"use strict";(self.webpackChunkextendify=self.webpackChunkextendify||[]).push([[123],{9272:(e,t,n)=>{n.d(t,{_:()=>c,p:()=>d});var r=n(424),o=n(619),a=n(2200);const{showAIConsent:s,userGaveConsent:i}=r.y.getState(),l=["siteId","partnerId","wpVersion","wpLanguage","devbuild","isBlockTheme","userId"],u={...Object.fromEntries(Object.entries(window.extSharedData).filter((([e])=>l.includes(e)))),showAIConsent:s,userGaveConsent:i},c=async e=>{const t=new URLSearchParams({...u,query:e}),n=await fetch(`${a.Yy}/api/draft/image/unsplash?${t.toString()}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error("Bad response from server");const r=await n.json();if(!Array.isArray(r))throw new Error("Bad response from server");return r.map((e=>({...e,requestMetadata:{id:n.headers.get("X-Request-Id"),total:n.headers.get("X-Total"),perPage:n.headers.get("X-Per-Page")}})))},d=async()=>{var e;const t=o.f.getState();if(!t.isEmpty()&&!t.hasExpired())return t.images;const{aiKeywords:n}=null!==(e=window.extSharedData?.siteProfile)&&void 0!==e?e:{},r=n?.length?n:[],a=(await Promise.all(r.map(c))).flat(),s=a.reduce(((e,t)=>(e.has(t.id)||e.set(t.id,t),e)),new Map);return t.updateCache(Array.from(s.values())),a}},6749:(e,t,n)=>{var r=n(9818),o=n(9272);(e=>{const t=`WP_PREFERENCES_USER_${window.extSharedData.userId}`,n=window.localStorage.getItem(t)||"{}";if(window.localStorage.setItem(t,JSON.stringify({...JSON.parse(n),"core/edit-post":{...null!==(e=JSON.parse(n)?.["core/edit-post"])&&void 0!==e?e:{},welcomeGuide:!1}})),"extendify-launch"===new URLSearchParams(window.location.search).get("page"))return;(0,o.p)();const a=document.createElement("style");a.innerHTML=".components-modal__screen-overlay { display: none!important }",document.head.appendChild(a);const s=(0,r.subscribe)((()=>{const e=document.querySelector(".editor-start-page-options__modal-content");e&&(e.style.display="",document.querySelector(".components-modal__header > .components-button")?.click())}));setTimeout((()=>{document.head.removeChild(a),s()}),3e3)})()},424:(e,t,n)=>{n.d(t,{y:()=>l});var r=n(6989),o=n.n(r),a=n(270),s=n(782);const i={setItem:(e,t)=>o()({path:"/extendify/v1/shared/update-user-meta",method:"POST",data:{option:"ai_consent",value:t.state.userGaveConsent}})},l=(0,a.Ue)((0,s.tJ)((0,s.mW)(((e,t)=>{var n,r,o;return{showAIConsent:null!==(n=window.extSharedData?.showAIConsent)&&void 0!==n&&n,consentTermsHTML:null!==(r=window.extSharedData?.consentTermsHTML)&&void 0!==r?r:"",userGaveConsent:null!==(o=window.extSharedData?.userGaveConsent)&&void 0!==o&&o,setUserGaveConsent:t=>e({userGaveConsent:t}),shouldShowAIConsent:e=>{var n;const{showAIConsent:r,consentTermsHTML:o,userGaveConsent:a}=t(),s=r&&o,i={launch:s,draft:s&&!a,"help-center":s&&!a};return null!==(n=i?.[e])&&void 0!==n&&n}}}),{name:"Extendify AI Consent"}),{name:"extendify-ai-consent",storage:i,skipHydration:!0}))},619:(e,t,n)=>{n.d(t,{f:()=>a});var r=n(270),o=n(782);const a=(0,r.Ue)((0,o.tJ)((0,o.mW)(((e,t)=>({images:[],expiration:0,isEmpty:()=>0===t().images.length,hasExpired:()=>Date.now()>t().expiration,updateCache:t=>e({images:t,expiration:Date.now()+6048e5})})),{name:"Extendify Unsplash Images"}),{name:"extendify-unsplash-images",storage:(0,o.FL)((()=>localStorage))}))},2200:(e,t,n)=>{n.d(t,{Ow:()=>s,Yy:()=>a,kE:()=>r,nX:()=>o});const r="https://patterns.extendify.com",o="https://kb.extendify.com",a="https://ai.extendify.com",s="https://insights.extendify.com"},3250:(e,t,n)=>{var r=n(9196),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=r.useState,s=r.useEffect,i=r.useLayoutEffect,l=r.useDebugValue;function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!o(e,n)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),o=r[0].inst,c=r[1];return i((function(){o.value=n,o.getSnapshot=t,u(o)&&c({inst:o})}),[e,n,t]),s((function(){return u(o)&&c({inst:o}),e((function(){u(o)&&c({inst:o})}))}),[e]),l(n),n};t.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:c},139:(e,t,n)=>{var r=n(9196),o=n(1688),a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=o.useSyncExternalStore,i=r.useRef,l=r.useEffect,u=r.useMemo,c=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var d=i(null);if(null===d.current){var p={hasValue:!1,value:null};d.current=p}else p=d.current;d=u((function(){function e(e){if(!l){if(l=!0,s=e,e=r(e),void 0!==o&&p.hasValue){var t=p.value;if(o(t,e))return i=t}return i=e}if(t=i,a(s,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(s=e,i=n)}var s,i,l=!1,u=void 0===n?null:n;return[function(){return e(t())},null===u?void 0:function(){return e(u())}]}),[t,n,r,o]);var v=s(e,d[0],d[1]);return l((function(){p.hasValue=!0,p.value=v}),[v]),c(v),v}},1688:(e,t,n)=>{e.exports=n(3250)},2798:(e,t,n)=>{e.exports=n(139)},9196:e=>{e.exports=window.React},6989:e=>{e.exports=window.wp.apiFetch},9818:e=>{e.exports=window.wp.data},270:(e,t,n)=>{n.d(t,{Ue:()=>d});const r=e=>{let t;const n=new Set,r=(e,r)=>{const o="function"==typeof e?e(t):e;if(!Object.is(o,t)){const e=t;t=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},t,o),n.forEach((n=>n(t,e)))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>s,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},s=t=e(r,o,a);return a};var o=n(9196),a=n(2798);const{useDebugValue:s}=o,{useSyncExternalStoreWithSelector:i}=a;let l=!1;const u=e=>e,c=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t="function"==typeof e?(e=>e?r(e):r)(e):e,n=(e,n)=>function(e,t=u,n){n&&!l&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),l=!0);const r=i(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return s(r),r}(t,e,n);return Object.assign(n,t),n},d=e=>e?c(e):c},782:(e,t,n)=>{n.d(t,{FL:()=>i,mW:()=>a,tJ:()=>u});const r=new Map,o=e=>{const t=r.get(e);return t?Object.fromEntries(Object.entries(t.stores).map((([e,t])=>[e,t.getState()]))):{}},a=(e,t={})=>(n,a,i)=>{const{enabled:l,anonymousActionType:u,store:c,...d}=t;let p;try{p=(null==l||l)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!p)return l&&console.warn("[zustand devtools middleware] Please install/enable Redux devtools extension"),e(n,a,i);const{connection:v,...f}=((e,t,n)=>{if(void 0===e)return{type:"untracked",connection:t.connect(n)};const o=r.get(n.name);if(o)return{type:"tracked",store:e,...o};const a={connection:t.connect(n),stores:{}};return r.set(n.name,a),{type:"tracked",store:e,...a}})(c,p,d);let m=!0;i.setState=(e,t,r)=>{const s=n(e,t);if(!m)return s;const l=void 0===r?{type:u||"anonymous"}:"string"==typeof r?{type:r}:r;return void 0===c?(null==v||v.send(l,a()),s):(null==v||v.send({...l,type:`${c}/${l.type}`},{...o(d.name),[c]:i.getState()}),s)};const h=(...e)=>{const t=m;m=!1,n(...e),m=t},g=e(i.setState,a,i);if("untracked"===f.type?null==v||v.init(g):(f.stores[f.store]=i,null==v||v.init(Object.fromEntries(Object.entries(f.stores).map((([e,t])=>[e,e===f.store?g:t.getState()]))))),i.dispatchFromDevtools&&"function"==typeof i.dispatch){let e=!1;const t=i.dispatch;i.dispatch=(...n)=>{"__setState"!==n[0].type||e||(console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'),e=!0),t(...n)}}return v.subscribe((e=>{var t;switch(e.type){case"ACTION":return"string"!=typeof e.payload?void console.error("[zustand devtools middleware] Unsupported action format"):s(e.payload,(e=>{if("__setState"!==e.type)i.dispatchFromDevtools&&"function"==typeof i.dispatch&&i.dispatch(e);else{if(void 0===c)return void h(e.state);1!==Object.keys(e.state).length&&console.error('\n [zustand devtools middleware] Unsupported __setState action format. \n When using \'store\' option in devtools(), the \'state\' should have only one key, which is a value of \'store\' that was passed in devtools(),\n and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }\n ');const t=e.state[c];if(null==t)return;JSON.stringify(i.getState())!==JSON.stringify(t)&&h(t)}}));case"DISPATCH":switch(e.payload.type){case"RESET":return h(g),void 0===c?null==v?void 0:v.init(i.getState()):null==v?void 0:v.init(o(d.name));case"COMMIT":return void 0===c?void(null==v||v.init(i.getState())):null==v?void 0:v.init(o(d.name));case"ROLLBACK":return s(e.state,(e=>{if(void 0===c)return h(e),void(null==v||v.init(i.getState()));h(e[c]),null==v||v.init(o(d.name))}));case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return s(e.state,(e=>{void 0!==c?JSON.stringify(i.getState())!==JSON.stringify(e[c])&&h(e[c]):h(e)}));case"IMPORT_STATE":{const{nextLiftedState:n}=e.payload,r=null==(t=n.computedStates.slice(-1)[0])?void 0:t.state;if(!r)return;return h(void 0===c?r:r[c]),void(null==v||v.send(null,n))}case"PAUSE_RECORDING":return m=!m}return}})),g},s=(e,t)=>{let n;try{n=JSON.parse(e)}catch(e){console.error("[zustand devtools middleware] Could not parse the received json",e)}void 0!==n&&t(n)};function i(e,t){let n;try{n=e()}catch(e){return}return{getItem:e=>{var r;const o=e=>null===e?null:JSON.parse(e,null==t?void 0:t.reviver),a=null!=(r=n.getItem(e))?r:null;return a instanceof Promise?a.then(o):o(a)},setItem:(e,r)=>n.setItem(e,JSON.stringify(r,null==t?void 0:t.replacer)),removeItem:e=>n.removeItem(e)}}const l=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then:e=>l(e)(n),catch(e){return this}}}catch(e){return{then(e){return this},catch:t=>l(t)(e)}}},u=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?(console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),((e,t)=>(n,r,o)=>{let a={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},s=!1;const i=new Set,u=new Set;let c;try{c=a.getStorage()}catch(e){}if(!c)return e(((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)}),r,o);const d=l(a.serialize),p=()=>{const e=a.partialize({...r()});let t;const n=d({state:e,version:a.version}).then((e=>c.setItem(a.name,e))).catch((e=>{t=e}));if(t)throw t;return n},v=o.setState;o.setState=(e,t)=>{v(e,t),p()};const f=e(((...e)=>{n(...e),p()}),r,o);let m;const h=()=>{var e;if(!c)return;s=!1,i.forEach((e=>e(r())));const t=(null==(e=a.onRehydrateStorage)?void 0:e.call(a,r()))||void 0;return l(c.getItem.bind(c))(a.name).then((e=>{if(e)return a.deserialize(e)})).then((e=>{if(e){if("number"!=typeof e.version||e.version===a.version)return e.state;if(a.migrate)return a.migrate(e.state,e.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}})).then((e=>{var t;return m=a.merge(e,null!=(t=r())?t:f),n(m,!0),p()})).then((()=>{null==t||t(m,void 0),s=!0,u.forEach((e=>e(m)))})).catch((e=>{null==t||t(void 0,e)}))};return o.persist={setOptions:e=>{a={...a,...e},e.getStorage&&(c=e.getStorage())},clearStorage:()=>{null==c||c.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>s,onHydrate:e=>(i.add(e),()=>{i.delete(e)}),onFinishHydration:e=>(u.add(e),()=>{u.delete(e)})},h(),m||f})(e,t)):((e,t)=>(n,r,o)=>{let a={storage:i((()=>localStorage)),partialize:e=>e,version:0,merge:(e,t)=>({...t,...e}),...t},s=!1;const u=new Set,c=new Set;let d=a.storage;if(!d)return e(((...e)=>{console.warn(`[zustand persist middleware] Unable to update item '${a.name}', the given storage is currently unavailable.`),n(...e)}),r,o);const p=()=>{const e=a.partialize({...r()});return d.setItem(a.name,{state:e,version:a.version})},v=o.setState;o.setState=(e,t)=>{v(e,t),p()};const f=e(((...e)=>{n(...e),p()}),r,o);let m;o.getInitialState=()=>f;const h=()=>{var e,t;if(!d)return;s=!1,u.forEach((e=>{var t;return e(null!=(t=r())?t:f)}));const o=(null==(t=a.onRehydrateStorage)?void 0:t.call(a,null!=(e=r())?e:f))||void 0;return l(d.getItem.bind(d))(a.name).then((e=>{if(e){if("number"!=typeof e.version||e.version===a.version)return[!1,e.state];if(a.migrate)return[!0,a.migrate(e.state,e.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}return[!1,void 0]})).then((e=>{var t;const[o,s]=e;if(m=a.merge(s,null!=(t=r())?t:f),n(m,!0),o)return p()})).then((()=>{null==o||o(m,void 0),m=r(),s=!0,c.forEach((e=>e(m)))})).catch((e=>{null==o||o(void 0,e)}))};return o.persist={setOptions:e=>{a={...a,...e},e.storage&&(d=e.storage)},clearStorage:()=>{null==d||d.removeItem(a.name)},getOptions:()=>a,rehydrate:()=>h(),hasHydrated:()=>s,onHydrate:e=>(u.add(e),()=>{u.delete(e)}),onFinishHydration:e=>(c.add(e),()=>{c.delete(e)})},a.skipHydration||h(),m||f})(e,t)}},e=>{e(e.s=6749)}]);