@builder.io/sdk-react 0.12.4 → 0.12.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 +24 -24
- package/lib/browser/index.mjs +485 -461
- package/lib/{edge/server-entry-0e4f0637.js → browser/server-entry-b9bdd327.js} +4 -4
- package/lib/browser/{server-entry-bcb725be.cjs → server-entry-fc715776.cjs} +1 -1
- package/lib/browser/server-entry.cjs +1 -1
- package/lib/browser/server-entry.mjs +1 -1
- package/lib/edge/index.cjs +31 -31
- package/lib/edge/index.mjs +550 -525
- package/lib/{browser/server-entry-0e4f0637.js → edge/server-entry-57d4ae22.js} +3 -3
- package/lib/edge/{server-entry-bcb725be.cjs → server-entry-fc715776.cjs} +1 -1
- package/lib/edge/server-entry.cjs +1 -1
- package/lib/edge/server-entry.mjs +1 -1
- package/lib/node/index.cjs +10 -10
- package/lib/node/index.mjs +283 -258
- package/lib/node/{server-entry-9aa733e8.js → server-entry-0457c4c8.js} +2 -2
- package/lib/node/server-entry.mjs +1 -1
- package/package.json +1 -1
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/evaluate/browser-runtime/browser.d.ts +5 -1
- package/types/functions/evaluate/should-force-browser-runtime-in-node.d.ts +1 -0
|
@@ -45,7 +45,7 @@ const Q = () => {
|
|
|
45
45
|
host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
|
|
46
46
|
device: n ? "tablet" : e.any() ? "mobile" : "desktop"
|
|
47
47
|
};
|
|
48
|
-
},
|
|
48
|
+
}, d = (t) => t != null, L = (t) => JSON.parse(JSON.stringify(t)), et = (t) => {
|
|
49
49
|
if (t === "localhost" || t === "127.0.0.1")
|
|
50
50
|
return t;
|
|
51
51
|
const e = t.split(".");
|
|
@@ -537,8 +537,8 @@ export {
|
|
|
537
537
|
a as j,
|
|
538
538
|
tt as k,
|
|
539
539
|
l,
|
|
540
|
-
|
|
541
|
-
|
|
540
|
+
d as m,
|
|
541
|
+
L as n,
|
|
542
542
|
dt as o,
|
|
543
543
|
$t as p,
|
|
544
544
|
mt as q,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const p="react",h="[Builder.io]: ",l={log:(...t)=>console.log(h,...t),error:(...t)=>console.error(h,...t),warn:(...t)=>console.warn(h,...t),debug:(...t)=>console.debug(h,...t)};function a(){return typeof window!="undefined"&&typeof document!="undefined"}function rt(){return a()&&window.self!==window.top}function v(){return rt()&&window.location.search.indexOf("builder.frameEditing=")!==-1}const ot=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},st=()=>typeof navigator=="object"&&navigator.userAgent||"",U=()=>{const t=st(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||p==="reactNative"}},n=t.match(/Tablet|iPad/i),r=ot();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":e.any()?"mobile":"desktop"}},I=t=>JSON.parse(JSON.stringify(t)),
|
|
1
|
+
"use strict";const p="react",h="[Builder.io]: ",l={log:(...t)=>console.log(h,...t),error:(...t)=>console.error(h,...t),warn:(...t)=>console.warn(h,...t),debug:(...t)=>console.debug(h,...t)};function a(){return typeof window!="undefined"&&typeof document!="undefined"}function rt(){return a()&&window.self!==window.top}function v(){return rt()&&window.location.search.indexOf("builder.frameEditing=")!==-1}const ot=()=>{if(a()){const t=new URL(location.href);return t.pathname===""&&(t.pathname="/"),t}else return console.warn("Cannot get location for tracking in non-browser environment"),null},st=()=>typeof navigator=="object"&&navigator.userAgent||"",U=()=>{const t=st(),e={Android(){return t.match(/Android/i)},BlackBerry(){return t.match(/BlackBerry/i)},iOS(){return t.match(/iPhone|iPod/i)},Opera(){return t.match(/Opera Mini/i)},Windows(){return t.match(/IEMobile/i)||t.match(/WPDesktop/i)},any(){return e.Android()||e.BlackBerry()||e.iOS()||e.Opera()||e.Windows()||p==="reactNative"}},n=t.match(/Tablet|iPad/i),r=ot();return{urlPath:r==null?void 0:r.pathname,host:(r==null?void 0:r.host)||(r==null?void 0:r.hostname),device:n?"tablet":e.any()?"mobile":"desktop"}},d=t=>t!=null,I=t=>JSON.parse(JSON.stringify(t)),it=t=>{if(t==="localhost"||t==="127.0.0.1")return t;const e=t.split(".");return e.length>2?e.slice(1).join("."):t},F=({name:t,canTrack:e})=>{var n;try{return e?(n=document.cookie.split("; ").find(r=>r.startsWith(`${t}=`)))==null?void 0:n.split("=")[1]:void 0}catch(r){l.warn("[COOKIE] GET error: ",(r==null?void 0:r.message)||r);return}},M=async t=>F(t),at=t=>t.map(([e,n])=>n?`${e}=${n}`:e).filter(d).join("; "),ct=[["secure",""],["SameSite","None"]],ut=({name:t,value:e,expires:n})=>{const o=(a()?location.protocol==="https:":!0)?ct:[[]],s=n?[["expires",n.toUTCString()]]:[[]],c=[[t,e],...s,["path","/"],["domain",it(window.location.hostname)],...o];return at(c)},D=async({name:t,value:e,expires:n,canTrack:r})=>{try{if(!r)return;const o=ut({name:t,value:e,expires:n});document.cookie=o}catch(o){l.warn("[COOKIE] SET error: ",(o==null?void 0:o.message)||o)}},lt="builder.tests",C=t=>`${lt}.${t}`,dt=({contentId:t})=>M({name:C(t),canTrack:!0}),ft=({contentId:t})=>F({name:C(t),canTrack:!0}),ht=({contentId:t,value:e})=>D({name:C(t),value:e,canTrack:!0}),K=t=>d(t.id)&&d(t.variations)&&Object.keys(t.variations).length>0,gt=({id:t,variations:e})=>{var o;let n=0;const r=Math.random();for(const s in e){const c=(o=e[s])==null?void 0:o.testRatio;if(n+=c,r<n)return s}return t},_=t=>{const e=gt(t);return ht({contentId:t.id,value:e}).catch(n=>{l.error("could not store A/B test variation: ",n)}),e},G=({item:t,testGroupId:e})=>{const n=t.variations[e];return e===t.id||!n?{testVariationId:t.id,testVariationName:"Default"}:{data:n.data,testVariationId:n.id,testVariationName:n.name||(n.id===t.id?"Default":"")}},pt=({item:t,canTrack:e})=>{if(!e)return t;if(!t)return;if(!K(t))return t;const n=ft({contentId:t.id})||_({variations:t.variations,id:t.id}),r=G({item:t,testGroupId:n});return{...t,...r}},yt=async({item:t,canTrack:e})=>{if(!e||!K(t))return t;const r=await dt({contentId:t.id})||_({variations:t.variations,id:t.id}),o=G({item:t,testGroupId:r});return{...t,...o}},W=t=>d(t)?t:!0,mt=[],St=t=>({type:"builder.registerComponent",data:J(t)}),wt=t=>{const e=t.toString().trim();return`return (${!e.startsWith("function")&&!e.startsWith("(")?"function ":""}${e}).apply(this, arguments)`},bt=t=>typeof t=="function"?wt(t):I(t),J=({inputs:t,...e})=>({...I(e),inputs:t==null?void 0:t.map(n=>Object.entries(n).reduce((r,[o,s])=>({...r,[o]:bt(s)}),{}))});function vt(){return typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:globalThis}function It(){const t=vt().fetch;if(typeof t=="undefined")throw console.warn(`Builder SDK could not find a global fetch function. Make sure you have a polyfill for fetch in your project.
|
|
2
2
|
For more information, read https://github.com/BuilderIO/this-package-uses-fetch`),new Error("Builder SDK could not find a global `fetch` function");return t}const z=It();function g(t,e=null,n="."){return Object.keys(t).reduce((r,o)=>{const s=t[o],c=[e,o].filter(Boolean).join(n);return[typeof s=="object",s!==null,!(Array.isArray(s)&&s.length===0)].every(Boolean)?{...r,...g(s,c,n)}:{...r,[c]:s}},{})}const Ct="v3",L="builder.",kt="options.",Et=t=>{const e={};return t.forEach((n,r)=>{e[r]=n}),e},k=t=>{if(!t)return{};const e=X(t),n={};return Object.keys(e).forEach(r=>{if(r.startsWith(L)){const o=r.replace(L,"").replace(kt,"");n[o]=e[r]}}),n},Ot=()=>{if(!a())return{};const t=new URLSearchParams(window.location.search);return k(t)},X=t=>t instanceof URLSearchParams?Et(t):t,N=t=>typeof t=="number"&&!isNaN(t)&&t>=0,E=t=>{let{noTraverse:e=!1}=t;const{limit:n=30,userAttributes:r,query:o,model:s,apiKey:c,includeRefs:y=!0,enrich:A,locale:x,apiVersion:m=Ct,fields:T,omit:et,offset:S,cacheSeconds:w,staleCacheSeconds:b,sort:R,includeUnpublished:B}=t;if(!c)throw new Error("Missing API key");if(!["v2","v3"].includes(m))throw new Error(`Invalid apiVersion: expected 'v2' or 'v3', received '${m}'`);(t.limit===void 0||t.limit>1)&&!("noTraverse"in t)&&(e=!0);const i=new URL(`https://cdn.builder.io/api/${m}/content/${s}?apiKey=${c}&limit=${n}&noTraverse=${e}&includeRefs=${y}${x?`&locale=${x}`:""}${A?`&enrich=${A}`:""}`);if(i.searchParams.set("omit",et||"meta.componentsUsed"),T&&i.searchParams.set("fields",T),Number.isFinite(S)&&S>-1&&i.searchParams.set("offset",String(Math.floor(S))),typeof B=="boolean"&&i.searchParams.set("includeUnpublished",String(B)),w&&N(w)&&i.searchParams.set("cacheSeconds",String(w)),b&&N(b)&&i.searchParams.set("staleCacheSeconds",String(b)),R){const u=g({sort:R});for(const f in u)i.searchParams.set(f,JSON.stringify(u[f]))}const nt={...Ot(),...X(t.options||{})},V=g(nt);for(const u in V)i.searchParams.set(u,String(V[u]));if(r&&i.searchParams.set("userAttributes",JSON.stringify(r)),o){const u=g({query:o});for(const f in u)i.searchParams.set(f,JSON.stringify(u[f]))}return i},Pt=t=>"results"in t;async function O(t){const e=await P({...t,limit:1});return e&&e[0]||null}const At=O,xt=async t=>{const e=E(t);return await(await z(e.href)).json()},q=async(t,e,n=E(t))=>{const r=W(t.canTrack);if(n.search.includes("preview="),!r||!(a()||p==="reactNative"))return e.results;try{const o=[];for(const s of e.results)o.push(await yt({item:s,canTrack:r}));e.results=o}catch(o){l.error("Could not process A/B tests. ",o)}return e.results};async function P(t){try{const e=E(t),n=await xt(t);return Pt(n)?q(t,n):(l.error("Error fetching data. ",{url:e,content:n,options:t}),null)}catch(e){return l.error("Error fetching data. ",e),null}}const Tt=P;function Rt(){return!a()||v()?!1:location.search.indexOf("builder.preview=")!==-1}function Bt(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t=="x"?e:e&3|8).toString(16)})}function H(){return Bt().replace(/-/g,"")}const Y="builderSessionId",Vt=async({canTrack:t})=>{if(!t)return;const e=await M({name:Y,canTrack:t});if(d(e))return e;{const n=Lt();return Nt({id:n,canTrack:t}),n}},Lt=()=>H(),Nt=({id:t,canTrack:e})=>D({name:Y,value:t,canTrack:e}),Q=()=>a()&&typeof localStorage!="undefined"?localStorage:void 0,$t=({key:t,canTrack:e})=>{var n;try{return e?(n=Q())==null?void 0:n.getItem(t):void 0}catch(r){console.debug("[LocalStorage] GET error: ",r);return}},jt=({key:t,canTrack:e,value:n})=>{var r;try{e&&((r=Q())==null||r.setItem(t,n))}catch(o){console.debug("[LocalStorage] SET error: ",o)}},Z="builderVisitorId",Ut=({canTrack:t})=>{if(!t)return;const e=$t({key:Z,canTrack:t});if(d(e))return e;{const n=Ft();return Mt({id:n,canTrack:t}),n}},Ft=()=>H(),Mt=({id:t,canTrack:e})=>jt({key:Z,value:t,canTrack:e}),Dt=async({canTrack:t})=>{if(!t)return{visitorId:void 0,sessionId:void 0};const e=await Vt({canTrack:t}),n=Ut({canTrack:t});return{sessionId:e,visitorId:n}},Kt=async({type:t,canTrack:e,apiKey:n,metadata:r,...o})=>({type:t,data:{...o,metadata:{url:location.href,...r},...await Dt({canTrack:e}),userAttributes:U(),ownerId:n}});async function tt(t){if(!t.apiKey){l.error("Missing API key for track call. Please provide your API key.");return}if(t.canTrack&&!v()&&(a()||p==="reactNative"))return fetch("https://cdn.builder.io/api/v1/track",{method:"POST",body:JSON.stringify({events:[await Kt(t)]}),headers:{"content-type":"application/json"},mode:"cors"}).catch(e=>{console.error("Failed to track: ",e)})}const _t=t=>tt({...t,canTrack:!0}),$={};function Gt(t,e){let n=$[t];if(n||(n=$[t]=[]),n.push(e),a()){const r={type:"builder.register",data:{type:t,info:e}};try{parent.postMessage(r,"*"),parent!==window&&window.postMessage(r,"*")}catch(o){console.debug("Could not postmessage",o)}}}const j={};function Wt(t){if(a()){Object.assign(j,t);const e={type:"builder.settingsChange",data:j};parent.postMessage(e,"*")}}const Jt=async t=>{var r,o,s;const e=t.path||((r=t.url)==null?void 0:r.pathname)||((o=t.userAttributes)==null?void 0:o.urlPath),n={...t,apiKey:t.apiKey,model:t.model||"page",userAttributes:{...t.userAttributes,...e?{urlPath:e}:{}},options:k(t.searchParams||((s=t.url)==null?void 0:s.searchParams)||t.options)};return{apiKey:n.apiKey,model:n.model,content:await O(n)}};exports.TARGET=p;exports._processContentResult=q;exports._track=tt;exports.checkIsDefined=d;exports.components=mt;exports.createRegisterComponentMessage=St;exports.fastClone=I;exports.fetch=z;exports.fetchBuilderProps=Jt;exports.fetchEntries=P;exports.fetchOneEntry=O;exports.getAllContent=Tt;exports.getBuilderSearchParams=k;exports.getContent=At;exports.getDefaultCanTrack=W;exports.getUserAttributes=U;exports.handleABTestingSync=pt;exports.isBrowser=a;exports.isEditing=v;exports.isPreviewing=Rt;exports.logger=l;exports.register=Gt;exports.serializeComponentInfo=J;exports.setEditorSettings=Wt;exports.track=_t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./server-entry-fc715776.cjs");exports._processContentResult=e._processContentResult;exports.createRegisterComponentMessage=e.createRegisterComponentMessage;exports.fetchBuilderProps=e.fetchBuilderProps;exports.fetchEntries=e.fetchEntries;exports.fetchOneEntry=e.fetchOneEntry;exports.getAllContent=e.getAllContent;exports.getBuilderSearchParams=e.getBuilderSearchParams;exports.getContent=e.getContent;exports.isEditing=e.isEditing;exports.isPreviewing=e.isPreviewing;exports.register=e.register;exports.setEditorSettings=e.setEditorSettings;exports.track=e.track;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as t, c as a, h as r, f as i, b as n, g, e as o, d as c, i as d, a as f, r as h, s as l, t as p } from "./server-entry-
|
|
1
|
+
import { _ as t, c as a, h as r, f as i, b as n, g, e as o, d as c, i as d, a as f, r as h, s as l, t as p } from "./server-entry-57d4ae22.js";
|
|
2
2
|
export {
|
|
3
3
|
t as _processContentResult,
|
|
4
4
|
a as createRegisterComponentMessage,
|
package/lib/node/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsxRuntime=require("react/jsx-runtime"),react=require("react"),serverEntry=require("./server-entry-bcb725be.cjs"),node_module=require("node:module");var _documentCurrentScript=typeof document!="undefined"?document.currentScript:null;const EMPTY_HTML_ELEMENTS=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),isEmptyElement=e=>typeof e=="string"&&EMPTY_HTML_ELEMENTS.has(e.toLowerCase());function DynamicRenderer(e){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:isEmptyElement(e.TagName)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof e.TagName=="string"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})})}const getClassPropName=()=>{switch(serverEntry.TARGET){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":return"class"}};function Button(e){return jsxRuntime.jsx(DynamicRenderer,{TagName:e.link?e.builderLinkComponent||"a":"button",attributes:{...e.attributes,[getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}},actionAttributes:{},children:e.text})}const builderContext=react.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}}),ComponentsContext=react.createContext({registeredComponents:{}});function getBlockComponentOptions(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const getFunctionArguments=({builder:e,context:t,event:n,state:i})=>Object.entries({state:i,Builder:e,builder:e,context:t,event:n}),getBuilderGlobals=()=>({isEditing:serverEntry.isEditing(),isBrowser:serverEntry.isBrowser(),isServer:!serverEntry.isBrowser(),getUserAttributes:()=>serverEntry.getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,runInBrowser=({code:e,builder:t,context:n,event:i,localState:r,rootSetState:
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const jsxRuntime=require("react/jsx-runtime"),react=require("react"),serverEntry=require("./server-entry-bcb725be.cjs"),node_module=require("node:module");var _documentCurrentScript=typeof document!="undefined"?document.currentScript:null;const EMPTY_HTML_ELEMENTS=new Set(["area","base","br","col","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),isEmptyElement=e=>typeof e=="string"&&EMPTY_HTML_ELEMENTS.has(e.toLowerCase());function DynamicRenderer(e){return jsxRuntime.jsx(jsxRuntime.Fragment,{children:isEmptyElement(e.TagName)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(e.TagName,{...e.attributes,...e.actionAttributes})}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:typeof e.TagName=="string"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(e.TagName,{...e.attributes,...e.actionAttributes,children:e.children})})})})}const getClassPropName=()=>{switch(serverEntry.TARGET){case"react":case"reactNative":case"rsc":return"className";case"svelte":case"vue":case"solid":case"qwik":return"class"}};function Button(e){return jsxRuntime.jsx(DynamicRenderer,{TagName:e.link?e.builderLinkComponent||"a":"button",attributes:{...e.attributes,[getClassPropName()]:`${e.link?"":"builder-button"} ${e.attributes[getClassPropName()]||""}`,...e.link?{href:e.link,target:e.openLinkInNewTab?"_blank":void 0,role:"link"}:{role:"button"}},actionAttributes:{},children:e.text})}const builderContext=react.createContext({content:null,context:{},localState:void 0,rootSetState(){},rootState:{},apiKey:null,apiVersion:void 0,componentInfos:{},inheritedStyles:{},BlocksWrapper:"div",BlocksWrapperProps:{}}),ComponentsContext=react.createContext({registeredComponents:{}});function getBlockComponentOptions(e){var t;return{...(t=e.component)==null?void 0:t.options,...e.options,builderBlock:e}}const getFunctionArguments=({builder:e,context:t,event:n,state:i})=>Object.entries({state:i,Builder:e,builder:e,context:t,event:n}),getBuilderGlobals=()=>({isEditing:serverEntry.isEditing(),isBrowser:serverEntry.isBrowser(),isServer:!serverEntry.isBrowser(),getUserAttributes:()=>serverEntry.getUserAttributes()}),parseCode=(e,{isExpression:t=!0})=>t&&!(e.includes(";")||e.includes(" return ")||e.trim().startsWith("return "))?`return (${e});`:e,runInBrowser=({code:e,builder:t,context:n,event:i,localState:r,rootSetState:o,rootState:a})=>{const s=getFunctionArguments({builder:t,context:n,event:i,state:flattenState({rootState:a,localState:r,rootSetState:o})});return new Function(...s.map(([c])=>c),e)(...s.map(([,c])=>c))};function flattenState({rootState:e,localState:t,rootSetState:n}){return new Proxy(e,{get:(i,r)=>{if(t&&r in t)return t[r];const o=i[r];return typeof o=="object"?flattenState({rootState:o,localState:void 0,rootSetState:n?a=>{i[r]=a,n(i)}:void 0}):o},set:(i,r,o)=>{if(t&&r in t)throw new Error("Writing to local state is not allowed as it is read-only.");return i[r]=o,n==null||n(i),!0}})}const set=(e,t,n)=>{if(Object(e)!==e)return e;const i=Array.isArray(t)?t:t.toString().match(/[^.[\]]+/g);return i.slice(0,-1).reduce((r,o,a)=>Object(r[o])===r[o]?r[o]:r[o]=Math.abs(Number(i[a+1]))>>0===+i[a+1]?[]:{},e)[i[i.length-1]]=n,e},noop=()=>{};let safeDynamicRequire=noop;try{safeDynamicRequire=node_module.createRequire(typeof document=="undefined"?require("url").pathToFileURL(__filename).href:_documentCurrentScript&&_documentCurrentScript.src||new URL("index.cjs",document.baseURI).href)}catch(error){try{safeDynamicRequire=eval("require")}catch(e){}}const ivm=safeDynamicRequire("isolated-vm"),getSyncValName=e=>`bldr_${e}_sync`,BUILDER_SET_STATE_NAME="BUILDER_SET_STATE",INJECTED_IVM_GLOBAL="BUILDER_IVM",REF_TO_PROXY_FN=`
|
|
2
2
|
var refToProxy = (obj) => {
|
|
3
3
|
if (typeof obj !== 'object' || obj === null) {
|
|
4
4
|
return obj;
|
|
@@ -38,18 +38,18 @@ if (typeof output === 'object' && output !== null) {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
output;
|
|
41
|
-
`},getIsolateContext=()=>new ivm.Isolate({memoryLimit:128}).createContextSync(),runInNode=({code:e,builder:t,context:n,event:i,localState:r,rootSetState:
|
|
41
|
+
`},getIsolateContext=()=>new ivm.Isolate({memoryLimit:128}).createContextSync(),runInNode=({code:e,builder:t,context:n,event:i,localState:r,rootSetState:o,rootState:a})=>{const s=serverEntry.fastClone({...a,...r}),c=getFunctionArguments({builder:t,context:n,event:i,state:s}),l=getIsolateContext(),u=l.global;u.setSync("global",u.derefInto()),u.setSync("log",function(...f){console.log(...f)}),u.setSync(BUILDER_SET_STATE_NAME,function(f,h){set(a,f,h),o==null||o(a)}),c.forEach(([f,h])=>{const S=typeof h=="object"?new ivm.Reference(f==="builder"?{...h,getUserAttributes:()=>h.getUserAttributes()}:h):null;u.setSync(getSyncValName(f),S)}),u.setSync(INJECTED_IVM_GLOBAL,ivm);const g=processCode({code:e,args:c}),y=l.evalSync(g);try{return JSON.parse(y)}catch{return y}};function isNodeRuntime(){var e;return typeof process!="undefined"&&serverEntry.checkIsDefined((e=process==null?void 0:process.versions)==null?void 0:e.node)}const shouldForceBrowserRuntimeInNode=()=>{var i;if(!isNodeRuntime())return!1;const e=process.arch==="arm64",t=process.version.startsWith("v20"),n=(i=process.env.NODE_OPTIONS)==null?void 0:i.includes("--no-node-snapshot");return e&&t&&!n?(serverEntry.logger.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},chooseBrowserOrServerEval=e=>serverEntry.isBrowser()||shouldForceBrowserRuntimeInNode()?runInBrowser(e):runInNode(e);function evaluate({code:e,context:t,localState:n,rootState:i,rootSetState:r,event:o,isExpression:a=!0}){if(e===""){serverEntry.logger.warn("Skipping evaluation of empty code block.");return}const s={code:parseCode(e,{isExpression:a}),builder:getBuilderGlobals(),context:t,event:o,rootSetState:r,rootState:i,localState:n};try{return chooseBrowserOrServerEval(s)}catch(c){serverEntry.logger.error("Failed code evaluation: "+c.message,{code:e});return}}function transformBlock(e){return e}const evaluateBindings=({block:e,context:t,localState:n,rootState:i,rootSetState:r})=>{if(!e.bindings)return e;const o=serverEntry.fastClone(e),a={...o,properties:{...o.properties},actions:{...o.actions}};for(const s in e.bindings){const c=e.bindings[s],l=evaluate({code:c,localState:n,rootState:i,rootSetState:r,context:t});set(a,s,l)}return a};function getProcessedBlock({block:e,context:t,shouldEvaluateBindings:n,localState:i,rootState:r,rootSetState:o}){const a=e;return n?evaluateBindings({block:a,localState:i,rootState:r,rootSetState:o,context:t}):a}const getComponent=({block:e,context:t,registeredComponents:n})=>{var o;const i=(o=getProcessedBlock({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:o.name;if(!i)return null;const r=n[i];if(r)return r;console.warn(`
|
|
42
42
|
Could not find a registered component named "${i}".
|
|
43
|
-
If you registered it, is the file that registered it imported by the file that needs to render it?`)},getRepeatItemData=({block:e,context:t})=>{const{repeat:n,...i}=e;if(!(n!=null&&n.collection))return;const r=evaluate({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(r))return;const
|
|
43
|
+
If you registered it, is the file that registered it imported by the file that needs to render it?`)},getRepeatItemData=({block:e,context:t})=>{const{repeat:n,...i}=e;if(!(n!=null&&n.collection))return;const r=evaluate({code:n.collection,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context});if(!Array.isArray(r))return;const o=n.collection.split(".").pop(),a=n.itemName||(o?o+"Item":"item");return r.map((c,l)=>({context:{...t,localState:{...t.localState,$index:l,$item:c,[a]:c,[`$${a}Index`]:l}},block:i}))},SIZES={small:{min:320,default:321,max:640},medium:{min:641,default:642,max:991},large:{min:990,default:991,max:1200}},getMaxWidthQueryForSize=(e,t=SIZES)=>`@media (max-width: ${t[e].max}px)`,getSizesForBreakpoints=({small:e,medium:t})=>{const n=serverEntry.fastClone(SIZES);if(!e||!t)return n;const i=Math.floor(e/2);n.small={max:e,min:i,default:i+1};const r=n.small.max+1;n.medium={max:t,min:r,default:r+1};const o=n.medium.max+1;return n.large={max:2e3,min:o,default:o+1},n},camelToKebabCase=e=>e.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g,"$1-$2").toLowerCase(),convertStyleMapToCSSArray=e=>Object.entries(e).map(([n,i])=>{if(typeof i=="string")return`${camelToKebabCase(n)}: ${i};`}).filter(serverEntry.checkIsDefined),convertStyleMapToCSS=e=>convertStyleMapToCSSArray(e).join(`
|
|
44
44
|
`),createCssClass=({mediaQuery:e,className:t,styles:n})=>{const i=`.${t} {
|
|
45
45
|
${convertStyleMapToCSS(n)}
|
|
46
46
|
}`;return e?`${e} {
|
|
47
47
|
${i}
|
|
48
|
-
}`:i};function InlinedStyles(e){return jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function BlockStyles(e){function t(){const i=getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return serverEntry.checkIsDefined(i.hide)?!i.hide:serverEntry.checkIsDefined(i.show)?i.show:!0}function n(){var h;const i=getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),r=i.responsiveStyles,
|
|
48
|
+
}`:i};function InlinedStyles(e){return jsxRuntime.jsx("style",{dangerouslySetInnerHTML:{__html:e.styles},id:e.id})}function BlockStyles(e){function t(){const i=getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0});return serverEntry.checkIsDefined(i.hide)?!i.hide:serverEntry.checkIsDefined(i.show)?i.show:!0}function n(){var h;const i=getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0}),r=i.responsiveStyles,o=e.context.content,a=getSizesForBreakpoints(((h=o==null?void 0:o.meta)==null?void 0:h.breakpoints)||{}),s=r==null?void 0:r.large,c=r==null?void 0:r.medium,l=r==null?void 0:r.small,u=i.id;if(!u)return"";const g=s?createCssClass({className:u,styles:s}):"",y=c?createCssClass({className:u,styles:c,mediaQuery:getMaxWidthQueryForSize("medium",a)}):"",f=l?createCssClass({className:u,styles:l,mediaQuery:getMaxWidthQueryForSize("small",a)}):"";return[g,y,f].join(" ")}return jsxRuntime.jsx(jsxRuntime.Fragment,{children:n()&&t()?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(InlinedStyles,{styles:n()})}):null})}function capitalizeFirstLetter(e){return e.charAt(0).toUpperCase()+e.slice(1)}const getEventHandlerName=e=>`on${capitalizeFirstLetter(e)}`,createEventHandler=(e,t)=>n=>evaluate({code:e,context:t.context,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,event:n,isExpression:!1});function getBlockActions(e){var i;const t={},n=(i=e.block.actions)!=null?i:{};for(const r in n){if(!n.hasOwnProperty(r))continue;const o=n[r];let a=getEventHandlerName(r);if(e.stripPrefix)switch(serverEntry.TARGET){case"vue":a=a.replace("v-on:","");break;case"svelte":a=a.replace("on:","");break}t[a]=createEventHandler(o,e)}return t}function transformStyleProperty({style:e}){return e}const getStyle=({block:e,context:t})=>mapStyleObjToStrIfNeeded(transformStyleProperty({style:e.style||{},context:t,block:e}));function mapStyleObjToStrIfNeeded(e){switch(serverEntry.TARGET){case"svelte":case"vue":case"solid":return convertStyleMapToCSSArray(e).join(" ");case"qwik":case"reactNative":case"react":case"rsc":return e}}function transformBlockProperties({properties:e}){return e}const extractRelevantRootBlockProperties=e=>({href:e.href});function getBlockProperties({block:e,context:t}){var i;const n={...extractRelevantRootBlockProperties(e),...e.properties,"builder-id":e.id,style:getStyle({block:e,context:t}),[getClassPropName()]:[e.id,"builder-block",e.class,(i=e.properties)==null?void 0:i.class].filter(Boolean).join(" ")};return transformBlockProperties({properties:n,context:t,block:e})}function BlockWrapper(e){return jsxRuntime.jsx(DynamicRenderer,{TagName:e.Wrapper,attributes:getBlockProperties({block:e.block,context:e.context}),actionAttributes: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 InteractiveElement(e){return jsxRuntime.jsx(e.Wrapper,{...e.wrapperProps,attributes:e.includeBlockProps?{...getBlockProperties({block:e.block,context:e.context}),...getBlockActions({block:e.block,rootState:e.context.rootState,rootSetState:e.context.rootSetState,localState:e.context.localState,context:e.context.context})}:{},children:e.children})}const getWrapperProps=({componentOptions:e,builderBlock:t,context:n,componentRef:i,includeBlockProps:r,isInteractive:o,contextValue:a})=>{const s={...e,...r?{attributes:getBlockProperties({block:t,context:a})}:{}};return o?{Wrapper:i,block:t,context:n,wrapperProps:e,includeBlockProps:r}:s};function ComponentRef(e){var i;const[t,n]=react.useState(()=>e.isInteractive?InteractiveElement:e.componentRef);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.componentRef?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(t,{...getWrapperProps({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:(i=e.blockChildren)==null?void 0:i.map(r=>jsxRuntime.jsx(Block,{block:r,context:e.context,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},r.id))})}):null})}function RepeatedBlock(e){const[t,n]=react.useState(()=>e.repeatContext);return jsxRuntime.jsx(builderContext.Provider,{value:t,children:jsxRuntime.jsx(Block,{block:e.block,context:t,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent})})}function Block(e){var u,g,y;function t(){return getComponent({block:e.block,context:e.context,registeredComponents:e.registeredComponents})}function n(){return getRepeatItemData({block:e.block,context:e.context})}function i(){var f;return(f=e.block.repeat)!=null&&f.collection?e.block:getProcessedBlock({block:e.block,localState:e.context.localState,rootState:e.context.rootState,rootSetState:e.context.rootSetState,context:e.context.context,shouldEvaluateBindings:!0})}function r(){var h;return e.block.tagName==="a"||((h=i().properties)==null?void 0:h.href)||i().href?e.linkComponent||"a":e.block.tagName||"div"}function o(){var S,R;if((S=e.block.repeat)!=null&&S.collection)return!!((R=n==null?void 0:n())!=null&&R.length);const f="hide"in i()?i().hide:!1;return("show"in i()?i().show:!0)&&!f}function a(){var h,S;return!((h=t==null?void 0:t())!=null&&h.component)&&!n()?(S=i().children)!=null?S:[]:[]}function s(){var f,h,S,R,j,v,C,E,I;return{blockChildren:(f=i().children)!=null?f:[],componentRef:(h=t==null?void 0:t())==null?void 0:h.component,componentOptions:{...getBlockComponentOptions(i()),builderContext:e.context,...((S=t==null?void 0:t())==null?void 0:S.name)==="Core:Button"||((R=t==null?void 0:t())==null?void 0:R.name)==="Symbol"||((j=t==null?void 0:t())==null?void 0:j.name)==="Columns"?{builderLinkComponent:e.linkComponent}:{},...((v=t==null?void 0:t())==null?void 0:v.name)==="Symbol"||((C=t==null?void 0:t())==null?void 0:C.name)==="Columns"?{builderComponents:e.registeredComponents}:{}},context:c,linkComponent:e.linkComponent,registeredComponents:e.registeredComponents,builderBlock:i(),includeBlockProps:((E=t==null?void 0:t())==null?void 0:E.noWrap)===!0,isInteractive:!((I=t==null?void 0:t())!=null&&I.isRSC)}}const[c,l]=react.useState(()=>e.context);return jsxRuntime.jsx(jsxRuntime.Fragment,{children:o()?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(BlockStyles,{block:e.block,context:e.context}),(u=t==null?void 0:t())!=null&&u.noWrap?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(ComponentRef,{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})}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:n()?jsxRuntime.jsx(jsxRuntime.Fragment,{children:(y=n())==null?void 0:y.map((f,h)=>jsxRuntime.jsx(RepeatedBlock,{repeatContext:f.context,block:f.block,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},h))}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsxs(BlockWrapper,{Wrapper:r(),block:i(),context:e.context,linkComponent:e.linkComponent,children:[jsxRuntime.jsx(ComponentRef,{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}),(g=a())==null?void 0:g.map(f=>jsxRuntime.jsx(Block,{block:f,context:c,registeredComponents:e.registeredComponents,linkComponent:e.linkComponent},f.id))]})})})]}):null})}function BlocksWrapper(e){function t(){var r;return"builder-blocks"+((r=e.blocks)!=null&&r.length?"":" no-blocks")}function n(){var r,o;serverEntry.isEditing()&&!((r=e.blocks)!=null&&r.length)&&((o=window.parent)==null||o.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function i(){var r,o;serverEntry.isEditing()&&!((r=e.blocks)!=null&&r.length)&&((o=window.parent)==null||o.postMessage({type:"builder.hoverEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(e.BlocksWrapper,{className:t()+" props-blocks-wrapper-4f2c12d8","builder-path":e.path,"builder-parent-id":e.parent,style:e.styleProp,onClick:r=>n(),onMouseEnter:r=>i(),onKeyPress:r=>n(),...e.BlocksWrapperProps,children:e.children}),jsxRuntime.jsx("style",{children:`.props-blocks-wrapper-4f2c12d8 {
|
|
49
49
|
display: flex;
|
|
50
50
|
flex-direction: column;
|
|
51
51
|
align-items: stretch;
|
|
52
|
-
}`})]})}function Blocks(e){var i,r,
|
|
52
|
+
}`})]})}function Blocks(e){var i,r,o;const t=react.useContext(builderContext),n=react.useContext(ComponentsContext);return jsxRuntime.jsx(BlocksWrapper,{blocks:e.blocks,parent:e.parent,path:e.path,styleProp:e.styleProp,BlocksWrapper:(i=e.context)==null?void 0:i.BlocksWrapper,BlocksWrapperProps:(r=e.context)==null?void 0:r.BlocksWrapperProps,children:e.blocks?jsxRuntime.jsx(jsxRuntime.Fragment,{children:(o=e.blocks)==null?void 0:o.map(a=>jsxRuntime.jsx(Block,{block:a,linkComponent:e.linkComponent,context:e.context||t,registeredComponents:e.registeredComponents||n.registeredComponents},a.id))}):null})}function Columns(e){var j;const[t,n]=react.useState(()=>typeof e.space=="number"?e.space||0:20),[i,r]=react.useState(()=>e.columns||[]),[o,a]=react.useState(()=>e.stackColumnsAt||"tablet");function s(v){var C;return((C=i[v])==null?void 0:C.width)||100/i.length}function c(v){const C=t*(i.length-1)/i.length;return`calc(${s(v)}% - ${C}px)`}function l({stackedStyle:v,desktopStyle:C}){return o==="tablet"?v:C}function u({stackedStyle:v,desktopStyle:C}){return o==="never"?C:v}const[g,y]=react.useState(()=>e.stackColumnsAt==="never"?"row":e.reverseColumnsWhenStacked?"column-reverse":"column");function f(){return{"--flex-dir":g,"--flex-dir-tablet":l({stackedStyle:g,desktopStyle:"row"})}}function h(v){const C=v===0?0:t,E=c(v),I=`${C}px`,T="100%",w=0;return{...{display:"flex",flexDirection:"column",alignItems:"stretch"},width:E,["marginLeft"]:I,"--column-width-mobile":u({stackedStyle:T,desktopStyle:E}),"--column-margin-left-mobile":u({stackedStyle:w,desktopStyle:I}),"--column-width-tablet":l({stackedStyle:T,desktopStyle:E}),"--column-margin-left-tablet":l({stackedStyle:w,desktopStyle:I})}}function S(v){var E,I;return getSizesForBreakpoints(((I=(E=e.builderContext.content)==null?void 0:E.meta)==null?void 0:I.breakpoints)||{})[v].max}function R(){return`
|
|
53
53
|
@media (max-width: ${S("medium")}px) {
|
|
54
54
|
.${e.builderBlock.id}-breakpoints {
|
|
55
55
|
flex-direction: var(--flex-dir-tablet);
|
|
@@ -73,10 +73,10 @@ output;
|
|
|
73
73
|
margin-left: var(--column-margin-left-mobile) !important;
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
|
-
`}return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-6f826264`,style:f(),children:[jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(InlinedStyles,{styles:R()})}),(
|
|
76
|
+
`}return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("div",{className:`builder-columns ${e.builderBlock.id}-breakpoints div-6f826264`,style:f(),children:[jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(InlinedStyles,{styles:R()})}),(j=e.columns)==null?void 0:j.map((v,C)=>jsxRuntime.jsx(DynamicRenderer,{TagName:v.link?e.builderLinkComponent||"a":"div",actionAttributes:{},attributes:{...v.link?{href:v.link}:{},[getClassPropName()]:"builder-column",style:mapStyleObjToStrIfNeeded(h(C))},children:jsxRuntime.jsx(Blocks,{path:`component.options.columns.${C}.blocks`,parent:e.builderBlock.id,styleProp:{flexGrow:"1"},context:e.builderContext,registeredComponents:e.builderComponents,linkComponent:e.builderLinkComponent,blocks:v.blocks})},C))]}),jsxRuntime.jsx("style",{children:`.div-6f826264 {
|
|
77
77
|
display: flex;
|
|
78
78
|
line-height: normal;
|
|
79
|
-
}`})]})}function FragmentComponent(e){return jsxRuntime.jsx("span",{children:e.children})}function removeProtocol(e){return e.replace(/http(s)?:/,"")}function updateQueryParam(e="",t,n){const i=new RegExp("([?&])"+t+"=.*?(&|$)","i"),r=e.indexOf("?")!==-1?"&":"?";return e.match(i)?e.replace(i,"$1"+t+"="+encodeURIComponent(n)+"$2"):e+r+t+"="+encodeURIComponent(n)}function getShopifyImageUrl(e,t){if(!e||!(e!=null&&e.match(/cdn\.shopify\.com/))||!t)return e;if(t==="master")return removeProtocol(e);const n=e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);if(n){const i=e.split(n[0]),r=n[3],
|
|
79
|
+
}`})]})}function FragmentComponent(e){return jsxRuntime.jsx("span",{children:e.children})}function removeProtocol(e){return e.replace(/http(s)?:/,"")}function updateQueryParam(e="",t,n){const i=new RegExp("([?&])"+t+"=.*?(&|$)","i"),r=e.indexOf("?")!==-1?"&":"?";return e.match(i)?e.replace(i,"$1"+t+"="+encodeURIComponent(n)+"$2"):e+r+t+"="+encodeURIComponent(n)}function getShopifyImageUrl(e,t){if(!e||!(e!=null&&e.match(/cdn\.shopify\.com/))||!t)return e;if(t==="master")return removeProtocol(e);const n=e.match(/(_\d+x(\d+)?)?(\.(jpg|jpeg|gif|png|bmp|bitmap|tiff|tif)(\?v=\d+)?)/i);if(n){const i=e.split(n[0]),r=n[3],o=t.match("x")?t:`${t}x`;return removeProtocol(`${i[0]}_${o}${r}`)}return null}function getSrcSet(e){if(!e)return e;const t=[100,200,400,800,1200,1600,2e3];if(e.match(/builder\.io/)){let n=e;const i=Number(e.split("?width=")[1]);return isNaN(i)||(n=`${n} ${i}w`),t.filter(r=>r!==i).map(r=>`${updateQueryParam(e,"width",r)} ${r}w`).concat([n]).join(", ")}return e.match(/cdn\.shopify\.com/)?t.map(n=>[getShopifyImageUrl(e,`${n}x${n}`),n]).filter(([n])=>!!n).map(([n,i])=>`${n} ${i}w`).concat([e]).join(", "):e}function Image(e){var r,o,a,s;function t(){var u;const l=e.image||e.src;if(!l||!(l.match(/builder\.io/)||l.match(/cdn\.shopify\.com/)))return e.srcset;if(e.srcset&&((u=e.image)!=null&&u.includes("builder.io/api/v1/image"))){if(!e.srcset.includes(e.image.split("?")[0]))return console.debug("Removed given srcset"),getSrcSet(l)}else if(e.image&&!e.srcset)return getSrcSet(l);return getSrcSet(l)}function n(){var c;return(c=t==null?void 0:t())!=null&&c.match(/builder\.io/)&&!e.noWebp?t().replace(/\?/g,"?format=webp&"):""}function i(){const c={position:"absolute",height:"100%",width:"100%",left:"0px",top:"0px"};return e.aspectRatio?c:void 0}return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsxs("picture",{children:[n()?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("source",{type:"image/webp",srcSet:n()})}):null,jsxRuntime.jsx("img",{loading:"lazy",alt:e.altText,role:e.altText?"presentation":void 0,style:{objectPosition:e.backgroundPosition||"center",objectFit:e.backgroundSize||"cover",...i()},className:"builder-image"+(e.className?" "+e.className:"")+" img-40c70c9b",src:e.image,srcSet:t(),sizes:e.sizes})]}),e.aspectRatio&&!((o=(r=e.builderBlock)==null?void 0:r.children)!=null&&o.length&&e.fitContent)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"builder-image-sizer div-40c70c9b",style:{paddingTop:e.aspectRatio*100+"%"}})}):null,(s=(a=e.builderBlock)==null?void 0:a.children)!=null&&s.length&&e.fitContent?jsxRuntime.jsx(jsxRuntime.Fragment,{children:e.children}):null,!e.fitContent&&e.children?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"div-40c70c9b-2",children:e.children})}):null]}),jsxRuntime.jsx("style",{children:`.img-40c70c9b {
|
|
80
80
|
opacity: 1;
|
|
81
81
|
transition: opacity 0.2s ease-in-out;
|
|
82
82
|
}.div-40c70c9b {
|
|
@@ -92,7 +92,7 @@ output;
|
|
|
92
92
|
left: 0;
|
|
93
93
|
width: 100%;
|
|
94
94
|
height: 100%;
|
|
95
|
-
}`})]})}function SectionComponent(e){return jsxRuntime.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 componentInfo$b={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},componentInfo$a={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(r=>r.get("width"))&&(n.find(a=>!a.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}]},componentInfo$9={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 CustomCode(e){const t=react.useRef(null),[n,i]=react.useState(()=>[]),[r,a]=react.useState(()=>[]);return react.useEffect(()=>{var s;if(!((s=t.current)!=null&&s.getElementsByTagName)||typeof window=="undefined")return;const o=t.current.getElementsByTagName("script");for(let c=0;c<o.length;c++){const l=o[c];if(l.src){if(n.includes(l.src))continue;n.push(l.src);const u=document.createElement("script");u.async=!0,u.src=l.src,document.head.appendChild(u)}else if(!l.type||["text/javascript","application/javascript","application/ecmascript"].includes(l.type)){if(r.includes(l.innerText))continue;try{r.push(l.innerText),new Function(l.innerText)()}catch(u){console.warn("`CustomCode`: Error running script:",u)}}}},[]),jsxRuntime.jsx("div",{ref:t,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const componentInfo$8={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}]},SCRIPT_MIME_TYPES=["text/javascript","application/javascript","application/ecmascript"],isJsScript=e=>SCRIPT_MIME_TYPES.includes(e.type);function Embed(e){const t=react.useRef(null),[n,i]=react.useState(()=>[]),[r,a]=react.useState(()=>[]),[o,s]=react.useState(()=>!1);function c(){if(!t.current||!t.current.getElementsByTagName)return;const l=t.current.getElementsByTagName("script");for(let u=0;u<l.length;u++){const g=l[u];if(g.src&&!n.includes(g.src)){n.push(g.src);const y=document.createElement("script");y.async=!0,y.src=g.src,document.head.appendChild(y)}else if(isJsScript(g)&&!r.includes(g.innerText))try{r.push(g.innerText),new Function(g.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return react.useEffect(()=>{t.current&&!o&&(s(!0),c())},[t.current,o]),jsxRuntime.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:e.content}})}const componentInfo$7={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},componentInfo$6={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(o,s=6e4){return new Promise((c,l)=>{const u=document.createElement("img");let g=!1;u.onload=()=>{g=!0,c(u)},u.addEventListener("error",y=>{console.warn("Image load failed",y.error),l(y.error)}),u.src=o,setTimeout(()=>{g||l(new Error("Image load timed out"))},s)})}function i(o){return Math.round(o*1e3)/1e3}const r=e.get("image"),a=e.get("aspectRatio");if(fetch(r).then(o=>o.blob()).then(o=>{o.type.includes("svg")&&e.set("noWebp",!0)}),r&&(!a||a===.7041))return n(r).then(o=>{const s=e.get("aspectRatio");e.get("image")===r&&(!s||s===.7041)&&o.width&&o.height&&(e.set("aspectRatio",i(o.height/o.width)),e.set("height",o.height),e.set("width",o.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}]},componentInfo$5={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 ImgComponent(e){return jsxRuntime.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},serverEntry.isEditing()&&e.imgSrc||"default-key")}const componentInfo$4={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>"}}}]},componentInfo$3={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 Slot(e){var t,n,i;return jsxRuntime.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:jsxRuntime.jsx(Blocks,{parent:(n=e.builderContext.context)==null?void 0:n.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,blocks:(i=e.builderContext.rootState)==null?void 0:i[e.name]})})}const componentInfo$2={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"}]},componentInfo$1={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 Text(e){var t;return jsxRuntime.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const componentInfo={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 Video(e){var i,r,a,o,s,c,l;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 jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.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:jsxRuntime.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((a=(r=e.builderBlock)==null?void 0:r.children)!=null&&a.length))?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(s=(o=e.builderBlock)==null?void 0:o.children)!=null&&s.length&&e.fitContent?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(l=(c=e.builderBlock)==null?void 0:c.children)!=null&&l.length&&!e.fitContent?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.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 getDefaultRegisteredComponents=()=>[{component:Button,...componentInfo$b},{component:Columns,...componentInfo$a},{component:CustomCode,...componentInfo$9},{component:Embed,...componentInfo$8},{component:FragmentComponent,...componentInfo$7},{component:Image,...componentInfo$6},{component:ImgComponent,...componentInfo$5},{component:SectionComponent,...componentInfo$4},{component:Symbol$1,...componentInfo$2},{component:Text,...componentInfo$1},{component:Video,...componentInfo},{component:Slot,...componentInfo$3}],UPDATE_COOKIES_AND_STYLES_SCRIPT=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
95
|
+
}`})]})}function SectionComponent(e){return jsxRuntime.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 componentInfo$b={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},componentInfo$a={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(r=>r.get("width"))&&(n.find(o=>!o.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}]},componentInfo$9={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 CustomCode(e){const t=react.useRef(null),[n,i]=react.useState(()=>[]),[r,o]=react.useState(()=>[]);return react.useEffect(()=>{var s;if(!((s=t.current)!=null&&s.getElementsByTagName)||typeof window=="undefined")return;const a=t.current.getElementsByTagName("script");for(let c=0;c<a.length;c++){const l=a[c];if(l.src){if(n.includes(l.src))continue;n.push(l.src);const u=document.createElement("script");u.async=!0,u.src=l.src,document.head.appendChild(u)}else if(!l.type||["text/javascript","application/javascript","application/ecmascript"].includes(l.type)){if(r.includes(l.innerText))continue;try{r.push(l.innerText),new Function(l.innerText)()}catch(u){console.warn("`CustomCode`: Error running script:",u)}}}},[]),jsxRuntime.jsx("div",{ref:t,className:"builder-custom-code"+(e.replaceNodes?" replace-nodes":""),dangerouslySetInnerHTML:{__html:e.code}})}const componentInfo$8={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}]},SCRIPT_MIME_TYPES=["text/javascript","application/javascript","application/ecmascript"],isJsScript=e=>SCRIPT_MIME_TYPES.includes(e.type);function Embed(e){const t=react.useRef(null),[n,i]=react.useState(()=>[]),[r,o]=react.useState(()=>[]),[a,s]=react.useState(()=>!1);function c(){if(!t.current||!t.current.getElementsByTagName)return;const l=t.current.getElementsByTagName("script");for(let u=0;u<l.length;u++){const g=l[u];if(g.src&&!n.includes(g.src)){n.push(g.src);const y=document.createElement("script");y.async=!0,y.src=g.src,document.head.appendChild(y)}else if(isJsScript(g)&&!r.includes(g.innerText))try{r.push(g.innerText),new Function(g.innerText)()}catch(y){console.warn("`Embed`: Error running script:",y)}}}return react.useEffect(()=>{t.current&&!a&&(s(!0),c())},[t.current,a]),jsxRuntime.jsx("div",{className:"builder-embed",ref:t,dangerouslySetInnerHTML:{__html:e.content}})}const componentInfo$7={name:"Fragment",static:!0,hidden:!0,canHaveChildren:!0,noWrap:!0},componentInfo$6={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((c,l)=>{const u=document.createElement("img");let g=!1;u.onload=()=>{g=!0,c(u)},u.addEventListener("error",y=>{console.warn("Image load failed",y.error),l(y.error)}),u.src=a,setTimeout(()=>{g||l(new Error("Image load timed out"))},s)})}function i(a){return Math.round(a*1e3)/1e3}const r=e.get("image"),o=e.get("aspectRatio");if(fetch(r).then(a=>a.blob()).then(a=>{a.type.includes("svg")&&e.set("noWebp",!0)}),r&&(!o||o===.7041))return n(r).then(a=>{const s=e.get("aspectRatio");e.get("image")===r&&(!s||s===.7041)&&a.width&&a.height&&(e.set("aspectRatio",i(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:"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}]},componentInfo$5={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 ImgComponent(e){return jsxRuntime.jsx("img",{style:{objectFit:e.backgroundSize||"cover",objectPosition:e.backgroundPosition||"center"},alt:e.altText,src:e.imgSrc||e.image,...e.attributes},serverEntry.isEditing()&&e.imgSrc||"default-key")}const componentInfo$4={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>"}}}]},componentInfo$3={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 Slot(e){var t,n,i;return jsxRuntime.jsx("div",{style:{pointerEvents:"auto"},...!((t=e.builderContext.context)!=null&&t.symbolId)&&{"builder-slot":e.name},children:jsxRuntime.jsx(Blocks,{parent:(n=e.builderContext.context)==null?void 0:n.symbolId,path:`symbol.data.${e.name}`,context:e.builderContext,blocks:(i=e.builderContext.rootState)==null?void 0:i[e.name]})})}const componentInfo$2={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"}]},componentInfo$1={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 Text(e){var t;return jsxRuntime.jsx("div",{className:"builder-text",dangerouslySetInnerHTML:{__html:((t=e.text)==null?void 0:t.toString())||""},style:{outline:"none"}})}const componentInfo={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 Video(e){var i,r,o,a,s,c,l;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 jsxRuntime.jsxs("div",{style:{position:"relative"},children:[jsxRuntime.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:jsxRuntime.jsx("source",{type:"video/mp4",src:e.video})}),e.aspectRatio&&!(e.fitContent&&((o=(r=e.builderBlock)==null?void 0:r.children)!=null&&o.length))?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{style:{width:"100%",paddingTop:e.aspectRatio*100+"%",pointerEvents:"none",fontSize:"0px"}})}):null,(s=(a=e.builderBlock)==null?void 0:a.children)!=null&&s.length&&e.fitContent?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"stretch"},children:e.children})}):null,(l=(c=e.builderBlock)==null?void 0:c.children)!=null&&l.length&&!e.fitContent?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.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 getDefaultRegisteredComponents=()=>[{component:Button,...componentInfo$b},{component:Columns,...componentInfo$a},{component:CustomCode,...componentInfo$9},{component:Embed,...componentInfo$8},{component:FragmentComponent,...componentInfo$7},{component:Image,...componentInfo$6},{component:ImgComponent,...componentInfo$5},{component:SectionComponent,...componentInfo$4},{component:Symbol$1,...componentInfo$2},{component:Text,...componentInfo$1},{component:Video,...componentInfo},{component:Slot,...componentInfo$3}],UPDATE_COOKIES_AND_STYLES_SCRIPT=`function updateCookiesAndStyles(contentId, variants, isHydrationTarget) {
|
|
96
96
|
function getAndSetVariantId() {
|
|
97
97
|
function setCookie(name, value, days) {
|
|
98
98
|
let expires = '';
|
|
@@ -190,7 +190,7 @@ output;
|
|
|
190
190
|
"${t}",${JSON.stringify(e)}, ${isHydrationTarget}
|
|
191
191
|
)`,getUpdateVariantVisibilityScript=({contentId:e,variationId:t})=>`window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
192
192
|
"${t}", "${e}", ${isHydrationTarget}
|
|
193
|
-
)`;function InlinedScript(e){return jsxRuntime.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}const DEFAULT_TRUSTED_HOSTS=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function isFromTrustedHost(e,t){const n=new URL(t.origin),i=n.hostname;return(e||DEFAULT_TRUSTED_HOSTS).findIndex(r=>r.startsWith("*.")?i.endsWith(r.slice(1)):r===i)>-1}function round(e){return Math.round(e*1e3)/1e3}const findParentElement=(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},findBuilderParent=e=>findParentElement(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),computeOffset=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,r=e.clientY-n.top,
|
|
193
|
+
)`;function InlinedScript(e){return jsxRuntime.jsx("script",{dangerouslySetInnerHTML:{__html:e.scriptStr},id:e.id||""})}const DEFAULT_TRUSTED_HOSTS=["*.beta.builder.io","beta.builder.io","builder.io","localhost","qa.builder.io"];function isFromTrustedHost(e,t){const n=new URL(t.origin),i=n.hostname;return(e||DEFAULT_TRUSTED_HOSTS).findIndex(r=>r.startsWith("*.")?i.endsWith(r.slice(1)):r===i)>-1}function round(e){return Math.round(e*1e3)/1e3}const findParentElement=(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},findBuilderParent=e=>findParentElement(e,t=>{const n=t.getAttribute("builder-id")||t.id;return(n==null?void 0:n.indexOf("builder-"))===0}),computeOffset=({event:e,target:t})=>{const n=t.getBoundingClientRect(),i=e.clientX-n.left,r=e.clientY-n.top,o=round(i/n.width),a=round(r/n.height);return{x:o,y:a}},getInteractionPropertiesForEvent=e=>{const t=e.target,n=t&&findBuilderParent(t),i=(n==null?void 0:n.getAttribute("builder-id"))||(n==null?void 0:n.id);return{targetBuilderElement:i||void 0,metadata:{targetOffset:t?computeOffset({event:e,target:t}):void 0,builderTargetOffset:n?computeOffset({event:e,target:n}):void 0,builderElementIndex:n&&i?[].slice.call(document.getElementsByClassName(i)).indexOf(n):void 0}}},SDK_VERSION="0.12.6",registerInsertMenu=()=>{serverEntry.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 isSetupForEditing=!1;const setupBrowserForEditing=(e={})=>{var t,n;isSetupForEditing||(isSetupForEditing=!0,serverEntry.isBrowser()&&((t=window.parent)==null||t.postMessage({type:"builder.sdkInfo",data:{target:serverEntry.TARGET,version:SDK_VERSION,supportsPatchUpdates:!1,supportsAddBlockScoping:!0,supportsCustomBreakpoints:!0}},"*"),(n=window.parent)==null||n.postMessage({type:"builder.updateContent",data:{options:e}},"*"),window.addEventListener("message",i=>{var o,a;if(!isFromTrustedHost(e.trustedHosts,i))return;const{data:r}=i;if(r!=null&&r.type)switch(r.type){case"builder.evaluate":{const s=r.data.text,c=r.data.arguments||[],l=r.data.id,u=new Function(s);let g,y=null;try{g=u.apply(null,c)}catch(f){y=f}y?(o=window.parent)==null||o.postMessage({type:"builder.evaluateError",data:{id:l,error:y.message}},"*"):g&&typeof g.then=="function"?g.then(f=>{var h;(h=window.parent)==null||h.postMessage({type:"builder.evaluateResult",data:{id:l,result:f}},"*")}).catch(console.error):(a=window.parent)==null||a.postMessage({type:"builder.evaluateResult",data:{result:g,id:l}},"*");break}}})))};function EnableEditor(e){var w,P,A,F,N,_,V;const t=react.useRef(null),[n,i]=react.useState(()=>0);react.useState(()=>!0);function r(d){var x,b;const m={...e.builderContextSignal.rootState,...d};e.builderContextSignal.rootSetState?(b=(x=e.builderContextSignal).rootSetState)==null||b.call(x,m):e.setBuilderContextSignal(p=>({...p,rootState:m}))}function o(d){var x,b,p,k,B;const m={...e.builderContextSignal.content,...d,data:{...(x=e.builderContextSignal.content)==null?void 0:x.data,...d==null?void 0:d.data},meta:{...(b=e.builderContextSignal.content)==null?void 0:b.meta,...d==null?void 0:d.meta,breakpoints:((p=d==null?void 0:d.meta)==null?void 0:p.breakpoints)||((B=(k=e.builderContextSignal.content)==null?void 0:k.meta)==null?void 0:B.breakpoints)}};e.setBuilderContextSignal($=>({...$,content:m}))}react.useState(()=>0);const[a,s]=react.useState(()=>!1),[c,l]=react.useState(()=>e.contentWrapper||"div");function u(d){var x;if(!isFromTrustedHost(e.trustedHosts,d))return;const{data:m}=d;if(m)switch(m.type){case"builder.configureSdk":{const b=m.data,{breakpoints:p,contentId:k}=b;if(!k||k!==((x=e.builderContextSignal.content)==null?void 0:x.id))return;p&&o({meta:{breakpoints:p}}),i(n+1);break}case"builder.contentUpdate":{const b=m.data,p=b.key||b.alias||b.entry||b.modelName,k=b.data;p===e.model&&(o(k),i(n+1));break}}}function g(){var m,x;const d=(x=(m=e.builderContextSignal.content)==null?void 0:m.data)==null?void 0:x.jsCode;d&&evaluate({code:d,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState})}const[y,f]=react.useState(()=>({})),[h,S]=react.useState(()=>!1);function R(d){var m,x;if(e.builderContextSignal.content){const b=(m=e.builderContextSignal.content)==null?void 0:m.testVariationId,p=(x=e.builderContextSignal.content)==null?void 0:x.id;serverEntry._track({type:"click",canTrack:serverEntry.getDefaultCanTrack(e.canTrack),contentId:p,apiKey:e.apiKey,variationId:b!==p?b:void 0,...getInteractionPropertiesForEvent(d),unique:!h})}h||S(!0)}function j(d){return d.replace(/{{([^}]+)}}/g,(m,x)=>evaluate({code:x,context:e.context||{},localState:void 0,rootState:e.builderContextSignal.rootState,rootSetState:e.builderContextSignal.rootSetState}))}function v({url:d,key:m}){serverEntry.fetch(d).then(x=>x.json()).then(x=>{var p,k;const b={...e.builderContextSignal.rootState,[m]:x};(k=(p=e.builderContextSignal).rootSetState)==null||k.call(p,b),y[m]=!0}).catch(x=>{console.error("error fetching dynamic data",d,x)})}function C(){var m,x,b;const d=(b=(x=(m=e.builderContextSignal.content)==null?void 0:m.data)==null?void 0:x.httpRequests)!=null?b:{};Object.entries(d).forEach(([p,k])=>{if(k&&(!y[p]||serverEntry.isEditing())){const B=j(k);v({url:B,key:p})}})}function E(){serverEntry.isEditing()&&window.dispatchEvent(new CustomEvent("builder:component:stateChange",{detail:{state:serverEntry.fastClone(e.builderContextSignal.rootState),ref:{name:e.model}}}))}function I(d){i(n+1),window.addEventListener("message",u),registerInsertMenu(),setupBrowserForEditing({...e.locale?{locale:e.locale}:{},...e.includeRefs?{includeRefs:e.includeRefs}:{},...e.enrich?{enrich:e.enrich}:{},...e.trustedHosts?{trustedHosts:e.trustedHosts}:{}}),Object.values(e.builderContextSignal.componentInfos).forEach(m=>{var b;const x=serverEntry.createRegisterComponentMessage(m);(b=window.parent)==null||b.postMessage(x,"*")}),window.addEventListener("builder:component:stateChangeListenerActivated",E)}function T(d){const m=new URL(location.href).searchParams,x=m.get("builder.preview"),b=m.get(`builder.preview.${x}`),p=m.get("apiKey")||m.get("builder.space");x===e.model&&p===e.apiKey&&(!e.content||b===e.content.id)&&serverEntry.fetchOneEntry({model:e.model,apiKey:e.apiKey,apiVersion:e.builderContextSignal.apiVersion}).then(k=>{k&&o(k)})}return react.useEffect(()=>{var d;return(d=t.current)==null||d.addEventListener("initeditingbldr",I),()=>{var m;return(m=t.current)==null?void 0:m.removeEventListener("initeditingbldr",I)}},[]),react.useEffect(()=>{var d;return(d=t.current)==null||d.addEventListener("initpreviewingbldr",T),()=>{var m;return(m=t.current)==null?void 0:m.removeEventListener("initpreviewingbldr",T)}},[]),react.useEffect(()=>{var d,m;if(serverEntry.isBrowser()){if(serverEntry.isEditing()&&t.current&&t.current.dispatchEvent(new CustomEvent("initeditingbldr")),e.builderContextSignal.content&&serverEntry.getDefaultCanTrack(e.canTrack)){const b=(d=e.builderContextSignal.content)==null?void 0:d.testVariationId,p=(m=e.builderContextSignal.content)==null?void 0:m.id,k=e.apiKey;serverEntry._track({type:"impression",canTrack:!0,contentId:p,apiKey:k,variationId:b!==p?b:void 0})}serverEntry.isPreviewing()&&t.current&&t.current.dispatchEvent(new CustomEvent("initpreviewingbldr"))}},[]),react.useEffect(()=>{e.apiKey||serverEntry.logger.error("No API key provided to `RenderContent` component. This can cause issues. Please provide an API key using the `apiKey` prop."),g(),C(),E()},[]),react.useEffect(()=>{e.content&&o(e.content)},[e.content]),react.useEffect(()=>{},[a]),react.useEffect(()=>{g()},[(P=(w=e.builderContextSignal.content)==null?void 0:w.data)==null?void 0:P.jsCode]),react.useEffect(()=>{C()},[(F=(A=e.builderContextSignal.content)==null?void 0:A.data)==null?void 0:F.httpRequests]),react.useEffect(()=>{E()},[e.builderContextSignal.rootState]),react.useEffect(()=>{e.data&&r(e.data)},[e.data]),react.useEffect(()=>{e.locale&&r({locale:e.locale})},[e.locale]),react.useEffect(()=>()=>{serverEntry.isBrowser()&&(window.removeEventListener("message",u),window.removeEventListener("builder:component:stateChangeListenerActivated",E))},[]),jsxRuntime.jsx(builderContext.Provider,{value:e.builderContextSignal,children:e.builderContextSignal.content?jsxRuntime.jsx(jsxRuntime.Fragment,{children:react.createElement(c,{key:n,ref:t,onClick:d=>R(d),"builder-content-id":(N=e.builderContextSignal.content)==null?void 0:N.id,"builder-model":e.model,...e.showContent?{}:{hidden:!0,"aria-hidden":!0},...e.contentWrapperProps,className:`variant-${((_=e.content)==null?void 0:_.testVariationId)||((V=e.content)==null?void 0:V.id)}`},e.children)}):null})}const getCssFromFont=e=>{var o,a;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],i=(a=e.fileUrl)!=null?a:(o=e==null?void 0:e.files)==null?void 0:o.regular;let r="";if(i&&t&&n&&(r+=`
|
|
194
194
|
@font-face {
|
|
195
195
|
font-family: "${t}";
|
|
196
196
|
src: local("${n}"), url('${i}') format('woff2');
|
|
@@ -224,4 +224,4 @@ ${getFontCss({customFonts:e.customFonts})}
|
|
|
224
224
|
text-align: inherit;
|
|
225
225
|
font-family: inherit;
|
|
226
226
|
}
|
|
227
|
-
`.trim());return jsxRuntime.jsx(InlinedStyles,{styles:t})}const getRootStateInitialValue=({content:e,data:t,locale:n})=>{var a,
|
|
227
|
+
`.trim());return jsxRuntime.jsx(InlinedStyles,{styles:t})}const getRootStateInitialValue=({content:e,data:t,locale:n})=>{var o,a,s;const i={},r=((o=e==null?void 0:e.data)==null?void 0:o.state)||{};return(s=(a=e==null?void 0:e.data)==null?void 0:a.inputs)==null||s.forEach(c=>{c.name&&c.defaultValue!==void 0&&(i[c.name]=c.defaultValue)}),{...i,...r,...t,...n?{locale:n}:{}}},getContentInitialValue=({content:e,data:t})=>e?{...e,data:{...e==null?void 0:e.data,...t},meta:e==null?void 0:e.meta}:void 0;function ContentComponent(e){var c,l,u,g,y,f,h;const[t,n]=react.useState(()=>{var S,R;return getUpdateVariantVisibilityScript({variationId:(S=e.content)==null?void 0:S.testVariationId,contentId:(R=e.content)==null?void 0:R.id})});function i(S){s(R=>({...R,rootState:S}))}const[r,o]=react.useState(()=>[...getDefaultRegisteredComponents(),...serverEntry.components,...e.customComponents||[]].reduce((S,{component:R,...j})=>({...S,[j.name]:{component:R,...serverEntry.serializeComponentInfo(j)}}),{})),[a,s]=react.useState(()=>({content:getContentInitialValue({content:e.content,data:e.data}),localState:void 0,rootState:getRootStateInitialValue({content:e.content,data:e.data,locale:e.locale}),rootSetState:i,context:e.context||{},apiKey:e.apiKey,apiVersion:e.apiVersion,componentInfos:[...getDefaultRegisteredComponents(),...serverEntry.components,...e.customComponents||[]].reduce((S,{component:R,...j})=>({...S,[j.name]:serverEntry.serializeComponentInfo(j)}),{}),inheritedStyles:{},BlocksWrapper:e.blocksWrapper||"div",BlocksWrapperProps:e.blocksWrapperProps||{}}));return jsxRuntime.jsx(ComponentsContext.Provider,{value:{registeredComponents:r},children:jsxRuntime.jsxs(EnableEditor,{content:e.content,data:e.data,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:a,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,linkComponent:e.linkComponent,trustedHosts:e.trustedHosts,setBuilderContextSignal:s,children:[e.isSsrAbTest?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(InlinedScript,{scriptStr:t})}):null,jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(ContentStyles,{contentId:(c=a.content)==null?void 0:c.id,cssCode:(u=(l=a.content)==null?void 0:l.data)==null?void 0:u.cssCode,customFonts:(y=(g=a.content)==null?void 0:g.data)==null?void 0:y.customFonts})}),jsxRuntime.jsx(Blocks,{blocks:(h=(f=a.content)==null?void 0:f.data)==null?void 0:h.blocks,context:a,registeredComponents:r,linkComponent:e.linkComponent})]})})}function ContentVariants(e){var a,s;const[t,n]=react.useState(()=>checkShouldRenderVariants({canTrack:serverEntry.getDefaultCanTrack(e.canTrack),content:e.content}));function i(){var c;return getUpdateCookieAndStylesScript(getVariants(e.content).map(l=>({id:l.testVariationId,testRatio:l.testRatio})),((c=e.content)==null?void 0:c.id)||"")}function r(){return getVariants(e.content).map(c=>`.variant-${c.testVariationId} { display: none; } `).join("")}function o(){var c;return t?{...e.content,testVariationId:(c=e.content)==null?void 0:c.id}:serverEntry.handleABTestingSync({item:e.content,canTrack:serverEntry.getDefaultCanTrack(e.canTrack)})}return react.useEffect(()=>{},[]),jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!e.__isNestedRender&&serverEntry.TARGET!=="reactNative"?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx(InlinedScript,{scriptStr:getScriptString()})}):null,t?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(InlinedStyles,{id:`variants-styles-${(a=e.content)==null?void 0:a.id}`,styles:r()}),jsxRuntime.jsx(InlinedScript,{scriptStr:i()}),(s=getVariants(e.content))==null?void 0:s.map(c=>jsxRuntime.jsx(ContentComponent,{content:c,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,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts},c.testVariationId))]}):null,jsxRuntime.jsx(ContentComponent,{content:o(),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,includeRefs:e.includeRefs,enrich:e.enrich,isSsrAbTest:t,blocksWrapper:e.blocksWrapper,blocksWrapperProps:e.blocksWrapperProps,contentWrapper:e.contentWrapper,contentWrapperProps:e.contentWrapperProps,trustedHosts:e.trustedHosts})]})}const fetchSymbolContent=async({builderContextValue:e,symbol:t})=>{if(t!=null&&t.model&&(e!=null&&e.apiKey))return serverEntry.fetchOneEntry({model:t.model,apiKey:e.apiKey,apiVersion:e.apiVersion,...(t==null?void 0:t.entry)&&{query:{id:t.entry}}}).catch(n=>{serverEntry.logger.error("Could not fetch symbol content: ",n)})};function Symbol$1(e){var o,a,s,c;function t(){var l,u;return[e.attributes[getClassPropName()],"builder-symbol",(l=e.symbol)!=null&&l.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]=react.useState(()=>{var l;return(l=e.symbol)==null?void 0:l.content});function r(){n||fetchSymbolContent({symbol:e.symbol,builderContextValue:e.builderContext}).then(l=>{l&&i(l)})}return react.useEffect(()=>{},[]),react.useEffect(()=>{r()},[e.symbol]),jsxRuntime.jsx("div",{...e.attributes,className:t(),children:jsxRuntime.jsx(ContentVariants,{__isNestedRender:!0,apiVersion:e.builderContext.apiVersion,apiKey:e.builderContext.apiKey,context:{...e.builderContext.context,symbolId:(o=e.builderBlock)==null?void 0:o.id},customComponents:Object.values(e.builderComponents),data:{...(a=e.symbol)==null?void 0:a.data,...e.builderContext.localState,...(s=n==null?void 0:n.data)==null?void 0:s.state},model:(c=e.symbol)==null?void 0:c.model,content:n,linkComponent:e.builderLinkComponent})})}const RenderBlocks=Blocks,RenderContent=ContentVariants;exports._processContentResult=serverEntry._processContentResult;exports.createRegisterComponentMessage=serverEntry.createRegisterComponentMessage;exports.fetchBuilderProps=serverEntry.fetchBuilderProps;exports.fetchEntries=serverEntry.fetchEntries;exports.fetchOneEntry=serverEntry.fetchOneEntry;exports.getAllContent=serverEntry.getAllContent;exports.getBuilderSearchParams=serverEntry.getBuilderSearchParams;exports.getContent=serverEntry.getContent;exports.isEditing=serverEntry.isEditing;exports.isPreviewing=serverEntry.isPreviewing;exports.register=serverEntry.register;exports.setEditorSettings=serverEntry.setEditorSettings;exports.track=serverEntry.track;exports.Blocks=Blocks;exports.Button=Button;exports.Columns=Columns;exports.Content=ContentVariants;exports.Fragment=FragmentComponent;exports.Image=Image;exports.RenderBlocks=RenderBlocks;exports.RenderContent=RenderContent;exports.Section=SectionComponent;exports.Symbol=Symbol$1;exports.Text=Text;exports.Video=Video;
|