File "extendify-auto-launch-fa577a30dd41aedded0e.js"
Full Path: /home/buyiwexj/public_html/wp-content/plugins/extendify/public/build/extendify-auto-launch-fa577a30dd41aedded0e.js
File size: 82.27 KB
MIME-type: text/plain
Charset: utf-8
"use strict";(globalThis.webpackChunkextendify=globalThis.webpackChunkextendify||[]).push([[847],{4027(e,t,a){var n=a(8557),i=a(319),s=a(6942),r=a.n(s),l=a(790);const o=({icon:e,badgeLabel:t,heading:a,description:s,buttonLabel:o,buttonIcon:c=n.A,highlight:d,onClick:u})=>(0,l.jsxs)("div",{className:r()("flex flex-col overflow-hidden text-left text-gray-900 backdrop-blur-2xl",d?"rounded-lg border-[3px] border-design-main sm:-mt-7":"rounded-sm border border-gray-300"),children:[d&&t&&(0,l.jsx)("span",{className:"flex h-7 items-center justify-center bg-design-main text-sm font-medium text-design-text",children:t}),(0,l.jsx)("span",{className:"flex items-center justify-center bg-gray-100/80 py-10 text-gray-900",children:(0,l.jsx)(i.A,{fill:"currentColor",icon:e,size:40})}),(0,l.jsxs)("span",{className:"flex flex-1 flex-col justify-between gap-6 border-t border-gray-300 bg-white/60 p-6",children:[(0,l.jsxs)("span",{className:"flex flex-col gap-2",children:[a&&(0,l.jsx)("span",{className:"text-base font-semibold leading-6",children:a}),(0,l.jsx)("span",{className:"text-sm leading-5 opacity-70",children:s})]}),(0,l.jsxs)("button",{type:"button",onClick:u,className:r()("inline-flex w-full items-center justify-between gap-2 rounded-full px-5 py-2.5 text-sm font-medium transition focus:outline-none focus-visible:ring-1 focus-visible:ring-gray-500",d?"border border-design-main bg-design-main text-white hover:opacity-90":"border border-gray-300 bg-transparent hover:border-gray-500"),children:[o,(0,l.jsx)(i.A,{fill:"currentColor",icon:c,size:20})]})]})]});var c=a(4574),d=a(8969),u=a(1994),p=a(8993),g=a(1455),m=a.n(g);const f={"Content-type":"application/json",Accept:"application/json","X-Extendify":"true"},{urlParams:h,activeTests:x}=window.extLaunchData,y=({stage:e,description:t,siteProfile:a={},sitePlugins:n=[],siteStyle:i={}}={})=>{const{type:s,category:r,structure:l,objective:o}=a,{siteId:c,partnerId:g,homeUrl:m,wpLanguage:y}=u.m,w=p.w.getState()?.attempt||1,b=JSON.stringify({...u.m,autoLaunch:!0,stage:e,description:t,attempt:w,activeTests:Object.keys(x??{}).length?JSON.stringify(x):void 0,skippedDescription:Boolean(h?.title||h?.description),insightsId:c,hostpartner:g,siteURL:m,language:y,sitePlugins:n?.map(e=>e?.name),urlParameters:h,siteStyle:i,style:i?.colorPalette,siteProfile:a,siteType:s,siteCategory:r,siteStructure:l,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(`${d.Dq}/api/v1/launch`,{method:"POST",headers:f,body:b,keepalive:!0})};var w=a(6087),b=a(7723),v=a(7611),j=a(4186),C=a(2344),_=a(8845);const S=({onProceed:e})=>{const{descriptionRaw:t,title:a}=(0,p.w)(),{extendifyCodeData:i={}}=window.extSharedData,{link:s,title:r,message:c,ctaPrimary:d}=i,u=s&&r&&c&&d;return(0,w.useEffect)(()=>{u?y({stage:"extendify_code_screen_seen",description:t||a}):e()},[u,e,t,a]),u?(0,l.jsxs)(_.P.div,{animate:{opacity:1},exit:{opacity:0},transition:{duration:.4},className:"flex w-full flex-col gap-6",children:[(0,l.jsxs)("div",{className:"flex flex-col items-center gap-2 text-center text-banner-text",children:[(0,l.jsx)("h2",{className:"m-0 p-0 text-pretty text-xl font-semibold md:text-2xl",children:(0,b.__)("How would you like to build this?","extendify-local")}),(0,l.jsx)("p",{className:"m-0 max-w-xl p-0 text-pretty text-sm opacity-70 md:text-base",children:(0,b.__)("Based on what you described, your site may need some advanced functionality.","extendify-local")})]}),(0,l.jsxs)("div",{className:"grid w-full gap-6 sm:mx-auto sm:max-w-2xl sm:grid-cols-2 sm:pt-7",children:[(0,l.jsx)(o,{icon:v.A,heading:(0,b.__)("Keep building with WordPress","extendify-local"),description:(0,b.__)("Great for business sites, e-commerces, landing pages, portfolios, and blogs.","extendify-local"),buttonLabel:(0,b.__)("Build with WordPress","extendify-local"),buttonIcon:n.A,onClick:()=>{y({stage:"extendify_code_choose_wordpress"}),e()}}),(0,l.jsx)(o,{icon:j.A,highlight:!0,badgeLabel:(0,b.__)("Recommended for you","extendify-local"),heading:r,description:c,buttonLabel:d,buttonIcon:C.A,onClick:()=>{const e=((e,{description:t,title:a}={})=>{if(!e)return"";const n=[a,t].map(e=>e?.trim()).filter(Boolean).join(" — ");return e.replace(/\{DESCRIPTION\}/g,encodeURIComponent(n))})(s,{description:t,title:a});y({stage:"extendify_code_choose_builder"}),e&&window.location.assign(e)}})]})]}):null};var L=a(2423),k=a(3896),N=a(8223),M=a(6480);const{showAILogo:P}=window.extSharedData,T={logoUrl:"https://images.extendify-cdn.com/demo-content/logos/ext-custom-logo-default.webp"},D=`${d.AY}/api/site-profile/generate-logo`,A={"Content-Type":"application/json"},O=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,M.uploadMedia)({filesList:[s],onFileChange:async([e])=>{e?.id&&await(0,k.D3)("site_logo",e.id)},onError:e=>{console.error("Error uploading logo:",e),(0,N.b)({error:e,details:{source:"auto-launch",caller:"uploadLogo"}})}})};var E=a(365);const $=async({slug:e,fonts:t},a)=>{const{fallback:n=!1}=a||{},i=(await(0,c.Ex)({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,E.$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 I=a(9700);const B=null,F={"Content-Type":"application/json"},z=async({urlParams:e})=>{const t=e?.["build-id"];if(!t)return B;
// translators: this is for a action log UI. Keep it short
(0,c.Lx)((0,b.__)("Loading your design","extendify-local"));const a=`${d.AY}/api/design/${encodeURIComponent(t)}`,n=await(0,c.Li)(()=>(0,c.u9)(a,{headers:F})).catch(e=>({ok:!1,statusText:e.message,status:0}));if(!n?.ok)return(0,N.b)({error:{message:n.statusText,name:"FetchError",status:n.status},details:{source:"auto-launch",caller:"handleDesignBuild"}}),B;try{const e=L.is.parse(await n.json()),a=e.siteProfile;await(0,k.D3)("extendify_site_profile",JSON.stringify(a)),(0,I.j)("siteProfile",{siteProfile:a},!1);const i=e.siteStyle,s=i.fonts?.heading||i.fonts?.body?i.fonts:null,r=await $({slug:i.colorPalette,fonts:s},{fallback:!0}),l={...i,variation:r};await(0,k.D3)("extendify_site_style",l),await(0,k.D3)("extendify_animation_settings",{type:i.animation??"fade",speed:"medium"}),(0,I.j)("siteStyle",L.pS.parse({siteStyle:l}),!1);const o=e.selectedPlugins;(0,I.j)("sitePlugins",L.q$.parse({sitePlugins:o}),!1),await O(e.logoUrl),(0,I.j)("siteLogo",L.$d.parse({logoUrl:e.logoUrl}),!1);const c={buildId:t,...e,siteProfile:a,siteStyle:l};return{designBuild:c,...c}}catch(e){return(0,N.b)({error:e,details:{source:"auto-launch",caller:"handleDesignBuild::parsing"}}),console.error("handleDesignBuild:",e),p.w.setState(e=>({urlParams:{...e.urlParams,"build-id":""}})),B}},H=`${d.zL}/api/home`,{wpLanguage:R,showImprint:U}=window.extSharedData,W={"Content-Type":"application/json"};var V=a(1073);const Y={launchDecisions:{navExtras:"none",navButtonLabel:""}},J=`${d.AY}/api/launch-decisions`,Q={"Content-Type":"application/json"};var Z=a(6001);const G=`${d.zL}/api/page-templates`,q={"Content-Type":"application/json"},X=Z._H3({recommended:Z.YOg(L.lY)}),{pluginGroupId:K}=window.extSharedData,ee={sitePlugins:[]},te=`${d.AY}/api/site-plugins`,ae={"Content-Type":"application/json"},ne=Z.Ikc({selectedPlugins:Z.YOg(L.Hg)}),ie=async({siteProfile:e={},requiredOnly:t=!1,showStatus:a=!0})=>{a&&
// translators: this is for a action log UI. Keep it short
// translators: this is for a action log UI. Keep it short
(0,c.Lx)((0,b.__)("Setting up site functionality","extendify-local"));const n=JSON.stringify({...u.m,...e,siteProfile:e,siteObjective:e.objective,pluginGroupId:K,requiredOnly:t}),i=await(0,c.Li)(()=>(0,c.u9)(te,{method:"POST",headers:ae,body:n})).catch(e=>({ok:!1,statusText:e.message,status:0}));if(!i?.ok)return(0,N.b)({error:{message:i.statusText,name:"FetchError",status:i.status},details:{source:"auto-launch",caller:"handleSitePlugins"}}),ee;const{selectedPlugins:s}=await(0,c.pv)(async()=>ne.parse(await i.json()),ee,{caller:"handleSitePlugins"});return L.q$.parse({sitePlugins:s})};var se=a(6745);const re=Z.Ikc({siteProfile:L.fR}),le=`${d.AY}/api/site-profile`,oe={"Content-Type":"application/json"};var ce=a(2285);const de={siteStyle:{}},ue=`${d.AY}/api/styles`,pe={"Content-Type":"application/json"},ge=Z.YOg(L.Jr.omit({variation:!0}));var me=a(3832);const fe=async({fontFamilyId:e,...t})=>{const a=`${t.fontFamilySlug}-${t.fontWeight}`;for(let n=0;n<=2;n++)try{n>0&&await(0,E.yy)(1e3);const a=await m()({path:`/wp/v2/font-families/${e}/font-faces`,method:"POST",body:we(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.`)}},he=async e=>{const t=e.fontFace.map(async e=>{const t=await xe(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 m()({path:(0,me.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 m()({path:"/wp/v2/font-families",method:"POST",body:ye(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 fe(e));return{...n,fontFace:s.filter(Boolean)}},xe=async e=>{for(let t=0;t<=2;t++)try{t>0&&await(0,E.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}},ye=({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},we=({fontFamilySlug:e,fontFamily:t,fontStyle:a,fontWeight:n,fontDisplay:i,unicodeRange:s,src:r=[],file:l=[]})=>{const o=new FormData,c={fontFamily:t,fontStyle:a,fontWeight:n,fontDisplay:i,unicodeRange:null==s?"":s,src:Array.isArray(r)?r:[r]};return(Array.isArray(l)?l:[l]).forEach(t=>{const i=`${e}-${n}-${a}`;o.append(i,t,t.name),r?.length?c.src=[i]:c.src.push(i)}),o.append("font_face_settings",JSON.stringify(c)),o};var be=a(8512),ve=a(4997);const je=[{slug:"shop",plugin:"woocommerce"},{slug:"events",plugin:"the-events-calendar"}],Ce=async e=>{const t=[];for(const a of e){const e=[],n=new Set;(0,c.Lx)((0,b.sprintf)((0,b.__)("Adding page: %s","extendify-local"),a.name));for(const[t,i]of a.patterns.entries()){const t=i.code,a=i.patternTypes?.[0],{slug:s}=Object.values(be.Q).find(({alias:e})=>e.includes(a))||{},r=i.navSlug??s;!n.has(r)&&r?(n.add(r),e.push(_e(t,r))):e.push(t)}const i={title:a.name,status:"publish",content:e.join(""),template:"home"===a.slug?"no-title":"page-with-title",meta:{made_with_extendify_launch:!0}};let s;try{s=await Se(i)}catch(e){i.template="no-title",s=await Se(i)}t.push({...s,originalSlug:a.slug})}const a=t.find(({originalSlug:e})=>"home"===e);a&&(await(0,k.D3)("show_on_front","page"),await(0,k.D3)("page_on_front",a.id));const n=t.find(({originalSlug:e})=>"blog"===e);return n&&await(0,k.D3)("page_for_posts",n.id),t},_e=(e,t)=>e.replace(/(<div\s[^>]*class="[^"]*\bwp-block-group\b[^"]*")/,`$1 id="${t}"`),Se=e=>m()({path:"wp/v2/pages",data:e,method:"POST"}),Le=e=>m()({path:`wp/v2/pages/${e.id}`,data:e,method:"POST"});var ke=a(6935),Ne=a(9324);const Me=()=>m()({path:"extendify/v1/auto-launch/active-plugins"}),Pe=(e,t)=>e?.filter(e=>e.includes(t))?.length,Te=async e=>{const t=async()=>{const t=await m()({path:"/wp/v2/plugins",method:"POST",data:{slug:e}});return await(0,ke.yB)({slug:e,source:"auto-launch"}),await(0,Ne.m_)(t?.plugin),t};try{return await t()}catch(a){if("folder_exists"===a?.code)return await De(e);try{return await t()}catch(e){return(0,N.b)({error:e,details:{source:"auto-launch",caller:"installPlugin"}}),null}}},De=async e=>{const t=await m()({path:(0,me.addQueryArgs)("/wp/v2/plugins",{search:e})});return t?.find(t=>t.plugin?.split("/")[0]===e)},Ae=async e=>{const t=e=>m()({path:`/wp/v2/plugins/${e}`,method:"POST",data:{status:"active"}});try{return await t(e),!0}catch(a){try{const{plugin:a}=await De(e);return await t(a),!0}catch(e){return(0,N.b)({error:e,details:{source:"auto-launch",caller:"activatePlugin"}}),!1}}},Oe=async(e,{installedSlugs:t=[]}={})=>{const a=[];for(const n of e)try{const e=t.includes(n)?null:await Te(n);await Ae(e?.plugin??n)||a.push(n)}catch(e){a.push(n)}return{failed:a}},Ee=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 Me())?.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,ke.yB)({slug:e,source:"auto-launch"});try{return await $e(e)}catch(t){return await $e(e).catch(()=>e)}},$e=e=>m()({path:"/extendify/v1/shared/process-placeholders",method:"POST",data:{patterns:e}}),{homeUrl:Ie}=window.extSharedData,Be=/href="(#extendify-[\w-]+)"/gi,Fe=e=>e?.content?.raw?.match(Be),ze=async({pageContent:e,availablePages:t})=>{try{const a=await fetch(`${d.AY}/api/link-pages`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...u.m,pageContent:e,availablePages:t})});if(!a.ok)throw new Error("Bad response from server");return await a.json()}catch(e){return{}}},He=async({content:e="",title:t,slug:a})=>{const n=await m()({path:(0,me.addQueryArgs)("extendify/v1/auto-launch/get-navigation",{slug:a})}).catch(()=>{});return n?.id?n:await m()({path:"extendify/v1/auto-launch/create-navigation",method:"POST",data:{title:t,slug:a,content:e}})},Re=(e,t)=>m()({path:`wp/v2/navigation/${e}`,method:"POST",data:{content:t}}),Ue=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)),l=e=>e.originalSlug??e.slug,o=e=>{const t=l(e);return be.Q[t]?.navOrder??Object.values(be.Q).find(e=>e.alias?.includes(t))?.navOrder??Object.keys(be.Q).length+1},c=[...r,...n];let d;if(i.length){const e=e=>i.indexOf(l(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=l(e);return"contact"===t||be.Q.contact?.alias?.includes(t)}),t=c.filter(t=>t!==e).sort((e,t)=>o(e)-o(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,b.__)("More","extendify-local"),url:"#",kind:"custom"})} --\x3e ${g.join("")} \x3c!-- /wp:navigation-submenu --\x3e`:g.join("");await Re(e,p+m)},We=e=>{try{return JSON.parse(e.match(/<!-- wp:navigation([\s\S]*?)-->/)[1])}catch(e){return{}}},Ve=(e,t)=>{const a=JSON.stringify({...We(e),...t});return e.replace(/(<!--\s*wp:navigation\b[^>]*>)([^]*?)(<!--\s*\/wp:navigation\s*-->)/gi,`\x3c!-- wp:navigation ${a} /--\x3e`)},Ye=e=>{const t=e.patterns?.filter(e=>e.contentGenerated)??[],a=e.patterns?.filter(e=>!e.contentGenerated)??[];return{generated:t,toGenerate:{...e,patterns:a}}};var Je=a(7143);const{globalStylesPostID:Qe}=window.extSharedData,Ze=(e,t)=>m()({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,b.__)("Added by Launch","extendify-local"),content:t}}),Ge=(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 qe=a(7581),Xe=a(4225);const{homeUrl:Ke,showImprint:et,wpLanguage:tt,installedPluginsSlugs:at}=window.extSharedData,nt=()=>{const{setErrorMessage:e,addStatusMessage:t,needToStall:a,setData:n,...i}=(0,p.w)(),{setUserGaveConsent:s}=(0,qe.D)(),r=(0,w.useRef)(!1),[l,o]=(0,w.useState)(!a()),[g,f]=(0,w.useState)(!1);return((e=!0,t)=>{(0,w.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])})(l,()=>{y({stage:"exit_early"})}),it("designBuild",()=>i.urlParams?.["build-id"]?i:null,z),it("siteProfile",()=>i.descriptionRaw||i.title?i:null,async e=>(y({stage:"get_profile"}),await(async({title:e,descriptionRaw:t,urlParams:a})=>{
// translators: this is for a action log UI. Keep it short
// translators: this is for a action log UI. Keep it short
(0,c.Lx)((0,b.__)("Creating a site profile","extendify-local"));const n=JSON.stringify({...u.m,title:e||window.extSharedData.siteTitle,description:t,autoLaunch:!0}),i=await(0,c.u9)(le,{method:"POST",headers:oe,body:n},2e4);if(!i?.ok)throw new Error("Failed to fetch site profile");const{profile:s}=await i.json(),r={...L.fR.parse(s),...(0,se.qi)(a),descriptionRaw:t};return await(0,k.D3)("extendify_site_profile",JSON.stringify(r)),re.parse({siteProfile:r})})(e))),it("siteLogo",()=>i.siteProfile?.title?i:null,async e=>(y({stage:"get_logo"}),await(async({siteProfile:e})=>{if(!P)return T;
// translators: this is for a action log UI. Keep it short
(0,c.Lx)((0,b.__)("Generating a logo","extendify-local"));const{logoObjectName:t}=e,a=JSON.stringify({...u.m,objectName:t}),n=await(0,c.Li)(()=>(0,c.u9)(D,{method:"POST",headers:A,body:a})).catch(e=>({ok:!1,statusText:e.message,status:0}));if(!n?.ok)return(0,N.b)({error:{message:n.statusText,name:"FetchError",status:n.status},details:{source:"auto-launch",caller:"handleSiteLogo",objectName:t}}),T;const i=await(0,c.pv)(async()=>{const{logoUrl:e}=L.$d.parse(await n.json());return e},T.logoUrl,{caller:"handleSiteLogo"});return await O(i),L.$d.parse({logoUrl:i})})(e))),it("sitePlugins",()=>i.siteProfile?.title?i:null,async e=>(y({stage:"get_plugins"}),await ie(e))),(0,w.useEffect)(()=>{i.sitePlugins?.length&&((0,c.Lx)(
// translators: this is for a action log UI. Keep it short
// translators: this is for a action log UI. Keep it short
(0,b.__)("Setting up functionality for your website","extendify-local")),Oe(i.sitePlugins.map(({wordpressSlug:e})=>e),{installedSlugs:at}))},[i.sitePlugins]),it("siteStyle",()=>i.siteProfile?.title?i:null,async e=>(y({stage:"get_style"}),await(async({siteProfile:e})=>{
// translators: this is for a action log UI. Keep it short
// translators: this is for a action log UI. Keep it short
(0,c.Lx)((0,b.__)("Picking the perfect design","extendify-local"));const t=JSON.stringify({...u.m,siteProfile:e,count:1}),a=await(0,c.Li)(()=>(0,c.u9)(ue,{method:"POST",headers:pe,body:t},2e4)).catch(e=>({ok:!1,statusText:e.message,status:0}));return a?.ok?(0,c.pv)(async()=>{const e=await a.json(),t=ge.parse(e)[0],n=await $({slug:t.colorPalette,fonts:t.fonts},{fallback:!0}),i={...t,variation:n};return await(0,k.D3)("extendify_site_style",i),await(0,k.D3)("extendify_animation_settings",{type:t.animation??"fade",speed:"medium"}),L.pS.parse({siteStyle:i})},de,{caller:"handleSiteStyle"}):((0,N.b)({error:{message:a.statusText,name:"FetchError",status:a.status},details:{source:"auto-launch",caller:"handleSiteStyle"}}),de)})(e))),it("siteStrings",()=>i.siteProfile?.title?i:null,async e=>(y({stage:"get_strings"}),await(0,ce.W)(e))),it("siteImages",()=>i.siteProfile?.title?i:null,async e=>(y({stage:"get_images"}),await(0,V.W)(e))),it("launchDecisions",()=>i.siteProfile?.title?i:null,async e=>(y({stage:"get_launch_decisions"}),await(async({siteProfile:e})=>{const t=JSON.stringify({...u.m,siteProfile:e}),a=await(0,c.Li)(()=>(0,c.u9)(J,{method:"POST",headers:Q,body:t}));return a?.ok?(0,c.pv)(async()=>({launchDecisions:L.Wq.parse(await a.json())}),Y):Y})(e))),it("home",()=>[i.siteProfile,i.siteStyle,i.siteImages,i.sitePlugins,i.aiHeaders].every(e=>void 0!==e)?i:null,async e=>(y({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
// translators: this is for a action log UI. Keep it short
(0,c.Lx)((0,b.__)("Preparing your home page","extendify-local"));const s=JSON.stringify({...u.m,siteProfile:e,siteImages:a,sitePlugins:t,aiHeaders:n,pages:i?.pages??[],buildId:i?.buildId}),r=await(0,c.Li)(()=>(0,c.u9)(H,{method:"POST",headers:W,body:s})).catch(e=>({ok:!1,statusText:e.message,status:0}));if(!r?.ok)throw(0,N.b)({error:{message:r.statusText,name:"FetchError",status:r.status},details:{source:"auto-launch",caller:"handleHome"}}),new Error(r.statusText);const l=L.py.parse(await r.json());l.patterns=((e,t)=>t?.patternCode?[{name:t.patternId,code:t.patternCode,patternTypes:["hero-header"],contentGenerated:!0},...e]:e)(l.patterns,i),l.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})})(l.patterns,i);const o=!!Array.isArray(U)&&U.includes(R??"")&&"Business"===e.category,{headers:d,footers:p}=await(0,k.cv)({useNavFooter:o}),g=d[Math.floor(Math.random()*d.length)],m=p[Math.floor(Math.random()*p.length)],f=i?.headerCode??g?.content?.raw?.trim()??"",h=m?.content?.raw?.trim()??"";return L.LL.parse({home:{...l,headerCode:f,footerCode:h}})})(e))),it("pages",()=>[i.siteProfile,i.siteStyle,i.siteImages,i.sitePlugins].every(e=>void 0!==e)?i:null,async e=>(y({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
(0,c.Lx)((0,b.__)("Preparing your pages","extendify-local"));const s=JSON.stringify({...u.m,siteProfile:e,siteStyle:a,siteImages:{siteImages:n},sitePlugins:t,includeOptional:!1,pages:i?.pages??[],buildId:i?.buildId}),r=await(0,c.Li)(()=>(0,c.u9)(G,{method:"POST",headers:q,body:s})),l=((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})(X.parse(await r.json()).recommended,i);return L.uH.parse({pages:l})})(e))),it("generalUpdates",()=>[i.siteProfile,i.home,i.pages].every(e=>void 0!==e)?i:null,async({siteProfile:e,sitePlugins:a,siteStyle:n})=>{y({stage:"set_general",siteProfile:e,sitePlugins:a,siteStyle:n});const{title:i}=e;
// translators: this is for a action log UI. Keep it short
t((0,b.__)("Adding admin configurations","extendify-local")),await(0,k.D3)("permalink_structure","/%postname%/"),s(!0),i&&await(0,k.D3)("blogname",i)}),it("pluginConfigurations",()=>i.sitePlugins?i:null,async()=>{y({stage:"set_plugin_config"});const e=await Me();if(Pe(e,"wpforms-lite")&&await(0,k.D3)("wpforms_activation_redirect","skip"),Pe(e,"all-in-one-seo-pack")&&await(0,k.D3)("aioseo_activation_redirect","skip"),Pe(e,"google-analytics-for-wordpress")){const e="_transient__monsterinsights_activation_redirect";await(0,k.D3)(e,null)}}),(0,w.useEffect)(()=>{if(a())return;const{home:s,pages:l,siteProfile:p,sitePlugins:g,siteStyle:h,aiBlogTitles:x,siteImages:w,designBuild:v,launchDecisions:j}=i;s&&l&&(r.current||(r.current=!0,(async()=>{const{objective:e,structure:a,category:r}=p;await(async(e,{installedSlugs:t=[]}={})=>{const a=await Me(),n=e.filter(e=>!a?.some(t=>t.split("/")[0]===e));if(!n.length)return;const{failed:i}=await Oe(n,{installedSlugs:t});i.length&&(0,N.b)({error:{message:`Plugins inactive after verify: ${i.join(", ")}`},details:{source:"auto-launch",caller:"verifyPluginsActive",failed:i}})})((g??[]).map(({wordpressSlug:e})=>e),{installedSlugs:at});const C=!!Array.isArray(et)&&et.includes(tt??"")&&"Business"===r,_=h?.variation?.settings?.typography?.fontFamilies?.custom;let S=h?.variation;if(_?.length){y({stage:"install_fonts"}),
// translators: this is for a action log UI. Keep it short
t((0,b.__)("Installing fonts locally","extendify-local"));const e=await(async e=>{const t=[];for(const a of e)t.push(await he(a));return t.filter(Boolean)})(_).catch(()=>[]);S=((e,t)=>(0,E.$N)(e,{settings:{typography:{fontFamilies:{custom:null}}}},{settings:{typography:{fontFamilies:{custom:t.filter(Boolean)}}}}))(h.variation,e)}if(h?.vibe&&"natural-1"!==h.vibe){
// translators: vibe in this context is a noun - the feeling of their site design.
t((0,b.__)("Setting the website style","extendify-local")),y({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 m()({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:Ge(n,e)}]:[t,a]})):null})(h.vibe).catch(()=>null);e&&(S={...S,styles:{...S.styles,blocks:e}})}y({stage:"set_vibe"}),await(e=>((e,t={})=>{const{settings:a,styles:n}=t;if(a&&n)return m()({path:`wp/v2/global-styles/${e}`,method:"POST",data:{id:e,settings:a,styles:n}})})(Qe,e))(S),t((0,b.__)("Working on the navigation","extendify-local"));const{id:L}=await He({title:(0,b.__)("Header Navigation","extendify-local"),slug:"site-navigation"});let M=Ve(s.headerCode||"",{ref:L});if(M=((e,t)=>{const a=t?.navExtras;if(!a||"none"===a)return e;const n=(e=>{switch(e?.navExtras){case"button":return`\x3c!-- wp:buttons {"className":"ext-nav-extras-btn"} --\x3e\n<div class="wp-block-buttons ext-nav-extras-btn">\x3c!-- wp:button {"className":"is-style-ext-preset--button--natural-1--button-1","style":{"spacing":{"padding":{"left":"20px","right":"20px","top":"8px","bottom":"8px"}},"typography":{"lineHeight":1.6}},"fontSize":"small"} --\x3e\n<div class="wp-block-button is-style-ext-preset--button--natural-1--button-1"><a class="wp-block-button__link has-small-font-size has-custom-font-size wp-element-button" href="#extendify-navbar-cta" style="padding-top:8px;padding-right:20px;padding-bottom:8px;padding-left:20px;line-height:1.6">${e?.navButtonLabel||(0,b.__)("Get Started","extendify-local")}</a></div>\n\x3c!-- /wp:button --\x3e</div>\n\x3c!-- /wp:buttons --\x3e`;case"phone-number":return'\x3c!-- wp:group {"className":"ext-nav-extras-phone","style":{"spacing":{"blockGap":"6px"}},"layout":{"type":"flex","flexWrap":"nowrap","verticalAlignment":"center"}} --\x3e\n<div class="wp-block-group ext-nav-extras-phone">\x3c!-- wp:image {"sizeSlug":"large","style":{"layout":{"selfStretch":"fixed","flexSize":"21px"},"color":{"duotone":"var:preset|duotone|primary-foreground"},"spacing":{"margin":{"bottom":"6px"}}}} --\x3e\n<figure class="wp-block-image size-large" style="margin-bottom:6px"><img src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgZmlsbD0iIzAwMDAwMCIgdmlld0JveD0iMCAwIDI1NiAyNTYiPjxwYXRoIGQ9Ik0yMjQsMTU0LjhsLTQ3LjA5LTIxLjExLS4xOC0uMDhhMTkuOTQsMTkuOTQsMCwwLDAtMTksMS43NSwxMy4wOCwxMy4wOCwwLDAsMC0xLjEyLjg0bC0yMi4zMSwxOWMtMTMtNy4wNS0yNi40My0yMC4zNy0zMy40OS0zMy4yMWwxOS4wNi0yMi42NmExMS43NiwxMS43NiwwLDAsMCwuODUtMS4xNSwyMCwyMCwwLDAsMCwxLjY2LTE4LjgzLDEuNDIsMS40MiwwLDAsMS0uMDgtLjE4TDEwMS4yLDMyQTIwLjA2LDIwLjA2LDAsMCwwLDgwLjQyLDIwLjE1LDYwLjI3LDYwLjI3LDAsMCwwLDI4LDgwYzAsODEuNjEsNjYuMzksMTQ4LDE0OCwxNDhhNjAuMjcsNjAuMjcsMCwwLDAsNTkuODUtNTIuNDJBMjAuMDYsMjAuMDYsMCwwLDAsMjI0LDE1NC44Wk0xNzYsMjA0QTEyNC4xNSwxMjQuMTUsMCwwLDEsNTIsODAsMzYuMjksMzYuMjksMCwwLDEsODAuNDgsNDQuNDZsMTguODIsNDJMODAuMTQsMTA5LjI4YTEyLDEyLDAsMCwwLS44NiwxLjE2QTIwLDIwLDAsMCwwLDc4LDEzMC4wOGM5LjQyLDE5LjI4LDI4LjgzLDM4LjU2LDQ4LjMxLDQ4QTIwLDIwLDAsMCwwLDE0NiwxNzYuNjNhMTEuNjMsMTEuNjMsMCwwLDAsMS4xMS0uODVsMjIuNDMtMTkuMDcsNDIsMTguODFBMzYuMjksMzYuMjksMCwwLDEsMTc2LDIwNFoiPjwvcGF0aD48L3N2Zz4=" alt=""/></figure>\n\x3c!-- /wp:image --\x3e\n\n\x3c!-- wp:paragraph {"className":"no-underline","style":{"elements":{"link":{"color":{"text":"var:preset|color|primary"}}},"typography":{"fontSize":"18px","fontStyle":"normal","fontWeight":"700","textDecoration":"none"}},"textColor":"primary"} --\x3e\n<p class="no-underline has-primary-color has-text-color has-link-color" style="font-size:18px;font-style:normal;font-weight:700;text-decoration:none"><a href="tel:206-555-0100" data-type="tel" data-id="tel:206-555-0100">206-555-0100</a></p>\n\x3c!-- /wp:paragraph --\x3e</div>\n\x3c!-- /wp:group --\x3e';case"social-icons":return'\x3c!-- wp:social-links {"iconColor":"foreground","iconColorValue":"var(--wp--preset--color--foreground)","size":"has-small-icon-size","className":"is-style-logos-only ext-hidden tablet:ext-flex ext-nav-extras-social","style":{"spacing":{"blockGap":"1rem"}},"layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"right"}} --\x3e\n<ul class="wp-block-social-links has-small-icon-size has-icon-color is-style-logos-only ext-hidden tablet:ext-flex ext-nav-extras-social">\x3c!-- wp:social-link {"url":"https://www.instagram.com/","service":"instagram"} /--\x3e\n\n\x3c!-- wp:social-link {"url":"https://www.facebook.com/","service":"facebook"} /--\x3e\n\n\x3c!-- wp:social-link {"url":"https://x.com/","service":"x"} /--\x3e</ul>\n\x3c!-- /wp:social-links --\x3e';default:return null}})(t);if(!n)return e;const i=e.replace(/<!--\s*wp:([\w-]+)\b[^>]*ext-nav-extras-[\w-]+[^>]*-->[\s\S]*?<!--\s*\/wp:\1\s*-->\s*/g,""),s=i.indexOf("ext-nav-extras");if(-1===s)return i;const r=i.slice(s).match(/<!--\s*\/wp:group\s*-->/);if(!r)return i;const l=s+r.index;return`${i.slice(0,l)}${n}\n${i.slice(l)}`})(M,j),"landing-page"===e){
// translators: this is for a action log UI. Keep it short
t((0,b.__)("Perfecting a landing page","extendify-local"));const e=/<!--\s*wp:social-links\b[^>]*>.*?<!--\s*\/wp:social-links\s*-->/gis;M=M.replace(/<!--\s*wp:navigation\b[^>]*.*\/-->/gis,"").replace(e,"")}M=M.replaceAll("206-555-0100","string"==typeof p.phoneNumber&&p.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,b.__)("206-555-0100","extendify-local")),y({stage:"set_navigation"});let P=null,T=s.footerCode||"";C&&(P=(await He({title:(0,b.__)("Footer Navigation","extendify-local"),slug:"footer-navigation"})).id,T=Ve(T,{ref:P})),y({stage:"set_footer"}),await Ze("extendable/footer",T),
// translators: this is for a action log UI. Keep it short
t((0,b.__)("Creating pages","extendify-local"));const D=(e=>{const{home:t,pages:a,siteProfile:n}=e,i={id:"home",name:be.Q.home.title,slug:"home",patterns:t.patterns},s="blog"===n.objective?{name:be.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)})(i),A=l?.[0]?.patterns?.find(e=>e.patternTypes?.includes("page-title"));A&&(y({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<main class="wp-block-group" style="margin-top:0px;margin-bottom:0px">\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,ve.createBlock)("core/post-title",a)}return e.innerBlocks?.length&&(e.innerBlocks=e.innerBlocks.map(a)),e};return(0,ve.serialize)((0,ve.parse)(e).map(a))})(e)}\n\t\t\t\x3c!-- wp:post-content {"layout":{"type":"constrained"}} /--\x3e\n\t\t</main>\n\t\t\x3c!-- /wp:group --\x3e\n\t\t\x3c!-- wp:template-part {"slug":"footer","tagName":"footer"} /--\x3e\n\t\t`;try{await m()({path:"/wp/v2/templates/extendable/page-with-title",method:"POST",data:{slug:"page-with-title",theme:"extendable",type:"wp_template",status:"publish",description:(0,b.__)("Added by Launch","extendify-local"),content:t}})}catch{}})(A.code));const O=await Me(),$=new Set(je.filter(({plugin:e})=>g.some(t=>t.wordpressSlug===e)||Pe(O,e)).map(({slug:e})=>e)),I=D.filter(e=>!$.has(e.slug)),B=[];y({stage:"replace_placeholder_patterns"});for(const e of I){const t=await Ee(e.patterns),a={...e,patterns:t};B.push(a)}y({stage:"generate_page_content"});const F=await(async(e,t)=>{const a=e.map(Ye),n=await Promise.allSettled(a.map(({toGenerate:e})=>(async(e,t)=>{const{siteProfile:a}=t;return await(0,c.Li)(async()=>{const t=await fetch(`${d.AY}/api/patterns`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...u.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??[]]}})})(B,i),z=F.find(e=>"home"===e.slug),H=z?.patterns?.find(e=>e.patternTypes?.includes("hero-header")),R=H?.code?.match(/<p[^>]*>([\s\S]*?)<\/p>/),U=R?.[1]?.replace(/<[^>]+>/g,"").trim();n("heroDescription",U||i.heroDescription);const W=await Ce(F),V=s?.patterns?.some(e=>e.patternTypes.includes("blog-section"));("blog"===e||V)&&(y({stage:"create_blog_sample_data"}),
// translators: this is for a action log UI. Keep it short
t((0,b.__)("Creating blog sample data","extendify-local")),await(0,k.Hi)({aiBlogTitles:x},w)),w?.length&&(y({stage:"set_hello_world_image"}),await(async e=>{try{const t=window.extLaunchData?.helloWorldPostSlug;let a=await m()({path:`wp/v2/posts?slug=${t}`});if(a.length||(a=await m()({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(0,k.JW)(i,{alt:(0,b.__)("Hello World Featured Image","extendify-local"),filename:"hello-world-featured.jpg",caption:""});if(!s||!s.id)return void console.error("Image upload failed.");await m()({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)}})(w));let Y={};C&&(y({stage:"create_imprint"}),Y=await(async({siteStyle:e})=>{try{const t=await(async({siteStyle:e})=>{const t=await fetch(`${d.zL}/api/page-imprint`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...u.m,siteStyle:e})});return{...(await t.json()).template}})({siteStyle:e}),[a]=await Ce([t]);return a}catch(e){return console.error("Failed to add imprint page:",e),null}})({siteStyle:h}).catch(()=>null));const J=[];if(Pe(O,"woocommerce")){y({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,b.__)("Setting up your online store","extendify-local")),await(0,c.Ex)({path:"/extendify/v1/auto-launch/import-woocommerce"}).catch(()=>null);const e=await(0,k.om)("woocommerce_shop_page_id"),a=e?await(0,k.MD)(e):null;a&&J.push(a)}Pe(O,"the-events-calendar")&&J.push({title:{rendered:(0,b.__)("Events","extendify-local")},slug:"events",link:`${Ke}/events`}),y({stage:"set_page_links"});const Q="single-page"===a?await(async(e,t,a,n="")=>{let i=e?.[0]?.content?.raw;if(!i)return{wpPages:e,headerCode:n};const{objective:s,activePlugins:r,landingPageCTALink:l}=a;if("landing-page"===s){const t=l&&"string"==typeof l?l:"#";return e[0]=Le({id:e[0].id,content:i.replaceAll(/href="(#extendify-[\w|-]+)"/gi,`href="${t}"`)}),{wpPages:e,headerCode:n.replaceAll(/href="(#extendify-[\w|-]+)"/gi,`href="${t}"`)}}const o=t?.[0]?.patterns?.map(e=>e?.patternTypes?.[0])?.filter(e=>"hero-header"!==e)?.map(e=>{const{slug:t}=Object.values(be.Q).find(({alias:t})=>t.includes(e))||{};return t})?.filter(Boolean)?.flat(),c=t?.filter(e=>"home"!==e.slug)?.map(e=>e.slug)?.filter(Boolean)??[],d=[];if(Pe(r,"woocommerce")){const e=await(0,k.MD)(await(0,k.om)("woocommerce_shop_page_id")).catch(()=>null);e?.slug&&d.push(e.slug)}Pe(r,"the-events-calendar")&&d.push("events");const u=(o??[]).concat(d);if(!u.length)return e[0]=Le({id:e[0].id,content:i.replaceAll(/href="(#extendify-[\w|-]+)"/gi,'href="#"')}),{wpPages:e,headerCode:n.replaceAll(/href="(#extendify-[\w|-]+)"/gi,'href="#"')};const{suggestedLinks:p}=await ze({pageContent:n?`${i}\n${n}`:i,availablePages:u})||{};let g=n;return i=Object.keys(p??{}).reduce((e,t)=>{const a=p[t];if(!a)return e;const n=d.concat(c).includes(a)?`"${Ie}/${a}"`:`"${Ie}/#${a}"`;return g=g.replaceAll(`"${t}"`,n),e.replaceAll(`"${t}"`,n)},i),e[0]=Le({id:e[0].id,content:i}),{wpPages:e,headerCode:g}})(W,F,{objective:e,activePlugins:O,landingPageCTALink:p.landingPageCTALink},M):await(async(e,t,a="")=>{const n=e.find(({originalSlug:e})=>e?.startsWith("contact"))?.slug,i=e.filter(Fe).map(({content:e})=>(0,ve.parse)(e.raw||"").map(e=>(0,ve.getBlockContent)(e)).filter(e=>e.match(Be)).join(""));a?.match(Be)&&i.push(a);const s=e.concat(t).filter(({slug:e})=>!e.startsWith("home")).map(({slug:e})=>`/${e}`),r=(await Promise.allSettled(i.map(e=>ze({pageContent:e,availablePages:s})||{}))).filter(e=>"fulfilled"===e.status).map(e=>e.value?.suggestedLinks||[]).reduce((e,t)=>{for(const a in t)e[a]=t[a];return e},{}),l=Object.keys(r).filter(e=>s.includes(`/${r[e].replace(/^\//,"")}`)).map(e=>`\\"${e}\\"`).join("|"),o=(await Promise.allSettled(e.filter(Fe).map(e=>{const t=l?e.content.raw.replace(new RegExp(l,"g"),t=>{if(!t||0===r.length)return"";const a=r[t.replace(/"/g,"")];return[e.slug,`/${e.slug}`,"/"].includes(a)?`"${Ie}/${n??""}"`:`"${Ie}/${a.replace(/^\//,"")}"`}):e.content.raw.replace(new RegExp(Be,"g"),e=>e?'href="#"':"");return Le({id:e.id,content:t})}))).filter(e=>"fulfilled"===e.status).map(e=>e.value),c=l?a.replace(new RegExp(l,"g"),e=>{const t=r[e.replace(/"/g,"")];return"/"===t?`"${Ie}/${n??""}"`:`"${Ie}/${t.replace(/^\//,"")}"`}):a.replace(new RegExp(Be,"g"),'href="#"');return{wpPages: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}}),headerCode:c}})(W,J,M),Z=Q.wpPages;M=Q.headerCode,await Ze("extendable/header",M);const G=[];if(P&&Y?.title){const{originalSlug:e,title:t}=Y;G.push({id:e,name:t.rendered,slug:e,patterns:[]})}if(y({stage:"set_navigation_links"}),"landing-page"!==e){const e=v?.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)??[],l=e=>{const t=e.patternTypes?.[0],a=Object.values(be.Q).find(({alias:e})=>e.includes(t))||{};return{label:e.navLabel??a.title,slug:e.navSlug??a.slug}},o=t.filter(e=>{const{slug:t}=l(e);return t&&!s.includes(t)}),c=new Set,d=o.map(e=>{const{label:t,slug:a}=l(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=l(o[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(l(o[t]).slug)),...u.filter((e,t)=>!n.has(a[t].slug))].join("")}else p=d.concat(u).join("");await Re(e,p)})(L,s?.patterns,J,W,{orderedSlugs:e}):await Ue(L,D,Z,J,{orderedSlugs:e}),P&&await Ue(P,G,Y?.id?[...Z,Y]:Z,[])}y({stage:"prefetch_assist_data"}),await(async()=>await m()({path:"extendify/v1/auto-launch/prefetch-assist-data"}))(),y({stage:"final_steps"}),await(e=>{const t=(0,Je.select)("core/preferences").get("core","renderingModes")||{};t?.extendable?.page!==e&&(0,Je.dispatch)("core/preferences").set("core","renderingModes",{...t,extendable:{...t.extendable||{},page:e}})})("template-locked"),await m()({path:"/extendify/v1/launch/post-launch-functions",method:"POST"}),w?.length&&await(0,k.N7)(w).catch(()=>null),
// translators: this is for a action log UI. Keep it short
t((0,b.__)("All done!","extendify-local")),await y({stage:"finished",siteProfile:p,sitePlugins:g,siteStyle:h}),o(!1),f(!0)})().catch(t=>{console.error(t),(0,N.b)({error:t,details:{source:"auto-launch",caller:"create-site"}}),r.current=!1,a(!0),e((0,b.__)("Something went wrong during the final steps. We will try again but you may need to refresh the page.","extendify-local"))})))},[i,a,s]),{done:g}},it=(e,t,a)=>{const{setData:n,setErrorMessage:i,needToStall:s}=(0,p.w)(),r=t?.()??null,{data:l,error:o}=(0,Xe.A)(r&&!s()?e:null,()=>a(t()));(0,w.useEffect)(()=>{l&&Object.entries(l).forEach(([e,t])=>{n(e,t)})},[l,n]),(0,w.useEffect)(()=>{o&&!s()&&(console.error(o),(0,N.b)({error:o,details:{source:"auto-launch",caller:"run-step"}}),i((0,b.__)("Having some trouble with this step. Trying again...","extendify-local")))},[o,i,s])},st=(0,l.jsxs)("svg",{viewBox:"0 0 2524 492",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:(0,b.__)("Extendify Logo","extendify-local")}),(0,l.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,l.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,l.jsx)("path",{d:"M994.142 125H1150.14V176H994.142V125ZM1102.64 372H1041.64V48H1102.64V372Z",fill:"currentColor"}),(0,l.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,l.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,l.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,l.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,l.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,l.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,l.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"})]}),rt=((0,b._x)("Loading animation","icon","extendify-local"),(0,b.__)("Checkmark","extendify-local"),(0,l.jsxs)("svg",{viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:(0,b.__)("Sparkles","extendify-local")}),(0,l.jsx)("path",{d:"M17.0909 9.81818L18 7.81818L20 6.90909L18 6L17.0909 4L16.1818 6L14.1818 6.90909L16.1818 7.81818L17.0909 9.81818Z",fill:"currentColor"}),(0,l.jsx)("path",{d:"M17.0909 14.1818L16.1818 16.1818L14.1818 17.0909L16.1818 18L17.0909 20L18 18L20 17.0909L18 16.1818L17.0909 14.1818Z",fill:"currentColor"}),(0,l.jsx)("path",{d:"M11.6364 10.1818L9.81818 6.18182L8 10.1818L4 12L8 13.8182L9.81818 17.8182L11.6364 13.8182L15.6364 12L11.6364 10.1818ZM10.5382 12.72L9.81818 14.3055L9.09818 12.72L7.51273 12L9.09818 11.28L9.81818 9.69455L10.5382 11.28L12.1236 12L10.5382 12.72Z",fill:"currentColor"})]})),lt=(0,l.jsxs)("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:(0,b.__)("Three bars loading animation","extendify-local")}),(0,l.jsxs)("rect",{x:"6",y:"20",width:"6",height:"6",rx:"3",fill:"currentColor",fillOpacity:"0.5",children:[(0,l.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,l.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,l.jsxs)("rect",{x:"20",y:"20",width:"6",height:"6",rx:"3",fill:"currentColor",fillOpacity:"0.5",children:[(0,l.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,l.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,l.jsxs)("rect",{x:"34",y:"20",width:"6",height:"6",rx:"3",fill:"currentColor",fillOpacity:"0.5",children:[(0,l.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,l.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"})]})]}),ot=(0,l.jsxs)("svg",{width:"172",height:"118",viewBox:"0 0 172 118",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,l.jsx)("title",{children:(0,b.__)("Site creation loading animation","extendify-local")}),(0,l.jsx)("rect",{x:"1",y:"1",width:"170",height:"116",rx:"12",stroke:"currentColor",strokeOpacity:"0.5",strokeWidth:"2",strokeLinecap:"round"}),(0,l.jsxs)("g",{clipPath:"url(#clip0)",children:[(0,l.jsxs)("rect",{rx:"6",fill:"url(#gradTL)",children:[(0,l.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,l.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,l.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,l.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,l.jsxs)("rect",{rx:"6",fill:"url(#gradTR)",children:[(0,l.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,l.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,l.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,l.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,l.jsxs)("rect",{rx:"6",fill:"url(#gradBL)",children:[(0,l.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,l.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,l.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,l.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,l.jsxs)("rect",{rx:"6",fill:"url(#gradBR)",children:[(0,l.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,l.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,l.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,l.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,l.jsxs)("defs",{children:[(0,l.jsxs)("linearGradient",{id:"gradTL",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.5"}),(0,l.jsx)("stop",{offset:"50%",stopColor:"currentColor",stopOpacity:"0.35"}),(0,l.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.5"})]}),(0,l.jsxs)("linearGradient",{id:"gradTR",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.5"}),(0,l.jsx)("stop",{offset:"50%",stopColor:"currentColor",stopOpacity:"0.35"}),(0,l.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.5"})]}),(0,l.jsxs)("linearGradient",{id:"gradBL",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.5"}),(0,l.jsx)("stop",{offset:"50%",stopColor:"currentColor",stopOpacity:"0.35"}),(0,l.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.5"})]}),(0,l.jsxs)("linearGradient",{id:"gradBR",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[(0,l.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"0.5"}),(0,l.jsx)("stop",{offset:"50%",stopColor:"currentColor",stopOpacity:"0.35"}),(0,l.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0.5"})]}),(0,l.jsx)("clipPath",{id:"clip0",children:(0,l.jsx)("rect",{width:"154",height:"100",fill:"white",transform:"translate(9 9)"})})]})]});var ct=a(3473),dt=a(6221);const{adminUrl:ut,homeUrl:pt}=window.extSharedData,gt=({height:e})=>{const{done:t}=nt(),a=(0,w.useRef)(0),[n,s]=(0,w.useState)(null),[r,o]=(0,w.useState)(!1),{statusMessages:c,errorMessage:d,setErrorMessage:u,errorCount:g,needToStall:m,resetErrorCount:f,setPulse:h}=(0,p.w)();return((e,t=2e3,a=[])=>{const n=(0,w.useRef)(0),i=(0,w.useRef)(null);(0,w.useEffect)(()=>{const a=()=>{clearTimeout(i.current);const s=Date.now(),r=Math.max(0,n.current+t-s),l=()=>{n.current=Date.now(),e()&&a()};0===r?l():i.current=setTimeout(l,r)};return a(),()=>{clearTimeout(i.current),i.current=null}},[e,t,...a])})(()=>!d&&(!(a.current>=c.length)&&(c.length-a.current>3&&a.current>0&&(a.current=c.length-3),s(c[a.current]),a.current+=1,a.current<c.length)),Math.floor(2500+750*Math.random()),[c.length]),(0,w.useEffect)(()=>{if(!d)return;const e=setTimeout(()=>{u(null)},5e3);return()=>clearTimeout(e)},[d,u]),(0,w.useEffect)(()=>{h(!t)},[t]),(0,w.useEffect)(()=>{if(!t)return;o(!0);const e=setTimeout(()=>{window.location.replace(`${pt}?extendify-launch-success=1`)},3e3);return()=>clearTimeout(e)},[t]),(0,w.useEffect)(()=>{if(!m())return;const e=setTimeout(()=>{f()},1e4);return()=>clearTimeout(e)},[m,g,f]),m()?(0,l.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,l.jsxs)("div",{className:"flex gap-2",children:[(0,l.jsx)("div",{className:"w-6 shrink-0 pt-0.5",children:(0,l.jsx)(i.A,{icon:ct.A,size:24})}),(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,l.jsx)("span",{className:"text-lg font-semibold leading-7 text-gray-900",children:(0,b.__)("We are experiencing some delays","extendify-local")}),(0,l.jsx)("span",{className:"text-base font-normal leading-6 text-gray-900",children:(0,b.__)("Pausing for a few seconds","extendify-local")})]})]})}):(0,l.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,l.jsx)("div",{className:"text-design-main",children:ot}),(0,l.jsx)("div",{className:"h-5 overflow-hidden",children:(0,l.jsx)(dt.N,{mode:"wait",children:n?(0,l.jsx)(_.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})}),d?(0,l.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,l.jsx)(i.A,{icon:ct.A,size:24}),(0,l.jsx)("span",{className:"text-sm font-medium leading-5 text-gray-900",children:d})]}):null,r?(0,l.jsx)(mt,{}):null]})},mt=()=>(0,l.jsx)("iframe",{title:"Admin Loader",src:ut,style:{display:"none"},sandbox:"allow-same-origin allow-scripts allow-forms"}),ft=e=>{return t=window.extLaunchData?.activeTests?.[e],{variant:t?.variant??null,percentage:"number"==typeof t?.percentage?t.percentage:null};var t},{installedPluginsSlugs:ht}=window.extSharedData||{};var xt=a(8537),yt=a(5367),wt=a(1450);const bt=()=>"B"===ft("AutoLaunch.ShowTitle").variant,vt=()=>{const{setData:e,descriptionBackup:t,urlParams:a}=(0,p.w)();(()=>{const{data:e,error:t}=(0,Xe.A)("required-plugins",()=>ie({requiredOnly:!0})),a=(0,w.useRef)(!1);(0,w.useEffect)(()=>{!a.current&&e?.sitePlugins?.length&&(a.current=!0,Oe(e.sitePlugins.map(({wordpressSlug:e})=>e),{installedSlugs:ht}))},[e])})();const[n,i]=(0,w.useState)(a.description||a.title||t||""),s=window.extSharedData?.siteTitle||"",r=!s||(0,me.isURL)(s)?"":(0,xt.decodeEntities)(s),[o,g]=(0,w.useState)(a.title||r),[m,f]=(0,w.useState)(!1),[h,x]=(0,w.useState)(!1),[y,v]=(0,w.useState)(null),j=(0,w.useRef)(null),{consentTerms:C}=(0,qe.D)(),_=bt(),S=h||(_?0===o.trim().length:0===n.trim().length),L=jt(),k=(0,w.useCallback)(()=>{const e=j.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,w.useEffect)(()=>{e("descriptionBackup",n.trim());const t=requestAnimationFrame(()=>{k()});return()=>cancelAnimationFrame(t)},[n,e]),(0,w.useEffect)(()=>{const e=new AbortController,{signal:t}=e,a=()=>{k();const e=j.current;e?.scrollTo(0,e.scrollHeight)};return window.addEventListener("resize",a,{signal:t}),window.addEventListener("orientationchange",a,{signal:t}),k(),()=>e.abort()},[k]),(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("form",{onSubmit:async t=>{t.preventDefault();const a=o.trim(),i=n.trim();if(_&&e("title",a),e("descriptionRaw",i),window.extSharedData?.showExtendifyCode){if(x(!0),1===await(async e=>{const t=await(0,c.u9)(`${d.AY}/api/launch-decisions/code-recommendation`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...u.m,description:e})}).then(e=>e.ok&&e.json()).catch(()=>null);return 1===t?.recommend?1:0})(i||a))return void e("showExtendifyCodeScreen",!0);x(!1)}e("go",!0)},onClick:()=>j.current?.focus(),className:"relative flex w-full flex-col",children:[(0,l.jsx)(Ct,{title:o,setTitle:g,setData:e,improving:m}),(0,l.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:m||h?(0,l.jsxs)("div",{className:"flex h-49 flex-col items-center justify-center gap-4",children:[(0,l.jsx)("div",{className:"h-12 w-12 text-design-main",children:lt}),(0,l.jsxs)("p",{className:"m-0 text-base leading-6 text-center text-gray-800",children:[h&&(0,b.__)("Reviewing your description...","extendify-local"),m&&(0,b.__)("Enhancing the website description...","extendify-local")]})]}):(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("textarea",{ref:j,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:!_,autoComplete:"off","data-1p-ignore":!0,value:n,onChange:e=>{i(e.target.value)},placeholder:L}),(0,l.jsxs)("div",{className:"flex justify-between items-end gap-4 p-6",children:[(0,l.jsx)("div",{children:(0,l.jsx)(kt,{disabled:0===n.trim().length||n.trim()===y,onClick:async()=>{f(!0);const e=`${d.AY}/api/prompt/improve`,t=await(0,c.u9)(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...u.m,description:n.trim(),title:window.extSharedData.siteTitle})}).then(e=>e.ok&&e.json()).catch(()=>null),a=t?.improvedPrompt;if(f(!1),a){v(a);const e=j.current;if(!e)return i(a);requestAnimationFrame(()=>{e.focus(),e.select(),document.execCommand("insertText",!1,a)||i(a)})}}})}),(0,l.jsx)(_t,{disabled:S})]})]})}),(0,l.jsx)(St,{disabled:S,improving:m||h})]}),(0,l.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:C}})]})},jt=()=>"B"===ft("AutoLaunch.DescriptionPlaceholderLaw").variant?(0,b.__)("E.g., A boutique law firm specializing in family law, estate planning, and real estate, offering trusted, personalized counsel to clients across the region.","extendify-local"):(0,b.__)("E.g., A personal photography portfolio featuring a collection of landscape, portrait, and street photography, capturing moments from around the world.","extendify-local"),Ct=({title:e,setTitle:t,setData:a,improving:n})=>!bt()||n?null:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"mb-4 w-full",children:[(0,l.jsx)("label",{htmlFor:"extendify-launch-site-title",className:"mb-2 block px-2 text-base font-medium leading-6 text-banner-text",children:(0,b.__)("Website title (required)","extendify-local")}),(0,l.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:(0,l.jsx)("input",{id:"extendify-launch-site-title",type:"text",className:"w-full bg-transparent text-base font-medium leading-6 placeholder:text-gray-700 placeholder:font-normal focus:shadow-none focus:outline-hidden border-none text-gray-900 px-6 py-4",autoFocus:!0,autoComplete:"off","data-1p-ignore":!0,value:e,onClick:e=>e.stopPropagation(),onChange:e=>{t(e.target.value),a("title",e.target.value)},placeholder:(0,b.__)("Enter your website name","extendify-local")})})]}),(0,l.jsx)("label",{htmlFor:"extendify-launch-chat-textarea",className:"mb-2 block px-2 text-base font-medium leading-6 text-banner-text",children:(0,b.__)("Describe your website","extendify-local")})]}),_t=({disabled:e})=>"B"===ft("AutoLaunch.SubmitOutside").variant?null:(0,l.jsx)(Lt,{disabled:e}),St=({disabled:e,improving:t})=>"B"!==ft("AutoLaunch.SubmitOutside").variant||t?null:(0,l.jsx)("div",{className:"mt-4 flex justify-end",children:(0,l.jsx)(Lt,{disabled:e})}),Lt=(0,w.forwardRef)((e,t)=>{const a="B"===ft("AutoLaunch.SubmitCreateWebsite").variant?(0,b.__)("Create website","extendify-local"):(0,b.__)("Next","extendify-local");return(0,l.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,l.jsx)("span",{className:"px-1",children:a}),(0,l.jsx)(i.A,{fill:"currentColor",icon:yt.A,size:24})]})}),kt=e=>"B"===ft("AutoLaunch.HideEnhanceAI").variant?null:(0,l.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,l.jsx)(i.A,{icon:wt.A,size:24}),(0,l.jsx)("span",{className:"px-1",children:(0,b.__)("Enhance with AI","extendify-local")})]}),Nt=({skipDescription:e,lastHeight:t})=>{const a="mx-auto w-full max-w-2xl";return e?(0,l.jsx)(_.P.div,{className:a,initial:{opacity:0,height:t||"auto"},animate:{opacity:1,height:400},transition:{duration:.4},children:(0,l.jsx)(gt,{height:400})}):(0,l.jsx)(_.P.div,{className:a,animate:{opacity:1},exit:{opacity:0},transition:{duration:.4},children:(0,l.jsx)(vt,{})})},Mt=()=>window.extSharedData?.partnerLogo?(0,l.jsx)("div",{className:"flex h-10 max-w-52 items-center overflow-hidden md:max-w-72",children:(0,l.jsx)("img",{className:"h-full w-auto max-w-full object-contain",src:window.extSharedData.partnerLogo,alt:window.extSharedData?.partnerName??""})}):(0,l.jsx)(i.A,{width:void 0,icon:st,className:"h-8 w-auto text-banner-text"});var Pt=a(942);const Tt=({onBuildNew:e})=>((0,w.useEffect)(()=>{y({stage:"migrate_screen"})},[]),(0,l.jsxs)(_.P.div,{animate:{opacity:1},exit:{opacity:0},transition:{duration:.4},className:"grid w-full gap-6 sm:mx-auto sm:max-w-xl sm:grid-cols-2 sm:items-start sm:pt-7",children:[(0,l.jsx)(o,{icon:Pt.A,buttonLabel:(0,b.__)("Migrate website","extendify-local"),description:(0,b.__)("Import an existing WordPress website","extendify-local"),onClick:()=>{y({stage:"migrate_screen_migrate"}),window.location.assign(`${window.extSharedData.adminUrl}plugin-install.php?tab=search&s=${encodeURIComponent((0,b.__)("migration","extendify-local"))}`)}}),(0,l.jsx)(o,{icon:rt,highlight:!0,badgeLabel:(0,b.__)("Most Popular","extendify-local"),buttonLabel:(0,b.__)("Build a new website","extendify-local"),description:(0,b.__)("Create a beautiful website in about a minute","extendify-local"),onClick:()=>{y({stage:"migrate_screen_build"}),e()}})]}));var Dt=a(3640),At=a(9384),Ot=a(8638),Et=a(5979);const $t=()=>{const e=(0,At.z)(),t=(0,Ot.I)(),a=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue("--ext-banner-main").trim(),[]),n=(0,w.useMemo)(()=>(0,Dt.Mj)(a).desaturate(.3).lighten(.4).alpha(.25).toRgbString(),[a]),i=(0,w.useMemo)(()=>(0,Dt.Mj)(a).isLight(),[a]),s=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue("--ext-design-main").trim(),[]),r=(0,w.useMemo)(()=>(0,Dt.Mj)(s).desaturate(.3).alpha(.25).toRgbString(),[s]),o=(0,w.useMemo)(()=>Math.random(),[]),c=(0,Et.G)(e,e=>(e/24e3+o)%1),d=(0,Et.G)(c,e=>180*Math.sin(e*Math.PI*2)),u=(0,Et.G)(c,e=>180*Math.cos(e*Math.PI*2));return t?null:i?(0,l.jsx)(_.P.div,{style:{background:`radial-gradient(circle at center, ${r}, transparent 40%)`,x:d,y:u},className:"pointer-events-none absolute inset-0 h-full w-full scale-200"}):(0,l.jsx)(_.P.div,{style:{background:`radial-gradient(circle at center, ${n}, transparent 40%)`,x:d,y:u},className:"pointer-events-none absolute inset-0 h-full w-full scale-200"})},It=()=>(0,l.jsxs)("div",{className:"flex w-full flex-col max-w-5xl p-6 lg:p-10",children:[(0,l.jsx)("h2",{className:"text-lg text-center text-gray-900 font-semibold px-4 py-0 m-0",children:(0,b.__)("One more thing before we start.","extendify-local")}),(0,l.jsxs)("div",{className:"relative mx-auto w-full max-w-xl text-gray-900",children:[(0,l.jsx)("p",{className:"text-base",children:(0,b.__)("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,l.jsx)("a",{className:"mt-4 text-base font-medium text-design-main underline",href:`${window.extSharedData.adminUrl}theme-install.php?theme=extendable`,children:(0,b.__)("Take me there","extendify-local")})]})]});var Bt=a(6427);const Ft=({pages:e})=>{const{resetSiteInformation:t}=window.extLaunchData,{navigationIds:a,templatePartsIds:n,pageWithTitleTemplateId:i}=t||{},s=window.extSharedData.globalStylesPostID,{reset:r}=(0,p.w)(),[o,c]=(0,w.useState)(!1);return(0,l.jsxs)("div",{className:"flex w-full flex-col gap-6 p-6",children:[(0,l.jsx)("h2",{className:"text-2xl leading-8 text-left text-gray-900 font-medium py-0 m-0",children:(0,b.__)("Start Over?","extendify-local")}),(0,l.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,l.jsx)("p",{className:"text-base leading-6 text-left text-gray-900 m-0",children:(0,b.__)("It looks like you have been here before. We need to clean up some things before we can continue.","extendify-local")}),(0,l.jsx)("p",{className:"text-base leading-6 text-left text-gray-900 font-medium m-0",children:(0,b.sprintf)(
// translators: %3$s is the number of old pages
// translators: %3$s is the number of old pages
(0,b.__)("%s pages/posts will be deleted.","extendify-local"),e.length)})]}),(0,l.jsx)("div",{className:"flex justify-between items-center mt-2",children:(0,l.jsx)(zt,{handleOk:async()=>{c(!0),r({exclude:["descriptionBackup"]}),localStorage.removeItem(`extendify-agent-workflows-${window.extSharedData.siteId}`);for(const t of e)try{await m()({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 m()({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 m()({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 m()({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 m()({path:`/wp/v2/templates/${i}?force=true`,method:"DELETE"})}catch(e){console.warn("Failed to delete page-with-title template:",e)}try{s&&await m()({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})})]})},zt=({handleOk:e,handleExit:t,processing:a})=>(0,l.jsxs)(l.Fragment,{children:[(0,l.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,l.jsx)("span",{className:"px-1",children:(0,b.__)("Exit","extendify-local")})}),a?(0,l.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,l.jsx)(Bt.Spinner,{className:"m-0"}),(0,l.jsx)("span",{className:"px-1",children:(0,b.__)("Processing...","extendify-local")})]}):(0,l.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,l.jsx)("span",{className:"px-1",children:(0,b.__)("Delete and start over","extendify-local")}),(0,l.jsx)(i.A,{fill:"currentColor",icon:yt.A,size:24})]})]}),Ht=()=>{const e=(0,Ot.I)(),t=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue("--ext-banner-main").trim(),[]),a=(0,w.useMemo)(()=>(0,Dt.Mj)(t).desaturate(.3).lighten(.4).alpha(.2).toRgbString(),[t]),n=(0,w.useMemo)(()=>(0,Dt.Mj)(t).isLight(),[t]),i=(0,w.useMemo)(()=>getComputedStyle(document.documentElement).getPropertyValue("--ext-design-main").trim(),[]),s=(0,w.useMemo)(()=>(0,Dt.Mj)(i).desaturate(.3).alpha(.2).toRgbString(),[i]);if(e)return null;const r=n?s:a;return(0,l.jsx)(_.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 Rt=a(9363),Ut=a(5492);const Wt=()=>{const e=(0,Je.useSelect)(e=>e("core").getCurrentTheme()),t=e&&"extendable"!==e?.textdomain,a=window.extLaunchData.resetSiteInformation.pagesIds??[],n=a.length>0,{title:i,descriptionRaw:s,go:o,urlParams:c,designBuild:g,setData:h,showExtendifyCodeScreen:x}=(0,p.w)(),v=Boolean(c?.["build-id"])||g||(i||s)&&o,j=!v&&x,C=!v&&!window.extLaunchData?.hideAutoLaunchExitLink,_="B"===ft("AutoLaunch.MigrateScreen").variant,[L,N]=(0,w.useState)(_),M=!v&&L,P=(0,w.useRef)(null);return(0,w.useEffect)(()=>{
// translators: Launch is a noun.
document.title=(0,b.__)("Launch - AI-Powered Web Creation","extendify-local"),(0,k.D3)("extendify_launch_loaded",(new Date).toISOString()),0===(0,ve.getBlockTypes)().length&&(0,Rt.registerCoreBlocks)(),m()({path:"/extendify/v1/auto-launch/pre-launch-functions",method:"POST"}),y({stage:"launch_page"}),(async()=>{const e=await(async()=>{try{return await m()({path:"/extendify/v1/shared/ping",parse:!1}),null}catch(e){return 403===e?.status?"403":404===e?.status?"404":e?.status?null:"network"}})();if(!e)return;const{siteId:t,partnerId:a,homeUrl:n,siteCreatedAt:i}=u.m;fetch(`${d.Dq}/api/v1/event`,{method:"POST",headers:f,body:JSON.stringify({insightsId:t,key:"rest_api_unreachable",payload:{reason:e},partnerId:a,siteURL:n,siteCreatedAt:i}),keepalive:!0})})()},[]),t?(0,l.jsx)(Vt,{children:(0,l.jsx)("div",{className:"bg-white w-full max-w-3xl rounded-lg border border-design-main/60 relative z-10",children:(0,l.jsx)(It,{})})}):n?(0,l.jsx)(Vt,{children:(0,l.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,l.jsx)(Ft,{pages:a})})}):(0,l.jsxs)(Vt,{footer:j?(0,l.jsx)(Jt,{onClick:()=>h("showExtendifyCodeScreen",!1)}):C?(0,l.jsx)(Yt,{}):null,children:[(0,l.jsx)(dt.N,{mode:"wait",initial:!1,children:(0,l.jsx)(Qt,{hide:v||j,migrate:M},M?"migrate":"description")}),(0,l.jsx)("div",{ref:P,className:r()("w-full relative z-10",{"max-w-3xl":_||j,"max-w-2xl":!_&&!j,"md:h-72.75":_&&!v}),children:(0,l.jsxs)(dt.N,{mode:"wait",children:[j&&(0,l.jsx)(S,{onProceed:()=>h("go",!0)},"extendify-code"),!j&&M&&(0,l.jsx)(Tt,{onBuildNew:()=>N(!1)},"migrate-choice"),!j&&!M&&(0,l.jsx)(Nt,{skipDescription:v,lastHeight:P.current?.offsetHeight},v?"description-launch":"creating-launch")]})})]})},Vt=({children:e,footer:t})=>{const{pulse:a}=(0,p.w)();return(0,l.jsxs)("div",{style:{zIndex:1e5},className:"fixed inset-0 bg-white",children:[(0,l.jsx)("div",{className:"relative h-dvh bg-banner-main text-banner-text text-base overflow-y-auto",children:(0,l.jsxs)("div",{className:"relative z-10 min-h-dvh w-full flex flex-col items-center justify-between p-6",children:[(0,l.jsxs)("div",{className:"w-full flex flex-col items-center gap-5 md:gap-8 m-auto",children:[(0,l.jsx)("div",{className:"mb-4",children:(0,l.jsx)(Mt,{})}),e]}),t&&(0,l.jsx)("div",{className:"w-full pt-8 shrink-0",children:t})]})}),(0,l.jsx)($t,{}),a?(0,l.jsx)(Ht,{}):null]})},Yt=()=>(0,l.jsxs)("a",{className:"inline-flex items-center gap-0.5 text-sm text-banner-text opacity-70 hover:opacity-100 transition-opacity",href:window.extSharedData.adminUrl,onClick:()=>y({stage:"exit_to_wp_admin"}),children:[(0,l.jsx)(i.A,{fill:"currentColor",icon:Ut.A,size:20}),(0,b.__)("WP Admin Dashboard","extendify-local")]}),Jt=({onClick:e})=>(0,l.jsxs)("button",{type:"button",onClick:e,className:"inline-flex items-center gap-0.5 border-0 bg-transparent cursor-pointer text-sm text-banner-text opacity-70 hover:opacity-100 transition-opacity",children:[(0,l.jsx)(i.A,{fill:"currentColor",icon:Ut.A,size:20}),(0,b.__)("Back","extendify-local")]}),Qt=({hide:e,migrate:t})=>{const a="B"===ft("AutoLaunch.HeaderParagraphOld").variant;if(e)return null;const n="text-xl md:text-2xl text-pretty text-banner-text font-semibold p-0 m-0 text-center",i={animate:{opacity:1},exit:{opacity:0},transition:{duration:.4}};return t?(0,l.jsx)(_.P.h2,{className:n,...i,children:(0,b.__)("How would you like to start your website?","extendify-local")}):a?(0,l.jsxs)(_.P.div,{className:"flex flex-col items-center gap-2",...i,children:[(0,l.jsx)("h2",{className:n,children:(0,b.__)("Tell Us About Your Website","extendify-local")}),(0,l.jsx)("p",{className:"text-sm md:text-base text-pretty text-banner-text opacity-70 p-0 m-0 text-center max-w-xl",children:(0,b.__)("Share your vision, and we'll craft a website that's perfectly tailored to your needs, ready to launch in no time.","extendify-local")})]}):(0,l.jsx)(_.P.h2,{className:n,...i,children:(0,b.__)("Describe the website you want to build","extendify-local")})};requestAnimationFrame(()=>{const e=document.getElementById("extendify-auto-launch-page");e&&(0,w.createRoot)(e).render((0,l.jsx)(Wt,{}))})},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},8537(e){e.exports=window.wp.htmlEntities},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=4027)),e.O()}]);