@builder.io/sdk-react 0.12.3 → 0.12.5
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 +25 -29
- package/lib/browser/index.mjs +736 -669
- package/lib/{edge/server-entry-f978b3a5.js → browser/server-entry-b9bdd327.js} +5 -6
- package/lib/browser/{server-entry-df9eba5d.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 +38 -42
- package/lib/edge/index.mjs +1280 -1212
- package/lib/{browser/server-entry-f978b3a5.js → edge/server-entry-57d4ae22.js} +4 -5
- package/lib/{node/server-entry-df9eba5d.cjs → edge/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 +7 -11
- package/lib/node/index.mjs +321 -253
- package/lib/node/{server-entry-46908b1b.js → server-entry-0457c4c8.js} +3 -4
- package/lib/{edge/server-entry-df9eba5d.cjs → node/server-entry-bcb725be.cjs} +1 -1
- package/lib/node/server-entry.cjs +1 -1
- package/lib/node/server-entry.mjs +1 -1
- package/package.json +1 -1
- package/types/blocks/button/button.types.d.ts +2 -1
- package/types/blocks/columns/columns.types.d.ts +3 -3
- package/types/blocks/symbol/symbol.types.d.ts +2 -2
- package/types/components/block/block.d.ts +1 -0
- package/types/components/block/components/block-wrapper.d.ts +1 -0
- package/types/components/block/components/component-ref/component-ref.helpers.d.ts +4 -1
- package/types/components/block/components/repeated-block.d.ts +3 -5
- package/types/components/blocks/blocks.types.d.ts +1 -0
- package/types/components/content-variants/content-variants.types.d.ts +6 -2
- package/types/constants/sdk-version.d.ts +1 -1
- package/types/functions/evaluate/should-force-browser-runtime-in-node.d.ts +1 -0
- package/types/functions/get-block-properties.d.ts +5 -1
- package/types/functions/get-class-prop-name.d.ts +1 -0
- package/types/functions/get-style.d.ts +12 -0
- package/types/functions/transform-block-properties.d.ts +7 -5
- package/types/functions/transform-style-property.d.ts +7 -0
- package/types/helpers/omit.d.ts +1 -0
- package/types/types/builder-block.d.ts +1 -0
- package/types/types/builder-props.d.ts +3 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const h = "[Builder.io]: ", l = {
|
|
1
|
+
const b = "react", h = "[Builder.io]: ", l = {
|
|
2
2
|
log: (...t) => console.log(h, ...t),
|
|
3
3
|
error: (...t) => console.error(h, ...t),
|
|
4
4
|
warn: (...t) => console.warn(h, ...t),
|
|
@@ -7,7 +7,6 @@ const h = "[Builder.io]: ", l = {
|
|
|
7
7
|
function a() {
|
|
8
8
|
return typeof window != "undefined" && typeof document != "undefined";
|
|
9
9
|
}
|
|
10
|
-
const b = "react";
|
|
11
10
|
function Y() {
|
|
12
11
|
return a() && window.self !== window.top;
|
|
13
12
|
}
|
|
@@ -46,7 +45,7 @@ const Q = () => {
|
|
|
46
45
|
host: (r == null ? void 0 : r.host) || (r == null ? void 0 : r.hostname),
|
|
47
46
|
device: n ? "tablet" : e.any() ? "mobile" : "desktop"
|
|
48
47
|
};
|
|
49
|
-
},
|
|
48
|
+
}, d = (t) => t != null, L = (t) => JSON.parse(JSON.stringify(t)), et = (t) => {
|
|
50
49
|
if (t === "localhost" || t === "127.0.0.1")
|
|
51
50
|
return t;
|
|
52
51
|
const e = t.split(".");
|
|
@@ -538,8 +537,8 @@ export {
|
|
|
538
537
|
a as j,
|
|
539
538
|
tt as k,
|
|
540
539
|
l,
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
d as m,
|
|
541
|
+
L as n,
|
|
543
542
|
dt as o,
|
|
544
543
|
$t as p,
|
|
545
544
|
mt as q,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const 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"}
|
|
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-
|
|
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:a,rootState:o})=>{const s=getFunctionArguments({builder:t,context:n,event:i,state:flattenState(o,r,a)});return new Function(...s.map(([c])=>c),e)(...s.map(([,c])=>c))};function flattenState(e,t,n){if(e===t)throw new Error("rootState === localState");return new Proxy(e,{get:(i,r)=>t&&r in t?t[r]:e[r],set:(i,r,a)=>{if(t&&r in t)throw new Error("Writing to local state is not allowed as it is read-only.");return e[r]=a,n==null||n(e),!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,a,o)=>Object(r[a])===r[a]?r[a]:r[a]=Math.abs(Number(i[o+1]))>>0===+i[o+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:a,rootState:o})=>{const s=serverEntry.fastClone({...o,...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(o,f,h),a==null||a(o)}),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}},chooseBrowserOrServerEval=e=>serverEntry.isBrowser()?runInBrowser(e):runInNode(e);function evaluate({code:e,context:t,localState:n,rootState:i,rootSetState:r,event:a,isExpression:o=!0}){if(e===""){serverEntry.logger.warn("Skipping evaluation of empty code block.");return}const s={code:parseCode(e,{isExpression:o}),builder:getBuilderGlobals(),context:t,event:a,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 a=serverEntry.fastClone(e),o={...a,properties:{...a.properties},actions:{...a.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(o,s,l)}return o};function getProcessedBlock({block:e,context:t,shouldEvaluateBindings:n,localState:i,rootState:r,rootSetState:a}){const o=e;return n?evaluateBindings({block:o,localState:i,rootState:r,rootSetState:a,context:t}):o}const getComponent=({block:e,context:t,registeredComponents:n})=>{var a;const i=(a=getProcessedBlock({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:a.name;if(!i)return null;const r=n[i];if(r)return r;console.warn(`
|
|
41
|
+
`},getIsolateContext=()=>new ivm.Isolate({memoryLimit:128}).createContextSync(),runInNode=({code:e,builder:t,context:n,event:i,localState:r,rootSetState:a,rootState:o})=>{const s=serverEntry.fastClone({...o,...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(o,f,h),a==null||a(o)}),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:a,isExpression:o=!0}){if(e===""){serverEntry.logger.warn("Skipping evaluation of empty code block.");return}const s={code:parseCode(e,{isExpression:o}),builder:getBuilderGlobals(),context:t,event:a,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 a=serverEntry.fastClone(e),o={...a,properties:{...a.properties},actions:{...a.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(o,s,l)}return o};function getProcessedBlock({block:e,context:t,shouldEvaluateBindings:n,localState:i,rootState:r,rootSetState:a}){const o=e;return n?evaluateBindings({block:o,localState:i,rootState:r,rootSetState:a,context:t}):o}const getComponent=({block:e,context:t,registeredComponents:n})=>{var a;const i=(a=getProcessedBlock({block:e,localState:t.localState,rootState:t.rootState,rootSetState:t.rootSetState,context:t.context,shouldEvaluateBindings:!1}).component)==null?void 0:a.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
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 a=n.collection.split(".").pop(),o=n.itemName||(a?a+"Item":"item");return r.map((c,l)=>({context:{...t,localState:{...t.localState,$index:l,$item:c,[o]:c,[`$${o}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 a=n.medium.max+1;return n.large={max:2e3,min:a,default:a+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,a=e.context.content,o=getSizesForBreakpoints(((h=a==null?void 0:a.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",o)}):"",f=l?createCssClass({className:u,styles:l,mediaQuery:getMaxWidthQueryForSize("small",o)}):"";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 a=n[r];let o=getEventHandlerName(r);if(e.stripPrefix)switch(serverEntry.TARGET){case"vue":o=o.replace("v-on:","");break;case"svelte":o=o.replace("on:","");break}t[o]=createEventHandler(a,e)}return t}function
|
|
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,a=e.context.content,o=getSizesForBreakpoints(((h=a==null?void 0:a.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",o)}):"",f=l?createCssClass({className:u,styles:l,mediaQuery:getMaxWidthQueryForSize("small",o)}):"";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 a=n[r];let o=getEventHandlerName(r);if(e.stripPrefix)switch(serverEntry.TARGET){case"vue":o=o.replace("v-on:","");break;case"svelte":o=o.replace("on:","");break}t[o]=createEventHandler(a,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:a,contextValue:o})=>{const s={...e,...r?{attributes:getBlockProperties({block:t,context:o})}:{}};return a?{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 a(){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 o(){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:a()?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=o())==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,a;serverEntry.isEditing()&&!((r=e.blocks)!=null&&r.length)&&((a=window.parent)==null||a.postMessage({type:"builder.clickEmptyBlocks",data:{parentElementId:e.parent,dataPath:e.path}},"*"))}function i(){var r,a;serverEntry.isEditing()&&!((r=e.blocks)!=null&&r.length)&&((a=window.parent)==null||a.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,a;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:(a=e.blocks)==null?void 0:a.map(o=>jsxRuntime.jsx(Block,{block:o,context:e.context||t,registeredComponents:e.registeredComponents||n.registeredComponents},o.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||[]),[a,o]=react.useState(()=>e.stackColumnsAt||"tablet");function s(
|
|
52
|
+
}`})]})}function Blocks(e){var i,r,a;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:(a=e.blocks)==null?void 0:a.map(o=>jsxRuntime.jsx(Block,{block:o,linkComponent:e.linkComponent,context:e.context||t,registeredComponents:e.registeredComponents||n.registeredComponents},o.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||[]),[a,o]=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 a==="tablet"?v:C}function u({stackedStyle:v,desktopStyle:C}){return a==="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,13 +73,9 @@ 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-
|
|
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
|
-
}.div-3c01d6ec-2 {
|
|
80
|
-
display: flex;
|
|
81
|
-
flex-direction: column;
|
|
82
|
-
align-items: stretch;
|
|
83
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],a=t.match("x")?t:`${t}x`;return removeProtocol(`${i[0]}_${a}${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,a,o,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&&!((a=(r=e.builderBlock)==null?void 0:r.children)!=null&&a.length&&e.fitContent)?jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{className:"builder-image-sizer div-40c70c9b",style:{paddingTop:e.aspectRatio*100+"%"}})}):null,(s=(o=e.builderBlock)==null?void 0:o.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 {
|
|
84
80
|
opacity: 1;
|
|
85
81
|
transition: opacity 0.2s ease-in-out;
|
|
@@ -194,7 +190,7 @@ output;
|
|
|
194
190
|
"${t}",${JSON.stringify(e)}, ${isHydrationTarget}
|
|
195
191
|
)`,getUpdateVariantVisibilityScript=({contentId:e,variationId:t})=>`window.${UPDATE_VARIANT_VISIBILITY_SCRIPT_FN_NAME}(
|
|
196
192
|
"${t}", "${e}", ${isHydrationTarget}
|
|
197
|
-
)`;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,a=round(i/n.width),o=round(r/n.height);return{x:a,y:o}},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.
|
|
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,a=round(i/n.width),o=round(r/n.height);return{x:a,y:o}},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.5",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 a,o;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?(a=window.parent)==null||a.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):(o=window.parent)==null||o.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 a(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[o,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&&a({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&&(a(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&&a(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&&a(e.content)},[e.content]),react.useEffect(()=>{},[o]),react.useEffect(()=>{g()},[(P=(w=e.builderContextSignal.content)==null?void 0:w.data)==null?void 0:P.jsCode,e.builderContextSignal.rootState]),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 a,o;const t=e.family+(e.kind&&!e.kind.includes("#")?", "+e.kind:""),n=t.split(",")[0],i=(o=e.fileUrl)!=null?o:(a=e==null?void 0:e.files)==null?void 0:a.regular;let r="";if(i&&t&&n&&(r+=`
|
|
198
194
|
@font-face {
|
|
199
195
|
font-family: "${t}";
|
|
200
196
|
src: local("${n}"), url('${i}') format('woff2');
|
|
@@ -228,4 +224,4 @@ ${getFontCss({customFonts:e.customFonts})}
|
|
|
228
224
|
text-align: inherit;
|
|
229
225
|
font-family: inherit;
|
|
230
226
|
}
|
|
231
|
-
`.trim());return jsxRuntime.jsx(InlinedStyles,{styles:t})}const getRootStateInitialValue=({content:e,data:t,locale:n})=>{var a,o,s;const i={},r=((a=e==null?void 0:e.data)==null?void 0:a.state)||{};return(s=(o=e==null?void 0:e.data)==null?void 0:o.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,
|
|
227
|
+
`.trim());return jsxRuntime.jsx(InlinedStyles,{styles:t})}const getRootStateInitialValue=({content:e,data:t,locale:n})=>{var a,o,s;const i={},r=((a=e==null?void 0:e.data)==null?void 0:a.state)||{};return(s=(o=e==null?void 0:e.data)==null?void 0:o.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,a]=react.useState(()=>[...getDefaultRegisteredComponents(),...serverEntry.components,...e.customComponents||[]].reduce((S,{component:R,...j})=>({...S,[j.name]:{component:R,...serverEntry.serializeComponentInfo(j)}}),{})),[o,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:o,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=o.content)==null?void 0:c.id,cssCode:(u=(l=o.content)==null?void 0:l.data)==null?void 0:u.cssCode,customFonts:(y=(g=o.content)==null?void 0:g.data)==null?void 0:y.customFonts})}),jsxRuntime.jsx(Blocks,{blocks:(h=(f=o.content)==null?void 0:f.data)==null?void 0:h.blocks,context:o,registeredComponents:r,linkComponent:e.linkComponent})]})})}function ContentVariants(e){var o,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 a(){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-${(o=e.content)==null?void 0:o.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:a(),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 a,o,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:(a=e.builderBlock)==null?void 0:a.id},customComponents:Object.values(e.builderComponents),data:{...(o=e.symbol)==null?void 0:o.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;
|