@builder.io/sdk-react 0.7.4 → 0.7.6
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/browser/index.cjs +11 -11
- package/lib/browser/index.mjs +147 -147
- package/lib/edge/index.cjs +12 -12
- package/lib/edge/index.mjs +303 -303
- package/lib/node/index.cjs +9 -9
- package/lib/node/index.mjs +139 -139
- package/package.json +1 -1
- package/types/components/content/content.helpers.d.ts +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
package/lib/browser/index.cjs
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
${Ne(n)}
|
|
8
8
|
}`;return e?`${e} {
|
|
9
9
|
${i}
|
|
10
|
-
}`:i};function W(e){return a.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function q(e){function t(){const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return d.checkIsDefined(i.hide)?!i.hide:d.checkIsDefined(i.show)?i.show:!0}function n(){var
|
|
10
|
+
}`:i};function W(e){return a.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function q(e){function t(){const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return d.checkIsDefined(i.hide)?!i.hide:d.checkIsDefined(i.show)?i.show:!0}function n(){var S;const i=$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),o=i.responsiveStyles,r=e.context.content,l=ue(((S=r==null?void 0:r.meta)==null?void 0:S.breakpoints)||{}),s=o==null?void 0:o.large,c=o==null?void 0:o.medium,u=o==null?void 0:o.small,f=i.id;if(!f)return"";const b=s?O({className:f,styles:s}):"",v=c?O({className:f,styles:c,mediaQuery:Z("medium",l)}):"",R=u?O({className:f,styles:u,mediaQuery:Z("small",l)}):"";return[b,v,R].join(" ")}return a.jsx(a.Fragment,{children:n()&&t()?a.jsx(a.Fragment,{children:a.jsx(W,{styles:n()})}):null})}function We(e){return e.charAt(0).toUpperCase()+e.slice(1)}const _e=e=>`on${We(e)}`,Me=(e,t)=>n=>A({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function K(e){const t={},n=e.block.actions??{};for(const i in n){if(!n.hasOwnProperty(i))continue;const o=n[i];let r=_e(i);if(e.stripPrefix)switch(d.TARGET){case"vue2":case"vue3":r=r.replace("v-on:","");break;case"svelte":r=r.replace("on:","");break}t[r]=Me(o,e)}return t}function Le(e){return e.className=e.class,delete e.class,e}const De=e=>({href:e.href});function N({block:e,context:t}){var i;const n={...De(e),...e.properties,"builder-id":e.id,style:e.style?Oe(e.style):void 0,class:[e.id,"builder-block",e.class,(i=e.properties)==null?void 0:i.class].filter(Boolean).join(" ")};return Le(n)}function Oe(e){switch(d.TARGET){case"svelte":case"vue2":case"vue3":case"solid":return me(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}function ee(e){return a.jsxs(a.Fragment,{children:[" ",e.hasChildren?a.jsx(a.Fragment,{children:a.jsxs(e.Wrapper,{...N({block:e.block,context:e.context}),...K({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0}),children:[" ",e.children," "]})}):a.jsx(a.Fragment,{children:a.jsx(e.Wrapper,{...N({block:e.block,context:e.context}),...K({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context,stripPrefix:!0})})})," "]})}function Ue(e){return a.jsx(e.Wrapper,{...e.wrapperProps,attributes:{...N({block:e.block,context:e.context}),...K({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})},children:e.children})}const Ke=({componentOptions:e,builderBlock:t,context:n,componentRef:i,includeBlockProps:o,isInteractive:r,contextValue:l})=>r?{Wrapper:i,block:t,context:n,wrapperProps:e}:{...e,...o?{attributes:N({block:t,context:l})}:{}};function te(e){var i,o;const[t,n]=m.useState(()=>e.isInteractive?Ue:e.componentRef);return a.jsx(a.Fragment,{children:e.componentRef?a.jsx(a.Fragment,{children:a.jsxs(t,{...Ke({componentOptions:e.componentOptions,builderBlock:e.builderBlock,context:e.context,componentRef:e.componentRef,includeBlockProps:e.includeBlockProps,isInteractive:e.isInteractive,contextValue:e.context}),children:[(i=e.blockChildren)==null?void 0:i.map(r=>a.jsx(_,{block:r,context:e.context,registeredComponents:e.registeredComponents},"block-"+r.id)),(o=e.blockChildren)==null?void 0:o.map(r=>a.jsx(q,{block:r,context:e.context},"block-style-"+r.id))]})}):null})}function He(e){const[t,n]=m.useState(()=>e.repeatContext);return a.jsx(z.Provider,{value:t,children:a.jsx(_,{block:e.block,context:t,registeredComponents:e.registeredComponents})})}function _(e){var f,b,v,R;function t(){return Ae({block:e.block,context:e.context,registeredComponents:e.registeredComponents})}function n(){return Ve({block:e.block,context:e.context})}function i(){var S;return(S=e.block.repeat)!=null&&S.collection?e.block:$({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})}function o(){return e.block.tagName||"div"}function r(){var I,w;if((I=e.block.repeat)!=null&&I.collection)return!!((w=n==null?void 0:n())!=null&&w.length);const S="hide"in i()?i().hide:!1;return("show"in i()?i().show:!0)&&!S}function l(){var k;return!((k=t==null?void 0:t())!=null&&k.component)&&!n()?i().children??[]:[]}function s(){var S,k,I,w,C;return{blockChildren:i().children??[],componentRef:(S=t==null?void 0:t())==null?void 0:S.component,componentOptions:{...we(i()),builderContext:e.context,...((k=t==null?void 0:t())==null?void 0:k.name)==="Symbol"||((I=t==null?void 0:t())==null?void 0:I.name)==="Columns"?{builderComponents:e.registeredComponents}:{}},context:c,registeredComponents:e.registeredComponents,builderBlock:i(),includeBlockProps:((w=t==null?void 0:t())==null?void 0:w.noWrap)===!0,isInteractive:!((C=t==null?void 0:t())!=null&&C.isRSC)}}const[c,u]=m.useState(()=>e.context);return a.jsx(a.Fragment,{children:r()?a.jsx(a.Fragment,{children:(f=t==null?void 0:t())!=null&&f.noWrap?a.jsx(a.Fragment,{children:a.jsx(te,{componentRef:s().componentRef,componentOptions:s().componentOptions,blockChildren:s().blockChildren,context:s().context,registeredComponents:s().registeredComponents,builderBlock:s().builderBlock,includeBlockProps:s().includeBlockProps,isInteractive:s().isInteractive})}):a.jsxs(a.Fragment,{children:[D(o())?a.jsx(a.Fragment,{children:a.jsx(ee,{Wrapper:o(),block:i(),context:e.context,hasChildren:!1})}):null,!D(o())&&n()?a.jsx(a.Fragment,{children:(b=n())==null?void 0:b.map((S,k)=>a.jsx(He,{repeatContext:S.context,block:S.block,registeredComponents:e.registeredComponents},k))}):null,!D(o())&&!n()?a.jsx(a.Fragment,{children:a.jsxs(ee,{Wrapper:o(),block:i(),context:e.context,hasChildren:!0,children:[a.jsx(te,{componentRef:s().componentRef,componentOptions:s().componentOptions,blockChildren:s().blockChildren,context:s().context,registeredComponents:s().registeredComponents,builderBlock:s().builderBlock,includeBlockProps:s().includeBlockProps,isInteractive:s().isInteractive}),(v=l())==null?void 0:v.map(S=>a.jsx(_,{block:S,context:c,registeredComponents:e.registeredComponents},"block-"+S.id)),(R=l())==null?void 0:R.map(S=>a.jsx(q,{block:S,context:c},"block-style-"+S.id))]})}):null]})}):null})}function ze(e){function t(){var o;return"builder-blocks"+((o=e.blocks)!=null&&o.length?"":" no-blocks")}function n(){var o,r;d.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((r=window.parent)==null||r.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function i(){var o,r;d.isEditing()&&!((o=e.blocks)!=null&&o.length)&&((r=window.parent)==null||r.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:t()+" div-02c7a115","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:o=>n(),onMouseEnter:o=>i(),onKeyPress:o=>n(),children:e.children}),a.jsx("style",{children:`.div-02c7a115 {
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
align-items: stretch;
|
|
14
|
-
}`})]})}function M(e){var i,o;const t=m.useContext(z),n=m.useContext(se);return a.jsxs(ze,{blocks:e.blocks,parent:e.parent,path:e.path,styleProp:e.styleProp,children:[e.blocks?a.jsx(a.Fragment,{children:(i=e.blocks)==null?void 0:i.map(r=>a.jsx(_,{block:r,context:e.context||t,registeredComponents:e.registeredComponents||n.registeredComponents},"render-block-"+r.id))}):null,e.blocks?a.jsx(a.Fragment,{children:(o=e.blocks)==null?void 0:o.map(r=>a.jsx(q,{block:r,context:e.context||t},"block-style-"+r.id))}):null]})}function fe(e){var
|
|
15
|
-
@media (max-width: ${
|
|
14
|
+
}`})]})}function M(e){var i,o;const t=m.useContext(z),n=m.useContext(se);return a.jsxs(ze,{blocks:e.blocks,parent:e.parent,path:e.path,styleProp:e.styleProp,children:[e.blocks?a.jsx(a.Fragment,{children:(i=e.blocks)==null?void 0:i.map(r=>a.jsx(_,{block:r,context:e.context||t,registeredComponents:e.registeredComponents||n.registeredComponents},"render-block-"+r.id))}):null,e.blocks?a.jsx(a.Fragment,{children:(o=e.blocks)==null?void 0:o.map(r=>a.jsx(q,{block:r,context:e.context||t},"block-style-"+r.id))}):null]})}function fe(e){var w;const[t,n]=m.useState(()=>typeof e.space=="number"?e.space||0:20),[i,o]=m.useState(()=>e.columns||[]),[r,l]=m.useState(()=>e.stackColumnsAt||"tablet");function s(C){var E;return((E=i[C])==null?void 0:E.width)||100/i.length}function c(C){const E=t*(i.length-1)/i.length;return`calc(${s(C)}% - ${E}px)`}function u({stackedStyle:C,desktopStyle:E}){return r==="tablet"?C:E}function f({stackedStyle:C,desktopStyle:E}){return r==="never"?E:C}const[b,v]=m.useState(()=>e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column");function R(){return{"--flex-dir":b,"--flex-dir-tablet":u({stackedStyle:b,desktopStyle:"row"})}}function S(C){const E=C===0?0:t,j=c(C),F=`${E}px`,B="100%",P=0;return{width:j,["marginLeft"]:F,"--column-width-mobile":f({stackedStyle:B,desktopStyle:j}),"--column-margin-left-mobile":f({stackedStyle:P,desktopStyle:F}),"--column-width-tablet":u({stackedStyle:B,desktopStyle:j}),"--column-margin-left-tablet":u({stackedStyle:P,desktopStyle:F})}}function k(C){var j,F;return ue(((F=(j=e.builderContext.content)==null?void 0:j.meta)==null?void 0:F.breakpoints)||{})[C].max}function I(){return`
|
|
15
|
+
@media (max-width: ${k("medium")}px) {
|
|
16
16
|
.${e.builderBlock.id}-breakpoints {
|
|
17
17
|
flex-direction: var(--flex-dir-tablet);
|
|
18
18
|
align-items: stretch;
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
@media (max-width: ${
|
|
27
|
+
@media (max-width: ${k("small")}px) {
|
|
28
28
|
.${e.builderBlock.id}-breakpoints {
|
|
29
29
|
flex-direction: var(--flex-dir);
|
|
30
30
|
align-items: stretch;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
|
-
`}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-53636e90`,style:R(),children:[a.jsx(a.Fragment,{children:a.jsx(W,{styles:
|
|
38
|
+
`}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-53636e90`,style:R(),children:[a.jsx(a.Fragment,{children:a.jsx(W,{styles:I()})}),(w=e.columns)==null?void 0:w.map((C,E)=>m.createElement("div",{className:"builder-column div-53636e90-2",style:S(E),key:E},a.jsx(M,{path:`component.options.columns.${E}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,blocks:C.blocks})))]}),a.jsx("style",{children:`.div-53636e90 {
|
|
39
39
|
display: flex;
|
|
40
40
|
line-height: normal;
|
|
41
41
|
}.div-53636e90-2 {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
left: 0;
|
|
59
59
|
width: 100%;
|
|
60
60
|
height: 100%;
|
|
61
|
-
}`})]})}function be(e){return a.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})}const Ye={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},Qe={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(i=>{i.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(o=>o.get("width"))&&(n.find(r=>!r.get("width"))||n.reduce((s,c)=>s+c.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}]},Je={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}]};function Xe(e){const t=m.useRef(null),[n,i]=m.useState(()=>[]),[o,r]=m.useState(()=>[]);return m.useEffect(()=>{var s;if(!((s=t.current)!=null&&s.getElementsByTagName)||typeof window>"u")return;const l=t.current.getElementsByTagName("script");for(let c=0;c<l.length;c++){const u=l[c];if(u.src){if(n.includes(u.src))continue;n.push(u.src);const f=document.createElement("script");f.async=!0,f.src=u.src,document.head.appendChild(f)}else if(!u.type||["text/javascript","application/javascript","application/ecmascript"].includes(u.type)){if(o.includes(u.innerText))continue;try{o.push(u.innerText),new Function(u.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),a.jsx("div",{ref:t,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const Ze={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(i=>i.json()).then(i=>{e.get("url")===t&&(i.html?e.set("content",i.html):e.set("content","Invalid url, please try another"))}).catch(i=>{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}]},et=["text/javascript","application/javascript","application/ecmascript"],tt=e=>et.includes(e.type);function nt(e){const t=m.useRef(null),[n,i]=m.useState(()=>[]),[o,r]=m.useState(()=>[]),[l,s]=m.useState(()=>!1);function c(){if(!t.current||!t.current.getElementsByTagName)return;const u=t.current.getElementsByTagName("script");for(let f=0;f<u.length;f++){const b=u[f];if(b.src&&!n.includes(b.src)){n.push(b.src);const y=document.createElement("script");y.async=!0,y.src=b.src,document.head.appendChild(y)}else if(tt(b)&&!o.includes(b.innerText))try{o.push(b.innerText),new Function(b.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return m.useEffect(()=>{t.current&&!l&&(s(!0),c())},[t.current,l]),a.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:e.content}})}const it={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},at={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(l,s=6e4){return new Promise((c,u)=>{const f=document.createElement("img");let b=!1;f.onload=()=>{b=!0,c(f)},f.addEventListener("error",y=>{console.warn("Image load failed",y.error),u(y.error)}),f.src=l,setTimeout(()=>{b||u(new Error("Image load timed out"))},s)})}function i(l){return Math.round(l*1e3)/1e3}const o=e.get("image"),r=e.get("aspectRatio");if(fetch(o).then(l=>l.blob()).then(l=>{l.type.includes("svg")&&e.set("noWebp",!0)}),o&&(!r||r===.7041))return n(o).then(l=>{const s=e.get("aspectRatio");e.get("image")===o&&(!s||s===.7041)&&l.width&&l.height&&(e.set("aspectRatio",i(l.height/l.width)),e.set("height",l.height),e.set("width",l.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:"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}]},ot={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};function rt(e){return a.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},d.isEditing()&&e.imgSrc||"default-key")}const lt={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>"}}}]},ct={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"}]},st={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 xe(e){var t;return a.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const dt={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://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",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}]};function Se(e){var i,o,r,l,s,c,u;function t(){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 n(){return{...t()}}return a.jsxs("div",{style:{position:"relative"},children:[a.jsx("video",{className:"builder-video",...n(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(i=e.attributes)==null?void 0:i.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:a.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((r=(o=e.builderBlock)==null?void 0:o.children)!=null&&r.length))?a.jsx(a.Fragment,{children:a.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(s=(l=e.builderBlock)==null?void 0:l.children)!=null&&s.length&&e.fitContent?a.jsx(a.Fragment,{children:a.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(u=(c=e.builderBlock)==null?void 0:c.children)!=null&&u.length&&!e.fitContent?a.jsx(a.Fragment,{children:a.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 ie=()=>[{component:ce,...Ye},{component:fe,...Qe},{component:Xe,...Je},{component:nt,...Ze},{component:ge,...it},{component:he,...at},{component:rt,...ot},{component:be,...lt},{component:ke,...ct},{component:xe,...st},{component:Se,...dt}],ut=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
61
|
+
}`})]})}function be(e){return a.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})}const Ye={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},Qe={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(i=>{i.delete("width")})}const n=e.get("columns");Array.isArray(n)&&n.find(o=>o.get("width"))&&(n.find(r=>!r.get("width"))||n.reduce((s,c)=>s+c.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}]},Je={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}]};function Xe(e){const t=m.useRef(null),[n,i]=m.useState(()=>[]),[o,r]=m.useState(()=>[]);return m.useEffect(()=>{var s;if(!((s=t.current)!=null&&s.getElementsByTagName)||typeof window>"u")return;const l=t.current.getElementsByTagName("script");for(let c=0;c<l.length;c++){const u=l[c];if(u.src){if(n.includes(u.src))continue;n.push(u.src);const f=document.createElement("script");f.async=!0,f.src=u.src,document.head.appendChild(f)}else if(!u.type||["text/javascript","application/javascript","application/ecmascript"].includes(u.type)){if(o.includes(u.innerText))continue;try{o.push(u.innerText),new Function(u.innerText)()}catch(f){console.warn("`CustomCode`: Error running script:",f)}}}},[]),a.jsx("div",{ref:t,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const Ze={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(i=>i.json()).then(i=>{e.get("url")===t&&(i.html?e.set("content",i.html):e.set("content","Invalid url, please try another"))}).catch(i=>{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}]},et=["text/javascript","application/javascript","application/ecmascript"],tt=e=>et.includes(e.type);function nt(e){const t=m.useRef(null),[n,i]=m.useState(()=>[]),[o,r]=m.useState(()=>[]),[l,s]=m.useState(()=>!1);function c(){if(!t.current||!t.current.getElementsByTagName)return;const u=t.current.getElementsByTagName("script");for(let f=0;f<u.length;f++){const b=u[f];if(b.src&&!n.includes(b.src)){n.push(b.src);const v=document.createElement("script");v.async=!0,v.src=b.src,document.head.appendChild(v)}else if(tt(b)&&!o.includes(b.innerText))try{o.push(b.innerText),new Function(b.innerText)()}catch(v){console.warn("`Embed`: Error running script:",v)}}}return m.useEffect(()=>{t.current&&!l&&(s(!0),c())},[t.current,l]),a.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:e.content}})}const it={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},at={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(l,s=6e4){return new Promise((c,u)=>{const f=document.createElement("img");let b=!1;f.onload=()=>{b=!0,c(f)},f.addEventListener("error",v=>{console.warn("Image load failed",v.error),u(v.error)}),f.src=l,setTimeout(()=>{b||u(new Error("Image load timed out"))},s)})}function i(l){return Math.round(l*1e3)/1e3}const o=e.get("image"),r=e.get("aspectRatio");if(fetch(o).then(l=>l.blob()).then(l=>{l.type.includes("svg")&&e.set("noWebp",!0)}),o&&(!r||r===.7041))return n(o).then(l=>{const s=e.get("aspectRatio");e.get("image")===o&&(!s||s===.7041)&&l.width&&l.height&&(e.set("aspectRatio",i(l.height/l.width)),e.set("height",l.height),e.set("width",l.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:"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}]},ot={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};function rt(e){return a.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},d.isEditing()&&e.imgSrc||"default-key")}const lt={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>"}}}]},ct={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"}]},st={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 xe(e){var t;return a.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const dt={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://firebasestorage.googleapis.com/v0/b/builder-3b0a2.appspot.com/o/assets%2FKQlEmWDxA0coC3PK6UvkrjwkIGI2%2F28cb070609f546cdbe5efa20e931aa4b?alt=media&token=912e9551-7a7c-4dfb-86b6-3da1537d1a7f",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}]};function Se(e){var i,o,r,l,s,c,u;function t(){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 n(){return{...t()}}return a.jsxs("div",{style:{position:"relative"},children:[a.jsx("video",{className:"builder-video",...n(),preload:e.preload||"metadata",style:{width:"100%",height:"100%",...(i=e.attributes)==null?void 0:i.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:a.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((r=(o=e.builderBlock)==null?void 0:o.children)!=null&&r.length))?a.jsx(a.Fragment,{children:a.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(s=(l=e.builderBlock)==null?void 0:l.children)!=null&&s.length&&e.fitContent?a.jsx(a.Fragment,{children:a.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(u=(c=e.builderBlock)==null?void 0:c.children)!=null&&u.length&&!e.fitContent?a.jsx(a.Fragment,{children:a.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 ie=()=>[{component:ce,...Ye},{component:fe,...Qe},{component:Xe,...Je},{component:nt,...Ze},{component:ge,...it},{component:he,...at},{component:rt,...ot},{component:be,...lt},{component:pe,...ct},{component:xe,...st},{component:Se,...dt}],ut=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
62
62
|
function getAndSetVariantId() {
|
|
63
63
|
function setCookie(name, value, days) {
|
|
64
64
|
let expires = '';
|
|
@@ -148,15 +148,15 @@
|
|
|
148
148
|
thisScriptEl?.remove();
|
|
149
149
|
}
|
|
150
150
|
return;
|
|
151
|
-
}`,ye="builderIoAbTest",ve="builderIoRenderContent",V=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),ft=({canTrack:e,content:t})=>!(!(V(t).length>0)||!e||d.isBrowser()),gt=e=>e==="react"||e==="reactNative",
|
|
151
|
+
}`,ye="builderIoAbTest",ve="builderIoRenderContent",V=e=>Object.values((e==null?void 0:e.variations)||{}).map(t=>({...t,testVariationId:t.id,id:e==null?void 0:e.id})),ft=({canTrack:e,content:t})=>!(!(V(t).length>0)||!e||d.isBrowser()),gt=e=>e==="react"||e==="reactNative",ke=gt(d.TARGET),ht=()=>`
|
|
152
152
|
window.${ye} = ${ut}
|
|
153
153
|
window.${ve} = ${mt}
|
|
154
154
|
`,bt=(e,t)=>`
|
|
155
155
|
window.${ye}(
|
|
156
|
-
"${t}",${JSON.stringify(e)}, ${
|
|
156
|
+
"${t}",${JSON.stringify(e)}, ${ke}
|
|
157
157
|
)`,xt=({contentId:e,variationId:t})=>`window.${ve}(
|
|
158
|
-
"${t}", "${e}", ${
|
|
159
|
-
)`;function H(e){return a.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}function ae(e){return Math.round(e*1e3)/1e3}const St=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},yt=e=>St(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),oe=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,o=e.clientY-n.top,r=ae(i/n.width),l=ae(o/n.height);return{x:r,y:l}},vt=e=>{const t=e.target,n=t&&yt(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?oe({event:e,target:t}):void 0,builderTargetOffset:n?oe({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},
|
|
158
|
+
"${t}", "${e}", ${ke}
|
|
159
|
+
)`;function H(e){return a.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}function ae(e){return Math.round(e*1e3)/1e3}const St=(e,t,n=!0)=>{if(!(e instanceof HTMLElement))return null;let i=n?e:e.parentElement;do{if(!i)return null;if(t(i))return i}while(i=i.parentElement);return null},yt=e=>St(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),oe=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,o=e.clientY-n.top,r=ae(i/n.width),l=ae(o/n.height);return{x:r,y:l}},vt=e=>{const t=e.target,n=t&&yt(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?oe({event:e,target:t}):void 0,builderTargetOffset:n?oe({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},kt="0.7.6",pt=()=>{d.register("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 re=!1;const Ct=(e={})=>{var t,n;re||(re=!0,d.isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:d.TARGET,version:kt,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",({data:i})=>{var o,r;if(i!=null&&i.type)switch(i.type){case"builder.evaluate":{const l=i.data.text,s=i.data.arguments||[],c=i.data.id,u=new Function(l);let f,b=null;try{f=u.apply(null,s)}catch(v){b=v}b?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:c,error:b.message}},"*"):f&&typeof f.then=="function"?f.then(v=>{var R;(R=window.parent)==null||R.postMessage({type:"builder.evaluateResult",data:{id:c,result:v}},"*")}).catch(console.error):(r=window.parent)==null||r.postMessage({type:"builder.evaluateResult",data:{result:f,id:c}},"*");break}}})))};function wt(e){var j,F,B,P,L,Y,Q;const t=m.useRef(null),[n,i]=m.useState(()=>0);function o(g){var x,y,p,T,J;const h={...e.builderContextSignal.content,...g,data:{...(x=e.builderContextSignal.content)==null?void 0:x.data,...g==null?void 0:g.data},meta:{...(y=e.builderContextSignal.content)==null?void 0:y.meta,...g==null?void 0:g.meta,breakpoints:((p=g==null?void 0:g.meta)==null?void 0:p.breakpoints)||((J=(T=e.builderContextSignal.content)==null?void 0:T.meta)==null?void 0:J.breakpoints)}};e.setBuilderContextSignal(Ce=>({...Ce,content:h}))}m.useState(()=>0);const[r,l]=m.useState(()=>!1);function s(g){var x;const{data:h}=g;if(h)switch(h.type){case"builder.configureSdk":{const y=h.data,{breakpoints:p,contentId:T}=y;if(!T||T!==((x=e.builderContextSignal.content)==null?void 0:x.id))return;p&&o({meta:{breakpoints:p}}),i(n+1);break}case"builder.contentUpdate":{const y=h.data,p=y.key||y.alias||y.entry||y.modelName,T=y.data;p===e.model&&(o(T),i(n+1));break}}}function c(){var h,x;const g=(x=(h=e.builderContextSignal.content)==null?void 0:h.data)==null?void 0:x.jsCode;g&&A({code:g,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[u,f]=m.useState(()=>({})),[b,v]=m.useState(()=>!1);function R(g){var h,x;if(e.builderContextSignal.content){const y=(h=e.builderContextSignal.content)==null?void 0:h.testVariationId,p=(x=e.builderContextSignal.content)==null?void 0:x.id;d._track({type:"click",canTrack:d.getDefaultCanTrack(e.canTrack),contentId:p,apiKey:e.apiKey,variationId:y!==p?y:void 0,...vt(g),unique:!b})}b||v(!0)}function S(g){return g.replace(/{{([^}]+)}}/g,(h,x)=>A({code:x,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function k({url:g,key:h}){d.fetch(g).then(x=>x.json()).then(x=>{var p,T;const y={...e.builderContextSignal.rootState,[h]:x};(T=(p=e.builderContextSignal).rootSetState)==null||T.call(p,y),u[h]=!0}).catch(x=>{console.error("error fetching dynamic data",g,x)})}function I(){var h,x;const g=((x=(h=e.builderContextSignal.content)==null?void 0:h.data)==null?void 0:x.httpRequests)??{};Object.entries(g).forEach(([y,p])=>{if(p&&(!u[y]||d.isEditing())){const T=S(p);k({url:T,key:y})}})}function w(){d.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:d.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function C(g){i(n+1),window.addEventListener("message",s),pt(),Ct({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(h=>{var y;const x=d.createRegisterComponentMessage(h);(y=window.parent)==null||y.postMessage(x,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",w)}function E(g){const h=new URL(location.href).searchParams,x=h.get("builder.preview"),y=h.get(`builder.preview.${x}`),p=h.get("apiKey")||h.get("builder.space");x===e.model&&p===e.apiKey&&(!e.content||y===e.content.id)&&d.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(T=>{T&&o(T)})}return m.useEffect(()=>{var g;return(g=t.current)==null||g.addEventListener("initeditingbldr",C),()=>{var h;return(h=t.current)==null?void 0:h.removeEventListener("initeditingbldr",C)}},[]),m.useEffect(()=>{var g;return(g=t.current)==null||g.addEventListener("initpreviewingbldr",E),()=>{var h;return(h=t.current)==null?void 0:h.removeEventListener("initpreviewingbldr",E)}},[]),m.useEffect(()=>{var g,h;if(d.isBrowser()){if(d.isEditing()&&t.current&&t.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&d.getDefaultCanTrack(e.canTrack)){const y=(g=e.builderContextSignal.content)==null?void 0:g.testVariationId,p=(h=e.builderContextSignal.content)==null?void 0:h.id,T=e.apiKey;d._track({type:"impression",canTrack:!0,contentId:p,apiKey:T,variationId:y!==p?y:void 0})}d.isPreviewing()&&t.current&&t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"))}},[]),m.useEffect(()=>{e.apiKey||d.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),c(),I(),w()},[]),m.useEffect(()=>{e.content&&o(e.content)},[e.content]),m.useEffect(()=>{},[r]),m.useEffect(()=>{c()},[(F=(j=e.builderContextSignal.content)==null?void 0:j.data)==null?void 0:F.jsCode,e.builderContextSignal.rootState]),m.useEffect(()=>{I()},[(P=(B=e.builderContextSignal.content)==null?void 0:B.data)==null?void 0:P.httpRequests]),m.useEffect(()=>{w()},[e.builderContextSignal.rootState]),m.useEffect(()=>()=>{d.isBrowser()&&(window.removeEventListener("message",s),window.removeEventListener("builder:component:stateChangeListenerActivated",w))},[]),a.jsx(z.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?a.jsx(a.Fragment,{children:m.createElement("div",{key:n,ref:t,onClick:g=>R(g),"builder-content-id":(L=e.builderContextSignal.content)==null?void 0:L.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},className:`variant-${((Y=e.content)==null?void 0:Y.testVariationId)||((Q=e.content)==null?void 0:Q.id)}`},e.children)}):null})}const It=e=>{var r;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],i=e.fileUrl??((r=e==null?void 0:e.files)==null?void 0:r.regular);let o="";if(i&&t&&n&&(o+=`
|
|
160
160
|
@font-face {
|
|
161
161
|
font-family: "${t}";
|
|
162
162
|
src: local("${n}"), url('${i}') format('woff2');
|
|
@@ -186,4 +186,4 @@ ${Et({customFonts:e.customFonts})}
|
|
|
186
186
|
text-align: inherit;
|
|
187
187
|
font-family: inherit;
|
|
188
188
|
}
|
|
189
|
-
`.trim());return a.jsx(W,{styles:t})}const jt=({content:e,data:t,locale:n})=>{var r,l,s;const i={}
|
|
189
|
+
`.trim());return a.jsx(W,{styles:t})}const jt=({content:e,data:t,locale:n})=>{var r,l,s;const i={},o=((r=e==null?void 0:e.data)==null?void 0:r.state)||{};return(s=(l=e==null?void 0:e.data)==null?void 0:l.inputs)==null||s.forEach(c=>{c.name&&c.defaultValue!==void 0&&(i[c.name]=c.defaultValue)}),{...i,...o,...t,...n?{locale:n}:{}}},Ft=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function le(e){var c,u,f,b,v,R,S;const[t,n]=m.useState(()=>{var k,I;return xt({variationId:(k=e.content)==null?void 0:k.testVariationId,contentId:(I=e.content)==null?void 0:I.id})});function i(k){s(I=>({...I,rootState:k}))}const[o,r]=m.useState(()=>[...ie(),...d.components,...e.customComponents||[]].reduce((k,{component:I,...w})=>({...k,[w.name]:{component:I,...d.serializeComponentInfo(w)}}),{})),[l,s]=m.useState(()=>({content:Ft({content:e.content,data:e.data}),localState:void 0,rootState:jt({content:e.content,data:e.data,locale:e.locale}),rootSetState:i,context:e.context||{},apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...ie(),...d.components,...e.customComponents||[]].reduce((k,{component:I,...w})=>({...k,[w.name]:d.serializeComponentInfo(w)}),{}),inheritedStyles:{}}));return a.jsx(se.Provider,{value:{registeredComponents:o},children:a.jsxs(wt,{content:e.content,model:e.model,context:e.context,apiKey:e.apiKey,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,showContent:e.showContent,builderContextSignal:l,setBuilderContextSignal:s,children:[e.isSsrAbTest?a.jsx(a.Fragment,{children:a.jsx(H,{scriptStr:t})}):null,a.jsx(a.Fragment,{children:a.jsx(Rt,{contentId:(c=l.content)==null?void 0:c.id,cssCode:(f=(u=l.content)==null?void 0:u.data)==null?void 0:f.cssCode,customFonts:(v=(b=l.content)==null?void 0:b.data)==null?void 0:v.customFonts})}),a.jsx(M,{blocks:(S=(R=l.content)==null?void 0:R.data)==null?void 0:S.blocks,context:l,registeredComponents:o})]})})}function G(e){var l,s;const[t,n]=m.useState(()=>ft({canTrack:d.getDefaultCanTrack(e.canTrack),content:e.content}));function i(){var c;return bt(V(e.content).map(u=>({id:u.testVariationId,testRatio:u.testRatio})),((c=e.content)==null?void 0:c.id)||"")}function o(){return V(e.content).map(c=>`.variant-${c.testVariationId} { display: none; } `).join("")}function r(){var c;return t?{...e.content,testVariationId:(c=e.content)==null?void 0:c.id}:d.handleABTestingSync({item:e.content,canTrack:d.getDefaultCanTrack(e.canTrack)})}return m.useEffect(()=>{},[]),a.jsxs(a.Fragment,{children:[!e.__isNestedRender&&d.TARGET!=="reactNative"?a.jsx(a.Fragment,{children:a.jsx(H,{scriptStr:ht()})}):null,t?a.jsxs(a.Fragment,{children:[a.jsx(W,{id:`variants-styles-${(l=e.content)==null?void 0:l.id}`,styles:o()}),a.jsx(H,{scriptStr:i()}),(s=V(e.content))==null?void 0:s.map(c=>a.jsx(le,{content:c,showContent:!1,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t},c.testVariationId))]}):null,a.jsx(le,{content:r(),showContent:!0,model:e.model,data:e.data,context:e.context,apiKey:e.apiKey,apiVersion:e.apiVersion,customComponents:e.customComponents,canTrack:e.canTrack,locale:e.locale,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t})]})}const Bt=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return d.fetchOneEntry({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(n=>{d.logger.error("Could not fetch symbol content: ",n)})};function pe(e){var r,l,s;function t(){var c,u;return[e.attributes.className,"builder-symbol",(c=e.symbol)!=null&&c.inline?"builder-inline-symbol":void 0,(u=e.symbol)!=null&&u.dynamic||e.dynamic?"builder-dynamic-symbol":void 0].filter(Boolean).join(" ")}const[n,i]=m.useState(()=>{var c;return(c=e.symbol)==null?void 0:c.content});function o(){n||Bt({symbol:e.symbol,builderContextValue:e.builderContext}).then(c=>{c&&i(c)})}return m.useEffect(()=>{},[]),m.useEffect(()=>{o()},[e.symbol]),a.jsx("div",{...e.attributes,className:t(),children:a.jsx(G,{__isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:e.builderContext.context,customComponents:Object.values(e.builderComponents),data:{...(r=e.symbol)==null?void 0:r.data,...e.builderContext.localState,...(l=n==null?void 0:n.data)==null?void 0:l.state},model:(s=e.symbol)==null?void 0:s.model,content:n})})}const Pt=M,At=G;exports._processContentResult=d._processContentResult;exports.createRegisterComponentMessage=d.createRegisterComponentMessage;exports.fetchBuilderProps=d.fetchBuilderProps;exports.fetchEntries=d.fetchEntries;exports.fetchOneEntry=d.fetchOneEntry;exports.getAllContent=d.getAllContent;exports.getBuilderSearchParams=d.getBuilderSearchParams;exports.getContent=d.getContent;exports.isEditing=d.isEditing;exports.isPreviewing=d.isPreviewing;exports.register=d.register;exports.setEditorSettings=d.setEditorSettings;exports.track=d.track;exports.Blocks=M;exports.Button=ce;exports.Columns=fe;exports.Content=G;exports.Fragment=ge;exports.Image=he;exports.RenderBlocks=Pt;exports.RenderContent=At;exports.Section=be;exports.Symbol=pe;exports.Text=xe;exports.Video=Se;
|