@ecopages/radiant-ui 0.1.0-beta.5 → 0.1.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ui/date-field/index.js +1 -1
- package/dist/components/ui/date-field/index.js.map +2 -2
- package/dist/components/ui/date-range-picker/index.js +1 -1
- package/dist/components/ui/date-range-picker/index.js.map +2 -2
- package/dist/components/ui/sidebar/index.js +1 -1
- package/dist/components/ui/sidebar/index.js.map +3 -3
- package/dist/components/ui/sidebar/sidebar.script.d.ts +12 -5
- package/dist/components/ui/toc/index.js +1 -1
- package/dist/components/ui/toc/index.js.map +3 -3
- package/dist/components/ui/toc/toc.ssr.test.d.ts +1 -0
- package/dist/components/ui/toc/toc.test.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +3 -3
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function K(...e){return e.filter(Boolean).join(" ")}import{RadiantElement as yo,customElement as b0,prop as _o}from"@ecopages/radiant";var po,fo,mo,go,bo;function p0(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:vo(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||vo(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:f0(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return g0(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function f0(e){var t=m0(e,"string");return typeof t=="symbol"?t:t+""}function m0(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vo(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function g0(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var fi,xo=class extends yo{static{({e:[fo,mo,go,bo],c:[fi,po]}=p0(this,[b0("rui-alert")],[[_o({type:String,reflect:!0,defaultValue:"info"}),0,"variant"],[_o({type:String,reflect:!0,defaultValue:"inline"}),0,"layout"]],0,void 0,yo))}constructor(...t){super(...t),bo(this)}variant=fo(this);layout=(mo(this),go(this));static{po()}};import{jsx as Ut}from"@ecopages/jsx/jsx-runtime";var v0=Symbol.for("@ecopages/storybook-radiant.viewElement"),wo=Symbol.for("@ecopages/storybook-radiant.scriptModule"),So=Symbol.for("@ecopages/storybook-radiant.scriptExport"),y0=Symbol.for("@ecopages/storybook-radiant.viewModule");function _0(e,t){e[v0]=t;let i=t[wo];i&&(e[wo]=i,e[So]=t[So]??t.name)}function rt(e,t,i){let r=c=>t(c);return _0(r,e),r}function nt(e,t,i){let r=e;return r[y0]=i,e}var x0={info:["M12 16v-4","M12 8h.01","M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z"],success:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","m9 12 2 2 4-4"],warning:["m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3","M12 9v4","M12 17h.01"],error:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","m15 9-6 6","m9 9 6 6"]};function w0({variant:e="info",class:t,children:i,...r}){if(i!=null)return Ut("span",{...r,class:K("rui-alert__icon",t),children:i});let c=x0[e],p=Array.isArray(c)?c:[c];return Ut("span",{...r,class:K("rui-alert__icon",t),"aria-hidden":"true",children:Ut("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:p.map(h=>Ut("path",{d:h}))})})}function S0({children:e,class:t,...i}){return Ut("p",{...i,class:K("rui-alert__title",t),children:e})}function E0({children:e,class:t,...i}){return Ut("div",{...i,class:K("rui-alert__description",t),children:e})}var T0=rt(fi,({variant:e="info",layout:t="inline",class:i,children:r,...c})=>Ut("rui-alert",{...c,variant:e,layout:t,children:Ut("div",{class:K("rui-alert",`rui-alert--${e}`,`rui-alert--${t}`,i),role:"alert",children:r})}),{stylesheets:["./alert.css"]});import{jsx as ko,jsxs as C0}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Oo,customElement as k0,onEvent as O0,onUpdated as V0,prop as Vo}from"@ecopages/radiant";function mi(e,t,i="base"){if(!t)return!0;if(i==="case")return e.includes(t);let r=new Intl.Collator(void 0,{sensitivity:i==="accent"?"accent":"base",usage:"search"});for(let c=0;c<=e.length-t.length;c+=1){let p=e.slice(c,c+t.length);if(r.compare(p,t)===0)return!0}return!1}var Eo,To,Ro,Ao,Io,Do;function R0(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Co(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Co(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:A0(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return D0(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function A0(e){var t=I0(e,"string");return typeof t=="symbol"?t:t+""}function I0(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Co(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function D0(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var gi,Mo=class extends Oo{static{({e:[Ro,Ao,Io,Do,Eo],c:[gi,To]}=R0(this,[k0("rui-autocomplete")],[[Vo({type:String,defaultValue:"base"}),0,"sensitivity"],[Vo({type:String,attribute:"input-value",defaultValue:""}),0,"inputValue"],[V0(["sensitivity","inputValue"]),2,"onPropsUpdated"],[O0({selector:"[data-autocomplete-input]",type:"input"}),2,"onInput"]],0,void 0,Oo))}sensitivity=(Eo(this),Ro(this));inputValue=(Ao(this),Io(this));externalInput=(Do(this),null);onExternalInput=()=>{this.applyFilter()};getInput(){let t=this.querySelector("[data-autocomplete-input]");return t||(this.closest("rui-combobox, rui-select")?.querySelector("[data-autocomplete-input]")??null)}bindExternalInput(){this.unbindExternalInput();let t=this.getInput();!t||this.contains(t)||(this.externalInput=t,t.addEventListener("input",this.onExternalInput))}unbindExternalInput(){this.externalInput?.removeEventListener("input",this.onExternalInput),this.externalInput=null}syncFilter(){this.applyFilter()}getCollection(){return this.querySelector("[data-autocomplete-collection]")??this}getFilterableItems(){let t=this.getCollection();return t?Array.from(t.querySelectorAll('[role="option"], [data-tag], [role="menuitem"]')).filter(r=>this.contains(r)||t.contains(r)):[]}getItemText(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}getQuery(){return this.inputValue?this.inputValue:this.getInput()?.value??""}applyFilter(){let t=this.getQuery(),i=this.getFilterableItems(),r=0;for(let p of i){let h=mi(this.getItemText(p),t,this.sensitivity);p.hidden=!h,h&&(r+=1)}let c=this.querySelector("[data-autocomplete-empty]");c&&(c.hidden=r>0)}initialize(){this.applyFilter()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.bindExternalInput(),this.initialize()})}disconnectedCallback(){this.unbindExternalInput(),super.disconnectedCallback()}onPropsUpdated(){this.applyFilter()}onInput(){this.applyFilter()}render(){return C0("div",{class:"rui-autocomplete","data-ref":"root",children:[ko("slot",{name:"input"}),ko("slot",{})]})}static{To()}};import{jsx as bi}from"@ecopages/jsx/jsx-runtime";function M0({placeholder:e,slot:t="input",class:i,disabled:r,...c}){return bi("input",{...c,type:"search",slot:t,"data-autocomplete-input":!0,class:K("rui-autocomplete__input",i),placeholder:e,disabled:r,autocomplete:"off"})}function zr({children:e,class:t,...i}){return bi("div",{...i,"data-autocomplete-collection":!0,class:K("rui-autocomplete__collection",t),children:e})}function Kr({children:e,class:t,...i}){return bi("div",{...i,"data-autocomplete-empty":!0,class:K("rui-autocomplete__empty",t),hidden:!0,children:e})}var Wr=rt(gi,({children:e,...t})=>bi("rui-autocomplete",{...t,children:e}),{stylesheets:["./autocomplete.css"]});import{jsx as Gr}from"@ecopages/jsx/jsx-runtime";function j0(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]??""}${t[1][0]??""}`.toUpperCase()}function jo({src:e,alt:t="",fallback:i,size:r="md",class:c,children:p,...h}){let a=i??(t?j0(t):void 0);return Gr("span",{...h,class:K("rui-avatar",`rui-avatar--${r}`,c),role:e?void 0:"img","aria-label":e?void 0:t||i,children:e?Gr("img",{class:"rui-avatar__image",src:e,alt:t}):Gr("span",{class:"rui-avatar__fallback","aria-hidden":t||i?"true":void 0,children:p??a??"?"})})}nt(jo,["./avatar.css"],import.meta.url);import{jsx as $o}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as zo,customElement as U0,prop as Ko}from"@ecopages/radiant";var Lo,Po,Bo,Fo,Uo;function L0(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:qo(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||qo(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:P0(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return F0(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function P0(e){var t=B0(e,"string");return typeof t=="symbol"?t:t+""}function B0(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qo(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function F0(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var vi,Wo=class extends zo{static{({e:[Po,Bo,Fo,Uo],c:[vi,Lo]}=L0(this,[U0("rui-breadcrumb")],[[Ko({type:String,defaultValue:"Breadcrumb"}),0,"label"],[Ko({type:String,defaultValue:"/"}),0,"separator"]],0,void 0,zo))}label=Po(this);separator=(Bo(this),Fo(this));resolvedAriaLabel=(Uo(this),this.$.label.map(t=>t||"Breadcrumb"));separatorStyle=this.$.separator.map(t=>({"--rui-breadcrumb-separator":JSON.stringify(t||"/")}));render(){return $o("nav",{class:"rui-breadcrumb","aria-label":this.resolvedAriaLabel,style:this.separatorStyle,children:$o("slot",{})})}static{Lo()}};import{jsx as qt,jsxs as q0}from"@ecopages/jsx/jsx-runtime";var $0=rt(vi,({children:e,...t})=>qt("rui-breadcrumb",{...t,children:e}),{stylesheets:["./breadcrumb.css"]});function z0({children:e,class:t,...i}){return qt("ol",{...i,class:K("rui-breadcrumb__list",t),children:e})}function K0({children:e,class:t,...i}){return qt("li",{...i,class:K("rui-breadcrumb__item",t),children:e})}function W0({children:e,href:t,class:i,"aria-label":r,...c}){return qt("a",{...c,class:K("rui-breadcrumb__link",i),href:t,"aria-label":r,children:e})}function G0({children:e,class:t,...i}){return qt("span",{...i,class:K("rui-breadcrumb__page",t),"aria-current":"page",children:e})}function H0({children:e,class:t,...i}){return qt("li",{...i,class:K("rui-breadcrumb__separator",t),role:"presentation","aria-hidden":"true",children:e})}function Y0({label:e="More",class:t,...i}){return q0("span",{...i,class:K("rui-breadcrumb__ellipsis",t),role:"presentation","aria-hidden":"true",children:[qt("span",{"aria-hidden":"true",children:"\u2026"}),qt("span",{class:"rui-breadcrumb__ellipsis-label",children:e})]})}import{jsx as Go}from"@ecopages/jsx/jsx-runtime";function X0(e,t,i){if(e!==void 0)return e;if(t)return i}function Hr(e){if(e.href!==void 0){let{href:$,target:L,rel:W,download:G,"aria-label":k,"aria-current":_,"on:click":H,children:Y,class:n,variant:g,size:f,...o}=e;return Go("a",{...o,href:$,target:L,rel:W,download:G,class:K("rui-button",`rui-button--${g??"filled"}`,`rui-button--${f??"md"}`,n),"aria-label":k,"aria-current":_,"on:click":H,children:Y})}let{variant:t,size:i,class:r,children:c,"aria-label":p,type:h="button",disabled:a,pressed:E,defaultPressed:C=!1,toggle:R=!1,"on:click":D,...T}=e,z=$=>{if(R&&E===void 0){let L=$.currentTarget,W=L.getAttribute("aria-pressed")!=="true";L.setAttribute("aria-pressed",String(W))}D?.($)};return Go("button",{...T,type:h,class:K("rui-button",`rui-button--${t??"filled"}`,`rui-button--${i??"md"}`,r),disabled:a,"aria-label":p,"aria-pressed":X0(E,R,C),"data-toggle":R&&E===void 0?"":void 0,"on:click":R||D?z:void 0,children:c})}import{jsx as Q0}from"@ecopages/jsx/jsx-runtime";function Ho({children:e,orientation:t="horizontal",class:i,"aria-label":r,...c}){return Q0("div",{...c,role:"group","aria-label":r,"aria-orientation":t,class:K("rui-button-group",`rui-button-group--${t}`,i),children:e})}nt(Ho,["./button-group.css"],import.meta.url);import{jsx as ft,jsxs as cn}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ua,customElement as vw,event as yw,onEvent as ie,onUpdated as _w,prop as $t,state as zt}from"@ecopages/radiant";function It(e){if(!e)return;let t=e.split(",").map(i=>i.trim()).filter(Boolean);return t.length>1?t:t[0]}function Dt(e){if(e==null)return null;let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;let i=Number(t[1]),r=Number(t[2])-1,c=Number(t[3]),p=new Date(i,r,c);return p.getFullYear()!==i||p.getMonth()!==r||p.getDate()!==c?null:p}function Ct(e){let t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${i}-${r}`}function Yr(e,t,i){return!(t&&e<t||i&&e>i)}function ee(e,t){return e.localeCompare(t)}function de(e,t){return ee(e,t)<=0?{start:e,end:t}:{start:t,end:e}}function xt(e){if(!e)return null;let[t,i]=e.split("/");return!t||!i?null:de(t,i)}function Re(e){if(!e)return"";let t=de(e.start,e.end);return`${t.start}/${t.end}`}function he(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean).sort(ee):[]}function Xr(e){return[...new Set(e)].sort(ee).join(",")}function Qr(e,t){let i=new Set(e);return i.has(t)?i.delete(t):i.add(t),[...i].sort(ee)}function Yo(e,t){let i=de(t.start,t.end);return ee(e,i.start)>=0&&ee(e,i.end)<=0}function Jr(e,t,i){if(t==="single"){let C=i.singleIso===e;return{isSelected:C,isRangeStart:C,isRangeEnd:C,isRangeMiddle:!1}}if(t==="multiple"){let C=i.multipleIsos?.includes(e)??!1;return{isSelected:C,isRangeStart:C,isRangeEnd:C,isRangeMiddle:!1}}let r=i.range;if(!r)return{isSelected:!1,isRangeStart:!1,isRangeEnd:!1,isRangeMiddle:!1};let c=de(r.start,r.end),p=Yo(e,c),h=e===c.start,a=e===c.end;return{isSelected:p,isRangeStart:h,isRangeEnd:a,isRangeMiddle:p&&!h&&!a}}function Zr(e,t,i){return t.anchor?{committed:de(t.anchor,i),draft:{anchor:null,hover:null}}:{committed:e,draft:{anchor:i,hover:i}}}function yi(e){let t=J0(e);try{let r=new Intl.Locale(t).weekInfo;if(r?.firstDay!=null)return r.firstDay===7?0:r.firstDay}catch{}return t.startsWith("en-US")?0:1}function J0(e){return Array.isArray(e)?e[0]??navigator.language:e??navigator.language}function Z0(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function N0(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function tw(e){let t=e.selectionMode??"single",i=e.value??"";if(t==="multiple")return{mode:t,multipleIsos:he(i)};if(t==="range"){let r=xt(i);if(e.rangeDraft?.anchor){let c=e.rangeDraft.hover??e.rangeDraft.anchor;return{mode:t,range:ew(e.rangeDraft.anchor,c)}}return{mode:t,range:r}}return{mode:t,singleIso:i||void 0}}function ew(e,t){return e.localeCompare(t)<=0?{start:e,end:t}:{start:t,end:e}}function Nr(e,t,i){let r=yi(i.locale),c=Z0(i.today??new Date),p=tw(i),a=(new Date(e,t,1).getDay()-r+7)%7,E=new Date(e,t,1-a),C=[],R=new Date(E);for(let D=0;D<6;D+=1){let T=[];for(let z=0;z<7;z+=1){let $=Ct(R),L=Jr($,p.mode,{singleIso:p.singleIso,multipleIsos:p.multipleIsos,range:p.range});T.push({date:new Date(R),iso:$,inMonth:R.getMonth()===t,isToday:N0(R,c),isSelected:L.isSelected,isDisabled:!Yr($,i.min,i.max),isRangeStart:L.isRangeStart,isRangeEnd:L.isRangeEnd,isRangeMiddle:L.isRangeMiddle}),R.setDate(R.getDate()+1)}if(C.push(T),D>=4&&R.getMonth()!==t&&R.getDate()>7)break}return C}function _i(e,t,i){let r=new Date(e,t+i,1);return{year:r.getFullYear(),month:r.getMonth()}}function tn(e,t,i){let r=Math.max(1,Math.min(i,12));return Array.from({length:r},(c,p)=>{let h=_i(e,t,p);return{year:h.year,month:h.month,offset:p}})}var Xo=new Map;function iw(e,t){return`${JSON.stringify(e??null)}|${JSON.stringify(t)}`}function wt(e,t){let i=iw(e,t),r=Xo.get(i);if(r)return r;let c=new Intl.DateTimeFormat(e,t);return Xo.set(i,c),c}function Ae(e,t,i="medium"){return wt(t,{dateStyle:i}).format(e)}function en(e,t){return wt(t,{month:"long",year:"numeric"}).format(e)}function rn(e,t){let i=wt(e,{weekday:"narrow"}),r=[];for(let c=0;c<7;c+=1){let p=(t+c)%7,h=new Date(2024,0,p===0?7:p);r.push(i.format(h))}return r}function nn(e){return new Intl.RelativeTimeFormat(e,{numeric:"auto"}).format(0,"day")}var rw={0:"digit",a:"letter","*":"any"},nw=/\p{L}/u;function ow(e,t){let i=t?.[e];if(i instanceof RegExp)return{kind:"any",pattern:i};if(i)return{kind:i};let r=rw[e];return r?{kind:r}:null}function Qo(e,t,i){return i?i.test(e):t==="digit"?/\d/.test(e):t==="letter"?nw.test(e):e.length>0}function Jo(e,t,i=!1){let r=[],c=0;for(;c<e.length;){let p=e[c];if(p==="\\"){let a=e[c+1];a&&r.push({type:"literal",value:a}),c+=2;continue}if(p==="{"){let a=e.indexOf("}",c+1);if(a<0){r.push({type:"literal",value:"{"}),c+=1;continue}r.push({type:"fixed",value:e.slice(c+1,a)}),c=a+1;continue}if(p==="["){let a=aw(e,c+1);if(a<0){r.push({type:"literal",value:"["}),c+=1;continue}let E=Jo(e.slice(c+1,a),t,!0);r.push(...E),c=a+1;continue}if(p==="]")break;let h=ow(p,t);if(h){r.push({type:"input",definition:p,kind:h.kind,pattern:h.pattern,optional:i}),c+=1;continue}r.push({type:"literal",value:p}),c+=1}return r}function aw(e,t){let i=1;for(let r=t;r<e.length;r+=1)if(e[r]==="["&&e[r-1]!=="\\"&&(i+=1),e[r]==="]"&&e[r-1]!=="\\"&&(i-=1,i===0))return r;return-1}function Ie(e,t){return Jo(e,t)}function xi(e,t={}){return e.filter(i=>i.type==="input"&&(!t.requiredOnly||!i.optional)).length}function on(e,t){let i=Ie(e,t),r="";for(let c of i){if(c.type==="literal"||c.type==="fixed"){r+=c.value;continue}r+="_"}return r}function Zo(e,t){let i="",r=0;for(let c of t){if(c.type==="fixed"||c.type==="literal"){e.slice(r,r+c.value.length)===c.value&&(r+=c.value.length);continue}if(r>=e.length)continue;let p=e[r];Qo(p,c.kind,c.pattern)&&(i+=p,r+=1)}return i}function No(e,t){if(!e)return"";let i=0,r="";for(let c of t){if(c.type==="fixed"||c.type==="literal"){r+=c.value;continue}if(i>=e.length){if(c.optional)continue;break}let p=e[i];if(!Qo(p,c.kind,c.pattern)){if(c.optional)continue;break}r+=p,i+=1}return r}function sw(e){return e.every(t=>t.type!=="input"||t.kind==="digit")}function lw(e,t){let i=e.replace(/\D/g,""),r=t.filter(c=>c.type==="fixed").map(c=>c.value.replace(/\D/g,"")).join("");return r&&i.startsWith(r)?i.slice(r.length):i}function De(e,t,i){let r=Ie(t,i),c=xi(r),p=Zo(e,r);return p.length===0&&/\S/.test(e)&&sw(r)&&(p=lw(e,r)),p.length>c&&(p=p.slice(0,c)),No(p,r)}var an=new Date(2001,8,3);function wi(e){return wt(e,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(an).filter(t=>t.type==="year"||t.type==="month"||t.type==="day").map(t=>t.type)}function pe(e){let t=wt(e,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(an),i="";for(let r of t){if(r.type==="literal"){i+=r.value;continue}(r.type==="month"||r.type==="day"||r.type==="year")&&(i+=r.value.replace(/\d/g,"0"))}return i}function sn(e){return wt(e,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(an).map(i=>i.type==="literal"?i.value:i.type==="year"?"yyyy":i.type==="month"?"mm":i.type==="day"?"dd":"").join("")}function fe(e){return e.replace(/\D/g,"")}function Si(e,t){return De(fe(e),t)}function Ce(e){return xi(Ie(e),{requiredOnly:!0})}function uw(e){return e>=100?e:e>=69?1900+e:2e3+e}function ln(e,t){let i=wi(t),r=0,c={};for(let p of i){let h=p==="year"?4:2,a=e.slice(r,r+h);if(a.length<h)return null;let E=Number(a);p==="year"&&(E=uw(E)),c[p]=E,r+=h}return c}function un(e){if(e.year==null||e.month==null||e.day==null)return null;let t=new Date(e.year,e.month-1,e.day);return t.getFullYear()!==e.year||t.getMonth()!==e.month-1||t.getDate()!==e.day?null:t}var cw=new Date(2001,8,3);function ta(e){return wt(e,{year:"numeric",month:"numeric",day:"numeric"}).formatToParts(cw).filter(i=>i.type==="year"||i.type==="month"||i.type==="day").map(i=>i.type)}function ea(e){return e>=100?e:e>=69?1900+e:2e3+e}function ia(e){let t=e.year,i=e.month,r=e.day;if(!Number.isFinite(t)||!Number.isFinite(i)||!Number.isFinite(r))return null;let c=new Date(t,i-1,r);return c.getFullYear()!==t||c.getMonth()!==i-1||c.getDate()!==r?null:c}function ke(e,t){let i=(e??"").trim();if(!i)return null;let r=Dt(i);if(r)return r;let c=dw(i,t);if(c)return c;let p=pw(i,t);if(p)return p;let h=ta(t),a=i.match(/\d+/g);if(!a||a.length<3)return null;let E={day:0,month:0,year:0};for(let C=0;C<3;C+=1){let R=h[C];if(!R)return null;let D=Number(a[C]);R==="year"&&(D=ea(D)),E[R]=D}return ia(E)}function dw(e,t){let i=pe(t),r=fe(e);return r.length<Ce(i)?null:un(ln(r,t)??{})}function hw(e){let t=new Map;for(let i of["short","long"])for(let r=0;r<12;r+=1){let c=wt(e,{month:i}).formatToParts(new Date(2020,r,1)).find(p=>p.type==="month")?.value;c&&t.set(c.toLowerCase(),r+1)}return t}function pw(e,t){let i=hw(t),r=e.toLowerCase();for(let[c,p]of i){if(r.indexOf(c)<0)continue;let a=e.match(/\d+/g);if(!a||a.length<2)continue;let E=a.find(T=>T.length===4)??a[a.length-1],C=a.find(T=>T!==E&&Number(T)<=31);if(!C||!E)continue;let R=ea(Number(E)),D=Number(C);return ia({year:R,month:p,day:D})}return null}var ra,na,oa,aa,sa,la,ua,ca,da,ha,pa,fa,ma,ga,ba,va,ya,_a,xa,wa,Sa,Ea,Ta,Ra,Aa,Ia,Da,Ca,ka,Oa,Va,Ma,ja,La,Pa,Ba;function fw(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Fa(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Fa(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:mw(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return bw(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function mw(e){var t=gw(e,"string");return typeof t=="symbol"?t:t+""}function gw(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fa(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function bw(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ei,qa=class extends Ua{static{({e:[oa,aa,sa,la,ua,ca,da,ha,pa,fa,ma,ga,ba,va,ya,_a,xa,wa,Sa,Ea,Ta,Ra,Aa,Ia,Da,Ca,ka,Oa,Va,Ma,ja,La,Pa,Ba,ra],c:[Ei,na]}=fw(this,[vw("rui-calendar")],[[$t({type:String,reflect:!0,defaultValue:""}),0,"value"],[$t({type:String,defaultValue:""}),0,"min"],[$t({type:String,defaultValue:""}),0,"max"],[$t({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[$t({type:String,defaultValue:""}),0,"locale"],[$t({type:String,attribute:"selection-mode",defaultValue:"single"}),0,"selectionMode"],[$t({type:Number,attribute:"visible-months",defaultValue:1}),0,"visibleMonths"],[$t({type:String,attribute:"page-behavior",defaultValue:"visible"}),0,"pageBehavior"],[yw({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[zt,0,"viewYear"],[zt,0,"viewMonth"],[zt,0,"focusedIso"],[zt,0,"weekdayLabels"],[zt,0,"monthPanels"],[zt,0,"todayLabel"],[zt,0,"rangeAnchor"],[zt,0,"rangeHover"],[_w(["value","min","max","disabled","locale","selectionMode","visibleMonths","pageBehavior"]),2,"onPropsUpdated"],[ie({selector:"[data-calendar-prev-month]",type:"click"}),2,"onPrevMonth"],[ie({selector:"[data-calendar-next-month]",type:"click"}),2,"onNextMonth"],[ie({selector:"[data-calendar-today]",type:"click"}),2,"onTodayClick"],[ie({selector:"[data-calendar-day]",type:"click"}),2,"onDayClick"],[ie({selector:"[data-calendar-day]",type:"pointerenter"}),2,"onDayPointerEnter"],[ie({selector:"[data-calendar-grid]",type:"pointerleave"}),2,"onGridPointerLeave"],[ie({selector:"[data-calendar-day]",type:"keydown"}),2,"onDayKeydown"]],0,void 0,Ua))}constructor(...t){super(...t),Ba(this)}value=(ra(this),oa(this));min=(aa(this),sa(this));max=(la(this),ua(this));disabled=(ca(this),da(this));locale=(ha(this),pa(this));selectionMode=(fa(this),ma(this));visibleMonths=(ga(this),ba(this));pageBehavior=(va(this),ya(this));changeEvent=(_a(this),xa(this));viewYear=(wa(this),Sa(this,new Date().getFullYear()));viewMonth=(Ea(this),Ta(this,new Date().getMonth()));focusedIso=(Ra(this),Aa(this,""));weekdayLabels=(Ia(this),Da(this,[]));monthPanels=(Ca(this),ka(this,[]));todayLabel=(Oa(this),Va(this,""));rangeAnchor=(Ma(this),ja(this,null));rangeHover=(La(this),Pa(this,null));get resolvedLocale(){return It(this.locale)}get pageDelta(){return this.pageBehavior==="single"?1:Math.max(1,Math.min(this.visibleMonths,12))}get monthOptions(){return{locale:this.resolvedLocale,selectionMode:this.selectionMode,value:this.value??"",rangeDraft:{anchor:this.rangeAnchor,hover:this.rangeHover},min:this.min||void 0,max:this.max||void 0}}syncViewFromValue(){let t=this.selectionMode==="range"?xt(this.value)?.start??"":this.selectionMode==="multiple"?he(this.value)[0]??"":this.value,i=Dt(t);if(i){this.viewYear=i.getFullYear(),this.viewMonth=i.getMonth(),this.focusedIso=t;return}let r=new Date;this.viewYear=r.getFullYear(),this.viewMonth=r.getMonth(),this.focusedIso=Ct(r)}refreshGrid(){this.weekdayLabels=rn(this.resolvedLocale,yi(this.resolvedLocale)),this.monthPanels=tn(this.viewYear,this.viewMonth,this.visibleMonths).map(t=>{let i=new Date(t.year,t.month,1);return{year:t.year,month:t.month,label:en(i,this.resolvedLocale),weeks:Nr(t.year,t.month,this.monthOptions)}}),this.todayLabel=nn(this.resolvedLocale)}moveMonth(t){let i=_i(this.viewYear,this.viewMonth,t);this.viewYear=i.year,this.viewMonth=i.month,this.refreshGrid()}getFlatDays(){return this.monthPanels.flatMap(t=>t.weeks.flat())}moveFocusedDay(t){let i=this.getFlatDays().filter(h=>!h.isDisabled);if(!i.length)return;let r=i.findIndex(h=>h.iso===this.focusedIso),c=r<0?Math.max(0,i.findIndex(h=>h.inMonth)):(r+t+i.length)%i.length,p=i[c];p&&((p.date.getMonth()!==this.viewMonth||p.date.getFullYear()!==this.viewYear)&&(this.viewYear=p.date.getFullYear(),this.viewMonth=p.date.getMonth()),this.focusedIso=p.iso,this.refreshGrid())}isIsoAllowed(t){return!(this.min&&t<this.min||this.max&&t>this.max)}emitChange(t,i={}){this.changeEvent.emit({value:t,...i})}selectSingle(t){!this.isIsoAllowed(t)||t===this.value||(this.value=t,this.emitChange(t),this.refreshGrid())}selectMultiple(t){if(!this.isIsoAllowed(t))return;let i=Xr(Qr(he(this.value),t));i!==this.value&&(this.value=i,this.emitChange(i),this.refreshGrid())}selectRange(t){if(!this.isIsoAllowed(t))return;let i=Zr(xt(this.value),{anchor:this.rangeAnchor,hover:this.rangeHover},t);if(this.rangeAnchor=i.draft.anchor,this.rangeHover=i.draft.hover,i.committed){let r=Re(i.committed);r!==this.value&&(this.value=r,this.emitChange(r,{start:i.committed.start,end:i.committed.end}))}this.refreshGrid()}selectIso(t){if(this.selectionMode==="multiple"){this.selectMultiple(t);return}if(this.selectionMode==="range"){this.selectRange(t);return}this.selectSingle(t)}previewRange(t){this.selectionMode!=="range"||!this.rangeAnchor||this.disabled||this.rangeHover!==t&&(this.rangeHover=t,this.refreshGrid())}clearRangePreview(){this.rangeHover&&(this.rangeHover=this.rangeAnchor,this.refreshGrid())}initialize(){this.syncViewFromValue(),this.refreshGrid()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}onPropsUpdated(){this.selectionMode!=="range"&&(this.rangeAnchor=null,this.rangeHover=null),this.syncViewFromValue(),this.refreshGrid()}onPrevMonth(t){t.preventDefault(),this.moveMonth(-this.pageDelta)}onNextMonth(t){t.preventDefault(),this.moveMonth(this.pageDelta)}onTodayClick(t){t.preventDefault(),this.selectIso(Ct(new Date))}onDayClick(t){let i=t.target.closest("[data-calendar-day]"),r=i?.getAttribute("data-iso");!r||i?.disabled||this.disabled||this.selectIso(r)}onDayPointerEnter(t){let i=t.target.closest("[data-calendar-day]"),r=i?.getAttribute("data-iso");!r||i?.disabled||this.previewRange(r)}onGridPointerLeave(){this.clearRangePreview()}onDayKeydown(t){if(!this.disabled){if(t.key==="ArrowLeft"){t.preventDefault(),this.moveFocusedDay(-1);return}if(t.key==="ArrowRight"){t.preventDefault(),this.moveFocusedDay(1);return}if(t.key==="ArrowUp"){t.preventDefault(),this.moveFocusedDay(-7);return}if(t.key==="ArrowDown"){t.preventDefault(),this.moveFocusedDay(7);return}if(t.key==="PageUp"){t.preventDefault(),this.moveMonth(t.shiftKey?-12:-this.pageDelta);return}if(t.key==="PageDown"){t.preventDefault(),this.moveMonth(t.shiftKey?12:this.pageDelta);return}if(t.key==="Enter"||t.key===" "){t.preventDefault();let i=t.target,r=i.getAttribute("data-iso");r&&!i.disabled&&this.selectIso(r)}}}dayDataAttributes(t){return{"data-range-start":t.isRangeStart?"true":void 0,"data-range-end":t.isRangeEnd?"true":void 0,"data-range-middle":t.isRangeMiddle?"true":void 0}}render(){let t=this.monthPanels.length,i=t>1;return cn("div",{class:`rui-calendar${i?" rui-calendar--multi":""}`,"data-ref":"root",role:"application","aria-label":"Calendar","aria-multiselectable":this.selectionMode==="multiple"?"true":void 0,children:[ft("div",{class:"rui-calendar__months",children:this.monthPanels.map((r,c)=>cn("div",{class:"rui-calendar__month-panel","data-calendar-month-panel":!0,children:[cn("div",{class:"rui-calendar__header",children:[c===0?ft("button",{type:"button",class:"rui-calendar__nav","data-calendar-prev-month":!0,"aria-label":"Previous month",disabled:this.disabled,children:"\u2039"}):ft("span",{class:"rui-calendar__nav-spacer","aria-hidden":"true"}),ft("div",{class:"rui-calendar__month","aria-live":"polite",children:r.label}),c===t-1?ft("button",{type:"button",class:"rui-calendar__nav","data-calendar-next-month":!0,"aria-label":"Next month",disabled:this.disabled,children:"\u203A"}):ft("span",{class:"rui-calendar__nav-spacer","aria-hidden":"true"})]}),c===0?ft("div",{class:"rui-calendar__weekdays",role:"row",children:this.weekdayLabels.map(p=>ft("div",{class:"rui-calendar__weekday",role:"columnheader","aria-hidden":"true",children:p}))}):null,ft("div",{class:"rui-calendar__grid",role:"grid","data-calendar-grid":!0,children:r.weeks.map(p=>ft("div",{class:"rui-calendar__week",role:"row",children:p.map(h=>ft("button",{type:"button",class:"rui-calendar__day","data-calendar-day":!0,"data-iso":h.iso,role:"gridcell",disabled:this.disabled||h.isDisabled,tabIndex:h.iso===this.focusedIso?0:-1,"aria-selected":h.isSelected?"true":"false","aria-current":h.isToday?"date":void 0,"data-outside":h.inMonth?void 0:"true",...this.dayDataAttributes(h),children:h.date.getDate()}))}))})]}))}),ft("div",{class:"rui-calendar__footer",children:ft("button",{type:"button",class:"rui-calendar__today","data-calendar-today":!0,disabled:this.disabled,children:this.todayLabel})})]})}static{na()}};import{jsx as xw}from"@ecopages/jsx/jsx-runtime";var ww=rt(Ei,({children:e,...t})=>xw("rui-calendar",{...t,children:e}),{stylesheets:["./calendar.css"]});import{jsx as ot,jsxs as re}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ps,customElement as Aw,onEvent as mt,onUpdated as dn,prop as St}from"@ecopages/radiant";var $a,za,Ka,Wa,Ga,Ha,Ya,Xa,Qa,Ja,Za,Na,ts,es,is,rs,ns,os,as,ss,ls,us,cs,ds;function Sw(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:hs(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||hs(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:Ew(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return Rw(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function Ew(e){var t=Tw(e,"string");return typeof t=="symbol"?t:t+""}function Tw(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hs(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function Rw(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Iw=48,Ti,fs=class extends ps{static{({e:[Ka,Wa,Ga,Ha,Ya,Xa,Qa,Ja,Za,Na,ts,es,is,rs,ns,os,as,ss,ls,us,cs,ds,$a],c:[Ti,za]}=Sw(this,[Aw("rui-carousel")],[[St({type:String,defaultValue:"Carousel"}),0,"label"],[St({type:Number,reflect:!0,defaultValue:0}),0,"index"],[St({type:Boolean,reflect:!0,defaultValue:!1}),0,"autoplay"],[St({type:Number,defaultValue:4e3}),0,"interval"],[St({type:String,defaultValue:"none"}),0,"transition"],[St({type:String,defaultValue:"toolbar",attribute:"controls-variant"}),0,"controlsVariant"],[St({type:Boolean,defaultValue:!1}),0,"showIndicators"],[St({type:Boolean,defaultValue:!1}),0,"showRotationControl"],[St({type:Boolean,defaultValue:!0}),0,"loop"],[St({type:Boolean,defaultValue:!0}),0,"wrap"],[St({type:Number,defaultValue:0}),0,"slideCount"],[dn(["index","transition","loop","wrap","controlsVariant"]),2,"onSlideStateUpdated"],[dn(["autoplay","showRotationControl","interval"]),2,"onAutoplayUpdated"],[dn(["showIndicators"]),2,"onIndicatorsUpdated"],[mt({selector:'[data-carousel-action="prev"]',type:"click"}),2,"prev"],[mt({selector:'[data-carousel-action="next"]',type:"click"}),2,"next"],[mt({selector:'[data-carousel-action="rotation"]',type:"click"}),2,"toggleRotation"],[mt({selector:"[data-carousel-indicator]",type:"click"}),2,"onIndicatorClick"],[mt({selector:"[data-carousel-indicator]",type:"keydown"}),2,"onIndicatorKeydown"],[mt({ref:"root",type:"pointerenter"}),2,"onRootPointerEnter"],[mt({ref:"root",type:"pointerleave"}),2,"onRootPointerLeave"],[mt({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[mt({ref:"root",type:"focusout"}),2,"onRootFocusOut"],[mt({ref:"viewport",type:"pointerdown"}),2,"onViewportPointerDown"],[mt({ref:"viewport",type:"pointermove"}),2,"onViewportPointerMove"],[mt({ref:"viewport",type:"pointerup"}),2,"onViewportPointerUp"],[mt({ref:"viewport",type:"pointercancel"}),2,"onViewportPointerCancel"]],0,void 0,ps))}label=($a(this),Ka(this));index=(Wa(this),Ga(this));autoplay=(Ha(this),Ya(this));interval=(Xa(this),Qa(this));transition=(Ja(this),Za(this));controlsVariant=(Na(this),ts(this));showIndicators=(es(this),is(this));showRotationControl=(rs(this),ns(this));loop=(os(this),as(this));wrap=(ss(this),ls(this));slideCount=(us(this),cs(this));timer=(ds(this),null);paused=!1;userOverrideReducedMotion=!1;swipePointerId=null;swipeStartX=0;swipeStartY=0;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.autoplay&&this.prefersReducedMotion()&&(this.paused=!0),this.sync(),this.syncAutoplay(),this.syncIndicators(),this.syncAriaLive()})}disconnectedCallback(){this.stop(),super.disconnectedCallback()}onSlideStateUpdated(){this.sync(),this.syncIndicators(),this.syncAutoplay()}onAutoplayUpdated(){this.syncAutoplay(),this.syncRotationControl()}onIndicatorsUpdated(){this.syncIndicators()}prefersReducedMotion(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}getCarouselId(){return this.id||"rui-carousel"}slidePanelId(t,i){let r=t.getAttribute("data-slide")??String(i),c=`${this.getCarouselId()}-panel-${r}`;return t.id=c,c}tabId(t){return`${this.getCarouselId()}-tab-${t}`}shouldShowRotationControl(){return this.autoplay||this.showRotationControl}syncSlideAccessibility(t,i){let r=t.length;t.forEach((c,p)=>{let h=p===i,a=`${p+1} of ${r}`;this.showIndicators?(this.slidePanelId(c,p),c.setAttribute("role","tabpanel"),c.setAttribute("aria-labelledby",this.tabId(p)),c.setAttribute("aria-label",a),c.removeAttribute("aria-roledescription")):(c.setAttribute("role","group"),c.setAttribute("aria-roledescription","slide"),c.setAttribute("aria-label",a),c.removeAttribute("aria-labelledby"),c.removeAttribute("tabindex")),this.transition==="none"?c.hidden=!h:c.hidden=!1,c.setAttribute("aria-hidden",String(!h)),c.setAttribute("data-active",h?"true":"false")})}getSlides(){return Array.from(this.querySelectorAll("[data-slide]"))}get shouldWrap(){return this.wrap&&this.loop}normalizeIndex(t,i){return i<=0?0:this.shouldWrap?(t%i+i)%i:Math.min(Math.max(t,0),i-1)}sync(){let t=this.getSlides();if(!t.length)return;let i=this.normalizeIndex(this.index,t.length);i!==this.index&&(this.index=i);let r=this.querySelector(".rui-carousel__track");r&&this.transition==="slide"&&r.style.setProperty("--rui-carousel-index",String(i)),this.syncSlideAccessibility(t,i),this.syncPrevNextDisabled(t.length,i)}syncPrevNextDisabled(t,i){let r=!this.shouldWrap&&t>0&&i<=0,c=!this.shouldWrap&&t>0&&i>=t-1;for(let p of this.querySelectorAll('[data-carousel-action="prev"]'))this.shouldWrap?p.removeAttribute("disabled"):p.disabled=r;for(let p of this.querySelectorAll('[data-carousel-action="next"]'))this.shouldWrap?p.removeAttribute("disabled"):p.disabled=c}syncIndicators(){let t=this.querySelector('[data-ref="indicators"]');if(!t)return;let i=this.getSlides(),r=this.normalizeIndex(this.index,i.length);Array.from(t.querySelectorAll("[data-carousel-indicator]")).length!==i.length&&t.replaceChildren(...i.map((h,a)=>{let E=document.createElement("button");return E.type="button",E.className="rui-carousel__indicator",E.id=this.tabId(a),E.setAttribute("role","tab"),E.setAttribute("data-carousel-indicator",String(a)),E.setAttribute("aria-controls",this.slidePanelId(h,a)),E.setAttribute("aria-label",`Slide ${a+1}`),E})),Array.from(t.querySelectorAll("[data-carousel-indicator]")).forEach((h,a)=>{let E=a===r,C=i[a];C&&(h.id=this.tabId(a),h.setAttribute("aria-controls",this.slidePanelId(C,a))),h.setAttribute("aria-selected",String(E)),h.tabIndex=E?0:-1})}syncRotationControl(){for(let t of this.querySelectorAll('[data-carousel-action="rotation"]')){let i=this.autoplay&&!this.paused;t.setAttribute("aria-pressed",String(i)),t.setAttribute("aria-label",i?"Pause rotation":"Start rotation")}}syncAriaLive(){let t=this.querySelector('[data-ref="viewport"]');if(!t)return;let i=this.autoplay&&!this.paused&&this.timer!==null;t.setAttribute("aria-live",i?"off":"polite"),t.setAttribute("aria-atomic","false")}canAutoplayRotate(){return!(!this.autoplay||this.paused||this.prefersReducedMotion()&&!this.userOverrideReducedMotion)}syncAutoplay(){this.canAutoplayRotate()?this.start():this.stop(),this.syncRotationControl(),this.syncAriaLive()}start(){let t=this.getSlides();if(!t.length)return;if(!this.shouldWrap&&this.index>=t.length-1){this.stop();return}this.stop();let i=Math.max(0,this.interval);this.timer=setInterval(()=>{let r=this.getSlides();if(r.length){if(!this.shouldWrap&&this.index>=r.length-1){this.stop(),this.syncAriaLive();return}this.goTo(this.index+1)}},i),this.syncAriaLive()}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.syncAriaLive()}goTo(t){let i=this.getSlides();i.length&&(this.index=this.normalizeIndex(t,i.length),this.sync(),this.syncIndicators())}userNavigate(t){this.paused=!0,this.stop(),this.goTo(this.index+t)}isSwipeExcludedTarget(t){return t instanceof Element?!!t.closest("button, a, input, textarea, select, [data-carousel-indicator], [data-carousel-action]"):!1}prev(){this.userNavigate(-1)}next(){this.userNavigate(1)}toggleRotation(){this.autoplay?(this.paused=!this.paused,this.paused||(this.userOverrideReducedMotion=!0)):(this.autoplay=!0,this.paused=!1,this.userOverrideReducedMotion=!0),this.syncAutoplay()}onIndicatorClick(t){let i=t.target.closest("[data-carousel-indicator]");if(!i)return;let r=Number(i.getAttribute("data-carousel-indicator"));Number.isFinite(r)&&(this.paused=!0,this.stop(),this.goTo(r),i.focus())}onIndicatorKeydown(t){let i=this.getSlides();if(!i.length)return;let r=t.target.closest("[data-carousel-indicator]");if(!r)return;let c=Number(r.getAttribute("data-carousel-indicator"));if(!Number.isFinite(c))return;if(t.key==="ArrowRight")c=this.normalizeIndex(c+1,i.length);else if(t.key==="ArrowLeft")c=this.normalizeIndex(c-1,i.length);else if(t.key==="Home")c=0;else if(t.key==="End")c=i.length-1;else if(t.key===" "||t.key==="Enter"){t.preventDefault(),this.paused=!0,this.stop(),this.goTo(c);return}else return;t.preventDefault(),this.paused=!0,this.stop(),this.goTo(c),Array.from(this.querySelectorAll('[data-ref="indicators"] [data-carousel-indicator]'))[c]?.focus()}onRootPointerEnter(t){this.autoplay&&t.pointerType==="mouse"&&this.stop()}onRootPointerLeave(t){this.autoplay&&!this.paused&&t.pointerType==="mouse"&&this.syncAutoplay()}onRootFocusIn(){this.autoplay&&this.stop()}onRootFocusOut(t){let i=t.relatedTarget;i&&this.contains(i)||this.autoplay&&!this.paused&&this.syncAutoplay()}onViewportPointerDown(t){t.button!==0||this.isSwipeExcludedTarget(t.target)||(this.swipePointerId=t.pointerId,this.swipeStartX=t.clientX,this.swipeStartY=t.clientY)}onViewportPointerMove(t){this.swipePointerId,t.pointerId}onViewportPointerUp(t){if(this.swipePointerId!==t.pointerId)return;let i=t.clientX-this.swipeStartX,r=t.clientY-this.swipeStartY;this.swipePointerId=null,!(Math.abs(i)<Iw||Math.abs(i)<=Math.abs(r))&&(i<0?this.next():this.prev())}onViewportPointerCancel(t){this.swipePointerId===t.pointerId&&(this.swipePointerId=null)}render(){let t=this.shouldShowRotationControl(),i=Math.max(this.getSlides().length,this.slideCount),r=this.normalizeIndex(this.index,i||1),c=!this.shouldWrap&&i>0&&r<=0,p=!this.shouldWrap&&i>0&&r>=i-1,h=this.autoplay&&!this.paused,a=h&&this.timer!==null?"off":"polite",E=this.controlsVariant==="overlay";queueMicrotask(()=>{this.sync(),this.syncIndicators(),this.syncRotationControl(),this.syncAriaLive()});let C=ot("slot",{name:"prev",children:ot("button",{type:"button","data-carousel-action":"prev","data-ref":"prev",class:`rui-carousel__nav rui-button rui-button--outline rui-button--sm${E?" rui-carousel__nav--overlay":" rui-carousel__nav--toolbar"}`,"aria-label":"Previous slide",disabled:c,children:E?ot("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}):re("span",{class:"rui-carousel__nav-label",children:[ot("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}),"Previous"]})})}),R=ot("slot",{name:"next",children:ot("button",{type:"button","data-carousel-action":"next","data-ref":"next",class:`rui-carousel__nav rui-button rui-button--outline rui-button--sm${E?" rui-carousel__nav--overlay":" rui-carousel__nav--toolbar"}`,"aria-label":"Next slide",disabled:p,children:E?ot("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"}):re("span",{class:"rui-carousel__nav-label",children:["Next",ot("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"})]})})}),D=t?ot("slot",{name:"rotation",children:ot("button",{type:"button","data-carousel-action":"rotation","data-ref":"rotation",class:`rui-carousel__rotation rui-button rui-button--ghost rui-button--sm${E?" rui-carousel__rotation--overlay":""}`,"aria-pressed":h,"aria-label":h?"Pause rotation":"Start rotation",children:h?"Pause":"Play"})}):null,T=this.showIndicators?ot("div",{class:`rui-carousel__indicators${E?" rui-carousel__indicators--overlay":""}`,"data-ref":"indicators",role:"tablist","aria-label":"Choose slide to display"}):null,z=re("div",{class:"rui-carousel__toolbar",children:[t?ot("div",{class:"rui-carousel__toolbar-rotation",children:D}):null,ot("div",{class:"rui-carousel__toolbar-side rui-carousel__toolbar-side--start",children:C}),ot("div",{class:"rui-carousel__toolbar-center",children:T}),ot("div",{class:"rui-carousel__toolbar-side rui-carousel__toolbar-side--end",children:R})]}),$=E?re("div",{class:"rui-carousel__overlay-chrome",children:[t?ot("div",{class:"rui-carousel__overlay-rotation",children:D}):null,re("div",{class:"rui-carousel__controls rui-carousel__controls--overlay",children:[C,R]}),T]}):null;return re("section",{class:`rui-carousel rui-carousel--${this.transition} rui-carousel--controls-${this.controlsVariant}`,"data-ref":"root","aria-roledescription":"carousel","aria-label":this.$.label,children:[ot("div",{class:"rui-carousel__stage",children:re("div",{class:"rui-carousel__viewport","data-ref":"viewport","aria-live":a,"aria-atomic":!1,children:[ot("div",{class:"rui-carousel__track",style:this.transition==="slide"?{"--rui-carousel-index":String(this.index)}:void 0,children:ot("slot",{})}),$]})}),E?null:ot("div",{class:"rui-carousel__footer",children:z})]})}static{za()}};import{jsx as Et,jsxs as ms}from"@ecopages/jsx/jsx-runtime";function gs({id:e,children:t,class:i,...r}){return Et("div",{...r,class:K("rui-carousel__slide",i),"data-slide":e,children:t})}function Dw(){return ms("span",{class:"rui-carousel__nav-label",children:[Et("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}),"Previous"]})}function Cw(){return ms("span",{class:"rui-carousel__nav-label",children:["Next",Et("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"})]})}function kw({children:e,slot:t="prev",class:i,disabled:r,overlay:c,...p}){return Et("button",{...p,slot:t,type:"button","data-carousel-action":"prev","data-ref":"prev",class:K("rui-carousel__nav rui-button rui-button--outline rui-button--sm",c?"rui-carousel__nav--overlay":"rui-carousel__nav--toolbar",i),"aria-label":"Previous slide",disabled:r,children:e??(c?Et("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}):Dw())})}function Ow({children:e,slot:t="next",class:i,disabled:r,overlay:c,...p}){return Et("button",{...p,slot:t,type:"button","data-carousel-action":"next","data-ref":"next",class:K("rui-carousel__nav rui-button rui-button--outline rui-button--sm",c?"rui-carousel__nav--overlay":"rui-carousel__nav--toolbar",i),"aria-label":"Next slide",disabled:r,children:e??(c?Et("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"}):Cw())})}function Vw({children:e,slot:t="rotation",class:i,overlay:r,...c}){return Et("button",{...c,slot:t,type:"button","data-carousel-action":"rotation","data-ref":"rotation",class:K("rui-carousel__rotation rui-button rui-button--ghost rui-button--sm",r&&"rui-carousel__rotation--overlay",i),"aria-pressed":!1,"aria-label":"Start rotation",children:e??"Play"})}var Mw=rt(Ti,({slides:e,children:t,...i})=>{if(t!=null)return Et("rui-carousel",{...i,children:t});let r=e??[];return Et("rui-carousel",{...i,slideCount:r.length,children:r.map(c=>Et(gs,{id:c.id,children:c.children}))})},{stylesheets:["./carousel.css"]});import{jsx as Ri,jsxs as Fw}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Os,customElement as Uw,event as qw,onEvent as $w,prop as Oe}from"@ecopages/radiant";var bs,vs,ys,_s,xs,ws,Ss,Es,Ts,Rs,As,Is,Ds,Cs;function jw(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:ks(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||ks(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:Lw(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return Bw(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function Lw(e){var t=Pw(e,"string");return typeof t=="symbol"?t:t+""}function Pw(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ks(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function Bw(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ai,Vs=class extends Os{static{({e:[ys,_s,xs,ws,Ss,Es,Ts,Rs,As,Is,Ds,Cs,bs],c:[Ai,vs]}=jw(this,[Uw("rui-checkbox")],[[Oe({type:Boolean,reflect:!0,defaultValue:!1}),0,"checked"],[Oe({type:Boolean,reflect:!0,defaultValue:!1}),0,"indeterminate"],[Oe({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Oe({type:String,defaultValue:"on"}),0,"value"],[Oe({type:String,defaultValue:""}),0,"name"],[qw({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[$w({ref:"input",type:"change"}),2,"onInputChange"]],0,void 0,Os))}checked=(bs(this),ys(this));indeterminate=(_s(this),xs(this));disabled=(ws(this),Ss(this));value=(Es(this),Ts(this));name=(Rs(this),As(this));changeEvent=(Is(this),Ds(this));nameAttr=(Cs(this),this.$.name.map(t=>t||void 0));resolvedAriaChecked=this.$.indeterminate.map(t=>t?"mixed":void 0);onInputChange(t){let i=t.target;this.checked=i.checked,i.indeterminate=this.indeterminate,this.changeEvent.emit({checked:this.checked,indeterminate:this.indeterminate})}render(){return Fw("label",{class:"rui-checkbox",children:[Ri("input",{type:"checkbox","data-ref":"input","data-rui-control":!0,"data-rui-control-type":"boolean",class:"rui-checkbox__input","prop:checked":this.$.checked,disabled:this.$.disabled,"prop:value":this.$.value,name:this.nameAttr,"prop:indeterminate":this.$.indeterminate,"aria-checked":this.resolvedAriaChecked}),Ri("span",{class:"rui-checkbox__control","aria-hidden":"true"}),Ri("span",{class:"rui-checkbox__label",children:Ri("slot",{})})]})}static{vs()}};import{jsx as zw}from"@ecopages/jsx/jsx-runtime";var Kw=rt(Ai,({children:e,...t})=>zw("rui-checkbox",{...t,children:e}),{stylesheets:["./checkbox.css"]});import{jsx as Ww}from"@ecopages/jsx/jsx-runtime";function Ms({children:e,variant:t="default",class:i,...r}){return Ww("span",{...r,class:K("rui-chip",`rui-chip--${t}`,i),children:e})}nt(Ms,["./chip.css"],import.meta.url);import{jsx as js}from"@ecopages/jsx/jsx-runtime";function Ls({children:e,class:t,"aria-label":i,...r}){return js("ul",{...r,class:K("rui-chip-list",t),"aria-label":i,children:e})}function Gw({children:e,class:t,...i}){return js("li",{...i,class:K("rui-chip-list__item",t),children:e})}nt(Ls,["./chip-list.css"],import.meta.url);import{jsx as sl,jsxs as nS}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ll,customElement as oS,event as aS,onEvent as jt,onUpdated as sS,prop as Me,query as lS}from"@ecopages/radiant";function Ve(e){let t=e.previousElementSibling;return t?.tagName.toLowerCase()==="label"?t:e.parentElement?.querySelector("[data-rui-field-label], label.rui-label")??null}function Kt(e,t,i){if(!t||t.hasAttribute("data-rui-field-managed"))return;let r=Ve(e);if(r){r.id||(r.id=i.labelId),r.htmlFor||(r.htmlFor=i.controlId),t.setAttribute("aria-labelledby",r.id),t.removeAttribute("aria-label");return}if(i.label){t.setAttribute("aria-label",i.label),t.removeAttribute("aria-labelledby");return}t.removeAttribute("aria-label"),t.removeAttribute("aria-labelledby")}var Hw={top:"bottom",bottom:"top",left:"right",right:"left"},Yw=8;function Xw(e){let t=e.indexOf("-");if(t===-1)return{side:e,align:"center"};let i=e.slice(0,t),r=e.slice(t+1);return{side:i,align:r==="start"||r==="end"?r:"center"}}function Fs(e){return e==="top"||e==="bottom"?"y":"x"}function Ps(e,t,i,r,c){let{width:p,height:h}=t,a=0,E=0;switch(i){case"top":E=e.top-h-c;break;case"bottom":E=e.bottom+c;break;case"left":a=e.left-p-c;break;case"right":a=e.right+c;break}return Fs(i)==="y"?r==="start"?a=e.left:r==="end"?a=e.right-p:a=e.left+(e.width-p)/2:r==="start"?E=e.top:r==="end"?E=e.bottom-h:E=e.top+(e.height-h)/2,{x:a,y:E}}function Qw(e,t,i,r){let{padding:c,width:p,height:h}=r;return i==="top"?Math.max(0,c-e.y):i==="bottom"?Math.max(0,e.y+t.height-(h-c)):i==="left"?Math.max(0,c-e.x):Math.max(0,e.x+t.width-(p-c))}function Bs(e,t,i,r){let{padding:c,width:p,height:h}=r;return i==="top"?e.top-c-t.height:i==="bottom"?h-c-t.height-e.bottom:i==="left"?e.left-c-t.width:p-c-t.width-e.right}function Jw(e,t){return t==="center"?e:`${e}-${t}`}function Zw(e,t,i,r){let{padding:c,width:p,height:h}=r;if(Fs(i)==="y"){let E=Math.max(c,p-c-t.width);return{x:Math.min(Math.max(e.x,c),E),y:e.y}}let a=Math.max(c,h-c-t.height);return{x:e.x,y:Math.min(Math.max(e.y,c),a)}}function Nw(e,t,i,r,c={width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight,padding:Yw}){let{side:p,align:h}=Xw(i),a=Ps(e,t,p,h,r),E=Qw(a,t,p,c),C=p,R=a;if(E>0){let D=Hw[p],T=Ps(e,t,D,h,r),z=Bs(e,t,p,c);Bs(e,t,D,c)>z&&(C=D,R=T)}return{coords:Zw(R,t,C,c),placement:Jw(C,h)}}function hn(e,t,i,r,c={}){let{coords:p,placement:h}=Nw(e.getBoundingClientRect(),{width:t.offsetWidth,height:t.offsetHeight},i,r);return Object.assign(t.style,{position:"fixed",left:`${p.x}px`,top:`${p.y}px`,right:"auto",bottom:"auto",visibility:"visible"}),c.matchAnchorWidth&&(t.style.width=`${e.offsetWidth}px`),t.setAttribute("data-placement",h),h}function Ii({anchor:e,floating:t,getPlacement:i,gap:r,matchAnchorWidth:c}){let p=()=>{t.hidden||hn(e,t,i(),r,{matchAnchorWidth:c})};p(),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0);let h=new ResizeObserver(p);return h.observe(e),h.observe(t),()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0),h.disconnect()}}function Us(e,t=document.body){let i=e.parentNode;if(!i)return{unmount:()=>{}};let r=document.createComment("rui-portal");return i.insertBefore(r,e),t.appendChild(e),{unmount:()=>{let c=r.parentNode;c&&(c.insertBefore(e,r),r.remove())}}}function pn(e,t,i){return i?!!(e?.contains(i)||t?.contains(i)):!1}function Wt(e,t,i){return i instanceof Node?!pn(e,t,i):!0}function Gt(e,t,i){return!pn(e,t,i)}var pt=class{config;cleanupFloating=null;portalHandle=null;floatingElement=null;constructor(t){this.config=t}updateConfig(t){this.config={...this.config,...t}}sync(){let t=this.resolveFloating();if(!t)return;if(!this.config.getOpen()){this.teardown(),t.hidden=!0;return}let r=this.config.getAnchor();if(!r)return;t.hidden=!1,this.config.portal!==!1?this.portalHandle||(this.portalHandle=Us(t,this.config.portalContainer??document.body)):this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null),this.teardownFloating(),this.cleanupFloating=Ii({anchor:r,floating:t,getPlacement:this.config.getPlacement,gap:this.config.gap??8,matchAnchorWidth:this.config.matchAnchorWidth})}contains(t){return pn(this.config.getAnchor(),this.resolveFloating(),t)}getFloatingElement(){return this.resolveFloating()}teardown(){this.teardownFloating(),this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null)}destroy(){this.teardown(),this.floatingElement=null}resolveFloating(){let t=this.config.getFloating();return t&&(this.floatingElement=t),t??this.floatingElement}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}};function qs(e){return e.filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}function $s(e,t,i){return i===0?-1:t===1?e>=i-1?0:e+1:e<=0?i-1:e-1}function fn(e,t){t?.removeAttribute("aria-activedescendant");for(let i of e)i.removeAttribute("data-active")}function zs(e,t,i,r,c){fn(e,r);let p=t[i];return!p||!r?null:(p.id||(p.id=`${c}-${i}`),p.setAttribute("data-active","true"),r.setAttribute("aria-activedescendant",p.id),p.scrollIntoView({block:"nearest"}),p)}var me=class{config;popoverController;activeIndex=-1;visualFocus=!1;constructor(t){this.config=t,this.popoverController=new pt({getAnchor:t.getAnchor,getFloating:t.getFloating,getOpen:t.getOpen,getPlacement:()=>"bottom-start",gap:4,portal:!1,matchAnchorWidth:!0})}get activeOptionIndex(){return this.activeIndex}get hasVisualFocus(){return this.visualFocus}ensureOptionIds(){this.config.getOptions().forEach((t,i)=>{t.id||(t.id=`${this.config.getOptionIdPrefix()}-${i}`)})}getVisibleOptions(){return qs(this.config.getOptions())}clearActiveOption(){this.activeIndex=-1,this.visualFocus=!1,fn(this.config.getOptions(),this.config.getActiveDescendantHost())}setActiveOption(t){let i=this.getVisibleOptions();if(t<0||t>=i.length){this.clearActiveOption();return}this.activeIndex=t,this.visualFocus=!0,zs(this.config.getOptions(),i,t,this.config.getActiveDescendantHost(),this.config.getOptionIdPrefix())}moveActive(t,i){let r=this.getVisibleOptions();if(r.length){if(!this.config.getOpen()){i(t===1?"first":"last");return}if(this.visualFocus){this.setActiveOption($s(this.activeIndex,t,r.length));return}this.setActiveOption(t===1?0:r.length-1)}}handleKeydown(t,i){if(!(t.ctrlKey||t.shiftKey||t.metaKey)){if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault(),t.stopPropagation();let r=t.key==="ArrowDown"?1:-1;if(t.altKey){r===1&&!i.isOpen?i.onOpen():r===-1&&i.isOpen&&i.onClose("arrow");return}this.moveActive(r,c=>i.onOpen(c));return}if(t.key==="Escape"){t.preventDefault(),i.isOpen?i.onClose("escape"):i.onEscapeWhenClosed?.();return}if(t.key==="Enter"||t.key===" "&&i.canUseSpace){if(!i.isOpen&&i.enterWhenClosed==="open"){t.preventDefault(),i.onOpen();return}let r=this.getVisibleOptions();i.isOpen&&this.visualFocus&&r[this.activeIndex]?(t.preventDefault(),i.onSelectActive()):t.key==="Enter"&&i.isOpen&&i.enterWithoutActive==="close"&&(t.preventDefault(),i.onClose("enter"));return}if(t.key==="Tab"&&i.isOpen){let r=this.getVisibleOptions();if(this.visualFocus&&r[this.activeIndex]&&i.closesOnTab){i.onSelectActive();return}i.onClose("tab")}}}syncPopoverPosition(){this.popoverController.sync()}shouldDismissFocus(t){return Wt(this.config.getAnchor(),this.popoverController.getFloatingElement(),t)}shouldDismissPointer(t){return Gt(this.config.getAnchor(),this.popoverController.getFloatingElement(),t)}destroy(){this.popoverController.destroy()}};var Ks,Ws,Gs,Hs,Ys,Xs,Qs,Js,Zs,Ns,tl,el,il,rl,nl,ol;function tS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:al(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||al(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:eS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return rS(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function eS(e){var t=iS(e,"string");return typeof t=="symbol"?t:t+""}function iS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function al(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function rS(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Di,ul=class extends ll{static{({e:[Gs,Hs,Ys,Xs,Qs,Js,Zs,Ns,tl,el,il,rl,nl,ol,Ks],c:[Di,Ws]}=tS(this,[oS("rui-combobox")],[[Me({type:String,reflect:!0,defaultValue:""}),0,"value"],[Me({type:String,defaultValue:""}),0,"label"],[Me({type:String,defaultValue:""}),0,"placeholder"],[Me({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Me({type:Boolean,reflect:!0,defaultValue:!1}),0,"openOnFocus"],[aS({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[lS({ref:"root"}),0,"rootTarget"],[sS(["value","label","placeholder","disabled","openOnFocus"]),2,"onPropsUpdated"],[jt({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[jt({ref:"root",type:"input"}),2,"onRootInput"],[jt({ref:"root",type:"keydown",options:{capture:!0}}),2,"onRootKeydown"],[jt({selector:"[data-combobox-trigger]",type:"click"}),2,"onTriggerClick"],[jt({selector:'[data-combobox-listbox] [role="option"]',type:"pointerover"}),2,"onOptionPointerOver"],[jt({selector:'[data-combobox-listbox] [role="option"]',type:"mousedown"}),2,"onOptionMouseDown"],[jt({selector:'[data-combobox-listbox] [role="option"]',type:"click"}),2,"onOptionClick"],[jt({ref:"root",type:"focusout"}),2,"onFocusOut"],[jt({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"]],0,void 0,ll))}constructor(...t){super(...t),ol(this)}value=(Ks(this),Gs(this));label=(Hs(this),Ys(this));placeholder=(Xs(this),Qs(this));disabled=(Js(this),Zs(this));openOnFocus=(Ns(this),tl(this));changeEvent=(el(this),il(this));open=(rl(this),!1);skipNextFocusOpen=!1;uid=Math.random().toString(36).slice(2,9);listboxBehavior=new me({getAnchor:()=>this.rootTarget,getFloating:()=>this.getListboxPopup(),getOpen:()=>this.open,getOptions:()=>this.getOptions(),getActiveDescendantHost:()=>this.getInput(),getOptionIdPrefix:()=>`rui-combobox-option-${this.uid}`});rootTarget=nl(this);get listboxId(){return`rui-combobox-list-${this.uid}`}get inputId(){return`rui-combobox-input-${this.uid}`}getInput(){return this.querySelector("[data-combobox-input]")}getTrigger(){return this.querySelector("[data-combobox-trigger]")}getListboxPopup(){return this.querySelector("[data-combobox-listbox]")}getListbox(){let t=this.querySelector("rui-listbox");return t instanceof HTMLElement?t.querySelector('[role="listbox"]')??t:this.getListboxPopup()}getListboxHost(){return this.querySelector("rui-listbox")}getOptions(){let t=this.getListbox();return t?Array.from(t.querySelectorAll('[role="option"]')):[]}getOptionLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}ensureOptionIds(){this.listboxBehavior.ensureOptionIds()}getAccessibleName(){return Ve(this)?.textContent?.trim()||this.label||"Suggestions"}isComboboxInput(t){return t instanceof HTMLInputElement&&t.hasAttribute("data-combobox-input")}syncLabel(){let t=this.getInput();Kt(this,t,{controlId:this.inputId,label:this.label,labelId:`rui-combobox-label-${this.uid}`})}syncTrigger(){let t=this.getTrigger(),i=this.getListbox();!t||!i||(t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",i.id||this.listboxId),t.tabIndex=-1,this.disabled&&(t.disabled=!0))}syncInput(){let t=this.getInput(),i=this.getListbox(),r=this.getListboxPopup();!t||!i||(t.id||(t.id=this.inputId),i.id||(i.id=this.listboxId),t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",this.listboxId),i.setAttribute("aria-label",this.getAccessibleName()),r&&(r.removeAttribute("role"),r.removeAttribute("aria-label")),this.placeholder&&!t.placeholder&&(t.placeholder=this.placeholder),this.disabled&&(t.disabled=!0),this.syncTrigger())}syncListboxHost(){let t=this.getListboxHost();t&&(t.embedded=!0,t.value=this.value)}syncOptionSelection(){for(let t of this.getOptions()){let r=(t.getAttribute("data-value")||this.getOptionLabel(t))===this.value&&this.value!=="";t.setAttribute("aria-selected",String(r))}}setVisualFocusCombobox(){this.listboxBehavior.clearActiveOption(),this.syncOptionSelection()}setOpen(t,i={}){let r=i.activate??"none";this.open=t;let c=this.getInput(),p=this.getListboxPopup();if(!(!c||!p)){if(c.setAttribute("aria-expanded",String(t)),p.hidden=!t,this.syncTrigger(),!t){this.listboxBehavior.clearActiveOption(),this.listboxBehavior.syncPopoverPosition();return}if(this.ensureOptionIds(),this.listboxBehavior.syncPopoverPosition(),r==="first"){let h=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(h.length?0:-1);return}if(r==="last"){let h=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(h.length?h.length-1:-1);return}this.listboxBehavior.clearActiveOption()}}getAutocomplete(){return this.querySelector("rui-autocomplete")}syncAutocompleteFilter(){let t=this.getAutocomplete();if(t){t.syncFilter();return}let i=this.getInput()?.value??"";for(let r of this.getOptions()){let c=mi(this.getOptionLabel(r),i,"base");r.hidden=i.trim()!==""&&!c}}showAllOptions(){for(let t of this.getOptions())t.hidden=!1}syncFilter(){this.syncAutocompleteFilter()}select(t){if(t.getAttribute("aria-disabled")==="true")return;let i=t.getAttribute("data-value")||this.getOptionLabel(t),r=this.getOptionLabel(t)||i;this.value=i;let c=this.getInput();c&&(c.value=r),this.changeEvent.emit({value:i}),this.syncOptionSelection(),this.skipNextFocusOpen=!0,this.setOpen(!1),c?.focus()}syncFromValue(){let t=this.getInput();if(!t)return;let i=this.getOptions().find(c=>c.getAttribute("data-value")===this.value),r=i?this.getOptionLabel(i):this.value||"";t.value=r}initialize(){this.ensureOptionIds(),this.syncLabel(),this.syncInput(),this.syncListboxHost(),this.syncFromValue(),this.syncOptionSelection(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.listboxBehavior.destroy(),super.disconnectedCallback()}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.syncListboxHost(),this.syncFromValue(),this.syncOptionSelection()}onRootFocusIn(t){if(this.isComboboxInput(t.target)){if(this.skipNextFocusOpen){this.skipNextFocusOpen=!1;return}this.openOnFocus&&(this.syncFilter(),this.setOpen(!0),this.setVisualFocusCombobox())}}onRootInput(t){if(!this.isComboboxInput(t.target))return;let i=t.target;this.syncFilter(),i.value.trim()!==""&&this.listboxBehavior.getVisibleOptions().length?this.setOpen(!0):i.value.trim()===""&&this.openOnFocus?this.setOpen(!0):(i.value.trim()===""||!this.listboxBehavior.getVisibleOptions().length)&&this.setOpen(!1),this.setVisualFocusCombobox()}onRootKeydown(t){this.isComboboxInput(t.target)&&this.handleInputKeydown(t)}handleInputKeydown(t){if(t.key==="Home"){let i=this.getInput();if(!i)return;t.preventDefault(),i.setSelectionRange(0,0),this.setVisualFocusCombobox();return}if(t.key==="End"){let i=this.getInput();if(!i)return;t.preventDefault();let r=i.value.length;i.setSelectionRange(r,r),this.setVisualFocusCombobox();return}(t.key==="ArrowDown"||t.key==="ArrowUp")&&(this.syncFilter(),this.listboxBehavior.getVisibleOptions().length||this.showAllOptions()),this.listboxBehavior.handleKeydown(t,{isOpen:this.open,canUseSpace:!1,closesOnTab:!0,enterWhenClosed:"ignore",enterWithoutActive:"close",onOpen:(i="none")=>{this.syncFilter(),this.setOpen(!0,{activate:i})},onClose:()=>this.setOpen(!1),onSelectActive:()=>{let i=this.listboxBehavior.getVisibleOptions()[this.listboxBehavior.activeOptionIndex];i&&this.select(i)},onEscapeWhenClosed:()=>{let i=this.getInput();i&&i.value&&(i.value="",this.value="",this.changeEvent.emit({value:""}),this.syncFilter())}})}onTriggerClick(t){t.preventDefault();let i=this.getInput();!i||i.disabled||(this.open?(this.skipNextFocusOpen=!0,this.setOpen(!1)):(this.syncFilter(),this.setOpen(!0),this.setVisualFocusCombobox()),i.focus())}onOptionPointerOver(t){if(!this.open)return;let i=t.target.closest('[role="option"]');if(!i||i.getAttribute("aria-disabled")==="true"||i.hidden)return;let c=this.listboxBehavior.getVisibleOptions().indexOf(i);c>=0&&this.listboxBehavior.setActiveOption(c)}onOptionMouseDown(t){t.preventDefault()}onOptionClick(t){let i=t.target.closest('[role="option"]');i&&this.select(i)}onFocusOut(t){this.listboxBehavior.shouldDismissFocus(t.relatedTarget)&&this.setOpen(!1)}onDocumentPointerDown(t){this.open&&this.listboxBehavior.shouldDismissPointer(t.target)&&this.setOpen(!1)}render(){return nS("div",{class:"rui-combobox","data-ref":"root",children:[sl("slot",{name:"control"}),sl("slot",{name:"listbox"})]})}static{Ws()}};import{jsx as yt,jsxs as mn}from"@ecopages/jsx/jsx-runtime";import{jsx as Ci,jsxs as uS}from"@ecopages/jsx/jsx-runtime";function je({class:e,size:t="sm",...i}){return uS("svg",{...i,class:K("rui-icon",t==="md"&&"rui-icon--md",e),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[Ci("path",{d:"M8 2v4"}),Ci("path",{d:"M16 2v4"}),Ci("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),Ci("path",{d:"M3 10h18"})]})}import{jsx as cl}from"@ecopages/jsx/jsx-runtime";function Le({class:e,size:t="sm",...i}){return cl("svg",{...i,class:K("rui-icon",t==="md"&&"rui-icon--md",e),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:cl("path",{d:"m6 9 6 6 6-6"})})}import{jsx as Rl}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Al,customElement as mS,event as gS,onEvent as Il,onUpdated as bS,prop as Pe}from"@ecopages/radiant";function lt(e,t){e.forEach((i,r)=>{i.tabIndex=r===t?0:-1})}function ge(e,t){if(!e.length)return null;let i=Math.max(0,Math.min(e.length-1,t));return lt(e,i),e[i]?.focus(),e[i]??null}function cS(e,t){return e==="Home"?"first":e==="End"?"last":t==="horizontal"?e==="ArrowRight"?"next":e==="ArrowLeft"?"prev":null:e==="ArrowDown"?"next":e==="ArrowUp"?"prev":null}function st(e){let{items:t,current:i,key:r,orientation:c="horizontal",wrap:p=!0}=e;if(!t.length||!i)return{handled:!1};let h=t.indexOf(i);if(h<0)return{handled:!1};let a=cS(r,c);if(!a)return{handled:!1};let E=h;a==="first"?E=0:a==="last"?E=t.length-1:a==="next"?E=p?(h+1)%t.length:Math.min(t.length-1,h+1):E=p?(h-1+t.length)%t.length:Math.max(0,h-1);let C=ge(t,E);return C?{handled:!0,index:E,item:C}:{handled:!1}}var dl,hl,pl,fl,ml,gl,bl,vl,yl,_l,xl,wl,Sl,El;function dS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Tl(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Tl(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:hS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return fS(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function hS(e){var t=pS(e,"string");return typeof t=="symbol"?t:t+""}function pS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tl(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function fS(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var ki,Dl=class extends Al{static{({e:[pl,fl,ml,gl,bl,vl,yl,_l,xl,wl,Sl,El,dl],c:[ki,hl]}=dS(this,[mS("rui-listbox")],[[Pe({type:String,reflect:!0,defaultValue:""}),0,"value"],[Pe({type:String,defaultValue:""}),0,"label"],[Pe({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Pe({type:Boolean,reflect:!0,defaultValue:!1}),0,"embedded"],[Pe({type:Boolean,reflect:!0}),0,"bordered"],[gS({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[bS(["value","disabled","embedded","bordered"]),2,"onPropsUpdated"],[Il({selector:'[role="option"]',type:"click"}),2,"onOptionClick"],[Il({selector:'[role="option"]',type:"keydown"}),2,"onOptionKeydown"]],0,void 0,Al))}value=(dl(this),pl(this));label=(fl(this),ml(this));disabled=(gl(this),bl(this));embedded=(vl(this),yl(this));bordered=(_l(this),xl(this));changeEvent=(wl(this),Sl(this));resolvedAriaLabel=(El(this),this.$.label.map(t=>t||void 0));resolvedAriaDisabled=this.$.disabled.map(t=>t?"true":void 0);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.sync(),this.syncPresentation()})}onPropsUpdated(){this.sync(),this.syncPresentation()}getOptions(){return Array.from(this.querySelectorAll('[role="option"]'))}sync(){let t=this.getOptions();for(let i of t){let r=i.getAttribute("data-value")===this.value;i.setAttribute("aria-selected",String(r)),i.tabIndex=this.embedded?-1:r||!this.value&&i===t[0]?0:-1}}select(t){this.disabled||t.getAttribute("aria-disabled")==="true"||(this.value=t.getAttribute("data-value")||t.textContent?.trim()||"",this.sync(),this.changeEvent.emit({value:this.value}),t.focus())}onOptionClick(t){if(this.embedded)return;let i=t.target.closest('[role="option"]');i&&this.contains(i)&&this.select(i)}onOptionKeydown(t){if(this.embedded)return;let i=this.getOptions(),r=t.target.closest('[role="option"]');if(!r)return;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.select(r);return}let c=st({items:i,current:r,key:t.key,orientation:"vertical"});c.handled&&(t.preventDefault(),this.select(c.item))}isBordered(){return this.bordered!=null?this.bordered:!this.embedded}syncPresentation(){let t=this.querySelector(".rui-listbox");t&&t.classList.toggle("rui-listbox--bordered",this.isBordered())}render(){let t=this.isBordered();return Rl("div",{class:`rui-listbox${t?" rui-listbox--bordered":""}`,role:"listbox","data-rui-control":!0,"data-rui-control-type":"text","aria-label":this.resolvedAriaLabel,"aria-disabled":this.resolvedAriaDisabled,children:Rl("slot",{})})}static{hl()}};import{jsx as Oi}from"@ecopages/jsx/jsx-runtime";function ne({value:e,label:t,children:i,class:r,disabled:c,...p}){return Oi("div",{...p,class:K("rui-listbox__option",r),role:"option","data-value":e,"data-label":t,"aria-disabled":c?"true":void 0,tabindex:-1,children:i})}var be=rt(ki,({options:e,children:t,...i})=>e!=null?Oi("rui-listbox",{...i,children:e.map(r=>Oi(ne,{value:r.value,label:typeof r.label=="string"?r.label:void 0,disabled:r.disabled,children:r.label}))}):Oi("rui-listbox",{...i,children:t}),{stylesheets:["./listbox.css"]});function Cl({children:e,slot:t="control",class:i,...r}){return yt("div",{...r,slot:t,class:K("rui-combobox__control",i),children:e})}function kl({placeholder:e,disabled:t,class:i,...r}){return yt("input",{...r,type:"text","data-combobox-input":!0,"data-autocomplete-input":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:K("rui-combobox__input",i),placeholder:e,disabled:t,autocomplete:"off"})}function Ol({children:e,class:t,"aria-label":i="Show suggestions",disabled:r,...c}){return yt("button",{...c,type:"button","data-combobox-trigger":!0,class:K("rui-control-toggle",t),"aria-label":i,disabled:r,tabIndex:-1,children:e??yt(Le,{})})}function Vl({children:e,slot:t="listbox",class:i,...r}){return yt("div",{...r,slot:t,"data-combobox-listbox":!0,class:K("rui-combobox__listbox rui-popover rui-popover--listbox rui-floating",i),hidden:!0,children:e})}var vS=ne,yS=rt(Di,({options:e,children:t,...i})=>e!=null?mn("rui-combobox",{...i,children:[mn(Cl,{children:[yt(kl,{placeholder:i.placeholder,disabled:i.disabled}),yt(Ol,{})]}),yt(Vl,{children:yt(Wr,{children:mn(zr,{children:[yt(be,{embedded:!0,options:e}),yt(Kr,{children:"No results found."})]})})})]}):yt("rui-combobox",{...i,children:t}),{stylesheets:["./combobox.css","../shared/control-toggle.css","../../../lib/icons/icons.css"]});import{jsx as Be,jsxs as yu}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as _u,customElement as ES,event as TS,onEvent as kt,onUpdated as xu,prop as _t,query as wu,state as gn}from"@ecopages/radiant";var Ml,jl,Ll,Pl,Bl,Fl,Ul,ql,$l,zl,Kl,Wl,Gl,Hl,Yl,Xl,Ql,Jl,Zl,Nl,tu,eu,iu,ru,nu,ou,au,su,lu,uu,cu,du,hu,pu,fu,mu,gu,bu;function _S(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:vu(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||vu(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:xS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return SS(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function xS(e){var t=wS(e,"string");return typeof t=="symbol"?t:t+""}function wS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vu(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function SS(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Vi,Su=class extends _u{static{({e:[Ll,Pl,Bl,Fl,Ul,ql,$l,zl,Kl,Wl,Gl,Hl,Yl,Xl,Ql,Jl,Zl,Nl,tu,eu,iu,ru,nu,ou,au,su,lu,uu,cu,du,hu,pu,fu,mu,gu,bu,Ml],c:[Vi,jl]}=_S(this,[ES("rui-date-field")],[[_t({type:String,reflect:!0,defaultValue:""}),0,"value"],[_t({type:String,defaultValue:""}),0,"min"],[_t({type:String,defaultValue:""}),0,"max"],[_t({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[_t({type:Boolean,attribute:"read-only",reflect:!0,defaultValue:!1}),0,"readOnly"],[_t({type:String,defaultValue:""}),0,"label"],[_t({type:String,defaultValue:""}),0,"name"],[_t({type:String,defaultValue:""}),0,"placeholder"],[_t({type:String,defaultValue:""}),0,"locale"],[_t({type:String,attribute:"date-style",defaultValue:"medium"}),0,"dateStyle"],[_t({type:Boolean,reflect:!0,defaultValue:!0}),0,"masked"],[_t({type:Number,attribute:"visible-months",defaultValue:1}),0,"visibleMonths"],[TS({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[gn,0,"displayValue"],[gn,0,"editing"],[gn,0,"open"],[wu({ref:"root"}),0,"rootTarget"],[wu({ref:"popover"}),0,"popoverTarget"],[xu(["value","min","max","label","placeholder","disabled","readOnly","locale","dateStyle","masked"]),2,"onPropsUpdated"],[xu(["open"]),2,"onOpenUpdated"],[kt({selector:"[data-date-field-input]",type:"focusin"}),2,"onInputFocus"],[kt({selector:"[data-date-field-input]",type:"input"}),2,"onInput"],[kt({selector:"[data-date-field-input]",type:"change"}),2,"onInputChange"],[kt({selector:"[data-date-field-input]",type:"keydown"}),2,"onInputKeydown"],[kt({ref:"root",type:"focusout"}),2,"onRootFocusOut"],[kt({ref:"trigger",type:"pointerdown"}),2,"onTriggerPointerDown"],[kt({ref:"trigger",type:"click"}),2,"onTriggerClick"],[kt({selector:"[data-date-field-popover]",type:"mousedown"}),2,"onPopoverMouseDown"],[kt({ref:"root",type:"rui-change"}),2,"onCalendarChange"],[kt({ref:"root",type:"keydown"}),2,"onRootKeydown"]],0,void 0,_u))}constructor(...t){super(...t),bu(this)}value=(Ml(this),Ll(this));min=(Pl(this),Bl(this));max=(Fl(this),Ul(this));disabled=(ql(this),$l(this));readOnly=(zl(this),Kl(this));label=(Wl(this),Gl(this));name=(Hl(this),Yl(this));placeholder=(Xl(this),Ql(this));locale=(Jl(this),Zl(this));dateStyle=(Nl(this),tu(this));masked=(eu(this),iu(this));visibleMonths=(ru(this),nu(this));changeEvent=(ou(this),au(this));displayValue=(su(this),lu(this,""));editing=(uu(this),cu(this,!1));open=(du(this),hu(this,!1));uid=(pu(this),Math.random().toString(36).slice(2,9));popoverController=null;suppressPopoverDismiss=!1;rootTarget=fu(this);popoverTarget=(mu(this),gu(this));get isoValue(){return this.value??""}get resolvedLocale(){return It(this.locale)}get inputId(){return`rui-date-field-input-${this.uid}`}get resolvedPlaceholder(){return this.placeholder||sn(this.resolvedLocale)}getInput(){return this.querySelector("[data-date-field-input]")}syncLabel(){let t=this.getInput();Kt(this,t,{controlId:this.inputId,label:this.label,labelId:`rui-date-field-label-${this.uid}`})}syncInput(){let t=this.getInput();if(!t)return;t.id||(t.id=this.inputId),this.name&&(t.name=this.name),this.disabled&&(t.disabled=!0);let i=this.resolvedPlaceholder;i&&(t.placeholder=i)}formatForDisplay(t){if(!t)return"";let i=Dt(t);return i?Ae(i,this.resolvedLocale,this.dateStyle):""}formatForEditing(t){if(!t)return"";if(!this.masked)return this.formatForDisplay(t);let i=Dt(t);if(!i)return"";let r=pe(this.resolvedLocale),c=RS(i,this.resolvedLocale);return Si(c,r)}syncDisplayValue(){if(this.editing)return;this.displayValue=this.formatForDisplay(this.isoValue);let t=this.getInput();t&&(t.value=this.displayValue)}isIsoAllowed(t){return!(this.min&&t<this.min||this.max&&t>this.max)}commitValue(t){if(t&&!this.isIsoAllowed(t)){this.syncDisplayValue();return}if(t===this.isoValue){this.syncDisplayValue();return}this.value=t,this.changeEvent.emit({value:t}),this.syncDisplayValue()}parseAndCommit(t){let i=(t??"").trim();if(!i){this.commitValue("");return}let r=ke(i,this.resolvedLocale);if(!r){this.syncDisplayValue();return}this.commitValue(Ct(r))}handleMaskedInput(t){let i=pe(this.resolvedLocale),r=fe(t),c=Si(r,i);return r.length>=Ce(i)&&this.parseAndCommit(c),c}initialize(){this.syncLabel(),this.syncInput(),this.syncDisplayValue()}setOpen(t){this.open=t,queueMicrotask(()=>this.syncPopoverPosition())}ensurePopoverController(){return this.popoverController||(this.popoverController=new pt({getAnchor:()=>this.rootTarget,getFloating:()=>this.popoverTarget,getOpen:()=>this.open,getPlacement:()=>"bottom-start",gap:4,portal:!1})),this.popoverController}syncPopoverPosition(){let t=this.popoverTarget;if(!t||!this.rootTarget)return;t.hidden=!this.open;let i=this.ensurePopoverController();i.updateConfig({getOpen:()=>this.open}),i.sync()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.syncDisplayValue()}onOpenUpdated(){this.syncPopoverPosition()}onInputFocus(){this.editing=!0;let t=this.getInput();t&&(t.value=this.isoValue?this.formatForEditing(this.isoValue):"",this.displayValue=t.value)}onInput(t){let i=t.target;if(this.masked){let r=this.handleMaskedInput(i.value);i.value=r,this.displayValue=r;return}this.displayValue=i.value}onInputChange(){let t=this.getInput();t&&this.parseAndCommit(t.value)}onInputKeydown(t){if(t.key==="Escape"){if(this.open){t.preventDefault(),this.setOpen(!1);return}this.editing=!1,this.syncDisplayValue()}}onRootFocusOut(t){let i=t.target,r=t.relatedTarget;i.matches("[data-date-field-input]")&&i instanceof HTMLInputElement&&queueMicrotask(()=>{this.editing&&(this.editing=!1,this.parseAndCommit(i.value))}),queueMicrotask(()=>{if(this.suppressPopoverDismiss){this.suppressPopoverDismiss=!1;return}if(!this.open)return;let c=r instanceof Node?r:document.activeElement;Wt(this.rootTarget,this.popoverTarget,c)&&this.setOpen(!1)})}onTriggerPointerDown(){this.suppressPopoverDismiss=!0}onTriggerClick(){this.disabled||this.readOnly||this.setOpen(!this.open)}onPopoverMouseDown(t){t.preventDefault()}onCalendarChange(t){let i=t.target;if(!(i instanceof HTMLElement)||i.tagName.toLowerCase()!=="rui-calendar")return;let r=t.detail;r?.value&&(this.commitValue(r.value),this.setOpen(!1))}onRootKeydown(t){t.key==="Escape"&&this.open&&(t.preventDefault(),this.setOpen(!1))}render(){let t={"prop:selectionMode":"single","prop:visibleMonths":this.visibleMonths,"prop:value":this.isoValue,"prop:min":this.min,"prop:max":this.max,"prop:locale":this.locale,"prop:disabled":this.disabled};return yu("div",{class:"rui-date-field","data-ref":"root",children:[yu("div",{class:"rui-date-field__group",children:[Be("input",{type:"text","data-date-field-input":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:"rui-date-field__input",id:this.inputId,autocomplete:"off",inputmode:this.masked?"numeric":"text",disabled:this.$.disabled,readOnly:this.$.readOnly,placeholder:this.$.placeholder||this.resolvedPlaceholder}),Be("button",{type:"button",class:"rui-control-toggle","data-ref":"trigger","data-date-field-trigger":!0,"aria-label":"Open calendar","aria-haspopup":"dialog","aria-expanded":this.$.open?"true":"false",disabled:this.$.disabled||this.$.readOnly,children:Be(je,{})})]}),Be("div",{class:"rui-date-field__popover rui-popover rui-floating","data-ref":"popover","data-date-field-popover":!0,hidden:!this.$.open,role:"dialog",children:this.$.open?Be("rui-calendar",{...t}):null})]})}static{jl()}};function RS(e,t){let i=wi(t),r={month:String(e.getMonth()+1).padStart(2,"0"),day:String(e.getDate()).padStart(2,"0"),year:String(e.getFullYear())};return i.map(c=>r[c]).join("")}import{jsx as AS}from"@ecopages/jsx/jsx-runtime";var IS=rt(Vi,({children:e,...t})=>AS("rui-date-field",{...t,children:e}),{stylesheets:["./date-field.css","../shared/control-toggle.css","../../../lib/icons/icons.css","../calendar/calendar.css"]});import{jsx as oe,jsxs as bn}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as pc,customElement as VS,event as MS,onEvent as Ot,onUpdated as fc,prop as gt,query as mc,state as Mi}from"@ecopages/radiant";var Eu,Tu,Ru,Au,Iu,Du,Cu,ku,Ou,Vu,Mu,ju,Lu,Pu,Bu,Fu,Uu,qu,$u,zu,Ku,Wu,Gu,Hu,Yu,Xu,Qu,Ju,Zu,Nu,tc,ec,ic,rc,nc,oc,ac,sc,lc,uc,cc,dc;function DS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:hc(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||hc(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:CS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return OS(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function CS(e){var t=kS(e,"string");return typeof t=="symbol"?t:t+""}function kS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hc(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function OS(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var ji,gc=class extends pc{static{({e:[Ru,Au,Iu,Du,Cu,ku,Ou,Vu,Mu,ju,Lu,Pu,Bu,Fu,Uu,qu,$u,zu,Ku,Wu,Gu,Hu,Yu,Xu,Qu,Ju,Zu,Nu,tc,ec,ic,rc,nc,oc,ac,sc,lc,uc,cc,dc,Eu],c:[ji,Tu]}=DS(this,[VS("rui-date-range-picker")],[[gt({type:String,reflect:!0,defaultValue:""}),0,"value"],[gt({type:String,defaultValue:""}),0,"min"],[gt({type:String,defaultValue:""}),0,"max"],[gt({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[gt({type:Boolean,attribute:"read-only",reflect:!0,defaultValue:!1}),0,"readOnly"],[gt({type:String,defaultValue:""}),0,"locale"],[gt({type:String,attribute:"placeholder-start",defaultValue:""}),0,"placeholderStart"],[gt({type:String,attribute:"placeholder-end",defaultValue:""}),0,"placeholderEnd"],[gt({type:String,attribute:"start-name",defaultValue:""}),0,"startName"],[gt({type:String,attribute:"end-name",defaultValue:""}),0,"endName"],[gt({type:String,defaultValue:""}),0,"name"],[gt({type:String,attribute:"date-style",defaultValue:"medium"}),0,"dateStyle"],[gt({type:Number,attribute:"visible-months",defaultValue:2}),0,"visibleMonths"],[MS({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Mi,0,"open"],[Mi,0,"startDisplay"],[Mi,0,"endDisplay"],[Mi,0,"editing"],[mc({ref:"root"}),0,"rootTarget"],[mc({ref:"popover"}),0,"popoverTarget"],[fc(["value","min","max","disabled","readOnly","locale","dateStyle","startName","endName","visibleMonths"]),2,"onPropsUpdated"],[fc(["open"]),2,"onOpenUpdated"],[Ot({ref:"trigger",type:"pointerdown"}),2,"onTriggerPointerDown"],[Ot({ref:"trigger",type:"click"}),2,"onTriggerClick"],[Ot({selector:"[data-range-start]",type:"focus"}),2,"onStartFocus"],[Ot({selector:"[data-range-end]",type:"focus"}),2,"onEndFocus"],[Ot({selector:"[data-range-start], [data-range-end]",type:"blur"}),2,"onInputBlur"],[Ot({selector:"[data-range-start], [data-range-end]",type:"input"}),2,"onInput"],[Ot({selector:"[data-range-popover]",type:"mousedown"}),2,"onPopoverMouseDown"],[Ot({ref:"root",type:"rui-change"}),2,"onCalendarChange"],[Ot({ref:"root",type:"keydown"}),2,"onRootKeydown"],[Ot({ref:"root",type:"focusout"}),2,"onRootFocusOut"]],0,void 0,pc))}constructor(...t){super(...t),dc(this)}value=(Eu(this),Ru(this));min=(Au(this),Iu(this));max=(Du(this),Cu(this));disabled=(ku(this),Ou(this));readOnly=(Vu(this),Mu(this));locale=(ju(this),Lu(this));placeholderStart=(Pu(this),Bu(this));placeholderEnd=(Fu(this),Uu(this));startName=(qu(this),$u(this));endName=(zu(this),Ku(this));name=(Wu(this),Gu(this));dateStyle=(Hu(this),Yu(this));visibleMonths=(Xu(this),Qu(this));changeEvent=(Ju(this),Zu(this));open=(Nu(this),tc(this,!1));startDisplay=(ec(this),ic(this,""));endDisplay=(rc(this),nc(this,""));editing=(oc(this),ac(this,null));uid=(sc(this),Math.random().toString(36).slice(2,9));popoverController=null;suppressPopoverDismiss=!1;rootTarget=lc(this);popoverTarget=(uc(this),cc(this));get resolvedLocale(){return It(this.locale)}get isoValue(){return this.value??""}getStartInput(){return this.querySelector("[data-range-start]")}getEndInput(){return this.querySelector("[data-range-end]")}formatIso(t){if(!t)return"";let i=Dt(t);return i?Ae(i,this.resolvedLocale,this.dateStyle):""}syncDisplayValues(){if(this.editing==="start"||this.editing==="end")return;let t=xt(this.isoValue);this.startDisplay=this.formatIso(t?.start??""),this.endDisplay=this.formatIso(t?.end??"");let i=this.getStartInput(),r=this.getEndInput();i&&(i.value=this.startDisplay),r&&(r.value=this.endDisplay)}isIsoAllowed(t){return!(this.min&&t<this.min||this.max&&t>this.max)}commitRange(t,i){if(t&&!this.isIsoAllowed(t)){this.syncDisplayValues();return}if(i&&!this.isIsoAllowed(i)){this.syncDisplayValues();return}let r=t&&i?Re({start:t,end:i}):"";if(r===this.isoValue){this.syncDisplayValues();return}this.value=r,this.changeEvent.emit({value:r,start:t,end:i}),this.syncDisplayValues()}parseField(t){let i=(t??"").trim();if(!i)return"";let r=ke(i,this.resolvedLocale);return r?Ct(r):""}commitFromInputs(){let t=this.parseField(this.getStartInput()?.value??""),i=this.parseField(this.getEndInput()?.value??"");if(!t&&!i){this.commitRange("","");return}if(t&&i){this.commitRange(t,i);return}let r=xt(this.isoValue);this.commitRange(t||r?.start||"",i||r?.end||"")}setOpen(t){this.open=t,queueMicrotask(()=>this.syncPopoverPosition())}ensurePopoverController(){return this.popoverController||(this.popoverController=new pt({getAnchor:()=>this.rootTarget,getFloating:()=>this.popoverTarget,getOpen:()=>this.open,getPlacement:()=>"bottom-start",gap:4,portal:!1})),this.popoverController}syncPopoverPosition(){let t=this.popoverTarget;if(!t||!this.rootTarget)return;t.hidden=!this.open;let i=this.ensurePopoverController();i.updateConfig({getOpen:()=>this.open}),i.sync()}wireInputNames(){let t=this.getStartInput(),i=this.getEndInput();t&&this.startName&&(t.name=this.startName),i&&this.endName&&(i.name=this.endName)}initialize(){this.wireInputNames(),this.syncDisplayValues(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}onPropsUpdated(){this.wireInputNames(),this.syncDisplayValues()}onOpenUpdated(){this.syncPopoverPosition()}onTriggerPointerDown(){this.suppressPopoverDismiss=!0}onTriggerClick(){this.disabled||this.readOnly||this.setOpen(!this.open)}onStartFocus(){this.editing="start";let t=xt(this.isoValue),i=this.getStartInput();i&&(i.value=t?.start?this.formatIso(t.start):"")}onEndFocus(){this.editing="end";let t=xt(this.isoValue),i=this.getEndInput();i&&(i.value=t?.end?this.formatIso(t.end):"")}onInputBlur(){this.editing=null,this.commitFromInputs()}onInput(t){let i=t.target;if(i.matches("[data-range-start]")){this.startDisplay=i.value;return}this.endDisplay=i.value}onPopoverMouseDown(t){t.preventDefault()}onCalendarChange(t){let i=t.target;if(!(i instanceof HTMLElement)||i.tagName.toLowerCase()!=="rui-calendar")return;let r=t.detail;!r?.start||!r.end||(this.commitRange(r.start,r.end),this.setOpen(!1))}onRootKeydown(t){t.key==="Escape"&&this.open&&(t.preventDefault(),this.setOpen(!1))}onRootFocusOut(t){let i=t.relatedTarget;queueMicrotask(()=>{if(this.suppressPopoverDismiss){this.suppressPopoverDismiss=!1;return}if(!this.open)return;let r=i instanceof Node?i:document.activeElement;Wt(this.rootTarget,this.popoverTarget,r)&&this.setOpen(!1)})}render(){let t={"prop:selectionMode":"range","prop:visibleMonths":this.visibleMonths,"prop:value":this.isoValue,"prop:min":this.min,"prop:max":this.max,"prop:locale":this.locale,"prop:disabled":this.disabled};return bn("div",{class:"rui-date-range-picker","data-ref":"root",children:[bn("div",{class:"rui-date-range-picker__group",children:[bn("div",{class:"rui-date-range-picker__values",children:[oe("input",{type:"text",class:"rui-date-range-picker__input","data-range-start":!0,"data-rui-control":!0,"data-rui-control-type":"text",id:`${this.uid}-start`,autocomplete:"off",disabled:this.$.disabled,readOnly:this.$.readOnly,placeholder:this.placeholderStart||"Start date"}),oe("span",{class:"rui-date-range-picker__separator","aria-hidden":"true",children:"\u2013"}),oe("input",{type:"text",class:"rui-date-range-picker__input","data-range-end":!0,"data-rui-control":!0,"data-rui-control-type":"text",id:`${this.uid}-end`,autocomplete:"off",disabled:this.$.disabled,readOnly:this.$.readOnly,placeholder:this.placeholderEnd||"End date"})]}),oe("button",{type:"button",class:"rui-control-toggle","data-ref":"trigger","data-range-trigger":!0,"aria-label":"Open calendar","aria-haspopup":"dialog","aria-expanded":this.$.open?"true":"false",disabled:this.$.disabled||this.$.readOnly,children:oe(je,{})})]}),oe("div",{class:"rui-date-range-picker__popover rui-popover rui-floating","data-ref":"popover","data-range-popover":!0,hidden:!this.$.open,role:"dialog",children:this.$.open?oe("rui-calendar",{...t}):null})]})}static{Tu()}};import{jsx as jS}from"@ecopages/jsx/jsx-runtime";var LS=rt(ji,({children:e,...t})=>jS("rui-date-range-picker",{...t,children:e}),{stylesheets:["./date-range-picker.css","../shared/control-toggle.css","../../../lib/icons/icons.css","../calendar/calendar.css"]});import{jsx as Fe,jsxs as Lc}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Pc,bound as $S,customElement as zS,event as KS,onEvent as yn,onUpdated as WS,prop as _n,query as xn}from"@ecopages/radiant";var bc="a[href], button, input, select, textarea, [tabindex]";function PS(e){return!e.hasAttribute("disabled")&&e.getAttribute("tabindex")!=="-1"}function vn(e){return Array.from(e.querySelectorAll(bc)).filter(PS)}function Li(e){return Array.from(e.querySelectorAll(bc)).filter(t=>!t.hasAttribute("disabled"))}function vc(e){return vn(e)[0]}var yc,_c,xc,wc,Sc,Ec,Tc,Rc,Ac,Ic,Dc,Cc,kc,Oc,Vc,Mc;function BS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:jc(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||jc(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:FS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return qS(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function FS(e){var t=US(e,"string");return typeof t=="symbol"?t:t+""}function US(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jc(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function qS(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Pi,Bc=class extends Pc{static{({e:[xc,wc,Sc,Ec,Tc,Rc,Ac,Ic,Dc,Cc,kc,Oc,Vc,Mc,yc],c:[Pi,_c]}=BS(this,[zS("rui-dialog")],[[_n({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[_n({type:Boolean,reflect:!0,defaultValue:!1}),0,"alert"],[_n({type:String,defaultValue:""}),0,"label"],[xn({ref:"dialog"}),0,"dialogTarget"],[xn({selector:"[data-dialog-title]"}),0,"titleTarget"],[xn({selector:"[data-dialog-body]"}),0,"descriptionTarget"],[KS({name:"rui-close",bubbles:!0,composed:!0}),0,"closeEvent"],[[$S,WS(["open","label"])],2,"syncOpenState"],[yn({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[yn({ref:"backdrop",type:"click"}),2,"onBackdropClick"],[yn({selector:"[data-dialog-close]",type:"click"}),2,"onCloseClick"]],0,void 0,Pc))}open=(yc(this),xc(this));alert=(wc(this),Sc(this));label=(Ec(this),Tc(this));dialogTarget=(Rc(this),Ac(this));titleTarget=(Ic(this),Dc(this));descriptionTarget=(Cc(this),kc(this));closeEvent=(Oc(this),Vc(this));dialogHidden=(Mc(this),this.$.open.map(t=>!t));resolvedRole=this.$.alert.map(t=>t?"alertdialog":"dialog");previouslyFocused=null;titleId=`rui-dialog-title-${Math.random().toString(36).slice(2,9)}`;descriptionId=`rui-dialog-desc-${Math.random().toString(36).slice(2,9)}`;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncOpenState())}syncOpenState(){this.dialogTarget&&(this.titleTarget?.textContent?.trim()?(this.titleTarget.id=this.titleId,this.dialogTarget.setAttribute("aria-labelledby",this.titleId),this.dialogTarget.removeAttribute("aria-label")):this.label&&(this.dialogTarget.setAttribute("aria-label",this.label),this.dialogTarget.removeAttribute("aria-labelledby")),this.descriptionTarget?(this.descriptionTarget.id=this.descriptionId,this.dialogTarget.setAttribute("aria-describedby",this.descriptionId)):this.dialogTarget.removeAttribute("aria-describedby"),this.open?(this.previouslyFocused=document.activeElement,queueMicrotask(()=>this.focusInitial())):(this.previouslyFocused?.focus?.(),this.previouslyFocused=null))}focusInitial(){(this.getFocusable()[0]??this.dialogTarget)?.focus()}getFocusable(){return this.dialogTarget?vn(this.dialogTarget):[]}dismiss(t){this.open&&(this.open=!1,this.closeEvent.emit({reason:t}))}onDocumentKeydown(t){if(!this.open)return;if(t.key==="Escape"){t.preventDefault(),this.dismiss("escape");return}if(t.key!=="Tab")return;let i=this.getFocusable();if(!i.length){t.preventDefault(),this.dialogTarget.focus();return}let r=i[0],c=i[i.length-1],p=document.activeElement;t.shiftKey&&p===r?(t.preventDefault(),c.focus()):!t.shiftKey&&p===c&&(t.preventDefault(),r.focus())}onBackdropClick(){this.dismiss("backdrop")}onCloseClick(){this.dismiss("dismiss")}render(){return Lc("div",{class:"rui-dialog",hidden:this.dialogHidden,children:[Fe("div",{"data-ref":"backdrop",class:"rui-dialog__backdrop"}),Lc("div",{"data-ref":"dialog",class:"rui-dialog__surface",tabindex:-1,role:this.resolvedRole,"aria-modal":"true",children:[Fe("slot",{name:"close"}),Fe("slot",{name:"title"}),Fe("slot",{}),Fe("slot",{name:"actions"})]})]})}static{_c()}};import{jsx as Lt,jsxs as GS}from"@ecopages/jsx/jsx-runtime";function Fc({children:e,slot:t="title",class:i,...r}){return Lt("div",{...r,slot:t,"data-dialog-title":!0,"data-ref":"title",class:K("rui-dialog__title",i),children:e})}function Uc({children:e,class:t,...i}){return Lt("div",{...i,"data-dialog-body":!0,"data-ref":"description",class:K("rui-dialog__body",t),children:e})}function qc({children:e,slot:t="actions",class:i,...r}){return Lt("div",{...r,slot:t,class:K("rui-dialog__actions",i),children:e})}function $c({children:e,slot:t="close",class:i,"aria-label":r="Close",...c}){return Lt("button",{...c,slot:t,type:"button","data-dialog-close":!0,"data-ref":"close",class:K("rui-dialog__close",i),"aria-label":r,children:e??"\xD7"})}var HS=rt(Pi,({title:e,actions:t,children:i,...r})=>e!=null||t!=null?GS("rui-dialog",{...r,children:[Lt($c,{}),e!=null?Lt(Fc,{children:e}):null,i!=null?Lt(Uc,{children:i}):null,t!=null?Lt(qc,{children:t}):null]}):Lt("rui-dialog",{...r,children:i}),{stylesheets:["./dialog.css"]});var Pt="__rui-dialog-host",Bi="rui-dialog-open",Fi="rui-dialog-close",Ui="rui-dialog-toggle",wn="rui-dialog-action";function zc(e){return"id"in e&&e.id!=null&&e.id!==""}var Ue=!1,qi=null,qe=null,dt=null;function En(e){let t=e.trim();if(!t)return null;let i=document.getElementById(t);return i?.localName==="rui-dialog"?i:null}function YS(){let e=document.createElement("button");return e.slot="close",e.type="button",e.setAttribute("data-dialog-close",""),e.setAttribute("data-ref","close"),e.className="rui-dialog__close",e.setAttribute("aria-label","Close"),e.textContent="\xD7",e}function XS(e){let t=document.createElement("div");return t.slot="title",t.setAttribute("data-dialog-title",""),t.setAttribute("data-ref","title"),t.className="rui-dialog__title",t.textContent=e,t}function QS(e){let t=document.createElement("div");t.setAttribute("data-dialog-body",""),t.setAttribute("data-ref","description"),t.className="rui-dialog__body";let i=document.createElement("p");return i.textContent=e,t.append(i),t}function JS(e){let t=document.createElement("div");t.slot="actions",t.className="rui-dialog__actions";for(let i of e){let r=document.createElement("button");r.type="button",r.className=`rui-button rui-button--${i.variant??"filled"} rui-button--${i.size??"md"}`,r.setAttribute("data-dialog-action",i.value??""),i.closeOnClick===!1&&r.setAttribute("data-dialog-action-close","false"),r.textContent=i.label,t.append(r)}return t}function $e(){qe?.remove(),qe=null}function ZS(e){$e();let t=document.createElement("rui-dialog");return t.id=Pt,t.alert=!!e.alert,t.label=e.label??"",t.append(YS()),e.title&&t.append(XS(e.title)),e.body&&t.append(QS(e.body)),e.actions?.length&&t.append(JS(e.actions)),(qi??document.body).appendChild(t),qe=t,t}function Kc(e){if(!(!dt||dt===e))if(dt===Pt)$e();else{let t=En(dt);t&&(t.open=!1)}}function ve(e){Ht();let t=En(e);t&&(Kc(e),t.open=!0,dt=e)}function NS(e){Ht(),Kc(Pt);let t=ZS(e);t.open=!0,dt=Pt}function $i(e){if(typeof e=="string"){ve(e);return}if(zc(e)){ve(e.id);return}NS(e)}function ye(e){Ht();let t=e??dt;if(t){if(t===Pt)$e();else{let i=En(t);i&&(i.open=!1)}dt===t&&(dt=null)}}function Tn(e){if(Ht(),dt===e){ye(e);return}ve(e)}function Wc(e){let t=e.detail;if(typeof t=="string"){$i(t);return}t&&typeof t=="object"&&$i(t)}function Gc(e){let t=e.detail;ye(t?.id)}function Hc(e){let t=e.detail;t?.id&&Tn(t.id)}function Yc(e){let t=e.target;if(!t?.closest)return;let i=t.closest("[data-dialog-action]");if(i&&qe?.contains(i)){e.preventDefault();let h={value:i.getAttribute("data-dialog-action")||void 0||void 0};qe.dispatchEvent(new CustomEvent(wn,{detail:h,bubbles:!0,composed:!0})),i.getAttribute("data-dialog-action-close")!=="false"&&ye(Pt);return}let r=t.closest("[data-dialog-open]");if(r){let p=r.getAttribute("data-dialog-open")?.trim();p&&(e.preventDefault(),ve(p));return}let c=t.closest("[data-dialog-close]");if(c){if(c.closest("rui-dialog")?.hasAttribute("open"))return;e.preventDefault(),ye()}}function Xc(e){let t=e.target?.closest?.("rui-dialog");if(!t)return;let i=t.id||null;i&&dt===i&&(i===Pt&&$e(),dt=null)}function Qc(e={}){return Ue?(e.mount&&(qi=e.mount),Sn):(Ue=!0,qi=e.mount??document.body,document.addEventListener(Bi,Wc),document.addEventListener(Fi,Gc),document.addEventListener(Ui,Hc),document.addEventListener("click",Yc),document.addEventListener("rui-close",Xc),Sn)}function Ht(){Ue||Qc()}function Sn(){Ue&&(document.removeEventListener(Bi,Wc),document.removeEventListener(Fi,Gc),document.removeEventListener(Ui,Hc),document.removeEventListener("click",Yc),document.removeEventListener("rui-close",Xc),$e(),qi=null,dt=null,Ue=!1)}function tE(){return dt}function eE(e){Ht(),$i(e)}function iE(e){Ht(),ye(e)}function rE(e){Ht(),Tn(e)}function nE(e){Ht();let t=e?.trim()||void 0;return{open:r=>{if(t){ve(t);return}if(r!=null){if(typeof r=="string"){ve(r);return}$i(r)}},close:r=>{ye(r??t)},toggle:r=>{let c=r??t;c&&Tn(c)},get openId(){return dt}}}import{jsx as ad,jsxs as uE}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as sd,bound as cE,customElement as dE,onEvent as hE,onUpdated as pE,prop as Rn}from"@ecopages/radiant";var Jc,Zc,Nc,td,ed,id,rd,nd;function oE(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:od(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||od(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:aE(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return lE(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function aE(e){var t=sE(e,"string");return typeof t=="symbol"?t:t+""}function sE(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function od(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function lE(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var _e,ld=class extends sd{static{({e:[Nc,td,ed,id,rd,nd,Jc],c:[_e,Zc]}=oE(this,[dE("rui-disclosure")],[[Rn({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[Rn({type:String,reflect:!0,defaultValue:""}),0,"value"],[Rn({type:Boolean,reflect:!0,defaultValue:!1}),0,"animated"],[hE({selector:"[data-disclosure-trigger]",type:"click"}),2,"onTriggerClick"],[[cE,pE(["open","animated"])],2,"syncExpanded"]],0,void 0,sd))}open=(Jc(this),Nc(this));value=(td(this),ed(this));animated=(id(this),rd(this));panelId=(nd(this),`rui-disclosure-${Math.random().toString(36).slice(2,9)}`);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncAnimated(),this.syncExpanded()})}syncAnimated(){this.toggleAttribute("data-animated",this.animated)}onTriggerClick(t){t.preventDefault(),this.toggle()}toggle(){let t=!this.open;this.open=t,this.dispatchEvent(new CustomEvent("rui-disclosure-toggle",{bubbles:!0,composed:!0,detail:{value:this.value,open:t}}))}syncExpanded(){this.syncAnimated();let t=this.querySelector("[data-disclosure-trigger]"),i=this.querySelector("[data-disclosure-panel]");if(!(!t||!i)){if(t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",this.panelId),i.id=this.panelId,i.dataset.state=this.open?"open":"closed",this.animated){i.hidden=!1,i.setAttribute("aria-hidden",String(!this.open));return}i.hidden=!this.open,i.removeAttribute("aria-hidden")}}render(){return uE("div",{class:"rui-disclosure",children:[ad("slot",{name:"trigger"}),ad("slot",{})]})}static{Zc()}};import{jsx as gd}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as bd,customElement as vE,onEvent as vd,onUpdated as yE,prop as yd}from"@ecopages/radiant";var ud,cd,dd,hd,pd,fd;function fE(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:md(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||md(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:mE(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return bE(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function mE(e){var t=gE(e,"string");return typeof t=="symbol"?t:t+""}function gE(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function md(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function bE(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var zi,_d=class extends bd{static{({e:[dd,hd,pd,fd,ud],c:[zi,cd]}=fE(this,[vE("rui-disclosure-group")],[[yd({type:Boolean,reflect:!0,defaultValue:!1}),0,"multiple"],[yd({type:Boolean,reflect:!0,attribute:"animated",defaultValue:!1}),0,"animated"],[yE("animated"),2,"onAnimatedUpdated"],[vd({selector:"rui-disclosure",type:"rui-disclosure-toggle"}),2,"onDisclosureToggle"],[vd({selector:"[data-disclosure-trigger]",type:"keydown"}),2,"onTriggerKeydown"]],0,void 0,bd))}constructor(...t){super(...t),fd(this)}multiple=(ud(this),dd(this));animated=(hd(this),pd(this));connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncChildrenAnimated(),this.syncTriggers()})}getTriggers(){return Array.from(this.querySelectorAll("[data-disclosure-trigger]"))}getDisclosureForTrigger(t){return t.closest("rui-disclosure")}syncTriggers(){let t=this.getTriggers();if(!t.length)return;let i=Math.max(0,t.findIndex(r=>r.tabIndex===0||r===document.activeElement));lt(t,i)}syncChildrenAnimated(){for(let t of this.querySelectorAll("rui-disclosure"))t.animated=this.animated}onAnimatedUpdated(){this.syncChildrenAnimated()}onDisclosureToggle(t){if(this.multiple||!t.detail?.open)return;let r=t.target;if(r instanceof _e)for(let c of this.querySelectorAll("rui-disclosure"))c!==r&&(c.open=!1)}onTriggerKeydown(t){let i=this.getTriggers(),r=t.target.closest("[data-disclosure-trigger]");if(!r)return;if(t.key==="ArrowLeft"||t.key==="ArrowRight"){let p=this.getDisclosureForTrigger(r);if(!p)return;let h=t.key==="ArrowRight";if(p.open===h){t.preventDefault();return}if(t.preventDefault(),p.open=h,h&&!this.multiple)for(let a of this.querySelectorAll("rui-disclosure"))a!==p&&(a.open=!1);return}st({items:i,current:r,key:t.key,orientation:"vertical",wrap:!0}).handled&&t.preventDefault()}render(){return gd("div",{class:"rui-disclosure-group","data-ref":"root",children:gd("slot",{})})}static{cd()}};import{jsx as Bt,jsxs as xd}from"@ecopages/jsx/jsx-runtime";function wd({variant:e="chevron",class:t,...i}){return Bt("span",{...i,class:K("rui-disclosure__icon",`rui-disclosure__icon--${e}`,t),"data-disclosure-icon":!0,"aria-hidden":"true"})}function Sd({children:e,slot:t="trigger",class:i,disabled:r,icon:c,iconPosition:p="start",...h}){let E=c!==null?c??Bt(wd,{}):null;return xd("button",{...h,slot:t,type:"button","data-disclosure-trigger":!0,class:K("rui-disclosure__trigger",p==="end"&&"rui-disclosure__trigger--icon-end",i),disabled:r,children:[p==="start"?E:null,Bt("span",{class:"rui-disclosure__label",children:e}),p==="end"?E:null]})}function Ed({children:e,class:t,...i}){return Bt("div",{...i,"data-disclosure-panel":!0,"data-ref":"panel",class:K("rui-disclosure__panel",t),children:Bt("div",{class:"rui-disclosure__panel-inner",children:e})})}var _E=rt(_e,({trigger:e,children:t,...i})=>e!=null?xd("rui-disclosure",{...i,children:[Bt(Sd,{children:e}),t!=null?Bt(Ed,{children:t}):null]}):Bt("rui-disclosure",{...i,children:t}),{stylesheets:["./disclosure.css"]}),xE=rt(zi,({children:e,...t})=>Bt("rui-disclosure-group",{...t,children:e}),{stylesheets:["./disclosure-group.css"]});import{jsx as Yt}from"@ecopages/jsx/jsx-runtime";function Td({children:e,label:t,class:i,"aria-labelledby":r,"aria-busy":c,...p}){return Yt("div",{...p,role:"feed",class:K("rui-feed",i),"aria-label":t,"aria-labelledby":r,"aria-busy":c,children:e})}function wE({children:e,posinset:t,setsize:i,labelledBy:r,describedBy:c,tabindex:p=0,class:h,...a}){return Yt("article",{...a,class:K("rui-feed__article",h),tabindex:p,"aria-posinset":t,"aria-setsize":i,"aria-labelledby":r,"aria-describedby":c,children:e})}function SE({children:e,class:t,...i}){return Yt("header",{...i,class:K("rui-feed__header",t),children:e})}function EE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__content",t),children:e})}function TE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__actions",t),children:e})}function RE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__byline",t),children:e})}function AE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__byline-body",t),children:e})}function IE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__meta",t),children:e})}nt(Td,["./feed.css"],import.meta.url);import{jsx as zE}from"@ecopages/jsx/jsx-runtime";import{jsx as rh}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as nh,customElement as PE,onEvent as Yi,onUpdated as jn,prop as se,registerSsrPreparationCallback as BE}from"@ecopages/radiant";import{consumeContext as FE,onContextUpdate as UE,provideContext as qE}from"@ecopages/radiant/context";var Tt="data-rui-control",An="data-rui-field-managed",Gi="data-rui-field-label",Hi="data-rui-field-description",xe="data-rui-field-error",In="data-default-value",Dn="data-default-values",ze=new Set(["rui-combobox","rui-date-field","rui-date-range-picker","rui-select","rui-tag-group","rui-checkbox","rui-switch","rui-radio-group","rui-slider","rui-number-field","rui-listbox"]),Dd=`[${Tt}], ${Array.from(ze).join(", ")}, input, textarea`,ae={read:e=>{let t=Reflect.get(e,"value");return typeof t=="string"?t:e.getAttribute("value")??""},write:(e,t)=>{let i=t==null?"":String(t);e.setAttribute("value",i),"value"in e&&Reflect.set(e,"value",i)}},Rd={read:e=>{let t=Reflect.get(e,"value");if(typeof t=="number")return t;let i=e.getAttribute("value");return i==null||i===""?"":Number(i)},write:(e,t)=>{let i=t==null?"":String(t);e.setAttribute("value",i),"value"in e&&Reflect.set(e,"value",t)}},Ad={read:e=>e.querySelector('input[type="checkbox"]')?.checked??e.hasAttribute("checked"),write:(e,t)=>{t?e.setAttribute("checked",""):e.removeAttribute("checked")}},Ki=new Map([["rui-checkbox",Ad],["rui-switch",Ad],["rui-combobox",ae],["rui-date-field",ae],["rui-date-range-picker",ae],["rui-select",ae],["rui-radio-group",ae],["rui-listbox",ae],["rui-tag-group",ae],["rui-slider",Rd],["rui-number-field",Rd]]);function Cd(e,t){let i=e,r=new Set,c=a=>{r.has(a)||(r.add(a),t(a))};if(typeof i.getSlotElements=="function")for(let a of i.getSlotElements())c(a);let p=e.querySelector(".rui-field")??e;for(let a of Array.from(p.children))c(a);for(let a of p.querySelectorAll("*"))c(a);for(let a of Array.from(e.children))c(a);let h=e.shadowRoot;if(h)for(let a of Array.from(h.children))c(a)}function Cn(e,t){let i=null;return Cd(e,r=>{if(!(i||!(r instanceof HTMLElement))){if(r.matches(t)){i=r;return}i=r.querySelector(t)}}),i}function DE(e){if(e.length===0)return null;if(e.length===1)return e[0];let t=e.find(h=>ze.has(h.localName)),i=e.find(h=>h.hasAttribute(Tt));if(i)return i;if(t)return t;let r=document.activeElement;if(r instanceof HTMLElement){for(let h of e)if(h===r||h.contains(r))return h}let c=e.filter(h=>h.isConnected&&h.getClientRects().length>0&&!h.closest('[hidden],[aria-hidden="true"]')),p=c.length>0?c:e.filter(h=>h.isConnected);return p[p.length-1]??e[e.length-1]}function CE(e){let t=e.querySelector(".rui-field");return t instanceof HTMLElement?Array.from(t.querySelectorAll(Dd)).filter(i=>e.contains(i)):[]}function Ke(e){let t=DE(CE(e));if(t)return t;let i=null;if(Cd(e,c=>{if(i)return;let p=Id(c);p&&(i=p)}),i)return i;let r=e.querySelector(".rui-field")??e;return Id(r)}function Id(e){return e instanceof HTMLElement?e.matches(`[${Tt}]`)||ze.has(e.localName)||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e:e.querySelector(Dd):null}function kn(e){if(e instanceof HTMLInputElement){let i=Wi(e),r=i===e?void 0:Ki.get(i.localName);return r?r.read(i):e.type==="checkbox"?e.checked:e.type==="number"||e.type==="range"?e.value===""?"":Number(e.value):e.value}if(e instanceof HTMLTextAreaElement)return e.value;let t=Wi(e);return Ki.get(t.localName)?.read(t)??t.getAttribute("value")??""}function On(e,t){if(e instanceof HTMLInputElement){let r=Wi(e),c=r===e?void 0:Ki.get(r.localName);if(c){c.write(r,t);return}if(e.type==="checkbox"){e.checked=!!t;let p=e.closest("rui-checkbox, rui-switch");p&&(t?p.setAttribute("checked",""):p.removeAttribute("checked"));return}e.value=t==null?"":String(t);return}if(e instanceof HTMLTextAreaElement){e.value=t==null?"":String(t);return}let i=Wi(e);Ki.get(i.localName)?.write(i,t)}function Wi(e){return e.hasAttribute(Tt)?e.closest(Array.from(ze).join(","))??e:e}function kd(e){return Cn(e,`[${Gi}], label.rui-label`)}function Od(e){return Cn(e,`[${Hi}]`)}function Vd(e){return Vn(e)[0]??null}function Vn(e){let t=e.querySelector(".rui-field");if(t instanceof HTMLElement){let c=Array.from(t.querySelectorAll(`[${xe}]`)),p=c.filter(h=>h.getClientRects().length>0);if(p.length>0)return p;if(c.length>0)return c}let i=Array.from(e.querySelectorAll(`[${xe}]`));if(i.length>0)return i;let r=Cn(e,`[${xe}]`);return r?[r]:[]}function Md(e,t,i){i&&((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.name=i),e&&e!==t&&ze.has(e.localName)&&e.setAttribute("name",i))}function jd(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e.hasAttribute(Tt))return e;let t=e.querySelector(`[${Tt}]`);if(t)return t;if(e.localName==="rui-combobox")return e.querySelector("[data-combobox-input]")??e;if(e.localName==="rui-date-field")return e.querySelector("[data-date-field-input]")??e;if(e.localName==="rui-date-range-picker")return e.querySelector("[data-range-start]")??e;if(e.localName==="rui-select")return e.querySelector("[data-select-trigger]")??e;if(e.localName==="rui-tag-group")return e.querySelector("[data-tag-list]")??e;if(e.localName==="rui-number-field")return e.querySelector("[data-number-field-input], input")??e;if(e.localName==="rui-slider")return e.querySelector('input[type="range"]')??e;if(e.localName==="rui-checkbox"||e.localName==="rui-switch")return e.querySelector("input")??e;if(e.localName==="rui-radio-group"){let i=e.querySelector('input[type="radio"]:checked'),r=e.querySelector('input[type="radio"]');return i??r??e}return e}import{createContext as kE}from"@ecopages/radiant/context";var we=kE(Symbol.for("rui-form-context"));import{createContext as OE}from"@ecopages/radiant/context";var Mn=OE(Symbol.for("rui-field-context"));var Ld,Pd,Bd,Fd,Ud,qd,$d,zd,Kd,Wd,Gd,Hd,Yd,Xd,Qd,Jd,Zd,Nd,th,eh;function VE(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:ih(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||ih(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:ME(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return LE(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function ME(e){var t=jE(e,"string");return typeof t=="symbol"?t:t+""}function jE(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ih(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function LE(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}function $E(e){if(!e)return;let{validate:t,...i}=e;return i}var Xi,oh=class extends nh{static{({e:[Bd,Fd,Ud,qd,$d,zd,Kd,Wd,Gd,Hd,Yd,Xd,Qd,Jd,Zd,Nd,th,eh,Ld],c:[Xi,Pd]}=VE(this,[PE("rui-field")],[[se({type:String,reflect:!0,defaultValue:""}),0,"name"],[se({type:Object}),0,"rules"],[se({type:Object}),0,"defaultValue"],[se({type:String,attribute:In}),0,"defaultValueData"],[se({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[se({type:String,defaultValue:""}),0,"error"],[se({type:Boolean,reflect:!0,defaultValue:!1}),0,"invalid"],[qE({context:Mn,initialValue:{name:"",controlId:"",descriptionId:"",errorId:"",error:void 0,invalid:!1,required:!1},hydrate:Object,serialize:t=>({...t,rules:$E(t.rules)})}),0,"fieldProvider"],[FE(we),0,"formContextProvider"],[UE({context:we,requestUpdate:!1}),2,"onFormContextChanged"],[jn(["name"]),2,"onNameUpdated"],[jn(["rules","defaultValue","defaultValueData"]),2,"onRulesUpdated"],[jn(["disabled","error","invalid"]),2,"onPresentationUpdated"],[Yi({selector:"[data-rui-control], rui-combobox, rui-date-field, rui-date-range-picker, rui-checkbox, rui-switch, rui-radio-group, rui-slider, rui-number-field, rui-listbox",type:"rui-change"}),2,"onControlChange"],[Yi({selector:"[data-rui-control], input, textarea",type:"input",options:{capture:!0}}),2,"onControlInput"],[Yi({selector:"[data-rui-control], input, textarea",type:"change",options:{capture:!0}}),2,"onControlNativeChange"],[Yi({selector:"[data-rui-control], input, textarea",type:"focusout"}),2,"onControlFocusOut"]],0,void 0,nh))}name=(Ld(this),Bd(this));rules=(Fd(this),Ud(this));defaultValue=(qd(this),$d(this));defaultValueData=(zd(this),Kd(this));disabled=(Wd(this),Gd(this));error=(Hd(this),Yd(this));invalid=(Xd(this),Qd(this));fieldProvider=(Jd(this),Zd(this));formContextProvider=(Nd(this),th(this));uid=(eh(this),Math.random().toString(36).slice(2,9));resolveFieldName(){return(this.name||this.getAttribute("name")||"").trim()}unregister;unregisterPresentation;registeredWithForm=!1;constructor(){super(),BE(this,()=>this.fieldProvider.setContext({rules:this.readFieldRules()}))}connectedCallback(){super.connectedCallback(),this.connectToForm(),queueMicrotask(()=>{this.connectToForm()})}disconnectedCallback(){this.unregister?.(),this.unregister=void 0,this.unregisterPresentation?.(),this.unregisterPresentation=void 0,this.registeredWithForm=!1,super.disconnectedCallback()}get currentFormContext(){return this.formContextProvider?.getContext()}parseJsonAttr(t){if(t)try{return JSON.parse(t)}catch{return}}readFieldRules(){let t=this.rules;return t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length>0?t:this.fieldProvider.getContext()?.rules}readDefaultValue(){return this.defaultValue!==void 0?this.defaultValue:this.parseJsonAttr(this.defaultValueData??this.getAttribute(In))}isRequired(){return!!this.readFieldRules()?.required}resolveErrorMessage(t){if(this.error)return this.error;let i=this.resolveFieldName();return i?(t??this.currentFormContext)?.fields[i]?.error:void 0}resolveInvalid(t){if(this.invalid||this.error)return!0;let i=this.resolveFieldName();return i?(t??this.currentFormContext)?.fields[i]?.invalid??!1:!1}connectToForm(){let t=this.resolveFieldName(),i=this.currentFormContext,r=i?.actions;if(!i?.ready||!r||!t){this.syncField();return}if(!this.registeredWithForm){this.registeredWithForm=!0,this.unregisterPresentation?.(),this.unregisterPresentation=r.subscribePresentation(c=>this.syncField(c)),this.unregister=r.register({name:t,rules:this.readFieldRules(),getRules:()=>this.readFieldRules(),defaultValue:this.readDefaultValue(),getValue:()=>{let c=Ke(this);return c?kn(c):void 0},setValue:c=>{let p=Ke(this);p&&On(p,c)}});return}r.updateFieldOptions(t,{rules:this.readFieldRules(),defaultValue:this.readDefaultValue()}),this.syncField()}onFormContextChanged(t){if(!this.registeredWithForm){t.ready?this.connectToForm():this.syncField(t);return}this.syncField(t)}onNameUpdated(){this.unregister?.(),this.unregister=void 0,this.unregisterPresentation?.(),this.unregisterPresentation=void 0,this.registeredWithForm=!1,this.connectToForm()}onRulesUpdated(){this.connectToForm()}onPresentationUpdated(){this.syncField()}onControlChange(){let t=this.resolveFieldName();t&&this.currentFormContext?.actions.handleFieldChange(t)}onControlInput(){let t=this.resolveFieldName();t&&this.currentFormContext?.actions.handleFieldChange(t)}onControlNativeChange(){let t=this.resolveFieldName();t&&this.currentFormContext?.actions.handleFieldChange(t)}onControlFocusOut(){let t=this.resolveFieldName();t&&this.currentFormContext?.actions.handleFieldBlur(t)}syncField(t){let i=Ke(this),r=i?jd(i):null,c=r?.id||`rui-field-control-${this.uid}`,p=`rui-field-desc-${this.uid}`,h=`rui-field-error-${this.uid}`,a=this.resolveErrorMessage(t),E=this.resolveInvalid(t),C=this.isRequired(),R=this.resolveFieldName();if(Md(i,r,R),r){r.id||(r.id=c),r.setAttribute(An,""),r.setAttribute("aria-invalid",E?"true":"false"),this.isRequired()?r.setAttribute("aria-required","true"):r.removeAttribute("aria-required");let $=[],L=Od(this);L&&(L.id=p,$.push(p));let W=Vd(this);W&&(W.id=h,a&&$.push(h)),$.length>0?r.setAttribute("aria-describedby",$.join(" ")):r.removeAttribute("aria-describedby"),this.disabled&&(r.setAttribute("aria-disabled","true"),(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)&&(r.disabled=!0))}let D=kd(this);D&&r&&(D.htmlFor=r.id);for(let $ of Vn(this))$.textContent=a??"",a?($.hidden=!1,$.removeAttribute("hidden")):$.hidden=!0;let T={name:R,controlId:r?.id??c,descriptionId:p,errorId:h,error:a,invalid:E,required:C},z=this.fieldProvider.getContext();z.name===T.name&&z.controlId===T.controlId&&z.descriptionId===T.descriptionId&&z.errorId===T.errorId&&z.error===T.error&&z.invalid===T.invalid&&z.required===T.required||this.fieldProvider.setContext(T)}render(){return rh("div",{class:"rui-field",children:rh("slot",{})})}static{Pd()}};var KE=rt(Xi,({children:e,rules:t,defaultValue:i,defaultValueData:r,...c})=>zE("rui-field",{...c,"prop:rules":t,"prop:defaultValue":i,"attr:data-default-value":r??(i!==void 0?JSON.stringify(i):void 0),children:e}),{stylesheets:["./field.css"]});import{jsx as WE}from"@ecopages/jsx/jsx-runtime";function GE({children:e,class:t,...i}){return WE("p",{...i,[Hi]:"",class:K("rui-field__description",t),children:e})}import{jsx as HE}from"@ecopages/jsx/jsx-runtime";function YE({class:e,...t}){return HE("p",{...t,[xe]:"",class:K("rui-field__error",e),role:"alert",hidden:!0})}import{jsx as rT}from"@ecopages/jsx/jsx-runtime";import{jsx as Ah}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ih,customElement as tT,event as Dh,onEvent as Pn,onUpdated as Ch,prop as He}from"@ecopages/radiant";import{provideContext as eT}from"@ecopages/radiant/context";function We(e,t){if(!(t===void 0||t===!1))return typeof t=="string"?t:typeof t=="object"&&t!==null&&"message"in t&&typeof t.message=="string"?t.message:e}function Ft(e){return typeof e=="object"&&e!==null&&"value"in e?e.value:e}async function XE(e,t,i,r){if(!i)return;if(i.required&&(t==null||t===""||Array.isArray(t)&&t.length===0||t===!1))return We("This field is required",i.required)??"This field is required";if(typeof t=="number"||typeof t=="string"&&t!==""&&!Number.isNaN(Number(t))){let p=typeof t=="number"?t:Number(t);if(i.min!==void 0&&p<Ft(i.min))return We(`Minimum value is ${Ft(i.min)}`,i.min);if(i.max!==void 0&&p>Ft(i.max))return We(`Maximum value is ${Ft(i.max)}`,i.max)}let c=t==null?"":String(t);if(i.minLength!==void 0&&c.length<Ft(i.minLength))return We(`Minimum length is ${Ft(i.minLength)}`,i.minLength);if(i.maxLength!==void 0&&c.length>Ft(i.maxLength))return We(`Maximum length is ${Ft(i.maxLength)}`,i.maxLength);if(i.pattern!==void 0&&!Ft(i.pattern).test(c)){let h=i.pattern;return typeof h=="object"&&"message"in h&&typeof h.message=="string"?h.message:"Invalid format"}if(i.validate){if(typeof i.validate=="function"){let p=await i.validate(t,r);return p===!0||p===void 0?void 0:p===!1?"Invalid value":String(p)}for(let p of Object.keys(i.validate)){let h=i.validate[p],a=await h(t,r);if(a!==!0&&a!==void 0)return a===!1?"Invalid value":String(a)}}}async function ah(e,t,i){let r=i??Object.keys(t.fields),c={};for(let p of r){let h=t.fields[p]?.rules,a=await XE(p,e[p],h,e);a&&(c[p]={type:"validation",message:a})}return Object.keys(c).length>0?{values:{},errors:c}:{values:e,errors:{}}}function Ln(){return(e,t,i)=>ah(e,t,i.names)}function sh(e){return typeof e=="function"?e:Ln()}var Ge=class{mode;reValidateMode;resolver;fields=new Map;listeners=new Set;revision=0;defaultValues;values;errors={};touched={};dirty={};isSubmitting=!1;isSubmitted=!1;constructor(t={}){this.mode=t.mode??"onSubmit",this.reValidateMode=t.reValidateMode??"onChange",this.resolver=sh(t.resolver),this.defaultValues={...t.defaultValues??{}},this.values={...this.defaultValues,...t.values??{}}}updateOptions(t){t.mode!==void 0&&(this.mode=t.mode),t.reValidateMode!==void 0&&(this.reValidateMode=t.reValidateMode),t.resolver!==void 0&&(this.resolver=sh(t.resolver)),t.defaultValues!==void 0&&(this.defaultValues={...t.defaultValues})}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(){this.revision+=1;for(let t of this.listeners)t()}getRevision(){return this.revision}getRegisteredFieldNames(){return Array.from(this.fields.keys())}register(t){let i=this.fields.get(t.name),r={...t,rules:t.rules??i?.rules,defaultValue:t.defaultValue??i?.defaultValue,getRules:t.getRules??i?.getRules};return this.fields.set(t.name,r),this.values[t.name]===void 0&&r.defaultValue!==void 0&&(this.values={...this.values,[t.name]:r.defaultValue}),r.setValue(this.values[t.name]),()=>{this.fields.get(t.name)===r&&(this.fields.delete(t.name),this.notify())}}updateFieldOptions(t,i){let r=this.fields.get(t);r&&(i.rules!==void 0&&(r.rules=i.rules),i.defaultValue!==void 0&&(r.defaultValue=i.defaultValue))}getValues(){let t={...this.values};for(let[i,r]of this.fields)t[i]=r.getValue();return t}setValue(t,i,r){this.values={...this.values,[t]:i},this.fields.get(String(t))?.setValue(i),r?.shouldDirty&&(this.dirty={...this.dirty,[t]:!0}),r?.shouldTouch&&(this.touched={...this.touched,[t]:!0}),this.notify()}markTouched(t){this.touched={...this.touched,[t]:!0},this.notify()}markDirty(t){this.dirty={...this.dirty,[t]:!0},this.notify()}clearErrors(t){if(t){let i={...this.errors};delete i[t],this.errors=i,this.notify();return}this.errors={},this.notify()}getFieldError(t){return this.errors[t]?.message}getState(){let t=this.getValues(),i=Object.keys(this.errors).length;return{values:t,errors:this.errors,touched:this.touched,dirty:this.dirty,isSubmitting:this.isSubmitting,isSubmitted:this.isSubmitted,isValid:i===0}}async validateField(t){let i=this.getValues(),c=(await this.resolver(i,{fields:this.buildResolverFields()},{names:[t]})).errors[t]?.message,p={...this.errors};return c?p[t]={type:"validation",message:c}:delete p[t],this.errors=p,this.notify(),!c}async validateAll(){let t=this.getValues(),i=await this.resolver(t,{fields:this.buildResolverFields()},{});return this.errors=i.errors,this.notify(),Object.keys(this.errors).length===0}shouldValidate(t,i){switch(this.isSubmitted?this.reValidateMode:this.mode){case"all":return!0;case"onChange":return i==="change";case"onBlur":return i==="blur";case"onTouched":return i==="blur"&&!!this.touched[t];case"onSubmit":return!1;default:return!1}}async handleFieldChange(t){let i=this.fields.get(t);if(!i)return;let r=i.getValue();this.values={...this.values,[t]:r},this.dirty={...this.dirty,[t]:!0},this.shouldValidate(t,"change")?await this.validateField(t):this.notify()}async handleFieldBlur(t){this.markTouched(t),this.shouldValidate(t,"blur")?await this.validateField(t):this.notify()}shouldDisplayFieldError(t){if(!this.errors[t]?.message)return!1;if(this.isSubmitted)return!0;switch(this.mode){case"all":return!!(this.dirty[t]||this.touched[t]);case"onChange":return!!this.dirty[t];case"onBlur":case"onTouched":return!!this.touched[t];default:return!1}}async handleSubmit(t,i){this.isSubmitting=!0,this.isSubmitted=!0;for(let c of this.fields.keys())this.touched={...this.touched,[c]:!0};this.notify();let r=await this.validateAll();if(this.isSubmitting=!1,this.notify(),r){await t(this.getValues());return}i?.(this.errors)}reset(t){let i=t??{...this.defaultValues,...this.collectFieldDefaults()};this.values={...i},this.errors={},this.touched={},this.dirty={},this.isSubmitted=!1,this.isSubmitting=!1;for(let r of this.fields.values())r.setValue(this.values[r.name]);this.notify()}collectFieldDefaults(){let t={};for(let[i,r]of this.fields)r.defaultValue!==void 0&&(t[i]=r.defaultValue);return t}buildResolverFields(){let t={};for(let[i,r]of this.fields){let c=r.getRules?.()??r.rules;t[i]={rules:c}}return t}};var lh,uh,ch,dh,hh,ph,fh,mh,gh,bh,vh,yh,_h,xh,wh,Sh,Eh,Th;function QE(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Rh(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Rh(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:JE(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return NE(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function JE(e){var t=ZE(e,"string");return typeof t=="symbol"?t:t+""}function ZE(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rh(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function NE(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var kh=()=>{},iT={register:()=>kh,updateFieldOptions:()=>{},handleFieldChange:()=>{},handleFieldBlur:()=>{},subscribePresentation:()=>kh},Qi,Oh=class extends Ih{static{({e:[ch,dh,hh,ph,fh,mh,gh,bh,vh,yh,_h,xh,wh,Sh,Eh,Th,lh],c:[Qi,uh]}=QE(this,[tT("rui-form")],[[eT({context:we,initialValue:{ready:!1,revision:0,fields:{},actions:iT}}),0,"formProvider"],[Dh({name:"rui-submit",bubbles:!0,composed:!0}),0,"submitEvent"],[Dh({name:"rui-invalid",bubbles:!0,composed:!0}),0,"invalidEvent"],[He({type:Object,defaultValue:{}}),0,"defaultValues"],[He({type:String,attribute:Dn}),0,"defaultValuesData"],[He({type:Object}),0,"resolver"],[He({type:String,reflect:!0,defaultValue:"onSubmit"}),0,"mode"],[He({type:String,reflect:!0,attribute:"revalidate-mode",defaultValue:"onChange"}),0,"reValidateMode"],[Ch(["defaultValues","defaultValuesData","mode","reValidateMode"]),2,"syncOptions"],[Ch(["resolver"]),2,"syncResolver"],[Pn({selector:"button[type=submit]",type:"click"}),2,"onSubmitButtonClick"],[Pn({ref:"form",type:"submit"}),2,"onNativeSubmit"],[Pn({ref:"form",type:"reset"}),2,"onNativeReset"]],0,void 0,Ih))}formProvider=(lh(this),ch(this));submitEvent=(dh(this),hh(this));invalidEvent=(ph(this),fh(this));defaultValues=(mh(this),gh(this));defaultValuesData=(bh(this),vh(this));resolver=(yh(this),_h(this));mode=(xh(this),wh(this));reValidateMode=(Sh(this),Eh(this));store=void Th(this);unsubscribeStore;nativeFormId=`rui-form-native-${Math.random().toString(36).slice(2,9)}`;lastPublishedRevision=-1;lastPublishedContext;presentationListeners=new Set;formActions={register:t=>{let r=this.ensureStore().register(t);return this.publishFormContext({force:!0}),()=>{r(),this.publishFormContext({force:!0})}},updateFieldOptions:(t,i)=>{this.ensureStore().updateFieldOptions(t,i)},handleFieldChange:t=>{this.ensureStore().handleFieldChange(t).then(()=>this.publishFormContext({force:!0}))},handleFieldBlur:t=>{this.ensureStore().handleFieldBlur(t).then(()=>this.publishFormContext({force:!0}))},subscribePresentation:t=>(this.presentationListeners.add(t),this.lastPublishedContext&&t(this.lastPublishedContext),()=>this.presentationListeners.delete(t))};connectedCallback(){super.connectedCallback(),this.ensureStore(),this.publishFormContext({force:!0}),queueMicrotask(()=>this.wireOrphanSubmitButtons())}queryNativeForm(){return this.getRef("form")??this.querySelector("form.rui-form")}wireOrphanSubmitButtons(){let t=this.queryNativeForm();if(t){t.id||(t.id=this.nativeFormId);for(let i of this.querySelectorAll("button[type=submit]"))t.contains(i)||i.setAttribute("form",t.id)}}runFormSubmit(){this.ensureStore().handleSubmit(i=>{this.submitEvent.emit({values:i})},i=>{this.invalidEvent.emit({errors:i})})}disconnectedCallback(){this.unsubscribeStore?.(),this.unsubscribeStore=void 0,super.disconnectedCallback()}resolveMode(){let t=this.getAttribute("mode");return t||(this.mode??"onSubmit")}resolveReValidateMode(){let t=this.getAttribute("revalidate-mode");return t||(this.reValidateMode??"onChange")}resolveDefaultValues(){if(this.defaultValues&&Object.keys(this.defaultValues).length>0)return this.defaultValues;let t=this.defaultValuesData??this.getAttribute(Dn);if(!t)return this.defaultValues??{};try{let i=JSON.parse(t);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return this.defaultValues??{}}}ensureStore(){return this.store?this.store:(this.store=new Ge({defaultValues:this.resolveDefaultValues(),resolver:typeof this.resolver=="function"?this.resolver:void 0,mode:this.resolveMode(),reValidateMode:this.resolveReValidateMode()}),this.unsubscribeStore=this.store.subscribe(()=>this.publishFormContext()),this.store)}buildFieldPresentations(t){let i={};for(let r of t.getRegisteredFieldNames()){let c=t.getFieldError(r),p=t.shouldDisplayFieldError(r);i[r]={error:p?c:void 0,invalid:!!(p&&c)}}return i}publishFormContext(t){let i=this.store;if(!i)return;let r=i.getRevision();if(!t?.force&&r===this.lastPublishedRevision)return;this.lastPublishedRevision=r;let c={ready:!0,revision:r,fields:this.buildFieldPresentations(i),actions:this.formActions};this.lastPublishedContext=c,this.formProvider.setContext(c);for(let p of this.presentationListeners)p(c)}syncOptions(){this.ensureStore().updateOptions({defaultValues:this.resolveDefaultValues(),mode:this.resolveMode(),reValidateMode:this.resolveReValidateMode()})}syncResolver(){typeof this.resolver=="function"&&this.ensureStore().updateOptions({resolver:this.resolver})}onSubmitButtonClick(t){t.preventDefault(),this.runFormSubmit()}onNativeSubmit(t){t.preventDefault(),this.runFormSubmit()}onNativeReset(){this.store?.reset()}render(){return Ah("form",{class:"rui-form","data-ref":"form",noValidate:!0,children:Ah("slot",{})})}static{uh()}};var nT=rt(Qi,({children:e,defaultValues:t,defaultValuesData:i,resolver:r,reValidateMode:c,...p})=>rT("rui-form",{...p,reValidateMode:c,"attr:revalidate-mode":c,"prop:defaultValues":t,"prop:resolver":r,"attr:data-default-values":i??(t!==void 0?JSON.stringify(t):void 0),children:e}),{stylesheets:["./form.css"]});import{jsx as Bh}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Fh,customElement as uT,onEvent as cT,prop as dT}from"@ecopages/radiant";var Vh,Mh,jh,Lh;function oT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Ph(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Ph(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:aT(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return lT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function aT(e){var t=sT(e,"string");return typeof t=="symbol"?t:t+""}function sT(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ph(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function lT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ji,Uh=class extends Fh{static{({e:[jh,Lh,Vh],c:[Ji,Mh]}=oT(this,[uT("rui-grid")],[[dT({type:String,defaultValue:""}),0,"label"],[cT({selector:'[role="gridcell"]',type:"keydown"}),2,"onKeydown"]],0,void 0,Fh))}label=(Vh(this),jh(this));resolvedAriaLabel=(Lh(this),this.$.label.map(t=>t||void 0));connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{let t=Array.from(this.querySelectorAll('[role="gridcell"]'));lt(t,0)})}getRows(){return Array.from(this.querySelectorAll('[role="row"]'))}onKeydown(t){let i=this.getRows(),r=t.target.closest('[role="gridcell"]');if(!r)return;let c=r.parentElement,p=i.indexOf(c),h=Array.from(c.querySelectorAll('[role="gridcell"]')),a=h.indexOf(r),E=p,C=a;switch(t.key){case"ArrowRight":C=Math.min(h.length-1,a+1);break;case"ArrowLeft":C=Math.max(0,a-1);break;case"ArrowDown":E=Math.min(i.length-1,p+1);break;case"ArrowUp":E=Math.max(0,p-1);break;case"Home":C=0;break;case"End":C=h.length-1;break;default:return}t.preventDefault();let R=i[E],D=Array.from(R.querySelectorAll('[role="gridcell"]')),T=D[Math.min(C,D.length-1)],z=Array.from(this.querySelectorAll('[role="gridcell"]'));lt(z,z.indexOf(T)),T.focus()}render(){return Bh("div",{class:"rui-grid",role:"grid","aria-label":this.resolvedAriaLabel,children:Bh("slot",{})})}static{Mh()}};import{jsx as Bn}from"@ecopages/jsx/jsx-runtime";var hT=rt(Ji,({rows:e,...t})=>Bn("rui-grid",{...t,children:e.map(i=>Bn("div",{class:"rui-grid__row",role:"row",children:i.map(r=>Bn("div",{class:"rui-grid__cell",role:"gridcell",tabindex:-1,children:r}))}))}),{stylesheets:["./grid.css"]});import{jsx as tr}from"@ecopages/jsx/jsx-runtime";import{jsx as pT}from"@ecopages/jsx/jsx-runtime";function Zi({as:e,children:t,...i}){return pT(e??"div",{...i,children:t})}import{jsx as fT}from"@ecopages/jsx/jsx-runtime";function Ni({children:e,as:t="h2",size:i="md",class:r,...c}){return fT(Zi,{as:t,...c,class:K("rui-headline",i!==!1&&`rui-headline--size-${i}`,r),children:e})}nt(Ni,["./headline.css"],import.meta.url);function mT(e,t,i){return K("rui-heading",`rui-heading--align-${e}`,`rui-heading--size-${t}`,i)}function qh({children:e,as:t="div",align:i="start",size:r="md",class:c,...p}){return tr(Zi,{as:t,...p,class:mT(i,r,c),children:e})}function gT({children:e,class:t,...i}){return tr("p",{...i,class:K("rui-heading__eyebrow",t),children:e})}function bT({children:e,as:t="h2",class:i,...r}){return tr(Ni,{as:t,size:!1,class:K("rui-heading__title",i),...r,children:e})}function vT({children:e,class:t,...i}){return tr("p",{...i,class:K("rui-heading__description",t),children:e})}nt(qh,["./heading.css","../headline/headline.css"],import.meta.url);import{jsx as yT}from"@ecopages/jsx/jsx-runtime";function $h(e){let{size:t="md",class:i,type:r="text",mask:c,placeholder:p,"on:input":h,...a}=e,E=c?on(c):p;return yT("input",{...a,type:r,placeholder:E,...c?{"on:input":R=>{if(c){let D=R.target;D.value=De(D.value,c)}h?.(R)}}:h?{"on:input":h}:{},inputmode:c?"numeric":void 0,[Tt]:"","data-rui-control-type":"text",class:K("rui-input",`rui-input--${t}`,i)})}nt($h,["./input.css"],import.meta.url);import{jsx as _T}from"@ecopages/jsx/jsx-runtime";function zh({children:e,htmlFor:t,class:i,...r}){return _T("label",{...r,[Gi]:"",class:K("rui-label",i),htmlFor:t,children:e})}nt(zh,["./label.css"],import.meta.url);import{jsx as er,jsxs as op}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ap,bound as TT,customElement as RT,event as sp,onEvent as Ye,onUpdated as AT,prop as lp,query as up}from"@ecopages/radiant";var Kh,Wh,Gh,Hh,Yh,Xh,Qh,Jh,Zh,Nh,tp,ep,ip,rp;function xT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:np(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||np(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:wT(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return ET(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function wT(e){var t=ST(e,"string");return typeof t=="symbol"?t:t+""}function ST(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function np(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function ET(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var IT=6,ir,cp=class extends ap{static{({e:[Gh,Hh,Yh,Xh,Qh,Jh,Zh,Nh,tp,ep,ip,rp,Kh],c:[ir,Wh]}=xT(this,[RT("rui-menu-button")],[[lp({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[lp({type:String,defaultValue:"bottom-start"}),0,"placement"],[up({ref:"trigger"}),0,"triggerTarget"],[up({ref:"menu"}),0,"menuTarget"],[sp({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[sp({name:"rui-close",bubbles:!0,composed:!0}),0,"closeEvent"],[[TT,AT(["open","placement"])],2,"syncOpenState"],[Ye({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"],[Ye({ref:"trigger",type:"click"}),2,"onTriggerClick"],[Ye({ref:"trigger",type:"keydown"}),2,"onTriggerKeydown"],[Ye({ref:"menu",type:"keydown"}),2,"onMenuKeydown"],[Ye({selector:'[role="menuitem"]',type:"click"}),2,"onItemClick"]],0,void 0,ap))}open=(Kh(this),Gh(this));placement=(Hh(this),Yh(this));triggerTarget=(Xh(this),Qh(this));menuTarget=(Jh(this),Zh(this));changeEvent=(Nh(this),tp(this));closeEvent=(ep(this),ip(this));menuId=(rp(this),`rui-menu-${Math.random().toString(36).slice(2,9)}`);popoverController=null;pendingFocus=null;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncOpenState())}disconnectedCallback(){this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}getItems(){return Array.from(this.menuTarget?.querySelectorAll('[role="menuitem"]')??[]).filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}ensurePopoverController(){return this.popoverController||(this.popoverController=new pt({getAnchor:()=>this.triggerTarget,getFloating:()=>this.menuTarget,getOpen:()=>this.open,getPlacement:()=>this.placement,gap:IT,portal:!1})),this.popoverController}syncOpenState(){if(!this.triggerTarget||!this.menuTarget)return;this.menuTarget.id=this.menuId,this.triggerTarget.setAttribute("aria-controls",this.menuId),this.triggerTarget.setAttribute("aria-haspopup","menu"),this.triggerTarget.setAttribute("aria-expanded",String(this.open)),this.menuTarget.hidden=!this.open;let t=this.ensurePopoverController();t.updateConfig({getPlacement:()=>this.placement,getOpen:()=>this.open}),t.sync();let i=this.pendingFocus;if(this.pendingFocus=null,!!i){if(i==="first"&&this.getItems()[0]?.focus(),i==="last"){let r=this.getItems();r[r.length-1]?.focus()}i==="trigger"&&this.triggerTarget?.focus()}}setOpen(t,i=null){let r=this.open;this.pendingFocus=i,this.open=t,r&&!t&&this.closeEvent.emit(),r===t&&this.syncOpenState()}onDocumentPointerDown(t){if(!this.open)return;let i=t.target;Gt(this.triggerTarget,this.menuTarget,i)&&this.setOpen(!1)}onTriggerClick(){this.setOpen(!this.open,this.open?null:"first")}onTriggerKeydown(t){switch(t.key){case"ArrowDown":case"Enter":case" ":t.preventDefault(),this.setOpen(!0,"first");break;case"ArrowUp":t.preventDefault(),this.setOpen(!0,"last");break;default:break}}onMenuKeydown(t){let i=this.getItems(),r=document.activeElement,c=r?i.indexOf(r):-1;switch(t.key){case"ArrowDown":{t.preventDefault(),i[(c+1)%i.length]?.focus();break}case"ArrowUp":{t.preventDefault(),i[(c-1+i.length)%i.length]?.focus();break}case"Home":t.preventDefault(),i[0]?.focus();break;case"End":t.preventDefault(),i[i.length-1]?.focus();break;case"Escape":t.preventDefault(),this.setOpen(!1,"trigger");break;case"Tab":this.setOpen(!1);break;case"Enter":case" ":r&&i.includes(r)&&(t.preventDefault(),this.activateItem(r));break;default:break}}onItemClick(t){let i=t.target.closest('[role="menuitem"]');!i||!this.contains(i)||this.activateItem(i)}activateItem(t){let i=t.getAttribute("data-value")||t.textContent?.trim()||"";this.changeEvent.emit({value:i}),this.setOpen(!1,"trigger")}render(){return op("div",{class:"rui-menu-button",children:[op("button",{type:"button","data-ref":"trigger",class:"rui-button rui-button--primary rui-button--md rui-menu-button__trigger","aria-haspopup":"menu","aria-expanded":"false",children:[er("slot",{name:"trigger"}),er("span",{class:"rui-menu-button__chevron","aria-hidden":"true"})]}),er("div",{"data-ref":"menu",class:"rui-menu-button__menu rui-popover rui-floating",role:"menu",hidden:!0,children:er("slot",{})})]})}static{Wh()}};import{jsx as dp,jsxs as DT}from"@ecopages/jsx/jsx-runtime";var CT=rt(ir,({trigger:e,items:t,...i})=>DT("rui-menu-button",{...i,children:[dp("span",{slot:"trigger",children:e}),t.map(r=>dp("button",{type:"button",class:"rui-menu-button__item",role:"menuitem","data-value":r.value,"aria-disabled":r.disabled?"true":void 0,tabindex:-1,children:r.label}))]}),{stylesheets:["./menu-button.css"]});import{jsx as yp}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as _p,customElement as jT,event as LT,onEvent as Xe,prop as PT}from"@ecopages/radiant";var hp,pp,fp,mp,gp,bp;function kT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:vp(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||vp(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:OT(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return MT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function OT(e){var t=VT(e,"string");return typeof t=="symbol"?t:t+""}function VT(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vp(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function MT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var rr,xp=class extends _p{static{({e:[fp,mp,gp,bp,hp],c:[rr,pp]}=kT(this,[jT("rui-menubar")],[[PT({type:String,defaultValue:""}),0,"label"],[LT({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Xe({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"],[Xe({selector:'[data-ref="menubar"] > [data-ref="menubar-root"] > [role="menuitem"]',type:"keydown"}),2,"onTopKeydown"],[Xe({selector:'[data-ref="menubar"] > [data-ref="menubar-root"] > [role="menuitem"]',type:"click"}),2,"onTopClick"],[Xe({selector:'[role="menu"] > [role="menuitem"]',type:"keydown"}),2,"onMenuKeydown"],[Xe({selector:'[role="menu"] > [role="menuitem"]',type:"click"}),2,"onMenuItemClick"]],0,void 0,_p))}label=(hp(this),fp(this));changeEvent=(mp(this),gp(this));resolvedAriaLabel=(bp(this),this.$.label.map(t=>t||void 0));openRoot=null;popoverController=null;getTopItems(){return Array.from(this.querySelectorAll('[data-ref="menubar"] > [data-ref="menubar-root"] > [role="menuitem"]'))}getMenuFor(t){return t.closest('[data-ref="menubar-root"]')?.querySelector(':scope > [role="menu"]')??null}getMenuItems(t){return Array.from(t.querySelectorAll(':scope > [role="menuitem"]')).filter(i=>i.getAttribute("aria-disabled")!=="true")}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>lt(this.getTopItems(),0))}disconnectedCallback(){this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}getOpenMenuAnchor(){return this.openRoot?this.openRoot.querySelector(':scope > [role="menuitem"]'):null}getOpenMenuSurface(){return this.openRoot?this.openRoot.querySelector(':scope > [role="menu"]'):null}syncOpenMenuPosition(){let t=this.getOpenMenuAnchor(),i=this.getOpenMenuSurface();!t||!i||(this.popoverController||(this.popoverController=new pt({getAnchor:()=>this.getOpenMenuAnchor(),getFloating:()=>this.getOpenMenuSurface(),getOpen:()=>!!this.openRoot,getPlacement:()=>"bottom-start",gap:6,portal:!1})),this.popoverController.updateConfig({getAnchor:()=>this.getOpenMenuAnchor(),getFloating:()=>this.getOpenMenuSurface(),getOpen:()=>!!this.openRoot}),this.popoverController.sync())}closeOpenMenu(t=!1){if(!this.openRoot)return;let i=this.openRoot.querySelector(':scope > [role="menuitem"]'),r=this.openRoot.querySelector(':scope > [role="menu"]');i&&i.setAttribute("aria-expanded","false"),r&&(r.hidden=!0),this.openRoot=null,this.popoverController?.teardown(),t&&i&&i.focus()}openMenu(t,i="first"){let r=t.closest('[data-ref="menubar-root"]'),c=this.getMenuFor(t);if(!(!r||!c)&&(this.openRoot&&this.openRoot!==r&&this.closeOpenMenu(),t.setAttribute("aria-expanded","true"),c.hidden=!1,this.openRoot=r,this.syncOpenMenuPosition(),i==="first")){let p=this.getMenuItems(c);lt(p,0),p[0]?.focus()}}onDocumentPointerDown(t){this.openRoot&&Gt(this.getOpenMenuAnchor(),this.getOpenMenuSurface(),t.target)&&this.closeOpenMenu()}onTopKeydown(t){let i=this.getTopItems(),r=t.target.closest('[role="menuitem"]');if(!r||!i.includes(r))return;if(t.key==="ArrowDown"||t.key==="Enter"||t.key===" "){this.getMenuFor(r)&&(t.preventDefault(),this.openMenu(r,"first"));return}if(t.key==="Escape"){t.preventDefault(),this.closeOpenMenu(!0);return}let c=st({items:i,current:r,key:t.key,orientation:"horizontal"});c.handled&&(t.preventDefault(),this.openRoot&&(this.getMenuFor(c.item)?this.openMenu(c.item,"first"):this.closeOpenMenu()))}onTopClick(t){let i=t.target.closest('[role="menuitem"]');if(!i||!this.getTopItems().includes(i))return;if(!this.getMenuFor(i)){this.closeOpenMenu();return}i.getAttribute("aria-expanded")==="true"?this.closeOpenMenu():this.openMenu(i,"first")}onMenuKeydown(t){let i=t.target.closest('[role="menu"]'),r=t.target.closest('[role="menuitem"]');if(!i||!r||!this.contains(i))return;let c=this.getMenuItems(i);if(t.key==="Escape"){t.preventDefault(),this.closeOpenMenu(!0);return}if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.activateItem(r);return}if(t.key==="ArrowLeft"||t.key==="ArrowRight"){let h=this.getTopItems(),a=i.parentElement?.querySelector(':scope > [role="menuitem"]');if(!a)return;t.preventDefault();let E=st({items:h,current:a,key:t.key,orientation:"horizontal"});E.handled&&this.getMenuFor(E.item)&&this.openMenu(E.item,"first");return}st({items:c,current:r,key:t.key,orientation:"vertical"}).handled&&t.preventDefault()}onMenuItemClick(t){let i=t.target.closest('[role="menuitem"]');!i||!this.contains(i)||i.parentElement?.getAttribute("role")==="menu"&&this.activateItem(i)}activateItem(t){let i=t.getAttribute("data-value")||t.textContent?.trim()||"";this.changeEvent.emit({value:i}),this.closeOpenMenu(!0)}render(){return yp("div",{class:"rui-menubar","data-ref":"menubar",role:"menubar","aria-label":this.resolvedAriaLabel,children:yp("slot",{})})}static{pp()}};import{jsx as nr,jsxs as BT}from"@ecopages/jsx/jsx-runtime";var FT=rt(rr,({items:e,...t})=>nr("rui-menubar",{...t,children:e.map(i=>BT("div",{class:"rui-menubar__root","data-ref":"menubar-root",children:[nr("button",{type:"button",class:"rui-menubar__item",role:"menuitem",tabindex:-1,"aria-haspopup":i.items?.length?"true":void 0,"aria-expanded":i.items?.length?"false":void 0,children:i.label}),i.items?.length?nr("div",{class:"rui-menubar__menu rui-popover rui-floating",role:"menu",hidden:!0,children:i.items.map(r=>nr("button",{type:"button",class:"rui-menubar__menu-item",role:"menuitem","data-value":r.id,tabindex:-1,children:r.label}))}):null]}))}),{stylesheets:["./menubar.css"]});import{jsx as KT,jsxs as Fn}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as jp,customElement as WT,onUpdated as GT,prop as or,state as HT}from"@ecopages/radiant";var wp,Sp,Ep,Tp,Rp,Ap,Ip,Dp,Cp,kp,Op,Vp;function UT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Mp(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Mp(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:qT(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return zT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function qT(e){var t=$T(e,"string");return typeof t=="symbol"?t:t+""}function $T(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mp(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function zT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var ar,Lp=class extends jp{static{({e:[Ep,Tp,Rp,Ap,Ip,Dp,Cp,kp,Op,Vp,wp],c:[ar,Sp]}=UT(this,[WT("rui-meter")],[[or({type:Number,reflect:!0,defaultValue:0}),0,"value"],[or({type:Number,defaultValue:0}),0,"min"],[or({type:Number,defaultValue:100}),0,"max"],[or({type:String,defaultValue:""}),0,"label"],[HT,0,"percent"],[GT(["value","min","max"]),2,"onRangeUpdated"]],0,void 0,jp))}value=(wp(this),Ep(this));min=(Tp(this),Rp(this));max=(Ap(this),Ip(this));label=(Dp(this),Cp(this));percent=(kp(this),Op(this,0));resolvedAriaLabel=(Vp(this),this.$.label.map(t=>t||void 0));onRangeUpdated(){this.percent=this.max===this.min?0:Math.round((this.value-this.min)/(this.max-this.min)*100)}render(){return Fn("div",{class:"rui-meter",children:[this.label?KT("span",{class:"rui-meter__label",children:this.$.label}):null,Fn("meter",{class:"rui-meter__bar",min:this.$.min,max:this.$.max,value:this.$.value,"aria-label":this.resolvedAriaLabel,children:[this.$.percent,"%"]}),Fn("span",{class:"rui-meter__value","aria-hidden":"true",children:[this.$.percent,"%"]})]})}static{Sp()}};import{jsx as YT}from"@ecopages/jsx/jsx-runtime";var XT=rt(ar,e=>YT("rui-meter",{...e}),{stylesheets:["./meter.css"]});import{jsx as ur}from"@ecopages/jsx/jsx-runtime";import{jsx as sr,jsxs as tR}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as $p,customElement as eR,onEvent as Se,prop as iR}from"@ecopages/radiant";var Pp,Bp,Fp,Up;function QT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:qp(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||qp(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:JT(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return NT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function JT(e){var t=ZT(e,"string");return typeof t=="symbol"?t:t+""}function ZT(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qp(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function NT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var lr,zp=class extends $p{static{({e:[Fp,Up,Pp],c:[lr,Bp]}=QT(this,[eR("rui-navigation-menu")],[[iR({type:String,defaultValue:""}),0,"label"],[Se({document:!0,type:"click"}),2,"onDocumentClick"],[Se({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[Se({ref:"root",type:"keydown"}),2,"onRootKeydown"],[Se({selector:"[data-navigation-trigger]",type:"click"}),2,"onTriggerClick"],[Se({selector:"[data-navigation-item]",type:"keydown"}),2,"onBarItemKeydown"],[Se({selector:"[data-navigation-panel]",type:"keydown"}),2,"onPanelKeydown"]],0,void 0,$p))}label=(Pp(this),Fp(this));resolvedAriaLabel=(Up(this),this.$.label.map(t=>t||void 0));openValue=null;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncPanels(),this.syncBarRovingTabindex()})}getBarItems(){return Array.from(this.querySelectorAll("[data-navigation-item]"))}syncBarRovingTabindex(){let t=this.getBarItems(),i=Math.max(0,t.findIndex(r=>r.tabIndex===0||r===document.activeElement));lt(t,i)}isBarTrigger(t){return t.hasAttribute("data-navigation-trigger")}getTriggers(){return Array.from(this.querySelectorAll("[data-navigation-trigger]"))}getPanel(t){return this.querySelector(`[data-navigation-panel][data-value="${t}"]`)}getTrigger(t){return this.querySelector(`[data-navigation-trigger][data-value="${t}"]`)}getPanels(){return Array.from(this.querySelectorAll("[data-navigation-panel]"))}getPanelFocusables(t){return Li(t)}focusPanelEntry(t){let i=this.getPanel(t);if(!i){this.getTrigger(t)?.focus();return}let r=this.getPanelFocusables(i);if(r.length>0){r[0].focus();return}i.hasAttribute("tabindex")||(i.tabIndex=-1),i.focus()}syncPanels(){for(let t of this.getPanels()){let i=t.getAttribute("data-value")??"",r=this.openValue===i;t.hidden=!r,t.dataset.state=r?"open":"closed",t.setAttribute("aria-hidden",String(!r));let c=this.getTrigger(i);c&&(c.setAttribute("aria-expanded",String(r)),t.setAttribute("role","region"),t.setAttribute("aria-labelledby",c.id||`${i}-trigger`),c.id||(c.id=`${i}-trigger`))}for(let t of this.getTriggers()){let i=t.getAttribute("data-value")??"",r=this.openValue===i;t.setAttribute("aria-expanded",String(r)),this.getPanel(i)?t.setAttribute("aria-haspopup","true"):t.removeAttribute("aria-haspopup")}}closeMenu(t=!1){let i=this.openValue;i&&(this.openValue=null,this.syncPanels(),t&&this.getTrigger(i)?.focus())}openPanel(t,i=!0){if(this.openValue===t){this.closeMenu(!0);return}this.openValue=t,this.syncPanels(),queueMicrotask(()=>{i?this.focusPanelEntry(t):this.getTrigger(t)?.focus()})}getEventElement(t){let i=t.target;return i instanceof Element?i:i instanceof Text?i.parentElement:null}isWithinOpenPanel(t){if(!this.openValue)return!1;let i=this.getPanel(this.openValue);return i?t.composedPath().some(r=>r instanceof Node&&i.contains(r)):!1}onDocumentClick(t){if(!this.openValue||this.isWithinOpenPanel(t))return;let i=this.getEventElement(t);i&&this.contains(i)||this.closeMenu()}onDocumentKeydown(t){if(t.key!=="Escape"||!this.openValue)return;let i=document.activeElement;i&&!this.contains(i)||(t.preventDefault(),this.closeMenu(!0))}onRootKeydown(t){t.key==="Escape"&&this.openValue&&(t.preventDefault(),this.closeMenu(!0))}onTriggerClick(t){let i=t.target.closest("[data-navigation-trigger]"),r=i?.getAttribute("data-value");!i||!r||(t.preventDefault(),this.openPanel(r))}onBarItemKeydown(t){let i=t.target.closest("[data-navigation-item]");if(!i)return;let r=this.getBarItems(),c=this.isBarTrigger(i),p=i.getAttribute("data-value");if(t.key==="Escape"){this.openValue&&(t.preventDefault(),this.closeMenu(!0));return}if(c&&p&&(t.key==="Enter"||t.key===" ")){t.preventDefault(),this.openPanel(p);return}if(c&&p&&t.key==="ArrowDown"){t.preventDefault(),this.openValue===p?this.focusPanelEntry(p):this.openPanel(p);return}let h=st({items:r,current:i,key:t.key,orientation:"horizontal",wrap:!1});if(!h.handled)return;t.preventDefault();let a=h.item,E=a.getAttribute("data-value"),C=this.isBarTrigger(a);this.openValue&&(C&&E?this.openPanel(E):this.closeMenu(!1))}onPanelKeydown(t){let i=t.target;if(!(i instanceof Element))return;let r=i.closest("[data-navigation-panel]");if(!r||r.hidden)return;let c=r.getAttribute("data-value");if(!c||this.openValue!==c)return;let p=document.activeElement instanceof HTMLElement?document.activeElement:null;if(!p||!r.contains(p))return;if(t.key==="Escape"){t.preventDefault(),this.closeMenu(!0);return}let h=this.getPanelFocusables(r);if(t.key==="ArrowUp"&&p===h[0]){t.preventDefault(),this.getTrigger(c)?.focus();return}!h.length||!st({items:h,current:p,key:t.key,orientation:"vertical",wrap:!1}).handled||t.preventDefault()}render(){return tR("nav",{class:"rui-navigation-menu","data-ref":"root","aria-label":this.resolvedAriaLabel,children:[sr("div",{class:"rui-navigation-menu__bar",children:sr("slot",{name:"triggers"})}),sr("div",{class:"rui-navigation-menu__panels",children:sr("slot",{name:"panels"})})]})}static{Bp()}};var rR=rt(lr,({children:e,...t})=>ur("rui-navigation-menu",{...t,children:e}),{stylesheets:["./navigation-menu.css"]});function nR({children:e,slot:t="triggers",value:i,variant:r="ghost",...c}){return ur(Hr,{...c,slot:t,variant:r,"data-navigation-item":!0,"data-navigation-trigger":!0,"data-value":i,children:e})}function oR({children:e,slot:t="triggers",href:i,class:r,...c}){return ur("a",{...c,slot:t,href:i,"data-navigation-item":!0,class:K("rui-button","rui-button--ghost","rui-button--md",r),children:e})}function aR({children:e,slot:t="panels",value:i,class:r,...c}){return ur("div",{...c,slot:t,class:r,"data-navigation-panel":!0,"data-value":i,children:e})}import{jsx as Xt,jsxs as Cf}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as kf,customElement as hR,event as pR,onEvent as le,onUpdated as fR,prop as ht,state as Of}from"@ecopages/radiant";function Un(e,t){return new Intl.NumberFormat(e,t)}function qn(e,t,i){return Number.isFinite(e)?Un(t,i).format(e):""}function $n(e,t,i){let r=e.trim();if(!r)return null;let p=Un(t,i).formatToParts(1234.5),h=p.find(R=>R.type==="decimal")?.value??".",a=p.find(R=>R.type==="group")?.value??",",E=r.replaceAll(a,"").replace(h,".").replace(/[^\d.-]/g,""),C=Number(E);return Number.isFinite(C)?C:null}function zn(e){if(e)try{let t=JSON.parse(e);return sR(t)?(new Intl.NumberFormat(void 0,t),t):void 0}catch{return}}function sR(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Kn(e,t,i,r){let c=Math.round((e-t)/r)*r+t;return Math.min(i,Math.max(t,c))}var Kp,Wp,Gp,Hp,Yp,Xp,Qp,Jp,Zp,Np,tf,ef,rf,nf,of,af,sf,lf,uf,cf,df,hf,pf,ff,mf,gf,bf,vf,yf,_f,xf,wf,Sf,Ef,Tf,Rf,Af,If;function lR(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Df(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Df(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:uR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return dR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function uR(e){var t=cR(e,"string");return typeof t=="symbol"?t:t+""}function cR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Df(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function dR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var cr,Vf=class extends kf{static{({e:[Gp,Hp,Yp,Xp,Qp,Jp,Zp,Np,tf,ef,rf,nf,of,af,sf,lf,uf,cf,df,hf,pf,ff,mf,gf,bf,vf,yf,_f,xf,wf,Sf,Ef,Tf,Rf,Af,If,Kp],c:[cr,Wp]}=lR(this,[hR("rui-number-field")],[[ht({type:Number,reflect:!0}),0,"value"],[ht({type:Number,attribute:"default-value"}),0,"defaultValue"],[ht({type:Number,attribute:"min-value",defaultValue:Number.NEGATIVE_INFINITY}),0,"minValue"],[ht({type:Number,attribute:"max-value",defaultValue:Number.POSITIVE_INFINITY}),0,"maxValue"],[ht({type:Number,defaultValue:1}),0,"step"],[ht({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[ht({type:Boolean,attribute:"read-only",reflect:!0,defaultValue:!1}),0,"readOnly"],[ht({type:String,defaultValue:""}),0,"label"],[ht({type:String,defaultValue:""}),0,"name"],[ht({type:String,defaultValue:""}),0,"locale"],[ht({type:String,attribute:"format-options",defaultValue:""}),0,"formatOptions"],[ht({type:String,attribute:"commit-behavior",defaultValue:"snap"}),0,"commitBehavior"],[ht({type:String,attribute:"increment-aria-label",defaultValue:""}),0,"incrementAriaLabel"],[ht({type:String,attribute:"decrement-aria-label",defaultValue:""}),0,"decrementAriaLabel"],[ht({type:Boolean,attribute:"wheel-disabled",defaultValue:!1}),0,"wheelDisabled"],[pR({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Of,0,"decreaseDisabled"],[Of,0,"increaseDisabled"],[fR(["value","defaultValue","minValue","maxValue","step","label","disabled","readOnly","locale","formatOptions","commitBehavior"]),2,"onPropsUpdated"],[le({selector:'[data-number-field-action="decrement"]',type:"click"}),2,"decrement"],[le({selector:'[data-number-field-action="increment"]',type:"click"}),2,"increment"],[le({selector:"[data-number-field-input]",type:"focus"}),2,"onInputFocus"],[le({selector:"[data-number-field-input]",type:"blur"}),2,"onInputBlur"],[le({selector:"[data-number-field-input]",type:"input"}),2,"onInput"],[le({selector:"[data-number-field-input]",type:"keydown"}),2,"onKeydown"],[le({selector:"[data-number-field-input]",type:"wheel"}),2,"onWheel"]],0,void 0,kf))}value=(Kp(this),Gp(this));defaultValue=(Hp(this),Yp(this));minValue=(Xp(this),Qp(this));maxValue=(Jp(this),Zp(this));step=(Np(this),tf(this));disabled=(ef(this),rf(this));readOnly=(nf(this),of(this));label=(af(this),sf(this));name=(lf(this),uf(this));locale=(cf(this),df(this));formatOptions=(hf(this),pf(this));commitBehavior=(ff(this),mf(this));incrementAriaLabel=(gf(this),bf(this));decrementAriaLabel=(vf(this),yf(this));wheelDisabled=(_f(this),xf(this));changeEvent=(wf(this),Sf(this));decreaseDisabled=(Ef(this),Tf(this,!1));increaseDisabled=(Rf(this),Af(this,!1));editing=(If(this),!1);draftValue="";initialized=!1;uid=Math.random().toString(36).slice(2,9);nameAttr=this.$.name.map(t=>t||void 0);get resolvedLocale(){return It(this.locale)}get resolvedFormatOptions(){return zn(this.formatOptions)}get inputId(){return`rui-number-field-input-${this.uid}`}getNumericValue(){return typeof this.value=="number"&&Number.isFinite(this.value)?this.value:typeof this.defaultValue=="number"&&Number.isFinite(this.defaultValue)?this.defaultValue:0}getInput(){return this.querySelector("[data-number-field-input]")}getHiddenInput(){return this.querySelector("[data-number-field-value]")}syncLabel(){let t=this.getInput();Kt(this,t,{controlId:this.inputId,label:this.label,labelId:`rui-number-field-label-${this.uid}`})}syncInput(){let t=this.getInput(),i=this.getHiddenInput();if(!t)return;t.id||(t.id=this.inputId);let r=this.getNumericValue();t.setAttribute("role","spinbutton"),t.setAttribute("inputmode","decimal"),t.toggleAttribute("data-disabled",this.disabled),t.toggleAttribute("data-readonly",this.readOnly),Number.isFinite(this.minValue)?t.setAttribute("aria-valuemin",String(this.minValue)):t.removeAttribute("aria-valuemin"),Number.isFinite(this.maxValue)?t.setAttribute("aria-valuemax",String(this.maxValue)):t.removeAttribute("aria-valuemax"),t.setAttribute("aria-valuenow",String(r)),this.editing||(t.value=qn(r,this.resolvedLocale,this.resolvedFormatOptions)),i&&(i.value=String(r),this.name&&(i.name=this.name),i.disabled=this.disabled)}updateStepperState(){let t=this.getNumericValue();this.decreaseDisabled=this.disabled||this.readOnly||t<=this.minValue,this.increaseDisabled=this.disabled||this.readOnly||t>=this.maxValue,queueMicrotask(()=>this.syncSlottedSteppers())}syncSlottedSteppers(){for(let t of this.querySelectorAll('[data-number-field-action="decrement"]'))t.disabled=this.decreaseDisabled;for(let t of this.querySelectorAll('[data-number-field-action="increment"]'))t.disabled=this.increaseDisabled}commitValue(t,i=!1){let r=t;if((this.commitBehavior==="snap"||i)&&(r=Kn(t,this.minValue,this.maxValue,this.step)),r===this.getNumericValue()){this.editing=!1,this.syncInput(),this.updateStepperState();return}this.value=r,this.changeEvent.emit({value:r}),this.editing=!1,this.syncInput(),this.updateStepperState()}commitDraft(){let t=$n(this.draftValue,this.resolvedLocale,this.resolvedFormatOptions);if(t==null){this.editing=!1,this.syncInput();return}if(this.commitBehavior==="validate"&&(t<this.minValue||t>this.maxValue)){this.editing=!1,this.syncInput();return}this.commitValue(t)}initialize(){this.initialized||(this.initialized=!0,this.value==null&&this.defaultValue!=null&&(this.value=this.defaultValue),this.syncLabel(),this.syncInput(),this.updateStepperState())}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.updateStepperState()}decrement(t){t.preventDefault(),!this.decreaseDisabled&&this.commitValue(this.getNumericValue()-this.step,!0)}increment(t){t.preventDefault(),!this.increaseDisabled&&this.commitValue(this.getNumericValue()+this.step,!0)}onInputFocus(t){if(this.disabled||this.readOnly)return;let i=t.target;this.editing=!0,this.draftValue=String(this.getNumericValue()),i.value=this.draftValue,i.select()}onInputBlur(){this.editing&&this.commitDraft()}onInput(t){this.disabled||this.readOnly||(this.editing=!0,this.draftValue=t.target.value)}onKeydown(t){if(!(this.disabled||this.readOnly)){if(t.key==="ArrowUp"){t.preventDefault(),this.increment(t);return}if(t.key==="ArrowDown"){t.preventDefault(),this.decrement(t);return}if(t.key==="Home"&&Number.isFinite(this.minValue)){t.preventDefault(),this.commitValue(this.minValue,!0);return}if(t.key==="End"&&Number.isFinite(this.maxValue)){t.preventDefault(),this.commitValue(this.maxValue,!0);return}t.key==="Enter"&&(t.preventDefault(),this.commitDraft(),this.getInput()?.blur())}}onWheel(t){if(this.wheelDisabled||this.disabled||this.readOnly)return;let i=t.target;document.activeElement===i&&(t.preventDefault(),t.deltaY<0?this.increment(t):t.deltaY>0&&this.decrement(t))}render(){let t=this.incrementAriaLabel||"Increment",i=this.decrementAriaLabel||"Decrement";return Xt("div",{class:"rui-number-field",children:Xt("slot",{name:"group",children:Cf("div",{class:"rui-number-field__group","data-number-field-group":!0,children:[Cf("slot",{name:"input",children:[Xt("input",{type:"text","data-number-field-input":!0,"data-rui-control":!0,"data-rui-control-type":"number",class:"rui-number-field__input",disabled:this.$.disabled,readOnly:this.$.readOnly,name:this.nameAttr}),Xt("input",{type:"hidden","data-number-field-value":!0})]}),Xt("slot",{name:"decrement",children:Xt("button",{type:"button",class:"rui-number-field__stepper","data-number-field-action":"decrement","aria-label":i,disabled:this.$.decreaseDisabled,tabIndex:-1,children:"\u2212"})}),Xt("slot",{name:"increment",children:Xt("button",{type:"button",class:"rui-number-field__stepper","data-number-field-action":"increment","aria-label":t,disabled:this.$.increaseDisabled,tabIndex:-1,children:"+"})})]})})})}static{Wp()}};import{jsx as Qe}from"@ecopages/jsx/jsx-runtime";function mR({children:e,slot:t="group",class:i,...r}){return Qe("div",{...r,slot:t,"data-number-field-group":!0,class:K("rui-number-field__group",i),children:e})}function gR({slot:e="input",class:t,disabled:i,readOnly:r,...c}){return Qe("input",{...c,type:"text",slot:e,"data-number-field-input":!0,"data-rui-control":!0,"data-rui-control-type":"number",class:K("rui-number-field__input",t),disabled:i,readOnly:r})}function bR({children:e,slot:t="increment",class:i,"aria-label":r="Increment",disabled:c,...p}){return Qe("button",{...p,type:"button",slot:t,"data-number-field-action":"increment",class:K("rui-number-field__stepper",i),"aria-label":r,disabled:c,tabIndex:-1,children:e??"+"})}function vR({children:e,slot:t="decrement",class:i,"aria-label":r="Decrement",disabled:c,...p}){return Qe("button",{...p,type:"button",slot:t,"data-number-field-action":"decrement",class:K("rui-number-field__stepper",i),"aria-label":r,disabled:c,tabIndex:-1,children:e??"\u2212"})}var yR=rt(cr,({children:e,...t})=>Qe("rui-number-field",{...t,children:e}),{stylesheets:["./number-field.css"]});import{jsx as Yn,jsxs as mm}from"@ecopages/jsx/jsx-runtime";import{jsx as Je,jsxs as hm}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as dr,bound as Gn,customElement as pm,event as SR,onEvent as Ze,onUpdated as fm,prop as Qt,query as Hn}from"@ecopages/radiant";var Mf,jf,Lf,Pf,Bf,Ff,Uf,qf,$f,zf,Kf,Wf,Gf,Hf,Yf,Xf,Qf,Jf,Zf,Nf,tm,em,im,rm,nm,om,am,sm;function dm(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:lm(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||lm(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:_R(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return wR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function _R(e){var t=xR(e,"string");return typeof t=="symbol"?t:t+""}function xR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lm(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function wR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var hr,um=class extends dr{static{({e:[Lf,Pf,Bf,Ff,Uf,qf,$f,zf,Kf,Wf,Gf,Hf,Yf,Xf,Qf,Jf,Zf,Nf,tm,em,Mf],c:[hr,jf]}=dm(this,[pm("rui-popover")],[[Qt({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[Qt({type:String,defaultValue:"bottom"}),0,"placement"],[Qt({type:Boolean,defaultValue:!0}),0,"portal"],[Qt({type:Boolean,defaultValue:!1}),0,"matchAnchorWidth"],[Qt({type:Number,defaultValue:8}),0,"offset"],[Qt({type:String,defaultValue:""}),0,"anchor"],[Qt({type:String,defaultValue:"default"}),0,"variant"],[Hn({ref:"surface"}),0,"surfaceTarget"],[Hn({ref:"host"}),0,"hostTarget"],[SR({name:"rui-open-change",bubbles:!0,composed:!0}),0,"openChangeEvent"],[[Gn,fm(["open","placement","portal","matchAnchorWidth","offset","anchor"])],2,"syncPopover"],[Ze({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"],[Ze({ref:"host",type:"focusout"}),2,"onFocusOut"],[Gn,2,"onExternalAnchorClick"],[Ze({document:!0,type:"keydown"}),2,"onDocumentKeydown"]],0,void 0,dr))}open=(Mf(this),Lf(this));placement=(Pf(this),Bf(this));portal=(Ff(this),Uf(this));matchAnchorWidth=(qf(this),$f(this));offset=(zf(this),Kf(this));anchor=(Wf(this),Gf(this));variant=(Hf(this),Yf(this));surfaceTarget=(Xf(this),Qf(this));hostTarget=(Jf(this),Zf(this));openChangeEvent=(Nf(this),tm(this));surfaceId=(em(this),`rui-popover-${Math.random().toString(36).slice(2,9)}`);controller=null;anchorClickTarget=null;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncPopover())}disconnectedCallback(){this.unbindExternalAnchorClick(),this.controller?.destroy(),this.controller=null,super.disconnectedCallback()}getAnchorElement(){let i=this.closest("rui-popover-trigger")?.querySelector('[slot="trigger"]');if(i instanceof HTMLElement)return Wn(i);let r=this.querySelector('[slot="trigger"]');if(r instanceof HTMLElement)return Wn(r);let c=this.anchor.trim();if(c){let p=document.querySelector(c);if(p instanceof HTMLElement)return Wn(p)}return null}ensureController(){return this.controller||(this.controller=new pt({getAnchor:()=>this.getAnchorElement(),getFloating:()=>this.surfaceTarget,getOpen:()=>this.open,getPlacement:()=>this.placement,gap:this.offset,portal:this.portal,matchAnchorWidth:this.matchAnchorWidth})),this.controller}syncPopover(){let t=this.getAnchorElement(),i=this.surfaceTarget;i&&(i.id=this.surfaceId),t&&(t.setAttribute("aria-controls",this.surfaceId),t.setAttribute("aria-expanded",String(this.open))),this.syncExternalAnchorClick(t);let r=this.ensureController();r.updateConfig({getAnchor:()=>this.getAnchorElement(),getFloating:()=>this.surfaceTarget,getOpen:()=>this.open,getPlacement:()=>this.placement,gap:this.offset,portal:this.portal,matchAnchorWidth:this.matchAnchorWidth}),r.sync()}setOpen(t,i=!0){if(this.open===t){this.syncPopover();return}this.open=t,i&&this.openChangeEvent.emit({open:t}),this.syncPopover()}onDocumentPointerDown(t){if(!this.open)return;let i=t.target;Gt(this.getAnchorElement(),this.controller?.getFloatingElement()??this.surfaceTarget,i)&&this.setOpen(!1)}onFocusOut(t){this.open&&Wt(this.getAnchorElement(),this.controller?.getFloatingElement()??this.surfaceTarget,t.relatedTarget)&&this.setOpen(!1)}usesExternalAnchor(){return!this.anchor.trim()||this.closest("rui-popover-trigger")?!1:!this.querySelector('[slot="trigger"]')}syncExternalAnchorClick(t){if(!this.usesExternalAnchor()||!t){this.unbindExternalAnchorClick();return}this.anchorClickTarget!==t&&(this.unbindExternalAnchorClick(),t.addEventListener("click",this.onExternalAnchorClick),this.anchorClickTarget=t)}unbindExternalAnchorClick(){this.anchorClickTarget&&(this.anchorClickTarget.removeEventListener("click",this.onExternalAnchorClick),this.anchorClickTarget=null)}onExternalAnchorClick(){this.setOpen(!this.open)}onDocumentKeydown(t){if(!this.open||t.key!=="Escape")return;t.preventDefault(),this.setOpen(!1),this.getAnchorElement()?.focus()}render(){let t=this.variant==="listbox"?"rui-popover--listbox":"";return hm("div",{class:"rui-popover-host","data-ref":"host",children:[Je("slot",{name:"trigger"}),Je("div",{"data-ref":"surface",class:`rui-popover rui-floating ${t}`.trim(),role:"dialog",hidden:!0,children:Je("slot",{name:"content"})})]})}static{jf()}};var pr,cm=class extends dr{static{({e:[nm,om,am,sm,im],c:[pr,rm]}=dm(this,[pm("rui-popover-trigger")],[[Qt({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[Hn({ref:"root"}),0,"rootTarget"],[[Gn,fm(["open"])],2,"syncToPopover"],[Ze({ref:"root",type:"click"}),2,"onHostClick"],[Ze({selector:"rui-popover",type:"rui-open-change"}),2,"onPopoverOpenChange"]],0,void 0,dr))}constructor(...t){super(...t),sm(this)}open=(im(this),nm(this));rootTarget=(om(this),am(this));getPopover(){return this.querySelector("rui-popover")}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncToPopover())}syncToPopover(){let t=this.getPopover();t&&t.open!==this.open&&t.setOpen(this.open,!1)}onHostClick(t){if(!t.target?.closest('[slot="trigger"]'))return;this.open=!this.open,this.getPopover()?.setOpen(this.open)}onPopoverOpenChange(t){let i=this.getPopover();t.target===i&&(this.open=t.detail.open)}render(){return hm("div",{class:"rui-popover-trigger","data-ref":"root",children:[Je("slot",{name:"trigger"}),Je("slot",{})]})}static{rm()}};function Wn(e){return e.querySelector('button, a[href], input, select, textarea, [role="button"]')??e}function ER({children:e,slot:t="content",class:i,...r}){return Yn("div",{...r,slot:t,class:K(i),children:e})}var TR=rt(hr,({trigger:e,children:t,...i})=>mm("rui-popover",{...i,children:[e!=null?Yn("span",{slot:"trigger",children:e}):null,t]}),{stylesheets:["./popover.css"]}),RR=rt(pr,({trigger:e,children:t,...i})=>mm("rui-popover-trigger",{...i,children:[Yn("span",{slot:"trigger",children:e}),t]}),{stylesheets:["./popover.css"]});import{jsx as Dm}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Cm,customElement as kR,event as OR,onEvent as VR,onUpdated as MR,prop as fr}from"@ecopages/radiant";var gm,bm,vm,ym,_m,xm,wm,Sm,Em,Tm,Rm,Am;function AR(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Im(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Im(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:IR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return CR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function IR(e){var t=DR(e,"string");return typeof t=="symbol"?t:t+""}function DR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Im(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function CR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var mr,km=class extends Cm{static{({e:[vm,ym,_m,xm,wm,Sm,Em,Tm,Rm,Am,gm],c:[mr,bm]}=AR(this,[kR("rui-radio-group")],[[fr({type:String,reflect:!0,defaultValue:""}),0,"value"],[fr({type:String,defaultValue:""}),0,"name"],[fr({type:String,defaultValue:""}),0,"label"],[fr({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[OR({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[MR(["value","name","disabled"]),2,"syncRadios"],[VR({selector:'input[type="radio"]',type:"change"}),2,"onRadioChange"]],0,void 0,Cm))}value=(gm(this),vm(this));name=(ym(this),_m(this));label=(xm(this),wm(this));disabled=(Sm(this),Em(this));changeEvent=(Tm(this),Rm(this));resolvedAriaLabel=(Am(this),this.$.label.map(t=>t||void 0));resolvedAriaDisabled=this.$.disabled.map(t=>t?"true":void 0);connectedCallback(){super.connectedCallback(),this.syncRadios()}syncRadios(){let t=this.querySelectorAll('input[type="radio"]'),i=this.name||this.getAttribute("name")||"rui-radio-group";for(let r of t)r.name=i,r.disabled=this.disabled||r.hasAttribute("data-disabled"),r.checked=this.value!==""&&r.value===this.value}onRadioChange(t){let i=t.target;i.checked&&(this.value=i.value,this.changeEvent.emit({value:this.value}))}render(){return Dm("div",{class:"rui-radio-group",role:"radiogroup","data-rui-control":!0,"data-rui-control-type":"text","aria-label":this.resolvedAriaLabel,"aria-disabled":this.resolvedAriaDisabled,children:Dm("slot",{})})}static{bm()}};import{jsx as gr,jsxs as jR}from"@ecopages/jsx/jsx-runtime";var LR=rt(mr,({options:e,...t})=>gr("rui-radio-group",{...t,children:e.map(i=>jR("label",{class:"rui-radio",children:[gr("input",{type:"radio",class:"rui-radio__input",value:i.value,disabled:i.disabled,"data-disabled":i.disabled?"":void 0}),gr("span",{class:"rui-radio__control","aria-hidden":"true"}),gr("span",{class:"rui-radio__label",children:i.label})]}))}),{stylesheets:["./radio-group.css"]});import{jsx as Jm,jsxs as qR}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Zm,customElement as $R,event as zR,onEvent as Rt,onUpdated as KR,prop as Ee,query as WR}from"@ecopages/radiant";function br(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Ne(e){return e.join(",")}var Om,Vm,Mm,jm,Lm,Pm,Bm,Fm,Um,qm,$m,zm,Km,Wm,Gm,Hm,Ym,Xm;function PR(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Qm(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Qm(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:BR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return UR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function BR(e){var t=FR(e,"string");return typeof t=="symbol"?t:t+""}function FR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qm(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function UR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var vr,Nm=class extends Zm{static{({e:[Mm,jm,Lm,Pm,Bm,Fm,Um,qm,$m,zm,Km,Wm,Gm,Hm,Ym,Xm,Om],c:[vr,Vm]}=PR(this,[$R("rui-select")],[[Ee({type:String,reflect:!0,defaultValue:""}),0,"value"],[Ee({type:String,defaultValue:""}),0,"label"],[Ee({type:String,defaultValue:""}),0,"placeholder"],[Ee({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Ee({type:String,attribute:"selection-mode",defaultValue:"single"}),0,"selectionMode"],[Ee({type:Boolean,attribute:"should-close-on-select"}),0,"shouldCloseOnSelect"],[zR({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[WR({ref:"root"}),0,"rootTarget"],[KR(["value","label","placeholder","disabled","selectionMode","shouldCloseOnSelect"]),2,"onPropsUpdated"],[Rt({selector:"[data-select-trigger], [data-select-toggle]",type:"click"}),2,"onTriggerClick"],[Rt({selector:"[data-select-trigger]",type:"keydown",options:{capture:!0}}),2,"onTriggerKeydown"],[Rt({selector:"[data-select-listbox] [data-autocomplete-input]",type:"keydown",options:{capture:!0}}),2,"onSearchKeydown"],[Rt({selector:"[data-select-listbox] [data-autocomplete-input]",type:"input"}),2,"onSearchInput"],[Rt({selector:"[data-select-value] rui-tag-group",type:"rui-remove"}),2,"onTagRemove"],[Rt({selector:"[data-select-value] [data-tag]",type:"click"}),2,"onTagClick"],[Rt({selector:'[data-select-listbox] [role="option"]',type:"pointerover"}),2,"onOptionPointerOver"],[Rt({selector:'[data-select-listbox] [role="option"]',type:"mousedown"}),2,"onOptionMouseDown"],[Rt({selector:'[data-select-listbox] [role="option"]',type:"click"}),2,"onOptionClick"],[Rt({ref:"root",type:"focusout"}),2,"onFocusOut"],[Rt({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"]],0,void 0,Zm))}constructor(...t){super(...t),Xm(this)}value=(Om(this),Mm(this));label=(jm(this),Lm(this));placeholder=(Pm(this),Bm(this));disabled=(Fm(this),Um(this));selectionMode=(qm(this),$m(this));shouldCloseOnSelect=(zm(this),Km(this));changeEvent=(Wm(this),Gm(this));open=(Hm(this),!1);uid=Math.random().toString(36).slice(2,9);listboxBehavior=new me({getAnchor:()=>this.rootTarget,getFloating:()=>this.getListboxPopup(),getOpen:()=>this.open,getOptions:()=>this.getOptions(),getActiveDescendantHost:()=>this.getActiveDescendantHost(),getOptionIdPrefix:()=>`rui-select-option-${this.uid}`});rootTarget=Ym(this);get listboxId(){return`rui-select-list-${this.uid}`}get triggerId(){return`rui-select-trigger-${this.uid}`}isMultiple(){return this.selectionMode==="multiple"}closesOnSelect(){return this.shouldCloseOnSelect!=null?this.shouldCloseOnSelect:!this.isMultiple()}getSelectedValues(){return this.value?br(this.value):[]}setSelectedValues(t){this.value=Ne(t)}getSearchInput(){return this.querySelector("[data-select-listbox] [data-autocomplete-input]")}hasSearchInput(){return this.getSearchInput()!=null}getActiveDescendantHost(){return this.open&&this.hasSearchInput()?this.getSearchInput():this.getTrigger()}resetSearchFilter(){let t=this.getSearchInput();!t||t.value===""||(t.value="",t.dispatchEvent(new Event("input",{bubbles:!0})))}syncSearchInput(){let t=this.getSearchInput(),i=this.getTrigger(),r=this.getListbox();if(!(!t||!r||!i)){if(this.open){t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded","true"),t.setAttribute("aria-controls",this.listboxId),i.removeAttribute("aria-activedescendant");return}t.removeAttribute("role"),t.removeAttribute("aria-autocomplete"),t.removeAttribute("aria-expanded"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-activedescendant")}}focusPopupInput(){queueMicrotask(()=>{this.getSearchInput()?.focus()})}getTagGroup(){return this.querySelector("[data-select-value] rui-tag-group")}hasTagGroup(){return this.getTagGroup()!=null}syncTagGroup(){let t=this.getTagGroup(),i=this.getValueElement();if(!t||!i)return;let r=this.getSelectedValues(),c=r.flatMap(p=>{let h=this.getOptions().find(a=>this.getOptionValue(a)===p);return h?[{value:p,label:this.getOptionLabel(h)}]:[]});t.embedded=!0,t.setItems(c),t.value=this.value,this.syncTagGroupPlaceholder(i,r.length)}syncTagGroupPlaceholder(t,i){let r=t.querySelector("[data-select-placeholder]");if(!this.placeholder){r?.remove();return}r||(r=document.createElement("span"),r.setAttribute("data-select-placeholder","true"),t.insertBefore(r,t.firstChild)),r.textContent=this.placeholder,r.hidden=i>0,t.toggleAttribute("data-placeholder",i===0)}removeSelectedValue(t){let i=new Set(this.getSelectedValues());i.has(t)&&(i.delete(t),this.setSelectedValues([...i]),this.syncValueDisplay(),this.syncOptionSelection(),this.syncTagGroup(),this.changeEvent.emit({value:this.value}))}getTrigger(){return this.querySelector("[data-select-trigger]")}getToggle(){return this.querySelector("[data-select-toggle]")}getValueElement(){return this.querySelector("[data-select-value]")}getListboxPopup(){return this.querySelector("[data-select-listbox]")}getListbox(){let t=this.querySelector("rui-listbox");return t?t.querySelector('[role="listbox"]'):this.getListboxPopup()}getListboxHost(){return this.querySelector("rui-listbox")}getOptions(){let t=this.getListbox();return t?Array.from(t.querySelectorAll('[role="option"]')):[]}getOptionLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}getOptionValue(t){return t.getAttribute("data-value")||this.getOptionLabel(t)}ensureOptionIds(){this.listboxBehavior.ensureOptionIds()}getAccessibleName(){return Ve(this)?.textContent?.trim()||this.label||"Options"}syncLabel(){let t=this.getTrigger();Kt(this,t,{controlId:this.triggerId,label:this.label,labelId:`rui-select-label-${this.uid}`})}syncTrigger(){let t=this.getTrigger(),i=this.getListbox(),r=this.getListboxPopup();!t||!i||(t.id||(t.id=this.triggerId),i.id||(i.id=this.listboxId),t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","none"),t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",this.listboxId),i.setAttribute("aria-label",this.getAccessibleName()),this.isMultiple()?i.setAttribute("aria-multiselectable","true"):i.removeAttribute("aria-multiselectable"),r&&(r.removeAttribute("role"),r.removeAttribute("aria-label"),r.removeAttribute("aria-multiselectable")),this.disabled&&(t.disabled=!0),this.syncToggle(),this.syncSearchInput())}syncToggle(){let t=this.getToggle();t&&(t.setAttribute("aria-expanded",String(this.open)),t.disabled=this.disabled)}syncListboxHost(){let t=this.getListboxHost();t&&(t.embedded=!0,this.isMultiple()||(t.value=this.value))}syncValueDisplay(){if(this.hasTagGroup()){this.syncTagGroup();return}let t=this.getValueElement();if(!t||t.childElementCount>0)return;let i=this.getSelectedValues();if(i.length===0){t.textContent="",t.setAttribute("data-placeholder","true"),this.placeholder&&(t.textContent=this.placeholder);return}if(t.removeAttribute("data-placeholder"),this.isMultiple()){let c=i.map(p=>{let h=this.getOptions().find(a=>this.getOptionValue(a)===p);return h?this.getOptionLabel(h):p});t.textContent=c.join(", ");return}let r=this.getOptions().find(c=>this.getOptionValue(c)===i[0]);t.textContent=r?this.getOptionLabel(r):i[0]}syncOptionSelection(){let t=new Set(this.getSelectedValues());for(let i of this.getOptions()){let r=this.getOptionValue(i),c=t.has(r);i.setAttribute("aria-selected",String(c))}}setOpen(t,i={}){let r=i.activate??"none";this.open=t;let c=this.getTrigger(),p=this.getListboxPopup();if(!(!c||!p)){if(c.setAttribute("aria-expanded",String(t)),p.hidden=!t,!t){this.listboxBehavior.clearActiveOption(),this.resetSearchFilter(),this.syncSearchInput(),this.listboxBehavior.syncPopoverPosition();return}if(this.ensureOptionIds(),this.syncSearchInput(),this.listboxBehavior.syncPopoverPosition(),this.hasSearchInput()&&this.focusPopupInput(),r==="first"){let h=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(h.length?0:-1);return}if(r==="last"){let h=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(h.length?h.length-1:-1);return}this.listboxBehavior.clearActiveOption()}}selectOption(t){if(t.getAttribute("aria-disabled")==="true")return;let i=this.getOptionValue(t);if(this.isMultiple()){let r=new Set(this.getSelectedValues());r.has(i)?r.delete(i):r.add(i),this.setSelectedValues([...r])}else this.value=i;this.syncValueDisplay(),this.syncOptionSelection(),this.changeEvent.emit({value:this.value}),this.closesOnSelect()&&(this.resetSearchFilter(),this.setOpen(!1),this.getTrigger()?.focus())}handleListboxKeydown(t){this.listboxBehavior.handleKeydown(t,{isOpen:this.open,canUseSpace:!this.hasSearchInput(),closesOnTab:this.closesOnSelect(),enterWhenClosed:"open",enterWithoutActive:"ignore",onOpen:(i="none")=>this.setOpen(!0,{activate:i}),onClose:i=>{this.setOpen(!1),(i==="arrow"||i==="escape")&&this.getTrigger()?.focus()},onSelectActive:()=>{let i=this.listboxBehavior.getVisibleOptions()[this.listboxBehavior.activeOptionIndex];i&&this.selectOption(i)}})}handleTriggerKeydown(t){this.handleListboxKeydown(t)}initialize(){this.ensureOptionIds(),this.syncLabel(),this.syncTrigger(),this.syncListboxHost(),this.syncValueDisplay(),this.syncOptionSelection(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.listboxBehavior.destroy(),super.disconnectedCallback()}onPropsUpdated(){this.syncLabel(),this.syncTrigger(),this.syncListboxHost(),this.syncValueDisplay(),this.syncOptionSelection()}onTriggerClick(t){t.preventDefault();let i=this.getTrigger();if(!(!i||i.disabled)){if(this.open?this.setOpen(!1):this.setOpen(!0),this.open&&this.hasSearchInput()){this.focusPopupInput();return}i.focus()}}onTriggerKeydown(t){this.handleTriggerKeydown(t)}onSearchKeydown(t){this.handleListboxKeydown(t)}onSearchInput(){this.open&&this.listboxBehavior.clearActiveOption()}onTagRemove(t){let i=t.detail;i?.value&&this.removeSelectedValue(i.value)}onTagClick(t){t.target.closest("[data-tag-remove]")||t.stopPropagation()}onOptionPointerOver(t){if(!this.open)return;let i=t.target.closest('[role="option"]');if(!i||i.getAttribute("aria-disabled")==="true"||i.hidden)return;let c=this.listboxBehavior.getVisibleOptions().indexOf(i);c>=0&&this.listboxBehavior.setActiveOption(c)}onOptionMouseDown(t){t.preventDefault()}onOptionClick(t){let i=t.target.closest('[role="option"]');i&&this.selectOption(i)}onFocusOut(t){this.listboxBehavior.shouldDismissFocus(t.relatedTarget)&&this.setOpen(!1)}onDocumentPointerDown(t){this.open&&this.listboxBehavior.shouldDismissPointer(t.target)&&this.setOpen(!1)}render(){return qR("div",{class:"rui-select","data-ref":"root",children:[Jm("slot",{name:"trigger"}),Jm("slot",{name:"listbox"})]})}static{Vm()}};import{jsx as bt,jsxs as tg}from"@ecopages/jsx/jsx-runtime";function eg({children:e,slot:t="trigger",class:i,...r}){return bt("div",{...r,slot:t,class:K("rui-select__control",i),children:e})}function ig({children:e,class:t,disabled:i,...r}){return bt("button",{...r,type:"button","data-select-trigger":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:K("rui-select__trigger",t),disabled:i,children:e})}function rg({children:e,class:t,"aria-label":i="Show options",disabled:r,...c}){return bt("button",{...c,type:"button","data-select-toggle":!0,class:K("rui-control-toggle",t),"aria-label":i,disabled:r,tabIndex:-1,children:e??bt(Le,{})})}function ng({children:e,slot:t,class:i,...r}){return bt("span",{...r,slot:t,"data-select-value":!0,class:K("rui-select__value",i),children:e})}function og({children:e,slot:t="listbox",class:i,...r}){return bt("div",{...r,slot:t,"data-select-listbox":!0,class:K("rui-select__listbox rui-popover rui-popover--listbox rui-floating",i),hidden:!0,children:e})}function GR({placeholder:e,slot:t="input",class:i,disabled:r,...c}){return bt("input",{...c,type:"search",slot:t,"data-autocomplete-input":!0,class:K("rui-select__search",i),placeholder:e,disabled:r,autocomplete:"off"})}var HR=ne,YR=rt(vr,({options:e,children:t,...i})=>e!=null?tg("rui-select",{...i,children:[tg(eg,{children:[bt(ig,{children:bt(ng,{})}),bt(rg,{})]}),bt(og,{children:bt(be,{embedded:!0,options:e})})]}):bt("rui-select",{...i,children:t}),{stylesheets:["./select.css","../shared/control-toggle.css","../../../lib/icons/icons.css"]});import{jsx as ti,jsxs as NR}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as rb,bound as ei,customElement as tA,event as Xn,onEvent as eA,onUpdated as Qn,prop as ct,query as _r,state as iA}from"@ecopages/radiant";function yr(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}var ag,sg,lg,ug,cg,dg,hg,pg,fg,mg,gg,bg,vg,yg,_g,xg,wg,Sg,Eg,Tg,Rg,Ag,Ig,Dg,Cg,kg,Og,Vg,Mg,jg,Lg,Pg,Bg,Fg,Ug,qg,$g,zg,Kg,Wg,Gg,Hg,Yg,Xg,Qg,Jg,Zg,Ng,tb,eb;function XR(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:ib(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||ib(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:QR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return ZR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function QR(e){var t=JR(e,"string");return typeof t=="symbol"?t:t+""}function JR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ib(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function ZR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var rA=256,nA=48,oA=200,aA=480,sA=768,lA="b",nb=8,ob=32,uA="a.rui-sidebar__menu-button";function cA(e){return e.metaKey||e.ctrlKey}function dA(){return typeof window<"u"&&typeof window.matchMedia=="function"}function xr(e){return e==="left"||e==="right"}var wr,ab=class extends rb{static{({e:[lg,ug,cg,dg,hg,pg,fg,mg,gg,bg,vg,yg,_g,xg,wg,Sg,Eg,Tg,Rg,Ag,Ig,Dg,Cg,kg,Og,Vg,Mg,jg,Lg,Pg,Bg,Fg,Ug,qg,$g,zg,Kg,Wg,Gg,Hg,Yg,Xg,Qg,Jg,Zg,Ng,tb,eb,ag],c:[wr,sg]}=XR(this,[tA("rui-sidebar")],[[ct({type:String,reflect:!0,defaultValue:"sidebar"}),0,"variant"],[ct({type:String,reflect:!0,defaultValue:"left"}),0,"side"],[ct({type:String,reflect:!0,defaultValue:"off"}),0,"collapsible"],[ct({type:Number,defaultValue:rA}),0,"defaultWidth"],[ct({type:Number,reflect:!0,attribute:"width"}),0,"width"],[ct({type:Number,defaultValue:oA}),0,"minWidth"],[ct({type:Number,defaultValue:aA}),0,"maxWidth"],[ct({type:Boolean,defaultValue:!1}),0,"resizable"],[ct({type:Boolean,defaultValue:!0}),0,"defaultOpen"],[ct({type:Boolean,attribute:"open"}),0,"open"],[ct({type:Number,defaultValue:sA}),0,"mobileBreakpoint"],[ct({type:String,defaultValue:"Sidebar"}),0,"label"],[ct({type:Boolean,reflect:!0,attribute:"match-active"}),0,"matchActive"],[ct({type:String,defaultValue:"pathname"}),0,"matchMode"],[ct({type:Boolean,attribute:"scroll-active-on-mount"}),0,"scrollActiveOnMount"],[ct({type:String,attribute:"navigation-events",defaultValue:""}),0,"navigationEvents"],[_r({ref:"root"}),0,"rootTarget"],[_r({ref:"pane"}),0,"paneTarget"],[_r({ref:"handle"}),0,"handleTarget"],[_r({ref:"scrim"}),0,"scrimTarget"],[Xn({name:"rui-sidebar-toggle",bubbles:!0,composed:!0}),0,"toggleEvent"],[Xn({name:"rui-sidebar-resize",bubbles:!0,composed:!0}),0,"resizeEvent"],[Xn({name:"rui-sidebar-mobile-change",bubbles:!0,composed:!0}),0,"mobileChangeEvent"],[iA,0,"isMobile"],[Qn(["open","collapsible","variant","side","width","defaultWidth","defaultOpen","minWidth","maxWidth","isMobile","resizable"]),2,"onStateUpdated"],[Qn(["mobileBreakpoint"]),2,"onMobileBreakpointUpdated"],[Qn(["matchActive","matchMode","navigationEvents"]),2,"onMatchSettingsUpdated"],[ei,2,"onPointerMove"],[ei,2,"onPointerUp"],[ei,2,"onHandlePointerDown"],[ei,2,"onHandleKeydown"],[ei,2,"onScrimClick"],[eA({document:!0,type:"keydown"}),2,"onHostKeydown"]],0,void 0,rb))}variant=(ag(this),lg(this));side=(ug(this),cg(this));collapsible=(dg(this),hg(this));defaultWidth=(pg(this),fg(this));width=(mg(this),gg(this));minWidth=(bg(this),vg(this));maxWidth=(yg(this),_g(this));resizable=(xg(this),wg(this));defaultOpen=(Sg(this),Eg(this));open=(Tg(this),Rg(this));mobileBreakpoint=(Ag(this),Ig(this));label=(Dg(this),Cg(this));matchActive=(kg(this),Og(this,!1));matchMode=(Vg(this),Mg(this));scrollActiveOnMount=(jg(this),Lg(this,!1));navigationEvents=(Pg(this),Bg(this,""));rootTarget=(Fg(this),Ug(this));paneTarget=(qg(this),$g(this));handleTarget=(zg(this),Kg(this));scrimTarget=(Wg(this),Gg(this));toggleEvent=(Hg(this),Yg(this));resizeEvent=(Xg(this),Qg(this));mobileChangeEvent=(Jg(this),Zg(this));isMobile=(Ng(this),tb(this,!1));mediaQuery=(eb(this),null);mediaListener=t=>this.setMobile(t.matches);dragging=!1;dragStartCoord=0;dragStartSize=0;navigationCleanups=[];connectedCallback(){super.connectedCallback(),this.ensureWidthInitialized(),this.setAttribute("role","complementary"),this.setAttribute("aria-label",this.label),this.syncHostAttributes(),this.attachNavigationListeners(),queueMicrotask(()=>{this.open===void 0&&(this.open=this.defaultOpen),this.ensureWidthInitialized(),this.syncHostAttributes(),this.syncPaneWidthVar(),this.bindMobileMediaQuery(),this.syncActiveLinks(this.scrollActiveOnMount)})}disconnectedCallback(){this.endDrag(),this.unbindMobileMediaQuery(),this.detachNavigationListeners(),super.disconnectedCallback()}syncHostAttributes(){let t=this.isOpen()?"expanded":"collapsed";this.setAttribute("data-state",t),this.setAttribute("data-collapsible",this.collapsible),this.setAttribute("data-variant",this.variant),this.setAttribute("data-side",this.side),this.setAttribute("data-mobile",String(this.isMobile)),this.setAttribute("data-pane-width",String(this.paneWidth()))}isOpen(){return this.open!==void 0?this.open:this.defaultOpen}ensureWidthInitialized(){this.hasAttribute("width")||(this.width===void 0||this.width===0)&&(this.width=this.defaultWidth)}onStateUpdated(){this.syncHostAttributes(),this.syncPaneWidthVar()}onMobileBreakpointUpdated(){this.bindMobileMediaQuery()}onMatchSettingsUpdated(){this.detachNavigationListeners(),this.attachNavigationListeners(),this.syncActiveLinks(!1)}syncActiveLinks(t=!1){if(!this.matchActive||typeof window>"u"||typeof window.location>"u")return;let i=window.location.pathname;for(let r of this.querySelectorAll(uA)){let c=this.isLinkActive(r,i);r.classList.toggle("rui-sidebar__menu-button--active",c),c?(r.setAttribute("aria-current","page"),t&&r.scrollIntoView({block:"nearest"})):r.removeAttribute("aria-current")}}isLinkActive(t,i){let r=t.pathname;return this.matchMode==="prefix"?i===r||i.startsWith(`${r}/`):r===i}attachNavigationListeners(){if(!this.matchActive||typeof window>"u"||typeof window.addEventListener!="function")return;let t=()=>this.syncActiveLinks(!1);if(window.addEventListener("popstate",t),this.navigationCleanups.push(()=>window.removeEventListener("popstate",t)),typeof document<"u"&&typeof document.addEventListener=="function")for(let i of yr(this.navigationEvents))document.addEventListener(i,t),this.navigationCleanups.push(()=>document.removeEventListener(i,t))}detachNavigationListeners(){for(let t of this.navigationCleanups)t();this.navigationCleanups=[]}unbindMobileMediaQuery(){this.mediaQuery?.removeEventListener("change",this.mediaListener),this.mediaQuery=null}bindMobileMediaQuery(){if(this.unbindMobileMediaQuery(),this.mobileBreakpoint<=0||!dA()){this.setMobile(!1);return}this.mediaQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.mediaQuery.addEventListener("change",this.mediaListener),this.setMobile(this.mediaQuery.matches)}setMobile(t){if(t===this.isMobile)return;let i=this.isMobile&&!t;this.isMobile=t,i&&this.collapsible==="off"&&!this.isOpen()?this.setOpen(!0):this.syncPaneWidthVar(),this.mobileChangeEvent.emit({mobile:t})}clampWidth(t){return Math.min(this.maxWidth,Math.max(this.minWidth,t))}paneWidth(){return this.isOpen()?this.width&&this.width>0?this.width:this.defaultWidth:this.isMobile?0:this.collapsible==="icon"?nA:0}syncPaneWidthVar(t=this.paneWidth()){let i=this.rootTarget;i&&i.style.setProperty("--rui-sidebar-pane-width",`${t}px`),this.paneTarget&&(this.paneTarget.style.removeProperty("width"),this.paneTarget.style.removeProperty("height")),this.setAttribute("data-pane-width",String(t))}applyWidth(t,i){let r=this.clampWidth(t);this.width=r,this.syncPaneWidthVar(r),i&&this.resizeEvent.emit({width:r})}toggle(){this.setOpen(!this.isOpen())}setOpen(t){let i=this.isOpen();if(t===i){this.syncPaneWidthVar();return}this.open=t;let r=t?"expanded":"collapsed";this.setAttribute("data-state",r),this.syncPaneWidthVar(),this.toggleEvent.emit({open:t,state:r})}beginDrag(t){if(t.button!==0||this.collapsible!=="off")return;this.dragging=!0;let i=xr(this.side);this.dragStartCoord=i?t.clientX:t.clientY,this.dragStartSize=this.paneWidth(),this.handleTarget?.setPointerCapture(t.pointerId),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerUp)}endDrag(){this.dragging&&(this.dragging=!1,document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp))}onPointerMove(t){if(!this.dragging)return;let r=xr(this.side)?t.clientX:t.clientY,c=this.side==="right"?this.dragStartCoord-r:r-this.dragStartCoord;this.applyWidth(this.dragStartSize+c,!0)}onPointerUp(){this.endDrag()}onHandlePointerDown(t){t.preventDefault(),this.beginDrag(t)}onHandleKeydown(t){let i=t,r=this.paneWidth(),c=xr(this.side),p=c?"ArrowLeft":"ArrowUp",h=c?"ArrowRight":"ArrowDown",a=r;if(i.key===p)a=r-(i.shiftKey?ob:nb);else if(i.key===h)a=r+(i.shiftKey?ob:nb);else if(i.key==="Home")a=this.minWidth;else if(i.key==="End")a=this.maxWidth;else return;t.preventDefault(),this.applyWidth(a,!0)}onScrimClick(){this.isMobile&&this.setOpen(!1)}onHostKeydown(t){let i=t;if(i.key==="Escape"&&this.isMobile&&this.isOpen()){i.preventDefault(),this.setOpen(!1);return}cA(i)&&i.key.toLowerCase()===lA&&(i.preventDefault(),this.toggle())}render(){let t=xr(this.side),i=this.isOpen(),r=i?"expanded":"collapsed",c=this.resizable&&this.collapsible==="off"&&i&&!this.isMobile,p=`${this.paneWidth()}px`,h=i||!this.isMobile&&this.collapsible==="icon"?void 0:"";return NR("div",{class:"rui-sidebar",style:{"--rui-sidebar-pane-width":p},"data-ref":"root","data-state":r,"data-collapsible":this.collapsible,"data-variant":this.variant,"data-side":this.side,"data-mobile":String(this.isMobile),children:[ti("button",{"data-ref":"scrim",type:"button",class:"rui-sidebar__scrim",tabindex:-1,"aria-label":"Close sidebar",hidden:!this.isMobile||!i,"on:click":this.onScrimClick}),ti("div",{"data-ref":"pane",class:"rui-sidebar__pane","data-side":this.side,"data-variant":this.variant,"aria-label":this.$.label,inert:h,children:ti("slot",{})}),c?ti("div",{"data-ref":"handle",class:"rui-sidebar__handle",role:"separator",tabindex:0,"aria-orientation":t?"vertical":"horizontal","aria-valuenow":this.paneWidth(),"aria-valuemin":this.minWidth,"aria-valuemax":this.maxWidth,"aria-label":`${this.label} resize handle`,"on:pointerdown":this.onHandlePointerDown,"on:keydown":this.onHandleKeydown,children:ti("span",{class:"rui-sidebar__handle-grip","aria-hidden":"true"})}):null]})}static{sg()}};import{jsx as vt,jsxs as ii}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Eb,customElement as gA,onEvent as bA,onUpdated as vA,prop as ri,query as yA,state as _A}from"@ecopages/radiant";var sb,lb,ub,cb,db,hb,pb,fb,mb,gb,bb,vb,yb,_b,xb,wb;function hA(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Sb(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Sb(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:pA(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return mA(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function pA(e){var t=fA(e,"string");return typeof t=="symbol"?t:t+""}function fA(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sb(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function mA(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Sr,Tb=class extends Eb{static{({e:[ub,cb,db,hb,pb,fb,mb,gb,bb,vb,yb,_b,xb,wb,sb],c:[Sr,lb]}=hA(this,[gA("rui-sidebar-trigger")],[[ri({type:String,defaultValue:""}),0,"controls"],[ri({type:String,attribute:"button-label",defaultValue:"Toggle sidebar"}),0,"buttonLabel"],[ri({type:String,reflect:!0,attribute:"data-placement",defaultValue:""}),0,"placement"],[ri({type:String,defaultValue:"ghost"}),0,"variant"],[ri({type:String,defaultValue:"md"}),0,"size"],[yA({ref:"button"}),0,"buttonTarget"],[_A,0,"sidebarState"],[vA(["controls","buttonLabel","placement"]),2,"onControlsUpdated"],[bA({selector:'button[data-ref="button"]',type:"click"}),2,"onButtonClick"]],0,void 0,Eb))}controls=(sb(this),ub(this));buttonLabel=(cb(this),db(this));placement=(hb(this),pb(this));variant=(fb(this),mb(this));size=(gb(this),bb(this));buttonTarget=(vb(this),yb(this));sidebarState=(_b(this),xb(this,"expanded"));sidebarListener=(wb(this),null);attachedSidebar=null;connectedCallback(){super.connectedCallback(),this.syncWithSidebar(),queueMicrotask(()=>this.syncWithSidebar())}disconnectedCallback(){this.detachFromSidebar(),super.disconnectedCallback()}onControlsUpdated(){this.detachFromSidebar(),this.syncWithSidebar(),this.applyState(this.attachedSidebar?this.readState(this.attachedSidebar):"expanded")}resolveSidebar(){let t=this.controls?.trim();if(t){let r=document.getElementById(t);if(r)return r}let i=this.closest("rui-sidebar");return i?.id?i:null}syncWithSidebar(){let t=this.resolveSidebar();if(t===this.attachedSidebar){t&&this.applyState(this.readState(t));return}this.detachFromSidebar(),t&&(this.attachedSidebar=t,this.sidebarListener=i=>{let r=i.detail;this.applyState(r.state)},t.addEventListener("rui-sidebar-toggle",this.sidebarListener),this.applyState(this.readState(t)))}detachFromSidebar(){this.attachedSidebar&&this.sidebarListener&&this.attachedSidebar.removeEventListener("rui-sidebar-toggle",this.sidebarListener),this.attachedSidebar=null,this.sidebarListener=null}readState(t){return t.getAttribute("data-state")??"expanded"}resolvedButtonLabel(t=this.sidebarState){if(this.placement==="inset")return t==="expanded"?"Close navigation":"Open navigation";let i=this.getAttribute("data-button-label")?.trim();if(i)return i;let r=this.getAttribute("button-label")?.trim();return r||this.buttonLabel||"Toggle sidebar"}applyState(t){this.sidebarState=t;let i=this.buttonTarget;if(!i)return;let r=this.resolveSidebar(),c=this.resolvedButtonLabel(t);i.setAttribute("aria-expanded",String(t==="expanded")),i.setAttribute("data-sidebar-state",t),i.setAttribute("aria-label",c),r?.id?i.setAttribute("aria-controls",r.id):this.controls&&i.setAttribute("aria-controls",this.controls)}onButtonClick(t){t.preventDefault(),t.stopPropagation();let i=this.resolveSidebar();i&&typeof i.toggle=="function"&&i.toggle()}placementClass(){return this.placement==="header"?"rui-sidebar__trigger--header":this.placement==="inset"?"rui-sidebar__trigger--inset":""}renderMenuIcon(t){return t==="expanded"?ii("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--close",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[vt("path",{d:"M18 6 6 18"}),vt("path",{d:"m6 6 12 12"})]}):ii("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--menu",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[vt("path",{d:"M4 6h16"}),vt("path",{d:"M4 12h16"}),vt("path",{d:"M4 18h16"})]})}renderDefaultIcon(){let t=this.sidebarState,i=this.placement;return i==="inset"?vt("span",{class:"rui-sidebar__trigger-icon","aria-hidden":"true",children:this.renderMenuIcon(t)}):ii("span",{class:"rui-sidebar__trigger-icon","aria-hidden":"true",children:[i==="header"||t==="expanded"?ii("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--collapse",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[vt("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),vt("path",{d:"M9 3v18"}),vt("path",{d:"m14 15 3-3-3-3"})]}):null,i!=="header"&&t==="collapsed"?ii("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--expand",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[vt("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),vt("path",{d:"M9 3v18"}),vt("path",{d:"m14 9-3 3 3 3"})]}):null]})}render(){let i=this.resolveSidebar()?.id||this.controls||null,r=this.sidebarState,c=this.resolvedButtonLabel(r);return vt("button",{"data-ref":"button",type:"button",class:`rui-button rui-button--${this.variant} rui-button--${this.size} rui-sidebar__trigger ${this.placementClass()}`.trim(),"data-sidebar-state":r,"aria-expanded":String(r==="expanded"),"aria-controls":i||null,"aria-label":c,children:this.renderDefaultIcon()})}static{lb()}};import{jsx as ut,jsxs as Er}from"@ecopages/jsx/jsx-runtime";function xA({layout:e="default",siteHeader:t,sidebar:i,children:r,class:c}){return e==="docs"?Er("div",{class:K("rui-sidebar-provider",c),"data-layout":e,children:[t?ut("div",{class:"rui-sidebar-provider__site-header",children:t}):null,Er("div",{class:"rui-sidebar-provider__body",children:[i,r]})]}):Er("div",{class:K("rui-sidebar-provider",c),"data-layout":e,children:[i,r]})}function wA({children:e,class:t,"aria-label":i}){return ut("div",{class:K("rui-sidebar__header",t),"aria-label":i,children:e})}function SA({children:e,class:t,"aria-label":i}){return ut("div",{class:K("rui-sidebar__content",t),"aria-label":i,children:e})}function EA({children:e,class:t}){return ut("div",{class:K("rui-sidebar__footer",t),children:e})}function TA({class:e,"aria-label":t}){return ut("hr",{role:"separator","aria-orientation":"horizontal","aria-label":t,class:K("rui-sidebar__separator",e)})}function RA({children:e,class:t,"aria-label":i}){return ut("section",{class:K("rui-sidebar__group",t),"aria-label":i,children:e})}function Rb({children:e,class:t,id:i}){return ut("h2",{id:i,class:K("rui-sidebar__group-label",t),children:e})}function AA({children:e,class:t,"aria-label":i}){return ut("button",{type:"button","aria-label":i,class:K("rui-sidebar__group-action",t),children:e})}function IA({label:e,action:t,class:i}){return Er("div",{class:K("rui-sidebar__group-header",i),children:[ut(Rb,{children:e}),t]})}function DA({children:e,class:t,"aria-label":i}){return ut("ul",{role:"list",class:K("rui-sidebar__menu",t),"aria-label":i,children:e})}function CA({children:e,class:t}){return ut("li",{class:K("rui-sidebar__menu-item",t),children:e})}function Ab({children:e,class:t,isActive:i,as:r,href:c,type:p="button",tooltip:h,disabled:a,onClick:E}){let C=K("rui-sidebar__menu-button",i&&"rui-sidebar__menu-button--active",t),R=h,D=typeof e=="string"?void 0:h;return r==="button"||!r&&!c?ut("button",{type:p,class:C,"aria-current":i?"page":void 0,disabled:a,title:R,"aria-label":D,"on:click":E,children:e}):ut("a",{href:c,class:C,"aria-current":i?"page":void 0,title:R,"aria-label":D,children:e})}function kA(e){let{class:t,...i}=e;return ut(Ab,{class:K("rui-sidebar__menu-action",t),...i})}function OA({children:e,class:t,id:i}){return ut("main",{id:i,class:K("rui-sidebar__inset",t),children:e})}var VA=rt(wr,({children:e,id:t,defaultOpen:i,open:r,defaultWidth:c,width:p,resizable:h,mobileBreakpoint:a,matchActive:E,matchMode:C,scrollActiveOnMount:R,navigationEvents:D,...T})=>ut("rui-sidebar",{...T,id:t,"prop:defaultOpen":i,"prop:open":r,"prop:defaultWidth":c,"prop:width":p,"prop:resizable":h,"prop:mobileBreakpoint":a,"prop:matchActive":E,"prop:matchMode":C,"prop:scrollActiveOnMount":R,"prop:navigationEvents":D,children:e}),{stylesheets:["./sidebar.css"]}),MA=rt(Sr,({children:e,controls:t,triggerLabel:i,placement:r,variant:c,size:p,...h})=>ut("rui-sidebar-trigger",{...h,"prop:controls":t,"prop:buttonLabel":i??"Toggle sidebar","attr:data-button-label":i??"Toggle sidebar","prop:placement":r,"attr:data-placement":r,variant:c,size:p,children:e}),{stylesheets:["./sidebar.css"]});import{jsx as Jt,jsxs as Tr}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as uv,customElement as FA,event as UA,onEvent as Vt,onUpdated as cv,prop as At,query as dv,state as hv}from"@ecopages/radiant";var Ib,Db,Cb,kb,Ob,Vb,Mb,jb,Lb,Pb,Bb,Fb,Ub,qb,$b,zb,Kb,Wb,Gb,Hb,Yb,Xb,Qb,Jb,Zb,Nb,tv,ev,iv,rv,nv,ov,av,sv;function jA(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:lv(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||lv(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:LA(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return BA(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function LA(e){var t=PA(e,"string");return typeof t=="symbol"?t:t+""}function PA(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lv(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function BA(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Rr,pv=class extends uv{static{({e:[Cb,kb,Ob,Vb,Mb,jb,Lb,Pb,Bb,Fb,Ub,qb,$b,zb,Kb,Wb,Gb,Hb,Yb,Xb,Qb,Jb,Zb,Nb,tv,ev,iv,rv,nv,ov,av,sv,Ib],c:[Rr,Db]}=jA(this,[FA("rui-slider")],[[At({type:String,defaultValue:"single"}),0,"variant"],[At({type:Number,reflect:!0,defaultValue:50}),0,"value"],[At({type:Number,reflect:!0,attribute:"range-min",defaultValue:25}),0,"rangeMin"],[At({type:Number,reflect:!0,attribute:"range-max",defaultValue:75}),0,"rangeMax"],[At({type:Number,defaultValue:0}),0,"min"],[At({type:Number,defaultValue:100}),0,"max"],[At({type:Number,defaultValue:1}),0,"step"],[At({type:Number,defaultValue:0}),0,"minDistance"],[At({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[At({type:String,defaultValue:""}),0,"label"],[At({type:String,defaultValue:""}),0,"name"],[UA({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[dv({ref:"input"}),0,"inputTarget"],[dv({ref:"rangeFill"}),0,"rangeFill"],[hv,0,"pendingRange"],[hv,0,"displayedValue"],[cv(["value","min","max","step","variant"]),2,"onSinglePropsUpdated"],[cv(["rangeMin","rangeMax","min","max","step","minDistance","variant"]),2,"onRangePropsUpdated"],[Vt({ref:"input",type:"pointerdown"}),2,"onPointerDown"],[Vt({ref:"input",type:"pointerup"}),2,"onPointerUp"],[Vt({ref:"input",type:"pointercancel"}),2,"onPointerCancel"],[Vt({ref:"input",type:"input"}),2,"onInput"],[Vt({ref:"input",type:"change"}),2,"onChange"],[Vt({selector:"[data-thumb]",type:"pointerdown"}),2,"onThumbPointerDown"],[Vt({selector:"[data-thumb]",type:"pointermove"}),2,"onThumbPointerMove"],[Vt({selector:"[data-thumb]",type:"pointerup"}),2,"onThumbPointerUp"],[Vt({selector:"[data-thumb]",type:"pointercancel"}),2,"onThumbPointerCancel"],[Vt({selector:"[data-thumb]",type:"keydown"}),2,"onThumbKeydown"]],0,void 0,uv))}variant=(Ib(this),Cb(this));value=(kb(this),Ob(this));rangeMin=(Vb(this),Mb(this));rangeMax=(jb(this),Lb(this));min=(Pb(this),Bb(this));max=(Fb(this),Ub(this));step=(qb(this),$b(this));minDistance=(zb(this),Kb(this));disabled=(Wb(this),Gb(this));label=(Hb(this),Yb(this));name=(Xb(this),Qb(this));changeEvent=(Jb(this),Zb(this));inputTarget=(Nb(this),tv(this));rangeFill=(ev(this),iv(this));interacting=(rv(this),!1);activeThumb=null;pendingRange=nv(this,null);displayedValue=(ov(this),av(this,null));resolvedDisabledTabindex=(sv(this),this.$.disabled.map(t=>t?-1:0));resolvedMinLabel=this.$.label.map(t=>t?`${t} minimum`:"Minimum value");resolvedMaxLabel=this.$.label.map(t=>t?`${t} maximum`:"Maximum value");resolvedName=this.$.name.map(t=>t||void 0);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.variant==="single"?this.syncInputFromValue():this.syncRangeUi()})}onSinglePropsUpdated(){this.variant!=="single"||this.interacting||this.syncInputFromValue()}onRangePropsUpdated(){this.variant!=="range"||this.activeThumb||this.syncRangeUi()}clamp(t){let i=Math.round(t/this.step)*this.step;return Math.min(this.max,Math.max(this.min,i))}normalizeRange(t=this.rangeMin,i=this.rangeMax){let r=this.clamp(t),c=this.clamp(i);return r>c&&([r,c]=[c,r]),c-r<this.minDistance&&(this.activeThumb==="min"?r=this.clamp(c-this.minDistance):c=this.clamp(r+this.minDistance)),[r,c]}getActiveRange(){return this.normalizeRange(...this.pendingRange??[this.rangeMin,this.rangeMax])}percentFor(t){return this.max===this.min?0:(t-this.min)/(this.max-this.min)*100}valueFromPointer(t,i){let r=i.getBoundingClientRect(),c=Math.min(1,Math.max(0,(t-r.left)/r.width));return this.clamp(this.min+c*(this.max-this.min))}syncInputFromValue(){let t=this.inputTarget;if(!t)return;let i=String(this.value);t.value!==i&&(t.value=i),t.min=String(this.min),t.max=String(this.max),t.step=String(this.step),this.updateDisplayedValue(this.value)}updateDisplayedValue(t){this.displayedValue=t}syncRangeUi(){let[t,i]=this.getActiveRange(),r=!1;if(this.activeThumb||(t!==this.rangeMin&&(this.rangeMin=t,r=!0),i!==this.rangeMax&&(this.rangeMax=i,r=!0)),r){queueMicrotask(()=>{this.activeThumb||this.paintRangeUi(...this.getActiveRange())});return}this.paintRangeUi(t,i)}paintRangeUi(t,i){let r=this.percentFor(t),c=this.percentFor(i),p=this.querySelector(".rui-slider__range-track");p&&(p.style.setProperty("--rui-slider-min",`${r}%`),p.style.setProperty("--rui-slider-max",`${c}%`)),this.rangeFill&&(this.rangeFill.style.left=`${r}%`,this.rangeFill.style.width=`${c-r}%`)}commitRange(t=!0){let[i,r]=this.getActiveRange(),c=i!==this.rangeMin||r!==this.rangeMax;this.pendingRange=null,this.rangeMin=i,this.rangeMax=r,t&&c&&this.changeEvent.emit({values:[i,r]})}setRangeValue(t,i){this.activeThumb=t;let[r,c]=this.pendingRange??[this.rangeMin,this.rangeMax],[p,h]=this.normalizeRange(t==="min"?i:r,t==="max"?i:c);this.pendingRange=[p,h],this.paintRangeUi(p,h)}commitSingleValue(t){let i=Number(t.value);this.updateDisplayedValue(i),i!==this.value&&(this.value=i,this.changeEvent.emit({value:i}))}onPointerDown(t){t.button!==0||this.variant!=="single"||(this.interacting=!0)}onPointerUp(t){!this.interacting||this.variant!=="single"||(this.interacting=!1,this.commitSingleValue(t.target))}onPointerCancel(t){!this.interacting||this.variant!=="single"||(this.interacting=!1,this.commitSingleValue(t.target))}onInput(t){if(this.variant!=="single")return;let i=t.target,r=Number(i.value);if(this.updateDisplayedValue(r),this.interacting){this.changeEvent.emit({value:r});return}this.commitSingleValue(i)}onChange(t){this.variant==="single"&&(this.interacting=!1,this.commitSingleValue(t.target))}onThumbPointerDown(t){if(t.button!==0||this.variant!=="range"||this.disabled)return;let i=t.target.closest("[data-thumb]");if(!i)return;let r=i.getAttribute("data-thumb");this.activeThumb=r,this.pendingRange=[this.rangeMin,this.rangeMax],i.setPointerCapture(t.pointerId),t.preventDefault()}onThumbPointerMove(t){if(!this.activeThumb||this.variant!=="range")return;let i=this.querySelector(".rui-slider__range-track");i&&(this.setRangeValue(this.activeThumb,this.valueFromPointer(t.clientX,i)),this.pendingRange&&this.changeEvent.emit({values:this.pendingRange}))}onThumbPointerUp(){!this.activeThumb||this.variant!=="range"||(this.commitRange(),this.activeThumb=null)}onThumbPointerCancel(){!this.activeThumb||this.variant!=="range"||(this.pendingRange=null,this.syncRangeUi(),this.activeThumb=null)}onThumbKeydown(t){if(this.variant!=="range"||this.disabled)return;let i=t.target.closest("[data-thumb]");if(!i)return;let r=i.getAttribute("data-thumb"),c=r==="min"?this.rangeMin:this.rangeMax,p=c;switch(t.key){case"ArrowRight":case"ArrowUp":p=this.clamp(c+this.step);break;case"ArrowLeft":case"ArrowDown":p=this.clamp(c-this.step);break;case"Home":p=this.min;break;case"End":p=this.max;break;case"PageUp":p=this.clamp(c+this.step*10);break;case"PageDown":p=this.clamp(c-this.step*10);break;default:return}t.preventDefault(),this.setRangeValue(r,p),this.commitRange(!1),this.changeEvent.emit({values:[this.rangeMin,this.rangeMax]}),this.activeThumb=null}render(){let[t,i]=this.getActiveRange(),r=this.displayedValue??this.value;return this.variant==="range"?Tr("div",{class:"rui-slider rui-slider--range",children:[this.label?Jt("span",{class:"rui-slider__label",children:this.label}):null,Jt("div",{class:"rui-slider__range",children:Tr("div",{class:"rui-slider__range-track",children:[Jt("div",{class:"rui-slider__range-fill","data-ref":"rangeFill"}),Jt("button",{type:"button",class:"rui-slider__thumb","data-ref":"rangeMinThumb","data-thumb":"min",role:"slider",tabindex:this.resolvedDisabledTabindex,"aria-label":this.resolvedMinLabel,"aria-valuemin":this.min,"aria-valuemax":i,"aria-valuenow":t,disabled:this.$.disabled}),Jt("button",{type:"button",class:"rui-slider__thumb","data-ref":"rangeMaxThumb","data-thumb":"max",role:"slider",tabindex:this.resolvedDisabledTabindex,"aria-label":this.resolvedMaxLabel,"aria-valuemin":t,"aria-valuemax":this.max,"aria-valuenow":i,disabled:this.$.disabled})]})}),Tr("span",{class:"rui-slider__value","data-ref":"value","aria-hidden":"true",children:[t," \u2013 ",i]})]}):Tr("label",{class:"rui-slider",children:[this.label?Jt("span",{class:"rui-slider__label",children:this.label}):null,Jt("input",{type:"range","data-ref":"input","data-rui-control":!0,"data-rui-control-type":"number",class:"rui-slider__input",disabled:this.$.disabled,name:this.resolvedName,"aria-valuemin":this.min,"aria-valuemax":this.max,"aria-valuenow":this.value}),Jt("span",{class:"rui-slider__value","data-ref":"value","aria-hidden":"true",children:r})]})}static{Db()}};import{jsx as qA}from"@ecopages/jsx/jsx-runtime";var $A=rt(Rr,({values:e,...t})=>qA("rui-slider",{...t,rangeMin:e?.[0],rangeMax:e?.[1]}),{stylesheets:["./slider.css"]});import{jsx as ni,jsxs as HA}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Tv,customElement as YA,event as XA,onEvent as QA,prop as Jn}from"@ecopages/radiant";var fv,mv,gv,bv,vv,yv,_v,xv,wv,Sv;function zA(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Ev(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Ev(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:KA(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return GA(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function KA(e){var t=WA(e,"string");return typeof t=="symbol"?t:t+""}function WA(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ev(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function GA(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ar,Rv=class extends Tv{static{({e:[gv,bv,vv,yv,_v,xv,wv,Sv,fv],c:[Ar,mv]}=zA(this,[YA("rui-switch")],[[Jn({type:Boolean,reflect:!0,defaultValue:!1}),0,"checked"],[Jn({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Jn({type:String,defaultValue:""}),0,"name"],[XA({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[QA({ref:"input",type:"change"}),2,"onInputChange"]],0,void 0,Tv))}checked=(fv(this),gv(this));disabled=(bv(this),vv(this));name=(yv(this),_v(this));changeEvent=(xv(this),wv(this));nameAttr=(Sv(this),this.$.name.map(t=>t||void 0));onInputChange(t){let i=t.target;this.checked=i.checked,this.changeEvent.emit({checked:this.checked})}render(){return HA("label",{class:"rui-switch",children:[ni("input",{type:"checkbox",role:"switch","data-ref":"input","data-rui-control":!0,"data-rui-control-type":"boolean",class:"rui-switch__input","prop:checked":this.$.checked,disabled:this.$.disabled,name:this.nameAttr}),ni("span",{class:"rui-switch__track","aria-hidden":"true",children:ni("span",{class:"rui-switch__thumb"})}),ni("span",{class:"rui-switch__label",children:ni("slot",{})})]})}static{mv()}};import{jsx as JA}from"@ecopages/jsx/jsx-runtime";var ZA=rt(Ar,({children:e,...t})=>JA("rui-switch",{...t,children:e}),{stylesheets:["./switch.css"]});import{RadiantElement as Uv,customElement as rI,event as nI,onEvent as qv,onUpdated as oI,prop as Ir}from"@ecopages/radiant";var Av,Iv,Dv,Cv,kv,Ov,Vv,Mv,jv,Lv,Pv,Bv;function NA(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Fv(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Fv(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:tI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return iI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function tI(e){var t=eI(e,"string");return typeof t=="symbol"?t:t+""}function eI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fv(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function iI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Dr,$v=class extends Uv{static{({e:[Dv,Cv,kv,Ov,Vv,Mv,jv,Lv,Pv,Bv,Av],c:[Dr,Iv]}=NA(this,[rI("rui-tabs")],[[Ir({type:String,reflect:!0,defaultValue:"boxed"}),0,"variant"],[Ir({type:String,reflect:!0,defaultValue:""}),0,"value"],[Ir({type:String,defaultValue:""}),0,"label"],[Ir({type:Boolean,defaultValue:!0}),0,"automatic"],[nI({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[oI(["value","label"]),2,"onPropsUpdated"],[qv({selector:'[role="tab"]',type:"click"}),2,"onTabClick"],[qv({selector:'[role="tab"]',type:"keydown"}),2,"onTabKeydown"]],0,void 0,Uv))}variant=(Av(this),Dv(this));value=(Cv(this),kv(this));label=(Ov(this),Vv(this));automatic=(Mv(this),jv(this));changeEvent=(Lv(this),Pv(this));childObserver=(Bv(this),null);connectedCallback(){super.connectedCallback(),this.childObserver=new MutationObserver(()=>this.resync()),this.childObserver.observe(this,{childList:!0,subtree:!0}),queueMicrotask(()=>this.resync())}disconnectedCallback(){this.childObserver?.disconnect(),this.childObserver=null,super.disconnectedCallback()}onPropsUpdated(){this.resync()}resync(){this.syncTablistLabel(),this.syncSelection(this.value||this.getTabValue(this.getTabs()[0])||"")}getTabs(){return Array.from(this.querySelectorAll('[role="tab"]'))}getPanels(){return Array.from(this.querySelectorAll('[role="tabpanel"]'))}getTabValue(t){return t?t.dataset.tabValue??t.id.replace(/^tab-/,""):""}syncTablistLabel(){let t=this.querySelector('[role="tablist"]');!t||t.hasAttribute("aria-label")||!this.label||t.setAttribute("aria-label",this.label)}syncSelection(t){let i=this.getTabs(),r=this.getPanels();if(!i.length)return;let c=i.find(h=>this.getTabValue(h)===t)??i.find(h=>h.id===t)??i[0],p=this.getTabValue(c);this.value=p;for(let h of i){let a=h===c;h.setAttribute("aria-selected",String(a)),h.tabIndex=a?0:-1}for(let h of r){let E=(h.dataset.tabValue??h.id.replace(/^panel-/,""))===p;h.hidden=!E,h.hasAttribute("tabindex")||(h.tabIndex=0)}}activateTab(t){!t||t.getAttribute("aria-disabled")==="true"||(this.syncSelection(this.getTabValue(t)),this.changeEvent.emit({value:this.value}))}onTabClick(t){let i=t.target.closest('[role="tab"]');!i||!this.contains(i)||this.activateTab(i)}onTabKeydown(t){let i=this.getTabs(),r=t.target.closest('[role="tab"]');if(!r||!i.includes(r))return;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.activateTab(r);return}let c=st({items:i,current:r,key:t.key,orientation:"horizontal"});c.handled&&(t.preventDefault(),this.automatic&&this.activateTab(c.item))}static{Iv()}};import{jsx as oi}from"@ecopages/jsx/jsx-runtime";function aI({children:e,class:t,...i}){return oi("div",{...i,class:K("rui-tabs__list",t),role:"tablist",children:e})}function sI({id:e,children:t,class:i,disabled:r}){return oi("button",{type:"button",class:K("rui-tabs__tab",i),role:"tab",id:`tab-${e}`,"data-tab-value":e,"aria-controls":`panel-${e}`,"aria-selected":"false",tabindex:-1,disabled:r,children:t})}function lI({children:e,class:t,...i}){return oi("div",{...i,class:K("rui-tabs__panels",t),children:e})}function uI({id:e,children:t,class:i,hidden:r}){return oi("div",{class:K("rui-tabs__panel",i),role:"tabpanel",id:`panel-${e}`,"data-tab-value":e,"aria-labelledby":`tab-${e}`,tabindex:0,hidden:r,children:t})}var cI=rt(Dr,({children:e,...t})=>oi("rui-tabs",{...t,children:e}),{stylesheets:["./tabs.css"]});import{jsx as Cr,jsxs as ly}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as uy,customElement as mI,event as cy,onEvent as Zn,onUpdated as gI,prop as ai,state as bI}from"@ecopages/radiant";var zv,Kv,Wv,Gv,Hv,Yv,Xv,Qv,Jv,Zv,Nv,ty,ey,iy,ry,ny,oy,ay;function dI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:sy(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||sy(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:hI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return fI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function hI(e){var t=pI(e,"string");return typeof t=="symbol"?t:t+""}function pI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sy(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function fI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var kr,dy=class extends uy{static{({e:[Wv,Gv,Hv,Yv,Xv,Qv,Jv,Zv,Nv,ty,ey,iy,ry,ny,oy,ay,zv],c:[kr,Kv]}=dI(this,[mI("rui-tag-group")],[[ai({type:String,reflect:!0,defaultValue:""}),0,"value"],[ai({type:String,defaultValue:""}),0,"label"],[ai({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[ai({type:String,attribute:"selection-mode",defaultValue:"multiple"}),0,"selectionMode"],[ai({type:Boolean,reflect:!0,defaultValue:!1}),0,"embedded"],[cy({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[cy({name:"rui-remove",bubbles:!0,composed:!0}),0,"removeEvent"],[bI,0,"managedItems"],[gI(["value","label","disabled","selectionMode","embedded","managedItems"]),2,"onPropsUpdated"],[Zn({selector:"[data-tag]",type:"click"}),2,"onTagClick"],[Zn({selector:"[data-tag-remove]",type:"click"}),2,"onRemoveClick"],[Zn({selector:"[data-tag]",type:"keydown"}),2,"onTagKeydown"]],0,void 0,uy))}constructor(...t){super(...t),ay(this)}value=(zv(this),Wv(this));label=(Gv(this),Hv(this));disabled=(Yv(this),Xv(this));selectionMode=(Qv(this),Jv(this));embedded=(Zv(this),Nv(this));changeEvent=(ty(this),ey(this));removeEvent=(iy(this),ry(this));uid=(ny(this),Math.random().toString(36).slice(2,9));managedItems=oy(this,[]);isMultiple(){return this.selectionMode==="multiple"}getSelectedValues(){return this.value?br(this.value):[]}setSelectedValues(t){this.value=Ne(t)}getList(){let t=this.querySelector("[data-rui-managed-list]");if(t)return t;let i=this.querySelector("[data-tag-list]");return i||(this.getSlotElements().find(r=>r.matches("[data-tag-list]")||r.querySelector("[data-tag-list]"))??null)}getTags(){let t=this.getList();return t?Array.from(t.querySelectorAll("[data-tag]")):[]}getVisibleTags(){return this.getTags().filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}getTagValue(t){return t.getAttribute("data-value")||t.textContent?.trim()||""}getTagLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}ensureTagIds(){this.getTags().forEach((t,i)=>{t.id||(t.id=`rui-tag-${this.uid}-${i}`)})}syncList(){let t=this.getList();t&&(t.id||(t.id=`rui-tag-list-${this.uid}`),t.setAttribute("role","list"),t.setAttribute("aria-label",this.label||"Tags"),this.disabled?t.setAttribute("aria-disabled","true"):t.removeAttribute("aria-disabled"))}syncTags(){let t=new Set(this.getSelectedValues());this.getTags().forEach((r,c)=>{r.setAttribute("role","listitem");let p=this.getTagValue(r),h=t.has(p);r.setAttribute("aria-selected",String(h)),r.tabIndex=c===0?0:-1;let a=r.querySelector("[data-tag-remove]");a&&(a.type="button",a.tabIndex=-1,a.setAttribute("aria-label",`Remove ${this.getTagLabel(r)}`))})}selectTag(t){if(this.disabled||this.embedded||t.getAttribute("aria-disabled")==="true")return;let i=this.getTagValue(t);if(this.isMultiple()){let r=new Set(this.getSelectedValues());r.has(i)?r.delete(i):r.add(i),this.setSelectedValues([...r])}else this.value=i;this.syncTags(),this.changeEvent.emit({value:this.value})}removeTag(t){let i=this.getTagValue(t),r=new Set(this.getSelectedValues());r.delete(i),this.setSelectedValues([...r]),this.syncTags(),this.removeEvent.emit({value:i}),this.changeEvent.emit({value:this.value})}initialize(){this.ensureTagIds(),this.syncList(),this.syncTags()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}onPropsUpdated(){this.syncList(),this.syncTags()}resync(){this.ensureTagIds(),this.syncList(),this.syncTags()}setItems(t){this.managedItems=t,this.value=Ne(t.map(i=>i.value))}onTagClick(t){let i=t.target;if(i.closest("[data-tag-remove]"))return;let r=i.closest("[data-tag]");r&&this.contains(r)&&this.selectTag(r)}onRemoveClick(t){t.stopPropagation();let r=t.target.closest("[data-tag]");r&&this.contains(r)&&this.removeTag(r)}onTagKeydown(t){let i=this.getVisibleTags(),r=t.target.closest("[data-tag]");if(!r)return;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.embedded||this.selectTag(r);return}if(t.key==="Backspace"||t.key==="Delete"){r.querySelector("[data-tag-remove]")&&(t.preventDefault(),this.removeTag(r));return}st({items:i,current:r,key:t.key,orientation:"horizontal"}).handled&&t.preventDefault()}render(){return ly("div",{class:"rui-tag-group","data-ref":"root",children:[Cr("slot",{}),this.managedItems.length>0?Cr("div",{"data-tag-list":!0,"data-rui-managed-list":!0,class:"rui-tag-group__list",children:this.managedItems.map(t=>ly("span",{"data-tag":!0,"data-value":t.value,"data-label":t.label,class:"rui-tag",children:[t.label,Cr("button",{type:"button","data-tag-remove":!0,class:"rui-tag__remove","aria-label":`Remove ${t.label}`,children:Cr("span",{"aria-hidden":"true",children:"\xD7"})})]}))}):null]})}static{Kv()}};import{jsx as Zt,jsxs as vI}from"@ecopages/jsx/jsx-runtime";function hy({children:e,class:t,...i}){return Zt("div",{...i,"data-tag-list":!0,class:K("rui-tag-group__list",t),children:e})}function py({value:e,label:t,children:i,class:r,disabled:c,...p}){return vI("span",{...p,"data-tag":!0,"data-value":e,"data-label":t,class:K("rui-tag",r),"aria-disabled":c?"true":void 0,children:[i,Zt(fy,{})]})}function fy({children:e,class:t,"aria-label":i="Remove",...r}){return Zt("button",{...r,type:"button","data-tag-remove":!0,class:K("rui-tag__remove",t),"aria-label":i,children:e??Zt("span",{"aria-hidden":"true",children:"\xD7"})})}var yI=rt(kr,({tags:e,children:t,...i})=>e!=null?Zt("rui-tag-group",{...i,children:Zt(hy,{children:e.map(r=>Zt(py,{value:r.value,label:typeof r.label=="string"?r.label:void 0,disabled:r.disabled,children:r.label}))})}):Zt("rui-tag-group",{...i,children:t}),{stylesheets:["./tag-group.css"]});import{jsx as _I}from"@ecopages/jsx/jsx-runtime";function my(e){let{size:t="md",class:i,rows:r=3,...c}=e;return _I("textarea",{...c,rows:r,[Tt]:"","data-rui-control-type":"text",class:K("rui-textarea",`rui-textarea--${t}`,i)})}nt(my,["./textarea.css"],import.meta.url);import{jsx as Te,jsxs as $y}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as zy,bound as oo,customElement as AI,onEvent as Ky,onUpdated as Or,prop as Mt,query as II}from"@ecopages/radiant";var si="rui-toast-show",li="rui-toast-dismiss",ui=4e3,Nn=356,to=14,eo=24,io=3,ci=45,ro=200,di="bottom-end";function ue(e){let[t,i]=e.split("-");return{y:t,x:i}}var xI=1;function wI(){return xI++}function gy(e,t){return typeof e=="function"?e(t):e}var no=class{subscribers=[];toasts=[];subscribe=t=>(this.subscribers.push(t),t(this.toasts),()=>{let i=this.subscribers.indexOf(t);i>=0&&this.subscribers.splice(i,1)});getSnapshot=()=>this.toasts;publish(){let t=this.toasts;for(let i of this.subscribers)i(t)}create=(t,i={})=>{let r=i.id??wI(),c=i.dismissible??!0,p=this.toasts.findIndex(a=>a.id===r),h={id:r,title:t,description:i.description,variant:i.variant??"default",duration:i.duration,action:i.action,dismissible:c,closeButton:i.closeButton,position:i.position,delete:!1};return p>=0?this.toasts=this.toasts.map(a=>a.id===r?{...a,...h,delete:!1}:a):this.toasts=[h,...this.toasts],this.publish(),r};dismiss=t=>{if(t==null){if(this.toasts.length===0)return;this.toasts=this.toasts.map(i=>({...i,delete:!0}))}else{let i=this.toasts.find(r=>r.id===t);if(!i||i.delete)return;this.toasts=this.toasts.map(r=>r.id===t?{...r,delete:!0}:r)}this.publish()};remove=t=>{this.toasts=this.toasts.filter(i=>i.id!==t),this.publish()};clear=()=>{this.toasts.length!==0&&(this.toasts=[],this.publish())};message=(t,i)=>this.create(t,i);success=(t,i)=>this.create(t,{...i,variant:"success"});error=(t,i)=>this.create(t,{...i,variant:"error"});info=(t,i)=>this.create(t,{...i,variant:"info"});warning=(t,i)=>this.create(t,{...i,variant:"warning"});loading=(t,i)=>this.create(t,{...i,variant:"loading",duration:i?.duration??Number.POSITIVE_INFINITY});promise=(t,i)=>{let r=this.loading(i.loading,{duration:Number.POSITIVE_INFINITY,action:i.action,closeButton:i.closeButton,position:i.position,description:typeof i.description=="string"?i.description:void 0});return(typeof t=="function"?t():t).then(p=>{let h=typeof i.description=="function"?i.description(p):i.description;this.create(gy(i.success,p),{id:r,variant:"success",description:h,duration:i.duration,action:i.action,closeButton:i.closeButton,position:i.position})}).catch(p=>{let h=typeof i.description=="function"?i.description(p):i.description;this.create(gy(i.error,p),{id:r,variant:"error",description:h,duration:i.duration,action:i.action,closeButton:i.closeButton,position:i.position})}),r}},at=new no;var by,vy,yy,_y,xy,wy,Sy,Ey,Ty,Ry,Ay,Iy,Dy,Cy,ky,Oy,Vy,My,jy,Ly,Py,By,Fy,Uy;function SI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:qy(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||qy(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:EI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return RI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function EI(e){var t=TI(e,"string");return typeof t=="symbol"?t:t+""}function TI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qy(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function RI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Vr,Wy=class extends zy{static{({e:[yy,_y,xy,wy,Sy,Ey,Ty,Ry,Ay,Iy,Dy,Cy,ky,Oy,Vy,My,jy,Ly,Py,By,Fy,Uy,by],c:[Vr,vy]}=SI(this,[AI("rui-toast")],[[Mt({type:String,reflect:!0,defaultValue:""}),0,"toastId"],[Mt({type:String,defaultValue:""}),0,"title"],[Mt({type:String,defaultValue:""}),0,"description"],[Mt({type:String,reflect:!0,defaultValue:"default"}),0,"variant"],[Mt({type:Number,defaultValue:4e3}),0,"duration"],[Mt({type:Boolean,defaultValue:!0}),0,"dismissible"],[Mt({type:Boolean,defaultValue:!1}),0,"closeButton"],[Mt({type:String,defaultValue:""}),0,"actionLabel"],[Mt({type:String,defaultValue:di}),0,"position"],[Mt({type:Boolean,defaultValue:!1}),0,"markedDelete"],[II({ref:"toast"}),0,"toastTarget"],[Or(["title","description","variant","actionLabel","closeButton"]),2,"onContentUpdated"],[Or("position"),2,"onPositionUpdated"],[Or("duration"),2,"onDurationUpdated"],[Or("markedDelete"),2,"onMarkedDeleteUpdated"],[oo,2,"onPointerDown"],[oo,2,"onPointerMove"],[oo,2,"onPointerUp"],[Ky({selector:"[data-toast-close]",type:"click"}),2,"onCloseClick"],[Ky({selector:"[data-toast-action]",type:"click"}),2,"onActionClick"]],0,void 0,zy))}toastId=(by(this),yy(this));title=(_y(this),xy(this));description=(wy(this),Sy(this));variant=(Ey(this),Ty(this));duration=(Ry(this),Ay(this));dismissible=(Iy(this),Dy(this));closeButton=(Cy(this),ky(this));actionLabel=(Oy(this),Vy(this));position=(My(this),jy(this));markedDelete=(Ly(this),Py(this));toastTarget=(By(this),Fy(this));mounted=(Uy(this),!1);removed=!1;swiping=!1;swipeOut=!1;swipeAxis=null;swipeOutDirection=null;held=!1;timerReady=!1;timeoutId=null;pointerStart=null;dragStartTime=null;exitTimer=null;connectedCallback(){super.connectedCallback();let t=this.mounted;if(this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointermove",this.onPointerMove),this.addEventListener("pointerup",this.onPointerUp),this.addEventListener("pointercancel",this.onPointerUp),t){this.syncDomState(),this.dispatchEvent(new CustomEvent("rui-toast-mounted",{bubbles:!0}));return}this.timerReady=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&(this.mounted=!0,this.timerReady=!0,this.syncDomState(),this.dispatchEvent(new CustomEvent("rui-toast-mounted",{bubbles:!0})))})}),this.syncDomState()}disconnectedCallback(){this.clearTimer(),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=null);let t=this.resolvedId;t!==""&&this.removed&&at.remove(t),this.held=!1,this.timerReady=!1,this.removeEventListener("pointerdown",this.onPointerDown),this.removeEventListener("pointermove",this.onPointerMove),this.removeEventListener("pointerup",this.onPointerUp),this.removeEventListener("pointercancel",this.onPointerUp),super.disconnectedCallback()}onContentUpdated(){this.requestUpdate()}onPositionUpdated(){this.syncDomState()}setPaused(t){if(this.held===t){!t&&this.timerReady&&this.mounted&&!this.removed&&!this.timeoutId&&this.startTimer();return}this.held=t,!(!this.timerReady||!this.mounted||this.removed)&&(t||document.hidden?this.clearTimer():this.startTimer())}onDurationUpdated(){!this.timerReady||!this.mounted||this.removed||this.held||this.startTimer()}onMarkedDeleteUpdated(){this.markedDelete&&!this.removed&&this.beginRemove()}get resolvedId(){let t=this.toastId;if(t==null||t==="")return"";let i=Number(t);return Number.isFinite(i)&&String(i)===t?i:t}clearTimer(){this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=null}startTimer(){if(!(this.held||this.removed||document.hidden)&&!(this.duration===Number.POSITIVE_INFINITY||this.variant==="loading")){if(this.duration<=0){this.beginRemove();return}this.clearTimer(),this.timeoutId=setTimeout(()=>this.beginRemove(),this.duration)}}beginRemove(){this.removed||(this.removed=!0,this.clearTimer(),this.syncDomState(),this.markedDelete||at.dismiss(this.resolvedId),this.exitTimer=setTimeout(()=>{this.exitTimer=null,at.remove(this.resolvedId)},200))}onPointerDown(t){!this.dismissible||this.variant==="loading"||t.button!==0||t.target?.closest("[data-toast-close], [data-toast-action], button, a")||(this.dragStartTime=Date.now(),this.pointerStart={x:t.clientX,y:t.clientY},this.swipeAxis=null,this.setPointerCapture(t.pointerId))}onPointerMove(t){if(!this.pointerStart)return;let{y:i,x:r}=ue(this.position),c=t.clientX-this.pointerStart.x,p=t.clientY-this.pointerStart.y;if(!this.swiping){if(Math.abs(c)<8&&Math.abs(p)<8)return;this.swiping=!0,this.syncDomState()}this.swipeAxis||(this.swipeAxis=Math.abs(c)>Math.abs(p)?"x":"y");let h=this.swipeAxis==="x"?c:0,a=this.swipeAxis==="y"?p:0;if(this.swipeAxis==="y"&&!(i==="bottom"?a>0:a<0)&&Math.abs(a)<45){this.style.setProperty("--swipe-amount-x","0px"),this.style.setProperty("--swipe-amount-y","0px");return}if(this.swipeAxis==="x"){let E=r==="start"?h<0:h>0;if(r!=="center"&&!E&&Math.abs(h)<45){this.style.setProperty("--swipe-amount-x","0px"),this.style.setProperty("--swipe-amount-y","0px");return}}this.style.setProperty("--swipe-amount-x",`${h}px`),this.style.setProperty("--swipe-amount-y",`${a}px`)}onPointerUp(t){if(!this.pointerStart)return;try{this.releasePointerCapture(t.pointerId)}catch{}let i=this.swiping;if(this.swiping=!1,!i){this.pointerStart=null,this.dragStartTime=null,this.swipeAxis=null;return}let r=Number.parseFloat(this.style.getPropertyValue("--swipe-amount-x")||"0"),c=Number.parseFloat(this.style.getPropertyValue("--swipe-amount-y")||"0"),p=this.swipeAxis==="x"?r:c,h=this.dragStartTime?Date.now()-this.dragStartTime:0,a=Math.abs(p)/Math.max(h,1);if((Math.abs(p)>=45||a>.11)&&this.dismissible){let{y:C,x:R}=ue(this.position);this.swipeAxis==="x"?(this.swipeOutDirection=r<0?"left":"right",R==="start"&&(this.swipeOutDirection="left"),R==="end"&&(this.swipeOutDirection="right")):this.swipeOutDirection=C==="bottom"?"down":"up",this.swipeOut=!0,this.syncDomState(),this.beginRemove()}else this.style.setProperty("--swipe-amount-x","0px"),this.style.setProperty("--swipe-amount-y","0px"),this.swipeAxis=null,this.syncDomState();this.pointerStart=null,this.dragStartTime=null}onCloseClick(t){t.stopPropagation(),this.dismissible&&this.beginRemove()}onActionClick(t){t.stopPropagation(),at.getSnapshot().find(r=>r.id===this.resolvedId)?.action?.onClick(t),this.dismissible&&this.beginRemove()}syncDomState(){let{y:t,x:i}=ue(this.position);this.setAttribute("role","listitem"),this.dataset.mounted=String(this.mounted),this.dataset.removed=String(this.removed),this.dataset.swiping=String(this.swiping),this.dataset.swipeOut=String(this.swipeOut),this.dataset.dismissible=String(this.dismissible),this.dataset.yPosition=t,this.dataset.xPosition=i,this.dataset.variant=this.variant??"default",this.swipeOutDirection?this.dataset.swipeDirection=this.swipeOutDirection:delete this.dataset.swipeDirection}iconForVariant(){switch(this.variant){case"success":return"\u2713";case"error":return"\u2715";case"warning":return"!";case"info":return"i";default:return""}}render(){let t=this.variant??"default",i=this.iconForVariant(),r=t!=="default";return $y("div",{ref:"toast",class:`rui-toast rui-toast--${t}`,role:"status","aria-live":"off","data-ref":"toast",children:[this.closeButton&&t!=="loading"?Te("button",{type:"button",class:"rui-toast__close","data-toast-close":!0,"aria-label":"Close toast",children:"\xD7"}):null,r?Te("span",{class:"rui-toast__icon","data-icon":!0,"aria-hidden":"true",children:t==="loading"?Te("span",{class:"rui-toast__loader"}):i}):null,$y("div",{class:"rui-toast__content",children:[Te("div",{class:"rui-toast__title","data-title":!0,children:this.$.title}),this.description?Te("div",{class:"rui-toast__description","data-description":!0,children:this.$.description}):null]}),this.actionLabel?Te("button",{type:"button",class:"rui-toast__action rui-button rui-button--outline rui-button--sm","data-toast-action":!0,children:this.$.actionLabel}):null]})}static{vy()}};import{jsx as ao}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as d_,bound as Mr,customElement as VI,onEvent as so,onUpdated as MI,prop as ce,state as jI}from"@ecopages/radiant";var Gy,Hy,Yy,Xy,Qy,Jy,Zy,Ny,t_,e_,i_,r_,n_,o_,a_,s_,l_,u_;function DI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:c_(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||c_(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:CI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return OI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function CI(e){var t=kI(e,"string");return typeof t=="symbol"?t:t+""}function kI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function c_(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function OI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}function h_(e,t){return e instanceof Node&&t.contains(e)}var jr,p_=class extends d_{static{({e:[Yy,Xy,Qy,Jy,Zy,Ny,t_,e_,i_,r_,n_,o_,a_,s_,l_,u_,Gy],c:[jr,Hy]}=DI(this,[VI("rui-toaster")],[[ce({type:String,reflect:!0,defaultValue:di}),0,"position"],[ce({type:Number,defaultValue:4e3}),0,"duration"],[ce({type:Number,defaultValue:3}),0,"visibleToasts"],[ce({type:Boolean,defaultValue:!1}),0,"closeButton"],[ce({type:Boolean,defaultValue:!1}),0,"expand"],[ce({type:Number,defaultValue:14}),0,"gap"],[ce({type:Number,defaultValue:24}),0,"offset"],[jI,0,"toasts"],[MI(["position","duration","visibleToasts","closeButton","expand","gap","offset"]),2,"onConfigUpdated"],[so({document:!0,type:si}),2,"onDocumentShow"],[so({document:!0,type:li}),2,"onDocumentDismiss"],[so({selector:"rui-toast",type:"rui-toast-mounted"}),2,"onToastMounted"],[Mr,2,"onPointerOver"],[Mr,2,"onPointerOut"],[Mr,2,"onPointerDown"],[Mr,2,"onPointerUp"]],0,void 0,d_))}position=(Gy(this),Yy(this));duration=(Xy(this),Qy(this));visibleToasts=(Jy(this),Zy(this));closeButton=(Ny(this),t_(this));expand=(e_(this),i_(this));gap=(r_(this),n_(this));offset=(o_(this),a_(this));toasts=(s_(this),l_(this,[]));expanded=(u_(this),!1);interacting=!1;unsubscribe=null;visibilityHandler=null;heights=new Map;observers=new Map;layoutFrame=null;connectedCallback(){super.connectedCallback(),this.syncHostPosition(),this.unsubscribe=at.subscribe(t=>{this.toasts=t,t.length===0&&this.resetLayoutState(),this.scheduleLayoutSync()}),this.visibilityHandler=()=>this.syncPauseState(),document.addEventListener("visibilitychange",this.visibilityHandler)}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp),this.layoutFrame!=null&&cancelAnimationFrame(this.layoutFrame),this.resetLayoutState(),super.disconnectedCallback()}onConfigUpdated(){this.syncHostPosition(),this.scheduleLayoutSync()}onDocumentShow(t){let i=t.detail;i?.title&&at.create(i.title,{id:i.id,description:i.description,variant:i.variant,duration:i.duration,action:i.action,dismissible:i.dismissible,closeButton:i.closeButton,position:i.position})}onDocumentDismiss(t){let i=t.detail;at.dismiss(i?.id)}onToastMounted(){this.observeToasts(),this.syncPauseState()}filteredToasts(){let t=this.toasts.filter(c=>(c.position??this.position)===this.position),i=[],r=[];for(let c of t)c.delete?r.push(c):i.push(c);return[...i.slice(0,this.visibleToasts),...r]}syncHostPosition(){let{y:t,x:i}=ue(this.position);this.dataset.yPosition=t,this.dataset.xPosition=i,this.style.setProperty("--width",`${356}px`),this.style.setProperty("--gap",`${this.gap}px`),this.style.setProperty("--viewport-offset",`${this.offset}px`)}isStackExpanded(){return this.expanded||this.expand}isPaused(){return this.isStackExpanded()||this.interacting||document.hidden}resetLayoutState(){for(let i of this.observers.values())i.disconnect();this.observers.clear(),this.heights.clear(),this.expanded=!1,this.interacting=!1;let t=this.querySelector(".rui-toaster");t&&(t.style.height="0px",t.dataset.expanded="false"),this.dataset.expanded="false"}syncPauseState(){let t=this.isPaused();for(let i of this.querySelectorAll("rui-toast"))i.setPaused(t);this.patchStackLayout()}scheduleLayoutSync(){this.layoutFrame!=null&&cancelAnimationFrame(this.layoutFrame),this.layoutFrame=requestAnimationFrame(()=>{if(this.layoutFrame=null,this.toasts.length>0&&!this.interacting){let i=!!(this.querySelector(".rui-toaster")?.matches(":hover")||this.matches(":hover"));this.expanded=i}this.observeToasts(),this.syncPauseState()})}measureToast(t){let i=t.style.height,r=t.style.overflow;t.style.height="auto",t.style.overflow="visible";let c=t.querySelector(".rui-toast"),p=Math.round(c instanceof HTMLElement?c.offsetHeight:t.offsetHeight)||64;return t.style.height=i,t.style.overflow=r,p}observeToasts(){let t=this.querySelector(".rui-toaster");if(!t)return;let i=[...t.querySelectorAll("rui-toast")],r=new Set;for(let c of i){let p=c.toastId;if(!p)continue;r.add(p);let h=c.querySelector(".rui-toast")??c;if(!this.observers.has(p)){let a=new ResizeObserver(()=>{let E=this.measureToast(c);this.heights.get(p)!==E&&(this.heights.set(p,E),this.patchStackLayout())});a.observe(h),this.observers.set(p,a)}this.heights.set(p,this.measureToast(c))}for(let[c,p]of[...this.observers])r.has(c)||(p.disconnect(),this.observers.delete(c),this.heights.delete(c))}patchStackLayout(){let t=this.querySelector(".rui-toaster");if(!t)return;let i=this.isStackExpanded(),{y:r}=ue(this.position),c=r==="bottom"?-1:1;this.dataset.expanded=String(i),t.dataset.expanded=String(i);let p=[...t.querySelectorAll("rui-toast")].filter(R=>R.dataset.mounted==="true"&&R.dataset.removed!=="true");if(p.length===0){t.style.height="0px";return}let h=p.map(R=>{let D=this.heights.get(R.toastId)??this.measureToast(R);return this.heights.set(R.toastId,D),D}),a=h[0]??64,E=0;for(let R=0;R<p.length;R+=1){let D=p[R];if(!D)continue;let T=h[R]??64,z=R===0;if(D.dataset.index=String(R),D.dataset.front=String(z),D.dataset.expanded=String(i),D.style.setProperty("--z-index",String(p.length-R)),i)D.style.setProperty("--y",`translateY(${c*E}px)`),D.style.height=`${T}px`,D.style.overflow="visible",E+=T+this.gap;else if(z)D.style.setProperty("--y","translateY(0px)"),D.style.height=`${T}px`,D.style.overflow="visible";else{let $=Math.max(.7,1-R*.05);D.style.setProperty("--y",`translateY(${c*R*this.gap}px) scale(${$})`),D.style.height=`${a}px`,D.style.overflow="hidden"}}let C=i?Math.max(0,E>0?E-this.gap:a):a+Math.max(0,p.length-1)*this.gap;t.style.height=`${C}px`}onPointerOver(t){h_(t.relatedTarget,this)||(this.expanded=!0,this.syncPauseState())}onPointerOut(t){h_(t.relatedTarget,this)||this.interacting||(this.expanded=!1,this.syncPauseState())}onPointerDown(){this.interacting=!0,this.expanded=!0,this.syncPauseState(),document.addEventListener("pointerup",this.onPointerUp,{once:!0}),document.addEventListener("pointercancel",this.onPointerUp,{once:!0})}onPointerUp(){if(!this.interacting)return;this.interacting=!1,this.matches(":hover")||this.querySelector("rui-toast:hover")||(this.expanded=!1),this.syncPauseState()}render(){let t=this.filteredToasts();return ao("section",{class:"rui-toaster-region","aria-label":"Notifications","aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",tabIndex:-1,children:ao("ol",{class:"rui-toaster","data-rui-toaster":!0,"on:pointerover":this.onPointerOver,"on:pointerout":this.onPointerOut,"on:pointerdown":this.onPointerDown,children:t.map(i=>{let r=i.duration??(i.variant==="loading"?Number.POSITIVE_INFINITY:this.duration);return ao("rui-toast",{"prop:toastId":String(i.id),"prop:title":i.title,"prop:description":i.description??"","prop:variant":i.variant,"prop:duration":r,"prop:dismissible":i.dismissible,"prop:closeButton":i.closeButton??this.closeButton,"prop:actionLabel":i.action?.label??"","prop:position":i.position??this.position,"prop:markedDelete":!!i.delete},String(i.id))})})})}static{Hy()}};import{jsx as f_}from"@ecopages/jsx/jsx-runtime";var LI=rt(Vr,({toastId:e,title:t,description:i,variant:r,duration:c,dismissible:p,closeButton:h,actionLabel:a,position:E,markedDelete:C,...R})=>f_("rui-toast",{...R,"prop:toastId":e!=null?String(e):void 0,"prop:title":t,"prop:description":i,"prop:variant":r,"prop:duration":c,"prop:dismissible":p,"prop:closeButton":h,"prop:actionLabel":a,"prop:position":E,"prop:markedDelete":C}),{stylesheets:["./toast.css"]}),PI=rt(jr,({children:e,position:t,duration:i,visibleToasts:r,closeButton:c,expand:p,gap:h,offset:a,...E})=>f_("rui-toaster",{...E,"prop:position":t,"prop:duration":i,"prop:visibleToasts":r,"prop:closeButton":c,"prop:expand":p,"prop:gap":h,"prop:offset":a,children:e}),{stylesheets:["./toast.css"]});var BI=Object.assign((e,t)=>at.create(e,t),{message:(e,t)=>at.message(e,t),success:(e,t)=>at.success(e,t),error:(e,t)=>at.error(e,t),info:(e,t)=>at.info(e,t),warning:(e,t)=>at.warning(e,t),loading:(e,t)=>at.loading(e,t),promise:(e,t)=>at.promise(e,t),dismiss:e=>at.dismiss(e),clear:()=>at.clear()});function FI(e){document.dispatchEvent(new CustomEvent(si,{detail:e,bubbles:!0,composed:!0}))}function UI(e){let t=e==null?{}:{id:e};document.dispatchEvent(new CustomEvent(li,{detail:t,bubbles:!0,composed:!0}))}import{jsx as Lr,jsxs as GI}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as P_,bound as HI,customElement as YI,onUpdated as XI,prop as hi,state as B_}from"@ecopages/radiant";function m_(e,t){try{return e.querySelector(t)}catch{return null}}function g_(e,t){try{return Array.from(e.querySelectorAll(t))}catch{return[]}}function qI(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"")}function b_(e,t,i=r=>document.getElementById(r)!==null){if(e.id)return t.add(e.id),e.id;let r=qI(e.textContent||"")||"section",c=r,p=2;for(;t.has(c)||i(c);)c=`${r}-${p}`,p+=1;return e.id=c,t.add(c),c}function v_(e,t){return e instanceof HTMLElement?e.getBoundingClientRect().top+t:t}function y_(e,t,i,r){if(t instanceof HTMLElement){let c=t.getBoundingClientRect(),p=e.getBoundingClientRect();t.scrollTo({top:t.scrollTop+(p.top-c.top)-i,behavior:r});return}window.scrollTo({top:window.scrollY+e.getBoundingClientRect().top-i,behavior:r})}var __,x_,w_,S_,E_,T_,R_,A_,I_,D_,C_,k_,O_,V_,M_,j_;function $I(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:L_(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||L_(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:zI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return WI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function zI(e){var t=KI(e,"string");return typeof t=="symbol"?t:t+""}function KI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function L_(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function WI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Pr,F_=class extends P_{static{({e:[w_,S_,E_,T_,R_,A_,I_,D_,C_,k_,O_,V_,M_,j_,__],c:[Pr,x_]}=$I(this,[YI("rui-toc")],[[hi({type:String,defaultValue:""}),0,"target"],[hi({type:String,attribute:"heading-selector",defaultValue:"h2,h3"}),0,"headingSelector"],[hi({type:String,defaultValue:"On this page"}),0,"label"],[hi({type:Number,attribute:"scroll-offset",defaultValue:120}),0,"scrollOffset"],[hi({type:String,attribute:"navigation-events",defaultValue:""}),0,"navigationEvents"],[B_,0,"entries"],[B_,0,"activeId"],[XI(["target","headingSelector","scrollOffset","navigationEvents"]),2,"onScanSettingsUpdated"],[HI,2,"onLinkClick"]],0,void 0,P_))}target=(__(this),w_(this,""));headingSelector=(S_(this),E_(this,"h2,h3"));label=(T_(this),R_(this,"On this page"));scrollOffset=(A_(this),I_(this,120));navigationEvents=(D_(this),C_(this,""));entries=(k_(this),O_(this,[]));activeId=(V_(this),M_(this,null));headings=(j_(this),[]);scrollRoot=null;scrollCleanup=null;navigationCleanups=[];pendingScrollTargetId=null;scrollRafPending=!1;scrollOffsetTolerance=4;connectedCallback(){super.connectedCallback(),this.rebuild(),this.attachNavigationListeners()}disconnectedCallback(){this.detachScrollListener(),this.detachNavigationListeners(),super.disconnectedCallback()}onScanSettingsUpdated(){this.detachNavigationListeners(),this.attachNavigationListeners(),this.rebuild()}rebuild(){this.detachScrollListener(),this.headings=[],this.entries=[],this.activeId=null,this.pendingScrollTargetId=null,this.scrollRoot=null;let t=this.resolveTarget();if(!t)return;let i=g_(t,this.headingSelector);if(i.length===0)return;let r=new Set,c=i.map(p=>({id:b_(p,r),label:(p.textContent||"").trim(),depth:this.headingDepth(p)}));this.headings=i,this.entries=c,this.scrollRoot=this.resolveScrollRoot(t),this.attachScrollListener(),this.updateActiveHeading()}resolveTarget(){let t=this.target.trim();return t?m_(document,t):this.parentElement}resolveScrollRoot(t){let i=t;for(;i&&i!==document.documentElement&&i!==document.body;){let r=getComputedStyle(i).overflowY;if(r==="auto"||r==="scroll"||r==="overlay")return i;i=i.parentElement}return window}headingDepth(t){let i=Number.parseInt(t.tagName.slice(1),10);return Number.isFinite(i)?i:2}attachNavigationListeners(){let t=()=>this.rebuild();for(let i of yr(this.navigationEvents))document.addEventListener(i,t),this.navigationCleanups.push(()=>document.removeEventListener(i,t))}detachNavigationListeners(){for(let t of this.navigationCleanups)t();this.navigationCleanups=[]}attachScrollListener(){let t=()=>{this.scrollRafPending||(this.scrollRafPending=!0,requestAnimationFrame(()=>{this.updateActiveHeading(),this.scrollRafPending=!1}))},i=this.scrollRoot??window;if(i===window){window.addEventListener("scroll",t,{passive:!0}),this.scrollCleanup=()=>window.removeEventListener("scroll",t);return}i.addEventListener("scroll",t,{passive:!0}),this.scrollCleanup=()=>i.removeEventListener("scroll",t)}detachScrollListener(){this.scrollCleanup?.(),this.scrollCleanup=null}isScrollAtBottom(){let t=this.scrollRoot??window;if(!(t instanceof HTMLElement)){let i=document.documentElement.scrollHeight,r=window.innerHeight;return i<=r+1?!1:window.scrollY+r>=i-10}return t.scrollHeight<=t.clientHeight+1?!1:t.scrollTop+t.clientHeight>=t.scrollHeight-10}activeLineY(){return v_(this.scrollRoot??window,this.scrollOffset+this.scrollOffsetTolerance)}updateActiveHeading(){if(this.headings.length===0)return;if(this.isScrollAtBottom()){this.pendingScrollTargetId=null;let r=this.headings[this.headings.length-1]?.id;r&&this.setActiveId(r);return}if(this.pendingScrollTargetId){let r=this.findHeadingById(this.pendingScrollTargetId);if(!r)this.pendingScrollTargetId=null;else if(this.hasPendingScrollReachedTarget(r))this.pendingScrollTargetId=null;else{this.setActiveId(this.pendingScrollTargetId);return}}let t=this.activeLineY(),i=null;for(let r of this.headings)if(r.getBoundingClientRect().top<=t)i=r.id;else break;this.setActiveId(i??this.headings[0].id)}setActiveId(t){this.activeId!==t&&(this.activeId=t)}findHeadingById(t){return this.headings.find(i=>i.id===t)??null}hasPendingScrollReachedTarget(t){return t.getBoundingClientRect().top<=this.activeLineY()}onLinkClick(t,i){let r=t;if(r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0)return;let c=this.findHeadingById(i);c&&(t.preventDefault(),this.pendingScrollTargetId=i,this.setActiveId(i),this.scrollToHeading(i,c))}scrollToHeading(t,i){let r=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth";window.history.replaceState(window.history.state,"",`${window.location.pathname}${window.location.search}#${t}`),y_(i,this.scrollRoot??window,this.scrollOffset,r)}render(){return this.entries.length===0?null:GI("nav",{class:"rui-toc","aria-label":this.label,children:[this.label?Lr("p",{class:"rui-toc__label",children:this.label}):null,Lr("ul",{class:"rui-toc__list",children:this.entries.map(t=>Lr("li",{class:t.depth>=3?"rui-toc__item rui-toc__item--depth-3":"rui-toc__item",children:Lr("a",{href:`#${t.id}`,class:t.id===this.activeId?"rui-toc__link rui-toc__link--active":"rui-toc__link","on:click":i=>this.onLinkClick(i,t.id),children:t.label})}))})]})}static{x_()}};import{jsx as QI}from"@ecopages/jsx/jsx-runtime";var JI=rt(Pr,({target:e,headingSelector:t,label:i,scrollOffset:r,navigationEvents:c,...p})=>QI("rui-toc",{...p,"prop:target":e,"prop:headingSelector":t,"prop:label":i,"prop:scrollOffset":r,"prop:navigationEvents":c}),{stylesheets:["./toc.css"]});import{jsx as H_}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Y_,customElement as iD,onEvent as X_,prop as Q_}from"@ecopages/radiant";var U_,q_,$_,z_,K_,W_;function ZI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:G_(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||G_(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:NI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return eD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function NI(e){var t=tD(e,"string");return typeof t=="symbol"?t:t+""}function tD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function G_(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function eD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Br,J_=class extends Y_{static{({e:[$_,z_,K_,W_,U_],c:[Br,q_]}=ZI(this,[iD("rui-toolbar")],[[Q_({type:String,defaultValue:""}),0,"label"],[Q_({type:Boolean,reflect:!0,defaultValue:!1}),0,"exclusiveToggles"],[X_({type:"keydown",selector:"button, a[href], input, select, [tabindex]"}),2,"onKeydown"],[X_({type:"click",selector:"button[data-toggle][aria-pressed]",options:{capture:!0}}),2,"onToggleButtonClick"]],0,void 0,Y_))}label=(U_(this),$_(this));exclusiveToggles=(z_(this),K_(this));resolvedAriaLabel=(W_(this),this.$.label.map(t=>t||void 0));getItems(){return Li(this)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>lt(this.getItems(),0))}onKeydown(t){let i=this.getItems(),r=t.target.closest("button, a[href], input, select, [tabindex]");st({items:i,current:r,key:t.key,orientation:"horizontal"}).handled&&t.preventDefault()}getToggleButtons(){return Array.from(this.querySelectorAll("button[data-toggle][aria-pressed]")).filter(t=>!t.disabled)}onToggleButtonClick(t){let i=t.target.closest("button[data-toggle][aria-pressed]");if(!i||i.disabled)return;t.stopImmediatePropagation();let r=i.getAttribute("aria-pressed")==="true";if(this.exclusiveToggles){for(let c of this.getToggleButtons())c.setAttribute("aria-pressed","false");r||i.setAttribute("aria-pressed","true");return}i.setAttribute("aria-pressed",String(!r))}render(){return H_("div",{class:"rui-toolbar",role:"toolbar","aria-label":this.resolvedAriaLabel,children:H_("slot",{})})}static{q_()}};import{jsx as rD}from"@ecopages/jsx/jsx-runtime";var nD=rt(Br,({children:e,...t})=>rD("rui-toolbar",{...t,children:e}),{stylesheets:["./toolbar.css"]});import{jsx as lo,jsxs as uD}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ux,bound as cx,customElement as cD,onEvent as uo,onUpdated as dD,prop as co,query as hD}from"@ecopages/radiant";var Z_,N_,tx,ex,ix,rx,nx,ox,ax,sx;function oD(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:lx(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||lx(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:aD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return lD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function aD(e){var t=sD(e,"string");return typeof t=="symbol"?t:t+""}function sD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lx(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function lD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var dx=8,Fr,hx=class extends ux{static{({e:[tx,ex,ix,rx,nx,ox,ax,sx,Z_],c:[Fr,N_]}=oD(this,[cD("rui-tooltip")],[[co({type:String,defaultValue:""}),0,"content"],[co({type:String,defaultValue:"top"}),0,"placement"],[co({type:Number,defaultValue:200}),0,"delay"],[hD({ref:"tooltip"}),0,"tooltipTarget"],[dD(["content","placement"]),2,"onDescribedPropsUpdated"],[uo({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[uo({type:"focusin",selector:".rui-tooltip__trigger"}),2,"onFocusIn"],[uo({type:"focusout",selector:".rui-tooltip__trigger"}),2,"onFocusOut"],[cx,2,"onPointerEnter"],[cx,2,"onPointerLeave"]],0,void 0,ux))}content=(Z_(this),tx(this));placement=(ex(this),ix(this));delay=(rx(this),nx(this));tooltipTarget=(ox(this),ax(this));open=(sx(this),!1);showTimer=null;hideTimer=null;tooltipId=`rui-tooltip-${Math.random().toString(36).slice(2,9)}`;describedEl=null;cleanupFloating=null;connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",this.onPointerEnter),this.addEventListener("pointerleave",this.onPointerLeave),queueMicrotask(()=>this.wireTrigger())}disconnectedCallback(){this.clearTimers(),this.teardownFloating(),this.removeEventListener("pointerenter",this.onPointerEnter),this.removeEventListener("pointerleave",this.onPointerLeave),this.describedEl?.removeAttribute("aria-describedby"),super.disconnectedCallback()}clearTimers(){this.showTimer&&clearTimeout(this.showTimer),this.hideTimer&&clearTimeout(this.hideTimer),this.showTimer=null,this.hideTimer=null}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}getAnchor(){return vc(this)??this}wireTrigger(){this.describedEl?.removeAttribute("aria-describedby"),this.describedEl=this.getAnchor(),this.describedEl.setAttribute("aria-describedby",this.tooltipId)}attachFloating(){this.tooltipTarget&&(this.teardownFloating(),this.cleanupFloating=Ii({anchor:this.getAnchor(),floating:this.tooltipTarget,getPlacement:()=>this.placement,gap:dx}))}onDescribedPropsUpdated(){this.wireTrigger(),this.open&&this.tooltipTarget&&hn(this.getAnchor(),this.tooltipTarget,this.placement,dx)}setOpen(t){this.clearTimers(),this.open=t,this.tooltipTarget&&(this.tooltipTarget.hidden=!t,t?this.attachFloating():this.teardownFloating())}scheduleShow(){if(this.clearTimers(),this.delay<=0){this.setOpen(!0);return}this.showTimer=setTimeout(()=>this.setOpen(!0),this.delay)}scheduleHide(){this.clearTimers(),this.hideTimer=setTimeout(()=>this.setOpen(!1),80)}onDocumentKeydown(t){!this.open||t.key!=="Escape"||this.setOpen(!1)}onFocusIn(){this.scheduleShow()}onFocusOut(t){let i=t.relatedTarget;i&&this.contains(i)||this.scheduleHide()}onPointerEnter(){this.scheduleShow()}onPointerLeave(){this.scheduleHide()}render(){return uD("span",{class:"rui-tooltip",children:[lo("span",{class:"rui-tooltip__trigger",children:lo("slot",{})}),lo("span",{"data-ref":"tooltip",id:this.tooltipId,class:"rui-tooltip__content rui-floating",role:"tooltip",hidden:!0,children:this.$.content})]})}static{N_()}};import{jsx as pD}from"@ecopages/jsx/jsx-runtime";var fD=rt(Fr,({children:e,...t})=>pD("rui-tooltip",{...t,children:e}),{stylesheets:["./tooltip.css"]});import{jsx as wx}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Sx,customElement as yD,event as _D,onEvent as Ex,onUpdated as xD,prop as Tx}from"@ecopages/radiant";var px,fx,mx,gx,bx,vx,yx,_x;function mD(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:xx(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||xx(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:gD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return vD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function gD(e){var t=bD(e,"string");return typeof t=="symbol"?t:t+""}function bD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xx(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function vD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ur,Rx=class extends Sx{static{({e:[mx,gx,bx,vx,yx,_x,px],c:[Ur,fx]}=mD(this,[yD("rui-tree")],[[Tx({type:String,defaultValue:""}),0,"label"],[Tx({type:String,reflect:!0,defaultValue:""}),0,"value"],[_D({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[xD("value"),2,"onValueUpdated"],[Ex({selector:'[role="treeitem"]',type:"click"}),2,"onClick"],[Ex({selector:'[role="treeitem"]',type:"keydown"}),2,"onKeydown"]],0,void 0,Sx))}label=(px(this),mx(this));value=(gx(this),bx(this));changeEvent=(vx(this),yx(this));resolvedAriaLabel=(_x(this),this.$.label.map(t=>t||void 0));getVisibleItems(){return Array.from(this.querySelectorAll('[role="treeitem"]')).filter(t=>{let i=t.parentElement;for(;i&&i!==this;){if(i.getAttribute("role")==="group"&&i.hidden)return!1;i=i.parentElement}return!0})}getParentItem(t){let i=t.closest('[role="group"]');if(!i)return null;let r=i.previousElementSibling;return r?.getAttribute("role")==="treeitem"?r:null}getSiblingItems(t){let i=this.getParentItem(t),r=i?i.nextElementSibling?.getAttribute("role")==="group"?i.nextElementSibling:null:this.querySelector('[role="tree"]')??this;return r?Array.from(r.querySelectorAll(':scope > li > [role="treeitem"], :scope > [role="treeitem"]')):[]}syncSelection(){let t=Array.from(this.querySelectorAll('[role="treeitem"]')),i=this.getVisibleItems(),r=0;t.forEach((c,p)=>{let h=c.getAttribute("data-value")||c.id||"",a=!!this.value&&h===this.value;if(c.setAttribute("aria-selected",String(a)),a){let E=i.indexOf(c);E>=0&&(r=E)}else!this.value&&p===0&&(r=0)}),lt(i,r)}syncExpanded(){let t=Array.from(this.querySelectorAll('[role="treeitem"]'));for(let i of t){if(!i.hasAttribute("aria-expanded"))continue;let r=i.nextElementSibling;r?.getAttribute("role")==="group"&&(r.hidden=i.getAttribute("aria-expanded")==="false")}}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncExpanded(),this.syncSelection()})}onValueUpdated(){this.syncSelection()}select(t){let i=t.getAttribute("data-value")||t.id||t.textContent?.trim()||"";this.value=i,this.syncSelection(),this.changeEvent.emit({value:i}),t.focus()}setExpanded(t,i){t.setAttribute("aria-expanded",String(i));let r=t.nextElementSibling;r?.getAttribute("role")==="group"&&(r.hidden=!i),this.syncSelection()}onClick(t){let i=t.target.closest('[role="treeitem"]');!i||!this.contains(i)||(i.hasAttribute("aria-expanded")&&this.setExpanded(i,i.getAttribute("aria-expanded")!=="true"),this.select(i))}onKeydown(t){let i=t.target.closest('[role="treeitem"]');if(i)switch(t.key){case"ArrowDown":case"ArrowUp":case"Home":case"End":{if(!st({items:this.getVisibleItems(),current:i,key:t.key,orientation:"vertical",wrap:!1}).handled)return;t.preventDefault();break}case"ArrowRight":{if(t.preventDefault(),i.getAttribute("aria-expanded")==="false"){this.setExpanded(i,!0);return}if(i.getAttribute("aria-expanded")==="true"){let r=this.getVisibleItems(),c=r.indexOf(i);r[c+1]&&ge(r,c+1)}break}case"ArrowLeft":{if(t.preventDefault(),i.getAttribute("aria-expanded")==="true"){this.setExpanded(i,!1);return}let r=this.getParentItem(i);if(r){let c=this.getVisibleItems(),p=c.indexOf(r);p>=0&&ge(c,p)}break}case"*":{t.preventDefault();for(let r of this.getSiblingItems(i))r.hasAttribute("aria-expanded")&&this.setExpanded(r,!0);break}case"Enter":{t.preventDefault(),i.hasAttribute("aria-expanded")&&this.setExpanded(i,i.getAttribute("aria-expanded")!=="true"),this.select(i);break}case" ":{t.preventDefault(),this.select(i);break}default:break}}render(){return wx("ul",{class:"rui-tree",role:"tree","aria-label":this.resolvedAriaLabel,"aria-multiselectable":"false",children:wx("slot",{})})}static{fx()}};import{Fragment as Ax,jsx as Nt,jsxs as wD}from"@ecopages/jsx/jsx-runtime";var Ix=({nodes:e})=>Nt(Ax,{children:e.map(t=>Nt("li",{class:"rui-tree__item",children:t.children?.length?wD(Ax,{children:[Nt("button",{type:"button",class:"rui-tree__node",role:"treeitem","data-value":t.id,"aria-expanded":t.expanded??!1,"aria-selected":"false",tabindex:-1,children:t.label}),Nt("ul",{role:"group",hidden:!(t.expanded??!1),children:Nt(Ix,{nodes:t.children})})]}):Nt("button",{type:"button",class:"rui-tree__node",role:"treeitem","data-value":t.id,"aria-selected":"false",tabindex:-1,children:t.label})}))}),SD=rt(Ur,({nodes:e,...t})=>Nt("rui-tree",{...t,children:Nt(Ix,{nodes:e})}),{stylesheets:["./tree.css"]});import{jsx as Bx}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Fx,customElement as ID,event as DD,onEvent as Ux,onUpdated as CD,prop as qx}from"@ecopages/radiant";var Dx,Cx,kx,Ox,Vx,Mx,jx,Lx;function ED(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Px(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Px(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:TD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return AD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function TD(e){var t=RD(e,"string");return typeof t=="symbol"?t:t+""}function RD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Px(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function AD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var qr,$x=class extends Fx{static{({e:[kx,Ox,Vx,Mx,jx,Lx,Dx],c:[qr,Cx]}=ED(this,[ID("rui-treegrid")],[[qx({type:String,defaultValue:""}),0,"label"],[qx({type:String,reflect:!0,defaultValue:""}),0,"value"],[DD({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[CD("value"),2,"onValueUpdated"],[Ux({selector:'[role="gridcell"]',type:"click"}),2,"onCellClick"],[Ux({selector:'[role="gridcell"]',type:"keydown"}),2,"onCellKeydown"]],0,void 0,Fx))}label=(Dx(this),kx(this));value=(Ox(this),Vx(this));changeEvent=(Mx(this),jx(this));resolvedAriaLabel=(Lx(this),this.$.label.map(t=>t||void 0));getDataRows(){return Array.from(this.querySelectorAll('[role="row"][data-row-id]'))}getVisibleRows(){return this.getDataRows().filter(t=>{let i=t.parentElement;for(;i&&i!==this;){if(i.getAttribute("role")==="rowgroup"&&i.hidden)return!1;i=i.parentElement}return!0})}getRowCells(t){return Array.from(t.children).filter(i=>i instanceof HTMLElement&&i.getAttribute("role")==="gridcell")}getVisibleCells(){return this.getVisibleRows().flatMap(t=>this.getRowCells(t))}getParentRow(t){let i=t.parentElement;if(!i||i.getAttribute("role")!=="rowgroup")return null;let r=i.previousElementSibling;return r?.getAttribute("role")==="row"?r:null}syncExpanded(){for(let t of this.getDataRows()){if(!t.hasAttribute("aria-expanded"))continue;let i=t.nextElementSibling;i?.getAttribute("role")==="rowgroup"&&(i.hidden=t.getAttribute("aria-expanded")==="false")}}syncSelection(){let t=this.getVisibleCells(),i=0;for(let r of this.getDataRows()){let c=r.getAttribute("data-row-id")??"",p=!!this.value&&c===this.value;for(let h of this.getRowCells(r))if(h.setAttribute("aria-selected",String(p)),p){let a=t.indexOf(h);a>=0&&(i=a)}}t.length>0&<(t,i)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncExpanded(),this.syncSelection()})}onValueUpdated(){this.syncSelection()}setExpanded(t,i){t.setAttribute("aria-expanded",String(i));let r=t.nextElementSibling;r?.getAttribute("role")==="rowgroup"&&(r.hidden=!i)}activateCell(t){let i=t.closest('[role="row"][data-row-id]');if(!i)return;let r=i.getAttribute("data-row-id")??"",c=this.getRowCells(i).indexOf(t);this.value=r,this.syncSelection(),this.changeEvent.emit({rowId:r,columnIndex:c}),t.focus()}focusCell(t,i){if(this.getVisibleRows().indexOf(t)<0)return;let p=this.getVisibleCells(),h=this.getRowCells(t),a=h[Math.min(Math.max(0,i),h.length-1)],E=p.indexOf(a);E>=0&&ge(p,E)}onCellClick(t){let i=t.target.closest('[role="gridcell"]');if(!i||!this.contains(i))return;let r=i.closest('[role="row"][data-row-id]');r&&this.getRowCells(r).indexOf(i)===0&&r.hasAttribute("aria-expanded")&&this.setExpanded(r,r.getAttribute("aria-expanded")!=="true"),this.activateCell(i)}onCellKeydown(t){let i=t.target.closest('[role="gridcell"]'),r=i?.closest('[role="row"][data-row-id]');if(!i||!r)return;let c=this.getVisibleRows(),p=c.indexOf(r),h=this.getRowCells(r),a=h.indexOf(i),E=a===0,C=r.hasAttribute("aria-expanded"),R=r.getAttribute("aria-expanded")==="true";switch(t.key){case"ArrowRight":{if(t.preventDefault(),E&&C&&!R){this.setExpanded(r,!0),this.syncSelection();return}a<h.length-1&&this.focusCell(r,a+1);return}case"ArrowLeft":{if(t.preventDefault(),E&&C&&R){this.setExpanded(r,!1),this.syncSelection();return}if(a>0){this.focusCell(r,a-1);return}let D=this.getParentRow(r);D&&this.focusCell(D,0);return}case"ArrowDown":{t.preventDefault();let D=c[Math.min(c.length-1,p+1)];D&&D!==r&&this.focusCell(D,a);return}case"ArrowUp":{t.preventDefault();let D=c[Math.max(0,p-1)];D&&D!==r&&this.focusCell(D,a);return}case"Home":{t.preventDefault(),this.focusCell(r,0);return}case"End":{t.preventDefault(),this.focusCell(r,h.length-1);return}case"*":{t.preventDefault();for(let D of this.getDataRows())D.hasAttribute("aria-expanded")&&this.setExpanded(D,!0);this.syncSelection();return}case"Enter":{if(t.preventDefault(),E&&C){this.setExpanded(r,!R),this.syncSelection();return}this.activateCell(i);return}case" ":{t.preventDefault(),this.activateCell(i);return}default:return}}render(){return Bx("div",{class:"rui-treegrid",role:"treegrid","aria-label":this.resolvedAriaLabel,children:Bx("slot",{})})}static{Cx()}};import{Fragment as zx,jsx as te,jsxs as Kx}from"@ecopages/jsx/jsx-runtime";var Wx=({rows:e})=>te(zx,{children:e.map(t=>Kx(zx,{children:[te("div",{class:"rui-treegrid__row",role:"row","data-row-id":t.id,"aria-expanded":t.children?.length?t.expanded??!1:void 0,children:t.cells.map((i,r)=>te("div",{class:"rui-treegrid__cell",role:"gridcell",tabindex:-1,"data-col":r,"aria-selected":"false",children:i}))}),t.children?.length?te("div",{class:"rui-treegrid__group",role:"rowgroup",hidden:!(t.expanded??!1),children:te(Wx,{rows:t.children})}):null]}))}),kD=rt(qr,({columns:e,rows:t,...i})=>Kx("rui-treegrid",{...i,children:[te("div",{class:"rui-treegrid__row rui-treegrid__row--header",role:"row",children:e.map(r=>te("div",{class:"rui-treegrid__cell rui-treegrid__cell--header",role:"columnheader",children:r}))}),te(Wx,{rows:t})]}),{stylesheets:["./treegrid.css"]});import{jsx as pi,jsxs as LD}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as s0,bound as l0,customElement as PD,event as BD,onEvent as u0,onUpdated as FD,prop as ho,query as c0}from"@ecopages/radiant";var Gx,Hx,Yx,Xx,Qx,Jx,Zx,Nx,t0,e0,i0,r0,n0,o0;function OD(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:a0(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||a0(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:VD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return jD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function VD(e){var t=MD(e,"string");return typeof t=="symbol"?t:t+""}function MD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function a0(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function jD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var $r,d0=class extends s0{static{({e:[Yx,Xx,Qx,Jx,Zx,Nx,t0,e0,i0,r0,n0,o0,Gx],c:[$r,Hx]}=OD(this,[PD("rui-window-splitter")],[[ho({type:Number,reflect:!0,defaultValue:50}),0,"value"],[ho({type:String,defaultValue:"horizontal"}),0,"orientation"],[ho({type:String,defaultValue:"Split view"}),0,"label"],[c0({ref:"primary"}),0,"primaryTarget"],[c0({ref:"separator"}),0,"separatorTarget"],[BD({name:"rui-splitter-change",bubbles:!0,composed:!0}),0,"changeEvent"],[FD(["value","orientation"]),2,"onPropsUpdated"],[u0({ref:"separator",type:"keydown"}),2,"onKeydown"],[u0({ref:"separator",type:"pointerdown"}),2,"onPointerDown"],[l0,2,"onPointerMove"],[l0,2,"onPointerUp"]],0,void 0,s0))}value=(Gx(this),Yx(this));orientation=(Xx(this),Qx(this));label=(Jx(this),Zx(this));primaryTarget=(Nx(this),t0(this));separatorTarget=(e0(this),i0(this));changeEvent=(r0(this),n0(this));resolvedAriaOrientation=(o0(this),this.$.orientation.map(t=>t!=="vertical"?"vertical":"horizontal"));dragging=!1;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.applySize())}disconnectedCallback(){document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),super.disconnectedCallback()}onPropsUpdated(){this.applySize()}applySize(){if(!this.primaryTarget)return;let t=`${Math.min(80,Math.max(20,this.value))}%`;this.orientation==="vertical"?(this.primaryTarget.style.height=t,this.primaryTarget.style.width=""):(this.primaryTarget.style.width=t,this.primaryTarget.style.height="")}onKeydown(t){let i=t.shiftKey?10:2,r=this.orientation!=="vertical";r&&t.key==="ArrowLeft"||!r&&t.key==="ArrowUp"?(t.preventDefault(),this.updateValue(Math.max(20,this.value-i))):r&&t.key==="ArrowRight"||!r&&t.key==="ArrowDown"?(t.preventDefault(),this.updateValue(Math.min(80,this.value+i))):t.key==="Home"?(t.preventDefault(),this.updateValue(20)):t.key==="End"&&(t.preventDefault(),this.updateValue(80))}updateValue(t){t!==this.value&&(this.value=t,this.changeEvent.emit({value:t}))}onPointerDown(t){this.dragging=!0,this.separatorTarget.setPointerCapture(t.pointerId),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)}onPointerMove(t){if(!this.dragging)return;let i=this.getBoundingClientRect();this.orientation==="vertical"?this.updateValue(Math.min(80,Math.max(20,(t.clientY-i.top)/i.height*100))):this.updateValue(Math.min(80,Math.max(20,(t.clientX-i.left)/i.width*100)))}onPointerUp(){this.dragging=!1,document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp)}render(){let t=this.orientation!=="vertical";return LD("div",{class:`rui-window-splitter rui-window-splitter--${t?"horizontal":"vertical"}`,children:[pi("div",{"data-ref":"primary",class:"rui-window-splitter__pane",children:pi("slot",{name:"primary"})}),pi("div",{"data-ref":"separator",class:"rui-window-splitter__separator",role:"separator",tabindex:0,"aria-orientation":this.resolvedAriaOrientation,"aria-valuenow":this.$.value,"aria-valuemin":20,"aria-valuemax":80,"aria-label":this.$.label}),pi("div",{class:"rui-window-splitter__pane",children:pi("slot",{name:"secondary"})})]})}static{Hx()}};import{jsx as h0,jsxs as UD}from"@ecopages/jsx/jsx-runtime";var qD=rt($r,({primary:e,secondary:t,...i})=>UD("rui-window-splitter",{...i,children:[h0("div",{slot:"primary",children:e}),h0("div",{slot:"secondary",children:t})]}),{stylesheets:["./window-splitter.css"]});export{di as DEFAULT_TOAST_POSITION,Ge as FormStore,Tt as RUI_CONTROL_ATTR,wn as RUI_DIALOG_ACTION_EVENT,Fi as RUI_DIALOG_CLOSE_EVENT,Pt as RUI_DIALOG_HOST_ID,Bi as RUI_DIALOG_OPEN_EVENT,Ui as RUI_DIALOG_TOGGLE_EVENT,Hi as RUI_FIELD_DESCRIPTION_ATTR,xe as RUI_FIELD_ERROR_ATTR,Gi as RUI_FIELD_LABEL_ATTR,An as RUI_FIELD_MANAGED_ATTR,li as RUI_TOAST_DISMISS_EVENT,si as RUI_TOAST_SHOW_EVENT,T0 as RuiAlert,E0 as RuiAlertDescription,fi as RuiAlertElement,w0 as RuiAlertIcon,S0 as RuiAlertTitle,Wr as RuiAutocomplete,zr as RuiAutocompleteCollection,gi as RuiAutocompleteElement,Kr as RuiAutocompleteEmpty,M0 as RuiAutocompleteInput,jo as RuiAvatar,$0 as RuiBreadcrumb,vi as RuiBreadcrumbElement,Y0 as RuiBreadcrumbEllipsis,K0 as RuiBreadcrumbItem,W0 as RuiBreadcrumbLink,z0 as RuiBreadcrumbList,G0 as RuiBreadcrumbPage,H0 as RuiBreadcrumbSeparator,Hr as RuiButton,Ho as RuiButtonGroup,ww as RuiCalendar,Ei as RuiCalendarElement,Mw as RuiCarousel,Ti as RuiCarouselElement,Ow as RuiCarouselNext,kw as RuiCarouselPrev,Vw as RuiCarouselRotation,gs as RuiCarouselSlide,Kw as RuiCheckbox,Ai as RuiCheckboxElement,Ms as RuiChip,Ls as RuiChipList,Gw as RuiChipListItem,yS as RuiCombobox,Cl as RuiComboboxControl,Di as RuiComboboxElement,kl as RuiComboboxInput,Vl as RuiComboboxListbox,vS as RuiComboboxOption,Ol as RuiComboboxTrigger,IS as RuiDateField,Vi as RuiDateFieldElement,LS as RuiDateRangePicker,ji as RuiDateRangePickerElement,HS as RuiDialog,qc as RuiDialogActions,Uc as RuiDialogBody,$c as RuiDialogClose,Pi as RuiDialogElement,Fc as RuiDialogTitle,_E as RuiDisclosure,_e as RuiDisclosureElement,xE as RuiDisclosureGroup,zi as RuiDisclosureGroupElement,wd as RuiDisclosureIcon,Ed as RuiDisclosurePanel,Sd as RuiDisclosureTrigger,Td as RuiFeed,wE as RuiFeedArticle,TE as RuiFeedArticleActions,EE as RuiFeedArticleContent,SE as RuiFeedArticleHeader,RE as RuiFeedByline,AE as RuiFeedBylineBody,IE as RuiFeedMeta,KE as RuiField,GE as RuiFieldDescription,Xi as RuiFieldElement,YE as RuiFieldError,nT as RuiForm,Qi as RuiFormElement,hT as RuiGrid,Ji as RuiGridElement,qh as RuiHeading,vT as RuiHeadingDescription,gT as RuiHeadingEyebrow,bT as RuiHeadingTitle,Ni as RuiHeadline,$h as RuiInput,zh as RuiLabel,be as RuiListbox,ki as RuiListboxElement,ne as RuiListboxOption,CT as RuiMenuButton,ir as RuiMenuButtonElement,FT as RuiMenubar,rr as RuiMenubarElement,XT as RuiMeter,ar as RuiMeterElement,rR as RuiNavigationMenu,lr as RuiNavigationMenuElement,oR as RuiNavigationMenuLink,aR as RuiNavigationMenuPanel,nR as RuiNavigationMenuTrigger,yR as RuiNumberField,vR as RuiNumberFieldDecrementButton,cr as RuiNumberFieldElement,mR as RuiNumberFieldGroup,bR as RuiNumberFieldIncrementButton,gR as RuiNumberFieldInput,TR as RuiPopover,ER as RuiPopoverContent,hr as RuiPopoverElement,RR as RuiPopoverTrigger,pr as RuiPopoverTriggerElement,LR as RuiRadioGroup,mr as RuiRadioGroupElement,YR as RuiSelect,eg as RuiSelectControl,vr as RuiSelectElement,og as RuiSelectListbox,HR as RuiSelectOption,GR as RuiSelectSearch,rg as RuiSelectToggle,ig as RuiSelectTrigger,ng as RuiSelectValue,VA as RuiSidebar,SA as RuiSidebarContent,wr as RuiSidebarElement,EA as RuiSidebarFooter,RA as RuiSidebarGroup,AA as RuiSidebarGroupAction,IA as RuiSidebarGroupHeader,Rb as RuiSidebarGroupLabel,wA as RuiSidebarHeader,OA as RuiSidebarInset,DA as RuiSidebarMenu,kA as RuiSidebarMenuAction,Ab as RuiSidebarMenuButton,CA as RuiSidebarMenuItem,xA as RuiSidebarProvider,TA as RuiSidebarSeparator,MA as RuiSidebarTrigger,Sr as RuiSidebarTriggerElement,$A as RuiSlider,Rr as RuiSliderElement,ZA as RuiSwitch,Ar as RuiSwitchElement,sI as RuiTab,aI as RuiTabList,uI as RuiTabPanel,lI as RuiTabPanels,cI as RuiTabs,Dr as RuiTabsElement,py as RuiTag,yI as RuiTagGroup,kr as RuiTagGroupElement,hy as RuiTagList,fy as RuiTagRemove,my as RuiTextarea,LI as RuiToast,Vr as RuiToastElement,PI as RuiToaster,jr as RuiToasterElement,JI as RuiToc,Pr as RuiTocElement,nD as RuiToolbar,Br as RuiToolbarElement,fD as RuiTooltip,Fr as RuiTooltipElement,SD as RuiTree,Ur as RuiTreeElement,kD as RuiTreegrid,qr as RuiTreegridElement,qD as RuiWindowSplitter,$r as RuiWindowSplitterElement,ro as TOAST_EXIT_MS,to as TOAST_GAP,ui as TOAST_LIFETIME,ci as TOAST_SWIPE_THRESHOLD,eo as TOAST_VIEWPORT_OFFSET,io as TOAST_VISIBLE_AMOUNT,Nn as TOAST_WIDTH,iE as closeDialog,nE as createDialogHandle,Ln as createRulesResolver,K as cx,UI as dismissToast,Mn as fieldContext,Ke as findFieldControl,we as formContext,tE as getOpenDialogId,Qc as installDialogs,eE as openDialog,kn as readControlValue,ah as runRulesResolver,FI as showToast,BI as toast,rE as toggleDialog,Sn as uninstallDialogs,On as writeControlValue};
|
|
1
|
+
function K(...e){return e.filter(Boolean).join(" ")}import{RadiantElement as yo,customElement as v0,prop as _o}from"@ecopages/radiant";var po,fo,mo,go,bo;function f0(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:vo(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||vo(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:m0(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return b0(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function m0(e){var t=g0(e,"string");return typeof t=="symbol"?t:t+""}function g0(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vo(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function b0(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var fi,xo=class extends yo{static{({e:[fo,mo,go,bo],c:[fi,po]}=f0(this,[v0("rui-alert")],[[_o({type:String,reflect:!0,defaultValue:"info"}),0,"variant"],[_o({type:String,reflect:!0,defaultValue:"inline"}),0,"layout"]],0,void 0,yo))}constructor(...t){super(...t),bo(this)}variant=fo(this);layout=(mo(this),go(this));static{po()}};import{jsx as Ut}from"@ecopages/jsx/jsx-runtime";var y0=Symbol.for("@ecopages/storybook-radiant.viewElement"),wo=Symbol.for("@ecopages/storybook-radiant.scriptModule"),So=Symbol.for("@ecopages/storybook-radiant.scriptExport"),_0=Symbol.for("@ecopages/storybook-radiant.viewModule");function x0(e,t){e[y0]=t;let i=t[wo];i&&(e[wo]=i,e[So]=t[So]??t.name)}function rt(e,t,i){let r=c=>t(c);return x0(r,e),r}function nt(e,t,i){let r=e;return r[_0]=i,e}var w0={info:["M12 16v-4","M12 8h.01","M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z"],success:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","m9 12 2 2 4-4"],warning:["m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3","M12 9v4","M12 17h.01"],error:["M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z","m15 9-6 6","m9 9 6 6"]};function S0({variant:e="info",class:t,children:i,...r}){if(i!=null)return Ut("span",{...r,class:K("rui-alert__icon",t),children:i});let c=w0[e],p=Array.isArray(c)?c:[c];return Ut("span",{...r,class:K("rui-alert__icon",t),"aria-hidden":"true",children:Ut("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:p.map(h=>Ut("path",{d:h}))})})}function E0({children:e,class:t,...i}){return Ut("p",{...i,class:K("rui-alert__title",t),children:e})}function T0({children:e,class:t,...i}){return Ut("div",{...i,class:K("rui-alert__description",t),children:e})}var R0=rt(fi,({variant:e="info",layout:t="inline",class:i,children:r,...c})=>Ut("rui-alert",{...c,variant:e,layout:t,children:Ut("div",{class:K("rui-alert",`rui-alert--${e}`,`rui-alert--${t}`,i),role:"alert",children:r})}),{stylesheets:["./alert.css"]});import{jsx as ko,jsxs as k0}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Oo,customElement as O0,onEvent as V0,onUpdated as M0,prop as Vo}from"@ecopages/radiant";function mi(e,t,i="base"){if(!t)return!0;if(i==="case")return e.includes(t);let r=new Intl.Collator(void 0,{sensitivity:i==="accent"?"accent":"base",usage:"search"});for(let c=0;c<=e.length-t.length;c+=1){let p=e.slice(c,c+t.length);if(r.compare(p,t)===0)return!0}return!1}var Eo,To,Ro,Ao,Io,Do;function A0(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Co(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Co(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:I0(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return C0(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function I0(e){var t=D0(e,"string");return typeof t=="symbol"?t:t+""}function D0(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Co(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function C0(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var gi,Mo=class extends Oo{static{({e:[Ro,Ao,Io,Do,Eo],c:[gi,To]}=A0(this,[O0("rui-autocomplete")],[[Vo({type:String,defaultValue:"base"}),0,"sensitivity"],[Vo({type:String,attribute:"input-value",defaultValue:""}),0,"inputValue"],[M0(["sensitivity","inputValue"]),2,"onPropsUpdated"],[V0({selector:"[data-autocomplete-input]",type:"input"}),2,"onInput"]],0,void 0,Oo))}sensitivity=(Eo(this),Ro(this));inputValue=(Ao(this),Io(this));externalInput=(Do(this),null);onExternalInput=()=>{this.applyFilter()};getInput(){let t=this.querySelector("[data-autocomplete-input]");return t||(this.closest("rui-combobox, rui-select")?.querySelector("[data-autocomplete-input]")??null)}bindExternalInput(){this.unbindExternalInput();let t=this.getInput();!t||this.contains(t)||(this.externalInput=t,t.addEventListener("input",this.onExternalInput))}unbindExternalInput(){this.externalInput?.removeEventListener("input",this.onExternalInput),this.externalInput=null}syncFilter(){this.applyFilter()}getCollection(){return this.querySelector("[data-autocomplete-collection]")??this}getFilterableItems(){let t=this.getCollection();return t?Array.from(t.querySelectorAll('[role="option"], [data-tag], [role="menuitem"]')).filter(r=>this.contains(r)||t.contains(r)):[]}getItemText(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}getQuery(){return this.inputValue?this.inputValue:this.getInput()?.value??""}applyFilter(){let t=this.getQuery(),i=this.getFilterableItems(),r=0;for(let p of i){let h=mi(this.getItemText(p),t,this.sensitivity);p.hidden=!h,h&&(r+=1)}let c=this.querySelector("[data-autocomplete-empty]");c&&(c.hidden=r>0)}initialize(){this.applyFilter()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.bindExternalInput(),this.initialize()})}disconnectedCallback(){this.unbindExternalInput(),super.disconnectedCallback()}onPropsUpdated(){this.applyFilter()}onInput(){this.applyFilter()}render(){return k0("div",{class:"rui-autocomplete","data-ref":"root",children:[ko("slot",{name:"input"}),ko("slot",{})]})}static{To()}};import{jsx as bi}from"@ecopages/jsx/jsx-runtime";function j0({placeholder:e,slot:t="input",class:i,disabled:r,...c}){return bi("input",{...c,type:"search",slot:t,"data-autocomplete-input":!0,class:K("rui-autocomplete__input",i),placeholder:e,disabled:r,autocomplete:"off"})}function zr({children:e,class:t,...i}){return bi("div",{...i,"data-autocomplete-collection":!0,class:K("rui-autocomplete__collection",t),children:e})}function Kr({children:e,class:t,...i}){return bi("div",{...i,"data-autocomplete-empty":!0,class:K("rui-autocomplete__empty",t),hidden:!0,children:e})}var Wr=rt(gi,({children:e,...t})=>bi("rui-autocomplete",{...t,children:e}),{stylesheets:["./autocomplete.css"]});import{jsx as Gr}from"@ecopages/jsx/jsx-runtime";function L0(e){let t=e.trim().split(/\s+/).filter(Boolean);return t.length===0?"?":t.length===1?t[0].slice(0,2).toUpperCase():`${t[0][0]??""}${t[1][0]??""}`.toUpperCase()}function jo({src:e,alt:t="",fallback:i,size:r="md",class:c,children:p,...h}){let a=i??(t?L0(t):void 0);return Gr("span",{...h,class:K("rui-avatar",`rui-avatar--${r}`,c),role:e?void 0:"img","aria-label":e?void 0:t||i,children:e?Gr("img",{class:"rui-avatar__image",src:e,alt:t}):Gr("span",{class:"rui-avatar__fallback","aria-hidden":t||i?"true":void 0,children:p??a??"?"})})}nt(jo,["./avatar.css"],import.meta.url);import{jsx as $o}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as zo,customElement as q0,prop as Ko}from"@ecopages/radiant";var Lo,Po,Bo,Fo,Uo;function P0(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:qo(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||qo(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:B0(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return U0(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function B0(e){var t=F0(e,"string");return typeof t=="symbol"?t:t+""}function F0(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qo(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function U0(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var vi,Wo=class extends zo{static{({e:[Po,Bo,Fo,Uo],c:[vi,Lo]}=P0(this,[q0("rui-breadcrumb")],[[Ko({type:String,defaultValue:"Breadcrumb"}),0,"label"],[Ko({type:String,defaultValue:"/"}),0,"separator"]],0,void 0,zo))}label=Po(this);separator=(Bo(this),Fo(this));resolvedAriaLabel=(Uo(this),this.$.label.map(t=>t||"Breadcrumb"));separatorStyle=this.$.separator.map(t=>({"--rui-breadcrumb-separator":JSON.stringify(t||"/")}));render(){return $o("nav",{class:"rui-breadcrumb","aria-label":this.resolvedAriaLabel,style:this.separatorStyle,children:$o("slot",{})})}static{Lo()}};import{jsx as qt,jsxs as $0}from"@ecopages/jsx/jsx-runtime";var z0=rt(vi,({children:e,...t})=>qt("rui-breadcrumb",{...t,children:e}),{stylesheets:["./breadcrumb.css"]});function K0({children:e,class:t,...i}){return qt("ol",{...i,class:K("rui-breadcrumb__list",t),children:e})}function W0({children:e,class:t,...i}){return qt("li",{...i,class:K("rui-breadcrumb__item",t),children:e})}function G0({children:e,href:t,class:i,"aria-label":r,...c}){return qt("a",{...c,class:K("rui-breadcrumb__link",i),href:t,"aria-label":r,children:e})}function H0({children:e,class:t,...i}){return qt("span",{...i,class:K("rui-breadcrumb__page",t),"aria-current":"page",children:e})}function Y0({children:e,class:t,...i}){return qt("li",{...i,class:K("rui-breadcrumb__separator",t),role:"presentation","aria-hidden":"true",children:e})}function X0({label:e="More",class:t,...i}){return $0("span",{...i,class:K("rui-breadcrumb__ellipsis",t),role:"presentation","aria-hidden":"true",children:[qt("span",{"aria-hidden":"true",children:"\u2026"}),qt("span",{class:"rui-breadcrumb__ellipsis-label",children:e})]})}import{jsx as Go}from"@ecopages/jsx/jsx-runtime";function Q0(e,t,i){if(e!==void 0)return e;if(t)return i}function Hr(e){if(e.href!==void 0){let{href:$,target:L,rel:W,download:G,"aria-label":k,"aria-current":_,"on:click":H,children:Y,class:n,variant:g,size:f,...o}=e;return Go("a",{...o,href:$,target:L,rel:W,download:G,class:K("rui-button",`rui-button--${g??"filled"}`,`rui-button--${f??"md"}`,n),"aria-label":k,"aria-current":_,"on:click":H,children:Y})}let{variant:t,size:i,class:r,children:c,"aria-label":p,type:h="button",disabled:a,pressed:E,defaultPressed:C=!1,toggle:R=!1,"on:click":D,...T}=e,z=$=>{if(R&&E===void 0){let L=$.currentTarget,W=L.getAttribute("aria-pressed")!=="true";L.setAttribute("aria-pressed",String(W))}D?.($)};return Go("button",{...T,type:h,class:K("rui-button",`rui-button--${t??"filled"}`,`rui-button--${i??"md"}`,r),disabled:a,"aria-label":p,"aria-pressed":Q0(E,R,C),"data-toggle":R&&E===void 0?"":void 0,"on:click":R||D?z:void 0,children:c})}import{jsx as J0}from"@ecopages/jsx/jsx-runtime";function Ho({children:e,orientation:t="horizontal",class:i,"aria-label":r,...c}){return J0("div",{...c,role:"group","aria-label":r,"aria-orientation":t,class:K("rui-button-group",`rui-button-group--${t}`,i),children:e})}nt(Ho,["./button-group.css"],import.meta.url);import{jsx as ft,jsxs as cn}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ua,customElement as yw,event as _w,onEvent as ie,onUpdated as xw,prop as $t,state as zt}from"@ecopages/radiant";function It(e){if(!e)return;let t=e.split(",").map(i=>i.trim()).filter(Boolean);return t.length>1?t:t[0]}function Dt(e){if(e==null)return null;let t=/^(\d{4})-(\d{2})-(\d{2})$/.exec(e.trim());if(!t)return null;let i=Number(t[1]),r=Number(t[2])-1,c=Number(t[3]),p=new Date(i,r,c);return p.getFullYear()!==i||p.getMonth()!==r||p.getDate()!==c?null:p}function Ct(e){let t=e.getFullYear(),i=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return`${t}-${i}-${r}`}function Yr(e,t,i){return!(t&&e<t||i&&e>i)}function ee(e,t){return e.localeCompare(t)}function de(e,t){return ee(e,t)<=0?{start:e,end:t}:{start:t,end:e}}function xt(e){if(!e)return null;let[t,i]=e.split("/");return!t||!i?null:de(t,i)}function Re(e){if(!e)return"";let t=de(e.start,e.end);return`${t.start}/${t.end}`}function he(e){return e?e.split(",").map(t=>t.trim()).filter(Boolean).sort(ee):[]}function Xr(e){return[...new Set(e)].sort(ee).join(",")}function Qr(e,t){let i=new Set(e);return i.has(t)?i.delete(t):i.add(t),[...i].sort(ee)}function Yo(e,t){let i=de(t.start,t.end);return ee(e,i.start)>=0&&ee(e,i.end)<=0}function Jr(e,t,i){if(t==="single"){let C=i.singleIso===e;return{isSelected:C,isRangeStart:C,isRangeEnd:C,isRangeMiddle:!1}}if(t==="multiple"){let C=i.multipleIsos?.includes(e)??!1;return{isSelected:C,isRangeStart:C,isRangeEnd:C,isRangeMiddle:!1}}let r=i.range;if(!r)return{isSelected:!1,isRangeStart:!1,isRangeEnd:!1,isRangeMiddle:!1};let c=de(r.start,r.end),p=Yo(e,c),h=e===c.start,a=e===c.end;return{isSelected:p,isRangeStart:h,isRangeEnd:a,isRangeMiddle:p&&!h&&!a}}function Zr(e,t,i){return t.anchor?{committed:de(t.anchor,i),draft:{anchor:null,hover:null}}:{committed:e,draft:{anchor:i,hover:i}}}function yi(e){let t=Z0(e);try{let r=new Intl.Locale(t).weekInfo;if(r?.firstDay!=null)return r.firstDay===7?0:r.firstDay}catch{}return t.startsWith("en-US")?0:1}function Z0(e){return Array.isArray(e)?e[0]??navigator.language:e??navigator.language}function N0(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function tw(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function ew(e){let t=e.selectionMode??"single",i=e.value??"";if(t==="multiple")return{mode:t,multipleIsos:he(i)};if(t==="range"){let r=xt(i);if(e.rangeDraft?.anchor){let c=e.rangeDraft.hover??e.rangeDraft.anchor;return{mode:t,range:iw(e.rangeDraft.anchor,c)}}return{mode:t,range:r}}return{mode:t,singleIso:i||void 0}}function iw(e,t){return e.localeCompare(t)<=0?{start:e,end:t}:{start:t,end:e}}function Nr(e,t,i){let r=yi(i.locale),c=N0(i.today??new Date),p=ew(i),a=(new Date(e,t,1).getDay()-r+7)%7,E=new Date(e,t,1-a),C=[],R=new Date(E);for(let D=0;D<6;D+=1){let T=[];for(let z=0;z<7;z+=1){let $=Ct(R),L=Jr($,p.mode,{singleIso:p.singleIso,multipleIsos:p.multipleIsos,range:p.range});T.push({date:new Date(R),iso:$,inMonth:R.getMonth()===t,isToday:tw(R,c),isSelected:L.isSelected,isDisabled:!Yr($,i.min,i.max),isRangeStart:L.isRangeStart,isRangeEnd:L.isRangeEnd,isRangeMiddle:L.isRangeMiddle}),R.setDate(R.getDate()+1)}if(C.push(T),D>=4&&R.getMonth()!==t&&R.getDate()>7)break}return C}function _i(e,t,i){let r=new Date(e,t+i,1);return{year:r.getFullYear(),month:r.getMonth()}}function tn(e,t,i){let r=Math.max(1,Math.min(i,12));return Array.from({length:r},(c,p)=>{let h=_i(e,t,p);return{year:h.year,month:h.month,offset:p}})}var Xo=new Map;function rw(e,t){return`${JSON.stringify(e??null)}|${JSON.stringify(t)}`}function wt(e,t){let i=rw(e,t),r=Xo.get(i);if(r)return r;let c=new Intl.DateTimeFormat(e,t);return Xo.set(i,c),c}function Ae(e,t,i="medium"){return wt(t,{dateStyle:i}).format(e)}function en(e,t){return wt(t,{month:"long",year:"numeric"}).format(e)}function rn(e,t){let i=wt(e,{weekday:"narrow"}),r=[];for(let c=0;c<7;c+=1){let p=(t+c)%7,h=new Date(2024,0,p===0?7:p);r.push(i.format(h))}return r}function nn(e){return new Intl.RelativeTimeFormat(e,{numeric:"auto"}).format(0,"day")}var nw={0:"digit",a:"letter","*":"any"},ow=/\p{L}/u;function aw(e,t){let i=t?.[e];if(i instanceof RegExp)return{kind:"any",pattern:i};if(i)return{kind:i};let r=nw[e];return r?{kind:r}:null}function Qo(e,t,i){return i?i.test(e):t==="digit"?/\d/.test(e):t==="letter"?ow.test(e):e.length>0}function Jo(e,t,i=!1){let r=[],c=0;for(;c<e.length;){let p=e[c];if(p==="\\"){let a=e[c+1];a&&r.push({type:"literal",value:a}),c+=2;continue}if(p==="{"){let a=e.indexOf("}",c+1);if(a<0){r.push({type:"literal",value:"{"}),c+=1;continue}r.push({type:"fixed",value:e.slice(c+1,a)}),c=a+1;continue}if(p==="["){let a=sw(e,c+1);if(a<0){r.push({type:"literal",value:"["}),c+=1;continue}let E=Jo(e.slice(c+1,a),t,!0);r.push(...E),c=a+1;continue}if(p==="]")break;let h=aw(p,t);if(h){r.push({type:"input",definition:p,kind:h.kind,pattern:h.pattern,optional:i}),c+=1;continue}r.push({type:"literal",value:p}),c+=1}return r}function sw(e,t){let i=1;for(let r=t;r<e.length;r+=1)if(e[r]==="["&&e[r-1]!=="\\"&&(i+=1),e[r]==="]"&&e[r-1]!=="\\"&&(i-=1,i===0))return r;return-1}function Ie(e,t){return Jo(e,t)}function xi(e,t={}){return e.filter(i=>i.type==="input"&&(!t.requiredOnly||!i.optional)).length}function on(e,t){let i=Ie(e,t),r="";for(let c of i){if(c.type==="literal"||c.type==="fixed"){r+=c.value;continue}r+="_"}return r}function Zo(e,t){let i="",r=0;for(let c of t){if(c.type==="fixed"||c.type==="literal"){e.slice(r,r+c.value.length)===c.value&&(r+=c.value.length);continue}if(r>=e.length)continue;let p=e[r];Qo(p,c.kind,c.pattern)&&(i+=p,r+=1)}return i}function No(e,t){if(!e)return"";let i=0,r="";for(let c of t){if(c.type==="fixed"||c.type==="literal"){r+=c.value;continue}if(i>=e.length){if(c.optional)continue;break}let p=e[i];if(!Qo(p,c.kind,c.pattern)){if(c.optional)continue;break}r+=p,i+=1}return r}function lw(e){return e.every(t=>t.type!=="input"||t.kind==="digit")}function uw(e,t){let i=e.replace(/\D/g,""),r=t.filter(c=>c.type==="fixed").map(c=>c.value.replace(/\D/g,"")).join("");return r&&i.startsWith(r)?i.slice(r.length):i}function De(e,t,i){let r=Ie(t,i),c=xi(r),p=Zo(e,r);return p.length===0&&/\S/.test(e)&&lw(r)&&(p=uw(e,r)),p.length>c&&(p=p.slice(0,c)),No(p,r)}var an=new Date(2001,8,3);function wi(e){return wt(e,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(an).filter(t=>t.type==="year"||t.type==="month"||t.type==="day").map(t=>t.type)}function pe(e){let t=wt(e,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(an),i="";for(let r of t){if(r.type==="literal"){i+=r.value;continue}(r.type==="month"||r.type==="day"||r.type==="year")&&(i+=r.value.replace(/\d/g,"0"))}return i}function sn(e){return wt(e,{year:"numeric",month:"2-digit",day:"2-digit"}).formatToParts(an).map(i=>i.type==="literal"?i.value:i.type==="year"?"yyyy":i.type==="month"?"mm":i.type==="day"?"dd":"").join("")}function fe(e){return e.replace(/\D/g,"")}function Si(e,t){return De(fe(e),t)}function Ce(e){return xi(Ie(e),{requiredOnly:!0})}function cw(e){return e>=100?e:e>=69?1900+e:2e3+e}function ln(e,t){let i=wi(t),r=0,c={};for(let p of i){let h=p==="year"?4:2,a=e.slice(r,r+h);if(a.length<h)return null;let E=Number(a);p==="year"&&(E=cw(E)),c[p]=E,r+=h}return c}function un(e){if(e.year==null||e.month==null||e.day==null)return null;let t=new Date(e.year,e.month-1,e.day);return t.getFullYear()!==e.year||t.getMonth()!==e.month-1||t.getDate()!==e.day?null:t}var dw=new Date(2001,8,3);function ta(e){return wt(e,{year:"numeric",month:"numeric",day:"numeric"}).formatToParts(dw).filter(i=>i.type==="year"||i.type==="month"||i.type==="day").map(i=>i.type)}function ea(e){return e>=100?e:e>=69?1900+e:2e3+e}function ia(e){let t=e.year,i=e.month,r=e.day;if(!Number.isFinite(t)||!Number.isFinite(i)||!Number.isFinite(r))return null;let c=new Date(t,i-1,r);return c.getFullYear()!==t||c.getMonth()!==i-1||c.getDate()!==r?null:c}function ke(e,t){let i=(e??"").trim();if(!i)return null;let r=Dt(i);if(r)return r;let c=hw(i,t);if(c)return c;let p=fw(i,t);if(p)return p;let h=ta(t),a=i.match(/\d+/g);if(!a||a.length<3)return null;let E={day:0,month:0,year:0};for(let C=0;C<3;C+=1){let R=h[C];if(!R)return null;let D=Number(a[C]);R==="year"&&(D=ea(D)),E[R]=D}return ia(E)}function hw(e,t){let i=pe(t),r=fe(e);return r.length<Ce(i)?null:un(ln(r,t)??{})}function pw(e){let t=new Map;for(let i of["short","long"])for(let r=0;r<12;r+=1){let c=wt(e,{month:i}).formatToParts(new Date(2020,r,1)).find(p=>p.type==="month")?.value;c&&t.set(c.toLowerCase(),r+1)}return t}function fw(e,t){let i=pw(t),r=e.toLowerCase();for(let[c,p]of i){if(r.indexOf(c)<0)continue;let a=e.match(/\d+/g);if(!a||a.length<2)continue;let E=a.find(T=>T.length===4)??a[a.length-1],C=a.find(T=>T!==E&&Number(T)<=31);if(!C||!E)continue;let R=ea(Number(E)),D=Number(C);return ia({year:R,month:p,day:D})}return null}var ra,na,oa,aa,sa,la,ua,ca,da,ha,pa,fa,ma,ga,ba,va,ya,_a,xa,wa,Sa,Ea,Ta,Ra,Aa,Ia,Da,Ca,ka,Oa,Va,Ma,ja,La,Pa,Ba;function mw(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Fa(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Fa(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:gw(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return vw(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function gw(e){var t=bw(e,"string");return typeof t=="symbol"?t:t+""}function bw(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fa(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function vw(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ei,qa=class extends Ua{static{({e:[oa,aa,sa,la,ua,ca,da,ha,pa,fa,ma,ga,ba,va,ya,_a,xa,wa,Sa,Ea,Ta,Ra,Aa,Ia,Da,Ca,ka,Oa,Va,Ma,ja,La,Pa,Ba,ra],c:[Ei,na]}=mw(this,[yw("rui-calendar")],[[$t({type:String,reflect:!0,defaultValue:""}),0,"value"],[$t({type:String,defaultValue:""}),0,"min"],[$t({type:String,defaultValue:""}),0,"max"],[$t({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[$t({type:String,defaultValue:""}),0,"locale"],[$t({type:String,attribute:"selection-mode",defaultValue:"single"}),0,"selectionMode"],[$t({type:Number,attribute:"visible-months",defaultValue:1}),0,"visibleMonths"],[$t({type:String,attribute:"page-behavior",defaultValue:"visible"}),0,"pageBehavior"],[_w({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[zt,0,"viewYear"],[zt,0,"viewMonth"],[zt,0,"focusedIso"],[zt,0,"weekdayLabels"],[zt,0,"monthPanels"],[zt,0,"todayLabel"],[zt,0,"rangeAnchor"],[zt,0,"rangeHover"],[xw(["value","min","max","disabled","locale","selectionMode","visibleMonths","pageBehavior"]),2,"onPropsUpdated"],[ie({selector:"[data-calendar-prev-month]",type:"click"}),2,"onPrevMonth"],[ie({selector:"[data-calendar-next-month]",type:"click"}),2,"onNextMonth"],[ie({selector:"[data-calendar-today]",type:"click"}),2,"onTodayClick"],[ie({selector:"[data-calendar-day]",type:"click"}),2,"onDayClick"],[ie({selector:"[data-calendar-day]",type:"pointerenter"}),2,"onDayPointerEnter"],[ie({selector:"[data-calendar-grid]",type:"pointerleave"}),2,"onGridPointerLeave"],[ie({selector:"[data-calendar-day]",type:"keydown"}),2,"onDayKeydown"]],0,void 0,Ua))}constructor(...t){super(...t),Ba(this)}value=(ra(this),oa(this));min=(aa(this),sa(this));max=(la(this),ua(this));disabled=(ca(this),da(this));locale=(ha(this),pa(this));selectionMode=(fa(this),ma(this));visibleMonths=(ga(this),ba(this));pageBehavior=(va(this),ya(this));changeEvent=(_a(this),xa(this));viewYear=(wa(this),Sa(this,new Date().getFullYear()));viewMonth=(Ea(this),Ta(this,new Date().getMonth()));focusedIso=(Ra(this),Aa(this,""));weekdayLabels=(Ia(this),Da(this,[]));monthPanels=(Ca(this),ka(this,[]));todayLabel=(Oa(this),Va(this,""));rangeAnchor=(Ma(this),ja(this,null));rangeHover=(La(this),Pa(this,null));get resolvedLocale(){return It(this.locale)}get pageDelta(){return this.pageBehavior==="single"?1:Math.max(1,Math.min(this.visibleMonths,12))}get monthOptions(){return{locale:this.resolvedLocale,selectionMode:this.selectionMode,value:this.value??"",rangeDraft:{anchor:this.rangeAnchor,hover:this.rangeHover},min:this.min||void 0,max:this.max||void 0}}syncViewFromValue(){let t=this.selectionMode==="range"?xt(this.value)?.start??"":this.selectionMode==="multiple"?he(this.value)[0]??"":this.value,i=Dt(t);if(i){this.viewYear=i.getFullYear(),this.viewMonth=i.getMonth(),this.focusedIso=t;return}let r=new Date;this.viewYear=r.getFullYear(),this.viewMonth=r.getMonth(),this.focusedIso=Ct(r)}refreshGrid(){this.weekdayLabels=rn(this.resolvedLocale,yi(this.resolvedLocale)),this.monthPanels=tn(this.viewYear,this.viewMonth,this.visibleMonths).map(t=>{let i=new Date(t.year,t.month,1);return{year:t.year,month:t.month,label:en(i,this.resolvedLocale),weeks:Nr(t.year,t.month,this.monthOptions)}}),this.todayLabel=nn(this.resolvedLocale)}moveMonth(t){let i=_i(this.viewYear,this.viewMonth,t);this.viewYear=i.year,this.viewMonth=i.month,this.refreshGrid()}getFlatDays(){return this.monthPanels.flatMap(t=>t.weeks.flat())}moveFocusedDay(t){let i=this.getFlatDays().filter(h=>!h.isDisabled);if(!i.length)return;let r=i.findIndex(h=>h.iso===this.focusedIso),c=r<0?Math.max(0,i.findIndex(h=>h.inMonth)):(r+t+i.length)%i.length,p=i[c];p&&((p.date.getMonth()!==this.viewMonth||p.date.getFullYear()!==this.viewYear)&&(this.viewYear=p.date.getFullYear(),this.viewMonth=p.date.getMonth()),this.focusedIso=p.iso,this.refreshGrid())}isIsoAllowed(t){return!(this.min&&t<this.min||this.max&&t>this.max)}emitChange(t,i={}){this.changeEvent.emit({value:t,...i})}selectSingle(t){!this.isIsoAllowed(t)||t===this.value||(this.value=t,this.emitChange(t),this.refreshGrid())}selectMultiple(t){if(!this.isIsoAllowed(t))return;let i=Xr(Qr(he(this.value),t));i!==this.value&&(this.value=i,this.emitChange(i),this.refreshGrid())}selectRange(t){if(!this.isIsoAllowed(t))return;let i=Zr(xt(this.value),{anchor:this.rangeAnchor,hover:this.rangeHover},t);if(this.rangeAnchor=i.draft.anchor,this.rangeHover=i.draft.hover,i.committed){let r=Re(i.committed);r!==this.value&&(this.value=r,this.emitChange(r,{start:i.committed.start,end:i.committed.end}))}this.refreshGrid()}selectIso(t){if(this.selectionMode==="multiple"){this.selectMultiple(t);return}if(this.selectionMode==="range"){this.selectRange(t);return}this.selectSingle(t)}previewRange(t){this.selectionMode!=="range"||!this.rangeAnchor||this.disabled||this.rangeHover!==t&&(this.rangeHover=t,this.refreshGrid())}clearRangePreview(){this.rangeHover&&(this.rangeHover=this.rangeAnchor,this.refreshGrid())}initialize(){this.syncViewFromValue(),this.refreshGrid()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}onPropsUpdated(){this.selectionMode!=="range"&&(this.rangeAnchor=null,this.rangeHover=null),this.syncViewFromValue(),this.refreshGrid()}onPrevMonth(t){t.preventDefault(),this.moveMonth(-this.pageDelta)}onNextMonth(t){t.preventDefault(),this.moveMonth(this.pageDelta)}onTodayClick(t){t.preventDefault(),this.selectIso(Ct(new Date))}onDayClick(t){let i=t.target.closest("[data-calendar-day]"),r=i?.getAttribute("data-iso");!r||i?.disabled||this.disabled||this.selectIso(r)}onDayPointerEnter(t){let i=t.target.closest("[data-calendar-day]"),r=i?.getAttribute("data-iso");!r||i?.disabled||this.previewRange(r)}onGridPointerLeave(){this.clearRangePreview()}onDayKeydown(t){if(!this.disabled){if(t.key==="ArrowLeft"){t.preventDefault(),this.moveFocusedDay(-1);return}if(t.key==="ArrowRight"){t.preventDefault(),this.moveFocusedDay(1);return}if(t.key==="ArrowUp"){t.preventDefault(),this.moveFocusedDay(-7);return}if(t.key==="ArrowDown"){t.preventDefault(),this.moveFocusedDay(7);return}if(t.key==="PageUp"){t.preventDefault(),this.moveMonth(t.shiftKey?-12:-this.pageDelta);return}if(t.key==="PageDown"){t.preventDefault(),this.moveMonth(t.shiftKey?12:this.pageDelta);return}if(t.key==="Enter"||t.key===" "){t.preventDefault();let i=t.target,r=i.getAttribute("data-iso");r&&!i.disabled&&this.selectIso(r)}}}dayDataAttributes(t){return{"data-range-start":t.isRangeStart?"true":void 0,"data-range-end":t.isRangeEnd?"true":void 0,"data-range-middle":t.isRangeMiddle?"true":void 0}}render(){let t=this.monthPanels.length,i=t>1;return cn("div",{class:`rui-calendar${i?" rui-calendar--multi":""}`,"data-ref":"root",role:"application","aria-label":"Calendar","aria-multiselectable":this.selectionMode==="multiple"?"true":void 0,children:[ft("div",{class:"rui-calendar__months",children:this.monthPanels.map((r,c)=>cn("div",{class:"rui-calendar__month-panel","data-calendar-month-panel":!0,children:[cn("div",{class:"rui-calendar__header",children:[c===0?ft("button",{type:"button",class:"rui-calendar__nav","data-calendar-prev-month":!0,"aria-label":"Previous month",disabled:this.disabled,children:"\u2039"}):ft("span",{class:"rui-calendar__nav-spacer","aria-hidden":"true"}),ft("div",{class:"rui-calendar__month","aria-live":"polite",children:r.label}),c===t-1?ft("button",{type:"button",class:"rui-calendar__nav","data-calendar-next-month":!0,"aria-label":"Next month",disabled:this.disabled,children:"\u203A"}):ft("span",{class:"rui-calendar__nav-spacer","aria-hidden":"true"})]}),c===0?ft("div",{class:"rui-calendar__weekdays",role:"row",children:this.weekdayLabels.map(p=>ft("div",{class:"rui-calendar__weekday",role:"columnheader","aria-hidden":"true",children:p}))}):null,ft("div",{class:"rui-calendar__grid",role:"grid","data-calendar-grid":!0,children:r.weeks.map(p=>ft("div",{class:"rui-calendar__week",role:"row",children:p.map(h=>ft("button",{type:"button",class:"rui-calendar__day","data-calendar-day":!0,"data-iso":h.iso,role:"gridcell",disabled:this.disabled||h.isDisabled,tabIndex:h.iso===this.focusedIso?0:-1,"aria-selected":h.isSelected?"true":"false","aria-current":h.isToday?"date":void 0,"data-outside":h.inMonth?void 0:"true",...this.dayDataAttributes(h),children:h.date.getDate()}))}))})]}))}),ft("div",{class:"rui-calendar__footer",children:ft("button",{type:"button",class:"rui-calendar__today","data-calendar-today":!0,disabled:this.disabled,children:this.todayLabel})})]})}static{na()}};import{jsx as ww}from"@ecopages/jsx/jsx-runtime";var Sw=rt(Ei,({children:e,...t})=>ww("rui-calendar",{...t,children:e}),{stylesheets:["./calendar.css"]});import{jsx as ot,jsxs as re}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ps,customElement as Iw,onEvent as mt,onUpdated as dn,prop as St}from"@ecopages/radiant";var $a,za,Ka,Wa,Ga,Ha,Ya,Xa,Qa,Ja,Za,Na,ts,es,is,rs,ns,os,as,ss,ls,us,cs,ds;function Ew(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:hs(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||hs(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:Tw(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return Aw(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function Tw(e){var t=Rw(e,"string");return typeof t=="symbol"?t:t+""}function Rw(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hs(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function Aw(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Dw=48,Ti,fs=class extends ps{static{({e:[Ka,Wa,Ga,Ha,Ya,Xa,Qa,Ja,Za,Na,ts,es,is,rs,ns,os,as,ss,ls,us,cs,ds,$a],c:[Ti,za]}=Ew(this,[Iw("rui-carousel")],[[St({type:String,defaultValue:"Carousel"}),0,"label"],[St({type:Number,reflect:!0,defaultValue:0}),0,"index"],[St({type:Boolean,reflect:!0,defaultValue:!1}),0,"autoplay"],[St({type:Number,defaultValue:4e3}),0,"interval"],[St({type:String,defaultValue:"none"}),0,"transition"],[St({type:String,defaultValue:"toolbar",attribute:"controls-variant"}),0,"controlsVariant"],[St({type:Boolean,defaultValue:!1}),0,"showIndicators"],[St({type:Boolean,defaultValue:!1}),0,"showRotationControl"],[St({type:Boolean,defaultValue:!0}),0,"loop"],[St({type:Boolean,defaultValue:!0}),0,"wrap"],[St({type:Number,defaultValue:0}),0,"slideCount"],[dn(["index","transition","loop","wrap","controlsVariant"]),2,"onSlideStateUpdated"],[dn(["autoplay","showRotationControl","interval"]),2,"onAutoplayUpdated"],[dn(["showIndicators"]),2,"onIndicatorsUpdated"],[mt({selector:'[data-carousel-action="prev"]',type:"click"}),2,"prev"],[mt({selector:'[data-carousel-action="next"]',type:"click"}),2,"next"],[mt({selector:'[data-carousel-action="rotation"]',type:"click"}),2,"toggleRotation"],[mt({selector:"[data-carousel-indicator]",type:"click"}),2,"onIndicatorClick"],[mt({selector:"[data-carousel-indicator]",type:"keydown"}),2,"onIndicatorKeydown"],[mt({ref:"root",type:"pointerenter"}),2,"onRootPointerEnter"],[mt({ref:"root",type:"pointerleave"}),2,"onRootPointerLeave"],[mt({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[mt({ref:"root",type:"focusout"}),2,"onRootFocusOut"],[mt({ref:"viewport",type:"pointerdown"}),2,"onViewportPointerDown"],[mt({ref:"viewport",type:"pointermove"}),2,"onViewportPointerMove"],[mt({ref:"viewport",type:"pointerup"}),2,"onViewportPointerUp"],[mt({ref:"viewport",type:"pointercancel"}),2,"onViewportPointerCancel"]],0,void 0,ps))}label=($a(this),Ka(this));index=(Wa(this),Ga(this));autoplay=(Ha(this),Ya(this));interval=(Xa(this),Qa(this));transition=(Ja(this),Za(this));controlsVariant=(Na(this),ts(this));showIndicators=(es(this),is(this));showRotationControl=(rs(this),ns(this));loop=(os(this),as(this));wrap=(ss(this),ls(this));slideCount=(us(this),cs(this));timer=(ds(this),null);paused=!1;userOverrideReducedMotion=!1;swipePointerId=null;swipeStartX=0;swipeStartY=0;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.autoplay&&this.prefersReducedMotion()&&(this.paused=!0),this.sync(),this.syncAutoplay(),this.syncIndicators(),this.syncAriaLive()})}disconnectedCallback(){this.stop(),super.disconnectedCallback()}onSlideStateUpdated(){this.sync(),this.syncIndicators(),this.syncAutoplay()}onAutoplayUpdated(){this.syncAutoplay(),this.syncRotationControl()}onIndicatorsUpdated(){this.syncIndicators()}prefersReducedMotion(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}getCarouselId(){return this.id||"rui-carousel"}slidePanelId(t,i){let r=t.getAttribute("data-slide")??String(i),c=`${this.getCarouselId()}-panel-${r}`;return t.id=c,c}tabId(t){return`${this.getCarouselId()}-tab-${t}`}shouldShowRotationControl(){return this.autoplay||this.showRotationControl}syncSlideAccessibility(t,i){let r=t.length;t.forEach((c,p)=>{let h=p===i,a=`${p+1} of ${r}`;this.showIndicators?(this.slidePanelId(c,p),c.setAttribute("role","tabpanel"),c.setAttribute("aria-labelledby",this.tabId(p)),c.setAttribute("aria-label",a),c.removeAttribute("aria-roledescription")):(c.setAttribute("role","group"),c.setAttribute("aria-roledescription","slide"),c.setAttribute("aria-label",a),c.removeAttribute("aria-labelledby"),c.removeAttribute("tabindex")),this.transition==="none"?c.hidden=!h:c.hidden=!1,c.setAttribute("aria-hidden",String(!h)),c.setAttribute("data-active",h?"true":"false")})}getSlides(){return Array.from(this.querySelectorAll("[data-slide]"))}get shouldWrap(){return this.wrap&&this.loop}normalizeIndex(t,i){return i<=0?0:this.shouldWrap?(t%i+i)%i:Math.min(Math.max(t,0),i-1)}sync(){let t=this.getSlides();if(!t.length)return;let i=this.normalizeIndex(this.index,t.length);i!==this.index&&(this.index=i);let r=this.querySelector(".rui-carousel__track");r&&this.transition==="slide"&&r.style.setProperty("--rui-carousel-index",String(i)),this.syncSlideAccessibility(t,i),this.syncPrevNextDisabled(t.length,i)}syncPrevNextDisabled(t,i){let r=!this.shouldWrap&&t>0&&i<=0,c=!this.shouldWrap&&t>0&&i>=t-1;for(let p of this.querySelectorAll('[data-carousel-action="prev"]'))this.shouldWrap?p.removeAttribute("disabled"):p.disabled=r;for(let p of this.querySelectorAll('[data-carousel-action="next"]'))this.shouldWrap?p.removeAttribute("disabled"):p.disabled=c}syncIndicators(){let t=this.querySelector('[data-ref="indicators"]');if(!t)return;let i=this.getSlides(),r=this.normalizeIndex(this.index,i.length);Array.from(t.querySelectorAll("[data-carousel-indicator]")).length!==i.length&&t.replaceChildren(...i.map((h,a)=>{let E=document.createElement("button");return E.type="button",E.className="rui-carousel__indicator",E.id=this.tabId(a),E.setAttribute("role","tab"),E.setAttribute("data-carousel-indicator",String(a)),E.setAttribute("aria-controls",this.slidePanelId(h,a)),E.setAttribute("aria-label",`Slide ${a+1}`),E})),Array.from(t.querySelectorAll("[data-carousel-indicator]")).forEach((h,a)=>{let E=a===r,C=i[a];C&&(h.id=this.tabId(a),h.setAttribute("aria-controls",this.slidePanelId(C,a))),h.setAttribute("aria-selected",String(E)),h.tabIndex=E?0:-1})}syncRotationControl(){for(let t of this.querySelectorAll('[data-carousel-action="rotation"]')){let i=this.autoplay&&!this.paused;t.setAttribute("aria-pressed",String(i)),t.setAttribute("aria-label",i?"Pause rotation":"Start rotation")}}syncAriaLive(){let t=this.querySelector('[data-ref="viewport"]');if(!t)return;let i=this.autoplay&&!this.paused&&this.timer!==null;t.setAttribute("aria-live",i?"off":"polite"),t.setAttribute("aria-atomic","false")}canAutoplayRotate(){return!(!this.autoplay||this.paused||this.prefersReducedMotion()&&!this.userOverrideReducedMotion)}syncAutoplay(){this.canAutoplayRotate()?this.start():this.stop(),this.syncRotationControl(),this.syncAriaLive()}start(){let t=this.getSlides();if(!t.length)return;if(!this.shouldWrap&&this.index>=t.length-1){this.stop();return}this.stop();let i=Math.max(0,this.interval);this.timer=setInterval(()=>{let r=this.getSlides();if(r.length){if(!this.shouldWrap&&this.index>=r.length-1){this.stop(),this.syncAriaLive();return}this.goTo(this.index+1)}},i),this.syncAriaLive()}stop(){this.timer&&clearInterval(this.timer),this.timer=null,this.syncAriaLive()}goTo(t){let i=this.getSlides();i.length&&(this.index=this.normalizeIndex(t,i.length),this.sync(),this.syncIndicators())}userNavigate(t){this.paused=!0,this.stop(),this.goTo(this.index+t)}isSwipeExcludedTarget(t){return t instanceof Element?!!t.closest("button, a, input, textarea, select, [data-carousel-indicator], [data-carousel-action]"):!1}prev(){this.userNavigate(-1)}next(){this.userNavigate(1)}toggleRotation(){this.autoplay?(this.paused=!this.paused,this.paused||(this.userOverrideReducedMotion=!0)):(this.autoplay=!0,this.paused=!1,this.userOverrideReducedMotion=!0),this.syncAutoplay()}onIndicatorClick(t){let i=t.target.closest("[data-carousel-indicator]");if(!i)return;let r=Number(i.getAttribute("data-carousel-indicator"));Number.isFinite(r)&&(this.paused=!0,this.stop(),this.goTo(r),i.focus())}onIndicatorKeydown(t){let i=this.getSlides();if(!i.length)return;let r=t.target.closest("[data-carousel-indicator]");if(!r)return;let c=Number(r.getAttribute("data-carousel-indicator"));if(!Number.isFinite(c))return;if(t.key==="ArrowRight")c=this.normalizeIndex(c+1,i.length);else if(t.key==="ArrowLeft")c=this.normalizeIndex(c-1,i.length);else if(t.key==="Home")c=0;else if(t.key==="End")c=i.length-1;else if(t.key===" "||t.key==="Enter"){t.preventDefault(),this.paused=!0,this.stop(),this.goTo(c);return}else return;t.preventDefault(),this.paused=!0,this.stop(),this.goTo(c),Array.from(this.querySelectorAll('[data-ref="indicators"] [data-carousel-indicator]'))[c]?.focus()}onRootPointerEnter(t){this.autoplay&&t.pointerType==="mouse"&&this.stop()}onRootPointerLeave(t){this.autoplay&&!this.paused&&t.pointerType==="mouse"&&this.syncAutoplay()}onRootFocusIn(){this.autoplay&&this.stop()}onRootFocusOut(t){let i=t.relatedTarget;i&&this.contains(i)||this.autoplay&&!this.paused&&this.syncAutoplay()}onViewportPointerDown(t){t.button!==0||this.isSwipeExcludedTarget(t.target)||(this.swipePointerId=t.pointerId,this.swipeStartX=t.clientX,this.swipeStartY=t.clientY)}onViewportPointerMove(t){this.swipePointerId,t.pointerId}onViewportPointerUp(t){if(this.swipePointerId!==t.pointerId)return;let i=t.clientX-this.swipeStartX,r=t.clientY-this.swipeStartY;this.swipePointerId=null,!(Math.abs(i)<Dw||Math.abs(i)<=Math.abs(r))&&(i<0?this.next():this.prev())}onViewportPointerCancel(t){this.swipePointerId===t.pointerId&&(this.swipePointerId=null)}render(){let t=this.shouldShowRotationControl(),i=Math.max(this.getSlides().length,this.slideCount),r=this.normalizeIndex(this.index,i||1),c=!this.shouldWrap&&i>0&&r<=0,p=!this.shouldWrap&&i>0&&r>=i-1,h=this.autoplay&&!this.paused,a=h&&this.timer!==null?"off":"polite",E=this.controlsVariant==="overlay";queueMicrotask(()=>{this.sync(),this.syncIndicators(),this.syncRotationControl(),this.syncAriaLive()});let C=ot("slot",{name:"prev",children:ot("button",{type:"button","data-carousel-action":"prev","data-ref":"prev",class:`rui-carousel__nav rui-button rui-button--outline rui-button--sm${E?" rui-carousel__nav--overlay":" rui-carousel__nav--toolbar"}`,"aria-label":"Previous slide",disabled:c,children:E?ot("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}):re("span",{class:"rui-carousel__nav-label",children:[ot("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}),"Previous"]})})}),R=ot("slot",{name:"next",children:ot("button",{type:"button","data-carousel-action":"next","data-ref":"next",class:`rui-carousel__nav rui-button rui-button--outline rui-button--sm${E?" rui-carousel__nav--overlay":" rui-carousel__nav--toolbar"}`,"aria-label":"Next slide",disabled:p,children:E?ot("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"}):re("span",{class:"rui-carousel__nav-label",children:["Next",ot("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"})]})})}),D=t?ot("slot",{name:"rotation",children:ot("button",{type:"button","data-carousel-action":"rotation","data-ref":"rotation",class:`rui-carousel__rotation rui-button rui-button--ghost rui-button--sm${E?" rui-carousel__rotation--overlay":""}`,"aria-pressed":h,"aria-label":h?"Pause rotation":"Start rotation",children:h?"Pause":"Play"})}):null,T=this.showIndicators?ot("div",{class:`rui-carousel__indicators${E?" rui-carousel__indicators--overlay":""}`,"data-ref":"indicators",role:"tablist","aria-label":"Choose slide to display"}):null,z=re("div",{class:"rui-carousel__toolbar",children:[t?ot("div",{class:"rui-carousel__toolbar-rotation",children:D}):null,ot("div",{class:"rui-carousel__toolbar-side rui-carousel__toolbar-side--start",children:C}),ot("div",{class:"rui-carousel__toolbar-center",children:T}),ot("div",{class:"rui-carousel__toolbar-side rui-carousel__toolbar-side--end",children:R})]}),$=E?re("div",{class:"rui-carousel__overlay-chrome",children:[t?ot("div",{class:"rui-carousel__overlay-rotation",children:D}):null,re("div",{class:"rui-carousel__controls rui-carousel__controls--overlay",children:[C,R]}),T]}):null;return re("section",{class:`rui-carousel rui-carousel--${this.transition} rui-carousel--controls-${this.controlsVariant}`,"data-ref":"root","aria-roledescription":"carousel","aria-label":this.$.label,children:[ot("div",{class:"rui-carousel__stage",children:re("div",{class:"rui-carousel__viewport","data-ref":"viewport","aria-live":a,"aria-atomic":!1,children:[ot("div",{class:"rui-carousel__track",style:this.transition==="slide"?{"--rui-carousel-index":String(this.index)}:void 0,children:ot("slot",{})}),$]})}),E?null:ot("div",{class:"rui-carousel__footer",children:z})]})}static{za()}};import{jsx as Et,jsxs as ms}from"@ecopages/jsx/jsx-runtime";function gs({id:e,children:t,class:i,...r}){return Et("div",{...r,class:K("rui-carousel__slide",i),"data-slide":e,children:t})}function Cw(){return ms("span",{class:"rui-carousel__nav-label",children:[Et("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}),"Previous"]})}function kw(){return ms("span",{class:"rui-carousel__nav-label",children:["Next",Et("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"})]})}function Ow({children:e,slot:t="prev",class:i,disabled:r,overlay:c,...p}){return Et("button",{...p,slot:t,type:"button","data-carousel-action":"prev","data-ref":"prev",class:K("rui-carousel__nav rui-button rui-button--outline rui-button--sm",c?"rui-carousel__nav--overlay":"rui-carousel__nav--toolbar",i),"aria-label":"Previous slide",disabled:r,children:e??(c?Et("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u2039"}):Cw())})}function Vw({children:e,slot:t="next",class:i,disabled:r,overlay:c,...p}){return Et("button",{...p,slot:t,type:"button","data-carousel-action":"next","data-ref":"next",class:K("rui-carousel__nav rui-button rui-button--outline rui-button--sm",c?"rui-carousel__nav--overlay":"rui-carousel__nav--toolbar",i),"aria-label":"Next slide",disabled:r,children:e??(c?Et("span",{class:"rui-carousel__nav-icon","aria-hidden":"true",children:"\u203A"}):kw())})}function Mw({children:e,slot:t="rotation",class:i,overlay:r,...c}){return Et("button",{...c,slot:t,type:"button","data-carousel-action":"rotation","data-ref":"rotation",class:K("rui-carousel__rotation rui-button rui-button--ghost rui-button--sm",r&&"rui-carousel__rotation--overlay",i),"aria-pressed":!1,"aria-label":"Start rotation",children:e??"Play"})}var jw=rt(Ti,({slides:e,children:t,...i})=>{if(t!=null)return Et("rui-carousel",{...i,children:t});let r=e??[];return Et("rui-carousel",{...i,slideCount:r.length,children:r.map(c=>Et(gs,{id:c.id,children:c.children}))})},{stylesheets:["./carousel.css"]});import{jsx as Ri,jsxs as Uw}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Os,customElement as qw,event as $w,onEvent as zw,prop as Oe}from"@ecopages/radiant";var bs,vs,ys,_s,xs,ws,Ss,Es,Ts,Rs,As,Is,Ds,Cs;function Lw(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:ks(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||ks(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:Pw(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return Fw(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function Pw(e){var t=Bw(e,"string");return typeof t=="symbol"?t:t+""}function Bw(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ks(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function Fw(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ai,Vs=class extends Os{static{({e:[ys,_s,xs,ws,Ss,Es,Ts,Rs,As,Is,Ds,Cs,bs],c:[Ai,vs]}=Lw(this,[qw("rui-checkbox")],[[Oe({type:Boolean,reflect:!0,defaultValue:!1}),0,"checked"],[Oe({type:Boolean,reflect:!0,defaultValue:!1}),0,"indeterminate"],[Oe({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Oe({type:String,defaultValue:"on"}),0,"value"],[Oe({type:String,defaultValue:""}),0,"name"],[$w({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[zw({ref:"input",type:"change"}),2,"onInputChange"]],0,void 0,Os))}checked=(bs(this),ys(this));indeterminate=(_s(this),xs(this));disabled=(ws(this),Ss(this));value=(Es(this),Ts(this));name=(Rs(this),As(this));changeEvent=(Is(this),Ds(this));nameAttr=(Cs(this),this.$.name.map(t=>t||void 0));resolvedAriaChecked=this.$.indeterminate.map(t=>t?"mixed":void 0);onInputChange(t){let i=t.target;this.checked=i.checked,i.indeterminate=this.indeterminate,this.changeEvent.emit({checked:this.checked,indeterminate:this.indeterminate})}render(){return Uw("label",{class:"rui-checkbox",children:[Ri("input",{type:"checkbox","data-ref":"input","data-rui-control":!0,"data-rui-control-type":"boolean",class:"rui-checkbox__input","prop:checked":this.$.checked,disabled:this.$.disabled,"prop:value":this.$.value,name:this.nameAttr,"prop:indeterminate":this.$.indeterminate,"aria-checked":this.resolvedAriaChecked}),Ri("span",{class:"rui-checkbox__control","aria-hidden":"true"}),Ri("span",{class:"rui-checkbox__label",children:Ri("slot",{})})]})}static{vs()}};import{jsx as Kw}from"@ecopages/jsx/jsx-runtime";var Ww=rt(Ai,({children:e,...t})=>Kw("rui-checkbox",{...t,children:e}),{stylesheets:["./checkbox.css"]});import{jsx as Gw}from"@ecopages/jsx/jsx-runtime";function Ms({children:e,variant:t="default",class:i,...r}){return Gw("span",{...r,class:K("rui-chip",`rui-chip--${t}`,i),children:e})}nt(Ms,["./chip.css"],import.meta.url);import{jsx as js}from"@ecopages/jsx/jsx-runtime";function Ls({children:e,class:t,"aria-label":i,...r}){return js("ul",{...r,class:K("rui-chip-list",t),"aria-label":i,children:e})}function Hw({children:e,class:t,...i}){return js("li",{...i,class:K("rui-chip-list__item",t),children:e})}nt(Ls,["./chip-list.css"],import.meta.url);import{jsx as sl,jsxs as oS}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ll,customElement as aS,event as sS,onEvent as jt,onUpdated as lS,prop as Me,query as uS}from"@ecopages/radiant";function Ve(e){let t=e.previousElementSibling;return t?.tagName.toLowerCase()==="label"?t:e.parentElement?.querySelector("[data-rui-field-label], label.rui-label")??null}function Kt(e,t,i){if(!t||t.hasAttribute("data-rui-field-managed"))return;let r=Ve(e);if(r){r.id||(r.id=i.labelId),r.htmlFor||(r.htmlFor=i.controlId),t.setAttribute("aria-labelledby",r.id),t.removeAttribute("aria-label");return}if(i.label){t.setAttribute("aria-label",i.label),t.removeAttribute("aria-labelledby");return}t.removeAttribute("aria-label"),t.removeAttribute("aria-labelledby")}var Yw={top:"bottom",bottom:"top",left:"right",right:"left"},Xw=8;function Qw(e){let t=e.indexOf("-");if(t===-1)return{side:e,align:"center"};let i=e.slice(0,t),r=e.slice(t+1);return{side:i,align:r==="start"||r==="end"?r:"center"}}function Fs(e){return e==="top"||e==="bottom"?"y":"x"}function Ps(e,t,i,r,c){let{width:p,height:h}=t,a=0,E=0;switch(i){case"top":E=e.top-h-c;break;case"bottom":E=e.bottom+c;break;case"left":a=e.left-p-c;break;case"right":a=e.right+c;break}return Fs(i)==="y"?r==="start"?a=e.left:r==="end"?a=e.right-p:a=e.left+(e.width-p)/2:r==="start"?E=e.top:r==="end"?E=e.bottom-h:E=e.top+(e.height-h)/2,{x:a,y:E}}function Jw(e,t,i,r){let{padding:c,width:p,height:h}=r;return i==="top"?Math.max(0,c-e.y):i==="bottom"?Math.max(0,e.y+t.height-(h-c)):i==="left"?Math.max(0,c-e.x):Math.max(0,e.x+t.width-(p-c))}function Bs(e,t,i,r){let{padding:c,width:p,height:h}=r;return i==="top"?e.top-c-t.height:i==="bottom"?h-c-t.height-e.bottom:i==="left"?e.left-c-t.width:p-c-t.width-e.right}function Zw(e,t){return t==="center"?e:`${e}-${t}`}function Nw(e,t,i,r){let{padding:c,width:p,height:h}=r;if(Fs(i)==="y"){let E=Math.max(c,p-c-t.width);return{x:Math.min(Math.max(e.x,c),E),y:e.y}}let a=Math.max(c,h-c-t.height);return{x:e.x,y:Math.min(Math.max(e.y,c),a)}}function tS(e,t,i,r,c={width:typeof window>"u"?0:window.innerWidth,height:typeof window>"u"?0:window.innerHeight,padding:Xw}){let{side:p,align:h}=Qw(i),a=Ps(e,t,p,h,r),E=Jw(a,t,p,c),C=p,R=a;if(E>0){let D=Yw[p],T=Ps(e,t,D,h,r),z=Bs(e,t,p,c);Bs(e,t,D,c)>z&&(C=D,R=T)}return{coords:Nw(R,t,C,c),placement:Zw(C,h)}}function hn(e,t,i,r,c={}){let{coords:p,placement:h}=tS(e.getBoundingClientRect(),{width:t.offsetWidth,height:t.offsetHeight},i,r);return Object.assign(t.style,{position:"fixed",left:`${p.x}px`,top:`${p.y}px`,right:"auto",bottom:"auto",visibility:"visible"}),c.matchAnchorWidth&&(t.style.width=`${e.offsetWidth}px`),t.setAttribute("data-placement",h),h}function Ii({anchor:e,floating:t,getPlacement:i,gap:r,matchAnchorWidth:c}){let p=()=>{t.hidden||hn(e,t,i(),r,{matchAnchorWidth:c})};p(),window.addEventListener("resize",p),window.addEventListener("scroll",p,!0);let h=new ResizeObserver(p);return h.observe(e),h.observe(t),()=>{window.removeEventListener("resize",p),window.removeEventListener("scroll",p,!0),h.disconnect()}}function Us(e,t=document.body){let i=e.parentNode;if(!i)return{unmount:()=>{}};let r=document.createComment("rui-portal");return i.insertBefore(r,e),t.appendChild(e),{unmount:()=>{let c=r.parentNode;c&&(c.insertBefore(e,r),r.remove())}}}function pn(e,t,i){return i?!!(e?.contains(i)||t?.contains(i)):!1}function Wt(e,t,i){return i instanceof Node?!pn(e,t,i):!0}function Gt(e,t,i){return!pn(e,t,i)}var pt=class{config;cleanupFloating=null;portalHandle=null;floatingElement=null;constructor(t){this.config=t}updateConfig(t){this.config={...this.config,...t}}sync(){let t=this.resolveFloating();if(!t)return;if(!this.config.getOpen()){this.teardown(),t.hidden=!0;return}let r=this.config.getAnchor();if(!r)return;t.hidden=!1,this.config.portal!==!1?this.portalHandle||(this.portalHandle=Us(t,this.config.portalContainer??document.body)):this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null),this.teardownFloating(),this.cleanupFloating=Ii({anchor:r,floating:t,getPlacement:this.config.getPlacement,gap:this.config.gap??8,matchAnchorWidth:this.config.matchAnchorWidth})}contains(t){return pn(this.config.getAnchor(),this.resolveFloating(),t)}getFloatingElement(){return this.resolveFloating()}teardown(){this.teardownFloating(),this.portalHandle&&(this.portalHandle.unmount(),this.portalHandle=null)}destroy(){this.teardown(),this.floatingElement=null}resolveFloating(){let t=this.config.getFloating();return t&&(this.floatingElement=t),t??this.floatingElement}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}};function qs(e){return e.filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}function $s(e,t,i){return i===0?-1:t===1?e>=i-1?0:e+1:e<=0?i-1:e-1}function fn(e,t){t?.removeAttribute("aria-activedescendant");for(let i of e)i.removeAttribute("data-active")}function zs(e,t,i,r,c){fn(e,r);let p=t[i];return!p||!r?null:(p.id||(p.id=`${c}-${i}`),p.setAttribute("data-active","true"),r.setAttribute("aria-activedescendant",p.id),p.scrollIntoView({block:"nearest"}),p)}var me=class{config;popoverController;activeIndex=-1;visualFocus=!1;constructor(t){this.config=t,this.popoverController=new pt({getAnchor:t.getAnchor,getFloating:t.getFloating,getOpen:t.getOpen,getPlacement:()=>"bottom-start",gap:4,portal:!1,matchAnchorWidth:!0})}get activeOptionIndex(){return this.activeIndex}get hasVisualFocus(){return this.visualFocus}ensureOptionIds(){this.config.getOptions().forEach((t,i)=>{t.id||(t.id=`${this.config.getOptionIdPrefix()}-${i}`)})}getVisibleOptions(){return qs(this.config.getOptions())}clearActiveOption(){this.activeIndex=-1,this.visualFocus=!1,fn(this.config.getOptions(),this.config.getActiveDescendantHost())}setActiveOption(t){let i=this.getVisibleOptions();if(t<0||t>=i.length){this.clearActiveOption();return}this.activeIndex=t,this.visualFocus=!0,zs(this.config.getOptions(),i,t,this.config.getActiveDescendantHost(),this.config.getOptionIdPrefix())}moveActive(t,i){let r=this.getVisibleOptions();if(r.length){if(!this.config.getOpen()){i(t===1?"first":"last");return}if(this.visualFocus){this.setActiveOption($s(this.activeIndex,t,r.length));return}this.setActiveOption(t===1?0:r.length-1)}}handleKeydown(t,i){if(!(t.ctrlKey||t.shiftKey||t.metaKey)){if(t.key==="ArrowDown"||t.key==="ArrowUp"){t.preventDefault(),t.stopPropagation();let r=t.key==="ArrowDown"?1:-1;if(t.altKey){r===1&&!i.isOpen?i.onOpen():r===-1&&i.isOpen&&i.onClose("arrow");return}this.moveActive(r,c=>i.onOpen(c));return}if(t.key==="Escape"){t.preventDefault(),i.isOpen?i.onClose("escape"):i.onEscapeWhenClosed?.();return}if(t.key==="Enter"||t.key===" "&&i.canUseSpace){if(!i.isOpen&&i.enterWhenClosed==="open"){t.preventDefault(),i.onOpen();return}let r=this.getVisibleOptions();i.isOpen&&this.visualFocus&&r[this.activeIndex]?(t.preventDefault(),i.onSelectActive()):t.key==="Enter"&&i.isOpen&&i.enterWithoutActive==="close"&&(t.preventDefault(),i.onClose("enter"));return}if(t.key==="Tab"&&i.isOpen){let r=this.getVisibleOptions();if(this.visualFocus&&r[this.activeIndex]&&i.closesOnTab){i.onSelectActive();return}i.onClose("tab")}}}syncPopoverPosition(){this.popoverController.sync()}shouldDismissFocus(t){return Wt(this.config.getAnchor(),this.popoverController.getFloatingElement(),t)}shouldDismissPointer(t){return Gt(this.config.getAnchor(),this.popoverController.getFloatingElement(),t)}destroy(){this.popoverController.destroy()}};var Ks,Ws,Gs,Hs,Ys,Xs,Qs,Js,Zs,Ns,tl,el,il,rl,nl,ol;function eS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:al(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||al(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:iS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return nS(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function iS(e){var t=rS(e,"string");return typeof t=="symbol"?t:t+""}function rS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function al(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function nS(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Di,ul=class extends ll{static{({e:[Gs,Hs,Ys,Xs,Qs,Js,Zs,Ns,tl,el,il,rl,nl,ol,Ks],c:[Di,Ws]}=eS(this,[aS("rui-combobox")],[[Me({type:String,reflect:!0,defaultValue:""}),0,"value"],[Me({type:String,defaultValue:""}),0,"label"],[Me({type:String,defaultValue:""}),0,"placeholder"],[Me({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Me({type:Boolean,reflect:!0,defaultValue:!1}),0,"openOnFocus"],[sS({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[uS({ref:"root"}),0,"rootTarget"],[lS(["value","label","placeholder","disabled","openOnFocus"]),2,"onPropsUpdated"],[jt({ref:"root",type:"focusin"}),2,"onRootFocusIn"],[jt({ref:"root",type:"input"}),2,"onRootInput"],[jt({ref:"root",type:"keydown",options:{capture:!0}}),2,"onRootKeydown"],[jt({selector:"[data-combobox-trigger]",type:"click"}),2,"onTriggerClick"],[jt({selector:'[data-combobox-listbox] [role="option"]',type:"pointerover"}),2,"onOptionPointerOver"],[jt({selector:'[data-combobox-listbox] [role="option"]',type:"mousedown"}),2,"onOptionMouseDown"],[jt({selector:'[data-combobox-listbox] [role="option"]',type:"click"}),2,"onOptionClick"],[jt({ref:"root",type:"focusout"}),2,"onFocusOut"],[jt({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"]],0,void 0,ll))}constructor(...t){super(...t),ol(this)}value=(Ks(this),Gs(this));label=(Hs(this),Ys(this));placeholder=(Xs(this),Qs(this));disabled=(Js(this),Zs(this));openOnFocus=(Ns(this),tl(this));changeEvent=(el(this),il(this));open=(rl(this),!1);skipNextFocusOpen=!1;uid=Math.random().toString(36).slice(2,9);listboxBehavior=new me({getAnchor:()=>this.rootTarget,getFloating:()=>this.getListboxPopup(),getOpen:()=>this.open,getOptions:()=>this.getOptions(),getActiveDescendantHost:()=>this.getInput(),getOptionIdPrefix:()=>`rui-combobox-option-${this.uid}`});rootTarget=nl(this);get listboxId(){return`rui-combobox-list-${this.uid}`}get inputId(){return`rui-combobox-input-${this.uid}`}getInput(){return this.querySelector("[data-combobox-input]")}getTrigger(){return this.querySelector("[data-combobox-trigger]")}getListboxPopup(){return this.querySelector("[data-combobox-listbox]")}getListbox(){let t=this.querySelector("rui-listbox");return t instanceof HTMLElement?t.querySelector('[role="listbox"]')??t:this.getListboxPopup()}getListboxHost(){return this.querySelector("rui-listbox")}getOptions(){let t=this.getListbox();return t?Array.from(t.querySelectorAll('[role="option"]')):[]}getOptionLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}ensureOptionIds(){this.listboxBehavior.ensureOptionIds()}getAccessibleName(){return Ve(this)?.textContent?.trim()||this.label||"Suggestions"}isComboboxInput(t){return t instanceof HTMLInputElement&&t.hasAttribute("data-combobox-input")}syncLabel(){let t=this.getInput();Kt(this,t,{controlId:this.inputId,label:this.label,labelId:`rui-combobox-label-${this.uid}`})}syncTrigger(){let t=this.getTrigger(),i=this.getListbox();!t||!i||(t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",i.id||this.listboxId),t.tabIndex=-1,this.disabled&&(t.disabled=!0))}syncInput(){let t=this.getInput(),i=this.getListbox(),r=this.getListboxPopup();!t||!i||(t.id||(t.id=this.inputId),i.id||(i.id=this.listboxId),t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",this.listboxId),i.setAttribute("aria-label",this.getAccessibleName()),r&&(r.removeAttribute("role"),r.removeAttribute("aria-label")),this.placeholder&&!t.placeholder&&(t.placeholder=this.placeholder),this.disabled&&(t.disabled=!0),this.syncTrigger())}syncListboxHost(){let t=this.getListboxHost();t&&(t.embedded=!0,t.value=this.value)}syncOptionSelection(){for(let t of this.getOptions()){let r=(t.getAttribute("data-value")||this.getOptionLabel(t))===this.value&&this.value!=="";t.setAttribute("aria-selected",String(r))}}setVisualFocusCombobox(){this.listboxBehavior.clearActiveOption(),this.syncOptionSelection()}setOpen(t,i={}){let r=i.activate??"none";this.open=t;let c=this.getInput(),p=this.getListboxPopup();if(!(!c||!p)){if(c.setAttribute("aria-expanded",String(t)),p.hidden=!t,this.syncTrigger(),!t){this.listboxBehavior.clearActiveOption(),this.listboxBehavior.syncPopoverPosition();return}if(this.ensureOptionIds(),this.listboxBehavior.syncPopoverPosition(),r==="first"){let h=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(h.length?0:-1);return}if(r==="last"){let h=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(h.length?h.length-1:-1);return}this.listboxBehavior.clearActiveOption()}}getAutocomplete(){return this.querySelector("rui-autocomplete")}syncAutocompleteFilter(){let t=this.getAutocomplete();if(t){t.syncFilter();return}let i=this.getInput()?.value??"";for(let r of this.getOptions()){let c=mi(this.getOptionLabel(r),i,"base");r.hidden=i.trim()!==""&&!c}}showAllOptions(){for(let t of this.getOptions())t.hidden=!1}syncFilter(){this.syncAutocompleteFilter()}select(t){if(t.getAttribute("aria-disabled")==="true")return;let i=t.getAttribute("data-value")||this.getOptionLabel(t),r=this.getOptionLabel(t)||i;this.value=i;let c=this.getInput();c&&(c.value=r),this.changeEvent.emit({value:i}),this.syncOptionSelection(),this.skipNextFocusOpen=!0,this.setOpen(!1),c?.focus()}syncFromValue(){let t=this.getInput();if(!t)return;let i=this.getOptions().find(c=>c.getAttribute("data-value")===this.value),r=i?this.getOptionLabel(i):this.value||"";t.value=r}initialize(){this.ensureOptionIds(),this.syncLabel(),this.syncInput(),this.syncListboxHost(),this.syncFromValue(),this.syncOptionSelection(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.listboxBehavior.destroy(),super.disconnectedCallback()}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.syncListboxHost(),this.syncFromValue(),this.syncOptionSelection()}onRootFocusIn(t){if(this.isComboboxInput(t.target)){if(this.skipNextFocusOpen){this.skipNextFocusOpen=!1;return}this.openOnFocus&&(this.syncFilter(),this.setOpen(!0),this.setVisualFocusCombobox())}}onRootInput(t){if(!this.isComboboxInput(t.target))return;let i=t.target;this.syncFilter(),i.value.trim()!==""&&this.listboxBehavior.getVisibleOptions().length?this.setOpen(!0):i.value.trim()===""&&this.openOnFocus?this.setOpen(!0):(i.value.trim()===""||!this.listboxBehavior.getVisibleOptions().length)&&this.setOpen(!1),this.setVisualFocusCombobox()}onRootKeydown(t){this.isComboboxInput(t.target)&&this.handleInputKeydown(t)}handleInputKeydown(t){if(t.key==="Home"){let i=this.getInput();if(!i)return;t.preventDefault(),i.setSelectionRange(0,0),this.setVisualFocusCombobox();return}if(t.key==="End"){let i=this.getInput();if(!i)return;t.preventDefault();let r=i.value.length;i.setSelectionRange(r,r),this.setVisualFocusCombobox();return}(t.key==="ArrowDown"||t.key==="ArrowUp")&&(this.syncFilter(),this.listboxBehavior.getVisibleOptions().length||this.showAllOptions()),this.listboxBehavior.handleKeydown(t,{isOpen:this.open,canUseSpace:!1,closesOnTab:!0,enterWhenClosed:"ignore",enterWithoutActive:"close",onOpen:(i="none")=>{this.syncFilter(),this.setOpen(!0,{activate:i})},onClose:()=>this.setOpen(!1),onSelectActive:()=>{let i=this.listboxBehavior.getVisibleOptions()[this.listboxBehavior.activeOptionIndex];i&&this.select(i)},onEscapeWhenClosed:()=>{let i=this.getInput();i&&i.value&&(i.value="",this.value="",this.changeEvent.emit({value:""}),this.syncFilter())}})}onTriggerClick(t){t.preventDefault();let i=this.getInput();!i||i.disabled||(this.open?(this.skipNextFocusOpen=!0,this.setOpen(!1)):(this.syncFilter(),this.setOpen(!0),this.setVisualFocusCombobox()),i.focus())}onOptionPointerOver(t){if(!this.open)return;let i=t.target.closest('[role="option"]');if(!i||i.getAttribute("aria-disabled")==="true"||i.hidden)return;let c=this.listboxBehavior.getVisibleOptions().indexOf(i);c>=0&&this.listboxBehavior.setActiveOption(c)}onOptionMouseDown(t){t.preventDefault()}onOptionClick(t){let i=t.target.closest('[role="option"]');i&&this.select(i)}onFocusOut(t){this.listboxBehavior.shouldDismissFocus(t.relatedTarget)&&this.setOpen(!1)}onDocumentPointerDown(t){this.open&&this.listboxBehavior.shouldDismissPointer(t.target)&&this.setOpen(!1)}render(){return oS("div",{class:"rui-combobox","data-ref":"root",children:[sl("slot",{name:"control"}),sl("slot",{name:"listbox"})]})}static{Ws()}};import{jsx as yt,jsxs as mn}from"@ecopages/jsx/jsx-runtime";import{jsx as Ci,jsxs as cS}from"@ecopages/jsx/jsx-runtime";function je({class:e,size:t="sm",...i}){return cS("svg",{...i,class:K("rui-icon",t==="md"&&"rui-icon--md",e),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:[Ci("path",{d:"M8 2v4"}),Ci("path",{d:"M16 2v4"}),Ci("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),Ci("path",{d:"M3 10h18"})]})}import{jsx as cl}from"@ecopages/jsx/jsx-runtime";function Le({class:e,size:t="sm",...i}){return cl("svg",{...i,class:K("rui-icon",t==="md"&&"rui-icon--md",e),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",children:cl("path",{d:"m6 9 6 6 6-6"})})}import{jsx as Rl}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Al,customElement as gS,event as bS,onEvent as Il,onUpdated as vS,prop as Pe}from"@ecopages/radiant";function lt(e,t){e.forEach((i,r)=>{i.tabIndex=r===t?0:-1})}function ge(e,t){if(!e.length)return null;let i=Math.max(0,Math.min(e.length-1,t));return lt(e,i),e[i]?.focus(),e[i]??null}function dS(e,t){return e==="Home"?"first":e==="End"?"last":t==="horizontal"?e==="ArrowRight"?"next":e==="ArrowLeft"?"prev":null:e==="ArrowDown"?"next":e==="ArrowUp"?"prev":null}function st(e){let{items:t,current:i,key:r,orientation:c="horizontal",wrap:p=!0}=e;if(!t.length||!i)return{handled:!1};let h=t.indexOf(i);if(h<0)return{handled:!1};let a=dS(r,c);if(!a)return{handled:!1};let E=h;a==="first"?E=0:a==="last"?E=t.length-1:a==="next"?E=p?(h+1)%t.length:Math.min(t.length-1,h+1):E=p?(h-1+t.length)%t.length:Math.max(0,h-1);let C=ge(t,E);return C?{handled:!0,index:E,item:C}:{handled:!1}}var dl,hl,pl,fl,ml,gl,bl,vl,yl,_l,xl,wl,Sl,El;function hS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Tl(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Tl(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:pS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return mS(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function pS(e){var t=fS(e,"string");return typeof t=="symbol"?t:t+""}function fS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tl(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function mS(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var ki,Dl=class extends Al{static{({e:[pl,fl,ml,gl,bl,vl,yl,_l,xl,wl,Sl,El,dl],c:[ki,hl]}=hS(this,[gS("rui-listbox")],[[Pe({type:String,reflect:!0,defaultValue:""}),0,"value"],[Pe({type:String,defaultValue:""}),0,"label"],[Pe({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Pe({type:Boolean,reflect:!0,defaultValue:!1}),0,"embedded"],[Pe({type:Boolean,reflect:!0}),0,"bordered"],[bS({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[vS(["value","disabled","embedded","bordered"]),2,"onPropsUpdated"],[Il({selector:'[role="option"]',type:"click"}),2,"onOptionClick"],[Il({selector:'[role="option"]',type:"keydown"}),2,"onOptionKeydown"]],0,void 0,Al))}value=(dl(this),pl(this));label=(fl(this),ml(this));disabled=(gl(this),bl(this));embedded=(vl(this),yl(this));bordered=(_l(this),xl(this));changeEvent=(wl(this),Sl(this));resolvedAriaLabel=(El(this),this.$.label.map(t=>t||void 0));resolvedAriaDisabled=this.$.disabled.map(t=>t?"true":void 0);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.sync(),this.syncPresentation()})}onPropsUpdated(){this.sync(),this.syncPresentation()}getOptions(){return Array.from(this.querySelectorAll('[role="option"]'))}sync(){let t=this.getOptions();for(let i of t){let r=i.getAttribute("data-value")===this.value;i.setAttribute("aria-selected",String(r)),i.tabIndex=this.embedded?-1:r||!this.value&&i===t[0]?0:-1}}select(t){this.disabled||t.getAttribute("aria-disabled")==="true"||(this.value=t.getAttribute("data-value")||t.textContent?.trim()||"",this.sync(),this.changeEvent.emit({value:this.value}),t.focus())}onOptionClick(t){if(this.embedded)return;let i=t.target.closest('[role="option"]');i&&this.contains(i)&&this.select(i)}onOptionKeydown(t){if(this.embedded)return;let i=this.getOptions(),r=t.target.closest('[role="option"]');if(!r)return;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.select(r);return}let c=st({items:i,current:r,key:t.key,orientation:"vertical"});c.handled&&(t.preventDefault(),this.select(c.item))}isBordered(){return this.bordered!=null?this.bordered:!this.embedded}syncPresentation(){let t=this.querySelector(".rui-listbox");t&&t.classList.toggle("rui-listbox--bordered",this.isBordered())}render(){let t=this.isBordered();return Rl("div",{class:`rui-listbox${t?" rui-listbox--bordered":""}`,role:"listbox","data-rui-control":!0,"data-rui-control-type":"text","aria-label":this.resolvedAriaLabel,"aria-disabled":this.resolvedAriaDisabled,children:Rl("slot",{})})}static{hl()}};import{jsx as Oi}from"@ecopages/jsx/jsx-runtime";function ne({value:e,label:t,children:i,class:r,disabled:c,...p}){return Oi("div",{...p,class:K("rui-listbox__option",r),role:"option","data-value":e,"data-label":t,"aria-disabled":c?"true":void 0,tabindex:-1,children:i})}var be=rt(ki,({options:e,children:t,...i})=>e!=null?Oi("rui-listbox",{...i,children:e.map(r=>Oi(ne,{value:r.value,label:typeof r.label=="string"?r.label:void 0,disabled:r.disabled,children:r.label}))}):Oi("rui-listbox",{...i,children:t}),{stylesheets:["./listbox.css"]});function Cl({children:e,slot:t="control",class:i,...r}){return yt("div",{...r,slot:t,class:K("rui-combobox__control",i),children:e})}function kl({placeholder:e,disabled:t,class:i,...r}){return yt("input",{...r,type:"text","data-combobox-input":!0,"data-autocomplete-input":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:K("rui-combobox__input",i),placeholder:e,disabled:t,autocomplete:"off"})}function Ol({children:e,class:t,"aria-label":i="Show suggestions",disabled:r,...c}){return yt("button",{...c,type:"button","data-combobox-trigger":!0,class:K("rui-control-toggle",t),"aria-label":i,disabled:r,tabIndex:-1,children:e??yt(Le,{})})}function Vl({children:e,slot:t="listbox",class:i,...r}){return yt("div",{...r,slot:t,"data-combobox-listbox":!0,class:K("rui-combobox__listbox rui-popover rui-popover--listbox rui-floating",i),hidden:!0,children:e})}var yS=ne,_S=rt(Di,({options:e,children:t,...i})=>e!=null?mn("rui-combobox",{...i,children:[mn(Cl,{children:[yt(kl,{placeholder:i.placeholder,disabled:i.disabled}),yt(Ol,{})]}),yt(Vl,{children:yt(Wr,{children:mn(zr,{children:[yt(be,{embedded:!0,options:e}),yt(Kr,{children:"No results found."})]})})})]}):yt("rui-combobox",{...i,children:t}),{stylesheets:["./combobox.css","../shared/control-toggle.css","../../../lib/icons/icons.css"]});import{jsx as Be,jsxs as yu}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as _u,customElement as TS,event as RS,onEvent as kt,onUpdated as xu,prop as _t,query as wu,state as gn}from"@ecopages/radiant";var Ml,jl,Ll,Pl,Bl,Fl,Ul,ql,$l,zl,Kl,Wl,Gl,Hl,Yl,Xl,Ql,Jl,Zl,Nl,tu,eu,iu,ru,nu,ou,au,su,lu,uu,cu,du,hu,pu,fu,mu,gu,bu;function xS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:vu(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||vu(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:wS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return ES(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function wS(e){var t=SS(e,"string");return typeof t=="symbol"?t:t+""}function SS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vu(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function ES(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Vi,Su=class extends _u{static{({e:[Ll,Pl,Bl,Fl,Ul,ql,$l,zl,Kl,Wl,Gl,Hl,Yl,Xl,Ql,Jl,Zl,Nl,tu,eu,iu,ru,nu,ou,au,su,lu,uu,cu,du,hu,pu,fu,mu,gu,bu,Ml],c:[Vi,jl]}=xS(this,[TS("rui-date-field")],[[_t({type:String,reflect:!0,defaultValue:""}),0,"value"],[_t({type:String,defaultValue:""}),0,"min"],[_t({type:String,defaultValue:""}),0,"max"],[_t({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[_t({type:Boolean,attribute:"read-only",reflect:!0,defaultValue:!1}),0,"readOnly"],[_t({type:String,defaultValue:""}),0,"label"],[_t({type:String,defaultValue:""}),0,"name"],[_t({type:String,defaultValue:""}),0,"placeholder"],[_t({type:String,defaultValue:""}),0,"locale"],[_t({type:String,attribute:"date-style",defaultValue:"medium"}),0,"dateStyle"],[_t({type:Boolean,reflect:!0,defaultValue:!0}),0,"masked"],[_t({type:Number,attribute:"visible-months",defaultValue:1}),0,"visibleMonths"],[RS({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[gn,0,"displayValue"],[gn,0,"editing"],[gn,0,"open"],[wu({ref:"root"}),0,"rootTarget"],[wu({ref:"popover"}),0,"popoverTarget"],[xu(["value","min","max","label","placeholder","disabled","readOnly","locale","dateStyle","masked"]),2,"onPropsUpdated"],[xu(["open"]),2,"onOpenUpdated"],[kt({selector:"[data-date-field-input]",type:"focusin"}),2,"onInputFocus"],[kt({selector:"[data-date-field-input]",type:"input"}),2,"onInput"],[kt({selector:"[data-date-field-input]",type:"change"}),2,"onInputChange"],[kt({selector:"[data-date-field-input]",type:"keydown"}),2,"onInputKeydown"],[kt({ref:"root",type:"focusout"}),2,"onRootFocusOut"],[kt({ref:"trigger",type:"pointerdown"}),2,"onTriggerPointerDown"],[kt({ref:"trigger",type:"click"}),2,"onTriggerClick"],[kt({selector:"[data-date-field-popover]",type:"mousedown"}),2,"onPopoverMouseDown"],[kt({ref:"root",type:"rui-change"}),2,"onCalendarChange"],[kt({ref:"root",type:"keydown"}),2,"onRootKeydown"]],0,void 0,_u))}constructor(...t){super(...t),bu(this)}value=(Ml(this),Ll(this));min=(Pl(this),Bl(this));max=(Fl(this),Ul(this));disabled=(ql(this),$l(this));readOnly=(zl(this),Kl(this));label=(Wl(this),Gl(this));name=(Hl(this),Yl(this));placeholder=(Xl(this),Ql(this));locale=(Jl(this),Zl(this));dateStyle=(Nl(this),tu(this));masked=(eu(this),iu(this));visibleMonths=(ru(this),nu(this));changeEvent=(ou(this),au(this));displayValue=(su(this),lu(this,""));editing=(uu(this),cu(this,!1));open=(du(this),hu(this,!1));uid=(pu(this),Math.random().toString(36).slice(2,9));popoverController=null;suppressPopoverDismiss=!1;rootTarget=fu(this);popoverTarget=(mu(this),gu(this));get isoValue(){return this.value??""}get resolvedLocale(){return It(this.locale)}get inputId(){return`rui-date-field-input-${this.uid}`}get resolvedPlaceholder(){return this.placeholder||sn(this.resolvedLocale)}getInput(){return this.querySelector("[data-date-field-input]")}syncLabel(){let t=this.getInput();Kt(this,t,{controlId:this.inputId,label:this.label,labelId:`rui-date-field-label-${this.uid}`})}syncInput(){let t=this.getInput();if(!t)return;t.id||(t.id=this.inputId),this.name&&(t.name=this.name),this.disabled&&(t.disabled=!0);let i=this.resolvedPlaceholder;i&&(t.placeholder=i)}formatForDisplay(t){if(!t)return"";let i=Dt(t);return i?Ae(i,this.resolvedLocale,this.dateStyle):""}formatForEditing(t){if(!t)return"";if(!this.masked)return this.formatForDisplay(t);let i=Dt(t);if(!i)return"";let r=pe(this.resolvedLocale),c=AS(i,this.resolvedLocale);return Si(c,r)}syncDisplayValue(){if(this.editing)return;this.displayValue=this.formatForDisplay(this.isoValue);let t=this.getInput();t&&(t.value=this.displayValue)}isIsoAllowed(t){return!(this.min&&t<this.min||this.max&&t>this.max)}commitValue(t){if(t&&!this.isIsoAllowed(t)){this.syncDisplayValue();return}if(t===this.isoValue){this.syncDisplayValue();return}this.value=t,this.changeEvent.emit({value:t}),this.syncDisplayValue()}parseAndCommit(t){let i=(t??"").trim();if(!i){this.commitValue("");return}let r=ke(i,this.resolvedLocale);if(!r){this.syncDisplayValue();return}this.commitValue(Ct(r))}handleMaskedInput(t){let i=pe(this.resolvedLocale),r=fe(t),c=Si(r,i);return r.length>=Ce(i)&&this.parseAndCommit(c),c}initialize(){this.syncLabel(),this.syncInput(),this.syncDisplayValue()}setOpen(t){this.open=t,queueMicrotask(()=>this.syncPopoverPosition())}ensurePopoverController(){return this.popoverController||(this.popoverController=new pt({getAnchor:()=>this.rootTarget,getFloating:()=>this.popoverTarget,getOpen:()=>this.open,getPlacement:()=>"bottom-start",gap:4,portal:!1})),this.popoverController}syncPopoverPosition(){let t=this.popoverTarget;if(!t||!this.rootTarget)return;t.hidden=!this.open;let i=this.ensurePopoverController();i.updateConfig({getOpen:()=>this.open}),i.sync()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.syncDisplayValue()}onOpenUpdated(){this.syncPopoverPosition()}onInputFocus(){this.editing=!0;let t=this.getInput();t&&(t.value=this.isoValue?this.formatForEditing(this.isoValue):"",this.displayValue=t.value)}onInput(t){let i=t.target;if(this.masked){let r=this.handleMaskedInput(i.value);i.value=r,this.displayValue=r;return}this.displayValue=i.value}onInputChange(){let t=this.getInput();t&&this.parseAndCommit(t.value)}onInputKeydown(t){if(t.key==="Escape"){if(this.open){t.preventDefault(),this.setOpen(!1);return}this.editing=!1,this.syncDisplayValue()}}onRootFocusOut(t){let i=t.target,r=t.relatedTarget;i.matches("[data-date-field-input]")&&i instanceof HTMLInputElement&&queueMicrotask(()=>{this.editing&&(this.editing=!1,this.parseAndCommit(i.value))}),queueMicrotask(()=>{if(this.suppressPopoverDismiss){this.suppressPopoverDismiss=!1;return}if(!this.open)return;let c=r instanceof Node?r:document.activeElement;Wt(this.rootTarget,this.popoverTarget,c)&&this.setOpen(!1)})}onTriggerPointerDown(){this.suppressPopoverDismiss=!0}onTriggerClick(){this.disabled||this.readOnly||this.setOpen(!this.open)}onPopoverMouseDown(t){t.preventDefault()}onCalendarChange(t){let i=t.target;if(!(i instanceof HTMLElement)||i.tagName.toLowerCase()!=="rui-calendar")return;let r=t.detail;r?.value&&(this.commitValue(r.value),this.setOpen(!1))}onRootKeydown(t){t.key==="Escape"&&this.open&&(t.preventDefault(),this.setOpen(!1))}render(){let t={"prop:selectionMode":"single","prop:visibleMonths":this.visibleMonths,"prop:value":this.isoValue,"prop:min":this.min,"prop:max":this.max,"prop:locale":this.locale,"prop:disabled":this.disabled};return yu("div",{class:"rui-date-field","data-ref":"root",children:[yu("div",{class:"rui-date-field__group",children:[Be("input",{type:"text","data-date-field-input":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:"rui-date-field__input",id:this.inputId,autocomplete:"off",inputmode:this.masked?"numeric":"text",disabled:this.$.disabled,readOnly:this.$.readOnly,placeholder:this.$.placeholder||this.resolvedPlaceholder}),Be("button",{type:"button",class:"rui-control-toggle","data-ref":"trigger","data-date-field-trigger":!0,"aria-label":"Open calendar","aria-haspopup":"dialog","aria-expanded":this.open?"true":"false",disabled:this.$.disabled||this.$.readOnly,children:Be(je,{})})]}),Be("div",{class:"rui-date-field__popover rui-popover rui-floating","data-ref":"popover","data-date-field-popover":!0,hidden:!this.open,role:"dialog",children:this.open?Be("rui-calendar",{...t}):null})]})}static{jl()}};function AS(e,t){let i=wi(t),r={month:String(e.getMonth()+1).padStart(2,"0"),day:String(e.getDate()).padStart(2,"0"),year:String(e.getFullYear())};return i.map(c=>r[c]).join("")}import{jsx as IS}from"@ecopages/jsx/jsx-runtime";var DS=rt(Vi,({children:e,...t})=>IS("rui-date-field",{...t,children:e}),{stylesheets:["./date-field.css","../shared/control-toggle.css","../../../lib/icons/icons.css","../calendar/calendar.css"]});import{jsx as oe,jsxs as bn}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as pc,customElement as MS,event as jS,onEvent as Ot,onUpdated as fc,prop as gt,query as mc,state as Mi}from"@ecopages/radiant";var Eu,Tu,Ru,Au,Iu,Du,Cu,ku,Ou,Vu,Mu,ju,Lu,Pu,Bu,Fu,Uu,qu,$u,zu,Ku,Wu,Gu,Hu,Yu,Xu,Qu,Ju,Zu,Nu,tc,ec,ic,rc,nc,oc,ac,sc,lc,uc,cc,dc;function CS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:hc(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||hc(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:kS(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return VS(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function kS(e){var t=OS(e,"string");return typeof t=="symbol"?t:t+""}function OS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function hc(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function VS(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var ji,gc=class extends pc{static{({e:[Ru,Au,Iu,Du,Cu,ku,Ou,Vu,Mu,ju,Lu,Pu,Bu,Fu,Uu,qu,$u,zu,Ku,Wu,Gu,Hu,Yu,Xu,Qu,Ju,Zu,Nu,tc,ec,ic,rc,nc,oc,ac,sc,lc,uc,cc,dc,Eu],c:[ji,Tu]}=CS(this,[MS("rui-date-range-picker")],[[gt({type:String,reflect:!0,defaultValue:""}),0,"value"],[gt({type:String,defaultValue:""}),0,"min"],[gt({type:String,defaultValue:""}),0,"max"],[gt({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[gt({type:Boolean,attribute:"read-only",reflect:!0,defaultValue:!1}),0,"readOnly"],[gt({type:String,defaultValue:""}),0,"locale"],[gt({type:String,attribute:"placeholder-start",defaultValue:""}),0,"placeholderStart"],[gt({type:String,attribute:"placeholder-end",defaultValue:""}),0,"placeholderEnd"],[gt({type:String,attribute:"start-name",defaultValue:""}),0,"startName"],[gt({type:String,attribute:"end-name",defaultValue:""}),0,"endName"],[gt({type:String,defaultValue:""}),0,"name"],[gt({type:String,attribute:"date-style",defaultValue:"medium"}),0,"dateStyle"],[gt({type:Number,attribute:"visible-months",defaultValue:2}),0,"visibleMonths"],[jS({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Mi,0,"open"],[Mi,0,"startDisplay"],[Mi,0,"endDisplay"],[Mi,0,"editing"],[mc({ref:"root"}),0,"rootTarget"],[mc({ref:"popover"}),0,"popoverTarget"],[fc(["value","min","max","disabled","readOnly","locale","dateStyle","startName","endName","visibleMonths"]),2,"onPropsUpdated"],[fc(["open"]),2,"onOpenUpdated"],[Ot({ref:"trigger",type:"pointerdown"}),2,"onTriggerPointerDown"],[Ot({ref:"trigger",type:"click"}),2,"onTriggerClick"],[Ot({selector:"[data-range-start]",type:"focus"}),2,"onStartFocus"],[Ot({selector:"[data-range-end]",type:"focus"}),2,"onEndFocus"],[Ot({selector:"[data-range-start], [data-range-end]",type:"blur"}),2,"onInputBlur"],[Ot({selector:"[data-range-start], [data-range-end]",type:"input"}),2,"onInput"],[Ot({selector:"[data-range-popover]",type:"mousedown"}),2,"onPopoverMouseDown"],[Ot({ref:"root",type:"rui-change"}),2,"onCalendarChange"],[Ot({ref:"root",type:"keydown"}),2,"onRootKeydown"],[Ot({ref:"root",type:"focusout"}),2,"onRootFocusOut"]],0,void 0,pc))}constructor(...t){super(...t),dc(this)}value=(Eu(this),Ru(this));min=(Au(this),Iu(this));max=(Du(this),Cu(this));disabled=(ku(this),Ou(this));readOnly=(Vu(this),Mu(this));locale=(ju(this),Lu(this));placeholderStart=(Pu(this),Bu(this));placeholderEnd=(Fu(this),Uu(this));startName=(qu(this),$u(this));endName=(zu(this),Ku(this));name=(Wu(this),Gu(this));dateStyle=(Hu(this),Yu(this));visibleMonths=(Xu(this),Qu(this));changeEvent=(Ju(this),Zu(this));open=(Nu(this),tc(this,!1));startDisplay=(ec(this),ic(this,""));endDisplay=(rc(this),nc(this,""));editing=(oc(this),ac(this,null));uid=(sc(this),Math.random().toString(36).slice(2,9));popoverController=null;suppressPopoverDismiss=!1;rootTarget=lc(this);popoverTarget=(uc(this),cc(this));get resolvedLocale(){return It(this.locale)}get isoValue(){return this.value??""}getStartInput(){return this.querySelector("[data-range-start]")}getEndInput(){return this.querySelector("[data-range-end]")}formatIso(t){if(!t)return"";let i=Dt(t);return i?Ae(i,this.resolvedLocale,this.dateStyle):""}syncDisplayValues(){if(this.editing==="start"||this.editing==="end")return;let t=xt(this.isoValue);this.startDisplay=this.formatIso(t?.start??""),this.endDisplay=this.formatIso(t?.end??"");let i=this.getStartInput(),r=this.getEndInput();i&&(i.value=this.startDisplay),r&&(r.value=this.endDisplay)}isIsoAllowed(t){return!(this.min&&t<this.min||this.max&&t>this.max)}commitRange(t,i){if(t&&!this.isIsoAllowed(t)){this.syncDisplayValues();return}if(i&&!this.isIsoAllowed(i)){this.syncDisplayValues();return}let r=t&&i?Re({start:t,end:i}):"";if(r===this.isoValue){this.syncDisplayValues();return}this.value=r,this.changeEvent.emit({value:r,start:t,end:i}),this.syncDisplayValues()}parseField(t){let i=(t??"").trim();if(!i)return"";let r=ke(i,this.resolvedLocale);return r?Ct(r):""}commitFromInputs(){let t=this.parseField(this.getStartInput()?.value??""),i=this.parseField(this.getEndInput()?.value??"");if(!t&&!i){this.commitRange("","");return}if(t&&i){this.commitRange(t,i);return}let r=xt(this.isoValue);this.commitRange(t||r?.start||"",i||r?.end||"")}setOpen(t){this.open=t,queueMicrotask(()=>this.syncPopoverPosition())}ensurePopoverController(){return this.popoverController||(this.popoverController=new pt({getAnchor:()=>this.rootTarget,getFloating:()=>this.popoverTarget,getOpen:()=>this.open,getPlacement:()=>"bottom-start",gap:4,portal:!1})),this.popoverController}syncPopoverPosition(){let t=this.popoverTarget;if(!t||!this.rootTarget)return;t.hidden=!this.open;let i=this.ensurePopoverController();i.updateConfig({getOpen:()=>this.open}),i.sync()}wireInputNames(){let t=this.getStartInput(),i=this.getEndInput();t&&this.startName&&(t.name=this.startName),i&&this.endName&&(i.name=this.endName)}initialize(){this.wireInputNames(),this.syncDisplayValues(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}onPropsUpdated(){this.wireInputNames(),this.syncDisplayValues()}onOpenUpdated(){this.syncPopoverPosition()}onTriggerPointerDown(){this.suppressPopoverDismiss=!0}onTriggerClick(){this.disabled||this.readOnly||this.setOpen(!this.open)}onStartFocus(){this.editing="start";let t=xt(this.isoValue),i=this.getStartInput();i&&(i.value=t?.start?this.formatIso(t.start):"")}onEndFocus(){this.editing="end";let t=xt(this.isoValue),i=this.getEndInput();i&&(i.value=t?.end?this.formatIso(t.end):"")}onInputBlur(){this.editing=null,this.commitFromInputs()}onInput(t){let i=t.target;if(i.matches("[data-range-start]")){this.startDisplay=i.value;return}this.endDisplay=i.value}onPopoverMouseDown(t){t.preventDefault()}onCalendarChange(t){let i=t.target;if(!(i instanceof HTMLElement)||i.tagName.toLowerCase()!=="rui-calendar")return;let r=t.detail;!r?.start||!r.end||(this.commitRange(r.start,r.end),this.setOpen(!1))}onRootKeydown(t){t.key==="Escape"&&this.open&&(t.preventDefault(),this.setOpen(!1))}onRootFocusOut(t){let i=t.relatedTarget;queueMicrotask(()=>{if(this.suppressPopoverDismiss){this.suppressPopoverDismiss=!1;return}if(!this.open)return;let r=i instanceof Node?i:document.activeElement;Wt(this.rootTarget,this.popoverTarget,r)&&this.setOpen(!1)})}render(){let t={"prop:selectionMode":"range","prop:visibleMonths":this.visibleMonths,"prop:value":this.isoValue,"prop:min":this.min,"prop:max":this.max,"prop:locale":this.locale,"prop:disabled":this.disabled};return bn("div",{class:"rui-date-range-picker","data-ref":"root",children:[bn("div",{class:"rui-date-range-picker__group",children:[bn("div",{class:"rui-date-range-picker__values",children:[oe("input",{type:"text",class:"rui-date-range-picker__input","data-range-start":!0,"data-rui-control":!0,"data-rui-control-type":"text",id:`${this.uid}-start`,autocomplete:"off",disabled:this.$.disabled,readOnly:this.$.readOnly,placeholder:this.placeholderStart||"Start date"}),oe("span",{class:"rui-date-range-picker__separator","aria-hidden":"true",children:"\u2013"}),oe("input",{type:"text",class:"rui-date-range-picker__input","data-range-end":!0,"data-rui-control":!0,"data-rui-control-type":"text",id:`${this.uid}-end`,autocomplete:"off",disabled:this.$.disabled,readOnly:this.$.readOnly,placeholder:this.placeholderEnd||"End date"})]}),oe("button",{type:"button",class:"rui-control-toggle","data-ref":"trigger","data-range-trigger":!0,"aria-label":"Open calendar","aria-haspopup":"dialog","aria-expanded":this.open?"true":"false",disabled:this.$.disabled||this.$.readOnly,children:oe(je,{})})]}),oe("div",{class:"rui-date-range-picker__popover rui-popover rui-floating","data-ref":"popover","data-range-popover":!0,hidden:!this.open,role:"dialog",children:this.open?oe("rui-calendar",{...t}):null})]})}static{Tu()}};import{jsx as LS}from"@ecopages/jsx/jsx-runtime";var PS=rt(ji,({children:e,...t})=>LS("rui-date-range-picker",{...t,children:e}),{stylesheets:["./date-range-picker.css","../shared/control-toggle.css","../../../lib/icons/icons.css","../calendar/calendar.css"]});import{jsx as Fe,jsxs as Lc}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Pc,bound as zS,customElement as KS,event as WS,onEvent as yn,onUpdated as GS,prop as _n,query as xn}from"@ecopages/radiant";var bc="a[href], button, input, select, textarea, [tabindex]";function BS(e){return!e.hasAttribute("disabled")&&e.getAttribute("tabindex")!=="-1"}function vn(e){return Array.from(e.querySelectorAll(bc)).filter(BS)}function Li(e){return Array.from(e.querySelectorAll(bc)).filter(t=>!t.hasAttribute("disabled"))}function vc(e){return vn(e)[0]}var yc,_c,xc,wc,Sc,Ec,Tc,Rc,Ac,Ic,Dc,Cc,kc,Oc,Vc,Mc;function FS(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:jc(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||jc(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:US(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return $S(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function US(e){var t=qS(e,"string");return typeof t=="symbol"?t:t+""}function qS(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jc(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function $S(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Pi,Bc=class extends Pc{static{({e:[xc,wc,Sc,Ec,Tc,Rc,Ac,Ic,Dc,Cc,kc,Oc,Vc,Mc,yc],c:[Pi,_c]}=FS(this,[KS("rui-dialog")],[[_n({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[_n({type:Boolean,reflect:!0,defaultValue:!1}),0,"alert"],[_n({type:String,defaultValue:""}),0,"label"],[xn({ref:"dialog"}),0,"dialogTarget"],[xn({selector:"[data-dialog-title]"}),0,"titleTarget"],[xn({selector:"[data-dialog-body]"}),0,"descriptionTarget"],[WS({name:"rui-close",bubbles:!0,composed:!0}),0,"closeEvent"],[[zS,GS(["open","label"])],2,"syncOpenState"],[yn({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[yn({ref:"backdrop",type:"click"}),2,"onBackdropClick"],[yn({selector:"[data-dialog-close]",type:"click"}),2,"onCloseClick"]],0,void 0,Pc))}open=(yc(this),xc(this));alert=(wc(this),Sc(this));label=(Ec(this),Tc(this));dialogTarget=(Rc(this),Ac(this));titleTarget=(Ic(this),Dc(this));descriptionTarget=(Cc(this),kc(this));closeEvent=(Oc(this),Vc(this));dialogHidden=(Mc(this),this.$.open.map(t=>!t));resolvedRole=this.$.alert.map(t=>t?"alertdialog":"dialog");previouslyFocused=null;titleId=`rui-dialog-title-${Math.random().toString(36).slice(2,9)}`;descriptionId=`rui-dialog-desc-${Math.random().toString(36).slice(2,9)}`;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncOpenState())}syncOpenState(){this.dialogTarget&&(this.titleTarget?.textContent?.trim()?(this.titleTarget.id=this.titleId,this.dialogTarget.setAttribute("aria-labelledby",this.titleId),this.dialogTarget.removeAttribute("aria-label")):this.label&&(this.dialogTarget.setAttribute("aria-label",this.label),this.dialogTarget.removeAttribute("aria-labelledby")),this.descriptionTarget?(this.descriptionTarget.id=this.descriptionId,this.dialogTarget.setAttribute("aria-describedby",this.descriptionId)):this.dialogTarget.removeAttribute("aria-describedby"),this.open?(this.previouslyFocused=document.activeElement,queueMicrotask(()=>this.focusInitial())):(this.previouslyFocused?.focus?.(),this.previouslyFocused=null))}focusInitial(){(this.getFocusable()[0]??this.dialogTarget)?.focus()}getFocusable(){return this.dialogTarget?vn(this.dialogTarget):[]}dismiss(t){this.open&&(this.open=!1,this.closeEvent.emit({reason:t}))}onDocumentKeydown(t){if(!this.open)return;if(t.key==="Escape"){t.preventDefault(),this.dismiss("escape");return}if(t.key!=="Tab")return;let i=this.getFocusable();if(!i.length){t.preventDefault(),this.dialogTarget.focus();return}let r=i[0],c=i[i.length-1],p=document.activeElement;t.shiftKey&&p===r?(t.preventDefault(),c.focus()):!t.shiftKey&&p===c&&(t.preventDefault(),r.focus())}onBackdropClick(){this.dismiss("backdrop")}onCloseClick(){this.dismiss("dismiss")}render(){return Lc("div",{class:"rui-dialog",hidden:this.dialogHidden,children:[Fe("div",{"data-ref":"backdrop",class:"rui-dialog__backdrop"}),Lc("div",{"data-ref":"dialog",class:"rui-dialog__surface",tabindex:-1,role:this.resolvedRole,"aria-modal":"true",children:[Fe("slot",{name:"close"}),Fe("slot",{name:"title"}),Fe("slot",{}),Fe("slot",{name:"actions"})]})]})}static{_c()}};import{jsx as Lt,jsxs as HS}from"@ecopages/jsx/jsx-runtime";function Fc({children:e,slot:t="title",class:i,...r}){return Lt("div",{...r,slot:t,"data-dialog-title":!0,"data-ref":"title",class:K("rui-dialog__title",i),children:e})}function Uc({children:e,class:t,...i}){return Lt("div",{...i,"data-dialog-body":!0,"data-ref":"description",class:K("rui-dialog__body",t),children:e})}function qc({children:e,slot:t="actions",class:i,...r}){return Lt("div",{...r,slot:t,class:K("rui-dialog__actions",i),children:e})}function $c({children:e,slot:t="close",class:i,"aria-label":r="Close",...c}){return Lt("button",{...c,slot:t,type:"button","data-dialog-close":!0,"data-ref":"close",class:K("rui-dialog__close",i),"aria-label":r,children:e??"\xD7"})}var YS=rt(Pi,({title:e,actions:t,children:i,...r})=>e!=null||t!=null?HS("rui-dialog",{...r,children:[Lt($c,{}),e!=null?Lt(Fc,{children:e}):null,i!=null?Lt(Uc,{children:i}):null,t!=null?Lt(qc,{children:t}):null]}):Lt("rui-dialog",{...r,children:i}),{stylesheets:["./dialog.css"]});var Pt="__rui-dialog-host",Bi="rui-dialog-open",Fi="rui-dialog-close",Ui="rui-dialog-toggle",wn="rui-dialog-action";function zc(e){return"id"in e&&e.id!=null&&e.id!==""}var Ue=!1,qi=null,qe=null,dt=null;function En(e){let t=e.trim();if(!t)return null;let i=document.getElementById(t);return i?.localName==="rui-dialog"?i:null}function XS(){let e=document.createElement("button");return e.slot="close",e.type="button",e.setAttribute("data-dialog-close",""),e.setAttribute("data-ref","close"),e.className="rui-dialog__close",e.setAttribute("aria-label","Close"),e.textContent="\xD7",e}function QS(e){let t=document.createElement("div");return t.slot="title",t.setAttribute("data-dialog-title",""),t.setAttribute("data-ref","title"),t.className="rui-dialog__title",t.textContent=e,t}function JS(e){let t=document.createElement("div");t.setAttribute("data-dialog-body",""),t.setAttribute("data-ref","description"),t.className="rui-dialog__body";let i=document.createElement("p");return i.textContent=e,t.append(i),t}function ZS(e){let t=document.createElement("div");t.slot="actions",t.className="rui-dialog__actions";for(let i of e){let r=document.createElement("button");r.type="button",r.className=`rui-button rui-button--${i.variant??"filled"} rui-button--${i.size??"md"}`,r.setAttribute("data-dialog-action",i.value??""),i.closeOnClick===!1&&r.setAttribute("data-dialog-action-close","false"),r.textContent=i.label,t.append(r)}return t}function $e(){qe?.remove(),qe=null}function NS(e){$e();let t=document.createElement("rui-dialog");return t.id=Pt,t.alert=!!e.alert,t.label=e.label??"",t.append(XS()),e.title&&t.append(QS(e.title)),e.body&&t.append(JS(e.body)),e.actions?.length&&t.append(ZS(e.actions)),(qi??document.body).appendChild(t),qe=t,t}function Kc(e){if(!(!dt||dt===e))if(dt===Pt)$e();else{let t=En(dt);t&&(t.open=!1)}}function ve(e){Ht();let t=En(e);t&&(Kc(e),t.open=!0,dt=e)}function tE(e){Ht(),Kc(Pt);let t=NS(e);t.open=!0,dt=Pt}function $i(e){if(typeof e=="string"){ve(e);return}if(zc(e)){ve(e.id);return}tE(e)}function ye(e){Ht();let t=e??dt;if(t){if(t===Pt)$e();else{let i=En(t);i&&(i.open=!1)}dt===t&&(dt=null)}}function Tn(e){if(Ht(),dt===e){ye(e);return}ve(e)}function Wc(e){let t=e.detail;if(typeof t=="string"){$i(t);return}t&&typeof t=="object"&&$i(t)}function Gc(e){let t=e.detail;ye(t?.id)}function Hc(e){let t=e.detail;t?.id&&Tn(t.id)}function Yc(e){let t=e.target;if(!t?.closest)return;let i=t.closest("[data-dialog-action]");if(i&&qe?.contains(i)){e.preventDefault();let h={value:i.getAttribute("data-dialog-action")||void 0||void 0};qe.dispatchEvent(new CustomEvent(wn,{detail:h,bubbles:!0,composed:!0})),i.getAttribute("data-dialog-action-close")!=="false"&&ye(Pt);return}let r=t.closest("[data-dialog-open]");if(r){let p=r.getAttribute("data-dialog-open")?.trim();p&&(e.preventDefault(),ve(p));return}let c=t.closest("[data-dialog-close]");if(c){if(c.closest("rui-dialog")?.hasAttribute("open"))return;e.preventDefault(),ye()}}function Xc(e){let t=e.target?.closest?.("rui-dialog");if(!t)return;let i=t.id||null;i&&dt===i&&(i===Pt&&$e(),dt=null)}function Qc(e={}){return Ue?(e.mount&&(qi=e.mount),Sn):(Ue=!0,qi=e.mount??document.body,document.addEventListener(Bi,Wc),document.addEventListener(Fi,Gc),document.addEventListener(Ui,Hc),document.addEventListener("click",Yc),document.addEventListener("rui-close",Xc),Sn)}function Ht(){Ue||Qc()}function Sn(){Ue&&(document.removeEventListener(Bi,Wc),document.removeEventListener(Fi,Gc),document.removeEventListener(Ui,Hc),document.removeEventListener("click",Yc),document.removeEventListener("rui-close",Xc),$e(),qi=null,dt=null,Ue=!1)}function eE(){return dt}function iE(e){Ht(),$i(e)}function rE(e){Ht(),ye(e)}function nE(e){Ht(),Tn(e)}function oE(e){Ht();let t=e?.trim()||void 0;return{open:r=>{if(t){ve(t);return}if(r!=null){if(typeof r=="string"){ve(r);return}$i(r)}},close:r=>{ye(r??t)},toggle:r=>{let c=r??t;c&&Tn(c)},get openId(){return dt}}}import{jsx as ad,jsxs as cE}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as sd,bound as dE,customElement as hE,onEvent as pE,onUpdated as fE,prop as Rn}from"@ecopages/radiant";var Jc,Zc,Nc,td,ed,id,rd,nd;function aE(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:od(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||od(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:sE(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return uE(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function sE(e){var t=lE(e,"string");return typeof t=="symbol"?t:t+""}function lE(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function od(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function uE(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var _e,ld=class extends sd{static{({e:[Nc,td,ed,id,rd,nd,Jc],c:[_e,Zc]}=aE(this,[hE("rui-disclosure")],[[Rn({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[Rn({type:String,reflect:!0,defaultValue:""}),0,"value"],[Rn({type:Boolean,reflect:!0,defaultValue:!1}),0,"animated"],[pE({selector:"[data-disclosure-trigger]",type:"click"}),2,"onTriggerClick"],[[dE,fE(["open","animated"])],2,"syncExpanded"]],0,void 0,sd))}open=(Jc(this),Nc(this));value=(td(this),ed(this));animated=(id(this),rd(this));panelId=(nd(this),`rui-disclosure-${Math.random().toString(36).slice(2,9)}`);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncAnimated(),this.syncExpanded()})}syncAnimated(){this.toggleAttribute("data-animated",this.animated)}onTriggerClick(t){t.preventDefault(),this.toggle()}toggle(){let t=!this.open;this.open=t,this.dispatchEvent(new CustomEvent("rui-disclosure-toggle",{bubbles:!0,composed:!0,detail:{value:this.value,open:t}}))}syncExpanded(){this.syncAnimated();let t=this.querySelector("[data-disclosure-trigger]"),i=this.querySelector("[data-disclosure-panel]");if(!(!t||!i)){if(t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",this.panelId),i.id=this.panelId,i.dataset.state=this.open?"open":"closed",this.animated){i.hidden=!1,i.setAttribute("aria-hidden",String(!this.open));return}i.hidden=!this.open,i.removeAttribute("aria-hidden")}}render(){return cE("div",{class:"rui-disclosure",children:[ad("slot",{name:"trigger"}),ad("slot",{})]})}static{Zc()}};import{jsx as gd}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as bd,customElement as yE,onEvent as vd,onUpdated as _E,prop as yd}from"@ecopages/radiant";var ud,cd,dd,hd,pd,fd;function mE(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:md(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||md(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:gE(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return vE(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function gE(e){var t=bE(e,"string");return typeof t=="symbol"?t:t+""}function bE(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function md(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function vE(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var zi,_d=class extends bd{static{({e:[dd,hd,pd,fd,ud],c:[zi,cd]}=mE(this,[yE("rui-disclosure-group")],[[yd({type:Boolean,reflect:!0,defaultValue:!1}),0,"multiple"],[yd({type:Boolean,reflect:!0,attribute:"animated",defaultValue:!1}),0,"animated"],[_E("animated"),2,"onAnimatedUpdated"],[vd({selector:"rui-disclosure",type:"rui-disclosure-toggle"}),2,"onDisclosureToggle"],[vd({selector:"[data-disclosure-trigger]",type:"keydown"}),2,"onTriggerKeydown"]],0,void 0,bd))}constructor(...t){super(...t),fd(this)}multiple=(ud(this),dd(this));animated=(hd(this),pd(this));connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncChildrenAnimated(),this.syncTriggers()})}getTriggers(){return Array.from(this.querySelectorAll("[data-disclosure-trigger]"))}getDisclosureForTrigger(t){return t.closest("rui-disclosure")}syncTriggers(){let t=this.getTriggers();if(!t.length)return;let i=Math.max(0,t.findIndex(r=>r.tabIndex===0||r===document.activeElement));lt(t,i)}syncChildrenAnimated(){for(let t of this.querySelectorAll("rui-disclosure"))t.animated=this.animated}onAnimatedUpdated(){this.syncChildrenAnimated()}onDisclosureToggle(t){if(this.multiple||!t.detail?.open)return;let r=t.target;if(r instanceof _e)for(let c of this.querySelectorAll("rui-disclosure"))c!==r&&(c.open=!1)}onTriggerKeydown(t){let i=this.getTriggers(),r=t.target.closest("[data-disclosure-trigger]");if(!r)return;if(t.key==="ArrowLeft"||t.key==="ArrowRight"){let p=this.getDisclosureForTrigger(r);if(!p)return;let h=t.key==="ArrowRight";if(p.open===h){t.preventDefault();return}if(t.preventDefault(),p.open=h,h&&!this.multiple)for(let a of this.querySelectorAll("rui-disclosure"))a!==p&&(a.open=!1);return}st({items:i,current:r,key:t.key,orientation:"vertical",wrap:!0}).handled&&t.preventDefault()}render(){return gd("div",{class:"rui-disclosure-group","data-ref":"root",children:gd("slot",{})})}static{cd()}};import{jsx as Bt,jsxs as xd}from"@ecopages/jsx/jsx-runtime";function wd({variant:e="chevron",class:t,...i}){return Bt("span",{...i,class:K("rui-disclosure__icon",`rui-disclosure__icon--${e}`,t),"data-disclosure-icon":!0,"aria-hidden":"true"})}function Sd({children:e,slot:t="trigger",class:i,disabled:r,icon:c,iconPosition:p="start",...h}){let E=c!==null?c??Bt(wd,{}):null;return xd("button",{...h,slot:t,type:"button","data-disclosure-trigger":!0,class:K("rui-disclosure__trigger",p==="end"&&"rui-disclosure__trigger--icon-end",i),disabled:r,children:[p==="start"?E:null,Bt("span",{class:"rui-disclosure__label",children:e}),p==="end"?E:null]})}function Ed({children:e,class:t,...i}){return Bt("div",{...i,"data-disclosure-panel":!0,"data-ref":"panel",class:K("rui-disclosure__panel",t),children:Bt("div",{class:"rui-disclosure__panel-inner",children:e})})}var xE=rt(_e,({trigger:e,children:t,...i})=>e!=null?xd("rui-disclosure",{...i,children:[Bt(Sd,{children:e}),t!=null?Bt(Ed,{children:t}):null]}):Bt("rui-disclosure",{...i,children:t}),{stylesheets:["./disclosure.css"]}),wE=rt(zi,({children:e,...t})=>Bt("rui-disclosure-group",{...t,children:e}),{stylesheets:["./disclosure-group.css"]});import{jsx as Yt}from"@ecopages/jsx/jsx-runtime";function Td({children:e,label:t,class:i,"aria-labelledby":r,"aria-busy":c,...p}){return Yt("div",{...p,role:"feed",class:K("rui-feed",i),"aria-label":t,"aria-labelledby":r,"aria-busy":c,children:e})}function SE({children:e,posinset:t,setsize:i,labelledBy:r,describedBy:c,tabindex:p=0,class:h,...a}){return Yt("article",{...a,class:K("rui-feed__article",h),tabindex:p,"aria-posinset":t,"aria-setsize":i,"aria-labelledby":r,"aria-describedby":c,children:e})}function EE({children:e,class:t,...i}){return Yt("header",{...i,class:K("rui-feed__header",t),children:e})}function TE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__content",t),children:e})}function RE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__actions",t),children:e})}function AE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__byline",t),children:e})}function IE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__byline-body",t),children:e})}function DE({children:e,class:t,...i}){return Yt("div",{...i,class:K("rui-feed__meta",t),children:e})}nt(Td,["./feed.css"],import.meta.url);import{jsx as KE}from"@ecopages/jsx/jsx-runtime";import{jsx as rh}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as nh,customElement as BE,onEvent as Yi,onUpdated as jn,prop as se,registerSsrPreparationCallback as FE}from"@ecopages/radiant";import{consumeContext as UE,onContextUpdate as qE,provideContext as $E}from"@ecopages/radiant/context";var Tt="data-rui-control",An="data-rui-field-managed",Gi="data-rui-field-label",Hi="data-rui-field-description",xe="data-rui-field-error",In="data-default-value",Dn="data-default-values",ze=new Set(["rui-combobox","rui-date-field","rui-date-range-picker","rui-select","rui-tag-group","rui-checkbox","rui-switch","rui-radio-group","rui-slider","rui-number-field","rui-listbox"]),Dd=`[${Tt}], ${Array.from(ze).join(", ")}, input, textarea`,ae={read:e=>{let t=Reflect.get(e,"value");return typeof t=="string"?t:e.getAttribute("value")??""},write:(e,t)=>{let i=t==null?"":String(t);e.setAttribute("value",i),"value"in e&&Reflect.set(e,"value",i)}},Rd={read:e=>{let t=Reflect.get(e,"value");if(typeof t=="number")return t;let i=e.getAttribute("value");return i==null||i===""?"":Number(i)},write:(e,t)=>{let i=t==null?"":String(t);e.setAttribute("value",i),"value"in e&&Reflect.set(e,"value",t)}},Ad={read:e=>e.querySelector('input[type="checkbox"]')?.checked??e.hasAttribute("checked"),write:(e,t)=>{t?e.setAttribute("checked",""):e.removeAttribute("checked")}},Ki=new Map([["rui-checkbox",Ad],["rui-switch",Ad],["rui-combobox",ae],["rui-date-field",ae],["rui-date-range-picker",ae],["rui-select",ae],["rui-radio-group",ae],["rui-listbox",ae],["rui-tag-group",ae],["rui-slider",Rd],["rui-number-field",Rd]]);function Cd(e,t){let i=e,r=new Set,c=a=>{r.has(a)||(r.add(a),t(a))};if(typeof i.getSlotElements=="function")for(let a of i.getSlotElements())c(a);let p=e.querySelector(".rui-field")??e;for(let a of Array.from(p.children))c(a);for(let a of p.querySelectorAll("*"))c(a);for(let a of Array.from(e.children))c(a);let h=e.shadowRoot;if(h)for(let a of Array.from(h.children))c(a)}function Cn(e,t){let i=null;return Cd(e,r=>{if(!(i||!(r instanceof HTMLElement))){if(r.matches(t)){i=r;return}i=r.querySelector(t)}}),i}function CE(e){if(e.length===0)return null;if(e.length===1)return e[0];let t=e.find(h=>ze.has(h.localName)),i=e.find(h=>h.hasAttribute(Tt));if(i)return i;if(t)return t;let r=document.activeElement;if(r instanceof HTMLElement){for(let h of e)if(h===r||h.contains(r))return h}let c=e.filter(h=>h.isConnected&&h.getClientRects().length>0&&!h.closest('[hidden],[aria-hidden="true"]')),p=c.length>0?c:e.filter(h=>h.isConnected);return p[p.length-1]??e[e.length-1]}function kE(e){let t=e.querySelector(".rui-field");return t instanceof HTMLElement?Array.from(t.querySelectorAll(Dd)).filter(i=>e.contains(i)):[]}function Ke(e){let t=CE(kE(e));if(t)return t;let i=null;if(Cd(e,c=>{if(i)return;let p=Id(c);p&&(i=p)}),i)return i;let r=e.querySelector(".rui-field")??e;return Id(r)}function Id(e){return e instanceof HTMLElement?e.matches(`[${Tt}]`)||ze.has(e.localName)||e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?e:e.querySelector(Dd):null}function kn(e){if(e instanceof HTMLInputElement){let i=Wi(e),r=i===e?void 0:Ki.get(i.localName);return r?r.read(i):e.type==="checkbox"?e.checked:e.type==="number"||e.type==="range"?e.value===""?"":Number(e.value):e.value}if(e instanceof HTMLTextAreaElement)return e.value;let t=Wi(e);return Ki.get(t.localName)?.read(t)??t.getAttribute("value")??""}function On(e,t){if(e instanceof HTMLInputElement){let r=Wi(e),c=r===e?void 0:Ki.get(r.localName);if(c){c.write(r,t);return}if(e.type==="checkbox"){e.checked=!!t;let p=e.closest("rui-checkbox, rui-switch");p&&(t?p.setAttribute("checked",""):p.removeAttribute("checked"));return}e.value=t==null?"":String(t);return}if(e instanceof HTMLTextAreaElement){e.value=t==null?"":String(t);return}let i=Wi(e);Ki.get(i.localName)?.write(i,t)}function Wi(e){return e.hasAttribute(Tt)?e.closest(Array.from(ze).join(","))??e:e}function kd(e){return Cn(e,`[${Gi}], label.rui-label`)}function Od(e){return Cn(e,`[${Hi}]`)}function Vd(e){return Vn(e)[0]??null}function Vn(e){let t=e.querySelector(".rui-field");if(t instanceof HTMLElement){let c=Array.from(t.querySelectorAll(`[${xe}]`)),p=c.filter(h=>h.getClientRects().length>0);if(p.length>0)return p;if(c.length>0)return c}let i=Array.from(e.querySelectorAll(`[${xe}]`));if(i.length>0)return i;let r=Cn(e,`[${xe}]`);return r?[r]:[]}function Md(e,t,i){i&&((t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement)&&(t.name=i),e&&e!==t&&ze.has(e.localName)&&e.setAttribute("name",i))}function jd(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e.hasAttribute(Tt))return e;let t=e.querySelector(`[${Tt}]`);if(t)return t;if(e.localName==="rui-combobox")return e.querySelector("[data-combobox-input]")??e;if(e.localName==="rui-date-field")return e.querySelector("[data-date-field-input]")??e;if(e.localName==="rui-date-range-picker")return e.querySelector("[data-range-start]")??e;if(e.localName==="rui-select")return e.querySelector("[data-select-trigger]")??e;if(e.localName==="rui-tag-group")return e.querySelector("[data-tag-list]")??e;if(e.localName==="rui-number-field")return e.querySelector("[data-number-field-input], input")??e;if(e.localName==="rui-slider")return e.querySelector('input[type="range"]')??e;if(e.localName==="rui-checkbox"||e.localName==="rui-switch")return e.querySelector("input")??e;if(e.localName==="rui-radio-group"){let i=e.querySelector('input[type="radio"]:checked'),r=e.querySelector('input[type="radio"]');return i??r??e}return e}import{createContext as OE}from"@ecopages/radiant/context";var we=OE(Symbol.for("rui-form-context"));import{createContext as VE}from"@ecopages/radiant/context";var Mn=VE(Symbol.for("rui-field-context"));var Ld,Pd,Bd,Fd,Ud,qd,$d,zd,Kd,Wd,Gd,Hd,Yd,Xd,Qd,Jd,Zd,Nd,th,eh;function ME(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:ih(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||ih(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:jE(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return PE(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function jE(e){var t=LE(e,"string");return typeof t=="symbol"?t:t+""}function LE(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ih(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function PE(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}function zE(e){if(!e)return;let{validate:t,...i}=e;return i}var Xi,oh=class extends nh{static{({e:[Bd,Fd,Ud,qd,$d,zd,Kd,Wd,Gd,Hd,Yd,Xd,Qd,Jd,Zd,Nd,th,eh,Ld],c:[Xi,Pd]}=ME(this,[BE("rui-field")],[[se({type:String,reflect:!0,defaultValue:""}),0,"name"],[se({type:Object}),0,"rules"],[se({type:Object}),0,"defaultValue"],[se({type:String,attribute:In}),0,"defaultValueData"],[se({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[se({type:String,defaultValue:""}),0,"error"],[se({type:Boolean,reflect:!0,defaultValue:!1}),0,"invalid"],[$E({context:Mn,initialValue:{name:"",controlId:"",descriptionId:"",errorId:"",error:void 0,invalid:!1,required:!1},hydrate:Object,serialize:t=>({...t,rules:zE(t.rules)})}),0,"fieldProvider"],[UE(we),0,"formContextProvider"],[qE({context:we,requestUpdate:!1}),2,"onFormContextChanged"],[jn(["name"]),2,"onNameUpdated"],[jn(["rules","defaultValue","defaultValueData"]),2,"onRulesUpdated"],[jn(["disabled","error","invalid"]),2,"onPresentationUpdated"],[Yi({selector:"[data-rui-control], rui-combobox, rui-date-field, rui-date-range-picker, rui-checkbox, rui-switch, rui-radio-group, rui-slider, rui-number-field, rui-listbox",type:"rui-change"}),2,"onControlChange"],[Yi({selector:"[data-rui-control], input, textarea",type:"input",options:{capture:!0}}),2,"onControlInput"],[Yi({selector:"[data-rui-control], input, textarea",type:"change",options:{capture:!0}}),2,"onControlNativeChange"],[Yi({selector:"[data-rui-control], input, textarea",type:"focusout"}),2,"onControlFocusOut"]],0,void 0,nh))}name=(Ld(this),Bd(this));rules=(Fd(this),Ud(this));defaultValue=(qd(this),$d(this));defaultValueData=(zd(this),Kd(this));disabled=(Wd(this),Gd(this));error=(Hd(this),Yd(this));invalid=(Xd(this),Qd(this));fieldProvider=(Jd(this),Zd(this));formContextProvider=(Nd(this),th(this));uid=(eh(this),Math.random().toString(36).slice(2,9));resolveFieldName(){return(this.name||this.getAttribute("name")||"").trim()}unregister;unregisterPresentation;registeredWithForm=!1;constructor(){super(),FE(this,()=>this.fieldProvider.setContext({rules:this.readFieldRules()}))}connectedCallback(){super.connectedCallback(),this.connectToForm(),queueMicrotask(()=>{this.connectToForm()})}disconnectedCallback(){this.unregister?.(),this.unregister=void 0,this.unregisterPresentation?.(),this.unregisterPresentation=void 0,this.registeredWithForm=!1,super.disconnectedCallback()}get currentFormContext(){return this.formContextProvider?.getContext()}parseJsonAttr(t){if(t)try{return JSON.parse(t)}catch{return}}readFieldRules(){let t=this.rules;return t&&typeof t=="object"&&!Array.isArray(t)&&Object.keys(t).length>0?t:this.fieldProvider.getContext()?.rules}readDefaultValue(){return this.defaultValue!==void 0?this.defaultValue:this.parseJsonAttr(this.defaultValueData??this.getAttribute(In))}isRequired(){return!!this.readFieldRules()?.required}resolveErrorMessage(t){if(this.error)return this.error;let i=this.resolveFieldName();return i?(t??this.currentFormContext)?.fields[i]?.error:void 0}resolveInvalid(t){if(this.invalid||this.error)return!0;let i=this.resolveFieldName();return i?(t??this.currentFormContext)?.fields[i]?.invalid??!1:!1}connectToForm(){let t=this.resolveFieldName(),i=this.currentFormContext,r=i?.actions;if(!i?.ready||!r||!t){this.syncField();return}if(!this.registeredWithForm){this.registeredWithForm=!0,this.unregisterPresentation?.(),this.unregisterPresentation=r.subscribePresentation(c=>this.syncField(c)),this.unregister=r.register({name:t,rules:this.readFieldRules(),getRules:()=>this.readFieldRules(),defaultValue:this.readDefaultValue(),getValue:()=>{let c=Ke(this);return c?kn(c):void 0},setValue:c=>{let p=Ke(this);p&&On(p,c)}});return}r.updateFieldOptions(t,{rules:this.readFieldRules(),defaultValue:this.readDefaultValue()}),this.syncField()}onFormContextChanged(t){if(!this.registeredWithForm){t.ready?this.connectToForm():this.syncField(t);return}this.syncField(t)}onNameUpdated(){this.unregister?.(),this.unregister=void 0,this.unregisterPresentation?.(),this.unregisterPresentation=void 0,this.registeredWithForm=!1,this.connectToForm()}onRulesUpdated(){this.connectToForm()}onPresentationUpdated(){this.syncField()}onControlChange(){let t=this.resolveFieldName();t&&this.currentFormContext?.actions.handleFieldChange(t)}onControlInput(){let t=this.resolveFieldName();t&&this.currentFormContext?.actions.handleFieldChange(t)}onControlNativeChange(){let t=this.resolveFieldName();t&&this.currentFormContext?.actions.handleFieldChange(t)}onControlFocusOut(){let t=this.resolveFieldName();t&&this.currentFormContext?.actions.handleFieldBlur(t)}syncField(t){let i=Ke(this),r=i?jd(i):null,c=r?.id||`rui-field-control-${this.uid}`,p=`rui-field-desc-${this.uid}`,h=`rui-field-error-${this.uid}`,a=this.resolveErrorMessage(t),E=this.resolveInvalid(t),C=this.isRequired(),R=this.resolveFieldName();if(Md(i,r,R),r){r.id||(r.id=c),r.setAttribute(An,""),r.setAttribute("aria-invalid",E?"true":"false"),this.isRequired()?r.setAttribute("aria-required","true"):r.removeAttribute("aria-required");let $=[],L=Od(this);L&&(L.id=p,$.push(p));let W=Vd(this);W&&(W.id=h,a&&$.push(h)),$.length>0?r.setAttribute("aria-describedby",$.join(" ")):r.removeAttribute("aria-describedby"),this.disabled&&(r.setAttribute("aria-disabled","true"),(r instanceof HTMLInputElement||r instanceof HTMLTextAreaElement)&&(r.disabled=!0))}let D=kd(this);D&&r&&(D.htmlFor=r.id);for(let $ of Vn(this))$.textContent=a??"",a?($.hidden=!1,$.removeAttribute("hidden")):$.hidden=!0;let T={name:R,controlId:r?.id??c,descriptionId:p,errorId:h,error:a,invalid:E,required:C},z=this.fieldProvider.getContext();z.name===T.name&&z.controlId===T.controlId&&z.descriptionId===T.descriptionId&&z.errorId===T.errorId&&z.error===T.error&&z.invalid===T.invalid&&z.required===T.required||this.fieldProvider.setContext(T)}render(){return rh("div",{class:"rui-field",children:rh("slot",{})})}static{Pd()}};var WE=rt(Xi,({children:e,rules:t,defaultValue:i,defaultValueData:r,...c})=>KE("rui-field",{...c,"prop:rules":t,"prop:defaultValue":i,"attr:data-default-value":r??(i!==void 0?JSON.stringify(i):void 0),children:e}),{stylesheets:["./field.css"]});import{jsx as GE}from"@ecopages/jsx/jsx-runtime";function HE({children:e,class:t,...i}){return GE("p",{...i,[Hi]:"",class:K("rui-field__description",t),children:e})}import{jsx as YE}from"@ecopages/jsx/jsx-runtime";function XE({class:e,...t}){return YE("p",{...t,[xe]:"",class:K("rui-field__error",e),role:"alert",hidden:!0})}import{jsx as nT}from"@ecopages/jsx/jsx-runtime";import{jsx as Ah}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ih,customElement as eT,event as Dh,onEvent as Pn,onUpdated as Ch,prop as He}from"@ecopages/radiant";import{provideContext as iT}from"@ecopages/radiant/context";function We(e,t){if(!(t===void 0||t===!1))return typeof t=="string"?t:typeof t=="object"&&t!==null&&"message"in t&&typeof t.message=="string"?t.message:e}function Ft(e){return typeof e=="object"&&e!==null&&"value"in e?e.value:e}async function QE(e,t,i,r){if(!i)return;if(i.required&&(t==null||t===""||Array.isArray(t)&&t.length===0||t===!1))return We("This field is required",i.required)??"This field is required";if(typeof t=="number"||typeof t=="string"&&t!==""&&!Number.isNaN(Number(t))){let p=typeof t=="number"?t:Number(t);if(i.min!==void 0&&p<Ft(i.min))return We(`Minimum value is ${Ft(i.min)}`,i.min);if(i.max!==void 0&&p>Ft(i.max))return We(`Maximum value is ${Ft(i.max)}`,i.max)}let c=t==null?"":String(t);if(i.minLength!==void 0&&c.length<Ft(i.minLength))return We(`Minimum length is ${Ft(i.minLength)}`,i.minLength);if(i.maxLength!==void 0&&c.length>Ft(i.maxLength))return We(`Maximum length is ${Ft(i.maxLength)}`,i.maxLength);if(i.pattern!==void 0&&!Ft(i.pattern).test(c)){let h=i.pattern;return typeof h=="object"&&"message"in h&&typeof h.message=="string"?h.message:"Invalid format"}if(i.validate){if(typeof i.validate=="function"){let p=await i.validate(t,r);return p===!0||p===void 0?void 0:p===!1?"Invalid value":String(p)}for(let p of Object.keys(i.validate)){let h=i.validate[p],a=await h(t,r);if(a!==!0&&a!==void 0)return a===!1?"Invalid value":String(a)}}}async function ah(e,t,i){let r=i??Object.keys(t.fields),c={};for(let p of r){let h=t.fields[p]?.rules,a=await QE(p,e[p],h,e);a&&(c[p]={type:"validation",message:a})}return Object.keys(c).length>0?{values:{},errors:c}:{values:e,errors:{}}}function Ln(){return(e,t,i)=>ah(e,t,i.names)}function sh(e){return typeof e=="function"?e:Ln()}var Ge=class{mode;reValidateMode;resolver;fields=new Map;listeners=new Set;revision=0;defaultValues;values;errors={};touched={};dirty={};isSubmitting=!1;isSubmitted=!1;constructor(t={}){this.mode=t.mode??"onSubmit",this.reValidateMode=t.reValidateMode??"onChange",this.resolver=sh(t.resolver),this.defaultValues={...t.defaultValues??{}},this.values={...this.defaultValues,...t.values??{}}}updateOptions(t){t.mode!==void 0&&(this.mode=t.mode),t.reValidateMode!==void 0&&(this.reValidateMode=t.reValidateMode),t.resolver!==void 0&&(this.resolver=sh(t.resolver)),t.defaultValues!==void 0&&(this.defaultValues={...t.defaultValues})}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}notify(){this.revision+=1;for(let t of this.listeners)t()}getRevision(){return this.revision}getRegisteredFieldNames(){return Array.from(this.fields.keys())}register(t){let i=this.fields.get(t.name),r={...t,rules:t.rules??i?.rules,defaultValue:t.defaultValue??i?.defaultValue,getRules:t.getRules??i?.getRules};return this.fields.set(t.name,r),this.values[t.name]===void 0&&r.defaultValue!==void 0&&(this.values={...this.values,[t.name]:r.defaultValue}),r.setValue(this.values[t.name]),()=>{this.fields.get(t.name)===r&&(this.fields.delete(t.name),this.notify())}}updateFieldOptions(t,i){let r=this.fields.get(t);r&&(i.rules!==void 0&&(r.rules=i.rules),i.defaultValue!==void 0&&(r.defaultValue=i.defaultValue))}getValues(){let t={...this.values};for(let[i,r]of this.fields)t[i]=r.getValue();return t}setValue(t,i,r){this.values={...this.values,[t]:i},this.fields.get(String(t))?.setValue(i),r?.shouldDirty&&(this.dirty={...this.dirty,[t]:!0}),r?.shouldTouch&&(this.touched={...this.touched,[t]:!0}),this.notify()}markTouched(t){this.touched={...this.touched,[t]:!0},this.notify()}markDirty(t){this.dirty={...this.dirty,[t]:!0},this.notify()}clearErrors(t){if(t){let i={...this.errors};delete i[t],this.errors=i,this.notify();return}this.errors={},this.notify()}getFieldError(t){return this.errors[t]?.message}getState(){let t=this.getValues(),i=Object.keys(this.errors).length;return{values:t,errors:this.errors,touched:this.touched,dirty:this.dirty,isSubmitting:this.isSubmitting,isSubmitted:this.isSubmitted,isValid:i===0}}async validateField(t){let i=this.getValues(),c=(await this.resolver(i,{fields:this.buildResolverFields()},{names:[t]})).errors[t]?.message,p={...this.errors};return c?p[t]={type:"validation",message:c}:delete p[t],this.errors=p,this.notify(),!c}async validateAll(){let t=this.getValues(),i=await this.resolver(t,{fields:this.buildResolverFields()},{});return this.errors=i.errors,this.notify(),Object.keys(this.errors).length===0}shouldValidate(t,i){switch(this.isSubmitted?this.reValidateMode:this.mode){case"all":return!0;case"onChange":return i==="change";case"onBlur":return i==="blur";case"onTouched":return i==="blur"&&!!this.touched[t];case"onSubmit":return!1;default:return!1}}async handleFieldChange(t){let i=this.fields.get(t);if(!i)return;let r=i.getValue();this.values={...this.values,[t]:r},this.dirty={...this.dirty,[t]:!0},this.shouldValidate(t,"change")?await this.validateField(t):this.notify()}async handleFieldBlur(t){this.markTouched(t),this.shouldValidate(t,"blur")?await this.validateField(t):this.notify()}shouldDisplayFieldError(t){if(!this.errors[t]?.message)return!1;if(this.isSubmitted)return!0;switch(this.mode){case"all":return!!(this.dirty[t]||this.touched[t]);case"onChange":return!!this.dirty[t];case"onBlur":case"onTouched":return!!this.touched[t];default:return!1}}async handleSubmit(t,i){this.isSubmitting=!0,this.isSubmitted=!0;for(let c of this.fields.keys())this.touched={...this.touched,[c]:!0};this.notify();let r=await this.validateAll();if(this.isSubmitting=!1,this.notify(),r){await t(this.getValues());return}i?.(this.errors)}reset(t){let i=t??{...this.defaultValues,...this.collectFieldDefaults()};this.values={...i},this.errors={},this.touched={},this.dirty={},this.isSubmitted=!1,this.isSubmitting=!1;for(let r of this.fields.values())r.setValue(this.values[r.name]);this.notify()}collectFieldDefaults(){let t={};for(let[i,r]of this.fields)r.defaultValue!==void 0&&(t[i]=r.defaultValue);return t}buildResolverFields(){let t={};for(let[i,r]of this.fields){let c=r.getRules?.()??r.rules;t[i]={rules:c}}return t}};var lh,uh,ch,dh,hh,ph,fh,mh,gh,bh,vh,yh,_h,xh,wh,Sh,Eh,Th;function JE(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Rh(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Rh(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:ZE(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return tT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function ZE(e){var t=NE(e,"string");return typeof t=="symbol"?t:t+""}function NE(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rh(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function tT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var kh=()=>{},rT={register:()=>kh,updateFieldOptions:()=>{},handleFieldChange:()=>{},handleFieldBlur:()=>{},subscribePresentation:()=>kh},Qi,Oh=class extends Ih{static{({e:[ch,dh,hh,ph,fh,mh,gh,bh,vh,yh,_h,xh,wh,Sh,Eh,Th,lh],c:[Qi,uh]}=JE(this,[eT("rui-form")],[[iT({context:we,initialValue:{ready:!1,revision:0,fields:{},actions:rT}}),0,"formProvider"],[Dh({name:"rui-submit",bubbles:!0,composed:!0}),0,"submitEvent"],[Dh({name:"rui-invalid",bubbles:!0,composed:!0}),0,"invalidEvent"],[He({type:Object,defaultValue:{}}),0,"defaultValues"],[He({type:String,attribute:Dn}),0,"defaultValuesData"],[He({type:Object}),0,"resolver"],[He({type:String,reflect:!0,defaultValue:"onSubmit"}),0,"mode"],[He({type:String,reflect:!0,attribute:"revalidate-mode",defaultValue:"onChange"}),0,"reValidateMode"],[Ch(["defaultValues","defaultValuesData","mode","reValidateMode"]),2,"syncOptions"],[Ch(["resolver"]),2,"syncResolver"],[Pn({selector:"button[type=submit]",type:"click"}),2,"onSubmitButtonClick"],[Pn({ref:"form",type:"submit"}),2,"onNativeSubmit"],[Pn({ref:"form",type:"reset"}),2,"onNativeReset"]],0,void 0,Ih))}formProvider=(lh(this),ch(this));submitEvent=(dh(this),hh(this));invalidEvent=(ph(this),fh(this));defaultValues=(mh(this),gh(this));defaultValuesData=(bh(this),vh(this));resolver=(yh(this),_h(this));mode=(xh(this),wh(this));reValidateMode=(Sh(this),Eh(this));store=void Th(this);unsubscribeStore;nativeFormId=`rui-form-native-${Math.random().toString(36).slice(2,9)}`;lastPublishedRevision=-1;lastPublishedContext;presentationListeners=new Set;formActions={register:t=>{let r=this.ensureStore().register(t);return this.publishFormContext({force:!0}),()=>{r(),this.publishFormContext({force:!0})}},updateFieldOptions:(t,i)=>{this.ensureStore().updateFieldOptions(t,i)},handleFieldChange:t=>{this.ensureStore().handleFieldChange(t).then(()=>this.publishFormContext({force:!0}))},handleFieldBlur:t=>{this.ensureStore().handleFieldBlur(t).then(()=>this.publishFormContext({force:!0}))},subscribePresentation:t=>(this.presentationListeners.add(t),this.lastPublishedContext&&t(this.lastPublishedContext),()=>this.presentationListeners.delete(t))};connectedCallback(){super.connectedCallback(),this.ensureStore(),this.publishFormContext({force:!0}),queueMicrotask(()=>this.wireOrphanSubmitButtons())}queryNativeForm(){return this.getRef("form")??this.querySelector("form.rui-form")}wireOrphanSubmitButtons(){let t=this.queryNativeForm();if(t){t.id||(t.id=this.nativeFormId);for(let i of this.querySelectorAll("button[type=submit]"))t.contains(i)||i.setAttribute("form",t.id)}}runFormSubmit(){this.ensureStore().handleSubmit(i=>{this.submitEvent.emit({values:i})},i=>{this.invalidEvent.emit({errors:i})})}disconnectedCallback(){this.unsubscribeStore?.(),this.unsubscribeStore=void 0,super.disconnectedCallback()}resolveMode(){let t=this.getAttribute("mode");return t||(this.mode??"onSubmit")}resolveReValidateMode(){let t=this.getAttribute("revalidate-mode");return t||(this.reValidateMode??"onChange")}resolveDefaultValues(){if(this.defaultValues&&Object.keys(this.defaultValues).length>0)return this.defaultValues;let t=this.defaultValuesData??this.getAttribute(Dn);if(!t)return this.defaultValues??{};try{let i=JSON.parse(t);return i&&typeof i=="object"&&!Array.isArray(i)?i:{}}catch{return this.defaultValues??{}}}ensureStore(){return this.store?this.store:(this.store=new Ge({defaultValues:this.resolveDefaultValues(),resolver:typeof this.resolver=="function"?this.resolver:void 0,mode:this.resolveMode(),reValidateMode:this.resolveReValidateMode()}),this.unsubscribeStore=this.store.subscribe(()=>this.publishFormContext()),this.store)}buildFieldPresentations(t){let i={};for(let r of t.getRegisteredFieldNames()){let c=t.getFieldError(r),p=t.shouldDisplayFieldError(r);i[r]={error:p?c:void 0,invalid:!!(p&&c)}}return i}publishFormContext(t){let i=this.store;if(!i)return;let r=i.getRevision();if(!t?.force&&r===this.lastPublishedRevision)return;this.lastPublishedRevision=r;let c={ready:!0,revision:r,fields:this.buildFieldPresentations(i),actions:this.formActions};this.lastPublishedContext=c,this.formProvider.setContext(c);for(let p of this.presentationListeners)p(c)}syncOptions(){this.ensureStore().updateOptions({defaultValues:this.resolveDefaultValues(),mode:this.resolveMode(),reValidateMode:this.resolveReValidateMode()})}syncResolver(){typeof this.resolver=="function"&&this.ensureStore().updateOptions({resolver:this.resolver})}onSubmitButtonClick(t){t.preventDefault(),this.runFormSubmit()}onNativeSubmit(t){t.preventDefault(),this.runFormSubmit()}onNativeReset(){this.store?.reset()}render(){return Ah("form",{class:"rui-form","data-ref":"form",noValidate:!0,children:Ah("slot",{})})}static{uh()}};var oT=rt(Qi,({children:e,defaultValues:t,defaultValuesData:i,resolver:r,reValidateMode:c,...p})=>nT("rui-form",{...p,reValidateMode:c,"attr:revalidate-mode":c,"prop:defaultValues":t,"prop:resolver":r,"attr:data-default-values":i??(t!==void 0?JSON.stringify(t):void 0),children:e}),{stylesheets:["./form.css"]});import{jsx as Bh}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Fh,customElement as cT,onEvent as dT,prop as hT}from"@ecopages/radiant";var Vh,Mh,jh,Lh;function aT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Ph(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Ph(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:sT(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return uT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function sT(e){var t=lT(e,"string");return typeof t=="symbol"?t:t+""}function lT(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ph(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function uT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ji,Uh=class extends Fh{static{({e:[jh,Lh,Vh],c:[Ji,Mh]}=aT(this,[cT("rui-grid")],[[hT({type:String,defaultValue:""}),0,"label"],[dT({selector:'[role="gridcell"]',type:"keydown"}),2,"onKeydown"]],0,void 0,Fh))}label=(Vh(this),jh(this));resolvedAriaLabel=(Lh(this),this.$.label.map(t=>t||void 0));connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{let t=Array.from(this.querySelectorAll('[role="gridcell"]'));lt(t,0)})}getRows(){return Array.from(this.querySelectorAll('[role="row"]'))}onKeydown(t){let i=this.getRows(),r=t.target.closest('[role="gridcell"]');if(!r)return;let c=r.parentElement,p=i.indexOf(c),h=Array.from(c.querySelectorAll('[role="gridcell"]')),a=h.indexOf(r),E=p,C=a;switch(t.key){case"ArrowRight":C=Math.min(h.length-1,a+1);break;case"ArrowLeft":C=Math.max(0,a-1);break;case"ArrowDown":E=Math.min(i.length-1,p+1);break;case"ArrowUp":E=Math.max(0,p-1);break;case"Home":C=0;break;case"End":C=h.length-1;break;default:return}t.preventDefault();let R=i[E],D=Array.from(R.querySelectorAll('[role="gridcell"]')),T=D[Math.min(C,D.length-1)],z=Array.from(this.querySelectorAll('[role="gridcell"]'));lt(z,z.indexOf(T)),T.focus()}render(){return Bh("div",{class:"rui-grid",role:"grid","aria-label":this.resolvedAriaLabel,children:Bh("slot",{})})}static{Mh()}};import{jsx as Bn}from"@ecopages/jsx/jsx-runtime";var pT=rt(Ji,({rows:e,...t})=>Bn("rui-grid",{...t,children:e.map(i=>Bn("div",{class:"rui-grid__row",role:"row",children:i.map(r=>Bn("div",{class:"rui-grid__cell",role:"gridcell",tabindex:-1,children:r}))}))}),{stylesheets:["./grid.css"]});import{jsx as tr}from"@ecopages/jsx/jsx-runtime";import{jsx as fT}from"@ecopages/jsx/jsx-runtime";function Zi({as:e,children:t,...i}){return fT(e??"div",{...i,children:t})}import{jsx as mT}from"@ecopages/jsx/jsx-runtime";function Ni({children:e,as:t="h2",size:i="md",class:r,...c}){return mT(Zi,{as:t,...c,class:K("rui-headline",i!==!1&&`rui-headline--size-${i}`,r),children:e})}nt(Ni,["./headline.css"],import.meta.url);function gT(e,t,i){return K("rui-heading",`rui-heading--align-${e}`,`rui-heading--size-${t}`,i)}function qh({children:e,as:t="div",align:i="start",size:r="md",class:c,...p}){return tr(Zi,{as:t,...p,class:gT(i,r,c),children:e})}function bT({children:e,class:t,...i}){return tr("p",{...i,class:K("rui-heading__eyebrow",t),children:e})}function vT({children:e,as:t="h2",class:i,...r}){return tr(Ni,{as:t,size:!1,class:K("rui-heading__title",i),...r,children:e})}function yT({children:e,class:t,...i}){return tr("p",{...i,class:K("rui-heading__description",t),children:e})}nt(qh,["./heading.css","../headline/headline.css"],import.meta.url);import{jsx as _T}from"@ecopages/jsx/jsx-runtime";function $h(e){let{size:t="md",class:i,type:r="text",mask:c,placeholder:p,"on:input":h,...a}=e,E=c?on(c):p;return _T("input",{...a,type:r,placeholder:E,...c?{"on:input":R=>{if(c){let D=R.target;D.value=De(D.value,c)}h?.(R)}}:h?{"on:input":h}:{},inputmode:c?"numeric":void 0,[Tt]:"","data-rui-control-type":"text",class:K("rui-input",`rui-input--${t}`,i)})}nt($h,["./input.css"],import.meta.url);import{jsx as xT}from"@ecopages/jsx/jsx-runtime";function zh({children:e,htmlFor:t,class:i,...r}){return xT("label",{...r,[Gi]:"",class:K("rui-label",i),htmlFor:t,children:e})}nt(zh,["./label.css"],import.meta.url);import{jsx as er,jsxs as op}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as ap,bound as RT,customElement as AT,event as sp,onEvent as Ye,onUpdated as IT,prop as lp,query as up}from"@ecopages/radiant";var Kh,Wh,Gh,Hh,Yh,Xh,Qh,Jh,Zh,Nh,tp,ep,ip,rp;function wT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:np(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||np(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:ST(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return TT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function ST(e){var t=ET(e,"string");return typeof t=="symbol"?t:t+""}function ET(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function np(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function TT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var DT=6,ir,cp=class extends ap{static{({e:[Gh,Hh,Yh,Xh,Qh,Jh,Zh,Nh,tp,ep,ip,rp,Kh],c:[ir,Wh]}=wT(this,[AT("rui-menu-button")],[[lp({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[lp({type:String,defaultValue:"bottom-start"}),0,"placement"],[up({ref:"trigger"}),0,"triggerTarget"],[up({ref:"menu"}),0,"menuTarget"],[sp({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[sp({name:"rui-close",bubbles:!0,composed:!0}),0,"closeEvent"],[[RT,IT(["open","placement"])],2,"syncOpenState"],[Ye({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"],[Ye({ref:"trigger",type:"click"}),2,"onTriggerClick"],[Ye({ref:"trigger",type:"keydown"}),2,"onTriggerKeydown"],[Ye({ref:"menu",type:"keydown"}),2,"onMenuKeydown"],[Ye({selector:'[role="menuitem"]',type:"click"}),2,"onItemClick"]],0,void 0,ap))}open=(Kh(this),Gh(this));placement=(Hh(this),Yh(this));triggerTarget=(Xh(this),Qh(this));menuTarget=(Jh(this),Zh(this));changeEvent=(Nh(this),tp(this));closeEvent=(ep(this),ip(this));menuId=(rp(this),`rui-menu-${Math.random().toString(36).slice(2,9)}`);popoverController=null;pendingFocus=null;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncOpenState())}disconnectedCallback(){this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}getItems(){return Array.from(this.menuTarget?.querySelectorAll('[role="menuitem"]')??[]).filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}ensurePopoverController(){return this.popoverController||(this.popoverController=new pt({getAnchor:()=>this.triggerTarget,getFloating:()=>this.menuTarget,getOpen:()=>this.open,getPlacement:()=>this.placement,gap:DT,portal:!1})),this.popoverController}syncOpenState(){if(!this.triggerTarget||!this.menuTarget)return;this.menuTarget.id=this.menuId,this.triggerTarget.setAttribute("aria-controls",this.menuId),this.triggerTarget.setAttribute("aria-haspopup","menu"),this.triggerTarget.setAttribute("aria-expanded",String(this.open)),this.menuTarget.hidden=!this.open;let t=this.ensurePopoverController();t.updateConfig({getPlacement:()=>this.placement,getOpen:()=>this.open}),t.sync();let i=this.pendingFocus;if(this.pendingFocus=null,!!i){if(i==="first"&&this.getItems()[0]?.focus(),i==="last"){let r=this.getItems();r[r.length-1]?.focus()}i==="trigger"&&this.triggerTarget?.focus()}}setOpen(t,i=null){let r=this.open;this.pendingFocus=i,this.open=t,r&&!t&&this.closeEvent.emit(),r===t&&this.syncOpenState()}onDocumentPointerDown(t){if(!this.open)return;let i=t.target;Gt(this.triggerTarget,this.menuTarget,i)&&this.setOpen(!1)}onTriggerClick(){this.setOpen(!this.open,this.open?null:"first")}onTriggerKeydown(t){switch(t.key){case"ArrowDown":case"Enter":case" ":t.preventDefault(),this.setOpen(!0,"first");break;case"ArrowUp":t.preventDefault(),this.setOpen(!0,"last");break;default:break}}onMenuKeydown(t){let i=this.getItems(),r=document.activeElement,c=r?i.indexOf(r):-1;switch(t.key){case"ArrowDown":{t.preventDefault(),i[(c+1)%i.length]?.focus();break}case"ArrowUp":{t.preventDefault(),i[(c-1+i.length)%i.length]?.focus();break}case"Home":t.preventDefault(),i[0]?.focus();break;case"End":t.preventDefault(),i[i.length-1]?.focus();break;case"Escape":t.preventDefault(),this.setOpen(!1,"trigger");break;case"Tab":this.setOpen(!1);break;case"Enter":case" ":r&&i.includes(r)&&(t.preventDefault(),this.activateItem(r));break;default:break}}onItemClick(t){let i=t.target.closest('[role="menuitem"]');!i||!this.contains(i)||this.activateItem(i)}activateItem(t){let i=t.getAttribute("data-value")||t.textContent?.trim()||"";this.changeEvent.emit({value:i}),this.setOpen(!1,"trigger")}render(){return op("div",{class:"rui-menu-button",children:[op("button",{type:"button","data-ref":"trigger",class:"rui-button rui-button--primary rui-button--md rui-menu-button__trigger","aria-haspopup":"menu","aria-expanded":"false",children:[er("slot",{name:"trigger"}),er("span",{class:"rui-menu-button__chevron","aria-hidden":"true"})]}),er("div",{"data-ref":"menu",class:"rui-menu-button__menu rui-popover rui-floating",role:"menu",hidden:!0,children:er("slot",{})})]})}static{Wh()}};import{jsx as dp,jsxs as CT}from"@ecopages/jsx/jsx-runtime";var kT=rt(ir,({trigger:e,items:t,...i})=>CT("rui-menu-button",{...i,children:[dp("span",{slot:"trigger",children:e}),t.map(r=>dp("button",{type:"button",class:"rui-menu-button__item",role:"menuitem","data-value":r.value,"aria-disabled":r.disabled?"true":void 0,tabindex:-1,children:r.label}))]}),{stylesheets:["./menu-button.css"]});import{jsx as yp}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as _p,customElement as LT,event as PT,onEvent as Xe,prop as BT}from"@ecopages/radiant";var hp,pp,fp,mp,gp,bp;function OT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:vp(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||vp(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:VT(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return jT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function VT(e){var t=MT(e,"string");return typeof t=="symbol"?t:t+""}function MT(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vp(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function jT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var rr,xp=class extends _p{static{({e:[fp,mp,gp,bp,hp],c:[rr,pp]}=OT(this,[LT("rui-menubar")],[[BT({type:String,defaultValue:""}),0,"label"],[PT({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Xe({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"],[Xe({selector:'[data-ref="menubar"] > [data-ref="menubar-root"] > [role="menuitem"]',type:"keydown"}),2,"onTopKeydown"],[Xe({selector:'[data-ref="menubar"] > [data-ref="menubar-root"] > [role="menuitem"]',type:"click"}),2,"onTopClick"],[Xe({selector:'[role="menu"] > [role="menuitem"]',type:"keydown"}),2,"onMenuKeydown"],[Xe({selector:'[role="menu"] > [role="menuitem"]',type:"click"}),2,"onMenuItemClick"]],0,void 0,_p))}label=(hp(this),fp(this));changeEvent=(mp(this),gp(this));resolvedAriaLabel=(bp(this),this.$.label.map(t=>t||void 0));openRoot=null;popoverController=null;getTopItems(){return Array.from(this.querySelectorAll('[data-ref="menubar"] > [data-ref="menubar-root"] > [role="menuitem"]'))}getMenuFor(t){return t.closest('[data-ref="menubar-root"]')?.querySelector(':scope > [role="menu"]')??null}getMenuItems(t){return Array.from(t.querySelectorAll(':scope > [role="menuitem"]')).filter(i=>i.getAttribute("aria-disabled")!=="true")}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>lt(this.getTopItems(),0))}disconnectedCallback(){this.popoverController?.destroy(),this.popoverController=null,super.disconnectedCallback()}getOpenMenuAnchor(){return this.openRoot?this.openRoot.querySelector(':scope > [role="menuitem"]'):null}getOpenMenuSurface(){return this.openRoot?this.openRoot.querySelector(':scope > [role="menu"]'):null}syncOpenMenuPosition(){let t=this.getOpenMenuAnchor(),i=this.getOpenMenuSurface();!t||!i||(this.popoverController||(this.popoverController=new pt({getAnchor:()=>this.getOpenMenuAnchor(),getFloating:()=>this.getOpenMenuSurface(),getOpen:()=>!!this.openRoot,getPlacement:()=>"bottom-start",gap:6,portal:!1})),this.popoverController.updateConfig({getAnchor:()=>this.getOpenMenuAnchor(),getFloating:()=>this.getOpenMenuSurface(),getOpen:()=>!!this.openRoot}),this.popoverController.sync())}closeOpenMenu(t=!1){if(!this.openRoot)return;let i=this.openRoot.querySelector(':scope > [role="menuitem"]'),r=this.openRoot.querySelector(':scope > [role="menu"]');i&&i.setAttribute("aria-expanded","false"),r&&(r.hidden=!0),this.openRoot=null,this.popoverController?.teardown(),t&&i&&i.focus()}openMenu(t,i="first"){let r=t.closest('[data-ref="menubar-root"]'),c=this.getMenuFor(t);if(!(!r||!c)&&(this.openRoot&&this.openRoot!==r&&this.closeOpenMenu(),t.setAttribute("aria-expanded","true"),c.hidden=!1,this.openRoot=r,this.syncOpenMenuPosition(),i==="first")){let p=this.getMenuItems(c);lt(p,0),p[0]?.focus()}}onDocumentPointerDown(t){this.openRoot&&Gt(this.getOpenMenuAnchor(),this.getOpenMenuSurface(),t.target)&&this.closeOpenMenu()}onTopKeydown(t){let i=this.getTopItems(),r=t.target.closest('[role="menuitem"]');if(!r||!i.includes(r))return;if(t.key==="ArrowDown"||t.key==="Enter"||t.key===" "){this.getMenuFor(r)&&(t.preventDefault(),this.openMenu(r,"first"));return}if(t.key==="Escape"){t.preventDefault(),this.closeOpenMenu(!0);return}let c=st({items:i,current:r,key:t.key,orientation:"horizontal"});c.handled&&(t.preventDefault(),this.openRoot&&(this.getMenuFor(c.item)?this.openMenu(c.item,"first"):this.closeOpenMenu()))}onTopClick(t){let i=t.target.closest('[role="menuitem"]');if(!i||!this.getTopItems().includes(i))return;if(!this.getMenuFor(i)){this.closeOpenMenu();return}i.getAttribute("aria-expanded")==="true"?this.closeOpenMenu():this.openMenu(i,"first")}onMenuKeydown(t){let i=t.target.closest('[role="menu"]'),r=t.target.closest('[role="menuitem"]');if(!i||!r||!this.contains(i))return;let c=this.getMenuItems(i);if(t.key==="Escape"){t.preventDefault(),this.closeOpenMenu(!0);return}if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.activateItem(r);return}if(t.key==="ArrowLeft"||t.key==="ArrowRight"){let h=this.getTopItems(),a=i.parentElement?.querySelector(':scope > [role="menuitem"]');if(!a)return;t.preventDefault();let E=st({items:h,current:a,key:t.key,orientation:"horizontal"});E.handled&&this.getMenuFor(E.item)&&this.openMenu(E.item,"first");return}st({items:c,current:r,key:t.key,orientation:"vertical"}).handled&&t.preventDefault()}onMenuItemClick(t){let i=t.target.closest('[role="menuitem"]');!i||!this.contains(i)||i.parentElement?.getAttribute("role")==="menu"&&this.activateItem(i)}activateItem(t){let i=t.getAttribute("data-value")||t.textContent?.trim()||"";this.changeEvent.emit({value:i}),this.closeOpenMenu(!0)}render(){return yp("div",{class:"rui-menubar","data-ref":"menubar",role:"menubar","aria-label":this.resolvedAriaLabel,children:yp("slot",{})})}static{pp()}};import{jsx as nr,jsxs as FT}from"@ecopages/jsx/jsx-runtime";var UT=rt(rr,({items:e,...t})=>nr("rui-menubar",{...t,children:e.map(i=>FT("div",{class:"rui-menubar__root","data-ref":"menubar-root",children:[nr("button",{type:"button",class:"rui-menubar__item",role:"menuitem",tabindex:-1,"aria-haspopup":i.items?.length?"true":void 0,"aria-expanded":i.items?.length?"false":void 0,children:i.label}),i.items?.length?nr("div",{class:"rui-menubar__menu rui-popover rui-floating",role:"menu",hidden:!0,children:i.items.map(r=>nr("button",{type:"button",class:"rui-menubar__menu-item",role:"menuitem","data-value":r.id,tabindex:-1,children:r.label}))}):null]}))}),{stylesheets:["./menubar.css"]});import{jsx as WT,jsxs as Fn}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as jp,customElement as GT,onUpdated as HT,prop as or,state as YT}from"@ecopages/radiant";var wp,Sp,Ep,Tp,Rp,Ap,Ip,Dp,Cp,kp,Op,Vp;function qT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Mp(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Mp(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:$T(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return KT(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function $T(e){var t=zT(e,"string");return typeof t=="symbol"?t:t+""}function zT(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Mp(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function KT(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var ar,Lp=class extends jp{static{({e:[Ep,Tp,Rp,Ap,Ip,Dp,Cp,kp,Op,Vp,wp],c:[ar,Sp]}=qT(this,[GT("rui-meter")],[[or({type:Number,reflect:!0,defaultValue:0}),0,"value"],[or({type:Number,defaultValue:0}),0,"min"],[or({type:Number,defaultValue:100}),0,"max"],[or({type:String,defaultValue:""}),0,"label"],[YT,0,"percent"],[HT(["value","min","max"]),2,"onRangeUpdated"]],0,void 0,jp))}value=(wp(this),Ep(this));min=(Tp(this),Rp(this));max=(Ap(this),Ip(this));label=(Dp(this),Cp(this));percent=(kp(this),Op(this,0));resolvedAriaLabel=(Vp(this),this.$.label.map(t=>t||void 0));onRangeUpdated(){this.percent=this.max===this.min?0:Math.round((this.value-this.min)/(this.max-this.min)*100)}render(){return Fn("div",{class:"rui-meter",children:[this.label?WT("span",{class:"rui-meter__label",children:this.$.label}):null,Fn("meter",{class:"rui-meter__bar",min:this.$.min,max:this.$.max,value:this.$.value,"aria-label":this.resolvedAriaLabel,children:[this.$.percent,"%"]}),Fn("span",{class:"rui-meter__value","aria-hidden":"true",children:[this.$.percent,"%"]})]})}static{Sp()}};import{jsx as XT}from"@ecopages/jsx/jsx-runtime";var QT=rt(ar,e=>XT("rui-meter",{...e}),{stylesheets:["./meter.css"]});import{jsx as ur}from"@ecopages/jsx/jsx-runtime";import{jsx as sr,jsxs as eR}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as $p,customElement as iR,onEvent as Se,prop as rR}from"@ecopages/radiant";var Pp,Bp,Fp,Up;function JT(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:qp(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||qp(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:ZT(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return tR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function ZT(e){var t=NT(e,"string");return typeof t=="symbol"?t:t+""}function NT(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qp(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function tR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var lr,zp=class extends $p{static{({e:[Fp,Up,Pp],c:[lr,Bp]}=JT(this,[iR("rui-navigation-menu")],[[rR({type:String,defaultValue:""}),0,"label"],[Se({document:!0,type:"click"}),2,"onDocumentClick"],[Se({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[Se({ref:"root",type:"keydown"}),2,"onRootKeydown"],[Se({selector:"[data-navigation-trigger]",type:"click"}),2,"onTriggerClick"],[Se({selector:"[data-navigation-item]",type:"keydown"}),2,"onBarItemKeydown"],[Se({selector:"[data-navigation-panel]",type:"keydown"}),2,"onPanelKeydown"]],0,void 0,$p))}label=(Pp(this),Fp(this));resolvedAriaLabel=(Up(this),this.$.label.map(t=>t||void 0));openValue=null;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncPanels(),this.syncBarRovingTabindex()})}getBarItems(){return Array.from(this.querySelectorAll("[data-navigation-item]"))}syncBarRovingTabindex(){let t=this.getBarItems(),i=Math.max(0,t.findIndex(r=>r.tabIndex===0||r===document.activeElement));lt(t,i)}isBarTrigger(t){return t.hasAttribute("data-navigation-trigger")}getTriggers(){return Array.from(this.querySelectorAll("[data-navigation-trigger]"))}getPanel(t){return this.querySelector(`[data-navigation-panel][data-value="${t}"]`)}getTrigger(t){return this.querySelector(`[data-navigation-trigger][data-value="${t}"]`)}getPanels(){return Array.from(this.querySelectorAll("[data-navigation-panel]"))}getPanelFocusables(t){return Li(t)}focusPanelEntry(t){let i=this.getPanel(t);if(!i){this.getTrigger(t)?.focus();return}let r=this.getPanelFocusables(i);if(r.length>0){r[0].focus();return}i.hasAttribute("tabindex")||(i.tabIndex=-1),i.focus()}syncPanels(){for(let t of this.getPanels()){let i=t.getAttribute("data-value")??"",r=this.openValue===i;t.hidden=!r,t.dataset.state=r?"open":"closed",t.setAttribute("aria-hidden",String(!r));let c=this.getTrigger(i);c&&(c.setAttribute("aria-expanded",String(r)),t.setAttribute("role","region"),t.setAttribute("aria-labelledby",c.id||`${i}-trigger`),c.id||(c.id=`${i}-trigger`))}for(let t of this.getTriggers()){let i=t.getAttribute("data-value")??"",r=this.openValue===i;t.setAttribute("aria-expanded",String(r)),this.getPanel(i)?t.setAttribute("aria-haspopup","true"):t.removeAttribute("aria-haspopup")}}closeMenu(t=!1){let i=this.openValue;i&&(this.openValue=null,this.syncPanels(),t&&this.getTrigger(i)?.focus())}openPanel(t,i=!0){if(this.openValue===t){this.closeMenu(!0);return}this.openValue=t,this.syncPanels(),queueMicrotask(()=>{i?this.focusPanelEntry(t):this.getTrigger(t)?.focus()})}getEventElement(t){let i=t.target;return i instanceof Element?i:i instanceof Text?i.parentElement:null}isWithinOpenPanel(t){if(!this.openValue)return!1;let i=this.getPanel(this.openValue);return i?t.composedPath().some(r=>r instanceof Node&&i.contains(r)):!1}onDocumentClick(t){if(!this.openValue||this.isWithinOpenPanel(t))return;let i=this.getEventElement(t);i&&this.contains(i)||this.closeMenu()}onDocumentKeydown(t){if(t.key!=="Escape"||!this.openValue)return;let i=document.activeElement;i&&!this.contains(i)||(t.preventDefault(),this.closeMenu(!0))}onRootKeydown(t){t.key==="Escape"&&this.openValue&&(t.preventDefault(),this.closeMenu(!0))}onTriggerClick(t){let i=t.target.closest("[data-navigation-trigger]"),r=i?.getAttribute("data-value");!i||!r||(t.preventDefault(),this.openPanel(r))}onBarItemKeydown(t){let i=t.target.closest("[data-navigation-item]");if(!i)return;let r=this.getBarItems(),c=this.isBarTrigger(i),p=i.getAttribute("data-value");if(t.key==="Escape"){this.openValue&&(t.preventDefault(),this.closeMenu(!0));return}if(c&&p&&(t.key==="Enter"||t.key===" ")){t.preventDefault(),this.openPanel(p);return}if(c&&p&&t.key==="ArrowDown"){t.preventDefault(),this.openValue===p?this.focusPanelEntry(p):this.openPanel(p);return}let h=st({items:r,current:i,key:t.key,orientation:"horizontal",wrap:!1});if(!h.handled)return;t.preventDefault();let a=h.item,E=a.getAttribute("data-value"),C=this.isBarTrigger(a);this.openValue&&(C&&E?this.openPanel(E):this.closeMenu(!1))}onPanelKeydown(t){let i=t.target;if(!(i instanceof Element))return;let r=i.closest("[data-navigation-panel]");if(!r||r.hidden)return;let c=r.getAttribute("data-value");if(!c||this.openValue!==c)return;let p=document.activeElement instanceof HTMLElement?document.activeElement:null;if(!p||!r.contains(p))return;if(t.key==="Escape"){t.preventDefault(),this.closeMenu(!0);return}let h=this.getPanelFocusables(r);if(t.key==="ArrowUp"&&p===h[0]){t.preventDefault(),this.getTrigger(c)?.focus();return}!h.length||!st({items:h,current:p,key:t.key,orientation:"vertical",wrap:!1}).handled||t.preventDefault()}render(){return eR("nav",{class:"rui-navigation-menu","data-ref":"root","aria-label":this.resolvedAriaLabel,children:[sr("div",{class:"rui-navigation-menu__bar",children:sr("slot",{name:"triggers"})}),sr("div",{class:"rui-navigation-menu__panels",children:sr("slot",{name:"panels"})})]})}static{Bp()}};var nR=rt(lr,({children:e,...t})=>ur("rui-navigation-menu",{...t,children:e}),{stylesheets:["./navigation-menu.css"]});function oR({children:e,slot:t="triggers",value:i,variant:r="ghost",...c}){return ur(Hr,{...c,slot:t,variant:r,"data-navigation-item":!0,"data-navigation-trigger":!0,"data-value":i,children:e})}function aR({children:e,slot:t="triggers",href:i,class:r,...c}){return ur("a",{...c,slot:t,href:i,"data-navigation-item":!0,class:K("rui-button","rui-button--ghost","rui-button--md",r),children:e})}function sR({children:e,slot:t="panels",value:i,class:r,...c}){return ur("div",{...c,slot:t,class:r,"data-navigation-panel":!0,"data-value":i,children:e})}import{jsx as Xt,jsxs as Cf}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as kf,customElement as pR,event as fR,onEvent as le,onUpdated as mR,prop as ht,state as Of}from"@ecopages/radiant";function Un(e,t){return new Intl.NumberFormat(e,t)}function qn(e,t,i){return Number.isFinite(e)?Un(t,i).format(e):""}function $n(e,t,i){let r=e.trim();if(!r)return null;let p=Un(t,i).formatToParts(1234.5),h=p.find(R=>R.type==="decimal")?.value??".",a=p.find(R=>R.type==="group")?.value??",",E=r.replaceAll(a,"").replace(h,".").replace(/[^\d.-]/g,""),C=Number(E);return Number.isFinite(C)?C:null}function zn(e){if(e)try{let t=JSON.parse(e);return lR(t)?(new Intl.NumberFormat(void 0,t),t):void 0}catch{return}}function lR(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Kn(e,t,i,r){let c=Math.round((e-t)/r)*r+t;return Math.min(i,Math.max(t,c))}var Kp,Wp,Gp,Hp,Yp,Xp,Qp,Jp,Zp,Np,tf,ef,rf,nf,of,af,sf,lf,uf,cf,df,hf,pf,ff,mf,gf,bf,vf,yf,_f,xf,wf,Sf,Ef,Tf,Rf,Af,If;function uR(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Df(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Df(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:cR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return hR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function cR(e){var t=dR(e,"string");return typeof t=="symbol"?t:t+""}function dR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Df(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function hR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var cr,Vf=class extends kf{static{({e:[Gp,Hp,Yp,Xp,Qp,Jp,Zp,Np,tf,ef,rf,nf,of,af,sf,lf,uf,cf,df,hf,pf,ff,mf,gf,bf,vf,yf,_f,xf,wf,Sf,Ef,Tf,Rf,Af,If,Kp],c:[cr,Wp]}=uR(this,[pR("rui-number-field")],[[ht({type:Number,reflect:!0}),0,"value"],[ht({type:Number,attribute:"default-value"}),0,"defaultValue"],[ht({type:Number,attribute:"min-value",defaultValue:Number.NEGATIVE_INFINITY}),0,"minValue"],[ht({type:Number,attribute:"max-value",defaultValue:Number.POSITIVE_INFINITY}),0,"maxValue"],[ht({type:Number,defaultValue:1}),0,"step"],[ht({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[ht({type:Boolean,attribute:"read-only",reflect:!0,defaultValue:!1}),0,"readOnly"],[ht({type:String,defaultValue:""}),0,"label"],[ht({type:String,defaultValue:""}),0,"name"],[ht({type:String,defaultValue:""}),0,"locale"],[ht({type:String,attribute:"format-options",defaultValue:""}),0,"formatOptions"],[ht({type:String,attribute:"commit-behavior",defaultValue:"snap"}),0,"commitBehavior"],[ht({type:String,attribute:"increment-aria-label",defaultValue:""}),0,"incrementAriaLabel"],[ht({type:String,attribute:"decrement-aria-label",defaultValue:""}),0,"decrementAriaLabel"],[ht({type:Boolean,attribute:"wheel-disabled",defaultValue:!1}),0,"wheelDisabled"],[fR({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[Of,0,"decreaseDisabled"],[Of,0,"increaseDisabled"],[mR(["value","defaultValue","minValue","maxValue","step","label","disabled","readOnly","locale","formatOptions","commitBehavior"]),2,"onPropsUpdated"],[le({selector:'[data-number-field-action="decrement"]',type:"click"}),2,"decrement"],[le({selector:'[data-number-field-action="increment"]',type:"click"}),2,"increment"],[le({selector:"[data-number-field-input]",type:"focus"}),2,"onInputFocus"],[le({selector:"[data-number-field-input]",type:"blur"}),2,"onInputBlur"],[le({selector:"[data-number-field-input]",type:"input"}),2,"onInput"],[le({selector:"[data-number-field-input]",type:"keydown"}),2,"onKeydown"],[le({selector:"[data-number-field-input]",type:"wheel"}),2,"onWheel"]],0,void 0,kf))}value=(Kp(this),Gp(this));defaultValue=(Hp(this),Yp(this));minValue=(Xp(this),Qp(this));maxValue=(Jp(this),Zp(this));step=(Np(this),tf(this));disabled=(ef(this),rf(this));readOnly=(nf(this),of(this));label=(af(this),sf(this));name=(lf(this),uf(this));locale=(cf(this),df(this));formatOptions=(hf(this),pf(this));commitBehavior=(ff(this),mf(this));incrementAriaLabel=(gf(this),bf(this));decrementAriaLabel=(vf(this),yf(this));wheelDisabled=(_f(this),xf(this));changeEvent=(wf(this),Sf(this));decreaseDisabled=(Ef(this),Tf(this,!1));increaseDisabled=(Rf(this),Af(this,!1));editing=(If(this),!1);draftValue="";initialized=!1;uid=Math.random().toString(36).slice(2,9);nameAttr=this.$.name.map(t=>t||void 0);get resolvedLocale(){return It(this.locale)}get resolvedFormatOptions(){return zn(this.formatOptions)}get inputId(){return`rui-number-field-input-${this.uid}`}getNumericValue(){return typeof this.value=="number"&&Number.isFinite(this.value)?this.value:typeof this.defaultValue=="number"&&Number.isFinite(this.defaultValue)?this.defaultValue:0}getInput(){return this.querySelector("[data-number-field-input]")}getHiddenInput(){return this.querySelector("[data-number-field-value]")}syncLabel(){let t=this.getInput();Kt(this,t,{controlId:this.inputId,label:this.label,labelId:`rui-number-field-label-${this.uid}`})}syncInput(){let t=this.getInput(),i=this.getHiddenInput();if(!t)return;t.id||(t.id=this.inputId);let r=this.getNumericValue();t.setAttribute("role","spinbutton"),t.setAttribute("inputmode","decimal"),t.toggleAttribute("data-disabled",this.disabled),t.toggleAttribute("data-readonly",this.readOnly),Number.isFinite(this.minValue)?t.setAttribute("aria-valuemin",String(this.minValue)):t.removeAttribute("aria-valuemin"),Number.isFinite(this.maxValue)?t.setAttribute("aria-valuemax",String(this.maxValue)):t.removeAttribute("aria-valuemax"),t.setAttribute("aria-valuenow",String(r)),this.editing||(t.value=qn(r,this.resolvedLocale,this.resolvedFormatOptions)),i&&(i.value=String(r),this.name&&(i.name=this.name),i.disabled=this.disabled)}updateStepperState(){let t=this.getNumericValue();this.decreaseDisabled=this.disabled||this.readOnly||t<=this.minValue,this.increaseDisabled=this.disabled||this.readOnly||t>=this.maxValue,queueMicrotask(()=>this.syncSlottedSteppers())}syncSlottedSteppers(){for(let t of this.querySelectorAll('[data-number-field-action="decrement"]'))t.disabled=this.decreaseDisabled;for(let t of this.querySelectorAll('[data-number-field-action="increment"]'))t.disabled=this.increaseDisabled}commitValue(t,i=!1){let r=t;if((this.commitBehavior==="snap"||i)&&(r=Kn(t,this.minValue,this.maxValue,this.step)),r===this.getNumericValue()){this.editing=!1,this.syncInput(),this.updateStepperState();return}this.value=r,this.changeEvent.emit({value:r}),this.editing=!1,this.syncInput(),this.updateStepperState()}commitDraft(){let t=$n(this.draftValue,this.resolvedLocale,this.resolvedFormatOptions);if(t==null){this.editing=!1,this.syncInput();return}if(this.commitBehavior==="validate"&&(t<this.minValue||t>this.maxValue)){this.editing=!1,this.syncInput();return}this.commitValue(t)}initialize(){this.initialized||(this.initialized=!0,this.value==null&&this.defaultValue!=null&&(this.value=this.defaultValue),this.syncLabel(),this.syncInput(),this.updateStepperState())}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}onPropsUpdated(){this.syncLabel(),this.syncInput(),this.updateStepperState()}decrement(t){t.preventDefault(),!this.decreaseDisabled&&this.commitValue(this.getNumericValue()-this.step,!0)}increment(t){t.preventDefault(),!this.increaseDisabled&&this.commitValue(this.getNumericValue()+this.step,!0)}onInputFocus(t){if(this.disabled||this.readOnly)return;let i=t.target;this.editing=!0,this.draftValue=String(this.getNumericValue()),i.value=this.draftValue,i.select()}onInputBlur(){this.editing&&this.commitDraft()}onInput(t){this.disabled||this.readOnly||(this.editing=!0,this.draftValue=t.target.value)}onKeydown(t){if(!(this.disabled||this.readOnly)){if(t.key==="ArrowUp"){t.preventDefault(),this.increment(t);return}if(t.key==="ArrowDown"){t.preventDefault(),this.decrement(t);return}if(t.key==="Home"&&Number.isFinite(this.minValue)){t.preventDefault(),this.commitValue(this.minValue,!0);return}if(t.key==="End"&&Number.isFinite(this.maxValue)){t.preventDefault(),this.commitValue(this.maxValue,!0);return}t.key==="Enter"&&(t.preventDefault(),this.commitDraft(),this.getInput()?.blur())}}onWheel(t){if(this.wheelDisabled||this.disabled||this.readOnly)return;let i=t.target;document.activeElement===i&&(t.preventDefault(),t.deltaY<0?this.increment(t):t.deltaY>0&&this.decrement(t))}render(){let t=this.incrementAriaLabel||"Increment",i=this.decrementAriaLabel||"Decrement";return Xt("div",{class:"rui-number-field",children:Xt("slot",{name:"group",children:Cf("div",{class:"rui-number-field__group","data-number-field-group":!0,children:[Cf("slot",{name:"input",children:[Xt("input",{type:"text","data-number-field-input":!0,"data-rui-control":!0,"data-rui-control-type":"number",class:"rui-number-field__input",disabled:this.$.disabled,readOnly:this.$.readOnly,name:this.nameAttr}),Xt("input",{type:"hidden","data-number-field-value":!0})]}),Xt("slot",{name:"decrement",children:Xt("button",{type:"button",class:"rui-number-field__stepper","data-number-field-action":"decrement","aria-label":i,disabled:this.$.decreaseDisabled,tabIndex:-1,children:"\u2212"})}),Xt("slot",{name:"increment",children:Xt("button",{type:"button",class:"rui-number-field__stepper","data-number-field-action":"increment","aria-label":t,disabled:this.$.increaseDisabled,tabIndex:-1,children:"+"})})]})})})}static{Wp()}};import{jsx as Qe}from"@ecopages/jsx/jsx-runtime";function gR({children:e,slot:t="group",class:i,...r}){return Qe("div",{...r,slot:t,"data-number-field-group":!0,class:K("rui-number-field__group",i),children:e})}function bR({slot:e="input",class:t,disabled:i,readOnly:r,...c}){return Qe("input",{...c,type:"text",slot:e,"data-number-field-input":!0,"data-rui-control":!0,"data-rui-control-type":"number",class:K("rui-number-field__input",t),disabled:i,readOnly:r})}function vR({children:e,slot:t="increment",class:i,"aria-label":r="Increment",disabled:c,...p}){return Qe("button",{...p,type:"button",slot:t,"data-number-field-action":"increment",class:K("rui-number-field__stepper",i),"aria-label":r,disabled:c,tabIndex:-1,children:e??"+"})}function yR({children:e,slot:t="decrement",class:i,"aria-label":r="Decrement",disabled:c,...p}){return Qe("button",{...p,type:"button",slot:t,"data-number-field-action":"decrement",class:K("rui-number-field__stepper",i),"aria-label":r,disabled:c,tabIndex:-1,children:e??"\u2212"})}var _R=rt(cr,({children:e,...t})=>Qe("rui-number-field",{...t,children:e}),{stylesheets:["./number-field.css"]});import{jsx as Yn,jsxs as mm}from"@ecopages/jsx/jsx-runtime";import{jsx as Je,jsxs as hm}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as dr,bound as Gn,customElement as pm,event as ER,onEvent as Ze,onUpdated as fm,prop as Qt,query as Hn}from"@ecopages/radiant";var Mf,jf,Lf,Pf,Bf,Ff,Uf,qf,$f,zf,Kf,Wf,Gf,Hf,Yf,Xf,Qf,Jf,Zf,Nf,tm,em,im,rm,nm,om,am,sm;function dm(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:lm(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||lm(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:xR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return SR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function xR(e){var t=wR(e,"string");return typeof t=="symbol"?t:t+""}function wR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lm(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function SR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var hr,um=class extends dr{static{({e:[Lf,Pf,Bf,Ff,Uf,qf,$f,zf,Kf,Wf,Gf,Hf,Yf,Xf,Qf,Jf,Zf,Nf,tm,em,Mf],c:[hr,jf]}=dm(this,[pm("rui-popover")],[[Qt({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[Qt({type:String,defaultValue:"bottom"}),0,"placement"],[Qt({type:Boolean,defaultValue:!0}),0,"portal"],[Qt({type:Boolean,defaultValue:!1}),0,"matchAnchorWidth"],[Qt({type:Number,defaultValue:8}),0,"offset"],[Qt({type:String,defaultValue:""}),0,"anchor"],[Qt({type:String,defaultValue:"default"}),0,"variant"],[Hn({ref:"surface"}),0,"surfaceTarget"],[Hn({ref:"host"}),0,"hostTarget"],[ER({name:"rui-open-change",bubbles:!0,composed:!0}),0,"openChangeEvent"],[[Gn,fm(["open","placement","portal","matchAnchorWidth","offset","anchor"])],2,"syncPopover"],[Ze({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"],[Ze({ref:"host",type:"focusout"}),2,"onFocusOut"],[Gn,2,"onExternalAnchorClick"],[Ze({document:!0,type:"keydown"}),2,"onDocumentKeydown"]],0,void 0,dr))}open=(Mf(this),Lf(this));placement=(Pf(this),Bf(this));portal=(Ff(this),Uf(this));matchAnchorWidth=(qf(this),$f(this));offset=(zf(this),Kf(this));anchor=(Wf(this),Gf(this));variant=(Hf(this),Yf(this));surfaceTarget=(Xf(this),Qf(this));hostTarget=(Jf(this),Zf(this));openChangeEvent=(Nf(this),tm(this));surfaceId=(em(this),`rui-popover-${Math.random().toString(36).slice(2,9)}`);controller=null;anchorClickTarget=null;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncPopover())}disconnectedCallback(){this.unbindExternalAnchorClick(),this.controller?.destroy(),this.controller=null,super.disconnectedCallback()}getAnchorElement(){let i=this.closest("rui-popover-trigger")?.querySelector('[slot="trigger"]');if(i instanceof HTMLElement)return Wn(i);let r=this.querySelector('[slot="trigger"]');if(r instanceof HTMLElement)return Wn(r);let c=this.anchor.trim();if(c){let p=document.querySelector(c);if(p instanceof HTMLElement)return Wn(p)}return null}ensureController(){return this.controller||(this.controller=new pt({getAnchor:()=>this.getAnchorElement(),getFloating:()=>this.surfaceTarget,getOpen:()=>this.open,getPlacement:()=>this.placement,gap:this.offset,portal:this.portal,matchAnchorWidth:this.matchAnchorWidth})),this.controller}syncPopover(){let t=this.getAnchorElement(),i=this.surfaceTarget;i&&(i.id=this.surfaceId),t&&(t.setAttribute("aria-controls",this.surfaceId),t.setAttribute("aria-expanded",String(this.open))),this.syncExternalAnchorClick(t);let r=this.ensureController();r.updateConfig({getAnchor:()=>this.getAnchorElement(),getFloating:()=>this.surfaceTarget,getOpen:()=>this.open,getPlacement:()=>this.placement,gap:this.offset,portal:this.portal,matchAnchorWidth:this.matchAnchorWidth}),r.sync()}setOpen(t,i=!0){if(this.open===t){this.syncPopover();return}this.open=t,i&&this.openChangeEvent.emit({open:t}),this.syncPopover()}onDocumentPointerDown(t){if(!this.open)return;let i=t.target;Gt(this.getAnchorElement(),this.controller?.getFloatingElement()??this.surfaceTarget,i)&&this.setOpen(!1)}onFocusOut(t){this.open&&Wt(this.getAnchorElement(),this.controller?.getFloatingElement()??this.surfaceTarget,t.relatedTarget)&&this.setOpen(!1)}usesExternalAnchor(){return!this.anchor.trim()||this.closest("rui-popover-trigger")?!1:!this.querySelector('[slot="trigger"]')}syncExternalAnchorClick(t){if(!this.usesExternalAnchor()||!t){this.unbindExternalAnchorClick();return}this.anchorClickTarget!==t&&(this.unbindExternalAnchorClick(),t.addEventListener("click",this.onExternalAnchorClick),this.anchorClickTarget=t)}unbindExternalAnchorClick(){this.anchorClickTarget&&(this.anchorClickTarget.removeEventListener("click",this.onExternalAnchorClick),this.anchorClickTarget=null)}onExternalAnchorClick(){this.setOpen(!this.open)}onDocumentKeydown(t){if(!this.open||t.key!=="Escape")return;t.preventDefault(),this.setOpen(!1),this.getAnchorElement()?.focus()}render(){let t=this.variant==="listbox"?"rui-popover--listbox":"";return hm("div",{class:"rui-popover-host","data-ref":"host",children:[Je("slot",{name:"trigger"}),Je("div",{"data-ref":"surface",class:`rui-popover rui-floating ${t}`.trim(),role:"dialog",hidden:!0,children:Je("slot",{name:"content"})})]})}static{jf()}};var pr,cm=class extends dr{static{({e:[nm,om,am,sm,im],c:[pr,rm]}=dm(this,[pm("rui-popover-trigger")],[[Qt({type:Boolean,reflect:!0,defaultValue:!1}),0,"open"],[Hn({ref:"root"}),0,"rootTarget"],[[Gn,fm(["open"])],2,"syncToPopover"],[Ze({ref:"root",type:"click"}),2,"onHostClick"],[Ze({selector:"rui-popover",type:"rui-open-change"}),2,"onPopoverOpenChange"]],0,void 0,dr))}constructor(...t){super(...t),sm(this)}open=(im(this),nm(this));rootTarget=(om(this),am(this));getPopover(){return this.querySelector("rui-popover")}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.syncToPopover())}syncToPopover(){let t=this.getPopover();t&&t.open!==this.open&&t.setOpen(this.open,!1)}onHostClick(t){if(!t.target?.closest('[slot="trigger"]'))return;this.open=!this.open,this.getPopover()?.setOpen(this.open)}onPopoverOpenChange(t){let i=this.getPopover();t.target===i&&(this.open=t.detail.open)}render(){return hm("div",{class:"rui-popover-trigger","data-ref":"root",children:[Je("slot",{name:"trigger"}),Je("slot",{})]})}static{rm()}};function Wn(e){return e.querySelector('button, a[href], input, select, textarea, [role="button"]')??e}function TR({children:e,slot:t="content",class:i,...r}){return Yn("div",{...r,slot:t,class:K(i),children:e})}var RR=rt(hr,({trigger:e,children:t,...i})=>mm("rui-popover",{...i,children:[e!=null?Yn("span",{slot:"trigger",children:e}):null,t]}),{stylesheets:["./popover.css"]}),AR=rt(pr,({trigger:e,children:t,...i})=>mm("rui-popover-trigger",{...i,children:[Yn("span",{slot:"trigger",children:e}),t]}),{stylesheets:["./popover.css"]});import{jsx as Dm}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Cm,customElement as OR,event as VR,onEvent as MR,onUpdated as jR,prop as fr}from"@ecopages/radiant";var gm,bm,vm,ym,_m,xm,wm,Sm,Em,Tm,Rm,Am;function IR(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Im(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Im(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:DR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return kR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function DR(e){var t=CR(e,"string");return typeof t=="symbol"?t:t+""}function CR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Im(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function kR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var mr,km=class extends Cm{static{({e:[vm,ym,_m,xm,wm,Sm,Em,Tm,Rm,Am,gm],c:[mr,bm]}=IR(this,[OR("rui-radio-group")],[[fr({type:String,reflect:!0,defaultValue:""}),0,"value"],[fr({type:String,defaultValue:""}),0,"name"],[fr({type:String,defaultValue:""}),0,"label"],[fr({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[VR({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[jR(["value","name","disabled"]),2,"syncRadios"],[MR({selector:'input[type="radio"]',type:"change"}),2,"onRadioChange"]],0,void 0,Cm))}value=(gm(this),vm(this));name=(ym(this),_m(this));label=(xm(this),wm(this));disabled=(Sm(this),Em(this));changeEvent=(Tm(this),Rm(this));resolvedAriaLabel=(Am(this),this.$.label.map(t=>t||void 0));resolvedAriaDisabled=this.$.disabled.map(t=>t?"true":void 0);connectedCallback(){super.connectedCallback(),this.syncRadios()}syncRadios(){let t=this.querySelectorAll('input[type="radio"]'),i=this.name||this.getAttribute("name")||"rui-radio-group";for(let r of t)r.name=i,r.disabled=this.disabled||r.hasAttribute("data-disabled"),r.checked=this.value!==""&&r.value===this.value}onRadioChange(t){let i=t.target;i.checked&&(this.value=i.value,this.changeEvent.emit({value:this.value}))}render(){return Dm("div",{class:"rui-radio-group",role:"radiogroup","data-rui-control":!0,"data-rui-control-type":"text","aria-label":this.resolvedAriaLabel,"aria-disabled":this.resolvedAriaDisabled,children:Dm("slot",{})})}static{bm()}};import{jsx as gr,jsxs as LR}from"@ecopages/jsx/jsx-runtime";var PR=rt(mr,({options:e,...t})=>gr("rui-radio-group",{...t,children:e.map(i=>LR("label",{class:"rui-radio",children:[gr("input",{type:"radio",class:"rui-radio__input",value:i.value,disabled:i.disabled,"data-disabled":i.disabled?"":void 0}),gr("span",{class:"rui-radio__control","aria-hidden":"true"}),gr("span",{class:"rui-radio__label",children:i.label})]}))}),{stylesheets:["./radio-group.css"]});import{jsx as Jm,jsxs as $R}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Zm,customElement as zR,event as KR,onEvent as Rt,onUpdated as WR,prop as Ee,query as GR}from"@ecopages/radiant";function br(e){return e.split(",").map(t=>t.trim()).filter(Boolean)}function Ne(e){return e.join(",")}var Om,Vm,Mm,jm,Lm,Pm,Bm,Fm,Um,qm,$m,zm,Km,Wm,Gm,Hm,Ym,Xm;function BR(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Qm(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Qm(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:FR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return qR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function FR(e){var t=UR(e,"string");return typeof t=="symbol"?t:t+""}function UR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Qm(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function qR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var vr,Nm=class extends Zm{static{({e:[Mm,jm,Lm,Pm,Bm,Fm,Um,qm,$m,zm,Km,Wm,Gm,Hm,Ym,Xm,Om],c:[vr,Vm]}=BR(this,[zR("rui-select")],[[Ee({type:String,reflect:!0,defaultValue:""}),0,"value"],[Ee({type:String,defaultValue:""}),0,"label"],[Ee({type:String,defaultValue:""}),0,"placeholder"],[Ee({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Ee({type:String,attribute:"selection-mode",defaultValue:"single"}),0,"selectionMode"],[Ee({type:Boolean,attribute:"should-close-on-select"}),0,"shouldCloseOnSelect"],[KR({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[GR({ref:"root"}),0,"rootTarget"],[WR(["value","label","placeholder","disabled","selectionMode","shouldCloseOnSelect"]),2,"onPropsUpdated"],[Rt({selector:"[data-select-trigger], [data-select-toggle]",type:"click"}),2,"onTriggerClick"],[Rt({selector:"[data-select-trigger]",type:"keydown",options:{capture:!0}}),2,"onTriggerKeydown"],[Rt({selector:"[data-select-listbox] [data-autocomplete-input]",type:"keydown",options:{capture:!0}}),2,"onSearchKeydown"],[Rt({selector:"[data-select-listbox] [data-autocomplete-input]",type:"input"}),2,"onSearchInput"],[Rt({selector:"[data-select-value] rui-tag-group",type:"rui-remove"}),2,"onTagRemove"],[Rt({selector:"[data-select-value] [data-tag]",type:"click"}),2,"onTagClick"],[Rt({selector:'[data-select-listbox] [role="option"]',type:"pointerover"}),2,"onOptionPointerOver"],[Rt({selector:'[data-select-listbox] [role="option"]',type:"mousedown"}),2,"onOptionMouseDown"],[Rt({selector:'[data-select-listbox] [role="option"]',type:"click"}),2,"onOptionClick"],[Rt({ref:"root",type:"focusout"}),2,"onFocusOut"],[Rt({document:!0,type:"pointerdown"}),2,"onDocumentPointerDown"]],0,void 0,Zm))}constructor(...t){super(...t),Xm(this)}value=(Om(this),Mm(this));label=(jm(this),Lm(this));placeholder=(Pm(this),Bm(this));disabled=(Fm(this),Um(this));selectionMode=(qm(this),$m(this));shouldCloseOnSelect=(zm(this),Km(this));changeEvent=(Wm(this),Gm(this));open=(Hm(this),!1);uid=Math.random().toString(36).slice(2,9);listboxBehavior=new me({getAnchor:()=>this.rootTarget,getFloating:()=>this.getListboxPopup(),getOpen:()=>this.open,getOptions:()=>this.getOptions(),getActiveDescendantHost:()=>this.getActiveDescendantHost(),getOptionIdPrefix:()=>`rui-select-option-${this.uid}`});rootTarget=Ym(this);get listboxId(){return`rui-select-list-${this.uid}`}get triggerId(){return`rui-select-trigger-${this.uid}`}isMultiple(){return this.selectionMode==="multiple"}closesOnSelect(){return this.shouldCloseOnSelect!=null?this.shouldCloseOnSelect:!this.isMultiple()}getSelectedValues(){return this.value?br(this.value):[]}setSelectedValues(t){this.value=Ne(t)}getSearchInput(){return this.querySelector("[data-select-listbox] [data-autocomplete-input]")}hasSearchInput(){return this.getSearchInput()!=null}getActiveDescendantHost(){return this.open&&this.hasSearchInput()?this.getSearchInput():this.getTrigger()}resetSearchFilter(){let t=this.getSearchInput();!t||t.value===""||(t.value="",t.dispatchEvent(new Event("input",{bubbles:!0})))}syncSearchInput(){let t=this.getSearchInput(),i=this.getTrigger(),r=this.getListbox();if(!(!t||!r||!i)){if(this.open){t.setAttribute("role","combobox"),t.setAttribute("aria-autocomplete","list"),t.setAttribute("aria-expanded","true"),t.setAttribute("aria-controls",this.listboxId),i.removeAttribute("aria-activedescendant");return}t.removeAttribute("role"),t.removeAttribute("aria-autocomplete"),t.removeAttribute("aria-expanded"),t.removeAttribute("aria-controls"),t.removeAttribute("aria-activedescendant")}}focusPopupInput(){queueMicrotask(()=>{this.getSearchInput()?.focus()})}getTagGroup(){return this.querySelector("[data-select-value] rui-tag-group")}hasTagGroup(){return this.getTagGroup()!=null}syncTagGroup(){let t=this.getTagGroup(),i=this.getValueElement();if(!t||!i)return;let r=this.getSelectedValues(),c=r.flatMap(p=>{let h=this.getOptions().find(a=>this.getOptionValue(a)===p);return h?[{value:p,label:this.getOptionLabel(h)}]:[]});t.embedded=!0,t.setItems(c),t.value=this.value,this.syncTagGroupPlaceholder(i,r.length)}syncTagGroupPlaceholder(t,i){let r=t.querySelector("[data-select-placeholder]");if(!this.placeholder){r?.remove();return}r||(r=document.createElement("span"),r.setAttribute("data-select-placeholder","true"),t.insertBefore(r,t.firstChild)),r.textContent=this.placeholder,r.hidden=i>0,t.toggleAttribute("data-placeholder",i===0)}removeSelectedValue(t){let i=new Set(this.getSelectedValues());i.has(t)&&(i.delete(t),this.setSelectedValues([...i]),this.syncValueDisplay(),this.syncOptionSelection(),this.syncTagGroup(),this.changeEvent.emit({value:this.value}))}getTrigger(){return this.querySelector("[data-select-trigger]")}getToggle(){return this.querySelector("[data-select-toggle]")}getValueElement(){return this.querySelector("[data-select-value]")}getListboxPopup(){return this.querySelector("[data-select-listbox]")}getListbox(){let t=this.querySelector("rui-listbox");return t?t.querySelector('[role="listbox"]'):this.getListboxPopup()}getListboxHost(){return this.querySelector("rui-listbox")}getOptions(){let t=this.getListbox();return t?Array.from(t.querySelectorAll('[role="option"]')):[]}getOptionLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}getOptionValue(t){return t.getAttribute("data-value")||this.getOptionLabel(t)}ensureOptionIds(){this.listboxBehavior.ensureOptionIds()}getAccessibleName(){return Ve(this)?.textContent?.trim()||this.label||"Options"}syncLabel(){let t=this.getTrigger();Kt(this,t,{controlId:this.triggerId,label:this.label,labelId:`rui-select-label-${this.uid}`})}syncTrigger(){let t=this.getTrigger(),i=this.getListbox(),r=this.getListboxPopup();!t||!i||(t.id||(t.id=this.triggerId),i.id||(i.id=this.listboxId),t.setAttribute("role","combobox"),t.setAttribute("aria-haspopup","listbox"),t.setAttribute("aria-autocomplete","none"),t.setAttribute("aria-expanded",String(this.open)),t.setAttribute("aria-controls",this.listboxId),i.setAttribute("aria-label",this.getAccessibleName()),this.isMultiple()?i.setAttribute("aria-multiselectable","true"):i.removeAttribute("aria-multiselectable"),r&&(r.removeAttribute("role"),r.removeAttribute("aria-label"),r.removeAttribute("aria-multiselectable")),this.disabled&&(t.disabled=!0),this.syncToggle(),this.syncSearchInput())}syncToggle(){let t=this.getToggle();t&&(t.setAttribute("aria-expanded",String(this.open)),t.disabled=this.disabled)}syncListboxHost(){let t=this.getListboxHost();t&&(t.embedded=!0,this.isMultiple()||(t.value=this.value))}syncValueDisplay(){if(this.hasTagGroup()){this.syncTagGroup();return}let t=this.getValueElement();if(!t||t.childElementCount>0)return;let i=this.getSelectedValues();if(i.length===0){t.textContent="",t.setAttribute("data-placeholder","true"),this.placeholder&&(t.textContent=this.placeholder);return}if(t.removeAttribute("data-placeholder"),this.isMultiple()){let c=i.map(p=>{let h=this.getOptions().find(a=>this.getOptionValue(a)===p);return h?this.getOptionLabel(h):p});t.textContent=c.join(", ");return}let r=this.getOptions().find(c=>this.getOptionValue(c)===i[0]);t.textContent=r?this.getOptionLabel(r):i[0]}syncOptionSelection(){let t=new Set(this.getSelectedValues());for(let i of this.getOptions()){let r=this.getOptionValue(i),c=t.has(r);i.setAttribute("aria-selected",String(c))}}setOpen(t,i={}){let r=i.activate??"none";this.open=t;let c=this.getTrigger(),p=this.getListboxPopup();if(!(!c||!p)){if(c.setAttribute("aria-expanded",String(t)),p.hidden=!t,!t){this.listboxBehavior.clearActiveOption(),this.resetSearchFilter(),this.syncSearchInput(),this.listboxBehavior.syncPopoverPosition();return}if(this.ensureOptionIds(),this.syncSearchInput(),this.listboxBehavior.syncPopoverPosition(),this.hasSearchInput()&&this.focusPopupInput(),r==="first"){let h=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(h.length?0:-1);return}if(r==="last"){let h=this.listboxBehavior.getVisibleOptions();this.listboxBehavior.setActiveOption(h.length?h.length-1:-1);return}this.listboxBehavior.clearActiveOption()}}selectOption(t){if(t.getAttribute("aria-disabled")==="true")return;let i=this.getOptionValue(t);if(this.isMultiple()){let r=new Set(this.getSelectedValues());r.has(i)?r.delete(i):r.add(i),this.setSelectedValues([...r])}else this.value=i;this.syncValueDisplay(),this.syncOptionSelection(),this.changeEvent.emit({value:this.value}),this.closesOnSelect()&&(this.resetSearchFilter(),this.setOpen(!1),this.getTrigger()?.focus())}handleListboxKeydown(t){this.listboxBehavior.handleKeydown(t,{isOpen:this.open,canUseSpace:!this.hasSearchInput(),closesOnTab:this.closesOnSelect(),enterWhenClosed:"open",enterWithoutActive:"ignore",onOpen:(i="none")=>this.setOpen(!0,{activate:i}),onClose:i=>{this.setOpen(!1),(i==="arrow"||i==="escape")&&this.getTrigger()?.focus()},onSelectActive:()=>{let i=this.listboxBehavior.getVisibleOptions()[this.listboxBehavior.activeOptionIndex];i&&this.selectOption(i)}})}handleTriggerKeydown(t){this.handleListboxKeydown(t)}initialize(){this.ensureOptionIds(),this.syncLabel(),this.syncTrigger(),this.syncListboxHost(),this.syncValueDisplay(),this.syncOptionSelection(),this.setOpen(!1)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}disconnectedCallback(){this.listboxBehavior.destroy(),super.disconnectedCallback()}onPropsUpdated(){this.syncLabel(),this.syncTrigger(),this.syncListboxHost(),this.syncValueDisplay(),this.syncOptionSelection()}onTriggerClick(t){t.preventDefault();let i=this.getTrigger();if(!(!i||i.disabled)){if(this.open?this.setOpen(!1):this.setOpen(!0),this.open&&this.hasSearchInput()){this.focusPopupInput();return}i.focus()}}onTriggerKeydown(t){this.handleTriggerKeydown(t)}onSearchKeydown(t){this.handleListboxKeydown(t)}onSearchInput(){this.open&&this.listboxBehavior.clearActiveOption()}onTagRemove(t){let i=t.detail;i?.value&&this.removeSelectedValue(i.value)}onTagClick(t){t.target.closest("[data-tag-remove]")||t.stopPropagation()}onOptionPointerOver(t){if(!this.open)return;let i=t.target.closest('[role="option"]');if(!i||i.getAttribute("aria-disabled")==="true"||i.hidden)return;let c=this.listboxBehavior.getVisibleOptions().indexOf(i);c>=0&&this.listboxBehavior.setActiveOption(c)}onOptionMouseDown(t){t.preventDefault()}onOptionClick(t){let i=t.target.closest('[role="option"]');i&&this.selectOption(i)}onFocusOut(t){this.listboxBehavior.shouldDismissFocus(t.relatedTarget)&&this.setOpen(!1)}onDocumentPointerDown(t){this.open&&this.listboxBehavior.shouldDismissPointer(t.target)&&this.setOpen(!1)}render(){return $R("div",{class:"rui-select","data-ref":"root",children:[Jm("slot",{name:"trigger"}),Jm("slot",{name:"listbox"})]})}static{Vm()}};import{jsx as bt,jsxs as tg}from"@ecopages/jsx/jsx-runtime";function eg({children:e,slot:t="trigger",class:i,...r}){return bt("div",{...r,slot:t,class:K("rui-select__control",i),children:e})}function ig({children:e,class:t,disabled:i,...r}){return bt("button",{...r,type:"button","data-select-trigger":!0,"data-rui-control":!0,"data-rui-control-type":"text",class:K("rui-select__trigger",t),disabled:i,children:e})}function rg({children:e,class:t,"aria-label":i="Show options",disabled:r,...c}){return bt("button",{...c,type:"button","data-select-toggle":!0,class:K("rui-control-toggle",t),"aria-label":i,disabled:r,tabIndex:-1,children:e??bt(Le,{})})}function ng({children:e,slot:t,class:i,...r}){return bt("span",{...r,slot:t,"data-select-value":!0,class:K("rui-select__value",i),children:e})}function og({children:e,slot:t="listbox",class:i,...r}){return bt("div",{...r,slot:t,"data-select-listbox":!0,class:K("rui-select__listbox rui-popover rui-popover--listbox rui-floating",i),hidden:!0,children:e})}function HR({placeholder:e,slot:t="input",class:i,disabled:r,...c}){return bt("input",{...c,type:"search",slot:t,"data-autocomplete-input":!0,class:K("rui-select__search",i),placeholder:e,disabled:r,autocomplete:"off"})}var YR=ne,XR=rt(vr,({options:e,children:t,...i})=>e!=null?tg("rui-select",{...i,children:[tg(eg,{children:[bt(ig,{children:bt(ng,{})}),bt(rg,{})]}),bt(og,{children:bt(be,{embedded:!0,options:e})})]}):bt("rui-select",{...i,children:t}),{stylesheets:["./select.css","../shared/control-toggle.css","../../../lib/icons/icons.css"]});import{jsx as ti,jsxs as tA}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as rb,bound as ei,customElement as eA,event as Xn,onEvent as iA,onUpdated as Qn,prop as ct,query as _r,state as rA}from"@ecopages/radiant";import{isServer as nA}from"@ecopages/radiant/is-server";function yr(e){return e.split(",").map(t=>t.trim()).filter(t=>t.length>0)}var ag,sg,lg,ug,cg,dg,hg,pg,fg,mg,gg,bg,vg,yg,_g,xg,wg,Sg,Eg,Tg,Rg,Ag,Ig,Dg,Cg,kg,Og,Vg,Mg,jg,Lg,Pg,Bg,Fg,Ug,qg,$g,zg,Kg,Wg,Gg,Hg,Yg,Xg,Qg,Jg,Zg,Ng,tb,eb;function QR(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:ib(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||ib(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:JR(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return NR(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function JR(e){var t=ZR(e,"string");return typeof t=="symbol"?t:t+""}function ZR(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ib(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function NR(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var oA=256,aA=48,sA=200,lA=480,uA=768,cA="b",nb=8,ob=32,dA="a.rui-sidebar__menu-button";function hA(e){return e.metaKey||e.ctrlKey}function pA(){return typeof window<"u"&&typeof window.matchMedia=="function"}function xr(e){return e==="left"||e==="right"}var wr,ab=class extends rb{static{({e:[lg,ug,cg,dg,hg,pg,fg,mg,gg,bg,vg,yg,_g,xg,wg,Sg,Eg,Tg,Rg,Ag,Ig,Dg,Cg,kg,Og,Vg,Mg,jg,Lg,Pg,Bg,Fg,Ug,qg,$g,zg,Kg,Wg,Gg,Hg,Yg,Xg,Qg,Jg,Zg,Ng,tb,eb,ag],c:[wr,sg]}=QR(this,[eA("rui-sidebar")],[[ct({type:String,reflect:!0,defaultValue:"sidebar"}),0,"variant"],[ct({type:String,reflect:!0,defaultValue:"left"}),0,"side"],[ct({type:String,reflect:!0,defaultValue:"off"}),0,"collapsible"],[ct({type:Number,defaultValue:oA}),0,"defaultWidth"],[ct({type:Number,reflect:!0,attribute:"width"}),0,"width"],[ct({type:Number,defaultValue:sA}),0,"minWidth"],[ct({type:Number,defaultValue:lA}),0,"maxWidth"],[ct({type:Boolean,defaultValue:!1}),0,"resizable"],[ct({type:Boolean,defaultValue:!0}),0,"defaultOpen"],[ct({type:Boolean,attribute:"open"}),0,"open"],[ct({type:Number,defaultValue:uA}),0,"mobileBreakpoint"],[ct({type:String,defaultValue:"Sidebar"}),0,"label"],[ct({type:Boolean,reflect:!0,attribute:"match-active"}),0,"matchActive"],[ct({type:String,defaultValue:"pathname"}),0,"matchMode"],[ct({type:Boolean,attribute:"scroll-active-on-mount"}),0,"scrollActiveOnMount"],[ct({type:String,attribute:"navigation-events",defaultValue:""}),0,"navigationEvents"],[_r({ref:"root"}),0,"rootTarget"],[_r({ref:"pane"}),0,"paneTarget"],[_r({ref:"handle"}),0,"handleTarget"],[_r({ref:"scrim"}),0,"scrimTarget"],[Xn({name:"rui-sidebar-toggle",bubbles:!0,composed:!0}),0,"toggleEvent"],[Xn({name:"rui-sidebar-resize",bubbles:!0,composed:!0}),0,"resizeEvent"],[Xn({name:"rui-sidebar-mobile-change",bubbles:!0,composed:!0}),0,"mobileChangeEvent"],[rA,0,"isMobile"],[Qn(["open","collapsible","variant","side","width","defaultWidth","defaultOpen","minWidth","maxWidth","isMobile","resizable"]),2,"onStateUpdated"],[Qn(["mobileBreakpoint"]),2,"onMobileBreakpointUpdated"],[Qn(["matchActive","matchMode","navigationEvents"]),2,"onMatchSettingsUpdated"],[ei,2,"onPointerMove"],[ei,2,"onPointerUp"],[ei,2,"onHandlePointerDown"],[ei,2,"onHandleKeydown"],[ei,2,"onScrimClick"],[iA({document:!0,type:"keydown"}),2,"onHostKeydown"]],0,void 0,rb))}variant=(ag(this),lg(this));side=(ug(this),cg(this));collapsible=(dg(this),hg(this));defaultWidth=(pg(this),fg(this));width=(mg(this),gg(this));minWidth=(bg(this),vg(this));maxWidth=(yg(this),_g(this));resizable=(xg(this),wg(this));defaultOpen=(Sg(this),Eg(this));open=(Tg(this),Rg(this));mobileBreakpoint=(Ag(this),Ig(this));label=(Dg(this),Cg(this));matchActive=(kg(this),Og(this,!1));matchMode=(Vg(this),Mg(this));scrollActiveOnMount=(jg(this),Lg(this,!1));navigationEvents=(Pg(this),Bg(this,""));rootTarget=(Fg(this),Ug(this));paneTarget=(qg(this),$g(this));handleTarget=(zg(this),Kg(this));scrimTarget=(Wg(this),Gg(this));toggleEvent=(Hg(this),Yg(this));resizeEvent=(Xg(this),Qg(this));mobileChangeEvent=(Jg(this),Zg(this));isMobile=(Ng(this),tb(this,!1));mediaQuery=(eb(this),null);mediaListener=t=>this.setMobile(t.matches);dragging=!1;dragStartCoord=0;dragStartSize=0;navigationCleanups=[];didScrollActiveOnMount=!1;connectedCallback(){super.connectedCallback(),this.ensureWidthInitialized(),this.setAttribute("role","complementary"),this.setAttribute("aria-label",this.label),this.syncHostAttributes(),this.attachNavigationListeners(),queueMicrotask(()=>{this.open===void 0&&(this.open=this.defaultOpen),this.ensureWidthInitialized(),this.syncHostAttributes(),this.syncPaneWidthVar(),this.bindMobileMediaQuery(),this.syncActiveLinksAfterRender(!0)})}hydrate(){super.hydrate(),this.syncActiveLinksAfterRender(!0)}update(){super.update(),this.syncActiveLinksAfterRender(!1)}requestUpdate(){super.requestUpdate(),queueMicrotask(()=>{this.syncActiveLinksAfterRender(!1)})}disconnectedCallback(){this.endDrag(),this.unbindMobileMediaQuery(),this.detachNavigationListeners(),super.disconnectedCallback()}syncActiveLinksAfterRender(t){let i=t&&this.scrollActiveOnMount&&!this.didScrollActiveOnMount;this.syncActiveLinks(i),i&&(this.didScrollActiveOnMount=!0)}syncHostAttributes(){let t=this.isOpen()?"expanded":"collapsed";this.setAttribute("data-state",t),this.setAttribute("data-collapsible",this.collapsible),this.setAttribute("data-variant",this.variant),this.setAttribute("data-side",this.side),this.setAttribute("data-mobile",String(this.isMobile)),this.setAttribute("data-pane-width",String(this.paneWidth()))}isOpen(){return this.open!==void 0?this.open:this.defaultOpen}ensureWidthInitialized(){this.hasAttribute("width")||(this.width===void 0||this.width===0)&&(this.width=this.defaultWidth)}onStateUpdated(){this.syncHostAttributes(),this.syncPaneWidthVar()}onMobileBreakpointUpdated(){this.bindMobileMediaQuery()}onMatchSettingsUpdated(){this.detachNavigationListeners(),this.attachNavigationListeners(),this.syncActiveLinks(!1)}syncActiveLinks(t=!1){if(!this.matchActive||typeof window>"u"||typeof window.location>"u")return!1;let i=window.location.pathname,r=!1;for(let c of this.querySelectorAll(dA)){let p=this.isLinkActive(c,i);c.classList.toggle("rui-sidebar__menu-button--active",p),p?(c.setAttribute("aria-current","page"),t&&!r&&(c.scrollIntoView({block:"nearest"}),r=!0)):c.removeAttribute("aria-current")}return r}isLinkActive(t,i){let r=t.pathname;return this.matchMode==="prefix"?i===r||i.startsWith(`${r}/`):r===i}attachNavigationListeners(){if(nA||!this.isConnected||!this.matchActive||typeof window>"u"||typeof window.addEventListener!="function")return;let t=()=>this.syncActiveLinks(!1);if(window.addEventListener("popstate",t),this.navigationCleanups.push(()=>window.removeEventListener("popstate",t)),typeof document<"u"&&typeof document.addEventListener=="function")for(let i of yr(this.navigationEvents))document.addEventListener(i,t),this.navigationCleanups.push(()=>document.removeEventListener(i,t))}detachNavigationListeners(){for(let t of this.navigationCleanups)t();this.navigationCleanups=[]}unbindMobileMediaQuery(){this.mediaQuery?.removeEventListener("change",this.mediaListener),this.mediaQuery=null}bindMobileMediaQuery(){if(this.unbindMobileMediaQuery(),this.mobileBreakpoint<=0||!pA()){this.setMobile(!1);return}this.mediaQuery=window.matchMedia(`(max-width: ${this.mobileBreakpoint-1}px)`),this.mediaQuery.addEventListener("change",this.mediaListener),this.setMobile(this.mediaQuery.matches)}setMobile(t){if(t===this.isMobile)return;let i=this.isMobile&&!t;this.isMobile=t,i&&this.collapsible==="off"&&!this.isOpen()?this.setOpen(!0):this.syncPaneWidthVar(),this.mobileChangeEvent.emit({mobile:t})}clampWidth(t){return Math.min(this.maxWidth,Math.max(this.minWidth,t))}paneWidth(){return this.isOpen()?this.width&&this.width>0?this.width:this.defaultWidth:this.isMobile?0:this.collapsible==="icon"?aA:0}syncPaneWidthVar(t=this.paneWidth()){let i=this.rootTarget;i&&i.style.setProperty("--rui-sidebar-pane-width",`${t}px`),this.paneTarget&&(this.paneTarget.style.removeProperty("width"),this.paneTarget.style.removeProperty("height")),this.setAttribute("data-pane-width",String(t))}applyWidth(t,i){let r=this.clampWidth(t);this.width=r,this.syncPaneWidthVar(r),i&&this.resizeEvent.emit({width:r})}toggle(){this.setOpen(!this.isOpen())}setOpen(t){let i=this.isOpen();if(t===i){this.syncPaneWidthVar();return}this.open=t;let r=t?"expanded":"collapsed";this.setAttribute("data-state",r),this.syncPaneWidthVar(),this.toggleEvent.emit({open:t,state:r})}beginDrag(t){if(t.button!==0||this.collapsible!=="off")return;this.dragging=!0;let i=xr(this.side);this.dragStartCoord=i?t.clientX:t.clientY,this.dragStartSize=this.paneWidth(),this.handleTarget?.setPointerCapture(t.pointerId),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerUp)}endDrag(){this.dragging&&(this.dragging=!1,document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp))}onPointerMove(t){if(!this.dragging)return;let r=xr(this.side)?t.clientX:t.clientY,c=this.side==="right"?this.dragStartCoord-r:r-this.dragStartCoord;this.applyWidth(this.dragStartSize+c,!0)}onPointerUp(){this.endDrag()}onHandlePointerDown(t){t.preventDefault(),this.beginDrag(t)}onHandleKeydown(t){let i=t,r=this.paneWidth(),c=xr(this.side),p=c?"ArrowLeft":"ArrowUp",h=c?"ArrowRight":"ArrowDown",a=r;if(i.key===p)a=r-(i.shiftKey?ob:nb);else if(i.key===h)a=r+(i.shiftKey?ob:nb);else if(i.key==="Home")a=this.minWidth;else if(i.key==="End")a=this.maxWidth;else return;t.preventDefault(),this.applyWidth(a,!0)}onScrimClick(){this.isMobile&&this.setOpen(!1)}onHostKeydown(t){let i=t;if(i.key==="Escape"&&this.isMobile&&this.isOpen()){i.preventDefault(),this.setOpen(!1);return}hA(i)&&i.key.toLowerCase()===cA&&(i.preventDefault(),this.toggle())}render(){let t=xr(this.side),i=this.isOpen(),r=i?"expanded":"collapsed",c=this.resizable&&this.collapsible==="off"&&i&&!this.isMobile,p=`${this.paneWidth()}px`,h=i||!this.isMobile&&this.collapsible==="icon"?void 0:"";return tA("div",{class:"rui-sidebar",style:{"--rui-sidebar-pane-width":p},"data-ref":"root","data-state":r,"data-collapsible":this.collapsible,"data-variant":this.variant,"data-side":this.side,"data-mobile":String(this.isMobile),children:[ti("button",{"data-ref":"scrim",type:"button",class:"rui-sidebar__scrim",tabindex:-1,"aria-label":"Close sidebar",hidden:!this.isMobile||!i,"on:click":this.onScrimClick}),ti("div",{"data-ref":"pane",class:"rui-sidebar__pane","data-side":this.side,"data-variant":this.variant,"aria-label":this.$.label,inert:h,children:ti("slot",{})}),c?ti("div",{"data-ref":"handle",class:"rui-sidebar__handle",role:"separator",tabindex:0,"aria-orientation":t?"vertical":"horizontal","aria-valuenow":this.paneWidth(),"aria-valuemin":this.minWidth,"aria-valuemax":this.maxWidth,"aria-label":`${this.label} resize handle`,"on:pointerdown":this.onHandlePointerDown,"on:keydown":this.onHandleKeydown,children:ti("span",{class:"rui-sidebar__handle-grip","aria-hidden":"true"})}):null]})}static{sg()}};import{jsx as vt,jsxs as ii}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Eb,customElement as vA,onEvent as yA,onUpdated as _A,prop as ri,query as xA,state as wA}from"@ecopages/radiant";var sb,lb,ub,cb,db,hb,pb,fb,mb,gb,bb,vb,yb,_b,xb,wb;function fA(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Sb(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Sb(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:mA(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return bA(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function mA(e){var t=gA(e,"string");return typeof t=="symbol"?t:t+""}function gA(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Sb(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function bA(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Sr,Tb=class extends Eb{static{({e:[ub,cb,db,hb,pb,fb,mb,gb,bb,vb,yb,_b,xb,wb,sb],c:[Sr,lb]}=fA(this,[vA("rui-sidebar-trigger")],[[ri({type:String,defaultValue:""}),0,"controls"],[ri({type:String,attribute:"button-label",defaultValue:"Toggle sidebar"}),0,"buttonLabel"],[ri({type:String,reflect:!0,attribute:"data-placement",defaultValue:""}),0,"placement"],[ri({type:String,defaultValue:"ghost"}),0,"variant"],[ri({type:String,defaultValue:"md"}),0,"size"],[xA({ref:"button"}),0,"buttonTarget"],[wA,0,"sidebarState"],[_A(["controls","buttonLabel","placement"]),2,"onControlsUpdated"],[yA({selector:'button[data-ref="button"]',type:"click"}),2,"onButtonClick"]],0,void 0,Eb))}controls=(sb(this),ub(this));buttonLabel=(cb(this),db(this));placement=(hb(this),pb(this));variant=(fb(this),mb(this));size=(gb(this),bb(this));buttonTarget=(vb(this),yb(this));sidebarState=(_b(this),xb(this,"expanded"));sidebarListener=(wb(this),null);attachedSidebar=null;connectedCallback(){super.connectedCallback(),this.syncWithSidebar(),queueMicrotask(()=>this.syncWithSidebar())}disconnectedCallback(){this.detachFromSidebar(),super.disconnectedCallback()}onControlsUpdated(){this.detachFromSidebar(),this.syncWithSidebar(),this.applyState(this.attachedSidebar?this.readState(this.attachedSidebar):"expanded")}resolveSidebar(){let t=this.controls?.trim();if(t){let r=document.getElementById(t);if(r)return r}let i=this.closest("rui-sidebar");return i?.id?i:null}syncWithSidebar(){let t=this.resolveSidebar();if(t===this.attachedSidebar){t&&this.applyState(this.readState(t));return}this.detachFromSidebar(),t&&(this.attachedSidebar=t,this.sidebarListener=i=>{let r=i.detail;this.applyState(r.state)},t.addEventListener("rui-sidebar-toggle",this.sidebarListener),this.applyState(this.readState(t)))}detachFromSidebar(){this.attachedSidebar&&this.sidebarListener&&this.attachedSidebar.removeEventListener("rui-sidebar-toggle",this.sidebarListener),this.attachedSidebar=null,this.sidebarListener=null}readState(t){return t.getAttribute("data-state")??"expanded"}resolvedButtonLabel(t=this.sidebarState){if(this.placement==="inset")return t==="expanded"?"Close navigation":"Open navigation";let i=this.getAttribute("data-button-label")?.trim();if(i)return i;let r=this.getAttribute("button-label")?.trim();return r||this.buttonLabel||"Toggle sidebar"}applyState(t){this.sidebarState=t;let i=this.buttonTarget;if(!i)return;let r=this.resolveSidebar(),c=this.resolvedButtonLabel(t);i.setAttribute("aria-expanded",String(t==="expanded")),i.setAttribute("data-sidebar-state",t),i.setAttribute("aria-label",c),r?.id?i.setAttribute("aria-controls",r.id):this.controls&&i.setAttribute("aria-controls",this.controls)}onButtonClick(t){t.preventDefault(),t.stopPropagation();let i=this.resolveSidebar();i&&typeof i.toggle=="function"&&i.toggle()}placementClass(){return this.placement==="header"?"rui-sidebar__trigger--header":this.placement==="inset"?"rui-sidebar__trigger--inset":""}renderMenuIcon(t){return t==="expanded"?ii("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--close",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[vt("path",{d:"M18 6 6 18"}),vt("path",{d:"m6 6 12 12"})]}):ii("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--menu",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[vt("path",{d:"M4 6h16"}),vt("path",{d:"M4 12h16"}),vt("path",{d:"M4 18h16"})]})}renderDefaultIcon(){let t=this.sidebarState,i=this.placement;return i==="inset"?vt("span",{class:"rui-sidebar__trigger-icon","aria-hidden":"true",children:this.renderMenuIcon(t)}):ii("span",{class:"rui-sidebar__trigger-icon","aria-hidden":"true",children:[i==="header"||t==="expanded"?ii("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--collapse",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[vt("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),vt("path",{d:"M9 3v18"}),vt("path",{d:"m14 15 3-3-3-3"})]}):null,i!=="header"&&t==="collapsed"?ii("svg",{class:"rui-sidebar__trigger-glyph rui-sidebar__trigger-glyph--expand",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",children:[vt("path",{d:"M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),vt("path",{d:"M9 3v18"}),vt("path",{d:"m14 9-3 3 3 3"})]}):null]})}render(){let i=this.resolveSidebar()?.id||this.controls||null,r=this.sidebarState,c=this.resolvedButtonLabel(r);return vt("button",{"data-ref":"button",type:"button",class:`rui-button rui-button--${this.variant} rui-button--${this.size} rui-sidebar__trigger ${this.placementClass()}`.trim(),"data-sidebar-state":r,"aria-expanded":String(r==="expanded"),"aria-controls":i||null,"aria-label":c,children:this.renderDefaultIcon()})}static{lb()}};import{jsx as ut,jsxs as Er}from"@ecopages/jsx/jsx-runtime";function SA({layout:e="default",siteHeader:t,sidebar:i,children:r,class:c}){return e==="docs"?Er("div",{class:K("rui-sidebar-provider",c),"data-layout":e,children:[t?ut("div",{class:"rui-sidebar-provider__site-header",children:t}):null,Er("div",{class:"rui-sidebar-provider__body",children:[i,r]})]}):Er("div",{class:K("rui-sidebar-provider",c),"data-layout":e,children:[i,r]})}function EA({children:e,class:t,"aria-label":i}){return ut("div",{class:K("rui-sidebar__header",t),"aria-label":i,children:e})}function TA({children:e,class:t,"aria-label":i}){return ut("div",{class:K("rui-sidebar__content",t),"aria-label":i,children:e})}function RA({children:e,class:t}){return ut("div",{class:K("rui-sidebar__footer",t),children:e})}function AA({class:e,"aria-label":t}){return ut("hr",{role:"separator","aria-orientation":"horizontal","aria-label":t,class:K("rui-sidebar__separator",e)})}function IA({children:e,class:t,"aria-label":i}){return ut("section",{class:K("rui-sidebar__group",t),"aria-label":i,children:e})}function Rb({children:e,class:t,id:i}){return ut("h2",{id:i,class:K("rui-sidebar__group-label",t),children:e})}function DA({children:e,class:t,"aria-label":i}){return ut("button",{type:"button","aria-label":i,class:K("rui-sidebar__group-action",t),children:e})}function CA({label:e,action:t,class:i}){return Er("div",{class:K("rui-sidebar__group-header",i),children:[ut(Rb,{children:e}),t]})}function kA({children:e,class:t,"aria-label":i}){return ut("ul",{role:"list",class:K("rui-sidebar__menu",t),"aria-label":i,children:e})}function OA({children:e,class:t}){return ut("li",{class:K("rui-sidebar__menu-item",t),children:e})}function Ab({children:e,class:t,isActive:i,as:r,href:c,type:p="button",tooltip:h,disabled:a,onClick:E}){let C=K("rui-sidebar__menu-button",i&&"rui-sidebar__menu-button--active",t),R=h,D=typeof e=="string"?void 0:h;return r==="button"||!r&&!c?ut("button",{type:p,class:C,"aria-current":i?"page":void 0,disabled:a,title:R,"aria-label":D,"on:click":E,children:e}):ut("a",{href:c,class:C,"aria-current":i?"page":void 0,title:R,"aria-label":D,children:e})}function VA(e){let{class:t,...i}=e;return ut(Ab,{class:K("rui-sidebar__menu-action",t),...i})}function MA({children:e,class:t,id:i}){return ut("main",{id:i,class:K("rui-sidebar__inset",t),children:e})}var jA=rt(wr,({children:e,id:t,defaultOpen:i,open:r,defaultWidth:c,width:p,resizable:h,mobileBreakpoint:a,matchActive:E,matchMode:C,scrollActiveOnMount:R,navigationEvents:D,...T})=>ut("rui-sidebar",{...T,id:t,"prop:defaultOpen":i,"prop:open":r,"prop:defaultWidth":c,"prop:width":p,"prop:resizable":h,"prop:mobileBreakpoint":a,"prop:matchActive":E,"prop:matchMode":C,"prop:scrollActiveOnMount":R,"prop:navigationEvents":D,children:e}),{stylesheets:["./sidebar.css"]}),LA=rt(Sr,({children:e,controls:t,triggerLabel:i,placement:r,variant:c,size:p,...h})=>ut("rui-sidebar-trigger",{...h,"prop:controls":t,"prop:buttonLabel":i??"Toggle sidebar","attr:data-button-label":i??"Toggle sidebar","prop:placement":r,"attr:data-placement":r,variant:c,size:p,children:e}),{stylesheets:["./sidebar.css"]});import{jsx as Jt,jsxs as Tr}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as uv,customElement as qA,event as $A,onEvent as Vt,onUpdated as cv,prop as At,query as dv,state as hv}from"@ecopages/radiant";var Ib,Db,Cb,kb,Ob,Vb,Mb,jb,Lb,Pb,Bb,Fb,Ub,qb,$b,zb,Kb,Wb,Gb,Hb,Yb,Xb,Qb,Jb,Zb,Nb,tv,ev,iv,rv,nv,ov,av,sv;function PA(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:lv(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||lv(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:BA(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return UA(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function BA(e){var t=FA(e,"string");return typeof t=="symbol"?t:t+""}function FA(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lv(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function UA(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Rr,pv=class extends uv{static{({e:[Cb,kb,Ob,Vb,Mb,jb,Lb,Pb,Bb,Fb,Ub,qb,$b,zb,Kb,Wb,Gb,Hb,Yb,Xb,Qb,Jb,Zb,Nb,tv,ev,iv,rv,nv,ov,av,sv,Ib],c:[Rr,Db]}=PA(this,[qA("rui-slider")],[[At({type:String,defaultValue:"single"}),0,"variant"],[At({type:Number,reflect:!0,defaultValue:50}),0,"value"],[At({type:Number,reflect:!0,attribute:"range-min",defaultValue:25}),0,"rangeMin"],[At({type:Number,reflect:!0,attribute:"range-max",defaultValue:75}),0,"rangeMax"],[At({type:Number,defaultValue:0}),0,"min"],[At({type:Number,defaultValue:100}),0,"max"],[At({type:Number,defaultValue:1}),0,"step"],[At({type:Number,defaultValue:0}),0,"minDistance"],[At({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[At({type:String,defaultValue:""}),0,"label"],[At({type:String,defaultValue:""}),0,"name"],[$A({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[dv({ref:"input"}),0,"inputTarget"],[dv({ref:"rangeFill"}),0,"rangeFill"],[hv,0,"pendingRange"],[hv,0,"displayedValue"],[cv(["value","min","max","step","variant"]),2,"onSinglePropsUpdated"],[cv(["rangeMin","rangeMax","min","max","step","minDistance","variant"]),2,"onRangePropsUpdated"],[Vt({ref:"input",type:"pointerdown"}),2,"onPointerDown"],[Vt({ref:"input",type:"pointerup"}),2,"onPointerUp"],[Vt({ref:"input",type:"pointercancel"}),2,"onPointerCancel"],[Vt({ref:"input",type:"input"}),2,"onInput"],[Vt({ref:"input",type:"change"}),2,"onChange"],[Vt({selector:"[data-thumb]",type:"pointerdown"}),2,"onThumbPointerDown"],[Vt({selector:"[data-thumb]",type:"pointermove"}),2,"onThumbPointerMove"],[Vt({selector:"[data-thumb]",type:"pointerup"}),2,"onThumbPointerUp"],[Vt({selector:"[data-thumb]",type:"pointercancel"}),2,"onThumbPointerCancel"],[Vt({selector:"[data-thumb]",type:"keydown"}),2,"onThumbKeydown"]],0,void 0,uv))}variant=(Ib(this),Cb(this));value=(kb(this),Ob(this));rangeMin=(Vb(this),Mb(this));rangeMax=(jb(this),Lb(this));min=(Pb(this),Bb(this));max=(Fb(this),Ub(this));step=(qb(this),$b(this));minDistance=(zb(this),Kb(this));disabled=(Wb(this),Gb(this));label=(Hb(this),Yb(this));name=(Xb(this),Qb(this));changeEvent=(Jb(this),Zb(this));inputTarget=(Nb(this),tv(this));rangeFill=(ev(this),iv(this));interacting=(rv(this),!1);activeThumb=null;pendingRange=nv(this,null);displayedValue=(ov(this),av(this,null));resolvedDisabledTabindex=(sv(this),this.$.disabled.map(t=>t?-1:0));resolvedMinLabel=this.$.label.map(t=>t?`${t} minimum`:"Minimum value");resolvedMaxLabel=this.$.label.map(t=>t?`${t} maximum`:"Maximum value");resolvedName=this.$.name.map(t=>t||void 0);connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.variant==="single"?this.syncInputFromValue():this.syncRangeUi()})}onSinglePropsUpdated(){this.variant!=="single"||this.interacting||this.syncInputFromValue()}onRangePropsUpdated(){this.variant!=="range"||this.activeThumb||this.syncRangeUi()}clamp(t){let i=Math.round(t/this.step)*this.step;return Math.min(this.max,Math.max(this.min,i))}normalizeRange(t=this.rangeMin,i=this.rangeMax){let r=this.clamp(t),c=this.clamp(i);return r>c&&([r,c]=[c,r]),c-r<this.minDistance&&(this.activeThumb==="min"?r=this.clamp(c-this.minDistance):c=this.clamp(r+this.minDistance)),[r,c]}getActiveRange(){return this.normalizeRange(...this.pendingRange??[this.rangeMin,this.rangeMax])}percentFor(t){return this.max===this.min?0:(t-this.min)/(this.max-this.min)*100}valueFromPointer(t,i){let r=i.getBoundingClientRect(),c=Math.min(1,Math.max(0,(t-r.left)/r.width));return this.clamp(this.min+c*(this.max-this.min))}syncInputFromValue(){let t=this.inputTarget;if(!t)return;let i=String(this.value);t.value!==i&&(t.value=i),t.min=String(this.min),t.max=String(this.max),t.step=String(this.step),this.updateDisplayedValue(this.value)}updateDisplayedValue(t){this.displayedValue=t}syncRangeUi(){let[t,i]=this.getActiveRange(),r=!1;if(this.activeThumb||(t!==this.rangeMin&&(this.rangeMin=t,r=!0),i!==this.rangeMax&&(this.rangeMax=i,r=!0)),r){queueMicrotask(()=>{this.activeThumb||this.paintRangeUi(...this.getActiveRange())});return}this.paintRangeUi(t,i)}paintRangeUi(t,i){let r=this.percentFor(t),c=this.percentFor(i),p=this.querySelector(".rui-slider__range-track");p&&(p.style.setProperty("--rui-slider-min",`${r}%`),p.style.setProperty("--rui-slider-max",`${c}%`)),this.rangeFill&&(this.rangeFill.style.left=`${r}%`,this.rangeFill.style.width=`${c-r}%`)}commitRange(t=!0){let[i,r]=this.getActiveRange(),c=i!==this.rangeMin||r!==this.rangeMax;this.pendingRange=null,this.rangeMin=i,this.rangeMax=r,t&&c&&this.changeEvent.emit({values:[i,r]})}setRangeValue(t,i){this.activeThumb=t;let[r,c]=this.pendingRange??[this.rangeMin,this.rangeMax],[p,h]=this.normalizeRange(t==="min"?i:r,t==="max"?i:c);this.pendingRange=[p,h],this.paintRangeUi(p,h)}commitSingleValue(t){let i=Number(t.value);this.updateDisplayedValue(i),i!==this.value&&(this.value=i,this.changeEvent.emit({value:i}))}onPointerDown(t){t.button!==0||this.variant!=="single"||(this.interacting=!0)}onPointerUp(t){!this.interacting||this.variant!=="single"||(this.interacting=!1,this.commitSingleValue(t.target))}onPointerCancel(t){!this.interacting||this.variant!=="single"||(this.interacting=!1,this.commitSingleValue(t.target))}onInput(t){if(this.variant!=="single")return;let i=t.target,r=Number(i.value);if(this.updateDisplayedValue(r),this.interacting){this.changeEvent.emit({value:r});return}this.commitSingleValue(i)}onChange(t){this.variant==="single"&&(this.interacting=!1,this.commitSingleValue(t.target))}onThumbPointerDown(t){if(t.button!==0||this.variant!=="range"||this.disabled)return;let i=t.target.closest("[data-thumb]");if(!i)return;let r=i.getAttribute("data-thumb");this.activeThumb=r,this.pendingRange=[this.rangeMin,this.rangeMax],i.setPointerCapture(t.pointerId),t.preventDefault()}onThumbPointerMove(t){if(!this.activeThumb||this.variant!=="range")return;let i=this.querySelector(".rui-slider__range-track");i&&(this.setRangeValue(this.activeThumb,this.valueFromPointer(t.clientX,i)),this.pendingRange&&this.changeEvent.emit({values:this.pendingRange}))}onThumbPointerUp(){!this.activeThumb||this.variant!=="range"||(this.commitRange(),this.activeThumb=null)}onThumbPointerCancel(){!this.activeThumb||this.variant!=="range"||(this.pendingRange=null,this.syncRangeUi(),this.activeThumb=null)}onThumbKeydown(t){if(this.variant!=="range"||this.disabled)return;let i=t.target.closest("[data-thumb]");if(!i)return;let r=i.getAttribute("data-thumb"),c=r==="min"?this.rangeMin:this.rangeMax,p=c;switch(t.key){case"ArrowRight":case"ArrowUp":p=this.clamp(c+this.step);break;case"ArrowLeft":case"ArrowDown":p=this.clamp(c-this.step);break;case"Home":p=this.min;break;case"End":p=this.max;break;case"PageUp":p=this.clamp(c+this.step*10);break;case"PageDown":p=this.clamp(c-this.step*10);break;default:return}t.preventDefault(),this.setRangeValue(r,p),this.commitRange(!1),this.changeEvent.emit({values:[this.rangeMin,this.rangeMax]}),this.activeThumb=null}render(){let[t,i]=this.getActiveRange(),r=this.displayedValue??this.value;return this.variant==="range"?Tr("div",{class:"rui-slider rui-slider--range",children:[this.label?Jt("span",{class:"rui-slider__label",children:this.label}):null,Jt("div",{class:"rui-slider__range",children:Tr("div",{class:"rui-slider__range-track",children:[Jt("div",{class:"rui-slider__range-fill","data-ref":"rangeFill"}),Jt("button",{type:"button",class:"rui-slider__thumb","data-ref":"rangeMinThumb","data-thumb":"min",role:"slider",tabindex:this.resolvedDisabledTabindex,"aria-label":this.resolvedMinLabel,"aria-valuemin":this.min,"aria-valuemax":i,"aria-valuenow":t,disabled:this.$.disabled}),Jt("button",{type:"button",class:"rui-slider__thumb","data-ref":"rangeMaxThumb","data-thumb":"max",role:"slider",tabindex:this.resolvedDisabledTabindex,"aria-label":this.resolvedMaxLabel,"aria-valuemin":t,"aria-valuemax":this.max,"aria-valuenow":i,disabled:this.$.disabled})]})}),Tr("span",{class:"rui-slider__value","data-ref":"value","aria-hidden":"true",children:[t," \u2013 ",i]})]}):Tr("label",{class:"rui-slider",children:[this.label?Jt("span",{class:"rui-slider__label",children:this.label}):null,Jt("input",{type:"range","data-ref":"input","data-rui-control":!0,"data-rui-control-type":"number",class:"rui-slider__input",disabled:this.$.disabled,name:this.resolvedName,"aria-valuemin":this.min,"aria-valuemax":this.max,"aria-valuenow":this.value}),Jt("span",{class:"rui-slider__value","data-ref":"value","aria-hidden":"true",children:r})]})}static{Db()}};import{jsx as zA}from"@ecopages/jsx/jsx-runtime";var KA=rt(Rr,({values:e,...t})=>zA("rui-slider",{...t,rangeMin:e?.[0],rangeMax:e?.[1]}),{stylesheets:["./slider.css"]});import{jsx as ni,jsxs as XA}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Tv,customElement as QA,event as JA,onEvent as ZA,prop as Jn}from"@ecopages/radiant";var fv,mv,gv,bv,vv,yv,_v,xv,wv,Sv;function WA(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Ev(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Ev(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:GA(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return YA(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function GA(e){var t=HA(e,"string");return typeof t=="symbol"?t:t+""}function HA(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ev(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function YA(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ar,Rv=class extends Tv{static{({e:[gv,bv,vv,yv,_v,xv,wv,Sv,fv],c:[Ar,mv]}=WA(this,[QA("rui-switch")],[[Jn({type:Boolean,reflect:!0,defaultValue:!1}),0,"checked"],[Jn({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[Jn({type:String,defaultValue:""}),0,"name"],[JA({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[ZA({ref:"input",type:"change"}),2,"onInputChange"]],0,void 0,Tv))}checked=(fv(this),gv(this));disabled=(bv(this),vv(this));name=(yv(this),_v(this));changeEvent=(xv(this),wv(this));nameAttr=(Sv(this),this.$.name.map(t=>t||void 0));onInputChange(t){let i=t.target;this.checked=i.checked,this.changeEvent.emit({checked:this.checked})}render(){return XA("label",{class:"rui-switch",children:[ni("input",{type:"checkbox",role:"switch","data-ref":"input","data-rui-control":!0,"data-rui-control-type":"boolean",class:"rui-switch__input","prop:checked":this.$.checked,disabled:this.$.disabled,name:this.nameAttr}),ni("span",{class:"rui-switch__track","aria-hidden":"true",children:ni("span",{class:"rui-switch__thumb"})}),ni("span",{class:"rui-switch__label",children:ni("slot",{})})]})}static{mv()}};import{jsx as NA}from"@ecopages/jsx/jsx-runtime";var tI=rt(Ar,({children:e,...t})=>NA("rui-switch",{...t,children:e}),{stylesheets:["./switch.css"]});import{RadiantElement as Uv,customElement as oI,event as aI,onEvent as qv,onUpdated as sI,prop as Ir}from"@ecopages/radiant";var Av,Iv,Dv,Cv,kv,Ov,Vv,Mv,jv,Lv,Pv,Bv;function eI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Fv(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Fv(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:iI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return nI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function iI(e){var t=rI(e,"string");return typeof t=="symbol"?t:t+""}function rI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Fv(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function nI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Dr,$v=class extends Uv{static{({e:[Dv,Cv,kv,Ov,Vv,Mv,jv,Lv,Pv,Bv,Av],c:[Dr,Iv]}=eI(this,[oI("rui-tabs")],[[Ir({type:String,reflect:!0,defaultValue:"boxed"}),0,"variant"],[Ir({type:String,reflect:!0,defaultValue:""}),0,"value"],[Ir({type:String,defaultValue:""}),0,"label"],[Ir({type:Boolean,defaultValue:!0}),0,"automatic"],[aI({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[sI(["value","label"]),2,"onPropsUpdated"],[qv({selector:'[role="tab"]',type:"click"}),2,"onTabClick"],[qv({selector:'[role="tab"]',type:"keydown"}),2,"onTabKeydown"]],0,void 0,Uv))}variant=(Av(this),Dv(this));value=(Cv(this),kv(this));label=(Ov(this),Vv(this));automatic=(Mv(this),jv(this));changeEvent=(Lv(this),Pv(this));childObserver=(Bv(this),null);connectedCallback(){super.connectedCallback(),this.childObserver=new MutationObserver(()=>this.resync()),this.childObserver.observe(this,{childList:!0,subtree:!0}),queueMicrotask(()=>this.resync())}disconnectedCallback(){this.childObserver?.disconnect(),this.childObserver=null,super.disconnectedCallback()}onPropsUpdated(){this.resync()}resync(){this.syncTablistLabel(),this.syncSelection(this.value||this.getTabValue(this.getTabs()[0])||"")}getTabs(){return Array.from(this.querySelectorAll('[role="tab"]'))}getPanels(){return Array.from(this.querySelectorAll('[role="tabpanel"]'))}getTabValue(t){return t?t.dataset.tabValue??t.id.replace(/^tab-/,""):""}syncTablistLabel(){let t=this.querySelector('[role="tablist"]');!t||t.hasAttribute("aria-label")||!this.label||t.setAttribute("aria-label",this.label)}syncSelection(t){let i=this.getTabs(),r=this.getPanels();if(!i.length)return;let c=i.find(h=>this.getTabValue(h)===t)??i.find(h=>h.id===t)??i[0],p=this.getTabValue(c);this.value=p;for(let h of i){let a=h===c;h.setAttribute("aria-selected",String(a)),h.tabIndex=a?0:-1}for(let h of r){let E=(h.dataset.tabValue??h.id.replace(/^panel-/,""))===p;h.hidden=!E,h.hasAttribute("tabindex")||(h.tabIndex=0)}}activateTab(t){!t||t.getAttribute("aria-disabled")==="true"||(this.syncSelection(this.getTabValue(t)),this.changeEvent.emit({value:this.value}))}onTabClick(t){let i=t.target.closest('[role="tab"]');!i||!this.contains(i)||this.activateTab(i)}onTabKeydown(t){let i=this.getTabs(),r=t.target.closest('[role="tab"]');if(!r||!i.includes(r))return;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.activateTab(r);return}let c=st({items:i,current:r,key:t.key,orientation:"horizontal"});c.handled&&(t.preventDefault(),this.automatic&&this.activateTab(c.item))}static{Iv()}};import{jsx as oi}from"@ecopages/jsx/jsx-runtime";function lI({children:e,class:t,...i}){return oi("div",{...i,class:K("rui-tabs__list",t),role:"tablist",children:e})}function uI({id:e,children:t,class:i,disabled:r}){return oi("button",{type:"button",class:K("rui-tabs__tab",i),role:"tab",id:`tab-${e}`,"data-tab-value":e,"aria-controls":`panel-${e}`,"aria-selected":"false",tabindex:-1,disabled:r,children:t})}function cI({children:e,class:t,...i}){return oi("div",{...i,class:K("rui-tabs__panels",t),children:e})}function dI({id:e,children:t,class:i,hidden:r}){return oi("div",{class:K("rui-tabs__panel",i),role:"tabpanel",id:`panel-${e}`,"data-tab-value":e,"aria-labelledby":`tab-${e}`,tabindex:0,hidden:r,children:t})}var hI=rt(Dr,({children:e,...t})=>oi("rui-tabs",{...t,children:e}),{stylesheets:["./tabs.css"]});import{jsx as Cr,jsxs as ly}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as uy,customElement as bI,event as cy,onEvent as Zn,onUpdated as vI,prop as ai,state as yI}from"@ecopages/radiant";var zv,Kv,Wv,Gv,Hv,Yv,Xv,Qv,Jv,Zv,Nv,ty,ey,iy,ry,ny,oy,ay;function pI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:sy(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||sy(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:fI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return gI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function fI(e){var t=mI(e,"string");return typeof t=="symbol"?t:t+""}function mI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sy(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function gI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var kr,dy=class extends uy{static{({e:[Wv,Gv,Hv,Yv,Xv,Qv,Jv,Zv,Nv,ty,ey,iy,ry,ny,oy,ay,zv],c:[kr,Kv]}=pI(this,[bI("rui-tag-group")],[[ai({type:String,reflect:!0,defaultValue:""}),0,"value"],[ai({type:String,defaultValue:""}),0,"label"],[ai({type:Boolean,reflect:!0,defaultValue:!1}),0,"disabled"],[ai({type:String,attribute:"selection-mode",defaultValue:"multiple"}),0,"selectionMode"],[ai({type:Boolean,reflect:!0,defaultValue:!1}),0,"embedded"],[cy({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[cy({name:"rui-remove",bubbles:!0,composed:!0}),0,"removeEvent"],[yI,0,"managedItems"],[vI(["value","label","disabled","selectionMode","embedded","managedItems"]),2,"onPropsUpdated"],[Zn({selector:"[data-tag]",type:"click"}),2,"onTagClick"],[Zn({selector:"[data-tag-remove]",type:"click"}),2,"onRemoveClick"],[Zn({selector:"[data-tag]",type:"keydown"}),2,"onTagKeydown"]],0,void 0,uy))}constructor(...t){super(...t),ay(this)}value=(zv(this),Wv(this));label=(Gv(this),Hv(this));disabled=(Yv(this),Xv(this));selectionMode=(Qv(this),Jv(this));embedded=(Zv(this),Nv(this));changeEvent=(ty(this),ey(this));removeEvent=(iy(this),ry(this));uid=(ny(this),Math.random().toString(36).slice(2,9));managedItems=oy(this,[]);isMultiple(){return this.selectionMode==="multiple"}getSelectedValues(){return this.value?br(this.value):[]}setSelectedValues(t){this.value=Ne(t)}getList(){let t=this.querySelector("[data-rui-managed-list]");if(t)return t;let i=this.querySelector("[data-tag-list]");return i||(this.getSlotElements().find(r=>r.matches("[data-tag-list]")||r.querySelector("[data-tag-list]"))??null)}getTags(){let t=this.getList();return t?Array.from(t.querySelectorAll("[data-tag]")):[]}getVisibleTags(){return this.getTags().filter(t=>!t.hidden&&t.getAttribute("aria-disabled")!=="true")}getTagValue(t){return t.getAttribute("data-value")||t.textContent?.trim()||""}getTagLabel(t){return t.getAttribute("data-label")||t.textContent?.trim()||""}ensureTagIds(){this.getTags().forEach((t,i)=>{t.id||(t.id=`rui-tag-${this.uid}-${i}`)})}syncList(){let t=this.getList();t&&(t.id||(t.id=`rui-tag-list-${this.uid}`),t.setAttribute("role","list"),t.setAttribute("aria-label",this.label||"Tags"),this.disabled?t.setAttribute("aria-disabled","true"):t.removeAttribute("aria-disabled"))}syncTags(){let t=new Set(this.getSelectedValues());this.getTags().forEach((r,c)=>{r.setAttribute("role","listitem");let p=this.getTagValue(r),h=t.has(p);r.setAttribute("aria-selected",String(h)),r.tabIndex=c===0?0:-1;let a=r.querySelector("[data-tag-remove]");a&&(a.type="button",a.tabIndex=-1,a.setAttribute("aria-label",`Remove ${this.getTagLabel(r)}`))})}selectTag(t){if(this.disabled||this.embedded||t.getAttribute("aria-disabled")==="true")return;let i=this.getTagValue(t);if(this.isMultiple()){let r=new Set(this.getSelectedValues());r.has(i)?r.delete(i):r.add(i),this.setSelectedValues([...r])}else this.value=i;this.syncTags(),this.changeEvent.emit({value:this.value})}removeTag(t){let i=this.getTagValue(t),r=new Set(this.getSelectedValues());r.delete(i),this.setSelectedValues([...r]),this.syncTags(),this.removeEvent.emit({value:i}),this.changeEvent.emit({value:this.value})}initialize(){this.ensureTagIds(),this.syncList(),this.syncTags()}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.initialize())}onPropsUpdated(){this.syncList(),this.syncTags()}resync(){this.ensureTagIds(),this.syncList(),this.syncTags()}setItems(t){this.managedItems=t,this.value=Ne(t.map(i=>i.value))}onTagClick(t){let i=t.target;if(i.closest("[data-tag-remove]"))return;let r=i.closest("[data-tag]");r&&this.contains(r)&&this.selectTag(r)}onRemoveClick(t){t.stopPropagation();let r=t.target.closest("[data-tag]");r&&this.contains(r)&&this.removeTag(r)}onTagKeydown(t){let i=this.getVisibleTags(),r=t.target.closest("[data-tag]");if(!r)return;if(t.key==="Enter"||t.key===" "){t.preventDefault(),this.embedded||this.selectTag(r);return}if(t.key==="Backspace"||t.key==="Delete"){r.querySelector("[data-tag-remove]")&&(t.preventDefault(),this.removeTag(r));return}st({items:i,current:r,key:t.key,orientation:"horizontal"}).handled&&t.preventDefault()}render(){return ly("div",{class:"rui-tag-group","data-ref":"root",children:[Cr("slot",{}),this.managedItems.length>0?Cr("div",{"data-tag-list":!0,"data-rui-managed-list":!0,class:"rui-tag-group__list",children:this.managedItems.map(t=>ly("span",{"data-tag":!0,"data-value":t.value,"data-label":t.label,class:"rui-tag",children:[t.label,Cr("button",{type:"button","data-tag-remove":!0,class:"rui-tag__remove","aria-label":`Remove ${t.label}`,children:Cr("span",{"aria-hidden":"true",children:"\xD7"})})]}))}):null]})}static{Kv()}};import{jsx as Zt,jsxs as _I}from"@ecopages/jsx/jsx-runtime";function hy({children:e,class:t,...i}){return Zt("div",{...i,"data-tag-list":!0,class:K("rui-tag-group__list",t),children:e})}function py({value:e,label:t,children:i,class:r,disabled:c,...p}){return _I("span",{...p,"data-tag":!0,"data-value":e,"data-label":t,class:K("rui-tag",r),"aria-disabled":c?"true":void 0,children:[i,Zt(fy,{})]})}function fy({children:e,class:t,"aria-label":i="Remove",...r}){return Zt("button",{...r,type:"button","data-tag-remove":!0,class:K("rui-tag__remove",t),"aria-label":i,children:e??Zt("span",{"aria-hidden":"true",children:"\xD7"})})}var xI=rt(kr,({tags:e,children:t,...i})=>e!=null?Zt("rui-tag-group",{...i,children:Zt(hy,{children:e.map(r=>Zt(py,{value:r.value,label:typeof r.label=="string"?r.label:void 0,disabled:r.disabled,children:r.label}))})}):Zt("rui-tag-group",{...i,children:t}),{stylesheets:["./tag-group.css"]});import{jsx as wI}from"@ecopages/jsx/jsx-runtime";function my(e){let{size:t="md",class:i,rows:r=3,...c}=e;return wI("textarea",{...c,rows:r,[Tt]:"","data-rui-control-type":"text",class:K("rui-textarea",`rui-textarea--${t}`,i)})}nt(my,["./textarea.css"],import.meta.url);import{jsx as Te,jsxs as $y}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as zy,bound as oo,customElement as DI,onEvent as Ky,onUpdated as Or,prop as Mt,query as CI}from"@ecopages/radiant";var si="rui-toast-show",li="rui-toast-dismiss",ui=4e3,Nn=356,to=14,eo=24,io=3,ci=45,ro=200,di="bottom-end";function ue(e){let[t,i]=e.split("-");return{y:t,x:i}}var SI=1;function EI(){return SI++}function gy(e,t){return typeof e=="function"?e(t):e}var no=class{subscribers=[];toasts=[];subscribe=t=>(this.subscribers.push(t),t(this.toasts),()=>{let i=this.subscribers.indexOf(t);i>=0&&this.subscribers.splice(i,1)});getSnapshot=()=>this.toasts;publish(){let t=this.toasts;for(let i of this.subscribers)i(t)}create=(t,i={})=>{let r=i.id??EI(),c=i.dismissible??!0,p=this.toasts.findIndex(a=>a.id===r),h={id:r,title:t,description:i.description,variant:i.variant??"default",duration:i.duration,action:i.action,dismissible:c,closeButton:i.closeButton,position:i.position,delete:!1};return p>=0?this.toasts=this.toasts.map(a=>a.id===r?{...a,...h,delete:!1}:a):this.toasts=[h,...this.toasts],this.publish(),r};dismiss=t=>{if(t==null){if(this.toasts.length===0)return;this.toasts=this.toasts.map(i=>({...i,delete:!0}))}else{let i=this.toasts.find(r=>r.id===t);if(!i||i.delete)return;this.toasts=this.toasts.map(r=>r.id===t?{...r,delete:!0}:r)}this.publish()};remove=t=>{this.toasts=this.toasts.filter(i=>i.id!==t),this.publish()};clear=()=>{this.toasts.length!==0&&(this.toasts=[],this.publish())};message=(t,i)=>this.create(t,i);success=(t,i)=>this.create(t,{...i,variant:"success"});error=(t,i)=>this.create(t,{...i,variant:"error"});info=(t,i)=>this.create(t,{...i,variant:"info"});warning=(t,i)=>this.create(t,{...i,variant:"warning"});loading=(t,i)=>this.create(t,{...i,variant:"loading",duration:i?.duration??Number.POSITIVE_INFINITY});promise=(t,i)=>{let r=this.loading(i.loading,{duration:Number.POSITIVE_INFINITY,action:i.action,closeButton:i.closeButton,position:i.position,description:typeof i.description=="string"?i.description:void 0});return(typeof t=="function"?t():t).then(p=>{let h=typeof i.description=="function"?i.description(p):i.description;this.create(gy(i.success,p),{id:r,variant:"success",description:h,duration:i.duration,action:i.action,closeButton:i.closeButton,position:i.position})}).catch(p=>{let h=typeof i.description=="function"?i.description(p):i.description;this.create(gy(i.error,p),{id:r,variant:"error",description:h,duration:i.duration,action:i.action,closeButton:i.closeButton,position:i.position})}),r}},at=new no;var by,vy,yy,_y,xy,wy,Sy,Ey,Ty,Ry,Ay,Iy,Dy,Cy,ky,Oy,Vy,My,jy,Ly,Py,By,Fy,Uy;function TI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:qy(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||qy(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:RI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return II(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function RI(e){var t=AI(e,"string");return typeof t=="symbol"?t:t+""}function AI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function qy(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function II(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Vr,Wy=class extends zy{static{({e:[yy,_y,xy,wy,Sy,Ey,Ty,Ry,Ay,Iy,Dy,Cy,ky,Oy,Vy,My,jy,Ly,Py,By,Fy,Uy,by],c:[Vr,vy]}=TI(this,[DI("rui-toast")],[[Mt({type:String,reflect:!0,defaultValue:""}),0,"toastId"],[Mt({type:String,defaultValue:""}),0,"title"],[Mt({type:String,defaultValue:""}),0,"description"],[Mt({type:String,reflect:!0,defaultValue:"default"}),0,"variant"],[Mt({type:Number,defaultValue:4e3}),0,"duration"],[Mt({type:Boolean,defaultValue:!0}),0,"dismissible"],[Mt({type:Boolean,defaultValue:!1}),0,"closeButton"],[Mt({type:String,defaultValue:""}),0,"actionLabel"],[Mt({type:String,defaultValue:di}),0,"position"],[Mt({type:Boolean,defaultValue:!1}),0,"markedDelete"],[CI({ref:"toast"}),0,"toastTarget"],[Or(["title","description","variant","actionLabel","closeButton"]),2,"onContentUpdated"],[Or("position"),2,"onPositionUpdated"],[Or("duration"),2,"onDurationUpdated"],[Or("markedDelete"),2,"onMarkedDeleteUpdated"],[oo,2,"onPointerDown"],[oo,2,"onPointerMove"],[oo,2,"onPointerUp"],[Ky({selector:"[data-toast-close]",type:"click"}),2,"onCloseClick"],[Ky({selector:"[data-toast-action]",type:"click"}),2,"onActionClick"]],0,void 0,zy))}toastId=(by(this),yy(this));title=(_y(this),xy(this));description=(wy(this),Sy(this));variant=(Ey(this),Ty(this));duration=(Ry(this),Ay(this));dismissible=(Iy(this),Dy(this));closeButton=(Cy(this),ky(this));actionLabel=(Oy(this),Vy(this));position=(My(this),jy(this));markedDelete=(Ly(this),Py(this));toastTarget=(By(this),Fy(this));mounted=(Uy(this),!1);removed=!1;swiping=!1;swipeOut=!1;swipeAxis=null;swipeOutDirection=null;held=!1;timerReady=!1;timeoutId=null;pointerStart=null;dragStartTime=null;exitTimer=null;connectedCallback(){super.connectedCallback();let t=this.mounted;if(this.addEventListener("pointerdown",this.onPointerDown),this.addEventListener("pointermove",this.onPointerMove),this.addEventListener("pointerup",this.onPointerUp),this.addEventListener("pointercancel",this.onPointerUp),t){this.syncDomState(),this.dispatchEvent(new CustomEvent("rui-toast-mounted",{bubbles:!0}));return}this.timerReady=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.isConnected&&(this.mounted=!0,this.timerReady=!0,this.syncDomState(),this.dispatchEvent(new CustomEvent("rui-toast-mounted",{bubbles:!0})))})}),this.syncDomState()}disconnectedCallback(){this.clearTimer(),this.exitTimer&&(clearTimeout(this.exitTimer),this.exitTimer=null);let t=this.resolvedId;t!==""&&this.removed&&at.remove(t),this.held=!1,this.timerReady=!1,this.removeEventListener("pointerdown",this.onPointerDown),this.removeEventListener("pointermove",this.onPointerMove),this.removeEventListener("pointerup",this.onPointerUp),this.removeEventListener("pointercancel",this.onPointerUp),super.disconnectedCallback()}onContentUpdated(){this.requestUpdate()}onPositionUpdated(){this.syncDomState()}setPaused(t){if(this.held===t){!t&&this.timerReady&&this.mounted&&!this.removed&&!this.timeoutId&&this.startTimer();return}this.held=t,!(!this.timerReady||!this.mounted||this.removed)&&(t||document.hidden?this.clearTimer():this.startTimer())}onDurationUpdated(){!this.timerReady||!this.mounted||this.removed||this.held||this.startTimer()}onMarkedDeleteUpdated(){this.markedDelete&&!this.removed&&this.beginRemove()}get resolvedId(){let t=this.toastId;if(t==null||t==="")return"";let i=Number(t);return Number.isFinite(i)&&String(i)===t?i:t}clearTimer(){this.timeoutId&&clearTimeout(this.timeoutId),this.timeoutId=null}startTimer(){if(!(this.held||this.removed||document.hidden)&&!(this.duration===Number.POSITIVE_INFINITY||this.variant==="loading")){if(this.duration<=0){this.beginRemove();return}this.clearTimer(),this.timeoutId=setTimeout(()=>this.beginRemove(),this.duration)}}beginRemove(){this.removed||(this.removed=!0,this.clearTimer(),this.syncDomState(),this.markedDelete||at.dismiss(this.resolvedId),this.exitTimer=setTimeout(()=>{this.exitTimer=null,at.remove(this.resolvedId)},200))}onPointerDown(t){!this.dismissible||this.variant==="loading"||t.button!==0||t.target?.closest("[data-toast-close], [data-toast-action], button, a")||(this.dragStartTime=Date.now(),this.pointerStart={x:t.clientX,y:t.clientY},this.swipeAxis=null,this.setPointerCapture(t.pointerId))}onPointerMove(t){if(!this.pointerStart)return;let{y:i,x:r}=ue(this.position),c=t.clientX-this.pointerStart.x,p=t.clientY-this.pointerStart.y;if(!this.swiping){if(Math.abs(c)<8&&Math.abs(p)<8)return;this.swiping=!0,this.syncDomState()}this.swipeAxis||(this.swipeAxis=Math.abs(c)>Math.abs(p)?"x":"y");let h=this.swipeAxis==="x"?c:0,a=this.swipeAxis==="y"?p:0;if(this.swipeAxis==="y"&&!(i==="bottom"?a>0:a<0)&&Math.abs(a)<45){this.style.setProperty("--swipe-amount-x","0px"),this.style.setProperty("--swipe-amount-y","0px");return}if(this.swipeAxis==="x"){let E=r==="start"?h<0:h>0;if(r!=="center"&&!E&&Math.abs(h)<45){this.style.setProperty("--swipe-amount-x","0px"),this.style.setProperty("--swipe-amount-y","0px");return}}this.style.setProperty("--swipe-amount-x",`${h}px`),this.style.setProperty("--swipe-amount-y",`${a}px`)}onPointerUp(t){if(!this.pointerStart)return;try{this.releasePointerCapture(t.pointerId)}catch{}let i=this.swiping;if(this.swiping=!1,!i){this.pointerStart=null,this.dragStartTime=null,this.swipeAxis=null;return}let r=Number.parseFloat(this.style.getPropertyValue("--swipe-amount-x")||"0"),c=Number.parseFloat(this.style.getPropertyValue("--swipe-amount-y")||"0"),p=this.swipeAxis==="x"?r:c,h=this.dragStartTime?Date.now()-this.dragStartTime:0,a=Math.abs(p)/Math.max(h,1);if((Math.abs(p)>=45||a>.11)&&this.dismissible){let{y:C,x:R}=ue(this.position);this.swipeAxis==="x"?(this.swipeOutDirection=r<0?"left":"right",R==="start"&&(this.swipeOutDirection="left"),R==="end"&&(this.swipeOutDirection="right")):this.swipeOutDirection=C==="bottom"?"down":"up",this.swipeOut=!0,this.syncDomState(),this.beginRemove()}else this.style.setProperty("--swipe-amount-x","0px"),this.style.setProperty("--swipe-amount-y","0px"),this.swipeAxis=null,this.syncDomState();this.pointerStart=null,this.dragStartTime=null}onCloseClick(t){t.stopPropagation(),this.dismissible&&this.beginRemove()}onActionClick(t){t.stopPropagation(),at.getSnapshot().find(r=>r.id===this.resolvedId)?.action?.onClick(t),this.dismissible&&this.beginRemove()}syncDomState(){let{y:t,x:i}=ue(this.position);this.setAttribute("role","listitem"),this.dataset.mounted=String(this.mounted),this.dataset.removed=String(this.removed),this.dataset.swiping=String(this.swiping),this.dataset.swipeOut=String(this.swipeOut),this.dataset.dismissible=String(this.dismissible),this.dataset.yPosition=t,this.dataset.xPosition=i,this.dataset.variant=this.variant??"default",this.swipeOutDirection?this.dataset.swipeDirection=this.swipeOutDirection:delete this.dataset.swipeDirection}iconForVariant(){switch(this.variant){case"success":return"\u2713";case"error":return"\u2715";case"warning":return"!";case"info":return"i";default:return""}}render(){let t=this.variant??"default",i=this.iconForVariant(),r=t!=="default";return $y("div",{ref:"toast",class:`rui-toast rui-toast--${t}`,role:"status","aria-live":"off","data-ref":"toast",children:[this.closeButton&&t!=="loading"?Te("button",{type:"button",class:"rui-toast__close","data-toast-close":!0,"aria-label":"Close toast",children:"\xD7"}):null,r?Te("span",{class:"rui-toast__icon","data-icon":!0,"aria-hidden":"true",children:t==="loading"?Te("span",{class:"rui-toast__loader"}):i}):null,$y("div",{class:"rui-toast__content",children:[Te("div",{class:"rui-toast__title","data-title":!0,children:this.$.title}),this.description?Te("div",{class:"rui-toast__description","data-description":!0,children:this.$.description}):null]}),this.actionLabel?Te("button",{type:"button",class:"rui-toast__action rui-button rui-button--outline rui-button--sm","data-toast-action":!0,children:this.$.actionLabel}):null]})}static{vy()}};import{jsx as ao}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as d_,bound as Mr,customElement as jI,onEvent as so,onUpdated as LI,prop as ce,state as PI}from"@ecopages/radiant";var Gy,Hy,Yy,Xy,Qy,Jy,Zy,Ny,t_,e_,i_,r_,n_,o_,a_,s_,l_,u_;function kI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:c_(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||c_(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:OI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return MI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function OI(e){var t=VI(e,"string");return typeof t=="symbol"?t:t+""}function VI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function c_(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function MI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}function h_(e,t){return e instanceof Node&&t.contains(e)}var jr,p_=class extends d_{static{({e:[Yy,Xy,Qy,Jy,Zy,Ny,t_,e_,i_,r_,n_,o_,a_,s_,l_,u_,Gy],c:[jr,Hy]}=kI(this,[jI("rui-toaster")],[[ce({type:String,reflect:!0,defaultValue:di}),0,"position"],[ce({type:Number,defaultValue:4e3}),0,"duration"],[ce({type:Number,defaultValue:3}),0,"visibleToasts"],[ce({type:Boolean,defaultValue:!1}),0,"closeButton"],[ce({type:Boolean,defaultValue:!1}),0,"expand"],[ce({type:Number,defaultValue:14}),0,"gap"],[ce({type:Number,defaultValue:24}),0,"offset"],[PI,0,"toasts"],[LI(["position","duration","visibleToasts","closeButton","expand","gap","offset"]),2,"onConfigUpdated"],[so({document:!0,type:si}),2,"onDocumentShow"],[so({document:!0,type:li}),2,"onDocumentDismiss"],[so({selector:"rui-toast",type:"rui-toast-mounted"}),2,"onToastMounted"],[Mr,2,"onPointerOver"],[Mr,2,"onPointerOut"],[Mr,2,"onPointerDown"],[Mr,2,"onPointerUp"]],0,void 0,d_))}position=(Gy(this),Yy(this));duration=(Xy(this),Qy(this));visibleToasts=(Jy(this),Zy(this));closeButton=(Ny(this),t_(this));expand=(e_(this),i_(this));gap=(r_(this),n_(this));offset=(o_(this),a_(this));toasts=(s_(this),l_(this,[]));expanded=(u_(this),!1);interacting=!1;unsubscribe=null;visibilityHandler=null;heights=new Map;observers=new Map;layoutFrame=null;connectedCallback(){super.connectedCallback(),this.syncHostPosition(),this.unsubscribe=at.subscribe(t=>{this.toasts=t,t.length===0&&this.resetLayoutState(),this.scheduleLayoutSync()}),this.visibilityHandler=()=>this.syncPauseState(),document.addEventListener("visibilitychange",this.visibilityHandler)}disconnectedCallback(){this.unsubscribe?.(),this.unsubscribe=null,this.visibilityHandler&&(document.removeEventListener("visibilitychange",this.visibilityHandler),this.visibilityHandler=null),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerUp),this.layoutFrame!=null&&cancelAnimationFrame(this.layoutFrame),this.resetLayoutState(),super.disconnectedCallback()}onConfigUpdated(){this.syncHostPosition(),this.scheduleLayoutSync()}onDocumentShow(t){let i=t.detail;i?.title&&at.create(i.title,{id:i.id,description:i.description,variant:i.variant,duration:i.duration,action:i.action,dismissible:i.dismissible,closeButton:i.closeButton,position:i.position})}onDocumentDismiss(t){let i=t.detail;at.dismiss(i?.id)}onToastMounted(){this.observeToasts(),this.syncPauseState()}filteredToasts(){let t=this.toasts.filter(c=>(c.position??this.position)===this.position),i=[],r=[];for(let c of t)c.delete?r.push(c):i.push(c);return[...i.slice(0,this.visibleToasts),...r]}syncHostPosition(){let{y:t,x:i}=ue(this.position);this.dataset.yPosition=t,this.dataset.xPosition=i,this.style.setProperty("--width",`${356}px`),this.style.setProperty("--gap",`${this.gap}px`),this.style.setProperty("--viewport-offset",`${this.offset}px`)}isStackExpanded(){return this.expanded||this.expand}isPaused(){return this.isStackExpanded()||this.interacting||document.hidden}resetLayoutState(){for(let i of this.observers.values())i.disconnect();this.observers.clear(),this.heights.clear(),this.expanded=!1,this.interacting=!1;let t=this.querySelector(".rui-toaster");t&&(t.style.height="0px",t.dataset.expanded="false"),this.dataset.expanded="false"}syncPauseState(){let t=this.isPaused();for(let i of this.querySelectorAll("rui-toast"))i.setPaused(t);this.patchStackLayout()}scheduleLayoutSync(){this.layoutFrame!=null&&cancelAnimationFrame(this.layoutFrame),this.layoutFrame=requestAnimationFrame(()=>{if(this.layoutFrame=null,this.toasts.length>0&&!this.interacting){let i=!!(this.querySelector(".rui-toaster")?.matches(":hover")||this.matches(":hover"));this.expanded=i}this.observeToasts(),this.syncPauseState()})}measureToast(t){let i=t.style.height,r=t.style.overflow;t.style.height="auto",t.style.overflow="visible";let c=t.querySelector(".rui-toast"),p=Math.round(c instanceof HTMLElement?c.offsetHeight:t.offsetHeight)||64;return t.style.height=i,t.style.overflow=r,p}observeToasts(){let t=this.querySelector(".rui-toaster");if(!t)return;let i=[...t.querySelectorAll("rui-toast")],r=new Set;for(let c of i){let p=c.toastId;if(!p)continue;r.add(p);let h=c.querySelector(".rui-toast")??c;if(!this.observers.has(p)){let a=new ResizeObserver(()=>{let E=this.measureToast(c);this.heights.get(p)!==E&&(this.heights.set(p,E),this.patchStackLayout())});a.observe(h),this.observers.set(p,a)}this.heights.set(p,this.measureToast(c))}for(let[c,p]of[...this.observers])r.has(c)||(p.disconnect(),this.observers.delete(c),this.heights.delete(c))}patchStackLayout(){let t=this.querySelector(".rui-toaster");if(!t)return;let i=this.isStackExpanded(),{y:r}=ue(this.position),c=r==="bottom"?-1:1;this.dataset.expanded=String(i),t.dataset.expanded=String(i);let p=[...t.querySelectorAll("rui-toast")].filter(R=>R.dataset.mounted==="true"&&R.dataset.removed!=="true");if(p.length===0){t.style.height="0px";return}let h=p.map(R=>{let D=this.heights.get(R.toastId)??this.measureToast(R);return this.heights.set(R.toastId,D),D}),a=h[0]??64,E=0;for(let R=0;R<p.length;R+=1){let D=p[R];if(!D)continue;let T=h[R]??64,z=R===0;if(D.dataset.index=String(R),D.dataset.front=String(z),D.dataset.expanded=String(i),D.style.setProperty("--z-index",String(p.length-R)),i)D.style.setProperty("--y",`translateY(${c*E}px)`),D.style.height=`${T}px`,D.style.overflow="visible",E+=T+this.gap;else if(z)D.style.setProperty("--y","translateY(0px)"),D.style.height=`${T}px`,D.style.overflow="visible";else{let $=Math.max(.7,1-R*.05);D.style.setProperty("--y",`translateY(${c*R*this.gap}px) scale(${$})`),D.style.height=`${a}px`,D.style.overflow="hidden"}}let C=i?Math.max(0,E>0?E-this.gap:a):a+Math.max(0,p.length-1)*this.gap;t.style.height=`${C}px`}onPointerOver(t){h_(t.relatedTarget,this)||(this.expanded=!0,this.syncPauseState())}onPointerOut(t){h_(t.relatedTarget,this)||this.interacting||(this.expanded=!1,this.syncPauseState())}onPointerDown(){this.interacting=!0,this.expanded=!0,this.syncPauseState(),document.addEventListener("pointerup",this.onPointerUp,{once:!0}),document.addEventListener("pointercancel",this.onPointerUp,{once:!0})}onPointerUp(){if(!this.interacting)return;this.interacting=!1,this.matches(":hover")||this.querySelector("rui-toast:hover")||(this.expanded=!1),this.syncPauseState()}render(){let t=this.filteredToasts();return ao("section",{class:"rui-toaster-region","aria-label":"Notifications","aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",tabIndex:-1,children:ao("ol",{class:"rui-toaster","data-rui-toaster":!0,"on:pointerover":this.onPointerOver,"on:pointerout":this.onPointerOut,"on:pointerdown":this.onPointerDown,children:t.map(i=>{let r=i.duration??(i.variant==="loading"?Number.POSITIVE_INFINITY:this.duration);return ao("rui-toast",{"prop:toastId":String(i.id),"prop:title":i.title,"prop:description":i.description??"","prop:variant":i.variant,"prop:duration":r,"prop:dismissible":i.dismissible,"prop:closeButton":i.closeButton??this.closeButton,"prop:actionLabel":i.action?.label??"","prop:position":i.position??this.position,"prop:markedDelete":!!i.delete},String(i.id))})})})}static{Hy()}};import{jsx as f_}from"@ecopages/jsx/jsx-runtime";var BI=rt(Vr,({toastId:e,title:t,description:i,variant:r,duration:c,dismissible:p,closeButton:h,actionLabel:a,position:E,markedDelete:C,...R})=>f_("rui-toast",{...R,"prop:toastId":e!=null?String(e):void 0,"prop:title":t,"prop:description":i,"prop:variant":r,"prop:duration":c,"prop:dismissible":p,"prop:closeButton":h,"prop:actionLabel":a,"prop:position":E,"prop:markedDelete":C}),{stylesheets:["./toast.css"]}),FI=rt(jr,({children:e,position:t,duration:i,visibleToasts:r,closeButton:c,expand:p,gap:h,offset:a,...E})=>f_("rui-toaster",{...E,"prop:position":t,"prop:duration":i,"prop:visibleToasts":r,"prop:closeButton":c,"prop:expand":p,"prop:gap":h,"prop:offset":a,children:e}),{stylesheets:["./toast.css"]});var UI=Object.assign((e,t)=>at.create(e,t),{message:(e,t)=>at.message(e,t),success:(e,t)=>at.success(e,t),error:(e,t)=>at.error(e,t),info:(e,t)=>at.info(e,t),warning:(e,t)=>at.warning(e,t),loading:(e,t)=>at.loading(e,t),promise:(e,t)=>at.promise(e,t),dismiss:e=>at.dismiss(e),clear:()=>at.clear()});function qI(e){document.dispatchEvent(new CustomEvent(si,{detail:e,bubbles:!0,composed:!0}))}function $I(e){let t=e==null?{}:{id:e};document.dispatchEvent(new CustomEvent(li,{detail:t,bubbles:!0,composed:!0}))}import{jsx as Lr,jsxs as YI}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as P_,bound as XI,customElement as QI,onUpdated as JI,prop as hi,state as B_}from"@ecopages/radiant";import{isServer as F_}from"@ecopages/radiant/is-server";function m_(e,t){try{return e.querySelector(t)}catch{return null}}function g_(e,t){try{return Array.from(e.querySelectorAll(t))}catch{return[]}}function zI(e){return e.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]/g,"")}function b_(e,t,i=r=>document.getElementById(r)!==null){if(e.id)return t.add(e.id),e.id;let r=zI(e.textContent||"")||"section",c=r,p=2;for(;t.has(c)||i(c);)c=`${r}-${p}`,p+=1;return e.id=c,t.add(c),c}function v_(e,t){return e instanceof HTMLElement?e.getBoundingClientRect().top+t:t}function y_(e,t,i,r){if(t instanceof HTMLElement){let c=t.getBoundingClientRect(),p=e.getBoundingClientRect();t.scrollTo({top:t.scrollTop+(p.top-c.top)-i,behavior:r});return}window.scrollTo({top:window.scrollY+e.getBoundingClientRect().top-i,behavior:r})}var __,x_,w_,S_,E_,T_,R_,A_,I_,D_,C_,k_,O_,V_,M_,j_;function KI(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:L_(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||L_(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:WI(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return HI(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function WI(e){var t=GI(e,"string");return typeof t=="symbol"?t:t+""}function GI(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function L_(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function HI(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Pr,U_=class extends P_{static{({e:[w_,S_,E_,T_,R_,A_,I_,D_,C_,k_,O_,V_,M_,j_,__],c:[Pr,x_]}=KI(this,[QI("rui-toc")],[[hi({type:String,defaultValue:""}),0,"target"],[hi({type:String,attribute:"heading-selector",defaultValue:"h2,h3"}),0,"headingSelector"],[hi({type:String,defaultValue:"On this page"}),0,"label"],[hi({type:Number,attribute:"scroll-offset",defaultValue:120}),0,"scrollOffset"],[hi({type:String,attribute:"navigation-events",defaultValue:""}),0,"navigationEvents"],[B_,0,"entries"],[B_,0,"activeId"],[JI(["target","headingSelector","scrollOffset","navigationEvents"]),2,"onScanSettingsUpdated"],[XI,2,"onLinkClick"]],0,void 0,P_))}target=(__(this),w_(this,""));headingSelector=(S_(this),E_(this,"h2,h3"));label=(T_(this),R_(this,"On this page"));scrollOffset=(A_(this),I_(this,120));navigationEvents=(D_(this),C_(this,""));entries=(k_(this),O_(this,[]));activeId=(V_(this),M_(this,null));headings=(j_(this),[]);scrollRoot=null;scrollCleanup=null;navigationCleanups=[];pendingScrollTargetId=null;scrollRafPending=!1;scrollOffsetTolerance=4;connectedCallback(){super.connectedCallback(),this.rebuild(),this.attachNavigationListeners()}disconnectedCallback(){this.detachScrollListener(),this.detachNavigationListeners(),super.disconnectedCallback()}onScanSettingsUpdated(){this.detachNavigationListeners(),this.attachNavigationListeners(),this.rebuild()}rebuild(){this.detachScrollListener(),this.headings=[],this.entries=[],this.activeId=null,this.pendingScrollTargetId=null,this.scrollRoot=null;let t=this.resolveTarget();if(!t)return;let i=g_(t,this.headingSelector);if(i.length===0)return;let r=new Set,c=i.map(p=>({id:b_(p,r),label:(p.textContent||"").trim(),depth:this.headingDepth(p)}));this.headings=i,this.entries=c,this.scrollRoot=this.resolveScrollRoot(t),this.attachScrollListener(),this.updateActiveHeading()}resolveTarget(){let t=this.target.trim();return t?m_(document,t):this.parentElement}resolveScrollRoot(t){let i=t;for(;i&&i!==document.documentElement&&i!==document.body;){let r=getComputedStyle(i).overflowY;if(r==="auto"||r==="scroll"||r==="overlay")return i;i=i.parentElement}return window}headingDepth(t){let i=Number.parseInt(t.tagName.slice(1),10);return Number.isFinite(i)?i:2}attachNavigationListeners(){if(F_||!this.isConnected)return;let t=()=>this.rebuild();for(let i of yr(this.navigationEvents))document.addEventListener(i,t),this.navigationCleanups.push(()=>document.removeEventListener(i,t))}detachNavigationListeners(){for(let t of this.navigationCleanups)t();this.navigationCleanups=[]}attachScrollListener(){if(F_||!this.isConnected)return;let t=()=>{this.scrollRafPending||(this.scrollRafPending=!0,requestAnimationFrame(()=>{this.updateActiveHeading(),this.scrollRafPending=!1}))},i=this.scrollRoot??window;if(i===window){window.addEventListener("scroll",t,{passive:!0}),this.scrollCleanup=()=>window.removeEventListener("scroll",t);return}i.addEventListener("scroll",t,{passive:!0}),this.scrollCleanup=()=>i.removeEventListener("scroll",t)}detachScrollListener(){this.scrollCleanup?.(),this.scrollCleanup=null}isScrollAtBottom(){let t=this.scrollRoot??window;if(!(t instanceof HTMLElement)){let i=document.documentElement.scrollHeight,r=window.innerHeight;return i<=r+1?!1:window.scrollY+r>=i-10}return t.scrollHeight<=t.clientHeight+1?!1:t.scrollTop+t.clientHeight>=t.scrollHeight-10}activeLineY(){return v_(this.scrollRoot??window,this.scrollOffset+this.scrollOffsetTolerance)}updateActiveHeading(){if(this.headings.length===0)return;if(this.isScrollAtBottom()){this.pendingScrollTargetId=null;let r=this.headings[this.headings.length-1]?.id;r&&this.setActiveId(r);return}if(this.pendingScrollTargetId){let r=this.findHeadingById(this.pendingScrollTargetId);if(!r)this.pendingScrollTargetId=null;else if(this.hasPendingScrollReachedTarget(r))this.pendingScrollTargetId=null;else{this.setActiveId(this.pendingScrollTargetId);return}}let t=this.activeLineY(),i=null;for(let r of this.headings)if(r.getBoundingClientRect().top<=t)i=r.id;else break;this.setActiveId(i??this.headings[0].id)}setActiveId(t){this.activeId!==t&&(this.activeId=t)}findHeadingById(t){return this.headings.find(i=>i.id===t)??null}hasPendingScrollReachedTarget(t){return t.getBoundingClientRect().top<=this.activeLineY()}onLinkClick(t,i){let r=t;if(r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0)return;let c=this.findHeadingById(i);c&&(t.preventDefault(),this.pendingScrollTargetId=i,this.setActiveId(i),this.scrollToHeading(i,c))}scrollToHeading(t,i){let r=window.matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth";window.history.replaceState(window.history.state,"",`${window.location.pathname}${window.location.search}#${t}`),y_(i,this.scrollRoot??window,this.scrollOffset,r)}render(){return this.entries.length===0?null:YI("nav",{class:"rui-toc","aria-label":this.label,children:[this.label?Lr("p",{class:"rui-toc__label",children:this.label}):null,Lr("ul",{class:"rui-toc__list",children:this.entries.map(t=>Lr("li",{class:t.depth>=3?"rui-toc__item rui-toc__item--depth-3":"rui-toc__item",children:Lr("a",{href:`#${t.id}`,class:t.id===this.activeId?"rui-toc__link rui-toc__link--active":"rui-toc__link","on:click":i=>this.onLinkClick(i,t.id),children:t.label})}))})]})}static{x_()}};import{jsx as ZI}from"@ecopages/jsx/jsx-runtime";var NI=rt(Pr,({target:e,headingSelector:t,label:i,scrollOffset:r,navigationEvents:c,...p})=>ZI("rui-toc",{...p,"prop:target":e,"prop:headingSelector":t,"prop:label":i,"prop:scrollOffset":r,"prop:navigationEvents":c}),{stylesheets:["./toc.css"]});import{jsx as Y_}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as X_,customElement as nD,onEvent as Q_,prop as J_}from"@ecopages/radiant";var q_,$_,z_,K_,W_,G_;function tD(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:H_(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||H_(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:eD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return rD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function eD(e){var t=iD(e,"string");return typeof t=="symbol"?t:t+""}function iD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function H_(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function rD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Br,Z_=class extends X_{static{({e:[z_,K_,W_,G_,q_],c:[Br,$_]}=tD(this,[nD("rui-toolbar")],[[J_({type:String,defaultValue:""}),0,"label"],[J_({type:Boolean,reflect:!0,defaultValue:!1}),0,"exclusiveToggles"],[Q_({type:"keydown",selector:"button, a[href], input, select, [tabindex]"}),2,"onKeydown"],[Q_({type:"click",selector:"button[data-toggle][aria-pressed]",options:{capture:!0}}),2,"onToggleButtonClick"]],0,void 0,X_))}label=(q_(this),z_(this));exclusiveToggles=(K_(this),W_(this));resolvedAriaLabel=(G_(this),this.$.label.map(t=>t||void 0));getItems(){return Li(this)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>lt(this.getItems(),0))}onKeydown(t){let i=this.getItems(),r=t.target.closest("button, a[href], input, select, [tabindex]");st({items:i,current:r,key:t.key,orientation:"horizontal"}).handled&&t.preventDefault()}getToggleButtons(){return Array.from(this.querySelectorAll("button[data-toggle][aria-pressed]")).filter(t=>!t.disabled)}onToggleButtonClick(t){let i=t.target.closest("button[data-toggle][aria-pressed]");if(!i||i.disabled)return;t.stopImmediatePropagation();let r=i.getAttribute("aria-pressed")==="true";if(this.exclusiveToggles){for(let c of this.getToggleButtons())c.setAttribute("aria-pressed","false");r||i.setAttribute("aria-pressed","true");return}i.setAttribute("aria-pressed",String(!r))}render(){return Y_("div",{class:"rui-toolbar",role:"toolbar","aria-label":this.resolvedAriaLabel,children:Y_("slot",{})})}static{$_()}};import{jsx as oD}from"@ecopages/jsx/jsx-runtime";var aD=rt(Br,({children:e,...t})=>oD("rui-toolbar",{...t,children:e}),{stylesheets:["./toolbar.css"]});import{jsx as lo,jsxs as dD}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as cx,bound as dx,customElement as hD,onEvent as uo,onUpdated as pD,prop as co,query as fD}from"@ecopages/radiant";var N_,tx,ex,ix,rx,nx,ox,ax,sx,lx;function sD(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:ux(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||ux(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:lD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return cD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function lD(e){var t=uD(e,"string");return typeof t=="symbol"?t:t+""}function uD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ux(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function cD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var hx=8,Fr,px=class extends cx{static{({e:[ex,ix,rx,nx,ox,ax,sx,lx,N_],c:[Fr,tx]}=sD(this,[hD("rui-tooltip")],[[co({type:String,defaultValue:""}),0,"content"],[co({type:String,defaultValue:"top"}),0,"placement"],[co({type:Number,defaultValue:200}),0,"delay"],[fD({ref:"tooltip"}),0,"tooltipTarget"],[pD(["content","placement"]),2,"onDescribedPropsUpdated"],[uo({document:!0,type:"keydown"}),2,"onDocumentKeydown"],[uo({type:"focusin",selector:".rui-tooltip__trigger"}),2,"onFocusIn"],[uo({type:"focusout",selector:".rui-tooltip__trigger"}),2,"onFocusOut"],[dx,2,"onPointerEnter"],[dx,2,"onPointerLeave"]],0,void 0,cx))}content=(N_(this),ex(this));placement=(ix(this),rx(this));delay=(nx(this),ox(this));tooltipTarget=(ax(this),sx(this));open=(lx(this),!1);showTimer=null;hideTimer=null;tooltipId=`rui-tooltip-${Math.random().toString(36).slice(2,9)}`;describedEl=null;cleanupFloating=null;connectedCallback(){super.connectedCallback(),this.addEventListener("pointerenter",this.onPointerEnter),this.addEventListener("pointerleave",this.onPointerLeave),queueMicrotask(()=>this.wireTrigger())}disconnectedCallback(){this.clearTimers(),this.teardownFloating(),this.removeEventListener("pointerenter",this.onPointerEnter),this.removeEventListener("pointerleave",this.onPointerLeave),this.describedEl?.removeAttribute("aria-describedby"),super.disconnectedCallback()}clearTimers(){this.showTimer&&clearTimeout(this.showTimer),this.hideTimer&&clearTimeout(this.hideTimer),this.showTimer=null,this.hideTimer=null}teardownFloating(){this.cleanupFloating?.(),this.cleanupFloating=null}getAnchor(){return vc(this)??this}wireTrigger(){this.describedEl?.removeAttribute("aria-describedby"),this.describedEl=this.getAnchor(),this.describedEl.setAttribute("aria-describedby",this.tooltipId)}attachFloating(){this.tooltipTarget&&(this.teardownFloating(),this.cleanupFloating=Ii({anchor:this.getAnchor(),floating:this.tooltipTarget,getPlacement:()=>this.placement,gap:hx}))}onDescribedPropsUpdated(){this.wireTrigger(),this.open&&this.tooltipTarget&&hn(this.getAnchor(),this.tooltipTarget,this.placement,hx)}setOpen(t){this.clearTimers(),this.open=t,this.tooltipTarget&&(this.tooltipTarget.hidden=!t,t?this.attachFloating():this.teardownFloating())}scheduleShow(){if(this.clearTimers(),this.delay<=0){this.setOpen(!0);return}this.showTimer=setTimeout(()=>this.setOpen(!0),this.delay)}scheduleHide(){this.clearTimers(),this.hideTimer=setTimeout(()=>this.setOpen(!1),80)}onDocumentKeydown(t){!this.open||t.key!=="Escape"||this.setOpen(!1)}onFocusIn(){this.scheduleShow()}onFocusOut(t){let i=t.relatedTarget;i&&this.contains(i)||this.scheduleHide()}onPointerEnter(){this.scheduleShow()}onPointerLeave(){this.scheduleHide()}render(){return dD("span",{class:"rui-tooltip",children:[lo("span",{class:"rui-tooltip__trigger",children:lo("slot",{})}),lo("span",{"data-ref":"tooltip",id:this.tooltipId,class:"rui-tooltip__content rui-floating",role:"tooltip",hidden:!0,children:this.$.content})]})}static{tx()}};import{jsx as mD}from"@ecopages/jsx/jsx-runtime";var gD=rt(Fr,({children:e,...t})=>mD("rui-tooltip",{...t,children:e}),{stylesheets:["./tooltip.css"]});import{jsx as Sx}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ex,customElement as xD,event as wD,onEvent as Tx,onUpdated as SD,prop as Rx}from"@ecopages/radiant";var fx,mx,gx,bx,vx,yx,_x,xx;function bD(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:wx(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||wx(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:vD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return _D(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function vD(e){var t=yD(e,"string");return typeof t=="symbol"?t:t+""}function yD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wx(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function _D(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var Ur,Ax=class extends Ex{static{({e:[gx,bx,vx,yx,_x,xx,fx],c:[Ur,mx]}=bD(this,[xD("rui-tree")],[[Rx({type:String,defaultValue:""}),0,"label"],[Rx({type:String,reflect:!0,defaultValue:""}),0,"value"],[wD({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[SD("value"),2,"onValueUpdated"],[Tx({selector:'[role="treeitem"]',type:"click"}),2,"onClick"],[Tx({selector:'[role="treeitem"]',type:"keydown"}),2,"onKeydown"]],0,void 0,Ex))}label=(fx(this),gx(this));value=(bx(this),vx(this));changeEvent=(yx(this),_x(this));resolvedAriaLabel=(xx(this),this.$.label.map(t=>t||void 0));getVisibleItems(){return Array.from(this.querySelectorAll('[role="treeitem"]')).filter(t=>{let i=t.parentElement;for(;i&&i!==this;){if(i.getAttribute("role")==="group"&&i.hidden)return!1;i=i.parentElement}return!0})}getParentItem(t){let i=t.closest('[role="group"]');if(!i)return null;let r=i.previousElementSibling;return r?.getAttribute("role")==="treeitem"?r:null}getSiblingItems(t){let i=this.getParentItem(t),r=i?i.nextElementSibling?.getAttribute("role")==="group"?i.nextElementSibling:null:this.querySelector('[role="tree"]')??this;return r?Array.from(r.querySelectorAll(':scope > li > [role="treeitem"], :scope > [role="treeitem"]')):[]}syncSelection(){let t=Array.from(this.querySelectorAll('[role="treeitem"]')),i=this.getVisibleItems(),r=0;t.forEach((c,p)=>{let h=c.getAttribute("data-value")||c.id||"",a=!!this.value&&h===this.value;if(c.setAttribute("aria-selected",String(a)),a){let E=i.indexOf(c);E>=0&&(r=E)}else!this.value&&p===0&&(r=0)}),lt(i,r)}syncExpanded(){let t=Array.from(this.querySelectorAll('[role="treeitem"]'));for(let i of t){if(!i.hasAttribute("aria-expanded"))continue;let r=i.nextElementSibling;r?.getAttribute("role")==="group"&&(r.hidden=i.getAttribute("aria-expanded")==="false")}}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncExpanded(),this.syncSelection()})}onValueUpdated(){this.syncSelection()}select(t){let i=t.getAttribute("data-value")||t.id||t.textContent?.trim()||"";this.value=i,this.syncSelection(),this.changeEvent.emit({value:i}),t.focus()}setExpanded(t,i){t.setAttribute("aria-expanded",String(i));let r=t.nextElementSibling;r?.getAttribute("role")==="group"&&(r.hidden=!i),this.syncSelection()}onClick(t){let i=t.target.closest('[role="treeitem"]');!i||!this.contains(i)||(i.hasAttribute("aria-expanded")&&this.setExpanded(i,i.getAttribute("aria-expanded")!=="true"),this.select(i))}onKeydown(t){let i=t.target.closest('[role="treeitem"]');if(i)switch(t.key){case"ArrowDown":case"ArrowUp":case"Home":case"End":{if(!st({items:this.getVisibleItems(),current:i,key:t.key,orientation:"vertical",wrap:!1}).handled)return;t.preventDefault();break}case"ArrowRight":{if(t.preventDefault(),i.getAttribute("aria-expanded")==="false"){this.setExpanded(i,!0);return}if(i.getAttribute("aria-expanded")==="true"){let r=this.getVisibleItems(),c=r.indexOf(i);r[c+1]&&ge(r,c+1)}break}case"ArrowLeft":{if(t.preventDefault(),i.getAttribute("aria-expanded")==="true"){this.setExpanded(i,!1);return}let r=this.getParentItem(i);if(r){let c=this.getVisibleItems(),p=c.indexOf(r);p>=0&&ge(c,p)}break}case"*":{t.preventDefault();for(let r of this.getSiblingItems(i))r.hasAttribute("aria-expanded")&&this.setExpanded(r,!0);break}case"Enter":{t.preventDefault(),i.hasAttribute("aria-expanded")&&this.setExpanded(i,i.getAttribute("aria-expanded")!=="true"),this.select(i);break}case" ":{t.preventDefault(),this.select(i);break}default:break}}render(){return Sx("ul",{class:"rui-tree",role:"tree","aria-label":this.resolvedAriaLabel,"aria-multiselectable":"false",children:Sx("slot",{})})}static{mx()}};import{Fragment as Ix,jsx as Nt,jsxs as ED}from"@ecopages/jsx/jsx-runtime";var Dx=({nodes:e})=>Nt(Ix,{children:e.map(t=>Nt("li",{class:"rui-tree__item",children:t.children?.length?ED(Ix,{children:[Nt("button",{type:"button",class:"rui-tree__node",role:"treeitem","data-value":t.id,"aria-expanded":t.expanded??!1,"aria-selected":"false",tabindex:-1,children:t.label}),Nt("ul",{role:"group",hidden:!(t.expanded??!1),children:Nt(Dx,{nodes:t.children})})]}):Nt("button",{type:"button",class:"rui-tree__node",role:"treeitem","data-value":t.id,"aria-selected":"false",tabindex:-1,children:t.label})}))}),TD=rt(Ur,({nodes:e,...t})=>Nt("rui-tree",{...t,children:Nt(Dx,{nodes:e})}),{stylesheets:["./tree.css"]});import{jsx as Fx}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as Ux,customElement as CD,event as kD,onEvent as qx,onUpdated as OD,prop as $x}from"@ecopages/radiant";var Cx,kx,Ox,Vx,Mx,jx,Lx,Px;function RD(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:Bx(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||Bx(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:AD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return DD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function AD(e){var t=ID(e,"string");return typeof t=="symbol"?t:t+""}function ID(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Bx(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function DD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var qr,zx=class extends Ux{static{({e:[Ox,Vx,Mx,jx,Lx,Px,Cx],c:[qr,kx]}=RD(this,[CD("rui-treegrid")],[[$x({type:String,defaultValue:""}),0,"label"],[$x({type:String,reflect:!0,defaultValue:""}),0,"value"],[kD({name:"rui-change",bubbles:!0,composed:!0}),0,"changeEvent"],[OD("value"),2,"onValueUpdated"],[qx({selector:'[role="gridcell"]',type:"click"}),2,"onCellClick"],[qx({selector:'[role="gridcell"]',type:"keydown"}),2,"onCellKeydown"]],0,void 0,Ux))}label=(Cx(this),Ox(this));value=(Vx(this),Mx(this));changeEvent=(jx(this),Lx(this));resolvedAriaLabel=(Px(this),this.$.label.map(t=>t||void 0));getDataRows(){return Array.from(this.querySelectorAll('[role="row"][data-row-id]'))}getVisibleRows(){return this.getDataRows().filter(t=>{let i=t.parentElement;for(;i&&i!==this;){if(i.getAttribute("role")==="rowgroup"&&i.hidden)return!1;i=i.parentElement}return!0})}getRowCells(t){return Array.from(t.children).filter(i=>i instanceof HTMLElement&&i.getAttribute("role")==="gridcell")}getVisibleCells(){return this.getVisibleRows().flatMap(t=>this.getRowCells(t))}getParentRow(t){let i=t.parentElement;if(!i||i.getAttribute("role")!=="rowgroup")return null;let r=i.previousElementSibling;return r?.getAttribute("role")==="row"?r:null}syncExpanded(){for(let t of this.getDataRows()){if(!t.hasAttribute("aria-expanded"))continue;let i=t.nextElementSibling;i?.getAttribute("role")==="rowgroup"&&(i.hidden=t.getAttribute("aria-expanded")==="false")}}syncSelection(){let t=this.getVisibleCells(),i=0;for(let r of this.getDataRows()){let c=r.getAttribute("data-row-id")??"",p=!!this.value&&c===this.value;for(let h of this.getRowCells(r))if(h.setAttribute("aria-selected",String(p)),p){let a=t.indexOf(h);a>=0&&(i=a)}}t.length>0&<(t,i)}connectedCallback(){super.connectedCallback(),queueMicrotask(()=>{this.syncExpanded(),this.syncSelection()})}onValueUpdated(){this.syncSelection()}setExpanded(t,i){t.setAttribute("aria-expanded",String(i));let r=t.nextElementSibling;r?.getAttribute("role")==="rowgroup"&&(r.hidden=!i)}activateCell(t){let i=t.closest('[role="row"][data-row-id]');if(!i)return;let r=i.getAttribute("data-row-id")??"",c=this.getRowCells(i).indexOf(t);this.value=r,this.syncSelection(),this.changeEvent.emit({rowId:r,columnIndex:c}),t.focus()}focusCell(t,i){if(this.getVisibleRows().indexOf(t)<0)return;let p=this.getVisibleCells(),h=this.getRowCells(t),a=h[Math.min(Math.max(0,i),h.length-1)],E=p.indexOf(a);E>=0&&ge(p,E)}onCellClick(t){let i=t.target.closest('[role="gridcell"]');if(!i||!this.contains(i))return;let r=i.closest('[role="row"][data-row-id]');r&&this.getRowCells(r).indexOf(i)===0&&r.hasAttribute("aria-expanded")&&this.setExpanded(r,r.getAttribute("aria-expanded")!=="true"),this.activateCell(i)}onCellKeydown(t){let i=t.target.closest('[role="gridcell"]'),r=i?.closest('[role="row"][data-row-id]');if(!i||!r)return;let c=this.getVisibleRows(),p=c.indexOf(r),h=this.getRowCells(r),a=h.indexOf(i),E=a===0,C=r.hasAttribute("aria-expanded"),R=r.getAttribute("aria-expanded")==="true";switch(t.key){case"ArrowRight":{if(t.preventDefault(),E&&C&&!R){this.setExpanded(r,!0),this.syncSelection();return}a<h.length-1&&this.focusCell(r,a+1);return}case"ArrowLeft":{if(t.preventDefault(),E&&C&&R){this.setExpanded(r,!1),this.syncSelection();return}if(a>0){this.focusCell(r,a-1);return}let D=this.getParentRow(r);D&&this.focusCell(D,0);return}case"ArrowDown":{t.preventDefault();let D=c[Math.min(c.length-1,p+1)];D&&D!==r&&this.focusCell(D,a);return}case"ArrowUp":{t.preventDefault();let D=c[Math.max(0,p-1)];D&&D!==r&&this.focusCell(D,a);return}case"Home":{t.preventDefault(),this.focusCell(r,0);return}case"End":{t.preventDefault(),this.focusCell(r,h.length-1);return}case"*":{t.preventDefault();for(let D of this.getDataRows())D.hasAttribute("aria-expanded")&&this.setExpanded(D,!0);this.syncSelection();return}case"Enter":{if(t.preventDefault(),E&&C){this.setExpanded(r,!R),this.syncSelection();return}this.activateCell(i);return}case" ":{t.preventDefault(),this.activateCell(i);return}default:return}}render(){return Fx("div",{class:"rui-treegrid",role:"treegrid","aria-label":this.resolvedAriaLabel,children:Fx("slot",{})})}static{kx()}};import{Fragment as Kx,jsx as te,jsxs as Wx}from"@ecopages/jsx/jsx-runtime";var Gx=({rows:e})=>te(Kx,{children:e.map(t=>Wx(Kx,{children:[te("div",{class:"rui-treegrid__row",role:"row","data-row-id":t.id,"aria-expanded":t.children?.length?t.expanded??!1:void 0,children:t.cells.map((i,r)=>te("div",{class:"rui-treegrid__cell",role:"gridcell",tabindex:-1,"data-col":r,"aria-selected":"false",children:i}))}),t.children?.length?te("div",{class:"rui-treegrid__group",role:"rowgroup",hidden:!(t.expanded??!1),children:te(Gx,{rows:t.children})}):null]}))}),VD=rt(qr,({columns:e,rows:t,...i})=>Wx("rui-treegrid",{...i,children:[te("div",{class:"rui-treegrid__row rui-treegrid__row--header",role:"row",children:e.map(r=>te("div",{class:"rui-treegrid__cell rui-treegrid__cell--header",role:"columnheader",children:r}))}),te(Gx,{rows:t})]}),{stylesheets:["./treegrid.css"]});import{jsx as pi,jsxs as BD}from"@ecopages/jsx/jsx-runtime";import{RadiantElement as l0,bound as u0,customElement as FD,event as UD,onEvent as c0,onUpdated as qD,prop as ho,query as d0}from"@ecopages/radiant";var Hx,Yx,Xx,Qx,Jx,Zx,Nx,t0,e0,i0,r0,n0,o0,a0;function MD(e,t,i,r,c,p){var h,a,E,C,R,D,T,z=Symbol.metadata||Symbol.for("Symbol.metadata"),$=Object.defineProperty,L=Object.create,W=[L(null),L(null)],G=t.length;function k(n,g,f){return function(o,s){g&&(s=o,o=e);for(var b=0;b<n.length;b++)s=n[b].apply(o,f?[s]:[]);return f?s:o}}function _(n,g,f,o){if(typeof n!="function"&&(o||n!==void 0))throw new TypeError(g+" must "+(f||"be")+" a function"+(o?"":" or undefined"));return n}function H(n,g,f,o,s,b,w,m,v,y,X){function P(u){if(!X(u))throw new TypeError("Attempted to access private element on non-instance")}var B=[].concat(g[0]),Q=g[3],F=!w,A=s===1,J=s===3,Z=s===4,O=s===2;function V(u,S,et){return function(j,it){return S&&(it=j,j=n),et&&et(j),l[u].call(j,it)}}if(!F){var l={},U=[],x=J?"get":Z||A?"set":"value";if(v?(y||A?l={get:s0(function(){return Q(this)},o,"get"),set:function(u){g[4](this,u)}}:l[x]=Q,y||s0(l[x],o,O?"":x)):y||(l=Object.getOwnPropertyDescriptor(n,o)),!y&&!v){if((a=W[+m][o])&&(a^s)!==7)throw Error("Decorating two elements with the same name ("+l[x].name+") is not supported yet");W[+m][o]=s<3?1:s}}for(var d=n,M=B.length-1;M>=0;M-=f?2:1){var N=_(B[M],"A decorator","be",!0),tt=f?B[M-1]:void 0,q={},I={kind:["field","accessor","method","getter","setter","class"][s],name:o,metadata:h,addInitializer:function(u,S){if(u.v)throw new TypeError("attempted to call addInitializer after decoration was finished");_(S,"An initializer","be",!0),b.push(S)}.bind(null,q)};if(F)a=N.call(tt,d,I),q.v=1,_(a,"class decorators","return")&&(d=a);else if(I.static=m,I.private=v,a=I.access={has:v?X.bind():function(u){return o in u}},Z||(a.get=v?O?function(u){return P(u),l.value}:V("get",0,P):function(u){return u[o]}),O||J||(a.set=v?V("set",0,P):function(u,S){u[o]=S}),d=N.call(tt,A?{get:l.get,set:l.set}:l[x],I),q.v=1,A){if(typeof d=="object"&&d)(a=_(d.get,"accessor.get"))&&(l.get=a),(a=_(d.set,"accessor.set"))&&(l.set=a),(a=_(d.init,"accessor.init"))&&U.unshift(a);else if(d!==void 0)throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined")}else _(d,(y?"field":"method")+" decorators","return")&&(y?U.unshift(d):l[x]=d)}return s<2&&w.push(k(U,m,1),k(b,m,0)),y||F||(v?A?w.splice(-1,0,V("get",m),V("set",m)):w.push(O?l[x]:_.call.bind(l[x])):$(n,o,l)),d}function Y(n){return $(n,z,{configurable:!0,enumerable:!0,value:h})}return p!==void 0&&(h=p[z]),h=L(h??null),R=[],D=function(n){n&&R.push(k(n))},T=function(n,g){for(var f=0;f<i.length;f++){var o=i[f],s=o[1],b=7&s;if((8&s)==n&&!b==g){var w=o[2],m=!!o[3],v=16&s;H(n?e:e.prototype,o,v,m?"#"+w:jD(w),b,b<2?[]:n?C=C||[]:E=E||[],R,!!n,m,g,n&&m?function(y){return PD(y)===e}:c)}}},T(8,0),T(0,0),T(8,1),T(0,1),D(E),D(C),a=R,G||Y(e),{e:a,get c(){var n=[];return G&&[Y(e=H(e,[t],r,e.name,5,n)),k(n,1)]}}}function jD(e){var t=LD(e,"string");return typeof t=="symbol"?t:t+""}function LD(e,t){if(typeof e!="object"||!e)return e;var i=e[Symbol.toPrimitive];if(i!==void 0){var r=i.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function s0(e,t,i){typeof t=="symbol"&&(t=(t=t.description)?"["+t+"]":"");try{Object.defineProperty(e,"name",{configurable:!0,value:i?i+" "+t:t})}catch{}return e}function PD(e){if(Object(e)!==e)throw TypeError("right-hand side of 'in' should be an object, got "+(e!==null?typeof e:"null"));return e}var $r,h0=class extends l0{static{({e:[Xx,Qx,Jx,Zx,Nx,t0,e0,i0,r0,n0,o0,a0,Hx],c:[$r,Yx]}=MD(this,[FD("rui-window-splitter")],[[ho({type:Number,reflect:!0,defaultValue:50}),0,"value"],[ho({type:String,defaultValue:"horizontal"}),0,"orientation"],[ho({type:String,defaultValue:"Split view"}),0,"label"],[d0({ref:"primary"}),0,"primaryTarget"],[d0({ref:"separator"}),0,"separatorTarget"],[UD({name:"rui-splitter-change",bubbles:!0,composed:!0}),0,"changeEvent"],[qD(["value","orientation"]),2,"onPropsUpdated"],[c0({ref:"separator",type:"keydown"}),2,"onKeydown"],[c0({ref:"separator",type:"pointerdown"}),2,"onPointerDown"],[u0,2,"onPointerMove"],[u0,2,"onPointerUp"]],0,void 0,l0))}value=(Hx(this),Xx(this));orientation=(Qx(this),Jx(this));label=(Zx(this),Nx(this));primaryTarget=(t0(this),e0(this));separatorTarget=(i0(this),r0(this));changeEvent=(n0(this),o0(this));resolvedAriaOrientation=(a0(this),this.$.orientation.map(t=>t!=="vertical"?"vertical":"horizontal"));dragging=!1;connectedCallback(){super.connectedCallback(),queueMicrotask(()=>this.applySize())}disconnectedCallback(){document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),super.disconnectedCallback()}onPropsUpdated(){this.applySize()}applySize(){if(!this.primaryTarget)return;let t=`${Math.min(80,Math.max(20,this.value))}%`;this.orientation==="vertical"?(this.primaryTarget.style.height=t,this.primaryTarget.style.width=""):(this.primaryTarget.style.width=t,this.primaryTarget.style.height="")}onKeydown(t){let i=t.shiftKey?10:2,r=this.orientation!=="vertical";r&&t.key==="ArrowLeft"||!r&&t.key==="ArrowUp"?(t.preventDefault(),this.updateValue(Math.max(20,this.value-i))):r&&t.key==="ArrowRight"||!r&&t.key==="ArrowDown"?(t.preventDefault(),this.updateValue(Math.min(80,this.value+i))):t.key==="Home"?(t.preventDefault(),this.updateValue(20)):t.key==="End"&&(t.preventDefault(),this.updateValue(80))}updateValue(t){t!==this.value&&(this.value=t,this.changeEvent.emit({value:t}))}onPointerDown(t){this.dragging=!0,this.separatorTarget.setPointerCapture(t.pointerId),document.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp)}onPointerMove(t){if(!this.dragging)return;let i=this.getBoundingClientRect();this.orientation==="vertical"?this.updateValue(Math.min(80,Math.max(20,(t.clientY-i.top)/i.height*100))):this.updateValue(Math.min(80,Math.max(20,(t.clientX-i.left)/i.width*100)))}onPointerUp(){this.dragging=!1,document.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp)}render(){let t=this.orientation!=="vertical";return BD("div",{class:`rui-window-splitter rui-window-splitter--${t?"horizontal":"vertical"}`,children:[pi("div",{"data-ref":"primary",class:"rui-window-splitter__pane",children:pi("slot",{name:"primary"})}),pi("div",{"data-ref":"separator",class:"rui-window-splitter__separator",role:"separator",tabindex:0,"aria-orientation":this.resolvedAriaOrientation,"aria-valuenow":this.$.value,"aria-valuemin":20,"aria-valuemax":80,"aria-label":this.$.label}),pi("div",{class:"rui-window-splitter__pane",children:pi("slot",{name:"secondary"})})]})}static{Yx()}};import{jsx as p0,jsxs as $D}from"@ecopages/jsx/jsx-runtime";var zD=rt($r,({primary:e,secondary:t,...i})=>$D("rui-window-splitter",{...i,children:[p0("div",{slot:"primary",children:e}),p0("div",{slot:"secondary",children:t})]}),{stylesheets:["./window-splitter.css"]});export{di as DEFAULT_TOAST_POSITION,Ge as FormStore,Tt as RUI_CONTROL_ATTR,wn as RUI_DIALOG_ACTION_EVENT,Fi as RUI_DIALOG_CLOSE_EVENT,Pt as RUI_DIALOG_HOST_ID,Bi as RUI_DIALOG_OPEN_EVENT,Ui as RUI_DIALOG_TOGGLE_EVENT,Hi as RUI_FIELD_DESCRIPTION_ATTR,xe as RUI_FIELD_ERROR_ATTR,Gi as RUI_FIELD_LABEL_ATTR,An as RUI_FIELD_MANAGED_ATTR,li as RUI_TOAST_DISMISS_EVENT,si as RUI_TOAST_SHOW_EVENT,R0 as RuiAlert,T0 as RuiAlertDescription,fi as RuiAlertElement,S0 as RuiAlertIcon,E0 as RuiAlertTitle,Wr as RuiAutocomplete,zr as RuiAutocompleteCollection,gi as RuiAutocompleteElement,Kr as RuiAutocompleteEmpty,j0 as RuiAutocompleteInput,jo as RuiAvatar,z0 as RuiBreadcrumb,vi as RuiBreadcrumbElement,X0 as RuiBreadcrumbEllipsis,W0 as RuiBreadcrumbItem,G0 as RuiBreadcrumbLink,K0 as RuiBreadcrumbList,H0 as RuiBreadcrumbPage,Y0 as RuiBreadcrumbSeparator,Hr as RuiButton,Ho as RuiButtonGroup,Sw as RuiCalendar,Ei as RuiCalendarElement,jw as RuiCarousel,Ti as RuiCarouselElement,Vw as RuiCarouselNext,Ow as RuiCarouselPrev,Mw as RuiCarouselRotation,gs as RuiCarouselSlide,Ww as RuiCheckbox,Ai as RuiCheckboxElement,Ms as RuiChip,Ls as RuiChipList,Hw as RuiChipListItem,_S as RuiCombobox,Cl as RuiComboboxControl,Di as RuiComboboxElement,kl as RuiComboboxInput,Vl as RuiComboboxListbox,yS as RuiComboboxOption,Ol as RuiComboboxTrigger,DS as RuiDateField,Vi as RuiDateFieldElement,PS as RuiDateRangePicker,ji as RuiDateRangePickerElement,YS as RuiDialog,qc as RuiDialogActions,Uc as RuiDialogBody,$c as RuiDialogClose,Pi as RuiDialogElement,Fc as RuiDialogTitle,xE as RuiDisclosure,_e as RuiDisclosureElement,wE as RuiDisclosureGroup,zi as RuiDisclosureGroupElement,wd as RuiDisclosureIcon,Ed as RuiDisclosurePanel,Sd as RuiDisclosureTrigger,Td as RuiFeed,SE as RuiFeedArticle,RE as RuiFeedArticleActions,TE as RuiFeedArticleContent,EE as RuiFeedArticleHeader,AE as RuiFeedByline,IE as RuiFeedBylineBody,DE as RuiFeedMeta,WE as RuiField,HE as RuiFieldDescription,Xi as RuiFieldElement,XE as RuiFieldError,oT as RuiForm,Qi as RuiFormElement,pT as RuiGrid,Ji as RuiGridElement,qh as RuiHeading,yT as RuiHeadingDescription,bT as RuiHeadingEyebrow,vT as RuiHeadingTitle,Ni as RuiHeadline,$h as RuiInput,zh as RuiLabel,be as RuiListbox,ki as RuiListboxElement,ne as RuiListboxOption,kT as RuiMenuButton,ir as RuiMenuButtonElement,UT as RuiMenubar,rr as RuiMenubarElement,QT as RuiMeter,ar as RuiMeterElement,nR as RuiNavigationMenu,lr as RuiNavigationMenuElement,aR as RuiNavigationMenuLink,sR as RuiNavigationMenuPanel,oR as RuiNavigationMenuTrigger,_R as RuiNumberField,yR as RuiNumberFieldDecrementButton,cr as RuiNumberFieldElement,gR as RuiNumberFieldGroup,vR as RuiNumberFieldIncrementButton,bR as RuiNumberFieldInput,RR as RuiPopover,TR as RuiPopoverContent,hr as RuiPopoverElement,AR as RuiPopoverTrigger,pr as RuiPopoverTriggerElement,PR as RuiRadioGroup,mr as RuiRadioGroupElement,XR as RuiSelect,eg as RuiSelectControl,vr as RuiSelectElement,og as RuiSelectListbox,YR as RuiSelectOption,HR as RuiSelectSearch,rg as RuiSelectToggle,ig as RuiSelectTrigger,ng as RuiSelectValue,jA as RuiSidebar,TA as RuiSidebarContent,wr as RuiSidebarElement,RA as RuiSidebarFooter,IA as RuiSidebarGroup,DA as RuiSidebarGroupAction,CA as RuiSidebarGroupHeader,Rb as RuiSidebarGroupLabel,EA as RuiSidebarHeader,MA as RuiSidebarInset,kA as RuiSidebarMenu,VA as RuiSidebarMenuAction,Ab as RuiSidebarMenuButton,OA as RuiSidebarMenuItem,SA as RuiSidebarProvider,AA as RuiSidebarSeparator,LA as RuiSidebarTrigger,Sr as RuiSidebarTriggerElement,KA as RuiSlider,Rr as RuiSliderElement,tI as RuiSwitch,Ar as RuiSwitchElement,uI as RuiTab,lI as RuiTabList,dI as RuiTabPanel,cI as RuiTabPanels,hI as RuiTabs,Dr as RuiTabsElement,py as RuiTag,xI as RuiTagGroup,kr as RuiTagGroupElement,hy as RuiTagList,fy as RuiTagRemove,my as RuiTextarea,BI as RuiToast,Vr as RuiToastElement,FI as RuiToaster,jr as RuiToasterElement,NI as RuiToc,Pr as RuiTocElement,aD as RuiToolbar,Br as RuiToolbarElement,gD as RuiTooltip,Fr as RuiTooltipElement,TD as RuiTree,Ur as RuiTreeElement,VD as RuiTreegrid,qr as RuiTreegridElement,zD as RuiWindowSplitter,$r as RuiWindowSplitterElement,ro as TOAST_EXIT_MS,to as TOAST_GAP,ui as TOAST_LIFETIME,ci as TOAST_SWIPE_THRESHOLD,eo as TOAST_VIEWPORT_OFFSET,io as TOAST_VISIBLE_AMOUNT,Nn as TOAST_WIDTH,rE as closeDialog,oE as createDialogHandle,Ln as createRulesResolver,K as cx,$I as dismissToast,Mn as fieldContext,Ke as findFieldControl,we as formContext,eE as getOpenDialogId,Qc as installDialogs,iE as openDialog,kn as readControlValue,ah as runRulesResolver,qI as showToast,UI as toast,nE as toggleDialog,Sn as uninstallDialogs,On as writeControlValue};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|