(()=>{"use strict";var e={n:t=>{var r=t&&t.__esModule?()=>t.default:()=>t;return e.d(r,{a:r}),r},d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{store:()=>C});var r={};e.r(r),e.d(r,{closeModal:()=>g,disableComplementaryArea:()=>u,enableComplementaryArea:()=>l,openModal:()=>A,pinItem:()=>p,setDefaultComplementaryArea:()=>c,setFeatureDefaults:()=>f,setFeatureValue:()=>y,toggleFeature:()=>m,unpinItem:()=>d});var n={};e.r(n),e.d(n,{getActiveComplementaryArea:()=>v,isComplementaryAreaLoading:()=>E,isFeatureActive:()=>b,isItemPinned:()=>M,isModalActive:()=>_});const s=window.wp.data,a=window.wp.deprecated;var o=e.n(a);const i=window.wp.preferences,c=(e,t)=>({type:"SET_DEFAULT_COMPLEMENTARY_AREA",scope:e,area:t}),l=(e,t)=>({registry:r,dispatch:n})=>{t&&(r.select(i.store).get(e,"isComplementaryAreaVisible")||r.dispatch(i.store).set(e,"isComplementaryAreaVisible",!0),n({type:"ENABLE_COMPLEMENTARY_AREA",scope:e,area:t}))},u=e=>({registry:t})=>{t.select(i.store).get(e,"isComplementaryAreaVisible")&&t.dispatch(i.store).set(e,"isComplementaryAreaVisible",!1)},p=(e,t)=>({registry:r})=>{if(!t)return;const n=r.select(i.store).get(e,"pinnedItems");!0!==(null==n?void 0:n[t])&&r.dispatch(i.store).set(e,"pinnedItems",{...n,[t]:!0})},d=(e,t)=>({registry:r})=>{if(!t)return;const n=r.select(i.store).get(e,"pinnedItems");r.dispatch(i.store).set(e,"pinnedItems",{...n,[t]:!1})};function m(e,t){return function({registry:r}){o()("dispatch( 'core/interface' ).toggleFeature",{since:"6.0",alternative:"dispatch( 'core/preferences' ).toggle"}),r.dispatch(i.store).toggle(e,t)}}function y(e,t,r){return function({registry:n}){o()("dispatch( 'core/interface' ).setFeatureValue",{since:"6.0",alternative:"dispatch( 'core/preferences' ).set"}),n.dispatch(i.store).set(e,t,!!r)}}function f(e,t){return function({registry:r}){o()("dispatch( 'core/interface' ).setFeatureDefaults",{since:"6.0",alternative:"dispatch( 'core/preferences' ).setDefaults"}),r.dispatch(i.store).setDefaults(e,t)}}function A(e){return{type:"OPEN_MODAL",name:e}}function g(){return{type:"CLOSE_MODAL"}}const v=(0,s.createRegistrySelector)((e=>(t,r)=>{var n;const s=e(i.store).get(r,"isComplementaryAreaVisible");if(void 0!==s)return!1===s?null:null==t||null===(n=t.complementaryAreas)||void 0===n?void 0:n[r]})),E=(0,s.createRegistrySelector)((e=>(t,r)=>{var n;const s=e(i.store).get(r,"isComplementaryAreaVisible"),a=null==t||null===(n=t.complementaryAreas)||void 0===n?void 0:n[r];return s&&void 0===a})),M=(0,s.createRegistrySelector)((e=>(t,r,n)=>{var s;const a=e(i.store).get(r,"pinnedItems");return null===(s=null==a?void 0:a[n])||void 0===s||s})),b=(0,s.createRegistrySelector)((e=>(t,r,n)=>(o()("select( 'core/interface' ).isFeatureActive( scope, featureName )",{since:"6.0",alternative:"select( 'core/preferences' ).get( scope, featureName )"}),!!e(i.store).get(r,n))));function _(e,t){return e.activeModal===t}const h=(0,s.combineReducers)({complementaryAreas:function(e={},t){switch(t.type){case"SET_DEFAULT_COMPLEMENTARY_AREA":{const{scope:r,area:n}=t;return e[r]?e:{...e,[r]:n}}case"ENABLE_COMPLEMENTARY_AREA":{const{scope:r,area:n}=t;return{...e,[r]:n}}}return e},activeModal:function(e=null,t){switch(t.type){case"OPEN_MODAL":return t.name;case"CLOSE_MODAL":return null}return e}}),C=(0,s.createReduxStore)("core/interface",{reducer:h,actions:r,selectors:n});(0,s.register)(C),(window.kubio=window.kubio||{}).interfaceStore=t})();
