"use strict";(globalThis.webpackChunkextendify=globalThis.webpackChunkextendify||[]).push([[847],{8187(e,t,a){var n=a(6001);const i=n._H3({name:n.YjP(),code:n.YjP(),patternTypes:n.YOg(n.YjP()),contentGenerated:n.zMY().optional(),navSlug:n.YjP().optional(),navLabel:n.YjP().optional()}),s=n._H3({id:n.YjP(),slug:n.YjP(),headerCode:n.YjP().optional(),footerCode:n.YjP().optional(),patterns:n.YOg(i)}),r=n._H3({home:s}),o=n._H3({siteImages:n.YOg(n.YjP())}),l=n._H3({logoUrl:n.OZ5()}),c=n._H3({id:n.YjP(),slug:n.YjP(),name:n.YjP(),patterns:n.YOg(i),siteStyle:n.Ikc()}),d=n._H3({pages:n.YOg(c)}),u=n._H3({name:n.YjP(),wordpressSlug:n.YjP()}),p=n.Ikc({sitePlugins:n.YOg(u)}),g=n._H3({type:n.YjP(),title:n.YjP(),description:n.YjP(),descriptionRaw:n.YjP().optional(),objective:n.YjP(),category:n.YjP().optional(),structure:n.YjP(),imageSearchTerms:n.YOg(n.YjP()),tone:n.YOg(n.YjP()),logoObjectName:n.YjP(),products:n.KCZ([n.YjP(),n.euz(!1)]),appointments:n.zMY(),events:n.zMY(),donations:n.zMY(),multilingual:n.zMY(),contact:n.zMY(),address:n.KCZ([n.zMY(),n.YjP()]),blog:n.zMY(),landingPage:n.zMY(),landingPageCTALink:n.KCZ([n.euz(!1),n.YjP()]),phoneNumber:n.KCZ([n.zMY(),n.YjP()]).optional()}),m=n._H3({aiHeaders:n.YOg(n.YjP()),aiBlogTitles:n.YOg(n.YjP())}),f=n._H3({vibe:n.YjP(),fonts:n._H3(),variation:n._H3(),colorPalette:n.YjP(),animation:n.YjP()}),h=n.Ikc({siteStyle:f.extend({variation:n._H3().optional()})}),y=n._H3({siteProfile:g,pages:n.YOg(n.Ikc({slug:n.YjP(),name:n.YjP(),description:n.YjP().optional()})),patternId:n.YjP(),headerCode:n.YjP(),siteStyle:f.omit({variation:!0}),selectedPlugins:n.YOg(u),html:n.YjP(),patternCode:n.YjP(),logoUrl:n.OZ5().nullish()});var w=a(1522),x=a(1455),b=a.n(x),v=a(7723),j=a(3832);const C=["header","header-with-center-nav-and-social","header-atlas-beacon","header-ember-harbor","header-catalina-skyline","header-ceadar-peak"],_=["header-center-nav-with-phone"],S=["footer","footer-social-icons","footer-with-center-logo-and-menu"],P=["footer-with-nav","footer-with-center-logo-social-nav"],k=(e,t)=>b()({path:"/extendify/v1/auto-launch/options",method:"POST",data:{option:e,value:t}}),T=e=>b()({path:(0,j.addQueryArgs)("/extendify/v1/auto-launch/options",{option:e})}),O=e=>{try{return b()({path:`/wp/v2/pages/${e}`})}catch{return null}},N=async(e,t)=>{try{const a=e=>new Promise((t,a)=>{e.onload=()=>t(),e.onerror=()=>a(new Error("Failed to load image."))}),n=new Image;n.src=e,n.crossOrigin="anonymous",await a(n);const i=document.createElement("canvas");i.width=n.width,i.height=n.height;const s=i.getContext("2d");if(!s)return null;s.drawImage(n,0,0);const r=await new Promise((e,t)=>{i.toBlob(a=>{a?e(a):t(new Error("Failed to convert canvas to Blob."))},"image/jpeg")}),o=new FormData;return o.append("file",new File([r],t.filename,{type:"image/jpeg"})),o.append("alt_text",t.alt||""),o.append("caption",t.caption||""),o.append("status","publish"),await(e=>b()({path:"wp/v2/media",body:e,method:"POST"}))(o)}catch(e){return null}},M=e=>b()({path:"/wp/v2/posts",method:"POST",data:e}),Y=e=>b()({path:"/wp/v2/tags",method:"POST",data:e}),L=e=>b()({path:"/wp/v2/categories",method:"POST",data:e});var $=a(1621),E=a(7134),A=a(6528);const D=n.Ikc({title:n.YjP().optional().default("").catch(()=>""),description:n.YjP().optional().default("").catch(()=>""),type:n.YjP().optional().catch(()=>""),objective:n.YjP().optional().catch(()=>""),category:n.YjP().optional().catch(()=>""),structure:n.YjP().optional().catch(()=>""),tone:n.YOg(n.YjP()).optional().catch(()=>[]),products:n.KCZ([n.YjP(),n.euz(!1)]).optional().catch(()=>!1),appointments:n.zMY().optional().catch(()=>!1),events:n.zMY().optional().catch(()=>!1),donations:n.zMY().optional().catch(()=>!1),multilingual:n.zMY().optional().catch(()=>!1),contact:n.zMY().optional().catch(()=>!1),address:n.KCZ([n.zMY(),n.YjP()]).optional().catch(()=>!1),blog:n.zMY().optional().catch(()=>!1),"landing-page":n.YjP().optional().catch(()=>""),"cta-link":n.KCZ([n.zMY(),n.YjP()]).optional().catch(()=>!1),"build-id":n.YjP().optional().catch(()=>""),go:n.zMY().optional().catch(()=>!1)}),F=D.parse((0,A.N)(window.extLaunchData.urlParams)||{}),H=new URL(window.location.href);Object.keys(F).forEach(e=>{H.searchParams.delete(e)}),window.history.replaceState({},"",H.toString());const I=e=>{const{"landing-page":t,"cta-link":a,...n}=e,i={...n,landingPage:"clickthrough"===t||void 0,landingPageCTALink:a};return Object.fromEntries(Object.entries(i).filter(([,e])=>void 0!==e&&""!==e))},B=e=>Object.fromEntries(Object.keys(e.shape).map(e=>[e,void 0])),R={go:!1, // translators: this is for a action log UI. Keep it short statusMessages:[(0,v.__)("Booting things up","extendify-local")],errorMessage:null,errorCount:0,description:null,descriptionBackup:void 0,descriptionRaw:null,urlParams:{},siteProfile:{...B(g)},...B(l),...B(p),...B(h),...B(m),...B(o),...B(r),...B(d),...B(y),designBuild:void 0,attempt:1},z=(e,t)=>({...R,urlParams:{...R.urlParams,...F},title:void 0,description:void 0,descriptionBackup:void 0,descriptionRaw:void 0,pulse:!1,setPulse:t=>e({pulse:t}),setData:(a,n)=>{V(a)&&t()[a]!==n&&e({[a]:n})},addStatusMessage:a=>{const n=t().statusMessages.filter(e=>e!==a);e({statusMessages:[...n,a]})},setErrorMessage:t=>{e(e=>({errorMessage:t,errorCount:e.errorCount+1}))},needToStall:()=>t().errorCount>6,resetErrorCount:()=>{e({errorCount:0})},reset:({exclude:a})=>{const n={...R,attempt:t().attempt+1};a&&Array.isArray(a)&&a.forEach(e=>{V(e)&&(n[e]=t()[e])}),b()({path:"/extendify/v1/shared/site-images/clear",method:"POST"}).catch(()=>null),e(n)}}),V=e=>Object.keys(R).includes(e),U={urlParams:D,siteProfile:g,...Object.fromEntries([l,p,h,m,o,r,d,y].flatMap(e=>Object.entries(e.shape)))},Z=(0,$.vt)((0,E.Zr)((0,E.lt)(z,{name:"Extendify Launch Data"}),{name:`extendify-launch-data-${window.extSharedData.siteId}`,merge:(e,t)=>{const a=e&&"object"==typeof e?e:{},n=Object.fromEntries(Object.entries(a).filter(([e])=>e in U).map(([e,t])=>{const a=U[e].safeParse(t);return[e,a.success?a.data:void 0]})),{title:i,description:s,go:r,...o}=I(F);return{...t,...a,...n,title:i||a.title,description:s||a.description,descriptionRaw:s||a.descriptionRaw,descriptionBackup:a.descriptionBackup||s||i,go:r||a.go,urlParams:{title:i,description:s,go:r,...o}}},onRehydrateStorage:()=>e=>{e&&queueMicrotask(()=>{Z.setState(e)})},partialize:e=>{const{statusMessages:t,errorMessage:a,errorCount:n,pulse:i,description:s,descriptionRaw:r,title:o,...l}=e;return Object.fromEntries(Object.entries(l).filter(([,e])=>Array.isArray(e)?e.length>0:Boolean(e)))}}),z);var J=a(8223);const G=e=>{Z.getState().addStatusMessage(e)},W=e=>{Z.getState().setErrorMessage(e)},Q=async e=>{try{return await e()}catch(t){W( // translators: This is an error message shown to the user when a network request fails and is being retried // translators: This is an error message shown to the user when a network request fails and is being retried (0,v.__)("The network seems unstable. Retrying...","extendify-local")),await K(1e3);const a=await e();return W(null),a}},q=async(e,t,a={})=>{try{return await e()}catch(e){return(0,J.b)({...a,error:a?.error??e,source:"auto-launch"}),t}},K=e=>new Promise(t=>setTimeout(t,e));async function X(e={},t=3e4){const a=new AbortController,{signal:n}=a,i=setTimeout(()=>a.abort(),t);try{return await b()({...e,signal:n})}finally{clearTimeout(i)}}const ee=async(e,t={},a=6e4)=>{const n=new AbortController,{signal:i}=n,s=setTimeout(()=>n.abort(),a);try{return await fetch(e,{...t,signal:i})}finally{clearTimeout(s)}};var te=a(8969),ae=a(1994),ne=a(6480);const{showAILogo:ie}=window.extSharedData,se={logoUrl:"https://images.extendify-cdn.com/demo-content/logos/ext-custom-logo-default.webp"},re=`${te.AY}/api/site-profile/generate-logo`,oe={"Content-Type":"application/json"},le=async e=>{const t=await(await fetch(e)).blob(),a=t.type,n=a.replace("image/",""),i=`ext-custom-logo-${Date.now()}`,s=new File([t],`${i}.${n}`,{type:a});await(0,ne.uploadMedia)({filesList:[s],onFileChange:async([e])=>{e?.id&&await k("site_logo",e.id)},onError:e=>{console.error("Error uploading logo:",e),(0,J.b)({error:e,details:{source:"auto-launch",caller:"uploadLogo"}})}})};var ce=a(365);const de=async({slug:e,fonts:t},a)=>{const{fallback:n=!1}=a||{},i=(await X({path:"wp/v2/global-styles/themes/extendable/variations"})).filter(e=>(e.settings?.color||e.styles?.color)&&(e.settings?.typography||e.styles?.typography));let s=i.find(t=>(t.slug||t.title.toLowerCase().trim().replace(/\s+/g,"-"))===e);return!s&&n&&(s=i.sort(()=>Math.random()-.5)[0]),t?(0,ce.$N)(s,{styles:{elements:{heading:{typography:{fontFamily:`var(--wp--preset--font-family--${t.heading.slug})`}}},typography:{fontFamily:`var(--wp--preset--font-family--${t.body.slug})`}},settings:{typography:{fontFamilies:{custom:[t.heading,t.body].filter(e=>!!e.host)}}}}):s};var ue=a(9700);const pe=null,ge={"Content-Type":"application/json"},me=async({urlParams:e})=>{const t=e?.["build-id"];if(!t)return pe; // translators: this is for a action log UI. Keep it short G((0,v.__)("Loading your design","extendify-local"));const a=`${te.AY}/api/design/${encodeURIComponent(t)}`,n=await Q(()=>ee(a,{headers:ge})).catch(e=>({ok:!1,statusText:e.message,status:0}));if(!n?.ok)return(0,J.b)({error:{message:n.statusText,name:"FetchError",status:n.status},details:{source:"auto-launch",caller:"handleDesignBuild"}}),pe;try{const e=y.parse(await n.json()),a=e.siteProfile;await k("extendify_site_profile",JSON.stringify(a)),(0,ue.j)("siteProfile",{siteProfile:a},!1);const i=e.siteStyle,s=i.fonts?.heading||i.fonts?.body?i.fonts:null,r=await de({slug:i.colorPalette,fonts:s},{fallback:!0}),o={...i,variation:r};await k("extendify_site_style",o),await k("extendify_animation_settings",{type:i.animation??"fade",speed:"medium"}),(0,ue.j)("siteStyle",h.parse({siteStyle:o}),!1);const c=e.selectedPlugins;(0,ue.j)("sitePlugins",p.parse({sitePlugins:c}),!1),await le(e.logoUrl),(0,ue.j)("siteLogo",l.parse({logoUrl:e.logoUrl}),!1);const d={buildId:t,...e,siteProfile:a,siteStyle:o};return{designBuild:d,...d}}catch(e){return(0,J.b)({error:e,details:{source:"auto-launch",caller:"handleDesignBuild::parsing"}}),console.error("handleDesignBuild:",e),Z.setState(e=>({urlParams:{...e.urlParams,"build-id":""}})),pe}},fe=`${te.zL}/api/home`,{wpLanguage:he,showImprint:ye}=window.extSharedData,we={"Content-Type":"application/json"},xe={siteImages:[]},be=`${te.a3}/api/search`,ve={"Content-Type":"application/json"},je=`${te.zL}/api/page-templates`,Ce={"Content-Type":"application/json"},_e=n._H3({recommended:n.YOg(c)}),{pluginGroupId:Se}=window.extSharedData,Pe={sitePlugins:[]},ke=`${te.AY}/api/site-plugins`,Te={"Content-Type":"application/json"},Oe=n.Ikc({selectedPlugins:n.YOg(u)}),Ne=async({siteProfile:e={},requiredOnly:t=!1,showStatus:a=!0})=>{a&& // translators: this is for a action log UI. Keep it short G((0,v.__)("Setting up site functionality","extendify-local"));const n=JSON.stringify({...ae.m,...e,siteProfile:e,siteObjective:e.objective,pluginGroupId:Se,requiredOnly:t}),i=await Q(()=>ee(ke,{method:"POST",headers:Te,body:n})).catch(e=>({ok:!1,statusText:e.message,status:0}));if(!i?.ok)return(0,J.b)({error:{message:i.statusText,name:"FetchError",status:i.status},details:{source:"auto-launch",caller:"handleSitePlugins"}}),Pe;const{selectedPlugins:s}=await q(async()=>Oe.parse(await i.json()),Pe,{caller:"handleSitePlugins"});return p.parse({sitePlugins:s})},Me=n.Ikc({siteProfile:g}),Ye=`${te.AY}/api/site-profile`,Le={"Content-Type":"application/json"},$e={aiHeaders:[],aiBlogTitles:[]},Ee=`${te.AY}/api/site-strings`,Ae={"Content-Type":"application/json"},De={siteStyle:{}},Fe=`${te.AY}/api/styles`,He={"Content-Type":"application/json"},Ie=n.YOg(f.omit({variation:!0})),Be=async({fontFamilyId:e,...t})=>{const a=`${t.fontFamilySlug}-${t.fontWeight}`;for(let n=0;n<=2;n++)try{n>0&&await(0,ce.yy)(1e3);const a=await b()({path:`/wp/v2/font-families/${e}/font-faces`,method:"POST",body:Ue(t)});return{id:a.id,...a.font_face_settings}}catch(e){if(n<=2){console.error(`Failed attempt to upload font file ${a}:`,e.message);continue}return void console.error(`Failed to upload font file ${a} after 3 attempts.`)}},Re=async e=>{const t=e.fontFace.map(async e=>{const t=await ze(e.src);if(t)return{...e,file:t}}),a=(await Promise.all(t)).filter(Boolean);if(!a.length)return;const n=await(async e=>{try{const t=(await b()({path:(0,j.addQueryArgs)("/wp/v2/font-families",{slug:e.slug,_embed:!0})}))?.[0];if(t)return{id:t.id,...t.font_family_settings,fontFace:t._embedded.font_faces.map(({id:e,font_face_settings:t})=>({id:e,...t}))};const a=await b()({path:"/wp/v2/font-families",method:"POST",body:Ve(e)});return{id:a.id,...a.font_family_settings,fontFace:a.fontFaces}}catch(e){return void console.error("Failed to register font family:",e.message)}})(e);if(!n)return;if(n?.fontFace?.length)return n;const i=a.map(e=>({fontFamilyId:n.id,fontFamilySlug:n.slug,...e})),s=[];for(const e of i)s.push(await Be(e));return{...n,fontFace:s.filter(Boolean)}},ze=async e=>{for(let t=0;t<=2;t++)try{t>0&&await(0,ce.yy)(1e3);const a=await fetch(e);if(!a.ok)throw new Error("Failed to fetch font file.");const n=await a.blob(),i=e.split("/").pop();return new File([n],i,{type:n.type})}catch(e){if(t<=2)continue;return}},Ve=({name:e,slug:t,fontFamily:a})=>{const n=new FormData,i={name:e,slug:t,fontFamily:a};return n.append("font_family_settings",JSON.stringify(i)),n},Ue=({fontFamilySlug:e,fontFamily:t,fontStyle:a,fontWeight:n,fontDisplay:i,unicodeRange:s,src:r=[],file:o=[]})=>{const l=new FormData,c={fontFamily:t,fontStyle:a,fontWeight:n,fontDisplay:i,unicodeRange:null==s?"":s,src:Array.isArray(r)?r:[r]};return(Array.isArray(o)?o:[o]).forEach(t=>{const i=`${e}-${n}-${a}`;l.append(i,t,t.name),r?.length?c.src=[i]:c.src.push(i)}),l.append("font_face_settings",JSON.stringify(c)),l},Ze={"Content-type":"application/json",Accept:"application/json","X-Extendify":"true"},{urlParams:Je}=window.extLaunchData,Ge=({stage:e,siteProfile:t={},sitePlugins:a=[],siteStyle:n={}}={})=>{const{type:i,category:s,structure:r,objective:o}=t,{siteId:l,partnerId:c,homeUrl:d,wpLanguage:u}=ae.m,p=Z.getState()?.attempt||1,g=JSON.stringify({...ae.m,autoLaunch:!0,stage:e,attempt:p,skippedDescription:Boolean(Je?.title||Je?.description),insightsId:l,hostpartner:c,siteURL:d,language:u,sitePlugins:a?.map(e=>e?.name),urlParameters:Je,siteStyle:n,style:n?.colorPalette,siteProfile:t,siteType:i,siteCategory:s,siteStructure:r,siteObjective:o,extra:{userAgent:window?.navigator?.userAgent,vendor:window?.navigator?.vendor||"unknown",platform:window?.navigator?.userAgentData?.platform||window?.navigator?.platform||"unknown",mobile:window?.navigator?.userAgentData?.mobile,width:window.innerWidth,height:window.innerHeight,screenHeight:window.screen.height,screenWidth:window.screen.width,orientation:window.screen.orientation?.type,touchSupport:"ontouchstart"in window||navigator.maxTouchPoints>0}});return fetch(`${te.Dq}/api/v1/launch`,{method:"POST",headers:Ze,body:g,keepalive:!0})};var We=a(8512),Qe=a(4997);const qe=[{slug:"shop",plugin:"woocommerce"},{slug:"events",plugin:"the-events-calendar"}],Ke=async(e,{stickyNav:t})=>{const a=[];for(const n of e){const e=[],i=new Set;G((0,v.sprintf)((0,v.__)("Adding page: %s","extendify-local"),n.name));for(const[t,a]of n.patterns.entries()){const t=a.code,n=a.patternTypes?.[0],{slug:s}=Object.values(We.Q).find(({alias:e})=>e.includes(n))||{},r=a.navSlug??s;!i.has(r)&&r?(i.add(r),e.push(Xe(t,r))):e.push(t)}const s={title:n.name,status:"publish",content:e.join(""),template:t?"no-title-sticky-header":"home"===n.slug?"no-title":"page-with-title",meta:{made_with_extendify_launch:!0}};let r;try{r=await et(s)}catch(e){s.template="no-title",r=await et(s)}a.push({...r,originalSlug:n.slug})}const n=a.find(({originalSlug:e})=>"home"===e);n&&(await k("show_on_front","page"),await k("page_on_front",n.id));const i=a.find(({originalSlug:e})=>"blog"===e);return i&&await k("page_for_posts",i.id),a},Xe=(e,t)=>e.replace(/(]*class="[^"]*\bwp-block-group\b[^"]*")/,`$1 id="${t}"`),et=e=>b()({path:"wp/v2/pages",data:e,method:"POST"}),tt=e=>b()({path:`wp/v2/pages/${e.id}`,data:e,method:"POST"});var at=a(6935);const nt=()=>b()({path:"extendify/v1/auto-launch/active-plugins"}),it=(e,t)=>e?.filter(e=>e.includes(t))?.length,st=async e=>{const t=async()=>{const t=await b()({path:"/wp/v2/plugins",method:"POST",data:{slug:e}});return await(0,at.yB)({slug:e,source:"auto-launch"}),t};try{return await t()}catch(a){if("folder_exists"===a?.code)return console.warn(`Plugin ${e} already installed. Attempting to activate...`),await rt(e);console.error(`Error installing ${e}. Retrying...`,a);try{return await t()}catch(t){console.error(`Failed ${e} again. Giving up`,t)}}},rt=async e=>{const t=await b()({path:(0,j.addQueryArgs)("/wp/v2/plugins",{search:e})});return t?.[0]},ot=async e=>{const t=e=>b()({path:`/wp/v2/plugins/${e}`,method:"POST",data:{status:"active"}});try{await t(e)}catch(a){console.warn(`Error activating ${e}. Retrying with fresh data...`);const{plugin:n}=await rt(e);try{await t(n)}catch(t){console.error(`Failed to activate ${e} again. Giving up`,t)}}},lt=async e=>{const t=(e=e.map(e=>e.patternTypes.includes("blog-section")&&e.patternReplacementCode?{...e,code:e.patternReplacementCode}:e)).filter(e=>e.patternReplacementCode);if(!t?.length)return e;const a=(await nt())?.data?.map(e=>e.split("/")[0])||[],n=e.filter(e=>e.pluginDependency).map(e=>e.pluginDependency).filter(e=>!a.includes(e));for(const e of n)(0,at.yB)({slug:e,source:"auto-launch"});try{return await ct(e)}catch(t){return await ct(e).catch(()=>e)}},ct=e=>b()({path:"/extendify/v1/shared/process-placeholders",method:"POST",data:{patterns:e}}),{homeUrl:dt}=window.extSharedData,ut=/href="(#extendify-[\w-]+)"/gi,pt=e=>e?.content?.raw?.match(ut),gt=async({pageContent:e,availablePages:t})=>{try{const a=await fetch(`${te.AY}/api/link-pages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ae.m,pageContent:e,availablePages:t})});if(!a.ok)throw new Error("Bad response from server");return await a.json()}catch(e){return{}}},mt=async({content:e="",title:t,slug:a})=>{const n=await b()({path:(0,j.addQueryArgs)("extendify/v1/auto-launch/get-navigation",{slug:a})}).catch(()=>{});return n?.id?n:await b()({path:"extendify/v1/auto-launch/create-navigation",method:"POST",data:{title:t,slug:a,content:e}})},ft=(e,t)=>b()({path:`wp/v2/navigation/${e}`,method:"POST",data:{content:t}}),ht=async(e,t,a,n=[],{orderedSlugs:i=[]}={})=>{const s=({slug:e})=>a.find(({originalSlug:t})=>t===e)||{},r=t.filter(e=>s(e)?.id).filter(({slug:e})=>"home"!==e).map(e=>s(e)),o=e=>e.originalSlug??e.slug,l=e=>{const t=o(e);return We.Q[t]?.navOrder??Object.values(We.Q).find(e=>e.alias?.includes(t))?.navOrder??Object.keys(We.Q).length+1},c=[...r,...n];let d;if(i.length){const e=e=>i.indexOf(o(e));d=[...c.filter(t=>-1!==e(t)).sort((t,a)=>e(t)-e(a)),...c.filter(t=>-1===e(t))]}else{const e=c.find(e=>{const t=o(e);return"contact"===t||We.Q.contact?.alias?.includes(t)}),t=c.filter(t=>t!==e).sort((e,t)=>l(e)-l(t));d=e?(()=>{const a=5===t.length?5:Math.min(4,t.length);return[...t.slice(0,a),e,...t.slice(a)]})():t}const u=d.map(({id:e,title:t,link:a,type:n})=>`\x3c!-- wp:navigation-link ${JSON.stringify({label:t.rendered,id:e,type:n,url:a,kind:e?"post-type":"custom",isTopLevelLink:!0})} /--\x3e`),p=u.slice(0,5).join(""),g=u.slice(5),m=g.length>1?` \x3c!-- wp:navigation-submenu ${JSON.stringify({ // translators: "More" here is used for a navigation menu item that contains additional links. label:(0,v.__)("More","extendify-local"),url:"#",kind:"custom"})} --\x3e ${g.join("")} \x3c!-- /wp:navigation-submenu --\x3e`:g.join("");await ft(e,p+m)},yt=e=>{try{return JSON.parse(e.match(//)[1])}catch(e){return{}}},wt=(e,t)=>{const a=JSON.stringify({...yt(e),...t});return e.replace(/()/gi,`\x3c!-- wp:navigation ${a} /--\x3e`)},xt=e=>{const t=e.patterns?.filter(e=>e.contentGenerated)??[],a=e.patterns?.filter(e=>!e.contentGenerated)??[];return{generated:t,toGenerate:{...e,patterns:a}}};var bt=a(7143);const{globalStylesPostID:vt}=window.extSharedData,jt=(e,t)=>b()({path:`wp/v2/template-parts/${e}`,method:"POST",data:{slug:e,theme:"extendable",type:"wp_template_part",status:"publish", // translators: Launch is the product name. Unless otherwise specified by the glossary, do not translate this name. description:(0,v.__)("Added by Launch","extendify-local"),content:t}}),Ct=(e,t)=>Object.fromEntries(Object.entries(e).map(([a,n])=>{if(!a.includes("--natural-1--"))return[a,{...n}];const i=((e,t)=>e.replace("--natural-1--",`--${t}--`))(a,t),s=e[i];return[a,s?{...s}:{...n}]}));var _t=a(6087),St=a(7581),Pt=a(4225);const{homeUrl:kt,showImprint:Tt,wpLanguage:Ot,installedPluginsSlugs:Nt}=window.extSharedData,Mt=()=>{const{setErrorMessage:e,addStatusMessage:t,needToStall:a,...n}=Z(),{setUserGaveConsent:i}=(0,St.D)(),c=(0,_t.useRef)(!1),[u,p]=(0,_t.useState)(!a()),[f,y]=(0,_t.useState)(!1);return((e=!0,t)=>{(0,_t.useEffect)(()=>{if(!e)return;const a=e=>(e.preventDefault(),t?.(),e.returnValue="",""),n={capture:!0};return window.addEventListener("beforeunload",a,n),()=>{window.removeEventListener("beforeunload",a,n)}},[e])})(u,()=>{Ge({stage:"exit_early"})}),Yt("designBuild",()=>n.urlParams?.["build-id"]?n:null,me),Yt("siteProfile",()=>n.descriptionRaw||n.title?n:null,async e=>(Ge({stage:"get_profile"}),await(async({title:e,descriptionRaw:t,urlParams:a})=>{ // translators: this is for a action log UI. Keep it short G((0,v.__)("Creating a site profile","extendify-local"));const n=JSON.stringify({...ae.m,title:e||window.extSharedData.siteTitle,description:t,autoLaunch:!0}),i=await ee(Ye,{method:"POST",headers:Le,body:n},2e4);if(!i?.ok)throw new Error("Failed to fetch site profile");const{profile:s}=await i.json(),r={...g.parse(s),...I(a),descriptionRaw:t};return await k("extendify_site_profile",JSON.stringify(r)),Me.parse({siteProfile:r})})(e))),Yt("siteLogo",()=>n.siteProfile?.title?n:null,async e=>(Ge({stage:"get_logo"}),await(async({siteProfile:e})=>{if(!ie)return se; // translators: this is for a action log UI. Keep it short G((0,v.__)("Generating a logo","extendify-local"));const{logoObjectName:t}=e,a=JSON.stringify({...ae.m,objectName:t}),n=await Q(()=>ee(re,{method:"POST",headers:oe,body:a})).catch(e=>({ok:!1,statusText:e.message,status:0}));if(!n?.ok)return(0,J.b)({error:{message:n.statusText,name:"FetchError",status:n.status},details:{source:"auto-launch",caller:"handleSiteLogo",objectName:t}}),se;const i=await q(async()=>{const{logoUrl:e}=l.parse(await n.json());return e},se.logoUrl,{caller:"handleSiteLogo"});return await le(i),l.parse({logoUrl:i})})(e))),Yt("sitePlugins",()=>n.siteProfile?.title?n:null,async e=>(Ge({stage:"get_plugins"}),await Ne(e))),(0,_t.useEffect)(()=>{if(!n.sitePlugins)return;const e=n.sitePlugins.filter(({wordpressSlug:e})=>!Nt?.includes(e));0!==e.length&&(G( // translators: this is for a action log UI. Keep it short // translators: this is for a action log UI. Keep it short (0,v.__)("Setting up functionality for your website","extendify-local")),async function(){for(const{wordpressSlug:t}of e){const e=await st(t);await ot(e?.plugin??t)}}())},[n.sitePlugins]),Yt("siteStyle",()=>n.siteProfile?.title?n:null,async e=>(Ge({stage:"get_style"}),await(async({siteProfile:e})=>{ // translators: this is for a action log UI. Keep it short G((0,v.__)("Picking the perfect design","extendify-local"));const t=JSON.stringify({...ae.m,siteProfile:e,count:1}),a=await Q(()=>ee(Fe,{method:"POST",headers:He,body:t},2e4)).catch(e=>({ok:!1,statusText:e.message,status:0}));return a?.ok?q(async()=>{const e=await a.json(),t=Ie.parse(e)[0],n=await de({slug:t.colorPalette,fonts:t.fonts},{fallback:!0}),i={...t,variation:n};return await k("extendify_site_style",i),await k("extendify_animation_settings",{type:t.animation??"fade",speed:"medium"}),h.parse({siteStyle:i})},De,{caller:"handleSiteStyle"}):((0,J.b)({error:{message:a.statusText,name:"FetchError",status:a.status},details:{source:"auto-launch",caller:"handleSiteStyle"}}),De)})(e))),Yt("siteStrings",()=>n.siteProfile?.title?n:null,async e=>(Ge({stage:"get_strings"}),await(async({siteProfile:e})=>{ // translators: this is for a action log UI. Keep it short G((0,v.__)("Generating site content ideas","extendify-local"));const t=JSON.stringify({...ae.m,siteProfile:e}),a=await Q(()=>ee(Ee,{method:"POST",headers:Ae,body:t}));return a?.ok?q(async()=>m.parse(await a.json()),$e,{caller:"handleSiteStrings"}):$e})(e))),Yt("siteImages",()=>n.siteProfile?.title?n:null,async e=>(Ge({stage:"get_images"}),await(async({siteProfile:e})=>{ // translators: this is for a action log UI. Keep it short G((0,v.__)("Finding the perfect images","extendify-local"));const t=JSON.stringify({...ae.m,siteProfile:e,source:"auto-launch"}),a=await Q(()=>ee(be,{method:"POST",headers:ve,body:t}));return a?.ok?q(async()=>o.parse(await a.json()),xe,{caller:"handleSiteImages"}):xe})(e))),Yt("home",()=>[n.siteProfile,n.siteStyle,n.siteImages,n.sitePlugins,n.aiHeaders].every(e=>void 0!==e)?n:null,async e=>(Ge({stage:"get_home"}),await(async({siteProfile:e,sitePlugins:t,siteImages:a,aiHeaders:n,designBuild:i})=>{ // translators: this is for a action log UI. Keep it short G((0,v.__)("Preparing your home page","extendify-local"));const o=JSON.stringify({...ae.m,siteProfile:e,siteImages:a,sitePlugins:t,aiHeaders:n,pages:i?.pages??[],buildId:i?.buildId}),l=await Q(()=>ee(fe,{method:"POST",headers:we,body:o})).catch(e=>({ok:!1,statusText:e.message,status:0}));if(!l?.ok)throw(0,J.b)({error:{message:l.statusText,name:"FetchError",status:l.status},details:{source:"auto-launch",caller:"handleHome"}}),new Error(l.statusText);const c=s.parse(await l.json());c.patterns=((e,t)=>t?.patternCode?[{name:t.patternId,code:t.patternCode,patternTypes:["hero-header"],contentGenerated:!0},...e]:e)(c.patterns,i),c.patterns=((e,t)=>{const a=t?.pages??[];if(!a.length)return e;let n=0;return e.map(e=>{if(e.patternTypes?.includes("hero-header"))return e;const t=a[n++];return t?{...e,navSlug:t.slug,navLabel:t.name}:e})})(c.patterns,i);const d=!!Array.isArray(ye)&&ye.includes(he??"")&&"Business"===e.category,{headers:u,footers:p}=await(async({useNavFooter:e=!1,siteProfile:t={}}={})=>{const a=await b()({path:"/wp/v2/template-parts"}),n=a.filter(({theme:e})=>"extendable"===e),i="home services"===t.type?_:C,s=n?.filter(({slug:e})=>i.includes(e)),r=e&&a?.some(({slug:e})=>P.includes(e))?P:S;return{headers:s,footers:n.filter(({slug:e})=>r.includes(e))}})({useNavFooter:d,siteProfile:e}),g=i?.headerCode??u[0]?.content?.raw?.trim()??"",m=p[0]?.content?.raw?.trim()??"";return r.parse({home:{...c,headerCode:g,footerCode:m}})})(e))),Yt("pages",()=>[n.siteProfile,n.siteStyle,n.siteImages,n.sitePlugins].every(e=>void 0!==e)?n:null,async e=>(Ge({stage:"get_pages"}),await(async({siteProfile:e,sitePlugins:t,siteStyle:a,siteImages:n,designBuild:i})=>{if("multi-page"!==e.structure)return{pages:[]}; // translators: this is for a action log UI. Keep it short G((0,v.__)("Preparing your pages","extendify-local"));const s=JSON.stringify({...ae.m,siteProfile:e,siteStyle:a,siteImages:{siteImages:n},sitePlugins:t,includeOptional:!1,pages:i?.pages??[],buildId:i?.buildId}),r=await Q(()=>ee(je,{method:"POST",headers:Ce,body:s})),o=((e,t)=>{const a=t?.pages?.map(e=>e.slug)??[];return a.length?[...a.map(t=>e.find(e=>e.slug===t)).filter(Boolean),...e.filter(e=>!a.includes(e.slug))]:e})(_e.parse(await r.json()).recommended,i);return d.parse({pages:o})})(e))),Yt("generalUpdates",()=>[n.siteProfile,n.home,n.pages].every(e=>void 0!==e)?n:null,async({siteProfile:e,sitePlugins:a,siteStyle:n})=>{Ge({stage:"set_general",siteProfile:e,sitePlugins:a,siteStyle:n});const{title:s}=e; // translators: this is for a action log UI. Keep it short t((0,v.__)("Adding admin configurations","extendify-local")),await k("permalink_structure","/%postname%/"),i(!0),s&&await k("blogname",s)}),Yt("pluginConfigurations",()=>n.sitePlugins?n:null,async()=>{Ge({stage:"set_plugin_config"});const e=await nt();if(it(e,"wpforms-lite")&&await k("wpforms_activation_redirect","skip"),it(e,"all-in-one-seo-pack")&&await k("aioseo_activation_redirect","skip"),it(e,"google-analytics-for-wordpress")){const e="_transient__monsterinsights_activation_redirect";await k(e,null)}}),(0,_t.useEffect)(()=>{if(a())return;const{home:i,pages:s,siteProfile:r,sitePlugins:o,siteStyle:l,aiBlogTitles:d,siteImages:u,designBuild:g}=n;i&&s&&(c.current||(c.current=!0,(async()=>{const{objective:e,structure:a,category:c}=r,m=!!Array.isArray(Tt)&&Tt.includes(Ot??"")&&"Business"===c,f=l?.variation?.settings?.typography?.fontFamilies?.custom;let h=l?.variation;if(f?.length){Ge({stage:"install_fonts"}), // translators: this is for a action log UI. Keep it short t((0,v.__)("Installing fonts locally","extendify-local"));const e=await(async e=>{const t=[];for(const a of e)t.push(await Re(a));return t.filter(Boolean)})(f).catch(()=>[]);h=((e,t)=>(0,ce.$N)(e,{settings:{typography:{fontFamilies:{custom:null}}}},{settings:{typography:{fontFamilies:{custom:t.filter(Boolean)}}}}))(l.variation,e)}if(l?.vibe&&"natural-1"!==l.vibe){ // translators: vibe in this context is a noun - the feeling of their site design. t((0,v.__)("Setting the website style","extendify-local")),Ge({stage:"compute_vibe"});const e=await(async e=>{if(!(e=>!!e&&"string"==typeof e&&""!==e.trim()&&"natural-1"!==e)(e))return null;const{styles:t}=await b()({path:"wp/v2/global-styles/themes/extendable?context=edit"});return t?.blocks?Object.fromEntries(Object.entries(t.blocks).map(([t,a])=>{if(!a?.variations)return[t,a];const{variations:n,...i}=a;return Object.keys(n).some(e=>e.includes("--natural-1--"))?[t,{...i,variations:Ct(n,e)}]:[t,a]})):null})(l.vibe).catch(()=>null);e&&(h={...h,styles:{...h.styles,blocks:e}})}Ge({stage:"set_vibe"}),await(e=>((e,t={})=>{const{settings:a,styles:n}=t;if(a&&n)return b()({path:`wp/v2/global-styles/${e}`,method:"POST",data:{id:e,settings:a,styles:n}})})(vt,e))(h),t((0,v.__)("Working on the navigation","extendify-local"));const{id:x}=await mt({title:(0,v.__)("Header Navigation","extendify-local"),slug:"site-navigation"});let j=wt(i.headerCode||"",{ref:x});if("landing-page"===e){ // translators: this is for a action log UI. Keep it short t((0,v.__)("Perfecting a landing page","extendify-local"));const e=//gis;j=j.replace(//gis,"").replace(e,"")}"string"==typeof r.phoneNumber&&(j=j.replaceAll("206-555-0100",r.phoneNumber|| // translators: Use a number that is appropriate for the locale. It does not need to be this exact number. This is a placeholder phone number. For example, in pt_BR you could use (11) 91234-5678. // translators: Use a number that is appropriate for the locale. It does not need to be this exact number. This is a placeholder phone number. For example, in pt_BR you could use (11) 91234-5678. (0,v.__)("206-555-0100","extendify-local"))),Ge({stage:"set_navigation"}),await jt("extendable/header",j);let C=null,_=i.footerCode||"";m&&(C=(await mt({title:(0,v.__)("Footer Navigation","extendify-local"),slug:"footer-navigation"})).id,_=wt(_,{ref:C})),Ge({stage:"set_footer"}),await jt("extendable/footer",_), // translators: this is for a action log UI. Keep it short t((0,v.__)("Creating pages","extendify-local"));const S=(e=>{const{home:t,pages:a,siteProfile:n}=e,i={id:"home",name:We.Q.home.title,slug:"home",patterns:t.patterns},s="blog"===n.objective?{name:We.Q.blog.title,id:"blog",patterns:[],slug:"blog"}:null,r=e=>!e.patternTypes?.includes("page-title");return[i,...a.map(e=>({...e,patterns:e.patterns.filter(r)})),s].filter(Boolean)})(n),P=s?.[0]?.patterns?.find(e=>e.patternTypes?.includes("page-title"));P&&(Ge({stage:"set_page_title_pattern"}),await(async e=>{const t=`\n\t\t\x3c!-- wp:template-part {"slug":"header","tagName":"header"} /--\x3e\n\t\t\x3c!-- wp:group {"tagName":"main","style":{"spacing":{"margin":{"top":"0px","bottom":"0px"},"blockGap":"0"}}} --\x3e\n\t\t
\n\t\t\t${(e=>{let t=!1;const a=e=>{if(t)return e;if("core/heading"===e.name){t=!0;const a={level:e.attributes.level,textAlign:e.attributes.textAlign,textColor:e.attributes.textColor,backgroundColor:e.attributes.backgroundColor,isLink:e.attributes.isLink,linkTarget:e.attributes.linkTarget,rel:e.attributes.rel};e.attributes.fontSize&&(a.fontSize=e.attributes.fontSize);const n=e.attributes.style?.typography?.fontSize,i=e.attributes.style?.elements?.link;return(n||i)&&(a.style={},n&&(a.style.typography={fontSize:n}),i&&(a.style.elements={link:i})),(0,Qe.createBlock)("core/post-title",a)}return e.innerBlocks?.length&&(e.innerBlocks=e.innerBlocks.map(a)),e};return(0,Qe.serialize)((0,Qe.parse)(e).map(a))})(e)}\n\t\t\t\x3c!-- wp:post-content {"layout":{"type":"constrained"}} /--\x3e\n\t\t
\n\t\t\x3c!-- /wp:group --\x3e\n\t\t\x3c!-- wp:template-part {"slug":"footer","tagName":"footer"} /--\x3e\n\t\t`;try{await b()({path:"/wp/v2/templates/extendable/page-with-title",method:"POST",data:{slug:"page-with-title",theme:"extendable",type:"wp_template",status:"publish",description:(0,v.__)("Added by Launch","extendify-local"),content:t}})}catch{}})(P.code));const k=await nt(),$=new Set(qe.filter(({plugin:e})=>o.some(t=>t.wordpressSlug===e)||it(k,e)).map(({slug:e})=>e)),E=S.filter(e=>!$.has(e.slug)),A=[];Ge({stage:"replace_placeholder_patterns"});for(const e of E){const t=await lt(e.patterns),a={...e,patterns:t};A.push(a)}Ge({stage:"generate_page_content"});const D=await(async(e,t)=>{const a=e.map(xt),n=await Promise.allSettled(a.map(({toGenerate:e})=>(async(e,t)=>{const{siteProfile:a}=t;return await Q(async()=>{const t=await fetch(`${te.AY}/api/patterns`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ae.m,siteProfile:a,page:e})});if(!t.ok)throw new Error(`Pattern generation failed with status ${t.status}`);return await t.json()})})(e,t).then(e=>e).catch(()=>e)));return n?.map((t,n)=>{const i=e[n],{generated:s}=a[n],r="fulfilled"===t.status&&t.value?{...i,...t.value}:i;return{...r,patterns:[...s,...r.patterns??[]]}})})(A,n),F="single-page"===a&&"landing-page"!==e,H=await Ke(D,{stickyNav:F}),I=i?.patterns?.some(e=>e.patternTypes.includes("blog-section"));("blog"===e||I)&&(Ge({stage:"create_blog_sample_data"}), // translators: this is for a action log UI. Keep it short t((0,v.__)("Creating blog sample data","extendify-local")),await(async(e,t)=>{const a=w[window.extSharedData?.wpLanguage||"en_US"]||w.en_US,n=await(async e=>{const t=[];for(const a of e){const e={name:a.name,slug:a.slug,description:a.description};let n;try{n=await L(e)}catch(e){}n?.id&&n?.slug&&t.push({id:n.id,slug:n.slug})}return t})(a.categories)||[],i=await(async e=>{const t=[];for(const a of e){const e={name:a.name,slug:a.slug,description:a.description};let n;try{n=await Y(e)}catch(e){}n?.id&&n?.slug&&t.push({id:n.id,slug:n.slug})}return t})(a.tags)||[],s=e=>e?.includes("?q=80&w=1470")?e:`${e}?q=80&w=1470`,r=(t||[]).sort(()=>Math.random()-.5),o=Array.from({length:8},(t,n)=>{return{name:e?.aiBlogTitles?.[n]|| // translators: %s is a post number // translators: %s is a post number (0,v.sprintf)((0,v.__)("Blog Post %s","extendify-local"),n+1),featured_image:r[n%r.length]?s(r[n%r.length]):null,post_content:(i=a.post_content,o=r,(i.match(/https:\/\/images\.unsplash\.com\/[^\s"]+/g)||[]).reduce((e,t,a)=>e.replace(t,s(o[a]||t)),i))};var i,o});for(const[e,t]of o.entries())try{const a=t.featured_image&&(await N(t.featured_image,{alt:"",filename:`featured-image-${e}.jpg`,caption:""}))?.id||null,s=n.length?n[e%n.length]?.id:[],r=e<4?[i.find(e=>"featured"===e.slug)?.id].filter(Boolean):[],o={title:t.name,content:t.post_content,status:"publish",featured_media:a||null,categories:s,tags:r,meta:{made_with_extendify_launch:!0}};await M(o)}catch(e){}})({aiBlogTitles:d},u)),u?.length&&(Ge({stage:"set_hello_world_image"}),await(async e=>{try{const t=window.extLaunchData?.helloWorldPostSlug;let a=await b()({path:`wp/v2/posts?slug=${t}`});if(a.length||(a=await b()({path:"wp/v2/posts?slug=hello-world"})),!a.length)return;const n=a[0];if(n.featured_media&&parseInt(n.featured_media,10)>0)return;if(!Array.isArray(e)||0===e.length)return void console.error("No image URLs provided.");const i=e[e.length-1],s=await N(i,{alt:(0,v.__)("Hello World Featured Image","extendify-local"),filename:"hello-world-featured.jpg",caption:""});if(!s||!s.id)return void console.error("Image upload failed.");await b()({path:`wp/v2/posts/${n.id}`,method:"POST",data:{featured_media:s.id}})}catch(e){console.error("Failed to set Hello World featured image:",e)}})(u));let B={};m&&(Ge({stage:"create_imprint"}),B=await(async({siteStyle:e})=>{try{const t=await(async({siteStyle:e})=>{const t=await fetch(`${te.zL}/api/page-imprint`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ae.m,siteStyle:e})});return{...(await t.json()).template}})({siteStyle:e}),[a]=await Ke([t],{stickyNav:!1});return a}catch(e){return console.error("Failed to add imprint page:",e),null}})({siteStyle:l}).catch(()=>null));const R=[];if(it(k,"woocommerce")){Ge({stage:"import_woocommerce_products"}),t( // translators: this is for a action log UI. Keep it short // translators: this is for a action log UI. Keep it short (0,v.__)("Setting up your online store","extendify-local")),await X({path:"/extendify/v1/auto-launch/import-woocommerce"}).catch(()=>null);const e=await T("woocommerce_shop_page_id"),a=e?await O(e):null;a&&R.push(a)}it(k,"the-events-calendar")&&R.push({title:{rendered:(0,v.__)("Events","extendify-local")},slug:"events",link:`${kt}/events`}),Ge({stage:"set_page_links"});const z="single-page"===a?await(async(e,t,a)=>{let n=e?.[0]?.content?.raw;if(!n)return e;const{objective:i,activePlugins:s,landingPageCTALink:r}=a;if("landing-page"===i){const t=r&&"string"==typeof r?r:"#";return e[0]=tt({id:e[0].id,content:n.replaceAll(/href="(#extendify-[\w|-]+)"/gi,`href="${t}"`)}),e}const o=t?.[0]?.patterns?.map(e=>e?.patternTypes?.[0])?.filter(e=>"hero-header"!==e)?.map(e=>{const{slug:t}=Object.values(We.Q).find(({alias:t})=>t.includes(e))||{};return t})?.filter(Boolean)?.flat(),l=t?.filter(e=>"home"!==e.slug)?.map(e=>e.slug)?.filter(Boolean)??[],c=[];if(it(s,"woocommerce")){const e=await O(await T("woocommerce_shop_page_id")).catch(()=>null);e?.slug&&c.push(e.slug)}it(s,"the-events-calendar")&&c.push("events");const d=(o??[]).concat(c);if(!d.length)return e[0]=tt({id:e[0].id,content:n.replaceAll(/href="(#extendify-[\w|-]+)"/gi,'href="#"')}),e;const{suggestedLinks:u}=await gt({pageContent:n,availablePages:d})||{};return n=Object.keys(u??{}).reduce((e,t)=>{const a=u[t];if(!a)return e;const n=c.concat(l).includes(a)?`"${dt}/${a}"`:`"${dt}/#${a}"`;return e.replaceAll(`"${t}"`,n)},n),e[0]=tt({id:e[0].id,content:n}),e})(H,D,{objective:e,activePlugins:k,landingPageCTALink:r.landingPageCTALink}):await(async(e,t)=>{const a=e.find(({originalSlug:e})=>e?.startsWith("contact"))?.slug,n=e.filter(pt).map(({content:e})=>(0,Qe.parse)(e.raw||"").map(e=>(0,Qe.getBlockContent)(e)).filter(e=>e.match(ut)).join("")),i=e.concat(t).filter(({slug:e})=>!e.startsWith("home")).map(({slug:e})=>`/${e}`),s=(await Promise.allSettled(n.map(e=>gt({pageContent:e,availablePages:i})||{}))).filter(e=>"fulfilled"===e.status).map(e=>e.value?.suggestedLinks||[]).reduce((e,t)=>{for(const a in t)e[a]=t[a];return e},{}),r=Object.keys(s).filter(e=>i.includes(`/${s[e].replace(/^\//,"")}`)).map(e=>`\\"${e}\\"`).join("|"),o=(await Promise.allSettled(e.filter(pt).map(e=>{const t=r?e.content.raw.replace(new RegExp(r,"g"),t=>{if(!t||0===s.length)return"";const n=s[t.replace(/"/g,"")];return[e.slug,`/${e.slug}`,"/"].includes(n)?`"${dt}/${a??""}"`:`"${dt}/${n.replace(/^\//,"")}"`}):e.content.raw.replace(new RegExp(ut,"g"),e=>e?'href="#"':"");return tt({id:e.id,content:t})}))).filter(e=>"fulfilled"===e.status).map(e=>e.value);return e.map(e=>o.find(({id:t})=>t===e.id)||e).map(t=>{const{originalSlug:a}=e.find(({id:e})=>e===t.id)||{};return{...t,originalSlug:a}})})(H,R),V=[];if(C&&B?.title){const{originalSlug:e,title:t}=B;V.push({id:e,name:t.rendered,slug:e,patterns:[]})}if(Ge({stage:"set_navigation_links"}),"landing-page"!==e){const e=g?.pages?.map(e=>e.slug)??[];"single-page"===a?await(async(e,t=[],a=[],n=[],{orderedSlugs:i=[]}={})=>{const s=a.map(({title:e})=>e?.rendered?.toLowerCase()),r=n?.filter(e=>"home"!==e?.slug)?.map(e=>e.slug)?.filter(Boolean)??[],o=e=>{const t=e.patternTypes?.[0],a=Object.values(We.Q).find(({alias:e})=>e.includes(t))||{};return{label:e.navLabel??a.title,slug:e.navSlug??a.slug}},l=t.filter(e=>{const{slug:t}=o(e);return t&&!s.includes(t)}),c=new Set,d=l.map(e=>{const{label:t,slug:a}=o(e);if(!a)return"";if(c.has(a))return"";c.add(a);const n=r.includes(a)?`${window.extSharedData.homeUrl}/${a}`:`${window.extSharedData.homeUrl}/#${a}`;return`\x3c!-- wp:navigation-link ${JSON.stringify({label:t,type:"custom",url:n,kind:"custom",isTopLevelLink:!0})} /--\x3e`}),u=a.map(({title:e,id:t,type:a,link:n})=>`\x3c!-- wp:navigation-link ${JSON.stringify({label:e.rendered,id:t,type:a,url:n,kind:t?"post-type":"custom",isTopLevelLink:!0})} /--\x3e`);let p;if(i.length){const e=new Map;d.forEach((t,a)=>{const n=o(l[a]).slug;n&&e.set(n,t)}),a.forEach((t,a)=>{t.slug&&e.set(t.slug,u[a])});const t=i.map(t=>e.get(t)).filter(Boolean),n=new Set(i.filter(t=>e.has(t)));p=[...t,...d.filter((e,t)=>!n.has(o(l[t]).slug)),...u.filter((e,t)=>!n.has(a[t].slug))].join("")}else p=d.concat(u).join("");await ft(e,p)})(x,i?.patterns,R,H,{orderedSlugs:e}):await ht(x,S,z,R,{orderedSlugs:e}),C&&await ht(C,V,B?.id?[...z,B]:z,[])}Ge({stage:"prefetch_assist_data"}),await(async()=>await b()({path:"extendify/v1/auto-launch/prefetch-assist-data"}))(),Ge({stage:"final_steps"}),await(e=>{const t=(0,bt.select)("core/preferences").get("core","renderingModes")||{};t?.extendable?.page!==e&&(0,bt.dispatch)("core/preferences").set("core","renderingModes",{...t,extendable:{...t.extendable||{},page:e}})})("template-locked"),await b()({path:"/extendify/v1/launch/post-launch-functions",method:"POST"}),u?.length&&await(e=>b()({path:"/extendify/v1/shared/site-images",method:"POST",data:{siteImages:e}}))(u).catch(()=>null), // translators: this is for a action log UI. Keep it short t((0,v.__)("All done!","extendify-local")),await Ge({stage:"finished",siteProfile:r,sitePlugins:o,siteStyle:l}),p(!1),y(!0)})().catch(t=>{console.error(t),(0,J.b)({error:t,details:{source:"auto-launch",caller:"create-site"}}),c.current=!1,a(!0),e((0,v.__)("Something went wrong during the final steps. We will try again but you may need to refresh the page.","extendify-local"))})))},[n,a,i]),{done:f}},Yt=(e,t,a)=>{const{setData:n,setErrorMessage:i,needToStall:s}=Z(),r=t?.()??null,{data:o,error:l}=(0,Pt.A)(r&&!s()?e:null,()=>a(t()));(0,_t.useEffect)(()=>{o&&Object.entries(o).forEach(([e,t])=>{n(e,t)})},[o,n]),(0,_t.useEffect)(()=>{l&&!s()&&(console.error(l),(0,J.b)({error:l,details:{source:"auto-launch",caller:"run-step"}}),i((0,v.__)("Having some trouble with this step. Trying again...","extendify-local")))},[l,i,s])};var Lt=a(790);const $t=(0,Lt.jsxs)("svg",{viewBox:"0 0 2524 492",xmlns:"http://www.w3.org/2000/svg",children:[(0,Lt.jsx)("title",{children:(0,v.__)("Extendify Logo","extendify-local")}),(0,Lt.jsx)("path",{d:"M609.404 378.5C585.07 378.5 563.404 373 544.404 362C525.737 350.667 511.07 335.333 500.404 316C489.737 296.333 484.404 273.833 484.404 248.5C484.404 222.833 489.57 200.167 499.904 180.5C510.237 160.833 524.737 145.5 543.404 134.5C562.07 123.167 583.404 117.5 607.404 117.5C632.404 117.5 653.904 122.833 671.904 133.5C689.904 143.833 703.737 158.333 713.404 177C723.404 195.667 728.404 218 728.404 244V262.5L516.404 263L517.404 224H667.904C667.904 207 662.404 193.333 651.404 183C640.737 172.667 626.237 167.5 607.904 167.5C593.57 167.5 581.404 170.5 571.404 176.5C561.737 182.5 554.404 191.5 549.404 203.5C544.404 215.5 541.904 230.167 541.904 247.5C541.904 274.167 547.57 294.333 558.904 308C570.57 321.667 587.737 328.5 610.404 328.5C627.07 328.5 640.737 325.333 651.404 319C662.404 312.667 669.57 303.667 672.904 292H729.404C724.07 319 710.737 340.167 689.404 355.5C668.404 370.833 641.737 378.5 609.404 378.5Z",fill:"currentColor"}),(0,Lt.jsx)("path",{d:"M797.529 372H728.029L813.029 251L728.029 125H799.029L853.529 209L906.029 125H974.529L890.529 250.5L972.029 372H902.029L849.029 290.5L797.529 372Z",fill:"currentColor"}),(0,Lt.jsx)("path",{d:"M994.142 125H1150.14V176H994.142V125ZM1102.64 372H1041.64V48H1102.64V372Z",fill:"currentColor"}),(0,Lt.jsx)("path",{d:"M1278.62 378.5C1254.29 378.5 1232.62 373 1213.62 362C1194.96 350.667 1180.29 335.333 1169.62 316C1158.96 296.333 1153.62 273.833 1153.62 248.5C1153.62 222.833 1158.79 200.167 1169.12 180.5C1179.46 160.833 1193.96 145.5 1212.62 134.5C1231.29 123.167 1252.62 117.5 1276.62 117.5C1301.62 117.5 1323.12 122.833 1341.12 133.5C1359.12 143.833 1372.96 158.333 1382.62 177C1392.62 195.667 1397.62 218 1397.62 244V262.5L1185.62 263L1186.62 224H1337.12C1337.12 207 1331.62 193.333 1320.62 183C1309.96 172.667 1295.46 167.5 1277.12 167.5C1262.79 167.5 1250.62 170.5 1240.62 176.5C1230.96 182.5 1223.62 191.5 1218.62 203.5C1213.62 215.5 1211.12 230.167 1211.12 247.5C1211.12 274.167 1216.79 294.333 1228.12 308C1239.79 321.667 1256.96 328.5 1279.62 328.5C1296.29 328.5 1309.96 325.333 1320.62 319C1331.62 312.667 1338.79 303.667 1342.12 292H1398.62C1393.29 319 1379.96 340.167 1358.62 355.5C1337.62 370.833 1310.96 378.5 1278.62 378.5Z",fill:"currentColor"}),(0,Lt.jsx)("path",{d:"M1484.44 372H1423.44V125H1479.94L1484.94 157C1492.61 144.667 1503.44 135 1517.44 128C1531.78 121 1547.28 117.5 1563.94 117.5C1594.94 117.5 1618.28 126.667 1633.94 145C1649.94 163.333 1657.94 188.333 1657.94 220V372H1596.94V234.5C1596.94 213.833 1592.28 198.5 1582.94 188.5C1573.61 178.167 1560.94 173 1544.94 173C1525.94 173 1511.11 179 1500.44 191C1489.78 203 1484.44 219 1484.44 239V372Z",fill:"currentColor"}),(0,Lt.jsx)("path",{d:"M1798.38 378.5C1774.38 378.5 1753.71 373.167 1736.38 362.5C1719.38 351.5 1706.04 336.333 1696.38 317C1687.04 297.667 1682.38 275.167 1682.38 249.5C1682.38 223.833 1687.04 201.167 1696.38 181.5C1706.04 161.5 1719.88 145.833 1737.88 134.5C1755.88 123.167 1777.21 117.5 1801.88 117.5C1819.21 117.5 1835.04 121 1849.38 128C1863.71 134.667 1874.71 144.167 1882.38 156.5V0H1942.88V372H1886.88L1882.88 333.5C1875.54 347.5 1864.21 358.5 1848.88 366.5C1833.88 374.5 1817.04 378.5 1798.38 378.5ZM1811.88 322.5C1826.21 322.5 1838.54 319.5 1848.88 313.5C1859.21 307.167 1867.21 298.333 1872.88 287C1878.88 275.333 1881.88 262.167 1881.88 247.5C1881.88 232.5 1878.88 219.5 1872.88 208.5C1867.21 197.167 1859.21 188.333 1848.88 182C1838.54 175.333 1826.21 172 1811.88 172C1797.88 172 1785.71 175.333 1775.38 182C1765.04 188.333 1757.04 197.167 1751.38 208.5C1746.04 219.833 1743.38 232.833 1743.38 247.5C1743.38 262.167 1746.04 275.167 1751.38 286.5C1757.04 297.833 1765.04 306.667 1775.38 313C1785.71 319.333 1797.88 322.5 1811.88 322.5Z",fill:"currentColor"}),(0,Lt.jsx)("path",{d:"M1996.45 372V125H2057.45V372H1996.45ZM2026.45 75.5C2016.11 75.5 2007.28 72 1999.95 65C1992.95 57.6667 1989.45 48.8333 1989.45 38.5C1989.45 28.1667 1992.95 19.5 1999.95 12.5C2007.28 5.50001 2016.11 2.00002 2026.45 2.00002C2036.78 2.00002 2045.45 5.50001 2052.45 12.5C2059.78 19.5 2063.45 28.1667 2063.45 38.5C2063.45 48.8333 2059.78 57.6667 2052.45 65C2045.45 72 2036.78 75.5 2026.45 75.5Z",fill:"currentColor"}),(0,Lt.jsx)("path",{d:"M2085.97 125H2240.97V176H2085.97V125ZM2241.47 2.5V54.5C2238.14 54.5 2234.64 54.5 2230.97 54.5C2227.64 54.5 2224.14 54.5 2220.47 54.5C2205.14 54.5 2194.8 58.1667 2189.47 65.5C2184.47 72.8333 2181.97 82.6667 2181.97 95V372H2121.47V95C2121.47 72.3333 2125.14 54.1667 2132.47 40.5C2139.8 26.5 2150.14 16.3333 2163.47 10C2176.8 3.33334 2192.3 0 2209.97 0C2214.97 0 2220.14 0.166671 2225.47 0.5C2231.14 0.833329 2236.47 1.49999 2241.47 2.5Z",fill:"currentColor"}),(0,Lt.jsx)("path",{d:"M2330.4 125L2410.9 353L2377.9 415.5L2265.9 125H2330.4ZM2272.4 486.5V436H2308.9C2316.9 436 2323.9 435 2329.9 433C2335.9 431.333 2341.24 428 2345.9 423C2350.9 418 2355.07 410.667 2358.4 401L2460.9 125H2523.9L2402.9 427C2393.9 449.667 2382.57 466.167 2368.9 476.5C2355.24 486.833 2338.24 492 2317.9 492C2309.24 492 2301.07 491.5 2293.4 490.5C2286.07 489.833 2279.07 488.5 2272.4 486.5Z",fill:"currentColor"}),(0,Lt.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M226.926 25.1299H310.197C333.783 25.1299 342.32 27.5938 350.948 32.1932C359.576 36.8108 366.326 43.5822 370.941 52.1969C375.556 60.8298 378 69.3715 378 92.9707V176.289C378 199.888 375.537 208.43 370.941 217.063C366.326 225.696 359.558 232.449 350.948 237.066C347.091 239.131 343.244 240.83 338.064 242.047V308.355C338.064 344.802 334.261 357.994 327.162 371.327C320.034 384.66 309.583 395.09 296.285 402.221C282.96 409.353 269.775 413.13 233.349 413.13H104.744C68.3172 413.13 55.1327 409.325 41.8073 402.221C28.4819 395.09 18.0583 384.632 10.9308 371.327C3.80323 358.023 0 344.802 0 308.355V179.706C0 143.259 3.80323 130.067 10.9026 116.734C18.0301 103.401 28.4819 92.9431 41.8073 85.8116C55.1045 78.7082 68.3172 74.9028 104.744 74.9028H159.808C160.841 64.0747 162.996 58.1666 166.165 52.2151C170.78 43.5822 177.547 36.8108 186.175 32.1932C194.785 27.5938 203.34 25.1299 226.926 25.1299ZM184.128 78.1641C184.128 62.7001 196.658 50.1641 212.114 50.1641H324.991C340.448 50.1641 352.978 62.7001 352.978 78.1641V191.096C352.978 206.56 340.448 219.096 324.991 219.096H212.114C196.658 219.096 184.128 206.56 184.128 191.096V78.1641Z",fill:"currentColor"})]}),Et=((0,v._x)("Loading animation","icon","extendify-local"),(0,v.__)("Checkmark","extendify-local"),(0,Lt.jsxs)("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,Lt.jsx)("title",{children:(0,v.__)("Three bars loading animation","extendify-local")}),(0,Lt.jsxs)("rect",{x:"6",y:"20",width:"6",height:"6",rx:"3",fill:"currentColor",fillOpacity:"0.5",children:[(0,Lt.jsx)("animate",{attributeName:"y",values:"20;8;8;8;8;8;20",keyTimes:"0;0.167;0.333;0.5;0.667;0.833;1",dur:"2500ms",repeatCount:"indefinite",calcMode:"spline",keySplines:"0.25 0.1 0.25 1; 0 0 0 0; 0 0 0 0; 0 0 0 0; 0 0 0 0; 0.25 0.1 0.25 1"}),(0,Lt.jsx)("animate",{attributeName:"height",values:"6;32;32;32;32;32;6",keyTimes:"0;0.167;0.333;0.5;0.667;0.833;1",dur:"2500ms",repeatCount:"indefinite",calcMode:"spline",keySplines:"0.25 0.1 0.25 1; 0 0 0 0; 0 0 0 0; 0 0 0 0; 0 0 0 0; 0.25 0.1 0.25 1"})]}),(0,Lt.jsxs)("rect",{x:"20",y:"20",width:"6",height:"6",rx:"3",fill:"currentColor",fillOpacity:"0.5",children:[(0,Lt.jsx)("animate",{attributeName:"y",values:"20;20;8;8;8;20;20",keyTimes:"0;0.167;0.333;0.5;0.667;0.833;1",dur:"2500ms",repeatCount:"indefinite",calcMode:"spline",keySplines:"0 0 0 0; 0.25 0.1 0.25 1; 0 0 0 0; 0 0 0 0; 0.25 0.1 0.25 1; 0 0 0 0"}),(0,Lt.jsx)("animate",{attributeName:"height",values:"6;6;32;32;32;6;6",keyTimes:"0;0.167;0.333;0.5;0.667;0.833;1",dur:"2500ms",repeatCount:"indefinite",calcMode:"spline",keySplines:"0 0 0 0; 0.25 0.1 0.25 1; 0 0 0 0; 0 0 0 0; 0.25 0.1 0.25 1; 0 0 0 0"})]}),(0,Lt.jsxs)("rect",{x:"34",y:"20",width:"6",height:"6",rx:"3",fill:"currentColor",fillOpacity:"0.5",children:[(0,Lt.jsx)("animate",{attributeName:"y",values:"20;20;20;8;20;20;20",keyTimes:"0;0.167;0.333;0.5;0.667;0.833;1",dur:"2500ms",repeatCount:"indefinite",calcMode:"spline",keySplines:"0 0 0 0; 0 0 0 0; 0.25 0.1 0.25 1; 0.25 0.1 0.25 1; 0 0 0 0; 0 0 0 0"}),(0,Lt.jsx)("animate",{attributeName:"height",values:"6;6;6;32;6;6;6",keyTimes:"0;0.167;0.333;0.5;0.667;0.833;1",dur:"2500ms",repeatCount:"indefinite",calcMode:"spline",keySplines:"0 0 0 0; 0 0 0 0; 0.25 0.1 0.25 1; 0.25 0.1 0.25 1; 0 0 0 0; 0 0 0 0"})]})]})),At=(0,Lt.jsxs)("svg",{width:"172",height:"118",viewBox:"0 0 172 118",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,Lt.jsx)("title",{children:(0,v.__)("Site creation loading animation","extendify-local")}),(0,Lt.jsx)("rect",{x:"1",y:"1",width:"170",height:"116",rx:"12",stroke:"currentColor",strokeOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round"}),(0,Lt.jsxs)("g",{clipPath:"url(#clip0)",children:[(0,Lt.jsxs)("rect",{rx:"6",fill:"url(#gradTL)",children:[(0,Lt.jsx)("animate",{attributeName:"x",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"9;9;9;9;9;9;9;9;9;9;9;9;9;9;9",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"y",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"9;9;9;9;9;9;9;9;9;9;9;9;9;9;9",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"width",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"100;100;48;48;48;48;48;48;74;74;74;74;74;74;100",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"height",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"100;100;100;100;100;100;47;47;47;47;47;47;100;100;100",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"})]}),(0,Lt.jsxs)("rect",{rx:"6",fill:"url(#gradTR)",children:[(0,Lt.jsx)("animate",{attributeName:"x",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"115;115;63;63;63;63;63;63;89;89;89;89;89;89;115",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"y",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"9;9;9;9;9;9;9;9;9;9;9;9;9;9;9",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"width",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"48;48;100;100;100;100;100;100;74;74;74;74;74;74;48",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"height",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"100;100;100;100;47;47;47;47;47;47;47;47;100;100;100",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"})]}),(0,Lt.jsxs)("rect",{rx:"6",fill:"url(#gradBL)",children:[(0,Lt.jsx)("animate",{attributeName:"x",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"9;9;9;9;9;9;9;9;9;9;9;9;9;9;9",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"y",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"109;109;109;109;109;109;62;62;62;62;62;109;109;109;109",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"width",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"48;48;48;48;48;48;48;48;80;80;0;0;0;0;48",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"height",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"0;0;0;0;0;0;47;47;47;47;47;0;0;0;0",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"})]}),(0,Lt.jsxs)("rect",{rx:"6",fill:"url(#gradBR)",children:[(0,Lt.jsx)("animate",{attributeName:"x",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"63;63;63;63;63;63;63;63;95;95;9;9;89;89;63",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"y",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"115;115;115;115;62;62;62;62;62;62;62;62;115;115;115",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"width",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"100;100;100;100;100;100;100;100;68;68;154;154;74;74;100",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"}),(0,Lt.jsx)("animate",{attributeName:"height",dur:"4900ms",repeatCount:"indefinite",calcMode:"spline",values:"47;47;47;47;47;47;47;47;47;47;47;47;47;47;47",keyTimes:"0;0.041;0.143;0.184;0.286;0.327;0.429;0.469;0.571;0.612;0.714;0.755;0.857;0.898;1",keySplines:"0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1;0 0 1 1;0 0 0.58 1"})]})]}),(0,Lt.jsxs)("defs",{children:[(0,Lt.jsxs)("linearGradient",{id:"gradTL",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,Lt.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.5"}),(0,Lt.jsx)("stop",{offset:"50%",stopColor:"currentColor",stopOpacity:"0.35"}),(0,Lt.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.5"})]}),(0,Lt.jsxs)("linearGradient",{id:"gradTR",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,Lt.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.5"}),(0,Lt.jsx)("stop",{offset:"50%",stopColor:"currentColor",stopOpacity:"0.35"}),(0,Lt.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.5"})]}),(0,Lt.jsxs)("linearGradient",{id:"gradBL",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,Lt.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.5"}),(0,Lt.jsx)("stop",{offset:"50%",stopColor:"currentColor",stopOpacity:"0.35"}),(0,Lt.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.5"})]}),(0,Lt.jsxs)("linearGradient",{id:"gradBR",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,Lt.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.5"}),(0,Lt.jsx)("stop",{offset:"50%",stopColor:"currentColor",stopOpacity:"0.35"}),(0,Lt.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.5"})]}),(0,Lt.jsx)("clipPath",{id:"clip0",children:(0,Lt.jsx)("rect",{width:"154",height:"100",fill:"white",transform:"translate(9 9)"})})]})]});var Dt=a(319),Ft=a(3473),Ht=a(6221),It=a(8845);const{adminUrl:Bt,homeUrl:Rt}=window.extSharedData,zt=({height:e})=>{const{done:t}=Mt(),a=(0,_t.useRef)(0),[n,i]=(0,_t.useState)(null),[s,r]=(0,_t.useState)(!1),{statusMessages:o,errorMessage:l,setErrorMessage:c,errorCount:d,needToStall:u,resetErrorCount:p,setPulse:g}=Z();return((e,t=2e3,a=[])=>{const n=(0,_t.useRef)(0),i=(0,_t.useRef)(null);(0,_t.useEffect)(()=>{const a=()=>{clearTimeout(i.current);const s=Date.now(),r=Math.max(0,n.current+t-s),o=()=>{n.current=Date.now(),e()&&a()};0===r?o():i.current=setTimeout(o,r)};return a(),()=>{clearTimeout(i.current),i.current=null}},[e,t,...a])})(()=>!l&&(!(a.current>=o.length)&&(o.length-a.current>3&&a.current>0&&(a.current=o.length-3),i(o[a.current]),a.current+=1,a.current{if(!l)return;const e=setTimeout(()=>{c(null)},5e3);return()=>clearTimeout(e)},[l,c]),(0,_t.useEffect)(()=>{g(!t)},[t]),(0,_t.useEffect)(()=>{if(!t)return;r(!0);const e=setTimeout(()=>{window.location.replace(`${Rt}?extendify-launch-success=1`)},3e3);return()=>clearTimeout(e)},[t]),(0,_t.useEffect)(()=>{if(!u())return;const e=setTimeout(()=>{p()},1e4);return()=>clearTimeout(e)},[u,d,p]),u()?(0,Lt.jsx)("div",{className:"w-full rounded-3xl border border-gray-300 bg-[#F0F0F0CC]/80 backdrop-blur-[80px] p-6 flex items-center gap-2",style:{boxShadow:"0px 4px 30px 0px #0000001A"},children:(0,Lt.jsxs)("div",{className:"flex gap-2",children:[(0,Lt.jsx)("div",{className:"w-6 shrink-0 pt-0.5",children:(0,Lt.jsx)(Dt.A,{icon:Ft.A,size:24})}),(0,Lt.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,Lt.jsx)("span",{className:"text-lg font-semibold leading-7 text-gray-900",children:(0,v.__)("We are experiencing some delays","extendify-local")}),(0,Lt.jsx)("span",{className:"text-base font-normal leading-6 text-gray-900",children:(0,v.__)("Pausing for a few seconds","extendify-local")})]})]})}):(0,Lt.jsxs)("div",{className:"w-full rounded-3xl border border-gray-300 bg-gray-100/80 backdrop-blur-2xl shadow-md flex flex-col items-center justify-center gap-3 relative",style:{height:e||"auto"},children:[(0,Lt.jsx)("div",{className:"text-design-main",children:At}),(0,Lt.jsx)("div",{className:"h-5 overflow-hidden",children:(0,Lt.jsx)(Ht.N,{mode:"wait",children:n?(0,Lt.jsx)(It.P.p,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0},transition:{duration:.25},className:"m-0 text-sm font-medium leading-5 text-center status-animation",children:n},n):null})}),l?(0,Lt.jsxs)("div",{className:"absolute left-0 w-full rounded-3xl border border-gray-300 bg-[#F0F0F0CC] backdrop-blur-[80px] px-6 py-3 flex items-center gap-2",style:{top:"calc(100% + 24px)",boxShadow:"0px 4px 30px 0px #0000001A"},children:[(0,Lt.jsx)(Dt.A,{icon:Ft.A,size:24}),(0,Lt.jsx)("span",{className:"text-sm font-medium leading-5 text-gray-900",children:l})]}):null,s?(0,Lt.jsx)(Vt,{}):null]})},Vt=()=>(0,Lt.jsx)("iframe",{title:"Admin Loader",src:Bt,style:{display:"none"},sandbox:"allow-same-origin allow-scripts allow-forms"}),{installedPluginsSlugs:Ut}=window.extSharedData||{};var Zt=a(5367),Jt=a(1450);const Gt=()=>{const{setData:e,descriptionBackup:t,urlParams:a}=Z();(()=>{const{data:e,error:t}=(0,Pt.A)("required-plugins",()=>Ne({requiredOnly:!0}));if(e?.sitePlugins?.sitePlugins?.length){const t=e.sitePlugins.sitePlugins.filter(({wordpressSlug:e})=>!Ut?.includes(e));if(0===t.length)return;!async function(){for(const{wordpressSlug:e}of t){const t=await st(e);await ot(t?.plugin??e)}}()}})();const[n,i]=(0,_t.useState)(a.description||a.title||t||""),[s,r]=(0,_t.useState)(!1),[o,l]=(0,_t.useState)(null),c=(0,_t.useRef)(null),{consentTerms:d}=(0,St.D)(),u=(0,_t.useCallback)(()=>{const e=c.current;if(!e)return;e.style.height="auto";const t=e.getBoundingClientRect(),a=window.innerHeight,n=Math.max(0,a-t.top-120),i=e.scrollHeight,s=Math.min(i,n);e.style.height=`${s}px`,e.style.overflowY=i>n?"auto":"hidden",window.dispatchEvent(new Event("launch-textarea-resize"))},[]);return(0,_t.useEffect)(()=>{e("descriptionBackup",n.trim());const t=requestAnimationFrame(()=>{u()});return()=>cancelAnimationFrame(t)},[n,e]),(0,_t.useEffect)(()=>{const e=new AbortController,{signal:t}=e,a=()=>{u();const e=c.current;e?.scrollTo(0,e.scrollHeight)};return window.addEventListener("resize",a,{signal:t}),window.addEventListener("orientationchange",a,{signal:t}),u(),()=>e.abort()},[u]),(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)("form",{onSubmit:t=>{t.preventDefault(),e("descriptionRaw",n.trim()),e("go",!0)},onClick:()=>c.current?.focus(),className:"relative flex w-full flex-col",children:(0,Lt.jsx)("div",{className:"w-full rounded-3xl border border-gray-300 bg-gray-100/80 text-gray-900 backdrop-blur-2xl focus-within:border-gray-500 focus-within:ring-gray-500 shadow-md overflow-hidden",children:s?(0,Lt.jsxs)("div",{className:"flex h-49 flex-col items-center justify-center gap-4",children:[(0,Lt.jsx)("div",{className:"h-12 w-12 text-design-main",children:Et}),(0,Lt.jsx)("p",{className:"m-0 text-base leading-6 text-center text-gray-800",children:(0,v.__)("Enhancing the website description...","extendify-local")})]}):(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)("textarea",{ref:c,id:"extendify-launch-chat-textarea",className:"flex min-h-20 md:min-h-24 w-full resize-none bg-transparent text-base leading-6 placeholder:text-gray-700 focus:shadow-none focus:outline-hidden border-none text-gray-900 p-6 pb-0",rows:"1",autoFocus:!0,autoComplete:"off","data-1p-ignore":!0,value:n,onChange:e=>{i(e.target.value)},placeholder:(0,v.__)("E.g., A personal photography portfolio featuring a collection of landscape, portrait, and street photography, capturing moments from around the world.","extendify-local")}),(0,Lt.jsxs)("div",{className:"flex justify-between items-end gap-4 p-6",children:[(0,Lt.jsx)("div",{children:(0,Lt.jsx)(Qt,{disabled:0===n.trim().length||n.trim()===o,onClick:async()=>{r(!0);const e=`${te.AY}/api/prompt/improve`,t=await ee(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...ae.m,description:n.trim(),title:window.extSharedData.siteTitle})}).then(e=>e.ok&&e.json()).catch(()=>null),a=t?.improvedPrompt;if(r(!1),a){l(a);const e=c.current;if(!e)return i(a);requestAnimationFrame(()=>{e.focus(),e.select(),document.execCommand("insertText",!1,a)||i(a)})}}})}),(0,Lt.jsx)(Wt,{disabled:0===n.trim().length})]})]})})}),(0,Lt.jsx)("div",{className:"text-pretty mt-4 text-center text-xs leading-4 opacity-70 text-banner-text [&>a]:text-xs [&>a]:text-banner-text [&>a]:underline w-full",dangerouslySetInnerHTML:{__html:d}})]})},Wt=(0,_t.forwardRef)((e,t)=>(0,Lt.jsxs)("button",{ref:t,type:"submit",className:"inline-flex items-center justify-center rounded-full border-0 bg-design-main px-3 py-2 text-sm leading-5 font-normal text-design-text focus-visible:ring-design-main disabled:opacity-40 focus:outline-none focus-visible:ring-1 focus-visible:ring-offset-2 group hover:opacity-90 transition-opacity",...e,children:[(0,Lt.jsx)("span",{className:"px-1",children:(0,v.__)("Next","extendify-local")}),(0,Lt.jsx)(Dt.A,{fill:"currentColor",icon:Zt.A,size:24})]})),Qt=e=>(0,Lt.jsxs)("button",{type:"button",className:"inline-flex items-center rounded-full ring-1 ring-gray-800 px-3 py-2 text-sm leading-5 font-normal text-gray-800 transition-colors hover:bg-gray-600/5 disabled:opacity-40",...e,children:[(0,Lt.jsx)(Dt.A,{icon:Jt.A,size:24}),(0,Lt.jsx)("span",{className:"px-1",children:(0,v.__)("Enhance with AI","extendify-local")})]}),qt=({skipDescription:e,lastHeight:t})=>e?(0,Lt.jsx)(It.P.div,{initial:{opacity:0,height:t||"auto"},animate:{opacity:1,height:400},transition:{duration:.4},children:(0,Lt.jsx)(zt,{height:400})}):(0,Lt.jsx)(It.P.div,{animate:{opacity:1},exit:{opacity:0},transition:{duration:.4},children:(0,Lt.jsx)(Gt,{})}),Kt=()=>window.extSharedData?.partnerLogo?(0,Lt.jsx)("div",{className:"flex h-10 max-w-52 items-center overflow-hidden md:max-w-72",children:(0,Lt.jsx)("img",{className:"h-full w-auto max-w-full object-contain",src:window.extSharedData.partnerLogo,alt:window.extSharedData?.partnerName??""})}):(0,Lt.jsx)(Dt.A,{width:void 0,icon:$t,className:"h-8 w-auto text-banner-text"});var Xt=a(3640),ea=a(9384),ta=a(8638),aa=a(5979);const na=()=>{const e=(0,ea.z)(),t=(0,ta.I)(),a=(0,_t.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue("--ext-banner-main").trim(),[]),n=(0,_t.useMemo)(()=>(0,Xt.Mj)(a).desaturate(.3).lighten(.4).alpha(.25).toRgbString(),[a]),i=(0,_t.useMemo)(()=>(0,Xt.Mj)(a).isLight(),[a]),s=(0,_t.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue("--ext-design-main").trim(),[]),r=(0,_t.useMemo)(()=>(0,Xt.Mj)(s).desaturate(.3).alpha(.25).toRgbString(),[s]),o=(0,_t.useMemo)(()=>Math.random(),[]),l=(0,aa.G)(e,e=>(e/24e3+o)%1),c=(0,aa.G)(l,e=>180*Math.sin(e*Math.PI*2)),d=(0,aa.G)(l,e=>180*Math.cos(e*Math.PI*2));return t?null:i?(0,Lt.jsx)(It.P.div,{style:{background:`radial-gradient(circle at center, ${r}, transparent 40%)`,x:c,y:d},className:"pointer-events-none absolute inset-0 h-full w-full scale-200"}):(0,Lt.jsx)(It.P.div,{style:{background:`radial-gradient(circle at center, ${n}, transparent 40%)`,x:c,y:d},className:"pointer-events-none absolute inset-0 h-full w-full scale-200"})},ia=()=>(0,Lt.jsxs)("div",{className:"flex w-full flex-col max-w-5xl p-6 lg:p-10",children:[(0,Lt.jsx)("h2",{className:"text-lg text-center text-gray-900 font-semibold px-4 py-0 m-0",children:(0,v.__)("One more thing before we start.","extendify-local")}),(0,Lt.jsxs)("div",{className:"relative mx-auto w-full max-w-xl text-gray-900",children:[(0,Lt.jsx)("p",{className:"text-base",children:(0,v.__)("Hey there, Launch is powered by Extendable and is required to proceed. You can install it from the link below and start over once activated.","extendify-local")}),(0,Lt.jsx)("a",{className:"mt-4 text-base font-medium text-design-main underline",href:`${window.extSharedData.adminUrl}theme-install.php?theme=extendable`,children:(0,v.__)("Take me there","extendify-local")})]})]});var sa=a(6427);const ra=({pages:e})=>{const{resetSiteInformation:t}=window.extLaunchData,{navigationIds:a,templatePartsIds:n,pageWithTitleTemplateId:i}=t||{},s=window.extSharedData.globalStylesPostID,{reset:r}=Z(),[o,l]=(0,_t.useState)(!1);return(0,Lt.jsxs)("div",{className:"flex w-full flex-col gap-6 p-6",children:[(0,Lt.jsx)("h2",{className:"text-2xl leading-8 text-left text-gray-900 font-medium py-0 m-0",children:(0,v.__)("Start Over?","extendify-local")}),(0,Lt.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,Lt.jsx)("p",{className:"text-base leading-6 text-left text-gray-900 m-0",children:(0,v.__)("It looks like you have been here before. We need to clean up some things before we can continue.","extendify-local")}),(0,Lt.jsx)("p",{className:"text-base leading-6 text-left text-gray-900 font-medium m-0",children:(0,v.sprintf)( // translators: %3$s is the number of old pages // translators: %3$s is the number of old pages (0,v.__)("%s pages/posts will be deleted.","extendify-local"),e.length)})]}),(0,Lt.jsx)("div",{className:"flex justify-between items-center mt-2",children:(0,Lt.jsx)(oa,{handleOk:async()=>{l(!0),r({exclude:["descriptionBackup"]}),localStorage.removeItem(`extendify-agent-workflows-${window.extSharedData.siteId}`);for(const t of e)try{await b()({path:`/wp/v2/pages/${t}`,method:"DELETE"})}catch(e){console.warn(`delete pages failed to delete a page (id: ${t}) with the following error`,e)}for(const t of e)try{await b()({path:`/wp/v2/posts/${t}`,method:"DELETE"})}catch(e){console.warn(`delete posts failed to delete a page (id: ${t}) with the following error`,e)}for(const e of a||[])try{await b()({path:`/wp/v2/navigation/${e}`,method:"DELETE"})}catch(t){console.warn(`delete navigation failed to delete a navigation (id: ${e}) with the following error`,t)}for(const e of n||[])try{await b()({path:`/wp/v2/template-parts/${e}?force=true`,method:"DELETE"})}catch(t){console.warn(`delete template failed to delete template (id: ${e}) with the following error`,t)}try{i&&await b()({path:`/wp/v2/templates/${i}?force=true`,method:"DELETE"})}catch(e){console.warn("Failed to delete page-with-title template:",e)}try{s&&await b()({path:`/wp/v2/global-styles/${s}`,method:"POST",body:JSON.stringify({settings:{},styles:{}})})}catch(e){console.warn("Failed to reset global styles with the following error:",e)}window.location.reload()},handleExit:()=>{window.location.href=`${window.extSharedData.adminUrl}admin.php?page=extendify-assist`},processing:o})})]})},oa=({handleOk:e,handleExit:t,processing:a})=>(0,Lt.jsxs)(Lt.Fragment,{children:[(0,Lt.jsx)("button",{type:"button",onClick:t,disabled:a,className:"inline-flex items-center gap-2 rounded-full ring-1 ring-gray-800 px-3 py-2.5 text-sm leading-5 font-normal text-gray-800 transition-colors hover:bg-gray-600/5 disabled:opacity-40",children:(0,Lt.jsx)("span",{className:"px-1",children:(0,v.__)("Exit","extendify-local")})}),a?(0,Lt.jsxs)("button",{type:"button",disabled:!0,className:"inline-flex items-center justify-center gap-2 rounded-full border-0 bg-design-main px-3 py-2 text-sm leading-5 font-normal text-design-text disabled:opacity-40",children:[(0,Lt.jsx)(sa.Spinner,{className:"m-0"}),(0,Lt.jsx)("span",{className:"px-1",children:(0,v.__)("Processing...","extendify-local")})]}):(0,Lt.jsxs)("button",{type:"button",onClick:e,className:"inline-flex items-center justify-center rounded-full border-0 bg-design-main px-3 py-2 text-sm leading-5 font-normal text-design-text group hover:opacity-90 transition-opacity",children:[(0,Lt.jsx)("span",{className:"px-1",children:(0,v.__)("Delete and start over","extendify-local")}),(0,Lt.jsx)(Dt.A,{fill:"currentColor",icon:Zt.A,size:24})]})]}),la=()=>{const e=(0,ta.I)(),t=(0,_t.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue("--ext-banner-main").trim(),[]),a=(0,_t.useMemo)(()=>(0,Xt.Mj)(t).desaturate(.3).lighten(.4).alpha(.2).toRgbString(),[t]),n=(0,_t.useMemo)(()=>(0,Xt.Mj)(t).isLight(),[t]),i=(0,_t.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue("--ext-design-main").trim(),[]),s=(0,_t.useMemo)(()=>(0,Xt.Mj)(i).desaturate(.3).alpha(.2).toRgbString(),[i]);if(e)return null;const r=n?s:a;return(0,Lt.jsx)(It.P.div,{className:"absolute inset-0",style:{background:`radial-gradient(ellipse at center, transparent 70%, ${r} 100%)`},animate:{opacity:[0,1,0]},transition:{duration:2.5,repeatDelay:4,repeat:1/0,ease:"linear"}})};var ca=a(9363),da=a(5492);const ua=()=>{const e=(0,bt.useSelect)(e=>e("core").getCurrentTheme()),t=e&&"extendable"!==e?.textdomain,a=window.extLaunchData.resetSiteInformation.pagesIds??[],n=a.length>0,{title:i,descriptionRaw:s,go:r,urlParams:o,designBuild:l}=Z(),c=Boolean(o?.["build-id"])||l||(i||s)&&r,d=(0,_t.useRef)(null);return(0,_t.useEffect)(()=>{ // translators: Launch is a noun. document.title=(0,v.__)("Launch - AI-Powered Web Creation","extendify-local"),k("extendify_launch_loaded",(new Date).toISOString()),0===(0,Qe.getBlockTypes)().length&&(0,ca.registerCoreBlocks)(),Ge({stage:"launch_page"})},[]),t?(0,Lt.jsx)(pa,{children:(0,Lt.jsx)("div",{className:"bg-white w-full max-w-3xl rounded-lg border border-design-main/60 relative z-10",children:(0,Lt.jsx)(ia,{})})}):n?(0,Lt.jsx)(pa,{children:(0,Lt.jsx)("div",{className:"w-full max-w-2xl rounded-3xl border bg-gray-100/80 backdrop-blur-2xl shadow-md relative z-10 border-gray-300",children:(0,Lt.jsx)(ra,{pages:a})})}):(0,Lt.jsxs)(pa,{children:[(0,Lt.jsx)(Ht.N,{mode:"wait",initial:!1,children:(0,Lt.jsx)(ga,{skipDescription:c})}),(0,Lt.jsx)("div",{ref:d,className:"w-full max-w-2xl relative z-10",children:(0,Lt.jsx)(Ht.N,{mode:"wait",children:(0,Lt.jsx)(qt,{skipDescription:c,lastHeight:d.current?.offsetHeight},c?"description-launch":"creating-launch")})}),c||window.extLaunchData?.hideAutoLaunchExitLink?null:(0,Lt.jsx)("div",{className:"flex w-full p-6 md:p-8 absolute bottom-0 left-0",children:(0,Lt.jsxs)("a",{className:"inline-flex items-center gap-0.5 text-sm text-banner-text opacity-70 hover:opacity-100 transition-opacity p-2",href:window.extSharedData.adminUrl,onClick:()=>Ge({stage:"exit_to_wp_admin"}),children:[(0,Lt.jsx)(Dt.A,{fill:"currentColor",icon:da.A,size:20}),(0,v.__)("WP Admin Dashboard","extendify-local")]})})]})},pa=({children:e})=>{const{pulse:t}=Z();return(0,Lt.jsxs)("div",{style:{zIndex:1e5},className:"fixed inset-0 bg-white",children:[(0,Lt.jsx)("div",{className:"relative h-dvh bg-banner-main text-banner-text text-base flex flex-col items-center justify-between",children:(0,Lt.jsxs)("div",{className:"relative w-full flex flex-col items-center gap-5 md:gap-8 p-6 pb-25 flex-1 justify-center",children:[(0,Lt.jsx)("div",{className:"mb-4",children:(0,Lt.jsx)(Kt,{})}),e]})}),(0,Lt.jsx)(na,{}),t?(0,Lt.jsx)(la,{}):null]})},ga=({skipDescription:e})=>e?null:(0,Lt.jsx)(It.P.h2,{className:"text-xl md:text-2xl text-pretty text-banner-text font-semibold p-0 m-0 text-center",animate:{opacity:1},exit:{opacity:0},transition:{duration:.4},children:(0,v.__)("Describe the website you want to build","extendify-local")});requestAnimationFrame(()=>{const e=document.getElementById("extendify-auto-launch-page");e&&(0,_t.createRoot)(e).render((0,Lt.jsx)(ua,{}))})},1609(e){e.exports=window.React},790(e){e.exports=window.ReactJSXRuntime},1455(e){e.exports=window.wp.apiFetch},9363(e){e.exports=window.wp.blockLibrary},4997(e){e.exports=window.wp.blocks},6427(e){e.exports=window.wp.components},7143(e){e.exports=window.wp.data},6087(e){e.exports=window.wp.element},7723(e){e.exports=window.wp.i18n},6480(e){e.exports=window.wp.mediaUtils},5573(e){e.exports=window.wp.primitives},3832(e){e.exports=window.wp.url}},e=>{e.O(0,[65,223],()=>e(e.s=8187)),e.O()}]);