@rettangoli/ui 0.1.2-rc20 → 0.1.2-rc22

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.
@@ -1,15 +1,15 @@
1
- var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)Is(e,r,{get:t[r],enumerable:!0})};function I(e,...t){let r="";return e.forEach((s,n)=>{r+=s+(t[n]||"")}),r}var Os=["xs","sm","md","lg","xl"],tr={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left",m:"margin",mh:"margin-left margin-right",mv:"margin-top margin-bottom",pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left",p:"padding",ph:"padding-left padding-right",pv:"padding-top padding-bottom",g:"gap",gv:"row-gap",gh:"column-gap",bw:"border-width",bwt:"border-top-width",bwr:"border-right-width",bwb:"border-bottom-width",bwl:"border-left-width",bc:"border-color",br:"border-radius",pos:"position",shadow:"box-shadow",ta:"text-align",c:"color",cur:"cursor"},te=Object.keys(tr),re=e=>e.concat(Os.flatMap(t=>e.map(r=>`${t}-${r}`))),rr={default:void 0,xl:"@media only screen and (max-width: 1280px)",lg:"@media only screen and (max-width: 1024px)",md:"@media only screen and (max-width: 768px)",sm:"@media only screen and (max-width: 640px)"},Q=(e,t={})=>{let r="";for(let[s,n]of Object.entries(rr)){s!=="default"&&(r+=`${n} {`);for(let[i,o]of Object.entries(e)){let a=t[i]?` ${t[i]} `:" ";for(let[l,p]of Object.entries(o)){let u=tr[i],c=p.startsWith("--")?`var(${p})`:p,d=s==="default"?i:`${s}-${i}`,m=s==="default"?`h-${i}`:`${s}-h-${i}`;if(u){let f=u.split(" ").map(y=>`${y}: ${c};`).join(" ");r+=`
1
+ var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)Is(e,r,{get:t[r],enumerable:!0})};function I(e,...t){let r="";return e.forEach((s,n)=>{r+=s+(t[n]||"")}),r}var Os=["xs","sm","md","lg","xl"],tr={mt:"margin-top",mr:"margin-right",mb:"margin-bottom",ml:"margin-left",m:"margin",mh:"margin-left margin-right",mv:"margin-top margin-bottom",pt:"padding-top",pr:"padding-right",pb:"padding-bottom",pl:"padding-left",p:"padding",ph:"padding-left padding-right",pv:"padding-top padding-bottom",g:"gap",gv:"row-gap",gh:"column-gap",bw:"border-width",bwt:"border-top-width",bwr:"border-right-width",bwb:"border-bottom-width",bwl:"border-left-width",bc:"border-color",br:"border-radius",pos:"position",shadow:"box-shadow",ta:"text-align",c:"color",cur:"cursor"},te=Object.keys(tr),re=e=>e.concat(Os.flatMap(t=>e.map(r=>`${t}-${r}`))),rr={default:void 0,xl:"@media only screen and (max-width: 1280px)",lg:"@media only screen and (max-width: 1024px)",md:"@media only screen and (max-width: 768px)",sm:"@media only screen and (max-width: 640px)"},Q=(e,t={})=>{let r="";for(let[s,n]of Object.entries(rr)){s!=="default"&&(r+=`${n} {`);for(let[i,o]of Object.entries(e)){let a=t[i]?` ${t[i]} `:" ";for(let[l,p]of Object.entries(o)){let u=tr[i],c=p.startsWith("--")?`var(${p})`:p,d=s==="default"?i:`${s}-${i}`,y=s==="default"?`h-${i}`:`${s}-h-${i}`;if(u){let f=u.split(" ").map(m=>`${m}: ${c};`).join(" ");r+=`
2
2
  :host([${d}="${l}"])${a}{
3
3
  ${f}
4
4
  }
5
- :host([${m}="${l}"]:hover)${a}{
5
+ :host([${y}="${l}"]:hover)${a}{
6
6
  ${f}
7
7
  }
8
8
  `}else r+=`
9
9
  :host([${d}="${l}"])${a}{
10
10
  ${p}
11
11
  }
12
- :host([${m}="${l}"]:hover)${a}{
12
+ :host([${y}="${l}"]:hover)${a}{
13
13
  ${p}
14
14
  }
15
15
  `}}s!=="default"&&(r+="}")}return r};function Ts(e){if(e===null||e.includes("/"))return!1;let t=String(e);return/[0-9]$/.test(t)}var Ls=e=>/%$/.test(e),j=e=>{if(e!==void 0)return Ls(e)?e:Ts(e)?`${e}px`:Object.keys(N).includes(e)?`var(${N[e]})`:e},N={xs:"--spacing-xs",sm:"--spacing-sm",md:"--spacing-md",lg:"--spacing-lg",xl:"--spacing-xl"};function se(e,t=":host"){let r="";for(let[s,n]of Object.entries(rr)){s!=="default"&&(r+=`${n} {
@@ -104,7 +104,7 @@ var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)I
104
104
  `,lk:`
105
105
  background-color: transparent;
106
106
  color: var(--foreground);
107
- `}},Vs={mt:"button",mr:"button",mb:"button",ml:"button",m:"button",mh:"button",mv:"button",s:"button",v:"button"},sr=Q(Ns,Vs);var me=I`
107
+ `}},Vs={mt:"button",mr:"button",mb:"button",ml:"button",m:"button",mh:"button",mv:"button",s:"button",v:"button"},sr=Q(Ns,Vs);var ye=I`
108
108
  a, a:link, a:visited, a:hover, a:active {
109
109
  color: inherit;
110
110
  text-decoration: none;
@@ -250,7 +250,7 @@ var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)I
250
250
  gap: 0;
251
251
  }
252
252
 
253
- ${me}
253
+ ${ye}
254
254
 
255
255
  a {
256
256
  display: contents;
@@ -412,7 +412,7 @@ var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)I
412
412
  ${H}
413
413
  ${U}
414
414
  ${Oe}
415
- ${me}
415
+ ${ye}
416
416
 
417
417
  :host([href]) {
418
418
  cursor: pointer;
@@ -526,7 +526,7 @@ var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)I
526
526
  width: 100%;
527
527
  }
528
528
 
529
- ${me}
529
+ ${ye}
530
530
 
531
531
  a {
532
532
  display: block;
@@ -748,7 +748,7 @@ var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)I
748
748
  }
749
749
  ${H}
750
750
  ${U}
751
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="color",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("change",this._onChange),this._inputElement.addEventListener("input",this._onInput)}static get observedAttributes(){return["key","value","disabled",...re([...te,"wh","w","h","hidden","visible","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onChange=t=>{this.dispatchEvent(new CustomEvent("colorpicker-change",{detail:{value:this._inputElement.value}}))};_onInput=t=>{this.dispatchEvent(new CustomEvent("colorpicker-input",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(["value","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let o=d=>`${i==="default"?"":`${i}-`}${d}`,a=this.getAttribute(o("wh")),l=j(a===null?this.getAttribute(o("w")):a),p=j(a===null?this.getAttribute(o("h")):a),u=this.getAttribute(o("op")),c=this.getAttribute(o("z"));c!==null&&(this._styles[i]["z-index"]=c),u!==null&&(this._styles[i].opacity=u),l==="f"?this._styles[i].width="var(--width-stretch)":l!==void 0&&(this._styles[i].width=l,this._styles[i]["min-width"]=l,this._styles[i]["max-width"]=l),p==="f"?this._styles[i].height="100%":p!==void 0&&(this._styles[i].height=p,this._styles[i]["min-height"]=p,this._styles[i]["max-height"]=p),this.hasAttribute(o("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(o("visible"))&&(this._styles[i].display="block !important")});let n=se(this._styles,'input[type="color"]');n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateInputAttributes(){let t=this.getAttribute("value"),r=this.hasAttribute("disabled");t!==null&&(this._inputElement.value=t),r?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},mr=({render:e,html:t})=>st;var it=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
751
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="color",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("change",this._onChange),this._inputElement.addEventListener("input",this._onInput)}static get observedAttributes(){return["key","value","disabled",...re([...te,"wh","w","h","hidden","visible","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onChange=t=>{this.dispatchEvent(new CustomEvent("colorpicker-change",{detail:{value:this._inputElement.value}}))};_onInput=t=>{this.dispatchEvent(new CustomEvent("colorpicker-input",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(["value","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let o=d=>`${i==="default"?"":`${i}-`}${d}`,a=this.getAttribute(o("wh")),l=j(a===null?this.getAttribute(o("w")):a),p=j(a===null?this.getAttribute(o("h")):a),u=this.getAttribute(o("op")),c=this.getAttribute(o("z"));c!==null&&(this._styles[i]["z-index"]=c),u!==null&&(this._styles[i].opacity=u),l==="f"?this._styles[i].width="var(--width-stretch)":l!==void 0&&(this._styles[i].width=l,this._styles[i]["min-width"]=l,this._styles[i]["max-width"]=l),p==="f"?this._styles[i].height="100%":p!==void 0&&(this._styles[i].height=p,this._styles[i]["min-height"]=p,this._styles[i]["max-height"]=p),this.hasAttribute(o("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(o("visible"))&&(this._styles[i].display="block !important")});let n=se(this._styles,'input[type="color"]');n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateInputAttributes(){let t=this.getAttribute("value"),r=this.hasAttribute("disabled");t!==null&&(this._inputElement.value=t),r?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},yr=({render:e,html:t})=>st;var it=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
752
752
  :host {
753
753
  display: contents;
754
754
  }
@@ -802,7 +802,7 @@ var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)I
802
802
  }
803
803
  ${H}
804
804
  ${U}
805
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="range",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","value","min","max","step","disabled",...re([...te,"wh","w","h","hidden","visible","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onInput=t=>{this.dispatchEvent(new CustomEvent("slider-input",{detail:{value:this._inputElement.value}}))};_onChange=t=>{this.dispatchEvent(new CustomEvent("slider-change",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(["value","min","max","step","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let o=d=>`${i==="default"?"":`${i}-`}${d}`,a=this.getAttribute(o("wh")),l=j(a===null?this.getAttribute(o("w")):a),p=j(a===null?this.getAttribute(o("h")):a),u=this.getAttribute(o("op")),c=this.getAttribute(o("z"));c!==null&&(this._styles[i]["z-index"]=c),u!==null&&(this._styles[i].opacity=u),l==="f"?this._styles[i].width="var(--width-stretch)":l!==void 0&&(this._styles[i].width=l,this._styles[i]["min-width"]=l,this._styles[i]["max-width"]=l),p==="f"?this._styles[i].height="100%":p!==void 0&&(this._styles[i].height=p,this._styles[i]["min-height"]=p,this._styles[i]["max-height"]=p),this.hasAttribute(o("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(o("visible"))&&(this._styles[i].display="block !important")});let n=se(this._styles,'input[type="range"]');n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateInputAttributes(){let t=this.getAttribute("value"),r=this.getAttribute("min"),s=this.getAttribute("max"),n=this.getAttribute("step"),i=this.hasAttribute("disabled");t!==null&&(this._inputElement.value=t),r!==null?this._inputElement.min=r:this._inputElement.min="0",s!==null?this._inputElement.max=s:this._inputElement.max="100",n!==null?this._inputElement.step=n:this._inputElement.step="1",i?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},yr=({render:e,html:t})=>it;var nt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
805
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"closed"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._styles={default:{},sm:{},md:{},lg:{},xl:{}},this._lastStyleString="",this._inputElement=document.createElement("input"),this._inputElement.type="range",this._styleElement=document.createElement("style"),this.shadow.appendChild(this._styleElement),this.shadow.appendChild(this._inputElement),this._inputElement.addEventListener("input",this._onInput),this._inputElement.addEventListener("change",this._onChange)}static get observedAttributes(){return["key","value","min","max","step","disabled",...re([...te,"wh","w","h","hidden","visible","op","z"])]}get value(){return this._inputElement.value}set value(t){this._inputElement.value=t}_onInput=t=>{this.dispatchEvent(new CustomEvent("slider-input",{detail:{value:this._inputElement.value}}))};_onChange=t=>{this.dispatchEvent(new CustomEvent("slider-change",{detail:{value:this._inputElement.value}}))};attributeChangedCallback(t,r,s){if(["value","min","max","step","disabled"].includes(t)){this._updateInputAttributes();return}this._styles={default:{},sm:{},md:{},lg:{},xl:{}},["default","sm","md","lg","xl"].forEach(i=>{let o=d=>`${i==="default"?"":`${i}-`}${d}`,a=this.getAttribute(o("wh")),l=j(a===null?this.getAttribute(o("w")):a),p=j(a===null?this.getAttribute(o("h")):a),u=this.getAttribute(o("op")),c=this.getAttribute(o("z"));c!==null&&(this._styles[i]["z-index"]=c),u!==null&&(this._styles[i].opacity=u),l==="f"?this._styles[i].width="var(--width-stretch)":l!==void 0&&(this._styles[i].width=l,this._styles[i]["min-width"]=l,this._styles[i]["max-width"]=l),p==="f"?this._styles[i].height="100%":p!==void 0&&(this._styles[i].height=p,this._styles[i]["min-height"]=p,this._styles[i]["max-height"]=p),this.hasAttribute(o("hidden"))&&(this._styles[i].display="none !important"),this.hasAttribute(o("visible"))&&(this._styles[i].display="block !important")});let n=se(this._styles,'input[type="range"]');n!==this._lastStyleString&&(this._styleElement.textContent=n,this._lastStyleString=n)}_updateInputAttributes(){let t=this.getAttribute("value"),r=this.getAttribute("min"),s=this.getAttribute("max"),n=this.getAttribute("step"),i=this.hasAttribute("disabled");t!==null&&(this._inputElement.value=t),r!==null?this._inputElement.min=r:this._inputElement.min="0",s!==null?this._inputElement.max=s:this._inputElement.max="100",n!==null?this._inputElement.step=n:this._inputElement.step="1",i?this._inputElement.setAttribute("disabled",""):this._inputElement.removeAttribute("disabled")}connectedCallback(){this._updateInputAttributes()}},mr=({render:e,html:t})=>it;var nt=class e extends HTMLElement{static styleSheet=null;static initializeStyleSheet(){e.styleSheet||(e.styleSheet=new CSSStyleSheet,e.styleSheet.replaceSync(I`
806
806
  :host {
807
807
  display: contents;
808
808
  }
@@ -916,7 +916,7 @@ var rettangoli=(()=>{var Is=Object.defineProperty;var P=(e,t)=>{for(var r in t)I
916
916
  min-width: 200px;
917
917
  max-width: 400px;
918
918
  }
919
- `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._popoverOverlay=document.createElement("div"),this._popoverOverlay.className="popover-overlay",this.shadow.appendChild(this._popoverOverlay),this._popoverOverlay.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._popoverOverlay.addEventListener("contextmenu",t=>{t.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this.shadow.appendChild(this._popoverContainer),this._slotElement=null,this._isOpen=!1,this._handleEscKey=this._handleEscKey.bind(this)}static get observedAttributes(){return["open","x","y","placement"]}connectedCallback(){this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._removeGlobalListeners()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._isOpen?this._show():s===null&&this._isOpen&&this._hide():(t==="x"||t==="y"||t==="placement")&&this._isOpen&&this._updatePosition()}_show(){this._isOpen||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._updatePosition(),this._addGlobalListeners())}_hide(){this._isOpen&&(this._isOpen=!1,this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null),this._removeGlobalListeners())}_updatePosition(){let t=parseFloat(this.getAttribute("x")||"0"),r=parseFloat(this.getAttribute("y")||"0"),s=this.getAttribute("placement")||"bottom-start";this.removeAttribute("positioned"),requestAnimationFrame(()=>{let n=this._popoverContainer.getBoundingClientRect(),{left:i,top:o}=this._calculatePosition(t,r,n.width,n.height,s);this._popoverContainer.style.left=`${i}px`,this._popoverContainer.style.top=`${o}px`,requestAnimationFrame(()=>{this.setAttribute("positioned","")})})}_calculatePosition(t,r,s,n,i){let a=t,l=r;switch(i){case"top":a=t-s/2,l=r-n-8;break;case"top-start":a=t,l=r-n-8;break;case"top-end":a=t-s,l=r-n-8;break;case"right":a=t+8,l=r-n/2;break;case"right-start":a=t+8,l=r;break;case"right-end":a=t+8,l=r-n;break;case"bottom":a=t-s/2,l=r+8;break;case"bottom-start":a=t,l=r+8;break;case"bottom-end":a=t-s,l=r+8;break;case"left":a=t-s-8,l=r-n/2;break;case"left-start":a=t-s-8,l=r;break;case"left-end":a=t-s-8,l=r-n;break}let p=8;return a=Math.max(p,Math.min(a,window.innerWidth-s-p)),l=Math.max(p,Math.min(l,window.innerHeight-n-p)),{left:a,top:l}}_addGlobalListeners(){setTimeout(()=>{document.addEventListener("keydown",this._handleEscKey)},0)}_removeGlobalListeners(){document.removeEventListener("keydown",this._handleEscKey)}_handleEscKey(t){t.key==="Escape"&&this.dispatchEvent(new CustomEvent("close",{detail:{}}))}get popover(){return this._popoverContainer}},vr=({render:e,html:t})=>at;var ot={};P(ot,{handleClickItem:()=>Ws});var Ws=(e,t)=>{let{dispatchEvent:r}=t,s=e.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:s}}))};var lt={};P(lt,{INITIAL_STATE:()=>Ms,toViewData:()=>zs});var Ms=Object.freeze({}),Ks=["id","class","style","slot"],Fs=e=>Object.entries(e).filter(([t])=>!Ks.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),zs=({props:e,attrs:t})=>{let r=Fs(t),s=e.items||[],n=e.separator||"breadcrumb-arrow",i=[];return s.forEach((o,a)=>{i.push(o),a<s.length-1&&i.push({isSeparator:!0})}),{containerAttrString:r,items:i,separator:n}};var br={elementName:"rtgl-breadcrumb",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}},separator:{type:"string"}}},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}},separator:{type:"string",default:"breadcrumb-arrow"}}},refs:{"item-*":{eventListeners:{click:{handler:"handleClickItem"}}}},events:{"item-click":{type:"object",properties:{item:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}},index:{type:"number"}}}},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:null,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.id"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${separator} c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"separator"}," c=mu-fg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item-${item.id} data-id=${item.id} cur=p",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},parsedKey:{type:2,parts:["rtgl-view#item-",{type:1,path:"item.id"}," data-id=",{type:1,path:"item.id"}," cur=p"]}}],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}],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 pt={};P(pt,{handleClickMenuItem:()=>Hs,handleClosePopover:()=>Us});var Us=(e,t)=>{let{dispatchEvent:r}=t;r(new CustomEvent("close"))},Hs=(e,t)=>{let{dispatchEvent:r}=t,s=parseInt(e.currentTarget.id.replace("option-","")),n=t.props.items[s];r(new CustomEvent("click-item",{detail:{index:s,item:n}}))};var ct={};P(ct,{INITIAL_STATE:()=>Js,toViewData:()=>Ys});var Js=Object.freeze({}),Ys=({props:e,attrs:t})=>({items:e.items||[],open:!!t.open,x:t.x,y:t.y,placement:t.placement});var wr={elementName:"rtgl-dropdown-menu",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},type:{type:"string",enum:["label","item","separator"]}}}}}},attrsSchema:{type:"object",properties:{open:{type:"string"},x:{type:"string"},y:{type:"string"},placement:{type:"string"}}},refs:{popover:{eventListeners:{close:{handler:"handleClosePopover"}}},"option-*":{eventListeners:{click:{handler:"handleClickMenuItem"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} placement=${placement}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=background 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.type == 'label'",value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"label"}},{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"item"}},{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"separator"}}],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#option-${i} w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-",{type:1,path:"i"}," w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu"]}}],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}}],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"}," placement=",{type:1,path:"placement"}]}}],fast:!1}],fast:!1}};var ut={};P(ut,{handleActionClick:()=>Xs,handleBeforeMount:()=>qs,handleColorPickerChange:()=>ti,handleImageClick:()=>ii,handleInputChange:()=>Qs,handleOnUpdate:()=>Gs,handlePopoverInputChange:()=>Zs,handleSelectChange:()=>ei,handleSliderChange:()=>ri,handleSliderInputChange:()=>si,handleWaveformClick:()=>ni});var qs=e=>{let{store:t,props:r}=e;t.setFormValues(r.defaultValues)},Gs=(e,t)=>{let{oldAttrs:r,newAttrs:s}=e,{store:n,props:i,render:o}=t;r?.key!==s?.key&&(n.setFormValues(i.defaultValues),o())},ye=(e,t,r,s)=>{s(new CustomEvent("form-change",{detail:{name:e,fieldValue:t,formValues:r}}))},Xs=(e,t)=>{let{store:r,dispatchEvent:s}=t,n=e.currentTarget.id.replace("action-","");s(new CustomEvent("action-click",{detail:{actionId:n,formValues:r.selectFormValues()}}))},Qs=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("input-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),ye(i,e.detail.value,r.selectFormValues(),s))},Zs=(e,t)=>{let{store:r,dispatchEvent:s}=t,n=e.currentTarget.id.replace("popover-input-","");n&&e.detail.value!==void 0&&(r.setFormFieldValue({name:n,value:e.detail.value,props}),ye(n,e.detail.value,r.selectFormValues(),s))},ei=(e,t)=>{let{store:r,dispatchEvent:s,render:n,props:i}=t,o=e.currentTarget.id.replace("select-","");o&&e.detail.selectedValue!==void 0&&(r.setFormFieldValue({name:o,value:e.detail.selectedValue,props:i}),ye(o,e.detail.selectedValue,r.selectFormValues(),s),n())},ti=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("colorpicker-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),ye(i,e.detail.value,r.selectFormValues(),s))},ri=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("slider-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),ye(i,e.detail.value,r.selectFormValues(),s))},si=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("slider-input-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),ye(i,e.detail.value,r.selectFormValues(),s))},ii=(e,t)=>{e.type==="contextmenu"&&e.preventDefault();let{dispatchEvent:r}=t,s=e.currentTarget.id.replace("image-","");r(new CustomEvent("extra-event",{detail:{name:s,x:e.clientX,y:e.clientY,trigger:e.type}}))},ni=(e,t)=>{e.type==="contextmenu"&&e.preventDefault();let{dispatchEvent:r}=t,s=e.currentTarget.id.replace("waveform-","");r(new CustomEvent("extra-event",{detail:{name:s,x:e.clientX,y:e.clientY,trigger:e.type}}))};var vt={};P(vt,{INITIAL_STATE:()=>Li,getFormFieldValue:()=>Bi,selectForm:()=>Ve,selectFormValues:()=>Di,selectState:()=>ji,setFormFieldValue:()=>Mi,setFormValues:()=>Wi,toViewData:()=>Pi});var g={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9},D={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8},Ae={NOT:0};var M=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},ge=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var ht=e=>{if(!e||e.trim()==="")throw new M("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new M(`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 M(`Incomplete comparison expression - missing right operand (got: '${e}')`)},xr=e=>{if(e.trim().endsWith(" in"))throw new M(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new M(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new M(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(t.includes(",")){let s=t.split(",").map(n=>n.trim());for(let n of s)if(!n)throw new M(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)}else if(!t.trim())throw new M(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)};var Er=(e,t)=>{if(t===null)return new ge(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new ge(`Cannot iterate over undefined value at '$for ${e}'`);let r=typeof t;return new ge(`Cannot iterate over non-array value (got: ${r}) at '$for ${e}'`)},_r=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new ge(`Unknown function '${e}' (${r})`)};var ai=(e,t,r={})=>O(e,r,t,{}),O=(e,t,r,s)=>{if(e.var&&!e.type)return F(e.var,r,s);if(e.type===g.LITERAL)return e.value;if(e.type===g.VARIABLE)return F(e.path,r,s);if(e.type===g.INTERPOLATION)return oi(e.parts,t,r,s);switch(e.type){case g.FUNCTION:return kr(e,t,r,s);case g.BINARY:return Ar(e,t,r,s);case g.UNARY:return Sr(e,t,r,s);case g.CONDITIONAL:return pi(e,t,r,s);case g.LOOP:return fi(e,t,r,s);case g.OBJECT:return yi(e,t,r,s);case g.ARRAY:return gi(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},ae=new Map,F=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=ae.get(e);s||(s=e.split("."),ae.set(e,s));let n=t;for(let i=0;i<s.length;i++){let o=s[i];if(o in r){n=r[o];continue}if(n==null)return;n=n[o]}return n},oi=(e,t,r,s)=>{let n=[];for(let i of e)if(typeof i=="string")n.push(i);else{let o=O(i,t,r,s);n.push(o!=null?String(o):"")}return n.join("")},kr=(e,t,r,s)=>{let n=t[e.name];if(!n)throw _r(e.name,t);let i=e.args.map(o=>O(o,t,r,s));return n(...i)},Le=(e,t,r,s)=>{if(e.var&&!e.type)return F(e.var,r,s);switch(e.type){case g.VARIABLE:return F(e.path,r,s);case g.LITERAL:return e.value;case g.BINARY:return Ar(e,t,r,s);case g.UNARY:return Sr(e,t,r,s);case g.FUNCTION:return kr(e,t,r,s);default:return O(e,t,r,s)}},Ar=(e,t,r,s)=>{if(e.op===D.AND||e.op===D.OR){let o=Le(e.left,t,r,s),a=Le(e.right,t,r,s);switch(e.op){case D.AND:return o&&a;case D.OR:return o||a}}let n=O(e.left,t,r,s),i=O(e.right,t,r,s);switch(e.op){case D.EQ:return n==i;case D.NEQ:return n!=i;case D.GT:return n>i;case D.LT:return n<i;case D.GTE:return n>=i;case D.LTE:return n<=i;case D.IN:return Array.isArray(i)?i.includes(n):!1;default:throw new Error(`Unknown binary operator: ${e.op}`)}},Sr=(e,t,r,s)=>{let n=e.op===Ae.NOT?Le(e.operand,t,r,s):O(e.operand,t,r,s);switch(e.op){case Ae.NOT:return!n;default:throw new Error(`Unknown unary operator: ${e.op}`)}},li=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let n=e.conditions[0];if(n.type===g.VARIABLE)if(F(n.path,r,s)){let o=e.bodies[0];if(o.type===g.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?O(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===g.LITERAL)a[p]=u.value;else if(u.type===g.VARIABLE)a[p]=F(u.path,r,s);else if(u.type===g.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===g.VARIABLE){let m=F(d.path,r,s);c.push(m!=null?String(m):"")}else{let m=O(d,t,r,s);c.push(m!=null?String(m):"")}a[p]=c.join("")}else a[p]=O(u,t,r,s)}return a}}else{let o=e.bodies[1];if(o.type===g.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?O(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===g.LITERAL)a[p]=u.value;else if(u.type===g.VARIABLE)a[p]=F(u.path,r,s);else if(u.type===g.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===g.VARIABLE){let m=F(d.path,r,s);c.push(m!=null?String(m):"")}else{let m=O(d,t,r,s);c.push(m!=null?String(m):"")}a[p]=c.join("")}else a[p]=O(u,t,r,s)}return a}}}return null},pi=(e,t,r,s)=>{let n=li(e,t,r,s);if(n!==null)return n;for(let i=0;i<e.conditions.length;i++){let o=e.conditions[i];if(o===null||Le(o,t,r,s))return O(e.bodies[i],t,r,s)}return $r},ci=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===g.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===g.VARIABLE){let n=r.conditions[0].path,i=r.bodies[0];if(n.startsWith(s+".")){let o=n.substring(s.length+1);if(i.type===g.OBJECT&&i.properties.length<=5){for(let l of i.properties)if(l.parsedKey)return null;let a=[];for(let l=0;l<t.length;l++){let p=t[l];if(p[o]){let u={};for(let c of i.properties){let d=c.key,m=c.value;if(m.type===g.LITERAL)u[d]=m.value;else if(m.type===g.VARIABLE){let h=m.path;if(h===s)u[d]=p;else if(h.startsWith(s+".")){let f=h.substring(s.length+1);u[d]=p[f]}else return null}else if(m.type===g.INTERPOLATION){let h=[],f=!0;for(let y of m.parts)if(typeof y=="string")h.push(y);else if(y.type===g.VARIABLE){let v=y.path;if(v===s)h.push(p!=null?String(p):"");else if(v.startsWith(s+".")){let w=v.substring(s.length+1),b=p[w];h.push(b!=null?String(b):"")}else{f=!1;break}}else{f=!1;break}if(!f)return null;u[d]=h.join("")}else return null}a.push(u)}}return a}}}return null},ui=(e,t)=>{let r=e.body,s=e.itemVar,n=ci(e,t);if(n!==null)return n;if(r.type===g.OBJECT&&r.properties.length<=5){for(let a of r.properties)if(a.parsedKey)return null;let i=[],o=!0;for(let a of r.properties){let l=a.key,p=a.value;if(p.type===g.LITERAL)i.push({key:l,type:"literal",value:p.value});else if(p.type===g.VARIABLE){let u=p.path;if(u===s)i.push({key:l,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes("."))i.push({key:l,type:"prop",prop:c});else{o=!1;break}}else{o=!1;break}}else if(p.type===g.INTERPOLATION&&p.parts.length===1){let u=p.parts[0];if(u.type===g.VARIABLE){let c=u.path;if(c===s)i.push({key:l,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes("."))i.push({key:l,type:"prop_string",prop:d});else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}if(o){let a=new Array(t.length);if(i.length===3&&i[0].type==="prop"&&i[0].key==="id"&&i[1].type==="prop_string"&&i[1].key==="title"&&i[2].type==="prop"&&i[2].key==="completed")for(let l=0;l<t.length;l++){let p=t[l];a[l]={id:p.id,title:p.title!=null?String(p.title):"",completed:p.completed}}else for(let l=0;l<t.length;l++){let p=t[l],u={};for(let c of i)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=p;else if(c.type==="prop")u[c.key]=p[c.prop];else if(c.type==="item_string")u[c.key]=p!=null?String(p):"";else if(c.type==="prop_string"){let d=p[c.prop];u[c.key]=d!=null?String(d):""}a[l]=u}return a}}return null},hi=(e,t,r,s,n)=>{let i=[],o=e.body;if(o.type===g.OBJECT&&o.fast!==!1){let a=e.itemVar,l=e.indexVar;for(let p=0;p<n.length;p++){let u=n[p],c={},d={...s,[a]:u,...l&&{[l]:p}};for(let m of o.properties){let h=m.parsedKey?O(m.parsedKey,t,r,d):m.key,f=m.value;if(f.type===g.LITERAL)c[h]=f.value;else if(f.type===g.VARIABLE){let y=f.path;if(y===a)c[h]=u;else if(y===l)c[h]=p;else if(y.startsWith(a+".")){let v=y.substring(a.length+1);if(!v.includes("."))c[h]=u[v];else{let w=ae.get(v)||(ae.set(v,v.split(".")),ae.get(v)),b=u;for(let E of w){if(b==null){b=void 0;break}b=b[E]}c[h]=b}}else c[h]=F(y,r,{...s,[a]:u,...l&&{[l]:p}})}else if(f.type===g.INTERPOLATION){let y=[];for(let v of f.parts)if(typeof v=="string")y.push(v);else if(v.type===g.VARIABLE){let w=v.path,b;if(w===a)b=u;else if(w===l)b=p;else if(w.startsWith(a+".")){let E=w.substring(a.length+1);if(!E.includes("."))b=u[E];else{let A=ae.get(E)||(ae.set(E,E.split(".")),ae.get(E)),_=u;for(let $ of A){if(_==null){_=void 0;break}_=_[$]}b=_}}else b=F(w,r,{...s,[a]:u,...l&&{[l]:p}});y.push(b!=null?String(b):"")}else{let w={...s,[a]:u,...l&&{[l]:p}},b=O(v,t,r,w);y.push(b!=null?String(b):"")}c[h]=y.join("")}else{let y={...s,[a]:u,...l&&{[l]:p}};c[h]=O(f,t,r,y)}}i.push(c)}return i}return null},di=(e,t,r)=>{let s=e.body;if(s.type===g.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let i=s.properties[0].value;if(i.type===g.CONDITIONAL&&i.conditions.length===1&&i.conditions[0].type===g.VARIABLE&&i.conditions[0].path==="item.visible"){let o=i.bodies[0];if(o.type===g.OBJECT&&o.properties.length===2){let a=o.properties[0],l=o.properties[1];if(a.key==="id"&&a.value.type===g.VARIABLE&&a.value.path==="item.id"&&l.key==="$if item.highlighted"&&l.value.type===g.CONDITIONAL){let p=[];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),p.push(d)}}return p}}}}return null},fi=(e,t,r,s)=>{let n=O(e.iterable,t,r,s);if(!Array.isArray(n)){let a=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${e.iterable.path}`;throw Er(a,n)}if(!e.indexVar){let a=di(e,n,e.itemVar);if(a!==null)return a}if(!e.indexVar){let a=ui(e,n);if(a!==null)return a}let i=hi(e,t,r,s,n);if(i!==null)return i;let o=[];for(let a=0;a<n.length;a++){let l=e.indexVar?{...s,[e.itemVar]:n[a],[e.indexVar]:a}:{...s,[e.itemVar]:n[a]},p=O(e.body,t,r,l);Array.isArray(p)&&p.length===1?o.push(p[0]):o.push(p)}return o},mi=(e,t,r,s)=>{if(e.properties.length===1){let n=e.properties[0],i=n.parsedKey?O(n.parsedKey,t,r,s):n.key,o=n.value;if(o.type===g.OBJECT&&o.properties.length<=10){let a={},l={},p=!0;for(let u of o.properties){let c=u.parsedKey?O(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===g.LITERAL)l[c]=d.value;else if(d.type===g.VARIABLE)l[c]=F(d.path,r,s);else if(d.type===g.INTERPOLATION){let m=[];for(let h of d.parts)if(typeof h=="string")m.push(h);else if(h.type===g.VARIABLE){let f=F(h.path,r,s);m.push(f!=null?String(f):"")}else{p=!1;break}if(!p)break;l[c]=m.join("")}else if(d.type===g.OBJECT&&d.properties.length<=5){let m={};for(let h of d.properties){let f=h.key,y=h.value;if(y.type===g.LITERAL)m[f]=y.value;else if(y.type===g.VARIABLE)m[f]=F(y.path,r,s);else if(y.type===g.INTERPOLATION){let v=[];for(let w of y.parts)if(typeof w=="string")v.push(w);else if(w.type===g.VARIABLE){let b=F(w.path,r,s);v.push(b!=null?String(b):"")}else{p=!1;break}if(!p)break;m[f]=v.join("")}else{p=!1;break}}if(!p)break;l[c]=m}else{p=!1;break}}if(p)return a[i]=l,a}}return null},yi=(e,t,r,s)=>{let n=mi(e,t,r,s);if(n!==null)return n;if(e.fast){let l={};for(let p of e.properties){let u=p.parsedKey?O(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===g.LITERAL)l[u]=c.value;else if(c.type===g.VARIABLE)l[u]=F(c.path,r,s);else if(c.type===g.INTERPOLATION){let d=[];for(let m of c.parts)if(typeof m=="string")d.push(m);else if(m.type===g.VARIABLE){let h=F(m.path,r,s);d.push(h!=null?String(h):"")}else{let h=O(m,t,r,s);d.push(h!=null?String(h):"")}l[u]=d.join("")}else l[u]=O(c,t,r,s)}return l}let i={},o=null,a=!1;for(let l of e.properties)if(!l.key.startsWith("$if ")&&!l.key.match(/^\$if\s+\w+.*:?$/)&&!l.key.startsWith("$elif")&&!l.key.startsWith("$else")&&!l.key.startsWith("$for ")){a=!0;break}for(let l of e.properties)if(l.key.startsWith("$if ")||l.key.match(/^\$if\s+\w+.*:?$/)){let p=O(l.value,t,r,s);if(!a&&p!==null&&p!==void 0)return Array.isArray(p)&&p.length===1?p[0]:p;typeof p=="object"&&p!==null&&!Array.isArray(p)&&Object.assign(i,p)}else if(!l.key.startsWith("$for ")){let p=l.value;if(p&&p.type===g.OBJECT&&p.properties){let u=p.properties.find(c=>c.key.startsWith("$for "));if(u){let c=O(u.value,t,r,s);c!==void 0&&(i[l.key]=c)}else{let c=O(l.value,t,r,s);c!==void 0&&(i[l.key]=c)}}else{let u=l.parsedKey?O(l.parsedKey,t,r,s):l.key,c=O(l.value,t,r,s);c!==void 0&&(i[u]=c)}}return i},$r={},gi=(e,t,r,s)=>{let n=[];for(let i of e.items)if(i.type===g.LOOP){let o=O(i,t,r,s);n.push(o)}else{let o=O(i,t,r,s);o!==$r&&n.push(o)}return n},dt=ai;var vi=/\$\{([^}]*)\}/g,Ir=e=>{let t=e.match(/^(\w+)\((.*)\)$/);if(!t)return{isFunction:!1};let[,r,s]=t,n=bi(s);return{isFunction:!0,type:g.FUNCTION,name:r,args:n}},bi=e=>e.trim()?wi(e).map(r=>xi(r.trim())):[],wi=e=>{let t=[],r="",s=0,n=!1,i="";for(let o=0;o<e.length;o++){let a=e[o],l=o>0?e[o-1]:"";!n&&(a==='"'||a==="'")?(n=!0,i=a,r+=a):n&&a===i&&l!=="\\"?(n=!1,i="",r+=a):!n&&a==="("?(s++,r+=a):!n&&a===")"?(s--,r+=a):!n&&a===","&&s===0?(t.push(r),r=""):r+=a}return r&&t.push(r),t},xi=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:g.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:g.LITERAL,value:parseFloat(e)};if(e==="true")return{type:g.LITERAL,value:!0};if(e==="false")return{type:g.LITERAL,value:!1};if(e==="null")return{type:g.LITERAL,value:null};let t=Ir(e);return t.isFunction?{type:t.type,name:t.name,args:t.args}:{type:g.VARIABLE,path:e}},Ei=/^\w+\(.*\)$/,_i=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,ki=e=>{if(!(!e||e.trim()===""||Ei.test(e))&&_i.test(e))throw e.includes("?")&&e.includes(":")?new M(`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 M(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new M(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},Cr=(e,t={})=>{let r=e.trim();ki(r);let s=Ir(r);return s.isFunction?{type:s.type,name:s.name,args:s.args}:{type:g.VARIABLE,path:r}},ft=(e,t={})=>{let r=e,s=[];e.includes("\\${")&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(a,l)=>{let p=`__ESCAPED_${s.length}__`;return s.push(l),p}),r=r.replace(/\\DOUBLE_ESC/g,"\\"));let n=[...r.matchAll(vi)];if(n.length===0){let a=r;for(let l=0;l<s.length;l++)a=a.replace(`__ESCAPED_${l}__`,s[l]);return{type:g.LITERAL,value:a}}if(n.length===1&&n[0][0]===r&&s.length===0)return Cr(n[0][1],t);let i=[],o=0;for(let a of n){let[l,p]=a,u=a.index;if(u>o){let d=r.substring(o,u);for(let m=0;m<s.length;m++)d=d.replace(`__ESCAPED_${m}__`,s[m]);d&&i.push(d)}let c=Cr(p.trim(),t);i.push(c),o=u+l.length}if(o<r.length){let a=r.substring(o);for(let l=0;l<s.length;l++)a=a.replace(`__ESCAPED_${l}__`,s[l]);a&&i.push(a)}return{type:g.INTERPOLATION,parts:i}};var le=(e,t)=>typeof e=="string"?ft(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Ai(e,t):Si(e,t):{type:g.LITERAL,value:e},Ai=(e,t)=>{let r=[],s=!1;for(let n=0;n<e.length;n++){let i=e[n];if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let a=Object.keys(i);if(a.length===1&&a[0].startsWith("$for ")){let l=Or(a[0],i[a[0]],t);r.push(l),s=!0;continue}}let o=le(i,t);r.push(o),(o.type===g.FUNCTION||o.type===g.CONDITIONAL||o.type===g.LOOP||o.type===g.OBJECT&&!o.fast||o.type===g.ARRAY&&!o.fast)&&(s=!0)}return{type:g.ARRAY,items:r,fast:!s}},Si=(e,t)=>{let r=[],s=!1,n=Object.entries(e),i=0;for(;i<n.length;){let[o,a]=n[i];if(o.startsWith("$if ")||o.match(/^\$if#\w+\s/)||o.match(/^\$if\s+\w+.*:$/)){let l=$i(n,i,t);r.push({key:o,value:l.node}),s=!0,i=l.nextIndex}else if(o.startsWith("$for ")){let l=Or(o,a,t);r.push({key:o,value:l}),s=!0,i++}else{if(o.startsWith("$elif ")||o.startsWith("$else"))throw new M(`'${o.split(" ")[0]}' without matching '$if'`);if(o==="$if"||o==="$if:")throw new M("Missing condition expression after '$if'");{let l=le(a,t);(l.type===g.FUNCTION||l.type===g.CONDITIONAL||l.type===g.LOOP||l.type===g.OBJECT&&!l.fast||l.type===g.ARRAY&&!l.fast)&&(s=!0);let p=ft(o,t),u={key:o,value:l};(p.type!==g.LITERAL||p.value!==o)&&(u.parsedKey=p),r.push(u),i++}}}return{type:g.OBJECT,properties:r,fast:!s}},$i=(e,t,r={})=>{let s=[],n=[],i=t,[o,a]=e[i],l=null,p;if(o.startsWith("$if#")){let c=o.match(/^\$if#(\w+)\s+(.+)$/);if(c)l=c[1],p=c[2];else throw new M(`Invalid conditional syntax: ${o}`)}else p=o.substring(4),p.endsWith(":")&&(p=p.slice(0,-1).trim());ht(p);let u=ie(p);for(s.push(u),n.push(le(a,r)),i++;i<e.length;){let[c,d]=e[i],m=!1,h;if(l?c.startsWith(`$elif#${l} `)?(h=c.substring(`$elif#${l} `.length),h.endsWith(":")&&(h=h.slice(0,-1).trim()),m=!0):(c===`$else#${l}`||c===`$else#${l}:`)&&(m=!0,h=null):c.startsWith("$elif ")?(h=c.substring(6),h.endsWith(":")&&(h=h.slice(0,-1).trim()),m=!0):(c==="$else"||c==="$else:")&&(m=!0,h=null),m){if(h===null)s.push(null);else{ht(h);let f=ie(h);s.push(f)}if(n.push(le(d,r)),i++,h===null)break}else break}return{node:{type:g.CONDITIONAL,conditions:s,bodies:n,id:l},nextIndex:i}},ie=e=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")"))return ie(e.slice(1,-1));let t=Ne(e,"||");if(t!==-1)return{type:g.BINARY,op:D.OR,left:ie(e.substring(0,t).trim()),right:ie(e.substring(t+2).trim())};let r=Ne(e,"&&");if(r!==-1)return{type:g.BINARY,op:D.AND,left:ie(e.substring(0,r).trim()),right:ie(e.substring(r+2).trim())};let s=[{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:i,type:o}of s){let a=Ne(e,i);if(a!==-1)return{type:g.BINARY,op:o,left:ie(e.substring(0,a).trim()),right:ie(e.substring(a+i.length).trim())}}let n=[" + "," - "," * "," / "," % "];for(let i of n)if(Ne(e,i)!==-1)throw new M(`Arithmetic expressions not supported in conditionals - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`);return e.startsWith("!")?{type:g.UNARY,op:Ae.NOT,operand:ie(e.substring(1).trim())}:Ci(e)},Ne=(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},Ci=e=>{if(e=e.trim(),e==="true")return{type:g.LITERAL,value:!0};if(e==="false")return{type:g.LITERAL,value:!1};if(e==="null")return{type:g.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:g.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:g.LITERAL,value:""};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:g.LITERAL,value:t}:{type:g.VARIABLE,path:e}},Or=(e,t,r)=>{let s=e.substring(5).trim();xr(s);let n=s.match(/^(.+?)\s+in\s+(.+)$/);if(!n)throw new M(`Invalid loop syntax - missing 'in' keyword (got: '$for ${s}')`);let i=n[1].trim(),o=n[2].trim(),a,l=null;if(i.includes(",")){let c=i.split(",").map(d=>d.trim());if(c.length!==2)throw new M(`Invalid loop variables: ${i}. Expected format: "item" or "item, index"`);a=c[0],l=c[1]}else a=i;let p={type:g.VARIABLE,path:o},u=le(t,r);return{type:g.LOOP,itemVar:a,indexVar:l,iterable:p,body:u}};var Ii=(e,t={})=>{let{functions:r={}}=t;return le(e,r)},mt=Ii;var yt={};P(yt,{now:()=>Oi});var Oi=()=>Date.now();var Ti=(e,t,r={})=>{let{functions:s={}}=r,n={...yt,...s},i=mt(e,{functions:n});return dt(i,t,n)},gt=Ti;function Tr(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}var Li=Object.freeze({formValues:{}}),Lr=(e,t,r=void 0)=>{let s=t.split(/[\[\].]/).filter(i=>i!==""),n=e;for(let i of s){if(n==null||!(i in n))return r;n=n[i]}return n},Ni=(e,t,r)=>{let s=t.split(/[\[\].]/).filter(i=>i!=="");t.includes("[")&&t in e&&delete e[t];let n=e;for(let i=0;i<s.length-1;i++){let o=s[i];if(!(o in n)||typeof n[o]!="object"||n[o]===null){let a=s[i+1],l=/^\d+$/.test(a);n[o]=l?[]:{}}n=n[o]}return n[s[s.length-1]]=r,e},Vi=["id","class","style","slot"],Ri=e=>Object.entries(e).filter(([t])=>!Vi.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ve=({state:e,props:t})=>{let{form:r}=t,{context:s}=t;return s?gt(r,s):r},Pi=({state:e,props:t,attrs:r})=>{let s=Ri(r),n=t.defaultValues||{},i=Ve({state:e,props:t}),o=structuredClone(i.fields||[]);return o.forEach(a=>{if(a.defaultValue=Lr(n,a.name),a.inputType==="image"){let l=a.src;a.imageSrc=l&&l.trim()?l:null,a.placeholderText=a.placeholder||"No Image"}if(a.inputType==="waveform"){let l=a.waveformData;a.waveformData=l||null,a.placeholderText=a.placeholder||"No Waveform"}}),{containerAttrString:s,title:i?.title||"",description:i?.description||"",fields:o,actions:t?.form?.actions||{buttons:[]},formValues:e.formValues}},ji=({state:e})=>e,Di=({state:e,props:t})=>{let r=Ve({state:e,props:t});return Tr(e.formValues,r.fields.map(s=>s.name))},Bi=({state:e},t)=>Lr(e.formValues,t),Wi=(e,t)=>{e.formValues=t||{}},Mi=(e,{name:t,value:r,props:s})=>{Ni(e.formValues,t,r);let n=Ve({state:e,props:s}),i=Tr(e.formValues,n.fields.map(o=>o.name));e.formValues=i};var Nr={elementName:"rtgl-form",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{defaultValues:{type:"object"},context:{type:"object"},form:{type:"object",properties:{title:{type:"string"},description:{type:"string"},fields:{type:"array",items:{anyOf:[{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"inputText"},placeholder:{type:"string"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"select"},placeholder:{type:"string"},options:{type:"array",items:{type:"object",properties:{id:{type:"string"},label:{type:"string"},value:{type:"any"}},required:["id","label","value"]}}},required:["name","label","inputType","options"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"colorPicker"},value:{type:"string"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"slider"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"slider-input"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"image"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"waveform"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"},defaultValue:{type:"object"},waveformData:{type:"object"}},required:["name","label","inputType"],additionalProperties:!1}]}},actions:{type:"object",properties:{buttons:{type:"array",items:{type:"object",properties:{id:{type:"string"},content:{type:"string"}},required:["id","content"]}}}}}}}},refs:{"action-*":{eventListeners:{click:{handler:"handleActionClick"}}},"input-*":{eventListeners:{"input-change":{handler:"handleInputChange"}}},"select-*":{eventListeners:{"select-change":{handler:"handleSelectChange"}}},"colorpicker-*":{eventListeners:{"colorpicker-change":{handler:"handleColorPickerChange"}}},"slider-*":{eventListeners:{"slider-change":{handler:"handleSliderChange"}}},"slider-input-*":{eventListeners:{"slider-input-value-change":{handler:"handleSliderInputChange"}}},"image-*":{eventListeners:{click:{handler:"handleImageClick"},contextmenu:{handler:"handleImageClick"}}},"waveform-*":{eventListeners:{click:{handler:"handleWaveformClick"},contextmenu:{handler:"handleWaveformClick"}}},"popover-input-*":{eventListeners:{"input-change":{handler:"handlePopoverInputChange"}}}},events:{"form-change":{},"extra-event":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=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:"rtgl-text s=lg",value:{type:1,path:"title"}}],fast:!0},{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"description"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view g=lg w=f",value:{type:9,items:[{type:7,itemVar:"field",indexVar:"i",iterable:{type:1,path:"fields"},body:{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:"rtgl-text",value:{type:1,path:"field.label"}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:'$if field.inputType == "read-only-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"read-only-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"field.defaultValue"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "inputText"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"inputText"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input#input-${field.name} w=f placeholder=${field.placeholder} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input-",{type:1,path:"field.name"}," w=f placeholder=",{type:1,path:"field.placeholder"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "popover-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"popover-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-popover-input#popover-input-${field.name} label="${field.label}" .defaultValue=fields[${i}].defaultValue',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-popover-input#popover-input-",{type:1,path:"field.name"},' label="',{type:1,path:"field.label"},'" .defaultValue=fields[',{type:1,path:"i"},"].defaultValue"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "select"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"select"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-select#select-${field.name} w=f .options=fields[${i}].options .placeholder=fields[${i}].placeholder .selectedValue=fields[${i}].defaultValue",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-select#select-",{type:1,path:"field.name"}," w=f .options=fields[",{type:1,path:"i"},"].options .placeholder=fields[",{type:1,path:"i"},"].placeholder .selectedValue=fields[",{type:1,path:"i"},"].defaultValue"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "colorPicker"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"colorPicker"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-color-picker#colorpicker-${field.name} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-color-picker#colorpicker-",{type:1,path:"field.name"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slider"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slider"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider#slider-${field.name} w=f min=${field.min} max=${field.max} step=${field.step} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider-",{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"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slider-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slider-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider-input#slider-input-${field.name} w=f min=${field.min} max=${field.max} step=${field.step} defaultValue=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider-input#slider-input-",{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"}," defaultValue=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "image" && field.imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"image"}},right:{type:1,path:"field.imageSrc"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image#image-${field.name} src=${field.imageSrc} w=${field.width} h=${field.height} cur=p",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image#image-",{type:1,path:"field.name"}," src=",{type:1,path:"field.imageSrc"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=p"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "image" && !field.imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},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.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p 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.name"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," bc=ac bw=sm ah=c av=c cur=p p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "waveform" && field.waveformData',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"waveform"}},right:{type:1,path:"field.waveformData"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-waveform#waveform-${field.name} .waveformData=fields[${i}].waveformData w=${field.width} h=${field.height} cur=p",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-waveform#waveform-",{type:1,path:"field.name"}," .waveformData=fields[",{type:1,path:"i"},"].waveformData w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=p"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "waveform" && !field.waveformData',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"waveform"}},right:{type:5,op:0,operand:{type:1,path:"field.waveformData"}}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view#waveform-${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg ta=c",value:{type:1,path:"field.placeholder"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#waveform-",{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=p p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=e g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions.buttons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action-${button.id}",value:{type:1,path:"button.content"},parsedKey:{type:2,parts:["rtgl-button#action-",{type:1,path:"button.id"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f h=f p=md g=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var bt={};P(bt,{handleClickStart:()=>Ki});var Ki=(e,t)=>{let{dispatchEvent:r,store:s}=t;console.log("handle click start",s.selectPath()),r(new CustomEvent("clickStart",{detail:{path:s.selectPath()}}))};var wt={};P(wt,{INITIAL_STATE:()=>Fi,selectPath:()=>Ji,setState:()=>Yi,toViewData:()=>Hi});var Fi=Object.freeze({}),zi=["id","class","style","slot"],Ui=e=>Object.entries(e).filter(([t])=>!zi.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Hi=({state:e,props:t,attrs:r})=>{console.log("attrs",{attrs:r,entries:Object.entries(r)});let s=r.start?JSON.parse(decodeURIComponent(r.start)):t.start;return{containerAttrString:Ui(r),start:s||{label:"",image:{src:"",width:32,height:32,alt:""}}}},Ji=({props:e})=>e.start.path,Yi=e=>{};var Vr={elementName:"rtgl-navbar",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}},hasImage:{type:"boolean"},hasHref:{type:"boolean"}}}}},propsSchema:{type:"object",properties:{start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}}}}}},refs:{start:{eventListeners:{click:{handler:"handleClickStart"}}}},events:{clickStart:{type:"object",properties:{path:{type:"string"}}}},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=lg 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=lg g=md cur=p",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=lg 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 flex=1",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 xt={};P(xt,{handleBeforeMount:()=>Gi});var Rr=(e,t)=>{let{store:r,render:s}=t,n,i=-1/0;e.forEach(o=>{let a=o.getBoundingClientRect();a.top<=20&&a.top>i&&(i=a.top,n=o.id)}),n&&n!==r.selectCurrentId()&&(r.setCurrentId(n),s())},qi=(e,t)=>{let{store:r,render:s}=t,n=e.querySelectorAll("rtgl-text[id]"),i=Array.from(n),o=i.map(l=>({id:l.id,href:`#${l.id}`,title:l.textContent}));r.setItems(o),Rr(i,t),s();let a=Rr.bind(void 0,i,t);return e.addEventListener("scroll",a,{passive:!0}),()=>{e.removeEventListener("scroll",a)}},Gi=e=>{let{attrs:t}=e;requestAnimationFrame(()=>{let r=document.getElementById(t["target-id"]),s=qi(r,e);return()=>{s()}})};var Et={};P(Et,{INITIAL_STATE:()=>Xi,selectCurrentId:()=>en,selectState:()=>Zi,setContentContainer:()=>sn,setCurrentId:()=>rn,setItems:()=>tn,toViewData:()=>Qi});var Xi=Object.freeze({items:[],currentId:null,contentContainer:null}),Qi=({state:e})=>({items:e.items.map(t=>({...t,c:t.id===e.currentId?"fg":"mu-fg"})),currentId:e.currentId}),Zi=({state:e})=>e,en=({state:e})=>e.currentId,tn=(e,t)=>{e.items=t},rn=(e,t)=>{e.currentId=t},sn=(e,t)=>{e.contentContainer=t};var Pr={elementName:"rtgl-page-outline",viewDataSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{slug:{type:"string"},title:{type:"string"}}}},selectedSlug:{type:"string",nullable:!0}}},propsSchema:{type:"object",properties:{}},refs:{},events:{onItemClick:{type:"object"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=272",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f g=sm 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 pv=xs av=c href=${item.href}",value:{type:9,items:[{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 pv=xs av=c href=",{type:1,path:"item.href"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}};var _t={};P(_t,{handleBeforeMount:()=>nn,handleInputChange:()=>pn,handleInputKeydown:()=>un,handleOnUpdate:()=>an,handlePopoverClose:()=>ln,handleSubmitClick:()=>cn,handleTextClick:()=>on});var nn=e=>{let{store:t,props:r}=e;(r.value!==void 0||r.defaultValue!==void 0)&&t.setValue(r.value||r.defaultValue||"")},an=(e,t)=>{let{oldProps:r,newProps:s}=e,{store:n,props:i,render:o}=t;r.defaultValue!==s.defaultValue&&n.setValue(i.defaultValue||""),o()},on=(e,t)=>{let{store:r,render:s,getRefIds:n,attrs:i}=t,o=r.selectValue();r.setTempValue(o),r.openPopover({position:{x:e.currentTarget.getBoundingClientRect().left,y:e.currentTarget.getBoundingClientRect().bottom}});let{input:a}=n();a.elm.value=o,s(),i["auto-focus"]&&setTimeout(()=>{a.elm.focus()},50)},ln=(e,t)=>{let{store:r,render:s}=t;r.closePopover(),s()},pn=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=e.detail.value;r.setTempValue(i),n(new CustomEvent("temp-input-change",{detail:{value:i},bubbles:!0})),s()},cn=(e,t)=>{let{store:r,render:s,dispatchEvent:n,getRefIds:i}=t,{input:o}=i(),a=o.elm.value;r.setValue(a),r.closePopover(),n(new CustomEvent("input-change",{detail:{value:a},bubbles:!0})),s()},un=(e,t)=>{let{store:r,render:s,dispatchEvent:n,getRefIds:i}=t;if(e.key==="Enter"){let{input:o}=i(),a=o.elm.value;r.closePopover(),n(new CustomEvent("input-change",{detail:{value:a},bubbles:!0})),s()}else e.key==="Escape"&&(r.closePopover(),s())};var kt={};P(kt,{INITIAL_STATE:()=>hn,closePopover:()=>yn,openPopover:()=>mn,selectValue:()=>vn,setTempValue:()=>fn,setValue:()=>gn,toViewData:()=>dn});var hn=Object.freeze({isOpen:!1,position:{x:0,y:0},value:"",tempValue:""}),dn=({attrs:e,state:t,props:r})=>{let s=t.value||"-";return{isOpen:t.isOpen,position:t.position,value:s??"-",tempValue:t.tempValue,placeholder:r.placeholder??"",label:e.label}},fn=(e,t)=>{e.tempValue=t},mn=(e,t)=>{let{position:r}=t;e.position=r,e.isOpen=!0,e.hasUnsavedChanges=!1},yn=e=>{e.isOpen=!1,e.tempValue=""},gn=(e,t)=>{e.value=t},vn=({state:e})=>e.value;var jr={elementName:"rtgl-popover-input",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{"auto-focus":{type:"boolean"}}},propsSchema:{type:"object",properties:{value:{type:"string"},defaultValue:{type:"string"},placeholder:{type:"string"},onChange:{type:"function"}}},refs:{"text-display":{eventListeners:{click:{handler:"handleTextClick"}}},popover:{eventListeners:{close:{handler:"handlePopoverClose"}}},input:{eventListeners:{"input-change":{handler:"handleInputChange"},keydown:{handler:"handleInputKeydown"}}},submit:{eventListeners:{click:{handler:"handleSubmitClick"}}}},events:{"input-change":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#text-display w=f cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"value"}}],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=background 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}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f placeholder=",{type:1,path:"placeholder"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#submit",value:{type:0,value:"Submit"}}],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 At={};P(At,{handleBeforeMount:()=>bn,handleButtonClick:()=>wn,handleClickOptionsPopoverOverlay:()=>xn,handleOptionClick:()=>En});var bn=e=>{let{store:t,props:r,render:s}=e;if(r.selectedValue!==null&&r.selectedValue!==void 0&&r.options){let n=r.options.find(i=>i.value===r.selectedValue);n&&(t.updateSelectOption(n),s())}},wn=(e,t)=>{let{store:r,render:s,getRefIds:n}=t;r.openOptionsPopover({position:{y:e.clientY,x:e.clientX}}),s()},xn=(e,t)=>{let{store:r,render:s}=t;r.closeOptionsPopover(),s()},En=(e,t)=>{let{render:r,dispatchEvent:s,props:n,store:i}=t,o=e.currentTarget.id.replace("option-",""),a=n.options[o];i.updateSelectOption(a),n.onChange&&typeof n.onChange=="function"&&n.onChange(a.value),s(new CustomEvent("option-selected",{detail:{value:a.value,label:a.label},bubbles:!0})),s(new CustomEvent("select-change",{detail:{selectedValue:a.value},bubbles:!0})),r()};var St={};P(St,{INITIAL_STATE:()=>_n,closeOptionsPopover:()=>$n,openOptionsPopover:()=>Sn,selectState:()=>An,toViewData:()=>kn,updateSelectOption:()=>Cn});var _n=Object.freeze({isOpen:!1,position:{x:0,y:0},selectedValue:null,selectedLabel:null}),kn=({state:e,props:t})=>{let r=t.placeholder||"Select an option",s=e.selectedValue!==null?e.selectedValue:t.selectedValue;if(s!=null&&t.options){let i=t.options.find(o=>o.value===s);i&&(r=i.label)}else e.selectedLabel&&(r=e.selectedLabel);let n=(t.options||[]).map(i=>({...i,isSelected:i.value===s,bgc:i.value===s?"mu":""}));return{isOpen:e.isOpen,position:e.position,options:n,selectedValue:s,selectedLabel:r,placeholder:t.placeholder||"Select an option"}},An=({state:e})=>e,Sn=(e,t)=>{let{position:r}=t;e.position=r,e.isOpen=!0},$n=e=>{e.isOpen=!1},Cn=(e,t)=>{e.selectedValue=t.value,e.selectedLabel=t.label,e.isOpen=!1};var Dr={elementName:"rtgl-select",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{options:{type:"array",items:{type:"object",properties:{id:{type:"string"},label:{type:"string"},value:{type:"any"}}}},selectedValue:{type:"any"},placeholder:{type:"string"},onChange:{type:"function"}}},refs:{"select-button":{eventListeners:{click:{handler:"handleButtonClick"}}},popover:{eventListeners:{close:{handler:"handleClickOptionsPopoverOverlay"}}},"option-*":{eventListeners:{click:{handler:"handleOptionClick"}}}},events:{},template:{type:9,items:[{type:8,properties:[{key:"rtgl-button#select-button v=ol",value:{type:9,items:[{type:1,path:"selectedLabel"}],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 wh=300 g=xs slot=content bgc=background 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 h-bgc=ac ph=lg pv=md cur=p br=md bgc=${option.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"option.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-",{type:1,path:"i"}," w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=",{type:1,path:"option.bgc"}]}}],fast:!0}],fast:!0}}],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"}]}}],fast:!1}],fast:!1}};var $t={};P($t,{handleHeaderClick:()=>In,handleItemClick:()=>On});var In=(e,t)=>{let{store:r,dispatchEvent:s}=t,n,i=r.selectHeader();e.currentTarget.id==="header-label"?n=i.labelPath:e.currentTarget.id==="header-image"?n=i.image.path:e.currentTarget.id==="header"&&(n=i.path),s(new CustomEvent("headerClick",{detail:{path:n},bubbles:!0,composed:!0}))},On=(e,t)=>{let{store:r,dispatchEvent:s}=t,n=e.currentTarget.id.replace("item-",""),i=r.selectItem(n);s(new CustomEvent("itemClick",{detail:{item:i},bubbles:!0,composed:!0}))};var It={};P(It,{INITIAL_STATE:()=>Tn,selectActiveItem:()=>Pn,selectHeader:()=>Rn,selectItem:()=>jn,setState:()=>Dn,toViewData:()=>Vn});var Tn=Object.freeze({}),Ln=["id","class","style","slot"],Nn=e=>Object.entries(e).filter(([t])=>!Ln.includes(t)).map(([t,r])=>`${t}=${r}`).join(" ");function Ct(e,t=null){let r=[];for(let s of e){let n=s.id||s.href||s.path,i=t===n;if(r.push({id:n,title:s.title,href:s.href,type:s.type||"item",icon:s.icon,hrefAttr:s.href?`href=${s.href}`:"",isSelected:i,itemBgc:i?"ac":"bg",itemHoverBgc:i?"ac":"mu"}),s.items&&Array.isArray(s.items))for(let o of s.items){let a=o.id||o.href||o.path,l=t===a;r.push({id:a,title:o.title,href:o.href,type:o.type||"item",icon:o.icon,hrefAttr:o.href?`href=${o.href}`:"",isSelected:l,itemBgc:l?"ac":"bg",itemHoverBgc:l?"ac":"mu"})}}return r}var Vn=({state:e,props:t,attrs:r})=>{let s=r.header?JSON.parse(decodeURIComponent(r.header)):t.header,n=r.items?JSON.parse(decodeURIComponent(r.items)):t.items,i=r.selectedItemId||t.selectedItemId,o=Nn(r),a=r.mode||"full",l=s||{label:"",path:"",image:{src:"",alt:"",width:0,height:0}},p=n?Ct(n,i):[],u=a==="full"?272:64,c=a==="full"?"fs":"c",d=a==="full"?"fs":"c",m=a==="full"?"lg":"sm",h=a==="full"?"md":"sm",f=a==="shrunk-lg"?48:40,y=a==="shrunk-lg"?28:20,v=a==="shrunk-lg"?"md":"sm",w=a==="full",b=a==="full",E=a==="full"?"fs":"c",A=a==="full"?"":`ah=${d}`,_=a==="full"?"f":f;return{containerAttrString:o,mode:a,header:l,items:p,sidebarWidth:u,headerAlign:c,itemAlign:d,headerPadding:m,itemPadding:h,itemHeight:f,iconSize:y,firstLetterSize:v,showLabels:w,showGroupLabels:b,itemContentAlign:E,itemAlignAttr:A,itemWidth:_,headerWidth:_,selectedItemId:i,ah:a==="shrunk-lg"||a==="shrunk-md"?"c":""}},Rn=({state:e,props:t,attrs:r})=>r.header?JSON.parse(decodeURIComponent(r.header)):t.header,Pn=({state:e,props:t})=>(t.items?Ct(t.items):[]).find(s=>s.active),jn=({state:e,props:t,attrs:r},s)=>{let n=r.items?JSON.parse(decodeURIComponent(r.items)):t.items;return(n?Ct(n):[]).find(o=>o.id===s)},Dn=e=>{};var Br={elementName:"rtgl-sidebar",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},mode:{type:"string",enum:["full","shrunk","shrunk-lg"],default:"full"},sidebarWidth:{type:"number"},headerAlign:{type:"string"},itemAlign:{type:"string"},headerPadding:{type:"string"},itemPadding:{type:"string"},itemHeight:{type:"number"},iconSize:{type:"number"},firstLetterSize:{type:"string"},showLabels:{type:"boolean"},showGroupLabels:{type:"boolean"},itemContentAlign:{type:"string"},itemAlignAttr:{type:"string"},itemWidth:{type:"string"},headerWidth:{type:"string"},selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{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"},active:{type:"boolean"},icon:{type:"string"}}}}}},propsSchema:{type:"object",properties:{selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{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"}}}}}},refs:{"header-image":{eventListeners:{click:{handler:"handleHeaderClick"}}},"header-label":{eventListeners:{click:{handler:"handleHeaderClick"}}},header:{eventListeners:{click:{handler:"handleHeaderClick"}}},"item-*":{eventListeners:{click:{handler:"handleItemClick"}}}},events:{headerClick:{type:"object",properties:{path:{type:"string"}}}},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#header-image cur=p":[{'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#header-label cur=p":[{"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} bwr=xs ah=${ah} ${containerAttrString}",value:{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#header-image cur=p",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#header-label cur=p",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=p",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#header-image cur=p",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#header-label cur=p",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=p"]}}],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},{type:8,properties:[{key:"rtgl-view w=f 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-bg",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-${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=p",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:"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=p"]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f 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"}," bwr=xs ah=",{type:1,path:"ah"}," ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Ot={};P(Ot,{handleBeforeMount:()=>Bn,handleValueChange:()=>Wn});var Bn=e=>{let{store:t,attrs:r}=e;t.setValue(r.defaultValue||0)},Wn=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=Number(e.detail.value);r.setValue(i),s(),n(new CustomEvent("slider-input-value-change",{detail:{value:i},bubbles:!0}))};var Tt={};P(Tt,{INITIAL_STATE:()=>Mn,setValue:()=>Fn,toViewData:()=>Kn});var Mn=Object.freeze({value:0}),Kn=({state:e,attrs:t})=>({value:e.value,w:t.w||"",min:t.min||0,max:t.max||100,step:t.step||1}),Fn=(e,t)=>{e.value=t};var Wr={elementName:"rtgl-slider-input",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{defaultValue:{type:"string",default:"0"},w:{type:"string",default:""},min:{type:"string",default:"0"},max:{type:"string",default:"100"},step:{type:"string",default:"1"}}},refs:{input:{eventListeners:{"input-change":{handler:"handleValueChange"}}},slider:{eventListeners:{"slider-change":{handler:"handleValueChange"}}}},events:{"form-change":{}},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 w=f type=range min=${min} max=${max} step=${step} value=${value}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider w=f type=range min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=84",value:{type:9,items:[{type:8,properties:[{key:"rtgl-input#input w=f type=number min=${min} max=${max} step=${step} value=${value}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f type=number min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}]}}],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 Lt={};P(Lt,{handleBeforeMount:()=>zn,handleHeaderClick:()=>Hn,handleRowClick:()=>Un});var zn=e=>{},Un=(e,t)=>{let{dispatchEvent:r,props:s}=t,n=parseInt(e.currentTarget.id.replace("row-","")),i=s.data?.rows?.[n];i&&r(new CustomEvent("row-click",{detail:{rowIndex:n,rowData:i}}))},Hn=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=e.currentTarget.id.replace("header-",""),o=r.selectSortInfo(),a="asc";o.column===i&&(o.direction==="asc"?a="desc":o.direction==="desc"&&(a=null)),a?r.setSortColumn({column:i,direction:a}):r.clearSort(),s(),n(new CustomEvent("header-click",{detail:{column:i,direction:a,sortInfo:a?{column:i,direction:a}:null}}))};var Nt={};P(Nt,{INITIAL_STATE:()=>Jn,clearSort:()=>ta,selectSortInfo:()=>Zn,selectState:()=>Qn,setSortColumn:()=>ea,toViewData:()=>Xn});var Jn=Object.freeze({sortColumn:null,sortDirection:null}),Yn=["id","class","style","slot"],qn=e=>Object.entries(e).filter(([t])=>!Yn.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Gn=(e,t)=>{let r=t.split("."),s=e;for(let n of r){if(s==null)return null;s=s[n]}return s},Xn=({state:e,props:t,attrs:r})=>{let s=qn(r),n=t.data||{columns:[],rows:[]},i=n.rows.map((o,a)=>{let l=n.columns.map(p=>{let u=Gn(o,p.key);return{key:p.key,value:u!=null?String(u):""}});return{index:a,cells:l}});return{containerAttrString:s,columns:n.columns||[],rows:i||[]}},Qn=({state:e})=>e,Zn=({state:e})=>({column:e.sortColumn,direction:e.sortDirection}),ea=(e,{column:t,direction:r})=>{e.sortColumn=t,e.sortDirection=r},ta=e=>{e.sortColumn=null,e.sortDirection=null};var Mr={elementName:"rtgl-table",viewDataSchema:{type:"object",properties:{columns:{type:"array"},rows:{type:"array"},containerAttrString:{type:"string"}}},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}}},refs:{"row-*":{eventListeners:{click:{handler:"handleRowClick"}}},"header-*":{eventListeners:{click:{handler:"handleHeaderClick"}}}},events:{},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-${column.key}",value:{type:1,path:"column.label"},parsedKey:{type:2,parts:["th#header-",{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-${row.index}",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:"row.index"}]}}],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 Vt={};P(Vt,{handleClickItem:()=>ra});var ra=(e,t)=>{let{dispatchEvent:r}=t,s=e.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:s}}))};var Rt={};P(Rt,{INITIAL_STATE:()=>sa,toViewData:()=>aa});var sa=Object.freeze({}),ia=["id","class","style","slot"],na=e=>Object.entries(e).filter(([t])=>!ia.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),aa=({state:e,props:t,attrs:r})=>{let s=na(r),n=t.items||[],i=r["selected-tab"],o=n.map(a=>({...a,isSelected:a.id===i,bgColor:a.id===i?"ac":"",borderColor:a.id===i?"":"tr",textColor:a.id===i?"":"mu-fg"}));return{containerAttrString:s,items:o,selectedTab:i}};var Kr={elementName:"rtgl-tabs",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},isSelected:{type:"boolean"},bgColor:{type:"string"},textColor:{type:"string"},borderColor:{type:"string"}}}},selectedTab:{type:"string"}}},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}}}},attrsSchema:{type:"object",properties:{"selected-tab":{type:"string"}}},refs:{"tab-*":{eventListeners:{click:{handler:"handleClickItem"}}}},events:{"item-click":{type:"object",properties:{id:{type:"string"}}}},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:null,iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#tab-${item.id} data-id=${item.id} cur=p bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg",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:"item.id"}," data-id=",{type:1,path:"item.id"}," cur=p bgc=",{type:1,path:"item.bgColor"}," bw=xs bc=",{type:1,path:"item.borderColor"}," pv=md ph=lg br=lg"]}}],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 Pt={};P(Pt,{handleAfterMount:()=>oa,handleOnUpdate:()=>la});var oa=async e=>{let{props:t,store:r,render:s,getRefIds:n}=e,{waveformData:i}=t;r.setWaveformData(i),s();let o=n().canvas?.elm;o&&Fr(i,o)},la=async(e,t)=>{let{store:r,render:s,getRefIds:n,props:i}=t,{waveformData:o}=i;if(!o){console.log("waveform handleOnUpdate: no waveformData provided");return}r.setWaveformData(o),s();let a=n().canvas?.elm;a&&Fr(o,a)};async function Fr(e,t){let r=t.getContext("2d"),s=t.getBoundingClientRect(),n=s.width,i=s.height;t.width=n,t.height=i;let o=t.width,a=t.height;if(r.clearRect(0,0,o,a),r.fillStyle="#1a1a1a",r.fillRect(0,0,o,a),!e||!e.data)return;let l=e.data,p=a/2,u=r.createLinearGradient(0,0,0,a);u.addColorStop(0,"#404040"),u.addColorStop(.5,"#A1A1A1"),u.addColorStop(1,"#404040");let c=Math.max(1,o/l.length),d=.2;for(let m=0;m<l.length;m++){let f=l[m]*(a*.85),y=m*c,v=p-f/2;r.fillStyle=u,r.fillRect(y,v,Math.max(1,c*(1-d)),f)}r.strokeStyle="rgba(255, 255, 255, 0.1)",r.lineWidth=1,r.beginPath(),r.moveTo(0,p),r.lineTo(o,p),r.stroke(),r.shadowBlur=10,r.shadowColor="#2196F3"}var jt={};P(jt,{INITIAL_STATE:()=>pa,setWaveformData:()=>ca,toViewData:()=>ua});var pa=Object.freeze({waveformData:null}),ca=(e,t)=>{e.waveformData=t},ua=({state:e,attrs:t,props:r})=>({isLoading:r.isLoading,w:t.w||"250",h:t.h||"150",cur:t.cur,waveformData:r.waveformData});var zr={elementName:"rtgl-waveform",attrsSchema:{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"}}},propsSchema:{type:"object",properties:{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"}}},refs:{canvas:{selector:"canvas"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=f 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 w=f h=f pos=rel w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," cur=",{type:1,path:"cur"}]}}],fast:!1}],fast:!1}};var Gr=Symbol.for("immer-nothing"),Ur=Symbol.for("immer-draftable"),Y=Symbol.for("immer-state");function Z(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ve=Object.getPrototypeOf;function be(e){return!!e&&!!e[Y]}function ce(e){return e?Xr(e)||Array.isArray(e)||!!e[Ur]||!!e.constructor?.[Ur]||Be(e)||We(e):!1}var ha=Object.prototype.constructor.toString();function Xr(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)===ha}function Re(e,t){De(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function De(e){let t=e[Y];return t?t.type_:Array.isArray(e)?1:Be(e)?2:We(e)?3:0}function Wt(e,t){return De(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Qr(e,t,r){let s=De(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function da(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Be(e){return e instanceof Map}function We(e){return e instanceof Set}function pe(e){return e.copy_||e.base_}function Mt(e,t){if(Be(e))return new Map(e);if(We(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=Xr(e);if(t===!0||t==="class_only"&&!r){let s=Object.getOwnPropertyDescriptors(e);delete s[Y];let n=Reflect.ownKeys(s);for(let i=0;i<n.length;i++){let o=n[i],a=s[o];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(s[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(ve(e),s)}else{let s=ve(e);if(s!==null&&r)return{...e};let n=Object.create(s);return Object.assign(n,e)}}function Ht(e,t=!1){return Me(e)||be(e)||!ce(e)||(De(e)>1&&(e.set=e.add=e.clear=e.delete=fa),Object.freeze(e),t&&Object.entries(e).forEach(([r,s])=>Ht(s,!0))),e}function fa(){Z(2)}function Me(e){return Object.isFrozen(e)}var ma={};function ue(e){let t=ma[e];return t||Z(0,e),t}var Se;function Zr(){return Se}function ya(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Hr(e,t){t&&(ue("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Kt(e){Ft(e),e.drafts_.forEach(ga),e.drafts_=null}function Ft(e){e===Se&&(Se=e.parent_)}function Jr(e){return Se=ya(Se,e)}function ga(e){let t=e[Y];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Yr(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[Y].modified_&&(Kt(t),Z(4)),ce(e)&&(e=Pe(t,e),t.parent_||je(t,e)),t.patches_&&ue("Patches").generateReplacementPatches_(r[Y].base_,e,t.patches_,t.inversePatches_)):e=Pe(t,r,[]),Kt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gr?e:void 0}function Pe(e,t,r){if(Me(t))return t;let s=t[Y];if(!s)return Re(t,(n,i)=>qr(e,s,t,n,i,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return je(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;let n=s.copy_,i=n,o=!1;s.type_===3&&(i=new Set(n),n.clear(),o=!0),Re(i,(a,l)=>qr(e,s,n,a,l,r,o)),je(e,n,!1),r&&e.patches_&&ue("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function qr(e,t,r,s,n,i,o){if(be(n)){let a=i&&t&&t.type_!==3&&!Wt(t.assigned_,s)?i.concat(s):void 0,l=Pe(e,n,a);if(Qr(r,s,l),be(l))e.canAutoFreeze_=!1;else return}else o&&r.add(n);if(ce(n)&&!Me(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Pe(e,n),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,s)&&je(e,n)}}function je(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ht(t,r)}function va(e,t){let r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:Zr(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},n=s,i=Jt;r&&(n=[s],i=$e);let{revoke:o,proxy:a}=Proxy.revocable(n,i);return s.draft_=a,s.revoke_=o,a}var Jt={get(e,t){if(t===Y)return e;let r=pe(e);if(!Wt(r,t))return ba(e,r,t);let s=r[t];return e.finalized_||!ce(s)?s:s===Dt(e.base_,t)?(Bt(e),e.copy_[t]=Ut(s,e)):s},has(e,t){return t in pe(e)},ownKeys(e){return Reflect.ownKeys(pe(e))},set(e,t,r){let s=es(pe(e),t);if(s?.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){let n=Dt(pe(e),t),i=n?.[Y];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(da(r,n)&&(r!==void 0||Wt(e.base_,t)))return!0;Bt(e),zt(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 Dt(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Bt(e),zt(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=pe(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){Z(11)},getPrototypeOf(e){return ve(e.base_)},setPrototypeOf(){Z(12)}},$e={};Re(Jt,(e,t)=>{$e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});$e.deleteProperty=function(e,t){return $e.set.call(this,e,t,void 0)};$e.set=function(e,t,r){return Jt.set.call(this,e[0],t,r,e[0])};function Dt(e,t){let r=e[Y];return(r?pe(r):e)[t]}function ba(e,t,r){let s=es(t,r);return s?"value"in s?s.value:s.get?.call(e.draft_):void 0}function es(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 zt(e){e.modified_||(e.modified_=!0,e.parent_&&zt(e.parent_))}function Bt(e){e.copy_||(e.copy_=Mt(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var wa=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){let i=r;r=t;let o=this;return function(l=i,...p){return o.produce(l,u=>r.call(this,u,...p))}}typeof r!="function"&&Z(6),s!==void 0&&typeof s!="function"&&Z(7);let n;if(ce(t)){let i=Jr(this),o=Ut(t,void 0),a=!0;try{n=r(o),a=!1}finally{a?Kt(i):Ft(i)}return Hr(i,s),Yr(n,i)}else if(!t||typeof t!="object"){if(n=r(t),n===void 0&&(n=t),n===Gr&&(n=void 0),this.autoFreeze_&&Ht(n,!0),s){let i=[],o=[];ue("Patches").generateReplacementPatches_(t,n,i,o),s(i,o)}return n}else Z(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...a)=>this.produceWithPatches(o,l=>t(l,...a));let s,n;return[this.produce(t,r,(o,a)=>{s=o,n=a}),s,n]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ce(e)||Z(8),be(e)&&(e=xa(e));let t=Jr(this),r=Ut(e,void 0);return r[Y].isManual_=!0,Ft(t),r}finishDraft(e,t){let r=e&&e[Y];(!r||!r.isManual_)&&Z(9);let{scope_:s}=r;return Hr(s,t),Yr(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 n=t[r];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));let s=ue("Patches").applyPatches_;return be(e)?s(e,t):this.produce(e,n=>s(n,t))}};function Ut(e,t){let r=Be(e)?ue("MapSet").proxyMap_(e,t):We(e)?ue("MapSet").proxySet_(e,t):va(e,t);return(t?t.scope_:Zr()).drafts_.push(r),r}function xa(e){return be(e)||Z(10,e),ts(e)}function ts(e){if(!ce(e)||Me(e))return e;let t=e[Y],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Mt(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Mt(e,!0);return Re(r,(s,n)=>{Qr(r,s,ts(n))}),t&&(t.finalized_=!1),r}var q=new wa,rs=q.produce,Sp=q.produceWithPatches.bind(q),$p=q.setAutoFreeze.bind(q),Cp=q.setUseStrictShallowCopy.bind(q),Ip=q.applyPatches.bind(q),Op=q.createDraft.bind(q),Tp=q.finishDraft.bind(q);var x={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9},G={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8},Ke={NOT:0};var we=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var ss=(e,t)=>{if(t===null)return new we(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new we(`Cannot iterate over undefined value at '$for ${e}'`);let r=typeof t;return new we(`Cannot iterate over non-array value (got: ${r}) at '$for ${e}'`)},is=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new we(`Unknown function '${e}' (${r})`)};var Ea=(e,t,r={})=>T(e,r,t,{}),T=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);if(e.type===x.LITERAL)return e.value;if(e.type===x.VARIABLE)return z(e.path,r,s);if(e.type===x.INTERPOLATION)return _a(e.parts,t,r,s);switch(e.type){case x.FUNCTION:return ns(e,t,r,s);case x.BINARY:return as(e,t,r,s);case x.UNARY:return os(e,t,r,s);case x.CONDITIONAL:return Aa(e,t,r,s);case x.LOOP:return Oa(e,t,r,s);case x.OBJECT:return La(e,t,r,s);case x.ARRAY:return Na(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},oe=new Map,z=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=oe.get(e);s||(s=e.split("."),oe.set(e,s));let n=t;for(let i=0;i<s.length;i++){let o=s[i];if(o in r){n=r[o];continue}if(n==null)return;n=n[o]}return n},_a=(e,t,r,s)=>{let n=[];for(let i of e)if(typeof i=="string")n.push(i);else{let o=T(i,t,r,s);n.push(o!=null?String(o):"")}return n.join("")},ns=(e,t,r,s)=>{let n=t[e.name];if(!n)throw is(e.name,t);let i=e.args.map(o=>T(o,t,r,s));return n(...i)},Fe=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);switch(e.type){case x.VARIABLE:return z(e.path,r,s);case x.LITERAL:return e.value;case x.BINARY:return as(e,t,r,s);case x.UNARY:return os(e,t,r,s);case x.FUNCTION:return ns(e,t,r,s);default:return T(e,t,r,s)}},as=(e,t,r,s)=>{if(e.op===G.AND||e.op===G.OR){let o=Fe(e.left,t,r,s),a=Fe(e.right,t,r,s);switch(e.op){case G.AND:return o&&a;case G.OR:return o||a}}let n=T(e.left,t,r,s),i=T(e.right,t,r,s);switch(e.op){case G.EQ:return n==i;case G.NEQ:return n!=i;case G.GT:return n>i;case G.LT:return n<i;case G.GTE:return n>=i;case G.LTE:return n<=i;case G.IN:return Array.isArray(i)?i.includes(n):!1;default:throw new Error(`Unknown binary operator: ${e.op}`)}},os=(e,t,r,s)=>{let n=e.op===Ke.NOT?Fe(e.operand,t,r,s):T(e.operand,t,r,s);switch(e.op){case Ke.NOT:return!n;default:throw new Error(`Unknown unary operator: ${e.op}`)}},ka=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let n=e.conditions[0];if(n.type===x.VARIABLE)if(z(n.path,r,s)){let o=e.bodies[0];if(o.type===x.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?T(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===x.LITERAL)a[p]=u.value;else if(u.type===x.VARIABLE)a[p]=z(u.path,r,s);else if(u.type===x.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===x.VARIABLE){let m=z(d.path,r,s);c.push(m!=null?String(m):"")}else{let m=T(d,t,r,s);c.push(m!=null?String(m):"")}a[p]=c.join("")}else a[p]=T(u,t,r,s)}return a}}else{let o=e.bodies[1];if(o.type===x.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?T(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===x.LITERAL)a[p]=u.value;else if(u.type===x.VARIABLE)a[p]=z(u.path,r,s);else if(u.type===x.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===x.VARIABLE){let m=z(d.path,r,s);c.push(m!=null?String(m):"")}else{let m=T(d,t,r,s);c.push(m!=null?String(m):"")}a[p]=c.join("")}else a[p]=T(u,t,r,s)}return a}}}return null},Aa=(e,t,r,s)=>{let n=ka(e,t,r,s);if(n!==null)return n;for(let i=0;i<e.conditions.length;i++){let o=e.conditions[i];if(o===null||Fe(o,t,r,s))return T(e.bodies[i],t,r,s)}return ls},Sa=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===x.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===x.VARIABLE){let n=r.conditions[0].path,i=r.bodies[0];if(n.startsWith(s+".")){let o=n.substring(s.length+1);if(i.type===x.OBJECT&&i.properties.length<=5){for(let l of i.properties)if(l.parsedKey)return null;let a=[];for(let l=0;l<t.length;l++){let p=t[l];if(p[o]){let u={};for(let c of i.properties){let d=c.key,m=c.value;if(m.type===x.LITERAL)u[d]=m.value;else if(m.type===x.VARIABLE){let h=m.path;if(h===s)u[d]=p;else if(h.startsWith(s+".")){let f=h.substring(s.length+1);u[d]=p[f]}else return null}else if(m.type===x.INTERPOLATION){let h=[],f=!0;for(let y of m.parts)if(typeof y=="string")h.push(y);else if(y.type===x.VARIABLE){let v=y.path;if(v===s)h.push(p!=null?String(p):"");else if(v.startsWith(s+".")){let w=v.substring(s.length+1),b=p[w];h.push(b!=null?String(b):"")}else{f=!1;break}}else{f=!1;break}if(!f)return null;u[d]=h.join("")}else return null}a.push(u)}}return a}}}return null},$a=(e,t)=>{let r=e.body,s=e.itemVar,n=Sa(e,t);if(n!==null)return n;if(r.type===x.OBJECT&&r.properties.length<=5){for(let a of r.properties)if(a.parsedKey)return null;let i=[],o=!0;for(let a of r.properties){let l=a.key,p=a.value;if(p.type===x.LITERAL)i.push({key:l,type:"literal",value:p.value});else if(p.type===x.VARIABLE){let u=p.path;if(u===s)i.push({key:l,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes("."))i.push({key:l,type:"prop",prop:c});else{o=!1;break}}else{o=!1;break}}else if(p.type===x.INTERPOLATION&&p.parts.length===1){let u=p.parts[0];if(u.type===x.VARIABLE){let c=u.path;if(c===s)i.push({key:l,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes("."))i.push({key:l,type:"prop_string",prop:d});else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}if(o){let a=new Array(t.length);if(i.length===3&&i[0].type==="prop"&&i[0].key==="id"&&i[1].type==="prop_string"&&i[1].key==="title"&&i[2].type==="prop"&&i[2].key==="completed")for(let l=0;l<t.length;l++){let p=t[l];a[l]={id:p.id,title:p.title!=null?String(p.title):"",completed:p.completed}}else for(let l=0;l<t.length;l++){let p=t[l],u={};for(let c of i)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=p;else if(c.type==="prop")u[c.key]=p[c.prop];else if(c.type==="item_string")u[c.key]=p!=null?String(p):"";else if(c.type==="prop_string"){let d=p[c.prop];u[c.key]=d!=null?String(d):""}a[l]=u}return a}}return null},Ca=(e,t,r,s,n)=>{let i=[],o=e.body;if(o.type===x.OBJECT&&o.fast!==!1){let a=e.itemVar,l=e.indexVar;for(let p=0;p<n.length;p++){let u=n[p],c={},d={...s,[a]:u,...l&&{[l]:p}};for(let m of o.properties){let h=m.parsedKey?T(m.parsedKey,t,r,d):m.key,f=m.value;if(f.type===x.LITERAL)c[h]=f.value;else if(f.type===x.VARIABLE){let y=f.path;if(y===a)c[h]=u;else if(y===l)c[h]=p;else if(y.startsWith(a+".")){let v=y.substring(a.length+1);if(!v.includes("."))c[h]=u[v];else{let w=oe.get(v)||(oe.set(v,v.split(".")),oe.get(v)),b=u;for(let E of w){if(b==null){b=void 0;break}b=b[E]}c[h]=b}}else c[h]=z(y,r,{...s,[a]:u,...l&&{[l]:p}})}else if(f.type===x.INTERPOLATION){let y=[];for(let v of f.parts)if(typeof v=="string")y.push(v);else if(v.type===x.VARIABLE){let w=v.path,b;if(w===a)b=u;else if(w===l)b=p;else if(w.startsWith(a+".")){let E=w.substring(a.length+1);if(!E.includes("."))b=u[E];else{let A=oe.get(E)||(oe.set(E,E.split(".")),oe.get(E)),_=u;for(let $ of A){if(_==null){_=void 0;break}_=_[$]}b=_}}else b=z(w,r,{...s,[a]:u,...l&&{[l]:p}});y.push(b!=null?String(b):"")}else{let w={...s,[a]:u,...l&&{[l]:p}},b=T(v,t,r,w);y.push(b!=null?String(b):"")}c[h]=y.join("")}else{let y={...s,[a]:u,...l&&{[l]:p}};c[h]=T(f,t,r,y)}}i.push(c)}return i}return null},Ia=(e,t,r)=>{let s=e.body;if(s.type===x.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let i=s.properties[0].value;if(i.type===x.CONDITIONAL&&i.conditions.length===1&&i.conditions[0].type===x.VARIABLE&&i.conditions[0].path==="item.visible"){let o=i.bodies[0];if(o.type===x.OBJECT&&o.properties.length===2){let a=o.properties[0],l=o.properties[1];if(a.key==="id"&&a.value.type===x.VARIABLE&&a.value.path==="item.id"&&l.key==="$if item.highlighted"&&l.value.type===x.CONDITIONAL){let p=[];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),p.push(d)}}return p}}}}return null},Oa=(e,t,r,s)=>{let n=T(e.iterable,t,r,s);if(!Array.isArray(n)){let a=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${e.iterable.path}`;throw ss(a,n)}if(!e.indexVar){let a=Ia(e,n,e.itemVar);if(a!==null)return a}if(!e.indexVar){let a=$a(e,n);if(a!==null)return a}let i=Ca(e,t,r,s,n);if(i!==null)return i;let o=[];for(let a=0;a<n.length;a++){let l=e.indexVar?{...s,[e.itemVar]:n[a],[e.indexVar]:a}:{...s,[e.itemVar]:n[a]},p=T(e.body,t,r,l);Array.isArray(p)&&p.length===1?o.push(p[0]):o.push(p)}return o},Ta=(e,t,r,s)=>{if(e.properties.length===1){let n=e.properties[0],i=n.parsedKey?T(n.parsedKey,t,r,s):n.key,o=n.value;if(o.type===x.OBJECT&&o.properties.length<=10){let a={},l={},p=!0;for(let u of o.properties){let c=u.parsedKey?T(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===x.LITERAL)l[c]=d.value;else if(d.type===x.VARIABLE)l[c]=z(d.path,r,s);else if(d.type===x.INTERPOLATION){let m=[];for(let h of d.parts)if(typeof h=="string")m.push(h);else if(h.type===x.VARIABLE){let f=z(h.path,r,s);m.push(f!=null?String(f):"")}else{p=!1;break}if(!p)break;l[c]=m.join("")}else if(d.type===x.OBJECT&&d.properties.length<=5){let m={};for(let h of d.properties){let f=h.key,y=h.value;if(y.type===x.LITERAL)m[f]=y.value;else if(y.type===x.VARIABLE)m[f]=z(y.path,r,s);else if(y.type===x.INTERPOLATION){let v=[];for(let w of y.parts)if(typeof w=="string")v.push(w);else if(w.type===x.VARIABLE){let b=z(w.path,r,s);v.push(b!=null?String(b):"")}else{p=!1;break}if(!p)break;m[f]=v.join("")}else{p=!1;break}}if(!p)break;l[c]=m}else{p=!1;break}}if(p)return a[i]=l,a}}return null},La=(e,t,r,s)=>{let n=Ta(e,t,r,s);if(n!==null)return n;if(e.fast){let l={};for(let p of e.properties){let u=p.parsedKey?T(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===x.LITERAL)l[u]=c.value;else if(c.type===x.VARIABLE)l[u]=z(c.path,r,s);else if(c.type===x.INTERPOLATION){let d=[];for(let m of c.parts)if(typeof m=="string")d.push(m);else if(m.type===x.VARIABLE){let h=z(m.path,r,s);d.push(h!=null?String(h):"")}else{let h=T(m,t,r,s);d.push(h!=null?String(h):"")}l[u]=d.join("")}else l[u]=T(c,t,r,s)}return l}let i={},o=null,a=!1;for(let l of e.properties)if(!l.key.startsWith("$if ")&&!l.key.match(/^\$if\s+\w+.*:?$/)&&!l.key.startsWith("$elif")&&!l.key.startsWith("$else")&&!l.key.startsWith("$for ")){a=!0;break}for(let l of e.properties)if(l.key.startsWith("$if ")||l.key.match(/^\$if\s+\w+.*:?$/)){let p=T(l.value,t,r,s);if(!a&&p!==null&&p!==void 0)return Array.isArray(p)&&p.length===1?p[0]:p;typeof p=="object"&&p!==null&&!Array.isArray(p)&&Object.assign(i,p)}else if(!l.key.startsWith("$for ")){let p=l.value;if(p&&p.type===x.OBJECT&&p.properties){let u=p.properties.find(c=>c.key.startsWith("$for "));if(u){let c=T(u.value,t,r,s);c!==void 0&&(i[l.key]=c)}else{let c=T(l.value,t,r,s);c!==void 0&&(i[l.key]=c)}}else{let u=l.parsedKey?T(l.parsedKey,t,r,s):l.key,c=T(l.value,t,r,s);c!==void 0&&(i[u]=c)}}return i},ls={},Na=(e,t,r,s)=>{let n=[];for(let i of e.items)if(i.type===x.LOOP){let o=T(i,t,r,s);n.push(o)}else{let o=T(i,t,r,s);o!==ls&&n.push(o)}return n},ze=Ea;var Ue=e=>Array.isArray(e)?e.reduce((t,r)=>{if(Array.isArray(r))t.push(...Ue(r));else{if(r&&typeof r=="object"){let s=Object.entries(r);if(s.length>0){let[n,i]=s[0];Array.isArray(i)&&(r={[n]:Ue(i)})}}t.push(r)}return t},[]):e;var ps=(e,t)=>{if(!t)return e;let r=[],s="",n=!1,i=null;for(let o=0;o<t.length;o++){let a=t[o];if(!n&&a===".")s&&(r.push(s),s="");else if(!n&&a==="[")s&&(r.push(s),s=""),n=!0;else if(n&&a==="]"){if(s){if(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))r.push(s.slice(1,-1));else{let l=Number(s);r.push(isNaN(l)?s:l)}s=""}n=!1,i=null}else n&&(a==='"'||a==="'")&&(i?a===i&&(i=null):i=a),s+=a}return s&&r.push(s),r.reduce((o,a)=>o&&o[a],e)},cs=({h:e,template:t,viewData:r,refs:s,handlers:n})=>{let i=ze(t,r,{}),o=Ue(i),a=ja({h:e,items:o,refs:s,handlers:n,viewData:r});return e("div",{style:{display:"contents"}},a)},ja=({h:e,items:t,refs:r={},handlers:s={},viewData:n={}})=>{if(!Array.isArray(t))return console.error("Input to createVirtualDom must be an array."),[e("div",{},[])];function i(o,a=""){return o.map((l,p)=>{if(typeof l=="string"||typeof l=="number")return String(l);if(typeof l!="object"||l===null)return console.warn("Skipping invalid item in DOM structure:",l),null;let u=Object.entries(l);if(u.length===0)return null;let[c,d]=u[0];if(!isNaN(Number(c)))return Array.isArray(d)?i(d,`${a}.${c}`):typeof d=="object"&&d!==null&&Object.entries(d).length>0?i([d],`${a}.${c}`):String(d);u.length>1&&console.warn("Item has multiple keys, processing only the first:",c);let m,h,f=c.indexOf(" ");f===-1?(m=c,h=""):(m=c.substring(0,f),h=c.substring(f+1).trim());let y=m.split(/[.#]/)[0],v=y.includes("-"),w={},b={};if(h){let C=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]+))/g,k,R=new Set;for(;(k=C.exec(h))!==null;)if(R.add(k[1]),k[1].startsWith(".")){let X=k[1].substring(1),_e=k[4];b[X]=ps(n,_e)}else if(k[1].startsWith("?")){let X=k[1].substring(1),_e=k[2]||k[3]||k[4],Ie;_e==="true"?Ie=!0:_e==="false"?Ie=!1:Ie=ps(n,_e),Ie&&(w[X]="")}else w[k[1]]=k[2]||k[3]||k[4];let B=h,K=[],ee,Ye=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]+))/g;for(;(ee=Ye.exec(h))!==null;)K.push(ee[0]);K.forEach(X=>{B=B.replace(X," ")});let qe=/\b(\S+?)(?=\s|$)/g,W;for(;(W=qe.exec(B))!==null;){let X=W[1];!R.has(X)&&!X.startsWith(".")&&!X.includes("=")&&(w[X]="")}}let E=m.match(/#([^.#\s]+)/);E&&!Object.prototype.hasOwnProperty.call(w,"id")&&(w.id=E[1]);let A=null;w.id?A=w.id:v&&(A=y);let _=Object.create(null),$=null;if(v)$=y;else{let C=m.match(/\.([^.#]+)/g);C&&C.forEach(R=>{let B=R.substring(1);_[B]=!0});let k=m.match(/#([^.#\s]+)/);k&&($=k[1])}let S;typeof d=="string"||typeof d=="number"?S=String(d):Array.isArray(d)?S=i(d,`${a}.${c}`):S=[],$&&!v&&(w.id=$);let L=Object.create(null);if(A&&r){let C=[];if(Object.keys(r).forEach(k=>{if(k.includes("*")){let R="^"+k.replace(/[.*+?^${}()|[\\\]\\]/g,"\\$&").replace(/\\\*/g,".*")+"$";try{new RegExp(R).test(A)&&C.push(k)}catch(B){console.warn(`[Parser] Invalid regex pattern created from refKey '${k}': ${R}`,B)}}else A===k&&C.push(k)}),C.length>0){C.sort((R,B)=>{let K=!R.includes("*"),ee=!B.includes("*");return K&&!ee?-1:!K&&ee?1:B.length-R.length});let k=C[0];if(r[k]&&r[k].eventListeners){let R=r[k].eventListeners;Object.entries(R).forEach(([B,K])=>{K.handler&&s[K.handler]?L[B]=ee=>{s[K.handler](ee)}:K.handler&&console.warn(`[Parser] Handler '${K.handler}' for refKey '${k}' (matching elementId '${A}') is referenced but not found in available handlers.`)})}}}let V={};if(A)V.key=A;else if(m){let C=a?`${a}.${p}`:String(p);if(V.key=`${m}-${C}`,Object.keys(b).length>0){let k=JSON.stringify(b).substring(0,50);V.key+=`-${k}`}}Object.keys(w).length>0&&(V.attrs=w),Object.keys(_).length>0&&(V.class=_),Object.keys(L).length>0&&(V.on=L),Object.keys(b).length>0&&(V.props=b),v&&(V.hook={update:(C,k)=>{let R=C.data?.props||{},B=k.data?.props||{},K=C.data?.attrs||{},ee=k.data?.attrs||{},Ye=JSON.stringify(R)!==JSON.stringify(B),qe=JSON.stringify(K)!==JSON.stringify(ee);if(Ye||qe){let W=k.elm;W&&W.render&&typeof W.render=="function"&&(W.setAttribute("isDirty","true"),requestAnimationFrame(()=>{if(W.render(),W.removeAttribute("isDirty"),W.handlers&&W.handlers.handleOnUpdate){let X={...W.deps||{},store:W.store,render:W.render.bind(W),handlers:W.handlers,dispatchEvent:W.dispatchEvent.bind(W),refIds:W.refIds||{},getRefIds:()=>W.refIds||{}};W.handlers.handleOnUpdate({oldProps:R,newProps:B,oldAttrs:K,newAttrs:ee},X)}}))}}});try{return e(y,V,S)}catch(C){return console.error("Error creating virtual node:",C,{tagName:y,snabbdomData:V,childrenOrText:S}),e("div",{},["Error creating element"])}}).filter(Boolean)}return i(t)};var Da=(e,t)=>{if(!t||typeof t!="object")return"";let r="",s=i=>Object.entries(i).map(([o,a])=>` ${o}: ${a};`).join(`
919
+ `))}constructor(){super(),e.initializeStyleSheet(),this.shadow=this.attachShadow({mode:"open"}),this.shadow.adoptedStyleSheets=[e.styleSheet],this._popoverOverlay=document.createElement("div"),this._popoverOverlay.className="popover-overlay",this.shadow.appendChild(this._popoverOverlay),this._popoverOverlay.addEventListener("click",()=>{this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._popoverOverlay.addEventListener("contextmenu",t=>{t.preventDefault(),this.dispatchEvent(new CustomEvent("close",{detail:{}}))}),this._popoverContainer=document.createElement("div"),this._popoverContainer.className="popover-container",this.shadow.appendChild(this._popoverContainer),this._slotElement=null,this._isOpen=!1,this._handleEscKey=this._handleEscKey.bind(this)}static get observedAttributes(){return["open","x","y","placement"]}connectedCallback(){this.hasAttribute("open")&&this._show()}disconnectedCallback(){this._removeGlobalListeners()}attributeChangedCallback(t,r,s){t==="open"?s!==null&&!this._isOpen?this._show():s===null&&this._isOpen&&this._hide():(t==="x"||t==="y"||t==="placement")&&this._isOpen&&this._updatePosition()}_show(){this._isOpen||(this._slotElement||(this._slotElement=document.createElement("slot"),this._slotElement.setAttribute("name","content"),this._popoverContainer.appendChild(this._slotElement)),this._isOpen=!0,this._updatePosition(),this._addGlobalListeners())}_hide(){this._isOpen&&(this._isOpen=!1,this._slotElement&&(this._popoverContainer.removeChild(this._slotElement),this._slotElement=null),this._removeGlobalListeners())}_updatePosition(){let t=parseFloat(this.getAttribute("x")||"0"),r=parseFloat(this.getAttribute("y")||"0"),s=this.getAttribute("placement")||"bottom-start";this.removeAttribute("positioned"),requestAnimationFrame(()=>{let n=this._popoverContainer.getBoundingClientRect(),{left:i,top:o}=this._calculatePosition(t,r,n.width,n.height,s);this._popoverContainer.style.left=`${i}px`,this._popoverContainer.style.top=`${o}px`,requestAnimationFrame(()=>{this.setAttribute("positioned","")})})}_calculatePosition(t,r,s,n,i){let a=t,l=r;switch(i){case"top":a=t-s/2,l=r-n-8;break;case"top-start":a=t,l=r-n-8;break;case"top-end":a=t-s,l=r-n-8;break;case"right":a=t+8,l=r-n/2;break;case"right-start":a=t+8,l=r;break;case"right-end":a=t+8,l=r-n;break;case"bottom":a=t-s/2,l=r+8;break;case"bottom-start":a=t,l=r+8;break;case"bottom-end":a=t-s,l=r+8;break;case"left":a=t-s-8,l=r-n/2;break;case"left-start":a=t-s-8,l=r;break;case"left-end":a=t-s-8,l=r-n;break}let p=8;return a=Math.max(p,Math.min(a,window.innerWidth-s-p)),l=Math.max(p,Math.min(l,window.innerHeight-n-p)),{left:a,top:l}}_addGlobalListeners(){setTimeout(()=>{document.addEventListener("keydown",this._handleEscKey)},0)}_removeGlobalListeners(){document.removeEventListener("keydown",this._handleEscKey)}_handleEscKey(t){t.key==="Escape"&&this.dispatchEvent(new CustomEvent("close",{detail:{}}))}get popover(){return this._popoverContainer}},vr=({render:e,html:t})=>at;var ot={};P(ot,{handleClickItem:()=>Ws});var Ws=(e,t)=>{let{dispatchEvent:r}=t,s=e.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:s}}))};var lt={};P(lt,{INITIAL_STATE:()=>Ms,toViewData:()=>zs});var Ms=Object.freeze({}),Ks=["id","class","style","slot"],Fs=e=>Object.entries(e).filter(([t])=>!Ks.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),zs=({props:e,attrs:t})=>{let r=Fs(t),s=e.items||[],n=e.separator||"breadcrumb-arrow",i=[];return s.forEach((o,a)=>{i.push(o),a<s.length-1&&i.push({isSeparator:!0})}),{containerAttrString:r,items:i,separator:n}};var br={elementName:"rtgl-breadcrumb",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}},separator:{type:"string"}}},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}},separator:{type:"string",default:"breadcrumb-arrow"}}},refs:{"item-*":{eventListeners:{click:{handler:"handleClickItem"}}}},events:{"item-click":{type:"object",properties:{item:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}},index:{type:"number"}}}},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:null,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.id"},null],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-svg wh=16 svg=${separator} c=mu-fg",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-svg wh=16 svg=",{type:1,path:"separator"}," c=mu-fg"]}}],fast:!0}],fast:!0},{type:9,items:[{type:8,properties:[{key:"rtgl-view#item-${item.id} data-id=${item.id} cur=p",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},parsedKey:{type:2,parts:["rtgl-view#item-",{type:1,path:"item.id"}," data-id=",{type:1,path:"item.id"}," cur=p"]}}],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}],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 pt={};P(pt,{handleClickMenuItem:()=>Hs,handleClosePopover:()=>Us});var Us=(e,t)=>{let{dispatchEvent:r}=t;r(new CustomEvent("close"))},Hs=(e,t)=>{let{dispatchEvent:r}=t,s=parseInt(e.currentTarget.id.replace("option-","")),n=t.props.items[s];r(new CustomEvent("click-item",{detail:{index:s,item:n}}))};var ct={};P(ct,{INITIAL_STATE:()=>Js,toViewData:()=>Ys});var Js=Object.freeze({}),Ys=({props:e,attrs:t})=>({items:e.items||[],open:!!t.open,x:t.x,y:t.y,placement:t.placement});var wr={elementName:"rtgl-dropdown-menu",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},type:{type:"string",enum:["label","item","separator"]}}}}}},attrsSchema:{type:"object",properties:{open:{type:"string"},x:{type:"string"},y:{type:"string"},placement:{type:"string"}}},refs:{popover:{eventListeners:{close:{handler:"handleClosePopover"}}},"option-*":{eventListeners:{click:{handler:"handleClickMenuItem"}}}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-popover#popover ?open=${open} x=${x} y=${y} placement=${placement}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view wh=300 g=xs slot=content bgc=background 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.type == 'label'",value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"label"}},{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"item"}},{type:4,op:0,left:{type:1,path:"item.type"},right:{type:0,value:"separator"}}],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#option-${i} w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"item.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-",{type:1,path:"i"}," w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=mu"]}}],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}}],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"}," placement=",{type:1,path:"placement"}]}}],fast:!1}],fast:!1}};var ut={};P(ut,{handleActionClick:()=>Xs,handleBeforeMount:()=>qs,handleColorPickerChange:()=>ti,handleImageClick:()=>ii,handleInputChange:()=>Qs,handleOnUpdate:()=>Gs,handlePopoverInputChange:()=>Zs,handleSelectChange:()=>ei,handleSliderChange:()=>ri,handleSliderInputChange:()=>si,handleWaveformClick:()=>ni});var qs=e=>{let{store:t,props:r}=e;t.setFormValues(r.defaultValues)},Gs=(e,t)=>{let{oldAttrs:r,newAttrs:s}=e,{store:n,props:i,render:o}=t;r?.key!==s?.key&&(n.setFormValues(i.defaultValues),o())},me=(e,t,r,s)=>{s(new CustomEvent("form-change",{detail:{name:e,fieldValue:t,formValues:r}}))},Xs=(e,t)=>{let{store:r,dispatchEvent:s}=t,n=e.currentTarget.id.replace("action-","");s(new CustomEvent("action-click",{detail:{actionId:n,formValues:r.selectFormValues()}}))},Qs=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("input-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},Zs=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("popover-input-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},ei=(e,t)=>{let{store:r,dispatchEvent:s,render:n,props:i}=t,o=e.currentTarget.id.replace("select-","");o&&e.detail.selectedValue!==void 0&&(r.setFormFieldValue({name:o,value:e.detail.selectedValue,props:i}),me(o,e.detail.selectedValue,r.selectFormValues(),s),n())},ti=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("colorpicker-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},ri=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("slider-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},si=(e,t)=>{let{store:r,dispatchEvent:s,props:n}=t,i=e.currentTarget.id.replace("slider-input-","");i&&e.detail.value!==void 0&&(r.setFormFieldValue({name:i,value:e.detail.value,props:n}),me(i,e.detail.value,r.selectFormValues(),s))},ii=(e,t)=>{e.type==="contextmenu"&&e.preventDefault();let{dispatchEvent:r}=t,s=e.currentTarget.id.replace("image-","");r(new CustomEvent("extra-event",{detail:{name:s,x:e.clientX,y:e.clientY,trigger:e.type}}))},ni=(e,t)=>{e.type==="contextmenu"&&e.preventDefault();let{dispatchEvent:r}=t,s=e.currentTarget.id.replace("waveform-","");r(new CustomEvent("extra-event",{detail:{name:s,x:e.clientX,y:e.clientY,trigger:e.type}}))};var vt={};P(vt,{INITIAL_STATE:()=>Li,getFormFieldValue:()=>Bi,selectForm:()=>Ve,selectFormValues:()=>Di,selectState:()=>ji,setFormFieldValue:()=>Mi,setFormValues:()=>Wi,toViewData:()=>Pi});var g={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9},D={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8},Ae={NOT:0};var M=class extends Error{constructor(t){super(`Parse Error: ${t}`),this.name="JemplParseError"}},ge=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var ht=e=>{if(!e||e.trim()==="")throw new M("Missing condition expression after '$if'");if(e.includes("===")||e.includes("!==")){let r=e.includes("===")?"==":"!=";throw new M(`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 M(`Incomplete comparison expression - missing right operand (got: '${e}')`)},xr=e=>{if(e.trim().endsWith(" in"))throw new M(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(!e.includes(" in "))throw new M(`Invalid loop syntax - missing 'in' keyword (got: '$for ${e}')`);let[t,r]=e.split(" in ");if(!r||r.trim()==="")throw new M(`Missing iterable expression after 'in' (got: '$for ${e}')`);if(t.includes(",")){let s=t.split(",").map(n=>n.trim());for(let n of s)if(!n)throw new M(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)}else if(!t.trim())throw new M(`Invalid loop variable - variable name cannot be empty (got: '$for ${e}')`)};var Er=(e,t)=>{if(t===null)return new ge(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new ge(`Cannot iterate over undefined value at '$for ${e}'`);let r=typeof t;return new ge(`Cannot iterate over non-array value (got: ${r}) at '$for ${e}'`)},_r=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new ge(`Unknown function '${e}' (${r})`)};var ai=(e,t,r={})=>O(e,r,t,{}),O=(e,t,r,s)=>{if(e.var&&!e.type)return F(e.var,r,s);if(e.type===g.LITERAL)return e.value;if(e.type===g.VARIABLE)return F(e.path,r,s);if(e.type===g.INTERPOLATION)return oi(e.parts,t,r,s);switch(e.type){case g.FUNCTION:return kr(e,t,r,s);case g.BINARY:return Ar(e,t,r,s);case g.UNARY:return Sr(e,t,r,s);case g.CONDITIONAL:return pi(e,t,r,s);case g.LOOP:return fi(e,t,r,s);case g.OBJECT:return mi(e,t,r,s);case g.ARRAY:return gi(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},ae=new Map,F=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=ae.get(e);s||(s=e.split("."),ae.set(e,s));let n=t;for(let i=0;i<s.length;i++){let o=s[i];if(o in r){n=r[o];continue}if(n==null)return;n=n[o]}return n},oi=(e,t,r,s)=>{let n=[];for(let i of e)if(typeof i=="string")n.push(i);else{let o=O(i,t,r,s);n.push(o!=null?String(o):"")}return n.join("")},kr=(e,t,r,s)=>{let n=t[e.name];if(!n)throw _r(e.name,t);let i=e.args.map(o=>O(o,t,r,s));return n(...i)},Le=(e,t,r,s)=>{if(e.var&&!e.type)return F(e.var,r,s);switch(e.type){case g.VARIABLE:return F(e.path,r,s);case g.LITERAL:return e.value;case g.BINARY:return Ar(e,t,r,s);case g.UNARY:return Sr(e,t,r,s);case g.FUNCTION:return kr(e,t,r,s);default:return O(e,t,r,s)}},Ar=(e,t,r,s)=>{if(e.op===D.AND||e.op===D.OR){let o=Le(e.left,t,r,s),a=Le(e.right,t,r,s);switch(e.op){case D.AND:return o&&a;case D.OR:return o||a}}let n=O(e.left,t,r,s),i=O(e.right,t,r,s);switch(e.op){case D.EQ:return n==i;case D.NEQ:return n!=i;case D.GT:return n>i;case D.LT:return n<i;case D.GTE:return n>=i;case D.LTE:return n<=i;case D.IN:return Array.isArray(i)?i.includes(n):!1;default:throw new Error(`Unknown binary operator: ${e.op}`)}},Sr=(e,t,r,s)=>{let n=e.op===Ae.NOT?Le(e.operand,t,r,s):O(e.operand,t,r,s);switch(e.op){case Ae.NOT:return!n;default:throw new Error(`Unknown unary operator: ${e.op}`)}},li=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let n=e.conditions[0];if(n.type===g.VARIABLE)if(F(n.path,r,s)){let o=e.bodies[0];if(o.type===g.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?O(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===g.LITERAL)a[p]=u.value;else if(u.type===g.VARIABLE)a[p]=F(u.path,r,s);else if(u.type===g.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===g.VARIABLE){let y=F(d.path,r,s);c.push(y!=null?String(y):"")}else{let y=O(d,t,r,s);c.push(y!=null?String(y):"")}a[p]=c.join("")}else a[p]=O(u,t,r,s)}return a}}else{let o=e.bodies[1];if(o.type===g.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?O(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===g.LITERAL)a[p]=u.value;else if(u.type===g.VARIABLE)a[p]=F(u.path,r,s);else if(u.type===g.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===g.VARIABLE){let y=F(d.path,r,s);c.push(y!=null?String(y):"")}else{let y=O(d,t,r,s);c.push(y!=null?String(y):"")}a[p]=c.join("")}else a[p]=O(u,t,r,s)}return a}}}return null},pi=(e,t,r,s)=>{let n=li(e,t,r,s);if(n!==null)return n;for(let i=0;i<e.conditions.length;i++){let o=e.conditions[i];if(o===null||Le(o,t,r,s))return O(e.bodies[i],t,r,s)}return $r},ci=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===g.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===g.VARIABLE){let n=r.conditions[0].path,i=r.bodies[0];if(n.startsWith(s+".")){let o=n.substring(s.length+1);if(i.type===g.OBJECT&&i.properties.length<=5){for(let l of i.properties)if(l.parsedKey)return null;let a=[];for(let l=0;l<t.length;l++){let p=t[l];if(p[o]){let u={};for(let c of i.properties){let d=c.key,y=c.value;if(y.type===g.LITERAL)u[d]=y.value;else if(y.type===g.VARIABLE){let h=y.path;if(h===s)u[d]=p;else if(h.startsWith(s+".")){let f=h.substring(s.length+1);u[d]=p[f]}else return null}else if(y.type===g.INTERPOLATION){let h=[],f=!0;for(let m of y.parts)if(typeof m=="string")h.push(m);else if(m.type===g.VARIABLE){let v=m.path;if(v===s)h.push(p!=null?String(p):"");else if(v.startsWith(s+".")){let w=v.substring(s.length+1),b=p[w];h.push(b!=null?String(b):"")}else{f=!1;break}}else{f=!1;break}if(!f)return null;u[d]=h.join("")}else return null}a.push(u)}}return a}}}return null},ui=(e,t)=>{let r=e.body,s=e.itemVar,n=ci(e,t);if(n!==null)return n;if(r.type===g.OBJECT&&r.properties.length<=5){for(let a of r.properties)if(a.parsedKey)return null;let i=[],o=!0;for(let a of r.properties){let l=a.key,p=a.value;if(p.type===g.LITERAL)i.push({key:l,type:"literal",value:p.value});else if(p.type===g.VARIABLE){let u=p.path;if(u===s)i.push({key:l,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes("."))i.push({key:l,type:"prop",prop:c});else{o=!1;break}}else{o=!1;break}}else if(p.type===g.INTERPOLATION&&p.parts.length===1){let u=p.parts[0];if(u.type===g.VARIABLE){let c=u.path;if(c===s)i.push({key:l,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes("."))i.push({key:l,type:"prop_string",prop:d});else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}if(o){let a=new Array(t.length);if(i.length===3&&i[0].type==="prop"&&i[0].key==="id"&&i[1].type==="prop_string"&&i[1].key==="title"&&i[2].type==="prop"&&i[2].key==="completed")for(let l=0;l<t.length;l++){let p=t[l];a[l]={id:p.id,title:p.title!=null?String(p.title):"",completed:p.completed}}else for(let l=0;l<t.length;l++){let p=t[l],u={};for(let c of i)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=p;else if(c.type==="prop")u[c.key]=p[c.prop];else if(c.type==="item_string")u[c.key]=p!=null?String(p):"";else if(c.type==="prop_string"){let d=p[c.prop];u[c.key]=d!=null?String(d):""}a[l]=u}return a}}return null},hi=(e,t,r,s,n)=>{let i=[],o=e.body;if(o.type===g.OBJECT&&o.fast!==!1){let a=e.itemVar,l=e.indexVar;for(let p=0;p<n.length;p++){let u=n[p],c={},d={...s,[a]:u,...l&&{[l]:p}};for(let y of o.properties){let h=y.parsedKey?O(y.parsedKey,t,r,d):y.key,f=y.value;if(f.type===g.LITERAL)c[h]=f.value;else if(f.type===g.VARIABLE){let m=f.path;if(m===a)c[h]=u;else if(m===l)c[h]=p;else if(m.startsWith(a+".")){let v=m.substring(a.length+1);if(!v.includes("."))c[h]=u[v];else{let w=ae.get(v)||(ae.set(v,v.split(".")),ae.get(v)),b=u;for(let E of w){if(b==null){b=void 0;break}b=b[E]}c[h]=b}}else c[h]=F(m,r,{...s,[a]:u,...l&&{[l]:p}})}else if(f.type===g.INTERPOLATION){let m=[];for(let v of f.parts)if(typeof v=="string")m.push(v);else if(v.type===g.VARIABLE){let w=v.path,b;if(w===a)b=u;else if(w===l)b=p;else if(w.startsWith(a+".")){let E=w.substring(a.length+1);if(!E.includes("."))b=u[E];else{let A=ae.get(E)||(ae.set(E,E.split(".")),ae.get(E)),_=u;for(let $ of A){if(_==null){_=void 0;break}_=_[$]}b=_}}else b=F(w,r,{...s,[a]:u,...l&&{[l]:p}});m.push(b!=null?String(b):"")}else{let w={...s,[a]:u,...l&&{[l]:p}},b=O(v,t,r,w);m.push(b!=null?String(b):"")}c[h]=m.join("")}else{let m={...s,[a]:u,...l&&{[l]:p}};c[h]=O(f,t,r,m)}}i.push(c)}return i}return null},di=(e,t,r)=>{let s=e.body;if(s.type===g.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let i=s.properties[0].value;if(i.type===g.CONDITIONAL&&i.conditions.length===1&&i.conditions[0].type===g.VARIABLE&&i.conditions[0].path==="item.visible"){let o=i.bodies[0];if(o.type===g.OBJECT&&o.properties.length===2){let a=o.properties[0],l=o.properties[1];if(a.key==="id"&&a.value.type===g.VARIABLE&&a.value.path==="item.id"&&l.key==="$if item.highlighted"&&l.value.type===g.CONDITIONAL){let p=[];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),p.push(d)}}return p}}}}return null},fi=(e,t,r,s)=>{let n=O(e.iterable,t,r,s);if(!Array.isArray(n)){let a=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${e.iterable.path}`;throw Er(a,n)}if(!e.indexVar){let a=di(e,n,e.itemVar);if(a!==null)return a}if(!e.indexVar){let a=ui(e,n);if(a!==null)return a}let i=hi(e,t,r,s,n);if(i!==null)return i;let o=[];for(let a=0;a<n.length;a++){let l=e.indexVar?{...s,[e.itemVar]:n[a],[e.indexVar]:a}:{...s,[e.itemVar]:n[a]},p=O(e.body,t,r,l);Array.isArray(p)&&p.length===1?o.push(p[0]):o.push(p)}return o},yi=(e,t,r,s)=>{if(e.properties.length===1){let n=e.properties[0],i=n.parsedKey?O(n.parsedKey,t,r,s):n.key,o=n.value;if(o.type===g.OBJECT&&o.properties.length<=10){let a={},l={},p=!0;for(let u of o.properties){let c=u.parsedKey?O(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===g.LITERAL)l[c]=d.value;else if(d.type===g.VARIABLE)l[c]=F(d.path,r,s);else if(d.type===g.INTERPOLATION){let y=[];for(let h of d.parts)if(typeof h=="string")y.push(h);else if(h.type===g.VARIABLE){let f=F(h.path,r,s);y.push(f!=null?String(f):"")}else{p=!1;break}if(!p)break;l[c]=y.join("")}else if(d.type===g.OBJECT&&d.properties.length<=5){let y={};for(let h of d.properties){let f=h.key,m=h.value;if(m.type===g.LITERAL)y[f]=m.value;else if(m.type===g.VARIABLE)y[f]=F(m.path,r,s);else if(m.type===g.INTERPOLATION){let v=[];for(let w of m.parts)if(typeof w=="string")v.push(w);else if(w.type===g.VARIABLE){let b=F(w.path,r,s);v.push(b!=null?String(b):"")}else{p=!1;break}if(!p)break;y[f]=v.join("")}else{p=!1;break}}if(!p)break;l[c]=y}else{p=!1;break}}if(p)return a[i]=l,a}}return null},mi=(e,t,r,s)=>{let n=yi(e,t,r,s);if(n!==null)return n;if(e.fast){let l={};for(let p of e.properties){let u=p.parsedKey?O(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===g.LITERAL)l[u]=c.value;else if(c.type===g.VARIABLE)l[u]=F(c.path,r,s);else if(c.type===g.INTERPOLATION){let d=[];for(let y of c.parts)if(typeof y=="string")d.push(y);else if(y.type===g.VARIABLE){let h=F(y.path,r,s);d.push(h!=null?String(h):"")}else{let h=O(y,t,r,s);d.push(h!=null?String(h):"")}l[u]=d.join("")}else l[u]=O(c,t,r,s)}return l}let i={},o=null,a=!1;for(let l of e.properties)if(!l.key.startsWith("$if ")&&!l.key.match(/^\$if\s+\w+.*:?$/)&&!l.key.startsWith("$elif")&&!l.key.startsWith("$else")&&!l.key.startsWith("$for ")){a=!0;break}for(let l of e.properties)if(l.key.startsWith("$if ")||l.key.match(/^\$if\s+\w+.*:?$/)){let p=O(l.value,t,r,s);if(!a&&p!==null&&p!==void 0)return Array.isArray(p)&&p.length===1?p[0]:p;typeof p=="object"&&p!==null&&!Array.isArray(p)&&Object.assign(i,p)}else if(!l.key.startsWith("$for ")){let p=l.value;if(p&&p.type===g.OBJECT&&p.properties){let u=p.properties.find(c=>c.key.startsWith("$for "));if(u){let c=O(u.value,t,r,s);c!==void 0&&(i[l.key]=c)}else{let c=O(l.value,t,r,s);c!==void 0&&(i[l.key]=c)}}else{let u=l.parsedKey?O(l.parsedKey,t,r,s):l.key,c=O(l.value,t,r,s);c!==void 0&&(i[u]=c)}}return i},$r={},gi=(e,t,r,s)=>{let n=[];for(let i of e.items)if(i.type===g.LOOP){let o=O(i,t,r,s);n.push(o)}else{let o=O(i,t,r,s);o!==$r&&n.push(o)}return n},dt=ai;var vi=/\$\{([^}]*)\}/g,Ir=e=>{let t=e.match(/^(\w+)\((.*)\)$/);if(!t)return{isFunction:!1};let[,r,s]=t,n=bi(s);return{isFunction:!0,type:g.FUNCTION,name:r,args:n}},bi=e=>e.trim()?wi(e).map(r=>xi(r.trim())):[],wi=e=>{let t=[],r="",s=0,n=!1,i="";for(let o=0;o<e.length;o++){let a=e[o],l=o>0?e[o-1]:"";!n&&(a==='"'||a==="'")?(n=!0,i=a,r+=a):n&&a===i&&l!=="\\"?(n=!1,i="",r+=a):!n&&a==="("?(s++,r+=a):!n&&a===")"?(s--,r+=a):!n&&a===","&&s===0?(t.push(r),r=""):r+=a}return r&&t.push(r),t},xi=e=>{if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:g.LITERAL,value:e.slice(1,-1)};if(/^-?\d+(\.\d+)?$/.test(e))return{type:g.LITERAL,value:parseFloat(e)};if(e==="true")return{type:g.LITERAL,value:!0};if(e==="false")return{type:g.LITERAL,value:!1};if(e==="null")return{type:g.LITERAL,value:null};let t=Ir(e);return t.isFunction?{type:t.type,name:t.name,args:t.args}:{type:g.VARIABLE,path:e}},Ei=/^\w+\(.*\)$/,_i=/\s[+\-*/%]\s|\|\||&&|\?\?|.*\?.*:/,ki=e=>{if(!(!e||e.trim()===""||Ei.test(e))&&_i.test(e))throw e.includes("?")&&e.includes(":")?new M(`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 M(`Logical operators not supported in variable replacements - consider calculating the value in your data instead (operators like ||, &&, ?? are not supported). Offending expression: "${e}"`):new M(`Arithmetic expressions not supported in variable replacements - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`)},Cr=(e,t={})=>{let r=e.trim();ki(r);let s=Ir(r);return s.isFunction?{type:s.type,name:s.name,args:s.args}:{type:g.VARIABLE,path:r}},ft=(e,t={})=>{let r=e,s=[];e.includes("\\${")&&(r=e.replace(/\\\\(\$\{[^}]*\})/g,"\\DOUBLE_ESC$1"),r=r.replace(/\\(\$\{[^}]*\})/g,(a,l)=>{let p=`__ESCAPED_${s.length}__`;return s.push(l),p}),r=r.replace(/\\DOUBLE_ESC/g,"\\"));let n=[...r.matchAll(vi)];if(n.length===0){let a=r;for(let l=0;l<s.length;l++)a=a.replace(`__ESCAPED_${l}__`,s[l]);return{type:g.LITERAL,value:a}}if(n.length===1&&n[0][0]===r&&s.length===0)return Cr(n[0][1],t);let i=[],o=0;for(let a of n){let[l,p]=a,u=a.index;if(u>o){let d=r.substring(o,u);for(let y=0;y<s.length;y++)d=d.replace(`__ESCAPED_${y}__`,s[y]);d&&i.push(d)}let c=Cr(p.trim(),t);i.push(c),o=u+l.length}if(o<r.length){let a=r.substring(o);for(let l=0;l<s.length;l++)a=a.replace(`__ESCAPED_${l}__`,s[l]);a&&i.push(a)}return{type:g.INTERPOLATION,parts:i}};var le=(e,t)=>typeof e=="string"?ft(e,t):typeof e=="object"&&e!==null?Array.isArray(e)?Ai(e,t):Si(e,t):{type:g.LITERAL,value:e},Ai=(e,t)=>{let r=[],s=!1;for(let n=0;n<e.length;n++){let i=e[n];if(typeof i=="object"&&i!==null&&!Array.isArray(i)){let a=Object.keys(i);if(a.length===1&&a[0].startsWith("$for ")){let l=Or(a[0],i[a[0]],t);r.push(l),s=!0;continue}}let o=le(i,t);r.push(o),(o.type===g.FUNCTION||o.type===g.CONDITIONAL||o.type===g.LOOP||o.type===g.OBJECT&&!o.fast||o.type===g.ARRAY&&!o.fast)&&(s=!0)}return{type:g.ARRAY,items:r,fast:!s}},Si=(e,t)=>{let r=[],s=!1,n=Object.entries(e),i=0;for(;i<n.length;){let[o,a]=n[i];if(o.startsWith("$if ")||o.match(/^\$if#\w+\s/)||o.match(/^\$if\s+\w+.*:$/)){let l=$i(n,i,t);r.push({key:o,value:l.node}),s=!0,i=l.nextIndex}else if(o.startsWith("$for ")){let l=Or(o,a,t);r.push({key:o,value:l}),s=!0,i++}else{if(o.startsWith("$elif ")||o.startsWith("$else"))throw new M(`'${o.split(" ")[0]}' without matching '$if'`);if(o==="$if"||o==="$if:")throw new M("Missing condition expression after '$if'");{let l=le(a,t);(l.type===g.FUNCTION||l.type===g.CONDITIONAL||l.type===g.LOOP||l.type===g.OBJECT&&!l.fast||l.type===g.ARRAY&&!l.fast)&&(s=!0);let p=ft(o,t),u={key:o,value:l};(p.type!==g.LITERAL||p.value!==o)&&(u.parsedKey=p),r.push(u),i++}}}return{type:g.OBJECT,properties:r,fast:!s}},$i=(e,t,r={})=>{let s=[],n=[],i=t,[o,a]=e[i],l=null,p;if(o.startsWith("$if#")){let c=o.match(/^\$if#(\w+)\s+(.+)$/);if(c)l=c[1],p=c[2];else throw new M(`Invalid conditional syntax: ${o}`)}else p=o.substring(4),p.endsWith(":")&&(p=p.slice(0,-1).trim());ht(p);let u=ie(p);for(s.push(u),n.push(le(a,r)),i++;i<e.length;){let[c,d]=e[i],y=!1,h;if(l?c.startsWith(`$elif#${l} `)?(h=c.substring(`$elif#${l} `.length),h.endsWith(":")&&(h=h.slice(0,-1).trim()),y=!0):(c===`$else#${l}`||c===`$else#${l}:`)&&(y=!0,h=null):c.startsWith("$elif ")?(h=c.substring(6),h.endsWith(":")&&(h=h.slice(0,-1).trim()),y=!0):(c==="$else"||c==="$else:")&&(y=!0,h=null),y){if(h===null)s.push(null);else{ht(h);let f=ie(h);s.push(f)}if(n.push(le(d,r)),i++,h===null)break}else break}return{node:{type:g.CONDITIONAL,conditions:s,bodies:n,id:l},nextIndex:i}},ie=e=>{if(e=e.trim(),e.startsWith("(")&&e.endsWith(")"))return ie(e.slice(1,-1));let t=Ne(e,"||");if(t!==-1)return{type:g.BINARY,op:D.OR,left:ie(e.substring(0,t).trim()),right:ie(e.substring(t+2).trim())};let r=Ne(e,"&&");if(r!==-1)return{type:g.BINARY,op:D.AND,left:ie(e.substring(0,r).trim()),right:ie(e.substring(r+2).trim())};let s=[{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:i,type:o}of s){let a=Ne(e,i);if(a!==-1)return{type:g.BINARY,op:o,left:ie(e.substring(0,a).trim()),right:ie(e.substring(a+i.length).trim())}}let n=[" + "," - "," * "," / "," % "];for(let i of n)if(Ne(e,i)!==-1)throw new M(`Arithmetic expressions not supported in conditionals - consider calculating '${e}' in your data instead (expressions with +, -, *, /, % are not supported). Offending expression: "${e}"`);return e.startsWith("!")?{type:g.UNARY,op:Ae.NOT,operand:ie(e.substring(1).trim())}:Ci(e)},Ne=(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},Ci=e=>{if(e=e.trim(),e==="true")return{type:g.LITERAL,value:!0};if(e==="false")return{type:g.LITERAL,value:!1};if(e==="null")return{type:g.LITERAL,value:null};if(e.startsWith('"')&&e.endsWith('"')||e.startsWith("'")&&e.endsWith("'"))return{type:g.LITERAL,value:e.slice(1,-1)};if(e==='""'||e==="''")return{type:g.LITERAL,value:""};let t=Number(e);return!isNaN(t)&&isFinite(t)?{type:g.LITERAL,value:t}:{type:g.VARIABLE,path:e}},Or=(e,t,r)=>{let s=e.substring(5).trim();xr(s);let n=s.match(/^(.+?)\s+in\s+(.+)$/);if(!n)throw new M(`Invalid loop syntax - missing 'in' keyword (got: '$for ${s}')`);let i=n[1].trim(),o=n[2].trim(),a,l=null;if(i.includes(",")){let c=i.split(",").map(d=>d.trim());if(c.length!==2)throw new M(`Invalid loop variables: ${i}. Expected format: "item" or "item, index"`);a=c[0],l=c[1]}else a=i;let p={type:g.VARIABLE,path:o},u=le(t,r);return{type:g.LOOP,itemVar:a,indexVar:l,iterable:p,body:u}};var Ii=(e,t={})=>{let{functions:r={}}=t;return le(e,r)},yt=Ii;var mt={};P(mt,{now:()=>Oi});var Oi=()=>Date.now();var Ti=(e,t,r={})=>{let{functions:s={}}=r,n={...mt,...s},i=yt(e,{functions:n});return dt(i,t,n)},gt=Ti;function Tr(e,t){return t.reduce((r,s)=>(s in e&&(r[s]=e[s]),r),{})}var Li=Object.freeze({formValues:{}}),Lr=(e,t,r=void 0)=>{if(!t)return;let s=t.split(/[\[\].]/).filter(i=>i!==""),n=e;for(let i of s){if(n==null||!(i in n))return r;n=n[i]}return n},Ni=(e,t,r)=>{let s=t.split(/[\[\].]/).filter(i=>i!=="");t.includes("[")&&t in e&&delete e[t];let n=e;for(let i=0;i<s.length-1;i++){let o=s[i];if(!(o in n)||typeof n[o]!="object"||n[o]===null){let a=s[i+1],l=/^\d+$/.test(a);n[o]=l?[]:{}}n=n[o]}return n[s[s.length-1]]=r,e},Vi=["id","class","style","slot"],Ri=e=>Object.entries(e).filter(([t])=>!Vi.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Ve=({state:e,props:t})=>{let{form:r}=t,{context:s}=t;return s?gt(r,s):r},Pi=({state:e,props:t,attrs:r})=>{let s=Ri(r),n=t.defaultValues||{},i=Ve({state:e,props:t}),o=structuredClone(i.fields||[]);return o.forEach(a=>{if(a.defaultValue=Lr(n,a.name),a.inputType==="image"){let l=a.src;a.imageSrc=l&&l.trim()?l:null,a.placeholderText=a.placeholder||"No Image"}if(a.inputType==="waveform"){let l=a.waveformData;a.waveformData=l||null,a.placeholderText=a.placeholder||"No Waveform"}}),{containerAttrString:s,title:i?.title||"",description:i?.description||"",fields:o,actions:t?.form?.actions||{buttons:[]},formValues:e.formValues}},ji=({state:e})=>e,Di=({state:e,props:t})=>{let r=Ve({state:e,props:t});return Tr(e.formValues,r.fields.map(s=>s.name))},Bi=({state:e},t)=>Lr(e.formValues,t),Wi=(e,t)=>{e.formValues=t||{}},Mi=(e,{name:t,value:r,props:s})=>{Ni(e.formValues,t,r);let n=Ve({state:e,props:s}),i=Tr(e.formValues,n.fields.map(o=>o.name));e.formValues=i};var Nr={elementName:"rtgl-form",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{defaultValues:{type:"object"},context:{type:"object"},form:{type:"object",properties:{title:{type:"string"},description:{type:"string"},fields:{type:"array",items:{anyOf:[{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"inputText"},placeholder:{type:"string"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"select"},placeholder:{type:"string"},options:{type:"array",items:{type:"object",properties:{id:{type:"string"},label:{type:"string"},value:{type:"any"}},required:["id","label","value"]}}},required:["name","label","inputType","options"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"colorPicker"},value:{type:"string"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"slider"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"slider-input"},min:{type:"number"},max:{type:"number"},step:{type:"number"},value:{type:"number"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"image"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"}},required:["name","label","inputType"],additionalProperties:!1},{type:"object",properties:{name:{type:"string"},label:{type:"string"},description:{type:"string"},inputType:{const:"waveform"},width:{type:"number"},height:{type:"number"},placeholder:{type:"string"},defaultValue:{type:"object"},waveformData:{type:"object"}},required:["name","label","inputType"],additionalProperties:!1}]}},actions:{type:"object",properties:{buttons:{type:"array",items:{type:"object",properties:{id:{type:"string"},content:{type:"string"}},required:["id","content"]}}}}}}}},refs:{"action-*":{eventListeners:{click:{handler:"handleActionClick"}}},"input-*":{eventListeners:{"input-change":{handler:"handleInputChange"}}},"select-*":{eventListeners:{"select-change":{handler:"handleSelectChange"}}},"colorpicker-*":{eventListeners:{"colorpicker-change":{handler:"handleColorPickerChange"}}},"slider-*":{eventListeners:{"slider-change":{handler:"handleSliderChange"}}},"slider-input-*":{eventListeners:{"slider-input-value-change":{handler:"handleSliderInputChange"}}},"image-*":{eventListeners:{click:{handler:"handleImageClick"},contextmenu:{handler:"handleImageClick"}}},"waveform-*":{eventListeners:{click:{handler:"handleWaveformClick"},contextmenu:{handler:"handleWaveformClick"}}},"popover-input-*":{eventListeners:{"input-change":{handler:"handlePopoverInputChange"}}}},events:{"form-change":{},"extra-event":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view 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:"rtgl-text s=lg",value:{type:1,path:"title"}}],fast:!0},{type:8,properties:[{key:"rtgl-text c=mu-fg",value:{type:1,path:"description"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:"rtgl-view g=lg w=f",value:{type:9,items:[{type:7,itemVar:"field",indexVar:"i",iterable:{type:1,path:"fields"},body:{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:"rtgl-text",value:{type:1,path:"field.label"}}],fast:!0},{type:8,properties:[{key:"rtgl-text s=sm c=mu-fg",value:{type:1,path:"field.description"}}],fast:!0}],fast:!0}}],fast:!0},{type:8,properties:[{key:'$if field.inputType == "read-only-text"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"read-only-text"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-text s=sm",value:{type:1,path:"field.defaultValue"}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "inputText"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"inputText"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-input#input-${field.name} w=f placeholder=${field.placeholder} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input-",{type:1,path:"field.name"}," w=f placeholder=",{type:1,path:"field.placeholder"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "popover-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"popover-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'rtgl-popover-input#popover-input-${field.name} label="${field.label}" .defaultValue=fields[${i}].defaultValue',value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-popover-input#popover-input-",{type:1,path:"field.name"},' label="',{type:1,path:"field.label"},'" .defaultValue=fields[',{type:1,path:"i"},"].defaultValue"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "select"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"select"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-select#select-${field.name} w=f .options=fields[${i}].options .placeholder=fields[${i}].placeholder .selectedValue=fields[${i}].defaultValue",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-select#select-",{type:1,path:"field.name"}," w=f .options=fields[",{type:1,path:"i"},"].options .placeholder=fields[",{type:1,path:"i"},"].placeholder .selectedValue=fields[",{type:1,path:"i"},"].defaultValue"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "colorPicker"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"colorPicker"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-color-picker#colorpicker-${field.name} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-color-picker#colorpicker-",{type:1,path:"field.name"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slider"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slider"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider#slider-${field.name} w=f min=${field.min} max=${field.max} step=${field.step} value=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider-",{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"}," value=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slider-input"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slider-input"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-slider-input#slider-input-${field.name} w=f min=${field.min} max=${field.max} step=${field.step} defaultValue=${field.defaultValue}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider-input#slider-input-",{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"}," defaultValue=",{type:1,path:"field.defaultValue"}]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "image" && field.imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"image"}},right:{type:1,path:"field.imageSrc"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-image#image-${field.name} src=${field.imageSrc} w=${field.width} h=${field.height} cur=p",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-image#image-",{type:1,path:"field.name"}," src=",{type:1,path:"field.imageSrc"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=p"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "image" && !field.imageSrc',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},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.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p 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.name"}," w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," bc=ac bw=sm ah=c av=c cur=p p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "waveform" && field.waveformData',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"waveform"}},right:{type:1,path:"field.waveformData"}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-waveform#waveform-${field.name} .waveformData=fields[${i}].waveformData w=${field.width} h=${field.height} cur=p",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-waveform#waveform-",{type:1,path:"field.name"}," .waveformData=fields[",{type:1,path:"i"},"].waveformData w=",{type:1,path:"field.width"}," h=",{type:1,path:"field.height"}," cur=p"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "waveform" && !field.waveformData',value:{type:6,conditions:[{type:4,op:6,left:{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"waveform"}},right:{type:5,op:0,operand:{type:1,path:"field.waveformData"}}}],bodies:[{type:9,items:[{type:8,properties:[{key:"rtgl-view#waveform-${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p p=md",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text c=mu-fg ta=c",value:{type:1,path:"field.placeholder"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#waveform-",{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=p p=md"]}}],fast:!0}],fast:!0}],id:null}}],fast:!1},{type:8,properties:[{key:'$if field.inputType == "slot"',value:{type:6,conditions:[{type:4,op:0,left:{type:1,path:"field.inputType"},right:{type:0,value:"slot"}}],bodies:[{type:9,items:[{type:8,properties:[{key:'slot#slot-${field.slotName} name=${field.slot} style="display: contents;"',value:{type:0,value:null},parsedKey:{type:2,parts:["slot#slot-",{type:1,path:"field.slotName"}," name=",{type:1,path:"field.slot"},' style="display: contents;"']}}],fast:!0}],fast:!0}],id:null}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}}],fast:!1},{type:8,properties:[{key:"rtgl-view g=sm w=f",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view d=h ah=e g=sm w=f",value:{type:9,items:[{type:7,itemVar:"button",indexVar:"i",iterable:{type:1,path:"actions.buttons"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-button#action-${button.id}",value:{type:1,path:"button.content"},parsedKey:{type:2,parts:["rtgl-button#action-",{type:1,path:"button.id"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f p=md g=lg ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var bt={};P(bt,{handleClickStart:()=>Ki});var Ki=(e,t)=>{let{dispatchEvent:r,store:s}=t;console.log("handle click start",s.selectPath()),r(new CustomEvent("clickStart",{detail:{path:s.selectPath()}}))};var wt={};P(wt,{INITIAL_STATE:()=>Fi,selectPath:()=>Ji,setState:()=>Yi,toViewData:()=>Hi});var Fi=Object.freeze({}),zi=["id","class","style","slot"],Ui=e=>Object.entries(e).filter(([t])=>!zi.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Hi=({state:e,props:t,attrs:r})=>{console.log("attrs",{attrs:r,entries:Object.entries(r)});let s=r.start?JSON.parse(decodeURIComponent(r.start)):t.start;return{containerAttrString:Ui(r),start:s||{label:"",image:{src:"",width:32,height:32,alt:""}}}},Ji=({props:e})=>e.start.path,Yi=e=>{};var Vr={elementName:"rtgl-navbar",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}},hasImage:{type:"boolean"},hasHref:{type:"boolean"}}}}},propsSchema:{type:"object",properties:{start:{type:"object",properties:{label:{type:"string"},href:{type:"string"},image:{type:"object",properties:{src:{type:"string"}}}}}}},refs:{start:{eventListeners:{click:{handler:"handleClickStart"}}}},events:{clickStart:{type:"object",properties:{path:{type:"string"}}}},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=lg 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=lg g=md cur=p",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=lg 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 flex=1",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 xt={};P(xt,{handleBeforeMount:()=>Gi});var Rr=(e,t)=>{let{store:r,render:s}=t,n,i=-1/0;e.forEach(o=>{let a=o.getBoundingClientRect();a.top<=20&&a.top>i&&(i=a.top,n=o.id)}),n&&n!==r.selectCurrentId()&&(r.setCurrentId(n),s())},qi=(e,t)=>{let{store:r,render:s}=t,n=e.querySelectorAll("rtgl-text[id]"),i=Array.from(n),o=i.map(l=>({id:l.id,href:`#${l.id}`,title:l.textContent}));r.setItems(o),Rr(i,t),s();let a=Rr.bind(void 0,i,t);return e.addEventListener("scroll",a,{passive:!0}),()=>{e.removeEventListener("scroll",a)}},Gi=e=>{let{attrs:t}=e;requestAnimationFrame(()=>{let r=document.getElementById(t["target-id"]),s=qi(r,e);return()=>{s()}})};var Et={};P(Et,{INITIAL_STATE:()=>Xi,selectCurrentId:()=>en,selectState:()=>Zi,setContentContainer:()=>sn,setCurrentId:()=>rn,setItems:()=>tn,toViewData:()=>Qi});var Xi=Object.freeze({items:[],currentId:null,contentContainer:null}),Qi=({state:e})=>({items:e.items.map(t=>({...t,c:t.id===e.currentId?"fg":"mu-fg"})),currentId:e.currentId}),Zi=({state:e})=>e,en=({state:e})=>e.currentId,tn=(e,t)=>{e.items=t},rn=(e,t)=>{e.currentId=t},sn=(e,t)=>{e.contentContainer=t};var Pr={elementName:"rtgl-page-outline",viewDataSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{slug:{type:"string"},title:{type:"string"}}}},selectedSlug:{type:"string",nullable:!0}}},propsSchema:{type:"object",properties:{}},refs:{},events:{onItemClick:{type:"object"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view h=f w=272",value:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f g=sm 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 pv=xs av=c href=${item.href}",value:{type:9,items:[{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 pv=xs av=c href=",{type:1,path:"item.href"}]}}],fast:!0}],fast:!0}}],fast:!1}}],fast:!1}],fast:!1}}],fast:!1}],fast:!1}};var _t={};P(_t,{handleBeforeMount:()=>nn,handleInputChange:()=>pn,handleInputKeydown:()=>un,handleOnUpdate:()=>an,handlePopoverClose:()=>ln,handleSubmitClick:()=>cn,handleTextClick:()=>on});var nn=e=>{let{store:t,props:r}=e;(r.value!==void 0||r.defaultValue!==void 0)&&t.setValue(r.value||r.defaultValue||"")},an=(e,t)=>{let{oldProps:r,newProps:s}=e,{store:n,props:i,render:o}=t;r.defaultValue!==s.defaultValue&&n.setValue(i.defaultValue||""),o()},on=(e,t)=>{let{store:r,render:s,getRefIds:n,attrs:i}=t,o=r.selectValue();r.setTempValue(o),r.openPopover({position:{x:e.currentTarget.getBoundingClientRect().left,y:e.currentTarget.getBoundingClientRect().bottom}});let{input:a}=n();a.elm.value=o,s(),i["auto-focus"]&&setTimeout(()=>{a.elm.focus()},50)},ln=(e,t)=>{let{store:r,render:s}=t;r.closePopover(),s()},pn=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=e.detail.value;r.setTempValue(i),n(new CustomEvent("temp-input-change",{detail:{value:i},bubbles:!0})),s()},cn=(e,t)=>{let{store:r,render:s,dispatchEvent:n,getRefIds:i}=t,{input:o}=i(),a=o.elm.value;r.setValue(a),r.closePopover(),n(new CustomEvent("input-change",{detail:{value:a},bubbles:!0})),s()},un=(e,t)=>{let{store:r,render:s,dispatchEvent:n,getRefIds:i}=t;if(e.key==="Enter"){let{input:o}=i(),a=o.elm.value;r.closePopover(),n(new CustomEvent("input-change",{detail:{value:a},bubbles:!0})),s()}else e.key==="Escape"&&(r.closePopover(),s())};var kt={};P(kt,{INITIAL_STATE:()=>hn,closePopover:()=>mn,openPopover:()=>yn,selectValue:()=>vn,setTempValue:()=>fn,setValue:()=>gn,toViewData:()=>dn});var hn=Object.freeze({isOpen:!1,position:{x:0,y:0},value:"",tempValue:""}),dn=({attrs:e,state:t,props:r})=>{let s=t.value||"-";return{isOpen:t.isOpen,position:t.position,value:s??"-",tempValue:t.tempValue,placeholder:r.placeholder??"",label:e.label}},fn=(e,t)=>{e.tempValue=t},yn=(e,t)=>{let{position:r}=t;e.position=r,e.isOpen=!0,e.hasUnsavedChanges=!1},mn=e=>{e.isOpen=!1,e.tempValue=""},gn=(e,t)=>{e.value=t},vn=({state:e})=>e.value;var jr={elementName:"rtgl-popover-input",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{"auto-focus":{type:"boolean"}}},propsSchema:{type:"object",properties:{value:{type:"string"},defaultValue:{type:"string"},placeholder:{type:"string"},onChange:{type:"function"}}},refs:{"text-display":{eventListeners:{click:{handler:"handleTextClick"}}},popover:{eventListeners:{close:{handler:"handlePopoverClose"}}},input:{eventListeners:{"input-change":{handler:"handleInputChange"},keydown:{handler:"handleInputKeydown"}}},submit:{eventListeners:{click:{handler:"handleSubmitClick"}}}},events:{"input-change":{}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view#text-display w=f cur=p",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"value"}}],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=background 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}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f placeholder=",{type:1,path:"placeholder"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=f ah=e",value:{type:9,items:[{type:8,properties:[{key:"rtgl-button#submit",value:{type:0,value:"Submit"}}],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 At={};P(At,{handleBeforeMount:()=>bn,handleButtonClick:()=>wn,handleClickOptionsPopoverOverlay:()=>xn,handleOptionClick:()=>En});var bn=e=>{let{store:t,props:r,render:s}=e;if(r.selectedValue!==null&&r.selectedValue!==void 0&&r.options){let n=r.options.find(i=>i.value===r.selectedValue);n&&(t.updateSelectOption(n),s())}},wn=(e,t)=>{let{store:r,render:s,getRefIds:n}=t;r.openOptionsPopover({position:{y:e.clientY,x:e.clientX}}),s()},xn=(e,t)=>{let{store:r,render:s}=t;r.closeOptionsPopover(),s()},En=(e,t)=>{let{render:r,dispatchEvent:s,props:n,store:i}=t,o=e.currentTarget.id.replace("option-",""),a=n.options[o];i.updateSelectOption(a),n.onChange&&typeof n.onChange=="function"&&n.onChange(a.value),s(new CustomEvent("option-selected",{detail:{value:a.value,label:a.label},bubbles:!0})),s(new CustomEvent("select-change",{detail:{selectedValue:a.value},bubbles:!0})),r()};var St={};P(St,{INITIAL_STATE:()=>_n,closeOptionsPopover:()=>$n,openOptionsPopover:()=>Sn,selectState:()=>An,toViewData:()=>kn,updateSelectOption:()=>Cn});var _n=Object.freeze({isOpen:!1,position:{x:0,y:0},selectedValue:null,selectedLabel:null}),kn=({state:e,props:t})=>{let r=t.placeholder||"Select an option",s=e.selectedValue!==null?e.selectedValue:t.selectedValue;if(s!=null&&t.options){let i=t.options.find(o=>o.value===s);i&&(r=i.label)}else e.selectedLabel&&(r=e.selectedLabel);let n=(t.options||[]).map(i=>({...i,isSelected:i.value===s,bgc:i.value===s?"mu":""}));return{isOpen:e.isOpen,position:e.position,options:n,selectedValue:s,selectedLabel:r,placeholder:t.placeholder||"Select an option"}},An=({state:e})=>e,Sn=(e,t)=>{let{position:r}=t;e.position=r,e.isOpen=!0},$n=e=>{e.isOpen=!1},Cn=(e,t)=>{e.selectedValue=t.value,e.selectedLabel=t.label,e.isOpen=!1};var Dr={elementName:"rtgl-select",viewDataSchema:{type:"object"},propsSchema:{type:"object",properties:{options:{type:"array",items:{type:"object",properties:{id:{type:"string"},label:{type:"string"},value:{type:"any"}}}},selectedValue:{type:"any"},placeholder:{type:"string"},onChange:{type:"function"}}},refs:{"select-button":{eventListeners:{click:{handler:"handleButtonClick"}}},popover:{eventListeners:{close:{handler:"handleClickOptionsPopoverOverlay"}}},"option-*":{eventListeners:{click:{handler:"handleOptionClick"}}}},events:{},template:{type:9,items:[{type:8,properties:[{key:"rtgl-button#select-button v=ol",value:{type:9,items:[{type:1,path:"selectedLabel"}],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 wh=300 g=xs slot=content bgc=background 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 h-bgc=ac ph=lg pv=md cur=p br=md bgc=${option.bgc}",value:{type:9,items:[{type:8,properties:[{key:"rtgl-text",value:{type:1,path:"option.label"}}],fast:!0}],fast:!0},parsedKey:{type:2,parts:["rtgl-view#option-",{type:1,path:"i"}," w=f h-bgc=ac ph=lg pv=md cur=p br=md bgc=",{type:1,path:"option.bgc"}]}}],fast:!0}],fast:!0}}],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"}]}}],fast:!1}],fast:!1}};var $t={};P($t,{handleHeaderClick:()=>In,handleItemClick:()=>On});var In=(e,t)=>{let{store:r,dispatchEvent:s}=t,n,i=r.selectHeader();e.currentTarget.id==="header-label"?n=i.labelPath:e.currentTarget.id==="header-image"?n=i.image.path:e.currentTarget.id==="header"&&(n=i.path),s(new CustomEvent("headerClick",{detail:{path:n},bubbles:!0,composed:!0}))},On=(e,t)=>{let{store:r,dispatchEvent:s}=t,n=e.currentTarget.id.replace("item-",""),i=r.selectItem(n);s(new CustomEvent("itemClick",{detail:{item:i},bubbles:!0,composed:!0}))};var It={};P(It,{INITIAL_STATE:()=>Tn,selectActiveItem:()=>Pn,selectHeader:()=>Rn,selectItem:()=>jn,setState:()=>Dn,toViewData:()=>Vn});var Tn=Object.freeze({}),Ln=["id","class","style","slot"],Nn=e=>Object.entries(e).filter(([t])=>!Ln.includes(t)).map(([t,r])=>`${t}=${r}`).join(" ");function Ct(e,t=null){let r=[];for(let s of e){let n=s.id||s.href||s.path,i=t===n;if(r.push({id:n,title:s.title,href:s.href,type:s.type||"item",icon:s.icon,hrefAttr:s.href?`href=${s.href}`:"",isSelected:i,itemBgc:i?"ac":"bg",itemHoverBgc:i?"ac":"mu"}),s.items&&Array.isArray(s.items))for(let o of s.items){let a=o.id||o.href||o.path,l=t===a;r.push({id:a,title:o.title,href:o.href,type:o.type||"item",icon:o.icon,hrefAttr:o.href?`href=${o.href}`:"",isSelected:l,itemBgc:l?"ac":"bg",itemHoverBgc:l?"ac":"mu"})}}return r}var Vn=({state:e,props:t,attrs:r})=>{let s=r.header?JSON.parse(decodeURIComponent(r.header)):t.header,n=r.items?JSON.parse(decodeURIComponent(r.items)):t.items,i=r.selectedItemId||t.selectedItemId,o=Nn(r),a=r.mode||"full",l=s||{label:"",path:"",image:{src:"",alt:"",width:0,height:0}},p=n?Ct(n,i):[],u=a==="full"?272:64,c=a==="full"?"fs":"c",d=a==="full"?"fs":"c",y=a==="full"?"lg":"sm",h=a==="full"?"md":"sm",f=a==="shrunk-lg"?48:40,m=a==="shrunk-lg"?28:20,v=a==="shrunk-lg"?"md":"sm",w=a==="full",b=a==="full",E=a==="full"?"fs":"c",A=a==="full"?"":`ah=${d}`,_=a==="full"?"f":f;return{containerAttrString:o,mode:a,header:l,items:p,sidebarWidth:u,headerAlign:c,itemAlign:d,headerPadding:y,itemPadding:h,itemHeight:f,iconSize:m,firstLetterSize:v,showLabels:w,showGroupLabels:b,itemContentAlign:E,itemAlignAttr:A,itemWidth:_,headerWidth:_,selectedItemId:i,ah:a==="shrunk-lg"||a==="shrunk-md"?"c":""}},Rn=({state:e,props:t,attrs:r})=>r.header?JSON.parse(decodeURIComponent(r.header)):t.header,Pn=({state:e,props:t})=>(t.items?Ct(t.items):[]).find(s=>s.active),jn=({state:e,props:t,attrs:r},s)=>{let n=r.items?JSON.parse(decodeURIComponent(r.items)):t.items;return(n?Ct(n):[]).find(o=>o.id===s)},Dn=e=>{};var Br={elementName:"rtgl-sidebar",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},mode:{type:"string",enum:["full","shrunk","shrunk-lg"],default:"full"},sidebarWidth:{type:"number"},headerAlign:{type:"string"},itemAlign:{type:"string"},headerPadding:{type:"string"},itemPadding:{type:"string"},itemHeight:{type:"number"},iconSize:{type:"number"},firstLetterSize:{type:"string"},showLabels:{type:"boolean"},showGroupLabels:{type:"boolean"},itemContentAlign:{type:"string"},itemAlignAttr:{type:"string"},itemWidth:{type:"string"},headerWidth:{type:"string"},selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{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"},active:{type:"boolean"},icon:{type:"string"}}}}}},propsSchema:{type:"object",properties:{selectedItemId:{type:"string"},header:{type:"object",properties:{label:{type:"string"},href:{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"}}}}}},refs:{"header-image":{eventListeners:{click:{handler:"handleHeaderClick"}}},"header-label":{eventListeners:{click:{handler:"handleHeaderClick"}}},header:{eventListeners:{click:{handler:"handleHeaderClick"}}},"item-*":{eventListeners:{click:{handler:"handleItemClick"}}}},events:{headerClick:{type:"object",properties:{path:{type:"string"}}}},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#header-image cur=p":[{'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#header-label cur=p":[{"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} bwr=xs ah=${ah} ${containerAttrString}",value:{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#header-image cur=p",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#header-label cur=p",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=p",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#header-image cur=p",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#header-label cur=p",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=p"]}}],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},{type:8,properties:[{key:"rtgl-view w=f 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-bg",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-${item.id} ${item.hrefAttr} h=${itemHeight} av=c ${itemAlignAttr} ph=${itemPadding} w=${itemWidth} h-bgc=${item.itemHoverBgc} br=lg bgc=${item.itemBgc} cur=p",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:"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=p"]}}],fast:!1}],fast:!1}],id:null}}],fast:!1}],fast:!1}}],fast:!1},parsedKey:{type:2,parts:["rtgl-view w=f 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"}," bwr=xs ah=",{type:1,path:"ah"}," ",{type:1,path:"containerAttrString"}]}}],fast:!1}],fast:!1}};var Ot={};P(Ot,{handleBeforeMount:()=>Bn,handleValueChange:()=>Wn});var Bn=e=>{let{store:t,attrs:r}=e;t.setValue(r.defaultValue||0)},Wn=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=Number(e.detail.value);r.setValue(i),s(),n(new CustomEvent("slider-input-value-change",{detail:{value:i},bubbles:!0}))};var Tt={};P(Tt,{INITIAL_STATE:()=>Mn,setValue:()=>Fn,toViewData:()=>Kn});var Mn=Object.freeze({value:0}),Kn=({state:e,attrs:t})=>({value:e.value,w:t.w||"",min:t.min||0,max:t.max||100,step:t.step||1}),Fn=(e,t)=>{e.value=t};var Wr={elementName:"rtgl-slider-input",viewDataSchema:{type:"object"},attrsSchema:{type:"object",properties:{defaultValue:{type:"string",default:"0"},w:{type:"string",default:""},min:{type:"string",default:"0"},max:{type:"string",default:"100"},step:{type:"string",default:"1"}}},refs:{input:{eventListeners:{"input-change":{handler:"handleValueChange"}}},slider:{eventListeners:{"slider-change":{handler:"handleValueChange"}}}},events:{"form-change":{}},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 w=f type=range min=${min} max=${max} step=${step} value=${value}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-slider#slider w=f type=range min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}]}}],fast:!0},{type:8,properties:[{key:"rtgl-view w=84",value:{type:9,items:[{type:8,properties:[{key:"rtgl-input#input w=f type=number min=${min} max=${max} step=${step} value=${value}",value:{type:0,value:null},parsedKey:{type:2,parts:["rtgl-input#input w=f type=number min=",{type:1,path:"min"}," max=",{type:1,path:"max"}," step=",{type:1,path:"step"}," value=",{type:1,path:"value"}]}}],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 Lt={};P(Lt,{handleBeforeMount:()=>zn,handleHeaderClick:()=>Hn,handleRowClick:()=>Un});var zn=e=>{},Un=(e,t)=>{let{dispatchEvent:r,props:s}=t,n=parseInt(e.currentTarget.id.replace("row-","")),i=s.data?.rows?.[n];i&&r(new CustomEvent("row-click",{detail:{rowIndex:n,rowData:i}}))},Hn=(e,t)=>{let{store:r,render:s,dispatchEvent:n}=t,i=e.currentTarget.id.replace("header-",""),o=r.selectSortInfo(),a="asc";o.column===i&&(o.direction==="asc"?a="desc":o.direction==="desc"&&(a=null)),a?r.setSortColumn({column:i,direction:a}):r.clearSort(),s(),n(new CustomEvent("header-click",{detail:{column:i,direction:a,sortInfo:a?{column:i,direction:a}:null}}))};var Nt={};P(Nt,{INITIAL_STATE:()=>Jn,clearSort:()=>ta,selectSortInfo:()=>Zn,selectState:()=>Qn,setSortColumn:()=>ea,toViewData:()=>Xn});var Jn=Object.freeze({sortColumn:null,sortDirection:null}),Yn=["id","class","style","slot"],qn=e=>Object.entries(e).filter(([t])=>!Yn.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),Gn=(e,t)=>{let r=t.split("."),s=e;for(let n of r){if(s==null)return null;s=s[n]}return s},Xn=({state:e,props:t,attrs:r})=>{let s=qn(r),n=t.data||{columns:[],rows:[]},i=n.rows.map((o,a)=>{let l=n.columns.map(p=>{let u=Gn(o,p.key);return{key:p.key,value:u!=null?String(u):""}});return{index:a,cells:l}});return{containerAttrString:s,columns:n.columns||[],rows:i||[]}},Qn=({state:e})=>e,Zn=({state:e})=>({column:e.sortColumn,direction:e.sortDirection}),ea=(e,{column:t,direction:r})=>{e.sortColumn=t,e.sortDirection=r},ta=e=>{e.sortColumn=null,e.sortDirection=null};var Mr={elementName:"rtgl-table",viewDataSchema:{type:"object",properties:{columns:{type:"array"},rows:{type:"array"},containerAttrString:{type:"string"}}},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}}},refs:{"row-*":{eventListeners:{click:{handler:"handleRowClick"}}},"header-*":{eventListeners:{click:{handler:"handleHeaderClick"}}}},events:{},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-${column.key}",value:{type:1,path:"column.label"},parsedKey:{type:2,parts:["th#header-",{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-${row.index}",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:"row.index"}]}}],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 Vt={};P(Vt,{handleClickItem:()=>ra});var ra=(e,t)=>{let{dispatchEvent:r}=t,s=e.currentTarget.dataset.id;r(new CustomEvent("item-click",{detail:{id:s}}))};var Rt={};P(Rt,{INITIAL_STATE:()=>sa,toViewData:()=>aa});var sa=Object.freeze({}),ia=["id","class","style","slot"],na=e=>Object.entries(e).filter(([t])=>!ia.includes(t)).map(([t,r])=>`${t}=${r}`).join(" "),aa=({state:e,props:t,attrs:r})=>{let s=na(r),n=t.items||[],i=r["selected-tab"],o=n.map(a=>({...a,isSelected:a.id===i,bgColor:a.id===i?"ac":"",borderColor:a.id===i?"":"tr",textColor:a.id===i?"":"mu-fg"}));return{containerAttrString:s,items:o,selectedTab:i}};var Kr={elementName:"rtgl-tabs",viewDataSchema:{type:"object",properties:{containerAttrString:{type:"string"},items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"},isSelected:{type:"boolean"},bgColor:{type:"string"},textColor:{type:"string"},borderColor:{type:"string"}}}},selectedTab:{type:"string"}}},propsSchema:{type:"object",properties:{items:{type:"array",items:{type:"object",properties:{label:{type:"string"},id:{type:"string"}}}}}},attrsSchema:{type:"object",properties:{"selected-tab":{type:"string"}}},refs:{"tab-*":{eventListeners:{click:{handler:"handleClickItem"}}}},events:{"item-click":{type:"object",properties:{id:{type:"string"}}}},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:null,iterable:{type:1,path:"items"},body:{type:9,items:[{type:8,properties:[{key:"rtgl-view#tab-${item.id} data-id=${item.id} cur=p bgc=${item.bgColor} bw=xs bc=${item.borderColor} pv=md ph=lg br=lg",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:"item.id"}," data-id=",{type:1,path:"item.id"}," cur=p bgc=",{type:1,path:"item.bgColor"}," bw=xs bc=",{type:1,path:"item.borderColor"}," pv=md ph=lg br=lg"]}}],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 Pt={};P(Pt,{handleAfterMount:()=>oa,handleOnUpdate:()=>la});var oa=async e=>{let{props:t,store:r,render:s,getRefIds:n}=e,{waveformData:i}=t;r.setWaveformData(i),s();let o=n().canvas?.elm;o&&Fr(i,o)},la=async(e,t)=>{let{store:r,render:s,getRefIds:n,props:i}=t,{waveformData:o}=i;if(!o){console.log("waveform handleOnUpdate: no waveformData provided");return}r.setWaveformData(o),s();let a=n().canvas?.elm;a&&Fr(o,a)};async function Fr(e,t){let r=t.getContext("2d"),s=t.getBoundingClientRect(),n=s.width,i=s.height;t.width=n,t.height=i;let o=t.width,a=t.height;if(r.clearRect(0,0,o,a),r.fillStyle="#1a1a1a",r.fillRect(0,0,o,a),!e||!e.data)return;let l=e.data,p=a/2,u=r.createLinearGradient(0,0,0,a);u.addColorStop(0,"#404040"),u.addColorStop(.5,"#A1A1A1"),u.addColorStop(1,"#404040");let c=Math.max(1,o/l.length),d=.2;for(let y=0;y<l.length;y++){let f=l[y]*(a*.85),m=y*c,v=p-f/2;r.fillStyle=u,r.fillRect(m,v,Math.max(1,c*(1-d)),f)}r.strokeStyle="rgba(255, 255, 255, 0.1)",r.lineWidth=1,r.beginPath(),r.moveTo(0,p),r.lineTo(o,p),r.stroke(),r.shadowBlur=10,r.shadowColor="#2196F3"}var jt={};P(jt,{INITIAL_STATE:()=>pa,setWaveformData:()=>ca,toViewData:()=>ua});var pa=Object.freeze({waveformData:null}),ca=(e,t)=>{e.waveformData=t},ua=({state:e,attrs:t,props:r})=>({isLoading:r.isLoading,w:t.w||"250",h:t.h||"150",cur:t.cur,waveformData:r.waveformData});var zr={elementName:"rtgl-waveform",attrsSchema:{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"}}},propsSchema:{type:"object",properties:{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"}}},refs:{canvas:{selector:"canvas"}},template:{type:9,items:[{type:8,properties:[{key:"rtgl-view w=f h=f 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 w=f h=f pos=rel w=",{type:1,path:"w"}," h=",{type:1,path:"h"}," cur=",{type:1,path:"cur"}]}}],fast:!1}],fast:!1}};var Gr=Symbol.for("immer-nothing"),Ur=Symbol.for("immer-draftable"),Y=Symbol.for("immer-state");function Z(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ve=Object.getPrototypeOf;function be(e){return!!e&&!!e[Y]}function ce(e){return e?Xr(e)||Array.isArray(e)||!!e[Ur]||!!e.constructor?.[Ur]||Be(e)||We(e):!1}var ha=Object.prototype.constructor.toString();function Xr(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)===ha}function Re(e,t){De(e)===0?Reflect.ownKeys(e).forEach(r=>{t(r,e[r],e)}):e.forEach((r,s)=>t(s,r,e))}function De(e){let t=e[Y];return t?t.type_:Array.isArray(e)?1:Be(e)?2:We(e)?3:0}function Wt(e,t){return De(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Qr(e,t,r){let s=De(e);s===2?e.set(t,r):s===3?e.add(r):e[t]=r}function da(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function Be(e){return e instanceof Map}function We(e){return e instanceof Set}function pe(e){return e.copy_||e.base_}function Mt(e,t){if(Be(e))return new Map(e);if(We(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let r=Xr(e);if(t===!0||t==="class_only"&&!r){let s=Object.getOwnPropertyDescriptors(e);delete s[Y];let n=Reflect.ownKeys(s);for(let i=0;i<n.length;i++){let o=n[i],a=s[o];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(s[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(ve(e),s)}else{let s=ve(e);if(s!==null&&r)return{...e};let n=Object.create(s);return Object.assign(n,e)}}function Ht(e,t=!1){return Me(e)||be(e)||!ce(e)||(De(e)>1&&(e.set=e.add=e.clear=e.delete=fa),Object.freeze(e),t&&Object.entries(e).forEach(([r,s])=>Ht(s,!0))),e}function fa(){Z(2)}function Me(e){return Object.isFrozen(e)}var ya={};function ue(e){let t=ya[e];return t||Z(0,e),t}var Se;function Zr(){return Se}function ma(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Hr(e,t){t&&(ue("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function Kt(e){Ft(e),e.drafts_.forEach(ga),e.drafts_=null}function Ft(e){e===Se&&(Se=e.parent_)}function Jr(e){return Se=ma(Se,e)}function ga(e){let t=e[Y];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Yr(e,t){t.unfinalizedDrafts_=t.drafts_.length;let r=t.drafts_[0];return e!==void 0&&e!==r?(r[Y].modified_&&(Kt(t),Z(4)),ce(e)&&(e=Pe(t,e),t.parent_||je(t,e)),t.patches_&&ue("Patches").generateReplacementPatches_(r[Y].base_,e,t.patches_,t.inversePatches_)):e=Pe(t,r,[]),Kt(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==Gr?e:void 0}function Pe(e,t,r){if(Me(t))return t;let s=t[Y];if(!s)return Re(t,(n,i)=>qr(e,s,t,n,i,r)),t;if(s.scope_!==e)return t;if(!s.modified_)return je(e,s.base_,!0),s.base_;if(!s.finalized_){s.finalized_=!0,s.scope_.unfinalizedDrafts_--;let n=s.copy_,i=n,o=!1;s.type_===3&&(i=new Set(n),n.clear(),o=!0),Re(i,(a,l)=>qr(e,s,n,a,l,r,o)),je(e,n,!1),r&&e.patches_&&ue("Patches").generatePatches_(s,r,e.patches_,e.inversePatches_)}return s.copy_}function qr(e,t,r,s,n,i,o){if(be(n)){let a=i&&t&&t.type_!==3&&!Wt(t.assigned_,s)?i.concat(s):void 0,l=Pe(e,n,a);if(Qr(r,s,l),be(l))e.canAutoFreeze_=!1;else return}else o&&r.add(n);if(ce(n)&&!Me(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Pe(e,n),(!t||!t.scope_.parent_)&&typeof s!="symbol"&&Object.prototype.propertyIsEnumerable.call(r,s)&&je(e,n)}}function je(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Ht(t,r)}function va(e,t){let r=Array.isArray(e),s={type_:r?1:0,scope_:t?t.scope_:Zr(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},n=s,i=Jt;r&&(n=[s],i=$e);let{revoke:o,proxy:a}=Proxy.revocable(n,i);return s.draft_=a,s.revoke_=o,a}var Jt={get(e,t){if(t===Y)return e;let r=pe(e);if(!Wt(r,t))return ba(e,r,t);let s=r[t];return e.finalized_||!ce(s)?s:s===Dt(e.base_,t)?(Bt(e),e.copy_[t]=Ut(s,e)):s},has(e,t){return t in pe(e)},ownKeys(e){return Reflect.ownKeys(pe(e))},set(e,t,r){let s=es(pe(e),t);if(s?.set)return s.set.call(e.draft_,r),!0;if(!e.modified_){let n=Dt(pe(e),t),i=n?.[Y];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(da(r,n)&&(r!==void 0||Wt(e.base_,t)))return!0;Bt(e),zt(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 Dt(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Bt(e),zt(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let r=pe(e),s=Reflect.getOwnPropertyDescriptor(r,t);return s&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:s.enumerable,value:r[t]}},defineProperty(){Z(11)},getPrototypeOf(e){return ve(e.base_)},setPrototypeOf(){Z(12)}},$e={};Re(Jt,(e,t)=>{$e[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});$e.deleteProperty=function(e,t){return $e.set.call(this,e,t,void 0)};$e.set=function(e,t,r){return Jt.set.call(this,e[0],t,r,e[0])};function Dt(e,t){let r=e[Y];return(r?pe(r):e)[t]}function ba(e,t,r){let s=es(t,r);return s?"value"in s?s.value:s.get?.call(e.draft_):void 0}function es(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 zt(e){e.modified_||(e.modified_=!0,e.parent_&&zt(e.parent_))}function Bt(e){e.copy_||(e.copy_=Mt(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var wa=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(t,r,s)=>{if(typeof t=="function"&&typeof r!="function"){let i=r;r=t;let o=this;return function(l=i,...p){return o.produce(l,u=>r.call(this,u,...p))}}typeof r!="function"&&Z(6),s!==void 0&&typeof s!="function"&&Z(7);let n;if(ce(t)){let i=Jr(this),o=Ut(t,void 0),a=!0;try{n=r(o),a=!1}finally{a?Kt(i):Ft(i)}return Hr(i,s),Yr(n,i)}else if(!t||typeof t!="object"){if(n=r(t),n===void 0&&(n=t),n===Gr&&(n=void 0),this.autoFreeze_&&Ht(n,!0),s){let i=[],o=[];ue("Patches").generateReplacementPatches_(t,n,i,o),s(i,o)}return n}else Z(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...a)=>this.produceWithPatches(o,l=>t(l,...a));let s,n;return[this.produce(t,r,(o,a)=>{s=o,n=a}),s,n]},typeof e?.autoFreeze=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){ce(e)||Z(8),be(e)&&(e=xa(e));let t=Jr(this),r=Ut(e,void 0);return r[Y].isManual_=!0,Ft(t),r}finishDraft(e,t){let r=e&&e[Y];(!r||!r.isManual_)&&Z(9);let{scope_:s}=r;return Hr(s,t),Yr(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 n=t[r];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}r>-1&&(t=t.slice(r+1));let s=ue("Patches").applyPatches_;return be(e)?s(e,t):this.produce(e,n=>s(n,t))}};function Ut(e,t){let r=Be(e)?ue("MapSet").proxyMap_(e,t):We(e)?ue("MapSet").proxySet_(e,t):va(e,t);return(t?t.scope_:Zr()).drafts_.push(r),r}function xa(e){return be(e)||Z(10,e),ts(e)}function ts(e){if(!ce(e)||Me(e))return e;let t=e[Y],r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=Mt(e,t.scope_.immer_.useStrictShallowCopy_)}else r=Mt(e,!0);return Re(r,(s,n)=>{Qr(r,s,ts(n))}),t&&(t.finalized_=!1),r}var q=new wa,rs=q.produce,Sp=q.produceWithPatches.bind(q),$p=q.setAutoFreeze.bind(q),Cp=q.setUseStrictShallowCopy.bind(q),Ip=q.applyPatches.bind(q),Op=q.createDraft.bind(q),Tp=q.finishDraft.bind(q);var x={LITERAL:0,VARIABLE:1,INTERPOLATION:2,FUNCTION:3,BINARY:4,UNARY:5,CONDITIONAL:6,LOOP:7,OBJECT:8,ARRAY:9},G={EQ:0,NEQ:1,GT:2,LT:3,GTE:4,LTE:5,AND:6,OR:7,IN:8},Ke={NOT:0};var we=class extends Error{constructor(t){super(`Render Error: ${t}`),this.name="JemplRenderError"}};var ss=(e,t)=>{if(t===null)return new we(`Cannot iterate over null value at '$for ${e}'`);if(t===void 0)return new we(`Cannot iterate over undefined value at '$for ${e}'`);let r=typeof t;return new we(`Cannot iterate over non-array value (got: ${r}) at '$for ${e}'`)},is=(e,t)=>{let r=t&&Object.keys(t).length>0?Object.keys(t).join(", "):"no custom functions provided";return new we(`Unknown function '${e}' (${r})`)};var Ea=(e,t,r={})=>T(e,r,t,{}),T=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);if(e.type===x.LITERAL)return e.value;if(e.type===x.VARIABLE)return z(e.path,r,s);if(e.type===x.INTERPOLATION)return _a(e.parts,t,r,s);switch(e.type){case x.FUNCTION:return ns(e,t,r,s);case x.BINARY:return as(e,t,r,s);case x.UNARY:return os(e,t,r,s);case x.CONDITIONAL:return Aa(e,t,r,s);case x.LOOP:return Oa(e,t,r,s);case x.OBJECT:return La(e,t,r,s);case x.ARRAY:return Na(e,t,r,s);default:throw new Error(`Unknown node type: ${e.type}`)}},oe=new Map,z=(e,t,r)=>{if(!e)return;if(e in r)return r[e];let s=oe.get(e);s||(s=e.split("."),oe.set(e,s));let n=t;for(let i=0;i<s.length;i++){let o=s[i];if(o in r){n=r[o];continue}if(n==null)return;n=n[o]}return n},_a=(e,t,r,s)=>{let n=[];for(let i of e)if(typeof i=="string")n.push(i);else{let o=T(i,t,r,s);n.push(o!=null?String(o):"")}return n.join("")},ns=(e,t,r,s)=>{let n=t[e.name];if(!n)throw is(e.name,t);let i=e.args.map(o=>T(o,t,r,s));return n(...i)},Fe=(e,t,r,s)=>{if(e.var&&!e.type)return z(e.var,r,s);switch(e.type){case x.VARIABLE:return z(e.path,r,s);case x.LITERAL:return e.value;case x.BINARY:return as(e,t,r,s);case x.UNARY:return os(e,t,r,s);case x.FUNCTION:return ns(e,t,r,s);default:return T(e,t,r,s)}},as=(e,t,r,s)=>{if(e.op===G.AND||e.op===G.OR){let o=Fe(e.left,t,r,s),a=Fe(e.right,t,r,s);switch(e.op){case G.AND:return o&&a;case G.OR:return o||a}}let n=T(e.left,t,r,s),i=T(e.right,t,r,s);switch(e.op){case G.EQ:return n==i;case G.NEQ:return n!=i;case G.GT:return n>i;case G.LT:return n<i;case G.GTE:return n>=i;case G.LTE:return n<=i;case G.IN:return Array.isArray(i)?i.includes(n):!1;default:throw new Error(`Unknown binary operator: ${e.op}`)}},os=(e,t,r,s)=>{let n=e.op===Ke.NOT?Fe(e.operand,t,r,s):T(e.operand,t,r,s);switch(e.op){case Ke.NOT:return!n;default:throw new Error(`Unknown unary operator: ${e.op}`)}},ka=(e,t,r,s)=>{if(e.conditions.length===2&&e.conditions[1]===null){let n=e.conditions[0];if(n.type===x.VARIABLE)if(z(n.path,r,s)){let o=e.bodies[0];if(o.type===x.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?T(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===x.LITERAL)a[p]=u.value;else if(u.type===x.VARIABLE)a[p]=z(u.path,r,s);else if(u.type===x.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===x.VARIABLE){let y=z(d.path,r,s);c.push(y!=null?String(y):"")}else{let y=T(d,t,r,s);c.push(y!=null?String(y):"")}a[p]=c.join("")}else a[p]=T(u,t,r,s)}return a}}else{let o=e.bodies[1];if(o.type===x.OBJECT&&o.properties.length<=5){let a={};for(let l of o.properties){let p=l.parsedKey?T(l.parsedKey,t,r,s):l.key,u=l.value;if(u.type===x.LITERAL)a[p]=u.value;else if(u.type===x.VARIABLE)a[p]=z(u.path,r,s);else if(u.type===x.INTERPOLATION){let c=[];for(let d of u.parts)if(typeof d=="string")c.push(d);else if(d.type===x.VARIABLE){let y=z(d.path,r,s);c.push(y!=null?String(y):"")}else{let y=T(d,t,r,s);c.push(y!=null?String(y):"")}a[p]=c.join("")}else a[p]=T(u,t,r,s)}return a}}}return null},Aa=(e,t,r,s)=>{let n=ka(e,t,r,s);if(n!==null)return n;for(let i=0;i<e.conditions.length;i++){let o=e.conditions[i];if(o===null||Fe(o,t,r,s))return T(e.bodies[i],t,r,s)}return ls},Sa=(e,t)=>{let r=e.body,s=e.itemVar;if(r.type===x.CONDITIONAL&&r.conditions.length===1&&r.conditions[0].type===x.VARIABLE){let n=r.conditions[0].path,i=r.bodies[0];if(n.startsWith(s+".")){let o=n.substring(s.length+1);if(i.type===x.OBJECT&&i.properties.length<=5){for(let l of i.properties)if(l.parsedKey)return null;let a=[];for(let l=0;l<t.length;l++){let p=t[l];if(p[o]){let u={};for(let c of i.properties){let d=c.key,y=c.value;if(y.type===x.LITERAL)u[d]=y.value;else if(y.type===x.VARIABLE){let h=y.path;if(h===s)u[d]=p;else if(h.startsWith(s+".")){let f=h.substring(s.length+1);u[d]=p[f]}else return null}else if(y.type===x.INTERPOLATION){let h=[],f=!0;for(let m of y.parts)if(typeof m=="string")h.push(m);else if(m.type===x.VARIABLE){let v=m.path;if(v===s)h.push(p!=null?String(p):"");else if(v.startsWith(s+".")){let w=v.substring(s.length+1),b=p[w];h.push(b!=null?String(b):"")}else{f=!1;break}}else{f=!1;break}if(!f)return null;u[d]=h.join("")}else return null}a.push(u)}}return a}}}return null},$a=(e,t)=>{let r=e.body,s=e.itemVar,n=Sa(e,t);if(n!==null)return n;if(r.type===x.OBJECT&&r.properties.length<=5){for(let a of r.properties)if(a.parsedKey)return null;let i=[],o=!0;for(let a of r.properties){let l=a.key,p=a.value;if(p.type===x.LITERAL)i.push({key:l,type:"literal",value:p.value});else if(p.type===x.VARIABLE){let u=p.path;if(u===s)i.push({key:l,type:"item"});else if(u.startsWith(s+".")){let c=u.substring(s.length+1);if(!c.includes("."))i.push({key:l,type:"prop",prop:c});else{o=!1;break}}else{o=!1;break}}else if(p.type===x.INTERPOLATION&&p.parts.length===1){let u=p.parts[0];if(u.type===x.VARIABLE){let c=u.path;if(c===s)i.push({key:l,type:"item_string"});else if(c.startsWith(s+".")){let d=c.substring(s.length+1);if(!d.includes("."))i.push({key:l,type:"prop_string",prop:d});else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}else{o=!1;break}}if(o){let a=new Array(t.length);if(i.length===3&&i[0].type==="prop"&&i[0].key==="id"&&i[1].type==="prop_string"&&i[1].key==="title"&&i[2].type==="prop"&&i[2].key==="completed")for(let l=0;l<t.length;l++){let p=t[l];a[l]={id:p.id,title:p.title!=null?String(p.title):"",completed:p.completed}}else for(let l=0;l<t.length;l++){let p=t[l],u={};for(let c of i)if(c.type==="literal")u[c.key]=c.value;else if(c.type==="item")u[c.key]=p;else if(c.type==="prop")u[c.key]=p[c.prop];else if(c.type==="item_string")u[c.key]=p!=null?String(p):"";else if(c.type==="prop_string"){let d=p[c.prop];u[c.key]=d!=null?String(d):""}a[l]=u}return a}}return null},Ca=(e,t,r,s,n)=>{let i=[],o=e.body;if(o.type===x.OBJECT&&o.fast!==!1){let a=e.itemVar,l=e.indexVar;for(let p=0;p<n.length;p++){let u=n[p],c={},d={...s,[a]:u,...l&&{[l]:p}};for(let y of o.properties){let h=y.parsedKey?T(y.parsedKey,t,r,d):y.key,f=y.value;if(f.type===x.LITERAL)c[h]=f.value;else if(f.type===x.VARIABLE){let m=f.path;if(m===a)c[h]=u;else if(m===l)c[h]=p;else if(m.startsWith(a+".")){let v=m.substring(a.length+1);if(!v.includes("."))c[h]=u[v];else{let w=oe.get(v)||(oe.set(v,v.split(".")),oe.get(v)),b=u;for(let E of w){if(b==null){b=void 0;break}b=b[E]}c[h]=b}}else c[h]=z(m,r,{...s,[a]:u,...l&&{[l]:p}})}else if(f.type===x.INTERPOLATION){let m=[];for(let v of f.parts)if(typeof v=="string")m.push(v);else if(v.type===x.VARIABLE){let w=v.path,b;if(w===a)b=u;else if(w===l)b=p;else if(w.startsWith(a+".")){let E=w.substring(a.length+1);if(!E.includes("."))b=u[E];else{let A=oe.get(E)||(oe.set(E,E.split(".")),oe.get(E)),_=u;for(let $ of A){if(_==null){_=void 0;break}_=_[$]}b=_}}else b=z(w,r,{...s,[a]:u,...l&&{[l]:p}});m.push(b!=null?String(b):"")}else{let w={...s,[a]:u,...l&&{[l]:p}},b=T(v,t,r,w);m.push(b!=null?String(b):"")}c[h]=m.join("")}else{let m={...s,[a]:u,...l&&{[l]:p}};c[h]=T(f,t,r,m)}}i.push(c)}return i}return null},Ia=(e,t,r)=>{let s=e.body;if(s.type===x.OBJECT&&s.properties.length===1&&s.properties[0].key==="$if item.visible"){let i=s.properties[0].value;if(i.type===x.CONDITIONAL&&i.conditions.length===1&&i.conditions[0].type===x.VARIABLE&&i.conditions[0].path==="item.visible"){let o=i.bodies[0];if(o.type===x.OBJECT&&o.properties.length===2){let a=o.properties[0],l=o.properties[1];if(a.key==="id"&&a.value.type===x.VARIABLE&&a.value.path==="item.id"&&l.key==="$if item.highlighted"&&l.value.type===x.CONDITIONAL){let p=[];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),p.push(d)}}return p}}}}return null},Oa=(e,t,r,s)=>{let n=T(e.iterable,t,r,s);if(!Array.isArray(n)){let a=`${e.itemVar}${e.indexVar?`, ${e.indexVar}`:""} in ${e.iterable.path}`;throw ss(a,n)}if(!e.indexVar){let a=Ia(e,n,e.itemVar);if(a!==null)return a}if(!e.indexVar){let a=$a(e,n);if(a!==null)return a}let i=Ca(e,t,r,s,n);if(i!==null)return i;let o=[];for(let a=0;a<n.length;a++){let l=e.indexVar?{...s,[e.itemVar]:n[a],[e.indexVar]:a}:{...s,[e.itemVar]:n[a]},p=T(e.body,t,r,l);Array.isArray(p)&&p.length===1?o.push(p[0]):o.push(p)}return o},Ta=(e,t,r,s)=>{if(e.properties.length===1){let n=e.properties[0],i=n.parsedKey?T(n.parsedKey,t,r,s):n.key,o=n.value;if(o.type===x.OBJECT&&o.properties.length<=10){let a={},l={},p=!0;for(let u of o.properties){let c=u.parsedKey?T(u.parsedKey,t,r,s):u.key,d=u.value;if(d.type===x.LITERAL)l[c]=d.value;else if(d.type===x.VARIABLE)l[c]=z(d.path,r,s);else if(d.type===x.INTERPOLATION){let y=[];for(let h of d.parts)if(typeof h=="string")y.push(h);else if(h.type===x.VARIABLE){let f=z(h.path,r,s);y.push(f!=null?String(f):"")}else{p=!1;break}if(!p)break;l[c]=y.join("")}else if(d.type===x.OBJECT&&d.properties.length<=5){let y={};for(let h of d.properties){let f=h.key,m=h.value;if(m.type===x.LITERAL)y[f]=m.value;else if(m.type===x.VARIABLE)y[f]=z(m.path,r,s);else if(m.type===x.INTERPOLATION){let v=[];for(let w of m.parts)if(typeof w=="string")v.push(w);else if(w.type===x.VARIABLE){let b=z(w.path,r,s);v.push(b!=null?String(b):"")}else{p=!1;break}if(!p)break;y[f]=v.join("")}else{p=!1;break}}if(!p)break;l[c]=y}else{p=!1;break}}if(p)return a[i]=l,a}}return null},La=(e,t,r,s)=>{let n=Ta(e,t,r,s);if(n!==null)return n;if(e.fast){let l={};for(let p of e.properties){let u=p.parsedKey?T(p.parsedKey,t,r,s):p.key,c=p.value;if(c.type===x.LITERAL)l[u]=c.value;else if(c.type===x.VARIABLE)l[u]=z(c.path,r,s);else if(c.type===x.INTERPOLATION){let d=[];for(let y of c.parts)if(typeof y=="string")d.push(y);else if(y.type===x.VARIABLE){let h=z(y.path,r,s);d.push(h!=null?String(h):"")}else{let h=T(y,t,r,s);d.push(h!=null?String(h):"")}l[u]=d.join("")}else l[u]=T(c,t,r,s)}return l}let i={},o=null,a=!1;for(let l of e.properties)if(!l.key.startsWith("$if ")&&!l.key.match(/^\$if\s+\w+.*:?$/)&&!l.key.startsWith("$elif")&&!l.key.startsWith("$else")&&!l.key.startsWith("$for ")){a=!0;break}for(let l of e.properties)if(l.key.startsWith("$if ")||l.key.match(/^\$if\s+\w+.*:?$/)){let p=T(l.value,t,r,s);if(!a&&p!==null&&p!==void 0)return Array.isArray(p)&&p.length===1?p[0]:p;typeof p=="object"&&p!==null&&!Array.isArray(p)&&Object.assign(i,p)}else if(!l.key.startsWith("$for ")){let p=l.value;if(p&&p.type===x.OBJECT&&p.properties){let u=p.properties.find(c=>c.key.startsWith("$for "));if(u){let c=T(u.value,t,r,s);c!==void 0&&(i[l.key]=c)}else{let c=T(l.value,t,r,s);c!==void 0&&(i[l.key]=c)}}else{let u=l.parsedKey?T(l.parsedKey,t,r,s):l.key,c=T(l.value,t,r,s);c!==void 0&&(i[u]=c)}}return i},ls={},Na=(e,t,r,s)=>{let n=[];for(let i of e.items)if(i.type===x.LOOP){let o=T(i,t,r,s);n.push(o)}else{let o=T(i,t,r,s);o!==ls&&n.push(o)}return n},ze=Ea;var Ue=e=>Array.isArray(e)?e.reduce((t,r)=>{if(Array.isArray(r))t.push(...Ue(r));else{if(r&&typeof r=="object"){let s=Object.entries(r);if(s.length>0){let[n,i]=s[0];Array.isArray(i)&&(r={[n]:Ue(i)})}}t.push(r)}return t},[]):e;var ps=(e,t)=>{if(!t)return e;let r=[],s="",n=!1,i=null;for(let o=0;o<t.length;o++){let a=t[o];if(!n&&a===".")s&&(r.push(s),s="");else if(!n&&a==="[")s&&(r.push(s),s=""),n=!0;else if(n&&a==="]"){if(s){if(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))r.push(s.slice(1,-1));else{let l=Number(s);r.push(isNaN(l)?s:l)}s=""}n=!1,i=null}else n&&(a==='"'||a==="'")&&(i?a===i&&(i=null):i=a),s+=a}return s&&r.push(s),r.reduce((o,a)=>o&&o[a],e)},cs=({h:e,template:t,viewData:r,refs:s,handlers:n})=>{let i=ze(t,r,{}),o=Ue(i),a=ja({h:e,items:o,refs:s,handlers:n,viewData:r});return e("div",{style:{display:"contents"}},a)},ja=({h:e,items:t,refs:r={},handlers:s={},viewData:n={}})=>{if(!Array.isArray(t))return console.error("Input to createVirtualDom must be an array."),[e("div",{},[])];function i(o,a=""){return o.map((l,p)=>{if(typeof l=="string"||typeof l=="number")return String(l);if(typeof l!="object"||l===null)return console.warn("Skipping invalid item in DOM structure:",l),null;let u=Object.entries(l);if(u.length===0)return null;let[c,d]=u[0];if(!isNaN(Number(c)))return Array.isArray(d)?i(d,`${a}.${c}`):typeof d=="object"&&d!==null&&Object.entries(d).length>0?i([d],`${a}.${c}`):String(d);u.length>1&&console.warn("Item has multiple keys, processing only the first:",c);let y,h,f=c.indexOf(" ");f===-1?(y=c,h=""):(y=c.substring(0,f),h=c.substring(f+1).trim());let m=y.split(/[.#]/)[0],v=m.includes("-"),w={},b={};if(h){let C=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]+))/g,k,R=new Set;for(;(k=C.exec(h))!==null;)if(R.add(k[1]),k[1].startsWith(".")){let X=k[1].substring(1),_e=k[4];b[X]=ps(n,_e)}else if(k[1].startsWith("?")){let X=k[1].substring(1),_e=k[2]||k[3]||k[4],Ie;_e==="true"?Ie=!0:_e==="false"?Ie=!1:Ie=ps(n,_e),Ie&&(w[X]="")}else w[k[1]]=k[2]||k[3]||k[4];let B=h,K=[],ee,Ye=/(\S+?)=(?:\"([^\"]*)\"|\'([^\']*)\'|([^\s]+))/g;for(;(ee=Ye.exec(h))!==null;)K.push(ee[0]);K.forEach(X=>{B=B.replace(X," ")});let qe=/\b(\S+?)(?=\s|$)/g,W;for(;(W=qe.exec(B))!==null;){let X=W[1];!R.has(X)&&!X.startsWith(".")&&!X.includes("=")&&(w[X]="")}}let E=y.match(/#([^.#\s]+)/);E&&!Object.prototype.hasOwnProperty.call(w,"id")&&(w.id=E[1]);let A=null;w.id?A=w.id:v&&(A=m);let _=Object.create(null),$=null;if(v)$=m;else{let C=y.match(/\.([^.#]+)/g);C&&C.forEach(R=>{let B=R.substring(1);_[B]=!0});let k=y.match(/#([^.#\s]+)/);k&&($=k[1])}let S;typeof d=="string"||typeof d=="number"?S=String(d):Array.isArray(d)?S=i(d,`${a}.${c}`):S=[],$&&!v&&(w.id=$);let L=Object.create(null);if(A&&r){let C=[];if(Object.keys(r).forEach(k=>{if(k.includes("*")){let R="^"+k.replace(/[.*+?^${}()|[\\\]\\]/g,"\\$&").replace(/\\\*/g,".*")+"$";try{new RegExp(R).test(A)&&C.push(k)}catch(B){console.warn(`[Parser] Invalid regex pattern created from refKey '${k}': ${R}`,B)}}else A===k&&C.push(k)}),C.length>0){C.sort((R,B)=>{let K=!R.includes("*"),ee=!B.includes("*");return K&&!ee?-1:!K&&ee?1:B.length-R.length});let k=C[0];if(r[k]&&r[k].eventListeners){let R=r[k].eventListeners;Object.entries(R).forEach(([B,K])=>{K.handler&&s[K.handler]?L[B]=ee=>{s[K.handler](ee)}:K.handler&&console.warn(`[Parser] Handler '${K.handler}' for refKey '${k}' (matching elementId '${A}') is referenced but not found in available handlers.`)})}}}let V={};if(A)V.key=A;else if(y){let C=a?`${a}.${p}`:String(p);if(V.key=`${y}-${C}`,Object.keys(b).length>0){let k=JSON.stringify(b).substring(0,50);V.key+=`-${k}`}}Object.keys(w).length>0&&(V.attrs=w),Object.keys(_).length>0&&(V.class=_),Object.keys(L).length>0&&(V.on=L),Object.keys(b).length>0&&(V.props=b),v&&(V.hook={update:(C,k)=>{let R=C.data?.props||{},B=k.data?.props||{},K=C.data?.attrs||{},ee=k.data?.attrs||{},Ye=JSON.stringify(R)!==JSON.stringify(B),qe=JSON.stringify(K)!==JSON.stringify(ee);if(Ye||qe){let W=k.elm;W&&W.render&&typeof W.render=="function"&&(W.setAttribute("isDirty","true"),requestAnimationFrame(()=>{if(W.render(),W.removeAttribute("isDirty"),W.handlers&&W.handlers.handleOnUpdate){let X={...W.deps||{},store:W.store,render:W.render.bind(W),handlers:W.handlers,dispatchEvent:W.dispatchEvent.bind(W),refIds:W.refIds||{},getRefIds:()=>W.refIds||{}};W.handlers.handleOnUpdate({oldProps:R,newProps:B,oldAttrs:K,newAttrs:ee},X)}}))}}});try{return e(m,V,S)}catch(C){return console.error("Error creating virtual node:",C,{tagName:m,snabbdomData:V,childrenOrText:S}),e("div",{},["Error creating element"])}}).filter(Boolean)}return i(t)};var Da=(e,t)=>{if(!t||typeof t!="object")return"";let r="",s=i=>Object.entries(i).map(([o,a])=>` ${o}: ${a};`).join(`
920
920
  `),n=(i,o)=>{if(typeof o!="object"||o===null)return"";if(i.startsWith("@")){let a=Object.entries(o).map(([l,p])=>{let u=s(p);return` ${l} {
921
921
  ${u.split(`
922
922
  `).map(c=>c?` ${c}`:"").join(`
@@ -940,4 +940,4 @@ ${a}
940
940
  font: inherit;
941
941
  cursor: pointer;
942
942
  }
943
- `);let r=[t];if(this.cssText){let n=new CSSStyleSheet;n.replaceSync(this.cssText),r.push(n)}this.shadow.adoptedStyleSheets=r,this.renderTarget=document.createElement("div"),this.renderTarget.style.cssText="display: contents;",this.shadow.appendChild(this.renderTarget),this.transformedHandlers={},this.renderTarget.parentNode||this.appendChild(this.renderTarget),this.style.display="contents";let s={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this)};if(Object.keys(this.handlers||{}).forEach(n=>{this.transformedHandlers[n]=i=>this.handlers[n](i,s)}),this.handlers?.handleBeforeMount&&(this._unmountCallback=this.handlers?.handleBeforeMount(s),this._unmountCallback&&typeof this._unmountCallback.then=="function"))throw new Error("handleBeforeMount must be synchronous and cannot return a Promise.");this.render(),this.handlers?.handleAfterMount&&this.handlers?.handleAfterMount(s),this.handlers?.subscriptions&&(this.unsubscribeAll=Ba(this.handlers.subscriptions(s)))}disconnectedCallback(){this._unmountCallback&&this._unmountCallback(),this.unsubscribeAll&&this.unsubscribeAll()}attributeChangedCallback(t,r,s){if(r!==s&&this.render)if(this.handlers?.handleOnUpdate){let n={[t]:{oldValue:r,newValue:s}},i={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this),store:this.store,render:this.render.bind(this)};this.handlers.handleOnUpdate(n,i)}else requestAnimationFrame(()=>{this.render()})}render=()=>{if(!this.patch){console.error("Patch function is not defined!");return}if(!this.template){console.error("Template is not defined!");return}try{let t={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this),store:this.store,render:this.render.bind(this)},r=cs({h:this.h,template:this.template,viewData:this.viewData,refs:this.refs,handlers:this.transformedHandlers}),s={},n=i=>{i.data?.attrs&&i.data.attrs.id&&(s[i.data.attrs.id]=i),i.children&&i.children.forEach(n)};n(r),this.refIds=s,this._oldVNode?this._oldVNode=this.patch(this._oldVNode,r):this._oldVNode=this.patch(this.renderTarget,r)}catch(t){console.error("Error during patching:",t)}}},Ka=(e,t,r)=>{let{INITIAL_STATE:s,toViewData:n,...i}=e,o={},a={},l=structuredClone(s);return Object.entries(i).forEach(([p,u])=>{p.startsWith("select")?o[p]=(...c)=>u({state:l,props:t,attrs:r},...c):a[p]=c=>(l=rs(l,d=>u(d,c)),l)}),{toViewData:()=>n({state:l,props:t,attrs:r}),getState:()=>l,...a,...o}},Fa=({handlers:e,view:t,store:r,patch:s,h:n},i)=>{let{elementName:o,propsSchema:a,attrsSchema:l,template:p,refs:u,styles:c}=t;if(!s)throw new Error("Patch is not defined");if(!n)throw new Error("h is not defined");if(!t)throw new Error("view is not defined");class d extends Yt{static get observedAttributes(){let h=["key"],f=l?.properties?Object.keys(l.properties):[];return[...h,...f]}constructor(){super();let h=Wa(this);this.propsSchema=a,this.props=a?Ma(this,Object.keys(a.properties)):{},this.elementName=o,this.styles=c,this.store=Ka(r,this.props,h),this.template=p,this.handlers=e,this.refs=u,this.patch=s,this.deps={...i,store:this.store,render:this.render,handlers:e,attrs:h,props:this.props},this.h=n,this.cssText=Da(o,c)}}return d},qt=Fa;function he(e,t,r,s,n){let i=t===void 0?void 0:t.key;return{sel:e,data:t,children:r,text:s,elm:n,key:i}}var xe=Array.isArray;function Ee(e){return typeof e=="string"||typeof e=="number"||e instanceof String||e instanceof Number}function za(e,t){return document.createElement(e,t)}function Ua(e,t,r){return document.createElementNS(e,t,r)}function Ha(){return de(document.createDocumentFragment())}function Ja(e){return document.createTextNode(e)}function Ya(e){return document.createComment(e)}function qa(e,t,r){if(ne(e)){let s=e;for(;s&&ne(s);)s=de(s).parent;e=s??e}ne(t)&&(t=de(t,e)),r&&ne(r)&&(r=de(r).firstChildNode),e.insertBefore(t,r)}function Ga(e,t){e.removeChild(t)}function Xa(e,t){ne(t)&&(t=de(t,e)),e.appendChild(t)}function hs(e){if(ne(e)){for(;e&&ne(e);)e=de(e).parent;return e??null}return e.parentNode}function Qa(e){var t;if(ne(e)){let r=de(e),s=hs(r);if(s&&r.lastChildNode){let n=Array.from(s.childNodes),i=n.indexOf(r.lastChildNode);return(t=n[i+1])!==null&&t!==void 0?t:null}return null}return e.nextSibling}function Za(e){return e.tagName}function eo(e,t){e.textContent=t}function to(e){return e.textContent}function ro(e){return e.nodeType===1}function so(e){return e.nodeType===3}function io(e){return e.nodeType===8}function ne(e){return e.nodeType===11}function de(e,t){var r,s,n;let i=e;return(r=i.parent)!==null&&r!==void 0||(i.parent=t??null),(s=i.firstChildNode)!==null&&s!==void 0||(i.firstChildNode=e.firstChild),(n=i.lastChildNode)!==null&&n!==void 0||(i.lastChildNode=e.lastChild),i}var ds={createElement:za,createElementNS:Ua,createTextNode:Ja,createDocumentFragment:Ha,createComment:Ya,insertBefore:qa,removeChild:Ga,appendChild:Xa,parentNode:hs,nextSibling:Qa,tagName:Za,setTextContent:eo,getTextContent:to,isElement:ro,isText:so,isComment:io,isDocumentFragment:ne};function He(e){return e===void 0}function J(e){return e!==void 0}var Gt=he("",{},[],void 0,void 0);function Ce(e,t){var r,s;let n=e.key===t.key,i=((r=e.data)===null||r===void 0?void 0:r.is)===((s=t.data)===null||s===void 0?void 0:s.is),o=e.sel===t.sel,a=!e.sel&&e.sel===t.sel?typeof e.text==typeof t.text:!0;return o&&n&&i&&a}function no(){throw new Error("The document fragment is not supported on this platform.")}function ao(e,t){return e.isElement(t)}function oo(e,t){return e.isDocumentFragment(t)}function lo(e,t,r){var s;let n={};for(let i=t;i<=r;++i){let o=(s=e[i])===null||s===void 0?void 0:s.key;o!==void 0&&(n[o]=i)}return n}var po=["create","update","remove","destroy","pre","post"];function fs(e,t,r){let s={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},n=t!==void 0?t:ds;for(let h of po)for(let f of e){let y=f[h];y!==void 0&&s[h].push(y)}function i(h){let f=h.id?"#"+h.id:"",y=h.getAttribute("class"),v=y?"."+y.split(" ").join("."):"";return he(n.tagName(h).toLowerCase()+f+v,{},[],void 0,h)}function o(h){return he(void 0,{},[],void 0,h)}function a(h,f){return function(){if(--f===0){let v=n.parentNode(h);v!==null&&n.removeChild(v,h)}}}function l(h,f){var y,v,w,b;let E,A=h.data;if(A!==void 0){let S=(y=A.hook)===null||y===void 0?void 0:y.init;J(S)&&(S(h),A=h.data)}let _=h.children,$=h.sel;if($==="!")He(h.text)&&(h.text=""),h.elm=n.createComment(h.text);else if($==="")h.elm=n.createTextNode(h.text);else if($!==void 0){let S=$.indexOf("#"),L=$.indexOf(".",S),V=S>0?S:$.length,C=L>0?L:$.length,k=S!==-1||L!==-1?$.slice(0,Math.min(V,C)):$,R=h.elm=J(A)&&J(E=A.ns)?n.createElementNS(E,k,A):n.createElement(k,A);for(V<C&&R.setAttribute("id",$.slice(V+1,C)),L>0&&R.setAttribute("class",$.slice(C+1).replace(/\./g," ")),E=0;E<s.create.length;++E)s.create[E](Gt,h);if(Ee(h.text)&&(!xe(_)||_.length===0)&&n.appendChild(R,n.createTextNode(h.text)),xe(_))for(E=0;E<_.length;++E){let K=_[E];K!=null&&n.appendChild(R,l(K,f))}let B=h.data.hook;J(B)&&((v=B.create)===null||v===void 0||v.call(B,Gt,h),B.insert&&f.push(h))}else if(!((w=r?.experimental)===null||w===void 0)&&w.fragments&&h.children){for(h.elm=((b=n.createDocumentFragment)!==null&&b!==void 0?b:no)(),E=0;E<s.create.length;++E)s.create[E](Gt,h);for(E=0;E<h.children.length;++E){let S=h.children[E];S!=null&&n.appendChild(h.elm,l(S,f))}}else h.elm=n.createTextNode(h.text);return h.elm}function p(h,f,y,v,w,b){for(;v<=w;++v){let E=y[v];E!=null&&n.insertBefore(h,l(E,b),f)}}function u(h){var f,y;let v=h.data;if(v!==void 0){(y=(f=v?.hook)===null||f===void 0?void 0:f.destroy)===null||y===void 0||y.call(f,h);for(let w=0;w<s.destroy.length;++w)s.destroy[w](h);if(h.children!==void 0)for(let w=0;w<h.children.length;++w){let b=h.children[w];b!=null&&typeof b!="string"&&u(b)}}}function c(h,f,y,v){for(var w,b;y<=v;++y){let E,A,_=f[y];if(_!=null)if(J(_.sel)){u(_),E=s.remove.length+1,A=a(_.elm,E);for(let S=0;S<s.remove.length;++S)s.remove[S](_,A);let $=(b=(w=_?.data)===null||w===void 0?void 0:w.hook)===null||b===void 0?void 0:b.remove;J($)?$(_,A):A()}else _.children?(u(_),c(h,_.children,0,_.children.length-1)):n.removeChild(h,_.elm)}}function d(h,f,y,v){let w=0,b=0,E=f.length-1,A=f[0],_=f[E],$=y.length-1,S=y[0],L=y[$],V,C,k,R;for(;w<=E&&b<=$;)A==null?A=f[++w]:_==null?_=f[--E]:S==null?S=y[++b]:L==null?L=y[--$]:Ce(A,S)?(m(A,S,v),A=f[++w],S=y[++b]):Ce(_,L)?(m(_,L,v),_=f[--E],L=y[--$]):Ce(A,L)?(m(A,L,v),n.insertBefore(h,A.elm,n.nextSibling(_.elm)),A=f[++w],L=y[--$]):Ce(_,S)?(m(_,S,v),n.insertBefore(h,_.elm,A.elm),_=f[--E],S=y[++b]):(V===void 0&&(V=lo(f,w,E)),C=V[S.key],He(C)?(n.insertBefore(h,l(S,v),A.elm),S=y[++b]):He(V[L.key])?(n.insertBefore(h,l(L,v),n.nextSibling(_.elm)),L=y[--$]):(k=f[C],k.sel!==S.sel?n.insertBefore(h,l(S,v),A.elm):(m(k,S,v),f[C]=void 0,n.insertBefore(h,k.elm,A.elm)),S=y[++b]));b<=$&&(R=y[$+1]==null?null:y[$+1].elm,p(h,R,y,b,$,v)),w<=E&&c(h,f,w,E)}function m(h,f,y){var v,w,b,E,A,_,$,S;let L=(v=f.data)===null||v===void 0?void 0:v.hook;(w=L?.prepatch)===null||w===void 0||w.call(L,h,f);let V=f.elm=h.elm;if(h===f)return;if(f.data!==void 0||J(f.text)&&f.text!==h.text){(b=f.data)!==null&&b!==void 0||(f.data={}),(E=h.data)!==null&&E!==void 0||(h.data={});for(let R=0;R<s.update.length;++R)s.update[R](h,f);($=(_=(A=f.data)===null||A===void 0?void 0:A.hook)===null||_===void 0?void 0:_.update)===null||$===void 0||$.call(_,h,f)}let C=h.children,k=f.children;He(f.text)?J(C)&&J(k)?C!==k&&d(V,C,k,y):J(k)?(J(h.text)&&n.setTextContent(V,""),p(V,null,k,0,k.length-1,y)):J(C)?c(V,C,0,C.length-1):J(h.text)&&n.setTextContent(V,""):h.text!==f.text&&(J(C)&&c(V,C,0,C.length-1),n.setTextContent(V,f.text)),(S=L?.postpatch)===null||S===void 0||S.call(L,h,f)}return function(f,y){let v,w,b,E=[];for(v=0;v<s.pre.length;++v)s.pre[v]();for(ao(n,f)?f=i(f):oo(n,f)&&(f=o(f)),Ce(f,y)?m(f,y,E):(w=f.elm,b=n.parentNode(w),l(y,E),b!==null&&(n.insertBefore(b,y.elm,n.nextSibling(w)),c(b,[f],0,0))),v=0;v<E.length;++v)E[v].data.hook.insert(E[v]);for(v=0;v<s.post.length;++v)s.post[v]();return y}}function ms(e,t){let r,s,n=t.elm,i=e.data.class,o=t.data.class;if(!(!i&&!o)&&i!==o){i=i||{},o=o||{};for(s in i)i[s]&&!Object.prototype.hasOwnProperty.call(o,s)&&n.classList.remove(s);for(s in o)r=o[s],r!==i[s]&&n.classList[r?"add":"remove"](s)}}var ys={create:ms,update:ms};function gs(e,t){let r,s,n,i=t.elm,o=e.data.props,a=t.data.props;if(!(!o&&!a)&&o!==a){o=o||{},a=a||{};for(r in a)s=a[r],n=o[r],n!==s&&(r!=="value"||i[r]!==s)&&(i[r]=s)}}var vs={create:gs,update:gs};var co="http://www.w3.org/1999/xlink",uo="http://www.w3.org/2000/xmlns/",ho="http://www.w3.org/XML/1998/namespace";function bs(e,t){let r,s=t.elm,n=e.data.attrs,i=t.data.attrs;if(!(!n&&!i)&&n!==i){n=n||{},i=i||{};for(r in i){let o=i[r];n[r]!==o&&(o===!0?s.setAttribute(r,""):o===!1?s.removeAttribute(r):r.charCodeAt(0)!==120?s.setAttribute(r,o):r.charCodeAt(3)===58?s.setAttributeNS(ho,r,o):r.charCodeAt(5)===58?r.charCodeAt(1)===109?s.setAttributeNS(uo,r,o):s.setAttributeNS(co,r,o):s.setAttribute(r,o))}for(r in n)r in i||s.removeAttribute(r)}}var ws={create:bs,update:bs};var xs=typeof window?.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):setTimeout,fo=function(e){xs(function(){xs(e)})},Xt=!1;function mo(e,t,r){fo(function(){e[t]=r})}function Es(e,t){let r,s,n=t.elm,i=e.data.style,o=t.data.style;if(!i&&!o||i===o)return;i=i||{},o=o||{};let a="delayed"in i;for(s in i)s in o||(s[0]==="-"&&s[1]==="-"?n.style.removeProperty(s):n.style[s]="");for(s in o)if(r=o[s],s==="delayed"&&o.delayed)for(let l in o.delayed)r=o.delayed[l],(!a||r!==i.delayed[l])&&mo(n.style,l,r);else s!=="remove"&&r!==i[s]&&(s[0]==="-"&&s[1]==="-"?n.style.setProperty(s,r):n.style[s]=r)}function yo(e){let t,r,s=e.elm,n=e.data.style;if(!(!n||!(t=n.destroy)))for(r in t)s.style[r]=t[r]}function go(e,t){let r=e.data.style;if(!r||!r.remove){t();return}Xt||(e.elm.offsetLeft,Xt=!0);let s,n=e.elm,i=0,o=r.remove,a=0,l=[];for(s in o)l.push(s),n.style[s]=o[s];let u=getComputedStyle(n)["transition-property"].split(", ");for(;i<u.length;++i)l.indexOf(u[i])!==-1&&a++;n.addEventListener("transitionend",function(c){c.target===n&&--a,a===0&&t()})}function vo(){Xt=!1}var _s={pre:vo,create:Es,update:Es,destroy:yo,remove:go};function ks(e,t,r){if(typeof e=="function")e.call(t,r,t);else if(typeof e=="object")for(let s=0;s<e.length;s++)ks(e[s],t,r)}function bo(e,t){let r=e.type,s=t.data.on;s&&s[r]&&ks(s[r],t,e)}function wo(){return function e(t){bo(t,e.vnode)}}function Qt(e,t){let r=e.data.on,s=e.listener,n=e.elm,i=t&&t.data.on,o=t&&t.elm,a;if(r!==i){if(r&&s)if(i)for(a in r)i[a]||n.removeEventListener(a,s,!1);else for(a in r)n.removeEventListener(a,s,!1);if(i){let l=t.listener=e.listener||wo();if(l.vnode=t,r)for(a in i)r[a]||o.addEventListener(a,l,!1);else for(a in i)o.addEventListener(a,l,!1)}}}var As={create:Qt,update:Qt,destroy:Qt};var xo=()=>fs([ys,vs,ws,_s,As]),Zt=xo;function Ss(e,t,r){if(e.ns="http://www.w3.org/2000/svg",r!=="foreignObject"&&t!==void 0)for(let s=0;s<t.length;++s){let n=t[s];if(typeof n=="string")continue;let i=n.data;i!==void 0&&Ss(i,n.children,n.sel)}}function er(e,t,r){let s={},n,i,o;if(r!==void 0?(t!==null&&(s=t),xe(r)?n=r:Ee(r)?i=r.toString():r&&r.sel&&(n=[r])):t!=null&&(xe(t)?n=t:Ee(t)?i=t.toString():t&&t.sel?n=[t]:s=t),n!==void 0)for(o=0;o<n.length;++o)Ee(n[o])&&(n[o]=he(void 0,void 0,void 0,n[o],void 0));return e.startsWith("svg")&&(e.length===3||e[3]==="."||e[3]==="#")&&Ss(s,n,e),he(e,s,n,i,void 0)}var Eo={},$s={components:Eo},Cs=Zt();var Je={components:{breadcrumb:{handlers:ot,store:lt,view:br},dropdownMenu:{handlers:pt,store:ct,view:wr},form:{handlers:ut,store:vt,view:Nr},navbar:{handlers:bt,store:wt,view:Vr},pageOutline:{handlers:xt,store:Et,view:Pr},popoverInput:{handlers:_t,store:kt,view:jr},select:{handlers:At,store:St,view:Dr},sidebar:{handlers:$t,store:It,view:Br},sliderInput:{handlers:Ot,store:Tt,view:Wr},table:{handlers:Lt,store:Nt,view:Mr},tabs:{handlers:Vt,store:Rt,view:Kr},waveform:{handlers:Pt,store:jt,view:zr}}};Object.keys(Je).forEach(e=>{Object.keys(Je[e]).forEach(t=>{let r=qt({...Je[e][t],patch:Cs,h:er},$s[e]);customElements.define(Je[e][t].view.elementName,r)})});customElements.define("rtgl-button",ir({}));customElements.define("rtgl-view",or({}));customElements.define("rtgl-text",pr({}));customElements.define("rtgl-image",cr({}));customElements.define("rtgl-svg",hr({}));customElements.define("rtgl-input",dr({}));customElements.define("rtgl-textarea",fr({}));customElements.define("rtgl-color-picker",mr({}));customElements.define("rtgl-slider",yr({}));customElements.define("rtgl-dialog",gr({}));customElements.define("rtgl-popover",vr({}));})();
943
+ `);let r=[t];if(this.cssText){let n=new CSSStyleSheet;n.replaceSync(this.cssText),r.push(n)}this.shadow.adoptedStyleSheets=r,this.renderTarget=document.createElement("div"),this.renderTarget.style.cssText="display: contents;",this.shadow.appendChild(this.renderTarget),this.transformedHandlers={},this.renderTarget.parentNode||this.appendChild(this.renderTarget),this.style.display="contents";let s={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this)};if(Object.keys(this.handlers||{}).forEach(n=>{this.transformedHandlers[n]=i=>this.handlers[n](i,s)}),this.handlers?.handleBeforeMount&&(this._unmountCallback=this.handlers?.handleBeforeMount(s),this._unmountCallback&&typeof this._unmountCallback.then=="function"))throw new Error("handleBeforeMount must be synchronous and cannot return a Promise.");this.render(),this.handlers?.handleAfterMount&&this.handlers?.handleAfterMount(s),this.handlers?.subscriptions&&(this.unsubscribeAll=Ba(this.handlers.subscriptions(s)))}disconnectedCallback(){this._unmountCallback&&this._unmountCallback(),this.unsubscribeAll&&this.unsubscribeAll()}attributeChangedCallback(t,r,s){if(r!==s&&this.render)if(this.handlers?.handleOnUpdate){let n={[t]:{oldValue:r,newValue:s}},i={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this),store:this.store,render:this.render.bind(this)};this.handlers.handleOnUpdate(n,i)}else requestAnimationFrame(()=>{this.render()})}render=()=>{if(!this.patch){console.error("Patch function is not defined!");return}if(!this.template){console.error("Template is not defined!");return}try{let t={...this.deps,refIds:this.refIds,getRefIds:()=>this.refIds,dispatchEvent:this.dispatchEvent.bind(this),store:this.store,render:this.render.bind(this)},r=cs({h:this.h,template:this.template,viewData:this.viewData,refs:this.refs,handlers:this.transformedHandlers}),s={},n=i=>{i.data?.attrs&&i.data.attrs.id&&(s[i.data.attrs.id]=i),i.children&&i.children.forEach(n)};n(r),this.refIds=s,this._oldVNode?this._oldVNode=this.patch(this._oldVNode,r):this._oldVNode=this.patch(this.renderTarget,r)}catch(t){console.error("Error during patching:",t)}}},Ka=(e,t,r)=>{let{INITIAL_STATE:s,toViewData:n,...i}=e,o={},a={},l=structuredClone(s);return Object.entries(i).forEach(([p,u])=>{p.startsWith("select")?o[p]=(...c)=>u({state:l,props:t,attrs:r},...c):a[p]=c=>(l=rs(l,d=>u(d,c)),l)}),{toViewData:()=>n({state:l,props:t,attrs:r}),getState:()=>l,...a,...o}},Fa=({handlers:e,view:t,store:r,patch:s,h:n},i)=>{let{elementName:o,propsSchema:a,attrsSchema:l,template:p,refs:u,styles:c}=t;if(!s)throw new Error("Patch is not defined");if(!n)throw new Error("h is not defined");if(!t)throw new Error("view is not defined");class d extends Yt{static get observedAttributes(){let h=["key"],f=l?.properties?Object.keys(l.properties):[];return[...h,...f]}constructor(){super();let h=Wa(this);this.propsSchema=a,this.props=a?Ma(this,Object.keys(a.properties)):{},this.elementName=o,this.styles=c,this.store=Ka(r,this.props,h),this.template=p,this.handlers=e,this.refs=u,this.patch=s,this.deps={...i,store:this.store,render:this.render,handlers:e,attrs:h,props:this.props},this.h=n,this.cssText=Da(o,c)}}return d},qt=Fa;function he(e,t,r,s,n){let i=t===void 0?void 0:t.key;return{sel:e,data:t,children:r,text:s,elm:n,key:i}}var xe=Array.isArray;function Ee(e){return typeof e=="string"||typeof e=="number"||e instanceof String||e instanceof Number}function za(e,t){return document.createElement(e,t)}function Ua(e,t,r){return document.createElementNS(e,t,r)}function Ha(){return de(document.createDocumentFragment())}function Ja(e){return document.createTextNode(e)}function Ya(e){return document.createComment(e)}function qa(e,t,r){if(ne(e)){let s=e;for(;s&&ne(s);)s=de(s).parent;e=s??e}ne(t)&&(t=de(t,e)),r&&ne(r)&&(r=de(r).firstChildNode),e.insertBefore(t,r)}function Ga(e,t){e.removeChild(t)}function Xa(e,t){ne(t)&&(t=de(t,e)),e.appendChild(t)}function hs(e){if(ne(e)){for(;e&&ne(e);)e=de(e).parent;return e??null}return e.parentNode}function Qa(e){var t;if(ne(e)){let r=de(e),s=hs(r);if(s&&r.lastChildNode){let n=Array.from(s.childNodes),i=n.indexOf(r.lastChildNode);return(t=n[i+1])!==null&&t!==void 0?t:null}return null}return e.nextSibling}function Za(e){return e.tagName}function eo(e,t){e.textContent=t}function to(e){return e.textContent}function ro(e){return e.nodeType===1}function so(e){return e.nodeType===3}function io(e){return e.nodeType===8}function ne(e){return e.nodeType===11}function de(e,t){var r,s,n;let i=e;return(r=i.parent)!==null&&r!==void 0||(i.parent=t??null),(s=i.firstChildNode)!==null&&s!==void 0||(i.firstChildNode=e.firstChild),(n=i.lastChildNode)!==null&&n!==void 0||(i.lastChildNode=e.lastChild),i}var ds={createElement:za,createElementNS:Ua,createTextNode:Ja,createDocumentFragment:Ha,createComment:Ya,insertBefore:qa,removeChild:Ga,appendChild:Xa,parentNode:hs,nextSibling:Qa,tagName:Za,setTextContent:eo,getTextContent:to,isElement:ro,isText:so,isComment:io,isDocumentFragment:ne};function He(e){return e===void 0}function J(e){return e!==void 0}var Gt=he("",{},[],void 0,void 0);function Ce(e,t){var r,s;let n=e.key===t.key,i=((r=e.data)===null||r===void 0?void 0:r.is)===((s=t.data)===null||s===void 0?void 0:s.is),o=e.sel===t.sel,a=!e.sel&&e.sel===t.sel?typeof e.text==typeof t.text:!0;return o&&n&&i&&a}function no(){throw new Error("The document fragment is not supported on this platform.")}function ao(e,t){return e.isElement(t)}function oo(e,t){return e.isDocumentFragment(t)}function lo(e,t,r){var s;let n={};for(let i=t;i<=r;++i){let o=(s=e[i])===null||s===void 0?void 0:s.key;o!==void 0&&(n[o]=i)}return n}var po=["create","update","remove","destroy","pre","post"];function fs(e,t,r){let s={create:[],update:[],remove:[],destroy:[],pre:[],post:[]},n=t!==void 0?t:ds;for(let h of po)for(let f of e){let m=f[h];m!==void 0&&s[h].push(m)}function i(h){let f=h.id?"#"+h.id:"",m=h.getAttribute("class"),v=m?"."+m.split(" ").join("."):"";return he(n.tagName(h).toLowerCase()+f+v,{},[],void 0,h)}function o(h){return he(void 0,{},[],void 0,h)}function a(h,f){return function(){if(--f===0){let v=n.parentNode(h);v!==null&&n.removeChild(v,h)}}}function l(h,f){var m,v,w,b;let E,A=h.data;if(A!==void 0){let S=(m=A.hook)===null||m===void 0?void 0:m.init;J(S)&&(S(h),A=h.data)}let _=h.children,$=h.sel;if($==="!")He(h.text)&&(h.text=""),h.elm=n.createComment(h.text);else if($==="")h.elm=n.createTextNode(h.text);else if($!==void 0){let S=$.indexOf("#"),L=$.indexOf(".",S),V=S>0?S:$.length,C=L>0?L:$.length,k=S!==-1||L!==-1?$.slice(0,Math.min(V,C)):$,R=h.elm=J(A)&&J(E=A.ns)?n.createElementNS(E,k,A):n.createElement(k,A);for(V<C&&R.setAttribute("id",$.slice(V+1,C)),L>0&&R.setAttribute("class",$.slice(C+1).replace(/\./g," ")),E=0;E<s.create.length;++E)s.create[E](Gt,h);if(Ee(h.text)&&(!xe(_)||_.length===0)&&n.appendChild(R,n.createTextNode(h.text)),xe(_))for(E=0;E<_.length;++E){let K=_[E];K!=null&&n.appendChild(R,l(K,f))}let B=h.data.hook;J(B)&&((v=B.create)===null||v===void 0||v.call(B,Gt,h),B.insert&&f.push(h))}else if(!((w=r?.experimental)===null||w===void 0)&&w.fragments&&h.children){for(h.elm=((b=n.createDocumentFragment)!==null&&b!==void 0?b:no)(),E=0;E<s.create.length;++E)s.create[E](Gt,h);for(E=0;E<h.children.length;++E){let S=h.children[E];S!=null&&n.appendChild(h.elm,l(S,f))}}else h.elm=n.createTextNode(h.text);return h.elm}function p(h,f,m,v,w,b){for(;v<=w;++v){let E=m[v];E!=null&&n.insertBefore(h,l(E,b),f)}}function u(h){var f,m;let v=h.data;if(v!==void 0){(m=(f=v?.hook)===null||f===void 0?void 0:f.destroy)===null||m===void 0||m.call(f,h);for(let w=0;w<s.destroy.length;++w)s.destroy[w](h);if(h.children!==void 0)for(let w=0;w<h.children.length;++w){let b=h.children[w];b!=null&&typeof b!="string"&&u(b)}}}function c(h,f,m,v){for(var w,b;m<=v;++m){let E,A,_=f[m];if(_!=null)if(J(_.sel)){u(_),E=s.remove.length+1,A=a(_.elm,E);for(let S=0;S<s.remove.length;++S)s.remove[S](_,A);let $=(b=(w=_?.data)===null||w===void 0?void 0:w.hook)===null||b===void 0?void 0:b.remove;J($)?$(_,A):A()}else _.children?(u(_),c(h,_.children,0,_.children.length-1)):n.removeChild(h,_.elm)}}function d(h,f,m,v){let w=0,b=0,E=f.length-1,A=f[0],_=f[E],$=m.length-1,S=m[0],L=m[$],V,C,k,R;for(;w<=E&&b<=$;)A==null?A=f[++w]:_==null?_=f[--E]:S==null?S=m[++b]:L==null?L=m[--$]:Ce(A,S)?(y(A,S,v),A=f[++w],S=m[++b]):Ce(_,L)?(y(_,L,v),_=f[--E],L=m[--$]):Ce(A,L)?(y(A,L,v),n.insertBefore(h,A.elm,n.nextSibling(_.elm)),A=f[++w],L=m[--$]):Ce(_,S)?(y(_,S,v),n.insertBefore(h,_.elm,A.elm),_=f[--E],S=m[++b]):(V===void 0&&(V=lo(f,w,E)),C=V[S.key],He(C)?(n.insertBefore(h,l(S,v),A.elm),S=m[++b]):He(V[L.key])?(n.insertBefore(h,l(L,v),n.nextSibling(_.elm)),L=m[--$]):(k=f[C],k.sel!==S.sel?n.insertBefore(h,l(S,v),A.elm):(y(k,S,v),f[C]=void 0,n.insertBefore(h,k.elm,A.elm)),S=m[++b]));b<=$&&(R=m[$+1]==null?null:m[$+1].elm,p(h,R,m,b,$,v)),w<=E&&c(h,f,w,E)}function y(h,f,m){var v,w,b,E,A,_,$,S;let L=(v=f.data)===null||v===void 0?void 0:v.hook;(w=L?.prepatch)===null||w===void 0||w.call(L,h,f);let V=f.elm=h.elm;if(h===f)return;if(f.data!==void 0||J(f.text)&&f.text!==h.text){(b=f.data)!==null&&b!==void 0||(f.data={}),(E=h.data)!==null&&E!==void 0||(h.data={});for(let R=0;R<s.update.length;++R)s.update[R](h,f);($=(_=(A=f.data)===null||A===void 0?void 0:A.hook)===null||_===void 0?void 0:_.update)===null||$===void 0||$.call(_,h,f)}let C=h.children,k=f.children;He(f.text)?J(C)&&J(k)?C!==k&&d(V,C,k,m):J(k)?(J(h.text)&&n.setTextContent(V,""),p(V,null,k,0,k.length-1,m)):J(C)?c(V,C,0,C.length-1):J(h.text)&&n.setTextContent(V,""):h.text!==f.text&&(J(C)&&c(V,C,0,C.length-1),n.setTextContent(V,f.text)),(S=L?.postpatch)===null||S===void 0||S.call(L,h,f)}return function(f,m){let v,w,b,E=[];for(v=0;v<s.pre.length;++v)s.pre[v]();for(ao(n,f)?f=i(f):oo(n,f)&&(f=o(f)),Ce(f,m)?y(f,m,E):(w=f.elm,b=n.parentNode(w),l(m,E),b!==null&&(n.insertBefore(b,m.elm,n.nextSibling(w)),c(b,[f],0,0))),v=0;v<E.length;++v)E[v].data.hook.insert(E[v]);for(v=0;v<s.post.length;++v)s.post[v]();return m}}function ys(e,t){let r,s,n=t.elm,i=e.data.class,o=t.data.class;if(!(!i&&!o)&&i!==o){i=i||{},o=o||{};for(s in i)i[s]&&!Object.prototype.hasOwnProperty.call(o,s)&&n.classList.remove(s);for(s in o)r=o[s],r!==i[s]&&n.classList[r?"add":"remove"](s)}}var ms={create:ys,update:ys};function gs(e,t){let r,s,n,i=t.elm,o=e.data.props,a=t.data.props;if(!(!o&&!a)&&o!==a){o=o||{},a=a||{};for(r in a)s=a[r],n=o[r],n!==s&&(r!=="value"||i[r]!==s)&&(i[r]=s)}}var vs={create:gs,update:gs};var co="http://www.w3.org/1999/xlink",uo="http://www.w3.org/2000/xmlns/",ho="http://www.w3.org/XML/1998/namespace";function bs(e,t){let r,s=t.elm,n=e.data.attrs,i=t.data.attrs;if(!(!n&&!i)&&n!==i){n=n||{},i=i||{};for(r in i){let o=i[r];n[r]!==o&&(o===!0?s.setAttribute(r,""):o===!1?s.removeAttribute(r):r.charCodeAt(0)!==120?s.setAttribute(r,o):r.charCodeAt(3)===58?s.setAttributeNS(ho,r,o):r.charCodeAt(5)===58?r.charCodeAt(1)===109?s.setAttributeNS(uo,r,o):s.setAttributeNS(co,r,o):s.setAttribute(r,o))}for(r in n)r in i||s.removeAttribute(r)}}var ws={create:bs,update:bs};var xs=typeof window?.requestAnimationFrame=="function"?window.requestAnimationFrame.bind(window):setTimeout,fo=function(e){xs(function(){xs(e)})},Xt=!1;function yo(e,t,r){fo(function(){e[t]=r})}function Es(e,t){let r,s,n=t.elm,i=e.data.style,o=t.data.style;if(!i&&!o||i===o)return;i=i||{},o=o||{};let a="delayed"in i;for(s in i)s in o||(s[0]==="-"&&s[1]==="-"?n.style.removeProperty(s):n.style[s]="");for(s in o)if(r=o[s],s==="delayed"&&o.delayed)for(let l in o.delayed)r=o.delayed[l],(!a||r!==i.delayed[l])&&yo(n.style,l,r);else s!=="remove"&&r!==i[s]&&(s[0]==="-"&&s[1]==="-"?n.style.setProperty(s,r):n.style[s]=r)}function mo(e){let t,r,s=e.elm,n=e.data.style;if(!(!n||!(t=n.destroy)))for(r in t)s.style[r]=t[r]}function go(e,t){let r=e.data.style;if(!r||!r.remove){t();return}Xt||(e.elm.offsetLeft,Xt=!0);let s,n=e.elm,i=0,o=r.remove,a=0,l=[];for(s in o)l.push(s),n.style[s]=o[s];let u=getComputedStyle(n)["transition-property"].split(", ");for(;i<u.length;++i)l.indexOf(u[i])!==-1&&a++;n.addEventListener("transitionend",function(c){c.target===n&&--a,a===0&&t()})}function vo(){Xt=!1}var _s={pre:vo,create:Es,update:Es,destroy:mo,remove:go};function ks(e,t,r){if(typeof e=="function")e.call(t,r,t);else if(typeof e=="object")for(let s=0;s<e.length;s++)ks(e[s],t,r)}function bo(e,t){let r=e.type,s=t.data.on;s&&s[r]&&ks(s[r],t,e)}function wo(){return function e(t){bo(t,e.vnode)}}function Qt(e,t){let r=e.data.on,s=e.listener,n=e.elm,i=t&&t.data.on,o=t&&t.elm,a;if(r!==i){if(r&&s)if(i)for(a in r)i[a]||n.removeEventListener(a,s,!1);else for(a in r)n.removeEventListener(a,s,!1);if(i){let l=t.listener=e.listener||wo();if(l.vnode=t,r)for(a in i)r[a]||o.addEventListener(a,l,!1);else for(a in i)o.addEventListener(a,l,!1)}}}var As={create:Qt,update:Qt,destroy:Qt};var xo=()=>fs([ms,vs,ws,_s,As]),Zt=xo;function Ss(e,t,r){if(e.ns="http://www.w3.org/2000/svg",r!=="foreignObject"&&t!==void 0)for(let s=0;s<t.length;++s){let n=t[s];if(typeof n=="string")continue;let i=n.data;i!==void 0&&Ss(i,n.children,n.sel)}}function er(e,t,r){let s={},n,i,o;if(r!==void 0?(t!==null&&(s=t),xe(r)?n=r:Ee(r)?i=r.toString():r&&r.sel&&(n=[r])):t!=null&&(xe(t)?n=t:Ee(t)?i=t.toString():t&&t.sel?n=[t]:s=t),n!==void 0)for(o=0;o<n.length;++o)Ee(n[o])&&(n[o]=he(void 0,void 0,void 0,n[o],void 0));return e.startsWith("svg")&&(e.length===3||e[3]==="."||e[3]==="#")&&Ss(s,n,e),he(e,s,n,i,void 0)}var Eo={},$s={components:Eo},Cs=Zt();var Je={components:{breadcrumb:{handlers:ot,store:lt,view:br},dropdownMenu:{handlers:pt,store:ct,view:wr},form:{handlers:ut,store:vt,view:Nr},navbar:{handlers:bt,store:wt,view:Vr},pageOutline:{handlers:xt,store:Et,view:Pr},popoverInput:{handlers:_t,store:kt,view:jr},select:{handlers:At,store:St,view:Dr},sidebar:{handlers:$t,store:It,view:Br},sliderInput:{handlers:Ot,store:Tt,view:Wr},table:{handlers:Lt,store:Nt,view:Mr},tabs:{handlers:Vt,store:Rt,view:Kr},waveform:{handlers:Pt,store:jt,view:zr}}};Object.keys(Je).forEach(e=>{Object.keys(Je[e]).forEach(t=>{let r=qt({...Je[e][t],patch:Cs,h:er},$s[e]);customElements.define(Je[e][t].view.elementName,r)})});customElements.define("rtgl-button",ir({}));customElements.define("rtgl-view",or({}));customElements.define("rtgl-text",pr({}));customElements.define("rtgl-image",cr({}));customElements.define("rtgl-svg",hr({}));customElements.define("rtgl-input",dr({}));customElements.define("rtgl-textarea",fr({}));customElements.define("rtgl-color-picker",yr({}));customElements.define("rtgl-slider",mr({}));customElements.define("rtgl-dialog",gr({}));customElements.define("rtgl-popover",vr({}));})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rettangoli/ui",
3
- "version": "0.1.2-rc20",
3
+ "version": "0.1.2-rc22",
4
4
  "description": "A UI component library for building web interfaces.",
5
5
  "main": "dist/rettangoli-esm.min.js",
6
6
  "type": "module",
@@ -60,7 +60,7 @@ export const handleInputChange = (e, deps) => {
60
60
  };
61
61
 
62
62
  export const handlePopoverInputChange = (e, deps) => {
63
- const { store, dispatchEvent } = deps;
63
+ const { store, dispatchEvent, props } = deps;
64
64
  const name = e.currentTarget.id.replace("popover-input-", "");
65
65
  // TODO fix double event
66
66
  if (name && e.detail.value !== undefined) {
@@ -13,6 +13,9 @@ export const INITIAL_STATE = Object.freeze({
13
13
 
14
14
  // Lodash-like utility functions for nested property access
15
15
  const get = (obj, path, defaultValue = undefined) => {
16
+ if (!path) {
17
+ return;
18
+ }
16
19
  const keys = path.split(/[\[\].]/).filter((key) => key !== "");
17
20
  let current = obj;
18
21
 
@@ -22,7 +25,6 @@ const get = (obj, path, defaultValue = undefined) => {
22
25
  }
23
26
  current = current[key];
24
27
  }
25
-
26
28
  return current;
27
29
  };
28
30
 
@@ -243,7 +243,7 @@ events:
243
243
  extra-event: {}
244
244
 
245
245
  template:
246
- - rtgl-view w=f h=f p=md g=lg ${containerAttrString}:
246
+ - rtgl-view w=f p=md g=lg ${containerAttrString}:
247
247
  - rtgl-view g=sm w=f:
248
248
  - rtgl-text s=lg: ${title}
249
249
  - rtgl-text c=mu-fg: ${description}
@@ -277,6 +277,8 @@ template:
277
277
  - $if field.inputType == "waveform" && !field.waveformData:
278
278
  - rtgl-view#waveform-${field.name} w=${field.width} h=${field.height} bc=ac bw=sm ah=c av=c cur=p p=md:
279
279
  - rtgl-text c=mu-fg ta=c: ${field.placeholder}
280
+ - $if field.inputType == "slot":
281
+ - 'slot#slot-${field.slotName} name=${field.slot} style="display: contents;"':
280
282
  - rtgl-view g=sm w=f:
281
283
  - rtgl-view d=h ah=e g=sm w=f:
282
284
  - $for button, i in actions.buttons: