@builder.io/sdk-react-nextjs 0.14.26 → 0.14.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/{node/USE_CLIENT_BUNDLE-07e24176.js → browser/USE_CLIENT_BUNDLE-1c35fc0a.js} +36 -35
- package/lib/browser/{USE_CLIENT_BUNDLE-26be487e.cjs → USE_CLIENT_BUNDLE-65950ed4.cjs} +5 -5
- package/lib/{edge/USE_SERVER_BUNDLE-06472a9d.cjs → browser/USE_SERVER_BUNDLE-3ea7f606.cjs} +1 -1
- package/lib/{edge/USE_SERVER_BUNDLE-3c38a1b1.js → browser/USE_SERVER_BUNDLE-812dfc95.js} +1 -1
- package/lib/browser/{bundle-999a2785.js → bundle-763c7cf6.js} +311 -302
- package/lib/browser/bundle-aff841a2.cjs +169 -0
- package/lib/browser/index.cjs +1 -1
- package/lib/browser/index.mjs +3 -3
- package/lib/{browser/USE_CLIENT_BUNDLE-4c845b66.js → edge/USE_CLIENT_BUNDLE-cf0350f7.js} +36 -35
- package/lib/{node/USE_CLIENT_BUNDLE-9966f569.cjs → edge/USE_CLIENT_BUNDLE-fc025b97.cjs} +5 -5
- package/lib/{node/USE_SERVER_BUNDLE-e36813e6.cjs → edge/USE_SERVER_BUNDLE-8e198f44.cjs} +1 -1
- package/lib/{node/USE_SERVER_BUNDLE-aa3e89ff.js → edge/USE_SERVER_BUNDLE-ded4dbdc.js} +1 -1
- package/lib/edge/bundle-05000fd3.cjs +189 -0
- package/lib/edge/{bundle-66b04b60.js → bundle-c67d25d8.js} +843 -842
- package/lib/edge/index.cjs +1 -1
- package/lib/edge/index.mjs +3 -3
- package/lib/{edge/USE_CLIENT_BUNDLE-6a4fcac3.js → node/USE_CLIENT_BUNDLE-0fda6fd8.js} +36 -35
- package/lib/{edge/USE_CLIENT_BUNDLE-7517cd42.cjs → node/USE_CLIENT_BUNDLE-c57c9376.cjs} +5 -5
- package/lib/{browser/USE_SERVER_BUNDLE-f8a1ee85.js → node/USE_SERVER_BUNDLE-15a235fc.js} +1 -1
- package/lib/{browser/USE_SERVER_BUNDLE-a3f3b1f7.cjs → node/USE_SERVER_BUNDLE-5472e997.cjs} +1 -1
- package/lib/node/{bundle-1b7db75b.js → bundle-40b09581.js} +26 -17
- package/lib/node/{bundle-e09f3bd9.cjs → bundle-acffe20a.cjs} +6 -6
- package/lib/node/index.cjs +1 -1
- package/lib/node/index.mjs +3 -3
- package/package.json +1 -1
- package/types/cjs/blocks/image/image.types.d.ts +1 -0
- package/types/cjs/components/block/block.helpers.d.ts +20 -2
- package/types/cjs/components/block/components/block-wrapper.d.ts +0 -1
- package/types/cjs/components/content/components/enable-editor.d.ts +1 -1
- package/types/cjs/constants/sdk-version.d.ts +1 -1
- package/types/esm/blocks/image/image.types.d.ts +1 -0
- package/types/esm/components/block/block.helpers.d.ts +20 -2
- package/types/esm/components/block/components/block-wrapper.d.ts +0 -1
- package/types/esm/components/content/components/enable-editor.d.ts +1 -1
- package/types/esm/constants/sdk-version.d.ts +1 -1
- package/lib/browser/bundle-476e30d7.cjs +0 -169
- package/lib/edge/bundle-ba82c7f5.cjs +0 -189
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";const c=require("react/jsx-runtime");require("react");const Ye=require("lru-cache"),C=require("./USE_CLIENT_BUNDLE-65950ed4.cjs");require("next/navigation");const Ge=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),Qe=e=>typeof e=="string"&&Ge.has(e.toLowerCase()),k="rsc",j=()=>{switch(k){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":case"angular":return"class"}};function Xe(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options}}const A="[Builder.io]: ",w={log:(...e)=>console.log(A,...e),error:(...e)=>console.error(A,...e),warn:(...e)=>console.warn(A,...e),debug:(...e)=>console.debug(A,...e)};function v(){return typeof window<"u"&&typeof document<"u"}const Ze=e=>{const t={};return e.forEach((n,o)=>{t[o]=n}),t},fe=e=>e instanceof URLSearchParams?Ze(e):e,he=e=>typeof e=="string"?e:e instanceof URLSearchParams?e.toString():new URLSearchParams(e).toString();function et(){return v()&&window.self!==window.top}function H(e){return et()&&he(e||window.location.search).indexOf("builder.frameEditing=")!==-1}const tt=()=>{if(v()){const e=new URL(location.href);return e.pathname===""&&(e.pathname="/"),e}else return console.warn("Cannot get location for tracking in non-browser environment"),null},nt=()=>typeof navigator=="object"&&navigator.userAgent||"",pe=()=>{const e=nt(),t={Android(){return e.match(/Android/i)},BlackBerry(){return e.match(/BlackBerry/i)},iOS(){return e.match(/iPhone|iPod/i)},Opera(){return e.match(/Opera Mini/i)},Windows(){return e.match(/IEMobile/i)||e.match(/WPDesktop/i)},any(){return t.Android()||t.BlackBerry()||t.iOS()||t.Opera()||t.Windows()||k==="reactNative"}},n=e.match(/Tablet|iPad/i),o=tt();return{urlPath:o==null?void 0:o.pathname,host:(o==null?void 0:o.host)||(o==null?void 0:o.hostname),device:n?"tablet":t.any()?"mobile":"desktop"}},ot=({builder:e,context:t,event:n,state:o})=>Object.entries({state:o,Builder:e,builder:e,context:t,event:n}),it=()=>({isEditing:H(),isBrowser:v(),isServer:!v(),getUserAttributes:()=>pe()}),rt=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,Z=({code:e,builder:t,context:n,event:o,localState:i,rootSetState:r,rootState:a})=>{const s=ot({builder:t,context:n,event:o,state:ge({rootState:a,localState:i,rootSetState:r})});return new Function(...s.map(([l])=>l),e)(...s.map(([,l])=>l))};function ge({rootState:e,localState:t,rootSetState:n}){return new Proxy(e,{get:(o,i)=>{if(t&&i in t)return t[i];const r=o[i];return typeof r=="object"&&r!==null?ge({rootState:r,localState:void 0,rootSetState:n?a=>{o[i]=a,n(o)}:void 0}):r},set:(o,i,r)=>{if(t&&i in t)throw new Error("Writing to local state is not allowed as it is read-only.");return o[i]=r,n==null||n(o),!0}})}const T=e=>e!=null;function at(){var e;return typeof process<"u"&&T((e=process==null?void 0:process.versions)==null?void 0:e.node)}const st=()=>{var o;if(!at())return!1;const e=process.arch==="arm64",t=process.version.startsWith("v20"),n=(o=process.env.NODE_OPTIONS)==null?void 0:o.includes("--no-node-snapshot");return e&&t&&!n?(w.log("Skipping usage of `isolated-vm` to avoid crashes in Node v20 on an arm64 machine.\n If you would like to use the `isolated-vm` package on this machine, please provide the `NODE_OPTIONS=--no-node-snapshot` config to your Node process.\n See https://github.com/BuilderIO/builder/blob/main/packages/sdks/README.md#node-v20--m1-macs-apple-silicon-support for more information.\n "),!0):!1},ct=e=>(v()||st(),Z(e)),K=class R{static getCacheKey(t){return JSON.stringify({...t,event:t.event?Math.random():void 0})}static getCachedValue(t){return R.cache.get(t)}static setCachedValue(t,n){R.cache.size>20&&R.cache.delete(R.cache.keys().next().value),R.cache.set(t,{value:n})}};K.cacheLimit=20;K.cache=new Map;let B=K;function O({code:e,context:t,localState:n,rootState:o,rootSetState:i,event:r,isExpression:a=!0,enableCache:s}){if(e==="")return;const l={code:rt(e,{isExpression:a}),builder:it(),context:t,event:r,rootSetState:i,rootState:o,localState:n};if(s){const u=B.getCacheKey(l),h=B.getCachedValue(u);if(h)return h.value}try{const u=ct(l);if(s){const h=B.getCacheKey(l);B.setCachedValue(h,u)}return u}catch(u){w.error("Failed code evaluation: "+u.message,{code:e});return}}const P=e=>JSON.parse(JSON.stringify(e)),lt=(e,t,n)=>{if(Object(e)!==e)return e;const o=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return o.slice(0,-1).reduce((i,r,a)=>Object(i[r])===i[r]?i[r]:i[r]=Math.abs(Number(o[a+1]))>>0===+o[a+1]?[]:{},e)[o[o.length-1]]=n,e};const dt=({block:e,context:t,localState:n,rootState:o,rootSetState:i})=>{if(!e.bindings)return e;const r=P(e),a={...r,properties:{...r.properties},actions:{...r.actions}};for(const s in e.bindings){const l=e.bindings[s],u=O({code:l,localState:n,rootState:o,rootSetState:i,context:t,enableCache:!0});lt(a,s,u)}return a};function F({block:e,context:t,shouldEvaluateBindings:n,localState:o,rootState:i,rootSetState:r}){const a=e;return n?dt({block:a,localState:o,rootState:i,rootSetState:r,context:t}):a}const z=e=>e?e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase():"",be=e=>Object.entries(e).map(([n,o])=>{if(typeof o=="string")return`${z(n)}: ${o};`}).filter(T),ut=e=>be(e).join(`
|
|
2
|
+
`),V=({mediaQuery:e,className:t,styles:n})=>{const o=`.${t} {
|
|
3
|
+
${ut(n)}
|
|
4
|
+
}`;return e?`${e} {
|
|
5
|
+
${o}
|
|
6
|
+
}`:o};function mt({style:e}){return e}const ft=({block:e,context:t})=>ye(mt({style:e.style||{},context:t,block:e}));function ye(e){switch(k){case"svelte":case"vue":case"solid":case"angular":return be(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}const ht=({block:e,context:t,registeredComponents:n})=>{var r;const o=(r=F({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:r.name;if(!o)return null;const i=n[o];if(i)return i;console.warn(`
|
|
7
|
+
Could not find a registered component named "${o}".
|
|
8
|
+
If you registered it, is the file that registered it imported by the file that needs to render it?`)},pt=({block:e,context:t})=>{const{repeat:n,...o}=e;if(!(n!=null&&n.collection))return;const i=O({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,enableCache:!0});if(!Array.isArray(i))return;const r=n.collection.split(".").pop(),a=n.itemName||(r?r+"Item":"item");return i.map((l,u)=>({context:{...t,localState:{...t.localState,$index:u,$item:l,[a]:l,[`$${a}Index`]:u}},block:o}))},gt=(e,t)=>e&&(e.isRSC&&k==="rsc"||["Core:Button","Symbol","Columns","Form:Form","Builder: Tabs","Builder:Accordion"].includes(e.name))?{builderLinkComponent:t}:{},bt=(e,t)=>e&&(e.isRSC&&k==="rsc"||["Symbol","Columns","Form:Form","Builder: Tabs","Builder:Accordion"].includes(e.name))?{builderComponents:t}:{},yt=(e,t)=>e&&(e.isRSC&&k==="rsc"||k==="reactNative"||["Builder:Accordion","Columns","Form:Form","Builder: Tabs","Symbol","Image","Video"].includes(e.name))?{builderBlock:t}:{},St=(e,t)=>e&&(e.isRSC&&k==="rsc"||["Builder:Accordion","Columns","Form:Form","Builder: Tabs","Symbol","Slot"].includes(e.name))?{builderContext:t}:{},Se={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},ee=(e,t=Se)=>`@media (max-width: ${t[e].max}px)`,xe=({small:e,medium:t})=>{const n=P(Se);if(!e||!t)return n;const o=Math.floor(e/2);n.small={max:e,min:o,default:o+1};const i=n.small.max+1;n.medium={max:t,min:i,default:i+1};const r=n.medium.max+1;return n.large={max:2e3,min:r,default:r+1},n};function $(e){return c.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},"data-id":e.id})}function xt(e){const t=function(){const i=F({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return T(i.hide)?!i.hide:T(i.show)?i.show:!0},n=function(){var m,p,y;const i=F({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),r=i.responsiveStyles,a=e.context.content,s=xe(((m=a==null?void 0:a.meta)==null?void 0:m.breakpoints)||{}),l=r==null?void 0:r.large,u=r==null?void 0:r.medium,h=r==null?void 0:r.small,d=i.id;if(!d)return"";const f=l?V({className:d,styles:l}):"",g=u?V({className:d,styles:u,mediaQuery:ee("medium",s)}):"",x=h?V({className:d,styles:h,mediaQuery:ee("small",s)}):"",b=i.animations&&i.animations.find(S=>S.trigger==="hover");let E="";if(b){const S=((y=(p=b.steps)==null?void 0:p[1])==null?void 0:y.styles)||{};E=V({className:`${d}:hover`,styles:{...S,transition:`all ${b.duration}s ${z(b.easing)}`,transitionDelay:b.delay?`${b.delay}s`:"0s"}})||""}return[f,g,x,E].join(" ")};return c.jsx(c.Fragment,{children:n()&&t()?c.jsx(c.Fragment,{children:c.jsx($,{id:"builderio-block",styles:n()})}):null})}function vt(e){return e.charAt(0).toUpperCase()+e.slice(1)}const kt=e=>`on${vt(e)}`,Ct=(e,t)=>n=>O({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1,enableCache:!0});function wt(e){const t={},n=e.block.actions??{};for(const o in n){if(!n.hasOwnProperty(o))continue;const i=n[o];let r=kt(o);if(e.stripPrefix)switch(k){case"vue":r=r.replace("v-on:","");break;case"svelte":r=r.replace("on:","");break}t[r]=Ct(i,e)}return t}function It({properties:e}){return e}const Tt=e=>({href:e.href});function ve({block:e,context:t}){var o;const n={...Tt(e),...e.properties,"builder-id":e.id,style:ft({block:e,context:t}),[j()]:[e.id,"builder-block",e.class,(o=e.properties)==null?void 0:o.class].filter(Boolean).join(" ")};return It({properties:n,context:t,block:e})}const Et=({componentOptions:e,builderBlock:t,context:n,componentRef:o,includeBlockProps:i,isInteractive:r,contextValue:a})=>{const s={...e,...i?{attributes:ve({block:t,context:a})}:{}};return r?{Wrapper:o,block:t,context:n,wrapperProps:e,includeBlockProps:i}:s};function te(e){var n;const t=e.isInteractive?C.InteractiveElement:e.componentRef;return c.jsx(c.Fragment,{children:e.componentRef?c.jsx(c.Fragment,{children:c.jsx(t,{...Et({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,linkComponent:e.linkComponent,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:(n=e.blockChildren)==null?void 0:n.map(o=>c.jsx(L,{block:o,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},o.id))})}):null})}function Rt(e){const t=e.repeatContext;return c.jsx(L,{block:e.block,context:t,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent})}function L(e){var l,u,h;const t=function(){return ht({block:e.block,context:e.context,registeredComponents:e.registeredComponents})},n=function(){return pt({block:e.block,context:e.context})},o=function(){var f;return(f=e.block.repeat)!=null&&f.collection?e.block:F({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})},i=function(){var g;return e.block.tagName==="a"||((g=o().properties)==null?void 0:g.href)||o().href?e.linkComponent||"a":e.block.tagName||"div"},r=function(){var x,b;if((x=e.block.repeat)!=null&&x.collection)return!!((b=n())!=null&&b.length);const f="hide"in o()?o().hide:!1;return("show"in o()?o().show:!0)&&!f},a=function(){var g;return!((g=t())!=null&&g.component)&&!n()?o().children??[]:[]},s=function(){var f,g,x;return{blockChildren:o().children??[],componentRef:(f=t())==null?void 0:f.component,componentOptions:{...Xe(o()),...yt(t(),o()),...St(t(),e.context),...gt(t(),e.linkComponent),...bt(t(),e.registeredComponents)},context:e.context,linkComponent:e.linkComponent,registeredComponents:e.registeredComponents,builderBlock:o(),includeBlockProps:((g=t())==null?void 0:g.noWrap)===!0,isInteractive:!((x=t())!=null&&x.isRSC)}};return c.jsx(c.Fragment,{children:r()?c.jsxs(c.Fragment,{children:[c.jsx(xt,{block:e.block,context:e.context}),(l=t())!=null&&l.noWrap?c.jsx(c.Fragment,{children:c.jsx(te,{componentRef:s().componentRef,componentOptions:s().componentOptions,blockChildren:s().blockChildren,context:s().context,registeredComponents:s().registeredComponents,linkComponent:s().linkComponent,builderBlock:s().builderBlock,includeBlockProps:s().includeBlockProps,isInteractive:s().isInteractive})}):c.jsx(c.Fragment,{children:n()?c.jsx(c.Fragment,{children:(h=n())==null?void 0:h.map((d,f)=>c.jsx(Rt,{repeatContext:d.context,block:d.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},f))}):c.jsxs(C.BlockWrapper,{Wrapper:i(),block:o(),context:e.context,children:[c.jsx(te,{componentRef:s().componentRef,componentOptions:s().componentOptions,blockChildren:s().blockChildren,context:s().context,registeredComponents:s().registeredComponents,linkComponent:s().linkComponent,builderBlock:s().builderBlock,includeBlockProps:s().includeBlockProps,isInteractive:s().isInteractive}),(u=a())==null?void 0:u.map(d=>c.jsx(L,{block:d,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent,context:e.context},d.id))]})})]}):null})}function U(e){var t,n,o;return c.jsx(C.BlocksWrapper,{blocks:e.blocks,parent:e.parent,path:e.path,styleProp:e.styleProp,BlocksWrapper:(t=e.context)==null?void 0:t.BlocksWrapper,BlocksWrapperProps:(n=e.context)==null?void 0:n.BlocksWrapperProps,children:e.blocks?c.jsx(c.Fragment,{children:(o=e.blocks)==null?void 0:o.map(i=>c.jsx(L,{block:i,linkComponent:e.linkComponent,context:e.context,registeredComponents:e.registeredComponents},i.id))}):null})}const Pt=e=>`builder-columns ${e}-breakpoints`;function ke(e){var b,E;const t=typeof e.space=="number"?e.space||0:20,n=e.columns||[],o=e.stackColumnsAt||"tablet",i=function(p){return p.link?e.builderLinkComponent||"a":"div"},r=function(p){var y;return((y=n[p])==null?void 0:y.width)||100/n.length},a=function(p){const y=t*(n.length-1)/n.length;return`calc(${r(p)}% - ${y}px)`},s=function({stackedStyle:p,desktopStyle:y}){return o==="tablet"?p:y},l=function({stackedStyle:p,desktopStyle:y}){return o==="never"?y:p},u=e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column",h=function(){return{"--flex-dir":u,"--flex-dir-tablet":s({stackedStyle:u,desktopStyle:"row"})}},d=function(p){const y=p===0?0:t,S=a(p),I=`${y}px`,Q="100%",X=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:S,["marginLeft"]:I,"--column-width-mobile":l({stackedStyle:Q,desktopStyle:S}),"--column-margin-left-mobile":l({stackedStyle:X,desktopStyle:I}),"--column-width-tablet":s({stackedStyle:Q,desktopStyle:S}),"--column-margin-left-tablet":s({stackedStyle:X,desktopStyle:I})}},f=function(p){var S,I;return xe(((I=(S=e.builderContext.content)==null?void 0:S.meta)==null?void 0:I.breakpoints)||{})[p].max},g=function(){return`
|
|
9
|
+
@media (max-width: ${f("medium")}px) {
|
|
10
|
+
.${e.builderBlock.id}-breakpoints {
|
|
11
|
+
flex-direction: var(--flex-dir-tablet);
|
|
12
|
+
align-items: stretch;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.${e.builderBlock.id}-breakpoints > .builder-column {
|
|
16
|
+
width: var(--column-width-tablet) !important;
|
|
17
|
+
margin-left: var(--column-margin-left-tablet) !important;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@media (max-width: ${f("small")}px) {
|
|
22
|
+
.${e.builderBlock.id}-breakpoints {
|
|
23
|
+
flex-direction: var(--flex-dir);
|
|
24
|
+
align-items: stretch;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.${e.builderBlock.id}-breakpoints > .builder-column {
|
|
28
|
+
width: var(--column-width-mobile) !important;
|
|
29
|
+
margin-left: var(--column-margin-left-mobile) !important;
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
`},x=function(p,y){return{...p.link?{href:p.link}:{},[j()]:"builder-column",style:ye(d(y))}};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Pt((b=e.builderBlock)==null?void 0:b.id)+" div-eeca3604",style:h(),children:[c.jsx($,{id:"builderio-columns",styles:g()}),(E=e.columns)==null?void 0:E.map((m,p)=>c.jsx(C.DynamicRenderer,{TagName:i(m),actionAttributes:{},attributes:x(m,p),children:c.jsx(U,{path:`component.options.columns.${p}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:m.blocks})},p))]}),c.jsx("style",{children:`.div-eeca3604 {
|
|
33
|
+
display: flex;
|
|
34
|
+
line-height: normal;
|
|
35
|
+
}`})]})}function ne(e){return e.replace(/http(s)?:/,"")}function At(e="",t,n){const o=new RegExp("([?&])"+t+"=.*?(&|$)","i"),i=e.indexOf("?")!==-1?"&":"?";return e.match(o)?e.replace(o,"$1"+t+"="+encodeURIComponent(n)+"$2"):e+i+t+"="+encodeURIComponent(n)}function Bt(e,t){if(!e||!(e!=null&&e.match(/cdn\.shopify\.com/))||!t)return e;if(t==="master")return ne(e);const n=e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);if(n){const o=e.split(n[0]),i=n[3],r=t.match("x")?t:`${t}x`;return ne(`${o[0]}_${r}${i}`)}return null}function Vt(e){if(!e)return e;const t=[100,200,400,800,1200,1600,2e3];if(e.match(/builder\.io/)){let n=e;const o=Number(e.split("?width=")[1]);return isNaN(o)||(n=`${n} ${o}w`),t.filter(i=>i!==o).map(i=>`${At(e,"width",i)} ${i}w`).concat([n]).join(", ")}return e.match(/cdn\.shopify\.com/)?t.map(n=>[Bt(e,`${n}x${n}`),n]).filter(([n])=>!!n).map(([n,o])=>`${n} ${o}w`).concat([e]).join(", "):e}const Wt=e=>{if(e==="localhost"||e==="127.0.0.1")return e;const t=e.split(".");return t.length>2?t.slice(1).join("."):e},Ce=({name:e,canTrack:t})=>{var n;try{return t?(n=document.cookie.split("; ").find(o=>o.startsWith(`${e}=`)))==null?void 0:n.split("=")[1]:void 0}catch(o){w.warn("[COOKIE] GET error: ",(o==null?void 0:o.message)||o);return}},we=async e=>Ce(e),Ft=e=>e.map(([t,n])=>n?`${t}=${n}`:t).filter(T).join("; "),Nt=[["secure",""],["SameSite","None"]],jt=({name:e,value:t,expires:n})=>{const i=(v()?location.protocol==="https:":!0)?Nt:[[]],r=n?[["expires",n.toUTCString()]]:[[]],a=[[e,t],...r,["path","/"],["domain",Wt(window.location.hostname)],...i];return Ft(a)},Ie=async({name:e,value:t,expires:n,canTrack:o})=>{try{if(!o)return;const i=jt({name:e,value:t,expires:n});document.cookie=i}catch(i){w.warn("[COOKIE] SET error: ",(i==null?void 0:i.message)||i)}},Ot="builder.tests",q=e=>`${Ot}.${e}`,$t=({contentId:e})=>we({name:q(e),canTrack:!0}),Lt=({contentId:e})=>Ce({name:q(e),canTrack:!0}),Ut=({contentId:e,value:t})=>Ie({name:q(e),value:t,canTrack:!0}),Te=e=>T(e.id)&&T(e.variations)&&Object.keys(e.variations).length>0,Dt=({id:e,variations:t})=>{var i;let n=0;const o=Math.random();for(const r in t){const a=(i=t[r])==null?void 0:i.testRatio;if(n+=a,o<n)return r}return e},Ee=e=>{const t=Dt(e);return Ut({contentId:e.id,value:t}).catch(n=>{w.error("could not store A/B test variation: ",n)}),t},Re=({item:e,testGroupId:t})=>{const n=e.variations[t];return t===e.id||!n?{testVariationId:e.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===e.id?"Default":"")}},_t=({item:e,canTrack:t})=>{if(!t)return e;if(!e)return;if(!Te(e))return e;const n=Lt({contentId:e.id})||Ee({variations:e.variations,id:e.id}),o=Re({item:e,testGroupId:n});return{...e,...o}},Mt=async({item:e,canTrack:t})=>{if(!t||!Te(e))return e;const o=await $t({contentId:e.id})||Ee({variations:e.variations,id:e.id}),i=Re({item:e,testGroupId:o});return{...e,...i}},N=e=>T(e)?e:!0,Ht={name:"Core:Button",image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13",defaultStyles:{appearance:"none",paddingTop:"15px",paddingBottom:"15px",paddingLeft:"25px",paddingRight:"25px",backgroundColor:"#000000",color:"white",borderRadius:"4px",textAlign:"center",cursor:"pointer"},inputs:[{name:"text",type:"text",defaultValue:"Click me!",bubble:!0},{name:"link",type:"url",bubble:!0},{name:"openLinkInNewTab",type:"boolean",defaultValue:!1,friendlyName:"Open link in new tab"}],static:!0,noWrap:!0},Kt={name:"Columns",isRSC:!0,inputs:[{name:"columns",type:"array",broadcast:!0,subFields:[{name:"blocks",type:"array",hideFromUI:!0,defaultValue:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{name:"width",type:"number",hideFromUI:!0,helperText:"Width %, e.g. set to 50 to fill half of the space"},{name:"link",type:"url",helperText:"Optionally set a url that clicking this column will link to"}],defaultValue:[{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]},{blocks:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto",minHeight:"20px",minWidth:"20px",overflow:"hidden"}},component:{name:"Image",options:{image:"https://builder.io/api/v1/image/assets%2Fpwgjf0RoYWbdnJSbpBAjXNRMe9F2%2Ffb27a7c790324294af8be1c35fe30f4d",backgroundPosition:"center",backgroundSize:"cover",aspectRatio:.7004048582995948}}},{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{display:"flex",flexDirection:"column",alignItems:"stretch",flexShrink:"0",position:"relative",marginTop:"30px",textAlign:"center",lineHeight:"normal",height:"auto"}},component:{name:"Text",options:{text:"<p>Enter some text...</p>"}}}]}],onChange:e=>{function t(){n.forEach(o=>{o.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(i=>i.get("width"))&&(n.find(r=>!r.get("width"))||n.reduce((s,l)=>s+l.get("width"),0)!==100)&&t()}},{name:"space",type:"number",defaultValue:20,helperText:"Size of gap between columns",advanced:!0},{name:"stackColumnsAt",type:"string",defaultValue:"tablet",helperText:"Convert horizontal columns to vertical at what device size",enum:["tablet","mobile","never"],advanced:!0},{name:"reverseColumnsWhenStacked",type:"boolean",defaultValue:!1,helperText:"When stacking columns for mobile devices, reverse the ordering",advanced:!0}]},zt={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},qt={name:"Image",static:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",defaultStyles:{position:"relative",minHeight:"20px",minWidth:"20px",overflow:"hidden"},canHaveChildren:!0,inputs:[{name:"image",type:"file",bubble:!0,allowedFileTypes:["jpeg","jpg","png","svg"],required:!0,defaultValue:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F72c80f114dc149019051b6852a9e3b7a",onChange:e=>{e.delete("srcset"),e.delete("noWebp");function n(a,s=6e4){return new Promise((l,u)=>{const h=document.createElement("img");let d=!1;h.onload=()=>{d=!0,l(h)},h.addEventListener("error",f=>{console.warn("Image load failed",f.error),u(f.error)}),h.src=a,setTimeout(()=>{d||u(new Error("Image load timed out"))},s)})}function o(a){return Math.round(a*1e3)/1e3}const i=e.get("image"),r=e.get("aspectRatio");if(fetch(i).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),i&&(!r||r===.7041))return n(i).then(a=>{const s=e.get("aspectRatio");e.get("image")===i&&(!s||s===.7041)&&a.width&&a.height&&(e.set("aspectRatio",o(a.height/a.width)),e.set("height",a.height),e.set("width",a.width))})}},{name:"backgroundSize",type:"text",defaultValue:"cover",enum:[{label:"contain",value:"contain",helperText:"The image should never get cropped"},{label:"cover",value:"cover",helperText:"The image should fill it's box, cropping when needed"}]},{name:"backgroundPosition",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"altText",type:"string",helperText:"Text to display when the user has images off"},{name:"height",type:"number",hideFromUI:!0},{name:"width",type:"number",hideFromUI:!0},{name:"sizes",type:"string",hideFromUI:!0},{name:"srcset",type:"string",hideFromUI:!0},{name:"lazy",type:"boolean",defaultValue:!0,hideFromUI:!0},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the image's aspect ratio",defaultValue:!0},{name:"highPriority",type:"boolean",advanced:!0,helperText:"Mark this image as high priority compared to other images on the page. This prevents lazy loading of the image and tells the browser to load this image before others on the page."},{name:"aspectRatio",type:"number",helperText:"This is the ratio of height/width, e.g. set to 1.5 for a 300px wide and 200px tall photo. Set to 0 to not force the image to maintain it's aspect ratio",advanced:!0,defaultValue:.7041}]},Jt={name:"Core:Section",static:!0,image:"https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F682efef23ace49afac61748dd305c70a",inputs:[{name:"maxWidth",type:"number",defaultValue:1200},{name:"lazyLoad",type:"boolean",defaultValue:!1,advanced:!0,description:"Only render this section when in view"}],defaultStyles:{paddingLeft:"20px",paddingRight:"20px",paddingTop:"50px",paddingBottom:"50px",marginTop:"0px",width:"100vw",marginLeft:"calc(50% - 50vw)"},canHaveChildren:!0,defaultChildren:[{"@type":"@builder.io/sdk:Element",responsiveStyles:{large:{textAlign:"center"}},component:{name:"Text",options:{text:"<p><b>I am a section! My content keeps from getting too wide, so that it's easy to read even on big screens.</b></p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur</p>"}}}]},Yt={name:"Slot",isRSC:!0,description:"Allow child blocks to be inserted into this content when used as a Symbol",docsLink:"https://www.builder.io/c/docs/symbols-with-blocks",image:"https://cdn.builder.io/api/v1/image/assets%2FYJIGb4i01jvw0SRdL5Bt%2F3aad6de36eae43b59b52c85190fdef56",inputs:[{name:"name",type:"string",required:!0,defaultValue:"children"}]};function Gt(e){var t,n,o;return c.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:c.jsx(U,{parent:(n=e.builderContext.context)==null?void 0:n.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,blocks:(o=e.builderContext.rootState)==null?void 0:o[e.name]})})}const Qt={name:"Symbol",noWrap:!0,static:!0,isRSC:!0,inputs:[{name:"symbol",type:"uiSymbol"},{name:"dataOnly",helperText:"Make this a data symbol that doesn't display any UI",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"inheritState",helperText:"Inherit the parent component state and data",type:"boolean",defaultValue:!1,advanced:!0},{name:"renderToLiquid",helperText:"Render this symbols contents to liquid. Turn off to fetch with javascript and use custom targeting",type:"boolean",defaultValue:!1,advanced:!0,hideFromUI:!0},{name:"useChildren",hideFromUI:!0,type:"boolean"}]},Xt={name:"Text",static:!0,isRSC:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-text_fields-24px%20(1).svg?alt=media&token=12177b73-0ee3-42ca-98c6-0dd003de1929",inputs:[{name:"text",type:"html",required:!0,autoFocus:!0,bubble:!0,defaultValue:"Enter some text..."}],defaultStyles:{lineHeight:"normal",height:"auto",textAlign:"center"}};function Pe(e){var t;return c.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const Zt={name:"Custom Code",static:!0,requiredPermissions:["editCode"],inputs:[{name:"code",type:"html",required:!0,defaultValue:"<p>Hello there, I am custom HTML code!</p>",code:!0},{name:"replaceNodes",type:"boolean",helperText:"Preserve server rendered dom nodes",advanced:!0},{name:"scriptsClientOnly",type:"boolean",defaultValue:!1,helperText:"Only print and run scripts on the client. Important when scripts influence DOM that could be replaced when client loads",advanced:!0}]},en={name:"Embed",static:!0,inputs:[{name:"url",type:"url",required:!0,defaultValue:"",helperText:"e.g. enter a youtube url, google map, etc",onChange:e=>{const t=e.get("url");if(t)return e.set("content","Loading..."),fetch(`https://iframe.ly/api/iframely?url=${t}&api_key=ae0e60e78201a3f2b0de4b`).then(o=>o.json()).then(o=>{e.get("url")===t&&(o.html?e.set("content",o.html):e.set("content","Invalid url, please try another"))}).catch(o=>{e.set("content","There was an error embedding this URL, please try again or another URL")});e.delete("content")}},{name:"content",type:"html",defaultValue:'<div style="padding: 20px; text-align: center">(Choose an embed URL)<div>',hideFromUI:!0}]},tn=["text/javascript","application/javascript","application/ecmascript"],nn=e=>tn.includes(e.type),on={name:"Raw:Img",hideFromInsertMenu:!0,image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-insert_photo-24px.svg?alt=media&token=4e5d0ef4-f5e8-4e57-b3a9-38d63a9b9dc4",inputs:[{name:"image",bubble:!0,type:"file",allowedFileTypes:["jpeg","jpg","png","svg","gif","webp"],required:!0}],noWrap:!0,static:!0},rn={name:"Video",canHaveChildren:!0,defaultStyles:{minHeight:"20px",minWidth:"20px"},image:"https://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/images%2Fbaseline-videocam-24px%20(1).svg?alt=media&token=49a84e4a-b20e-4977-a650-047f986874bb",inputs:[{name:"video",type:"file",allowedFileTypes:["mp4"],bubble:!0,defaultValue:"https://cdn.builder.io/o/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fd27731a526464deba0016216f5f9e570%2Fcompressed?apiKey=YJIGb4i01jvw0SRdL5Bt&token=d27731a526464deba0016216f5f9e570&alt=media&optimized=true",required:!0},{name:"posterImage",type:"file",allowedFileTypes:["jpeg","png"],helperText:"Image to show before the video plays"},{name:"autoPlay",type:"boolean",defaultValue:!0},{name:"controls",type:"boolean",defaultValue:!1},{name:"muted",type:"boolean",defaultValue:!0},{name:"loop",type:"boolean",defaultValue:!0},{name:"playsInline",type:"boolean",defaultValue:!0},{name:"fit",type:"text",defaultValue:"cover",enum:["contain","cover","fill","auto"]},{name:"preload",type:"text",defaultValue:"metadata",enum:["auto","metadata","none"]},{name:"fitContent",type:"boolean",helperText:"When child blocks are provided, fit to them instead of using the aspect ratio",defaultValue:!0,advanced:!0},{name:"position",type:"text",defaultValue:"center",enum:["center","top","left","right","bottom","top left","top right","bottom left","bottom right"]},{name:"height",type:"number",advanced:!0},{name:"width",type:"number",advanced:!0},{name:"aspectRatio",type:"number",advanced:!0,defaultValue:.7004048582995948},{name:"lazyLoad",type:"boolean",helperText:'Load this video "lazily" - as in only when a user scrolls near the video. Recommended for optmized performance and bandwidth consumption',defaultValue:!0,advanced:!0}]},an=()=>[{component:C.CustomCode,...Zt},{component:C.Embed,...en},{component:C.ImgComponent,...on},{component:C.Video,...rn}],oe=()=>[{component:C.Button,...Ht},{component:ke,...Kt},{component:C.FragmentComponent,...zt},{component:C.Image,...qt},{component:C.SectionComponent,...Jt},{component:Gt,...Yt},{component:Je,...Qt},{component:Pe,...Xt},...an()],sn=e=>({type:"builder.registerComponent",data:D(e)}),cn=e=>{const t=e.toString().trim();return`return (${!t.startsWith("function")&&!t.startsWith("(")?"function ":""}${t}).apply(this, arguments)`},ln=e=>typeof e=="function"?cn(e):P(e),D=({inputs:e,...t})=>({...P(t),inputs:e==null?void 0:e.map(n=>Object.entries(n).reduce((o,[i,r])=>({...o,[i]:ln(r)}),{}))}),dn=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
36
|
+
function getAndSetVariantId() {
|
|
37
|
+
function setCookie(name, value, days) {
|
|
38
|
+
let expires = '';
|
|
39
|
+
if (days) {
|
|
40
|
+
const date = new Date();
|
|
41
|
+
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
|
|
42
|
+
expires = '; expires=' + date.toUTCString();
|
|
43
|
+
}
|
|
44
|
+
document.cookie = name + '=' + (value || '') + expires + '; path=/' + '; Secure; SameSite=None';
|
|
45
|
+
}
|
|
46
|
+
function getCookie(name) {
|
|
47
|
+
const nameEQ = name + '=';
|
|
48
|
+
const ca = document.cookie.split(';');
|
|
49
|
+
for (let i = 0; i < ca.length; i++) {
|
|
50
|
+
let c = ca[i];
|
|
51
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
52
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const cookieName = \`builder.tests.\${contentId}\`;
|
|
57
|
+
const variantInCookie = getCookie(cookieName);
|
|
58
|
+
const availableIDs = variants.map(vr => vr.id).concat(contentId);
|
|
59
|
+
if (variantInCookie && availableIDs.includes(variantInCookie)) {
|
|
60
|
+
return variantInCookie;
|
|
61
|
+
}
|
|
62
|
+
let n = 0;
|
|
63
|
+
const random = Math.random();
|
|
64
|
+
for (let i = 0; i < variants.length; i++) {
|
|
65
|
+
const variant = variants[i];
|
|
66
|
+
const testRatio = variant.testRatio;
|
|
67
|
+
n += testRatio;
|
|
68
|
+
if (random < n) {
|
|
69
|
+
setCookie(cookieName, variant.id);
|
|
70
|
+
return variant.id;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
setCookie(cookieName, contentId);
|
|
74
|
+
return contentId;
|
|
75
|
+
}
|
|
76
|
+
const winningVariantId = getAndSetVariantId();
|
|
77
|
+
const styleEl = document.currentScript?.previousElementSibling;
|
|
78
|
+
if (isHydrationTarget) {
|
|
79
|
+
styleEl.remove();
|
|
80
|
+
const thisScriptEl = document.currentScript;
|
|
81
|
+
thisScriptEl?.remove();
|
|
82
|
+
} else {
|
|
83
|
+
const newStyleStr = variants.concat({
|
|
84
|
+
id: contentId
|
|
85
|
+
}).filter(variant => variant.id !== winningVariantId).map(value => {
|
|
86
|
+
return \`.variant-\${value.id} { display: none; }
|
|
87
|
+
\`;
|
|
88
|
+
}).join('');
|
|
89
|
+
styleEl.innerHTML = newStyleStr;
|
|
90
|
+
}
|
|
91
|
+
}`,un=`function updateVariantVisibility(variantContentId, defaultContentId, isHydrationTarget) {
|
|
92
|
+
if (!navigator.cookieEnabled) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
function getCookie(name) {
|
|
96
|
+
const nameEQ = name + '=';
|
|
97
|
+
const ca = document.cookie.split(';');
|
|
98
|
+
for (let i = 0; i < ca.length; i++) {
|
|
99
|
+
let c = ca[i];
|
|
100
|
+
while (c.charAt(0) === ' ') c = c.substring(1, c.length);
|
|
101
|
+
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length, c.length);
|
|
102
|
+
}
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
const cookieName = \`builder.tests.\${defaultContentId}\`;
|
|
106
|
+
const winningVariant = getCookie(cookieName);
|
|
107
|
+
const parentDiv = document.currentScript?.parentElement;
|
|
108
|
+
const isDefaultContent = variantContentId === defaultContentId;
|
|
109
|
+
const isWinningVariant = winningVariant === variantContentId;
|
|
110
|
+
if (isWinningVariant && !isDefaultContent) {
|
|
111
|
+
parentDiv?.removeAttribute('hidden');
|
|
112
|
+
parentDiv?.removeAttribute('aria-hidden');
|
|
113
|
+
} else if (!isWinningVariant && isDefaultContent) {
|
|
114
|
+
parentDiv?.setAttribute('hidden', 'true');
|
|
115
|
+
parentDiv?.setAttribute('aria-hidden', 'true');
|
|
116
|
+
}
|
|
117
|
+
if (isHydrationTarget) {
|
|
118
|
+
if (!isWinningVariant) {
|
|
119
|
+
parentDiv?.remove();
|
|
120
|
+
}
|
|
121
|
+
const thisScriptEl = document.currentScript;
|
|
122
|
+
thisScriptEl?.remove();
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}`,Ae="builderIoAbTest",Be="builderIoRenderContent",W=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),mn=({canTrack:e,content:t})=>!(!(W(t).length>0)||!e||v()),fn=e=>e==="react"||e==="reactNative",Ve=fn(k),hn=()=>`
|
|
126
|
+
window.${Ae} = ${dn}
|
|
127
|
+
window.${Be} = ${un}
|
|
128
|
+
`,pn=(e,t)=>`
|
|
129
|
+
window.${Ae}(
|
|
130
|
+
"${t}",${JSON.stringify(e)}, ${Ve}
|
|
131
|
+
)`,gn=({contentId:e,variationId:t})=>`window.${Be}(
|
|
132
|
+
"${t}", "${e}", ${Ve}
|
|
133
|
+
)`;function _(e){return c.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},"data-id":e.id})}const bn=e=>{const t=e.get("preview"),n=e.get("overrides."+t);return n||w.warn("No previewed ID found in search params."),n};function We(){globalThis._BUILDER_PREVIEW_LRU_CACHE||(globalThis._BUILDER_PREVIEW_LRU_CACHE=new Ye.LRUCache({max:500,ttl:1e3*60*5}))}function yn(e){We();const t=bn(e);return typeof t=="string"?globalThis._BUILDER_PREVIEW_LRU_CACHE.get(t):void 0}function Sn(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:globalThis}function xn(){const e=Sn().fetch;if(typeof e>"u")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
134
|
+
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return e}const Fe=xn();function M(e,t=null,n="."){return Object.keys(e).reduce((o,i)=>{const r=e[i],a=[t,i].filter(Boolean).join(n);return[typeof r=="object",r!==null,!(Array.isArray(r)&&r.length===0)].every(Boolean)?{...o,...M(r,a,n)}:{...o,[a]:r}},{})}function Ne(e,t,n={}){for(const o in e){const i=e[o],r=t?t+"."+o:o;i&&typeof i=="object"&&!Array.isArray(i)&&!Object.keys(i).find(a=>a.startsWith("$"))?Ne(i,r,n):n[r]=i}return n}const vn="v3",ie="builder.",kn="options.",J=e=>{if(!e)return{};const t=fe(e),n={};return Object.keys(t).forEach(o=>{if(o.startsWith(ie)){const i=o.replace(ie,"").replace(kn,"");n[i]=t[o]}}),n},Cn=()=>{if(!v())return{};const e=new URLSearchParams(window.location.search);return J(e)},re=e=>typeof e=="number"&&!isNaN(e)&&e>=0,Y=e=>{const{limit:t=30,userAttributes:n,query:o,model:i,apiKey:r,enrich:a,locale:s,apiVersion:l=vn,fields:u,omit:h,offset:d,cacheSeconds:f,staleCacheSeconds:g,sort:x,includeUnpublished:b}=e;if(!r)throw new Error("Missing API key");if(!["v3"].includes(l))throw new Error(`Invalid apiVersion: expected 'v3', received '${l}'`);const E=t!==1,m=new URL(`https://cdn.builder.io/api/${l}/content/${i}`);if(m.searchParams.set("apiKey",r),m.searchParams.set("limit",String(t)),m.searchParams.set("noTraverse",String(E)),m.searchParams.set("includeRefs",String(!0)),s&&m.searchParams.set("locale",s),a&&m.searchParams.set("enrich",String(a)),m.searchParams.set("omit",h||"meta.componentsUsed"),u&&m.searchParams.set("fields",u),Number.isFinite(d)&&d>-1&&m.searchParams.set("offset",String(Math.floor(d))),typeof b=="boolean"&&m.searchParams.set("includeUnpublished",String(b)),f&&re(f)&&m.searchParams.set("cacheSeconds",String(f)),g&&re(g)&&m.searchParams.set("staleCacheSeconds",String(g)),x){const S=M({sort:x});for(const I in S)m.searchParams.set(I,JSON.stringify(S[I]))}const p={...Cn(),...fe(e.options||{})},y=M(p);for(const S in y)m.searchParams.set(S,String(y[S]));if(n&&m.searchParams.set("userAttributes",JSON.stringify(n)),o){const S=Ne({query:o});for(const I in S)m.searchParams.set(I,JSON.stringify(S[I]))}return m},wn=e=>"results"in e;async function G(e){const t=await Oe({...e,limit:1});return t&&t[0]||null}const In=async e=>{const t=Y(e);return await(await(e.fetch??Fe)(t.href,e.fetchOptions)).json()},je=async(e,t,n=Y(e))=>{const o=N(e.canTrack);if(n.search.includes("preview=")){const r=[];for(const a of t.results){const s=yn(n.searchParams);r.push(s||a)}t.results=r}if(!o||!(v()||k==="reactNative"))return t.results;try{const r=[];for(const a of t.results)r.push(await Mt({item:a,canTrack:o}));t.results=r}catch(r){w.error("Could not process A/B tests. ",r)}return t.results};async function Oe(e){try{const t=Y(e),n=await In(e);return wn(n)?je(e,n):(w.error("Error fetching data. ",{url:t,content:n,options:e}),null)}catch(t){return w.error("Error fetching data. ",t),null}}function Tn(e){const t=e||(v()?window.location.search:void 0);return t?he(t).indexOf("builder.preview=")!==-1:!1}function En(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}function $e(){return En().replace(/-/g,"")}const Le="builderSessionId",Rn=async({canTrack:e})=>{if(!e)return;const t=await we({name:Le,canTrack:e});if(T(t))return t;{const n=Pn();return An({id:n,canTrack:e}),n}},Pn=()=>$e(),An=({id:e,canTrack:t})=>Ie({name:Le,value:e,canTrack:t}),Ue=()=>v()&&typeof localStorage<"u"?localStorage:void 0,Bn=({key:e,canTrack:t})=>{var n;try{return t?(n=Ue())==null?void 0:n.getItem(e):void 0}catch(o){console.debug("[LocalStorage] GET error: ",o);return}},Vn=({key:e,canTrack:t,value:n})=>{var o;try{t&&((o=Ue())==null||o.setItem(e,n))}catch(i){console.debug("[LocalStorage] SET error: ",i)}},De="builderVisitorId",Wn=({canTrack:e})=>{if(!e)return;const t=Bn({key:De,canTrack:e});if(T(t))return t;{const n=Fn();return Nn({id:n,canTrack:e}),n}},Fn=()=>$e(),Nn=({id:e,canTrack:t})=>Vn({key:De,value:e,canTrack:t}),jn=async({canTrack:e})=>{if(!e)return{visitorId:void 0,sessionId:void 0};const t=await Rn({canTrack:e}),n=Wn({canTrack:e});return{sessionId:t,visitorId:n}},On=async({type:e,canTrack:t,apiKey:n,metadata:o,...i})=>({type:e,data:{...i,metadata:{url:location.href,...o},...await jn({canTrack:t}),userAttributes:pe(),ownerId:n}});async function _e(e){if(!e.apiKey){w.error("Missing API key for track call. Please provide your API key.");return}if(e.canTrack&&!H()&&(v()||k==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await On(e)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(t=>{console.error("Failed to track: ",t)})}const $n=e=>_e({...e,canTrack:!0});function ae(e){return Math.round(e*1e3)/1e3}const Ln=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let o=n?e:e.parentElement;do{if(!o)return null;if(t(o))return o}while(o=o.parentElement);return null},Un=e=>Ln(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),se=({event:e,target:t})=>{const n=t.getBoundingClientRect(),o=e.clientX-n.left,i=e.clientY-n.top,r=ae(o/n.width),a=ae(i/n.height);return{x:r,y:a}},Dn=e=>{const t=e.target,n=t&&Un(t),o=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:o||void 0,metadata:{targetOffset:t?se({event:e,target:t}):void 0,builderTargetOffset:n?se({event:e,target:n}):void 0,builderElementIndex:n&&o?[].slice.call(document.getElementsByClassName(o)).indexOf(n):void 0}}},_n=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function Me(e,t){if(!t.origin.startsWith("http")&&!t.origin.startsWith("https"))return!1;const n=new URL(t.origin),o=n.hostname;return(e||_n).findIndex(i=>i.startsWith("*.")?o.endsWith(i.slice(1)):i===o)>-1}const Mn="0.14.28",ce={};function He(e,t){let n=ce[e];if(n||(n=ce[e]=[]),n.push(t),v()){const o={type:"builder.register",data:{type:e,info:t}};try{parent.postMessage(o,"*"),parent!==window&&window.postMessage(o,"*")}catch(i){console.debug("Could not postmessage",i)}}}const Hn=()=>{He("insertMenu",{name:"_default",default:!0,items:[{name:"Box"},{name:"Text"},{name:"Image"},{name:"Columns"},{name:"Core:Section"},{name:"Core:Button"},{name:"Embed"},{name:"Custom Code"}]})};let le=!1;const Ke=(e={})=>{var t,n;le||(le=!0,v()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:k,version:Mn,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",o=>{var r,a;if(!Me(e.trustedHosts,o))return;const{data:i}=o;if(i!=null&&i.type)switch(i.type){case"builder.evaluate":{const s=i.data.text,l=i.data.arguments||[],u=i.data.id,h=new Function(s);let d,f=null;try{d=h.apply(null,l)}catch(g){f=g}f?(r=window.parent)==null||r.postMessage({type:"builder.evaluateError",data:{id:u,error:f.message}},"*"):d&&typeof d.then=="function"?d.then(g=>{var x;(x=window.parent)==null||x.postMessage({type:"builder.evaluateResult",data:{id:u,result:g}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:d,id:u}},"*");break}}})))},ze=({model:e,trustedHosts:t,callbacks:n})=>o=>{if(!Me(t,o))return;const{data:i}=o;if(i)switch(i.type){case"builder.configureSdk":{n.configureSdk(i.data);break}case"builder.triggerAnimation":{n.animation(i.data);break}case"builder.contentUpdate":{const r=i.data,a=r.key||r.alias||r.entry||r.modelName,s=r.data;a===e&&n.contentUpdate(s);break}}},Kn=(e,t,n)=>{if(!v)return w.warn("`subscribeToEditor` only works in the browser. It currently seems to be running on the server."),()=>{};Ke();const o=ze({callbacks:{contentUpdate:t,animation:()=>{},configureSdk:()=>{}},model:e,trustedHosts:n==null?void 0:n.trustedHosts});return window.addEventListener("message",o),()=>{window.removeEventListener("message",o)}};function de(e,...t){const n=Object(e);for(let o=1;o<arguments.length;o++){const i=arguments[o];if(i!=null)for(const r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])}return n}function zn(e){console.warn(`Cannot animate element: element with ID ${e} not found!`)}function qn(e,t){const n=Jn(e),o=getComputedStyle(t),i=e.steps[0].styles,r=e.steps[e.steps.length-1].styles,a=[i,r];for(const s of a)for(const l of n)l in s||(s[l]=o[l])}function Jn(e){const t=[];for(const n of e.steps)for(const o in n.styles)t.indexOf(o)===-1&&t.push(o);return t}function Yn(e){const t=Array.prototype.slice.call(document.getElementsByClassName(e.elementId||e.id||""));if(!t.length){zn(e.elementId||e.id||"");return}Array.from(t).forEach(n=>{qn(e,n),n.style.transition="none",n.style.transitionDelay="0",de(n.style,e.steps[0].styles),setTimeout(()=>{n.style.transition=`all ${e.duration}s ${z(e.easing)}`,e.delay&&(n.style.transitionDelay=e.delay+"s"),de(n.style,e.steps[1].styles),setTimeout(()=>{n.style.transition="",n.style.transitionDelay=""},(e.delay||0)*1e3+e.duration*1e3+100)})})}const Gn=e=>{var r;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],o=e.fileUrl??((r=e==null?void 0:e.files)==null?void 0:r.regular);let i="";if(o&&t&&n&&(i+=`
|
|
135
|
+
@font-face {
|
|
136
|
+
font-family: "${t}";
|
|
137
|
+
src: local("${n}"), url('${o}') format('woff2');
|
|
138
|
+
font-display: fallback;
|
|
139
|
+
font-weight: 400;
|
|
140
|
+
}
|
|
141
|
+
`.trim()),e.files)for(const a in e.files){if(!(String(Number(a))===a))continue;const l=e.files[a];l&&l!==o&&(i+=`
|
|
142
|
+
@font-face {
|
|
143
|
+
font-family: "${t}";
|
|
144
|
+
src: url('${l}') format('woff2');
|
|
145
|
+
font-display: fallback;
|
|
146
|
+
font-weight: ${a};
|
|
147
|
+
}
|
|
148
|
+
`.trim())}return i},Qn=({customFonts:e})=>{var t;return((t=e==null?void 0:e.map(n=>Gn(n)))==null?void 0:t.join(" "))||""},Xn=({cssCode:e,contentId:t})=>e?t?(e==null?void 0:e.replace(/&/g,`div[builder-content-id="${t}"]`))||"":e:"",Zn=`
|
|
149
|
+
.builder-button {
|
|
150
|
+
all: unset;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.builder-text > p:first-of-type, .builder-text > .builder-paragraph:first-of-type {
|
|
154
|
+
margin: 0;
|
|
155
|
+
}
|
|
156
|
+
.builder-text > p, .builder-text > .builder-paragraph {
|
|
157
|
+
color: inherit;
|
|
158
|
+
line-height: inherit;
|
|
159
|
+
letter-spacing: inherit;
|
|
160
|
+
font-weight: inherit;
|
|
161
|
+
font-size: inherit;
|
|
162
|
+
text-align: inherit;
|
|
163
|
+
font-family: inherit;
|
|
164
|
+
}
|
|
165
|
+
`,eo=e=>e?"":Zn,to=e=>`variant-${e}`;function no(e){const t=`
|
|
166
|
+
${Xn({cssCode:e.cssCode,contentId:e.contentId})}
|
|
167
|
+
${Qn({customFonts:e.customFonts})}
|
|
168
|
+
${eo(e.isNestedRender)}
|
|
169
|
+
`.trim();return c.jsx($,{id:"builderio-content",styles:t})}const oo=({content:e,data:t,locale:n})=>{var r,a,s;const o={},i=((r=e==null?void 0:e.data)==null?void 0:r.state)||{};return(s=(a=e==null?void 0:e.data)==null?void 0:a.inputs)==null||s.forEach(l=>{l.name&&l.defaultValue!==void 0&&(o[l.name]=l.defaultValue)}),{...o,...i,...t,...n?{locale:n}:{}}},io=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function ue(e){var i,r,a,s,l,u,h,d,f;const t=gn({variationId:(i=e.content)==null?void 0:i.testVariationId,contentId:(r=e.content)==null?void 0:r.id}),n=[...oe(),...e.customComponents||[]].reduce((g,{component:x,...b})=>({...g,[b.name]:{component:x,...D(b)}}),{}),o={content:io({content:e.content,data:e.data}),localState:void 0,rootState:oo({content:e.content,data:e.data,locale:e.locale}),rootSetState:void 0,context:e.context||{},canTrack:e.canTrack,apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...oe(),...e.customComponents||[]].reduce((g,{component:x,...b})=>({...g,[b.name]:D(b)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{}};return c.jsxs(C.EnableEditor,{content:e.content,data:e.data,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,showContent:e.showContent,builderContextSignal:o,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts,children:[e.isSsrAbTest?c.jsx(_,{id:"builderio-variant-visibility",scriptStr:t}):null,c.jsx(no,{isNestedRender:e.isNestedRender,contentId:(a=o.content)==null?void 0:a.id,cssCode:(l=(s=o.content)==null?void 0:s.data)==null?void 0:l.cssCode,customFonts:(h=(u=o.content)==null?void 0:u.data)==null?void 0:h.customFonts}),c.jsx(U,{blocks:(f=(d=o.content)==null?void 0:d.data)==null?void 0:f.blocks,context:o,registeredComponents:n,linkComponent:e.linkComponent})]})}function qe(e){var r;const t=mn({canTrack:N(e.canTrack),content:e.content}),n=function(){var s;return pn(W(e.content).map(l=>({id:l.testVariationId,testRatio:l.testRatio})),((s=e.content)==null?void 0:s.id)||"")},o=function(){return W(e.content).map(s=>`.variant-${s.testVariationId} { display: none; } `).join("")},i=function(){var s;return t?{...e.content,testVariationId:(s=e.content)==null?void 0:s.id}:_t({item:e.content,canTrack:N(e.canTrack)})};return c.jsxs(c.Fragment,{children:[!e.isNestedRender&&k!=="reactNative"?c.jsx(_,{id:"builderio-init-variants-fns",scriptStr:hn()}):null,t?c.jsxs(c.Fragment,{children:[c.jsx($,{id:"builderio-variants",styles:o()}),c.jsx(_,{id:"builderio-variants-visibility",scriptStr:n()}),(r=W(e.content))==null?void 0:r.map(a=>c.jsx(ue,{isNestedRender:e.isNestedRender,content:a,showContent:!1,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts},a.testVariationId))]}):null,c.jsx(ue,{isNestedRender:e.isNestedRender,content:i(),showContent:!0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,linkComponent:e.linkComponent,canTrack:e.canTrack,locale:e.locale,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts})]})}const ro=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return G({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(n=>{w.error("Could not fetch symbol content: ",n)})};async function Je(e){var r,a,s,l,u;const t=function(){return"div"},n=function(){return"div"},o=function(){var d,f;return[e.attributes[j()],"builder-symbol",(d=e.symbol)!=null&&d.inline?"builder-inline-symbol":void 0,(f=e.symbol)!=null&&f.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")},i=((r=e.symbol)==null?void 0:r.content)||await ro({symbol:e.symbol,builderContextValue:e.builderContext});return c.jsx("div",{...e.attributes,className:o(),children:c.jsx(qe,{isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(a=e.builderBlock)==null?void 0:a.id},customComponents:Object.values(e.builderComponents),data:{...(s=e.symbol)==null?void 0:s.data,...e.builderContext.localState,...(l=i==null?void 0:i.data)==null?void 0:l.state},canTrack:e.builderContext.canTrack,model:(u=e.symbol)==null?void 0:u.model,content:i,linkComponent:e.builderLinkComponent,blocksWrapper:t(),contentWrapper:n()})})}const me={};function ao(e){if(v()){Object.assign(me,e);const t={type:"builder.settingsChange",data:me};parent.postMessage(t,"*")}}const so=async e=>{var o,i,r;const t=e.path||((o=e.url)==null?void 0:o.pathname)||((i=e.userAttributes)==null?void 0:i.urlPath),n={...e,apiKey:e.apiKey,model:e.model||"page",userAttributes:{...e.userAttributes,...t?{urlPath:t}:{}},options:J(e.searchParams||((r=e.url)==null?void 0:r.searchParams)||e.options)};return{apiKey:n.apiKey,model:n.model,content:await G(n)}};exports.Blocks=U;exports.Columns=ke;exports.ContentVariants=qe;exports.Symbol=Je;exports.Text=Pe;exports._processContentResult=je;exports._track=_e;exports.createEditorListener=ze;exports.createRegisterComponentMessage=sn;exports.evaluate=O;exports.fastClone=P;exports.fetch=Fe;exports.fetchBuilderProps=so;exports.fetchEntries=Oe;exports.fetchOneEntry=G;exports.getBlockActions=wt;exports.getBlockProperties=ve;exports.getBuilderSearchParams=J;exports.getClassPropName=j;exports.getDefaultCanTrack=N;exports.getInteractionPropertiesForEvent=Dn;exports.getSrcSet=Vt;exports.getWrapperClassName=to;exports.init=We;exports.isBrowser=v;exports.isEditing=H;exports.isEmptyElement=Qe;exports.isJsScript=nn;exports.isPreviewing=Tn;exports.logger=w;exports.register=He;exports.registerInsertMenu=Hn;exports.setEditorSettings=ao;exports.setupBrowserForEditing=Ke;exports.subscribeToEditor=Kn;exports.track=$n;exports.triggerAnimation=Yn;
|
package/lib/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./USE_CLIENT_BUNDLE-65950ed4.cjs"),e=require("./bundle-aff841a2.cjs");require("react/jsx-runtime");require("react");require("./USE_SERVER_BUNDLE-3ea7f606.cjs");require("next/navigation");require("lru-cache");exports.BuilderContext=t.builderContext;exports.Button=t.Button;exports.Fragment=t.FragmentComponent;exports.Image=t.Image;exports.Section=t.SectionComponent;exports.Video=t.Video;exports.Blocks=e.Blocks;exports.Columns=e.Columns;exports.Content=e.ContentVariants;exports.Symbol=e.Symbol;exports.Text=e.Text;exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.subscribeToEditor=e.subscribeToEditor;exports.track=e.track;
|
package/lib/browser/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { f as n, c as m, F as c, d as p, S as g, V as d } from "./USE_CLIENT_BUNDLE-
|
|
2
|
-
import { B as l, C as f, x as B, S as C, T as E, G as S, u as x, F as h, H as b, v as y, A as F, c as P, j as T, y as k, z as v, E as R, D as V } from "./bundle-
|
|
1
|
+
import { f as n, c as m, F as c, d as p, S as g, V as d } from "./USE_CLIENT_BUNDLE-1c35fc0a.js";
|
|
2
|
+
import { B as l, C as f, x as B, S as C, T as E, G as S, u as x, F as h, H as b, v as y, A as F, c as P, j as T, y as k, z as v, E as R, D as V } from "./bundle-763c7cf6.js";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
|
-
import "./USE_SERVER_BUNDLE-
|
|
5
|
+
import "./USE_SERVER_BUNDLE-812dfc95.js";
|
|
6
6
|
import "next/navigation";
|
|
7
7
|
import "lru-cache";
|
|
8
8
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as a, Fragment as w, jsxs as I } from "react/jsx-runtime";
|
|
3
|
-
import { i as Z, g as H, a as $, b as O, c as E, d as R, e as p, f as _, h as V, _ as D, j as ee, l as te, k as ne, m as ie, t as ae, n as U, o as ce, p as re, q as le, r as oe, s as de, u as se, v as ue } from "./bundle-
|
|
4
|
-
import { useRef as T, useState as C, useEffect as
|
|
5
|
-
import { p as ge } from "./USE_SERVER_BUNDLE-
|
|
6
|
-
import { useRouter as
|
|
3
|
+
import { i as Z, g as H, a as $, b as O, c as E, d as R, e as p, f as _, h as V, _ as D, j as ee, l as te, k as ne, m as ie, t as ae, n as U, o as ce, p as re, q as le, r as oe, s as de, u as se, v as ue } from "./bundle-c67d25d8.js";
|
|
4
|
+
import { useRef as T, useState as C, useEffect as b, createContext as me } from "react";
|
|
5
|
+
import { p as ge } from "./USE_SERVER_BUNDLE-ded4dbdc.js";
|
|
6
|
+
import { useRouter as fe } from "next/navigation";
|
|
7
7
|
function J(e) {
|
|
8
8
|
return /* @__PURE__ */ a(w, { children: Z(e.TagName) ? /* @__PURE__ */ a(w, { children: /* @__PURE__ */ a(e.TagName, { ...e.attributes, ...e.actionAttributes }) }) : /* @__PURE__ */ a(w, { children: typeof e.TagName == "string" ? /* @__PURE__ */ a(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) : /* @__PURE__ */ a(e.TagName, { ...e.attributes, ...e.actionAttributes, children: e.children }) }) });
|
|
9
9
|
}
|
|
@@ -127,7 +127,7 @@ function Ie(e) {
|
|
|
127
127
|
return /* @__PURE__ */ a("span", { children: e.children });
|
|
128
128
|
}
|
|
129
129
|
function Pe(e) {
|
|
130
|
-
var r, g, v, h,
|
|
130
|
+
var r, g, v, h, f, o;
|
|
131
131
|
function i() {
|
|
132
132
|
var x;
|
|
133
133
|
const d = e.image || e.src;
|
|
@@ -163,7 +163,8 @@ function Pe(e) {
|
|
|
163
163
|
/* @__PURE__ */ a(
|
|
164
164
|
"img",
|
|
165
165
|
{
|
|
166
|
-
loading: "lazy",
|
|
166
|
+
loading: e.highPriority ? "eager" : "lazy",
|
|
167
|
+
fetchPriority: e.highPriority ? "high" : "auto",
|
|
167
168
|
alt: e.altText,
|
|
168
169
|
role: e.altText ? void 0 : "presentation",
|
|
169
170
|
style: {
|
|
@@ -171,7 +172,7 @@ function Pe(e) {
|
|
|
171
172
|
objectFit: e.backgroundSize || "cover",
|
|
172
173
|
...S()
|
|
173
174
|
},
|
|
174
|
-
className: "builder-image" + (e.className ? " " + e.className : "") + " img-
|
|
175
|
+
className: "builder-image" + (e.className ? " " + e.className : "") + " img-ac3dff4a",
|
|
175
176
|
src: e.image,
|
|
176
177
|
srcSet: i(),
|
|
177
178
|
sizes: e.sizes
|
|
@@ -181,23 +182,23 @@ function Pe(e) {
|
|
|
181
182
|
e.aspectRatio && !((g = (r = e.builderBlock) == null ? void 0 : r.children) != null && g.length && e.fitContent) ? /* @__PURE__ */ a(
|
|
182
183
|
"div",
|
|
183
184
|
{
|
|
184
|
-
className: "builder-image-sizer div-
|
|
185
|
+
className: "builder-image-sizer div-ac3dff4a",
|
|
185
186
|
style: {
|
|
186
187
|
paddingTop: e.aspectRatio * 100 + "%"
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
) : null,
|
|
190
191
|
(h = (v = e.builderBlock) == null ? void 0 : v.children) != null && h.length && e.fitContent ? /* @__PURE__ */ a(w, { children: e.children }) : null,
|
|
191
|
-
!e.fitContent && ((o = (
|
|
192
|
+
!e.fitContent && ((o = (f = e.builderBlock) == null ? void 0 : f.children) != null && o.length) ? /* @__PURE__ */ a("div", { className: "div-ac3dff4a-2", children: e.children }) : null
|
|
192
193
|
] }),
|
|
193
|
-
/* @__PURE__ */ a("style", { children: `.img-
|
|
194
|
+
/* @__PURE__ */ a("style", { children: `.img-ac3dff4a {
|
|
194
195
|
opacity: 1;
|
|
195
196
|
transition: opacity 0.2s ease-in-out;
|
|
196
|
-
}.div-
|
|
197
|
+
}.div-ac3dff4a {
|
|
197
198
|
width: 100%;
|
|
198
199
|
pointer-events: none;
|
|
199
200
|
font-size: 0;
|
|
200
|
-
}.div-
|
|
201
|
+
}.div-ac3dff4a-2 {
|
|
201
202
|
display: flex;
|
|
202
203
|
flex-direction: column;
|
|
203
204
|
align-items: stretch;
|
|
@@ -232,13 +233,13 @@ function Re(e) {
|
|
|
232
233
|
}
|
|
233
234
|
function Te(e) {
|
|
234
235
|
const i = T(null), [s, S] = C(() => []), [r, g] = C(() => []);
|
|
235
|
-
return
|
|
236
|
+
return b(() => {
|
|
236
237
|
var h;
|
|
237
238
|
if (!((h = i.current) != null && h.getElementsByTagName) || typeof window > "u")
|
|
238
239
|
return;
|
|
239
240
|
const v = i.current.getElementsByTagName("script");
|
|
240
|
-
for (let
|
|
241
|
-
const o = v[
|
|
241
|
+
for (let f = 0; f < v.length; f++) {
|
|
242
|
+
const o = v[f];
|
|
242
243
|
if (o.src) {
|
|
243
244
|
if (s.includes(o.src))
|
|
244
245
|
continue;
|
|
@@ -270,7 +271,7 @@ function Te(e) {
|
|
|
270
271
|
}
|
|
271
272
|
function Ne(e) {
|
|
272
273
|
const i = T(null), [s, S] = C(() => []), [r, g] = C(() => []), [v, h] = C(() => !1);
|
|
273
|
-
function
|
|
274
|
+
function f() {
|
|
274
275
|
if (!i.current || !i.current.getElementsByTagName)
|
|
275
276
|
return;
|
|
276
277
|
const o = i.current.getElementsByTagName("script");
|
|
@@ -288,8 +289,8 @@ function Ne(e) {
|
|
|
288
289
|
}
|
|
289
290
|
}
|
|
290
291
|
}
|
|
291
|
-
return
|
|
292
|
-
i.current && !v && (h(!0),
|
|
292
|
+
return b(() => {
|
|
293
|
+
i.current && !v && (h(!0), f());
|
|
293
294
|
}, [i.current, v]), /* @__PURE__ */ a(
|
|
294
295
|
"div",
|
|
295
296
|
{
|
|
@@ -315,7 +316,7 @@ function Be(e) {
|
|
|
315
316
|
);
|
|
316
317
|
}
|
|
317
318
|
function Le(e) {
|
|
318
|
-
var S, r, g, v, h,
|
|
319
|
+
var S, r, g, v, h, f, o;
|
|
319
320
|
function i() {
|
|
320
321
|
return {
|
|
321
322
|
...e.autoPlay === !0 ? {
|
|
@@ -394,7 +395,7 @@ function Le(e) {
|
|
|
394
395
|
children: e.children
|
|
395
396
|
}
|
|
396
397
|
) : null,
|
|
397
|
-
(o = (
|
|
398
|
+
(o = (f = e.builderBlock) == null ? void 0 : f.children) != null && o.length && !e.fitContent ? /* @__PURE__ */ a(
|
|
398
399
|
"div",
|
|
399
400
|
{
|
|
400
401
|
style: {
|
|
@@ -494,7 +495,7 @@ function je(e) {
|
|
|
494
495
|
}
|
|
495
496
|
})(n);
|
|
496
497
|
}
|
|
497
|
-
function
|
|
498
|
+
function f() {
|
|
498
499
|
var t, l;
|
|
499
500
|
const n = (l = (t = e.builderContextSignal.content) == null ? void 0 : t.data) == null ? void 0 : l.jsCode;
|
|
500
501
|
n && U({
|
|
@@ -606,8 +607,8 @@ function je(e) {
|
|
|
606
607
|
y && S(y);
|
|
607
608
|
});
|
|
608
609
|
}
|
|
609
|
-
const X =
|
|
610
|
-
return
|
|
610
|
+
const X = fe();
|
|
611
|
+
return b(() => {
|
|
611
612
|
var n;
|
|
612
613
|
return (n = i.current) == null || n.addEventListener(
|
|
613
614
|
"initeditingbldr",
|
|
@@ -619,7 +620,7 @@ function je(e) {
|
|
|
619
620
|
L
|
|
620
621
|
);
|
|
621
622
|
};
|
|
622
|
-
}, []),
|
|
623
|
+
}, []), b(() => {
|
|
623
624
|
var n;
|
|
624
625
|
return (n = i.current) == null || n.addEventListener(
|
|
625
626
|
"initpreviewingbldr",
|
|
@@ -631,7 +632,7 @@ function je(e) {
|
|
|
631
632
|
j
|
|
632
633
|
);
|
|
633
634
|
};
|
|
634
|
-
}, []),
|
|
635
|
+
}, []), b(() => {
|
|
635
636
|
var n, t;
|
|
636
637
|
if (_()) {
|
|
637
638
|
if (E() && i.current && i.current.dispatchEvent(new CustomEvent("initeditingbldr")), e.builderContextSignal.content && V(e.canTrack)) {
|
|
@@ -646,24 +647,24 @@ function je(e) {
|
|
|
646
647
|
}
|
|
647
648
|
ee() && E();
|
|
648
649
|
}
|
|
649
|
-
}, []),
|
|
650
|
+
}, []), b(() => {
|
|
650
651
|
e.apiKey || te.error(
|
|
651
652
|
"No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."
|
|
652
|
-
),
|
|
653
|
-
}, []),
|
|
654
|
-
}, [e.content]),
|
|
655
|
-
|
|
656
|
-
}, [(K = (W = e.builderContextSignal.content) == null ? void 0 : W.data) == null ? void 0 : K.jsCode]),
|
|
653
|
+
), f(), B(), P();
|
|
654
|
+
}, []), b(() => {
|
|
655
|
+
}, [e.content]), b(() => {
|
|
656
|
+
f();
|
|
657
|
+
}, [(K = (W = e.builderContextSignal.content) == null ? void 0 : W.data) == null ? void 0 : K.jsCode]), b(() => {
|
|
657
658
|
B();
|
|
658
|
-
}, [(F = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : F.httpRequests]),
|
|
659
|
+
}, [(F = (A = e.builderContextSignal.content) == null ? void 0 : A.data) == null ? void 0 : F.httpRequests]), b(() => {
|
|
659
660
|
P();
|
|
660
|
-
}, [e.builderContextSignal.rootState]),
|
|
661
|
+
}, [e.builderContextSignal.rootState]), b(() => {
|
|
661
662
|
e.data && s(e.data);
|
|
662
|
-
}, [e.data]),
|
|
663
|
+
}, [e.data]), b(() => {
|
|
663
664
|
e.locale && s({
|
|
664
665
|
locale: e.locale
|
|
665
666
|
});
|
|
666
|
-
}, [e.locale]),
|
|
667
|
+
}, [e.locale]), b(() => () => {
|
|
667
668
|
_() && (window.removeEventListener("message", h), window.removeEventListener(
|
|
668
669
|
"builder:component:stateChangeListenerActivated",
|
|
669
670
|
P
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use client";"use strict";const t=require("react/jsx-runtime"),n=require("./bundle-
|
|
1
|
+
"use client";"use strict";const t=require("react/jsx-runtime"),n=require("./bundle-05000fd3.cjs"),l=require("react"),D=require("./USE_SERVER_BUNDLE-8e198f44.cjs"),H=require("next/navigation");function j(e){return t.jsx(t.Fragment,{children:n.isEmptyElement(e.TagName)?t.jsx(t.Fragment,{children:t.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):t.jsx(t.Fragment,{children:typeof e.TagName=="string"?t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children}):t.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})}function V(e){function c(){return{...e.attributes,[n.getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[n.getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}}}return t.jsx(j,{attributes:c(),TagName:e.link?e.builderLinkComponent||"a":"button",actionAttributes:{},children:e.text})}function U(e){return t.jsx(j,{TagName:e.Wrapper,attributes:n.getBlockProperties({block:e.block,context:e.context}),actionAttributes:n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:e.children})}function O(e){function c(){return e.includeBlockProps?{...n.getBlockProperties({block:e.block,context:e.context}),...n.getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{}}return t.jsx(e.Wrapper,{...e.wrapperProps,attributes:c(),children:e.children})}function $(e){function c(){var o;return"builder-blocks"+((o=e.blocks)!=null&&o.length?"":" no-blocks")}function g(){var o,h;n.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((h=window.parent)==null||h.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function S(){var o,h;n.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((h=window.parent)==null||h.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return t.jsxs(t.Fragment,{children:[t.jsx(e.BlocksWrapper,{className:c()+" props-blocks-wrapper-7cd1560e","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:o=>g(),onMouseEnter:o=>S(),onKeyPress:o=>g(),...e.BlocksWrapperProps,children:e.children}),t.jsx("style",{children:`.props-blocks-wrapper-7cd1560e {
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: stretch;
|
|
5
|
-
}`})]})}function J(e){return t.jsx("span",{children:e.children})}function G(e){var o,
|
|
5
|
+
}`})]})}function J(e){return t.jsx("span",{children:e.children})}function G(e){var o,h,v,x,b,s;function c(){var y;const u=e.image||e.src;if(!u||!(u.match(/builder\.io/)||u.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((y=e.image)!=null&&y.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),n.getSrcSet(u)}else if(e.image&&!e.srcset)return n.getSrcSet(u);return n.getSrcSet(u)}function g(){var m;return(m=c==null?void 0:c())!=null&&m.match(/builder\.io/)&&!e.noWebp?c().replace(/\?/g,"?format=webp&"):""}function S(){const m={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?m:void 0}return t.jsxs(t.Fragment,{children:[t.jsxs(t.Fragment,{children:[t.jsxs("picture",{children:[g()?t.jsx("source",{type:"image/webp",srcSet:g()}):null,t.jsx("img",{loading:e.highPriority?"eager":"lazy",fetchPriority:e.highPriority?"high":"auto",alt:e.altText,role:e.altText?void 0:"presentation",style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...S()},className:"builder-image"+(e.className?" "+e.className:"")+" img-ac3dff4a",src:e.image,srcSet:c(),sizes:e.sizes})]}),e.aspectRatio&&!((h=(o=e.builderBlock)==null?void 0:o.children)!=null&&h.length&&e.fitContent)?t.jsx("div",{className:"builder-image-sizer div-ac3dff4a",style:{paddingTop:e.aspectRatio*100+"%"}}):null,(x=(v=e.builderBlock)==null?void 0:v.children)!=null&&x.length&&e.fitContent?t.jsx(t.Fragment,{children:e.children}):null,!e.fitContent&&((s=(b=e.builderBlock)==null?void 0:b.children)!=null&&s.length)?t.jsx("div",{className:"div-ac3dff4a-2",children:e.children}):null]}),t.jsx("style",{children:`.img-ac3dff4a {
|
|
6
6
|
opacity: 1;
|
|
7
7
|
transition: opacity 0.2s ease-in-out;
|
|
8
|
-
}.div-
|
|
8
|
+
}.div-ac3dff4a {
|
|
9
9
|
width: 100%;
|
|
10
10
|
pointer-events: none;
|
|
11
11
|
font-size: 0;
|
|
12
|
-
}.div-
|
|
12
|
+
}.div-ac3dff4a-2 {
|
|
13
13
|
display: flex;
|
|
14
14
|
flex-direction: column;
|
|
15
15
|
align-items: stretch;
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
left: 0;
|
|
19
19
|
width: 100%;
|
|
20
20
|
height: 100%;
|
|
21
|
-
}`})]})}function Q(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function X(e){const c=l.useRef(null),[g,S]=l.useState(()=>[]),[o,
|
|
21
|
+
}`})]})}function Q(e){return t.jsx("section",{...e.attributes,style:{width:"100%",alignSelf:"stretch",flexGrow:1,boxSizing:"border-box",maxWidth:e.maxWidth||1200,display:"flex",flexDirection:"column",alignItems:"stretch",marginLeft:"auto",marginRight:"auto"},children:e.children})}function X(e){const c=l.useRef(null),[g,S]=l.useState(()=>[]),[o,h]=l.useState(()=>[]);return l.useEffect(()=>{var x;if(!((x=c.current)!=null&&x.getElementsByTagName)||typeof window>"u")return;const v=c.current.getElementsByTagName("script");for(let b=0;b<v.length;b++){const s=v[b];if(s.src){if(g.includes(s.src))continue;g.push(s.src);const m=document.createElement("script");m.async=!0,m.src=s.src,document.head.appendChild(m)}else if(!s.type||["text/javascript","application/javascript","application/ecmascript"].includes(s.type)){if(o.includes(s.innerText))continue;try{o.push(s.innerText),new Function(s.innerText)()}catch(m){console.warn("`CustomCode`: Error running script:",m)}}}},[]),t.jsx("div",{ref:c,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}function Y(e){const c=l.useRef(null),[g,S]=l.useState(()=>[]),[o,h]=l.useState(()=>[]),[v,x]=l.useState(()=>!1);function b(){if(!c.current||!c.current.getElementsByTagName)return;const s=c.current.getElementsByTagName("script");for(let m=0;m<s.length;m++){const u=s[m];if(u.src&&!g.includes(u.src)){g.push(u.src);const y=document.createElement("script");y.async=!0,y.src=u.src,document.head.appendChild(y)}else if(n.isJsScript(u)&&!o.includes(u.innerText))try{o.push(u.innerText),new Function(u.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return l.useEffect(()=>{c.current&&!v&&(x(!0),b())},[c.current,v]),t.jsx("div",{className:"builder-embed",ref:c,dangerouslySetInnerHTML:{__html:e.content}})}function Z(e){return t.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},n.isEditing()&&e.imgSrc||"default-key")}function p(e){var S,o,h,v,x,b,s;function c(){return{...e.autoPlay===!0?{autoPlay:!0}:{},...e.muted===!0?{muted:!0}:{},...e.controls===!0?{controls:!0}:{},...e.loop===!0?{loop:!0}:{},...e.playsInline===!0?{playsInline:!0}:{}}}function g(){return{...c()}}return t.jsxs("div",{style:{position:"relative"},children:[t.jsx("video",{className:"builder-video",...g(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(S=e.attributes)==null?void 0:S.style,objectFit:e.fit,objectPosition:e.position,zIndex:2,borderRadius:"1px",...e.aspectRatio?{position:"absolute"}:null},src:e.video||"no-src",poster:e.posterImage,children:e.lazyLoad?null:t.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((h=(o=e.builderBlock)==null?void 0:o.children)!=null&&h.length))?t.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}}):null,(x=(v=e.builderBlock)==null?void 0:v.children)!=null&&x.length&&e.fitContent?t.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children}):null,(s=(b=e.builderBlock)==null?void 0:b.children)!=null&&s.length&&!e.fitContent?t.jsx("div",{style:{pointerEvents:"none",display:"flex",flexDirection:"column",alignItems:"stretch",position:"absolute",top:"0",left:"0",width:"100%",height:"100%"},children:e.children}):null]})}const A=l.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}});function ee(e){var T,B,N,L,F,W,q;const c=l.useRef(null);function g(a){var d,r;const i={...e.builderContextSignal.rootState,...a};e.builderContextSignal.rootSetState?(r=(d=e.builderContextSignal).rootSetState)==null||r.call(d,i):e.builderContextSignal.rootState=i}function S(a){var d,r,f,k,C;const i={...e.builderContextSignal.content,...a,data:{...(d=e.builderContextSignal.content)==null?void 0:d.data,...a==null?void 0:a.data},meta:{...(r=e.builderContextSignal.content)==null?void 0:r.meta,...a==null?void 0:a.meta,breakpoints:((f=a==null?void 0:a.meta)==null?void 0:f.breakpoints)||((C=(k=e.builderContextSignal.content)==null?void 0:k.meta)==null?void 0:C.breakpoints)}};D.postPreviewContent({value:i,key:i.id}).then(()=>{z.refresh()})}function o(){return e.showContent?{}:{hidden:!0,"aria-hidden":!0}}const[h,v]=l.useState(()=>e.contentWrapper||"div");function x(a){return n.createEditorListener({model:e.model,trustedHosts:e.trustedHosts,callbacks:{configureSdk:i=>{var f;const{breakpoints:d,contentId:r}=i;!r||r!==((f=e.builderContextSignal.content)==null?void 0:f.id)||d&&S({meta:{breakpoints:d}})},animation:i=>{n.triggerAnimation(i)},contentUpdate:i=>{S(i)}}})(a)}function b(){var i,d;const a=(d=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:d.jsCode;a&&n.evaluate({code:a,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!1})}const[s,m]=l.useState(()=>({})),[u,y]=l.useState(()=>({})),[I,K]=l.useState(()=>!1);function _(a){var i,d;if(e.builderContextSignal.content){const r=(i=e.builderContextSignal.content)==null?void 0:i.testVariationId,f=(d=e.builderContextSignal.content)==null?void 0:d.id;n._track({type:"click",canTrack:n.getDefaultCanTrack(e.canTrack),contentId:f,apiKey:e.apiKey,variationId:r!==f?r:void 0,...n.getInteractionPropertiesForEvent(a),unique:!I})}I||K(!0)}function w(){var i,d;const a=((d=(i=e.builderContextSignal.content)==null?void 0:i.data)==null?void 0:d.httpRequests)??{};Object.entries(a).forEach(([r,f])=>{if(!f||u[r]||s[r]&&!n.isEditing())return;u[r]=!0;const k=f.replace(/{{([^}]+)}}/g,(C,M)=>String(n.evaluate({code:M,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState,enableCache:!0})));n.fetch(k).then(C=>C.json()).then(C=>{g({[r]:C}),s[r]=!0}).catch(C=>{console.error("error fetching dynamic data",f,C)}).finally(()=>{u[r]=!1})})}function E(){n.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:n.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function P(a){window.addEventListener("message",x),n.registerInsertMenu(),n.setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(i=>{var r;const d=n.createRegisterComponentMessage(i);(r=window.parent)==null||r.postMessage(d,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",E)}function R(a){const i=new URL(location.href).searchParams,d=i.get("builder.preview"),r=i.get(`builder.overrides.${d}`),f=i.get("apiKey")||i.get("builder.space");d===e.model&&f===e.apiKey&&(!e.content||r===e.content.id)&&n.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(k=>{k&&S(k)})}const z=H.useRouter();return l.useEffect(()=>{var a;return(a=c.current)==null||a.addEventListener("initeditingbldr",P),()=>{var i;return(i=c.current)==null?void 0:i.removeEventListener("initeditingbldr",P)}},[]),l.useEffect(()=>{var a;return(a=c.current)==null||a.addEventListener("initpreviewingbldr",R),()=>{var i;return(i=c.current)==null?void 0:i.removeEventListener("initpreviewingbldr",R)}},[]),l.useEffect(()=>{var a,i;if(n.isBrowser()){if(n.isEditing()&&c.current&&c.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&n.getDefaultCanTrack(e.canTrack)){const r=(a=e.builderContextSignal.content)==null?void 0:a.testVariationId,f=(i=e.builderContextSignal.content)==null?void 0:i.id,k=e.apiKey;n._track({type:"impression",canTrack:!0,contentId:f,apiKey:k,variationId:r!==f?r:void 0})}n.isPreviewing()&&n.isEditing()}},[]),l.useEffect(()=>{e.apiKey||n.logger.error("No API key provided to `Content` component. This can cause issues. Please provide an API key using the `apiKey` prop."),b(),w(),E()},[]),l.useEffect(()=>{},[e.content]),l.useEffect(()=>{b()},[(B=(T=e.builderContextSignal.content)==null?void 0:T.data)==null?void 0:B.jsCode]),l.useEffect(()=>{w()},[(L=(N=e.builderContextSignal.content)==null?void 0:N.data)==null?void 0:L.httpRequests]),l.useEffect(()=>{E()},[e.builderContextSignal.rootState]),l.useEffect(()=>{e.data&&g(e.data)},[e.data]),l.useEffect(()=>{e.locale&&g({locale:e.locale})},[e.locale]),l.useEffect(()=>()=>{n.isBrowser()&&(window.removeEventListener("message",x),window.removeEventListener("builder:component:stateChangeListenerActivated",E))},[]),t.jsx(A.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?t.jsx(h,{ref:c,onClick:a=>_(a),"builder-content-id":(F=e.builderContextSignal.content)==null?void 0:F.id,"builder-model":e.model,...o(),...e.contentWrapperProps,className:n.getWrapperClassName(((W=e.content)==null?void 0:W.testVariationId)||((q=e.content)==null?void 0:q.id)),children:e.children}):null})}exports.BlockWrapper=U;exports.BlocksWrapper=$;exports.Button=V;exports.CustomCode=X;exports.DynamicRenderer=j;exports.Embed=Y;exports.EnableEditor=ee;exports.FragmentComponent=J;exports.Image=G;exports.ImgComponent=Z;exports.InteractiveElement=O;exports.SectionComponent=Q;exports.Video=p;exports.builderContext=A;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use server";"use strict";const n=require("./bundle-
|
|
1
|
+
"use server";"use strict";const n=require("./bundle-05000fd3.cjs");async function s({key:e,value:t}){return n.init(),globalThis._BUILDER_PREVIEW_LRU_CACHE.set(e,t),{[e]:t}}exports.postPreviewContent=s;
|