@rulecms/widget-svelte 0.8.2 → 0.8.3

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/README.md CHANGED
@@ -10,7 +10,7 @@ Fetches a widget by **token + key** and renders the `itemList` layout tree throu
10
10
  npm install @rulecms/widget-svelte @rulecms/source-components-svelte
11
11
  ```
12
12
 
13
- Peer dependency: `svelte` >= 5.0.
13
+ Peer dependency: `svelte` >= 5.41.1. The package ships compiled components, and earlier Svelte runtimes switch their `{#if}` blocks wrongly.
14
14
 
15
15
  ## Usage
16
16
 
@@ -39,6 +39,8 @@ Same routing rules as `@rulecms/widget-react`.
39
39
 
40
40
  ## Server-side rendering
41
41
 
42
+ > **Not working yet.** The package ships components compiled for the browser, so `render` from `svelte/server`, which SvelteKit uses to render a page on the server, throws `effect_orphan` on them. Render the widget in the browser until a server build ships.
43
+
42
44
  Fetch widget data on the server (or at build time), then render with pre-fetched data so images and content appear in the initial HTML.
43
45
 
44
46
  ```ts
package/dist/index.cjs CHANGED
@@ -1,65 +1,65 @@
1
- "use strict";var Dr=Object.defineProperty;var xr=(e,t,r)=>t in e?Dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var at=(e,t,r)=>xr(e,typeof t!="symbol"?t+"":t,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("svelte/internal/disclose-version");const Lr=require("svelte/internal/client"),We=require("svelte");function kr(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const n=kr(Lr),ee="default";function He(e,t){return!(e!=null&&e.length)||e===ee?t:`${e}/${t}`}const Rr=`RuleCMS widget: this widget config uses components from the default component library, but no "default" library is registered. The default library is registered by the consumer app: add the RuleCMS default source components package as a direct dependency and register it, e.g. libraries: { default: sourceComponentsModule } (statically imported for SSR) or libraries: { default: () => import('<default source components package>') }. See the @rulecms/widget-svelte README.`;function ct(e){if(!e||typeof e!="object")return!1;const t=e;return!!t.manifest&&typeof t.manifest=="object"&&!!t.components&&typeof t.components=="object"&&!Array.isArray(t.components)}function Or(e){if(ct(e))return e;const t=e;return ct(t==null?void 0:t.default)?t.default:null}function Re(e){return e.usesDefaultLibrary?[ee,...e.libraryIds]:[...e.libraryIds]}function dt({registrations:e,referenced:t}){if(t.usesDefaultLibrary&&!(e!=null&&e[ee]))throw new Error(Rr)}function Wr(e){const t=[],r=new Set;for(const o of e.values()){if(typeof o.stylesheet!="string")continue;const s=o.stylesheet.trim();!s||r.has(s)||(r.add(s),t.push(s))}return t.length>0?t:void 0}function _t(e){const t={};for(const[o,s]of e){const i=o===ee;for(const[l,a]of Object.entries(s.components))t[i?l:`${o}/${l}`]=a}const r=Wr(e);return r?{components:t,stylesheets:r}:{components:t}}function se(){const e=new Map,t=new Map,r=new Map,o=new Map;let s=0;function i(d,c){var f;e.get(d)!==c&&((f=c.manifest)!=null&&f.id&&c.manifest.id!==d&&console.warn(`RuleCMS widget: component library registered as "${d}" declares manifest id "${c.manifest.id}". The registered id wins for resolution.`),e.set(d,c),s+=1)}function l(d){const c=Re(d),f=[...c].sort().join("|"),p=o.get(f);if(p&&p.loadedVersion===s)return p.plugin;const g=new Map;for(const A of c){const b=e.get(A);b&&g.set(A,b)}const E=_t(g);return o.set(f,{loadedVersion:s,plugin:E}),E}function a(d){dt(d);const{registrations:c,referenced:f}=d;for(const p of Re(f)){if(e.has(p)||r.has(p))continue;const g=c==null?void 0:c[p];if(!g){console.error(`RuleCMS widget: no component library registered for libraryId "${p}"; its components will not render.`),r.set(p,new Error(`No registration for libraryId "${p}"`));continue}if(typeof g=="function")return null;i(p,g)}return l(f)}async function u(d){dt(d);const{registrations:c,referenced:f}=d,p=Re(f);return await Promise.all(p.map(async g=>{if(e.has(g)||r.has(g))return;const E=c==null?void 0:c[g];if(!E){console.error(`RuleCMS widget: no component library registered for libraryId "${g}"; its components will not render.`),r.set(g,new Error(`No registration for libraryId "${g}"`));return}if(typeof E!="function"){i(g,E);return}let A=t.get(g);A||(A=E().then(b=>{const _=Or(b);if(!_)throw new Error(`Registration for libraryId "${g}" did not resolve to a ComponentLibraryModule (expected { manifest, components }).`);i(g,_)}).catch(b=>{r.set(g,b),console.error(`RuleCMS widget: failed to load component library "${g}":`,b)}).finally(()=>{t.delete(g)}),t.set(g,A)),await A})),l(f)}return{resolveSync:a,resolve:u}}const Ne={Preview:"Preview",Compose:"Compose",RenderedPage:"RenderedPage"},_e={DroppableBox:"droppable-box"},Me={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly"},Nr={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly",Stretch:"stretch"},pe="cssAttrArray",Mr={Phone:"phone",Tablet:"tablet",Desktop:"desktop"},ze={ComposerComponent:"ComposerWidget",Collection:"Collection",MoveComponentHandle:"MoveWidgetHandle"},Ge=`${ze.Collection}_`,Ct="dev.",vt="https://rulecms.com",At="https://widget-cache.rulecms.com",Et="/api/v1/c/widget/get",wt="/api/v1/c/dev/widget/get",St="/api/v1/c/widget/resolve",Tt="/api/v1/c/dev/widget/resolve";function z(e){return typeof e=="string"&&e.startsWith(Ct)}function Ye(e,t){return t?t.replace(/\/$/,""):z(e)?vt:At}function Xe({publishedKey:e,token:t,endpoint:r}){const o=z(t),s=o?wt:Et,i=o?new URLSearchParams({widgetKey:e,token:t}):new URLSearchParams({publishedKey:e,token:t});return`${Ye(t,r)}${s}?${i.toString()}`}function Je({token:e,endpoint:t}){const r=z(e)?Tt:St;return`${Ye(e,t)}${r}`}const jr=({id:e,prefix:t})=>`${t}_${e}`,It=e=>{if(!(e!=null&&e.length)||!e.includes("_")){console.error(`Invalid drag item id: ${e}. Type does not exist.`);return}return Pt(e)},qe=e=>e.includes("_"),Pt=e=>{const t=e.indexOf("_"),r=e.substring(0,t),o=e.substring(t+1);return{prefix:r,id:o}},Ze=e=>{if(!qe(e))return;const r=It(e);return(r==null?void 0:r.prefix)===ze.Collection||console.error("getCollectionIdForCollectionType - Invalid component type: ${componentType}. Invalid prefix type."),r==null?void 0:r.id},Vr=e=>{if(!(e!=null&&e.length)){console.error("getNameAndInstanceIdFromWidgetKey: Missing widget key");return}const t=e.split("$");if(t.length<2){console.error("getNameAndInstanceIdFromWidgetKey: Invalid widget key format");return}const r=t[0];if(!t[1].includes("@"))return{name:r,instanceId:t[1]};const s=t[1].split("@");return{name:r,instanceId:s[0],parentId:s[1]}},Fr=e=>{if(!(e!=null&&e.length))return{errorMessage:"getNameFromWidgetKey: Missing widget key"};const t=e.split("$");return t.length<2?{errorMessage:"getNameFromWidgetKey: Invalid widget key format"}:{name:t[0]}},Dt=e=>{var s,i,l,a;if(!e)return{error:"getWidgetKeyForCollection: Missing collection"};if(!((s=e.name)!=null&&s.length))return{error:"getWidgetKeyForCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((l=e.id)!=null&&l.length))return{error:"getWidgetKeyForCollection: Missing collection id"};const o=((a=e.parentId)==null?void 0:a.length)?`${e.id}@${e.parentId}`:`${e.id}`;return{data:`${t}$${o}`}},xt=e=>{var s,i,l,a;if(!e)return{error:"getWidgetKeyForPublishedCollection: Missing collection"};if(!((s=e.name)!=null&&s.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((l=e.publishedKey)!=null&&l.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection publishedKey"};const o=((a=e.parentId)==null?void 0:a.length)?`${e.publishedKey}@${e.parentId}`:`${e.publishedKey}`;return{data:`${t}$${o}`}},Kr=e=>{const t=Dt(e);return`${Ge}${t.data}`},Br=e=>{const t=xt(e);return`${Ge}${t.data}`},me="---",Lt="___";function kt(e,t){return`${e}${me}${t}`}function Ur(e,t,r){return`${kt(e,t)}${Lt}${r}`}function Hr(e){const t=e.split(".");if(t.length!==3)throw new Error(`Invalid version format: ${e}. Expected format: x.y.z`);const r=t[0],o=t[1],s=parseInt(t[2],10);if(isNaN(s))throw new Error(`Invalid patch version: ${t[2]}. Expected a number.`);return`${r}.${o}.${s+1}`}function Ce({displayItemList:e,widgetCollections:t}){const r=new Set;let o=!1;const s=i=>{var l,a,u;if((l=i==null?void 0:i.rows)!=null&&l.length){for(const d of i.rows)if((a=d==null?void 0:d.columns)!=null&&a.length)for(const c of d.columns)c.collection&&s(c.collection.collectionRows),!(!c.type||c.type===_e.DroppableBox)&&(qe(c.type)||(!((u=c.libraryId)!=null&&u.length)||c.libraryId===ee?o=!0:r.add(c.libraryId)))}};s(e);for(const i of Object.values(t??{}))s(i==null?void 0:i.collectionRows);return{libraryIds:Array.from(r),usesDefaultLibrary:o}}const Qe=Symbol("rulecms-widget-context");function zr(){return{token:"",endpoint:void 0,libraries:void 0,libraryRegistry:se()}}function Gr(e,t){n.push(t,!0);const r=n.proxy(zr());function o(){r.token=t.token,r.endpoint=t.endpoint,r.libraries=t.libraries}o(),n.user_effect(o),We.setContext(Qe,r);var s=n.comment(),i=n.first_child(s);n.snippet(i,()=>t.children),n.append(e,s),n.pop()}const Rt="1200px",$e="500px",et="820px",Yr=Rt,Ot="rulecms",Xr=1920,Jr={f:"auto",q:"auto",c:"limit"},qr=/^[A-Za-z0-9][A-Za-z0-9._\-/]*$/,Zr=300,Qr=/^[A-Za-z0-9][A-Za-z0-9_-]*$/,$r=100,eo=/^https:\/\/[^\s"'()\\<>]+$/,to=2e3,no=/^[A-Za-z0-9_,.:\-/]*$/,ro=300,Wt=e=>typeof e=="string"&&e.length<=Zr&&qr.test(e),Nt=e=>typeof e=="string"&&e.length<=$r&&Qr.test(e),Mt=e=>typeof e=="string"&&e.length<=to&&eo.test(e),jt=e=>typeof e=="string"&&e.length<=ro&&no.test(e),oo=e=>Object.entries(e).map(([t,r])=>`${t}_${r}`).join(","),so=e=>{const t={};for(const r of e.split(",")){const o=r.trim(),s=o.indexOf("_");s<=0||(t[o.slice(0,s)]=o.slice(s+1))}return t},Vt=({publicId:e,cloudName:t=Ot,transformations:r,width:o=Xr})=>{const s=typeof r=="string"?so(r):r,i={...Jr,...s,w:o};return encodeURI(`https://res.cloudinary.com/${t}/image/upload/${oo(i)}/${e}`)},Ft=/^--[A-Za-z0-9_-]+$/,Kt=200,Z=e=>{if(typeof e!="string")return!1;const t=e.trim();return t.length<=Kt&&Ft.test(t)},K=e=>`var(${e.trim()})`,L=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e.cssVariable;if(t!=null)return Z(t)?t.trim():void 0},U=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e.cssVariable;return t==null?!1:!Z(t)},io=(e,t)=>{const r=L(e);return r?{[t]:K(r)}:void 0},Bt=e=>{if(typeof e!="object"||e===null||Array.isArray(e)||U(e))return!1;if(L(e))return!0;const t=e;return t.source==="none"?!0:t.source==="url"?Mt(t.url):t.source==="cloudinary"?!Wt(t.publicId)||t.cloudName!==void 0&&t.cloudName!==null&&!Nt(t.cloudName)?!1:t.transformations===void 0||t.transformations===null||jt(t.transformations):!1},Ut=["px","%","em","rem","vh","vw"],ve=["inherit","unset"],Ht=["allSides","top","right","bottom","left"],J=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const r=e;return U(e)?!1:L(e)?!0:r.unit==="auto"?t.allowAuto!==!1:r.unit==="keyword"?t.allowKeywords!==!1&&ve.includes(r.keyword):Ut.includes(r.unit)?typeof r.value!="number"||!Number.isFinite(r.value)?!1:t.allowNegative!==!1||r.value>=0:!1},zt=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const r=e;for(const o of Ht){const s=r[o];if(s!=null&&!J(s,t))return!1}return!0},lo=[...ve,"transparent","currentColor"],ao=/^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/,Ae=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:t.unit==="keyword"?lo.includes(t.keyword):t.unit==="color"?typeof t.value=="string"&&ao.test(t.value.trim()):!1},Ee=e=>{const t=L(e);return t?K(t):"unit"in e?e.unit==="keyword"?e.keyword:e.value.trim():""},Gt=(e,t)=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):typeof e!="string"||!e.length?!1:t.includes(e)?!0:ve.includes(e),Yt=['system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif','Georgia, "Times New Roman", Times, serif',"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace","Arial, Helvetica, sans-serif",'"Helvetica Neue", Helvetica, Arial, sans-serif',"Verdana, Geneva, sans-serif"],Xt=["normal","bold","100","200","300","400","500","600","700","800","900"],Jt=["normal","italic","oblique"],qt=["left","center","right","justify","start","end"],Zt=["none","underline","line-through","overline"],Qt=["none","uppercase","lowercase","capitalize"],fe=["visible","hidden","scroll","auto","clip"],$t=["auto","none"],en=["flex-start","flex-end","center","space-between","space-around","space-evenly"],tn=["flex-start","flex-end","center","baseline","stretch"],nn=["wrap","nowrap"],rn=["flex-start","flex-end","center","space-between","space-around","space-evenly","stretch"],on=["row","row-reverse","column","column-reverse"],sn=["cover","contain","auto"],ln=["center center","center top","center bottom","left center","left top","left bottom","right center","right top","right bottom"],an=["no-repeat","repeat","repeat-x","repeat-y","space","round"],cn=["justifyContent","alignItems","flexWrap","alignContent","flexDirection"],dn=["none","solid","dashed","dotted","double","groove","ridge","inset","outset"],un=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):dn.includes(e),fn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:!(t.width!==void 0&&t.width!==null&&!J(t.width,{allowAuto:!1,allowNegative:!1})||t.style!==void 0&&t.style!==null&&!un(t.style)||t.color!==void 0&&t.color!==null&&!Ae(t.color))},co={allowAuto:!1,allowKeywords:!1,allowNegative:!0},uo={allowAuto:!1,allowKeywords:!1,allowNegative:!1},gn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;if(U(e))return!1;if(L(e))return!0;for(const r of["offsetX","offsetY","spread"]){const o=t[r];if(o!=null&&!J(o,co))return!1}return!(t.blur!==void 0&&t.blur!==null&&!J(t.blur,uo)||t.color!==void 0&&t.color!==null&&!Ae(t.color)||t.inset!==void 0&&t.inset!==null&&typeof t.inset!="boolean")},pn=e=>e?e.cssVariable!==void 0&&e.cssVariable!==null||e.offsetX!==void 0||e.offsetY!==void 0||e.blur!==void 0||e.spread!==void 0||e.color!==void 0:!1,mn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return U(e)?!1:L(e)?!0:t.unit==="number"?typeof t.value=="number"&&Number.isFinite(t.value)&&t.value>0:J(e,{allowAuto:!1,allowNegative:!1})},yn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!U(e)&&!!L(e):typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1,hn=e=>{if(!Bt(e))return{};const t=L(e);if(t)return{backgroundImage:K(t)};const r=e;return r.source==="none"?{backgroundImage:"none"}:r.source==="url"?{backgroundImage:`url("${r.url}")`}:{backgroundImage:`url("${Vt({publicId:r.publicId,cloudName:r.cloudName,transformations:r.transformations})}")`}},q=e=>{const t=L(e);return t?K(t):"unit"in e?e.unit==="auto"?"auto":e.unit==="keyword"?e.keyword:`${e.value}${e.unit}`:""},bn=e=>{if(!fn(e))return{};const t=L(e);if(t)return{border:K(t)};const r={};if(e.width&&(r.borderWidth=q(e.width)),e.style){const o=L(e.style);r.borderStyle=o?K(o):e.style}return e.color&&(r.borderColor=Ee(e.color)),r},de=e=>e?q(e):"0px",_n=e=>{if(!gn(e)||!pn(e))return{};const t=L(e);if(t)return{boxShadow:K(t)};const r=[de(e.offsetX),de(e.offsetY),de(e.blur),de(e.spread)];return e.color&&r.push(Ee(e.color)),e.inset&&r.unshift("inset"),{boxShadow:r.join(" ")}},fo=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,Cn=(e,t)=>{if(!zt(e))return{};if(e.allSides)return{[t]:q(e.allSides)};const r={};for(const o of["top","right","bottom","left"]){const s=e[o];s&&(r[`${t}${fo(o)}`]=q(s))}return r},vn=(e,t)=>Ae(e)?{[t]:Ee(e)}:{},An=(e,t,r)=>{if(!Gt(e,r))return{};const o=L(e);return o?{[t]:K(o)}:{[t]:e}},En=(e,t,r={})=>J(e,r)?{[t]:q(e)}:{},wn=e=>{if(!mn(e))return{};const t=L(e);return t?{lineHeight:K(t)}:"unit"in e&&e.unit==="number"?{lineHeight:e.value}:{lineHeight:q(e)}},Sn=e=>{if(!yn(e))return{};const t=L(e);return t?{opacity:K(t)}:{opacity:e}},we={"margin-3-resolutions":{kind:"boxSpacing",cssProperty:"margin"},"padding-3-resolutions":{kind:"boxSpacing",cssProperty:"padding"},"border-3-resolutions":{kind:"border"},"box-shadow-3-resolutions":{kind:"boxShadow"},"border-radius-3-resolutions":{kind:"length",cssProperty:"borderRadius",capabilities:{allowAuto:!1,allowNegative:!1}},"width-3-resolutions":{kind:"length",cssProperty:"width",capabilities:{allowAuto:!0,allowNegative:!1}},"height-3-resolutions":{kind:"length",cssProperty:"height",capabilities:{allowAuto:!0,allowNegative:!1}},"min-width-3-resolutions":{kind:"length",cssProperty:"minWidth",capabilities:{allowAuto:!1,allowNegative:!1}},"max-width-3-resolutions":{kind:"length",cssProperty:"maxWidth",capabilities:{allowAuto:!1,allowNegative:!1}},"min-height-3-resolutions":{kind:"length",cssProperty:"minHeight",capabilities:{allowAuto:!1,allowNegative:!1}},"max-height-3-resolutions":{kind:"length",cssProperty:"maxHeight",capabilities:{allowAuto:!1,allowNegative:!1}},"gap-3-resolutions":{kind:"length",cssProperty:"gap",capabilities:{allowAuto:!1,allowNegative:!1}},"justify-content-3-resolutions":{kind:"enum",cssProperty:"justifyContent",allowedValues:en},"align-items-3-resolutions":{kind:"enum",cssProperty:"alignItems",allowedValues:tn},"flex-wrap-3-resolutions":{kind:"enum",cssProperty:"flexWrap",allowedValues:nn},"align-content-3-resolutions":{kind:"enum",cssProperty:"alignContent",allowedValues:rn},"flex-direction-3-resolutions":{kind:"enum",cssProperty:"flexDirection",allowedValues:on},"overflow-3-resolutions":{kind:"enum",cssProperty:"overflow",allowedValues:fe},"overflow-x-3-resolutions":{kind:"enum",cssProperty:"overflowX",allowedValues:fe},"overflow-y-3-resolutions":{kind:"enum",cssProperty:"overflowY",allowedValues:fe},"pointer-events-3-resolutions":{kind:"enum",cssProperty:"pointerEvents",allowedValues:$t},"background-color-3-resolutions":{kind:"color",cssProperty:"backgroundColor"},"color-3-resolutions":{kind:"color",cssProperty:"color"},"background-image-3-resolutions":{kind:"backgroundImage"},"background-size-3-resolutions":{kind:"enum",cssProperty:"backgroundSize",allowedValues:sn},"background-position-3-resolutions":{kind:"enum",cssProperty:"backgroundPosition",allowedValues:ln},"background-repeat-3-resolutions":{kind:"enum",cssProperty:"backgroundRepeat",allowedValues:an},"opacity-3-resolutions":{kind:"opacity"},"font-family-3-resolutions":{kind:"enum",cssProperty:"fontFamily",allowedValues:Yt},"font-size-3-resolutions":{kind:"length",cssProperty:"fontSize",capabilities:{allowAuto:!1,allowNegative:!1}},"font-weight-3-resolutions":{kind:"enum",cssProperty:"fontWeight",allowedValues:Xt},"font-style-3-resolutions":{kind:"enum",cssProperty:"fontStyle",allowedValues:Jt},"line-height-3-resolutions":{kind:"lineHeight"},"letter-spacing-3-resolutions":{kind:"length",cssProperty:"letterSpacing",capabilities:{allowAuto:!1,allowNegative:!0}},"text-align-3-resolutions":{kind:"enum",cssProperty:"textAlign",allowedValues:qt},"text-decoration-3-resolutions":{kind:"enum",cssProperty:"textDecoration",allowedValues:Zt},"text-transform-3-resolutions":{kind:"enum",cssProperty:"textTransform",allowedValues:Qt}},Tn=(e,t)=>{const r=we[e];if(!r)return{};switch(r.kind){case"boxSpacing":return Cn(t,r.cssProperty);case"length":return En(t,r.cssProperty,r.capabilities);case"border":return bn(t);case"boxShadow":return _n(t);case"color":return vn(t,r.cssProperty);case"opacity":return Sn(t);case"enum":return An(t,r.cssProperty,r.allowedValues);case"lineHeight":return wn(t);case"backgroundImage":return hn(t);default:return{}}},go=Object.fromEntries(Object.entries(we).filter(([,e])=>e.kind==="boxSpacing").map(([e,t])=>[e,t.cssProperty])),po=e=>e!=null&&e!=="",In=e=>e?!cn.some(r=>po(e[r]))||e.display==="flex"?e:{...e,display:"flex"}:{},Pn=({dbEntryType:e,libraryId:t,sourceComponentsPlugin:r})=>{if(!(e!=null&&e.length))return;const o=r.components[He(t,e)];if(!o||!("defaultAttributeValues"in o))return;const i=o.defaultAttributeValues;if(i!=null&&i.length)return i.reduce((l,a)=>({...l,[a.name]:a.defaultValues}),{})},G=({deviceDisplayType:e,componentAttributes:t})=>{if(!t)return;const r={},o={};for(const[s,i]of Object.entries(t)){if(!s.includes("3-resolutions")||!i)continue;const l=i.all,a=l??i[e.toLowerCase()];o[s]=a,we[s]&&Object.assign(r,Tn(s,a))}return Object.keys(r).length||Object.keys(o).length?{styles:Object.keys(r).length?r:void 0,componentAttributesSpecificToDeviceType:Object.keys(o).length?o:void 0}:void 0},Dn=({defaultAttributes:e,userModifiedAttributes:t})=>e?t?{...e,...t}:e:t;function oe(e){return e.componentAttributes??e.widgetAttributes}function je({col:e,deviceDisplayType:t,isComposeMode:r,sourceComponentsPlugin:o}){const s=oe(e),i=Pn({dbEntryType:e.type,libraryId:e.libraryId,sourceComponentsPlugin:o})||[],l=Dn({defaultAttributes:i,userModifiedAttributes:s}),{styles:a,componentAttributesSpecificToDeviceType:u}=G({deviceDisplayType:t,componentAttributes:l})||{styles:void 0,componentAttributesSpecificToDeviceType:void 0};let d={};const c={};if(a)for(const[g,E]of Object.entries(a))r&&c[g]||(d={...d,[g]:E});let f=oe(e);for(const g in u)if(g.includes("3-resolutions")){f={...oe(e)||{},...u||{}};break}const p=In(d);if(r&&p.pointerEvents!==void 0){const g={...p};return delete g.pointerEvents,{componentAttributesBasedOnDevice:f,componentStyles:g}}return{componentAttributesBasedOnDevice:f,componentStyles:p}}const xn=e=>{const t=(e==null?void 0:e.rows)||[];for(const r of t)if(((r==null?void 0:r.columns)||[]).length>0)return!0;return(e==null?void 0:e.containerAttributes)&&Object.keys(e.containerAttributes).length>0},Ln="var(--sl-spacing-x-small)";function kn(e){return e!=null&&e.horizontalAlignment||e!=null&&e.verticalAlignment||e!=null&&e.flexWrap||e!=null&&e.gap||e!=null&&e.alignContent?!0:!!(e!=null&&e.rowAttributes&&Object.keys(e.rowAttributes).length>0)}function Rn({row:e,deviceDisplayType:t}){var o;const r=G({deviceDisplayType:t,componentAttributes:e.rowAttributes});return((o=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:o["hide-component-3-resolutions"])==="true"}function On({row:e,deviceDisplayType:t,isComposeMode:r}){var g;const o=((g=G({deviceDisplayType:t,componentAttributes:e.rowAttributes}))==null?void 0:g.styles)||{},s=o.justifyContent??e.horizontalAlignment??Me.Center,i=o.alignItems??e.verticalAlignment??Me.Center,l=o.flexDirection??"row",a=o.gap??e.gap??Ln,u=r?"nowrap":o.flexWrap??e.flexWrap??"nowrap",d=o.alignContent??e.alignContent??void 0,c=new Set(["justifyContent","alignItems","flexDirection","gap","flexWrap","alignContent","display"]),f={};for(const[E,A]of Object.entries(o))c.has(E)||(f[E]=A);const p={display:"flex",flexDirection:l,gap:a,flexWrap:u,justifyContent:s,alignItems:i,...f};return d!==void 0&&(p.alignContent=d),p}const Se="css-classes-3-resolutions",mo=500,yo=/[\x00-\x1f\x7f]/g,Te=e=>{if(typeof e!="string")return;const t=new Set,r=[];for(const s of e.split(/\s+/)){const i=s.replace(yo,"");i&&(t.has(i)||(t.add(i),r.push(i)))}if(!r.length)return;let o="";for(const s of r){const i=o?`${o} ${s}`:s;if(i.length>mo)break;o=i}return o.length?o:void 0},tt="hide-component-3-resolutions",Wn="pointer-events-3-resolutions",Nn=["width-3-resolutions","min-width-3-resolutions","max-width-3-resolutions","height-3-resolutions","min-height-3-resolutions","max-height-3-resolutions","margin-3-resolutions","padding-3-resolutions","border-3-resolutions","border-radius-3-resolutions","box-shadow-3-resolutions","overflow-3-resolutions","overflow-x-3-resolutions","overflow-y-3-resolutions",tt,Wn],ho=new Set(Nn);function Ie({containerAttributes:e,deviceDisplayType:t}){var o;const r=G({deviceDisplayType:t,componentAttributes:e});return((o=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:o[tt])==="true"}function nt({containerAttributes:e,deviceDisplayType:t,isComposeMode:r}){var i;if(!e)return{styles:{}};const o=r?Object.fromEntries(Object.entries(e).filter(([l])=>!ho.has(l))):e,s=G({deviceDisplayType:t,componentAttributes:o});return{styles:(s==null?void 0:s.styles)??{},cssClasses:Te((i=s==null?void 0:s.componentAttributesSpecificToDeviceType)==null?void 0:i[Se])}}function Mn(e){return Object.keys(e.styles).length>0||!!e.cssClasses}function rt({containerAttributes:e,widgetContainerStyles:t}){return((e==null?void 0:e[pe])||[]).some(o=>o.toLowerCase().startsWith("height:"))||t.styles.height!==void 0}const jn="z-index-3-resolutions",ot=0;function Vn(e){var t,r;return!!((r=(t=e==null?void 0:e.overlayLayers)==null?void 0:t.layers)!=null&&r.length)}function Ve({containerAttributes:e,deviceDisplayType:t}){var s;const r=G({deviceDisplayType:t,componentAttributes:e}),o=(s=r==null?void 0:r.componentAttributesSpecificToDeviceType)==null?void 0:s[jn];if(typeof o=="number"&&Number.isFinite(o))return o;if(typeof o=="string"&&o.trim().length){const i=Number(o);if(Number.isFinite(i))return i}return ot}function Fn(e,t){return e+t+1}function Kn({containerAttributes:e,deviceDisplayType:t}){var s;const r=G({deviceDisplayType:t,componentAttributes:e}),o=(s=r==null?void 0:r.styles)==null?void 0:s.pointerEvents;return typeof o=="string"?o:void 0}function Bn({layer:e,deviceDisplayType:t}){var r;return(r=e==null?void 0:e.rows)!=null&&r.length?Ie({containerAttributes:e.containerAttributes,deviceDisplayType:t}):!0}function Un({isWithinCollection:e,baseDeclaresOwnHeight:t,baseZIndex:r}){return{position:"relative",isolation:"isolate",display:"flex",flexDirection:"column",...t?{}:{height:e?"auto":"100%"},...r===ot?{}:{zIndex:r}}}function Hn({zIndex:e,pointerEvents:t}){return{position:"absolute",top:0,left:0,width:"100%",height:"100%",boxSizing:"border-box",zIndex:e,...t?{pointerEvents:t}:{}}}function W(e){if(!e)return;const t=[];for(const[r,o]of Object.entries(e)){if(o==null||o==="")continue;const s=r.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);t.push(`${s}: ${o}`)}return t.length>0?t.join("; "):void 0}const ie="/";function zn({componentProps:e,ancestorColumnIds:t,columnId:r}){if(!e||!r)return;const o=[...t??[],r];for(let s=0;s<o.length;s+=1){const i=o.slice(s).join(ie),l=e[i];if(l)return l}}const Fe="placeholderValues";function Gn({widgetInstanceProps:e,placeholderValues:t}){return t===void 0||e!=null&&Object.prototype.hasOwnProperty.call(e,Fe)?e:{...e,[Fe]:t}}function Yn({displayItemList:e,widgetCollections:t}){const r=[],o=(s,i)=>{var l;if((l=s==null?void 0:s.rows)!=null&&l.length)for(const a of s.rows)for(const u of a.columns){if(!u.id||u.type===_e.DroppableBox)continue;const d=Ze(u.type);if(d!=null&&d.length){const c=u.collection??(t==null?void 0:t[d]);c&&!i.includes(u.id)&&o(c.collectionRows,[...i,u.id]);continue}r.push([...i,u.id].join(ie))}};return o(e,[]),r}function bo(e,t){const r=`${ie}${e}`;return t.some(o=>o===e||o.endsWith(r))}function Xn({componentProps:e,displayItemList:t,widgetCollections:r}){const o=e?Object.keys(e):[];if(!o.length)return[];const s=Yn({displayItemList:t,widgetCollections:r});return o.filter(i=>!bo(i,s))}function Jn({componentProps:e,displayItemList:t,widgetCollections:r,publishedKey:o}){if(process.env.NODE_ENV==="production")return;const s=Xn({componentProps:e,displayItemList:t,widgetCollections:r});s.length&&console.warn(`RuleCMSWidget "${o}": componentProps ${s.map(i=>`"${i}"`).join(", ")} ${s.length===1?"matches":"match"} no component in this widget, so those props were not passed to anything. Keys are column ids from the widget config — the composer's Modify drawer shows the id of the selected component.`)}function _o(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Co(e){if(e.all!==void 0&&e.all!==null)return!1;const t=e.phone,r=e.tablet,o=e.desktop;return t!==r||t!==o||r!==o}function Ke(e){var t,r;if(!((t=e==null?void 0:e.rows)!=null&&t.length))return!1;if(Oe(e.containerAttributes))return!0;for(const o of e.rows){if(Oe(o.rowAttributes))return!0;for(const s of o.columns)if(Oe(oe(s)))return!0}for(const o of((r=e.overlayLayers)==null?void 0:r.layers)??[])if(Ke(o))return!0;return!1}function Oe(e){if(!e)return!1;for(const[t,r]of Object.entries(e))if(!(!t.includes("3-resolutions")||!_o(r))){if(t==="hide-component-3-resolutions"){const o=r,s=i=>i==="true"||i===!0;if(s(o.phone)!==s(o.tablet)||s(o.phone)!==s(o.desktop))return!0;continue}if(Co(r))return!0}return!1}function qn(e,t){if(Ke(e))return!0;for(const r of Object.values(t))if(Ke(r.collectionRows))return!0;return!1}const Zn=parseInt($e,10),Qn=parseInt(et,10),vo=Zn+1,Ao=Qn+1;function Eo(e){const t=`.${e}-phone`,r=`.${e}-tablet`,o=`.${e}-desktop`;return`
2
- ${t}, ${r}, ${o} { display: none; }
3
- @media (max-width: ${Zn}px) { ${t} { display: block; } }
4
- @media (min-width: ${vo}px) and (max-width: ${Qn}px) { ${r} { display: block; } }
5
- @media (min-width: ${Ao}px) { ${o} { display: block; } }
6
- `.trim()}function ge(e){if(!e)throw new Error("Source components plugin is required, but no plugins were provided");const t=e.sourceComponents;if(!t)throw new Error("Source components plugin is required, but was not found in plugins object");if(!t.components)throw new Error("Source components plugin is missing required property: components");if(typeof t.components!="object"||t.components===null||Array.isArray(t.components))throw new Error("Source components plugin components must be an object (Record<string, LibraryComponentEntry>)");return t}let wo=0;var So=n.from_html("<div><!> <!></div>");function To(e,t){n.push(t,!0);let r=n.prop(t,"isComposeMode",3,!1),o=n.prop(t,"showDropContainers",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"deviceDisplayType",3,"Desktop");const l=`rulecms-vc-${++wo}`;function a(h,v,C){const w=h&&!C?3:1;return!!(v!=null&&v.length)&&v.length>w}const u=n.derived(()=>{var h;return(((h=t.displayItemList.containerAttributes)==null?void 0:h[pe])||[]).join(`;
7
- `)}),d=n.derived(()=>n.get(u)?`.${l} {
8
- ${n.get(u)}
9
- }`:""),c=n.derived(()=>!r()&&Ie({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:i()})),f=n.derived(()=>nt({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:i(),isComposeMode:r()})),p=n.derived(()=>{var C;const h=((C=t.displayItemList.containerAttributes)==null?void 0:C[pe])||[],v=Mn(n.get(f));return r()&&!s()||o()||h.length>0||v||a(r(),t.displayItemList.rows,s())}),g=n.derived(()=>[n.get(u)?l:void 0,n.get(f).cssClasses].filter(Boolean).join(" ")),E=n.derived(()=>({...rt({containerAttributes:t.displayItemList.containerAttributes,widgetContainerStyles:n.get(f)})?{}:{height:s()?"auto":"100%"},display:"flex",flexDirection:"column",...n.get(f).styles})),A=n.derived(()=>n.get(p)?n.get(g):""),b=n.derived(()=>n.get(c)?{display:"none"}:n.get(p)?n.get(E):{display:"contents"});var _=So(),T=n.child(_);{var N=h=>{var v=n.comment(),C=n.first_child(v);n.element(C,()=>"style",!1,(w,I)=>{var P=n.text();n.template_effect(()=>n.set_text(P,n.get(d))),n.append(I,P)}),n.append(h,v)};n.if(T,h=>{n.get(u)&&h(N)})}var H=n.sibling(T,2);n.snippet(H,()=>t.children),n.reset(_),n.template_effect(h=>{n.set_attribute(_,"hidden",n.get(c)||void 0),n.set_class(_,1,n.clsx(n.get(A)||void 0)),n.set_style(_,h)},[()=>W(n.get(b))]),n.append(e,_),n.pop()}var Io=n.from_html("<div><!></div>");function Po(e,t){n.push(t,!0);let r=n.prop(t,"isComposeMode",3,!1),o=n.prop(t,"showDropContainers",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"deviceDisplayType",3,"Desktop");function l(A,b,_){var N;const T=A&&!_?3:1;return!!((N=b==null?void 0:b.columns)!=null&&N.length)&&b.columns.length>T}const a=n.derived(()=>!r()&&Rn({row:t.row,deviceDisplayType:i()})),u=n.derived(()=>o()||kn(t.row)||l(r(),t.row,s())),d=n.derived(()=>On({row:t.row,deviceDisplayType:i(),isComposeMode:r()})),c=n.derived(()=>{var b;const A=G({deviceDisplayType:i(),componentAttributes:t.row.rowAttributes});return Te((b=A==null?void 0:A.componentAttributesSpecificToDeviceType)==null?void 0:b[Se])??""}),f=n.derived(()=>n.get(u)?n.get(c):""),p=n.derived(()=>n.get(a)?{display:"none"}:n.get(u)?n.get(d):{display:"contents"});var g=Io(),E=n.child(g);n.snippet(E,()=>t.children),n.reset(g),n.template_effect(A=>{n.set_attribute(g,"hidden",n.get(a)||void 0),n.set_class(g,1,n.clsx(n.get(f)||void 0)),n.set_style(g,A)},[()=>W(n.get(p))]),n.append(e,g),n.pop()}const $n=["minWidth","maxWidth","minHeight","maxHeight","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","borderWidth","borderStyle","borderColor","border","borderRadius","boxShadow","width","height","gap","display","justifyContent","alignItems","flexWrap","alignContent","flexDirection","overflow","overflowX","overflowY","backgroundColor","backgroundImage","backgroundSize","backgroundPosition","backgroundRepeat","opacity","fontFamily","fontSize","fontWeight","fontStyle","color","lineHeight","letterSpacing","textAlign","textDecoration","textTransform"],Do=e=>e!=null&&e!=="",xo=e=>e?$n.reduce((t,r)=>{const o=e[r];return Do(o)&&(t[r]=o),t},{}):{},Lo=e=>{if(!e)return;const t={...e};for(const r of $n)delete t[r];return Object.keys(t).length?t:void 0},ko=e=>Object.keys(e).length>0,Ro=(e,t)=>{const r=(e==null?void 0:e.noContainer)??!1,o=e==null?void 0:e.resolveNoContainer;if(typeof o!="function")return r;try{const s=o(t);if(typeof s=="boolean")return s;console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" returned ${typeof s} instead of a boolean; falling back to noContainer=${r}`)}catch(s){console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" threw; falling back to noContainer=${r}`,s)}return r},Oo=(e,t)=>{const r=e==null?void 0:e.resolveRendersOwnElement;if(typeof r!="function")return!1;try{const o=r(t);if(typeof o=="boolean")return o;console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" returned ${typeof o} instead of a boolean; falling back to false`)}catch(o){console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" threw; falling back to false`,o)}return!1};var ut=n.from_html("<div><!></div>");function er(e,t){n.push(t,!0);const r=n.derived(()=>t.components[He(t.libraryId,t.componentType)]),o=n.derived(()=>{var _;const b=(_=n.get(r))==null?void 0:_.card;return b||(console.error(`DisplayComponent: Component with type ${t.componentType}${t.libraryId?` (library "${t.libraryId}")`:""} not found in components`),null)}),s=n.derived(()=>({componentAttributes:t.componentAttributes,styleProps:t.styleProps})),i=n.derived(()=>n.get(r)?Ro(n.get(r),n.get(s)):!1),l=n.derived(()=>xo(t.styleProps)),a=n.derived(()=>n.get(i)?Lo(t.styleProps):t.styleProps),u=n.derived(()=>{var b;return Te((b=t.componentAttributes)==null?void 0:b[Se])}),d=n.derived(()=>n.get(i)&&ko(n.get(l))),c=n.derived(()=>!n.get(i)||(n.get(r)?Oo(n.get(r),n.get(s)):!1)),f=n.derived(()=>!n.get(d)&&n.get(c)?n.get(u):void 0),p=n.derived(()=>({componentAttributes:t.componentAttributes,styleProps:n.get(a),className:n.get(f),widgetInstanceProps:t.widgetInstanceProps,pageViewType:t.pageViewType,columnPath:t.columnPath,mounts:t.mounts}));var g=n.comment(),E=n.first_child(g);{var A=b=>{const _=n.derived(()=>n.get(o));var T=n.comment(),N=n.first_child(T);{var H=C=>{var w=ut(),I=n.child(w);n.component(I,()=>n.get(_),(P,k)=>{k(P,n.spread_props(()=>n.get(p)))}),n.reset(w),n.template_effect(P=>{n.set_class(w,1,n.clsx(n.get(u)||void 0)),n.set_style(w,P)},[()=>W(n.get(l))]),n.append(C,w)},h=C=>{var w=ut(),I=n.child(w);n.component(I,()=>n.get(_),(P,k)=>{k(P,n.spread_props(()=>n.get(p)))}),n.reset(w),n.template_effect(()=>n.set_class(w,1,n.clsx(n.get(u)))),n.append(C,w)},v=C=>{var w=n.comment(),I=n.first_child(w);n.component(I,()=>n.get(_),(P,k)=>{k(P,n.spread_props(()=>n.get(p)))}),n.append(C,w)};n.if(N,C=>{n.get(d)?C(H):!n.get(c)&&n.get(u)?C(h,1):C(v,-1)})}n.append(b,T)};n.if(E,b=>{n.get(o)&&b(A)})}n.append(e,g),n.pop()}var Wo=n.from_html("<div><!></div>"),No=n.from_html("<div><!> <!></div>");function ye(e,t){n.push(t,!0);const r=h=>{To(h,{get displayItemList(){return t.displayItemList},get isComposeMode(){return o()},get showDropContainers(){return i()},get isWithinCollection(){return s()},get deviceDisplayType(){return t.deviceDisplayType},children:(v,C)=>{var w=n.comment(),I=n.first_child(w);n.each(I,17,()=>t.displayItemList.rows,P=>P.id,(P,k)=>{Po(P,{get row(){return n.get(k)},get isComposeMode(){return o()},get showDropContainers(){return i()},get isWithinCollection(){return s()},get deviceDisplayType(){return t.deviceDisplayType},children:(Q,te)=>{var ne=n.comment(),le=n.first_child(ne);n.each(le,17,()=>n.get(k).columns,$=>$.id,($,V)=>{var ae=n.comment(),xe=n.first_child(ae);{var Le=y=>{const m=n.derived(()=>p(n.get(V)));var S=n.comment(),D=n.first_child(S);{var M=O=>{{let X=n.derived(()=>g(n.get(V).id));ye(O,{get displayItemList(){return n.get(m)},get isComposeMode(){return o()},isWithinCollection:!0,get widgetCollections(){return t.widgetCollections},get showDropContainers(){return i()},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return n.get(X)}})}},R=O=>{{let X=n.derived(()=>f(n.get(V)).componentAttributes),ce=n.derived(()=>f(n.get(V)).styleProps),re=n.derived(()=>b(n.get(V).id)),it=n.derived(E),lt=n.derived(()=>A(n.get(V).id));er(O,{get componentType(){return n.get(V).type},get libraryId(){return n.get(V).libraryId},get componentAttributes(){return n.get(X)},get components(){return n.get(l)},get styleProps(){return n.get(ce)},get widgetInstanceProps(){return n.get(re)},get pageViewType(){return n.get(it)},get columnPath(){return n.get(lt)},get mounts(){return t.mounts}})}};n.if(D,O=>{n.get(m)?O(M):O(R,-1)})}n.append(y,S)},ke=n.derived(()=>c(n.get(V)));n.if(xe,y=>{n.get(ke)&&y(Le)})}n.append($,ae)}),n.append(Q,ne)},$$slots:{default:!0}})}),n.append(v,w)},$$slots:{default:!0}})};let o=n.prop(t,"isComposeMode",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"showDropContainers",3,!1);const l=n.derived(()=>ge(t.plugins).components),a=n.derived(()=>!o()&&Vn(t.displayItemList)&&!Ie({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType})),u=n.derived(()=>{const h=Ve({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType});return Un({isWithinCollection:s(),baseDeclaresOwnHeight:rt({containerAttributes:t.displayItemList.containerAttributes,widgetContainerStyles:nt({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType,isComposeMode:o()})}),baseZIndex:h})}),d=n.derived(()=>{var C;const h=((C=t.displayItemList.overlayLayers)==null?void 0:C.layers)??[],v=Ve({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType});return h.flatMap((w,I)=>Bn({layer:w,deviceDisplayType:t.deviceDisplayType})?[]:[{index:I,layer:w,boxStyles:Hn({zIndex:Fn(v,I),pointerEvents:Kn({containerAttributes:w.containerAttributes,deviceDisplayType:t.deviceDisplayType})})}])});function c(h){if(o()&&h.type===_e.DroppableBox)return!1;const{componentAttributesBasedOnDevice:v}=je({col:h,deviceDisplayType:t.deviceDisplayType,isComposeMode:o(),sourceComponentsPlugin:ge(t.plugins)}),C=!!v&&v["hide-component-3-resolutions"]==="true";return!(!o()&&C)}function f(h){const{componentAttributesBasedOnDevice:v,componentStyles:C}=je({col:h,deviceDisplayType:t.deviceDisplayType,isComposeMode:o(),sourceComponentsPlugin:ge(t.plugins)});return{componentAttributes:v,styleProps:C}}function p(h){const v=Ze(h.type);if(!(v!=null&&v.length))return null;const C=h.collection??t.widgetCollections[v];if(!C)throw new Error(`DisplayCollection - Collection with ID ${v} not found in widgetCollections. Available collections: ${Object.keys(t.widgetCollections).join(", ")}`);return!C.collectionRows||!xn(C.collectionRows)?null:C.collectionRows}function g(h){return[...t.ancestorColumnIds??[],h]}function E(){return o()?Ne.Compose:Ne.RenderedPage}function A(h){if(!(o()||!h))return[...t.ancestorColumnIds??[],h].join(ie)}function b(h){return Gn({widgetInstanceProps:zn({componentProps:t.componentProps,ancestorColumnIds:t.ancestorColumnIds,columnId:h}),placeholderValues:o()?void 0:t.placeholderValues})}var _=n.comment(),T=n.first_child(_);{var N=h=>{var v=No(),C=n.child(v);r(C);var w=n.sibling(C,2);n.each(w,17,()=>n.get(d),I=>I.index,(I,P)=>{var k=Wo(),Q=n.child(k);ye(Q,{get displayItemList(){return n.get(P).layer},get isComposeMode(){return o()},isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return t.ancestorColumnIds}}),n.reset(k),n.template_effect(te=>{n.set_attribute(k,"data-rulecms-overlay-layer",n.get(P).index),n.set_style(k,te)},[()=>W(n.get(P).boxStyles)]),n.append(I,k)}),n.reset(v),n.template_effect(I=>n.set_style(v,I),[()=>W(n.get(u))]),n.append(h,v)},H=h=>{r(h)};n.if(T,h=>{n.get(a)?h(N):h(H,-1)})}n.append(e,_),n.pop()}function he(e,t){n.push(t,!0);var r=n.comment(),o=n.first_child(r);{var s=i=>{ye(i,{get displayItemList(){return t.displayItemList},get isComposeMode(){return t.isComposeMode},get isWithinCollection(){return t.isWithinCollection},get widgetCollections(){return t.widgetCollections},get showDropContainers(){return t.showDropContainers},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return t.ancestorColumnIds}})};n.if(o,i=>{var l,a;(a=(l=t.displayItemList)==null?void 0:l.rows)!=null&&a.length&&i(s)})}n.append(e,r),n.pop()}function tr(e,t){var r=n.comment(),o=n.first_child(r);n.each(o,17,()=>t.stylesheets??[],n.index,(s,i)=>{var l=n.comment(),a=n.first_child(l);n.element(a,()=>"style",!1,(u,d)=>{n.attribute_effect(u,()=>({"data-rulecms-library-stylesheet":""}));var c=n.text();n.template_effect(()=>n.set_text(c,n.get(i))),n.append(d,c)}),n.append(s,l)}),n.append(e,r)}let Mo=0;var jo=n.from_html("<div><!></div>"),ft=n.from_html("<!> <!>",1);function nr(e,t){n.push(t,!0);const r=["Phone","Tablet","Desktop"],o=`rulecms-bp-${++Mo}`,s=n.derived(()=>t.scopeIdInput??o),i=n.derived(()=>qn(t.displayItemList,t.widgetCollections)),l=n.derived(()=>Eo(n.get(s)));var a=ft(),u=n.first_child(a);{let p=n.derived(()=>{var g;return(g=t.plugins.sourceComponents)==null?void 0:g.stylesheets});tr(u,{get stylesheets(){return n.get(p)}})}var d=n.sibling(u,2);{var c=p=>{he(p,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",deviceDisplayType:"Desktop",get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})},f=p=>{var g=ft(),E=n.first_child(g);n.element(E,()=>"style",!1,(b,_)=>{var T=n.text();n.template_effect(()=>n.set_text(T,n.get(l))),n.append(_,T)});var A=n.sibling(E,2);n.each(A,16,()=>r,b=>b,(b,_)=>{var T=jo(),N=n.child(T);he(N,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get deviceDisplayType(){return _},get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}}),n.reset(T),n.template_effect(H=>n.set_class(T,1,H),[()=>`${n.get(s)}-${_.toLowerCase()}`]),n.append(b,T)}),n.append(p,g)};n.if(d,p=>{n.get(i)?p(f,-1):p(c)})}n.append(e,a),n.pop()}function Vo(e,t,r){if(e)return"Phone";if(t)return"Tablet";const o=(r==null?void 0:r.toLowerCase())||"desktop";return o==="phone"?"Phone":o==="tablet"?"Tablet":"Desktop"}const Fo=`(max-width: ${$e})`,Ko=`(max-width: ${et})`;var Bo=n.from_html("<!> <!>",1);function rr(e,t){n.push(t,!0);let r=n.state("Desktop"),o,s;function i(){n.set(r,Vo((o==null?void 0:o.matches)??!1,(s==null?void 0:s.matches)??!1,t.reduxDeviceDisplayType),!0)}n.user_effect(()=>(typeof matchMedia=="function"&&(o=matchMedia(Fo),s=matchMedia(Ko),o.addEventListener("change",i),s.addEventListener("change",i)),i(),()=>{o==null||o.removeEventListener("change",i),s==null||s.removeEventListener("change",i)}));var l=Bo(),a=n.first_child(l);{var u=c=>{{let f=n.derived(()=>{var p;return(p=t.plugins.sourceComponents)==null?void 0:p.stylesheets});tr(c,{get stylesheets(){return n.get(f)}})}};n.if(a,c=>{t.isWithinCollection||c(u)})}var d=n.sibling(a,2);he(d,{get displayItemList(){return t.displayItemList},get isComposeMode(){return t.isComposeMode},get isWithinCollection(){return t.isWithinCollection},get widgetCollections(){return t.widgetCollections},get showDropContainers(){return t.showDropContainers},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get deviceDisplayType(){return n.get(r)},get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}}),n.append(e,l),n.pop()}function or(e){return e!==!1}const Uo=["utilities","components"],Ho=new Set(Uo),sr=e=>typeof e=="string"&&Ho.has(e),zo=e=>e.split(`
1
+ "use strict";var ko=Object.defineProperty;var Ro=(e,t,o)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o;var ct=(e,t,o)=>Ro(e,typeof t!="symbol"?t+"":t,o);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("svelte/internal/disclose-version");const xo=require("svelte/internal/client"),We=require("svelte");function Oo(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const n=Oo(xo),te="default";function ze(e,t){return!(e!=null&&e.length)||e===te?t:`${e}/${t}`}const No=`RuleCMS widget: this widget config uses components from the default component library, but no "default" library is registered. The default library is registered by the consumer app: add the RuleCMS default source components package as a direct dependency and register it, e.g. libraries: { default: sourceComponentsModule } (statically imported for SSR) or libraries: { default: () => import('<default source components package>') }. See the @rulecms/widget-svelte README.`;function ut(e){if(!e||typeof e!="object")return!1;const t=e;return!!t.manifest&&typeof t.manifest=="object"&&!!t.components&&typeof t.components=="object"&&!Array.isArray(t.components)}function Wo(e){if(ut(e))return e;const t=e;return ut(t==null?void 0:t.default)?t.default:null}function Oe(e){return e.usesDefaultLibrary?[te,...e.libraryIds]:[...e.libraryIds]}function dt({registrations:e,referenced:t}){if(t.usesDefaultLibrary&&!(e!=null&&e[te]))throw new Error(No)}function Mo(e){const t=[],o=new Set;for(const r of e.values()){if(typeof r.stylesheet!="string")continue;const s=r.stylesheet.trim();!s||o.has(s)||(o.add(s),t.push(s))}return t.length>0?t:void 0}function _t(e){const t={};for(const[r,s]of e){const i=r===te;for(const[l,a]of Object.entries(s.components))t[i?l:`${r}/${l}`]=a}const o=Mo(e);return o?{components:t,stylesheets:o}:{components:t}}function ie(){const e=new Map,t=new Map,o=new Map,r=new Map;let s=0;function i(d,u){var g;e.get(d)!==u&&((g=u.manifest)!=null&&g.id&&u.manifest.id!==d&&console.warn(`RuleCMS widget: component library registered as "${d}" declares manifest id "${u.manifest.id}". The registered id wins for resolution.`),e.set(d,u),s+=1)}function l(d){const u=Oe(d),g=[...u].sort().join("|"),m=r.get(g);if(m&&m.loadedVersion===s)return m.plugin;const f=new Map;for(const w of u){const h=e.get(w);h&&f.set(w,h)}const A=_t(f);return r.set(g,{loadedVersion:s,plugin:A}),A}function a(d){dt(d);const{registrations:u,referenced:g}=d;for(const m of Oe(g)){if(e.has(m)||o.has(m))continue;const f=u==null?void 0:u[m];if(!f){console.error(`RuleCMS widget: no component library registered for libraryId "${m}"; its components will not render.`),o.set(m,new Error(`No registration for libraryId "${m}"`));continue}if(typeof f=="function")return null;i(m,f)}return l(g)}async function c(d){dt(d);const{registrations:u,referenced:g}=d,m=Oe(g);return await Promise.all(m.map(async f=>{if(e.has(f)||o.has(f))return;const A=u==null?void 0:u[f];if(!A){console.error(`RuleCMS widget: no component library registered for libraryId "${f}"; its components will not render.`),o.set(f,new Error(`No registration for libraryId "${f}"`));return}if(typeof A!="function"){i(f,A);return}let w=t.get(f);w||(w=A().then(h=>{const E=Wo(h);if(!E)throw new Error(`Registration for libraryId "${f}" did not resolve to a ComponentLibraryModule (expected { manifest, components }).`);i(f,E)}).catch(h=>{o.set(f,h),console.error(`RuleCMS widget: failed to load component library "${f}":`,h)}).finally(()=>{t.delete(f)}),t.set(f,w)),await w})),l(g)}return{resolveSync:a,resolve:c}}const Me={Preview:"Preview",Compose:"Compose",RenderedPage:"RenderedPage"},_e={DroppableBox:"droppable-box"},je={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly"},jo={FlexStart:"flex-start",FlexEnd:"flex-end",Center:"center",SpaceBetween:"space-between",SpaceAround:"space-around",SpaceEvenly:"space-evenly",Stretch:"stretch"},me="cssAttrArray",Vo={Phone:"phone",Tablet:"tablet",Desktop:"desktop"},Ge={ComposerComponent:"ComposerWidget",Collection:"Collection",MoveComponentHandle:"MoveWidgetHandle"},Ye=`${Ge.Collection}_`,vt="dev.",At="https://rulecms.com",Et="https://widget-cache.rulecms.com",wt="/api/v1/c/widget/get",St="/api/v1/c/dev/widget/get",Tt="/api/v1/c/widget/resolve",It="/api/v1/c/dev/widget/resolve";function G(e){return typeof e=="string"&&e.startsWith(vt)}function Xe(e,t){return t?t.replace(/\/$/,""):G(e)?At:Et}function Je({publishedKey:e,token:t,endpoint:o}){const r=G(t),s=r?St:wt,i=r?new URLSearchParams({widgetKey:e,token:t}):new URLSearchParams({publishedKey:e,token:t});return`${Xe(t,o)}${s}?${i.toString()}`}function qe({token:e,endpoint:t}){const o=G(e)?It:Tt;return`${Xe(e,t)}${o}`}const Fo=({id:e,prefix:t})=>`${t}_${e}`,Pt=e=>{if(!(e!=null&&e.length)||!e.includes("_")){console.error(`Invalid drag item id: ${e}. Type does not exist.`);return}return Dt(e)},Ze=e=>e.includes("_"),Dt=e=>{const t=e.indexOf("_"),o=e.substring(0,t),r=e.substring(t+1);return{prefix:o,id:r}},Qe=e=>{if(!Ze(e))return;const o=Pt(e);return(o==null?void 0:o.prefix)===Ge.Collection||console.error("getCollectionIdForCollectionType - Invalid component type: ${componentType}. Invalid prefix type."),o==null?void 0:o.id},Ko=e=>{if(!(e!=null&&e.length)){console.error("getNameAndInstanceIdFromWidgetKey: Missing widget key");return}const t=e.split("$");if(t.length<2){console.error("getNameAndInstanceIdFromWidgetKey: Invalid widget key format");return}const o=t[0];if(!t[1].includes("@"))return{name:o,instanceId:t[1]};const s=t[1].split("@");return{name:o,instanceId:s[0],parentId:s[1]}},Bo=e=>{if(!(e!=null&&e.length))return{errorMessage:"getNameFromWidgetKey: Missing widget key"};const t=e.split("$");return t.length<2?{errorMessage:"getNameFromWidgetKey: Invalid widget key format"}:{name:t[0]}},Lt=e=>{var s,i,l,a;if(!e)return{error:"getWidgetKeyForCollection: Missing collection"};if(!((s=e.name)!=null&&s.length))return{error:"getWidgetKeyForCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((l=e.id)!=null&&l.length))return{error:"getWidgetKeyForCollection: Missing collection id"};const r=((a=e.parentId)==null?void 0:a.length)?`${e.id}@${e.parentId}`:`${e.id}`;return{data:`${t}$${r}`}},kt=e=>{var s,i,l,a;if(!e)return{error:"getWidgetKeyForPublishedCollection: Missing collection"};if(!((s=e.name)!=null&&s.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection name"};const t=(i=e.name)==null?void 0:i.trim().toLowerCase();if(!((l=e.publishedKey)!=null&&l.length))return{error:"getWidgetKeyForPublishedCollection: Missing collection publishedKey"};const r=((a=e.parentId)==null?void 0:a.length)?`${e.publishedKey}@${e.parentId}`:`${e.publishedKey}`;return{data:`${t}$${r}`}},Uo=e=>{const t=Lt(e);return`${Ye}${t.data}`},Ho=e=>{const t=kt(e);return`${Ye}${t.data}`},ye="---",Rt="___";function xt(e,t){return`${e}${ye}${t}`}function zo(e,t,o){return`${xt(e,t)}${Rt}${o}`}function Go(e){const t=e.split(".");if(t.length!==3)throw new Error(`Invalid version format: ${e}. Expected format: x.y.z`);const o=t[0],r=t[1],s=parseInt(t[2],10);if(isNaN(s))throw new Error(`Invalid patch version: ${t[2]}. Expected a number.`);return`${o}.${r}.${s+1}`}function ve({displayItemList:e,widgetCollections:t}){const o=new Set;let r=!1;const s=i=>{var l,a,c;if((l=i==null?void 0:i.rows)!=null&&l.length){for(const d of i.rows)if((a=d==null?void 0:d.columns)!=null&&a.length)for(const u of d.columns)u.collection&&s(u.collection.collectionRows),!(!u.type||u.type===_e.DroppableBox)&&(Ze(u.type)||(!((c=u.libraryId)!=null&&c.length)||u.libraryId===te?r=!0:o.add(u.libraryId)))}};s(e);for(const i of Object.values(t??{}))s(i==null?void 0:i.collectionRows);return{libraryIds:Array.from(o),usesDefaultLibrary:r}}const $e=Symbol("rulecms-widget-context");function Yo(){return{token:"",endpoint:void 0,libraries:void 0,libraryRegistry:ie()}}function Xo(e,t){n.push(t,!0);const o=n.proxy(Yo());function r(){o.token=t.token,o.endpoint=t.endpoint,o.libraries=t.libraries}r(),n.user_effect(r),We.setContext($e,o);var s=n.comment(),i=n.first_child(s);n.snippet(i,()=>t.children),n.append(e,s),n.pop()}const Ot="1200px",et="500px",tt="820px",Jo=Ot,Nt="rulecms",qo=1920,Zo={f:"auto",q:"auto",c:"limit"},Qo=/^[A-Za-z0-9][A-Za-z0-9._\-/]*$/,$o=300,er=/^[A-Za-z0-9][A-Za-z0-9_-]*$/,tr=100,nr=/^https:\/\/[^\s"'()\\<>]+$/,or=2e3,rr=/^[A-Za-z0-9_,.:\-/]*$/,sr=300,Wt=e=>typeof e=="string"&&e.length<=$o&&Qo.test(e),Mt=e=>typeof e=="string"&&e.length<=tr&&er.test(e),jt=e=>typeof e=="string"&&e.length<=or&&nr.test(e),Vt=e=>typeof e=="string"&&e.length<=sr&&rr.test(e),ir=e=>Object.entries(e).map(([t,o])=>`${t}_${o}`).join(","),lr=e=>{const t={};for(const o of e.split(",")){const r=o.trim(),s=r.indexOf("_");s<=0||(t[r.slice(0,s)]=r.slice(s+1))}return t},Ft=({publicId:e,cloudName:t=Nt,transformations:o,width:r=qo})=>{const s=typeof o=="string"?lr(o):o,i={...Zo,...s,w:r};return encodeURI(`https://res.cloudinary.com/${t}/image/upload/${ir(i)}/${e}`)},Kt=/^--[A-Za-z0-9_-]+$/,Bt=200,Q=e=>{if(typeof e!="string")return!1;const t=e.trim();return t.length<=Bt&&Kt.test(t)},K=e=>`var(${e.trim()})`,L=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return;const t=e.cssVariable;if(t!=null)return Q(t)?t.trim():void 0},H=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e.cssVariable;return t==null?!1:!Q(t)},ar=(e,t)=>{const o=L(e);return o?{[t]:K(o)}:void 0},Ut=e=>{if(typeof e!="object"||e===null||Array.isArray(e)||H(e))return!1;if(L(e))return!0;const t=e;return t.source==="none"?!0:t.source==="url"?jt(t.url):t.source==="cloudinary"?!Wt(t.publicId)||t.cloudName!==void 0&&t.cloudName!==null&&!Mt(t.cloudName)?!1:t.transformations===void 0||t.transformations===null||Vt(t.transformations):!1},Ht=["px","%","em","rem","vh","vw"],Ae=["inherit","unset"],zt=["allSides","top","right","bottom","left"],q=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const o=e;return H(e)?!1:L(e)?!0:o.unit==="auto"?t.allowAuto!==!1:o.unit==="keyword"?t.allowKeywords!==!1&&Ae.includes(o.keyword):Ht.includes(o.unit)?typeof o.value!="number"||!Number.isFinite(o.value)?!1:t.allowNegative!==!1||o.value>=0:!1},Gt=(e,t={})=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const o=e;for(const r of zt){const s=o[r];if(s!=null&&!q(s,t))return!1}return!0},cr=[...Ae,"transparent","currentColor"],ur=/^(#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/,Ee=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return H(e)?!1:L(e)?!0:t.unit==="keyword"?cr.includes(t.keyword):t.unit==="color"?typeof t.value=="string"&&ur.test(t.value.trim()):!1},we=e=>{const t=L(e);return t?K(t):"unit"in e?e.unit==="keyword"?e.keyword:e.value.trim():""},Yt=(e,t)=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!H(e)&&!!L(e):typeof e!="string"||!e.length?!1:t.includes(e)?!0:Ae.includes(e),Xt=['system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif','Georgia, "Times New Roman", Times, serif',"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace","Arial, Helvetica, sans-serif",'"Helvetica Neue", Helvetica, Arial, sans-serif',"Verdana, Geneva, sans-serif"],Jt=["normal","bold","100","200","300","400","500","600","700","800","900"],qt=["normal","italic","oblique"],Zt=["left","center","right","justify","start","end"],Qt=["none","underline","line-through","overline"],$t=["none","uppercase","lowercase","capitalize"],ge=["visible","hidden","scroll","auto","clip"],en=["auto","none"],tn=["flex-start","flex-end","center","space-between","space-around","space-evenly"],nn=["flex-start","flex-end","center","baseline","stretch"],on=["wrap","nowrap"],rn=["flex-start","flex-end","center","space-between","space-around","space-evenly","stretch"],sn=["row","row-reverse","column","column-reverse"],ln=["cover","contain","auto"],an=["center center","center top","center bottom","left center","left top","left bottom","right center","right top","right bottom"],cn=["no-repeat","repeat","repeat-x","repeat-y","space","round"],un=["justifyContent","alignItems","flexWrap","alignContent","flexDirection"],dn=["none","solid","dashed","dotted","double","groove","ridge","inset","outset"],fn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!H(e)&&!!L(e):dn.includes(e),gn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return H(e)?!1:L(e)?!0:!(t.width!==void 0&&t.width!==null&&!q(t.width,{allowAuto:!1,allowNegative:!1})||t.style!==void 0&&t.style!==null&&!fn(t.style)||t.color!==void 0&&t.color!==null&&!Ee(t.color))},dr={allowAuto:!1,allowKeywords:!1,allowNegative:!0},fr={allowAuto:!1,allowKeywords:!1,allowNegative:!1},pn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;if(H(e))return!1;if(L(e))return!0;for(const o of["offsetX","offsetY","spread"]){const r=t[o];if(r!=null&&!q(r,dr))return!1}return!(t.blur!==void 0&&t.blur!==null&&!q(t.blur,fr)||t.color!==void 0&&t.color!==null&&!Ee(t.color)||t.inset!==void 0&&t.inset!==null&&typeof t.inset!="boolean")},mn=e=>e?e.cssVariable!==void 0&&e.cssVariable!==null||e.offsetX!==void 0||e.offsetY!==void 0||e.blur!==void 0||e.spread!==void 0||e.color!==void 0:!1,yn=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return H(e)?!1:L(e)?!0:t.unit==="number"?typeof t.value=="number"&&Number.isFinite(t.value)&&t.value>0:q(e,{allowAuto:!1,allowNegative:!1})},hn=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?!H(e)&&!!L(e):typeof e=="number"&&Number.isFinite(e)&&e>=0&&e<=1,bn=e=>{if(!Ut(e))return{};const t=L(e);if(t)return{backgroundImage:K(t)};const o=e;return o.source==="none"?{backgroundImage:"none"}:o.source==="url"?{backgroundImage:`url("${o.url}")`}:{backgroundImage:`url("${Ft({publicId:o.publicId,cloudName:o.cloudName,transformations:o.transformations})}")`}},Z=e=>{const t=L(e);return t?K(t):"unit"in e?e.unit==="auto"?"auto":e.unit==="keyword"?e.keyword:`${e.value}${e.unit}`:""},Cn=e=>{if(!gn(e))return{};const t=L(e);if(t)return{border:K(t)};const o={};if(e.width&&(o.borderWidth=Z(e.width)),e.style){const r=L(e.style);o.borderStyle=r?K(r):e.style}return e.color&&(o.borderColor=we(e.color)),o},de=e=>e?Z(e):"0px",_n=e=>{if(!pn(e)||!mn(e))return{};const t=L(e);if(t)return{boxShadow:K(t)};const o=[de(e.offsetX),de(e.offsetY),de(e.blur),de(e.spread)];return e.color&&o.push(we(e.color)),e.inset&&o.unshift("inset"),{boxShadow:o.join(" ")}},gr=e=>`${e.charAt(0).toUpperCase()}${e.slice(1)}`,vn=(e,t)=>{if(!Gt(e))return{};if(e.allSides)return{[t]:Z(e.allSides)};const o={};for(const r of["top","right","bottom","left"]){const s=e[r];s&&(o[`${t}${gr(r)}`]=Z(s))}return o},An=(e,t)=>Ee(e)?{[t]:we(e)}:{},En=(e,t,o)=>{if(!Yt(e,o))return{};const r=L(e);return r?{[t]:K(r)}:{[t]:e}},wn=(e,t,o={})=>q(e,o)?{[t]:Z(e)}:{},Sn=e=>{if(!yn(e))return{};const t=L(e);return t?{lineHeight:K(t)}:"unit"in e&&e.unit==="number"?{lineHeight:e.value}:{lineHeight:Z(e)}},Tn=e=>{if(!hn(e))return{};const t=L(e);return t?{opacity:K(t)}:{opacity:e}},Se={"margin-3-resolutions":{kind:"boxSpacing",cssProperty:"margin"},"padding-3-resolutions":{kind:"boxSpacing",cssProperty:"padding"},"border-3-resolutions":{kind:"border"},"box-shadow-3-resolutions":{kind:"boxShadow"},"border-radius-3-resolutions":{kind:"length",cssProperty:"borderRadius",capabilities:{allowAuto:!1,allowNegative:!1}},"width-3-resolutions":{kind:"length",cssProperty:"width",capabilities:{allowAuto:!0,allowNegative:!1}},"height-3-resolutions":{kind:"length",cssProperty:"height",capabilities:{allowAuto:!0,allowNegative:!1}},"min-width-3-resolutions":{kind:"length",cssProperty:"minWidth",capabilities:{allowAuto:!1,allowNegative:!1}},"max-width-3-resolutions":{kind:"length",cssProperty:"maxWidth",capabilities:{allowAuto:!1,allowNegative:!1}},"min-height-3-resolutions":{kind:"length",cssProperty:"minHeight",capabilities:{allowAuto:!1,allowNegative:!1}},"max-height-3-resolutions":{kind:"length",cssProperty:"maxHeight",capabilities:{allowAuto:!1,allowNegative:!1}},"gap-3-resolutions":{kind:"length",cssProperty:"gap",capabilities:{allowAuto:!1,allowNegative:!1}},"justify-content-3-resolutions":{kind:"enum",cssProperty:"justifyContent",allowedValues:tn},"align-items-3-resolutions":{kind:"enum",cssProperty:"alignItems",allowedValues:nn},"flex-wrap-3-resolutions":{kind:"enum",cssProperty:"flexWrap",allowedValues:on},"align-content-3-resolutions":{kind:"enum",cssProperty:"alignContent",allowedValues:rn},"flex-direction-3-resolutions":{kind:"enum",cssProperty:"flexDirection",allowedValues:sn},"overflow-3-resolutions":{kind:"enum",cssProperty:"overflow",allowedValues:ge},"overflow-x-3-resolutions":{kind:"enum",cssProperty:"overflowX",allowedValues:ge},"overflow-y-3-resolutions":{kind:"enum",cssProperty:"overflowY",allowedValues:ge},"pointer-events-3-resolutions":{kind:"enum",cssProperty:"pointerEvents",allowedValues:en},"background-color-3-resolutions":{kind:"color",cssProperty:"backgroundColor"},"color-3-resolutions":{kind:"color",cssProperty:"color"},"background-image-3-resolutions":{kind:"backgroundImage"},"background-size-3-resolutions":{kind:"enum",cssProperty:"backgroundSize",allowedValues:ln},"background-position-3-resolutions":{kind:"enum",cssProperty:"backgroundPosition",allowedValues:an},"background-repeat-3-resolutions":{kind:"enum",cssProperty:"backgroundRepeat",allowedValues:cn},"opacity-3-resolutions":{kind:"opacity"},"font-family-3-resolutions":{kind:"enum",cssProperty:"fontFamily",allowedValues:Xt},"font-size-3-resolutions":{kind:"length",cssProperty:"fontSize",capabilities:{allowAuto:!1,allowNegative:!1}},"font-weight-3-resolutions":{kind:"enum",cssProperty:"fontWeight",allowedValues:Jt},"font-style-3-resolutions":{kind:"enum",cssProperty:"fontStyle",allowedValues:qt},"line-height-3-resolutions":{kind:"lineHeight"},"letter-spacing-3-resolutions":{kind:"length",cssProperty:"letterSpacing",capabilities:{allowAuto:!1,allowNegative:!0}},"text-align-3-resolutions":{kind:"enum",cssProperty:"textAlign",allowedValues:Zt},"text-decoration-3-resolutions":{kind:"enum",cssProperty:"textDecoration",allowedValues:Qt},"text-transform-3-resolutions":{kind:"enum",cssProperty:"textTransform",allowedValues:$t}},In=(e,t)=>{const o=Se[e];if(!o)return{};switch(o.kind){case"boxSpacing":return vn(t,o.cssProperty);case"length":return wn(t,o.cssProperty,o.capabilities);case"border":return Cn(t);case"boxShadow":return _n(t);case"color":return An(t,o.cssProperty);case"opacity":return Tn(t);case"enum":return En(t,o.cssProperty,o.allowedValues);case"lineHeight":return Sn(t);case"backgroundImage":return bn(t);default:return{}}},pr=Object.fromEntries(Object.entries(Se).filter(([,e])=>e.kind==="boxSpacing").map(([e,t])=>[e,t.cssProperty])),mr=e=>e!=null&&e!=="",Pn=e=>e?!un.some(o=>mr(e[o]))||e.display==="flex"?e:{...e,display:"flex"}:{},Dn=({dbEntryType:e,libraryId:t,sourceComponentsPlugin:o})=>{if(!(e!=null&&e.length))return;const r=o.components[ze(t,e)];if(!r||!("defaultAttributeValues"in r))return;const i=r.defaultAttributeValues;if(i!=null&&i.length)return i.reduce((l,a)=>({...l,[a.name]:a.defaultValues}),{})},Y=({deviceDisplayType:e,componentAttributes:t})=>{if(!t)return;const o={},r={};for(const[s,i]of Object.entries(t)){if(!s.includes("3-resolutions")||!i)continue;const l=i.all,a=l??i[e.toLowerCase()];r[s]=a,Se[s]&&Object.assign(o,In(s,a))}return Object.keys(o).length||Object.keys(r).length?{styles:Object.keys(o).length?o:void 0,componentAttributesSpecificToDeviceType:Object.keys(r).length?r:void 0}:void 0},Ln=({defaultAttributes:e,userModifiedAttributes:t})=>e?t?{...e,...t}:e:t;function se(e){return e.componentAttributes??e.widgetAttributes}function Ve({col:e,deviceDisplayType:t,isComposeMode:o,sourceComponentsPlugin:r}){const s=se(e),i=Dn({dbEntryType:e.type,libraryId:e.libraryId,sourceComponentsPlugin:r})||[],l=Ln({defaultAttributes:i,userModifiedAttributes:s}),{styles:a,componentAttributesSpecificToDeviceType:c}=Y({deviceDisplayType:t,componentAttributes:l})||{styles:void 0,componentAttributesSpecificToDeviceType:void 0};let d={};const u={};if(a)for(const[f,A]of Object.entries(a))o&&u[f]||(d={...d,[f]:A});let g=se(e);for(const f in c)if(f.includes("3-resolutions")){g={...se(e)||{},...c||{}};break}const m=Pn(d);if(o&&m.pointerEvents!==void 0){const f={...m};return delete f.pointerEvents,{componentAttributesBasedOnDevice:g,componentStyles:f}}return{componentAttributesBasedOnDevice:g,componentStyles:m}}const kn=e=>{const t=(e==null?void 0:e.rows)||[];for(const o of t)if(((o==null?void 0:o.columns)||[]).length>0)return!0;return(e==null?void 0:e.containerAttributes)&&Object.keys(e.containerAttributes).length>0},Rn="var(--sl-spacing-x-small)";function xn(e){return e!=null&&e.horizontalAlignment||e!=null&&e.verticalAlignment||e!=null&&e.flexWrap||e!=null&&e.gap||e!=null&&e.alignContent?!0:!!(e!=null&&e.rowAttributes&&Object.keys(e.rowAttributes).length>0)}function On({row:e,deviceDisplayType:t}){var r;const o=Y({deviceDisplayType:t,componentAttributes:e.rowAttributes});return((r=o==null?void 0:o.componentAttributesSpecificToDeviceType)==null?void 0:r["hide-component-3-resolutions"])==="true"}function Nn({row:e,deviceDisplayType:t,isComposeMode:o}){var f;const r=((f=Y({deviceDisplayType:t,componentAttributes:e.rowAttributes}))==null?void 0:f.styles)||{},s=r.justifyContent??e.horizontalAlignment??je.Center,i=r.alignItems??e.verticalAlignment??je.Center,l=r.flexDirection??"row",a=r.gap??e.gap??Rn,c=o?"nowrap":r.flexWrap??e.flexWrap??"nowrap",d=r.alignContent??e.alignContent??void 0,u=new Set(["justifyContent","alignItems","flexDirection","gap","flexWrap","alignContent","display"]),g={};for(const[A,w]of Object.entries(r))u.has(A)||(g[A]=w);const m={display:"flex",flexDirection:l,gap:a,flexWrap:c,justifyContent:s,alignItems:i,...g};return d!==void 0&&(m.alignContent=d),m}const Te="css-classes-3-resolutions",yr=500,hr=/[\x00-\x1f\x7f]/g,Ie=e=>{if(typeof e!="string")return;const t=new Set,o=[];for(const s of e.split(/\s+/)){const i=s.replace(hr,"");i&&(t.has(i)||(t.add(i),o.push(i)))}if(!o.length)return;let r="";for(const s of o){const i=r?`${r} ${s}`:s;if(i.length>yr)break;r=i}return r.length?r:void 0},nt="hide-component-3-resolutions",Wn="pointer-events-3-resolutions",Mn=["width-3-resolutions","min-width-3-resolutions","max-width-3-resolutions","height-3-resolutions","min-height-3-resolutions","max-height-3-resolutions","margin-3-resolutions","padding-3-resolutions","border-3-resolutions","border-radius-3-resolutions","box-shadow-3-resolutions","overflow-3-resolutions","overflow-x-3-resolutions","overflow-y-3-resolutions",nt,Wn],br=new Set(Mn);function Pe({containerAttributes:e,deviceDisplayType:t}){var r;const o=Y({deviceDisplayType:t,componentAttributes:e});return((r=o==null?void 0:o.componentAttributesSpecificToDeviceType)==null?void 0:r[nt])==="true"}function ot({containerAttributes:e,deviceDisplayType:t,isComposeMode:o}){var i;if(!e)return{styles:{}};const r=o?Object.fromEntries(Object.entries(e).filter(([l])=>!br.has(l))):e,s=Y({deviceDisplayType:t,componentAttributes:r});return{styles:(s==null?void 0:s.styles)??{},cssClasses:Ie((i=s==null?void 0:s.componentAttributesSpecificToDeviceType)==null?void 0:i[Te])}}function jn(e){return Object.keys(e.styles).length>0||!!e.cssClasses}function rt({containerAttributes:e,widgetContainerStyles:t}){return((e==null?void 0:e[me])||[]).some(r=>r.toLowerCase().startsWith("height:"))||t.styles.height!==void 0}const Vn="z-index-3-resolutions",st=0;function Fn(e){var t,o;return!!((o=(t=e==null?void 0:e.overlayLayers)==null?void 0:t.layers)!=null&&o.length)}function Fe({containerAttributes:e,deviceDisplayType:t}){var s;const o=Y({deviceDisplayType:t,componentAttributes:e}),r=(s=o==null?void 0:o.componentAttributesSpecificToDeviceType)==null?void 0:s[Vn];if(typeof r=="number"&&Number.isFinite(r))return r;if(typeof r=="string"&&r.trim().length){const i=Number(r);if(Number.isFinite(i))return i}return st}function Kn(e,t){return e+t+1}function Bn({containerAttributes:e,deviceDisplayType:t}){var s;const o=Y({deviceDisplayType:t,componentAttributes:e}),r=(s=o==null?void 0:o.styles)==null?void 0:s.pointerEvents;return typeof r=="string"?r:void 0}function Un({layer:e,deviceDisplayType:t}){var o;return(o=e==null?void 0:e.rows)!=null&&o.length?Pe({containerAttributes:e.containerAttributes,deviceDisplayType:t}):!0}function Hn({isWithinCollection:e,baseDeclaresOwnHeight:t,baseZIndex:o}){return{position:"relative",isolation:"isolate",display:"flex",flexDirection:"column",...t?{}:{height:e?"auto":"100%"},...o===st?{}:{zIndex:o}}}function zn({zIndex:e,pointerEvents:t}){return{position:"absolute",top:0,left:0,width:"100%",height:"100%",boxSizing:"border-box",zIndex:e,...t?{pointerEvents:t}:{}}}function W(e){if(!e)return;const t=[];for(const[o,r]of Object.entries(e)){if(r==null||r==="")continue;const s=o.replace(/[A-Z]/g,i=>`-${i.toLowerCase()}`);t.push(`${s}: ${r}`)}return t.length>0?t.join("; "):void 0}const le="/";function Gn({componentProps:e,ancestorColumnIds:t,columnId:o}){if(!e||!o)return;const r=[...t??[],o];for(let s=0;s<r.length;s+=1){const i=r.slice(s).join(le),l=e[i];if(l)return l}}const Ke="placeholderValues";function Yn({widgetInstanceProps:e,placeholderValues:t}){return t===void 0||e!=null&&Object.prototype.hasOwnProperty.call(e,Ke)?e:{...e,[Ke]:t}}function Xn({displayItemList:e,widgetCollections:t}){const o=[],r=(s,i)=>{var l;if((l=s==null?void 0:s.rows)!=null&&l.length)for(const a of s.rows)for(const c of a.columns){if(!c.id||c.type===_e.DroppableBox)continue;const d=Qe(c.type);if(d!=null&&d.length){const u=c.collection??(t==null?void 0:t[d]);u&&!i.includes(c.id)&&r(u.collectionRows,[...i,c.id]);continue}o.push([...i,c.id].join(le))}};return r(e,[]),o}function Cr(e,t){const o=`${le}${e}`;return t.some(r=>r===e||r.endsWith(o))}function Jn({componentProps:e,displayItemList:t,widgetCollections:o}){const r=e?Object.keys(e):[];if(!r.length)return[];const s=Xn({displayItemList:t,widgetCollections:o});return r.filter(i=>!Cr(i,s))}function qn({componentProps:e,displayItemList:t,widgetCollections:o,publishedKey:r}){if(process.env.NODE_ENV==="production")return;const s=Jn({componentProps:e,displayItemList:t,widgetCollections:o});s.length&&console.warn(`RuleCMSWidget "${r}": componentProps ${s.map(i=>`"${i}"`).join(", ")} ${s.length===1?"matches":"match"} no component in this widget, so those props were not passed to anything. Keys are column ids from the widget config — the composer's Modify drawer shows the id of the selected component.`)}function _r(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vr(e){if(e.all!==void 0&&e.all!==null)return!1;const t=e.phone,o=e.tablet,r=e.desktop;return t!==o||t!==r||o!==r}function Be(e){var t,o;if(!((t=e==null?void 0:e.rows)!=null&&t.length))return!1;if(Ne(e.containerAttributes))return!0;for(const r of e.rows){if(Ne(r.rowAttributes))return!0;for(const s of r.columns)if(Ne(se(s)))return!0}for(const r of((o=e.overlayLayers)==null?void 0:o.layers)??[])if(Be(r))return!0;return!1}function Ne(e){if(!e)return!1;for(const[t,o]of Object.entries(e))if(!(!t.includes("3-resolutions")||!_r(o))){if(t==="hide-component-3-resolutions"){const r=o,s=i=>i==="true"||i===!0;if(s(r.phone)!==s(r.tablet)||s(r.phone)!==s(r.desktop))return!0;continue}if(vr(o))return!0}return!1}function Zn(e,t){if(Be(e))return!0;for(const o of Object.values(t))if(Be(o.collectionRows))return!0;return!1}const Qn=parseInt(et,10),$n=parseInt(tt,10),Ar=Qn+1,Er=$n+1;function wr(e){const t=`.${e}-phone`,o=`.${e}-tablet`,r=`.${e}-desktop`;return`
2
+ ${t}, ${o}, ${r} { display: none; }
3
+ @media (max-width: ${Qn}px) { ${t} { display: block; } }
4
+ @media (min-width: ${Ar}px) and (max-width: ${$n}px) { ${o} { display: block; } }
5
+ @media (min-width: ${Er}px) { ${r} { display: block; } }
6
+ `.trim()}const Sr=/(<\/|<)(s)(tyle)/gi;function Tr(e){return e.replace(Sr,(t,o,r,s)=>`${o}${r==="s"?"\\73 ":"\\53 "}${s}`)}function B(e,t){return`<style${t?` ${t}=""`:""}>${Tr(e)}</style>`}function pe(e){if(!e)throw new Error("Source components plugin is required, but no plugins were provided");const t=e.sourceComponents;if(!t)throw new Error("Source components plugin is required, but was not found in plugins object");if(!t.components)throw new Error("Source components plugin is missing required property: components");if(typeof t.components!="object"||t.components===null||Array.isArray(t.components))throw new Error("Source components plugin components must be an object (Record<string, LibraryComponentEntry>)");return t}var Ir=n.from_html("<div><!> <!></div>");function Pr(e,t){const o=n.props_id();n.push(t,!0);let r=n.prop(t,"isComposeMode",3,!1),s=n.prop(t,"showDropContainers",3,!1),i=n.prop(t,"isWithinCollection",3,!1),l=n.prop(t,"deviceDisplayType",3,"Desktop");const a=`rulecms-vc-${o.replace(/[^a-zA-Z0-9_-]/g,"")}`;function c(_,b,v){const I=_&&!v?3:1;return!!(b!=null&&b.length)&&b.length>I}const d=n.derived(()=>{var _;return(((_=t.displayItemList.containerAttributes)==null?void 0:_[me])||[]).join(`;
7
+ `)}),u=n.derived(()=>n.get(d)?`.${a} {
8
+ ${n.get(d)}
9
+ }`:""),g=n.derived(()=>!r()&&Pe({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:l()})),m=n.derived(()=>ot({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:l(),isComposeMode:r()})),f=n.derived(()=>{var v;const _=((v=t.displayItemList.containerAttributes)==null?void 0:v[me])||[],b=jn(n.get(m));return r()&&!i()||s()||_.length>0||b||c(r(),t.displayItemList.rows,i())}),A=n.derived(()=>[n.get(d)?a:void 0,n.get(m).cssClasses].filter(Boolean).join(" ")),w=n.derived(()=>({...rt({containerAttributes:t.displayItemList.containerAttributes,widgetContainerStyles:n.get(m)})?{}:{height:i()?"auto":"100%"},display:"flex",flexDirection:"column",...n.get(m).styles})),h=n.derived(()=>n.get(f)?n.get(A):""),E=n.derived(()=>n.get(g)?{display:"none"}:n.get(f)?n.get(w):{display:"contents"});var T=Ir(),k=n.child(T);{var z=_=>{var b=n.comment(),v=n.first_child(b);n.html(v,()=>B(n.get(u))),n.append(_,b)};n.if(k,_=>{n.get(d)&&_(z)})}var C=n.sibling(k,2);n.snippet(C,()=>t.children),n.reset(T),n.template_effect(_=>{n.set_attribute(T,"hidden",n.get(g)||void 0),n.set_class(T,1,n.clsx(n.get(h)||void 0)),n.set_style(T,_)},[()=>W(n.get(E))]),n.append(e,T),n.pop()}var Dr=n.from_html("<div><!></div>");function Lr(e,t){n.push(t,!0);let o=n.prop(t,"isComposeMode",3,!1),r=n.prop(t,"showDropContainers",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"deviceDisplayType",3,"Desktop");function l(w,h,E){var k;const T=w&&!E?3:1;return!!((k=h==null?void 0:h.columns)!=null&&k.length)&&h.columns.length>T}const a=n.derived(()=>!o()&&On({row:t.row,deviceDisplayType:i()})),c=n.derived(()=>r()||xn(t.row)||l(o(),t.row,s())),d=n.derived(()=>Nn({row:t.row,deviceDisplayType:i(),isComposeMode:o()})),u=n.derived(()=>{var h;const w=Y({deviceDisplayType:i(),componentAttributes:t.row.rowAttributes});return Ie((h=w==null?void 0:w.componentAttributesSpecificToDeviceType)==null?void 0:h[Te])??""}),g=n.derived(()=>n.get(c)?n.get(u):""),m=n.derived(()=>n.get(a)?{display:"none"}:n.get(c)?n.get(d):{display:"contents"});var f=Dr(),A=n.child(f);n.snippet(A,()=>t.children),n.reset(f),n.template_effect(w=>{n.set_attribute(f,"hidden",n.get(a)||void 0),n.set_class(f,1,n.clsx(n.get(g)||void 0)),n.set_style(f,w)},[()=>W(n.get(m))]),n.append(e,f),n.pop()}const eo=["minWidth","maxWidth","minHeight","maxHeight","margin","marginTop","marginRight","marginBottom","marginLeft","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","borderWidth","borderStyle","borderColor","border","borderRadius","boxShadow","width","height","gap","display","justifyContent","alignItems","flexWrap","alignContent","flexDirection","overflow","overflowX","overflowY","backgroundColor","backgroundImage","backgroundSize","backgroundPosition","backgroundRepeat","opacity","fontFamily","fontSize","fontWeight","fontStyle","color","lineHeight","letterSpacing","textAlign","textDecoration","textTransform"],kr=e=>e!=null&&e!=="",Rr=e=>e?eo.reduce((t,o)=>{const r=e[o];return kr(r)&&(t[o]=r),t},{}):{},xr=e=>{if(!e)return;const t={...e};for(const o of eo)delete t[o];return Object.keys(t).length?t:void 0},Or=e=>Object.keys(e).length>0,Nr=(e,t)=>{const o=(e==null?void 0:e.noContainer)??!1,r=e==null?void 0:e.resolveNoContainer;if(typeof r!="function")return o;try{const s=r(t);if(typeof s=="boolean")return s;console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" returned ${typeof s} instead of a boolean; falling back to noContainer=${o}`)}catch(s){console.error(`resolveNoContainer: component "${e==null?void 0:e.id}" threw; falling back to noContainer=${o}`,s)}return o},Wr=(e,t)=>{const o=e==null?void 0:e.resolveRendersOwnElement;if(typeof o!="function")return!1;try{const r=o(t);if(typeof r=="boolean")return r;console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" returned ${typeof r} instead of a boolean; falling back to false`)}catch(r){console.error(`resolveRendersOwnElement: component "${e==null?void 0:e.id}" threw; falling back to false`,r)}return!1};var ft=n.from_html("<div><!></div>");function to(e,t){n.push(t,!0);const o=n.derived(()=>t.components[ze(t.libraryId,t.componentType)]),r=n.derived(()=>{var E;const h=(E=n.get(o))==null?void 0:E.card;return h||(console.error(`DisplayComponent: Component with type ${t.componentType}${t.libraryId?` (library "${t.libraryId}")`:""} not found in components`),null)}),s=n.derived(()=>({componentAttributes:t.componentAttributes,styleProps:t.styleProps})),i=n.derived(()=>n.get(o)?Nr(n.get(o),n.get(s)):!1),l=n.derived(()=>Rr(t.styleProps)),a=n.derived(()=>n.get(i)?xr(t.styleProps):t.styleProps),c=n.derived(()=>{var h;return Ie((h=t.componentAttributes)==null?void 0:h[Te])}),d=n.derived(()=>n.get(i)&&Or(n.get(l))),u=n.derived(()=>!n.get(i)||(n.get(o)?Wr(n.get(o),n.get(s)):!1)),g=n.derived(()=>!n.get(d)&&n.get(u)?n.get(c):void 0),m=n.derived(()=>({componentAttributes:t.componentAttributes,styleProps:n.get(a),className:n.get(g),widgetInstanceProps:t.widgetInstanceProps,pageViewType:t.pageViewType,columnPath:t.columnPath,mounts:t.mounts}));var f=n.comment(),A=n.first_child(f);{var w=h=>{const E=n.derived(()=>n.get(r));var T=n.comment(),k=n.first_child(T);{var z=b=>{var v=ft(),I=n.child(v);n.component(I,()=>n.get(E),(R,x)=>{x(R,n.spread_props(()=>n.get(m)))}),n.reset(v),n.template_effect(R=>{n.set_class(v,1,n.clsx(n.get(c)||void 0)),n.set_style(v,R)},[()=>W(n.get(l))]),n.append(b,v)},C=b=>{var v=ft(),I=n.child(v);n.component(I,()=>n.get(E),(R,x)=>{x(R,n.spread_props(()=>n.get(m)))}),n.reset(v),n.template_effect(()=>n.set_class(v,1,n.clsx(n.get(c)))),n.append(b,v)},_=b=>{var v=n.comment(),I=n.first_child(v);n.component(I,()=>n.get(E),(R,x)=>{x(R,n.spread_props(()=>n.get(m)))}),n.append(b,v)};n.if(k,b=>{n.get(d)?b(z):!n.get(u)&&n.get(c)?b(C,1):b(_,-1)})}n.append(h,T)};n.if(A,h=>{n.get(r)&&h(w)})}n.append(e,f),n.pop()}var Mr=n.from_html("<div><!></div>"),jr=n.from_html("<div><!> <!></div>");function he(e,t){n.push(t,!0);const o=C=>{Pr(C,{get displayItemList(){return t.displayItemList},get isComposeMode(){return r()},get showDropContainers(){return i()},get isWithinCollection(){return s()},get deviceDisplayType(){return t.deviceDisplayType},children:(_,b)=>{var v=n.comment(),I=n.first_child(v);n.each(I,17,()=>t.displayItemList.rows,R=>R.id,(R,x)=>{Lr(R,{get row(){return n.get(x)},get isComposeMode(){return r()},get showDropContainers(){return i()},get isWithinCollection(){return s()},get deviceDisplayType(){return t.deviceDisplayType},children:($,ne)=>{var oe=n.comment(),ae=n.first_child(oe);n.each(ae,17,()=>n.get(x).columns,ee=>ee.id,(ee,V)=>{var ce=n.comment(),ke=n.first_child(ce);{var Re=y=>{const p=n.derived(()=>m(n.get(V)));var S=n.comment(),P=n.first_child(S);{var M=N=>{{let J=n.derived(()=>f(n.get(V).id));he(N,{get displayItemList(){return n.get(p)},get isComposeMode(){return r()},isWithinCollection:!0,get widgetCollections(){return t.widgetCollections},get showDropContainers(){return i()},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return n.get(J)}})}},O=N=>{{let J=n.derived(()=>g(n.get(V)).componentAttributes),ue=n.derived(()=>g(n.get(V)).styleProps),re=n.derived(()=>h(n.get(V).id)),lt=n.derived(A),at=n.derived(()=>w(n.get(V).id));to(N,{get componentType(){return n.get(V).type},get libraryId(){return n.get(V).libraryId},get componentAttributes(){return n.get(J)},get components(){return n.get(l)},get styleProps(){return n.get(ue)},get widgetInstanceProps(){return n.get(re)},get pageViewType(){return n.get(lt)},get columnPath(){return n.get(at)},get mounts(){return t.mounts}})}};n.if(P,N=>{n.get(p)?N(M):N(O,-1)})}n.append(y,S)},xe=n.derived(()=>u(n.get(V)));n.if(ke,y=>{n.get(xe)&&y(Re)})}n.append(ee,ce)}),n.append($,oe)},$$slots:{default:!0}})}),n.append(_,v)},$$slots:{default:!0}})};let r=n.prop(t,"isComposeMode",3,!1),s=n.prop(t,"isWithinCollection",3,!1),i=n.prop(t,"showDropContainers",3,!1);const l=n.derived(()=>pe(t.plugins).components),a=n.derived(()=>!r()&&Fn(t.displayItemList)&&!Pe({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType})),c=n.derived(()=>{const C=Fe({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType});return Hn({isWithinCollection:s(),baseDeclaresOwnHeight:rt({containerAttributes:t.displayItemList.containerAttributes,widgetContainerStyles:ot({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType,isComposeMode:r()})}),baseZIndex:C})}),d=n.derived(()=>{var b;const C=((b=t.displayItemList.overlayLayers)==null?void 0:b.layers)??[],_=Fe({containerAttributes:t.displayItemList.containerAttributes,deviceDisplayType:t.deviceDisplayType});return C.flatMap((v,I)=>Un({layer:v,deviceDisplayType:t.deviceDisplayType})?[]:[{index:I,layer:v,boxStyles:zn({zIndex:Kn(_,I),pointerEvents:Bn({containerAttributes:v.containerAttributes,deviceDisplayType:t.deviceDisplayType})})}])});function u(C){if(r()&&C.type===_e.DroppableBox)return!1;const{componentAttributesBasedOnDevice:_}=Ve({col:C,deviceDisplayType:t.deviceDisplayType,isComposeMode:r(),sourceComponentsPlugin:pe(t.plugins)}),b=!!_&&_["hide-component-3-resolutions"]==="true";return!(!r()&&b)}function g(C){const{componentAttributesBasedOnDevice:_,componentStyles:b}=Ve({col:C,deviceDisplayType:t.deviceDisplayType,isComposeMode:r(),sourceComponentsPlugin:pe(t.plugins)});return{componentAttributes:_,styleProps:b}}function m(C){const _=Qe(C.type);if(!(_!=null&&_.length))return null;const b=C.collection??t.widgetCollections[_];if(!b)throw new Error(`DisplayCollection - Collection with ID ${_} not found in widgetCollections. Available collections: ${Object.keys(t.widgetCollections).join(", ")}`);return!b.collectionRows||!kn(b.collectionRows)?null:b.collectionRows}function f(C){return[...t.ancestorColumnIds??[],C]}function A(){return r()?Me.Compose:Me.RenderedPage}function w(C){if(!(r()||!C))return[...t.ancestorColumnIds??[],C].join(le)}function h(C){return Yn({widgetInstanceProps:Gn({componentProps:t.componentProps,ancestorColumnIds:t.ancestorColumnIds,columnId:C}),placeholderValues:r()?void 0:t.placeholderValues})}var E=n.comment(),T=n.first_child(E);{var k=C=>{var _=jr(),b=n.child(_);o(b);var v=n.sibling(b,2);n.each(v,17,()=>n.get(d),I=>I.index,(I,R)=>{var x=Mr(),$=n.child(x);he($,{get displayItemList(){return n.get(R).layer},get isComposeMode(){return r()},isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return t.ancestorColumnIds}}),n.reset(x),n.template_effect(ne=>{n.set_attribute(x,"data-rulecms-overlay-layer",n.get(R).index),n.set_style(x,ne)},[()=>W(n.get(R).boxStyles)]),n.append(I,x)}),n.reset(_),n.template_effect(I=>n.set_style(_,I),[()=>W(n.get(c))]),n.append(C,_)},z=C=>{o(C)};n.if(T,C=>{n.get(a)?C(k):C(z,-1)})}n.append(e,E),n.pop()}function be(e,t){n.push(t,!0);var o=n.comment(),r=n.first_child(o);{var s=i=>{he(i,{get displayItemList(){return t.displayItemList},get isComposeMode(){return t.isComposeMode},get isWithinCollection(){return t.isWithinCollection},get widgetCollections(){return t.widgetCollections},get showDropContainers(){return t.showDropContainers},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get plugins(){return t.plugins},get deviceDisplayType(){return t.deviceDisplayType},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues},get ancestorColumnIds(){return t.ancestorColumnIds}})};n.if(r,i=>{var l,a;(a=(l=t.displayItemList)==null?void 0:l.rows)!=null&&a.length&&i(s)})}n.append(e,o),n.pop()}function no(e,t){n.push(t,!0);var o=n.comment(),r=n.first_child(o);n.each(r,17,()=>t.stylesheets??[],n.index,(s,i)=>{var l=n.comment(),a=n.first_child(l);n.html(a,()=>B(n.get(i),"data-rulecms-library-stylesheet")),n.append(s,l)}),n.append(e,o),n.pop()}var Vr=n.from_html("<div><!></div>"),gt=n.from_html("<!> <!>",1);function oo(e,t){const o=n.props_id();n.push(t,!0);const r=["Phone","Tablet","Desktop"],s=`rulecms-bp-${o.replace(/[^a-zA-Z0-9_-]/g,"")}`,i=n.derived(()=>t.scopeIdInput??s),l=n.derived(()=>Zn(t.displayItemList,t.widgetCollections)),a=n.derived(()=>wr(n.get(i)));var c=gt(),d=n.first_child(c);{let f=n.derived(()=>{var A;return(A=t.plugins.sourceComponents)==null?void 0:A.stylesheets});no(d,{get stylesheets(){return n.get(f)}})}var u=n.sibling(d,2);{var g=f=>{be(f,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",deviceDisplayType:"Desktop",get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})},m=f=>{var A=gt(),w=n.first_child(A);n.html(w,()=>B(n.get(a)));var h=n.sibling(w,2);n.each(h,16,()=>r,E=>E,(E,T)=>{var k=Vr(),z=n.child(k);be(z,{get displayItemList(){return t.displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return t.widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get deviceDisplayType(){return T},get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}}),n.reset(k),n.template_effect(C=>n.set_class(k,1,C),[()=>`${n.get(i)}-${T.toLowerCase()}`]),n.append(E,k)}),n.append(f,A)};n.if(u,f=>{n.get(l)?f(m,-1):f(g)})}n.append(e,c),n.pop()}function Fr(e,t,o){if(e)return"Phone";if(t)return"Tablet";const r=(o==null?void 0:o.toLowerCase())||"desktop";return r==="phone"?"Phone":r==="tablet"?"Tablet":"Desktop"}const Kr=`(max-width: ${et})`,Br=`(max-width: ${tt})`;var Ur=n.from_html("<!> <!>",1);function ro(e,t){n.push(t,!0);let o=n.state("Desktop"),r,s;function i(){n.set(o,Fr((r==null?void 0:r.matches)??!1,(s==null?void 0:s.matches)??!1,t.reduxDeviceDisplayType),!0)}n.user_effect(()=>(typeof matchMedia=="function"&&(r=matchMedia(Kr),s=matchMedia(Br),r.addEventListener("change",i),s.addEventListener("change",i)),i(),()=>{r==null||r.removeEventListener("change",i),s==null||s.removeEventListener("change",i)}));var l=Ur(),a=n.first_child(l);{var c=u=>{{let g=n.derived(()=>{var m;return(m=t.plugins.sourceComponents)==null?void 0:m.stylesheets});no(u,{get stylesheets(){return n.get(g)}})}};n.if(a,u=>{t.isWithinCollection||u(c)})}var d=n.sibling(a,2);be(d,{get displayItemList(){return t.displayItemList},get isComposeMode(){return t.isComposeMode},get isWithinCollection(){return t.isWithinCollection},get widgetCollections(){return t.widgetCollections},get showDropContainers(){return t.showDropContainers},get reduxDeviceDisplayType(){return t.reduxDeviceDisplayType},get deviceDisplayType(){return n.get(o)},get plugins(){return t.plugins},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}}),n.append(e,l),n.pop()}function so(e){return e!==!1}const Hr=["utilities","components"],zr=new Set(Hr),io=e=>typeof e=="string"&&zr.has(e),Gr=e=>e.split(`
10
10
  `).map(t=>t.length>0?` ${t}`:t).join(`
11
- `),Go=(e,t)=>e?sr(t)?`@layer ${t} {
12
- ${zo(e)}
13
- }`:e:null,Yo=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),Xo=e=>e.replace(/[^A-Za-z0-9_-]/g,t=>`\\${t}`),Jo=["</","<script","@import","javascript:","vbscript:","expression("],qo=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Zo=/[\s{};"]/,Qo=/^[A-Za-z0-9_:%./[\]%-]+$/,$o=e=>{let t=0;for(const r of e)if(r==="{")t+=1;else if(r==="}"&&(t-=1,t<0))return!1;return t===0},es=e=>{const t=e.startsWith(".")?e.slice(1):e;return!t||t.length>200||t.startsWith(".")||Zo.test(t)?!1:Qo.test(t)},ts=e=>{const t=e.trim();if(!t||t.length>4e3||qo.test(t)||!$o(t))return!1;const r=t.toLowerCase();return!Jo.some(o=>r.includes(o))},ns=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.startsWith(".")?r.slice(1):r.trim();if(!es(s)||typeof o!="string")continue;const i=o.trim();ts(i)&&(t[s]=i)}return t},rs=e=>e.split(`
11
+ `),Yr=(e,t)=>e?io(t)?`@layer ${t} {
12
+ ${Gr(e)}
13
+ }`:e:null,Xr=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),Jr=e=>{const t=e.replace(/[^A-Za-z0-9_-]/g,o=>`\\${o}`);return/^[0-9]/.test(t)?`\\3${t[0]} ${t.slice(1)}`:/^-[0-9]/.test(t)?`-\\3${t[1]} ${t.slice(2)}`:t},qr=["</","<script","@import","javascript:","vbscript:","expression("],Zr=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Qr=/[\s{};"]/,$r=/^[A-Za-z0-9_:%./[\]%-]+$/,es=e=>{let t=0;for(const o of e)if(o==="{")t+=1;else if(o==="}"&&(t-=1,t<0))return!1;return t===0},ts=e=>{const t=e.startsWith(".")?e.slice(1):e;return!t||t.length>200||t.startsWith(".")||Qr.test(t)?!1:$r.test(t)},ns=e=>{const t=e.trim();if(!t||t.length>4e3||Zr.test(t)||!es(t))return!1;const o=t.toLowerCase();return!qr.some(r=>o.includes(r))},os=e=>{if(!e)return{};const t={};for(const[o,r]of Object.entries(e)){const s=o.startsWith(".")?o.slice(1):o.trim();if(!ts(s)||typeof r!="string")continue;const i=r.trim();ns(i)&&(t[s]=i)}return t},rs=e=>e.split(`
14
14
  `).map(t=>` ${t}`).join(`
15
- `),os=(e,t,r,o)=>{if(!or(r))return null;const s=ns(t),i=Object.keys(s);if(i.length===0||!e)return null;const l=`[data-rulecms-published-key="${Yo(e)}"]`,a=i.sort((u,d)=>u.localeCompare(d)).map(u=>`${l} .${Xo(u)} {
16
- ${rs(s[u])}
15
+ `),ss=(e,t,o,r)=>{if(!so(o))return null;const s=os(t),i=Object.keys(s);if(i.length===0||!e)return null;const l=`[data-rulecms-published-key="${Xr(e)}"]`,a=i.map(c=>`${l} .${Jr(c)} {
16
+ ${rs(s[c])}
17
17
  }`).join(`
18
- `);return Go(a,o)};function ss(e,t){n.push(t,!0);const r=n.derived(()=>os(t.publishedKey,t.classes,void 0,t.classLayer));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-class-definitions":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function st(e){return e!==!1}const ir=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),is=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-sans-serif","ui-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),ls=/^[a-zA-Z_\u00A0-\uFFFF-][a-zA-Z0-9_\u00A0-\uFFFF-]*$/,as=/url\(|@|[{};\\<>]|javascript:/i,cs=/url\(|@|[{};\\<>]|javascript:|expression\(/i,ds=/^--[A-Za-z_][\w-]*$/,us=/^[A-Za-z0-9 ]+$/,fs=new Set([100,200,300,400,500,600,700,800,900]),gs=4,ps=8,ms=255,Be=e=>is.has(e.toLowerCase())||ls.test(e)?e:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,gt=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=80&&!e.includes(",")&&!as.test(e),ys=e=>typeof e=="string"&&ds.test(e.trim())&&e.trim().length<=80,hs=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=400&&!cs.test(e),bs=e=>typeof e!="number"||!Number.isInteger(e)||e<0||e>ms?null:e,_s=(e,t,r)=>{if(!Array.isArray(e))return[];const o=[];for(const s of e){if(!s||typeof s!="object"||o.length>=gs)continue;const i=s;if(!ys(i.name))continue;const l=i.name.trim();if(t.has(l))continue;const a=[],u=new Set;for(const c of i.overrideColors??[]){if(a.length>=ps)break;const f=bs(c==null?void 0:c.index);f===null||u.has(f)||!hs(c==null?void 0:c.color)||(u.add(f),a.push({index:f,color:c.color.trim()}))}a.sort((c,f)=>c.index-f.index);const d=i.applyToWidget===!0&&!r.current;d&&(r.current=!0),t.add(l),o.push({name:l,...a.length>0?{overrideColors:a}:{},...d?{applyToWidget:!0}:{}})}return o},Pe=e=>{var l;if(!Array.isArray(e))return[];const t=[],r=new Set,o=new Set,s={current:!1};let i=!1;for(const a of e){if(!a||!gt(a.family))continue;const u=a.family.trim(),d=u.toLowerCase();if(r.has(d)||t.length>=12)continue;const c=(a.fallbacks??[]).filter(gt).slice(0,8),f=typeof a.cssVariable=="string"&&Z(a.cssVariable.trim())?a.cssVariable.trim():void 0;let p={kind:"stack-only"};if(((l=a.source)==null?void 0:l.kind)==="google"){if(!us.test(u))continue;const b=(Array.isArray(a.source.weights)?a.source.weights:[]).filter(_=>typeof _=="number"&&fs.has(_)).filter((_,T,N)=>N.indexOf(_)===T).sort((_,T)=>_-T);if(b.length===0)continue;p={kind:"google",weights:b}}r.add(d);const g=a.applyToWidget===!0&&!i;g&&(i=!0);const E=_s(a.palettes,o,s);t.push({family:u,...f?{cssVariable:f}:{},fallbacks:c,applyToWidget:g,source:p,...E.length>0?{palettes:E}:{}})}return t},Cs=e=>{const t=Pe(e).filter(r=>r.source.kind==="google").map(r=>{const o=r.source.kind==="google"?r.source.weights.join(";"):"400";return`family=${r.family.replace(/ /g,"+")}:wght@${o}`});return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`},vs=e=>[Be(e.family),...(e.fallbacks??[]).map(Be)].join(", "),As=e=>{const t=[];for(const r of e)for(const o of r.palettes??[]){const s=[` font-family: ${Be(r.family)};`];if(o.overrideColors&&o.overrideColors.length>0){const i=o.overrideColors.map(l=>`${l.index} ${l.color}`).join(", ");s.push(` override-colors: ${i};`)}t.push(`@font-palette-values ${o.name} {
18
+ `);return Yr(a,r)};function is(e,t){n.push(t,!0);const o=n.derived(()=>ss(t.publishedKey,t.classes,void 0,t.classLayer));var r=n.comment(),s=n.first_child(r);{var i=l=>{var a=n.comment(),c=n.first_child(a);n.html(c,()=>B(n.get(o),"data-rulecms-project-class-definitions")),n.append(l,a)};n.if(s,l=>{n.get(o)&&l(i)})}n.append(e,r),n.pop()}function it(e){return e!==!1}const lo=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),ls=new Set(["serif","sans-serif","monospace","cursive","fantasy","system-ui","ui-sans-serif","ui-serif","ui-monospace","ui-rounded","emoji","math","fangsong"]),as=/^[a-zA-Z_\u00A0-\uFFFF-][a-zA-Z0-9_\u00A0-\uFFFF-]*$/,cs=/url\(|@|[{};\\<>]|javascript:/i,us=/url\(|@|[{};\\<>]|javascript:|expression\(/i,ds=/^--[A-Za-z_][\w-]*$/,fs=/^[A-Za-z0-9 ]+$/,gs=new Set([100,200,300,400,500,600,700,800,900]),ps=4,ms=8,ys=255,Ue=e=>ls.has(e.toLowerCase())||as.test(e)?e:`"${e.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`,pt=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=80&&!e.includes(",")&&!cs.test(e),hs=e=>typeof e=="string"&&ds.test(e.trim())&&e.trim().length<=80,bs=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=400&&!us.test(e),Cs=e=>typeof e!="number"||!Number.isInteger(e)||e<0||e>ys?null:e,_s=(e,t,o)=>{if(!Array.isArray(e))return[];const r=[];for(const s of e){if(!s||typeof s!="object"||r.length>=ps)continue;const i=s;if(!hs(i.name))continue;const l=i.name.trim();if(t.has(l))continue;const a=[],c=new Set;for(const u of i.overrideColors??[]){if(a.length>=ms)break;const g=Cs(u==null?void 0:u.index);g===null||c.has(g)||!bs(u==null?void 0:u.color)||(c.add(g),a.push({index:g,color:u.color.trim()}))}a.sort((u,g)=>u.index-g.index);const d=i.applyToWidget===!0&&!o.current;d&&(o.current=!0),t.add(l),r.push({name:l,...a.length>0?{overrideColors:a}:{},...d?{applyToWidget:!0}:{}})}return r},De=e=>{var l;if(!Array.isArray(e))return[];const t=[],o=new Set,r=new Set,s={current:!1};let i=!1;for(const a of e){if(!a||!pt(a.family))continue;const c=a.family.trim(),d=c.toLowerCase();if(o.has(d)||t.length>=12)continue;const u=(a.fallbacks??[]).filter(pt).slice(0,8),g=typeof a.cssVariable=="string"&&Q(a.cssVariable.trim())?a.cssVariable.trim():void 0;let m={kind:"stack-only"};if(((l=a.source)==null?void 0:l.kind)==="google"){if(!fs.test(c))continue;const h=(Array.isArray(a.source.weights)?a.source.weights:[]).filter(E=>typeof E=="number"&&gs.has(E)).filter((E,T,k)=>k.indexOf(E)===T).sort((E,T)=>E-T);if(h.length===0)continue;m={kind:"google",weights:h}}o.add(d);const f=a.applyToWidget===!0&&!i;f&&(i=!0);const A=_s(a.palettes,r,s);t.push({family:c,...g?{cssVariable:g}:{},fallbacks:u,applyToWidget:f,source:m,...A.length>0?{palettes:A}:{}})}return t},vs=e=>{const t=De(e).filter(o=>o.source.kind==="google").map(o=>{const r=o.source.kind==="google"?o.source.weights.join(";"):"400";return`family=${o.family.replace(/ /g,"+")}:wght@${r}`});return t.length===0?null:`https://fonts.googleapis.com/css2?${t.join("&")}&display=swap`},As=e=>[Ue(e.family),...(e.fallbacks??[]).map(Ue)].join(", "),Es=e=>{const t=[];for(const o of e)for(const r of o.palettes??[]){const s=[` font-family: ${Ue(o.family)};`];if(r.overrideColors&&r.overrideColors.length>0){const i=r.overrideColors.map(l=>`${l.index} ${l.color}`).join(", ");s.push(` override-colors: ${i};`)}t.push(`@font-palette-values ${r.name} {
19
19
  ${s.join(`
20
20
  `)}
21
21
  }`)}return t.length>0?t.join(`
22
22
 
23
- `):null},Es=e=>{for(const t of e)for(const r of t.palettes??[])if(r.applyToWidget)return r.name},ws=(e,t,r)=>{if(!st(r)||!e)return null;const o=Pe(t),s=[];for(const d of o){const c=vs(d);d.cssVariable&&s.push(` ${d.cssVariable}: ${c};`),d.applyToWidget&&s.push(` font-family: ${d.cssVariable?`var(${d.cssVariable})`:c};`)}const i=Es(o);i&&s.push(` font-palette: ${i};`);const l=As(o),a=`[data-rulecms-published-key="${ir(e)}"] > *`,u=s.length>0?`${a} {
23
+ `):null},ws=e=>{for(const t of e)for(const o of t.palettes??[])if(o.applyToWidget)return o.name},Ss=(e,t,o)=>{if(!it(o)||!e)return null;const r=De(t),s=[];for(const d of r){const u=As(d);d.cssVariable&&s.push(` ${d.cssVariable}: ${u};`),d.applyToWidget&&s.push(` font-family: ${d.cssVariable?`var(${d.cssVariable})`:u};`)}const i=ws(r);i&&s.push(` font-palette: ${i};`);const l=Es(r),a=`[data-rulecms-published-key="${lo(e)}"] > *`,c=s.length>0?`${a} {
24
24
  ${s.join(`
25
25
  `)}
26
- }`:null;return!l&&!u?null:l?u?`${l}
26
+ }`:null;return!l&&!c?null:l?c?`${l}
27
27
 
28
- ${u}`:l:u};var Ss=n.from_html('<link rel="stylesheet" data-rulecms-project-fonts=""/>'),Ts=n.from_html("<!> <!>",1);function Is(e,t){n.push(t,!0);const r=n.derived(()=>Pe(t.fonts)),o=n.derived(()=>st(t.includeFontFaces)?Cs(n.get(r)):null),s=n.derived(()=>ws(t.publishedKey,n.get(r),t.includeFontFaces));var i=Ts(),l=n.first_child(i);{var a=c=>{var f=Ss();n.template_effect(()=>n.set_attribute(f,"href",n.get(o))),n.append(c,f)};n.if(l,c=>{n.get(o)&&c(a)})}var u=n.sibling(l,2);{var d=c=>{var f=n.comment(),p=n.first_child(f);n.element(p,()=>"style",!1,(g,E)=>{n.attribute_effect(g,()=>({"data-rulecms-project-fonts":""}));var A=n.text();n.template_effect(()=>n.set_text(A,n.get(s))),n.append(E,A)}),n.append(c,f)};n.if(u,c=>{n.get(s)&&c(d)})}n.append(e,i),n.pop()}function lr(e){return e!==!1}const Ps=80,Ds=4e3,xs=32,ar=["url(","@import","@font-face","@media","@keyframes","</","<script","javascript:","expression(","behavior:"],Ls=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,ks=/^[A-Za-z_][\w-]*$/,Rs=e=>{let t=0;for(const r of e)if(r==="{")t+=1;else if(r==="}"&&(t-=1,t<0))return!1;return t===0},Os=e=>{if(!e||e.length>Ps||e.includes("@")||e.includes(".")||/\s/.test(e))return!1;const t=e.toLowerCase();return ar.some(r=>t.includes(r))?!1:ks.test(e)},Ws=e=>{const t=e.trim();if(t==="")return!1;const r=t.toLowerCase();if(r==="from"||r==="to")return!0;const o=t.match(/^(\d{1,3}(?:\.\d+)?)%$/);if(!o)return!1;const s=Number(o[1]);return s>=0&&s<=100},Ns=e=>{let t=0;const r=e.length;let o=0;const s=()=>{for(;t<r&&/\s/.test(e[t]);)t+=1};for(s();t<r;){const i=e.indexOf("{",t);if(i===-1||!e.slice(t,i).trim().split(",").every(d=>Ws(d)))return!1;t=i+1;const a=e.indexOf("}",t);if(a===-1)return!1;const u=e.slice(t,a);if(u.includes("{")||u.includes("}")||u.includes("@"))return!1;t=a+1,o+=1,s()}return o>0},Ms=e=>{const t=e.trim();if(!t||t.length>Ds||Ls.test(t)||!Rs(t))return!1;const r=t.toLowerCase();return ar.some(o=>r.includes(o))||t.includes("@")?!1:Ns(t)},cr=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.trim();if(!Os(s)||t[s]!==void 0||typeof o!="string")continue;const i=o.trim();if(Ms(i)&&(t[s]=i,Object.keys(t).length===xs))break}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},js=e=>e.split(`
28
+ ${c}`:l:c};var Ts=n.from_html('<link rel="stylesheet" data-rulecms-project-fonts=""/>'),Is=n.from_html("<!> <!>",1);function Ps(e,t){n.push(t,!0);const o=n.derived(()=>De(t.fonts)),r=n.derived(()=>it(t.includeFontFaces)?vs(n.get(o)):null),s=n.derived(()=>Ss(t.publishedKey,n.get(o),t.includeFontFaces));var i=Is(),l=n.first_child(i);{var a=u=>{var g=Ts();n.template_effect(()=>n.set_attribute(g,"href",n.get(r))),n.append(u,g)};n.if(l,u=>{n.get(r)&&u(a)})}var c=n.sibling(l,2);{var d=u=>{var g=n.comment(),m=n.first_child(g);n.html(m,()=>B(n.get(s),"data-rulecms-project-fonts")),n.append(u,g)};n.if(c,u=>{n.get(s)&&u(d)})}n.append(e,i),n.pop()}function ao(e){return e!==!1}const Ds=80,Ls=4e3,ks=32,co=["url(","@import","@font-face","@media","@keyframes","</","<script","javascript:","expression(","behavior:"],Rs=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,xs=/^[A-Za-z_][\w-]*$/,Os=e=>{let t=0;for(const o of e)if(o==="{")t+=1;else if(o==="}"&&(t-=1,t<0))return!1;return t===0},Ns=e=>{if(!e||e.length>Ds||e.includes("@")||e.includes(".")||/\s/.test(e))return!1;const t=e.toLowerCase();return co.some(o=>t.includes(o))?!1:xs.test(e)},Ws=e=>{const t=e.trim();if(t==="")return!1;const o=t.toLowerCase();if(o==="from"||o==="to")return!0;const r=t.match(/^(\d{1,3}(?:\.\d+)?)%$/);if(!r)return!1;const s=Number(r[1]);return s>=0&&s<=100},Ms=e=>{let t=0;const o=e.length;let r=0;const s=()=>{for(;t<o&&/\s/.test(e[t]);)t+=1};for(s();t<o;){const i=e.indexOf("{",t);if(i===-1||!e.slice(t,i).trim().split(",").every(d=>Ws(d)))return!1;t=i+1;const a=e.indexOf("}",t);if(a===-1)return!1;const c=e.slice(t,a);if(c.includes("{")||c.includes("}")||c.includes("@"))return!1;t=a+1,r+=1,s()}return r>0},js=e=>{const t=e.trim();if(!t||t.length>Ls||Rs.test(t)||!Os(t))return!1;const o=t.toLowerCase();return co.some(r=>o.includes(r))||t.includes("@")?!1:Ms(t)},uo=e=>{if(!e)return{};const t={};for(const[o,r]of Object.entries(e)){const s=o.trim();if(!Ns(s)||t[s]!==void 0||typeof r!="string")continue;const i=r.trim();if(js(i)&&(t[s]=i,Object.keys(t).length===ks))break}return Object.fromEntries(Object.entries(t).sort(([o],[r])=>o.localeCompare(r)))},Vs=e=>e.split(`
29
29
  `).map(t=>` ${t}`).join(`
30
- `),Vs=(e,t,r)=>{if(!lr(r))return null;const o=cr(t),s=Object.keys(o);return s.length===0?null:s.map(i=>`@keyframes ${i} {
31
- ${js(o[i])}
30
+ `),Fs=(e,t,o)=>{if(!ao(o))return null;const r=uo(t),s=Object.keys(r);return s.length===0?null:s.map(i=>`@keyframes ${i} {
31
+ ${Vs(r[i])}
32
32
  }`).join(`
33
33
 
34
- `)};function Fs(e,t){n.push(t,!0);const r=n.derived(()=>Vs(t.publishedKey,t.keyframes));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-keyframes":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}const dr=e=>e!==!1,Ks=80,Bs=2e3,Us=16,ur=["url(","@","</","<script","javascript:","expression("],Hs=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,zs=/^--[A-Za-z_][\w-]*$/,Gs=e=>{for(const t of e)if(t==="{"||t==="}")return!1;return!0},Ys=e=>{if(!e||e.length>Ks||e.includes("@")||e.includes(".")||/\s/.test(e))return!1;const t=e.toLowerCase();return ur.some(r=>t.includes(r))?!1:zs.test(e)},Xs=e=>{const t=e.trim();if(!t||t.length>Bs||Hs.test(t)||!Gs(t))return!1;const r=t.toLowerCase();return!ur.some(o=>r.includes(o))},fr=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){const s=r.trim();if(!Ys(s)||t[s]!==void 0||typeof o!="string")continue;const i=o.trim();if(Xs(i)&&(t[s]=i,Object.keys(t).length===Us))break}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},Js=e=>e.split(`
34
+ `)};function Ks(e,t){n.push(t,!0);const o=n.derived(()=>Fs(t.publishedKey,t.keyframes));var r=n.comment(),s=n.first_child(r);{var i=l=>{var a=n.comment(),c=n.first_child(a);n.html(c,()=>B(n.get(o),"data-rulecms-project-keyframes")),n.append(l,a)};n.if(s,l=>{n.get(o)&&l(i)})}n.append(e,r),n.pop()}const fo=e=>e!==!1,Bs=80,Us=2e3,Hs=16,go=["url(","@","</","<script","javascript:","expression("],zs=/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/,Gs=/^--[A-Za-z_][\w-]*$/,Ys=e=>{for(const t of e)if(t==="{"||t==="}")return!1;return!0},Xs=e=>{if(!e||e.length>Bs||e.includes("@")||e.includes(".")||/\s/.test(e))return!1;const t=e.toLowerCase();return go.some(o=>t.includes(o))?!1:Gs.test(e)},Js=e=>{const t=e.trim();if(!t||t.length>Us||zs.test(t)||!Ys(t))return!1;const o=t.toLowerCase();return!go.some(r=>o.includes(r))},po=e=>{if(!e)return{};const t={};for(const[o,r]of Object.entries(e)){const s=o.trim();if(!Xs(s)||t[s]!==void 0||typeof r!="string")continue;const i=r.trim();if(Js(i)&&(t[s]=i,Object.keys(t).length===Hs))break}return Object.fromEntries(Object.entries(t).sort(([o],[r])=>o.localeCompare(r)))},qs=e=>e.split(`
35
35
  `).map(t=>` ${t}`).join(`
36
- `),qs=(e,t,r)=>{if(!dr(r))return null;const o=fr(t),s=Object.keys(o);return s.length===0?null:s.map(i=>`@position-try ${i} {
37
- ${Js(o[i])}
36
+ `),Zs=(e,t,o)=>{if(!fo(o))return null;const r=po(t),s=Object.keys(r);return s.length===0?null:s.map(i=>`@position-try ${i} {
37
+ ${qs(r[i])}
38
38
  }`).join(`
39
39
 
40
- `)};function Zs(e,t){n.push(t,!0);const r=n.derived(()=>qs(t.publishedKey,t.positionTry));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-position-try":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function gr(e){return e!==!1}const Qs=["*","<number>","<integer>","<length>","<percentage>","<length-percentage>","<color>","<angle>","<time>","<transform-function>","<transform-list>"],$s=new Set(Qs),ei=/[{};]/,ti=40,ni=200,ri=e=>typeof e=="string"&&$s.has(e),oi=(e,t)=>t!=="*"&&e===""?!1:t==="*"&&e===""?!0:!(e.length>ni||ei.test(e)||e.includes("url(")||e.includes("@")),pr=e=>{if(!Array.isArray(e))return[];const t=[],r=new Set;for(const o of e){if(!o||typeof o.name!="string"||!Z(o.name.trim()))continue;const s=o.name.trim();if(r.has(s)||t.length>=ti||!ri(o.syntax)||typeof o.inherits!="boolean")continue;const i=typeof o.initialValue=="string"?o.initialValue.trim():"";oi(i,o.syntax)&&(r.add(s),t.push({name:s,syntax:o.syntax,inherits:o.inherits,initialValue:i}))}return t},si=e=>{const t=[`@property ${e.name} {`,` syntax: "${e.syntax}";`,` inherits: ${e.inherits?"true":"false"};`];return e.initialValue!==""&&t.push(` initial-value: ${e.initialValue};`),t.push("}"),t.join(`
41
- `)},ii=(e,t,r)=>{if(!gr(r))return null;const o=pr(t);return o.length===0?null:o.map(si).join(`
40
+ `)};function Qs(e,t){n.push(t,!0);const o=n.derived(()=>Zs(t.publishedKey,t.positionTry));var r=n.comment(),s=n.first_child(r);{var i=l=>{var a=n.comment(),c=n.first_child(a);n.html(c,()=>B(n.get(o),"data-rulecms-project-position-try")),n.append(l,a)};n.if(s,l=>{n.get(o)&&l(i)})}n.append(e,r),n.pop()}function mo(e){return e!==!1}const $s=["*","<number>","<integer>","<length>","<percentage>","<length-percentage>","<color>","<angle>","<time>","<transform-function>","<transform-list>"],ei=new Set($s),ti=/[{};]/,ni=200,oi=200,ri=e=>typeof e=="string"&&ei.has(e),si=(e,t)=>t!=="*"&&e===""?!1:t==="*"&&e===""?!0:!(e.length>oi||ti.test(e)||e.includes("url(")||e.includes("@")),yo=e=>{if(!Array.isArray(e))return[];const t=[],o=new Set;for(const r of e){if(!r||typeof r.name!="string"||!Q(r.name.trim()))continue;const s=r.name.trim();if(o.has(s)||t.length>=ni||!ri(r.syntax)||typeof r.inherits!="boolean")continue;const i=typeof r.initialValue=="string"?r.initialValue.trim():"";si(i,r.syntax)&&(o.add(s),t.push({name:s,syntax:r.syntax,inherits:r.inherits,initialValue:i}))}return t},ii=e=>{const t=[`@property ${e.name} {`,` syntax: "${e.syntax}";`,` inherits: ${e.inherits?"true":"false"};`];return e.initialValue!==""&&t.push(` initial-value: ${e.initialValue};`),t.push("}"),t.join(`
41
+ `)},li=(e,t,o)=>{if(!mo(o))return null;const r=yo(t);return r.length===0?null:r.map(ii).join(`
42
42
 
43
- `)};function li(e,t){n.push(t,!0);const r=n.derived(()=>ii(t.publishedKey,t.cssProperties));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-css-properties":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function mr(e){return e!==!1}const yr=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),ai=/[{};]/,ci=e=>{if(!e)return{};const t={};for(const[r,o]of Object.entries(e)){if(!Z(r)||typeof o!="string")continue;const s=o.trim();s===""||ai.test(s)||(t[r.trim()]=s)}return t},di=(e,t,r)=>{if(!mr(r))return null;const o=ci(t),s=Object.keys(o);if(s.length===0||!e)return null;const i=`[data-rulecms-published-key="${yr(e)}"] > *`,l=s.sort((a,u)=>a.localeCompare(u)).map(a=>` ${a}: ${o[a]};`).join(`
43
+ `)};function ai(e,t){n.push(t,!0);const o=n.derived(()=>li(t.publishedKey,t.cssProperties));var r=n.comment(),s=n.first_child(r);{var i=l=>{var a=n.comment(),c=n.first_child(a);n.html(c,()=>B(n.get(o),"data-rulecms-project-css-properties")),n.append(l,a)};n.if(s,l=>{n.get(o)&&l(i)})}n.append(e,r),n.pop()}function ho(e){return e!==!1}const bo=e=>e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),ci=/[{};]/,ui=e=>{if(!e)return{};const t={};for(const[o,r]of Object.entries(e)){if(!Q(o)||typeof r!="string")continue;const s=r.trim();s===""||ci.test(s)||(t[o.trim()]=s)}return t},di=(e,t,o)=>{if(!ho(o))return null;const r=ui(t),s=Object.keys(r);if(s.length===0||!e)return null;const i=`[data-rulecms-published-key="${bo(e)}"] > *`,l=s.sort((a,c)=>a.localeCompare(c)).map(a=>` ${a}: ${r[a]};`).join(`
44
44
  `);return`${i} {
45
45
  ${l}
46
- }`};function hr(e){return e!==!1}const ui=5,fi=200,gi=[{kind:"prefers-color-scheme",value:"dark"},{kind:"prefers-color-scheme",value:"light"},{kind:"html-class",value:"dark"},{kind:"data-theme",value:"dark"},{kind:"data-theme",value:"light"}],pi=/[{};]/,mi=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return gi.some(r=>r.kind===t.kind&&r.value===t.value)},yi=e=>{if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[r,o]of Object.entries(e)){if(!Z(r)||typeof o!="string")continue;const s=o.trim();s===""||pi.test(s)||s.includes("url(")||s.includes("@")||(t[r.trim()]=s)}return Object.fromEntries(Object.entries(t).sort(([r],[o])=>r.localeCompare(o)))},br=e=>{if(!Array.isArray(e))return[];const t=[],r=new Set;let o=0;for(const s of e){if(!s||!mi(s.condition))continue;const i=`${s.condition.kind}:${s.condition.value}`;if(r.has(i))continue;const l=yi(s.variables),a=o+Object.keys(l).length;if(!(Object.keys(l).length===0||a>fi)&&(r.add(i),o=a,t.push({condition:s.condition,variables:l}),t.length===ui))break}return t},hi=(e,t)=>{const r=Object.entries(e).map(([o,s])=>` ${o}: ${s};`);return`${t} {
47
- ${r.join(`
46
+ }`};function Co(e){return e!==!1}const fi=5,gi=200,pi=[{kind:"prefers-color-scheme",value:"dark"},{kind:"prefers-color-scheme",value:"light"},{kind:"html-class",value:"dark"},{kind:"data-theme",value:"dark"},{kind:"data-theme",value:"light"}],mi=/[{};]/,yi=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return pi.some(o=>o.kind===t.kind&&o.value===t.value)},hi=e=>{if(!e||typeof e!="object"||Array.isArray(e))return{};const t={};for(const[o,r]of Object.entries(e)){if(!Q(o)||typeof r!="string")continue;const s=r.trim();s===""||mi.test(s)||s.includes("url(")||s.includes("@")||(t[o.trim()]=s)}return Object.fromEntries(Object.entries(t).sort(([o],[r])=>o.localeCompare(r)))},_o=e=>{if(!Array.isArray(e))return[];const t=[],o=new Set;let r=0;for(const s of e){if(!s||!yi(s.condition))continue;const i=`${s.condition.kind}:${s.condition.value}`;if(o.has(i))continue;const l=hi(s.variables),a=r+Object.keys(l).length;if(!(Object.keys(l).length===0||a>gi)&&(o.add(i),r=a,t.push({condition:s.condition,variables:l}),t.length===fi))break}return t},bi=(e,t)=>{const o=Object.entries(e).map(([r,s])=>` ${r}: ${s};`);return`${t} {
47
+ ${o.join(`
48
48
  `)}
49
- }`},bi=e=>e.split(`
49
+ }`},Ci=e=>e.split(`
50
50
  `).map(t=>` ${t}`).join(`
51
- `),_i=(e,t)=>{const r=hi(e.variables,t),{kind:o,value:s}=e.condition;return o==="prefers-color-scheme"?`@media (prefers-color-scheme: ${s}) {
52
- ${bi(r)}
53
- }`:o==="html-class"?`html.${s} ${r}`:`[data-theme="${s}"] ${r}`},Ci=(e,t,r)=>{if(!hr(r)||!e)return null;const o=br(t);if(o.length===0)return null;const s=`[data-rulecms-published-key="${yr(e)}"] > *`;return o.map(i=>_i(i,s)).join(`
51
+ `),_i=(e,t)=>{const o=bi(e.variables,t),{kind:r,value:s}=e.condition;return r==="prefers-color-scheme"?`@media (prefers-color-scheme: ${s}) {
52
+ ${Ci(o)}
53
+ }`:r==="html-class"?`html.${s} ${o}`:`[data-theme="${s}"] ${o}`},vi=(e,t,o)=>{if(!Co(o)||!e)return null;const r=_o(t);if(r.length===0)return null;const s=`[data-rulecms-published-key="${bo(e)}"] > *`;return r.map(i=>_i(i,s)).join(`
54
54
 
55
- `)};function vi(e,t){n.push(t,!0);const r=n.derived(()=>Ci(t.publishedKey,t.themes));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-themes":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function Ai(e,t){n.push(t,!0);const r=n.derived(()=>di(t.publishedKey,t.variables));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-css-variables":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function _r(e){return e!==!1}const Ei=["light","dark","light dark"],wi=["auto","thin","none"],Si=new Set(Ei),Ti=new Set(wi),Ii=/[{};]|url\(|@/i,Pi=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=400&&!Ii.test(e),ue=e=>Pi(e)?e.trim():void 0,Cr=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;const t=ue(e.selectionBackground),r=ue(e.selectionColor),o=ue(e.caretColor),s=ue(e.scrollbarColor),i={...typeof e.colorScheme=="string"&&Si.has(e.colorScheme)?{colorScheme:e.colorScheme}:{},...t?{selectionBackground:t}:{},...r?{selectionColor:r}:{},...o?{caretColor:o}:{},...s?{scrollbarColor:s}:{},...typeof e.scrollbarWidth=="string"&&Ti.has(e.scrollbarWidth)?{scrollbarWidth:e.scrollbarWidth}:{}};return Object.keys(i).length>0?i:null},Di=(e,t,r)=>{if(!_r(r)||!e)return null;const o=Cr(t);if(!o)return null;const s=`[data-rulecms-published-key="${ir(e)}"]`,i=[];o.colorScheme&&i.push(` color-scheme: ${o.colorScheme};`),o.caretColor&&i.push(` caret-color: ${o.caretColor};`),o.scrollbarWidth&&i.push(` scrollbar-width: ${o.scrollbarWidth};`),o.scrollbarColor&&i.push(` scrollbar-color: ${o.scrollbarColor};`);const l=[];o.selectionBackground&&l.push(` background: ${o.selectionBackground};`),o.selectionColor&&l.push(` color: ${o.selectionColor};`);const a=[];return i.length>0&&a.push(`${s} > * {
55
+ `)};function Ai(e,t){n.push(t,!0);const o=n.derived(()=>vi(t.publishedKey,t.themes));var r=n.comment(),s=n.first_child(r);{var i=l=>{var a=n.comment(),c=n.first_child(a);n.html(c,()=>B(n.get(o),"data-rulecms-project-themes")),n.append(l,a)};n.if(s,l=>{n.get(o)&&l(i)})}n.append(e,r),n.pop()}function Ei(e,t){n.push(t,!0);const o=n.derived(()=>di(t.publishedKey,t.variables));var r=n.comment(),s=n.first_child(r);{var i=l=>{var a=n.comment(),c=n.first_child(a);n.html(c,()=>B(n.get(o),"data-rulecms-project-css-variables")),n.append(l,a)};n.if(s,l=>{n.get(o)&&l(i)})}n.append(e,r),n.pop()}function vo(e){return e!==!1}const wi=["light","dark","light dark"],Si=["auto","thin","none"],Ti=new Set(wi),Ii=new Set(Si),Pi=/[{};]|url\(|@/i,Di=e=>typeof e=="string"&&e.trim()!==""&&e.trim().length<=400&&!Pi.test(e),fe=e=>Di(e)?e.trim():void 0,Ao=e=>{if(!e||typeof e!="object"||Array.isArray(e))return null;const t=fe(e.selectionBackground),o=fe(e.selectionColor),r=fe(e.caretColor),s=fe(e.scrollbarColor),i={...typeof e.colorScheme=="string"&&Ti.has(e.colorScheme)?{colorScheme:e.colorScheme}:{},...t?{selectionBackground:t}:{},...o?{selectionColor:o}:{},...r?{caretColor:r}:{},...s?{scrollbarColor:s}:{},...typeof e.scrollbarWidth=="string"&&Ii.has(e.scrollbarWidth)?{scrollbarWidth:e.scrollbarWidth}:{}};return Object.keys(i).length>0?i:null},Li=(e,t,o)=>{if(!vo(o)||!e)return null;const r=Ao(t);if(!r)return null;const s=`[data-rulecms-published-key="${lo(e)}"]`,i=[];r.colorScheme&&i.push(` color-scheme: ${r.colorScheme};`),r.caretColor&&i.push(` caret-color: ${r.caretColor};`),r.scrollbarWidth&&i.push(` scrollbar-width: ${r.scrollbarWidth};`),r.scrollbarColor&&i.push(` scrollbar-color: ${r.scrollbarColor};`);const l=[];r.selectionBackground&&l.push(` background: ${r.selectionBackground};`),r.selectionColor&&l.push(` color: ${r.selectionColor};`);const a=[];return i.length>0&&a.push(`${s} > * {
56
56
  ${i.join(`
57
57
  `)}
58
58
  }`),l.length>0&&a.push(`${s} > * ::selection {
59
59
  ${l.join(`
60
60
  `)}
61
61
  }`),a.length>0?a.join(`
62
- `):null};function xi(e,t){n.push(t,!0);const r=n.derived(()=>Di(t.publishedKey,t.widgetChrome));var o=n.comment(),s=n.first_child(o);{var i=l=>{var a=n.comment(),u=n.first_child(a);n.element(u,()=>"style",!1,(d,c)=>{n.attribute_effect(d,()=>({"data-rulecms-project-widget-chrome":""}));var f=n.text();n.template_effect(()=>n.set_text(f,n.get(r))),n.append(c,f)}),n.append(l,a)};n.if(s,l=>{n.get(r)&&l(i)})}n.append(e,o),n.pop()}function Li(e){return e!==!1}function ki(e){const t={};return Object.entries(e).forEach(([r,o])=>{const s={...o};if(s.itemList)try{s.collectionRows=typeof s.itemList=="string"?JSON.parse(s.itemList):s.itemList}catch(l){console.error(`Failed to parse itemList for collection ${r}:`,l),s.collectionRows={rows:[]}}let i=`${s.name}$${r}`;s.parentId&&(i=`${i}@${s.parentId}`),t[i]=s}),t}function Ri(e){return typeof e.itemList=="string"?JSON.parse(e.itemList):e.itemList}function De(e){const t=Pe(e.fontFaces),r=cr(e.keyframes),o=br(e.themes),s=pr(e.cssProperties),i=Cr(e.widgetChrome),l=fr(e.positionTry),a=Li(e.includeClassLayer)&&sr(e.classLayer)?e.classLayer:void 0;return{displayItemList:Ri(e.widget),widgetCollections:ki(e.childCollections),...e.libraries?{libraries:e.libraries}:{},...mr(e.includeCssVariables)&&e.cssVariables&&Object.keys(e.cssVariables).length>0?{cssVariables:e.cssVariables}:{},...or(e.includeClassDefinitions)&&e.classDefinitions&&Object.keys(e.classDefinitions).length>0?{classDefinitions:e.classDefinitions}:{},...st(e.includeFontFaces)&&t.length>0?{fontFaces:t}:{},...lr(e.includeKeyframes)&&Object.keys(r).length>0?{keyframes:r}:{},...hr(e.includeThemes)&&o.length>0?{themes:o}:{},...gr(e.includeCssProperties)&&s.length>0?{cssProperties:s}:{},..._r(e.includeWidgetChrome)&&i?{widgetChrome:i}:{},...a?{classLayer:a}:{},...dr(e.includePositionTry)&&Object.keys(l).length>0?{positionTry:l}:{}}}function Oi(e){const t=e.registry??se(),r=Ce({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolveSync({registrations:e.libraries,referenced:r})}function Wi(e){const t=e.registry??se(),r=Ce({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolve({registrations:e.libraries,referenced:r})}function Ni(e){const t=e.lastIndexOf(me);return t===-1?e:e.slice(t+me.length)}const Mi="text/plain";function ji({token:e,rulesetPublishedKey:t,params:r}){return z(e)?{token:e,rulesetKey:Ni(t),...r?{params:r}:{}}:{token:e,rulesetPublishedKey:t,...r?{params:r}:{},mode:"payload"}}function vr({contentType:e=Mi,...t}){return{method:"POST",headers:{"Content-Type":e},body:JSON.stringify(ji(t))}}const Ue="rulecms_anon_id";function pt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function Ar(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(Ue);if(e)return e;const t=pt();return window.localStorage.setItem(Ue,t),t}catch{return pt()}}function Er(e){return e>=500}function Vi(e){if(!(e!=null&&e.success)||!e.data)return null;const{selection:t,...r}=e.data;return{raw:r,selection:t}}function Fi(e,t){if(!(e!=null&&e.resolution)||!e.widget)return null;const{resolution:r,...o}=e,s={rulesetPublishedKey:t,outcome:r.outcome,ruleId:r.ruleId??null,variantId:r.variantId??null,widgetKey:r.widgetKey,widgetPublishedKey:r.widgetPublishedKey};return{raw:o,selection:s}}function wr({token:e,rulesetPublishedKey:t,body:r}){return z(e)?Fi(r,t):Vi(r)}function Sr(e){return JSON.stringify(e,(t,r)=>{if(r===null||typeof r!="object"||Array.isArray(r))return r;const o={};for(const s of Object.keys(r).sort())o[s]=r[s];return o})}const Ki={display:"flex",justifyContent:"center",alignItems:"center",padding:"3rem",color:"#e2e8f0"},Bi={display:"flex",alignItems:"center",gap:"1rem"},Ui={width:"40px",height:"40px",border:"4px solid #4a5568",borderTopColor:"#63b3ed",borderRadius:"50%",animation:"spin 1s linear infinite"},mt={padding:"1.5rem",backgroundColor:"#742a2a",border:"1px solid #9b2c2c",borderRadius:"8px",color:"#fed7d7"},yt={fontSize:"16px",fontWeight:"600",marginBottom:"0.5rem",color:"#feb2b2"},ht={fontSize:"14px",color:"#fed7d7"},Hi=`
62
+ `):null};function ki(e,t){n.push(t,!0);const o=n.derived(()=>Li(t.publishedKey,t.widgetChrome));var r=n.comment(),s=n.first_child(r);{var i=l=>{var a=n.comment(),c=n.first_child(a);n.html(c,()=>B(n.get(o),"data-rulecms-project-widget-chrome")),n.append(l,a)};n.if(s,l=>{n.get(o)&&l(i)})}n.append(e,r),n.pop()}function Ri(e){return e!==!1}function xi(e){const t={};return Object.entries(e).forEach(([o,r])=>{const s={...r};if(s.itemList)try{s.collectionRows=typeof s.itemList=="string"?JSON.parse(s.itemList):s.itemList}catch(l){console.error(`Failed to parse itemList for collection ${o}:`,l),s.collectionRows={rows:[]}}let i=`${s.name}$${o}`;s.parentId&&(i=`${i}@${s.parentId}`),t[i]=s}),t}function Oi(e){return typeof e.itemList=="string"?JSON.parse(e.itemList):e.itemList}function Le(e){const t=De(e.fontFaces),o=uo(e.keyframes),r=_o(e.themes),s=yo(e.cssProperties),i=Ao(e.widgetChrome),l=po(e.positionTry),a=Ri(e.includeClassLayer)&&io(e.classLayer)?e.classLayer:void 0;return{displayItemList:Oi(e.widget),widgetCollections:xi(e.childCollections),...e.libraries?{libraries:e.libraries}:{},...ho(e.includeCssVariables)&&e.cssVariables&&Object.keys(e.cssVariables).length>0?{cssVariables:e.cssVariables}:{},...so(e.includeClassDefinitions)&&e.classDefinitions&&Object.keys(e.classDefinitions).length>0?{classDefinitions:e.classDefinitions}:{},...it(e.includeFontFaces)&&t.length>0?{fontFaces:t}:{},...ao(e.includeKeyframes)&&Object.keys(o).length>0?{keyframes:o}:{},...Co(e.includeThemes)&&r.length>0?{themes:r}:{},...mo(e.includeCssProperties)&&s.length>0?{cssProperties:s}:{},...vo(e.includeWidgetChrome)&&i?{widgetChrome:i}:{},...a?{classLayer:a}:{},...fo(e.includePositionTry)&&Object.keys(l).length>0?{positionTry:l}:{}}}function Ni(e){const t=e.registry??ie(),o=ve({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolveSync({registrations:e.libraries,referenced:o})}function Wi(e){const t=e.registry??ie(),o=ve({displayItemList:e.displayItemList,widgetCollections:e.widgetCollections});return t.resolve({registrations:e.libraries,referenced:o})}function Mi(e){const t=e.lastIndexOf(ye);return t===-1?e:e.slice(t+ye.length)}const ji="text/plain";function Vi({token:e,rulesetPublishedKey:t,params:o}){return G(e)?{token:e,rulesetKey:Mi(t),...o?{params:o}:{}}:{token:e,rulesetPublishedKey:t,...o?{params:o}:{},mode:"payload"}}function Eo({contentType:e=ji,...t}){return{method:"POST",headers:{"Content-Type":e},body:JSON.stringify(Vi(t))}}const He="rulecms_anon_id";function mt(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function wo(){if(!(typeof window>"u"))try{const e=window.localStorage.getItem(He);if(e)return e;const t=mt();return window.localStorage.setItem(He,t),t}catch{return mt()}}function So(e){return e>=500}function Fi(e){if(!(e!=null&&e.success)||!e.data)return null;const{selection:t,...o}=e.data;return{raw:o,selection:t}}function Ki(e,t){if(!(e!=null&&e.resolution)||!e.widget)return null;const{resolution:o,...r}=e,s={rulesetPublishedKey:t,outcome:o.outcome,ruleId:o.ruleId??null,variantId:o.variantId??null,widgetKey:o.widgetKey,widgetPublishedKey:o.widgetPublishedKey};return{raw:r,selection:s}}function To({token:e,rulesetPublishedKey:t,body:o}){return G(e)?Ki(o,t):Fi(o)}function Io(e){return JSON.stringify(e,(t,o)=>{if(o===null||typeof o!="object"||Array.isArray(o))return o;const r={};for(const s of Object.keys(o).sort())r[s]=o[s];return r})}const Bi={display:"flex",justifyContent:"center",alignItems:"center",padding:"3rem",color:"#e2e8f0"},Ui={display:"flex",alignItems:"center",gap:"1rem"},Hi={width:"40px",height:"40px",border:"4px solid #4a5568",borderTopColor:"#63b3ed",borderRadius:"50%",animation:"spin 1s linear infinite"},yt={padding:"1.5rem",backgroundColor:"#742a2a",border:"1px solid #9b2c2c",borderRadius:"8px",color:"#fed7d7"},ht={fontSize:"16px",fontWeight:"600",marginBottom:"0.5rem",color:"#feb2b2"},bt={fontSize:"14px",color:"#fed7d7"},zi=`
63
63
  @keyframes spin {
64
64
  from {
65
65
  transform: rotate(0deg);
@@ -68,4 +68,4 @@ ${l.join(`
68
68
  transform: rotate(360deg);
69
69
  }
70
70
  }
71
- `,zi="data-rulecms-published-key";var Gi=n.from_html("<div><div><div></div></div></div>"),Yi=n.from_html("<div><div>Error Loading Widget</div> <div> </div></div>"),Xi=n.from_html("<div><div>No Widget Data</div> <div>No widget data available</div></div>"),Ji=n.from_html('<span style="display: contents"><!> <!> <!> <!> <!> <!> <!> <!> <!></span>');function qi(e,t){n.push(t,!0);let r=n.prop(t,"mode",3,"client-fetch");const o=We.getContext(Qe);let s=n.state(!0),i=n.state(null),l=n.state(null),a=n.state(null),u=n.state("");const d=n.derived(()=>r()==="pre-fetched"),c=n.derived(()=>({sourceComponents:n.get(a)??void 0})),f=n.derived(()=>t.publishedKey||n.get(u));let p=null,g=null,E=!1,A=0;class b extends Error{constructor(m){super(m),this.name="FetchWidgetMessage"}}function _(){if(!n.get(l)){n.set(a,null);return}const y=t.libraries??(o==null?void 0:o.libraries),m=o==null?void 0:o.libraryRegistry,S=Oi({displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,libraries:y,registry:m});if(S){n.set(a,S,!0);return}Wi({displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,libraries:y,registry:m}).then(D=>{n.set(a,D,!0)})}function T(){n.get(l)&&Jn({componentProps:t.componentProps,displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,publishedKey:n.get(f)})}function N(){if(E||typeof document>"u")return;const y="rulecms-widget-spinner-styles";if(!document.getElementById(y)){const m=document.createElement("style");m.id=y,m.textContent=Hi,document.head.appendChild(m)}E=!0}function H(){const y=t.token??(o==null?void 0:o.token),m=t.endpoint??(o==null?void 0:o.endpoint),S=z(y),D=t.rulesetPublishedKey;if(!t.publishedKey&&!D||!y){!t.publishedKey&&!D?n.set(i,D!==void 0?S?"Ruleset key is required":"Ruleset published key is required":S?"Widget key is required":"Published key is required",!0):n.set(i,"Token is required. Provide it either directly as a prop (`token`) or via RuleCMSWidgetProvider."),n.set(l,null),n.set(s,!1);return}const M=Sr(t.params),R=JSON.stringify({publishedKey:t.publishedKey,rulesetPublishedKey:D,token:y,endpoint:m,paramsKey:M,anonymousId:t.anonymousId,fallbackPublishedKey:t.fallbackPublishedKey,contentType:t.contentType});if(g===R&&n.get(l)){n.set(s,!1),_();return}p==null||p.abort(),p=new AbortController;const O=p.signal;g=R,n.set(s,!0),n.set(i,null);const X=++A,ce=async x=>(await x.json().catch(()=>({error:"Unknown error"}))).error||`Request failed with status ${x.status}`,re=async x=>{const F=Xe({publishedKey:x,token:y,endpoint:m}),B=await fetch(F,{method:"GET",...S?{cache:"no-store"}:{},signal:O});if(!B.ok)throw new b(await ce(B));const j=await B.json();if(!j.success)throw new b("Failed to fetch widget data");return j.data};(D?(async()=>{const x=M?JSON.parse(M):{};if(t.anonymousId!==!1){if(typeof t.anonymousId=="string")x.anonId=x.anonId??t.anonymousId;else if(x.anonId==null){const j=Ar();j&&(x.anonId=j)}}let F;try{F=await fetch(Je({token:y,endpoint:m}),{...vr({token:y,rulesetPublishedKey:D,params:x,contentType:t.contentType}),signal:O})}catch(j){if(j instanceof DOMException&&j.name==="AbortError")throw j;if(t.fallbackPublishedKey)return{raw:await re(t.fallbackPublishedKey),selection:null};throw j}if(!F.ok){if(t.fallbackPublishedKey&&Er(F.status))return{raw:await re(t.fallbackPublishedKey),selection:null};throw new b(await ce(F))}const B=wr({token:y,rulesetPublishedKey:D,body:await F.json()});if(!B)throw new b("Failed to fetch widget data");return{raw:B.raw,selection:B.selection}})():re(t.publishedKey).then(x=>({raw:x,selection:null}))).then(({raw:x,selection:F})=>{var B,j;n.set(l,De(x),!0),n.set(u,((B=x.widget)==null?void 0:B.publishedKey)??"",!0),n.set(i,null),_(),T(),F&&((j=t.onSelection)==null||j.call(t,F))}).catch(x=>{x instanceof DOMException&&x.name==="AbortError"||(console.error("Error fetching widget:",x),n.set(i,x instanceof b?x.message:"Failed to fetch widget",!0),n.set(l,null))}).finally(()=>{A===X&&n.set(s,!1)})}function h(){n.set(l,t.initialData??null,!0),n.set(s,!1),n.set(i,null),_(),T()}function v(){if(r()==="pre-fetched"){h();return}N(),H()}function C(){r()==="pre-fetched"&&h()}C(),n.user_effect(()=>(t.publishedKey,t.rulesetPublishedKey,t.params,t.anonymousId,t.fallbackPublishedKey,t.contentType,t.token,t.endpoint,r(),t.initialData,t.libraries,t.componentProps,We.untrack(()=>v()),()=>{p==null||p.abort()}));var w=Ji(),I=n.child(w);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.fontFaces});Is(I,{get publishedKey(){return n.get(f)},get fonts(){return n.get(y)}})}var P=n.sibling(I,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.keyframes});Fs(P,{get publishedKey(){return n.get(f)},get keyframes(){return n.get(y)}})}var k=n.sibling(P,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.themes});vi(k,{get publishedKey(){return n.get(f)},get themes(){return n.get(y)}})}var Q=n.sibling(k,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.cssProperties});li(Q,{get publishedKey(){return n.get(f)},get cssProperties(){return n.get(y)}})}var te=n.sibling(Q,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.widgetChrome});xi(te,{get publishedKey(){return n.get(f)},get widgetChrome(){return n.get(y)}})}var ne=n.sibling(te,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.positionTry});Zs(ne,{get publishedKey(){return n.get(f)},get positionTry(){return n.get(y)}})}var le=n.sibling(ne,2);{let y=n.derived(()=>{var m;return(m=n.get(l))==null?void 0:m.cssVariables});Ai(le,{get publishedKey(){return n.get(f)},get variables(){return n.get(y)}})}var $=n.sibling(le,2);{let y=n.derived(()=>{var S;return(S=n.get(l))==null?void 0:S.classDefinitions}),m=n.derived(()=>{var S;return(S=n.get(l))==null?void 0:S.classLayer});ss($,{get publishedKey(){return n.get(f)},get classes(){return n.get(y)},get classLayer(){return n.get(m)}})}var V=n.sibling($,2);{var ae=y=>{var m=Gi(),S=n.child(m),D=n.child(S);n.reset(S),n.reset(m),n.template_effect((M,R,O)=>{n.set_style(m,M),n.set_style(S,R),n.set_style(D,O)},[()=>W(Ki),()=>W(Bi),()=>W(Ui)]),n.append(y,m)},xe=y=>{var m=Yi(),S=n.child(m),D=n.sibling(S,2),M=n.child(D,!0);n.reset(D),n.reset(m),n.template_effect((R,O,X)=>{n.set_style(m,R),n.set_style(S,O),n.set_style(D,X),n.set_text(M,n.get(i))},[()=>W(mt),()=>W(yt),()=>W(ht)]),n.append(y,m)},Le=y=>{var m=Xi(),S=n.child(m),D=n.sibling(S,2);n.reset(m),n.template_effect((M,R,O)=>{n.set_style(m,M),n.set_style(S,R),n.set_style(D,O)},[()=>W(mt),()=>W(yt),()=>W(ht)]),n.append(y,m)},ke=y=>{var m=n.comment(),S=n.first_child(m);{var D=R=>{nr(R,{get displayItemList(){return n.get(l).displayItemList},get widgetCollections(){return n.get(l).widgetCollections},get plugins(){return n.get(c)},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})},M=R=>{rr(R,{get displayItemList(){return n.get(l).displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return n.get(l).widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get plugins(){return n.get(c)},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})};n.if(S,R=>{n.get(d)?R(D):R(M,-1)})}n.append(y,m)};n.if(V,y=>{r()!=="pre-fetched"&&n.get(s)?y(ae):r()!=="pre-fetched"&&n.get(i)?y(xe,1):r()!=="pre-fetched"&&!n.get(l)?y(Le,2):n.get(a)&&n.get(l)&&y(ke,3)})}n.reset(w),n.template_effect(()=>n.set_attribute(w,"data-rulecms-published-key",n.get(f))),n.append(e,w),n.pop()}const Tr=6e4;class Y extends Error{constructor(r,o){super(r);at(this,"status");this.name="FetchRuleCMSWidgetError",this.status=o}}const be=new Map;function Zi(){be.clear()}function bt(e){const t=e==null?void 0:e.cache;return t==="no-store"||t==="reload"||t==="no-cache"}function Qi(e,t){const r=be.get(e);if(r){if(r.expiresAt<=t){be.delete(e);return}return r.data}}async function Ir(e){return(await e.json().catch(()=>({error:"Unknown error"}))).error||`Request failed with status ${e.status}`}async function Pr({publishedKey:e,token:t,endpoint:r,fetchOptions:o}){const s=Xe({publishedKey:e,token:t,endpoint:r}),i=z(t),l=Date.now();if(!i&&!bt(o)){const c=Qi(s,l);if(c)return c}const a=await fetch(s,{method:"GET",...i?{cache:"no-store"}:{},...o});if(!a.ok)throw new Y(await Ir(a),a.status);const u=await a.json();if(!u.success)throw new Y("Failed to fetch widget data");const d=De(u.data);return!i&&!bt(o)&&be.set(s,{expiresAt:l+Tr,data:d}),d}async function $i(e){const{rulesetPublishedKey:t,params:r,fallbackPublishedKey:o,contentType:s,token:i,endpoint:l,fetchOptions:a}=e,u=()=>Pr({publishedKey:o,token:i,endpoint:l,fetchOptions:a});let d;try{d=await fetch(Je({token:i,endpoint:l}),{...vr({token:i,rulesetPublishedKey:t,params:r,contentType:s}),...a})}catch(f){if(o)return u();throw f}if(!d.ok){if(o&&Er(d.status))return u();throw new Y(await Ir(d),d.status)}const c=wr({token:i,rulesetPublishedKey:t,body:await d.json()});if(!c)throw new Y("Failed to fetch widget data");return{...De(c.raw),selection:c.selection}}async function el(e){const{publishedKey:t,rulesetPublishedKey:r,token:o}=e;if(!t&&!r){const s=z(o);throw r!==void 0?new Y(s?"Ruleset key is required":"Ruleset published key is required"):new Y(s?"Widget key is required":"Published key is required")}if(!o)throw new Y("Token is required");return e.rulesetPublishedKey?$i(e):Pr(e)}async function tl(e){const{data:t,libraries:r}=e,o=Ce({displayItemList:t.displayItemList,widgetCollections:t.widgetCollections});return se().resolve({registrations:r,referenced:o})}exports.AlignContentTypes=Nr;exports.BreakpointVariantRender=nr;exports.COLLECTION_TYPE_PREFIX=Ge;exports.COMPONENT_PROPS_PATH_SEPARATOR=ie;exports.CSS_CLASSES_ATTRIBUTE_NAME=Se;exports.CSS_VARIABLE_NAME_MAX_LENGTH=Kt;exports.CSS_VARIABLE_NAME_PATTERN=Ft;exports.DEFAULT_BASE_Z_INDEX=ot;exports.DEFAULT_CLOUDINARY_CLOUD_NAME=Ot;exports.DEFAULT_LIBRARY_ID=ee;exports.DEFAULT_PUBLISHED_WIDGET_CACHE_MS=Tr;exports.DEFAULT_ROW_GAP=Ln;exports.DEV_CLIENT_TOKEN_PREFIX=Ct;exports.DEV_WIDGET_API_PATH=wt;exports.DEV_WIDGET_RESOLVE_API_PATH=Tt;exports.DeviceDisplayTypes=Mr;exports.DisplayComponent=er;exports.DisplayItemTypes=_e;exports.DragItemIdPrefixTypes=ze;exports.EMBEDDED_KEY_SEPARATOR=Lt;exports.FLEX_LAYOUT_STYLE_KEYS_THAT_DERIVE_DISPLAY=cn;exports.FetchRuleCMSWidgetError=Y;exports.HIDE_WIDGET_ATTRIBUTE_NAME=tt;exports.JustifyContentTypes=Me;exports.POINTER_EVENTS_ATTRIBUTE_NAME=Wn;exports.PUBLISHED_KEY_SEPARATOR=me;exports.PUBLISHED_WIDGET_API_PATH=Et;exports.PUBLISHED_WIDGET_RESOLVE_API_PATH=St;exports.PageViewTypes=Ne;exports.RULECMS_ANONYMOUS_ID_STORAGE_KEY=Ue;exports.RULECMS_API_ORIGIN=vt;exports.RULECMS_PUBLISHED_KEY_ATTRIBUTE=zi;exports.RULECMS_WIDGET_CONTEXT_KEY=Qe;exports.RenderComponents=rr;exports.RenderComponentsForDevice=he;exports.RenderComponentsInner=ye;exports.RuleCMSWidget=qi;exports.RuleCMSWidgetProvider=Gr;exports.WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE=Nn;exports.WIDGET_CACHE_API_ORIGIN=At;exports.WIDGET_PLACEHOLDER_VALUES_KEY=Fe;exports.Z_INDEX_WIDGET_ATTRIBUTE_NAME=jn;exports.alignContentAllowlist=rn;exports.alignItemsAllowlist=tn;exports.backgroundPositionAllowlist=ln;exports.backgroundRepeatAllowlist=an;exports.backgroundSizeAllowlist=sn;exports.borderStyleKeywords=dn;exports.boxSpacingSideKeys=Ht;exports.boxSpacingStyleAttributeEntries=go;exports.buildCloudinaryBackgroundUrl=Vt;exports.buildOverlayLayerBoxStyles=Hn;exports.buildOverlayStackStyles=Un;exports.buildWidgetFetchUrl=Xe;exports.buildWidgetResolveUrl=Je;exports.clearPublishedWidgetFetchCache=Zi;exports.collectComponentInstancePaths=Yn;exports.collectReferencedLibraryIds=Ce;exports.composeSourceComponentsPlugin=_t;exports.createComponentLibraryRegistry=se;exports.cssAttrArrayKey=pe;exports.defaultPageWidth=Rt;exports.deriveDisplayFlexIfNeeded=In;exports.desktopModeWidth=Yr;exports.fetchRuleCMSWidget=el;exports.findUnmatchedComponentPropsKeys=Xn;exports.flexDirectionAllowlist=on;exports.flexWrapAllowlist=nn;exports.fontFamilyAllowlist=Yt;exports.fontStyleAllowlist=Jt;exports.fontWeightAllowlist=Xt;exports.formatBackgroundImageStyles=hn;exports.formatBorderStyles=bn;exports.formatBoxShadowStyles=_n;exports.formatBoxSpacingStyles=Cn;exports.formatCssColorStyles=vn;exports.formatCssColorValue=Ee;exports.formatCssEnumStyles=An;exports.formatCssLengthStyles=En;exports.formatCssVariable=K;exports.formatCssVariableStyles=io;exports.formatLineHeightStyles=wn;exports.formatObjectStyleAttribute=Tn;exports.formatOpacityStyles=Sn;exports.formatSpacingSideValue=q;exports.generatePublishedKey=kt;exports.generatePublishedKeyForEmbedded=Ur;exports.getCollectionIdForCollectionType=Ze;exports.getColumnAttributes=oe;exports.getComponentAttributesAndStyles=je;exports.getComponentsPluginFromPlugins=ge;exports.getCssVariableFromLeaf=L;exports.getDefaultDimensionAttributes=Pn;exports.getDeviceTypeBasedAttributes=G;exports.getDragItemId=jr;exports.getDragItemPrefixAndId=It;exports.getIdAndPrefix=Pt;exports.getMergedAttributes=Dn;exports.getNameAndInstanceIdFromWidgetKey=Vr;exports.getNameFromWidgetKey=Fr;exports.getOrCreateAnonymousId=Ar;exports.getOverlayLayerZIndex=Fn;exports.getWidgetKeyForCollection=Dt;exports.getWidgetKeyForCollectionWithPrefix=Kr;exports.getWidgetKeyForPublishedCollection=xt;exports.getWidgetKeyForPublishedCollectionWithPrefix=Br;exports.hasBoxShadowLeaf=pn;exports.hasDeviceDivergentValues=qn;exports.hasInvalidCssVariable=U;exports.hasItems=xn;exports.hasOverlayLayers=Vn;exports.incrementVersion=Hr;exports.isBackgroundImageValue=Bt;exports.isBorderStyleValue=un;exports.isBorderValue=fn;exports.isBoxShadowValue=gn;exports.isBoxSpacingValue=zt;exports.isCloudinaryCloudName=Nt;exports.isCloudinaryPublicId=Wt;exports.isCloudinaryTransformationString=jt;exports.isCssColorValue=Ae;exports.isCssEnumValue=Gt;exports.isCssVariableName=Z;exports.isDevClientToken=z;exports.isLineHeightValue=mn;exports.isOpacityValue=yn;exports.isOverlayLayerEmptyForDevice=Bn;exports.isRowHiddenForDevice=Rn;exports.isSafeImageUrl=Mt;exports.isSpacingSideValue=J;exports.isWidgetHiddenForDevice=Ie;exports.justifyContentAllowlist=en;exports.normalizeCssClasses=Te;exports.objectStyleAttributeRegistry=we;exports.overflowAllowlist=fe;exports.phoneModeWidth=$e;exports.pointerEventsAllowlist=$t;exports.prepareRuleCMSWidgetData=De;exports.resolveBaseZIndex=Ve;exports.resolveKey=He;exports.resolveOverlayLayerPointerEvents=Kn;exports.resolveRowStyles=On;exports.resolveWidgetApiOrigin=Ye;exports.resolveWidgetContainerStyles=nt;exports.resolveWidgetInstanceProps=zn;exports.resolveWidgetLibraries=tl;exports.rowBasedPropertiesAreAssigned=kn;exports.spacingKeywords=ve;exports.spacingLengthUnits=Ut;exports.stableJsonStringify=Sr;exports.tabletModeWidth=et;exports.textAlignAllowlist=qt;exports.textDecorationAllowlist=Zt;exports.textTransformAllowlist=Qt;exports.toStyleAttr=W;exports.typeHasPrefix=qe;exports.warnUnmatchedComponentProps=Jn;exports.widgetBasedPropertiesAreAssigned=Mn;exports.widgetDeclaresOwnHeight=rt;exports.withWidgetPlaceholderValues=Gn;
71
+ `,Gi="data-rulecms-published-key";var Yi=n.from_html("<div><div><div></div></div></div>"),Xi=n.from_html("<div><div>Error Loading Widget</div> <div> </div></div>"),Ji=n.from_html("<div><div>No Widget Data</div> <div>No widget data available</div></div>"),qi=n.from_html('<span style="display: contents"><!> <!> <!> <!> <!> <!> <!> <!> <!></span>');function Zi(e,t){n.push(t,!0);let o=n.prop(t,"mode",3,"client-fetch");const r=We.getContext($e);let s=n.state(!0),i=n.state(null),l=n.state(null),a=n.state(null),c=n.state("");const d=n.derived(()=>o()==="pre-fetched"),u=n.derived(()=>({sourceComponents:n.get(a)??void 0})),g=n.derived(()=>t.publishedKey||n.get(c));let m=null,f=null,A=!1,w=0;class h extends Error{constructor(p){super(p),this.name="FetchWidgetMessage"}}function E(){if(!n.get(l)){n.set(a,null);return}const y=t.libraries??(r==null?void 0:r.libraries),p=r==null?void 0:r.libraryRegistry,S=Ni({displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,libraries:y,registry:p});if(S){n.set(a,S,!0);return}Wi({displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,libraries:y,registry:p}).then(P=>{n.set(a,P,!0)})}function T(){n.get(l)&&qn({componentProps:t.componentProps,displayItemList:n.get(l).displayItemList,widgetCollections:n.get(l).widgetCollections,publishedKey:n.get(g)})}function k(){if(A||typeof document>"u")return;const y="rulecms-widget-spinner-styles";if(!document.getElementById(y)){const p=document.createElement("style");p.id=y,p.textContent=zi,document.head.appendChild(p)}A=!0}function z(){const y=t.token??(r==null?void 0:r.token),p=t.endpoint??(r==null?void 0:r.endpoint),S=G(y),P=t.rulesetPublishedKey;if(!t.publishedKey&&!P||!y){!t.publishedKey&&!P?n.set(i,P!==void 0?S?"Ruleset key is required":"Ruleset published key is required":S?"Widget key is required":"Published key is required",!0):n.set(i,"Token is required. Provide it either directly as a prop (`token`) or via RuleCMSWidgetProvider."),n.set(l,null),n.set(s,!1);return}const M=Io(t.params),O=JSON.stringify({publishedKey:t.publishedKey,rulesetPublishedKey:P,token:y,endpoint:p,paramsKey:M,anonymousId:t.anonymousId,fallbackPublishedKey:t.fallbackPublishedKey,contentType:t.contentType});if(f===O&&n.get(l)){n.set(s,!1),E();return}m==null||m.abort(),m=new AbortController;const N=m.signal;f=O,n.set(s,!0),n.set(i,null);const J=++w,ue=async D=>(await D.json().catch(()=>({error:"Unknown error"}))).error||`Request failed with status ${D.status}`,re=async D=>{const F=Je({publishedKey:D,token:y,endpoint:p}),U=await fetch(F,{method:"GET",...S?{cache:"no-store"}:{},signal:N});if(!U.ok)throw new h(await ue(U));const j=await U.json();if(!j.success)throw new h("Failed to fetch widget data");return j.data};(P?(async()=>{const D=M?JSON.parse(M):{};if(t.anonymousId!==!1){if(typeof t.anonymousId=="string")D.anonId=D.anonId??t.anonymousId;else if(D.anonId==null){const j=wo();j&&(D.anonId=j)}}let F;try{F=await fetch(qe({token:y,endpoint:p}),{...Eo({token:y,rulesetPublishedKey:P,params:D,contentType:t.contentType}),signal:N})}catch(j){if(j instanceof DOMException&&j.name==="AbortError")throw j;if(t.fallbackPublishedKey)return{raw:await re(t.fallbackPublishedKey),selection:null};throw j}if(!F.ok){if(t.fallbackPublishedKey&&So(F.status))return{raw:await re(t.fallbackPublishedKey),selection:null};throw new h(await ue(F))}const U=To({token:y,rulesetPublishedKey:P,body:await F.json()});if(!U)throw new h("Failed to fetch widget data");return{raw:U.raw,selection:U.selection}})():re(t.publishedKey).then(D=>({raw:D,selection:null}))).then(({raw:D,selection:F})=>{var U,j;n.set(l,Le(D),!0),n.set(c,((U=D.widget)==null?void 0:U.publishedKey)??"",!0),n.set(i,null),E(),T(),F&&((j=t.onSelection)==null||j.call(t,F))}).catch(D=>{D instanceof DOMException&&D.name==="AbortError"||(console.error("Error fetching widget:",D),n.set(i,D instanceof h?D.message:"Failed to fetch widget",!0),n.set(l,null))}).finally(()=>{w===J&&n.set(s,!1)})}function C(){n.set(l,t.initialData??null,!0),n.set(s,!1),n.set(i,null),E(),T()}function _(){if(o()==="pre-fetched"){C();return}k(),z()}function b(){o()==="pre-fetched"&&C()}b(),n.user_effect(()=>(t.publishedKey,t.rulesetPublishedKey,t.params,t.anonymousId,t.fallbackPublishedKey,t.contentType,t.token,t.endpoint,o(),t.initialData,t.libraries,t.componentProps,We.untrack(()=>_()),()=>{m==null||m.abort()}));var v=qi(),I=n.child(v);{let y=n.derived(()=>{var p;return(p=n.get(l))==null?void 0:p.fontFaces});Ps(I,{get publishedKey(){return n.get(g)},get fonts(){return n.get(y)}})}var R=n.sibling(I,2);{let y=n.derived(()=>{var p;return(p=n.get(l))==null?void 0:p.keyframes});Ks(R,{get publishedKey(){return n.get(g)},get keyframes(){return n.get(y)}})}var x=n.sibling(R,2);{let y=n.derived(()=>{var p;return(p=n.get(l))==null?void 0:p.themes});Ai(x,{get publishedKey(){return n.get(g)},get themes(){return n.get(y)}})}var $=n.sibling(x,2);{let y=n.derived(()=>{var p;return(p=n.get(l))==null?void 0:p.cssProperties});ai($,{get publishedKey(){return n.get(g)},get cssProperties(){return n.get(y)}})}var ne=n.sibling($,2);{let y=n.derived(()=>{var p;return(p=n.get(l))==null?void 0:p.widgetChrome});ki(ne,{get publishedKey(){return n.get(g)},get widgetChrome(){return n.get(y)}})}var oe=n.sibling(ne,2);{let y=n.derived(()=>{var p;return(p=n.get(l))==null?void 0:p.positionTry});Qs(oe,{get publishedKey(){return n.get(g)},get positionTry(){return n.get(y)}})}var ae=n.sibling(oe,2);{let y=n.derived(()=>{var p;return(p=n.get(l))==null?void 0:p.cssVariables});Ei(ae,{get publishedKey(){return n.get(g)},get variables(){return n.get(y)}})}var ee=n.sibling(ae,2);{let y=n.derived(()=>{var S;return(S=n.get(l))==null?void 0:S.classDefinitions}),p=n.derived(()=>{var S;return(S=n.get(l))==null?void 0:S.classLayer});is(ee,{get publishedKey(){return n.get(g)},get classes(){return n.get(y)},get classLayer(){return n.get(p)}})}var V=n.sibling(ee,2);{var ce=y=>{var p=Yi(),S=n.child(p),P=n.child(S);n.reset(S),n.reset(p),n.template_effect((M,O,N)=>{n.set_style(p,M),n.set_style(S,O),n.set_style(P,N)},[()=>W(Bi),()=>W(Ui),()=>W(Hi)]),n.append(y,p)},ke=y=>{var p=Xi(),S=n.child(p),P=n.sibling(S,2),M=n.child(P,!0);n.reset(P),n.reset(p),n.template_effect((O,N,J)=>{n.set_style(p,O),n.set_style(S,N),n.set_style(P,J),n.set_text(M,n.get(i))},[()=>W(yt),()=>W(ht),()=>W(bt)]),n.append(y,p)},Re=y=>{var p=Ji(),S=n.child(p),P=n.sibling(S,2);n.reset(p),n.template_effect((M,O,N)=>{n.set_style(p,M),n.set_style(S,O),n.set_style(P,N)},[()=>W(yt),()=>W(ht),()=>W(bt)]),n.append(y,p)},xe=y=>{var p=n.comment(),S=n.first_child(p);{var P=O=>{oo(O,{get displayItemList(){return n.get(l).displayItemList},get widgetCollections(){return n.get(l).widgetCollections},get plugins(){return n.get(u)},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})},M=O=>{ro(O,{get displayItemList(){return n.get(l).displayItemList},isComposeMode:!1,isWithinCollection:!1,get widgetCollections(){return n.get(l).widgetCollections},showDropContainers:!1,reduxDeviceDisplayType:"desktop",get plugins(){return n.get(u)},get componentProps(){return t.componentProps},get mounts(){return t.mounts},get placeholderValues(){return t.placeholderValues}})};n.if(S,O=>{n.get(d)?O(P):O(M,-1)})}n.append(y,p)};n.if(V,y=>{o()!=="pre-fetched"&&n.get(s)?y(ce):o()!=="pre-fetched"&&n.get(i)?y(ke,1):o()!=="pre-fetched"&&!n.get(l)?y(Re,2):n.get(a)&&n.get(l)&&y(xe,3)})}n.reset(v),n.template_effect(()=>n.set_attribute(v,"data-rulecms-published-key",n.get(g))),n.append(e,v),n.pop()}const Po=6e4;class X extends Error{constructor(o,r){super(o);ct(this,"status");this.name="FetchRuleCMSWidgetError",this.status=r}}const Ce=new Map;function Qi(){Ce.clear()}function Ct(e){const t=e==null?void 0:e.cache;return t==="no-store"||t==="reload"||t==="no-cache"}function $i(e,t){const o=Ce.get(e);if(o){if(o.expiresAt<=t){Ce.delete(e);return}return o.data}}async function Do(e){return(await e.json().catch(()=>({error:"Unknown error"}))).error||`Request failed with status ${e.status}`}async function Lo({publishedKey:e,token:t,endpoint:o,fetchOptions:r}){const s=Je({publishedKey:e,token:t,endpoint:o}),i=G(t),l=Date.now();if(!i&&!Ct(r)){const u=$i(s,l);if(u)return u}const a=await fetch(s,{method:"GET",...i?{cache:"no-store"}:{},...r});if(!a.ok)throw new X(await Do(a),a.status);const c=await a.json();if(!c.success)throw new X("Failed to fetch widget data");const d=Le(c.data);return!i&&!Ct(r)&&Ce.set(s,{expiresAt:l+Po,data:d}),d}async function el(e){const{rulesetPublishedKey:t,params:o,fallbackPublishedKey:r,contentType:s,token:i,endpoint:l,fetchOptions:a}=e,c=()=>Lo({publishedKey:r,token:i,endpoint:l,fetchOptions:a});let d;try{d=await fetch(qe({token:i,endpoint:l}),{...Eo({token:i,rulesetPublishedKey:t,params:o,contentType:s}),...a})}catch(g){if(r)return c();throw g}if(!d.ok){if(r&&So(d.status))return c();throw new X(await Do(d),d.status)}const u=To({token:i,rulesetPublishedKey:t,body:await d.json()});if(!u)throw new X("Failed to fetch widget data");return{...Le(u.raw),selection:u.selection}}async function tl(e){const{publishedKey:t,rulesetPublishedKey:o,token:r}=e;if(!t&&!o){const s=G(r);throw o!==void 0?new X(s?"Ruleset key is required":"Ruleset published key is required"):new X(s?"Widget key is required":"Published key is required")}if(!r)throw new X("Token is required");return e.rulesetPublishedKey?el(e):Lo(e)}async function nl(e){const{data:t,libraries:o}=e,r=ve({displayItemList:t.displayItemList,widgetCollections:t.widgetCollections});return ie().resolve({registrations:o,referenced:r})}exports.AlignContentTypes=jo;exports.BreakpointVariantRender=oo;exports.COLLECTION_TYPE_PREFIX=Ye;exports.COMPONENT_PROPS_PATH_SEPARATOR=le;exports.CSS_CLASSES_ATTRIBUTE_NAME=Te;exports.CSS_VARIABLE_NAME_MAX_LENGTH=Bt;exports.CSS_VARIABLE_NAME_PATTERN=Kt;exports.DEFAULT_BASE_Z_INDEX=st;exports.DEFAULT_CLOUDINARY_CLOUD_NAME=Nt;exports.DEFAULT_LIBRARY_ID=te;exports.DEFAULT_PUBLISHED_WIDGET_CACHE_MS=Po;exports.DEFAULT_ROW_GAP=Rn;exports.DEV_CLIENT_TOKEN_PREFIX=vt;exports.DEV_WIDGET_API_PATH=St;exports.DEV_WIDGET_RESOLVE_API_PATH=It;exports.DeviceDisplayTypes=Vo;exports.DisplayComponent=to;exports.DisplayItemTypes=_e;exports.DragItemIdPrefixTypes=Ge;exports.EMBEDDED_KEY_SEPARATOR=Rt;exports.FLEX_LAYOUT_STYLE_KEYS_THAT_DERIVE_DISPLAY=un;exports.FetchRuleCMSWidgetError=X;exports.HIDE_WIDGET_ATTRIBUTE_NAME=nt;exports.JustifyContentTypes=je;exports.POINTER_EVENTS_ATTRIBUTE_NAME=Wn;exports.PUBLISHED_KEY_SEPARATOR=ye;exports.PUBLISHED_WIDGET_API_PATH=wt;exports.PUBLISHED_WIDGET_RESOLVE_API_PATH=Tt;exports.PageViewTypes=Me;exports.RULECMS_ANONYMOUS_ID_STORAGE_KEY=He;exports.RULECMS_API_ORIGIN=At;exports.RULECMS_PUBLISHED_KEY_ATTRIBUTE=Gi;exports.RULECMS_WIDGET_CONTEXT_KEY=$e;exports.RenderComponents=ro;exports.RenderComponentsForDevice=be;exports.RenderComponentsInner=he;exports.RuleCMSWidget=Zi;exports.RuleCMSWidgetProvider=Xo;exports.WIDGET_ATTRIBUTES_IGNORED_IN_COMPOSE_MODE=Mn;exports.WIDGET_CACHE_API_ORIGIN=Et;exports.WIDGET_PLACEHOLDER_VALUES_KEY=Ke;exports.Z_INDEX_WIDGET_ATTRIBUTE_NAME=Vn;exports.alignContentAllowlist=rn;exports.alignItemsAllowlist=nn;exports.backgroundPositionAllowlist=an;exports.backgroundRepeatAllowlist=cn;exports.backgroundSizeAllowlist=ln;exports.borderStyleKeywords=dn;exports.boxSpacingSideKeys=zt;exports.boxSpacingStyleAttributeEntries=pr;exports.buildCloudinaryBackgroundUrl=Ft;exports.buildOverlayLayerBoxStyles=zn;exports.buildOverlayStackStyles=Hn;exports.buildWidgetFetchUrl=Je;exports.buildWidgetResolveUrl=qe;exports.clearPublishedWidgetFetchCache=Qi;exports.collectComponentInstancePaths=Xn;exports.collectReferencedLibraryIds=ve;exports.composeSourceComponentsPlugin=_t;exports.createComponentLibraryRegistry=ie;exports.cssAttrArrayKey=me;exports.defaultPageWidth=Ot;exports.deriveDisplayFlexIfNeeded=Pn;exports.desktopModeWidth=Jo;exports.fetchRuleCMSWidget=tl;exports.findUnmatchedComponentPropsKeys=Jn;exports.flexDirectionAllowlist=sn;exports.flexWrapAllowlist=on;exports.fontFamilyAllowlist=Xt;exports.fontStyleAllowlist=qt;exports.fontWeightAllowlist=Jt;exports.formatBackgroundImageStyles=bn;exports.formatBorderStyles=Cn;exports.formatBoxShadowStyles=_n;exports.formatBoxSpacingStyles=vn;exports.formatCssColorStyles=An;exports.formatCssColorValue=we;exports.formatCssEnumStyles=En;exports.formatCssLengthStyles=wn;exports.formatCssVariable=K;exports.formatCssVariableStyles=ar;exports.formatLineHeightStyles=Sn;exports.formatObjectStyleAttribute=In;exports.formatOpacityStyles=Tn;exports.formatSpacingSideValue=Z;exports.generatePublishedKey=xt;exports.generatePublishedKeyForEmbedded=zo;exports.getCollectionIdForCollectionType=Qe;exports.getColumnAttributes=se;exports.getComponentAttributesAndStyles=Ve;exports.getComponentsPluginFromPlugins=pe;exports.getCssVariableFromLeaf=L;exports.getDefaultDimensionAttributes=Dn;exports.getDeviceTypeBasedAttributes=Y;exports.getDragItemId=Fo;exports.getDragItemPrefixAndId=Pt;exports.getIdAndPrefix=Dt;exports.getMergedAttributes=Ln;exports.getNameAndInstanceIdFromWidgetKey=Ko;exports.getNameFromWidgetKey=Bo;exports.getOrCreateAnonymousId=wo;exports.getOverlayLayerZIndex=Kn;exports.getWidgetKeyForCollection=Lt;exports.getWidgetKeyForCollectionWithPrefix=Uo;exports.getWidgetKeyForPublishedCollection=kt;exports.getWidgetKeyForPublishedCollectionWithPrefix=Ho;exports.hasBoxShadowLeaf=mn;exports.hasDeviceDivergentValues=Zn;exports.hasInvalidCssVariable=H;exports.hasItems=kn;exports.hasOverlayLayers=Fn;exports.incrementVersion=Go;exports.isBackgroundImageValue=Ut;exports.isBorderStyleValue=fn;exports.isBorderValue=gn;exports.isBoxShadowValue=pn;exports.isBoxSpacingValue=Gt;exports.isCloudinaryCloudName=Mt;exports.isCloudinaryPublicId=Wt;exports.isCloudinaryTransformationString=Vt;exports.isCssColorValue=Ee;exports.isCssEnumValue=Yt;exports.isCssVariableName=Q;exports.isDevClientToken=G;exports.isLineHeightValue=yn;exports.isOpacityValue=hn;exports.isOverlayLayerEmptyForDevice=Un;exports.isRowHiddenForDevice=On;exports.isSafeImageUrl=jt;exports.isSpacingSideValue=q;exports.isWidgetHiddenForDevice=Pe;exports.justifyContentAllowlist=tn;exports.normalizeCssClasses=Ie;exports.objectStyleAttributeRegistry=Se;exports.overflowAllowlist=ge;exports.phoneModeWidth=et;exports.pointerEventsAllowlist=en;exports.prepareRuleCMSWidgetData=Le;exports.resolveBaseZIndex=Fe;exports.resolveKey=ze;exports.resolveOverlayLayerPointerEvents=Bn;exports.resolveRowStyles=Nn;exports.resolveWidgetApiOrigin=Xe;exports.resolveWidgetContainerStyles=ot;exports.resolveWidgetInstanceProps=Gn;exports.resolveWidgetLibraries=nl;exports.rowBasedPropertiesAreAssigned=xn;exports.spacingKeywords=Ae;exports.spacingLengthUnits=Ht;exports.stableJsonStringify=Io;exports.tabletModeWidth=tt;exports.textAlignAllowlist=Zt;exports.textDecorationAllowlist=Qt;exports.textTransformAllowlist=$t;exports.toStyleAttr=W;exports.typeHasPrefix=Ze;exports.warnUnmatchedComponentProps=qn;exports.widgetBasedPropertiesAreAssigned=jn;exports.widgetDeclaresOwnHeight=rt;exports.withWidgetPlaceholderValues=Yn;