@rettangoli/ui 1.0.0-rc15 → 1.0.0-rc16
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.
|
@@ -1071,7 +1071,7 @@ var rettangoli=(()=>{var ua=Object.defineProperty;var R=(e,t)=>{for(var r in t)u
|
|
|
1071
1071
|
min-width: 200px;
|
|
1072
1072
|
max-width: 400px;
|
|
1073
1073
|
}
|
|
1074
|
-
`))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._dialogElement=document.createElement("dialog"),this.shadow.appendChild(this._dialogElement),this._dialogElement.addEventListener("click",t=>{t.stopPropagation();let r=t.composedPath();(r[0]===this._dialogElement||r[0].nodeName==="DIALOG"&&r[0]===this._dialogElement)&&this._emitClose()}),this._dialogElement.addEventListener("contextmenu",t=>{let r=t.composedPath();(r[0]===this._dialogElement||r[0].nodeName==="DIALOG"&&r[0]===this._dialogElement)&&(t.preventDefault(),this._emitClose())}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._emitClose()}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this._dialogElement.appendChild(this._popoverContainer),this._slotElement=null,this._isOpen=!1}_emitClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","x","y","place","no-overlay"]}connectedCallback(){this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._isOpen&&this._dialogElement.open&&this._dialogElement.close()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._isOpen?this.isConnected&&this._show():s===null&&this._isOpen&&this._hide():(t==="x"||t==="y"||t==="place")&&this._isOpen?this._updatePosition():t==="no-overlay"&&r!==s&&this._isOpen&&(this._hide(),this._show())}_show(){this._isOpen||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._dialogElement.open||setTimeout(()=>{this._dialogElement&&!this._dialogElement.open&&(this.hasAttribute("no-overlay")?this._dialogElement.show():this._dialogElement.showModal())},0),requestAnimationFrame(()=>{this._updatePosition()}))}_hide(){this._isOpen&&(this._isOpen=!1,this._dialogElement.open&&this._dialogElement.close(),this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null))}_updatePosition(){let t=parseFloat(this.getAttribute("x")||"0"),r=parseFloat(this.getAttribute("y")||"0"),s=this.getAttribute("place")||"bs";this.removeAttribute("positioned"),requestAnimationFrame(()=>{let i=this._popoverContainer.getBoundingClientRect(),{left:n,top:a}=this._calculatePosition(t,r,i.width,i.height,s);this._popoverContainer.style.left=`${n}px`,this._popoverContainer.style.top=`${a}px`,requestAnimationFrame(()=>{this.setAttribute("positioned","")})})}_calculatePosition(t,r,s,i,n){let l=t,p=r;switch(n){case"t":l=t-s/2,p=r-i-8;break;case"ts":l=t,p=r-i-8;break;case"te":l=t-s,p=r-i-8;break;case"r":l=t+8,p=r-i/2;break;case"rs":l=t+8,p=r;break;case"re":l=t+8,p=r-i;break;case"b":l=t-s/2,p=r+8;break;case"bs":l=t,p=r+8;break;case"be":l=t-s,p=r+8;break;case"l":l=t-s-8,p=r-i/2;break;case"ls":l=t-s-8,p=r;break;case"le":l=t-s-8,p=r-i;break;default:l=t,p=r+8;break}let o=8;return l=Math.max(o,Math.min(l,window.innerWidth-s-o)),p=Math.max(o,Math.min(p,window.innerHeight-i-o)),{left:l,top:p}}get popover(){return this._popoverContainer}},Os=({render:e,html:t})=>Yt;var Xt={};R(Xt,{handleClickHeader:()=>Da});var Da=(e,t)=>{let{store:r,render:s}=e;r.toggleOpen({}),s()};var Ts={componentName:"rtgl-accordion-item",propsSchema:{type:"object",properties:{label:{type:"string"},content:{type:"string"},w:{type:"string"}}},events:[],methods:{type:"object",properties:{}}};var Zt={};R(Zt,{createInitialState:()=>Ba,selectViewData:()=>Ma,toggleOpen:()=>Wa});var Ba=()=>Object.freeze({open:!1}),ja=["id","class","style","slot","label","content"],Fa=(e={})=>Object.entries(e).filter(([t])=>!ja.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ma=({state:e,props:t})=>({label:t.label||"",content:t.content||"",openClass:e.open?"content-wrapper open":"content-wrapper",chevronIcon:e.open?"chevronUp":"chevronDown",containerAttrString:Fa(t)}),Wa=({state:e})=>{e.open=!e.open};var Ls={refs:{header:{eventListeners:{click:{handler:"handleClickHeader"}}}},styles:{".content-wrapper":{display:"grid","grid-template-rows":"0fr",transition:"grid-template-rows 0.2s ease-out"},".content-wrapper.open":{"grid-template-rows":"1fr"},".content-inner":{overflow:"hidden"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=v ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view#header d=h av=c w=f pv=md cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"label"}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-svg svg=${chevronIcon} wh=16 c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg svg=",{type:1,path:"chevronIcon"}," wh=16 c=mu-fg"]}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:'div class="${openClass}"',value:{type:9,items:[{type:8,properties:[{key:"div class=content-inner",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view pb=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"content"}}],fast:!0},{type:8,properties:[{key:"slot name=content",value:{type:0,value:null}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:['div class="',{type:1,path:"openClass"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=v ",{type:1,path:"containerAttrString"}]}}],fast:!0}],fast:!0}};var Qt={};R(Qt,{handleClickItem:()=>za});var za=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=Number(i.currentTarget.dataset.index),a=Array.isArray(s.items)?s.items[n]:void 0;if(!a)return;if(a.disabled||a.current){i.preventDefault();return}typeof a.href=="string"&&a.href.length>0||i.preventDefault(),r(new CustomEvent("item-click",{detail:{id:a.id,path:a.path,href:a.href,item:a,index:n,trigger:i.type}}))};var Rs={componentName:"rtgl-breadcrumb",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},href:{type:"string"},path:{type:"string"},current:{type:"boolean"},disabled:{type:"boolean"},click:{type:"boolean"},newTab:{type:"boolean"},rel:{type:"string"}}}},sep:{type:"string",default:"breadcrumb-arrow"},max:{type:"number"}}},events:{"item-click":{type:"object",properties:{id:{type:"string"},path:{type:"string"},href:{type:"string"},item:{type:"object"},index:{type:"number"},trigger:{type:"string"}}}},methods:{type:"object",properties:{}}};var er={};R(er,{createInitialState:()=>Ua,selectViewData:()=>Xa});var Ua=()=>Object.freeze({}),Ka=["id","class","style","slot","items","sep","max","separator"],Ha=(e={})=>Object.entries(e).filter(([t])=>!Ka.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ga=e=>{if(e==null||e==="")return;let t=Number(e);return Number.isNaN(t)?void 0:t},qa=e=>`${e}`.replace(/"/g,"""),Ja=(e,t)=>{if(!t||t<3||e.length<=t)return e;let r=t-2;return[e[0],{isEllipsis:!0,label:"..."},...e.slice(-r)]},Ya=e=>e.map((t,r)=>{let s=typeof t.href=="string"&&t.href.length>0,i=t.path!==void 0&&t.path!==null&&`${t.path}`!="",n=!!t.current,a=!!t.disabled,l=!n&&!a&&(s||i||!!t.click),p=t.rel||(t.newTab?"noopener noreferrer":""),o=[t.newTab?'target="_blank"':"",p?`rel="${qa(p)}"`:""].filter(Boolean).join(" ");return{...t,label:t.label||"",index:r,href:s?t.href:void 0,path:i?t.path:void 0,isCurrent:n,isDisabled:a,isInteractive:l,linkExtraAttrs:o,c:n?"fg":"mu-fg"}}),Xa=({props:e})=>{let t=Ha(e),r=Array.isArray(e.items)?e.items:[],s=Ga(e.max),i=e.sep||"breadcrumb-arrow",n=Ya(r),a=Ja(n,s),l=[];return a.forEach((p,o)=>{l.push(p),o<a.length-1&&l.push({isSeparator:!0})}),{containerAttrString:t,items:l,sep:i}};var Ns={refs:{"item*":{eventListeners:{click:{handler:"handleClickItem"}}}},styles:{a:{"text-decoration":"none",color:"inherit"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md p=sm ${containerAttrString}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"$if item.isSeparator",value:{type:6,conditions:[{type:1,path:"item.isSeparator"},{type:1,path:"item.isEllipsis"},{type:4,op:6,left:{type:1,path:"item.isInteractive"},right:{type:1,path:"item.href"}},{type:1,path:"item.isInteractive"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${sep} c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"sep"}," c=mu-fg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#item${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#item",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," ",{type:1,path:"item.linkExtraAttrs"}," data-index=",{type:1,path:"item.index"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item${i} data-index=${item.index} cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#item",{type:1,path:"i"}," data-index=",{type:1,path:"item.index"}," cur=pointer"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view d=h av=c g=md p=sm ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var tr={};R(tr,{handleClickMenuItem:()=>Qa,handleClosePopover:()=>Za});var Za=(e,t)=>{let{dispatchEvent:r}=e;r(new CustomEvent("close"))},Qa=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=Number(i.currentTarget.dataset.index??i.currentTarget.id.slice(6)),a=s.items[n],l=a?.type||"item";if(!a||l!=="item"||a.disabled){i.preventDefault();return}a.href||i.preventDefault(),r(new CustomEvent("item-click",{detail:{index:n,item:a,id:a.id,path:a.path,href:a.href,trigger:i.type}}))};var Vs={componentName:"rtgl-dropdown-menu",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},type:{type:"string",enum:["label","item","separator"]},id:{type:"string"},path:{type:"string"},href:{type:"string"},disabled:{type:"boolean"},newTab:{type:"boolean"},rel:{type:"string"},testId:{type:"string"}}}},open:{type:"boolean"},x:{type:"string"},y:{type:"string"},place:{type:"string"},w:{type:"string"},h:{type:"string"}}},events:{close:{type:"object"},"item-click":{type:"object",properties:{index:{type:"number"},item:{type:"object"},id:{type:"string"},path:{type:"string"},href:{type:"string"},trigger:{type:"string"}}}},methods:{type:"object",properties:{}}};var rr={};R(rr,{createInitialState:()=>eo,selectViewData:()=>so});var eo=()=>Object.freeze({}),to=e=>`${e}`.replace(/"/g,"""),ro=e=>e.map((t,r)=>{let s=t.type||"item",i=s==="separator",n=s==="label",a=s==="item",l=!!t.disabled,p=a&&!l,o=l?"mu-fg":"fg",u=l?"mu":"",c=l?"":"ac",d=typeof t.href=="string"&&t.href.length>0,h=t.rel||(t.newTab?"noopener noreferrer":""),f=[t.newTab?'target="_blank"':"",h?`rel="${to(h)}"`:""].filter(Boolean).join(" ");return{...t,index:r,type:s,isSeparator:i,isLabel:n,isItem:a,isDisabled:l,isInteractive:p,hasHref:d,linkExtraAttrs:f,c:o,bgc:u,hoverBgc:c}}),so=({props:e})=>{let t=Array.isArray(e.items)?e.items:[];return{items:ro(t),open:!!e.open,x:e.x||0,y:e.y||0,w:e.w||"300",h:e.h||"300",place:e.place||"bs"}};var Ps={refs:{popover:{eventListeners:{close:{handler:"handleClosePopover"}}},"option*":{eventListeners:{click:{handler:"handleClickMenuItem"}}}},styles:{a:{display:"block",width:"100%","text-decoration":"none",color:"inherit"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=${w} h=${h} sv g=xs slot=content bgc=mu br=md",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"$if item.isLabel",value:{type:6,conditions:[{type:1,path:"item.isLabel"},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:1,path:"item.isDisabled"}},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:4,op:6,left:{type:1,path:"item.hasHref"},right:{type:1,path:"item.linkExtraAttrs"}}},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:1,path:"item.hasHref"}},{type:1,path:"item.isItem"},{type:1,path:"item.isSeparator"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f ph=lg pv=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f ph=lg pv=md br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f ph=lg pv=md br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#option${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#option",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," ",{type:1,path:"item.linkExtraAttrs"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#option${i} href=${item.href} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#option",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#option${i} w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option",{type:1,path:"i"}," w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=1 ph=lg mv=md bgc=bo",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," sv g=xs slot=content bgc=mu br=md"]}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"open"}," x=",{type:1,path:"x"}," y=",{type:1,path:"y"}," place=",{type:1,path:"place"}]}}],fast:!1}],fast:!1}};var dr={};R(dr,{handleActionClick:()=>yl,handleAfterMount:()=>dl,handleBeforeMount:()=>ul,handleImageClick:()=>gl,handleKeyDown:()=>bl,handleOnUpdate:()=>fl,handleTooltipMouseEnter:()=>vl,handleTooltipMouseLeave:()=>wl,handleValueChange:()=>ml,handleValueInput:()=>hl});var ur={};R(ur,{clearFieldError:()=>al,collectAllDataFields:()=>Q,createInitialState:()=>el,flattenFields:()=>cr,get:()=>ie,getDefaultValue:()=>Ye,hideTooltip:()=>pl,isDataField:()=>pr,pruneHiddenValues:()=>Re,resetFormValues:()=>il,selectForm:()=>K,selectFormValues:()=>me,selectViewData:()=>tl,set:()=>pe,setErrors:()=>nl,setFormFieldValue:()=>rl,setFormValues:()=>sl,setReactiveMode:()=>ol,showTooltip:()=>ll,validateField:()=>Je,validateForm:()=>Le});var v={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9,PARTIAL:10,PATH_REFERENCE:11},P={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},Ge={NOT:0};var k=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},re=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var sr=e=>{if(!e||e.trim()==="")throw new k("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new k(`Invalid comparison operator '${e.includes("===")?"===":"!=="}' - did you mean '${r}'? (got: '${e}')`)}let t=["<",">","<=",">=","==","!="];for(let r of t)if(e.trim().endsWith(r))throw new k(`Incomplete comparison expression - missing right operand (got: '${e}')`)},Ds=e=>{if(e.trim().endsWith(" in"))throw new k(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new k(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new k(`Missing iterable expression after 'in' (got: '$for ${e}')`);let s=t.includes(",")?t.split(",").map(i=>i.trim()):[t.trim()];for(let i of s){if(!i)throw new k(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`);if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))throw new k(`Invalid loop syntax (got: '$for ${e}')`)}};var Bs=(e,t,r=!1)=>{if(t===null)return new re(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new re(`Cannot iterate over undefined value at '$for ${e}'`);let s=typeof t;return r?new re(`Cannot iterate over non-array value in loop '${e}' - got ${s} instead`):new re(`Cannot iterate over non-array value (got: ${s}) at '$for ${e}'`)},js=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new re(`Unknown function '${e}' (${r})`)};var io=(e,t,r={})=>{let s={},i={};r&&typeof r=="object"&&(r.functions!==void 0||r.partials!==void 0?(s=r.functions||{},i=r.partials||{}):typeof r=="object"&&(s=r));let a=C(e,{functions:s,partials:i},t,{});return a===void 0?{}:a},C=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return W(e.var,r,s);if(e.type===v.LITERAL)return e.value;if(e.type===v.VARIABLE)return W(e.path,r,s);if(e.type===v.INTERPOLATION)return ao(e.parts,t,r,s);switch(e.type){case v.FUNCTION:return Ms(e,t,r,s);case v.BINARY:return Ws(e,t,r,s);case v.UNARY:return zs(e,t,r,s);case v.CONDITIONAL:return lo(e,t,r,s);case v.LOOP:return ho(e,t,r,s);case v.OBJECT:return yo(e,t,r,s);case v.ARRAY:return go(e,t,r,s);case v.PARTIAL:return bo(e,t,r,s);case v.PATH_REFERENCE:return vo(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},Fs=new Map,no=e=>{let t=[],r="",s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(n==="[")r&&(t.push({type:"property",value:r}),r=""),s=!0;else if(n==="]"){if(s&&r){let a=r.trim();if(/^\d+$/.test(a))t.push({type:"index",value:parseInt(a,10)});else if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")){let l=a.slice(1,-1);t.push({type:"property",value:l})}else t.push({type:"property",value:a});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},W=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=Fs.get(e);if(!s){let n=[],a="",l=0;for(let p=0;p<e.length;p++){let o=e[p];o==="["?(l++,a+=o):o==="]"?(l--,a+=o):o==="."&&l===0?a&&(n.push(a),a=""):a+=o}a&&n.push(a),s=[];for(let p of n){let o=no(p.trim());s.push(...o)}Fs.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let a=s[n];if(a.type==="property"&&a.value in r){i=r[a.value];continue}if(i==null)return;(a.type==="property"||a.type==="index")&&(i=i[a.value])}return i},ao=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let a=C(n,t,r,s);i.push(a!=null?String(a):"")}return i.join("")},Ms=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw js(e.name,i);let a=e.args.map(l=>C(l,t,r,s));return n(...a)},Te=(e,t,r,s)=>{if(e.var&&!e.type)return W(e.var,r,s);switch(e.type){case v.VARIABLE:return W(e.path,r,s);case v.LITERAL:return e.value;case v.BINARY:return Ws(e,t,r,s);case v.UNARY:return zs(e,t,r,s);case v.FUNCTION:return Ms(e,t,r,s);default:return C(e,t,r,s)}},Ws=(e,t,r,s)=>{if(e.op===P.AND||e.op===P.OR){let a=Te(e.left,t,r,s),l=Te(e.right,t,r,s);switch(e.op){case P.AND:return a&&l;case P.OR:return a||l}}let i=C(e.left,t,r,s),n=C(e.right,t,r,s);switch(e.op){case P.EQ:return i==n;case P.NEQ:return i!=n;case P.GT:return i>n;case P.LT:return i<n;case P.GTE:return i>=n;case P.LTE:return i<=n;case P.IN:return Array.isArray(n)?n.includes(i):!1;case P.ADD:if(typeof i!="number"||typeof n!="number")throw new re(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case P.SUBTRACT:if(typeof i!="number"||typeof n!="number")throw new re(`Arithmetic operations require numbers. Got ${typeof i} - ${typeof n}`);return i-n;default:throw new Error(`Unknown binary operator: ${e.op}`)}},zs=(e,t,r,s)=>{let i=e.op===Ge.NOT?Te(e.operand,t,r,s):C(e.operand,t,r,s);switch(e.op){case Ge.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},oo=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===v.VARIABLE)if(W(i.path,r,s)){let a=e.bodies[0];if(a.type===v.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?C(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===v.LITERAL)l[o]=u.value;else if(u.type===v.VARIABLE)l[o]=W(u.path,r,s);else if(u.type===v.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===v.VARIABLE){let h=W(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=C(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=C(u,t,r,s)}return l}}else{let a=e.bodies[1];if(a.type===v.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?C(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===v.LITERAL)l[o]=u.value;else if(u.type===v.VARIABLE)l[o]=W(u.path,r,s);else if(u.type===v.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===v.VARIABLE){let h=W(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=C(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=C(u,t,r,s)}return l}}}return null},lo=(e,t,r,s)=>{let i=oo(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let a=e.conditions[n];if(a===null||Te(a,t,r,s))return C(e.bodies[n],t,r,s)}return Us},po=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===v.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===v.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let a=i.substring(s.length+1);if(n.type===v.OBJECT&&n.properties.length<=5){for(let p of n.properties)if(p.parsedKey)return null;let l=[];for(let p=0;p<t.length;p++){let o=t[p];if(o[a]){let u={};for(let c of n.properties){let d=c.key,h=c.value;if(h.type===v.LITERAL)u[d]=h.value;else if(h.type===v.VARIABLE){let f=h.path;if(f===s)u[d]=o;else if(f.startsWith(s+".")){let m=f.substring(s.length+1);u[d]=o[m]}else return null}else if(h.type===v.INTERPOLATION){let f=[],m=!0;for(let g of h.parts)if(typeof g=="string")f.push(g);else if(g.type===v.VARIABLE){let y=g.path;if(y===s)f.push(o!=null?String(o):"");else if(y.startsWith(s+".")){let w=y.substring(s.length+1),_=o[w];f.push(_!=null?String(_):"")}else{m=!1;break}}else{m=!1;break}if(!m)return null;u[d]=f.join("")}else return null}l.push(u)}}return l}}}return null},co=(e,t)=>{let r=e.body,s=e.itemVar,i=po(e,t);if(i!==null)return i;if(r.type===v.OBJECT&&r.properties.length<=5&&!r.whenCondition){for(let l of r.properties)if(l.parsedKey)return null;let n=[],a=!0;for(let l of r.properties){let p=l.key,o=l.value;if(o.type===v.LITERAL)n.push({key:p,type:"literal",value:o.value});else if(o.type===v.VARIABLE){let u=o.path;if(u===s)n.push({key:p,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes(".")&&!c.includes("["))n.push({key:p,type:"prop",prop:c});else{a=!1;break}}else{a=!1;break}}else if(o.type===v.INTERPOLATION&&o.parts.length===1){let u=o.parts[0];if(u.type===v.VARIABLE){let c=u.path;if(c===s)n.push({key:p,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:p,type:"prop_string",prop:d});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let l=new Array(t.length);if(n.length===3&&n[0].type==="prop"&&n[0].key==="id"&&n[1].type==="prop_string"&&n[1].key==="title"&&n[2].type==="prop"&&n[2].key==="completed")for(let p=0;p<t.length;p++){let o=t[p];l[p]={id:o.id,title:o.title!=null?String(o.title):"",completed:o.completed}}else for(let p=0;p<t.length;p++){let o=t[p],u={};for(let c of n)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=o;else if(c.type==="prop")u[c.key]=o[c.prop];else if(c.type==="item_string")u[c.key]=o!=null?String(o):"";else if(c.type==="prop_string"){let d=o[c.prop];u[c.key]=d!=null?String(d):""}l[p]=u}return l}}return null},uo=(e,t,r,s,i)=>{let n=[],a=e.body;if(a.type===v.OBJECT&&a.fast!==!1){let l=e.itemVar,p=e.indexVar;for(let o=0;o<i.length;o++){let u=i[o],c={},d={...s,[l]:u,...p&&{[p]:o}};d.__paths__||(d.__paths__=s.__paths__||{});let h=e.iterable.path||"";if(s&&s.__paths__&&h){let f=h.split("."),m=f[0];m in s.__paths__&&(h=s.__paths__[m],f.length>1&&(h+="."+f.slice(1).join(".")))}d.__paths__={...d.__paths__,[l]:`${h}[${o}]`,...p&&{[p]:o}};for(let f of a.properties){let m=f.parsedKey?C(f.parsedKey,t,r,d):f.key,g=f.value;if(g.type===v.LITERAL)c[m]=g.value;else if(g.type===v.VARIABLE){let y=g.path;if(y===l)c[m]=u;else if(y===p)c[m]=o;else if(y.startsWith(l+".")){let w=y.substring(l.length+1);!w.includes(".")&&!w.includes("[")?c[m]=u[w]:c[m]=W(y,r,{...s,[l]:u,...p&&{[p]:o}})}else c[m]=W(y,r,{...s,[l]:u,...p&&{[p]:o}})}else if(g.type===v.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===v.VARIABLE){let _=w.path,x;if(_===l)x=u;else if(_===p)x=o;else if(_.startsWith(l+".")){let E=_.substring(l.length+1);!E.includes(".")&&!E.includes("[")?x=u[E]:x=W(_,r,{...s,[l]:u,...p&&{[p]:o}})}else x=W(_,r,{...s,[l]:u,...p&&{[p]:o}});y.push(x!=null?String(x):"")}else{let _={...s,[l]:u,...p&&{[p]:o}},x=C(w,t,r,_);y.push(x!=null?String(x):"")}c[m]=y.join("")}else{let y={...s,[l]:u,...p&&{[p]:o}};c[m]=C(g,t,r,y)}}n.push(c)}return n}return null},fo=(e,t,r)=>{let s=e.body;if(s.type===v.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===v.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===v.VARIABLE&&n.conditions[0].path==="item.visible"){let a=n.bodies[0];if(a.type===v.OBJECT&&a.properties.length===2){let l=a.properties[0],p=a.properties[1];if(l.key==="id"&&l.value.type===v.VARIABLE&&l.value.path==="item.id"&&p.key==="$if item.highlighted"&&p.value.type===v.CONDITIONAL){let o=[];for(let u=0;u<t.length;u++){let c=t[u];if(c.visible){let d={id:c.id};c.highlighted?(d.highlight=!0,d.message=`This item is highlighted: ${c.name}`):(d.highlight=!1,d.message=c.name),o.push(d)}}return o}}}}return null},ho=(e,t,r,s)=>{let i=C(e.iterable,t,r,s);if(!Array.isArray(i)){let o,u=!1;if(e.iterable.type===v.FUNCTION){u=!0;let d=e.iterable.args.map(h=>h.type===v.LITERAL?typeof h.value=="string"?`'${h.value}'`:String(h.value):h.type===v.VARIABLE?h.path:h.type===v.FUNCTION?`${h.name}(...)`:"?").join(", ");o=`${e.iterable.name}(${d})`}else o=e.iterable.path||"undefined";let c=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${o}`;throw Bs(c,i,u)}if(!e.indexVar){let o=fo(e,i,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=co(e,i);if(o!==null)return o}let n=uo(e,t,r,s,i);if(n!==null)return n;let a=[],l=e.iterable.path||"";if(s&&s.__paths__&&l){let o=l.split("."),u=o[0];u in s.__paths__&&(l=s.__paths__[u],o.length>1&&(l+="."+o.slice(1).join(".")))}let p=!1;e.body.type===v.ARRAY&&(e.body.items.length<=1?p=!1:p=e.body._shouldPreserveArray??=e.body.items.some(o=>o.type===v.OBJECT&&o.properties.some(u=>u.key.startsWith("$if ")||u.key.startsWith("$when "))));for(let o=0;o<i.length;o++){let u=e.indexVar?{...s,[e.itemVar]:i[o],[e.indexVar]:o}:{...s,[e.itemVar]:i[o]};u.__paths__||(u.__paths__=s.__paths__||{}),u.__paths__={...u.__paths__,[e.itemVar]:`${l}[${o}]`},e.indexVar&&(u.__paths__[e.indexVar]=o);let c=C(e.body,t,r,u);if(Array.isArray(c)&&c.length===1&&!p){let d=c[0];a.push(d===void 0?{}:d)}else a.push(c===void 0?{}:c)}return a},mo=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let i=e.properties[0],n=i.parsedKey?C(i.parsedKey,t,r,s):i.key,a=i.value;if(a.type===v.OBJECT&&a.properties.length<=10&&!a.whenCondition){let l={},p={},o=!0;for(let u of a.properties){let c=u.parsedKey?C(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===v.LITERAL)p[c]=d.value;else if(d.type===v.VARIABLE)p[c]=W(d.path,r,s);else if(d.type===v.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===v.VARIABLE){let m=W(f.path,r,s);h.push(m!=null?String(m):"")}else{o=!1;break}if(!o)break;p[c]=h.join("")}else if(d.type===v.OBJECT&&d.properties.length<=5){let h={};for(let f of d.properties){let m=f.key,g=f.value;if(g.type===v.LITERAL)h[m]=g.value;else if(g.type===v.VARIABLE)h[m]=W(g.path,r,s);else if(g.type===v.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===v.VARIABLE){let _=W(w.path,r,s);y.push(_!=null?String(_):"")}else{o=!1;break}if(!o)break;h[m]=y.join("")}else{o=!1;break}}if(!o)break;p[c]=h}else{o=!1;break}}if(o)return l[n]=p,l}}return null},yo=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!Te(e.whenCondition,i,r,s))return;let n=mo(e,t,r,s);if(n!==null)return n;if(e.fast){let o={};for(let u of e.properties){let c=u.parsedKey?C(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===v.LITERAL)o[c]=d.value;else if(d.type===v.VARIABLE)o[c]=W(d.path,r,s);else if(d.type===v.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===v.VARIABLE){let m=W(f.path,r,s);h.push(m!=null?String(m):"")}else{let m=C(f,t,r,s);h.push(m!=null?String(m):"")}o[c]=h.join("")}else o[c]=C(d,t,r,s)}return o}let a={},l=null,p=!1;for(let o of e.properties)if(!o.key.startsWith("$if ")&&!o.key.match(/^\$if\s+\w+.*:?$/)&&!o.key.startsWith("$elif")&&!o.key.startsWith("$else")&&!o.key.startsWith("$for ")){p=!0;break}for(let o of e.properties)if(o.key.startsWith("$if ")||o.key.match(/^\$if\s+\w+.*:?$/)){let u=C(o.value,t,r,s);if(!p&&u!==null&&u!==void 0)return Array.isArray(u)&&u.length===1?u[0]:u;typeof u=="object"&&u!==null&&!Array.isArray(u)&&Object.assign(a,u)}else if(o.key.startsWith("$for ")){if(e.properties.length===1)return C(o.value,t,r,s)}else{let u=o.value;if(u&&u.type===v.OBJECT&&u.properties){let c=u.properties.find(d=>d.key.startsWith("$for "));if(c){let d=C(c.value,t,r,s);d!==void 0&&(a[o.key]=d)}else{let d=C(o.value,t,r,s);d!==void 0&&(a[o.key]=d)}}else{let c=o.parsedKey?C(o.parsedKey,t,r,s):o.key,d=C(o.value,t,r,s);d!==void 0&&(a[c]=d)}}return a},Us={},go=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===v.LOOP){let a=C(n,t,r,s);Array.isArray(a)&&n.flatten!==!1?i.push(...a):i.push(a)}else{let a=C(n,t,r,s);a!==Us&&a!==void 0&&i.push(a)}return i},bo=(e,t,r,s)=>{let{name:i,data:n,whenCondition:a}=e,l=t.partials||{},p=t.functions||t;if(a&&!Te(a,p,r,s))return;if(!l[i])throw new re(`Partial '${i}' is not defined`);let o=s._partialStack||[];if(o.includes(i))throw new re(`Circular partial reference detected: ${i}`);let u=l[i],c=r,d={...s,_partialStack:[...o,i]};if(s){c={...r};for(let h of Object.keys(s))h.startsWith("_")||(c[h]=s[h])}if(n){let h=C(n,t,r,s);c={...c,...h}}return C(u,t,c,d)},vo=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),a=n[0],l=n.slice(1);if(!s||!(a in s))throw new re(`Path reference '#{${i}}' refers to '${a}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(a in s.__paths__))throw new re(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let p=s.__paths__[a];if(typeof p=="number"){if(l.length>0)throw new re(`Path reference '#{${i}}' - cannot access properties on index variable '${a}'`);return String(p)}return l.length>0&&(p+="."+l.join(".")),p},ir=io;var wo=/\$\{([^}]*)\}/g,_o=/#\{([^}]*)\}/g,Hs=(e,t={})=>{let r=e.match(/^(\w+)\((.*)\)$/);if(!r)return{isFunction:!1};let[,s,i]=r,n=xo(i,t);return{isFunction:!0,type:v.FUNCTION,name:s,args:n}},xo=(e,t={})=>e.trim()?Eo(e).map(s=>Ao(s.trim(),t)):[],Eo=e=>{let t=[],r="",s=0,i=!1,n="";for(let a=0;a<e.length;a++){let l=e[a],p=a>0?e[a-1]:"";!i&&(l==='"'||l==="'")?(i=!0,n=l,r+=l):i&&l===n&&p!=="\\"?(i=!1,n="",r+=l):!i&&l==="("?(s++,r+=l):!i&&l===")"?(s--,r+=l):!i&&l===","&&s===0?(t.push(r),r=""):r+=l}return r&&t.push(r),t},Ao=(e,t={})=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:v.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:v.LITERAL,value:parseFloat(e)};if(e==="true")return{type:v.LITERAL,value:!0};if(e==="false")return{type:v.LITERAL,value:!1};if(e==="null")return{type:v.LITERAL,value:null};let r=Hs(e,t);if(r.isFunction)return{type:r.type,name:r.name,args:r.args};let s=e.trim(),i=[{op:" + ",type:"ADD"},{op:" - ",type:"SUBTRACT"}],n=-1,a=null;for(let{op:l,type:p}of i){let o=0;for(;o<s.length;){let u=Ae(s.substring(o),l);if(u===-1)break;let c=o+u;c>n&&(n=c,a={op:l,type:p}),o=c+l.length}}if(n!==-1)try{return Z(s,t)}catch{return{type:v.VARIABLE,path:s}}return{type:v.VARIABLE,path:s}},Gs=/^\w+\(.*\)$/,ko=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,$o=e=>{if(!(!e||e.trim()===""||Gs.test(e))&&ko.test(e))throw e.includes("?")&&e.includes(":")?new k(`Complex expressions not supported in variable replacements - consider calculating the value in your data instead. Offending expression: "${e}"`):e.includes("||")||e.includes("&&")||e.includes("??")?new k(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new k(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},Ks=e=>{let t=e.trim();if(Gs.test(t))throw new k(`Functions are not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("["))throw new k(`Array indices not supported in path references - use simple variable names or properties. Offending expression: "#{${e}}"`);if(/[+\-*/%]/.test(t))throw new k(`Arithmetic expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(/\|\||&&/.test(t))throw new k(`Logical operators not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("?")&&t.includes(":"))throw new k(`Complex expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);return{type:v.PATH_REFERENCE,path:t}},qe=(e,t={})=>{let r=e.trim();$o(r);let s=Hs(r,t);if(s.isFunction)return{type:s.type,name:s.name,args:s.args};if(r.includes("[")&&!/[\s+\-*/%|&?:]/.test(r)){let i=0;for(let n of r)n==="["?i++:n==="]"&&i--;if(i!==0)throw new Error("Invalid array index syntax")}return{type:v.VARIABLE,path:r}},nr=(e,t={})=>{let r=e,s=[];(e.includes("\\${")||e.includes("\\#{"))&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC_VAR$1"),r=r.replace(/\\\\(#\{[^}]*\})/g,"\\DOUBLE_ESC_PATH$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\(#\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\DOUBLE_ESC_VAR/g,"\\"),r=r.replace(/\\DOUBLE_ESC_PATH/g,"\\"));let i=[...r.matchAll(wo)],n=[...r.matchAll(_o)],a=[...i.map(o=>({match:o,type:"variable"})),...n.map(o=>({match:o,type:"pathref"}))].sort((o,u)=>o.match.index-u.match.index);if(a.length===0){let o=r;for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);return{type:v.LITERAL,value:o}}if(a.length===1&&a[0].match[0]===r&&s.length===0){let{match:o,type:u}=a[0];try{return u==="variable"?qe(o[1],t):Ks(o[1])}catch(c){if(c.message==="Invalid array index syntax")return{type:v.LITERAL,value:r};throw c}}let l=[],p=0;for(let{match:o,type:u}of a){let[c,d]=o,h=o.index;if(h>p){let f=r.substring(p,h);for(let m=0;m<s.length;m++)f=f.replace(`__ESCAPED_${m}__`,s[m]);f&&l.push(f)}try{let f;u==="variable"?f=qe(d.trim(),t):f=Ks(d.trim()),l.push(f)}catch(f){if(f.message==="Invalid array index syntax")l.push(c);else throw f}p=h+c.length}if(p<r.length){let o=r.substring(p);for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);o&&l.push(o)}return{type:v.INTERPOLATION,parts:l}};var ve=(e,t)=>typeof e=="string"?nr(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Co(e,t):Io(e,t):{type:v.LITERAL,value:e},So=e=>{let{$each:t,...r}=e;if(typeof t!="string")throw new k("$each value must be a non-empty string");let s=t.trim();if(s==="")throw new k("$each value must be a non-empty string");if(Object.keys(r).length===0)throw new k("Empty $each body not allowed");if(r.$partial!==void 0)throw new k("Cannot use $partial with $each at the same level. Wrap $partial in a parent object if you need conditionals.");return{[`$for ${s}`]:r}},Co=(e,t)=>{let r=[],s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(typeof n=="object"&&n!==null&&!Array.isArray(n)){if(n.$each!==void 0)try{let p=So(n),o=Object.keys(p);if(o.length===1&&/^\$for(?::\w+)?\s/.test(o[0])){let u=qs(o[0],p[o[0]],t,!0);r.push(u),s=!0;continue}}catch(p){throw p instanceof k?p:new k(p.message)}let l=Object.keys(n);if(l.length===1&&/^\$for(?::\w+)?\s/.test(l[0])){let p=qs(l[0],n[l[0]],t);r.push(p),s=!0;continue}}let a=ve(n,t);r.push(a),(a.type===v.FUNCTION||a.type===v.CONDITIONAL||a.type===v.LOOP||a.type===v.PARTIAL||a.type===v.OBJECT&&!a.fast||a.type===v.ARRAY&&!a.fast)&&(s=!0)}return{type:v.ARRAY,items:r,fast:!s}},Io=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),a=0;if(e.$partial!==void 0){if(typeof e.$partial!="string")throw new k("$partial value must be a string");if(e.$partial.trim()==="")throw new k("$partial value cannot be an empty string");let p=["$if","$elif","$else","$for"],o=[];for(let[y]of n)for(let w of p)if(y===w||y.startsWith(w+" ")||y.startsWith(w+"#")){o.push(w);break}if(o.length>0)throw new k(`Cannot use $partial with ${o.join(", ")} at the same level. Wrap $partial in a parent object if you need conditionals.`);let{$partial:u,$when:c,...d}=e,h={},f=!1;for(let[y,w]of Object.entries(d)){let _=y;(y.startsWith("\\$")||y.startsWith("$$"))&&(_=y.slice(1)),h[_]=w,f=!0}let m=null;if(f&&(m=ve(h,t),m.type===v.OBJECT)){let y=!1;for(let w of m.properties)if(w.value.type===v.VARIABLE||w.value.type===v.INTERPOLATION||w.value.type===v.FUNCTION||w.value.type===v.CONDITIONAL||w.value.type===v.OBJECT&&!w.value.fast||w.value.type===v.ARRAY&&!w.value.fast){y=!0;break}y&&(m.fast=!1)}let g={type:v.PARTIAL,name:u,data:m};if(c!==void 0){let y;if(typeof c=="string"){if(c.trim()==="")throw new k("Empty condition expression after '$when'");y=Z(c,t)}else y={type:v.LITERAL,value:c};g.whenCondition=y}return g}for(let[p,o]of n)if(p==="$when"){if(i!==null)throw new k("Multiple '$when' directives on the same object are not allowed");if(o==null)throw new k("Missing condition expression after '$when'");let u=typeof o=="string"?o:JSON.stringify(o);if(u.trim()==="")throw new k("Empty condition expression after '$when'");i=Z(u,t),s=!0}else if(p.startsWith("$when#")||p.startsWith("$when "))throw new k("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<n.length;){let[p,o]=n[a];if(p==="$when"){a++;continue}if(p==="$each")throw new k("$each can only be used inside arrays");if(p.startsWith("$if ")||p.match(/^\$if#\w+\s/)||p.match(/^\$if\s+\w+.*:$/)){let u=Oo(n,a,t);r.push({key:p,value:u.node}),s=!0,a=u.nextIndex}else if(/^\$for(?::\w+)?\s/.test(p)){let u=p.match(/^\$for(?::(\w+))?\s/)?.[1]||"",c=u?`:${u}`:"";throw new k(`$for loops must be inside arrays - use '- $for${c} item in items:' instead of '$for${c} item in items:'. For cleaner object generation syntax, consider using $each.`)}else{if(p.startsWith("$elif ")||p.startsWith("$else"))throw new k(`'${p.split(" ")[0]}' without matching '$if'`);if(p==="$if"||p==="$if:")throw new k("Missing condition expression after '$if'");{let u=ve(o,t);(u.type===v.FUNCTION||u.type===v.CONDITIONAL||u.type===v.PARTIAL||u.type===v.OBJECT&&!u.fast||u.type===v.ARRAY&&!u.fast)&&(s=!0);let c=nr(p,t),d={key:p,value:u};(c.type!==v.LITERAL||c.value!==p)&&(d.parsedKey=c),r.push(d),a++}}}let l={type:v.OBJECT,properties:r,fast:!s};return i&&(l.whenCondition=i),l},Oo=(e,t,r={})=>{let s=[],i=[],n=t,[a,l]=e[n],p=null,o;if(a.startsWith("$if#")){let c=a.match(/^\$if#(\w+)\s+(.+)$/);if(c)p=c[1],o=c[2];else throw new k(`Invalid conditional syntax: ${a}`)}else o=a.substring(4),o.endsWith(":")&&(o=o.slice(0,-1).trim());sr(o);let u=Z(o,r);for(s.push(u),i.push(ve(l,r)),n++;n<e.length;){let[c,d]=e[n],h=!1,f;if(p?c.startsWith(`$elif#${p} `)?(f=c.substring(`$elif#${p} `.length),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c===`$else#${p}`||c===`$else#${p}:`)&&(h=!0,f=null):c.startsWith("$elif ")?(f=c.substring(6),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c==="$else"||c==="$else:")&&(h=!0,f=null),h){if(f===null)s.push(null);else{sr(f);let m=Z(f,r);s.push(m)}if(i.push(ve(d,r)),n++,f===null)break}else break}return{node:{type:v.CONDITIONAL,conditions:s,bodies:i,id:p},nextIndex:n}},Z=(e,t={})=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")")){let o=e.slice(1,-1),u=0,c=!0;for(let d=0;d<o.length;d++)if(o[d]==="("?u++:o[d]===")"&&u--,u<0){c=!1;break}if(c&&u===0)return Z(o,t)}let r=Ae(e,"||");if(r!==-1)return{type:v.BINARY,op:P.OR,left:Z(e.substring(0,r).trim(),t),right:Z(e.substring(r+2).trim(),t)};let s=Ae(e,"&&");if(s!==-1)return{type:v.BINARY,op:P.AND,left:Z(e.substring(0,s).trim(),t),right:Z(e.substring(s+2).trim(),t)};let i=[{op:">=",type:P.GTE},{op:"<=",type:P.LTE},{op:"==",type:P.EQ},{op:"!=",type:P.NEQ},{op:">",type:P.GT},{op:"<",type:P.LT},{op:" in ",type:P.IN}];for(let{op:o,type:u}of i){let c=Ae(e,o);if(c!==-1)return{type:v.BINARY,op:u,left:Z(e.substring(0,c).trim(),t),right:Z(e.substring(c+o.length).trim(),t)}}let n=-1,a=null,l=[{op:" + ",type:P.ADD},{op:" - ",type:P.SUBTRACT}];for(let{op:o,type:u}of l){let c=0;for(;c<e.length;){let d=Ae(e.substring(c),o);if(d===-1)break;let h=c+d;h>n&&(n=h,a={op:o,type:u}),c=h+o.length}}if(n!==-1&&a)return{type:v.BINARY,op:a.type,left:Z(e.substring(0,n).trim(),t),right:Z(e.substring(n+a.op.length).trim(),t)};let p=[" * "," / "," % "];for(let o of p)if(Ae(e,o)!==-1)throw new k(`Arithmetic operations are not allowed in conditionals: "${o}"`);return e.startsWith("!")?{type:v.UNARY,op:Ge.NOT,operand:Z(e.substring(1).trim(),t)}:Js(e,t)},Ae=(e,t)=>{let r=0,s=0;for(;s<=e.length-t.length;){if(e[s]==="(")r++;else if(e[s]===")")r--;else if(r===0&&e.substring(s,s+t.length)===t)return s;s++}return-1},To=e=>{if(e=e.trim(),e==="true")return{type:v.LITERAL,value:!0};if(e==="false")return{type:v.LITERAL,value:!1};if(e==="null")return{type:v.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:v.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:v.LITERAL,value:""};if(e==="{}")return{type:v.LITERAL,value:{}};if(e==="[]")return{type:v.LITERAL,value:[]};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:v.LITERAL,value:t}:{type:v.VARIABLE,path:e}},Js=(e,t)=>{let r=e.trim();if(r.match(/^(\w+)\((.*)\)$/))return qe(r,t);let i=To(r);if(i.type===v.LITERAL)return i;if(/^[a-zA-Z_$][\w.$]*$/.test(r))return{type:v.VARIABLE,path:r};try{return qe(r,t)}catch(n){if(n.message&&n.message.includes("not supported"))return i;throw n}},Lo=(e,t=!1)=>{let r=t?"$each":"$for";try{Ds(e)}catch(s){if(s instanceof k&&t){let i=s.message.replace(/\$for/g,"$each");throw new k(i.replace("Parse Error: ",""))}throw s}},qs=(e,t,r,s=!1)=>{let i=/^\$for(?::(\w+))?\s+(.+)$/,n=e.match(i);if(!n){let g=s?"$each":"$for";throw new k(`Invalid loop syntax (got: '${e.replace("$for",g)}')`)}let a=n[1],l=n[2].trim();Lo(l,s);let p=l.match(/^(.+?)\s+in\s+(.+)$/);if(!p){let g=s?"$each":"$for";throw new k(`Invalid loop syntax - missing 'in' keyword (got: '${g} ${l}')`)}let o=p[1].trim(),u=p[2].trim(),c,d=null;if(o.includes(",")){let g=o.split(",").map(y=>y.trim());if(g.length!==2)throw new k(`Invalid loop variables: ${o}. Expected format: "item" or "item, index"`);c=g[0],d=g[1]}else c=o;let h=["this","undefined","null","true","false"];if(h.includes(c))throw new k(`Reserved variable name: ${c}`);if(d&&h.includes(d))throw new k(`Reserved variable name: ${d}`);let f=Js(u,r),m=ve(t,r);return{type:v.LOOP,itemVar:c,indexVar:d,iterable:f,body:m,flatten:a!=="nested"}};var Ro=(e,t={})=>{let{functions:r={}}=t;return ve(e,r)},pt=Ro;var ar={};R(ar,{now:()=>No});var No=()=>Date.now();var Vo=(e,t,r={})=>{let{functions:s={},partials:i={}}=r,n={...ar,...s},a=pt(e,{functions:n}),l={};for(let[p,o]of Object.entries(i))l[p]=pt(o,{functions:n});return ir(a,t,{functions:n,partials:l})},or=Vo;var lr=e=>e!==null&&typeof e=="object",ct=e=>lr(e)&&!Array.isArray(e),Po=e=>typeof e=="string"&&e.includes("."),Ys=e=>typeof e=="string"&&/[\[\]]/.test(e);function Xs(e,t){let r={};for(let s of t){if(typeof s!="string"||s.length===0)continue;let i=ie(e,s);i!==void 0&&pe(r,s,i)}return r}function Do(e){if(!ct(e)||!Array.isArray(e.fields))return e;let t=(r=[])=>r.map(s=>{if(!ct(s))return s;if(typeof s.$when=="string"&&s.$when.trim().length>0){let{$when:i,...n}=s,a=Array.isArray(n.fields)?{...n,fields:t(n.fields)}:n;return{[`$if ${i}`]:a}}return Array.isArray(s.fields)?{...s,fields:t(s.fields)}:s});return{...e,fields:t(e.fields)}}var ie=(e,t,r=void 0)=>{if(!t||!lr(e)||Ys(t))return r;let s=t.split(".").filter(n=>n!==""),i=e;for(let n of s){if(i==null||!(n in i))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:r;i=i[n]}return i},pe=(e,t,r)=>{if(!lr(e)||typeof t!="string"||t.length===0||Ys(t))return e;let s=t.split(".").filter(n=>n!=="");if(s.length===0)return e;Po(t)&&Object.prototype.hasOwnProperty.call(e,t)&&delete e[t];let i=e;for(let n=0;n<s.length-1;n++){let a=s[n];(!(a in i)||typeof i[a]!="object"||i[a]===null)&&(i[a]={}),i=i[a]}return i[s[s.length-1]]=r,e},Bo=["id","class","style","slot","form","defaultValues","disabled"],jo=(e={})=>Object.entries(e).filter(([t])=>!Bo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Fo={email:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,url:/^https?:\/\/.+/},de={required:"This field is required",minLength:e=>`Must be at least ${e} characters`,maxLength:e=>`Must be at most ${e} characters`,pattern:"Invalid format",invalidDate:"Invalid date format",invalidTime:"Invalid time format",invalidDateTime:"Invalid date and time format",minTemporal:e=>`Must be on or after ${e}`,maxTemporal:e=>`Must be on or before ${e}`},Mo="input-date",Wo="input-time",zo="input-datetime",Uo=/^(\d{4})-(\d{2})-(\d{2})$/,Ko=/^(\d{2}):(\d{2})(?::(\d{2}))?$/,Ho=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}(?::\d{2})?)$/,Go=e=>{if(typeof e!="string")return null;let t=Uo.exec(e);if(!t)return null;let r=Number(t[1]),s=Number(t[2]),i=Number(t[3]);if(!Number.isInteger(r)||!Number.isInteger(s)||!Number.isInteger(i)||s<1||s>12||i<1||i>31)return null;let n=new Date(Date.UTC(r,s-1,i));return n.getUTCFullYear()===r&&n.getUTCMonth()===s-1&&n.getUTCDate()===i?{year:r,month:s,day:i}:null},qo=e=>{if(typeof e!="string")return null;let t=Ko.exec(e);if(!t)return null;let r=Number(t[1]),s=Number(t[2]),i=t[3]===void 0?0:Number(t[3]);return!Number.isInteger(r)||!Number.isInteger(s)||!Number.isInteger(i)||r<0||r>23||s<0||s>59||i<0||i>59?null:{hour:r,minute:s,second:i}},Zs=e=>{let t=qo(e);return t?`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}:${String(t.second).padStart(2,"0")}`:null},Qs=e=>Go(e)?e:null,Jo=e=>{if(typeof e!="string")return null;let t=Ho.exec(e);if(!t)return null;let r=Qs(t[1]),s=Zs(t[2]);return!r||!s?null:`${r}T${s}`},Yo=e=>e===Mo?{normalize:Qs,invalidMessage:de.invalidDate}:e===Wo?{normalize:Zs,invalidMessage:de.invalidTime}:e===zo?{normalize:Jo,invalidMessage:de.invalidDateTime}:null,Xo=(e,t)=>{let r=Yo(e.type);if(!r||t==null||t==="")return null;let s=r.normalize(String(t));if(!s)return r.invalidMessage;if(e.min!==void 0&&e.min!==null&&String(e.min)!==""){let i=r.normalize(String(e.min));if(i&&s<i)return de.minTemporal(String(e.min))}if(e.max!==void 0&&e.max!==null&&String(e.max)!==""){let i=r.normalize(String(e.max));if(i&&s>i)return de.maxTemporal(String(e.max))}return null},Je=(e,t)=>{if(e.required){let s=t==null||t===""||typeof t=="boolean"&&t===!1,i=e.type==="input-number"&&t===null;if(e.type==="input-number"?i:s)return typeof e.required=="object"&&e.required.message?e.required.message:de.required}let r=Xo(e,t);if(r)return r;if(Array.isArray(e.rules))for(let s of e.rules){let i=Zo(s,t);if(i)return i}return null},Zo=(e,t)=>{if(t==null||t==="")return null;let r=String(t);switch(e.rule){case"minLength":return r.length<e.value?e.message||de.minLength(e.value):null;case"maxLength":return r.length>e.value?e.message||de.maxLength(e.value):null;case"pattern":{let i=Fo[e.value];if(!i)try{i=new RegExp(e.value)}catch{return e.message||de.pattern}return i.test(r)?null:e.message||de.pattern}default:return null}},Le=(e,t)=>{let r={},s=Q(e);for(let i of s){let n=ie(t,i.name),a=Je(i,n);a&&(r[i.name]=a)}return{valid:Object.keys(r).length===0,errors:r}},Qo=["section","read-only-text","slot"],pr=e=>!Qo.includes(e.type),Q=e=>{let t=[];for(let r of e)r.type==="section"&&Array.isArray(r.fields)?t.push(...Q(r.fields)):pr(r)&&t.push(r);return t},Ye=e=>{switch(e.type){case"input-text":case"input-date":case"input-time":case"input-datetime":case"input-textarea":case"popover-input":return"";case"input-number":return null;case"select":return null;case"checkbox":return!1;case"color-picker":return"#000000";case"slider":case"slider-with-input":return e.min!==void 0?e.min:0;case"image":return null;default:return null}},cr=(e,t=0)=>{let r=[],s=t;for(let i of e)if(i.type==="section"){if(r.push({...i,_isSection:!0,_idx:s}),s++,Array.isArray(i.fields)){let n=cr(i.fields,s);r.push(...n),s+=n.length}}else r.push({...i,_isSection:!1,_idx:s}),s++;return r},el=()=>Object.freeze({formValues:{},errors:{},reactiveMode:!1,tooltipState:{open:!1,x:0,y:0,content:""}}),K=({state:e,props:t})=>{let{form:r={}}=t||{},s=Do(r),i=ct(t?.context)?t.context:{},n=ct(e?.formValues)?e.formValues:{},a={...i,...n,formValues:n};return Object.keys(a).length>0?or(s,a):s},tl=({state:e,props:t})=>{let r=jo(t),s=K({state:e,props:t}),i=s.fields||[],n=!!t?.disabled,a=cr(i);a.forEach((c,d)=>{if(c._arrIdx=d,c._isSection)return;let h=pr(c);if(c._disabled=n||!!c.disabled,h&&c.name&&(c._error=e.errors[c.name]||null),c.type==="input-text"&&(c._inputType=c.inputType||"text"),c.type==="select"){let f=ie(e.formValues,c.name);c._selectedValue=f!==void 0?f:null,c.placeholder=c.placeholder||"",c.noClear=c.clearable===!1}if(c.type==="image"){let f=ie(e.formValues,c.name);c._imageSrc=f&&String(f).trim()?f:null,c.placeholderText=c.placeholderText||"No Image"}if(c.type==="read-only-text"&&(c.content=c.content||""),c.type==="checkbox"){let f=typeof c.content=="string"?c.content:typeof c.checkboxLabel=="string"?c.checkboxLabel:"";c._checkboxText=f}});let l=s.actions||{buttons:[]},p=l.layout||"split",o=(l.buttons||[]).map((c,d)=>({...c,_globalIdx:d,variant:c.variant||"se",_disabled:n||!!c.disabled,pre:c.pre||"",suf:c.suf||""})),u;return p==="split"?u={_layout:"split",buttons:o,_leftButtons:o.filter(c=>c.align==="left"),_rightButtons:o.filter(c=>c.align!=="left")}:u={_layout:p,buttons:o,_allButtons:o},{containerAttrString:r,title:s?.title||"",description:s?.description||"",flatFields:a,actions:u,formValues:e.formValues,tooltipState:e.tooltipState}},me=({state:e,props:t})=>{let r=K({state:e,props:t}),s=Q(r.fields||[]);return Xs(e.formValues,s.map(i=>i.name).filter(i=>typeof i=="string"&&i.length>0))},rl=({state:e,props:t},r={})=>{let{name:s,value:i}=r;s&&(pe(e.formValues,s,i),Re({state:e,props:t}))},Re=({state:e,props:t})=>{if(!t)return;let r=K({state:e,props:t}),s=Q(r.fields||[]);e.formValues=Xs(e.formValues,s.map(i=>i.name).filter(i=>typeof i=="string"&&i.length>0))},sl=({state:e},t={})=>{let{values:r}=t;!r||typeof r!="object"||Object.keys(r).forEach(s=>{pe(e.formValues,s,r[s])})},il=({state:e},t={})=>{let{defaultValues:r={}}=t;e.formValues=r?structuredClone(r):{},e.errors={},e.reactiveMode=!1},nl=({state:e},t={})=>{e.errors=t.errors||{}},al=({state:e},t={})=>{let{name:r}=t;r&&e.errors[r]&&delete e.errors[r]},ol=({state:e})=>{e.reactiveMode=!0},ll=({state:e},t={})=>{let{x:r,y:s,content:i}=t;e.tooltipState={open:!0,x:r,y:s,content:i}},pl=({state:e})=>{e.tooltipState={...e.tooltipState,open:!1}};var ei=({field:e,target:t,value:r})=>{!e||!t||["slider-with-input","popover-input"].includes(e.type)&&(r==null?t.removeAttribute("value"):t.setAttribute("value",String(r)))},ti=({form:e,formValues:t={},refs:r,formDisabled:s=!1})=>{let i=e.fields||[],n=0,a=l=>{for(let p of l){if(p.type==="section"){n++,Array.isArray(p.fields)&&a(p.fields);continue}let o=r[`field${n}`];if(n++,!o)continue;let u=s||!!p.disabled;if(["input-text","input-date","input-time","input-datetime","input-number","input-textarea","color-picker","slider","slider-with-input","popover-input"].includes(p.type)){let c=ie(t,p.name);if(c==null?o.removeAttribute("value"):o.setAttribute("value",String(c)),p.type==="slider-with-input"&&o.store?.setValue){let d=Number(c??0);o.store.setValue({value:Number.isFinite(d)?d:0}),typeof o.render=="function"&&o.render()}p.type==="popover-input"&&o.store?.setValue&&(o.store.setValue({value:c==null?"":String(c)}),typeof o.render=="function"&&o.render())}p.type==="checkbox"&&(ie(t,p.name)?o.setAttribute("checked",""):o.removeAttribute("checked")),["input-text","input-date","input-time","input-datetime","input-number","input-textarea","popover-input"].includes(p.type)&&p.placeholder&&o.getAttribute("placeholder")!==p.placeholder&&(p.placeholder===void 0||p.placeholder===null?o.removeAttribute("placeholder"):o.setAttribute("placeholder",p.placeholder)),u?o.setAttribute("disabled",""):o.removeAttribute("disabled")}};a(i)},cl=(e,t)=>{let r=t?.defaultValues||{},s={};Object.keys(r).forEach(l=>{pe(s,l,r[l])});let i=K({state:{formValues:s},props:t}),n=Q(i.fields||[]),a={};for(let l of n){let p=ie(r,l.name);p!==void 0?pe(a,l.name,p):pe(a,l.name,Ye(l))}e.resetFormValues({defaultValues:a})},ul=e=>{let{store:t,props:r}=e;cl(t,r)},dl=e=>{let{props:t,refs:r,render:s}=e,i=e.store.getState(),n=K({state:i,props:t});ti({form:n,formValues:i.formValues,refs:r,formDisabled:!!t?.disabled}),s()},fl=(e,t)=>{let{newProps:r}=t,{store:s,render:i,refs:n}=e,a=!!r?.disabled,l=s.getState();Re({state:l,props:r});let p=K({state:l,props:r});ti({form:p,formValues:l.formValues,refs:n,formDisabled:a}),i()},hl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event,l=a.currentTarget.dataset.fieldName;if(!l||!a.detail||!Object.prototype.hasOwnProperty.call(a.detail,"value"))return;let p=a.detail.value;r.setFormFieldValue({name:l,value:p});let o=r.getState();Re({state:o,props:n});let u=K({state:o,props:n}),d=Q(u.fields||[]).find(h=>h.name===l);if(ei({field:d,target:a.currentTarget,value:p}),o.reactiveMode&&d){let h=Je(d,p);h?r.setErrors({errors:{...o.errors,[l]:h}}):r.clearFieldError({name:l})}i(),s(new CustomEvent("form-input",{bubbles:!0,detail:{name:l,value:p,values:me({state:r.getState(),props:n})}}))},ml=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event,l=a.currentTarget.dataset.fieldName;if(!l||!a.detail||!Object.prototype.hasOwnProperty.call(a.detail,"value"))return;let p=a.detail.value;r.setFormFieldValue({name:l,value:p});let o=r.getState();Re({state:o,props:n});let u=K({state:o,props:n}),d=Q(u.fields||[]).find(h=>h.name===l);if(ei({field:d,target:a.currentTarget,value:p}),o.reactiveMode&&d){let h=Je(d,p);h?r.setErrors({errors:{...o.errors,[l]:h}}):r.clearFieldError({name:l})}i(),s(new CustomEvent("form-change",{bubbles:!0,detail:{name:l,value:p,values:me({state:r.getState(),props:n})}}))},yl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,l=t._event.currentTarget.dataset.actionId;if(!l)return;let p=r.getState(),o=K({state:p,props:n}),d=((o.actions||{}).buttons||[]).find(f=>f.id===l),h=me({state:p,props:n});if(d&&d.validate){let f=Q(o.fields||[]),{valid:m,errors:g}=Le(f,p.formValues);r.setErrors({errors:g}),m||r.setReactiveMode(),i(),s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:l,values:h,valid:m,errors:g}}))}else s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:l,values:h}}))},gl=(e,t)=>{let r=t._event;r.type==="contextmenu"&&r.preventDefault();let{store:s,dispatchEvent:i,props:n}=e,a=r.currentTarget.dataset.fieldName;i(new CustomEvent("form-field-event",{bubbles:!0,detail:{name:a,event:r.type,values:me({state:s.getState(),props:n})}}))},bl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event;if(a.key==="Enter"&&!a.shiftKey){let l=a.target;if(l.tagName==="TEXTAREA"||l.tagName==="RTGL-TEXTAREA")return;a.preventDefault();let p=r.getState(),o=K({state:p,props:n}),c=(o.actions||{}).buttons||[],h=c.find(m=>m.validate)||c[0];if(!h)return;let f=me({state:p,props:n});if(h.validate){let m=Q(o.fields||[]),{valid:g,errors:y}=Le(m,p.formValues);r.setErrors({errors:y}),g||r.setReactiveMode(),i(),s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:h.id,values:f,valid:g,errors:y}}))}else s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:h.id,values:f}}))}},vl=(e,t)=>{let{store:r,render:s,props:i}=e,n=t._event,a=n.currentTarget.dataset.fieldName,l=K({state:r.getState(),props:i}),o=Q(l.fields||[]).find(u=>u.name===a);if(o&&o.tooltip){let u=n.currentTarget.getBoundingClientRect();r.showTooltip({x:u.left+u.width/2,y:u.top-8,content:typeof o.tooltip=="string"?o.tooltip:o.tooltip.content||""}),s()}},wl=e=>{let{store:t,render:r}=e;t.hideTooltip({}),r()};var fr={};R(fr,{getValues:()=>$l,reset:()=>Il,setValues:()=>Sl,validate:()=>Cl});var _l=["input-text","input-date","input-time","input-datetime","input-number","input-textarea","color-picker","slider","slider-with-input","popover-input"],xl=["input-text","input-date","input-time","input-datetime","input-number","input-textarea","popover-input","slider-with-input"],El=({ref:e,fieldType:t,value:r,forceRefresh:s=!1})=>{if(_l.includes(t)){if(s&&e.removeAttribute("value"),r==null){if(xl.includes(t)&&s){if(t==="popover-input"){e.removeAttribute("value");return}e.setAttribute("value","");return}e.removeAttribute("value");return}e.setAttribute("value",String(r))}},si=({ref:e,value:t})=>{e&&e?.store?.updateSelectedValue&&(e.store.updateSelectedValue({value:t}),typeof e.render=="function"&&e.render())},Al=e=>{let t=new Map;return!e||typeof e.querySelectorAll!="function"||e.querySelectorAll("[data-field-name]").forEach(r=>{let s=r.getAttribute("data-field-name");s&&t.set(s,r)}),t},ri=e=>e?.renderTarget?e.renderTarget:e?.shadowRoot?e.shadowRoot:e?.shadow,kl=({root:e,values:t={}})=>{if(!e||typeof e.querySelectorAll!="function")return;e.querySelectorAll("rtgl-select[data-field-name]").forEach(s=>{let i=s.dataset?.fieldName;if(!i)return;let n=ie(t,i);si({ref:s,value:n})})},$l=function(){let e=this.store.getState();return me({state:e,props:this.props})},Sl=function(e={}){let t=e&&typeof e=="object"&&e.values&&typeof e.values=="object"?e.values:e;if(!t||typeof t!="object"||Array.isArray(t))return;this.store.setFormValues({values:t}),this.store.pruneHiddenValues();let r=this.store.getState(),s=K({state:r,props:this.props}),i=Q(s.fields||[]),n=Al(ri(this));for(let l of i){if(!l.name)continue;let p=n.get(l.name);if(!p)continue;let o=Object.prototype.hasOwnProperty.call(t,l.name),u=ie(t,l.name);if(!o&&u===void 0)continue;let c=ie(r.formValues,l.name);El({ref:p,fieldType:l.type,value:c,forceRefresh:!0}),typeof p?.tagName=="string"&&p.tagName.toUpperCase()==="RTGL-SELECT"&&si({ref:p,value:c}),l.type==="checkbox"&&(c?p.setAttribute("checked",""):p.removeAttribute("checked"))}this.render();let a=()=>{let l=this.store.getState();kl({root:ri(this),values:l.formValues})};a(),setTimeout(()=>{a()},0)},Cl=function(){let e=this.store.getState(),t=K({state:e,props:this.props}),r=Q(t.fields||[]),{valid:s,errors:i}=Le(r,e.formValues);return this.store.setErrors({errors:i}),s||this.store.setReactiveMode(),this.render(),{valid:s,errors:i}},Il=function(){let e=this.props?.defaultValues||{},t={};Object.keys(e).forEach(n=>{pe(t,n,e[n])});let r=K({state:{formValues:t},props:this.props}),s=Q(r.fields||[]),i={};for(let n of s){let a=ie(e,n.name);a!==void 0?pe(i,n.name,a):pe(i,n.name,Ye(n))}this.store.resetFormValues({defaultValues:i}),this.setValues(i)};var ii={componentName:"rtgl-form",propsSchema:{type:"object",properties:{form:{type:"object"},defaultValues:{type:"object"},context:{type:"object"},disabled:{type:"boolean"}}},events:{"form-input":{},"form-change":{},"form-field-event":{},"form-action":{}},methods:{type:"object",properties:{getValues:{type:"function"},setValues:{type:"function"},validate:{type:"function"},reset:{type:"function"}}}};var ni={refs:{formContainer:{eventListeners:{keydown:{handler:"handleKeyDown"}}},"action*":{eventListeners:{click:{handler:"handleActionClick"}}},"tooltipIcon*":{eventListeners:{mouseenter:{handler:"handleTooltipMouseEnter"},mouseleave:{handler:"handleTooltipMouseLeave"}}},"field*":{eventListeners:{"value-input":{handler:"handleValueInput"},"value-change":{handler:"handleValueChange"}}},"image*":{eventListeners:{click:{handler:"handleImageClick"},contextmenu:{handler:"handleImageClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#formContainer w=f p=md g=lg ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:8,properties:[{key:"$if title",value:{type:6,conditions:[{type:1,path:"title"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"title"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if description",value:{type:6,conditions:[{type:1,path:"description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view g=lg w=f",value:{type:9,items:[{type:7,itemVar:"field",indexVar:"i",iterable:{type:1,path:"flatFields"},body:{type:9,items:[{type:8,properties:[{key:"$if field._isSection",value:{type:6,conditions:[{type:1,path:"field._isSection"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm",value:{type:9,items:[{type:8,properties:[{key:"$if field.label",value:{type:6,conditions:[{type:1,path:"field.label"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=md",value:{type:1,path:"field.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.description",value:{type:6,conditions:[{type:1,path:"field.description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if !field._isSection",value:{type:6,conditions:[{type:5,op:0,operand:{type:1,path:"field._isSection"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=f",value:{type:9,items:[{type:8,properties:[{key:"$if field.label || field.description",value:{type:6,conditions:[{type:4,op:7,left:{type:1,path:"field.label"},right:{type:1,path:"field.description"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=md av=c",value:{type:9,items:[{type:8,properties:[{key:"$if field.label",value:{type:6,conditions:[{type:1,path:"field.label"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"field.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.required",value:{type:6,conditions:[{type:1,path:"field.required"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text c=fg s=sm",value:{type:0,value:"*"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.tooltip",value:{type:6,conditions:[{type:1,path:"field.tooltip"}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-svg#tooltipIcon${field._idx} data-field-name=${field.name} svg="info" wh=16 c=mu-fg cur=help ml=xs',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg#tooltipIcon",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"},' svg="info" wh=16 c=mu-fg cur=help ml=xs']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"$if field.description",value:{type:6,conditions:[{type:1,path:"field.description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input#field${field._idx} data-field-name=${field.name} w=f type=${field._inputType} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f type=",{type:1,path:"field._inputType"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-date"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-date"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-date#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-date#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-time"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-time"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-time#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-time#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-datetime"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-datetime"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-datetime#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-datetime#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-number"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-number"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-number#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-number#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-textarea"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-textarea"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-textarea#field${field._idx} data-field-name=${field.name} w=f rows=${field.rows} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-textarea#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f rows=",{type:1,path:"field.rows"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "select"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"select"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-select#field${field._idx} data-field-name=${field.name} w=f :options=flatFields[${field._arrIdx}].options ?no-clear=flatFields[${field._arrIdx}].noClear :selectedValue=#{field._selectedValue} :placeholder=#{field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-select#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f :options=flatFields[",{type:1,path:"field._arrIdx"},"].options ?no-clear=flatFields[",{type:1,path:"field._arrIdx"},"].noClear :selectedValue=",{type:11,path:"field._selectedValue"}," :placeholder=",{type:11,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "color-picker"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"color-picker"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-color-picker#field${field._idx} data-field-name=${field.name} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-color-picker#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slider"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slider"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slider-with-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slider-with-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider-input#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "popover-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"popover-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-popover-input#field${field._idx} data-field-name=${field.name} label="${field.label}" placeholder=${field.placeholder} ?disabled=${field._disabled}',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-popover-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"},' label="',{type:1,path:"field.label"},'" placeholder=',{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "checkbox"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"checkbox"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-checkbox#field${field._idx} data-field-name=${field.name} label="${field._checkboxText}" ?disabled=${field._disabled}',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-checkbox#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"},' label="',{type:1,path:"field._checkboxText"},'" ?disabled=',{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "image" && field._imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"image"}},right:{type:1,path:"field._imageSrc"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image#image${field._idx} data-field-name=${field.name} src=${field._imageSrc} w=${field.width} h=${field.height} cur=pointer",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image#image",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," src=",{type:1,path:"field._imageSrc"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=pointer"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "image" && !field._imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"image"}},right:{type:5,op:0,operand:{type:1,path:"field._imageSrc"}}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view#image${field._idx} data-field-name=${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=pointer p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg ta=c",value:{type:1,path:"field.placeholderText"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#image",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," bc=ac bw=sm ah=c av=c cur=pointer p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "read-only-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"read-only-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"field.content"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slot"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slot"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'slot#fieldSlot${field._idx} name=${field.slot} style="display: contents;"',value:{type:0,value:null},parsedKey:{type:2,parts:["slot#fieldSlot",{type:1,path:"field._idx"}," name=",{type:1,path:"field.slot"},' style="display: contents;"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field._error",value:{type:6,conditions:[{type:1,path:"field._error"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=de",value:{type:1,path:"field._error"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"$if actions.buttons.length > 0",value:{type:6,conditions:[{type:4,op:2,left:{type:1,path:"actions.buttons.length"},right:{type:0,value:0}}],bodies:[{type:9,items:[{type:8,properties:[{key:'$if actions._layout == "split"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"split"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h w=f g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._leftButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view d=h g=sm ah=e w=1fg",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._rightButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if actions._layout == "vertical"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"vertical"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._allButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} w=f ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," w=f ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if actions._layout == "stretch"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"stretch"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._allButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} w=f ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," w=f ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'rtgl-tooltip ?open=${tooltipState.open} x=${tooltipState.x} y=${tooltipState.y} place="t" content="${tooltipState.content}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-tooltip ?open=",{type:1,path:"tooltipState.open"}," x=",{type:1,path:"tooltipState.x"}," y=",{type:1,path:"tooltipState.y"},' place="t" content="',{type:1,path:"tooltipState.content"},'"']}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#formContainer w=f p=md g=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var hr={};R(hr,{handleCancel:()=>Ll,handleCloseAll:()=>Bl,handleConfirm:()=>Tl,handleDialogClose:()=>Ol,handleDropdownClose:()=>Rl,handleDropdownItemClick:()=>Nl,handleShowAlert:()=>Vl,handleShowConfirm:()=>Pl,handleShowDropdownMenu:()=>Dl});var Ol=(e,t)=>{let{store:r,render:s}=e;r.closeAll(),s()},Tl=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",!0)},Ll=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",!1)},Rl=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",null)},Nl=(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t._event,{index:a,item:l}=n.detail;r.closeAll(),s(),i.emit("event",{index:a,item:l})},Vl=(e,t)=>{let{store:r,render:s}=e,i=t;r.selectIsOpen()&&(r.closeAll(),s()),r.setAlertConfig(i),s()},Pl=async(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t;return r.selectIsOpen()&&(r.closeAll(),s()),r.setConfirmConfig(n),s(),new Promise(a=>{i.once("event",l=>{a(l)})})},Dl=async(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t;return r.selectIsOpen()&&(r.closeAll(),s()),r.setDropdownConfig(n),s(),new Promise(a=>{i.once("event",l=>{a(l)})})},Bl=e=>{let{store:t,render:r}=e;t.selectIsOpen()&&(t.closeAll(),r())};var ai={componentName:"rtgl-global-ui",propsSchema:{type:"object",properties:{}},events:[],methods:{type:"object",properties:{}}};var mr={};R(mr,{closeAll:()=>zl,createInitialState:()=>jl,selectConfig:()=>Ul,selectDropdownConfig:()=>Kl,selectIsOpen:()=>Gl,selectUiType:()=>Hl,selectViewData:()=>ql,setAlertConfig:()=>Fl,setConfirmConfig:()=>Ml,setDropdownConfig:()=>Wl});var jl=()=>Object.freeze({isOpen:!1,uiType:"dialog",config:{status:void 0,title:"",message:"",confirmText:"OK",cancelText:"Cancel",mode:"alert"},dropdownConfig:{items:[],x:0,y:0,place:"bs"}}),Fl=({state:e},t={})=>{if(!t.message)throw new Error("message is required for showAlert");e.config={status:t.status||void 0,title:t.title||"",message:t.message,confirmText:t.confirmText||"OK",cancelText:"",mode:"alert"},e.uiType="dialog",e.isOpen=!0},Ml=({state:e},t={})=>{if(!t.message)throw new Error("message is required for showConfirm");e.config={status:t.status||void 0,title:t.title||"",message:t.message,confirmText:t.confirmText||"Yes",cancelText:t.cancelText||"Cancel",mode:"confirm"},e.uiType="dialog",e.isOpen=!0},Wl=({state:e},t={})=>{if(!t.items||!Array.isArray(t.items))throw new Error("items array is required for showDropdown");e.dropdownConfig={items:t.items,x:t.x||0,y:t.y||0,place:t.place||"bs"},e.uiType="dropdown",e.isOpen=!0},zl=({state:e})=>{e.isOpen=!1,e.uiType="dialog"},Ul=({state:e})=>e.config,Kl=({state:e})=>e.dropdownConfig,Hl=({state:e})=>e.uiType,Gl=({state:e})=>e.isOpen,ql=({state:e})=>({isOpen:e.isOpen,uiType:e.uiType,config:e.config,dropdownConfig:{items:e.dropdownConfig?.items||[],x:e.dropdownConfig?.x||0,y:e.dropdownConfig?.y||0,place:e.dropdownConfig?.place||"bs"},isDialogOpen:e.isOpen&&e.uiType==="dialog",isDropdownOpen:e.isOpen&&e.uiType==="dropdown"});var oi={refs:{dialog:{eventListeners:{close:{handler:"handleDialogClose"}}},confirmButton:{eventListeners:{click:{handler:"handleConfirm"}}},cancelButton:{eventListeners:{click:{handler:"handleCancel"}}},dropdownMenu:{eventListeners:{close:{handler:"handleDropdownClose"},"item-click":{handler:"handleDropdownItemClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-dialog#dialog ?open=${isDialogOpen} s=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content g=lg p=lg",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=c av=c g=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view h=24 av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"config.title"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"config.message"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h g=md mt=lg w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"$if config.mode == 'confirm'",value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"config.mode"},right:{type:0,value:"confirm"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-button#cancelButton v=se",value:{type:1,path:"config.cancelText"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-button#confirmButton v=pr",value:{type:1,path:"config.confirmText"}}],fast:!0}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-dialog#dialog ?open=",{type:1,path:"isDialogOpen"}," s=sm"]}}],fast:!1},{type:8,properties:[{key:"rtgl-dropdown-menu#dropdownMenu ?open=${isDropdownOpen} x=${dropdownConfig.x} y=${dropdownConfig.y} place=${dropdownConfig.place} :items=dropdownConfig.items key=dropdown-${isDropdownOpen}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-dropdown-menu#dropdownMenu ?open=",{type:1,path:"isDropdownOpen"}," x=",{type:1,path:"dropdownConfig.x"}," y=",{type:1,path:"dropdownConfig.y"}," place=",{type:1,path:"dropdownConfig.place"}," :items=dropdownConfig.items key=dropdown-",{type:1,path:"isDropdownOpen"}]}}],fast:!0}],fast:!1}};var yr={};R(yr,{handleClickStart:()=>Jl});var Jl=(e,t)=>{let{dispatchEvent:r,store:s}=e,i=t._event;console.log("handle click start",s.selectPath()),r(new CustomEvent("start-click",{detail:{path:s.selectPath()}}))};var li={componentName:"rtgl-navbar",propsSchema:{type:"object",properties:{start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}}}}}},events:{"start-click":{type:"object",properties:{path:{type:"string"}}}},methods:{type:"object",properties:{}}};var gr={};R(gr,{createInitialState:()=>Yl,selectPath:()=>tp,selectViewData:()=>ep,setState:()=>rp});var Yl=()=>Object.freeze({}),Xl=["id","class","style","slot","start"],Zl=(e={})=>Object.entries(e).filter(([t])=>!Xl.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ql=e=>{if(e!=null){if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(decodeURIComponent(e))}catch{try{return JSON.parse(e)}catch{return}}}},ep=({props:e})=>{let t=Ql(e.start)||e.start;return{containerAttrString:Zl(e),start:t||{label:"",image:{src:"",width:32,height:32,alt:""}}}},tp=({props:e})=>e.start?.path,rp=({state:e})=>{};var pi={refs:{start:{eventListeners:{click:{handler:"handleClickStart"}}}},anchors:[[{"rtgl-text s=lg":"${start.label}"},{"$if start.image && start.image.src":[{"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}":null}]}]],template:{type:9,items:[{type:8,properties:[{key:"rtgl-view bgc=bg d=h h=48 av=c w=f ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if start.href",value:{type:6,conditions:[{type:1,path:"start.href"},{type:1,path:"start.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${start.href}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["a href=",{type:1,path:"start.href"}]}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#start d=h av=c g=md cur=pointer",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h av=c g=lg",value:{type:9,items:[{type:8,properties:[{key:"slot name=right",value:{type:0,value:null}}],fast:!0}],fast:!0}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view bgc=bg d=h h=48 av=c w=f ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var br={};R(br,{handleBeforeMount:()=>ip});var ci=(e,t,r)=>{let{store:s,render:i}=r,n,a=-1/0;if(e.forEach(l=>{let p=l.getBoundingClientRect();p.top<=t&&p.top>a&&(a=p.top,n=l.id)}),!n){let l=1/0;e.forEach(p=>{let o=p.getBoundingClientRect();o.top>t&&o.top<l&&(l=o.top,n=p.id)})}n&&n!==s.selectCurrentId()&&(s.setCurrentId({id:n}),i())},sp=(e,t,r,s)=>{let{store:i,render:n}=s,a=e.querySelectorAll("h1[id], h2[id], h3[id], h4[id], rtgl-text[id]"),l=Array.from(a),p=l.map(u=>{let c=1,d=u.tagName.toLowerCase();return d==="h1"?c=1:d==="h2"?c=2:d==="h3"?c=3:d==="h4"?c=4:d==="rtgl-text"&&(c=parseInt(u.getAttribute("data-level")||"1",10)),{id:u.id,href:`#${u.id}`,title:u.textContent,level:c}});i.setItems({items:p}),ci(l,r,s),n();let o=ci.bind(void 0,l,r,s);return t.addEventListener("scroll",o,{passive:!0}),()=>{t.removeEventListener("scroll",o)}},ip=e=>{let{props:t}=e,r=()=>{};return requestAnimationFrame(()=>{let s=document.getElementById(t.targetId);if(!s)return;let i=window;t.scrollContainerId&&(i=document.getElementById(t.scrollContainerId)||window);let n=parseInt(t.offsetTop||"100",10);r=sp(s,i,n,e)}),()=>{r()}};var ui={componentName:"rtgl-page-outline",propsSchema:{type:"object",properties:{targetId:{type:"string"},scrollContainerId:{type:"string"},offsetTop:{type:"string"}}},events:{onItemClick:{type:"object"}},methods:{type:"object",properties:{}}};var vr={};R(vr,{createInitialState:()=>np,selectCurrentId:()=>lp,selectState:()=>op,selectViewData:()=>ap,setContentContainer:()=>up,setCurrentId:()=>cp,setItems:()=>pp});var np=()=>Object.freeze({items:[],currentId:null,contentContainer:null}),ap=({state:e})=>{let r=((s,i)=>{let n=new Set,a=s.findIndex(p=>p.id===i);if(a===-1)return n;let l=s[a].level;for(let p=a-1;p>=0;p--)if(s[p].level<l){let o=s[p].level;n.add(s[p].id);for(let u=p-1;u>=0;u--)s[u].level<o&&(n.add(s[u].id),o=s[u].level);break}return n})(e.items,e.currentId);return{items:e.items.map(s=>{let i={1:"0",2:"12px",3:"24px",4:"32px"},n=s.id===e.currentId,a=r.has(s.id),l=n||a;return{...s,c:l?"fg":"mu-fg",ml:i[s.level]||"",bc:l?"fg":"mu-fg"}}),currentId:e.currentId}},op=({state:e})=>e,lp=({state:e})=>e.currentId,pp=({state:e},t={})=>{e.items=Array.isArray(t.items)?t.items:[]},cp=({state:e},t={})=>{e.currentId=t.id},up=({state:e},t={})=>{e.contentContainer=t.container};var di={refs:{},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=272 d=v pr=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=1fg sv mt=xl",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:'rtgl-view d=h bwl=xs bc="${item.bc}" pv=sm av=c href=${item.href} pl=md',value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=${item.ml}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-view w=",{type:1,path:"item.ml"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm c=${item.c} h-c=fg",value:{type:1,path:"item.title"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}," h-c=fg"]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:['rtgl-view d=h bwl=xs bc="',{type:1,path:"item.bc"},'" pv=sm av=c href=',{type:1,path:"item.href"}," pl=md"]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}};var wr={};R(wr,{handleBeforeMount:()=>dp,handleInputChange:()=>yp,handleInputKeydown:()=>bp,handleOnUpdate:()=>fp,handlePopoverClose:()=>mp,handleSubmitClick:()=>gp,handleTextClick:()=>hp});var Xe=e=>e==null||e===!0?"":String(e),fi=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=Xe(t);r.setValue({value:n}),r.closePopover({}),i(new CustomEvent("value-change",{detail:{value:n},bubbles:!0})),s()},dp=e=>{let{store:t,props:r}=e;if(r.value!==void 0){let s=Xe(r.value);t.setValue({value:s}),t.setTempValue({value:s})}},fp=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e;if(r?.value!==s?.value){let l=Xe(s?.value);i.setValue({value:l}),i.getState().isOpen||i.setTempValue({value:l})}n()},hp=(e,t)=>{let{store:r,render:s,refs:i,props:n}=e;if(n.disabled)return;let a=t._event,l=Xe(n.value);r.setValue({value:l}),r.setTempValue({value:l}),r.openPopover({position:{x:a.currentTarget.getBoundingClientRect().left,y:a.currentTarget.getBoundingClientRect().bottom}}),s(),setTimeout(()=>{let{input:p}=i;if(!p)return;p.value=l,p.focus();let o=p.shadowRoot?.querySelector("input, textarea");o&&typeof o.focus=="function"&&o.focus()},50)},mp=(e,t)=>{let{store:r,render:s}=e;r.closePopover({}),s()},yp=(e,t)=>{let{store:r}=e,s=t._event,i=Xe(s.detail.value);r.setTempValue({value:i})},gp=e=>{let{store:t,refs:r}=e,{input:s}=r,i=s?s.value:t.getState().tempValue;fi(e,i)},bp=(e,t)=>{let{store:r,refs:s}=e,i=t._event;if(i.key==="Enter"){i.preventDefault(),i.stopPropagation();let{input:n}=s,a=n?n.value:r.getState().tempValue;fi(e,a)}else i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),r.closePopover({}),e.render())};var hi={componentName:"rtgl-popover-input",propsSchema:{type:"object",properties:{value:{type:"string"},placeholder:{type:"string"},label:{type:"string"},autoFocus:{type:"boolean"},disabled:{type:"boolean",default:!1}}},events:{"value-change":{}},methods:{type:"object",properties:{}}};var _r={};R(_r,{closePopover:()=>Ep,createInitialState:()=>vp,openPopover:()=>xp,selectValue:()=>kp,selectViewData:()=>wp,setTempValue:()=>_p,setValue:()=>Ap});var vp=()=>Object.freeze({isOpen:!1,position:{x:0,y:0},value:"",tempValue:""}),wp=({props:e,state:t})=>{let r=typeof t.value=="string"&&t.value.length>0,s=r?t.value:"-",i=typeof e.placeholder=="string"?e.placeholder:"",n=typeof e.label=="string"?e.label:"",a=!!e.disabled;return{isOpen:t.isOpen,position:t.position,value:s,valueColor:r?"fg":"mu-fg",tempValue:t.tempValue,placeholder:i,label:n,disabled:a}},_p=({state:e},t={})=>{e.tempValue=t.value},xp=({state:e},t={})=>{let{position:r}=t;e.position=r,e.isOpen=!0,e.hasUnsavedChanges=!1},Ep=({state:e})=>{e.isOpen=!1,e.tempValue=""},Ap=({state:e},t={})=>{e.value=t.value},kp=({state:e})=>e.value;var mi={refs:{textDisplay:{eventListeners:{click:{handler:"handleTextClick"}}},popover:{eventListeners:{close:{handler:"handlePopoverClose"}}},input:{eventListeners:{"value-input":{handler:"handleInputChange"},keydown:{handler:"handleInputKeydown"}}},submit:{eventListeners:{click:{handler:"handleSubmitClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#textDisplay w=f cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${valueColor}",value:{type:1,path:"value"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"valueColor"}]}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=240 slot=content bgc=mu br=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"label"}}],fast:!0},{type:8,properties:[{key:"rtgl-input#input w=f placeholder=${placeholder} ?disabled=${disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f placeholder=",{type:1,path:"placeholder"}," ?disabled=",{type:1,path:"disabled"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#submit ?disabled=${disabled}",value:{type:0,value:"Submit"},parsedKey:{type:2,parts:["rtgl-button#submit ?disabled=",{type:1,path:"disabled"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"isOpen"}," x=",{type:1,path:"position.x"}," y=",{type:1,path:"position.y"}]}}],fast:!0}],fast:!0}};var xr={};R(xr,{handleAddOptionClick:()=>Np,handleAddOptionMouseEnter:()=>Vp,handleAddOptionMouseLeave:()=>Pp,handleBeforeMount:()=>$p,handleButtonClick:()=>Cp,handleClearClick:()=>Rp,handleClickOptionsPopoverOverlay:()=>Ip,handleOnUpdate:()=>Sp,handleOptionClick:()=>Op,handleOptionMouseEnter:()=>Tp,handleOptionMouseLeave:()=>Lp});var $p=e=>{let{store:t,props:r,render:s}=e;if(r.selectedValue!==null&&r.selectedValue!==void 0&&r.options){let i=r.options.find(n=>Ee(n.value,r.selectedValue));i&&(t.updateSelectedValue({value:i?.value}),s())}},Sp=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e,a=!1;s?.disabled&&!r?.disabled&&(i.closeOptionsPopover({}),a=!0),r.selectedValue!==s.selectedValue&&(i.updateSelectedValue({value:s.selectedValue}),a=!0),a&&n()},Cp=(e,t)=>{let{store:r,render:s,refs:i,props:n}=e;if(n.disabled)return;t._event.stopPropagation();let l=i.selectButton,p=l.firstElementChild,o=p?p.getBoundingClientRect():l.getBoundingClientRect(),u=r.selectSelectedValue(),c=u!==null?u:n.selectedValue,d=null;c!=null&&n.options&&(d=n.options.findIndex(h=>Ee(h.value,c)),d===-1&&(d=null)),r.openOptionsPopover({position:{y:o.bottom+12,x:o.left-24},selectedIndex:d}),s()},Ip=e=>{let{store:t,render:r}=e;t.closeOptionsPopover({}),r()},Op=(e,t)=>{let{render:r,dispatchEvent:s,props:i,store:n}=e;if(i.disabled)return;let a=t._event;a.stopPropagation();let l=a.currentTarget.id.slice(6),p=Number(l),o=i.options[l];n.updateSelectedValue({value:o?.value}),i.onChange&&typeof i.onChange=="function"&&i.onChange(o.value),s(new CustomEvent("value-change",{detail:{value:o.value,label:o.label,index:p,item:o},bubbles:!0})),r()},Tp=(e,t)=>{let{store:r,render:s}=e,i=t._event,n=parseInt(i.currentTarget.id.slice(6),10);r.setHoveredOption({optionId:n}),s()},Lp=(e,t)=>{let{store:r,render:s}=e;r.clearHoveredOption({}),s()},Rp=(e,t)=>{let{store:r,render:s,dispatchEvent:i,props:n}=e;if(n.disabled)return;t._event.stopPropagation(),r.clearSelectedValue({}),n.onChange&&typeof n.onChange=="function"&&n.onChange(void 0),i(new CustomEvent("value-change",{detail:{value:void 0,label:void 0,index:null,item:void 0},bubbles:!0})),s()},Np=(e,t)=>{if(e.props.disabled)return;let{store:r,render:s,dispatchEvent:i}=e,{_event:n}=t;n.stopPropagation(),r.closeOptionsPopover({}),i(new CustomEvent("add-option-click",{bubbles:!0})),s()},Vp=(e,t)=>{let{store:r,render:s}=e;r.setHoveredAddOption({isHovered:!0}),s()},Pp=(e,t)=>{let{store:r,render:s}=e;r.setHoveredAddOption({isHovered:!1}),s()};var yi={componentName:"rtgl-select",propsSchema:{type:"object",properties:{placeholder:{type:"string"},options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"any"},testId:{type:"string"}}}},selectedValue:{type:"any"},onChange:{type:"function"},noClear:{type:"boolean"},addOption:{type:"object",properties:{label:{type:"string"}}},disabled:{type:"boolean"},w:{type:"string"}}},events:{"value-change":{},"add-option-click":{}},methods:{type:"object",properties:{}}};var Er={};R(Er,{clearHoveredOption:()=>qp,clearSelectedValue:()=>Jp,closeOptionsPopover:()=>Up,createInitialState:()=>jp,openOptionsPopover:()=>zp,resetSelection:()=>Hp,selectSelectedValue:()=>Wp,selectState:()=>Mp,selectViewData:()=>Fp,setHoveredAddOption:()=>Yp,setHoveredOption:()=>Gp,updateSelectedValue:()=>Kp});var Dp=["id","class","style","slot","placeholder","selectedValue","onChange","options","noClear","addOption","disabled"],Bp=(e={})=>Object.entries(e).filter(([t])=>!Dp.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),jp=()=>Object.freeze({isOpen:!1,position:{x:0,y:0},selectedValue:null,hoveredOptionId:null,hoveredAddOption:!1}),Fp=({state:e,props:t})=>{let r=Bp(t),s=!!t.disabled,n=Object.prototype.hasOwnProperty.call(t||{},"selectedValue")?t.selectedValue:e.selectedValue,a=t.placeholder||"Select an option",l=!0,p=t.options||[],o=p.find(c=>Ee(c.value,n));o&&(a=o.label,l=!1);let u=p.map((c,d)=>{let h=Ee(c.value,n),f=e.hoveredOptionId===d;return{...c,isSelected:h,bgc:f?"ac":h?"mu":""}});return{containerAttrString:r,isDisabled:s,isOpen:e.isOpen,position:e.position,options:u,selectedValue:n,selectedLabel:a,selectedLabelColor:l?"mu-fg":"fg",hasValue:n!=null,showClear:!s&&!t.noClear&&n!=null,showAddOption:!s&&!!t.addOption,addOptionLabel:t.addOption?.label?`+ ${t.addOption.label}`:"+ Add",addOptionBgc:e.hoveredAddOption?"ac":""}},Mp=({state:e})=>e,Wp=({state:e})=>e.selectedValue,zp=({state:e},t={})=>{let{position:r,selectedIndex:s}=t;e.position=r,e.isOpen=!0,s!=null&&(e.hoveredOptionId=s)},Up=({state:e})=>{e.isOpen=!1},Kp=({state:e},t={})=>{e.selectedValue=t.value,e.isOpen=!1},Hp=({state:e})=>{e.selectedValue=void 0},Gp=({state:e},t={})=>{e.hoveredOptionId=t.optionId},qp=({state:e})=>{e.hoveredOptionId=null},Jp=({state:e})=>{e.selectedValue=void 0},Yp=({state:e},t={})=>{e.hoveredAddOption=!!t.isHovered};var gi={refs:{selectButton:{eventListeners:{click:{handler:"handleButtonClick"}}},clearButton:{eventListeners:{click:{handler:"handleClearClick"}}},popover:{eventListeners:{close:{handler:"handleClickOptionsPopoverOverlay"}}},"option*":{eventListeners:{click:{handler:"handleOptionClick"},mouseenter:{handler:"handleOptionMouseEnter"},mouseleave:{handler:"handleOptionMouseLeave"}}},optionAdd:{eventListeners:{click:{handler:"handleAddOptionClick"},mouseenter:{handler:"handleAddOptionMouseEnter"},mouseleave:{handler:"handleAddOptionMouseLeave"}}}},template:{type:9,items:[{type:8,properties:[{key:'rtgl-button#selectButton v=ol ${containerAttrString} ?disabled=${isDisabled} data-testid="select-button"',value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c ah=s w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text w=1fg ta=s c=${selectedLabelColor} ellipsis",value:{type:1,path:"selectedLabel"},parsedKey:{type:2,parts:["rtgl-text w=1fg ta=s c=",{type:1,path:"selectedLabelColor"}," ellipsis"]}}],fast:!0},{type:8,properties:[{key:"$if showClear",value:{type:6,conditions:[{type:1,path:"showClear"}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-svg#clearButton ml=md svg=x wh=16 c=mu-fg cur=pointer data-testid="select-clear-button"',value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-svg ml=md svg=chevronDown wh=16 c=mu-fg",value:{type:0,value:null}}],fast:!0}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-button#selectButton v=ol ",{type:1,path:"containerAttrString"}," ?disabled=",{type:1,path:"isDisabled"},' data-testid="select-button"']}}],fast:!1},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y} place=rs",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=mu br=md sv=true",value:{type:9,items:[{type:7,itemVar:"option",indexVar:"i",iterable:{type:1,path:"options"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#option${i} w=f ph=lg pv=md cur=pointer br=md bgc=${option.bgc} data-testid=${option.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=s",value:{type:1,path:"option.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option",{type:1,path:"i"}," w=f ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"option.bgc"}," data-testid=",{type:1,path:"option.testId"}]}}],fast:!0}],fast:!0}},{type:8,properties:[{key:"$if showAddOption",value:{type:6,conditions:[{type:1,path:"showAddOption"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f bw=xs bc=mu bwt=sm",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:'rtgl-view#optionAdd w=f ph=lg pv=md cur=pointer br=md bgc=${addOptionBgc} data-testid="select-add-option"',value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=ac",value:{type:1,path:"addOptionLabel"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#optionAdd w=f ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"addOptionBgc"},' data-testid="select-add-option"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"isOpen"}," x=",{type:1,path:"position.x"}," y=",{type:1,path:"position.y"}," place=rs"]}}],fast:!1}],fast:!1}};var Ar={};R(Ar,{handleHeaderClick:()=>Xp,handleItemClick:()=>Zp});var Xp=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n,a=r.selectHeader();i.currentTarget.id==="headerLabel"?n=a.labelPath:i.currentTarget.id==="headerImage"?n=a.image.path:i.currentTarget.id==="header"&&(n=a.path),s(new CustomEvent("header-click",{detail:{path:n},bubbles:!0,composed:!0}))},Zp=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n=i.currentTarget.dataset.itemId||i.currentTarget.id.slice(4),a=r.selectItem(n);s(new CustomEvent("item-click",{detail:{item:a},bubbles:!0,composed:!0}))};var bi={componentName:"rtgl-sidebar",propsSchema:{type:"object",properties:{mode:{type:"string"},hideHeader:{type:"boolean",default:!1},w:{type:"string"},bwr:{type:"string"},selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{type:"string"},testId:{type:"string"},image:{type:"object",properties:{src:{type:"string"},width:{type:"number"},height:{type:"number"},alt:{type:"string"}}}}},items:{type:"array",items:{type:"object",properties:{title:{type:"string"},slug:{type:"string"},type:{type:"string"},items:{type:"array"},testId:{type:"string"}}}}}},events:{"header-click":{type:"object",properties:{path:{type:"string"}}},"item-click":{type:"object",properties:{item:{type:"object"}}}},methods:{type:"object",properties:{}}};var $r={};R($r,{createInitialState:()=>Qp,selectActiveItem:()=>ac,selectHeader:()=>nc,selectItem:()=>oc,selectViewData:()=>ic,setState:()=>lc});var Qp=()=>Object.freeze({}),ec=["id","class","style","slot","header","items","selectedItemId","mode","hideHeader","w","bwr"],tc=(e={})=>Object.entries(e).filter(([t])=>!ec.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ze=e=>{if(e!=null){if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(decodeURIComponent(e))}catch{try{return JSON.parse(e)}catch{return}}}},rc=e=>{if(e===!0)return!0;if(e===!1||e===void 0||e===null)return!1;if(typeof e=="string"){let t=e.trim().toLowerCase();return t===""||t==="true"}return!1},sc=(e,t)=>e!=null&&e!==""?e:t==="full"?272:64;function kr(e,t=null){let r=[];for(let s of e){let i=s.id||s.href||s.path,n=t===i;if(r.push({id:i,title:s.title,href:s.href,type:s.type||"item",icon:s.icon,hrefAttr:s.href?`href=${s.href}`:"",isSelected:n,itemBgc:n?"ac":"bg",itemHoverBgc:n?"ac":"mu"}),s.items&&Array.isArray(s.items))for(let a of s.items){let l=a.id||a.href||a.path,p=t===l;r.push({id:l,title:a.title,href:a.href,type:a.type||"item",icon:a.icon,hrefAttr:a.href?`href=${a.href}`:"",isSelected:p,itemBgc:p?"ac":"bg",itemHoverBgc:p?"ac":"mu"})}}return r}var ic=({props:e})=>{let t=Ze(e.header)||e.header,r=Ze(e.items)||e.items,s=e.selectedItemId,i=tc(e),n=e.mode||"full",a=t||{label:"",path:"",image:{src:"",alt:"",width:0,height:0}},l=r?kr(r,s):[],p=!rc(e.hideHeader),o=e.bwr||"xs",u=sc(e.w,n),c=n==="full"?"fs":"c",d=n==="full"?"fs":"c",h=n==="full"?"lg":"sm",f=n==="full"?"md":"sm",m=n==="shrunk-lg"?48:40,g=n==="shrunk-lg"?28:20,y=n==="shrunk-lg"?"md":"sm",w=n==="full",_=n==="full",x=n==="full"?"fs":"c",E=n==="full"?"":`ah=${d}`,A=n==="full"?"f":m;return{containerAttrString:i,mode:n,header:a,items:l,sidebarWidth:u,headerAlign:c,itemAlign:d,headerPadding:h,itemPadding:f,itemHeight:m,iconSize:g,firstLetterSize:y,showLabels:w,showGroupLabels:_,itemContentAlign:x,itemAlignAttr:E,itemWidth:A,headerWidth:A,selectedItemId:s,ah:n==="shrunk-lg"||n==="shrunk-md"?"c":"",showHeader:p,rightBorderWidth:o}},nc=({props:e})=>Ze(e.header)||e.header,ac=({state:e,props:t})=>{let r=Ze(t.items)||t.items;return(r?kr(r):[]).find(i=>i.active)},oc=({props:e},t)=>{let r=Ze(e.items)||e.items;return(r?kr(r):[]).find(i=>i.id===t)},lc=({state:e})=>{};var vi={refs:{headerImage:{eventListeners:{click:{handler:"handleHeaderClick"}}},headerLabel:{eventListeners:{click:{handler:"handleHeaderClick"}}},header:{eventListeners:{click:{handler:"handleHeaderClick"}}},"item*":{eventListeners:{click:{handler:"handleItemClick"}}}},anchors:[[{"$if header.image && header.image.src":[{"$if header.image.href":[{"a href=${header.image.href}":[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}],"$elif header.image.path":[{"rtgl-view#headerImage cur=pointer":[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}],$else:[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}]},{"$if header.label && showLabels":[{"$if header.labelHref":[{"rtgl-text href=${header.labelHref} s=lg":"${header.label}"}],"$elif header.labelPath":[{"rtgl-view#headerLabel cur=pointer":[{"rtgl-text s=lg":"${header.label}"}]}],$else:[{"rtgl-text s=lg":"${header.label}"}]}]}]],template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=${sidebarWidth} d=v bwr=${rightBorderWidth} ah=${ah} ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if showHeader",value:{type:6,conditions:[{type:1,path:"showHeader"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view ph=${headerPadding} pv=lg",value:{type:9,items:[{type:8,properties:[{key:"$if header.href",value:{type:6,conditions:[{type:1,path:"header.href"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view href=${header.href} d=h av=c ah=${headerAlign} g=lg w=${headerWidth}",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"$if header.image && header.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.image"},right:{type:1,path:"header.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.image.href",value:{type:6,conditions:[{type:1,path:"header.image.href"},{type:1,path:"header.image.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${header.image.href}",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a href=",{type:1,path:"header.image.href"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#headerImage cur=pointer",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if header.label && showLabels",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.label"},right:{type:1,path:"showLabels"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.labelHref",value:{type:6,conditions:[{type:1,path:"header.labelHref"},{type:1,path:"header.labelPath"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text href=${header.labelHref} s=lg",value:{type:1,path:"header.label"},parsedKey:{type:2,parts:["rtgl-text href=",{type:1,path:"header.labelHref"}," s=lg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#headerLabel cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view href=",{type:1,path:"header.href"}," d=h av=c ah=",{type:1,path:"headerAlign"}," g=lg w=",{type:1,path:"headerWidth"}]}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header d=h av=c ah=${headerAlign} g=lg w=${headerWidth} cur=pointer data-testid=${header.testId}",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"$if header.image && header.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.image"},right:{type:1,path:"header.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.image.href",value:{type:6,conditions:[{type:1,path:"header.image.href"},{type:1,path:"header.image.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${header.image.href}",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a href=",{type:1,path:"header.image.href"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#headerImage cur=pointer",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if header.label && showLabels",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.label"},right:{type:1,path:"showLabels"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.labelHref",value:{type:6,conditions:[{type:1,path:"header.labelHref"},{type:1,path:"header.labelPath"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text href=${header.labelHref} s=lg",value:{type:1,path:"header.label"},parsedKey:{type:2,parts:["rtgl-text href=",{type:1,path:"header.labelHref"}," s=lg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#headerLabel cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#header d=h av=c ah=",{type:1,path:"headerAlign"}," g=lg w=",{type:1,path:"headerWidth"}," cur=pointer data-testid=",{type:1,path:"header.testId"}]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view ph=",{type:1,path:"headerPadding"}," pv=lg"]}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-view w=f h=1fg sv ph=${headerPadding} pb=lg g=xs ah=${ah}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:'$if item.type == "groupLabel"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"groupLabel"}},null],bodies:[{type:9,items:[{type:8,properties:[{key:"$if showGroupLabels",value:{type:6,conditions:[{type:1,path:"showGroupLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view mt=md h=32 av=c ph=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=xs c=mu-fg",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view mt=md h=1 bgc=mu",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item${i} data-item-id=${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=pointer data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"$if item.icon",value:{type:6,conditions:[{type:1,path:"item.icon"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"$if showLabels",value:{type:6,conditions:[{type:1,path:"showLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=${itemContentAlign} g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${item.icon} c=fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"item.icon"}," c=fg"]}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=h ah=",{type:1,path:"itemContentAlign"}," g=sm"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=${iconSize} svg=${item.icon} c=fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=",{type:1,path:"iconSize"}," svg=",{type:1,path:"item.icon"}," c=fg"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"$if showLabels",value:{type:6,conditions:[{type:1,path:"showLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=${iconSize} br=f bgc=mu av=c ah=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=${firstLetterSize} c=fg",value:{type:1,path:"item.title.charAt(0).toUpperCase()"},parsedKey:{type:2,parts:["rtgl-text s=",{type:1,path:"firstLetterSize"}," c=fg"]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view wh=",{type:1,path:"iconSize"}," br=f bgc=mu av=c ah=c"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#item",{type:1,path:"i"}," data-item-id=",{type:1,path:"item.id"}," ",{type:1,path:"item.hrefAttr"}," h=",{type:1,path:"itemHeight"}," av=c ",{type:1,path:"itemAlignAttr"}," ph=",{type:1,path:"itemPadding"}," w=",{type:1,path:"itemWidth"}," h-bgc=",{type:1,path:"item.itemHoverBgc"}," br=lg bgc=",{type:1,path:"item.itemBgc"}," cur=pointer data-testid=",{type:1,path:"item.testId"}]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f h=1fg sv ph=",{type:1,path:"headerPadding"}," pb=lg g=xs ah=",{type:1,path:"ah"}]}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view h=f w=",{type:1,path:"sidebarWidth"}," d=v bwr=",{type:1,path:"rightBorderWidth"}," ah=",{type:1,path:"ah"}," ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Sr={};R(Sr,{handleBeforeMount:()=>pc,handleOnUpdate:()=>cc,handleValueChange:()=>uc,handleValueInput:()=>dc});var pc=e=>{let{store:t,props:r}=e;t.setValue({value:r.value??0})},cc=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e,a=r?.key!==s?.key,l=r?.value!==s?.value;if(a||l){let p=s?.value??0;i.setValue({value:p}),n()}},uc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=t._event,a=Number(n.detail.value),p=(typeof n.composedPath=="function"?n.composedPath():[]).find(o=>o?.tagName==="RTGL-SLIDER-INPUT")||n.currentTarget?.getRootNode?.()?.host;r.setValue({value:a}),p&&typeof p.setAttribute=="function"&&p.setAttribute("value",String(a)),s(),i(new CustomEvent("value-change",{detail:{value:a},bubbles:!0}))},dc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=t._event,a=Number(n.detail.value),p=(typeof n.composedPath=="function"?n.composedPath():[]).find(o=>o?.tagName==="RTGL-SLIDER-INPUT")||n.currentTarget?.getRootNode?.()?.host;r.setValue({value:a}),p&&typeof p.setAttribute=="function"&&p.setAttribute("value",String(a)),s(),i(new CustomEvent("value-input",{detail:{value:a},bubbles:!0}))};var wi={componentName:"rtgl-slider-input",propsSchema:{type:"object",properties:{key:{type:"string"},value:{type:"string",default:"0"},w:{type:"string",default:""},min:{type:"string",default:"0"},max:{type:"string",default:"100"},step:{type:"string",default:"1"},disabled:{type:"boolean",default:!1}}},events:{"value-input":{},"value-change":{}},methods:{type:"object",properties:{}}};var Cr={};R(Cr,{createInitialState:()=>fc,selectViewData:()=>hc,setValue:()=>mc});var fc=()=>Object.freeze({value:0}),hc=({state:e,props:t})=>({key:t.key,value:e.value,w:t.w||"",min:t.min||0,max:t.max||100,step:t.step||1,disabled:!!t.disabled}),mc=({state:e},t={})=>{e.value=t.value};var _i={refs:{input:{eventListeners:{"value-input":{handler:"handleValueInput"},"value-change":{handler:"handleValueChange"}}},slider:{eventListeners:{"value-change":{handler:"handleValueChange"},"value-input":{handler:"handleValueInput"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md w=${w}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-slider#slider key=${key} w=f type=range min=${min} max=${max} step=${step} value=${value} ?disabled=${disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider key=",{type:1,path:"key"}," w=f type=range min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}," ?disabled=",{type:1,path:"disabled"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=84",value:{type:9,items:[{type:8,properties:[{key:"rtgl-input-number#input key=${key} w=f min=${min} max=${max} step=${step} value=${value} ?disabled=${disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-number#input key=",{type:1,path:"key"}," w=f min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}," ?disabled=",{type:1,path:"disabled"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=h av=c g=md w=",{type:1,path:"w"}]}}],fast:!0}],fast:!0}};var Ir={};R(Ir,{handleBeforeMount:()=>yc,handleHeaderClick:()=>bc,handleRowClick:()=>gc});var yc=e=>{},gc=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=parseInt(i.currentTarget.id.slice(3),10),a=s.data?.rows?.[n];a&&r(new CustomEvent("row-click",{detail:{rowIndex:n,rowData:a}}))},bc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,a=t._event.currentTarget.dataset.columnKey,l=r.selectSortInfo(),p="asc";l.column===a&&(l.direction==="asc"?p="desc":l.direction==="desc"&&(p=null)),p?r.setSortColumn({column:a,direction:p}):r.clearSort(),s(),i(new CustomEvent("header-click",{detail:{column:a,direction:p,sortInfo:p?{column:a,direction:p}:null}}))};var xi={componentName:"rtgl-table",propsSchema:{type:"object",properties:{data:{type:"object",properties:{columns:{type:"array",items:{type:"object",properties:{key:{type:"string"},label:{type:"string"}}}},rows:{type:"array",items:{type:"object"}}}},responsive:{type:"boolean",default:!0}}},events:{},methods:{type:"object",properties:{}}};var Or={};R(Or,{clearSort:()=>Sc,createInitialState:()=>vc,selectSortInfo:()=>kc,selectState:()=>Ac,selectViewData:()=>Ec,setSortColumn:()=>$c});var vc=()=>Object.freeze({sortColumn:null,sortDirection:null}),wc=["id","class","style","slot","data"],_c=(e={})=>Object.entries(e).filter(([t])=>!wc.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),xc=(e,t)=>{let r=t.split("."),s=e;for(let i of r){if(s==null)return null;s=s[i]}return s},Ec=({state:e,props:t})=>{let r=_c(t),s=t.data||{columns:[],rows:[]},i=s.rows.map((n,a)=>{let l=s.columns.map(p=>{let o=xc(n,p.key);return{key:p.key,value:o!=null?String(o):""}});return{index:a,cells:l}});return{containerAttrString:r,columns:s.columns||[],rows:i||[]}},Ac=({state:e})=>e,kc=({state:e})=>({column:e.sortColumn,direction:e.sortDirection}),$c=({state:e},{column:t,direction:r}={})=>{e.sortColumn=t,e.sortDirection=r},Sc=({state:e})=>{e.sortColumn=null,e.sortDirection=null};var Ei={refs:{"row*":{eventListeners:{click:{handler:"handleRowClick"}}},"header*":{eventListeners:{click:{handler:"handleHeaderClick"}}}},styles:{table:{width:"100%","border-collapse":"collapse","border-spacing":0},thead:{"border-bottom":"2px solid var(--border)"},th:{padding:"12px","text-align":"left","font-weight":500,color:"var(--foreground)","background-color":"var(--muted)",cursor:"pointer",position:"sticky",top:0,"z-index":1},"tbody tr":{"border-bottom":"1px solid var(--border)"},"tbody tr:last-child":{"border-bottom":"none"},td:{padding:"12px",color:"var(--foreground)"},".table-container":{width:"100%",height:"100%",overflow:"auto"},".empty-state":{"text-align":"center",padding:"24px",color:"var(--muted-foreground)"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view.table-container ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if rows.length > 0",value:{type:6,conditions:[{type:4,op:2,left:{type:1,path:"rows.length"},right:{type:0,value:0}},null],bodies:[{type:9,items:[{type:8,properties:[{key:"table",value:{type:9,items:[{type:8,properties:[{key:"thead",value:{type:9,items:[{type:8,properties:[{key:"tr",value:{type:9,items:[{type:7,itemVar:"column",indexVar:"i",iterable:{type:1,path:"columns"},body:{type:9,items:[{type:8,properties:[{key:"th#header${i} data-column-key=${column.key}",value:{type:1,path:"column.label"},parsedKey:{type:2,parts:["th#header",{type:1,path:"i"}," data-column-key=",{type:1,path:"column.key"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"tbody",value:{type:9,items:[{type:7,itemVar:"row",indexVar:"rowIndex",iterable:{type:1,path:"rows"},body:{type:9,items:[{type:8,properties:[{key:"tr#row${rowIndex}",value:{type:9,items:[{type:7,itemVar:"cell",indexVar:"cellIndex",iterable:{type:1,path:"row.cells"},body:{type:9,items:[{type:8,properties:[{key:"td",value:{type:1,path:"cell.value"}}],fast:!0}],fast:!0}}],fast:!1},parsedKey:{type:2,parts:["tr#row",{type:1,path:"rowIndex"}]}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view.empty-state w=f p=xl",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:0,value:"No data available"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view.table-container ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Tr={};R(Tr,{handleClickItem:()=>Cc});var Cc=(e,t)=>{let{dispatchEvent:r}=e,i=t._event.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:i}}))};var Ai={componentName:"rtgl-tabs",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},testId:{type:"string"}}}},selectedTab:{type:"string"}}},events:{"item-click":{type:"object",properties:{id:{type:"string"}}}},methods:{type:"object",properties:{}}};var Lr={};R(Lr,{createInitialState:()=>Ic,selectViewData:()=>Lc});var Ic=()=>Object.freeze({}),Oc=["id","class","style","slot","items","selectedTab"],Tc=(e={})=>Object.entries(e).filter(([t])=>!Oc.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Lc=({props:e})=>{let t=Tc(e),r=e.items||[],s=e.selectedTab,i=r.map(n=>({...n,isSelected:n.id===s,bgColor:n.id===s?"ac":"",borderColor:n.id===s?"":"tr",textColor:n.id===s?"":"mu-fg"}));return{containerAttrString:t,items:i,selectedTab:s}};var ki={refs:{"tab*":{eventListeners:{click:{handler:"handleClickItem"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm bgc=mu p=sm br=lg ${containerAttrString}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#tab${i} data-id=${item.id} cur=pointer bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.textColor}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.textColor"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#tab",{type:1,path:"i"}," data-id=",{type:1,path:"item.id"}," cur=pointer bgc=",{type:1,path:"item.bgColor"}," bw=xs bc=",{type:1,path:"item.borderColor"}," pv=md ph=lg br=lg data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view d=h g=sm bgc=mu p=sm br=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var $i={};var Si={componentName:"rtgl-tooltip",propsSchema:{type:"object",properties:{open:{type:"boolean"},x:{type:"string"},y:{type:"string"},place:{type:"string"},content:{type:"string"}}},events:[],methods:{type:"object",properties:{}}};var Rr={};R(Rr,{createInitialState:()=>Rc,selectViewData:()=>Nc});var Rc=()=>Object.freeze({}),Nc=({props:e})=>({open:!!e.open,x:e.x||0,y:e.y||0,place:e.place||"t",content:e.content||""});var Ci={template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place} no-overlay",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content bgc=bg bc=bo br=md p=sm ah=c av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=c s=sm c=fg",value:{type:1,path:"content"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"open"}," x=",{type:1,path:"x"}," y=",{type:1,path:"y"}," place=",{type:1,path:"place"}," no-overlay"]}}],fast:!0}],fast:!0},refs:{}};var Nr={};R(Nr,{handleAfterMount:()=>Vc,handleOnUpdate:()=>Pc});var Vc=async e=>{let{props:t,store:r,render:s,refs:i}=e,{waveformData:n}=t;r.setWaveformData({data:n}),s();let a=i.canvas;a&&Ii(n,a)},Pc=async(e,t)=>{let{store:r,render:s,refs:i,props:n}=e,{waveformData:a}=n;if(!a){console.log("waveform handleOnUpdate: no waveformData provided");return}r.setWaveformData({data:a}),s();let l=i.canvas;l&&Ii(a,l)};async function Ii(e,t){let r=t.getContext("2d"),s=t.getBoundingClientRect(),i=s.width,n=s.height;t.width=i,t.height=n;let a=t.width,l=t.height;if(r.clearRect(0,0,a,l),r.fillStyle="#1a1a1a",r.fillRect(0,0,a,l),!e||!e.amplitudes)return;let p=e.amplitudes,o=l/2,u=r.createLinearGradient(0,0,0,l);u.addColorStop(0,"#404040"),u.addColorStop(.5,"#A1A1A1"),u.addColorStop(1,"#404040");let c=Math.max(1,a/p.length),d=.2;for(let h=0;h<p.length;h++){let m=p[h]/255*(l*.85),g=h*c,y=o-m/2;r.fillStyle=u,r.fillRect(g,y,Math.max(1,c*(1-d)),m)}r.strokeStyle="rgba(255, 255, 255, 0.1)",r.lineWidth=1,r.beginPath(),r.moveTo(0,o),r.lineTo(a,o),r.stroke(),r.shadowBlur=10,r.shadowColor="#2196F3"}var Oi={componentName:"rtgl-waveform",propsSchema:{type:"object",properties:{w:{type:"string",description:"Width of the waveform visualizer",default:"250"},h:{type:"string",description:"Height of the waveform visualizer",default:"150"},cur:{type:"string",description:"cursor"},waveformData:{type:"object",description:"File ID of the waveform data in object storage"},isLoading:{type:"boolean",description:"Whether the waveform data is currently being loaded"}}},events:[],methods:{type:"object",properties:{}}};var Vr={};R(Vr,{createInitialState:()=>Dc,selectViewData:()=>jc,setWaveformData:()=>Bc});var Dc=()=>Object.freeze({waveformData:null}),Bc=({state:e},t={})=>{e.waveformData=t.data},jc=({state:e,props:t})=>({isLoading:t.isLoading,w:t.w||"250",h:t.h||"150",cur:t.cur,waveformData:t.waveformData});var Ti={refs:{canvas:{selector:"canvas"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view pos=rel w=${w} h=${h} cur=${cur}",value:{type:9,items:[{type:8,properties:[{key:"$if isLoading",value:{type:6,conditions:[{type:1,path:"isLoading"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=f av=c ah=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:0,value:"..."}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'canvas#canvas style="width:100%; height:100%;"',value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view pos=rel w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," cur=",{type:1,path:"cur"}]}}],fast:!1}],fast:!1}};var Pr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dt=e=>e.replace(/-([a-z0-9])/g,(t,r)=>r.toUpperCase()),ut=e=>{if(e!=null)return e===""?!0:e},Li=(e,t)=>{let r=e.getAttribute(t);if(r!==null)return ut(r);let s=Pr(t);if(s!==t){let i=e.getAttribute(s);if(i!==null)return ut(i)}},Ri=(e,t)=>{let r=new Set(t);return new Proxy({},{get(s,i){if(typeof i=="string"&&r.has(i)){let n=e[i];return n!==void 0?n:Li(e,i)}},set(){throw new Error("Cannot assign to read-only proxy")},defineProperty(){throw new Error("Cannot define properties on read-only proxy")},deleteProperty(){throw new Error("Cannot delete properties from read-only proxy")},has(s,i){return typeof i=="string"&&r.has(i)},ownKeys(){return[...r]},getOwnPropertyDescriptor(s,i){if(typeof i=="string"&&r.has(i))return{configurable:!0,enumerable:!0,get:()=>{let n=e[i];return n!==void 0?n:Li(e,i)}}}})};var Ni=({schema:e,methodExports:t=[]})=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("componentName is required.");if(typeof e.componentName!="string"||e.componentName.trim()==="")throw new Error("componentName is required.");if(Object.prototype.hasOwnProperty.call(e,"attrsSchema"))throw new Error("attrsSchema is not supported.");if(Object.prototype.hasOwnProperty.call(e,"methods")){let r=e.methods;if(!r||typeof r!="object"||Array.isArray(r))throw new Error("methods must be an object schema with a properties map.");if(Object.prototype.hasOwnProperty.call(r,"type")&&r.type!=="object")throw new Error("methods.type must be 'object'.");if(!r.properties||typeof r.properties!="object"||Array.isArray(r.properties))throw new Error("methods.properties must be an object keyed by method name.");for(let s of Object.keys(r.properties))if(!t.includes(s))throw new Error(`method '${s}' is declared in schema but missing in .methods.js exports.`)}return!0};var b={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9,PARTIAL:10,PATH_REFERENCE:11},D={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},Qe={NOT:0};var T=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},se=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var Dr=e=>{if(!e||e.trim()==="")throw new T("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new T(`Invalid comparison operator '${e.includes("===")?"===":"!=="}' - did you mean '${r}'? (got: '${e}')`)}let t=["<",">","<=",">=","==","!="];for(let r of t)if(e.trim().endsWith(r))throw new T(`Incomplete comparison expression - missing right operand (got: '${e}')`)},Vi=e=>{if(e.trim().endsWith(" in"))throw new T(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new T(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new T(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(t.includes(",")){let s=t.split(",").map(i=>i.trim());for(let i of s)if(!i)throw new T(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)}else if(!t.trim())throw new T(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)};var Pi=(e,t,r=!1)=>{if(t===null)return new se(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new se(`Cannot iterate over undefined value at '$for ${e}'`);let s=typeof t;return r?new se(`Cannot iterate over non-array value in loop '${e}' - got ${s} instead`):new se(`Cannot iterate over non-array value (got: ${s}) at '$for ${e}'`)},Di=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new se(`Unknown function '${e}' (${r})`)};var Fc=(e,t,r={})=>{let s={},i={};r&&typeof r=="object"&&(r.functions!==void 0||r.partials!==void 0?(s=r.functions||{},i=r.partials||{}):typeof r=="object"&&(s=r));let a=I(e,{functions:s,partials:i},t,{});return a===void 0?{}:a},I=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return z(e.var,r,s);if(e.type===b.LITERAL)return e.value;if(e.type===b.VARIABLE)return z(e.path,r,s);if(e.type===b.INTERPOLATION)return Wc(e.parts,t,r,s);switch(e.type){case b.FUNCTION:return ji(e,t,r,s);case b.BINARY:return Fi(e,t,r,s);case b.UNARY:return Mi(e,t,r,s);case b.CONDITIONAL:return Uc(e,t,r,s);case b.LOOP:return Jc(e,t,r,s);case b.OBJECT:return Xc(e,t,r,s);case b.ARRAY:return Zc(e,t,r,s);case b.PARTIAL:return Qc(e,t,r,s);case b.PATH_REFERENCE:return eu(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},Bi=new Map,Mc=e=>{let t=[],r="",s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(n==="[")r&&(t.push({type:"property",value:r}),r=""),s=!0;else if(n==="]"){if(s&&r){let a=r.trim();if(/^\d+$/.test(a))t.push({type:"index",value:parseInt(a,10)});else if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")){let l=a.slice(1,-1);t.push({type:"property",value:l})}else t.push({type:"property",value:a});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},z=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=Bi.get(e);if(!s){let n=[],a="",l=0;for(let p=0;p<e.length;p++){let o=e[p];o==="["?(l++,a+=o):o==="]"?(l--,a+=o):o==="."&&l===0?a&&(n.push(a),a=""):a+=o}a&&n.push(a),s=[];for(let p of n){let o=Mc(p.trim());s.push(...o)}Bi.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let a=s[n];if(a.type==="property"&&a.value in r){i=r[a.value];continue}if(i==null)return;(a.type==="property"||a.type==="index")&&(i=i[a.value])}return i},Wc=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let a=I(n,t,r,s);i.push(a!=null?String(a):"")}return i.join("")},ji=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw Di(e.name,i);let a=e.args.map(l=>I(l,t,r,s));return n(...a)},Ne=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);switch(e.type){case b.VARIABLE:return z(e.path,r,s);case b.LITERAL:return e.value;case b.BINARY:return Fi(e,t,r,s);case b.UNARY:return Mi(e,t,r,s);case b.FUNCTION:return ji(e,t,r,s);default:return I(e,t,r,s)}},Fi=(e,t,r,s)=>{if(e.op===D.AND||e.op===D.OR){let a=Ne(e.left,t,r,s),l=Ne(e.right,t,r,s);switch(e.op){case D.AND:return a&&l;case D.OR:return a||l}}let i=I(e.left,t,r,s),n=I(e.right,t,r,s);switch(e.op){case D.EQ:return i==n;case D.NEQ:return i!=n;case D.GT:return i>n;case D.LT:return i<n;case D.GTE:return i>=n;case D.LTE:return i<=n;case D.IN:return Array.isArray(n)?n.includes(i):!1;case D.ADD:if(typeof i!="number"||typeof n!="number")throw new se(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case D.SUBTRACT:if(typeof i!="number"||typeof n!="number")throw new se(`Arithmetic operations require numbers. Got ${typeof i} - ${typeof n}`);return i-n;default:throw new Error(`Unknown binary operator: ${e.op}`)}},Mi=(e,t,r,s)=>{let i=e.op===Qe.NOT?Ne(e.operand,t,r,s):I(e.operand,t,r,s);switch(e.op){case Qe.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},zc=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===b.VARIABLE)if(z(i.path,r,s)){let a=e.bodies[0];if(a.type===b.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?I(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===b.LITERAL)l[o]=u.value;else if(u.type===b.VARIABLE)l[o]=z(u.path,r,s);else if(u.type===b.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===b.VARIABLE){let h=z(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=I(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=I(u,t,r,s)}return l}}else{let a=e.bodies[1];if(a.type===b.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?I(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===b.LITERAL)l[o]=u.value;else if(u.type===b.VARIABLE)l[o]=z(u.path,r,s);else if(u.type===b.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===b.VARIABLE){let h=z(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=I(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=I(u,t,r,s)}return l}}}return null},Uc=(e,t,r,s)=>{let i=zc(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let a=e.conditions[n];if(a===null||Ne(a,t,r,s))return I(e.bodies[n],t,r,s)}return Wi},Kc=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===b.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===b.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let a=i.substring(s.length+1);if(n.type===b.OBJECT&&n.properties.length<=5){for(let p of n.properties)if(p.parsedKey)return null;let l=[];for(let p=0;p<t.length;p++){let o=t[p];if(o[a]){let u={};for(let c of n.properties){let d=c.key,h=c.value;if(h.type===b.LITERAL)u[d]=h.value;else if(h.type===b.VARIABLE){let f=h.path;if(f===s)u[d]=o;else if(f.startsWith(s+".")){let m=f.substring(s.length+1);u[d]=o[m]}else return null}else if(h.type===b.INTERPOLATION){let f=[],m=!0;for(let g of h.parts)if(typeof g=="string")f.push(g);else if(g.type===b.VARIABLE){let y=g.path;if(y===s)f.push(o!=null?String(o):"");else if(y.startsWith(s+".")){let w=y.substring(s.length+1),_=o[w];f.push(_!=null?String(_):"")}else{m=!1;break}}else{m=!1;break}if(!m)return null;u[d]=f.join("")}else return null}l.push(u)}}return l}}}return null},Hc=(e,t)=>{let r=e.body,s=e.itemVar,i=Kc(e,t);if(i!==null)return i;if(r.type===b.OBJECT&&r.properties.length<=5){for(let l of r.properties)if(l.parsedKey)return null;let n=[],a=!0;for(let l of r.properties){let p=l.key,o=l.value;if(o.type===b.LITERAL)n.push({key:p,type:"literal",value:o.value});else if(o.type===b.VARIABLE){let u=o.path;if(u===s)n.push({key:p,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes(".")&&!c.includes("["))n.push({key:p,type:"prop",prop:c});else{a=!1;break}}else{a=!1;break}}else if(o.type===b.INTERPOLATION&&o.parts.length===1){let u=o.parts[0];if(u.type===b.VARIABLE){let c=u.path;if(c===s)n.push({key:p,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:p,type:"prop_string",prop:d});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let l=new Array(t.length);if(n.length===3&&n[0].type==="prop"&&n[0].key==="id"&&n[1].type==="prop_string"&&n[1].key==="title"&&n[2].type==="prop"&&n[2].key==="completed")for(let p=0;p<t.length;p++){let o=t[p];l[p]={id:o.id,title:o.title!=null?String(o.title):"",completed:o.completed}}else for(let p=0;p<t.length;p++){let o=t[p],u={};for(let c of n)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=o;else if(c.type==="prop")u[c.key]=o[c.prop];else if(c.type==="item_string")u[c.key]=o!=null?String(o):"";else if(c.type==="prop_string"){let d=o[c.prop];u[c.key]=d!=null?String(d):""}l[p]=u}return l}}return null},Gc=(e,t,r,s,i)=>{let n=[],a=e.body;if(a.type===b.OBJECT&&a.fast!==!1){let l=e.itemVar,p=e.indexVar;for(let o=0;o<i.length;o++){let u=i[o],c={},d={...s,[l]:u,...p&&{[p]:o}};d.__paths__||(d.__paths__=s.__paths__||{});let h=e.iterable.path||"";if(s&&s.__paths__&&h){let f=h.split("."),m=f[0];m in s.__paths__&&(h=s.__paths__[m],f.length>1&&(h+="."+f.slice(1).join(".")))}d.__paths__={...d.__paths__,[l]:`${h}[${o}]`,...p&&{[p]:o}};for(let f of a.properties){let m=f.parsedKey?I(f.parsedKey,t,r,d):f.key,g=f.value;if(g.type===b.LITERAL)c[m]=g.value;else if(g.type===b.VARIABLE){let y=g.path;if(y===l)c[m]=u;else if(y===p)c[m]=o;else if(y.startsWith(l+".")){let w=y.substring(l.length+1);!w.includes(".")&&!w.includes("[")?c[m]=u[w]:c[m]=z(y,r,{...s,[l]:u,...p&&{[p]:o}})}else c[m]=z(y,r,{...s,[l]:u,...p&&{[p]:o}})}else if(g.type===b.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===b.VARIABLE){let _=w.path,x;if(_===l)x=u;else if(_===p)x=o;else if(_.startsWith(l+".")){let E=_.substring(l.length+1);!E.includes(".")&&!E.includes("[")?x=u[E]:x=z(_,r,{...s,[l]:u,...p&&{[p]:o}})}else x=z(_,r,{...s,[l]:u,...p&&{[p]:o}});y.push(x!=null?String(x):"")}else{let _={...s,[l]:u,...p&&{[p]:o}},x=I(w,t,r,_);y.push(x!=null?String(x):"")}c[m]=y.join("")}else{let y={...s,[l]:u,...p&&{[p]:o}};c[m]=I(g,t,r,y)}}n.push(c)}return n}return null},qc=(e,t,r)=>{let s=e.body;if(s.type===b.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===b.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===b.VARIABLE&&n.conditions[0].path==="item.visible"){let a=n.bodies[0];if(a.type===b.OBJECT&&a.properties.length===2){let l=a.properties[0],p=a.properties[1];if(l.key==="id"&&l.value.type===b.VARIABLE&&l.value.path==="item.id"&&p.key==="$if item.highlighted"&&p.value.type===b.CONDITIONAL){let o=[];for(let u=0;u<t.length;u++){let c=t[u];if(c.visible){let d={id:c.id};c.highlighted?(d.highlight=!0,d.message=`This item is highlighted: ${c.name}`):(d.highlight=!1,d.message=c.name),o.push(d)}}return o}}}}return null},Jc=(e,t,r,s)=>{let i=I(e.iterable,t,r,s);if(!Array.isArray(i)){let o,u=!1;if(e.iterable.type===b.FUNCTION){u=!0;let d=e.iterable.args.map(h=>h.type===b.LITERAL?typeof h.value=="string"?`'${h.value}'`:String(h.value):h.type===b.VARIABLE?h.path:h.type===b.FUNCTION?`${h.name}(...)`:"?").join(", ");o=`${e.iterable.name}(${d})`}else o=e.iterable.path||"undefined";let c=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${o}`;throw Pi(c,i,u)}if(!e.indexVar){let o=qc(e,i,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=Hc(e,i);if(o!==null)return o}let n=Gc(e,t,r,s,i);if(n!==null)return n;let a=[],l=e.iterable.path||"";if(s&&s.__paths__&&l){let o=l.split("."),u=o[0];u in s.__paths__&&(l=s.__paths__[u],o.length>1&&(l+="."+o.slice(1).join(".")))}let p=!1;e.body.type===b.ARRAY&&(e.body.items.length<=1?p=!1:p=e.body._shouldPreserveArray??=e.body.items.some(o=>o.type===b.OBJECT&&o.properties.some(u=>u.key.startsWith("$if ")||u.key.startsWith("$when "))));for(let o=0;o<i.length;o++){let u=e.indexVar?{...s,[e.itemVar]:i[o],[e.indexVar]:o}:{...s,[e.itemVar]:i[o]};u.__paths__||(u.__paths__=s.__paths__||{}),u.__paths__={...u.__paths__,[e.itemVar]:`${l}[${o}]`},e.indexVar&&(u.__paths__[e.indexVar]=o);let c=I(e.body,t,r,u);Array.isArray(c)&&c.length===1&&!p?a.push(c[0]):a.push(c)}return a},Yc=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let i=e.properties[0],n=i.parsedKey?I(i.parsedKey,t,r,s):i.key,a=i.value;if(a.type===b.OBJECT&&a.properties.length<=10&&!a.whenCondition){let l={},p={},o=!0;for(let u of a.properties){let c=u.parsedKey?I(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===b.LITERAL)p[c]=d.value;else if(d.type===b.VARIABLE)p[c]=z(d.path,r,s);else if(d.type===b.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===b.VARIABLE){let m=z(f.path,r,s);h.push(m!=null?String(m):"")}else{o=!1;break}if(!o)break;p[c]=h.join("")}else if(d.type===b.OBJECT&&d.properties.length<=5){let h={};for(let f of d.properties){let m=f.key,g=f.value;if(g.type===b.LITERAL)h[m]=g.value;else if(g.type===b.VARIABLE)h[m]=z(g.path,r,s);else if(g.type===b.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===b.VARIABLE){let _=z(w.path,r,s);y.push(_!=null?String(_):"")}else{o=!1;break}if(!o)break;h[m]=y.join("")}else{o=!1;break}}if(!o)break;p[c]=h}else{o=!1;break}}if(o)return l[n]=p,l}}return null},Xc=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!Ne(e.whenCondition,i,r,s))return;let n=Yc(e,t,r,s);if(n!==null)return n;if(e.fast){let o={};for(let u of e.properties){let c=u.parsedKey?I(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===b.LITERAL)o[c]=d.value;else if(d.type===b.VARIABLE)o[c]=z(d.path,r,s);else if(d.type===b.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===b.VARIABLE){let m=z(f.path,r,s);h.push(m!=null?String(m):"")}else{let m=I(f,t,r,s);h.push(m!=null?String(m):"")}o[c]=h.join("")}else o[c]=I(d,t,r,s)}return o}let a={},l=null,p=!1;for(let o of e.properties)if(!o.key.startsWith("$if ")&&!o.key.match(/^\$if\s+\w+.*:?$/)&&!o.key.startsWith("$elif")&&!o.key.startsWith("$else")&&!o.key.startsWith("$for ")){p=!0;break}for(let o of e.properties)if(o.key.startsWith("$if ")||o.key.match(/^\$if\s+\w+.*:?$/)){let u=I(o.value,t,r,s);if(!p&&u!==null&&u!==void 0)return Array.isArray(u)&&u.length===1?u[0]:u;typeof u=="object"&&u!==null&&!Array.isArray(u)&&Object.assign(a,u)}else if(o.key.startsWith("$for ")){if(e.properties.length===1)return I(o.value,t,r,s)}else{let u=o.value;if(u&&u.type===b.OBJECT&&u.properties){let c=u.properties.find(d=>d.key.startsWith("$for "));if(c){let d=I(c.value,t,r,s);d!==void 0&&(a[o.key]=d)}else{let d=I(o.value,t,r,s);d!==void 0&&(a[o.key]=d)}}else{let c=o.parsedKey?I(o.parsedKey,t,r,s):o.key,d=I(o.value,t,r,s);d!==void 0&&(a[c]=d)}}return a},Wi={},Zc=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===b.LOOP){let a=I(n,t,r,s);i.push(a)}else{let a=I(n,t,r,s);a!==Wi&&a!==void 0&&i.push(a)}return i},Qc=(e,t,r,s)=>{let{name:i,data:n,whenCondition:a}=e,l=t.partials||{},p=t.functions||t;if(a&&!Ne(a,p,r,s))return;if(!l[i])throw new se(`Partial '${i}' is not defined`);let o=s._partialStack||[];if(o.includes(i))throw new se(`Circular partial reference detected: ${i}`);let u=l[i],c=r,d={...s,_partialStack:[...o,i]};if(s){c={...r};for(let h of Object.keys(s))h.startsWith("_")||(c[h]=s[h])}if(n){let h=I(n,t,r,s);c={...c,...h}}return I(u,t,c,d)},eu=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),a=n[0],l=n.slice(1);if(!s||!(a in s))throw new se(`Path reference '#{${i}}' refers to '${a}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(a in s.__paths__))throw new se(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let p=s.__paths__[a];if(typeof p=="number"){if(l.length>0)throw new se(`Path reference '#{${i}}' - cannot access properties on index variable '${a}'`);return String(p)}return l.length>0&&(p+="."+l.join(".")),p},et=Fc;var tu=/\$\{([^}]*)\}/g,ru=/#\{([^}]*)\}/g,Ui=(e,t={})=>{let r=e.match(/^(\w+)\((.*)\)$/);if(!r)return{isFunction:!1};let[,s,i]=r,n=su(i,t);return{isFunction:!0,type:b.FUNCTION,name:s,args:n}},su=(e,t={})=>e.trim()?iu(e).map(s=>nu(s.trim(),t)):[],iu=e=>{let t=[],r="",s=0,i=!1,n="";for(let a=0;a<e.length;a++){let l=e[a],p=a>0?e[a-1]:"";!i&&(l==='"'||l==="'")?(i=!0,n=l,r+=l):i&&l===n&&p!=="\\"?(i=!1,n="",r+=l):!i&&l==="("?(s++,r+=l):!i&&l===")"?(s--,r+=l):!i&&l===","&&s===0?(t.push(r),r=""):r+=l}return r&&t.push(r),t},nu=(e,t={})=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:b.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:b.LITERAL,value:parseFloat(e)};if(e==="true")return{type:b.LITERAL,value:!0};if(e==="false")return{type:b.LITERAL,value:!1};if(e==="null")return{type:b.LITERAL,value:null};let r=Ui(e,t);if(r.isFunction)return{type:r.type,name:r.name,args:r.args};let s=e.trim(),i=[{op:" + ",type:"ADD"},{op:" - ",type:"SUBTRACT"}],n=-1,a=null;for(let{op:l,type:p}of i){let o=0;for(;o<s.length;){let u=ke(s.substring(o),l);if(u===-1)break;let c=o+u;c>n&&(n=c,a={op:l,type:p}),o=c+l.length}}if(n!==-1)try{return ee(s,t)}catch{return{type:b.VARIABLE,path:s}}return{type:b.VARIABLE,path:s}},Ki=/^\w+\(.*\)$/,au=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,ou=e=>{if(!(!e||e.trim()===""||Ki.test(e))&&au.test(e))throw e.includes("?")&&e.includes(":")?new T(`Complex expressions not supported in variable replacements - consider calculating the value in your data instead. Offending expression: "${e}"`):e.includes("||")||e.includes("&&")||e.includes("??")?new T(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new T(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},zi=e=>{let t=e.trim();if(Ki.test(t))throw new T(`Functions are not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("["))throw new T(`Array indices not supported in path references - use simple variable names or properties. Offending expression: "#{${e}}"`);if(/[+\-*/%]/.test(t))throw new T(`Arithmetic expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(/\|\||&&/.test(t))throw new T(`Logical operators not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("?")&&t.includes(":"))throw new T(`Complex expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);return{type:b.PATH_REFERENCE,path:t}},tt=(e,t={})=>{let r=e.trim();ou(r);let s=Ui(r,t);if(s.isFunction)return{type:s.type,name:s.name,args:s.args};if(r.includes("[")&&!/[\s+\-*/%|&?:]/.test(r)){let i=0;for(let n of r)n==="["?i++:n==="]"&&i--;if(i!==0)throw new Error("Invalid array index syntax")}return{type:b.VARIABLE,path:r}},Br=(e,t={})=>{let r=e,s=[];(e.includes("\\${")||e.includes("\\#{"))&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC_VAR$1"),r=r.replace(/\\\\(#\{[^}]*\})/g,"\\DOUBLE_ESC_PATH$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\(#\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\DOUBLE_ESC_VAR/g,"\\"),r=r.replace(/\\DOUBLE_ESC_PATH/g,"\\"));let i=[...r.matchAll(tu)],n=[...r.matchAll(ru)],a=[...i.map(o=>({match:o,type:"variable"})),...n.map(o=>({match:o,type:"pathref"}))].sort((o,u)=>o.match.index-u.match.index);if(a.length===0){let o=r;for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);return{type:b.LITERAL,value:o}}if(a.length===1&&a[0].match[0]===r&&s.length===0){let{match:o,type:u}=a[0];try{return u==="variable"?tt(o[1],t):zi(o[1])}catch(c){if(c.message==="Invalid array index syntax")return{type:b.LITERAL,value:r};throw c}}let l=[],p=0;for(let{match:o,type:u}of a){let[c,d]=o,h=o.index;if(h>p){let f=r.substring(p,h);for(let m=0;m<s.length;m++)f=f.replace(`__ESCAPED_${m}__`,s[m]);f&&l.push(f)}try{let f;u==="variable"?f=tt(d.trim(),t):f=zi(d.trim()),l.push(f)}catch(f){if(f.message==="Invalid array index syntax")l.push(c);else throw f}p=h+c.length}if(p<r.length){let o=r.substring(p);for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);o&&l.push(o)}return{type:b.INTERPOLATION,parts:l}};var we=(e,t)=>typeof e=="string"?Br(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?lu(e,t):pu(e,t):{type:b.LITERAL,value:e},lu=(e,t)=>{let r=[],s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let l=Object.keys(n);if(l.length===1&&l[0].startsWith("$for ")){let p=Gi(l[0],n[l[0]],t);r.push(p),s=!0;continue}}let a=we(n,t);r.push(a),(a.type===b.FUNCTION||a.type===b.CONDITIONAL||a.type===b.LOOP||a.type===b.PARTIAL||a.type===b.OBJECT&&!a.fast||a.type===b.ARRAY&&!a.fast)&&(s=!0)}return{type:b.ARRAY,items:r,fast:!s}},pu=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),a=0;if(e.$partial!==void 0){if(typeof e.$partial!="string")throw new T("$partial value must be a string");if(e.$partial.trim()==="")throw new T("$partial value cannot be an empty string");let p=["$if","$elif","$else","$for"],o=[];for(let[y]of n)for(let w of p)if(y===w||y.startsWith(w+" ")||y.startsWith(w+"#")){o.push(w);break}if(o.length>0)throw new T(`Cannot use $partial with ${o.join(", ")} at the same level. Wrap $partial in a parent object if you need conditionals.`);let{$partial:u,$when:c,...d}=e,h={},f=!1;for(let[y,w]of Object.entries(d)){let _=y;(y.startsWith("\\$")||y.startsWith("$$"))&&(_=y.slice(1)),h[_]=w,f=!0}let m=null;if(f&&(m=we(h,t),m.type===b.OBJECT)){let y=!1;for(let w of m.properties)if(w.value.type===b.VARIABLE||w.value.type===b.INTERPOLATION||w.value.type===b.FUNCTION||w.value.type===b.CONDITIONAL||w.value.type===b.LOOP||w.value.type===b.OBJECT&&!w.value.fast||w.value.type===b.ARRAY&&!w.value.fast){y=!0;break}y&&(m.fast=!1)}let g={type:b.PARTIAL,name:u,data:m};if(c!==void 0){let y;if(typeof c=="string"){if(c.trim()==="")throw new T("Empty condition expression after '$when'");y=ee(c,t)}else y={type:b.LITERAL,value:c};g.whenCondition=y}return g}for(let[p,o]of n)if(p==="$when"){if(i!==null)throw new T("Multiple '$when' directives on the same object are not allowed");if(o==null)throw new T("Missing condition expression after '$when'");let u=typeof o=="string"?o:JSON.stringify(o);if(u.trim()==="")throw new T("Empty condition expression after '$when'");i=ee(u,t),s=!0}else if(p.startsWith("$when#")||p.startsWith("$when "))throw new T("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<n.length;){let[p,o]=n[a];if(p==="$when"){a++;continue}if(p.startsWith("$if ")||p.match(/^\$if#\w+\s/)||p.match(/^\$if\s+\w+.*:$/)){let u=cu(n,a,t);r.push({key:p,value:u.node}),s=!0,a=u.nextIndex}else if(p.startsWith("$for ")){let u=Gi(p,o,t);r.push({key:p,value:u}),s=!0,a++}else{if(p.startsWith("$elif ")||p.startsWith("$else"))throw new T(`'${p.split(" ")[0]}' without matching '$if'`);if(p==="$if"||p==="$if:")throw new T("Missing condition expression after '$if'");{let u=we(o,t);(u.type===b.FUNCTION||u.type===b.CONDITIONAL||u.type===b.LOOP||u.type===b.PARTIAL||u.type===b.OBJECT&&!u.fast||u.type===b.ARRAY&&!u.fast)&&(s=!0);let c=Br(p,t),d={key:p,value:u};(c.type!==b.LITERAL||c.value!==p)&&(d.parsedKey=c),r.push(d),a++}}}let l={type:b.OBJECT,properties:r,fast:!s};return i&&(l.whenCondition=i),l},cu=(e,t,r={})=>{let s=[],i=[],n=t,[a,l]=e[n],p=null,o;if(a.startsWith("$if#")){let c=a.match(/^\$if#(\w+)\s+(.+)$/);if(c)p=c[1],o=c[2];else throw new T(`Invalid conditional syntax: ${a}`)}else o=a.substring(4),o.endsWith(":")&&(o=o.slice(0,-1).trim());Dr(o);let u=ee(o,r);for(s.push(u),i.push(we(l,r)),n++;n<e.length;){let[c,d]=e[n],h=!1,f;if(p?c.startsWith(`$elif#${p} `)?(f=c.substring(`$elif#${p} `.length),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c===`$else#${p}`||c===`$else#${p}:`)&&(h=!0,f=null):c.startsWith("$elif ")?(f=c.substring(6),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c==="$else"||c==="$else:")&&(h=!0,f=null),h){if(f===null)s.push(null);else{Dr(f);let m=ee(f,r);s.push(m)}if(i.push(we(d,r)),n++,f===null)break}else break}return{node:{type:b.CONDITIONAL,conditions:s,bodies:i,id:p},nextIndex:n}},ee=(e,t={})=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")")){let o=e.slice(1,-1),u=0,c=!0;for(let d=0;d<o.length;d++)if(o[d]==="("?u++:o[d]===")"&&u--,u<0){c=!1;break}if(c&&u===0)return ee(o,t)}let r=ke(e,"||");if(r!==-1)return{type:b.BINARY,op:D.OR,left:ee(e.substring(0,r).trim(),t),right:ee(e.substring(r+2).trim(),t)};let s=ke(e,"&&");if(s!==-1)return{type:b.BINARY,op:D.AND,left:ee(e.substring(0,s).trim(),t),right:ee(e.substring(s+2).trim(),t)};let i=[{op:">=",type:D.GTE},{op:"<=",type:D.LTE},{op:"==",type:D.EQ},{op:"!=",type:D.NEQ},{op:">",type:D.GT},{op:"<",type:D.LT},{op:" in ",type:D.IN}];for(let{op:o,type:u}of i){let c=ke(e,o);if(c!==-1)return{type:b.BINARY,op:u,left:ee(e.substring(0,c).trim(),t),right:ee(e.substring(c+o.length).trim(),t)}}let n=-1,a=null,l=[{op:" + ",type:D.ADD},{op:" - ",type:D.SUBTRACT}];for(let{op:o,type:u}of l){let c=0;for(;c<e.length;){let d=ke(e.substring(c),o);if(d===-1)break;let h=c+d;h>n&&(n=h,a={op:o,type:u}),c=h+o.length}}if(n!==-1&&a)return{type:b.BINARY,op:a.type,left:ee(e.substring(0,n).trim(),t),right:ee(e.substring(n+a.op.length).trim(),t)};let p=[" * "," / "," % "];for(let o of p)if(ke(e,o)!==-1)throw new T(`Arithmetic operations are not allowed in conditionals: "${o}"`);return e.startsWith("!")?{type:b.UNARY,op:Qe.NOT,operand:ee(e.substring(1).trim(),t)}:Hi(e,t)},ke=(e,t)=>{let r=0,s=0;for(;s<=e.length-t.length;){if(e[s]==="(")r++;else if(e[s]===")")r--;else if(r===0&&e.substring(s,s+t.length)===t)return s;s++}return-1},uu=e=>{if(e=e.trim(),e==="true")return{type:b.LITERAL,value:!0};if(e==="false")return{type:b.LITERAL,value:!1};if(e==="null")return{type:b.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:b.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:b.LITERAL,value:""};if(e==="{}")return{type:b.LITERAL,value:{}};if(e==="[]")return{type:b.LITERAL,value:[]};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:b.LITERAL,value:t}:{type:b.VARIABLE,path:e}},Hi=(e,t)=>{let r=e.trim();if(r.match(/^(\w+)\((.*)\)$/))return tt(r,t);let i=uu(r);if(i.type===b.LITERAL)return i;if(/^[a-zA-Z_$][\w.$]*$/.test(r))return{type:b.VARIABLE,path:r};try{return tt(r,t)}catch(n){if(n.message&&n.message.includes("not supported"))return i;throw n}},Gi=(e,t,r)=>{let s=e.substring(5).trim();Vi(s);let i=s.match(/^(.+?)\s+in\s+(.+)$/);if(!i)throw new T(`Invalid loop syntax - missing 'in' keyword (got: '$for ${s}')`);let n=i[1].trim(),a=i[2].trim(),l,p=null;if(n.includes(",")){let c=n.split(",").map(d=>d.trim());if(c.length!==2)throw new T(`Invalid loop variables: ${n}. Expected format: "item" or "item, index"`);l=c[0],p=c[1]}else l=n;let o=Hi(a,r),u=we(t,r);return{type:b.LOOP,itemVar:l,indexVar:p,iterable:o,body:u}};var du=(e,t={})=>{let{functions:r={}}=t;return we(e,r)},ft=du;var jr={};R(jr,{now:()=>fu});var fu=()=>Date.now();var hu=(e,t,r={})=>{let{functions:s={},partials:i={}}=r,n={...jr,...s},a=ft(e,{functions:n}),l={};for(let[p,o]of Object.entries(i))l[p]=ft(o,{functions:n});return et(a,t,{functions:n,partials:l})},rt=hu;var _e=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);var qi=(e,t)=>{!t||typeof t!="object"||Object.entries(t).forEach(([r,s])=>{if(r==="default")throw new Error("[Methods] Invalid method name 'default'. Use named exports in .methods.js; default export is not supported.");if(typeof s=="function"){if(r in e)throw new Error(`[Methods] Cannot define method '${r}' because it already exists on the component instance.`);Object.defineProperty(e,r,{configurable:!0,enumerable:!1,writable:!1,value:(i={})=>{let n=i===void 0?{}:i;if(!_e(n))throw new Error(`[Methods] Method '${r}' expects payload to be an object.`);return s.call(e,n)}})}})};var en=Symbol.for("immer-nothing"),Ji=Symbol.for("immer-draftable"),ae=Symbol.for("immer-state");function ce(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ve=Object.getPrototypeOf;function Pe(e){return!!e&&!!e[ae]}function Se(e){return e?tn(e)||Array.isArray(e)||!!e[Ji]||!!e.constructor?.[Ji]||bt(e)||vt(e):!1}var mu=Object.prototype.constructor.toString();function tn(e){if(!e||typeof e!="object")return!1;let t=Ve(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===mu}function ht(e,t){gt(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function gt(e){let t=e[ae];return t?t.type_:Array.isArray(e)?1:bt(e)?2:vt(e)?3:0}function Wr(e,t){return gt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function rn(e,t,r){let s=gt(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function yu(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function bt(e){return e instanceof Map}function vt(e){return e instanceof Set}function $e(e){return e.copy_||e.base_}function zr(e,t){if(bt(e))return new Map(e);if(vt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=tn(e);if(t===!0||t==="class_only"&&!r){let s=Object.getOwnPropertyDescriptors(e);delete s[ae];let i=Reflect.ownKeys(s);for(let n=0;n<i.length;n++){let a=i[n],l=s[a];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(s[a]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[a]})}return Object.create(Ve(e),s)}else{let s=Ve(e);if(s!==null&&r)return{...e};let i=Object.create(s);return Object.assign(i,e)}}function qr(e,t=!1){return wt(e)||Pe(e)||!Se(e)||(gt(e)>1&&(e.set=e.add=e.clear=e.delete=gu),Object.freeze(e),t&&Object.entries(e).forEach(([r,s])=>qr(s,!0))),e}function gu(){ce(2)}function wt(e){return Object.isFrozen(e)}var bu={};function Ce(e){let t=bu[e];return t||ce(0,e),t}var st;function sn(){return st}function vu(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Yi(e,t){t&&(Ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ur(e){Kr(e),e.drafts_.forEach(wu),e.drafts_=null}function Kr(e){e===st&&(st=e.parent_)}function Xi(e){return st=vu(st,e)}function wu(e){let t=e[ae];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Zi(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[ae].modified_&&(Ur(t),ce(4)),Se(e)&&(e=mt(t,e),t.parent_||yt(t,e)),t.patches_&&Ce("Patches").generateReplacementPatches_(r[ae].base_,e,t.patches_,t.inversePatches_)):e=mt(t,r,[]),Ur(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==en?e:void 0}function mt(e,t,r){if(wt(t))return t;let s=t[ae];if(!s)return ht(t,(i,n)=>Qi(e,s,t,i,n,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return yt(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;let i=s.copy_,n=i,a=!1;s.type_===3&&(n=new Set(i),i.clear(),a=!0),ht(n,(l,p)=>Qi(e,s,i,l,p,r,a)),yt(e,i,!1),r&&e.patches_&&Ce("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function Qi(e,t,r,s,i,n,a){if(Pe(i)){let l=n&&t&&t.type_!==3&&!Wr(t.assigned_,s)?n.concat(s):void 0,p=mt(e,i,l);if(rn(r,s,p),Pe(p))e.canAutoFreeze_=!1;else return}else a&&r.add(i);if(Se(i)&&!wt(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;mt(e,i),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,s)&&yt(e,i)}}function yt(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&qr(t,r)}function _u(e,t){let r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:sn(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=s,n=Jr;r&&(i=[s],n=it);let{revoke:a,proxy:l}=Proxy.revocable(i,n);return s.draft_=l,s.revoke_=a,l}var Jr={get(e,t){if(t===ae)return e;let r=$e(e);if(!Wr(r,t))return xu(e,r,t);let s=r[t];return e.finalized_||!Se(s)?s:s===Fr(e.base_,t)?(Mr(e),e.copy_[t]=Gr(s,e)):s},has(e,t){return t in $e(e)},ownKeys(e){return Reflect.ownKeys($e(e))},set(e,t,r){let s=nn($e(e),t);if(s?.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){let i=Fr($e(e),t),n=i?.[ae];if(n&&n.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(yu(r,i)&&(r!==void 0||Wr(e.base_,t)))return!0;Mr(e),Hr(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Fr(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Mr(e),Hr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=$e(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){ce(11)},getPrototypeOf(e){return Ve(e.base_)},setPrototypeOf(){ce(12)}},it={};ht(Jr,(e,t)=>{it[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});it.deleteProperty=function(e,t){return it.set.call(this,e,t,void 0)};it.set=function(e,t,r){return Jr.set.call(this,e[0],t,r,e[0])};function Fr(e,t){let r=e[ae];return(r?$e(r):e)[t]}function xu(e,t,r){let s=nn(t,r);return s?"value"in s?s.value:s.get?.call(e.draft_):void 0}function nn(e,t){if(!(t in e))return;let r=Ve(e);for(;r;){let s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=Ve(r)}}function Hr(e){e.modified_||(e.modified_=!0,e.parent_&&Hr(e.parent_))}function Mr(e){e.copy_||(e.copy_=zr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Eu=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){let n=r;r=t;let a=this;return function(p=n,...o){return a.produce(p,u=>r.call(this,u,...o))}}typeof r!="function"&&ce(6),s!==void 0&&typeof s!="function"&&ce(7);let i;if(Se(t)){let n=Xi(this),a=Gr(t,void 0),l=!0;try{i=r(a),l=!1}finally{l?Ur(n):Kr(n)}return Yi(n,s),Zi(i,n)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===en&&(i=void 0),this.autoFreeze_&&qr(i,!0),s){let n=[],a=[];Ce("Patches").generateReplacementPatches_(t,i,n,a),s(n,a)}return i}else ce(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(a,...l)=>this.produceWithPatches(a,p=>t(p,...l));let s,i;return[this.produce(t,r,(a,l)=>{s=a,i=l}),s,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Se(e)||ce(8),Pe(e)&&(e=Au(e));let t=Xi(this),r=Gr(e,void 0);return r[ae].isManual_=!0,Kr(t),r}finishDraft(e,t){let r=e&&e[ae];(!r||!r.isManual_)&&ce(9);let{scope_:s}=r;return Yi(s,t),Zi(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));let s=Ce("Patches").applyPatches_;return Pe(e)?s(e,t):this.produce(e,i=>s(i,t))}};function Gr(e,t){let r=bt(e)?Ce("MapSet").proxyMap_(e,t):vt(e)?Ce("MapSet").proxySet_(e,t):_u(e,t);return(t?t.scope_:sn()).drafts_.push(r),r}function Au(e){return Pe(e)||ce(10,e),an(e)}function an(e){if(!Se(e)||wt(e))return e;let t=e[ae],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=zr(e,t.scope_.immer_.useStrictShallowCopy_)}else r=zr(e,!0);return ht(r,(s,i)=>{rn(r,s,an(i))}),t&&(t.finalized_=!1),r}var oe=new Eu,on=oe.produce,Mm=oe.produceWithPatches.bind(oe),Wm=oe.setAutoFreeze.bind(oe),zm=oe.setUseStrictShallowCopy.bind(oe),Um=oe.applyPatches.bind(oe),Km=oe.createDraft.bind(oe),Hm=oe.finishDraft.bind(oe);var ln=(e,t,r)=>{let{createInitialState:s,...i}=e,n={},a={},l={};return s&&(l=s({props:t,constants:r})),Object.entries(i).forEach(([p,o])=>{if(p.startsWith("select")){n[p]=(...u)=>o({state:l,props:t,constants:r},...u);return}a[p]=(u={})=>{let c=u===void 0?{}:u;if(!_e(c))throw new Error(`[Store] Action '${p}' expects payload to be an object.`);return l=on(l,d=>o({state:d,props:t,constants:r},c)),l}}),{getState:()=>l,...a,...n}};var pn=e=>!_e(e)||Object.isFrozen(e)?e:(Object.values(e).forEach(t=>{pn(t)}),Object.freeze(e)),cn=({setupConstants:e,fileConstants:t})=>{let r=_e(e)?e:{},s=_e(t)?t:{};return pn({...r,...s})};var un=(e,t)=>{if(!t||typeof t!="object")return"";let r="",s=n=>Object.entries(n).map(([a,l])=>` ${a}: ${l};`).join(`
|
|
1074
|
+
`))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._dialogElement=document.createElement("dialog"),this.shadow.appendChild(this._dialogElement),this._dialogElement.addEventListener("click",t=>{t.stopPropagation();let r=t.composedPath();(r[0]===this._dialogElement||r[0].nodeName==="DIALOG"&&r[0]===this._dialogElement)&&this._emitClose()}),this._dialogElement.addEventListener("contextmenu",t=>{let r=t.composedPath();(r[0]===this._dialogElement||r[0].nodeName==="DIALOG"&&r[0]===this._dialogElement)&&(t.preventDefault(),this._emitClose())}),this._dialogElement.addEventListener("cancel",t=>{t.preventDefault(),this._emitClose()}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this._dialogElement.appendChild(this._popoverContainer),this._slotElement=null,this._isOpen=!1}_emitClose(){this.dispatchEvent(new CustomEvent("close",{detail:{},bubbles:!0}))}static get observedAttributes(){return["open","x","y","place","no-overlay"]}connectedCallback(){this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._isOpen&&this._dialogElement.open&&this._dialogElement.close()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._isOpen?this.isConnected&&this._show():s===null&&this._isOpen&&this._hide():(t==="x"||t==="y"||t==="place")&&this._isOpen?this._updatePosition():t==="no-overlay"&&r!==s&&this._isOpen&&(this._hide(),this._show())}_show(){this._isOpen||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._dialogElement.open||setTimeout(()=>{this._dialogElement&&!this._dialogElement.open&&(this.hasAttribute("no-overlay")?this._dialogElement.show():this._dialogElement.showModal())},0),requestAnimationFrame(()=>{this._updatePosition()}))}_hide(){this._isOpen&&(this._isOpen=!1,this._dialogElement.open&&this._dialogElement.close(),this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null))}_updatePosition(){let t=parseFloat(this.getAttribute("x")||"0"),r=parseFloat(this.getAttribute("y")||"0"),s=this.getAttribute("place")||"bs";this.removeAttribute("positioned"),requestAnimationFrame(()=>{let i=this._popoverContainer.getBoundingClientRect(),{left:n,top:a}=this._calculatePosition(t,r,i.width,i.height,s);this._popoverContainer.style.left=`${n}px`,this._popoverContainer.style.top=`${a}px`,requestAnimationFrame(()=>{this.setAttribute("positioned","")})})}_calculatePosition(t,r,s,i,n){let l=t,p=r;switch(n){case"t":l=t-s/2,p=r-i-8;break;case"ts":l=t,p=r-i-8;break;case"te":l=t-s,p=r-i-8;break;case"r":l=t+8,p=r-i/2;break;case"rs":l=t+8,p=r;break;case"re":l=t+8,p=r-i;break;case"b":l=t-s/2,p=r+8;break;case"bs":l=t,p=r+8;break;case"be":l=t-s,p=r+8;break;case"l":l=t-s-8,p=r-i/2;break;case"ls":l=t-s-8,p=r;break;case"le":l=t-s-8,p=r-i;break;default:l=t,p=r+8;break}let o=8;return l=Math.max(o,Math.min(l,window.innerWidth-s-o)),p=Math.max(o,Math.min(p,window.innerHeight-i-o)),{left:l,top:p}}get popover(){return this._popoverContainer}},Os=({render:e,html:t})=>Yt;var Xt={};R(Xt,{handleClickHeader:()=>Da});var Da=(e,t)=>{let{store:r,render:s}=e;r.toggleOpen({}),s()};var Ts={componentName:"rtgl-accordion-item",propsSchema:{type:"object",properties:{label:{type:"string"},content:{type:"string"},w:{type:"string"}}},events:[],methods:{type:"object",properties:{}}};var Zt={};R(Zt,{createInitialState:()=>Ba,selectViewData:()=>Ma,toggleOpen:()=>Wa});var Ba=()=>Object.freeze({open:!1}),ja=["id","class","style","slot","label","content"],Fa=(e={})=>Object.entries(e).filter(([t])=>!ja.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ma=({state:e,props:t})=>({label:t.label||"",content:t.content||"",openClass:e.open?"content-wrapper open":"content-wrapper",chevronIcon:e.open?"chevronUp":"chevronDown",containerAttrString:Fa(t)}),Wa=({state:e})=>{e.open=!e.open};var Ls={refs:{header:{eventListeners:{click:{handler:"handleClickHeader"}}}},styles:{".content-wrapper":{display:"grid","grid-template-rows":"0fr",transition:"grid-template-rows 0.2s ease-out"},".content-wrapper.open":{"grid-template-rows":"1fr"},".content-inner":{overflow:"hidden"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=v ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view#header d=h av=c w=f pv=md cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"label"}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-svg svg=${chevronIcon} wh=16 c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg svg=",{type:1,path:"chevronIcon"}," wh=16 c=mu-fg"]}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:'div class="${openClass}"',value:{type:9,items:[{type:8,properties:[{key:"div class=content-inner",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view pb=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"content"}}],fast:!0},{type:8,properties:[{key:"slot name=content",value:{type:0,value:null}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:['div class="',{type:1,path:"openClass"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=v ",{type:1,path:"containerAttrString"}]}}],fast:!0}],fast:!0}};var Qt={};R(Qt,{handleClickItem:()=>za});var za=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=Number(i.currentTarget.dataset.index),a=Array.isArray(s.items)?s.items[n]:void 0;if(!a)return;if(a.disabled||a.current){i.preventDefault();return}typeof a.href=="string"&&a.href.length>0||i.preventDefault(),r(new CustomEvent("item-click",{detail:{id:a.id,path:a.path,href:a.href,item:a,index:n,trigger:i.type}}))};var Rs={componentName:"rtgl-breadcrumb",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},href:{type:"string"},path:{type:"string"},current:{type:"boolean"},disabled:{type:"boolean"},click:{type:"boolean"},newTab:{type:"boolean"},rel:{type:"string"}}}},sep:{type:"string",default:"breadcrumb-arrow"},max:{type:"number"}}},events:{"item-click":{type:"object",properties:{id:{type:"string"},path:{type:"string"},href:{type:"string"},item:{type:"object"},index:{type:"number"},trigger:{type:"string"}}}},methods:{type:"object",properties:{}}};var er={};R(er,{createInitialState:()=>Ua,selectViewData:()=>Xa});var Ua=()=>Object.freeze({}),Ka=["id","class","style","slot","items","sep","max","separator"],Ha=(e={})=>Object.entries(e).filter(([t])=>!Ka.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ga=e=>{if(e==null||e==="")return;let t=Number(e);return Number.isNaN(t)?void 0:t},qa=e=>`${e}`.replace(/"/g,"""),Ja=(e,t)=>{if(!t||t<3||e.length<=t)return e;let r=t-2;return[e[0],{isEllipsis:!0,label:"..."},...e.slice(-r)]},Ya=e=>e.map((t,r)=>{let s=typeof t.href=="string"&&t.href.length>0,i=t.path!==void 0&&t.path!==null&&`${t.path}`!="",n=!!t.current,a=!!t.disabled,l=!n&&!a&&(s||i||!!t.click),p=t.rel||(t.newTab?"noopener noreferrer":""),o=[t.newTab?'target="_blank"':"",p?`rel="${qa(p)}"`:""].filter(Boolean).join(" ");return{...t,label:t.label||"",index:r,href:s?t.href:void 0,path:i?t.path:void 0,isCurrent:n,isDisabled:a,isInteractive:l,linkExtraAttrs:o,c:n?"fg":"mu-fg"}}),Xa=({props:e})=>{let t=Ha(e),r=Array.isArray(e.items)?e.items:[],s=Ga(e.max),i=e.sep||"breadcrumb-arrow",n=Ya(r),a=Ja(n,s),l=[];return a.forEach((p,o)=>{l.push(p),o<a.length-1&&l.push({isSeparator:!0})}),{containerAttrString:t,items:l,sep:i}};var Ns={refs:{"item*":{eventListeners:{click:{handler:"handleClickItem"}}}},styles:{a:{"text-decoration":"none",color:"inherit"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md p=sm ${containerAttrString}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"$if item.isSeparator",value:{type:6,conditions:[{type:1,path:"item.isSeparator"},{type:1,path:"item.isEllipsis"},{type:4,op:6,left:{type:1,path:"item.isInteractive"},right:{type:1,path:"item.href"}},{type:1,path:"item.isInteractive"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${sep} c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"sep"}," c=mu-fg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#item${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#item",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," ",{type:1,path:"item.linkExtraAttrs"}," data-index=",{type:1,path:"item.index"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item${i} data-index=${item.index} cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#item",{type:1,path:"i"}," data-index=",{type:1,path:"item.index"}," cur=pointer"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view d=h av=c g=md p=sm ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var tr={};R(tr,{handleClickMenuItem:()=>Qa,handleClosePopover:()=>Za});var Za=(e,t)=>{let{dispatchEvent:r}=e;r(new CustomEvent("close"))},Qa=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=Number(i.currentTarget.dataset.index??i.currentTarget.id.slice(6)),a=s.items[n],l=a?.type||"item";if(!a||l!=="item"||a.disabled){i.preventDefault();return}a.href||i.preventDefault(),r(new CustomEvent("item-click",{detail:{index:n,item:a,id:a.id,path:a.path,href:a.href,trigger:i.type}}))};var Vs={componentName:"rtgl-dropdown-menu",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},type:{type:"string",enum:["label","item","separator"]},id:{type:"string"},path:{type:"string"},href:{type:"string"},disabled:{type:"boolean"},newTab:{type:"boolean"},rel:{type:"string"},testId:{type:"string"}}}},open:{type:"boolean"},x:{type:"string"},y:{type:"string"},place:{type:"string"},w:{type:"string"},h:{type:"string"}}},events:{close:{type:"object"},"item-click":{type:"object",properties:{index:{type:"number"},item:{type:"object"},id:{type:"string"},path:{type:"string"},href:{type:"string"},trigger:{type:"string"}}}},methods:{type:"object",properties:{}}};var rr={};R(rr,{createInitialState:()=>eo,selectViewData:()=>so});var eo=()=>Object.freeze({}),to=e=>`${e}`.replace(/"/g,"""),ro=e=>e.map((t,r)=>{let s=t.type||"item",i=s==="separator",n=s==="label",a=s==="item",l=!!t.disabled,p=a&&!l,o=l?"mu-fg":"fg",u=l?"mu":"",c=l?"":"ac",d=typeof t.href=="string"&&t.href.length>0,h=t.rel||(t.newTab?"noopener noreferrer":""),f=[t.newTab?'target="_blank"':"",h?`rel="${to(h)}"`:""].filter(Boolean).join(" ");return{...t,index:r,type:s,isSeparator:i,isLabel:n,isItem:a,isDisabled:l,isInteractive:p,hasHref:d,linkExtraAttrs:f,c:o,bgc:u,hoverBgc:c}}),so=({props:e})=>{let t=Array.isArray(e.items)?e.items:[];return{items:ro(t),open:!!e.open,x:e.x||0,y:e.y||0,w:e.w||"300",h:e.h||"300",place:e.place||"bs"}};var Ps={refs:{popover:{eventListeners:{close:{handler:"handleClosePopover"}}},"option*":{eventListeners:{click:{handler:"handleClickMenuItem"}}}},styles:{a:{display:"block",width:"100%","text-decoration":"none",color:"inherit"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=${w} h=${h} sv g=xs slot=content bgc=mu br=md",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"$if item.isLabel",value:{type:6,conditions:[{type:1,path:"item.isLabel"},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:1,path:"item.isDisabled"}},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:4,op:6,left:{type:1,path:"item.hasHref"},right:{type:1,path:"item.linkExtraAttrs"}}},{type:4,op:6,left:{type:1,path:"item.isItem"},right:{type:1,path:"item.hasHref"}},{type:1,path:"item.isItem"},{type:1,path:"item.isSeparator"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f ph=lg pv=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f ph=lg pv=md br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f ph=lg pv=md br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#option${i} href=${item.href} ${item.linkExtraAttrs} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#option",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," ",{type:1,path:"item.linkExtraAttrs"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"a#option${i} href=${item.href} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a#option",{type:1,path:"i"}," href=",{type:1,path:"item.href"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#option${i} w=f h-bgc=${item.hoverBgc} ph=lg pv=md cur=pointer br=md bgc=${item.bgc} data-index=${item.index} data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${item.c}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"item.c"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option",{type:1,path:"i"}," w=f h-bgc=",{type:1,path:"item.hoverBgc"}," ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"item.bgc"}," data-index=",{type:1,path:"item.index"}," data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=1 ph=lg mv=md bgc=bo",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," sv g=xs slot=content bgc=mu br=md"]}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"open"}," x=",{type:1,path:"x"}," y=",{type:1,path:"y"}," place=",{type:1,path:"place"}]}}],fast:!1}],fast:!1}};var dr={};R(dr,{handleActionClick:()=>yl,handleAfterMount:()=>dl,handleBeforeMount:()=>ul,handleImageClick:()=>gl,handleKeyDown:()=>bl,handleOnUpdate:()=>fl,handleTooltipMouseEnter:()=>vl,handleTooltipMouseLeave:()=>wl,handleValueChange:()=>ml,handleValueInput:()=>hl});var ur={};R(ur,{clearFieldError:()=>al,collectAllDataFields:()=>Q,createInitialState:()=>el,flattenFields:()=>cr,get:()=>ie,getDefaultValue:()=>Ye,hideTooltip:()=>pl,isDataField:()=>pr,pruneHiddenValues:()=>Re,resetFormValues:()=>il,selectForm:()=>K,selectFormValues:()=>me,selectViewData:()=>tl,set:()=>pe,setErrors:()=>nl,setFormFieldValue:()=>rl,setFormValues:()=>sl,setReactiveMode:()=>ol,showTooltip:()=>ll,validateField:()=>Je,validateForm:()=>Le});var v={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9,PARTIAL:10,PATH_REFERENCE:11},P={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},Ge={NOT:0};var k=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},re=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var sr=e=>{if(!e||e.trim()==="")throw new k("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new k(`Invalid comparison operator '${e.includes("===")?"===":"!=="}' - did you mean '${r}'? (got: '${e}')`)}let t=["<",">","<=",">=","==","!="];for(let r of t)if(e.trim().endsWith(r))throw new k(`Incomplete comparison expression - missing right operand (got: '${e}')`)},Ds=e=>{if(e.trim().endsWith(" in"))throw new k(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new k(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new k(`Missing iterable expression after 'in' (got: '$for ${e}')`);let s=t.includes(",")?t.split(",").map(i=>i.trim()):[t.trim()];for(let i of s){if(!i)throw new k(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`);if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))throw new k(`Invalid loop syntax (got: '$for ${e}')`)}};var Bs=(e,t,r=!1)=>{if(t===null)return new re(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new re(`Cannot iterate over undefined value at '$for ${e}'`);let s=typeof t;return r?new re(`Cannot iterate over non-array value in loop '${e}' - got ${s} instead`):new re(`Cannot iterate over non-array value (got: ${s}) at '$for ${e}'`)},js=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new re(`Unknown function '${e}' (${r})`)};var io=(e,t,r={})=>{let s={},i={};r&&typeof r=="object"&&(r.functions!==void 0||r.partials!==void 0?(s=r.functions||{},i=r.partials||{}):typeof r=="object"&&(s=r));let a=C(e,{functions:s,partials:i},t,{});return a===void 0?{}:a},C=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return W(e.var,r,s);if(e.type===v.LITERAL)return e.value;if(e.type===v.VARIABLE)return W(e.path,r,s);if(e.type===v.INTERPOLATION)return ao(e.parts,t,r,s);switch(e.type){case v.FUNCTION:return Ms(e,t,r,s);case v.BINARY:return Ws(e,t,r,s);case v.UNARY:return zs(e,t,r,s);case v.CONDITIONAL:return lo(e,t,r,s);case v.LOOP:return ho(e,t,r,s);case v.OBJECT:return yo(e,t,r,s);case v.ARRAY:return go(e,t,r,s);case v.PARTIAL:return bo(e,t,r,s);case v.PATH_REFERENCE:return vo(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},Fs=new Map,no=e=>{let t=[],r="",s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(n==="[")r&&(t.push({type:"property",value:r}),r=""),s=!0;else if(n==="]"){if(s&&r){let a=r.trim();if(/^\d+$/.test(a))t.push({type:"index",value:parseInt(a,10)});else if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")){let l=a.slice(1,-1);t.push({type:"property",value:l})}else t.push({type:"property",value:a});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},W=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=Fs.get(e);if(!s){let n=[],a="",l=0;for(let p=0;p<e.length;p++){let o=e[p];o==="["?(l++,a+=o):o==="]"?(l--,a+=o):o==="."&&l===0?a&&(n.push(a),a=""):a+=o}a&&n.push(a),s=[];for(let p of n){let o=no(p.trim());s.push(...o)}Fs.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let a=s[n];if(a.type==="property"&&a.value in r){i=r[a.value];continue}if(i==null)return;(a.type==="property"||a.type==="index")&&(i=i[a.value])}return i},ao=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let a=C(n,t,r,s);i.push(a!=null?String(a):"")}return i.join("")},Ms=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw js(e.name,i);let a=e.args.map(l=>C(l,t,r,s));return n(...a)},Te=(e,t,r,s)=>{if(e.var&&!e.type)return W(e.var,r,s);switch(e.type){case v.VARIABLE:return W(e.path,r,s);case v.LITERAL:return e.value;case v.BINARY:return Ws(e,t,r,s);case v.UNARY:return zs(e,t,r,s);case v.FUNCTION:return Ms(e,t,r,s);default:return C(e,t,r,s)}},Ws=(e,t,r,s)=>{if(e.op===P.AND||e.op===P.OR){let a=Te(e.left,t,r,s),l=Te(e.right,t,r,s);switch(e.op){case P.AND:return a&&l;case P.OR:return a||l}}let i=C(e.left,t,r,s),n=C(e.right,t,r,s);switch(e.op){case P.EQ:return i==n;case P.NEQ:return i!=n;case P.GT:return i>n;case P.LT:return i<n;case P.GTE:return i>=n;case P.LTE:return i<=n;case P.IN:return Array.isArray(n)?n.includes(i):!1;case P.ADD:if(typeof i!="number"||typeof n!="number")throw new re(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case P.SUBTRACT:if(typeof i!="number"||typeof n!="number")throw new re(`Arithmetic operations require numbers. Got ${typeof i} - ${typeof n}`);return i-n;default:throw new Error(`Unknown binary operator: ${e.op}`)}},zs=(e,t,r,s)=>{let i=e.op===Ge.NOT?Te(e.operand,t,r,s):C(e.operand,t,r,s);switch(e.op){case Ge.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},oo=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===v.VARIABLE)if(W(i.path,r,s)){let a=e.bodies[0];if(a.type===v.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?C(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===v.LITERAL)l[o]=u.value;else if(u.type===v.VARIABLE)l[o]=W(u.path,r,s);else if(u.type===v.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===v.VARIABLE){let h=W(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=C(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=C(u,t,r,s)}return l}}else{let a=e.bodies[1];if(a.type===v.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?C(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===v.LITERAL)l[o]=u.value;else if(u.type===v.VARIABLE)l[o]=W(u.path,r,s);else if(u.type===v.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===v.VARIABLE){let h=W(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=C(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=C(u,t,r,s)}return l}}}return null},lo=(e,t,r,s)=>{let i=oo(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let a=e.conditions[n];if(a===null||Te(a,t,r,s))return C(e.bodies[n],t,r,s)}return Us},po=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===v.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===v.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let a=i.substring(s.length+1);if(n.type===v.OBJECT&&n.properties.length<=5){for(let p of n.properties)if(p.parsedKey)return null;let l=[];for(let p=0;p<t.length;p++){let o=t[p];if(o[a]){let u={};for(let c of n.properties){let d=c.key,h=c.value;if(h.type===v.LITERAL)u[d]=h.value;else if(h.type===v.VARIABLE){let f=h.path;if(f===s)u[d]=o;else if(f.startsWith(s+".")){let m=f.substring(s.length+1);u[d]=o[m]}else return null}else if(h.type===v.INTERPOLATION){let f=[],m=!0;for(let g of h.parts)if(typeof g=="string")f.push(g);else if(g.type===v.VARIABLE){let y=g.path;if(y===s)f.push(o!=null?String(o):"");else if(y.startsWith(s+".")){let w=y.substring(s.length+1),_=o[w];f.push(_!=null?String(_):"")}else{m=!1;break}}else{m=!1;break}if(!m)return null;u[d]=f.join("")}else return null}l.push(u)}}return l}}}return null},co=(e,t)=>{let r=e.body,s=e.itemVar,i=po(e,t);if(i!==null)return i;if(r.type===v.OBJECT&&r.properties.length<=5&&!r.whenCondition){for(let l of r.properties)if(l.parsedKey)return null;let n=[],a=!0;for(let l of r.properties){let p=l.key,o=l.value;if(o.type===v.LITERAL)n.push({key:p,type:"literal",value:o.value});else if(o.type===v.VARIABLE){let u=o.path;if(u===s)n.push({key:p,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes(".")&&!c.includes("["))n.push({key:p,type:"prop",prop:c});else{a=!1;break}}else{a=!1;break}}else if(o.type===v.INTERPOLATION&&o.parts.length===1){let u=o.parts[0];if(u.type===v.VARIABLE){let c=u.path;if(c===s)n.push({key:p,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:p,type:"prop_string",prop:d});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let l=new Array(t.length);if(n.length===3&&n[0].type==="prop"&&n[0].key==="id"&&n[1].type==="prop_string"&&n[1].key==="title"&&n[2].type==="prop"&&n[2].key==="completed")for(let p=0;p<t.length;p++){let o=t[p];l[p]={id:o.id,title:o.title!=null?String(o.title):"",completed:o.completed}}else for(let p=0;p<t.length;p++){let o=t[p],u={};for(let c of n)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=o;else if(c.type==="prop")u[c.key]=o[c.prop];else if(c.type==="item_string")u[c.key]=o!=null?String(o):"";else if(c.type==="prop_string"){let d=o[c.prop];u[c.key]=d!=null?String(d):""}l[p]=u}return l}}return null},uo=(e,t,r,s,i)=>{let n=[],a=e.body;if(a.type===v.OBJECT&&a.fast!==!1){let l=e.itemVar,p=e.indexVar;for(let o=0;o<i.length;o++){let u=i[o],c={},d={...s,[l]:u,...p&&{[p]:o}};d.__paths__||(d.__paths__=s.__paths__||{});let h=e.iterable.path||"";if(s&&s.__paths__&&h){let f=h.split("."),m=f[0];m in s.__paths__&&(h=s.__paths__[m],f.length>1&&(h+="."+f.slice(1).join(".")))}d.__paths__={...d.__paths__,[l]:`${h}[${o}]`,...p&&{[p]:o}};for(let f of a.properties){let m=f.parsedKey?C(f.parsedKey,t,r,d):f.key,g=f.value;if(g.type===v.LITERAL)c[m]=g.value;else if(g.type===v.VARIABLE){let y=g.path;if(y===l)c[m]=u;else if(y===p)c[m]=o;else if(y.startsWith(l+".")){let w=y.substring(l.length+1);!w.includes(".")&&!w.includes("[")?c[m]=u[w]:c[m]=W(y,r,{...s,[l]:u,...p&&{[p]:o}})}else c[m]=W(y,r,{...s,[l]:u,...p&&{[p]:o}})}else if(g.type===v.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===v.VARIABLE){let _=w.path,x;if(_===l)x=u;else if(_===p)x=o;else if(_.startsWith(l+".")){let E=_.substring(l.length+1);!E.includes(".")&&!E.includes("[")?x=u[E]:x=W(_,r,{...s,[l]:u,...p&&{[p]:o}})}else x=W(_,r,{...s,[l]:u,...p&&{[p]:o}});y.push(x!=null?String(x):"")}else{let _={...s,[l]:u,...p&&{[p]:o}},x=C(w,t,r,_);y.push(x!=null?String(x):"")}c[m]=y.join("")}else{let y={...s,[l]:u,...p&&{[p]:o}};c[m]=C(g,t,r,y)}}n.push(c)}return n}return null},fo=(e,t,r)=>{let s=e.body;if(s.type===v.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===v.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===v.VARIABLE&&n.conditions[0].path==="item.visible"){let a=n.bodies[0];if(a.type===v.OBJECT&&a.properties.length===2){let l=a.properties[0],p=a.properties[1];if(l.key==="id"&&l.value.type===v.VARIABLE&&l.value.path==="item.id"&&p.key==="$if item.highlighted"&&p.value.type===v.CONDITIONAL){let o=[];for(let u=0;u<t.length;u++){let c=t[u];if(c.visible){let d={id:c.id};c.highlighted?(d.highlight=!0,d.message=`This item is highlighted: ${c.name}`):(d.highlight=!1,d.message=c.name),o.push(d)}}return o}}}}return null},ho=(e,t,r,s)=>{let i=C(e.iterable,t,r,s);if(!Array.isArray(i)){let o,u=!1;if(e.iterable.type===v.FUNCTION){u=!0;let d=e.iterable.args.map(h=>h.type===v.LITERAL?typeof h.value=="string"?`'${h.value}'`:String(h.value):h.type===v.VARIABLE?h.path:h.type===v.FUNCTION?`${h.name}(...)`:"?").join(", ");o=`${e.iterable.name}(${d})`}else o=e.iterable.path||"undefined";let c=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${o}`;throw Bs(c,i,u)}if(!e.indexVar){let o=fo(e,i,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=co(e,i);if(o!==null)return o}let n=uo(e,t,r,s,i);if(n!==null)return n;let a=[],l=e.iterable.path||"";if(s&&s.__paths__&&l){let o=l.split("."),u=o[0];u in s.__paths__&&(l=s.__paths__[u],o.length>1&&(l+="."+o.slice(1).join(".")))}let p=!1;e.body.type===v.ARRAY&&(e.body.items.length<=1?p=!1:p=e.body._shouldPreserveArray??=e.body.items.some(o=>o.type===v.OBJECT&&o.properties.some(u=>u.key.startsWith("$if ")||u.key.startsWith("$when "))));for(let o=0;o<i.length;o++){let u=e.indexVar?{...s,[e.itemVar]:i[o],[e.indexVar]:o}:{...s,[e.itemVar]:i[o]};u.__paths__||(u.__paths__=s.__paths__||{}),u.__paths__={...u.__paths__,[e.itemVar]:`${l}[${o}]`},e.indexVar&&(u.__paths__[e.indexVar]=o);let c=C(e.body,t,r,u);if(Array.isArray(c)&&c.length===1&&!p){let d=c[0];a.push(d===void 0?{}:d)}else a.push(c===void 0?{}:c)}return a},mo=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let i=e.properties[0],n=i.parsedKey?C(i.parsedKey,t,r,s):i.key,a=i.value;if(a.type===v.OBJECT&&a.properties.length<=10&&!a.whenCondition){let l={},p={},o=!0;for(let u of a.properties){let c=u.parsedKey?C(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===v.LITERAL)p[c]=d.value;else if(d.type===v.VARIABLE)p[c]=W(d.path,r,s);else if(d.type===v.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===v.VARIABLE){let m=W(f.path,r,s);h.push(m!=null?String(m):"")}else{o=!1;break}if(!o)break;p[c]=h.join("")}else if(d.type===v.OBJECT&&d.properties.length<=5){let h={};for(let f of d.properties){let m=f.key,g=f.value;if(g.type===v.LITERAL)h[m]=g.value;else if(g.type===v.VARIABLE)h[m]=W(g.path,r,s);else if(g.type===v.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===v.VARIABLE){let _=W(w.path,r,s);y.push(_!=null?String(_):"")}else{o=!1;break}if(!o)break;h[m]=y.join("")}else{o=!1;break}}if(!o)break;p[c]=h}else{o=!1;break}}if(o)return l[n]=p,l}}return null},yo=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!Te(e.whenCondition,i,r,s))return;let n=mo(e,t,r,s);if(n!==null)return n;if(e.fast){let o={};for(let u of e.properties){let c=u.parsedKey?C(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===v.LITERAL)o[c]=d.value;else if(d.type===v.VARIABLE)o[c]=W(d.path,r,s);else if(d.type===v.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===v.VARIABLE){let m=W(f.path,r,s);h.push(m!=null?String(m):"")}else{let m=C(f,t,r,s);h.push(m!=null?String(m):"")}o[c]=h.join("")}else o[c]=C(d,t,r,s)}return o}let a={},l=null,p=!1;for(let o of e.properties)if(!o.key.startsWith("$if ")&&!o.key.match(/^\$if\s+\w+.*:?$/)&&!o.key.startsWith("$elif")&&!o.key.startsWith("$else")&&!o.key.startsWith("$for ")){p=!0;break}for(let o of e.properties)if(o.key.startsWith("$if ")||o.key.match(/^\$if\s+\w+.*:?$/)){let u=C(o.value,t,r,s);if(!p&&u!==null&&u!==void 0)return Array.isArray(u)&&u.length===1?u[0]:u;typeof u=="object"&&u!==null&&!Array.isArray(u)&&Object.assign(a,u)}else if(o.key.startsWith("$for ")){if(e.properties.length===1)return C(o.value,t,r,s)}else{let u=o.value;if(u&&u.type===v.OBJECT&&u.properties){let c=u.properties.find(d=>d.key.startsWith("$for "));if(c){let d=C(c.value,t,r,s);d!==void 0&&(a[o.key]=d)}else{let d=C(o.value,t,r,s);d!==void 0&&(a[o.key]=d)}}else{let c=o.parsedKey?C(o.parsedKey,t,r,s):o.key,d=C(o.value,t,r,s);d!==void 0&&(a[c]=d)}}return a},Us={},go=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===v.LOOP){let a=C(n,t,r,s);Array.isArray(a)&&n.flatten!==!1?i.push(...a):i.push(a)}else{let a=C(n,t,r,s);a!==Us&&a!==void 0&&i.push(a)}return i},bo=(e,t,r,s)=>{let{name:i,data:n,whenCondition:a}=e,l=t.partials||{},p=t.functions||t;if(a&&!Te(a,p,r,s))return;if(!l[i])throw new re(`Partial '${i}' is not defined`);let o=s._partialStack||[];if(o.includes(i))throw new re(`Circular partial reference detected: ${i}`);let u=l[i],c=r,d={...s,_partialStack:[...o,i]};if(s){c={...r};for(let h of Object.keys(s))h.startsWith("_")||(c[h]=s[h])}if(n){let h=C(n,t,r,s);c={...c,...h}}return C(u,t,c,d)},vo=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),a=n[0],l=n.slice(1);if(!s||!(a in s))throw new re(`Path reference '#{${i}}' refers to '${a}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(a in s.__paths__))throw new re(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let p=s.__paths__[a];if(typeof p=="number"){if(l.length>0)throw new re(`Path reference '#{${i}}' - cannot access properties on index variable '${a}'`);return String(p)}return l.length>0&&(p+="."+l.join(".")),p},ir=io;var wo=/\$\{([^}]*)\}/g,_o=/#\{([^}]*)\}/g,Hs=(e,t={})=>{let r=e.match(/^(\w+)\((.*)\)$/);if(!r)return{isFunction:!1};let[,s,i]=r,n=xo(i,t);return{isFunction:!0,type:v.FUNCTION,name:s,args:n}},xo=(e,t={})=>e.trim()?Eo(e).map(s=>Ao(s.trim(),t)):[],Eo=e=>{let t=[],r="",s=0,i=!1,n="";for(let a=0;a<e.length;a++){let l=e[a],p=a>0?e[a-1]:"";!i&&(l==='"'||l==="'")?(i=!0,n=l,r+=l):i&&l===n&&p!=="\\"?(i=!1,n="",r+=l):!i&&l==="("?(s++,r+=l):!i&&l===")"?(s--,r+=l):!i&&l===","&&s===0?(t.push(r),r=""):r+=l}return r&&t.push(r),t},Ao=(e,t={})=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:v.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:v.LITERAL,value:parseFloat(e)};if(e==="true")return{type:v.LITERAL,value:!0};if(e==="false")return{type:v.LITERAL,value:!1};if(e==="null")return{type:v.LITERAL,value:null};let r=Hs(e,t);if(r.isFunction)return{type:r.type,name:r.name,args:r.args};let s=e.trim(),i=[{op:" + ",type:"ADD"},{op:" - ",type:"SUBTRACT"}],n=-1,a=null;for(let{op:l,type:p}of i){let o=0;for(;o<s.length;){let u=Ae(s.substring(o),l);if(u===-1)break;let c=o+u;c>n&&(n=c,a={op:l,type:p}),o=c+l.length}}if(n!==-1)try{return Z(s,t)}catch{return{type:v.VARIABLE,path:s}}return{type:v.VARIABLE,path:s}},Gs=/^\w+\(.*\)$/,ko=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,$o=e=>{if(!(!e||e.trim()===""||Gs.test(e))&&ko.test(e))throw e.includes("?")&&e.includes(":")?new k(`Complex expressions not supported in variable replacements - consider calculating the value in your data instead. Offending expression: "${e}"`):e.includes("||")||e.includes("&&")||e.includes("??")?new k(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new k(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},Ks=e=>{let t=e.trim();if(Gs.test(t))throw new k(`Functions are not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("["))throw new k(`Array indices not supported in path references - use simple variable names or properties. Offending expression: "#{${e}}"`);if(/[+\-*/%]/.test(t))throw new k(`Arithmetic expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(/\|\||&&/.test(t))throw new k(`Logical operators not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("?")&&t.includes(":"))throw new k(`Complex expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);return{type:v.PATH_REFERENCE,path:t}},qe=(e,t={})=>{let r=e.trim();$o(r);let s=Hs(r,t);if(s.isFunction)return{type:s.type,name:s.name,args:s.args};if(r.includes("[")&&!/[\s+\-*/%|&?:]/.test(r)){let i=0;for(let n of r)n==="["?i++:n==="]"&&i--;if(i!==0)throw new Error("Invalid array index syntax")}return{type:v.VARIABLE,path:r}},nr=(e,t={})=>{let r=e,s=[];(e.includes("\\${")||e.includes("\\#{"))&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC_VAR$1"),r=r.replace(/\\\\(#\{[^}]*\})/g,"\\DOUBLE_ESC_PATH$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\(#\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\DOUBLE_ESC_VAR/g,"\\"),r=r.replace(/\\DOUBLE_ESC_PATH/g,"\\"));let i=[...r.matchAll(wo)],n=[...r.matchAll(_o)],a=[...i.map(o=>({match:o,type:"variable"})),...n.map(o=>({match:o,type:"pathref"}))].sort((o,u)=>o.match.index-u.match.index);if(a.length===0){let o=r;for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);return{type:v.LITERAL,value:o}}if(a.length===1&&a[0].match[0]===r&&s.length===0){let{match:o,type:u}=a[0];try{return u==="variable"?qe(o[1],t):Ks(o[1])}catch(c){if(c.message==="Invalid array index syntax")return{type:v.LITERAL,value:r};throw c}}let l=[],p=0;for(let{match:o,type:u}of a){let[c,d]=o,h=o.index;if(h>p){let f=r.substring(p,h);for(let m=0;m<s.length;m++)f=f.replace(`__ESCAPED_${m}__`,s[m]);f&&l.push(f)}try{let f;u==="variable"?f=qe(d.trim(),t):f=Ks(d.trim()),l.push(f)}catch(f){if(f.message==="Invalid array index syntax")l.push(c);else throw f}p=h+c.length}if(p<r.length){let o=r.substring(p);for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);o&&l.push(o)}return{type:v.INTERPOLATION,parts:l}};var ve=(e,t)=>typeof e=="string"?nr(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Co(e,t):Io(e,t):{type:v.LITERAL,value:e},So=e=>{let{$each:t,...r}=e;if(typeof t!="string")throw new k("$each value must be a non-empty string");let s=t.trim();if(s==="")throw new k("$each value must be a non-empty string");if(Object.keys(r).length===0)throw new k("Empty $each body not allowed");if(r.$partial!==void 0)throw new k("Cannot use $partial with $each at the same level. Wrap $partial in a parent object if you need conditionals.");return{[`$for ${s}`]:r}},Co=(e,t)=>{let r=[],s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(typeof n=="object"&&n!==null&&!Array.isArray(n)){if(n.$each!==void 0)try{let p=So(n),o=Object.keys(p);if(o.length===1&&/^\$for(?::\w+)?\s/.test(o[0])){let u=qs(o[0],p[o[0]],t,!0);r.push(u),s=!0;continue}}catch(p){throw p instanceof k?p:new k(p.message)}let l=Object.keys(n);if(l.length===1&&/^\$for(?::\w+)?\s/.test(l[0])){let p=qs(l[0],n[l[0]],t);r.push(p),s=!0;continue}}let a=ve(n,t);r.push(a),(a.type===v.FUNCTION||a.type===v.CONDITIONAL||a.type===v.LOOP||a.type===v.PARTIAL||a.type===v.OBJECT&&!a.fast||a.type===v.ARRAY&&!a.fast)&&(s=!0)}return{type:v.ARRAY,items:r,fast:!s}},Io=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),a=0;if(e.$partial!==void 0){if(typeof e.$partial!="string")throw new k("$partial value must be a string");if(e.$partial.trim()==="")throw new k("$partial value cannot be an empty string");let p=["$if","$elif","$else","$for"],o=[];for(let[y]of n)for(let w of p)if(y===w||y.startsWith(w+" ")||y.startsWith(w+"#")){o.push(w);break}if(o.length>0)throw new k(`Cannot use $partial with ${o.join(", ")} at the same level. Wrap $partial in a parent object if you need conditionals.`);let{$partial:u,$when:c,...d}=e,h={},f=!1;for(let[y,w]of Object.entries(d)){let _=y;(y.startsWith("\\$")||y.startsWith("$$"))&&(_=y.slice(1)),h[_]=w,f=!0}let m=null;if(f&&(m=ve(h,t),m.type===v.OBJECT)){let y=!1;for(let w of m.properties)if(w.value.type===v.VARIABLE||w.value.type===v.INTERPOLATION||w.value.type===v.FUNCTION||w.value.type===v.CONDITIONAL||w.value.type===v.OBJECT&&!w.value.fast||w.value.type===v.ARRAY&&!w.value.fast){y=!0;break}y&&(m.fast=!1)}let g={type:v.PARTIAL,name:u,data:m};if(c!==void 0){let y;if(typeof c=="string"){if(c.trim()==="")throw new k("Empty condition expression after '$when'");y=Z(c,t)}else y={type:v.LITERAL,value:c};g.whenCondition=y}return g}for(let[p,o]of n)if(p==="$when"){if(i!==null)throw new k("Multiple '$when' directives on the same object are not allowed");if(o==null)throw new k("Missing condition expression after '$when'");let u=typeof o=="string"?o:JSON.stringify(o);if(u.trim()==="")throw new k("Empty condition expression after '$when'");i=Z(u,t),s=!0}else if(p.startsWith("$when#")||p.startsWith("$when "))throw new k("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<n.length;){let[p,o]=n[a];if(p==="$when"){a++;continue}if(p==="$each")throw new k("$each can only be used inside arrays");if(p.startsWith("$if ")||p.match(/^\$if#\w+\s/)||p.match(/^\$if\s+\w+.*:$/)){let u=Oo(n,a,t);r.push({key:p,value:u.node}),s=!0,a=u.nextIndex}else if(/^\$for(?::\w+)?\s/.test(p)){let u=p.match(/^\$for(?::(\w+))?\s/)?.[1]||"",c=u?`:${u}`:"";throw new k(`$for loops must be inside arrays - use '- $for${c} item in items:' instead of '$for${c} item in items:'. For cleaner object generation syntax, consider using $each.`)}else{if(p.startsWith("$elif ")||p.startsWith("$else"))throw new k(`'${p.split(" ")[0]}' without matching '$if'`);if(p==="$if"||p==="$if:")throw new k("Missing condition expression after '$if'");{let u=ve(o,t);(u.type===v.FUNCTION||u.type===v.CONDITIONAL||u.type===v.PARTIAL||u.type===v.OBJECT&&!u.fast||u.type===v.ARRAY&&!u.fast)&&(s=!0);let c=nr(p,t),d={key:p,value:u};(c.type!==v.LITERAL||c.value!==p)&&(d.parsedKey=c),r.push(d),a++}}}let l={type:v.OBJECT,properties:r,fast:!s};return i&&(l.whenCondition=i),l},Oo=(e,t,r={})=>{let s=[],i=[],n=t,[a,l]=e[n],p=null,o;if(a.startsWith("$if#")){let c=a.match(/^\$if#(\w+)\s+(.+)$/);if(c)p=c[1],o=c[2];else throw new k(`Invalid conditional syntax: ${a}`)}else o=a.substring(4),o.endsWith(":")&&(o=o.slice(0,-1).trim());sr(o);let u=Z(o,r);for(s.push(u),i.push(ve(l,r)),n++;n<e.length;){let[c,d]=e[n],h=!1,f;if(p?c.startsWith(`$elif#${p} `)?(f=c.substring(`$elif#${p} `.length),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c===`$else#${p}`||c===`$else#${p}:`)&&(h=!0,f=null):c.startsWith("$elif ")?(f=c.substring(6),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c==="$else"||c==="$else:")&&(h=!0,f=null),h){if(f===null)s.push(null);else{sr(f);let m=Z(f,r);s.push(m)}if(i.push(ve(d,r)),n++,f===null)break}else break}return{node:{type:v.CONDITIONAL,conditions:s,bodies:i,id:p},nextIndex:n}},Z=(e,t={})=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")")){let o=e.slice(1,-1),u=0,c=!0;for(let d=0;d<o.length;d++)if(o[d]==="("?u++:o[d]===")"&&u--,u<0){c=!1;break}if(c&&u===0)return Z(o,t)}let r=Ae(e,"||");if(r!==-1)return{type:v.BINARY,op:P.OR,left:Z(e.substring(0,r).trim(),t),right:Z(e.substring(r+2).trim(),t)};let s=Ae(e,"&&");if(s!==-1)return{type:v.BINARY,op:P.AND,left:Z(e.substring(0,s).trim(),t),right:Z(e.substring(s+2).trim(),t)};let i=[{op:">=",type:P.GTE},{op:"<=",type:P.LTE},{op:"==",type:P.EQ},{op:"!=",type:P.NEQ},{op:">",type:P.GT},{op:"<",type:P.LT},{op:" in ",type:P.IN}];for(let{op:o,type:u}of i){let c=Ae(e,o);if(c!==-1)return{type:v.BINARY,op:u,left:Z(e.substring(0,c).trim(),t),right:Z(e.substring(c+o.length).trim(),t)}}let n=-1,a=null,l=[{op:" + ",type:P.ADD},{op:" - ",type:P.SUBTRACT}];for(let{op:o,type:u}of l){let c=0;for(;c<e.length;){let d=Ae(e.substring(c),o);if(d===-1)break;let h=c+d;h>n&&(n=h,a={op:o,type:u}),c=h+o.length}}if(n!==-1&&a)return{type:v.BINARY,op:a.type,left:Z(e.substring(0,n).trim(),t),right:Z(e.substring(n+a.op.length).trim(),t)};let p=[" * "," / "," % "];for(let o of p)if(Ae(e,o)!==-1)throw new k(`Arithmetic operations are not allowed in conditionals: "${o}"`);return e.startsWith("!")?{type:v.UNARY,op:Ge.NOT,operand:Z(e.substring(1).trim(),t)}:Js(e,t)},Ae=(e,t)=>{let r=0,s=0;for(;s<=e.length-t.length;){if(e[s]==="(")r++;else if(e[s]===")")r--;else if(r===0&&e.substring(s,s+t.length)===t)return s;s++}return-1},To=e=>{if(e=e.trim(),e==="true")return{type:v.LITERAL,value:!0};if(e==="false")return{type:v.LITERAL,value:!1};if(e==="null")return{type:v.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:v.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:v.LITERAL,value:""};if(e==="{}")return{type:v.LITERAL,value:{}};if(e==="[]")return{type:v.LITERAL,value:[]};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:v.LITERAL,value:t}:{type:v.VARIABLE,path:e}},Js=(e,t)=>{let r=e.trim();if(r.match(/^(\w+)\((.*)\)$/))return qe(r,t);let i=To(r);if(i.type===v.LITERAL)return i;if(/^[a-zA-Z_$][\w.$]*$/.test(r))return{type:v.VARIABLE,path:r};try{return qe(r,t)}catch(n){if(n.message&&n.message.includes("not supported"))return i;throw n}},Lo=(e,t=!1)=>{let r=t?"$each":"$for";try{Ds(e)}catch(s){if(s instanceof k&&t){let i=s.message.replace(/\$for/g,"$each");throw new k(i.replace("Parse Error: ",""))}throw s}},qs=(e,t,r,s=!1)=>{let i=/^\$for(?::(\w+))?\s+(.+)$/,n=e.match(i);if(!n){let g=s?"$each":"$for";throw new k(`Invalid loop syntax (got: '${e.replace("$for",g)}')`)}let a=n[1],l=n[2].trim();Lo(l,s);let p=l.match(/^(.+?)\s+in\s+(.+)$/);if(!p){let g=s?"$each":"$for";throw new k(`Invalid loop syntax - missing 'in' keyword (got: '${g} ${l}')`)}let o=p[1].trim(),u=p[2].trim(),c,d=null;if(o.includes(",")){let g=o.split(",").map(y=>y.trim());if(g.length!==2)throw new k(`Invalid loop variables: ${o}. Expected format: "item" or "item, index"`);c=g[0],d=g[1]}else c=o;let h=["this","undefined","null","true","false"];if(h.includes(c))throw new k(`Reserved variable name: ${c}`);if(d&&h.includes(d))throw new k(`Reserved variable name: ${d}`);let f=Js(u,r),m=ve(t,r);return{type:v.LOOP,itemVar:c,indexVar:d,iterable:f,body:m,flatten:a!=="nested"}};var Ro=(e,t={})=>{let{functions:r={}}=t;return ve(e,r)},pt=Ro;var ar={};R(ar,{now:()=>No});var No=()=>Date.now();var Vo=(e,t,r={})=>{let{functions:s={},partials:i={}}=r,n={...ar,...s},a=pt(e,{functions:n}),l={};for(let[p,o]of Object.entries(i))l[p]=pt(o,{functions:n});return ir(a,t,{functions:n,partials:l})},or=Vo;var lr=e=>e!==null&&typeof e=="object",ct=e=>lr(e)&&!Array.isArray(e),Po=e=>typeof e=="string"&&e.includes("."),Ys=e=>typeof e=="string"&&/[\[\]]/.test(e);function Xs(e,t){let r={};for(let s of t){if(typeof s!="string"||s.length===0)continue;let i=ie(e,s);i!==void 0&&pe(r,s,i)}return r}function Do(e){if(!ct(e)||!Array.isArray(e.fields))return e;let t=(r=[])=>r.map(s=>{if(!ct(s))return s;if(typeof s.$when=="string"&&s.$when.trim().length>0){let{$when:i,...n}=s,a=Array.isArray(n.fields)?{...n,fields:t(n.fields)}:n;return{[`$if ${i}`]:a}}return Array.isArray(s.fields)?{...s,fields:t(s.fields)}:s});return{...e,fields:t(e.fields)}}var ie=(e,t,r=void 0)=>{if(!t||!lr(e)||Ys(t))return r;let s=t.split(".").filter(n=>n!==""),i=e;for(let n of s){if(i==null||!(n in i))return Object.prototype.hasOwnProperty.call(e,t)?e[t]:r;i=i[n]}return i},pe=(e,t,r)=>{if(!lr(e)||typeof t!="string"||t.length===0||Ys(t))return e;let s=t.split(".").filter(n=>n!=="");if(s.length===0)return e;Po(t)&&Object.prototype.hasOwnProperty.call(e,t)&&delete e[t];let i=e;for(let n=0;n<s.length-1;n++){let a=s[n];(!(a in i)||typeof i[a]!="object"||i[a]===null)&&(i[a]={}),i=i[a]}return i[s[s.length-1]]=r,e},Bo=["id","class","style","slot","form","defaultValues","disabled"],jo=(e={})=>Object.entries(e).filter(([t])=>!Bo.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Fo={email:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,url:/^https?:\/\/.+/},de={required:"This field is required",minLength:e=>`Must be at least ${e} characters`,maxLength:e=>`Must be at most ${e} characters`,pattern:"Invalid format",invalidDate:"Invalid date format",invalidTime:"Invalid time format",invalidDateTime:"Invalid date and time format",minTemporal:e=>`Must be on or after ${e}`,maxTemporal:e=>`Must be on or before ${e}`},Mo="input-date",Wo="input-time",zo="input-datetime",Uo=/^(\d{4})-(\d{2})-(\d{2})$/,Ko=/^(\d{2}):(\d{2})(?::(\d{2}))?$/,Ho=/^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}(?::\d{2})?)$/,Go=e=>{if(typeof e!="string")return null;let t=Uo.exec(e);if(!t)return null;let r=Number(t[1]),s=Number(t[2]),i=Number(t[3]);if(!Number.isInteger(r)||!Number.isInteger(s)||!Number.isInteger(i)||s<1||s>12||i<1||i>31)return null;let n=new Date(Date.UTC(r,s-1,i));return n.getUTCFullYear()===r&&n.getUTCMonth()===s-1&&n.getUTCDate()===i?{year:r,month:s,day:i}:null},qo=e=>{if(typeof e!="string")return null;let t=Ko.exec(e);if(!t)return null;let r=Number(t[1]),s=Number(t[2]),i=t[3]===void 0?0:Number(t[3]);return!Number.isInteger(r)||!Number.isInteger(s)||!Number.isInteger(i)||r<0||r>23||s<0||s>59||i<0||i>59?null:{hour:r,minute:s,second:i}},Zs=e=>{let t=qo(e);return t?`${String(t.hour).padStart(2,"0")}:${String(t.minute).padStart(2,"0")}:${String(t.second).padStart(2,"0")}`:null},Qs=e=>Go(e)?e:null,Jo=e=>{if(typeof e!="string")return null;let t=Ho.exec(e);if(!t)return null;let r=Qs(t[1]),s=Zs(t[2]);return!r||!s?null:`${r}T${s}`},Yo=e=>e===Mo?{normalize:Qs,invalidMessage:de.invalidDate}:e===Wo?{normalize:Zs,invalidMessage:de.invalidTime}:e===zo?{normalize:Jo,invalidMessage:de.invalidDateTime}:null,Xo=(e,t)=>{let r=Yo(e.type);if(!r||t==null||t==="")return null;let s=r.normalize(String(t));if(!s)return r.invalidMessage;if(e.min!==void 0&&e.min!==null&&String(e.min)!==""){let i=r.normalize(String(e.min));if(i&&s<i)return de.minTemporal(String(e.min))}if(e.max!==void 0&&e.max!==null&&String(e.max)!==""){let i=r.normalize(String(e.max));if(i&&s>i)return de.maxTemporal(String(e.max))}return null},Je=(e,t)=>{if(e.required){let s=t==null||t===""||typeof t=="boolean"&&t===!1,i=e.type==="input-number"&&t===null;if(e.type==="input-number"?i:s)return typeof e.required=="object"&&e.required.message?e.required.message:de.required}let r=Xo(e,t);if(r)return r;if(Array.isArray(e.rules))for(let s of e.rules){let i=Zo(s,t);if(i)return i}return null},Zo=(e,t)=>{if(t==null||t==="")return null;let r=String(t);switch(e.rule){case"minLength":return r.length<e.value?e.message||de.minLength(e.value):null;case"maxLength":return r.length>e.value?e.message||de.maxLength(e.value):null;case"pattern":{let i=Fo[e.value];if(!i)try{i=new RegExp(e.value)}catch{return e.message||de.pattern}return i.test(r)?null:e.message||de.pattern}default:return null}},Le=(e,t)=>{let r={},s=Q(e);for(let i of s){let n=ie(t,i.name),a=Je(i,n);a&&(r[i.name]=a)}return{valid:Object.keys(r).length===0,errors:r}},Qo=["section","read-only-text","slot"],pr=e=>!Qo.includes(e.type),Q=e=>{let t=[];for(let r of e)r.type==="section"&&Array.isArray(r.fields)?t.push(...Q(r.fields)):pr(r)&&t.push(r);return t},Ye=e=>{switch(e.type){case"input-text":case"input-date":case"input-time":case"input-datetime":case"input-textarea":case"popover-input":return"";case"input-number":return null;case"select":return null;case"checkbox":return!1;case"color-picker":return"#000000";case"slider":case"slider-with-input":return e.min!==void 0?e.min:0;case"image":return null;default:return null}},cr=(e,t=0)=>{let r=[],s=t;for(let i of e)if(i.type==="section"){if(r.push({...i,_isSection:!0,_idx:s}),s++,Array.isArray(i.fields)){let n=cr(i.fields,s);r.push(...n),s+=n.length}}else r.push({...i,_isSection:!1,_idx:s}),s++;return r},el=()=>Object.freeze({formValues:{},errors:{},reactiveMode:!1,tooltipState:{open:!1,x:0,y:0,content:""}}),K=({state:e,props:t})=>{let{form:r={}}=t||{},s=Do(r),i=ct(t?.context)?t.context:{},n=ct(e?.formValues)?e.formValues:{},a={...i,...n,formValues:n};return Object.keys(a).length>0?or(s,a):s},tl=({state:e,props:t})=>{let r=jo(t),s=K({state:e,props:t}),i=s.fields||[],n=!!t?.disabled,a=cr(i);a.forEach((c,d)=>{if(c._arrIdx=d,c._isSection)return;let h=pr(c);if(c._disabled=n||!!c.disabled,h&&c.name&&(c._error=e.errors[c.name]||null),c.type==="input-text"&&(c._inputType=c.inputType||"text"),c.type==="select"){let f=ie(e.formValues,c.name);c._selectedValue=f!==void 0?f:null,c.placeholder=c.placeholder||"",c.noClear=c.clearable===!1}if(c.type==="image"){let f=ie(e.formValues,c.name);c._imageSrc=f&&String(f).trim()?f:null,c.placeholderText=c.placeholderText||"No Image"}if(c.type==="read-only-text"&&(c.content=c.content||""),c.type==="checkbox"){let f=typeof c.content=="string"?c.content:typeof c.checkboxLabel=="string"?c.checkboxLabel:"";c._checkboxText=f}});let l=s.actions||{buttons:[]},p=l.layout||"split",o=(l.buttons||[]).map((c,d)=>({...c,_globalIdx:d,variant:c.variant||"se",_disabled:n||!!c.disabled,pre:c.pre||"",suf:c.suf||""})),u;return p==="split"?u={_layout:"split",buttons:o,_leftButtons:o.filter(c=>c.align==="left"),_rightButtons:o.filter(c=>c.align!=="left")}:u={_layout:p,buttons:o,_allButtons:o},{containerAttrString:r,title:s?.title||"",description:s?.description||"",flatFields:a,actions:u,formValues:e.formValues,tooltipState:e.tooltipState}},me=({state:e,props:t})=>{let r=K({state:e,props:t}),s=Q(r.fields||[]);return Xs(e.formValues,s.map(i=>i.name).filter(i=>typeof i=="string"&&i.length>0))},rl=({state:e,props:t},r={})=>{let{name:s,value:i}=r;s&&(pe(e.formValues,s,i),Re({state:e,props:t}))},Re=({state:e,props:t})=>{if(!t)return;let r=K({state:e,props:t}),s=Q(r.fields||[]);e.formValues=Xs(e.formValues,s.map(i=>i.name).filter(i=>typeof i=="string"&&i.length>0))},sl=({state:e},t={})=>{let{values:r}=t;!r||typeof r!="object"||Object.keys(r).forEach(s=>{pe(e.formValues,s,r[s])})},il=({state:e},t={})=>{let{defaultValues:r={}}=t;e.formValues=r?structuredClone(r):{},e.errors={},e.reactiveMode=!1},nl=({state:e},t={})=>{e.errors=t.errors||{}},al=({state:e},t={})=>{let{name:r}=t;r&&e.errors[r]&&delete e.errors[r]},ol=({state:e})=>{e.reactiveMode=!0},ll=({state:e},t={})=>{let{x:r,y:s,content:i}=t;e.tooltipState={open:!0,x:r,y:s,content:i}},pl=({state:e})=>{e.tooltipState={...e.tooltipState,open:!1}};var ei=({field:e,target:t,value:r})=>{!e||!t||["slider-with-input","popover-input"].includes(e.type)&&(r==null?t.removeAttribute("value"):t.setAttribute("value",String(r)))},ti=({form:e,formValues:t={},refs:r,formDisabled:s=!1})=>{let i=e.fields||[],n=0,a=l=>{for(let p of l){if(p.type==="section"){n++,Array.isArray(p.fields)&&a(p.fields);continue}let o=r[`field${n}`];if(n++,!o)continue;let u=s||!!p.disabled;if(["input-text","input-date","input-time","input-datetime","input-number","input-textarea","color-picker","slider","slider-with-input","popover-input"].includes(p.type)){let c=ie(t,p.name);if(c==null?o.removeAttribute("value"):o.setAttribute("value",String(c)),p.type==="slider-with-input"&&o.store?.setValue){let d=Number(c??0);o.store.setValue({value:Number.isFinite(d)?d:0}),typeof o.render=="function"&&o.render()}p.type==="popover-input"&&o.store?.setValue&&(o.store.setValue({value:c==null?"":String(c)}),typeof o.render=="function"&&o.render())}p.type==="checkbox"&&(ie(t,p.name)?o.setAttribute("checked",""):o.removeAttribute("checked")),["input-text","input-date","input-time","input-datetime","input-number","input-textarea","popover-input"].includes(p.type)&&p.placeholder&&o.getAttribute("placeholder")!==p.placeholder&&(p.placeholder===void 0||p.placeholder===null?o.removeAttribute("placeholder"):o.setAttribute("placeholder",p.placeholder)),u?o.setAttribute("disabled",""):o.removeAttribute("disabled")}};a(i)},cl=(e,t)=>{let r=t?.defaultValues||{},s={};Object.keys(r).forEach(l=>{pe(s,l,r[l])});let i=K({state:{formValues:s},props:t}),n=Q(i.fields||[]),a={};for(let l of n){let p=ie(r,l.name);p!==void 0?pe(a,l.name,p):pe(a,l.name,Ye(l))}e.resetFormValues({defaultValues:a})},ul=e=>{let{store:t,props:r}=e;cl(t,r)},dl=e=>{let{props:t,refs:r,render:s}=e,i=e.store.getState(),n=K({state:i,props:t});ti({form:n,formValues:i.formValues,refs:r,formDisabled:!!t?.disabled}),s()},fl=(e,t)=>{let{newProps:r}=t,{store:s,render:i,refs:n}=e,a=!!r?.disabled,l=s.getState();Re({state:l,props:r});let p=K({state:l,props:r});ti({form:p,formValues:l.formValues,refs:n,formDisabled:a}),i()},hl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event,l=a.currentTarget.dataset.fieldName;if(!l||!a.detail||!Object.prototype.hasOwnProperty.call(a.detail,"value"))return;let p=a.detail.value;r.setFormFieldValue({name:l,value:p});let o=r.getState();Re({state:o,props:n});let u=K({state:o,props:n}),d=Q(u.fields||[]).find(h=>h.name===l);if(ei({field:d,target:a.currentTarget,value:p}),o.reactiveMode&&d){let h=Je(d,p);h?r.setErrors({errors:{...o.errors,[l]:h}}):r.clearFieldError({name:l})}i(),s(new CustomEvent("form-input",{bubbles:!0,detail:{name:l,value:p,values:me({state:r.getState(),props:n})}}))},ml=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event,l=a.currentTarget.dataset.fieldName;if(!l||!a.detail||!Object.prototype.hasOwnProperty.call(a.detail,"value"))return;let p=a.detail.value;r.setFormFieldValue({name:l,value:p});let o=r.getState();Re({state:o,props:n});let u=K({state:o,props:n}),d=Q(u.fields||[]).find(h=>h.name===l);if(ei({field:d,target:a.currentTarget,value:p}),o.reactiveMode&&d){let h=Je(d,p);h?r.setErrors({errors:{...o.errors,[l]:h}}):r.clearFieldError({name:l})}i(),s(new CustomEvent("form-change",{bubbles:!0,detail:{name:l,value:p,values:me({state:r.getState(),props:n})}}))},yl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,l=t._event.currentTarget.dataset.actionId;if(!l)return;let p=r.getState(),o=K({state:p,props:n}),d=((o.actions||{}).buttons||[]).find(f=>f.id===l),h=me({state:p,props:n});if(d&&d.validate){let f=Q(o.fields||[]),{valid:m,errors:g}=Le(f,p.formValues);r.setErrors({errors:g}),m||r.setReactiveMode(),i(),s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:l,values:h,valid:m,errors:g}}))}else s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:l,values:h}}))},gl=(e,t)=>{let r=t._event;r.type==="contextmenu"&&r.preventDefault();let{store:s,dispatchEvent:i,props:n}=e,a=r.currentTarget.dataset.fieldName;i(new CustomEvent("form-field-event",{bubbles:!0,detail:{name:a,event:r.type,values:me({state:s.getState(),props:n})}}))},bl=(e,t)=>{let{store:r,dispatchEvent:s,render:i,props:n}=e,a=t._event;if(a.key==="Enter"&&!a.shiftKey){let l=a.target;if(l.tagName==="TEXTAREA"||l.tagName==="RTGL-TEXTAREA")return;a.preventDefault();let p=r.getState(),o=K({state:p,props:n}),c=(o.actions||{}).buttons||[],h=c.find(m=>m.validate)||c[0];if(!h)return;let f=me({state:p,props:n});if(h.validate){let m=Q(o.fields||[]),{valid:g,errors:y}=Le(m,p.formValues);r.setErrors({errors:y}),g||r.setReactiveMode(),i(),s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:h.id,values:f,valid:g,errors:y}}))}else s(new CustomEvent("form-action",{bubbles:!0,detail:{actionId:h.id,values:f}}))}},vl=(e,t)=>{let{store:r,render:s,props:i}=e,n=t._event,a=n.currentTarget.dataset.fieldName,l=K({state:r.getState(),props:i}),o=Q(l.fields||[]).find(u=>u.name===a);if(o&&o.tooltip){let u=n.currentTarget.getBoundingClientRect();r.showTooltip({x:u.left+u.width/2,y:u.top-8,content:typeof o.tooltip=="string"?o.tooltip:o.tooltip.content||""}),s()}},wl=e=>{let{store:t,render:r}=e;t.hideTooltip({}),r()};var fr={};R(fr,{getValues:()=>$l,reset:()=>Il,setValues:()=>Sl,validate:()=>Cl});var _l=["input-text","input-date","input-time","input-datetime","input-number","input-textarea","color-picker","slider","slider-with-input","popover-input"],xl=["input-text","input-date","input-time","input-datetime","input-number","input-textarea","popover-input","slider-with-input"],El=({ref:e,fieldType:t,value:r,forceRefresh:s=!1})=>{if(_l.includes(t)){if(s&&e.removeAttribute("value"),r==null){if(xl.includes(t)&&s){if(t==="popover-input"){e.removeAttribute("value");return}e.setAttribute("value","");return}e.removeAttribute("value");return}e.setAttribute("value",String(r))}},si=({ref:e,value:t})=>{e&&e?.store?.updateSelectedValue&&(e.store.updateSelectedValue({value:t}),typeof e.render=="function"&&e.render())},Al=e=>{let t=new Map;return!e||typeof e.querySelectorAll!="function"||e.querySelectorAll("[data-field-name]").forEach(r=>{let s=r.getAttribute("data-field-name");s&&t.set(s,r)}),t},ri=e=>e?.renderTarget?e.renderTarget:e?.shadowRoot?e.shadowRoot:e?.shadow,kl=({root:e,values:t={}})=>{if(!e||typeof e.querySelectorAll!="function")return;e.querySelectorAll("rtgl-select[data-field-name]").forEach(s=>{let i=s.dataset?.fieldName;if(!i)return;let n=ie(t,i);si({ref:s,value:n})})},$l=function(){let e=this.store.getState();return me({state:e,props:this.props})},Sl=function(e={}){let t=e&&typeof e=="object"&&e.values&&typeof e.values=="object"?e.values:e;if(!t||typeof t!="object"||Array.isArray(t))return;this.store.setFormValues({values:t}),this.store.pruneHiddenValues();let r=this.store.getState(),s=K({state:r,props:this.props}),i=Q(s.fields||[]),n=Al(ri(this));for(let l of i){if(!l.name)continue;let p=n.get(l.name);if(!p)continue;let o=Object.prototype.hasOwnProperty.call(t,l.name),u=ie(t,l.name);if(!o&&u===void 0)continue;let c=ie(r.formValues,l.name);El({ref:p,fieldType:l.type,value:c,forceRefresh:!0}),typeof p?.tagName=="string"&&p.tagName.toUpperCase()==="RTGL-SELECT"&&si({ref:p,value:c}),l.type==="checkbox"&&(c?p.setAttribute("checked",""):p.removeAttribute("checked"))}this.render();let a=()=>{let l=this.store.getState();kl({root:ri(this),values:l.formValues})};a(),setTimeout(()=>{a()},0)},Cl=function(){let e=this.store.getState(),t=K({state:e,props:this.props}),r=Q(t.fields||[]),{valid:s,errors:i}=Le(r,e.formValues);return this.store.setErrors({errors:i}),s||this.store.setReactiveMode(),this.render(),{valid:s,errors:i}},Il=function(){let e=this.props?.defaultValues||{},t={};Object.keys(e).forEach(n=>{pe(t,n,e[n])});let r=K({state:{formValues:t},props:this.props}),s=Q(r.fields||[]),i={};for(let n of s){let a=ie(e,n.name);a!==void 0?pe(i,n.name,a):pe(i,n.name,Ye(n))}this.store.resetFormValues({defaultValues:i}),this.setValues(i)};var ii={componentName:"rtgl-form",propsSchema:{type:"object",properties:{form:{type:"object"},defaultValues:{type:"object"},context:{type:"object"},disabled:{type:"boolean"}}},events:{"form-input":{},"form-change":{},"form-field-event":{},"form-action":{}},methods:{type:"object",properties:{getValues:{type:"function"},setValues:{type:"function"},validate:{type:"function"},reset:{type:"function"}}}};var ni={refs:{formContainer:{eventListeners:{keydown:{handler:"handleKeyDown"}}},"action*":{eventListeners:{click:{handler:"handleActionClick"}}},"tooltipIcon*":{eventListeners:{mouseenter:{handler:"handleTooltipMouseEnter"},mouseleave:{handler:"handleTooltipMouseLeave"}}},"field*":{eventListeners:{"value-input":{handler:"handleValueInput"},"value-change":{handler:"handleValueChange"}}},"image*":{eventListeners:{click:{handler:"handleImageClick"},contextmenu:{handler:"handleImageClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#formContainer w=f p=md g=lg ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:8,properties:[{key:"$if title",value:{type:6,conditions:[{type:1,path:"title"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"title"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if description",value:{type:6,conditions:[{type:1,path:"description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view g=lg w=f",value:{type:9,items:[{type:7,itemVar:"field",indexVar:"i",iterable:{type:1,path:"flatFields"},body:{type:9,items:[{type:8,properties:[{key:"$if field._isSection",value:{type:6,conditions:[{type:1,path:"field._isSection"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm",value:{type:9,items:[{type:8,properties:[{key:"$if field.label",value:{type:6,conditions:[{type:1,path:"field.label"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=md",value:{type:1,path:"field.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.description",value:{type:6,conditions:[{type:1,path:"field.description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if !field._isSection",value:{type:6,conditions:[{type:5,op:0,operand:{type:1,path:"field._isSection"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=f",value:{type:9,items:[{type:8,properties:[{key:"$if field.label || field.description",value:{type:6,conditions:[{type:4,op:7,left:{type:1,path:"field.label"},right:{type:1,path:"field.description"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=md av=c",value:{type:9,items:[{type:8,properties:[{key:"$if field.label",value:{type:6,conditions:[{type:1,path:"field.label"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"field.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.required",value:{type:6,conditions:[{type:1,path:"field.required"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text c=fg s=sm",value:{type:0,value:"*"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field.tooltip",value:{type:6,conditions:[{type:1,path:"field.tooltip"}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-svg#tooltipIcon${field._idx} data-field-name=${field.name} svg="info" wh=16 c=mu-fg cur=help ml=xs',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg#tooltipIcon",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"},' svg="info" wh=16 c=mu-fg cur=help ml=xs']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"$if field.description",value:{type:6,conditions:[{type:1,path:"field.description"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input#field${field._idx} data-field-name=${field.name} w=f type=${field._inputType} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f type=",{type:1,path:"field._inputType"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-date"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-date"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-date#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-date#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-time"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-time"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-time#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-time#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-datetime"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-datetime"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-datetime#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-datetime#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-number"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-number"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input-number#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-number#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "input-textarea"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"input-textarea"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-textarea#field${field._idx} data-field-name=${field.name} w=f rows=${field.rows} placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-textarea#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f rows=",{type:1,path:"field.rows"}," placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "select"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"select"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-select#field${field._idx} data-field-name=${field.name} w=f :options=flatFields[${field._arrIdx}].options ?no-clear=${field.noClear} :selectedValue=flatFields[${field._arrIdx}]._selectedValue :placeholder=${field.placeholder} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-select#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f :options=flatFields[",{type:1,path:"field._arrIdx"},"].options ?no-clear=",{type:1,path:"field.noClear"}," :selectedValue=flatFields[",{type:1,path:"field._arrIdx"},"]._selectedValue :placeholder=",{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "color-picker"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"color-picker"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-color-picker#field${field._idx} data-field-name=${field.name} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-color-picker#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slider"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slider"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slider-with-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slider-with-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider-input#field${field._idx} data-field-name=${field.name} w=f min=${field.min} max=${field.max} step=${field.step} ?disabled=${field._disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=f min=",{type:1,path:"field.min"}," max=",{type:1,path:"field.max"}," step=",{type:1,path:"field.step"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "popover-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"popover-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-popover-input#field${field._idx} data-field-name=${field.name} label="${field.label}" placeholder=${field.placeholder} ?disabled=${field._disabled}',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-popover-input#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"},' label="',{type:1,path:"field.label"},'" placeholder=',{type:1,path:"field.placeholder"}," ?disabled=",{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "checkbox"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"checkbox"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-checkbox#field${field._idx} data-field-name=${field.name} label="${field._checkboxText}" ?disabled=${field._disabled}',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-checkbox#field",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"},' label="',{type:1,path:"field._checkboxText"},'" ?disabled=',{type:1,path:"field._disabled"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "image" && field._imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"image"}},right:{type:1,path:"field._imageSrc"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image#image${field._idx} data-field-name=${field.name} src=${field._imageSrc} w=${field.width} h=${field.height} cur=pointer",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image#image",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," src=",{type:1,path:"field._imageSrc"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=pointer"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "image" && !field._imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"image"}},right:{type:5,op:0,operand:{type:1,path:"field._imageSrc"}}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view#image${field._idx} data-field-name=${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=pointer p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg ta=c",value:{type:1,path:"field.placeholderText"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#image",{type:1,path:"field._idx"}," data-field-name=",{type:1,path:"field.name"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," bc=ac bw=sm ah=c av=c cur=pointer p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "read-only-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"read-only-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"field.content"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.type == "slot"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.type"},right:{type:0,value:"slot"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'slot#fieldSlot${field._idx} name=${field.slot} style="display: contents;"',value:{type:0,value:null},parsedKey:{type:2,parts:["slot#fieldSlot",{type:1,path:"field._idx"}," name=",{type:1,path:"field.slot"},' style="display: contents;"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"$if field._error",value:{type:6,conditions:[{type:1,path:"field._error"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=de",value:{type:1,path:"field._error"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"$if actions.buttons.length > 0",value:{type:6,conditions:[{type:4,op:2,left:{type:1,path:"actions.buttons.length"},right:{type:0,value:0}}],bodies:[{type:9,items:[{type:8,properties:[{key:'$if actions._layout == "split"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"split"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h w=f g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._leftButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view d=h g=sm ah=e w=1fg",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._rightButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if actions._layout == "vertical"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"vertical"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._allButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} w=f ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," w=f ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'$if actions._layout == "stretch"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"actions._layout"},right:{type:0,value:"stretch"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions._allButtons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action${button._globalIdx} data-action-id=${button.id} v=${button.variant} w=f ?disabled=${button._disabled} pre=${button.pre} suf=${button.suf}",value:{type:1,path:"button.label"},parsedKey:{type:2,parts:["rtgl-button#action",{type:1,path:"button._globalIdx"}," data-action-id=",{type:1,path:"button.id"}," v=",{type:1,path:"button.variant"}," w=f ?disabled=",{type:1,path:"button._disabled"}," pre=",{type:1,path:"button.pre"}," suf=",{type:1,path:"button.suf"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:'rtgl-tooltip ?open=${tooltipState.open} x=${tooltipState.x} y=${tooltipState.y} place="t" content="${tooltipState.content}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-tooltip ?open=",{type:1,path:"tooltipState.open"}," x=",{type:1,path:"tooltipState.x"}," y=",{type:1,path:"tooltipState.y"},' place="t" content="',{type:1,path:"tooltipState.content"},'"']}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#formContainer w=f p=md g=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var hr={};R(hr,{handleCancel:()=>Ll,handleCloseAll:()=>Bl,handleConfirm:()=>Tl,handleDialogClose:()=>Ol,handleDropdownClose:()=>Rl,handleDropdownItemClick:()=>Nl,handleShowAlert:()=>Vl,handleShowConfirm:()=>Pl,handleShowDropdownMenu:()=>Dl});var Ol=(e,t)=>{let{store:r,render:s}=e;r.closeAll(),s()},Tl=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",!0)},Ll=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",!1)},Rl=(e,t)=>{let{store:r,render:s,globalUI:i}=e;r.closeAll(),s(),i.emit("event",null)},Nl=(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t._event,{index:a,item:l}=n.detail;r.closeAll(),s(),i.emit("event",{index:a,item:l})},Vl=(e,t)=>{let{store:r,render:s}=e,i=t;r.selectIsOpen()&&(r.closeAll(),s()),r.setAlertConfig(i),s()},Pl=async(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t;return r.selectIsOpen()&&(r.closeAll(),s()),r.setConfirmConfig(n),s(),new Promise(a=>{i.once("event",l=>{a(l)})})},Dl=async(e,t)=>{let{store:r,render:s,globalUI:i}=e,n=t;return r.selectIsOpen()&&(r.closeAll(),s()),r.setDropdownConfig(n),s(),new Promise(a=>{i.once("event",l=>{a(l)})})},Bl=e=>{let{store:t,render:r}=e;t.selectIsOpen()&&(t.closeAll(),r())};var ai={componentName:"rtgl-global-ui",propsSchema:{type:"object",properties:{}},events:[],methods:{type:"object",properties:{}}};var mr={};R(mr,{closeAll:()=>zl,createInitialState:()=>jl,selectConfig:()=>Ul,selectDropdownConfig:()=>Kl,selectIsOpen:()=>Gl,selectUiType:()=>Hl,selectViewData:()=>ql,setAlertConfig:()=>Fl,setConfirmConfig:()=>Ml,setDropdownConfig:()=>Wl});var jl=()=>Object.freeze({isOpen:!1,uiType:"dialog",config:{status:void 0,title:"",message:"",confirmText:"OK",cancelText:"Cancel",mode:"alert"},dropdownConfig:{items:[],x:0,y:0,place:"bs"}}),Fl=({state:e},t={})=>{if(!t.message)throw new Error("message is required for showAlert");e.config={status:t.status||void 0,title:t.title||"",message:t.message,confirmText:t.confirmText||"OK",cancelText:"",mode:"alert"},e.uiType="dialog",e.isOpen=!0},Ml=({state:e},t={})=>{if(!t.message)throw new Error("message is required for showConfirm");e.config={status:t.status||void 0,title:t.title||"",message:t.message,confirmText:t.confirmText||"Yes",cancelText:t.cancelText||"Cancel",mode:"confirm"},e.uiType="dialog",e.isOpen=!0},Wl=({state:e},t={})=>{if(!t.items||!Array.isArray(t.items))throw new Error("items array is required for showDropdown");e.dropdownConfig={items:t.items,x:t.x||0,y:t.y||0,place:t.place||"bs"},e.uiType="dropdown",e.isOpen=!0},zl=({state:e})=>{e.isOpen=!1,e.uiType="dialog"},Ul=({state:e})=>e.config,Kl=({state:e})=>e.dropdownConfig,Hl=({state:e})=>e.uiType,Gl=({state:e})=>e.isOpen,ql=({state:e})=>({isOpen:e.isOpen,uiType:e.uiType,config:e.config,dropdownConfig:{items:e.dropdownConfig?.items||[],x:e.dropdownConfig?.x||0,y:e.dropdownConfig?.y||0,place:e.dropdownConfig?.place||"bs"},isDialogOpen:e.isOpen&&e.uiType==="dialog",isDropdownOpen:e.isOpen&&e.uiType==="dropdown"});var oi={refs:{dialog:{eventListeners:{close:{handler:"handleDialogClose"}}},confirmButton:{eventListeners:{click:{handler:"handleConfirm"}}},cancelButton:{eventListeners:{click:{handler:"handleCancel"}}},dropdownMenu:{eventListeners:{close:{handler:"handleDropdownClose"},"item-click":{handler:"handleDropdownItemClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-dialog#dialog ?open=${isDialogOpen} s=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content g=lg p=lg",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=c av=c g=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view h=24 av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"config.title"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"config.message"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h g=md mt=lg w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"$if config.mode == 'confirm'",value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"config.mode"},right:{type:0,value:"confirm"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-button#cancelButton v=se",value:{type:1,path:"config.cancelText"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-button#confirmButton v=pr",value:{type:1,path:"config.confirmText"}}],fast:!0}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-dialog#dialog ?open=",{type:1,path:"isDialogOpen"}," s=sm"]}}],fast:!1},{type:8,properties:[{key:"rtgl-dropdown-menu#dropdownMenu ?open=${isDropdownOpen} x=${dropdownConfig.x} y=${dropdownConfig.y} place=${dropdownConfig.place} :items=dropdownConfig.items key=dropdown-${isDropdownOpen}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-dropdown-menu#dropdownMenu ?open=",{type:1,path:"isDropdownOpen"}," x=",{type:1,path:"dropdownConfig.x"}," y=",{type:1,path:"dropdownConfig.y"}," place=",{type:1,path:"dropdownConfig.place"}," :items=dropdownConfig.items key=dropdown-",{type:1,path:"isDropdownOpen"}]}}],fast:!0}],fast:!1}};var yr={};R(yr,{handleClickStart:()=>Jl});var Jl=(e,t)=>{let{dispatchEvent:r,store:s}=e,i=t._event;console.log("handle click start",s.selectPath()),r(new CustomEvent("start-click",{detail:{path:s.selectPath()}}))};var li={componentName:"rtgl-navbar",propsSchema:{type:"object",properties:{start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}}}}}},events:{"start-click":{type:"object",properties:{path:{type:"string"}}}},methods:{type:"object",properties:{}}};var gr={};R(gr,{createInitialState:()=>Yl,selectPath:()=>tp,selectViewData:()=>ep,setState:()=>rp});var Yl=()=>Object.freeze({}),Xl=["id","class","style","slot","start"],Zl=(e={})=>Object.entries(e).filter(([t])=>!Xl.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ql=e=>{if(e!=null){if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(decodeURIComponent(e))}catch{try{return JSON.parse(e)}catch{return}}}},ep=({props:e})=>{let t=Ql(e.start)||e.start;return{containerAttrString:Zl(e),start:t||{label:"",image:{src:"",width:32,height:32,alt:""}}}},tp=({props:e})=>e.start?.path,rp=({state:e})=>{};var pi={refs:{start:{eventListeners:{click:{handler:"handleClickStart"}}}},anchors:[[{"rtgl-text s=lg":"${start.label}"},{"$if start.image && start.image.src":[{"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}":null}]}]],template:{type:9,items:[{type:8,properties:[{key:"rtgl-view bgc=bg d=h h=48 av=c w=f ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if start.href",value:{type:6,conditions:[{type:1,path:"start.href"},{type:1,path:"start.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${start.href}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["a href=",{type:1,path:"start.href"}]}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#start d=h av=c g=md cur=pointer",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"start.label"}}],fast:!0},{type:8,properties:[{key:"$if start.image && start.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"start.image"},right:{type:1,path:"start.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image w=${start.image.width} h=${start.image.height} src=${start.image.src} alt=${start.image.alt}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"start.image.width"}," h=",{type:1,path:"start.image.height"}," src=",{type:1,path:"start.image.src"}," alt=",{type:1,path:"start.image.alt"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-view w=1fg",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:"rtgl-view d=h av=c g=lg",value:{type:9,items:[{type:8,properties:[{key:"slot name=right",value:{type:0,value:null}}],fast:!0}],fast:!0}}],fast:!0}],fast:!1},parsedKey:{type:2,parts:["rtgl-view bgc=bg d=h h=48 av=c w=f ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var br={};R(br,{handleBeforeMount:()=>ip});var ci=(e,t,r)=>{let{store:s,render:i}=r,n,a=-1/0;if(e.forEach(l=>{let p=l.getBoundingClientRect();p.top<=t&&p.top>a&&(a=p.top,n=l.id)}),!n){let l=1/0;e.forEach(p=>{let o=p.getBoundingClientRect();o.top>t&&o.top<l&&(l=o.top,n=p.id)})}n&&n!==s.selectCurrentId()&&(s.setCurrentId({id:n}),i())},sp=(e,t,r,s)=>{let{store:i,render:n}=s,a=e.querySelectorAll("h1[id], h2[id], h3[id], h4[id], rtgl-text[id]"),l=Array.from(a),p=l.map(u=>{let c=1,d=u.tagName.toLowerCase();return d==="h1"?c=1:d==="h2"?c=2:d==="h3"?c=3:d==="h4"?c=4:d==="rtgl-text"&&(c=parseInt(u.getAttribute("data-level")||"1",10)),{id:u.id,href:`#${u.id}`,title:u.textContent,level:c}});i.setItems({items:p}),ci(l,r,s),n();let o=ci.bind(void 0,l,r,s);return t.addEventListener("scroll",o,{passive:!0}),()=>{t.removeEventListener("scroll",o)}},ip=e=>{let{props:t}=e,r=()=>{};return requestAnimationFrame(()=>{let s=document.getElementById(t.targetId);if(!s)return;let i=window;t.scrollContainerId&&(i=document.getElementById(t.scrollContainerId)||window);let n=parseInt(t.offsetTop||"100",10);r=sp(s,i,n,e)}),()=>{r()}};var ui={componentName:"rtgl-page-outline",propsSchema:{type:"object",properties:{targetId:{type:"string"},scrollContainerId:{type:"string"},offsetTop:{type:"string"}}},events:{onItemClick:{type:"object"}},methods:{type:"object",properties:{}}};var vr={};R(vr,{createInitialState:()=>np,selectCurrentId:()=>lp,selectState:()=>op,selectViewData:()=>ap,setContentContainer:()=>up,setCurrentId:()=>cp,setItems:()=>pp});var np=()=>Object.freeze({items:[],currentId:null,contentContainer:null}),ap=({state:e})=>{let r=((s,i)=>{let n=new Set,a=s.findIndex(p=>p.id===i);if(a===-1)return n;let l=s[a].level;for(let p=a-1;p>=0;p--)if(s[p].level<l){let o=s[p].level;n.add(s[p].id);for(let u=p-1;u>=0;u--)s[u].level<o&&(n.add(s[u].id),o=s[u].level);break}return n})(e.items,e.currentId);return{items:e.items.map(s=>{let i={1:"0",2:"12px",3:"24px",4:"32px"},n=s.id===e.currentId,a=r.has(s.id),l=n||a;return{...s,c:l?"fg":"mu-fg",ml:i[s.level]||"",bc:l?"fg":"mu-fg"}}),currentId:e.currentId}},op=({state:e})=>e,lp=({state:e})=>e.currentId,pp=({state:e},t={})=>{e.items=Array.isArray(t.items)?t.items:[]},cp=({state:e},t={})=>{e.currentId=t.id},up=({state:e},t={})=>{e.contentContainer=t.container};var di={refs:{},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=272 d=v pr=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=1fg sv mt=xl",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:'rtgl-view d=h bwl=xs bc="${item.bc}" pv=sm av=c href=${item.href} pl=md',value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=${item.ml}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-view w=",{type:1,path:"item.ml"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm c=${item.c} h-c=fg",value:{type:1,path:"item.title"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.c"}," h-c=fg"]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:['rtgl-view d=h bwl=xs bc="',{type:1,path:"item.bc"},'" pv=sm av=c href=',{type:1,path:"item.href"}," pl=md"]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}};var wr={};R(wr,{handleBeforeMount:()=>dp,handleInputChange:()=>yp,handleInputKeydown:()=>bp,handleOnUpdate:()=>fp,handlePopoverClose:()=>mp,handleSubmitClick:()=>gp,handleTextClick:()=>hp});var Xe=e=>e==null||e===!0?"":String(e),fi=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=Xe(t);r.setValue({value:n}),r.closePopover({}),i(new CustomEvent("value-change",{detail:{value:n},bubbles:!0})),s()},dp=e=>{let{store:t,props:r}=e;if(r.value!==void 0){let s=Xe(r.value);t.setValue({value:s}),t.setTempValue({value:s})}},fp=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e;if(r?.value!==s?.value){let l=Xe(s?.value);i.setValue({value:l}),i.getState().isOpen||i.setTempValue({value:l})}n()},hp=(e,t)=>{let{store:r,render:s,refs:i,props:n}=e;if(n.disabled)return;let a=t._event,l=Xe(n.value);r.setValue({value:l}),r.setTempValue({value:l}),r.openPopover({position:{x:a.currentTarget.getBoundingClientRect().left,y:a.currentTarget.getBoundingClientRect().bottom}}),s(),setTimeout(()=>{let{input:p}=i;if(!p)return;p.value=l,p.focus();let o=p.shadowRoot?.querySelector("input, textarea");o&&typeof o.focus=="function"&&o.focus()},50)},mp=(e,t)=>{let{store:r,render:s}=e;r.closePopover({}),s()},yp=(e,t)=>{let{store:r}=e,s=t._event,i=Xe(s.detail.value);r.setTempValue({value:i})},gp=e=>{let{store:t,refs:r}=e,{input:s}=r,i=s?s.value:t.getState().tempValue;fi(e,i)},bp=(e,t)=>{let{store:r,refs:s}=e,i=t._event;if(i.key==="Enter"){i.preventDefault(),i.stopPropagation();let{input:n}=s,a=n?n.value:r.getState().tempValue;fi(e,a)}else i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),r.closePopover({}),e.render())};var hi={componentName:"rtgl-popover-input",propsSchema:{type:"object",properties:{value:{type:"string"},placeholder:{type:"string"},label:{type:"string"},autoFocus:{type:"boolean"},disabled:{type:"boolean",default:!1}}},events:{"value-change":{}},methods:{type:"object",properties:{}}};var _r={};R(_r,{closePopover:()=>Ep,createInitialState:()=>vp,openPopover:()=>xp,selectValue:()=>kp,selectViewData:()=>wp,setTempValue:()=>_p,setValue:()=>Ap});var vp=()=>Object.freeze({isOpen:!1,position:{x:0,y:0},value:"",tempValue:""}),wp=({props:e,state:t})=>{let r=typeof t.value=="string"&&t.value.length>0,s=r?t.value:"-",i=typeof e.placeholder=="string"?e.placeholder:"",n=typeof e.label=="string"?e.label:"",a=!!e.disabled;return{isOpen:t.isOpen,position:t.position,value:s,valueColor:r?"fg":"mu-fg",tempValue:t.tempValue,placeholder:i,label:n,disabled:a}},_p=({state:e},t={})=>{e.tempValue=t.value},xp=({state:e},t={})=>{let{position:r}=t;e.position=r,e.isOpen=!0,e.hasUnsavedChanges=!1},Ep=({state:e})=>{e.isOpen=!1,e.tempValue=""},Ap=({state:e},t={})=>{e.value=t.value},kp=({state:e})=>e.value;var mi={refs:{textDisplay:{eventListeners:{click:{handler:"handleTextClick"}}},popover:{eventListeners:{close:{handler:"handlePopoverClose"}}},input:{eventListeners:{"value-input":{handler:"handleInputChange"},keydown:{handler:"handleInputKeydown"}}},submit:{eventListeners:{click:{handler:"handleSubmitClick"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#textDisplay w=f cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=${valueColor}",value:{type:1,path:"value"},parsedKey:{type:2,parts:["rtgl-text c=",{type:1,path:"valueColor"}]}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view g=md w=240 slot=content bgc=mu br=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"label"}}],fast:!0},{type:8,properties:[{key:"rtgl-input#input w=f placeholder=${placeholder} ?disabled=${disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f placeholder=",{type:1,path:"placeholder"}," ?disabled=",{type:1,path:"disabled"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#submit ?disabled=${disabled}",value:{type:0,value:"Submit"},parsedKey:{type:2,parts:["rtgl-button#submit ?disabled=",{type:1,path:"disabled"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"isOpen"}," x=",{type:1,path:"position.x"}," y=",{type:1,path:"position.y"}]}}],fast:!0}],fast:!0}};var xr={};R(xr,{handleAddOptionClick:()=>Np,handleAddOptionMouseEnter:()=>Vp,handleAddOptionMouseLeave:()=>Pp,handleBeforeMount:()=>$p,handleButtonClick:()=>Cp,handleClearClick:()=>Rp,handleClickOptionsPopoverOverlay:()=>Ip,handleOnUpdate:()=>Sp,handleOptionClick:()=>Op,handleOptionMouseEnter:()=>Tp,handleOptionMouseLeave:()=>Lp});var $p=e=>{let{store:t,props:r,render:s}=e;if(r.selectedValue!==null&&r.selectedValue!==void 0&&r.options){let i=r.options.find(n=>Ee(n.value,r.selectedValue));i&&(t.updateSelectedValue({value:i?.value}),s())}},Sp=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e,a=!1;s?.disabled&&!r?.disabled&&(i.closeOptionsPopover({}),a=!0),r.selectedValue!==s.selectedValue&&(i.updateSelectedValue({value:s.selectedValue}),a=!0),a&&n()},Cp=(e,t)=>{let{store:r,render:s,refs:i,props:n}=e;if(n.disabled)return;t._event.stopPropagation();let l=i.selectButton,p=l.firstElementChild,o=p?p.getBoundingClientRect():l.getBoundingClientRect(),u=r.selectSelectedValue(),c=u!==null?u:n.selectedValue,d=null;c!=null&&n.options&&(d=n.options.findIndex(h=>Ee(h.value,c)),d===-1&&(d=null)),r.openOptionsPopover({position:{y:o.bottom+12,x:o.left-24},selectedIndex:d}),s()},Ip=e=>{let{store:t,render:r}=e;t.closeOptionsPopover({}),r()},Op=(e,t)=>{let{render:r,dispatchEvent:s,props:i,store:n}=e;if(i.disabled)return;let a=t._event;a.stopPropagation();let l=a.currentTarget.id.slice(6),p=Number(l),o=i.options[l];n.updateSelectedValue({value:o?.value}),i.onChange&&typeof i.onChange=="function"&&i.onChange(o.value),s(new CustomEvent("value-change",{detail:{value:o.value,label:o.label,index:p,item:o},bubbles:!0})),r()},Tp=(e,t)=>{let{store:r,render:s}=e,i=t._event,n=parseInt(i.currentTarget.id.slice(6),10);r.setHoveredOption({optionId:n}),s()},Lp=(e,t)=>{let{store:r,render:s}=e;r.clearHoveredOption({}),s()},Rp=(e,t)=>{let{store:r,render:s,dispatchEvent:i,props:n}=e;if(n.disabled)return;t._event.stopPropagation(),r.clearSelectedValue({}),n.onChange&&typeof n.onChange=="function"&&n.onChange(void 0),i(new CustomEvent("value-change",{detail:{value:void 0,label:void 0,index:null,item:void 0},bubbles:!0})),s()},Np=(e,t)=>{if(e.props.disabled)return;let{store:r,render:s,dispatchEvent:i}=e,{_event:n}=t;n.stopPropagation(),r.closeOptionsPopover({}),i(new CustomEvent("add-option-click",{bubbles:!0})),s()},Vp=(e,t)=>{let{store:r,render:s}=e;r.setHoveredAddOption({isHovered:!0}),s()},Pp=(e,t)=>{let{store:r,render:s}=e;r.setHoveredAddOption({isHovered:!1}),s()};var yi={componentName:"rtgl-select",propsSchema:{type:"object",properties:{placeholder:{type:"string"},options:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"any"},testId:{type:"string"}}}},selectedValue:{type:"any"},onChange:{type:"function"},noClear:{type:"boolean"},addOption:{type:"object",properties:{label:{type:"string"}}},disabled:{type:"boolean"},w:{type:"string"}}},events:{"value-change":{},"add-option-click":{}},methods:{type:"object",properties:{}}};var Er={};R(Er,{clearHoveredOption:()=>qp,clearSelectedValue:()=>Jp,closeOptionsPopover:()=>Up,createInitialState:()=>jp,openOptionsPopover:()=>zp,resetSelection:()=>Hp,selectSelectedValue:()=>Wp,selectState:()=>Mp,selectViewData:()=>Fp,setHoveredAddOption:()=>Yp,setHoveredOption:()=>Gp,updateSelectedValue:()=>Kp});var Dp=["id","class","style","slot","placeholder","selectedValue","onChange","options","noClear","addOption","disabled"],Bp=(e={})=>Object.entries(e).filter(([t])=>!Dp.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),jp=()=>Object.freeze({isOpen:!1,position:{x:0,y:0},selectedValue:null,hoveredOptionId:null,hoveredAddOption:!1}),Fp=({state:e,props:t})=>{let r=Bp(t),s=!!t.disabled,n=Object.prototype.hasOwnProperty.call(t||{},"selectedValue")?t.selectedValue:e.selectedValue,a=t.placeholder||"Select an option",l=!0,p=t.options||[],o=p.find(c=>Ee(c.value,n));o&&(a=o.label,l=!1);let u=p.map((c,d)=>{let h=Ee(c.value,n),f=e.hoveredOptionId===d;return{...c,isSelected:h,bgc:f?"ac":h?"mu":""}});return{containerAttrString:r,isDisabled:s,isOpen:e.isOpen,position:e.position,options:u,selectedValue:n,selectedLabel:a,selectedLabelColor:l?"mu-fg":"fg",hasValue:n!=null,showClear:!s&&!t.noClear&&n!=null,showAddOption:!s&&!!t.addOption,addOptionLabel:t.addOption?.label?`+ ${t.addOption.label}`:"+ Add",addOptionBgc:e.hoveredAddOption?"ac":""}},Mp=({state:e})=>e,Wp=({state:e})=>e.selectedValue,zp=({state:e},t={})=>{let{position:r,selectedIndex:s}=t;e.position=r,e.isOpen=!0,s!=null&&(e.hoveredOptionId=s)},Up=({state:e})=>{e.isOpen=!1},Kp=({state:e},t={})=>{e.selectedValue=t.value,e.isOpen=!1},Hp=({state:e})=>{e.selectedValue=void 0},Gp=({state:e},t={})=>{e.hoveredOptionId=t.optionId},qp=({state:e})=>{e.hoveredOptionId=null},Jp=({state:e})=>{e.selectedValue=void 0},Yp=({state:e},t={})=>{e.hoveredAddOption=!!t.isHovered};var gi={refs:{selectButton:{eventListeners:{click:{handler:"handleButtonClick"}}},clearButton:{eventListeners:{click:{handler:"handleClearClick"}}},popover:{eventListeners:{close:{handler:"handleClickOptionsPopoverOverlay"}}},"option*":{eventListeners:{click:{handler:"handleOptionClick"},mouseenter:{handler:"handleOptionMouseEnter"},mouseleave:{handler:"handleOptionMouseLeave"}}},optionAdd:{eventListeners:{click:{handler:"handleAddOptionClick"},mouseenter:{handler:"handleAddOptionMouseEnter"},mouseleave:{handler:"handleAddOptionMouseLeave"}}}},template:{type:9,items:[{type:8,properties:[{key:'rtgl-button#selectButton v=ol ${containerAttrString} ?disabled=${isDisabled} data-testid="select-button"',value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c ah=s w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text w=1fg ta=s c=${selectedLabelColor} ellipsis",value:{type:1,path:"selectedLabel"},parsedKey:{type:2,parts:["rtgl-text w=1fg ta=s c=",{type:1,path:"selectedLabelColor"}," ellipsis"]}}],fast:!0},{type:8,properties:[{key:"$if showClear",value:{type:6,conditions:[{type:1,path:"showClear"}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-svg#clearButton ml=md svg=x wh=16 c=mu-fg cur=pointer data-testid="select-clear-button"',value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-svg ml=md svg=chevronDown wh=16 c=mu-fg",value:{type:0,value:null}}],fast:!0}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-button#selectButton v=ol ",{type:1,path:"containerAttrString"}," ?disabled=",{type:1,path:"isDisabled"},' data-testid="select-button"']}}],fast:!1},{type:8,properties:[{key:"rtgl-popover#popover ?open=${isOpen} x=${position.x} y=${position.y} place=rs",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=mu br=md sv=true",value:{type:9,items:[{type:7,itemVar:"option",indexVar:"i",iterable:{type:1,path:"options"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#option${i} w=f ph=lg pv=md cur=pointer br=md bgc=${option.bgc} data-testid=${option.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=s",value:{type:1,path:"option.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option",{type:1,path:"i"}," w=f ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"option.bgc"}," data-testid=",{type:1,path:"option.testId"}]}}],fast:!0}],fast:!0}},{type:8,properties:[{key:"$if showAddOption",value:{type:6,conditions:[{type:1,path:"showAddOption"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f bw=xs bc=mu bwt=sm",value:{type:0,value:null}}],fast:!0},{type:8,properties:[{key:'rtgl-view#optionAdd w=f ph=lg pv=md cur=pointer br=md bgc=${addOptionBgc} data-testid="select-add-option"',value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=ac",value:{type:1,path:"addOptionLabel"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#optionAdd w=f ph=lg pv=md cur=pointer br=md bgc=",{type:1,path:"addOptionBgc"},' data-testid="select-add-option"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"isOpen"}," x=",{type:1,path:"position.x"}," y=",{type:1,path:"position.y"}," place=rs"]}}],fast:!1}],fast:!1}};var Ar={};R(Ar,{handleHeaderClick:()=>Xp,handleItemClick:()=>Zp});var Xp=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n,a=r.selectHeader();i.currentTarget.id==="headerLabel"?n=a.labelPath:i.currentTarget.id==="headerImage"?n=a.image.path:i.currentTarget.id==="header"&&(n=a.path),s(new CustomEvent("header-click",{detail:{path:n},bubbles:!0,composed:!0}))},Zp=(e,t)=>{let{store:r,dispatchEvent:s}=e,i=t._event,n=i.currentTarget.dataset.itemId||i.currentTarget.id.slice(4),a=r.selectItem(n);s(new CustomEvent("item-click",{detail:{item:a},bubbles:!0,composed:!0}))};var bi={componentName:"rtgl-sidebar",propsSchema:{type:"object",properties:{mode:{type:"string"},hideHeader:{type:"boolean",default:!1},w:{type:"string"},bwr:{type:"string"},selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{type:"string"},testId:{type:"string"},image:{type:"object",properties:{src:{type:"string"},width:{type:"number"},height:{type:"number"},alt:{type:"string"}}}}},items:{type:"array",items:{type:"object",properties:{title:{type:"string"},slug:{type:"string"},type:{type:"string"},items:{type:"array"},testId:{type:"string"}}}}}},events:{"header-click":{type:"object",properties:{path:{type:"string"}}},"item-click":{type:"object",properties:{item:{type:"object"}}}},methods:{type:"object",properties:{}}};var $r={};R($r,{createInitialState:()=>Qp,selectActiveItem:()=>ac,selectHeader:()=>nc,selectItem:()=>oc,selectViewData:()=>ic,setState:()=>lc});var Qp=()=>Object.freeze({}),ec=["id","class","style","slot","header","items","selectedItemId","mode","hideHeader","w","bwr"],tc=(e={})=>Object.entries(e).filter(([t])=>!ec.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ze=e=>{if(e!=null){if(typeof e=="object")return e;if(typeof e=="string")try{return JSON.parse(decodeURIComponent(e))}catch{try{return JSON.parse(e)}catch{return}}}},rc=e=>{if(e===!0)return!0;if(e===!1||e===void 0||e===null)return!1;if(typeof e=="string"){let t=e.trim().toLowerCase();return t===""||t==="true"}return!1},sc=(e,t)=>e!=null&&e!==""?e:t==="full"?272:64;function kr(e,t=null){let r=[];for(let s of e){let i=s.id||s.href||s.path,n=t===i;if(r.push({id:i,title:s.title,href:s.href,type:s.type||"item",icon:s.icon,hrefAttr:s.href?`href=${s.href}`:"",isSelected:n,itemBgc:n?"ac":"bg",itemHoverBgc:n?"ac":"mu"}),s.items&&Array.isArray(s.items))for(let a of s.items){let l=a.id||a.href||a.path,p=t===l;r.push({id:l,title:a.title,href:a.href,type:a.type||"item",icon:a.icon,hrefAttr:a.href?`href=${a.href}`:"",isSelected:p,itemBgc:p?"ac":"bg",itemHoverBgc:p?"ac":"mu"})}}return r}var ic=({props:e})=>{let t=Ze(e.header)||e.header,r=Ze(e.items)||e.items,s=e.selectedItemId,i=tc(e),n=e.mode||"full",a=t||{label:"",path:"",image:{src:"",alt:"",width:0,height:0}},l=r?kr(r,s):[],p=!rc(e.hideHeader),o=e.bwr||"xs",u=sc(e.w,n),c=n==="full"?"fs":"c",d=n==="full"?"fs":"c",h=n==="full"?"lg":"sm",f=n==="full"?"md":"sm",m=n==="shrunk-lg"?48:40,g=n==="shrunk-lg"?28:20,y=n==="shrunk-lg"?"md":"sm",w=n==="full",_=n==="full",x=n==="full"?"fs":"c",E=n==="full"?"":`ah=${d}`,A=n==="full"?"f":m;return{containerAttrString:i,mode:n,header:a,items:l,sidebarWidth:u,headerAlign:c,itemAlign:d,headerPadding:h,itemPadding:f,itemHeight:m,iconSize:g,firstLetterSize:y,showLabels:w,showGroupLabels:_,itemContentAlign:x,itemAlignAttr:E,itemWidth:A,headerWidth:A,selectedItemId:s,ah:n==="shrunk-lg"||n==="shrunk-md"?"c":"",showHeader:p,rightBorderWidth:o}},nc=({props:e})=>Ze(e.header)||e.header,ac=({state:e,props:t})=>{let r=Ze(t.items)||t.items;return(r?kr(r):[]).find(i=>i.active)},oc=({props:e},t)=>{let r=Ze(e.items)||e.items;return(r?kr(r):[]).find(i=>i.id===t)},lc=({state:e})=>{};var vi={refs:{headerImage:{eventListeners:{click:{handler:"handleHeaderClick"}}},headerLabel:{eventListeners:{click:{handler:"handleHeaderClick"}}},header:{eventListeners:{click:{handler:"handleHeaderClick"}}},"item*":{eventListeners:{click:{handler:"handleItemClick"}}}},anchors:[[{"$if header.image && header.image.src":[{"$if header.image.href":[{"a href=${header.image.href}":[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}],"$elif header.image.path":[{"rtgl-view#headerImage cur=pointer":[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}],$else:[{'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"':null}]}]},{"$if header.label && showLabels":[{"$if header.labelHref":[{"rtgl-text href=${header.labelHref} s=lg":"${header.label}"}],"$elif header.labelPath":[{"rtgl-view#headerLabel cur=pointer":[{"rtgl-text s=lg":"${header.label}"}]}],$else:[{"rtgl-text s=lg":"${header.label}"}]}]}]],template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=${sidebarWidth} d=v bwr=${rightBorderWidth} ah=${ah} ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if showHeader",value:{type:6,conditions:[{type:1,path:"showHeader"}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view ph=${headerPadding} pv=lg",value:{type:9,items:[{type:8,properties:[{key:"$if header.href",value:{type:6,conditions:[{type:1,path:"header.href"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view href=${header.href} d=h av=c ah=${headerAlign} g=lg w=${headerWidth}",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"$if header.image && header.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.image"},right:{type:1,path:"header.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.image.href",value:{type:6,conditions:[{type:1,path:"header.image.href"},{type:1,path:"header.image.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${header.image.href}",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a href=",{type:1,path:"header.image.href"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#headerImage cur=pointer",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if header.label && showLabels",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.label"},right:{type:1,path:"showLabels"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.labelHref",value:{type:6,conditions:[{type:1,path:"header.labelHref"},{type:1,path:"header.labelPath"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text href=${header.labelHref} s=lg",value:{type:1,path:"header.label"},parsedKey:{type:2,parts:["rtgl-text href=",{type:1,path:"header.labelHref"}," s=lg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#headerLabel cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view href=",{type:1,path:"header.href"}," d=h av=c ah=",{type:1,path:"headerAlign"}," g=lg w=",{type:1,path:"headerWidth"}]}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#header d=h av=c ah=${headerAlign} g=lg w=${headerWidth} cur=pointer data-testid=${header.testId}",value:{type:9,items:[{type:9,items:[{type:8,properties:[{key:"$if header.image && header.image.src",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.image"},right:{type:1,path:"header.image.src"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.image.href",value:{type:6,conditions:[{type:1,path:"header.image.href"},{type:1,path:"header.image.path"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"a href=${header.image.href}",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["a href=",{type:1,path:"header.image.href"}]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#headerImage cur=pointer",value:{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'rtgl-image w=${header.image.width} h=${header.image.height} src=${header.image.src} alt="${header.image.alt}"',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image w=",{type:1,path:"header.image.width"}," h=",{type:1,path:"header.image.height"}," src=",{type:1,path:"header.image.src"},' alt="',{type:1,path:"header.image.alt"},'"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"$if header.label && showLabels",value:{type:6,conditions:[{type:4,op:6,left:{type:1,path:"header.label"},right:{type:1,path:"showLabels"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"$if header.labelHref",value:{type:6,conditions:[{type:1,path:"header.labelHref"},{type:1,path:"header.labelPath"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text href=${header.labelHref} s=lg",value:{type:1,path:"header.label"},parsedKey:{type:2,parts:["rtgl-text href=",{type:1,path:"header.labelHref"}," s=lg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#headerLabel cur=pointer",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-text s=lg",value:{type:1,path:"header.label"}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#header d=h av=c ah=",{type:1,path:"headerAlign"}," g=lg w=",{type:1,path:"headerWidth"}," cur=pointer data-testid=",{type:1,path:"header.testId"}]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view ph=",{type:1,path:"headerPadding"}," pv=lg"]}}],fast:!1}],fast:!1}],id:null}}],fast:!1},{type:8,properties:[{key:"rtgl-view w=f h=1fg sv ph=${headerPadding} pb=lg g=xs ah=${ah}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:'$if item.type == "groupLabel"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"groupLabel"}},null],bodies:[{type:9,items:[{type:8,properties:[{key:"$if showGroupLabels",value:{type:6,conditions:[{type:1,path:"showGroupLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view mt=md h=32 av=c ph=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=xs c=mu-fg",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view mt=md h=1 bgc=mu",value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item${i} data-item-id=${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=pointer data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"$if item.icon",value:{type:6,conditions:[{type:1,path:"item.icon"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"$if showLabels",value:{type:6,conditions:[{type:1,path:"showLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=${itemContentAlign} g=sm",value:{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${item.icon} c=fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"item.icon"}," c=fg"]}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=h ah=",{type:1,path:"itemContentAlign"}," g=sm"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=${iconSize} svg=${item.icon} c=fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=",{type:1,path:"iconSize"}," svg=",{type:1,path:"item.icon"}," c=fg"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"$if showLabels",value:{type:6,conditions:[{type:1,path:"showLabels"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"item.title"}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=${iconSize} br=f bgc=mu av=c ah=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=${firstLetterSize} c=fg",value:{type:1,path:"item.title.charAt(0).toUpperCase()"},parsedKey:{type:2,parts:["rtgl-text s=",{type:1,path:"firstLetterSize"}," c=fg"]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view wh=",{type:1,path:"iconSize"}," br=f bgc=mu av=c ah=c"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view#item",{type:1,path:"i"}," data-item-id=",{type:1,path:"item.id"}," ",{type:1,path:"item.hrefAttr"}," h=",{type:1,path:"itemHeight"}," av=c ",{type:1,path:"itemAlignAttr"}," ph=",{type:1,path:"itemPadding"}," w=",{type:1,path:"itemWidth"}," h-bgc=",{type:1,path:"item.itemHoverBgc"}," br=lg bgc=",{type:1,path:"item.itemBgc"}," cur=pointer data-testid=",{type:1,path:"item.testId"}]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f h=1fg sv ph=",{type:1,path:"headerPadding"}," pb=lg g=xs ah=",{type:1,path:"ah"}]}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view h=f w=",{type:1,path:"sidebarWidth"}," d=v bwr=",{type:1,path:"rightBorderWidth"}," ah=",{type:1,path:"ah"}," ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Sr={};R(Sr,{handleBeforeMount:()=>pc,handleOnUpdate:()=>cc,handleValueChange:()=>uc,handleValueInput:()=>dc});var pc=e=>{let{store:t,props:r}=e;t.setValue({value:r.value??0})},cc=(e,t)=>{let{oldProps:r,newProps:s}=t,{store:i,render:n}=e,a=r?.key!==s?.key,l=r?.value!==s?.value;if(a||l){let p=s?.value??0;i.setValue({value:p}),n()}},uc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=t._event,a=Number(n.detail.value),p=(typeof n.composedPath=="function"?n.composedPath():[]).find(o=>o?.tagName==="RTGL-SLIDER-INPUT")||n.currentTarget?.getRootNode?.()?.host;r.setValue({value:a}),p&&typeof p.setAttribute=="function"&&p.setAttribute("value",String(a)),s(),i(new CustomEvent("value-change",{detail:{value:a},bubbles:!0}))},dc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,n=t._event,a=Number(n.detail.value),p=(typeof n.composedPath=="function"?n.composedPath():[]).find(o=>o?.tagName==="RTGL-SLIDER-INPUT")||n.currentTarget?.getRootNode?.()?.host;r.setValue({value:a}),p&&typeof p.setAttribute=="function"&&p.setAttribute("value",String(a)),s(),i(new CustomEvent("value-input",{detail:{value:a},bubbles:!0}))};var wi={componentName:"rtgl-slider-input",propsSchema:{type:"object",properties:{key:{type:"string"},value:{type:"string",default:"0"},w:{type:"string",default:""},min:{type:"string",default:"0"},max:{type:"string",default:"100"},step:{type:"string",default:"1"},disabled:{type:"boolean",default:!1}}},events:{"value-input":{},"value-change":{}},methods:{type:"object",properties:{}}};var Cr={};R(Cr,{createInitialState:()=>fc,selectViewData:()=>hc,setValue:()=>mc});var fc=()=>Object.freeze({value:0}),hc=({state:e,props:t})=>({key:t.key,value:e.value,w:t.w||"",min:t.min||0,max:t.max||100,step:t.step||1,disabled:!!t.disabled}),mc=({state:e},t={})=>{e.value=t.value};var _i={refs:{input:{eventListeners:{"value-input":{handler:"handleValueInput"},"value-change":{handler:"handleValueChange"}}},slider:{eventListeners:{"value-change":{handler:"handleValueChange"},"value-input":{handler:"handleValueInput"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h av=c g=md w=${w}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-slider#slider key=${key} w=f type=range min=${min} max=${max} step=${step} value=${value} ?disabled=${disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider key=",{type:1,path:"key"}," w=f type=range min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}," ?disabled=",{type:1,path:"disabled"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=84",value:{type:9,items:[{type:8,properties:[{key:"rtgl-input-number#input key=${key} w=f min=${min} max=${max} step=${step} value=${value} ?disabled=${disabled}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input-number#input key=",{type:1,path:"key"}," w=f min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}," ?disabled=",{type:1,path:"disabled"}]}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view d=h av=c g=md w=",{type:1,path:"w"}]}}],fast:!0}],fast:!0}};var Ir={};R(Ir,{handleBeforeMount:()=>yc,handleHeaderClick:()=>bc,handleRowClick:()=>gc});var yc=e=>{},gc=(e,t)=>{let{dispatchEvent:r,props:s}=e,i=t._event,n=parseInt(i.currentTarget.id.slice(3),10),a=s.data?.rows?.[n];a&&r(new CustomEvent("row-click",{detail:{rowIndex:n,rowData:a}}))},bc=(e,t)=>{let{store:r,render:s,dispatchEvent:i}=e,a=t._event.currentTarget.dataset.columnKey,l=r.selectSortInfo(),p="asc";l.column===a&&(l.direction==="asc"?p="desc":l.direction==="desc"&&(p=null)),p?r.setSortColumn({column:a,direction:p}):r.clearSort(),s(),i(new CustomEvent("header-click",{detail:{column:a,direction:p,sortInfo:p?{column:a,direction:p}:null}}))};var xi={componentName:"rtgl-table",propsSchema:{type:"object",properties:{data:{type:"object",properties:{columns:{type:"array",items:{type:"object",properties:{key:{type:"string"},label:{type:"string"}}}},rows:{type:"array",items:{type:"object"}}}},responsive:{type:"boolean",default:!0}}},events:{},methods:{type:"object",properties:{}}};var Or={};R(Or,{clearSort:()=>Sc,createInitialState:()=>vc,selectSortInfo:()=>kc,selectState:()=>Ac,selectViewData:()=>Ec,setSortColumn:()=>$c});var vc=()=>Object.freeze({sortColumn:null,sortDirection:null}),wc=["id","class","style","slot","data"],_c=(e={})=>Object.entries(e).filter(([t])=>!wc.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),xc=(e,t)=>{let r=t.split("."),s=e;for(let i of r){if(s==null)return null;s=s[i]}return s},Ec=({state:e,props:t})=>{let r=_c(t),s=t.data||{columns:[],rows:[]},i=s.rows.map((n,a)=>{let l=s.columns.map(p=>{let o=xc(n,p.key);return{key:p.key,value:o!=null?String(o):""}});return{index:a,cells:l}});return{containerAttrString:r,columns:s.columns||[],rows:i||[]}},Ac=({state:e})=>e,kc=({state:e})=>({column:e.sortColumn,direction:e.sortDirection}),$c=({state:e},{column:t,direction:r}={})=>{e.sortColumn=t,e.sortDirection=r},Sc=({state:e})=>{e.sortColumn=null,e.sortDirection=null};var Ei={refs:{"row*":{eventListeners:{click:{handler:"handleRowClick"}}},"header*":{eventListeners:{click:{handler:"handleHeaderClick"}}}},styles:{table:{width:"100%","border-collapse":"collapse","border-spacing":0},thead:{"border-bottom":"2px solid var(--border)"},th:{padding:"12px","text-align":"left","font-weight":500,color:"var(--foreground)","background-color":"var(--muted)",cursor:"pointer",position:"sticky",top:0,"z-index":1},"tbody tr":{"border-bottom":"1px solid var(--border)"},"tbody tr:last-child":{"border-bottom":"none"},td:{padding:"12px",color:"var(--foreground)"},".table-container":{width:"100%",height:"100%",overflow:"auto"},".empty-state":{"text-align":"center",padding:"24px",color:"var(--muted-foreground)"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view.table-container ${containerAttrString}",value:{type:9,items:[{type:8,properties:[{key:"$if rows.length > 0",value:{type:6,conditions:[{type:4,op:2,left:{type:1,path:"rows.length"},right:{type:0,value:0}},null],bodies:[{type:9,items:[{type:8,properties:[{key:"table",value:{type:9,items:[{type:8,properties:[{key:"thead",value:{type:9,items:[{type:8,properties:[{key:"tr",value:{type:9,items:[{type:7,itemVar:"column",indexVar:"i",iterable:{type:1,path:"columns"},body:{type:9,items:[{type:8,properties:[{key:"th#header${i} data-column-key=${column.key}",value:{type:1,path:"column.label"},parsedKey:{type:2,parts:["th#header",{type:1,path:"i"}," data-column-key=",{type:1,path:"column.key"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1},{type:8,properties:[{key:"tbody",value:{type:9,items:[{type:7,itemVar:"row",indexVar:"rowIndex",iterable:{type:1,path:"rows"},body:{type:9,items:[{type:8,properties:[{key:"tr#row${rowIndex}",value:{type:9,items:[{type:7,itemVar:"cell",indexVar:"cellIndex",iterable:{type:1,path:"row.cells"},body:{type:9,items:[{type:8,properties:[{key:"td",value:{type:1,path:"cell.value"}}],fast:!0}],fast:!0}}],fast:!1},parsedKey:{type:2,parts:["tr#row",{type:1,path:"rowIndex"}]}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},{type:9,items:[{type:8,properties:[{key:"rtgl-view.empty-state w=f p=xl",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:0,value:"No data available"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view.table-container ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Tr={};R(Tr,{handleClickItem:()=>Cc});var Cc=(e,t)=>{let{dispatchEvent:r}=e,i=t._event.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:i}}))};var Ai={componentName:"rtgl-tabs",propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},testId:{type:"string"}}}},selectedTab:{type:"string"}}},events:{"item-click":{type:"object",properties:{id:{type:"string"}}}},methods:{type:"object",properties:{}}};var Lr={};R(Lr,{createInitialState:()=>Ic,selectViewData:()=>Lc});var Ic=()=>Object.freeze({}),Oc=["id","class","style","slot","items","selectedTab"],Tc=(e={})=>Object.entries(e).filter(([t])=>!Oc.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Lc=({props:e})=>{let t=Tc(e),r=e.items||[],s=e.selectedTab,i=r.map(n=>({...n,isSelected:n.id===s,bgColor:n.id===s?"ac":"",borderColor:n.id===s?"":"tr",textColor:n.id===s?"":"mu-fg"}));return{containerAttrString:t,items:i,selectedTab:s}};var ki={refs:{"tab*":{eventListeners:{click:{handler:"handleClickItem"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h g=sm bgc=mu p=sm br=lg ${containerAttrString}",value:{type:9,items:[{type:7,itemVar:"item",indexVar:"i",iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#tab${i} data-id=${item.id} cur=pointer bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg data-testid=${item.testId}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm c=${item.textColor}",value:{type:1,path:"item.label"},parsedKey:{type:2,parts:["rtgl-text s=sm c=",{type:1,path:"item.textColor"}]}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#tab",{type:1,path:"i"}," data-id=",{type:1,path:"item.id"}," cur=pointer bgc=",{type:1,path:"item.bgColor"}," bw=xs bc=",{type:1,path:"item.borderColor"}," pv=md ph=lg br=lg data-testid=",{type:1,path:"item.testId"}]}}],fast:!0}],fast:!0}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view d=h g=sm bgc=mu p=sm br=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var $i={};var Si={componentName:"rtgl-tooltip",propsSchema:{type:"object",properties:{open:{type:"boolean"},x:{type:"string"},y:{type:"string"},place:{type:"string"},content:{type:"string"}}},events:[],methods:{type:"object",properties:{}}};var Rr={};R(Rr,{createInitialState:()=>Rc,selectViewData:()=>Nc});var Rc=()=>Object.freeze({}),Nc=({props:e})=>({open:!!e.open,x:e.x||0,y:e.y||0,place:e.place||"t",content:e.content||""});var Ci={template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} place=${place} no-overlay",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view slot=content bgc=bg bc=bo br=md p=sm ah=c av=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text ta=c s=sm c=fg",value:{type:1,path:"content"}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-popover#popover ?open=",{type:1,path:"open"}," x=",{type:1,path:"x"}," y=",{type:1,path:"y"}," place=",{type:1,path:"place"}," no-overlay"]}}],fast:!0}],fast:!0},refs:{}};var Nr={};R(Nr,{handleAfterMount:()=>Vc,handleOnUpdate:()=>Pc});var Vc=async e=>{let{props:t,store:r,render:s,refs:i}=e,{waveformData:n}=t;r.setWaveformData({data:n}),s();let a=i.canvas;a&&Ii(n,a)},Pc=async(e,t)=>{let{store:r,render:s,refs:i,props:n}=e,{waveformData:a}=n;if(!a){console.log("waveform handleOnUpdate: no waveformData provided");return}r.setWaveformData({data:a}),s();let l=i.canvas;l&&Ii(a,l)};async function Ii(e,t){let r=t.getContext("2d"),s=t.getBoundingClientRect(),i=s.width,n=s.height;t.width=i,t.height=n;let a=t.width,l=t.height;if(r.clearRect(0,0,a,l),r.fillStyle="#1a1a1a",r.fillRect(0,0,a,l),!e||!e.amplitudes)return;let p=e.amplitudes,o=l/2,u=r.createLinearGradient(0,0,0,l);u.addColorStop(0,"#404040"),u.addColorStop(.5,"#A1A1A1"),u.addColorStop(1,"#404040");let c=Math.max(1,a/p.length),d=.2;for(let h=0;h<p.length;h++){let m=p[h]/255*(l*.85),g=h*c,y=o-m/2;r.fillStyle=u,r.fillRect(g,y,Math.max(1,c*(1-d)),m)}r.strokeStyle="rgba(255, 255, 255, 0.1)",r.lineWidth=1,r.beginPath(),r.moveTo(0,o),r.lineTo(a,o),r.stroke(),r.shadowBlur=10,r.shadowColor="#2196F3"}var Oi={componentName:"rtgl-waveform",propsSchema:{type:"object",properties:{w:{type:"string",description:"Width of the waveform visualizer",default:"250"},h:{type:"string",description:"Height of the waveform visualizer",default:"150"},cur:{type:"string",description:"cursor"},waveformData:{type:"object",description:"File ID of the waveform data in object storage"},isLoading:{type:"boolean",description:"Whether the waveform data is currently being loaded"}}},events:[],methods:{type:"object",properties:{}}};var Vr={};R(Vr,{createInitialState:()=>Dc,selectViewData:()=>jc,setWaveformData:()=>Bc});var Dc=()=>Object.freeze({waveformData:null}),Bc=({state:e},t={})=>{e.waveformData=t.data},jc=({state:e,props:t})=>({isLoading:t.isLoading,w:t.w||"250",h:t.h||"150",cur:t.cur,waveformData:t.waveformData});var Ti={refs:{canvas:{selector:"canvas"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view pos=rel w=${w} h=${h} cur=${cur}",value:{type:9,items:[{type:8,properties:[{key:"$if isLoading",value:{type:6,conditions:[{type:1,path:"isLoading"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=f av=c ah=c",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:0,value:"..."}}],fast:!0}],fast:!0}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:'canvas#canvas style="width:100%; height:100%;"',value:{type:0,value:null}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view pos=rel w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," cur=",{type:1,path:"cur"}]}}],fast:!1}],fast:!1}};var Pr=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),dt=e=>e.replace(/-([a-z0-9])/g,(t,r)=>r.toUpperCase()),ut=e=>{if(e!=null)return e===""?!0:e},Li=(e,t)=>{let r=e.getAttribute(t);if(r!==null)return ut(r);let s=Pr(t);if(s!==t){let i=e.getAttribute(s);if(i!==null)return ut(i)}},Ri=(e,t)=>{let r=new Set(t);return new Proxy({},{get(s,i){if(typeof i=="string"&&r.has(i)){let n=e[i];return n!==void 0?n:Li(e,i)}},set(){throw new Error("Cannot assign to read-only proxy")},defineProperty(){throw new Error("Cannot define properties on read-only proxy")},deleteProperty(){throw new Error("Cannot delete properties from read-only proxy")},has(s,i){return typeof i=="string"&&r.has(i)},ownKeys(){return[...r]},getOwnPropertyDescriptor(s,i){if(typeof i=="string"&&r.has(i))return{configurable:!0,enumerable:!0,get:()=>{let n=e[i];return n!==void 0?n:Li(e,i)}}}})};var Ni=({schema:e,methodExports:t=[]})=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("componentName is required.");if(typeof e.componentName!="string"||e.componentName.trim()==="")throw new Error("componentName is required.");if(Object.prototype.hasOwnProperty.call(e,"attrsSchema"))throw new Error("attrsSchema is not supported.");if(Object.prototype.hasOwnProperty.call(e,"methods")){let r=e.methods;if(!r||typeof r!="object"||Array.isArray(r))throw new Error("methods must be an object schema with a properties map.");if(Object.prototype.hasOwnProperty.call(r,"type")&&r.type!=="object")throw new Error("methods.type must be 'object'.");if(!r.properties||typeof r.properties!="object"||Array.isArray(r.properties))throw new Error("methods.properties must be an object keyed by method name.");for(let s of Object.keys(r.properties))if(!t.includes(s))throw new Error(`method '${s}' is declared in schema but missing in .methods.js exports.`)}return!0};var b={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9,PARTIAL:10,PATH_REFERENCE:11},D={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8,ADD:10,SUBTRACT:11},Qe={NOT:0};var T=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},se=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var Dr=e=>{if(!e||e.trim()==="")throw new T("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new T(`Invalid comparison operator '${e.includes("===")?"===":"!=="}' - did you mean '${r}'? (got: '${e}')`)}let t=["<",">","<=",">=","==","!="];for(let r of t)if(e.trim().endsWith(r))throw new T(`Incomplete comparison expression - missing right operand (got: '${e}')`)},Vi=e=>{if(e.trim().endsWith(" in"))throw new T(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new T(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new T(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(t.includes(",")){let s=t.split(",").map(i=>i.trim());for(let i of s)if(!i)throw new T(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)}else if(!t.trim())throw new T(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)};var Pi=(e,t,r=!1)=>{if(t===null)return new se(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new se(`Cannot iterate over undefined value at '$for ${e}'`);let s=typeof t;return r?new se(`Cannot iterate over non-array value in loop '${e}' - got ${s} instead`):new se(`Cannot iterate over non-array value (got: ${s}) at '$for ${e}'`)},Di=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new se(`Unknown function '${e}' (${r})`)};var Fc=(e,t,r={})=>{let s={},i={};r&&typeof r=="object"&&(r.functions!==void 0||r.partials!==void 0?(s=r.functions||{},i=r.partials||{}):typeof r=="object"&&(s=r));let a=I(e,{functions:s,partials:i},t,{});return a===void 0?{}:a},I=(e,t,r,s)=>{let i=t.functions||t;if(e.var&&!e.type)return z(e.var,r,s);if(e.type===b.LITERAL)return e.value;if(e.type===b.VARIABLE)return z(e.path,r,s);if(e.type===b.INTERPOLATION)return Wc(e.parts,t,r,s);switch(e.type){case b.FUNCTION:return ji(e,t,r,s);case b.BINARY:return Fi(e,t,r,s);case b.UNARY:return Mi(e,t,r,s);case b.CONDITIONAL:return Uc(e,t,r,s);case b.LOOP:return Jc(e,t,r,s);case b.OBJECT:return Xc(e,t,r,s);case b.ARRAY:return Zc(e,t,r,s);case b.PARTIAL:return Qc(e,t,r,s);case b.PATH_REFERENCE:return eu(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},Bi=new Map,Mc=e=>{let t=[],r="",s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(n==="[")r&&(t.push({type:"property",value:r}),r=""),s=!0;else if(n==="]"){if(s&&r){let a=r.trim();if(/^\d+$/.test(a))t.push({type:"index",value:parseInt(a,10)});else if(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'")){let l=a.slice(1,-1);t.push({type:"property",value:l})}else t.push({type:"property",value:a});r=""}s=!1}else r+=n}return r&&t.push({type:"property",value:r}),t},z=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=Bi.get(e);if(!s){let n=[],a="",l=0;for(let p=0;p<e.length;p++){let o=e[p];o==="["?(l++,a+=o):o==="]"?(l--,a+=o):o==="."&&l===0?a&&(n.push(a),a=""):a+=o}a&&n.push(a),s=[];for(let p of n){let o=Mc(p.trim());s.push(...o)}Bi.set(e,s)}let i=t;for(let n=0;n<s.length;n++){let a=s[n];if(a.type==="property"&&a.value in r){i=r[a.value];continue}if(i==null)return;(a.type==="property"||a.type==="index")&&(i=i[a.value])}return i},Wc=(e,t,r,s)=>{let i=[];for(let n of e)if(typeof n=="string")i.push(n);else{let a=I(n,t,r,s);i.push(a!=null?String(a):"")}return i.join("")},ji=(e,t,r,s)=>{let i=t.functions||t,n=i[e.name];if(!n)throw Di(e.name,i);let a=e.args.map(l=>I(l,t,r,s));return n(...a)},Ne=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);switch(e.type){case b.VARIABLE:return z(e.path,r,s);case b.LITERAL:return e.value;case b.BINARY:return Fi(e,t,r,s);case b.UNARY:return Mi(e,t,r,s);case b.FUNCTION:return ji(e,t,r,s);default:return I(e,t,r,s)}},Fi=(e,t,r,s)=>{if(e.op===D.AND||e.op===D.OR){let a=Ne(e.left,t,r,s),l=Ne(e.right,t,r,s);switch(e.op){case D.AND:return a&&l;case D.OR:return a||l}}let i=I(e.left,t,r,s),n=I(e.right,t,r,s);switch(e.op){case D.EQ:return i==n;case D.NEQ:return i!=n;case D.GT:return i>n;case D.LT:return i<n;case D.GTE:return i>=n;case D.LTE:return i<=n;case D.IN:return Array.isArray(n)?n.includes(i):!1;case D.ADD:if(typeof i!="number"||typeof n!="number")throw new se(`Arithmetic operations require numbers. Got ${typeof i} + ${typeof n}`);return i+n;case D.SUBTRACT:if(typeof i!="number"||typeof n!="number")throw new se(`Arithmetic operations require numbers. Got ${typeof i} - ${typeof n}`);return i-n;default:throw new Error(`Unknown binary operator: ${e.op}`)}},Mi=(e,t,r,s)=>{let i=e.op===Qe.NOT?Ne(e.operand,t,r,s):I(e.operand,t,r,s);switch(e.op){case Qe.NOT:return!i;default:throw new Error(`Unknown unary operator: ${e.op}`)}},zc=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let i=e.conditions[0];if(i.type===b.VARIABLE)if(z(i.path,r,s)){let a=e.bodies[0];if(a.type===b.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?I(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===b.LITERAL)l[o]=u.value;else if(u.type===b.VARIABLE)l[o]=z(u.path,r,s);else if(u.type===b.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===b.VARIABLE){let h=z(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=I(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=I(u,t,r,s)}return l}}else{let a=e.bodies[1];if(a.type===b.OBJECT&&a.properties.length<=5){let l={};for(let p of a.properties){let o=p.parsedKey?I(p.parsedKey,t,r,s):p.key,u=p.value;if(u.type===b.LITERAL)l[o]=u.value;else if(u.type===b.VARIABLE)l[o]=z(u.path,r,s);else if(u.type===b.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===b.VARIABLE){let h=z(d.path,r,s);c.push(h!=null?String(h):"")}else{let h=I(d,t,r,s);c.push(h!=null?String(h):"")}l[o]=c.join("")}else l[o]=I(u,t,r,s)}return l}}}return null},Uc=(e,t,r,s)=>{let i=zc(e,t,r,s);if(i!==null)return i;for(let n=0;n<e.conditions.length;n++){let a=e.conditions[n];if(a===null||Ne(a,t,r,s))return I(e.bodies[n],t,r,s)}return Wi},Kc=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===b.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===b.VARIABLE){let i=r.conditions[0].path,n=r.bodies[0];if(i.startsWith(s+".")){let a=i.substring(s.length+1);if(n.type===b.OBJECT&&n.properties.length<=5){for(let p of n.properties)if(p.parsedKey)return null;let l=[];for(let p=0;p<t.length;p++){let o=t[p];if(o[a]){let u={};for(let c of n.properties){let d=c.key,h=c.value;if(h.type===b.LITERAL)u[d]=h.value;else if(h.type===b.VARIABLE){let f=h.path;if(f===s)u[d]=o;else if(f.startsWith(s+".")){let m=f.substring(s.length+1);u[d]=o[m]}else return null}else if(h.type===b.INTERPOLATION){let f=[],m=!0;for(let g of h.parts)if(typeof g=="string")f.push(g);else if(g.type===b.VARIABLE){let y=g.path;if(y===s)f.push(o!=null?String(o):"");else if(y.startsWith(s+".")){let w=y.substring(s.length+1),_=o[w];f.push(_!=null?String(_):"")}else{m=!1;break}}else{m=!1;break}if(!m)return null;u[d]=f.join("")}else return null}l.push(u)}}return l}}}return null},Hc=(e,t)=>{let r=e.body,s=e.itemVar,i=Kc(e,t);if(i!==null)return i;if(r.type===b.OBJECT&&r.properties.length<=5){for(let l of r.properties)if(l.parsedKey)return null;let n=[],a=!0;for(let l of r.properties){let p=l.key,o=l.value;if(o.type===b.LITERAL)n.push({key:p,type:"literal",value:o.value});else if(o.type===b.VARIABLE){let u=o.path;if(u===s)n.push({key:p,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes(".")&&!c.includes("["))n.push({key:p,type:"prop",prop:c});else{a=!1;break}}else{a=!1;break}}else if(o.type===b.INTERPOLATION&&o.parts.length===1){let u=o.parts[0];if(u.type===b.VARIABLE){let c=u.path;if(c===s)n.push({key:p,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes(".")&&!d.includes("["))n.push({key:p,type:"prop_string",prop:d});else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}else{a=!1;break}}if(a){let l=new Array(t.length);if(n.length===3&&n[0].type==="prop"&&n[0].key==="id"&&n[1].type==="prop_string"&&n[1].key==="title"&&n[2].type==="prop"&&n[2].key==="completed")for(let p=0;p<t.length;p++){let o=t[p];l[p]={id:o.id,title:o.title!=null?String(o.title):"",completed:o.completed}}else for(let p=0;p<t.length;p++){let o=t[p],u={};for(let c of n)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=o;else if(c.type==="prop")u[c.key]=o[c.prop];else if(c.type==="item_string")u[c.key]=o!=null?String(o):"";else if(c.type==="prop_string"){let d=o[c.prop];u[c.key]=d!=null?String(d):""}l[p]=u}return l}}return null},Gc=(e,t,r,s,i)=>{let n=[],a=e.body;if(a.type===b.OBJECT&&a.fast!==!1){let l=e.itemVar,p=e.indexVar;for(let o=0;o<i.length;o++){let u=i[o],c={},d={...s,[l]:u,...p&&{[p]:o}};d.__paths__||(d.__paths__=s.__paths__||{});let h=e.iterable.path||"";if(s&&s.__paths__&&h){let f=h.split("."),m=f[0];m in s.__paths__&&(h=s.__paths__[m],f.length>1&&(h+="."+f.slice(1).join(".")))}d.__paths__={...d.__paths__,[l]:`${h}[${o}]`,...p&&{[p]:o}};for(let f of a.properties){let m=f.parsedKey?I(f.parsedKey,t,r,d):f.key,g=f.value;if(g.type===b.LITERAL)c[m]=g.value;else if(g.type===b.VARIABLE){let y=g.path;if(y===l)c[m]=u;else if(y===p)c[m]=o;else if(y.startsWith(l+".")){let w=y.substring(l.length+1);!w.includes(".")&&!w.includes("[")?c[m]=u[w]:c[m]=z(y,r,{...s,[l]:u,...p&&{[p]:o}})}else c[m]=z(y,r,{...s,[l]:u,...p&&{[p]:o}})}else if(g.type===b.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===b.VARIABLE){let _=w.path,x;if(_===l)x=u;else if(_===p)x=o;else if(_.startsWith(l+".")){let E=_.substring(l.length+1);!E.includes(".")&&!E.includes("[")?x=u[E]:x=z(_,r,{...s,[l]:u,...p&&{[p]:o}})}else x=z(_,r,{...s,[l]:u,...p&&{[p]:o}});y.push(x!=null?String(x):"")}else{let _={...s,[l]:u,...p&&{[p]:o}},x=I(w,t,r,_);y.push(x!=null?String(x):"")}c[m]=y.join("")}else{let y={...s,[l]:u,...p&&{[p]:o}};c[m]=I(g,t,r,y)}}n.push(c)}return n}return null},qc=(e,t,r)=>{let s=e.body;if(s.type===b.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let n=s.properties[0].value;if(n.type===b.CONDITIONAL&&n.conditions.length===1&&n.conditions[0].type===b.VARIABLE&&n.conditions[0].path==="item.visible"){let a=n.bodies[0];if(a.type===b.OBJECT&&a.properties.length===2){let l=a.properties[0],p=a.properties[1];if(l.key==="id"&&l.value.type===b.VARIABLE&&l.value.path==="item.id"&&p.key==="$if item.highlighted"&&p.value.type===b.CONDITIONAL){let o=[];for(let u=0;u<t.length;u++){let c=t[u];if(c.visible){let d={id:c.id};c.highlighted?(d.highlight=!0,d.message=`This item is highlighted: ${c.name}`):(d.highlight=!1,d.message=c.name),o.push(d)}}return o}}}}return null},Jc=(e,t,r,s)=>{let i=I(e.iterable,t,r,s);if(!Array.isArray(i)){let o,u=!1;if(e.iterable.type===b.FUNCTION){u=!0;let d=e.iterable.args.map(h=>h.type===b.LITERAL?typeof h.value=="string"?`'${h.value}'`:String(h.value):h.type===b.VARIABLE?h.path:h.type===b.FUNCTION?`${h.name}(...)`:"?").join(", ");o=`${e.iterable.name}(${d})`}else o=e.iterable.path||"undefined";let c=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${o}`;throw Pi(c,i,u)}if(!e.indexVar){let o=qc(e,i,e.itemVar);if(o!==null)return o}if(!e.indexVar){let o=Hc(e,i);if(o!==null)return o}let n=Gc(e,t,r,s,i);if(n!==null)return n;let a=[],l=e.iterable.path||"";if(s&&s.__paths__&&l){let o=l.split("."),u=o[0];u in s.__paths__&&(l=s.__paths__[u],o.length>1&&(l+="."+o.slice(1).join(".")))}let p=!1;e.body.type===b.ARRAY&&(e.body.items.length<=1?p=!1:p=e.body._shouldPreserveArray??=e.body.items.some(o=>o.type===b.OBJECT&&o.properties.some(u=>u.key.startsWith("$if ")||u.key.startsWith("$when "))));for(let o=0;o<i.length;o++){let u=e.indexVar?{...s,[e.itemVar]:i[o],[e.indexVar]:o}:{...s,[e.itemVar]:i[o]};u.__paths__||(u.__paths__=s.__paths__||{}),u.__paths__={...u.__paths__,[e.itemVar]:`${l}[${o}]`},e.indexVar&&(u.__paths__[e.indexVar]=o);let c=I(e.body,t,r,u);Array.isArray(c)&&c.length===1&&!p?a.push(c[0]):a.push(c)}return a},Yc=(e,t,r,s)=>{if(e.whenCondition)return null;if(e.properties.length===1){let i=e.properties[0],n=i.parsedKey?I(i.parsedKey,t,r,s):i.key,a=i.value;if(a.type===b.OBJECT&&a.properties.length<=10&&!a.whenCondition){let l={},p={},o=!0;for(let u of a.properties){let c=u.parsedKey?I(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===b.LITERAL)p[c]=d.value;else if(d.type===b.VARIABLE)p[c]=z(d.path,r,s);else if(d.type===b.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===b.VARIABLE){let m=z(f.path,r,s);h.push(m!=null?String(m):"")}else{o=!1;break}if(!o)break;p[c]=h.join("")}else if(d.type===b.OBJECT&&d.properties.length<=5){let h={};for(let f of d.properties){let m=f.key,g=f.value;if(g.type===b.LITERAL)h[m]=g.value;else if(g.type===b.VARIABLE)h[m]=z(g.path,r,s);else if(g.type===b.INTERPOLATION){let y=[];for(let w of g.parts)if(typeof w=="string")y.push(w);else if(w.type===b.VARIABLE){let _=z(w.path,r,s);y.push(_!=null?String(_):"")}else{o=!1;break}if(!o)break;h[m]=y.join("")}else{o=!1;break}}if(!o)break;p[c]=h}else{o=!1;break}}if(o)return l[n]=p,l}}return null},Xc=(e,t,r,s)=>{let i=t.functions||t;if(e.whenCondition&&!Ne(e.whenCondition,i,r,s))return;let n=Yc(e,t,r,s);if(n!==null)return n;if(e.fast){let o={};for(let u of e.properties){let c=u.parsedKey?I(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===b.LITERAL)o[c]=d.value;else if(d.type===b.VARIABLE)o[c]=z(d.path,r,s);else if(d.type===b.INTERPOLATION){let h=[];for(let f of d.parts)if(typeof f=="string")h.push(f);else if(f.type===b.VARIABLE){let m=z(f.path,r,s);h.push(m!=null?String(m):"")}else{let m=I(f,t,r,s);h.push(m!=null?String(m):"")}o[c]=h.join("")}else o[c]=I(d,t,r,s)}return o}let a={},l=null,p=!1;for(let o of e.properties)if(!o.key.startsWith("$if ")&&!o.key.match(/^\$if\s+\w+.*:?$/)&&!o.key.startsWith("$elif")&&!o.key.startsWith("$else")&&!o.key.startsWith("$for ")){p=!0;break}for(let o of e.properties)if(o.key.startsWith("$if ")||o.key.match(/^\$if\s+\w+.*:?$/)){let u=I(o.value,t,r,s);if(!p&&u!==null&&u!==void 0)return Array.isArray(u)&&u.length===1?u[0]:u;typeof u=="object"&&u!==null&&!Array.isArray(u)&&Object.assign(a,u)}else if(o.key.startsWith("$for ")){if(e.properties.length===1)return I(o.value,t,r,s)}else{let u=o.value;if(u&&u.type===b.OBJECT&&u.properties){let c=u.properties.find(d=>d.key.startsWith("$for "));if(c){let d=I(c.value,t,r,s);d!==void 0&&(a[o.key]=d)}else{let d=I(o.value,t,r,s);d!==void 0&&(a[o.key]=d)}}else{let c=o.parsedKey?I(o.parsedKey,t,r,s):o.key,d=I(o.value,t,r,s);d!==void 0&&(a[c]=d)}}return a},Wi={},Zc=(e,t,r,s)=>{let i=[];for(let n of e.items)if(n.type===b.LOOP){let a=I(n,t,r,s);i.push(a)}else{let a=I(n,t,r,s);a!==Wi&&a!==void 0&&i.push(a)}return i},Qc=(e,t,r,s)=>{let{name:i,data:n,whenCondition:a}=e,l=t.partials||{},p=t.functions||t;if(a&&!Ne(a,p,r,s))return;if(!l[i])throw new se(`Partial '${i}' is not defined`);let o=s._partialStack||[];if(o.includes(i))throw new se(`Circular partial reference detected: ${i}`);let u=l[i],c=r,d={...s,_partialStack:[...o,i]};if(s){c={...r};for(let h of Object.keys(s))h.startsWith("_")||(c[h]=s[h])}if(n){let h=I(n,t,r,s);c={...c,...h}}return I(u,t,c,d)},eu=(e,t,r,s)=>{let{path:i}=e,n=i.split("."),a=n[0],l=n.slice(1);if(!s||!(a in s))throw new se(`Path reference '#{${i}}' refers to '${a}' which is not a loop variable in the current scope`);if(s.__paths__||(s.__paths__={}),!(a in s.__paths__))throw new se(`Path reference '#{${i}}' cannot be resolved - path tracking may not be initialized properly`);let p=s.__paths__[a];if(typeof p=="number"){if(l.length>0)throw new se(`Path reference '#{${i}}' - cannot access properties on index variable '${a}'`);return String(p)}return l.length>0&&(p+="."+l.join(".")),p},et=Fc;var tu=/\$\{([^}]*)\}/g,ru=/#\{([^}]*)\}/g,Ui=(e,t={})=>{let r=e.match(/^(\w+)\((.*)\)$/);if(!r)return{isFunction:!1};let[,s,i]=r,n=su(i,t);return{isFunction:!0,type:b.FUNCTION,name:s,args:n}},su=(e,t={})=>e.trim()?iu(e).map(s=>nu(s.trim(),t)):[],iu=e=>{let t=[],r="",s=0,i=!1,n="";for(let a=0;a<e.length;a++){let l=e[a],p=a>0?e[a-1]:"";!i&&(l==='"'||l==="'")?(i=!0,n=l,r+=l):i&&l===n&&p!=="\\"?(i=!1,n="",r+=l):!i&&l==="("?(s++,r+=l):!i&&l===")"?(s--,r+=l):!i&&l===","&&s===0?(t.push(r),r=""):r+=l}return r&&t.push(r),t},nu=(e,t={})=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:b.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:b.LITERAL,value:parseFloat(e)};if(e==="true")return{type:b.LITERAL,value:!0};if(e==="false")return{type:b.LITERAL,value:!1};if(e==="null")return{type:b.LITERAL,value:null};let r=Ui(e,t);if(r.isFunction)return{type:r.type,name:r.name,args:r.args};let s=e.trim(),i=[{op:" + ",type:"ADD"},{op:" - ",type:"SUBTRACT"}],n=-1,a=null;for(let{op:l,type:p}of i){let o=0;for(;o<s.length;){let u=ke(s.substring(o),l);if(u===-1)break;let c=o+u;c>n&&(n=c,a={op:l,type:p}),o=c+l.length}}if(n!==-1)try{return ee(s,t)}catch{return{type:b.VARIABLE,path:s}}return{type:b.VARIABLE,path:s}},Ki=/^\w+\(.*\)$/,au=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,ou=e=>{if(!(!e||e.trim()===""||Ki.test(e))&&au.test(e))throw e.includes("?")&&e.includes(":")?new T(`Complex expressions not supported in variable replacements - consider calculating the value in your data instead. Offending expression: "${e}"`):e.includes("||")||e.includes("&&")||e.includes("??")?new T(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new T(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},zi=e=>{let t=e.trim();if(Ki.test(t))throw new T(`Functions are not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("["))throw new T(`Array indices not supported in path references - use simple variable names or properties. Offending expression: "#{${e}}"`);if(/[+\-*/%]/.test(t))throw new T(`Arithmetic expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(/\|\||&&/.test(t))throw new T(`Logical operators not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);if(t.includes("?")&&t.includes(":"))throw new T(`Complex expressions not supported in path references - path references can only refer to loop variables. Offending expression: "#{${e}}"`);return{type:b.PATH_REFERENCE,path:t}},tt=(e,t={})=>{let r=e.trim();ou(r);let s=Ui(r,t);if(s.isFunction)return{type:s.type,name:s.name,args:s.args};if(r.includes("[")&&!/[\s+\-*/%|&?:]/.test(r)){let i=0;for(let n of r)n==="["?i++:n==="]"&&i--;if(i!==0)throw new Error("Invalid array index syntax")}return{type:b.VARIABLE,path:r}},Br=(e,t={})=>{let r=e,s=[];(e.includes("\\${")||e.includes("\\#{"))&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC_VAR$1"),r=r.replace(/\\\\(#\{[^}]*\})/g,"\\DOUBLE_ESC_PATH$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\(#\{[^}]*\})/g,(o,u)=>{let c=`__ESCAPED_${s.length}__`;return s.push(u),c}),r=r.replace(/\\DOUBLE_ESC_VAR/g,"\\"),r=r.replace(/\\DOUBLE_ESC_PATH/g,"\\"));let i=[...r.matchAll(tu)],n=[...r.matchAll(ru)],a=[...i.map(o=>({match:o,type:"variable"})),...n.map(o=>({match:o,type:"pathref"}))].sort((o,u)=>o.match.index-u.match.index);if(a.length===0){let o=r;for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);return{type:b.LITERAL,value:o}}if(a.length===1&&a[0].match[0]===r&&s.length===0){let{match:o,type:u}=a[0];try{return u==="variable"?tt(o[1],t):zi(o[1])}catch(c){if(c.message==="Invalid array index syntax")return{type:b.LITERAL,value:r};throw c}}let l=[],p=0;for(let{match:o,type:u}of a){let[c,d]=o,h=o.index;if(h>p){let f=r.substring(p,h);for(let m=0;m<s.length;m++)f=f.replace(`__ESCAPED_${m}__`,s[m]);f&&l.push(f)}try{let f;u==="variable"?f=tt(d.trim(),t):f=zi(d.trim()),l.push(f)}catch(f){if(f.message==="Invalid array index syntax")l.push(c);else throw f}p=h+c.length}if(p<r.length){let o=r.substring(p);for(let u=0;u<s.length;u++)o=o.replace(`__ESCAPED_${u}__`,s[u]);o&&l.push(o)}return{type:b.INTERPOLATION,parts:l}};var we=(e,t)=>typeof e=="string"?Br(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?lu(e,t):pu(e,t):{type:b.LITERAL,value:e},lu=(e,t)=>{let r=[],s=!1;for(let i=0;i<e.length;i++){let n=e[i];if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let l=Object.keys(n);if(l.length===1&&l[0].startsWith("$for ")){let p=Gi(l[0],n[l[0]],t);r.push(p),s=!0;continue}}let a=we(n,t);r.push(a),(a.type===b.FUNCTION||a.type===b.CONDITIONAL||a.type===b.LOOP||a.type===b.PARTIAL||a.type===b.OBJECT&&!a.fast||a.type===b.ARRAY&&!a.fast)&&(s=!0)}return{type:b.ARRAY,items:r,fast:!s}},pu=(e,t)=>{let r=[],s=!1,i=null,n=Object.entries(e),a=0;if(e.$partial!==void 0){if(typeof e.$partial!="string")throw new T("$partial value must be a string");if(e.$partial.trim()==="")throw new T("$partial value cannot be an empty string");let p=["$if","$elif","$else","$for"],o=[];for(let[y]of n)for(let w of p)if(y===w||y.startsWith(w+" ")||y.startsWith(w+"#")){o.push(w);break}if(o.length>0)throw new T(`Cannot use $partial with ${o.join(", ")} at the same level. Wrap $partial in a parent object if you need conditionals.`);let{$partial:u,$when:c,...d}=e,h={},f=!1;for(let[y,w]of Object.entries(d)){let _=y;(y.startsWith("\\$")||y.startsWith("$$"))&&(_=y.slice(1)),h[_]=w,f=!0}let m=null;if(f&&(m=we(h,t),m.type===b.OBJECT)){let y=!1;for(let w of m.properties)if(w.value.type===b.VARIABLE||w.value.type===b.INTERPOLATION||w.value.type===b.FUNCTION||w.value.type===b.CONDITIONAL||w.value.type===b.LOOP||w.value.type===b.OBJECT&&!w.value.fast||w.value.type===b.ARRAY&&!w.value.fast){y=!0;break}y&&(m.fast=!1)}let g={type:b.PARTIAL,name:u,data:m};if(c!==void 0){let y;if(typeof c=="string"){if(c.trim()==="")throw new T("Empty condition expression after '$when'");y=ee(c,t)}else y={type:b.LITERAL,value:c};g.whenCondition=y}return g}for(let[p,o]of n)if(p==="$when"){if(i!==null)throw new T("Multiple '$when' directives on the same object are not allowed");if(o==null)throw new T("Missing condition expression after '$when'");let u=typeof o=="string"?o:JSON.stringify(o);if(u.trim()==="")throw new T("Empty condition expression after '$when'");i=ee(u,t),s=!0}else if(p.startsWith("$when#")||p.startsWith("$when "))throw new T("'$when' does not support ID syntax or inline conditions - use '$when' as a property");for(;a<n.length;){let[p,o]=n[a];if(p==="$when"){a++;continue}if(p.startsWith("$if ")||p.match(/^\$if#\w+\s/)||p.match(/^\$if\s+\w+.*:$/)){let u=cu(n,a,t);r.push({key:p,value:u.node}),s=!0,a=u.nextIndex}else if(p.startsWith("$for ")){let u=Gi(p,o,t);r.push({key:p,value:u}),s=!0,a++}else{if(p.startsWith("$elif ")||p.startsWith("$else"))throw new T(`'${p.split(" ")[0]}' without matching '$if'`);if(p==="$if"||p==="$if:")throw new T("Missing condition expression after '$if'");{let u=we(o,t);(u.type===b.FUNCTION||u.type===b.CONDITIONAL||u.type===b.LOOP||u.type===b.PARTIAL||u.type===b.OBJECT&&!u.fast||u.type===b.ARRAY&&!u.fast)&&(s=!0);let c=Br(p,t),d={key:p,value:u};(c.type!==b.LITERAL||c.value!==p)&&(d.parsedKey=c),r.push(d),a++}}}let l={type:b.OBJECT,properties:r,fast:!s};return i&&(l.whenCondition=i),l},cu=(e,t,r={})=>{let s=[],i=[],n=t,[a,l]=e[n],p=null,o;if(a.startsWith("$if#")){let c=a.match(/^\$if#(\w+)\s+(.+)$/);if(c)p=c[1],o=c[2];else throw new T(`Invalid conditional syntax: ${a}`)}else o=a.substring(4),o.endsWith(":")&&(o=o.slice(0,-1).trim());Dr(o);let u=ee(o,r);for(s.push(u),i.push(we(l,r)),n++;n<e.length;){let[c,d]=e[n],h=!1,f;if(p?c.startsWith(`$elif#${p} `)?(f=c.substring(`$elif#${p} `.length),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c===`$else#${p}`||c===`$else#${p}:`)&&(h=!0,f=null):c.startsWith("$elif ")?(f=c.substring(6),f.endsWith(":")&&(f=f.slice(0,-1).trim()),h=!0):(c==="$else"||c==="$else:")&&(h=!0,f=null),h){if(f===null)s.push(null);else{Dr(f);let m=ee(f,r);s.push(m)}if(i.push(we(d,r)),n++,f===null)break}else break}return{node:{type:b.CONDITIONAL,conditions:s,bodies:i,id:p},nextIndex:n}},ee=(e,t={})=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")")){let o=e.slice(1,-1),u=0,c=!0;for(let d=0;d<o.length;d++)if(o[d]==="("?u++:o[d]===")"&&u--,u<0){c=!1;break}if(c&&u===0)return ee(o,t)}let r=ke(e,"||");if(r!==-1)return{type:b.BINARY,op:D.OR,left:ee(e.substring(0,r).trim(),t),right:ee(e.substring(r+2).trim(),t)};let s=ke(e,"&&");if(s!==-1)return{type:b.BINARY,op:D.AND,left:ee(e.substring(0,s).trim(),t),right:ee(e.substring(s+2).trim(),t)};let i=[{op:">=",type:D.GTE},{op:"<=",type:D.LTE},{op:"==",type:D.EQ},{op:"!=",type:D.NEQ},{op:">",type:D.GT},{op:"<",type:D.LT},{op:" in ",type:D.IN}];for(let{op:o,type:u}of i){let c=ke(e,o);if(c!==-1)return{type:b.BINARY,op:u,left:ee(e.substring(0,c).trim(),t),right:ee(e.substring(c+o.length).trim(),t)}}let n=-1,a=null,l=[{op:" + ",type:D.ADD},{op:" - ",type:D.SUBTRACT}];for(let{op:o,type:u}of l){let c=0;for(;c<e.length;){let d=ke(e.substring(c),o);if(d===-1)break;let h=c+d;h>n&&(n=h,a={op:o,type:u}),c=h+o.length}}if(n!==-1&&a)return{type:b.BINARY,op:a.type,left:ee(e.substring(0,n).trim(),t),right:ee(e.substring(n+a.op.length).trim(),t)};let p=[" * "," / "," % "];for(let o of p)if(ke(e,o)!==-1)throw new T(`Arithmetic operations are not allowed in conditionals: "${o}"`);return e.startsWith("!")?{type:b.UNARY,op:Qe.NOT,operand:ee(e.substring(1).trim(),t)}:Hi(e,t)},ke=(e,t)=>{let r=0,s=0;for(;s<=e.length-t.length;){if(e[s]==="(")r++;else if(e[s]===")")r--;else if(r===0&&e.substring(s,s+t.length)===t)return s;s++}return-1},uu=e=>{if(e=e.trim(),e==="true")return{type:b.LITERAL,value:!0};if(e==="false")return{type:b.LITERAL,value:!1};if(e==="null")return{type:b.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:b.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:b.LITERAL,value:""};if(e==="{}")return{type:b.LITERAL,value:{}};if(e==="[]")return{type:b.LITERAL,value:[]};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:b.LITERAL,value:t}:{type:b.VARIABLE,path:e}},Hi=(e,t)=>{let r=e.trim();if(r.match(/^(\w+)\((.*)\)$/))return tt(r,t);let i=uu(r);if(i.type===b.LITERAL)return i;if(/^[a-zA-Z_$][\w.$]*$/.test(r))return{type:b.VARIABLE,path:r};try{return tt(r,t)}catch(n){if(n.message&&n.message.includes("not supported"))return i;throw n}},Gi=(e,t,r)=>{let s=e.substring(5).trim();Vi(s);let i=s.match(/^(.+?)\s+in\s+(.+)$/);if(!i)throw new T(`Invalid loop syntax - missing 'in' keyword (got: '$for ${s}')`);let n=i[1].trim(),a=i[2].trim(),l,p=null;if(n.includes(",")){let c=n.split(",").map(d=>d.trim());if(c.length!==2)throw new T(`Invalid loop variables: ${n}. Expected format: "item" or "item, index"`);l=c[0],p=c[1]}else l=n;let o=Hi(a,r),u=we(t,r);return{type:b.LOOP,itemVar:l,indexVar:p,iterable:o,body:u}};var du=(e,t={})=>{let{functions:r={}}=t;return we(e,r)},ft=du;var jr={};R(jr,{now:()=>fu});var fu=()=>Date.now();var hu=(e,t,r={})=>{let{functions:s={},partials:i={}}=r,n={...jr,...s},a=ft(e,{functions:n}),l={};for(let[p,o]of Object.entries(i))l[p]=ft(o,{functions:n});return et(a,t,{functions:n,partials:l})},rt=hu;var _e=e=>e!==null&&typeof e=="object"&&!Array.isArray(e);var qi=(e,t)=>{!t||typeof t!="object"||Object.entries(t).forEach(([r,s])=>{if(r==="default")throw new Error("[Methods] Invalid method name 'default'. Use named exports in .methods.js; default export is not supported.");if(typeof s=="function"){if(r in e)throw new Error(`[Methods] Cannot define method '${r}' because it already exists on the component instance.`);Object.defineProperty(e,r,{configurable:!0,enumerable:!1,writable:!1,value:(i={})=>{let n=i===void 0?{}:i;if(!_e(n))throw new Error(`[Methods] Method '${r}' expects payload to be an object.`);return s.call(e,n)}})}})};var en=Symbol.for("immer-nothing"),Ji=Symbol.for("immer-draftable"),ae=Symbol.for("immer-state");function ce(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Ve=Object.getPrototypeOf;function Pe(e){return!!e&&!!e[ae]}function Se(e){return e?tn(e)||Array.isArray(e)||!!e[Ji]||!!e.constructor?.[Ji]||bt(e)||vt(e):!1}var mu=Object.prototype.constructor.toString();function tn(e){if(!e||typeof e!="object")return!1;let t=Ve(e);if(t===null)return!0;let r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object?!0:typeof r=="function"&&Function.toString.call(r)===mu}function ht(e,t){gt(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function gt(e){let t=e[ae];return t?t.type_:Array.isArray(e)?1:bt(e)?2:vt(e)?3:0}function Wr(e,t){return gt(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function rn(e,t,r){let s=gt(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function yu(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function bt(e){return e instanceof Map}function vt(e){return e instanceof Set}function $e(e){return e.copy_||e.base_}function zr(e,t){if(bt(e))return new Map(e);if(vt(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=tn(e);if(t===!0||t==="class_only"&&!r){let s=Object.getOwnPropertyDescriptors(e);delete s[ae];let i=Reflect.ownKeys(s);for(let n=0;n<i.length;n++){let a=i[n],l=s[a];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(s[a]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[a]})}return Object.create(Ve(e),s)}else{let s=Ve(e);if(s!==null&&r)return{...e};let i=Object.create(s);return Object.assign(i,e)}}function qr(e,t=!1){return wt(e)||Pe(e)||!Se(e)||(gt(e)>1&&(e.set=e.add=e.clear=e.delete=gu),Object.freeze(e),t&&Object.entries(e).forEach(([r,s])=>qr(s,!0))),e}function gu(){ce(2)}function wt(e){return Object.isFrozen(e)}var bu={};function Ce(e){let t=bu[e];return t||ce(0,e),t}var st;function sn(){return st}function vu(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Yi(e,t){t&&(Ce("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Ur(e){Kr(e),e.drafts_.forEach(wu),e.drafts_=null}function Kr(e){e===st&&(st=e.parent_)}function Xi(e){return st=vu(st,e)}function wu(e){let t=e[ae];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Zi(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[ae].modified_&&(Ur(t),ce(4)),Se(e)&&(e=mt(t,e),t.parent_||yt(t,e)),t.patches_&&Ce("Patches").generateReplacementPatches_(r[ae].base_,e,t.patches_,t.inversePatches_)):e=mt(t,r,[]),Ur(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==en?e:void 0}function mt(e,t,r){if(wt(t))return t;let s=t[ae];if(!s)return ht(t,(i,n)=>Qi(e,s,t,i,n,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return yt(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;let i=s.copy_,n=i,a=!1;s.type_===3&&(n=new Set(i),i.clear(),a=!0),ht(n,(l,p)=>Qi(e,s,i,l,p,r,a)),yt(e,i,!1),r&&e.patches_&&Ce("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function Qi(e,t,r,s,i,n,a){if(Pe(i)){let l=n&&t&&t.type_!==3&&!Wr(t.assigned_,s)?n.concat(s):void 0,p=mt(e,i,l);if(rn(r,s,p),Pe(p))e.canAutoFreeze_=!1;else return}else a&&r.add(i);if(Se(i)&&!wt(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;mt(e,i),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,s)&&yt(e,i)}}function yt(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&qr(t,r)}function _u(e,t){let r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:sn(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=s,n=Jr;r&&(i=[s],n=it);let{revoke:a,proxy:l}=Proxy.revocable(i,n);return s.draft_=l,s.revoke_=a,l}var Jr={get(e,t){if(t===ae)return e;let r=$e(e);if(!Wr(r,t))return xu(e,r,t);let s=r[t];return e.finalized_||!Se(s)?s:s===Fr(e.base_,t)?(Mr(e),e.copy_[t]=Gr(s,e)):s},has(e,t){return t in $e(e)},ownKeys(e){return Reflect.ownKeys($e(e))},set(e,t,r){let s=nn($e(e),t);if(s?.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){let i=Fr($e(e),t),n=i?.[ae];if(n&&n.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(yu(r,i)&&(r!==void 0||Wr(e.base_,t)))return!0;Mr(e),Hr(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Fr(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Mr(e),Hr(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=$e(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){ce(11)},getPrototypeOf(e){return Ve(e.base_)},setPrototypeOf(){ce(12)}},it={};ht(Jr,(e,t)=>{it[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});it.deleteProperty=function(e,t){return it.set.call(this,e,t,void 0)};it.set=function(e,t,r){return Jr.set.call(this,e[0],t,r,e[0])};function Fr(e,t){let r=e[ae];return(r?$e(r):e)[t]}function xu(e,t,r){let s=nn(t,r);return s?"value"in s?s.value:s.get?.call(e.draft_):void 0}function nn(e,t){if(!(t in e))return;let r=Ve(e);for(;r;){let s=Object.getOwnPropertyDescriptor(r,t);if(s)return s;r=Ve(r)}}function Hr(e){e.modified_||(e.modified_=!0,e.parent_&&Hr(e.parent_))}function Mr(e){e.copy_||(e.copy_=zr(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var Eu=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){let n=r;r=t;let a=this;return function(p=n,...o){return a.produce(p,u=>r.call(this,u,...o))}}typeof r!="function"&&ce(6),s!==void 0&&typeof s!="function"&&ce(7);let i;if(Se(t)){let n=Xi(this),a=Gr(t,void 0),l=!0;try{i=r(a),l=!1}finally{l?Ur(n):Kr(n)}return Yi(n,s),Zi(i,n)}else if(!t||typeof t!="object"){if(i=r(t),i===void 0&&(i=t),i===en&&(i=void 0),this.autoFreeze_&&qr(i,!0),s){let n=[],a=[];Ce("Patches").generateReplacementPatches_(t,i,n,a),s(n,a)}return i}else ce(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(a,...l)=>this.produceWithPatches(a,p=>t(p,...l));let s,i;return[this.produce(t,r,(a,l)=>{s=a,i=l}),s,i]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){Se(e)||ce(8),Pe(e)&&(e=Au(e));let t=Xi(this),r=Gr(e,void 0);return r[ae].isManual_=!0,Kr(t),r}finishDraft(e,t){let r=e&&e[ae];(!r||!r.isManual_)&&ce(9);let{scope_:s}=r;return Yi(s,t),Zi(void 0,s)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){let i=t[r];if(i.path.length===0&&i.op==="replace"){e=i.value;break}}r>-1&&(t=t.slice(r+1));let s=Ce("Patches").applyPatches_;return Pe(e)?s(e,t):this.produce(e,i=>s(i,t))}};function Gr(e,t){let r=bt(e)?Ce("MapSet").proxyMap_(e,t):vt(e)?Ce("MapSet").proxySet_(e,t):_u(e,t);return(t?t.scope_:sn()).drafts_.push(r),r}function Au(e){return Pe(e)||ce(10,e),an(e)}function an(e){if(!Se(e)||wt(e))return e;let t=e[ae],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=zr(e,t.scope_.immer_.useStrictShallowCopy_)}else r=zr(e,!0);return ht(r,(s,i)=>{rn(r,s,an(i))}),t&&(t.finalized_=!1),r}var oe=new Eu,on=oe.produce,Mm=oe.produceWithPatches.bind(oe),Wm=oe.setAutoFreeze.bind(oe),zm=oe.setUseStrictShallowCopy.bind(oe),Um=oe.applyPatches.bind(oe),Km=oe.createDraft.bind(oe),Hm=oe.finishDraft.bind(oe);var ln=(e,t,r)=>{let{createInitialState:s,...i}=e,n={},a={},l={};return s&&(l=s({props:t,constants:r})),Object.entries(i).forEach(([p,o])=>{if(p.startsWith("select")){n[p]=(...u)=>o({state:l,props:t,constants:r},...u);return}a[p]=(u={})=>{let c=u===void 0?{}:u;if(!_e(c))throw new Error(`[Store] Action '${p}' expects payload to be an object.`);return l=on(l,d=>o({state:d,props:t,constants:r},c)),l}}),{getState:()=>l,...a,...n}};var pn=e=>!_e(e)||Object.isFrozen(e)?e:(Object.values(e).forEach(t=>{pn(t)}),Object.freeze(e)),cn=({setupConstants:e,fileConstants:t})=>{let r=_e(e)?e:{},s=_e(t)?t:{};return pn({...r,...s})};var un=(e,t)=>{if(!t||typeof t!="object")return"";let r="",s=n=>Object.entries(n).map(([a,l])=>` ${a}: ${l};`).join(`
|
|
1075
1075
|
`),i=(n,a)=>{if(typeof a!="object"||a===null)return"";if(n.startsWith("@")){let p=Object.entries(a).map(([o,u])=>{let c=s(u);return` ${o} {
|
|
1076
1076
|
${c.split(`
|
|
1077
1077
|
`).map(d=>d?` ${d}`:"").join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rettangoli/ui",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-rc16",
|
|
4
4
|
"description": "A UI component library for building web interfaces.",
|
|
5
5
|
"main": "dist/rettangoli-esm.min.js",
|
|
6
6
|
"type": "module",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"homepage": "https://github.com/yuusoft-org/rettangoli#readme",
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@floating-ui/dom": "^1.6.13",
|
|
66
|
-
"@rettangoli/fe": "
|
|
66
|
+
"@rettangoli/fe": "1.0.0-rc3",
|
|
67
67
|
"commander": "^13.1.0",
|
|
68
68
|
"jempl": "1.0.0",
|
|
69
69
|
"js-yaml": "^4.1.0",
|
|
@@ -67,7 +67,7 @@ template:
|
|
|
67
67
|
- $if field.type == "input-textarea":
|
|
68
68
|
- rtgl-textarea#field${field._idx} data-field-name=${field.name} w=f rows=${field.rows} placeholder=${field.placeholder} ?disabled=${field._disabled}: null
|
|
69
69
|
- $if field.type == "select":
|
|
70
|
-
- rtgl-select#field${field._idx} data-field-name=${field.name} w=f :options=flatFields[${field._arrIdx}].options ?no-clear=flatFields[${field._arrIdx}].
|
|
70
|
+
- rtgl-select#field${field._idx} data-field-name=${field.name} w=f :options=flatFields[${field._arrIdx}].options ?no-clear=${field.noClear} :selectedValue=flatFields[${field._arrIdx}]._selectedValue :placeholder=${field.placeholder} ?disabled=${field._disabled}: null
|
|
71
71
|
- $if field.type == "color-picker":
|
|
72
72
|
- rtgl-color-picker#field${field._idx} data-field-name=${field.name} ?disabled=${field._disabled}: null
|
|
73
73
|
- $if field.type == "slider":
|