import{F as g,r as l,aQ as k,c1 as w,ch as S,ci as C,cj as V,a3 as I,aH as K,m as p,bW as R,Q as A,W as B,R as E,X as L,e as M,c2 as T}from"./vendor-CB-jpi5M.js";import{J as _}from"./index-Bjc9_X6l.js";import{b as x}from"./customComponents-DZtKf30Z.js";const U=g({__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}k(()=>{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||V(),t.value?s("ready"):s("empty"))}function s(a){v("setState",{state:a})}const r=I(null),y=K(r),i=p(()=>!!y.value&&!!e.value?.data),h=p(()=>_(e.value?.data?.title).title.value);R({title:()=>i.value?h.value:void 0,keywords:()=>i.value?e.value?.data?.keywords:void 0,description:()=>i.value?e.value?.data?.description:void 0});const b=()=>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":b()},null,8,["content","api-key","custom-components"])],512)):B("",!0)}});export{U as default};
//# sourceMappingURL=builder-io-DW7xSpPT.js.map
