import{F as k,r as l,aR as g,c4 as w,ck as S,cl as C,cm as I,a3 as R,aI as V,m as p,bZ as K,Q as A,W as B,R as E,X as L,e as M,c5 as T}from"./vendor-CYDnlB7m.js";import{J as _}from"./index-Dbx5Evda.js";import{b as x}from"./customComponents-ImefLNJb.js";const F=k({__name:"builder-io",props:{apiKey:{},isVisible:{type:Boolean}},emits:["setState"],setup(o,{emit:m}){const v=m,u=o,t=l(!1),e=l(null),n=l(!1);function f(){e.value=null,t.value=!1,n.value=!1}g(()=>{c(window.location.pathname)}),w((a,d)=>{a.path!==d.path&&(f(),c(a.path))});async function c(a){u.apiKey&&(n.value=!0,s("loading"),e.value=await S({model:"page",apiKey:u.apiKey,options:C(new URLSearchParams(location.search)),userAttributes:{urlPath:a}}),n.value=!1,t.value=!!e.value||I(),t.value?s("ready"):s("empty"))}function s(a){v("setState",{state:a})}const r=R(null),y=V(r),i=p(()=>!!y.value&&!!e.value?.data),b=p(()=>_(e.value?.data?.title).title.value);K({title:()=>i.value?b.value:void 0,keywords:()=>i.value?e.value?.data?.keywords:void 0,description:()=>i.value?e.value?.data?.description:void 0});const h=()=>x;return(a,d)=>o.isVisible&&t.value?(E(),A("div",{key:0,ref_key:"builderIoAnchor",ref:r},[L(M(T),{model:"page",content:e.value,"api-key":o.apiKey,"custom-components":h()},null,8,["content","api-key","custom-components"])],512)):B("",!0)}});export{F as default};
//# sourceMappingURL=builder-io-DAOJH6hH.js.map
