@optionfactory/fml 9.0.0-rc3 → 9.0.0-rc31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -88
- package/dist/client-errors.iife.js +40 -49
- package/dist/client-errors.iife.js.map +1 -1
- package/dist/client-errors.iife.min.js +1 -1
- package/dist/client-errors.iife.min.js.map +1 -1
- package/dist/custom-elements.json +491 -51
- package/dist/fml.css +25 -20
- package/dist/fml.css.map +1 -1
- package/dist/fml.iife.js +5866 -2563
- package/dist/fml.iife.js.map +1 -1
- package/dist/fml.iife.min.js +1 -1
- package/dist/fml.iife.min.js.map +1 -1
- package/dist/ftl.d.mts +425 -231
- package/dist/ftl.iife.js +774 -1044
- package/dist/ftl.iife.js.map +1 -1
- package/dist/ftl.iife.min.js +1 -1
- package/dist/ftl.iife.min.js.map +1 -1
- package/dist/ftl.min.mjs +1 -1
- package/dist/ftl.min.mjs.map +1 -1
- package/dist/ftl.mjs +774 -1044
- package/dist/ftl.mjs.map +1 -1
- package/dist/ful.css +25 -20
- package/dist/ful.css.map +1 -1
- package/dist/ful.d.mts +3048 -556
- package/dist/ful.iife.js +4977 -1395
- package/dist/ful.iife.js.map +1 -1
- package/dist/ful.iife.min.js +1 -1
- package/dist/ful.iife.min.js.map +1 -1
- package/dist/ful.min.mjs +1 -1
- package/dist/ful.min.mjs.map +1 -1
- package/dist/ful.mjs +4975 -1396
- package/dist/ful.mjs.map +1 -1
- package/dist/httpc.d.mts +143 -123
- package/dist/httpc.iife.js +163 -175
- package/dist/httpc.iife.js.map +1 -1
- package/dist/httpc.iife.min.js +1 -1
- package/dist/httpc.iife.min.js.map +1 -1
- package/dist/httpc.min.mjs +1 -1
- package/dist/httpc.min.mjs.map +1 -1
- package/dist/httpc.mjs +163 -175
- package/dist/httpc.mjs.map +1 -1
- package/dist/vscode.html-custom-data.json +239 -39
- package/dist/web-types.json +498 -51
- package/package.json +2 -2
package/dist/fml.iife.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var fml=function(e){"use strict";class t{#e;#t=new Map;constructor(e){this.#e=e}getOrCompute(e,t){if(this.#t.has(e))return this.#t.get(e);const s=t(e);return this.#t.size>=this.#e&&this.#t.delete(this.#t.keys().next().value),this.#t.set(e,s),s}get size(){return this.#t.size}}const s={ter:Symbol("ternary"),elv:Symbol("elvis"),nullc:Symbol("null-coalescence"),or:Symbol("or"),and:Symbol("and"),eq:Symbol("eq"),cmp:Symbol("cmp"),not:Symbol("not"),access:Symbol("access"),member:Symbol("access-member"),subscript:Symbol("access-subscript"),method:Symbol("access-method-call"),call:Symbol("module-function-call"),tstring:Symbol("tstring"),literal:Symbol("literal"),array:Symbol("array-literal"),dict:Symbol("dict-literal"),function:Symbol("module-function"),symbol:Symbol("symbol"),templated:{ten:Symbol("templated-node"),teh:Symbol("templated-html"),tet:Symbol("templated-text"),tel:Symbol("templated-literal")},dom:{t:Symbol("text"),h:Symbol("html"),n:Symbol("node")}},r=new Map([["true",!0],["false",!1],["null",null],["undefined",void 0]]);class i extends SyntaxError{constructor(e,t,s,r){super(e),this.expected=t,this.found=s,this.location=r,this.name="SyntaxError"}format(e){let t="Error: "+this.message;if(this.location){let s=null;const r=e.find(e=>e.source===this.location.source);r&&(s=r.text.split(/\r\n|\n|\r/g));const i=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(i):i,a=this.location.source+":"+n.line+":"+n.column;if(s){const e=this.location.end,r="".padEnd(n.line.toString().length," "),o=s[i.line-1],l=(i.line===e.line?e.column:o.length+1)-i.column||1;t+="\n --\x3e "+a+"\n"+r+" |\n"+n.line+" | "+o+"\n"+r+" | "+"".padEnd(i.column-1," ")+"".padEnd(l,"^")}else t+="\n at "+a}return t}static buildMessage(e,t){function s(e){return e.codePointAt(0).toString(16).toUpperCase()}const r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function i(e){return r?e.replace(r,e=>"\\u{"+s(e)+"}"):e}function n(e){return i(e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+s(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+s(e)))}function a(e){return i(e.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,e=>"\\x0"+s(e)).replace(/[\x10-\x1F\x7F-\x9F]/g,e=>"\\x"+s(e)))}const o={literal:e=>'"'+n(e.text)+'"',class(e){const t=e.parts.map(e=>Array.isArray(e)?a(e[0])+"-"+a(e[1]):a(e));return"["+(e.inverted?"^":"")+t.join("")+"]"+(e.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:e=>e.description};function l(e){return o[e.type](e)}return"Expected "+function(e){const t=e.map(l);if(t.sort(),t.length>0){let e=1;for(let s=1;s<t.length;s++)t[s-1]!==t[s]&&(t[e]=t[s],e++);t.length=e}switch(t.length){case 1:return t[0];case 2:return t[0]+" or "+t[1];default:return t.slice(0,-1).join(", ")+", or "+t[t.length-1]}}(e)+" but "+function(e){return e?'"'+n(e)+'"':"end of input"}(t)+" found."}}const n=(e,t)=>{if("self"===t)return e[e.length-1];for(let s=e.length-1;s>=0;s--){const r=e[s];if(null!=r&&("object"==typeof r||"function"==typeof r)&&t in r)return r[t]}};class a{#s;#r;constructor(e,t){this.#s=e,this.#r=t}#i(e){return n(this.#r,e)}#n(e,t){const r=0===t?e.lhs:e.rhs[t-1];return r.type===s.symbol?r.value:r.type===s.member?r.rhs:null}#a;#o(){return this.#a||(this.#a=new Proxy(this.#r,{get:(e,t)=>this.#i(t)})),this.#a}[s.and](e){return this.visit(e.lhs)&&this.visit(e.rhs)}[s.or](e){return this.visit(e.lhs)||this.visit(e.rhs)}[s.nullc](e){const t=this.visit(e.lhs);return null!=t?t:this.visit(e.rhs)}[s.not](e){return!this.visit(e.expr)}[s.eq](e){const t=this.visit(e.lhs)===this.visit(e.rhs);return"=="===e.op?t:!t}[s.cmp](e){const t=this.visit(e.lhs),s=this.visit(e.rhs);switch(e.op){case">":return t>s;case"<":return t<s;case">=":return t>=s;case"<=":return t<=s;default:throw new Error(`unknown cmp op ${e.op}`)}}[s.call](e){const t=e.value,s=null===t.module?this.#s:this.#s?.[t.module];if(!s)throw new Error(`Module "${t.module}" not found`);const r=s[t.value];if(!r)throw new Error(`Function "#${null===t.module?"":`${t.module}:`}${t.value}" not found`);const i=e.args.map(e=>this.visit(e));return r.apply(this.#o(),i)}[s.literal](e){return e.value}[s.tstring](e){let t="";const s=e.parts;for(let e=0,r=s.length;e<r;e++){const r=this.visit(s[e]);null!=r&&(t+=r)}return t}[s.symbol](e){return this.#i(e.value)}[s.dict](e){return Object.fromEntries(e.value.map(e=>[this.visit(e[0]),this.visit(e[1])]))}[s.array](e){return e.value.map(e=>this.visit(e))}[s.ter](e){return this.visit(e.cond)?this.visit(e.ifTrue):this.visit(e.ifFalse)}[s.elv](e){return this.visit(e.cond)||this.visit(e.ifFalse)}[s.access](e){let t,r=this.visit(e.lhs);for(let i=0;i!==e.rhs.length;++i){const n=e.rhs[i];if(n.ns&&null==r)return;let a;switch(n.type){case s.member:a=r[n.rhs];break;case s.subscript:a=r[this.visit(n.rhs)];break;case s.method:{if(!r){const t=this.#n(e,i);throw new Error(null===t?"Method missing":`Method missing "${t}"`)}const s=n.args.map(e=>this.visit(e));a=r.apply(t,s);break}}t=r,r=a}return r}visit(e,...t){return this[e.type](e,...t)}visitRoot(e,t){return t?e.map(e=>{switch(e.type){case s.templated.tel:return{type:s.dom.t,value:e.value};case s.templated.tet:return{type:s.dom.t,value:this.visit(e.value)};case s.templated.teh:return{type:s.dom.h,value:this.visit(e.value)};case s.templated.ten:return{type:s.dom.n,value:this.visit(e.value)};default:throw new Error(`unknown node type ${e.type.toString()}`)}}):this.visit(e)}}class o{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static#l=new t(1e3);static parse(e,t){const n=t?.toString()+e;return this.#l.getOrCompute(n,()=>function(e,t){const n={},a=(t=void 0!==t?t:{}).grammarSource,o={TemplatedRoot:mt,ExpressionRoot:bt};let l=mt;const u="{{{{",c="}}}}",d="{{{",h="}}}",p="{{",f="}}",m="\\",g="{",b="?",v=":",y="?:",w="??",E="||",x="&&",A="!",S="?.",T=".",C="[",_="]",O="(",R=",",q=")",N="-",P="'",L='"',k="`",z="}",M="#",D="==",F="!=",I=">=",$=">",B="<=",j="<",H=/^[^\\{]/,W=/^[0-9]/,V=/^[^']/,U=/^[^"]/,G=/^[^\\`{]/,Q=/^[a-zA-Z$_]/,K=/^[a-zA-Z$_0-9]/,J=/^[ \t\n\r]/,X=ut("{{{{",!1),Y=ut("}}}}",!1),Z=ut("{{{",!1),ee=ut("}}}",!1),te=ut("{{",!1),se=ut("}}",!1),re=ct(["\\","{"],!0,!1,!1),ie=ut("\\",!1),ne={type:"any"},ae=ut("{",!1),oe=ut("?",!1),le=ut(":",!1),ue=ut("?:",!1),ce=ut("??",!1),de=ut("||",!1),he=ut("&&",!1),pe=ut("!",!1),fe=dt("member"),me=ut("?.",!1),ge=ut(".",!1),be=dt("subscript"),ve=ut("[",!1),ye=ut("]",!1),we=dt("method-call"),Ee=ut("(",!1),xe=ut(",",!1),Ae=ut(")",!1),Se=dt("module-function-call"),Te=dt("number-literal"),Ce=ut("-",!1),_e=ct([["0","9"]],!1,!1,!1),Oe=dt("string-literal"),Re=ut("'",!1),qe=ct(["'"],!0,!1,!1),Ne=ut('"',!1),Pe=ct(['"'],!0,!1,!1),Le=ut("`",!1),ke=dt("tstring-expression"),ze=ut("}",!1),Me=dt("tstring-literal"),De=ct(["\\","`","{"],!0,!1,!1),Fe=dt("array-literal"),Ie=dt("dict-literal"),$e=dt("module-function"),Be=ut("#",!1),je=ct([["a","z"],["A","Z"],"$","_"],!1,!1,!1),He=ct([["a","z"],["A","Z"],"$","_",["0","9"]],!1,!1,!1),We=dt("identifier-or-keyword"),Ve=ut("==",!1),Ue=ut("!=",!1),Ge=ut(">=",!1),Qe=ut(">",!1),Ke=ut("<=",!1),Je=ut("<",!1),Xe=ct([" ","\t","\n","\r"],!1,!1,!1);function Ye(e){return e}function Ze(e,t,s){return{op:t,rhs:s}}function et(e,t,s){return{op:t,rhs:s}}function tt(e){return e}let st=0|t.peg$currPos;const rt=[{line:1,column:1}];let it,nt=st,at=t.peg$maxFailExpected||[],ot=0|t.peg$silentFails,lt={};if(t.startRule){if(!(t.startRule in o))throw new Error("Can't start parsing from rule \""+t.startRule+'".');l=o[t.startRule]}function ut(e,t){return{type:"literal",text:e,ignoreCase:t}}function ct(e,t,s,r){return{type:"class",parts:e,inverted:t,ignoreCase:s,unicode:r}}function dt(e){return{type:"other",description:e}}function ht(t){let s,r=rt[t];if(r)return r;if(t>=rt.length)s=rt.length-1;else for(s=t;!rt[--s];);for(r=rt[s],r={line:r.line,column:r.column};s<t;)10===e.charCodeAt(s)?(r.line++,r.column=1):r.column++,s++;return rt[t]=r,r}function pt(e,t,s){const r=ht(e),i=ht(t);return{source:a,start:{offset:e,line:r.line,column:r.column},end:{offset:t,line:i.line,column:i.column}}}function ft(e){st<nt||(st>nt&&(nt=st,at=[]),at.push(e))}function mt(){let e,t;const s=38*st+0,r=lt[s];if(r)return st=r.nextPos,r.result;for(e=[],t=gt();t!==n;)e.push(t),t=gt();return lt[s]={nextPos:st,result:e},e}function gt(){let t,r,i,a,o;const l=38*st+1,b=lt[l];return b?(st=b.nextPos,b.result):(t=st,r=st,i=function(){let t;const s=38*st+2,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,4)===u?(t=u,st+=4):(t=n,0===ot&&ft(X)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+3,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,4)===c?(t=c,st+=4):(t=n,0===ot&&ft(Y)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(v=r,r={type:s.templated.ten,value:v}),t=r,t===n&&(t=st,r=st,i=function(){let t;const s=38*st+4,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,3)===d?(t=d,st+=3):(t=n,0===ot&&ft(Z)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+5,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,3)===h?(t=h,st+=3):(t=n,0===ot&&ft(ee)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(r=function(e){return{type:s.templated.teh,value:e}}(r)),t=r,t===n&&(t=st,r=st,i=function(){let t;const s=38*st+6,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===p?(t=p,st+=2):(t=n,0===ot&&ft(te)),lt[s]={nextPos:st,result:t},t)}(),i!==n?(a=bt(),a!==n?(o=function(){let t;const s=38*st+7,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===f?(t=f,st+=2):(t=n,0===ot&&ft(se)),lt[s]={nextPos:st,result:t},t)}(),o!==n?r=a:(st=r,r=n)):(st=r,r=n)):(st=r,r=n),r!==n&&(r=function(e){return{type:s.templated.tet,value:e}}(r)),t=r,t===n&&(t=st,r=function(){let t,s,r,i,a,o,l;const u=38*st+8,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,s=[],r=st,i=[],a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re)),a!==n)for(;a!==n;)i.push(a),a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re));else i=n;if(r=i!==n?e.substring(r,st):i,r===n&&(r=st,92===e.charCodeAt(st)?(i=m,st++):(i=n,0===ot&&ft(ie)),i!==n?(e.length>st?(a=e.charAt(st),st++):(a=n,0===ot&&ft(ne)),a!==n?r=a:(st=r,r=n)):(st=r,r=n),r===n&&(r=st,i=st,123===e.charCodeAt(st)?(a=g,st++):(a=n,0===ot&&ft(ae)),a!==n?(o=st,ot++,123===e.charCodeAt(st)?(l=g,st++):(l=n,0===ot&&ft(ae)),ot--,l===n?o=void 0:(st=o,o=n),o!==n?(a=[a,o],i=a):(st=i,i=n)):(st=i,i=n),r=i!==n?e.substring(r,st):i)),r!==n)for(;r!==n;){if(s.push(r),r=st,i=[],a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re)),a!==n)for(;a!==n;)i.push(a),a=e.charAt(st),H.test(a)?st++:(a=n,0===ot&&ft(re));else i=n;r=i!==n?e.substring(r,st):i,r===n&&(r=st,92===e.charCodeAt(st)?(i=m,st++):(i=n,0===ot&&ft(ie)),i!==n?(e.length>st?(a=e.charAt(st),st++):(a=n,0===ot&&ft(ne)),a!==n?r=Ye(a):(st=r,r=n)):(st=r,r=n),r===n&&(r=st,i=st,123===e.charCodeAt(st)?(a=g,st++):(a=n,0===ot&&ft(ae)),a!==n?(o=st,ot++,123===e.charCodeAt(st)?(l=g,st++):(l=n,0===ot&&ft(ae)),ot--,l===n?o=void 0:(st=o,o=n),o!==n?(a=[a,o],i=a):(st=i,i=n)):(st=i,i=n),r=i!==n?e.substring(r,st):i))}else s=n;return s!==n&&(s=s.join("")),t=s,lt[u]={nextPos:st,result:t},t}(),r!==n&&(r=function(e){return{type:s.templated.tel,value:e}}(r)),t=r))),lt[l]={nextPos:st,result:t},t);var v}function bt(){let e,t;const s=38*st+9,r=lt[s];return r?(st=r.nextPos,r.result):(e=st,kt(),t=vt(),t!==n?(kt(),e=t):(st=e,e=n),lt[s]={nextPos:st,result:e},e)}function vt(){let t,r,i,a,o,l;const u=38*st+10,c=lt[u];return c?(st=c.nextPos,c.result):(t=st,r=yt(),r!==n?(kt(),63===e.charCodeAt(st)?(i=b,st++):(i=n,0===ot&&ft(oe)),i!==n?(kt(),a=vt(),a!==n?(kt(),58===e.charCodeAt(st)?(o=v,st++):(o=n,0===ot&&ft(le)),o!==n?(kt(),l=vt(),l!==n?t={type:s.ter,cond:r,ifTrue:a,ifFalse:l}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=yt()),lt[u]={nextPos:st,result:t},t)}function yt(){let t,r,i,a;const o=38*st+11,l=lt[o];return l?(st=l.nextPos,l.result):(t=st,r=wt(),r!==n?(kt(),e.substr(st,2)===y?(i=y,st+=2):(i=n,0===ot&&ft(ue)),i!==n?(kt(),a=yt(),a!==n?t={type:s.elv,cond:r,ifFalse:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=wt()),lt[o]={nextPos:st,result:t},t)}function wt(){let t,r,i,a;const o=38*st+12,l=lt[o];return l?(st=l.nextPos,l.result):(t=st,r=Et(),r!==n?(kt(),e.substr(st,2)===w?(i=w,st+=2):(i=n,0===ot&&ft(ce)),i!==n?(kt(),a=wt(),a!==n?t={type:s.nullc,lhs:r,rhs:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=Et()),lt[o]={nextPos:st,result:t},t)}function Et(){let t,r,i,a,o,l;const u=38*st+13,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,r=xt(),r!==n){for(i=[],a=st,kt(),e.substr(st,2)===E?(o=E,st+=2):(o=n,0===ot&&ft(de)),o!==n?(kt(),l=xt(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);a!==n;)i.push(a),a=st,kt(),e.substr(st,2)===E?(o=E,st+=2):(o=n,0===ot&&ft(de)),o!==n?(kt(),l=xt(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);t=function(e,t){let r=e;for(const e of t)r={type:s.or,lhs:r,rhs:e};return r}(r,i)}else st=t,t=n;return lt[u]={nextPos:st,result:t},t}function xt(){let t,r,i,a,o,l;const u=38*st+14,c=lt[u];if(c)return st=c.nextPos,c.result;if(t=st,r=At(),r!==n){for(i=[],a=st,kt(),e.substr(st,2)===x?(o=x,st+=2):(o=n,0===ot&&ft(he)),o!==n?(kt(),l=At(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);a!==n;)i.push(a),a=st,kt(),e.substr(st,2)===x?(o=x,st+=2):(o=n,0===ot&&ft(he)),o!==n?(kt(),l=At(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);t=function(e,t){let r=e;for(const e of t)r={type:s.and,lhs:r,rhs:e};return r}(r,i)}else st=t,t=n;return lt[u]={nextPos:st,result:t},t}function At(){let e,t,r,i,a,o;const l=38*st+15,u=lt[l];if(u)return st=u.nextPos,u.result;if(e=st,t=St(),t!==n){for(r=[],i=st,kt(),a=Pt(),a!==n?(kt(),o=St(),o!==n?i=Ze(0,a,o):(st=i,i=n)):(st=i,i=n);i!==n;)r.push(i),i=st,kt(),a=Pt(),a!==n?(kt(),o=St(),o!==n?i=Ze(0,a,o):(st=i,i=n)):(st=i,i=n);e=function(e,t){let r=e;for(const e of t)r={type:s.eq,op:e.op,lhs:r,rhs:e.rhs};return r}(t,r)}else st=e,e=n;return lt[l]={nextPos:st,result:e},e}function St(){let e,t,r,i,a,o;const l=38*st+16,u=lt[l];if(u)return st=u.nextPos,u.result;if(e=st,t=Tt(),t!==n){for(r=[],i=st,kt(),a=Lt(),a!==n?(kt(),o=Tt(),o!==n?i=et(0,a,o):(st=i,i=n)):(st=i,i=n);i!==n;)r.push(i),i=st,kt(),a=Lt(),a!==n?(kt(),o=Tt(),o!==n?i=et(0,a,o):(st=i,i=n)):(st=i,i=n);e=function(e,t){let r=e;for(const e of t)r={type:s.cmp,op:e.op,lhs:r,rhs:e.rhs};return r}(t,r)}else st=e,e=n;return lt[l]={nextPos:st,result:e},e}function Tt(){let t,r,i;const a=38*st+17,o=lt[a];return o?(st=o.nextPos,o.result):(t=st,33===e.charCodeAt(st)?(r=A,st++):(r=n,0===ot&&ft(pe)),r!==n?(kt(),i=Tt(),i!==n?t={type:s.not,expr:i}:(st=t,t=n)):(st=t,t=n),t===n&&(t=function(){let e,t,r,i,a;const o=38*st+18,l=lt[o];if(l)return st=l.nextPos,l.result;if(e=st,t=_t(),t!==n){if(kt(),r=[],i=st,a=Ct(),a!==n?(kt(),i=a):(st=i,i=n),i!==n)for(;i!==n;)r.push(i),i=st,a=Ct(),a!==n?(kt(),i=a):(st=i,i=n);else r=n;r!==n?e={type:s.access,lhs:t,rhs:r}:(st=e,e=n)}else st=e,e=n;return e===n&&(e=_t()),lt[o]={nextPos:st,result:e},e}()),lt[a]={nextPos:st,result:t},t)}function Ct(){let t;const r=38*st+19,i=lt[r];return i?(st=i.nextPos,i.result):(t=function(){let t,r,i;const a=38*st+20,o=lt[a];return o?(st=o.nextPos,o.result):(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(46===e.charCodeAt(st)?(r=T,st++):(r=n,0===ot&&ft(ge))),r!==n?(kt(),i=Nt(),i!==n?t={type:s.member,ns:"?."===r,rhs:i}:(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft(fe)),lt[a]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let t,r,i,a,o;const l=38*st+21,u=lt[l];return u?(st=u.nextPos,u.result):(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(r=null),91===e.charCodeAt(st)?(i=C,st++):(i=n,0===ot&&ft(ve)),i!==n?(kt(),a=vt(),a!==n?(kt(),93===e.charCodeAt(st)?(o=_,st++):(o=n,0===ot&&ft(ye)),o!==n?t={type:s.subscript,ns:null!==r,rhs:a}:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft(be)),lt[l]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let t,r,i,a,o,l,u,c;const d=38*st+22,h=lt[d];if(h)return st=h.nextPos,h.result;if(ot++,t=st,e.substr(st,2)===S?(r=S,st+=2):(r=n,0===ot&&ft(me)),r===n&&(r=null),40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n){for(kt(),a=st,o=vt(),o!==n?(l=kt(),a=o):(st=a,a=n),a===n&&(a=null),o=[],l=st,44===e.charCodeAt(st)?(u=R,st++):(u=n,0===ot&&ft(xe)),u!==n?(kt(),c=vt(),c!==n?(kt(),l=c):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=R,st++):(u=n,0===ot&&ft(xe)),u!==n?(kt(),c=vt(),c!==n?(kt(),l=c):(st=l,l=n)):(st=l,l=n);41===e.charCodeAt(st)?(l=q,st++):(l=n,0===ot&&ft(Ae)),l!==n?t=function(e,t,r){return{type:s.method,ns:null!==e,args:null===t?[]:[t,...r]}}(r,a,o):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(we)),lt[d]={nextPos:st,result:t},t}())),lt[r]={nextPos:st,result:t},t)}function _t(){let t,i,a,o;const l=38*st+23,u=lt[l];return u?(st=u.nextPos,u.result):(t=st,40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n?(kt(),a=vt(),a!==n?(kt(),41===e.charCodeAt(st)?(o=q,st++):(o=n,0===ot&&ft(Ae)),o!==n?t=a:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),t===n&&(t=function(){let t,r,i,a,o,l,u,c;const d=38*st+24,h=lt[d];if(h)return st=h.nextPos,h.result;if(ot++,t=st,r=function(){let t,r,i,a,o;const l=38*st+32,u=lt[l];return u?(st=u.nextPos,u.result):(ot++,t=st,35===e.charCodeAt(st)?(r=M,st++):(r=n,0===ot&&ft(Be)),r!==n?(i=st,a=Nt(),a!==n?(58===e.charCodeAt(st)?(o=v,st++):(o=n,0===ot&&ft(le)),o!==n?i=a:(st=i,i=n)):(st=i,i=n),i===n&&(i=null),a=Nt(),a!==n?t={type:s.function,module:i,value:a}:(st=t,t=n)):(st=t,t=n),ot--,t===n&&(r=n,0===ot&&ft($e)),lt[l]={nextPos:st,result:t},t)}(),r!==n)if(40===e.charCodeAt(st)?(i=O,st++):(i=n,0===ot&&ft(Ee)),i!==n){for(kt(),a=st,o=vt(),o!==n?(l=kt(),a=o):(st=a,a=n),a===n&&(a=null),o=[],l=st,44===e.charCodeAt(st)?(u=R,st++):(u=n,0===ot&&ft(xe)),u!==n?(kt(),c=vt(),c!==n?(kt(),l=c):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=R,st++):(u=n,0===ot&&ft(xe)),u!==n?(kt(),c=vt(),c!==n?(kt(),l=c):(st=l,l=n)):(st=l,l=n);41===e.charCodeAt(st)?(l=q,st++):(l=n,0===ot&&ft(Ae)),l!==n?t=function(e,t,r){const i=null===t?[]:[t,...r];return{type:s.call,value:e,args:i}}(r,a,o):(st=t,t=n)}else st=t,t=n;else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(Se)),lt[d]={nextPos:st,result:t},t}(),t===n&&(t=function(){let t;const r=38*st+25,i=lt[r];return i?(st=i.nextPos,i.result):(t=function(){let t,r,i,a,o,l,u,c,d,h;const p=38*st+26,f=lt[p];if(f)return st=f.nextPos,f.result;if(ot++,t=st,r=st,i=st,45===e.charCodeAt(st)?(a=N,st++):(a=n,0===ot&&ft(Ce)),a===n&&(a=null),o=st,l=[],u=e.charAt(st),W.test(u)?st++:(u=n,0===ot&&ft(_e)),u!==n)for(;u!==n;)l.push(u),u=e.charAt(st),W.test(u)?st++:(u=n,0===ot&&ft(_e));else l=n;if(l!==n){if(u=st,46===e.charCodeAt(st)?(c=T,st++):(c=n,0===ot&&ft(ge)),c!==n){for(d=[],h=e.charAt(st),W.test(h)?st++:(h=n,0===ot&&ft(_e));h!==n;)d.push(h),h=e.charAt(st),W.test(h)?st++:(h=n,0===ot&&ft(_e));c=[c,d],u=c}else st=u,u=n;u===n&&(u=null),l=[l,u],o=l}else st=o,o=n;if(o===n)if(o=st,46===e.charCodeAt(st)?(l=T,st++):(l=n,0===ot&&ft(ge)),l!==n){if(u=[],c=e.charAt(st),W.test(c)?st++:(c=n,0===ot&&ft(_e)),c!==n)for(;c!==n;)u.push(c),c=e.charAt(st),W.test(c)?st++:(c=n,0===ot&&ft(_e));else u=n;u!==n?(l=[l,u],o=l):(st=o,o=n)}else st=o,o=n;return o!==n?(a=[a,o],i=a):(st=i,i=n),r=i!==n?e.substring(r,st):i,r!==n&&(r={type:s.literal,value:parseFloat(r)}),t=r,ot--,t===n&&(r=n,0===ot&&ft(Te)),lt[p]={nextPos:st,result:t},t}(),t===n&&(t=Ot(),t===n&&(t=function(){let t,r,i,a,o,l,u;const c=38*st+30,d=lt[c];if(d)return st=d.nextPos,d.result;if(ot++,t=st,91===e.charCodeAt(st)?(r=C,st++):(r=n,0===ot&&ft(ve)),r!==n){for(kt(),i=vt(),i===n&&(i=null),kt(),a=[],o=st,44===e.charCodeAt(st)?(l=R,st++):(l=n,0===ot&&ft(xe)),l!==n?(kt(),u=vt(),u!==n?(kt(),o=u):(st=o,o=n)):(st=o,o=n);o!==n;)a.push(o),o=st,44===e.charCodeAt(st)?(l=R,st++):(l=n,0===ot&&ft(xe)),l!==n?(kt(),u=vt(),u!==n?(kt(),o=u):(st=o,o=n)):(st=o,o=n);93===e.charCodeAt(st)?(o=_,st++):(o=n,0===ot&&ft(ye)),o!==n?t=function(e,t){const r=null===e?[]:[e,...t];return{type:s.array,value:r}}(i,a):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(Fe)),lt[c]={nextPos:st,result:t},t}(),t===n&&(t=function(){let t,r,i,a,o,l,u,c,d,h,p;const f=38*st+31,m=lt[f];if(m)return st=m.nextPos,m.result;if(ot++,t=st,123===e.charCodeAt(st)?(r=g,st++):(r=n,0===ot&&ft(ae)),r!==n){for(kt(),i=st,a=Ot(),a!==n?(o=kt(),58===e.charCodeAt(st)?(l=v,st++):(l=n,0===ot&&ft(le)),l!==n?(u=kt(),c=vt(),c!==n?i=[a,c]:(st=i,i=n)):(st=i,i=n)):(st=i,i=n),i===n&&(i=null),a=kt(),o=[],l=st,44===e.charCodeAt(st)?(u=R,st++):(u=n,0===ot&&ft(xe)),u!==n?(c=kt(),d=Ot(),d!==n?(kt(),58===e.charCodeAt(st)?(h=v,st++):(h=n,0===ot&&ft(le)),h!==n?(kt(),p=vt(),p!==n?(kt(),l=[d,p]):(st=l,l=n)):(st=l,l=n)):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=R,st++):(u=n,0===ot&&ft(xe)),u!==n?(c=kt(),d=Ot(),d!==n?(kt(),58===e.charCodeAt(st)?(h=v,st++):(h=n,0===ot&&ft(le)),h!==n?(kt(),p=vt(),p!==n?(kt(),l=[d,p]):(st=l,l=n)):(st=l,l=n)):(st=l,l=n)):(st=l,l=n);125===e.charCodeAt(st)?(l=z,st++):(l=n,0===ot&&ft(ze)),l!==n?t=function(e,t){var r=[];return null!==e&&r.push(e),r.push.apply(r,t),{type:s.dict,value:r}}(i,o):(st=t,t=n)}else st=t,t=n;return ot--,t===n&&(r=n,0===ot&&ft(Ie)),lt[f]={nextPos:st,result:t},t}()))),lt[r]={nextPos:st,result:t},t)}(),t===n&&(t=function(){let e,t;const i=38*st+34,a=lt[i];return a?(st=a.nextPos,a.result):(ot++,e=st,t=Nt(),t!==n&&(o=t,t=r.has(o)?{type:s.literal,value:r.get(o)}:{type:s.symbol,value:o}),e=t,ot--,e===n&&(t=n,0===ot&&ft(We)),lt[i]={nextPos:st,result:e},e);var o}()))),lt[l]={nextPos:st,result:t},t)}function Ot(){let t,r,i,a,o;const l=38*st+27,u=lt[l];if(u)return st=u.nextPos,u.result;if(ot++,t=st,39===e.charCodeAt(st)?(r=P,st++):(r=n,0===ot&&ft(Re)),r!==n){for(i=st,a=[],o=e.charAt(st),V.test(o)?st++:(o=n,0===ot&&ft(qe));o!==n;)a.push(o),o=e.charAt(st),V.test(o)?st++:(o=n,0===ot&&ft(qe));i=e.substring(i,st),39===e.charCodeAt(st)?(a=P,st++):(a=n,0===ot&&ft(Re)),a!==n?t={type:s.literal,value:i}:(st=t,t=n)}else st=t,t=n;if(t===n){if(t=st,34===e.charCodeAt(st)?(r=L,st++):(r=n,0===ot&&ft(Ne)),r!==n){for(i=st,a=[],o=e.charAt(st),U.test(o)?st++:(o=n,0===ot&&ft(Pe));o!==n;)a.push(o),o=e.charAt(st),U.test(o)?st++:(o=n,0===ot&&ft(Pe));i=e.substring(i,st),34===e.charCodeAt(st)?(a=L,st++):(a=n,0===ot&&ft(Ne)),a!==n?t={type:s.literal,value:i}:(st=t,t=n)}else st=t,t=n;if(t===n)if(t=st,96===e.charCodeAt(st)?(r=k,st++):(r=n,0===ot&&ft(Le)),r!==n){for(i=[],a=Rt(),a===n&&(a=qt());a!==n;)i.push(a),a=Rt(),a===n&&(a=qt());96===e.charCodeAt(st)?(a=k,st++):(a=n,0===ot&&ft(Le)),a!==n?t={type:s.tstring,parts:i}:(st=t,t=n)}else st=t,t=n}return ot--,t===n&&(r=n,0===ot&&ft(Oe)),lt[l]={nextPos:st,result:t},t}function Rt(){let t,s,r,i;const a=38*st+28,o=lt[a];return o?(st=o.nextPos,o.result):(ot++,t=st,123===e.charCodeAt(st)?(s=g,st++):(s=n,0===ot&&ft(ae)),s!==n?(kt(),r=vt(),r!==n?(kt(),125===e.charCodeAt(st)?(i=z,st++):(i=n,0===ot&&ft(ze)),i!==n?t=r:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),ot--,t===n&&(s=n,0===ot&&ft(ke)),lt[a]={nextPos:st,result:t},t)}function qt(){let t,r,i,a,o;const l=38*st+29,u=lt[l];if(u)return st=u.nextPos,u.result;if(ot++,t=st,r=[],i=st,a=[],o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(De)),o!==n)for(;o!==n;)a.push(o),o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(De));else a=n;if(i=a!==n?e.substring(i,st):a,i===n&&(i=st,92===e.charCodeAt(st)?(a=m,st++):(a=n,0===ot&&ft(ie)),a!==n?(e.length>st?(o=e.charAt(st),st++):(o=n,0===ot&&ft(ne)),o!==n?i=o:(st=i,i=n)):(st=i,i=n)),i!==n)for(;i!==n;){if(r.push(i),i=st,a=[],o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(De)),o!==n)for(;o!==n;)a.push(o),o=e.charAt(st),G.test(o)?st++:(o=n,0===ot&&ft(De));else a=n;i=a!==n?e.substring(i,st):a,i===n&&(i=st,92===e.charCodeAt(st)?(a=m,st++):(a=n,0===ot&&ft(ie)),a!==n?(e.length>st?(o=e.charAt(st),st++):(o=n,0===ot&&ft(ne)),o!==n?i=tt(o):(st=i,i=n)):(st=i,i=n))}else r=n;return r!==n&&(r={type:s.literal,value:r.join("")}),t=r,t===n&&(t=st,123===e.charCodeAt(st)?(r=g,st++):(r=n,0===ot&&ft(ae)),r!==n&&(r={type:s.literal,value:r}),t=r),ot--,t===n&&(r=n,0===ot&&ft(Me)),lt[l]={nextPos:st,result:t},t}function Nt(){let t,s,r,i,a;const o=38*st+33,l=lt[o];if(l)return st=l.nextPos,l.result;if(t=st,s=st,r=e.charAt(st),Q.test(r)?st++:(r=n,0===ot&&ft(je)),r!==n){for(i=[],a=e.charAt(st),K.test(a)?st++:(a=n,0===ot&&ft(He));a!==n;)i.push(a),a=e.charAt(st),K.test(a)?st++:(a=n,0===ot&&ft(He));r=[r,i],s=r}else st=s,s=n;return t=s!==n?e.substring(t,st):s,lt[o]={nextPos:st,result:t},t}function Pt(){let t;const s=38*st+35,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===D?(t=D,st+=2):(t=n,0===ot&&ft(Ve)),t===n&&(e.substr(st,2)===F?(t=F,st+=2):(t=n,0===ot&&ft(Ue))),lt[s]={nextPos:st,result:t},t)}function Lt(){let t;const s=38*st+36,r=lt[s];return r?(st=r.nextPos,r.result):(e.substr(st,2)===I?(t=I,st+=2):(t=n,0===ot&&ft(Ge)),t===n&&(62===e.charCodeAt(st)?(t=$,st++):(t=n,0===ot&&ft(Qe)),t===n&&(e.substr(st,2)===B?(t=B,st+=2):(t=n,0===ot&&ft(Ke)),t===n&&(60===e.charCodeAt(st)?(t=j,st++):(t=n,0===ot&&ft(Je))))),lt[s]={nextPos:st,result:t},t)}function kt(){let t,s;const r=38*st+37,i=lt[r];if(i)return st=i.nextPos,i.result;for(ot++,t=[],s=e.charAt(st),J.test(s)?st++:(s=n,0===ot&&ft(Xe));s!==n;)t.push(s),s=e.charAt(st),J.test(s)?st++:(s=n,0===ot&&ft(Xe));return ot--,lt[r]={nextPos:st,result:t},t}it=l();const zt=it!==n&&st===e.length;function Mt(){throw it!==n&&st<e.length&&ft({type:"end"}),t=at,s=nt<e.length?function(t=st){const s=e.codePointAt(t);return void 0===s?"":String.fromCodePoint(s)}(nt):null,r=nt<e.length?pt(nt,nt+1):pt(nt,nt),new i(i.buildMessage(t,s),t,s,r);var t,s,r}return t.peg$library?{peg$result:it,peg$currPos:st,peg$FAILED:n,peg$maxFailExpected:at,peg$maxFailPos:nt,peg$success:zt,peg$throw:zt?void 0:Mt}:zt?it:void Mt()}(e,{startRule:t===o.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}static evaluate(e,t,s,r){return new a(e,t).visitRoot(s,r===o.MODE_TEMPLATED)}static interpret(e,t,s,r){return o.evaluate(e,t,o.parse(s,r),r)}}class l{#s;#r;constructor(e,t){this.#s=e,this.#r=t}withModule(e,t){const s=e?{[e]:t}:t;return new l({...this.#s,...s},this.#r)}withOverlay(...e){return new l(this.#s,0===e.length?this.#r:[...this.#r,...e])}resolve(e){return n(this.#r,e)}evaluateExpression(e){return o.interpret(this.#s,this.#r,e,o.MODE_EXPRESSION)}evaluateTemplated(e){return o.interpret(this.#s,this.#r,e,o.MODE_TEMPLATED)}}class u{static fromHtml(...e){const t=document.createElement("template");return t.innerHTML=e.map(e=>e.trim()).join(""),document.adoptNode(t.content)}static toHtml(e){var t=document.createElement("template");return t.content.appendChild(e),t.innerHTML}static isBlank(e){return 0===e.childElementCount&&""===e.textContent.trim()}static from(...e){const t=new DocumentFragment;for(const s of e)t.appendChild(s);return t}static fromChildNodes(e){const t=new DocumentFragment;for(;e.firstChild;)t.appendChild(e.firstChild);return t}}class c{static id=0;static uid(e){return`${e}-${++c.id}`}static defaultValue(e,t,s){return e.hasAttribute(t)||e.setAttribute(t,s),e.getAttribute(t)}static forward(e,t,s){t.getAttributeNames().filter(t=>t.startsWith(e)).forEach(r=>{const i=r.substring(e.length);if("class"===i){const r=t.getAttribute(`${e}class`)?.split(/\s+/).filter(e=>e.length)??[];return void s.classList.add(...r)}s.setAttribute(i,t.getAttribute(r))})}static set(e,t,s){null==s?e.removeAttribute(t):e.setAttribute(t,s)}}class d{static from(e){for(const t of e.children)t.matches('[slot=""]')&&t.removeAttribute("slot");const t=Array.from(e.children).filter(e=>e.matches("[slot]")).map(e=>{e.remove();const t=e.getAttribute("slot");return e.removeAttribute("slot"),[t,d.slotFromNode(e)]}),s={};s.default=new DocumentFragment,s.default.append(...e.childNodes);for(const[e,r]of t)e in s||(s[e]=new DocumentFragment),s[e].append(r);return s}static slotFromNode(e){return e instanceof HTMLTemplateElement?document.adoptNode(e.content):e instanceof HTMLScriptElement&&"text/html"===e.type?u.fromHtml(e.innerHTML):e}}class h{static isParsed(e){for(let t=e;t;t=t.parentNode)if(t.nextSibling)return!0;return!1}static waitDomContentLoaded(e){if("loading"===e.readyState)return new Promise(t=>{e.addEventListener("DOMContentLoaded",()=>t(void 0),{once:!0})});if("complete"===e.readyState)return Promise.resolve();const t=e.defaultView;return null===t?Promise.resolve():new Promise(e=>{const s=()=>{t.removeEventListener("DOMContentLoaded",s),t.removeEventListener("load",s),e(void 0)};t.addEventListener("DOMContentLoaded",s),t.addEventListener("load",s)})}static waitParsed(e){return h.isParsed(e)?Promise.resolve(e):new Promise(t=>{const s=new MutationObserver(()=>{h.isParsed(e)&&(s.disconnect(),t(e))});for(let t=e.parentNode;t;t=t.parentNode)s.observe(t,{childList:!0});h.waitDomContentLoaded(e.ownerDocument).then(()=>{s.disconnect(),t(e)})})}static queryChildren(e,t){for(const s of e.children)if(s.matches(t))return s;return null}static queryChildrenAll(e,t){const s=[];for(const r of e.children)r.matches(t)&&s.push(r);return s}}class p{#u=new Set;removed(e){return this.#u.has(e)}remove(e){e.replaceChildren?.(),Object.keys(e.dataset||{}).filter(e=>e.startsWith("tpl")).forEach(t=>{delete e.dataset[t]}),this.#u.add(e)}popData(e,t){const s=e.dataset[t];return delete e.dataset[t],s}prepend(e,t){e.parentNode.insertBefore(t,e)}append(e,t){e.parentNode.insertBefore(t,e.nextSibling)}replace(e,t){this.prepend(e,t),this.remove(e)}cleanup(){for(const e of this.#u)e.remove();this.#u.clear()}}class f{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplRemove","tplVerbatim"];static tplIf(e,t,s,r){r.evaluateExpression(t)||s.remove(e)}static tplWith(e,t,s,r){const i=r.evaluateExpression(t),n=s.popData(e,"tplVar"),a=new b(e,r).withOverlay(n?{[n]:i}:i).render();s.replace(e,a)}static tplEach(e,t,s,r){const i=s.popData(e,"tplVar"),n=s.popData(e,"tplStat"),a=new b(e,r),o=r.evaluateExpression(t),l=null===o||"object"!=typeof o?void 0:Object.getPrototypeOf(o),u=o instanceof Map?[...o]:o?.[Symbol.iterator]||l!==Object.prototype&&null!==l?null:Object.entries(o),c=null===u?o:u.map(([e,t])=>({key:e,value:t}));if(!c?.[Symbol.iterator])throw new Error(`Expected an iterable got '${o}'`);if(!n){for(const t of c)s.prepend(e,a.withOverlay(i?{[i]:t}:t).render());return void s.remove(e)}const d=Array.isArray(c)||"number"==typeof c.length?c.length:"number"==typeof c.size?c.size:null;let h=0;for(const t of c){const r={index:h,count:h+1,size:d,first:0===h,last:null===d?null:h===d-1,even:h%2==0,odd:h%2==1};s.prepend(e,a.withOverlay({[n]:r},i?{[i]:t}:t).render()),++h}s.remove(e)}static tplWhen(e,t,s,r){r.evaluateExpression(t)||s.remove(e)}static tplVerbatim(e,t,s,r){const i=e.cloneNode(!0);s.replace(e,i)}static tplRemove(e,t,s,r){switch(t.toLowerCase()){case"tag":{const t=new DocumentFragment;for(;e.firstChild;)t.appendChild(e.firstChild);"tplVerbatim"in e.dataset?(s.popData(e,"tplVerbatim"),s.replace(e,t)):(s.append(e,t),s.remove(e));break}case"body":e.replaceChildren();break;case"all":s.remove(e)}}static tplClassAppend(e,t,s,r){const i=r.evaluateExpression(t);if(!i)return;const n=(Array.isArray(i)?i:[i]).flatMap(e=>"string"==typeof e?e.split(" "):e).filter(Boolean);0!==n.length&&e.classList.add(...n)}static tplAttrAppend(e,t,s,r){const i=r.evaluateExpression(t);i&&0!==i.length&&(Array.isArray(i[0])?i:[i]).forEach(([t,s])=>{e.setAttribute(t,s)})}static textNode(e,t,r,i){for(const n of i.evaluateTemplated(t))if(null!=n.value)switch(n.type){case s.dom.t:r.prepend(e,document.createTextNode(n.value));break;case s.dom.h:r.prepend(e,u.fromHtml("string"==typeof n.value?n.value:String(n.value)));break;case s.dom.n:if(!(n.value instanceof Node))throw new TypeError(`Expected a Node, got '${typeof n.value}'`);r.prepend(e,n.value)}r.remove(e)}}const m=new t(1e3);function g(e){return m.getOrCompute(e,e=>e.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase())}class b{static fromHtml(e,t,...s){return new b(u.fromHtml(e),new l(t,s))}static fromSelector(e,t,...s){const r=document.querySelector(e);if(!(r instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");const i=document.adoptNode(r.content);return new b(i,new l(t,s))}static fromTemplate(e,t,...s){const r=document.adoptNode(e.content);return new b(r,new l(t,s))}static fromFragment(e,t,...s){return new b(e,new l(t,s))}#c;#d;constructor(e,t){this.#c=e,this.#d=t}withEvaluator(e){return new b(this.#c,e)}withFragment(e){return new b(e,this.#d)}withModule(e,t){return new b(this.#c,this.#d.withModule(e,t))}withOverlay(...e){return new b(this.#c,this.#d.withOverlay(...e))}evaluateExpression(e,...t){return this.#d.withOverlay(...t).evaluateExpression(e)}evaluateTemplated(e,...t){return this.#d.withOverlay(...t).evaluateTemplated(e)}evaluator(){return this.#d}render(){try{const e=new p,t=document.importNode(this.#c,!0),s=t.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t:(()=>{const e=new DocumentFragment;return e.appendChild(t),e})(),r=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,b.#h);let i;for(;null!==(i=r.nextNode());){if(e.cleanup(),i.nodeType===Node.TEXT_NODE){try{f.textNode(i,i.nodeValue,e,this.#d)}catch(e){throw v.wrap("Error evaluating text node",i,e)}continue}const t=i;for(const s of f.ORDERED_COMMANDS){if(!(s in t.dataset))continue;const r=e.popData(t,s);try{f[s](t,r,e,this.#d)}catch(e){throw v.wrap(`Error evaluating data-tpl-${g(s)}="${r}"`,t,e)}if(e.removed(t))break}for(const s of Object.keys(t.dataset||{})){if(!s.startsWith("tpl"))continue;const r=g(s),i=e.popData(t,s);try{const e=this.#d.evaluateExpression(i);if("boolean"==typeof e){t.toggleAttribute(r,e);continue}null!=e&&t.setAttribute(r,e)}catch(e){throw v.wrap(`Error evaluating data-tpl-${g(s)}="${i}"`,t,e)}}}return e.cleanup(),s}catch(e){if(e instanceof v)throw e;throw new v("Error rendering template",this.#c,e)}}renderTo(e){e.replaceChildren(this.render())}appendTo(e){e.appendChild(this.render())}renderToSelector(e){const t=document.querySelector(e);t&&this.renderTo(t)}appendToSelector(e){const t=document.querySelector(e);t&&this.appendTo(t)}static#h(e){if(e.nodeType===Node.TEXT_NODE)return e.nodeValue.includes("{{")&&e.nodeValue.includes("}}")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT;for(const t of e.attributes)if(t.name.startsWith("data-tpl-"))return NodeFilter.FILTER_ACCEPT;return NodeFilter.FILTER_SKIP}}class v extends Error{static FRAMES=3;#p;#f;truncated=!1;static wrap(e,t,s){return s instanceof v&&s.depth>=v.FRAMES?(s.truncated=!0,s):new v(e,t,s)}constructor(e,t,s){super(`${e} in \`${v.describe(t)}\``,{cause:s}),this.name="RenderError",this.#p=t,this.#f=(s instanceof v?s.depth:0)+1}get depth(){return this.#f}get node(){return this.#p}get html(){return v.stringify(this.#p)}static describe(e){if(e.nodeType===Node.TEXT_NODE)return v.#m(String(e.nodeValue).trim());if(e.nodeType===Node.ELEMENT_NODE){const t=e,s=Array.from(t.attributes,e=>` ${e.name}="${e.value}"`).join("");return v.#m(`<${t.localName}${s}>`)}const t=Array.from(e.childNodes).filter(e=>e.nodeType===Node.ELEMENT_NODE||String(e.nodeValue??"").trim().length>0).map(e=>v.describe(e));return v.#m(t.join(""))}static#m(e){return e.length>120?`${e.slice(0,120)}…`:e}static stringify(e){const t=document.createElement("template");return t.content.appendChild(v.#g(e.cloneNode(!0))),t.innerHTML}static#g(e){e.nodeType===Node.TEXT_NODE&&(e.nodeValue=e.nodeValue.trim());for(let t=0;t<e.childNodes.length;t++){const s=e.childNodes[t];s.nodeType===Node.TEXT_NODE?(s.nodeValue=s.nodeValue.trim(),0===s.nodeValue.length&&(e.removeChild(s),t--)):s.nodeType===Node.ELEMENT_NODE&&v.#g(s)}return e}}class y{#b=new Map;#v;#y=new Promise(e=>{this.#v=e});constructor(){h.waitDomContentLoaded(document).then(()=>{this.#w()})}ready(){return this.#y}async#w(){await this.settled(),document.dispatchEvent(new CustomEvent("ftl:ready",{bubbles:!1,cancelable:!1})),this.#v()}enqueue(e){if(this.#b.has(e))return;const{promise:t,resolve:s}=Promise.withResolvers(),r=h.waitParsed(e).then(()=>e.upgrade()).finally(()=>{this.#b.delete(e),s()});this.#b.set(e,{upgrade:r,finished:t})}async#E(e,t){for(;;){const s=Array.from(this.#b).filter(([t])=>e(t)).map(([,e])=>t(e));if(0===s.length)return;await Promise.all(s)}}settled(){return this.#E(()=>!0,e=>e.finished)}upgraded(e){return this.#E(e,e=>e.upgrade)}whenUpgraded(e){return this.#b.get(e)?.upgrade}pending(){return Array.from(this.#b.keys())}}class w{#x={};#A=!1;#S={string:{unmarshal:(e,t,s)=>e,marshal:(e,t,s)=>null==e?null:String(e)},number:{unmarshal:(e,t,s)=>null===e?null:Number(e),marshal:(e,t,s)=>null==e?null:String(e)},presence:{unmarshal:(e,t,s)=>null!==e,marshal:(e,t,s)=>e?"":null},bool:{unmarshal:(e,t,s)=>"true"===e,marshal:(e,t,s)=>null==e?null:String(!0===e)},json:{unmarshal:(e,t,s)=>null===e?null:JSON.parse(e),marshal:(e,t,s)=>null==e?null:JSON.stringify(e)},csv:{unmarshal:(e,t,s)=>null===e?[]:e.split(",").map(e=>e.trim()).filter(e=>e),marshal:(e,t,s)=>null==e?null:e.join(",")}};#T={};#s;#C=[];#d=new l(void 0,[]);#_=new y;defineElement(e,t){return this.#A?(this.#O(e,t),this):(this.#x[e]=t,this)}static declarationsOf(e){const t=[];for(let s=e;null!==s&&s!==HTMLElement;s=Object.getPrototypeOf(s))t.unshift(s);const s=e=>t.flatMap(t=>Object.getOwnPropertyDescriptor(t,e)?.value??[]);return{observed:s("observed"),attributes:s("attributes")}}static propertyOf(e){return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}#O(e,t){const{observed:s,attributes:r}=w.declarationsOf(t),{template:i,templates:n,slots:a,mappers:o,config:l}=t,u=s.map(e=>e.split(":")[0]),c=[...new Set(u.reverse())].reverse(),d=[...r,...s].reduce((e,t)=>{const[s,r]=t.split(":"),i=r??"string";if(!(i in this.#S)&&!(i in(o??{})))throw new Error(`unsupported attribute type: ${i}`);return e[s]=o?.[i]??this.#S[i],e},{}),h=Object.entries(Object.assign({},n,i?{default:i}:{})).map(([e,t])=>[e,b.fromHtml(t)]),p=Object.fromEntries(h);t.BITS={registry:this,enqueue:e=>this.#_.enqueue(e),SLOTS:a,CONFIG:l,OBSERVED:c,DECLARED:[...new Set([...c,...r.map(e=>e.split(":")[0])])],ATTR_TO_MAPPER:d,ATTR_TO_PROPERTY:Object.fromEntries(c.map(e=>[e,w.propertyOf(e)])),TEMPLATES:p},customElements.define(e,t)}defineModule(e,t){const s=e?{[e]:t}:t;return this.#s={...this.#s,...s},this.#R(),this}defineModules(e){return this.#s=e,this.#R(),this}defineComponent(e,t){return this.#T[e]=t,this}defineData(...e){return this.#C=e,this.#R(),this}defineOverlay(...e){return this.#C=[...this.#C,...e],this.#R(),this}defineMapper(e,t){return this.#S[e]=t,this}plugin(e){return e.configure(this),this}configure(){for(const[e,t]of Object.entries(this.#x))this.#O(e,t),delete this.#x[e];return this.#A=!0,this}settle(e){return this.#_.upgraded(e)}whenUpgraded(e){return this.#_.whenUpgraded(e)}pending(){return this.#_.pending()}ready(){return this.#_.ready()}#R(){this.#d=new l(this.#s,this.#C)}evaluator(){return this.#d}component(e){return this.#T[e]}}const E=new w;class x{static fromHtml(e){return b.fromHtml(e).withEvaluator(E.evaluator())}static fromSelector(e){return b.fromSelector(e).withEvaluator(E.evaluator())}static fromTemplate(e){return b.fromTemplate(e).withEvaluator(E.evaluator())}static fromFragment(e){return b.fromFragment(e).withEvaluator(E.evaluator())}}class A{static waitFor(e){return E.settle(t=>e.contains(t))}static waitForChildren(e){return E.settle(t=>e!==t&&e.contains(t))}}class S extends HTMLElement{static BITS={registry:E,enqueue:e=>{},SLOTS:!1,CONFIG:void 0,OBSERVED:[],DECLARED:[],ATTR_TO_MAPPER:{},ATTR_TO_PROPERTY:{},TEMPLATES:{}};static get observedAttributes(){return this.BITS.OBSERVED}constructor(){super(),this.internals=this.attachInternals()}internals;#q=!1;#N=!1;#P=new Set;#L=null;#k={};#z(){return this.constructor.BITS}#M(e){const t=this.#z().ATTR_TO_MAPPER[e];if(!t)throw new Error(`${this.constructor.name} declares no attribute '${e}': declare it in static observed or static attributes, or read it with getAttribute`);return t}unmarshal(e,t){return this.#M(e).unmarshal(t,e,this)}marshal(e,t){return this.#M(e).marshal(t,e,this)}get _registry(){return this.#z().registry}component(e){return this.#z().registry.component(e)}template(e){const t=this.#z().TEMPLATES[e??"default"];if(!t)throw new Error(`no template named '${e??"default"}' on ${this.constructor.name}`);const s=t.withEvaluator(this.#z().registry.evaluator()),r=this.#z().CONFIG;return r?s.withOverlay({config:r}):s}connectedCallback(){this.#N||this.#z().enqueue(this)}attributeChangedCallback(e,t,s){t!==s&&(this.#P.has(e)||(this.#q?this[this.#z().ATTR_TO_PROPERTY[e]]=this.unmarshal(e,s):null!==this.#L&&e in this.#L&&(this.#L[e]=this.unmarshal(e,s))))}async upgrade(){if(this.#N)return;this.#N=!0;const e=this.#z().SLOTS?d.from(this):void 0,t=Object.fromEntries(this.#z().DECLARED.map(e=>[e,this.unmarshal(e,this.getAttribute(e))])),s=new Set(this.#z().OBSERVED);this.#k=Object.fromEntries(Object.entries(t).filter(([e])=>!s.has(e))),this.#L=t;try{await this.render({slots:e});const s=this.#z().ATTR_TO_PROPERTY;for(const e of this.#z().OBSERVED)this[s[e]]=t[e];this.#q=!0,this.internals.states.add("rendered")}finally{this.#L=null}}render(e){}declared(e){return e in this.#k?this.#k[e]:null!==this.#L&&e in this.#L?this.#L[e]:this.unmarshal(e,this.getAttribute(e))}get rendered(){return this.#q}reflectTo(e,t){const s=this.marshal(e,t);if(s!==this.getAttribute(e)){this.#P.add(e);try{c.set(this,e,s)}finally{this.#P.delete(e)}}}}const T=/\{(\w+)\}/g,C=/\{(\d+)\}/g,_=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),O=new Set,R=e=>{O.has(e)||(O.add(e),console.warn(`l10n: ${e}`))},q=new t(100),N=(e,t,s)=>{const r=`${e.name}|${t??""}|${void 0===s?"":JSON.stringify(s)}`;return q.getOrCompute(r,()=>new e(t,s))};class P{static t(e,...t){let s=(this.l10n??{})[e];if(void 0===s)return R(`missing message "${e}"`),e;if(_(s)){const r=1===t.length&&_(t[0])?t[0]:{};if("number"!=typeof r.count)R(`plural message "${e}" needs a numeric {count}`),s=s.other;else{const e=this.locale??navigator?.language??"en";s=s[N(Intl.PluralRules,e).select(r.count)]??s.other}}if(void 0===s||"object"==typeof s)return R(`plural message "${e}" has no "other" form`),e;if(1===t.length&&_(t[0])){const r=t[0];return s.replace(T,(t,s)=>s in r?String(r[s]):(R(`message "${e}" wants {${s}}`),t))}return t.length>0?s.replace(C,(s,r)=>{const i=Number(r);return i>=t.length?(R(`message "${e}" wants {${r}}`),s):String(t[i])}):s}static date(e,t){return N(Intl.DateTimeFormat,this.locale,t).format(e)}static number(e,t){return N(Intl.NumberFormat,this.locale,t).format(e)}static bytes(e){const t=N(Intl.NumberFormat,this.locale,{maximumFractionDigits:2}).format;return e>=1073741824?`${t(e/1024/1024/1024)}GiB`:e>=1048576?`${t(e/1024/1024)}MiB`:e>=1024?`${t(e/1024)}KiB`:`${t(e)}B`}static of(e={}){const t=e=>E.evaluator().resolve(e),s=s=>(...r)=>s.apply({l10n:t("l10n"),locale:e.locale??t("locale")},r);return{t:s(P.t),date:s(P.date),number:s(P.number),bytes:s(P.bytes)}}}var L=Object.freeze({__proto__:null,Attributes:c,BoundedCache:t,ExpressionEvaluator:l,Expressions:o,Fragments:u,LightSlots:d,Localization:P,Nodes:h,ParsedElement:S,Registry:w,RenderError:v,Rendering:A,Template:b,Templates:x,registry:E});class k extends Error{constructor(e,t,s){super(e,{cause:s}),this.name="Failure",this.problems=t}dropping(e){return new k(this.message,k.dropProblemsContext(this.problems,e),this)}static dropProblemsContext(e,t){return e.map(({type:e,context:s,reason:r,details:i})=>({type:e,context:s?.startsWith(t)?s.substring(t.length):s,reason:r,details:i}))}static problemsText(e,t=null){return e?.problems?.length?e.problems.map(e=>`${e.reason}`).join("\n"):t??`${e?.message??e}`}}class z{static encode(e,t){const s=t||z.URL_SAFE,r=e.byteLength,i=new Uint8Array(e);let n="";for(let e=0;e<r;e+=3)n+=s[i[e]>>2]+s[(3&i[e])<<4|i[e+1]>>4]+s[(15&i[e+1])<<2|i[e+2]>>6]+s[63&i[e+2]];return r%3==2?n=n.substring(0,n.length-1):r%3==1&&(n=n.substring(0,n.length-2)),n}static decode(e,t){const s=t||z.URL_SAFE;let r=e.length;for(;r>0&&"="===e.charAt(r-1);)--r;const i=e.substring(0,r);if(e.length-r>2||i.includes("=")||0===i.length&&e.length>0)throw new Error("invalid padding");if(i.length%4==1)throw new Error("invalid length");for(const e of i)if(-1===s.indexOf(e))throw new Error(`invalid character '${e}'`);const n=Math.floor(.75*i.length),a=new Uint8Array(n);let o=0,l=0;for(;o<n;){const e=s.indexOf(i.charAt(l++)),t=s.indexOf(i.charAt(l++)),r=s.indexOf(i.charAt(l++)),u=s.indexOf(i.charAt(l++));if(a[o++]=e<<2|t>>4,o===n)break;if(a[o++]=(15&t)<<4|r>>2,o===n)break;a[o++]=(3&r)<<6|u}return a.buffer}}z.STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",z.URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";class M{static decode(e){if(e.length%2!=0)throw new Error("invalid length");if(!/^[0-9a-fA-F]*$/.test(e))throw new Error("invalid character");const t=e.length/2;return new Uint8Array(t).map((t,s)=>{const r=2*s,i=e.substring(r,r+2);return parseInt(i,16)})}static encode(e,t){return Array.from(e).map(e=>e.toString(16)).map(e=>t?e.toUpperCase():e).map(e=>e.padStart(2,"0")).join("")}}class D{#D;#F;constructor(e,t){this.#D=e,this.#F=t}get normalized(){return`${this.#D}/${this.#F}`}get type(){return this.#D}get subtype(){return this.#F}static parse(e){if(!e)return new D("unknown","unknown");const[t,s]=e.split(";"),[r,i]=t.trim().toLowerCase().split("/");return r&&i?new D(r,i):new D("unknown","unknown")}}class F extends k{constructor(e,t,s,r){super(e,s,r),this.name="HttpClientError",this.status=t}dropping(e){return new F(this.message,this.status,k.dropProblemsContext(this.problems,e),this)}static problem(e,t){return{type:e,context:null,reason:t,details:null}}static of(e,t){const s=String(t?.message??t??"unknown failure");return new F(s,0,[F.problem(e,s)],t)}static async fromResponse(e){switch(D.parse(e.headers.get("Content-Type")).normalized){case"application/failures+json":{const t=await e.json().catch(()=>F.#I);if(t===F.#I)return F.#$(e);if(!Array.isArray(t))return F.#$(e,"as a failures array");const s=`${e.status} ${e.statusText}: ${t.length} failures`;return new F(s,e.status,t)}case"application/problem+json":{const t=await e.json().catch(()=>F.#I);if(t===F.#I)return F.#$(e);if("object"!=typeof t||null===t||Array.isArray(t))return F.#$(e,"as a problem object");const s=`${e.status} ${e.statusText}: ${t.title} ${t.detail}`;return new F(s,e.status,t.problems||[F.problem("GENERIC_PROBLEM",s)])}default:return F.#B(e)}}static#I=Symbol("unreadable body");static#$(e,t="as json"){const s=D.parse(e.headers.get("Content-Type")).normalized,r=`${e.status} ${e.statusText}: the ${s} body does not decode ${t}`;return new F(r,e.status,[F.problem("GENERIC_PROBLEM",r)])}static async#B(e){const t=await e.text().catch(()=>null),s=null===t?`${e.status} ${e.statusText}: the body could not be read`:`${e.status} ${e.statusText}: ${t}`;return new F(s,e.status,[F.problem("GENERIC_PROBLEM",s)])}}const I=e=>globalThis.document?.querySelector(`meta[name="${e}"]`)?.getAttribute("content")??void 0;class ${async intercept(e,t,s){if(e.origin!==(globalThis.window?.location?.origin??e.origin))return await s.proceed(e,t);const r=I("_csrf_header"),i=I("_csrf");return r&&i&&t.headers.set(r,i),await s.proceed(e,t)}}class B{#j;constructor(e){this.#j=e}async intercept(e,t,s){const r=await s.proceed(e,t);return 401===r.status?(window.location.href=this.#j,new Promise(()=>{})):r}}class j{#H;constructor(){this.#H=[]}withCsrfToken(){return this.#H.push(new $),this}withRedirectOnUnauthorized(e){return this.#H.push(new B(e)),this}withInterceptors(...e){return this.#H.push(...e),this}build(){return new V(this.#H)}}class H{async intercept(e,t,s){try{return await fetch(e,t)}catch(e){throw F.of("CONNECTION_PROBLEM",e)}}}class W{#H;#W;constructor(e,t){this.#H=e,this.#W=t}async proceed(e,t){const s=this.#H[this.#W];return await s.intercept(e,t,new W(this.#H,this.#W+1))}}class V{#H;static builder(){return new j}constructor(e){this.#H=e||[]}async exchange(e,t,s){const r=[...this.#H,...s||[],new H],i=new W(r,0),n=new URL(new Request(e).url),a={...t,headers:new Headers(t?.headers)};return await i.proceed(n,a)}request(e,t){return Q.create(this,e,t)}get(e){return Q.create(this,"GET",e)}head(e){return Q.create(this,"HEAD",e)}post(e){return Q.create(this,"POST",e)}put(e){return Q.create(this,"PUT",e)}patch(e){return Q.create(this,"PATCH",e)}delete(e){return Q.create(this,"DELETE",e)}}const U=async(e,t)=>{try{return await e[t]()}catch(e){throw F.of("UNMARSHALING_PROBLEM",e)}},G=e=>null==e?[]:"string"==typeof e?new URLSearchParams(e):"function"==typeof e[Symbol.iterator]?e:Object.entries(e);class Q{#V;#U;#G;#Q;#K;#J;#X;#H;#c;static create(e,t,s){const r=s.indexOf("#"),i=-1===r?"":s.slice(r),n=-1===r?s:s.slice(0,r),a=n.indexOf("?");return new Q(e,t,-1===a?n:n.slice(0,a),new URLSearchParams(-1===a?"":n.slice(a+1)),new Headers,void 0,{},[],i)}constructor(e,t,s,r,i,n,a,o,l=""){this.#V=e,this.#U=t,this.#G=s,this.#Q=r,this.#J=n,this.#K=i,this.#X=a,this.#H=o,this.#c=l}headers(e){for(const[t,s]of G(e))null==s?this.#K.delete(t):this.#K.set(t,s);return this}header(e,t){return null==t?this.#K.delete(e):this.#K.set(e,t),this}params(e){for(const[t,s]of G(e))null==s?this.#Q.delete(t):this.#Q.set(t,s);return this}param(e,...t){this.#Q.delete(e);const s=t.filter(e=>null!=e);if(0===s.length)return this;for(const t of s)this.#Q.append(e,t);return this}body(e){return this.#J=e,this}json(e){if(void 0===e)return this;const t=JSON.stringify(e);return this.#K.set("Content-Type","application/json"),this.#J=t,this}multipart(e){const t=new FormData;return e(new K(t)),this.#J=t,this}options(e){for(const[t,s]of Object.entries(e))this.#X[t]=s;return this}option(e,t){return this.#X[e]=t,this}interceptors(e){for(const t of e)this.#H.push(t);return this}interceptor(e){return this.#H.push(e),this}async exchange(){const e=this.#Q.size?`?${this.#Q}`:"",t={...this.#X,headers:this.#K,method:this.#U,body:this.#J};return await this.#V.exchange(`${this.#G}${e}${this.#c}`,t,this.#H)}async fetch(){try{const e=await this.exchange();if(!e.ok)throw await F.fromResponse(e);return e}catch(e){if(e instanceof k)throw e;throw F.of("UNEXPECTED_PROBLEM",e)}}async fetchText(){const e=await this.fetch();return await U(e,"text")}async fetchJson(){const e=await this.fetch();return 204===e.status?null:await U(e,"json")}async fetchBlob(){const e=await this.fetch();return await U(e,"blob")}async fetchArrayBuffer(){const e=await this.fetch();return await U(e,"arrayBuffer")}}class K{#Y;constructor(e){this.#Y=e}field(e,t){return this.#Y.append(e,t),this}blob(e,t,s){return this.#Y.append(e,t,s),this}blobs(e,t){for(const s of t)this.#Y.append(e,s);return this}json(e,t,s){const r=new Blob([JSON.stringify(t)],{type:"application/json"});return this.#Y.append(e,r,s),this}}var J=Object.freeze({__proto__:null,Base64:z,Failure:k,Hex:M,HttpClient:V,HttpClientBuilder:j,HttpClientError:F,HttpInterceptorChain:W,HttpMultipartRequestCustomizer:K,HttpRequestBuilder:Q,MediaType:D});const X=e=>{const t=t=>{try{e().removeItem(t)}catch{}},s=s=>{let r;try{r=e().getItem(s)}catch{return}if(null!==r)try{return JSON.parse(r)}catch{return void t(s)}};return{save:(t,s)=>{e().setItem(t,JSON.stringify(s))},load:s,remove:t,pop:e=>{const r=s(e);return t(e),r}}},Y=e=>({save(t,s,r){e.save(t,{revision:s,data:r})},load(t,s){const r=e.load(t);if(null!=r&&"object"==typeof r&&r.revision===s)return r.data;e.remove(t)}}),Z=X(()=>localStorage),ee=X(()=>sessionStorage),te=Y(Z),se=Y(ee);class re{static async fireAsync(e,t,s){e.dispatchEvent(t);const r=t.async?.promises??[],i=s?.mode??"broadcast";if("pipeline"===i&&r.length>1||"delegate"===i&&1!==r.length)throw Promise.all(r).catch(()=>{}),new Error("pipeline"===i?`[AsyncEvents] Event "${t.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${r.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${t.type}" is configured in 'delegate' mode and requires exactly one async listener, but ${r.length} were registered.`);return"broadcast"===i?Promise.all(r):Promise.resolve(r[0])}static asyncOn(e,t,s,r){const i=async e=>{const t=e;t.async||(t.async={promises:[]});const{promise:r,resolve:i,reject:n}=Promise.withResolvers();t.async.promises.push(r);try{i(await s(t))}catch(e){n(e)}};return e.addEventListener(t,i,r),i}static asyncOff(e,t,s,r){e.removeEventListener(t,s,r)}static mixInto(...e){for(const t of e)Object.assign(t.prototype,{async fireAsync(e,t){return await re.fireAsync(this,e,t)},asyncOn(e,t,s){return re.asyncOn(this,e,t,s)},asyncOff(e,t,s){re.asyncOff(this,e,t,s)}})}}class ie{#Z=0;take(){return++this.#Z,this.hold()}hold(){const e=this.#Z,t=this;return{get stale(){return e!==t.#Z}}}invalidate(){++this.#Z}}class ne{static sleep(e){return new Promise(t=>setTimeout(t,e))}static debounce(e,t,s){const r=s?.immediate??!1;let i=null,n=[],a=0;const o=()=>{const s=performance.now()-a;e>s?i=setTimeout(o,e-s):(i=null,r||t(...n),null===i&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===i&&(i=setTimeout(o,e),r&&t(...n))},()=>{clearTimeout(i??void 0),i=null,n=[]}]}static throttle(e,t,s){const r=s?.leading??!0,i=s?.trailing??!0;let n=null,a=[],o=0;const l=()=>{o=r?performance.now():0,n=null,t(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();o||r||(o=u);const c=0===o?0:e-(u-o);a=s,c<=0||c>e?(null!==n&&(clearTimeout(n),n=null),o=u,t(...a),null===n&&(a=[])):null===n&&i&&(n=setTimeout(l,c))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class ae{static flatten(e,t,s){return Object.keys(e).reduce((r,i)=>{const n=t.length?`${t}.${i}`:i;return s.has(n)||"object"!=typeof e[i]||null===e[i]?r[n]=e[i]:Object.assign(r,ae.flatten(e[i],n,s)),r},{})}static#ee=new Set(["__proto__","prototype","constructor"]);static providePath(e,t,s){const r=t.split(".").map(e=>/^[0-9]+$/.test(e)?+e:e);for(const e of r)if(ae.#ee.has(e))throw new Error(`unsupported name segment '${e}' in '${t}'`);let i=e??{},n=null;for(let t=0;;++t){const a=r[t],o=r[t-1];if(Number.isInteger(a)&&!Array.isArray(i)&&(null!==n?n[o]=i=[]:e=i=[]),t===r.length-1)return i[a]=void 0!==s?s:a in i?i[a]:null,e;"object"==typeof i[a]&&null!==i[a]||(i[a]={}),n=i,i=i[a]}}static extract(e){if("radio"===e.getAttribute("type")){if(!e.checked)return;return"boolean"===e.dataset.fulBindType?"true"===e.value:e.value}return"checkbox"===e.getAttribute("type")?e.checked:"boolean"===e.dataset.fulBindType?e.value?"true"===e.value:null:"SELECT"===e.tagName&&e.multiple?Array.from(e.selectedOptions).map(e=>e.value):"INPUT"!==e.tagName&&"SELECT"!==e.tagName&&"TEXTAREA"!==e.tagName||""!==e.value&&void 0!==e.value?e.value:null}static#te(e){return"submit"===e.type||"reset"===e.type||"button"===e.type}static extractFrom(e,t){let s={};for(const r of e.elements)r.hasAttribute("name")&&(ae.#te(r)&&r!==t||r.matches(":disabled")&&r!==t||(s=ae.providePath(s,r.getAttribute("name"),ae.extract(r))));return s}static mutate(e,t){if("radio"!==e.getAttribute("type"))if("checkbox"!==e.getAttribute("type")){if("SELECT"===e.tagName&&e.multiple){const s=Array.isArray(t)?t.map(String):null==t?[]:[String(t)];return void Array.from(e.options).forEach(e=>{e.selected=s.includes(e.value)})}e.value=t}else e.checked=t;else e.checked=null!=t&&e.getAttribute("value")===String(t)}static mutateIn(e,t){const s=Array.from(e.elements).map(e=>e.getAttribute("name")).filter(e=>e);for(const[r,i]of Object.entries(ae.flatten(t,"",new Set(s))))for(const t of e.querySelectorAll(`[name='${CSS.escape(r)}']`))ae.mutate(t,i)}static errors(e,t,s){e.querySelectorAll("ful-field-error").forEach(e=>{e.setAttribute("aria-live",s?"off":"polite")});const r=e=>("FIELD_ERROR"===e.type||"INVALID_FORMAT"===e.type)&&e.context,i=t.filter(r),n=t.filter(e=>!r(e));e.querySelectorAll("[name]").forEach(e=>{e.setCustomValidity?.("")}),e.querySelectorAll("ful-errors").forEach(e=>{e.setAttribute("role","alert"),e.replaceChildren(),e.setAttribute("hidden","")});const a=[];i.forEach(t=>{const s=t.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let r=s.length;0!==r;--r){const i=s.slice(0,r).join("."),n=e.querySelectorAll(`[name='${CSS.escape(i)}']`);if(0===n.length)continue;const a=s.slice(r).join(".");return void n.forEach(e=>{e.setCustomValidity?.(t.reason,a)})}a.push(t)});const o=[...n,...a];e.querySelectorAll("ful-errors").forEach(e=>{const t=e;0!==o.length?(e.removeAttribute("hidden"),t.innerText=o.map(e=>e.reason).join("\n")):t.innerText=""}),0!==t.length&&s&&Array.from(e.querySelectorAll(":invalid")).sort((e,t)=>e.getBoundingClientRect().y-t.getBoundingClientRect().y)[0]?.focus()}}class oe extends S{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#se;#re;#ie;#ne;#ae=[];constructor(){super(),this.internals.role=this.constructor.ROLE}#oe(){return[this.#ie??this.#se,...this.#ae].filter(e=>e)}#le({fragment:e,control:t,error:s,label:r=null,described:i=null,claims:n=null,announces:a=t,freeze:o=null,also:l=[]}){this.#se=t,this.#re=s,this.#ie=n,this.#ne=a,this.#ae=l,o&&o.addEventListener("click",e=>{this.readonly&&e.preventDefault()},!0),s&&(s.id||(s.id=c.uid("ful-field-error")),(i??t).setAttribute("aria-describedby",s.id)),r&&oe.#ue(this,r,t),this.addEventListener("keydown",e=>{if("Enter"!==e.key||e.defaultPrevented||e.isComposing)return;const t=e.target;t.form!==this.internals.form&&oe.#ce(t)&&this._requestSubmit()}),this.replaceChildren(e)}static#ce(e){return e instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(e.type)}focus(e){this.#se?.focus(e)}setCustomValidity(e,t){if(c.set(this.#ne??this.#se,"aria-invalid",e?"true":null),!e)return this.internals.setValidity({}),void(this.#re.innerText="");this.internals.setValidity({customError:!0}," "),this.#re.innerText=e}_requestSubmit(){const e=this.internals.form;if(!e)return;const t=e.querySelectorAll("button:not(:disabled), input:not(:disabled)");e.requestSubmit([...t].find(t=>"submit"===t.type&&t.form===e))}_notifyChange(e={}){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value,...e}}))}static#de=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#ue(e,t,s){if(!oe.#de.has(s.tagName)||"hidden"===s.getAttribute("type"))return t.id||(t.id=c.uid("ful-label")),s.setAttribute("aria-labelledby",t.id),void t.addEventListener("click",()=>e.focus());s.id||(s.id=c.uid("ful-control")),t.setAttribute("for",s.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}get value(){}set value(e){}formResetCallback(){this.value=this.unmarshal("value",this.getAttribute("value"))}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.reflectTo("disabled",e);for(const t of this.#oe())t.toggleAttribute("disabled",e)}get readonly(){return this.hasAttribute("readonly")}set readonly(e){for(const t of this.#oe())t.readOnly=e;this.#ne&&c.set(this.#ne,"aria-readonly",e?"true":null),this.reflectTo("readonly",e)}get required(){return this.hasAttribute("required")}set required(e){this.#ne&&c.set(this.#ne,"aria-required",e?"true":null),this.reflectTo("required",e)}render(e){const t=this._build(e);if(t instanceof Promise)return t.then(e=>this.#he(e));this.#he(t)}#he(e){this.#le(e)}_build(e){throw new Error(`${this.constructor.name} must implement _build`)}}class le{#pe;#fe;#U;#me;#ge;constructor(e,t,s,r,i){this.#pe=e,this.#fe=t,this.#U=s,this.#me=r,this.#ge=i}prepare(e,t){return this.#me(e,t)}async submit(e,t){return await this.#pe.request(this.#U,this.#fe).json(e).fetch()}transform(e,t){return this.#ge(e,t)}}class ue{#me;#ge;constructor(e,t){this.#me=e,this.#ge=t}async prepare(e,t){return await this.#me(e,t)}async submit(e,t,s){return s}async transform(e,t){return await this.#ge(e,t)}}class ce{static create(e,t){const s=e.component("http-client"),r=e.declared("request-mapper")?e.component(e.declared("request-mapper")):e=>e,i=e.declared("response-mapper")?e.component(e.declared("response-mapper")):e=>e,n=e.declared("action");if(!n)return new ue(r,i);const a=e.declared("method")??"POST";return new le(s,n,a,r,i)}}class de extends S{static attributes=["action","method","loader","request-mapper","response-mapper","clear-invalid-on-change:presence","scroll-on-error:presence","autocomplete"];form;render(){const e=document.createElement("form");this.form=e,e.setAttribute("novalidate",""),c.forward("form-",this,e),c.set(e,"autocomplete",this.declared("autocomplete")),e.replaceChildren(...this.childNodes),e.addEventListener("submit",async e=>{e.preventDefault(),e.stopPropagation(),await this.submit(e.submitter??void 0)}),this.addEventListener("click",e=>{const t=e.target;t.closest?.('[aria-disabled="true"]')&&(e.preventDefault(),e.stopImmediatePropagation())},!0),this.declared("clear-invalid-on-change")&&this.addEventListener("change",e=>{e.target.setCustomValidity?.("")}),this.replaceChildren(e)}#be=!1;async submit(e){if(this.#be)return;let t,s;this.#be=!0,this.spinner(!0);try{const r=this.component(this.declared("loader")??"loaders:form").create(this);t=ae.extractFrom(this.form,e),s=await r.prepare(t,this);const i=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:e,values:t,request:s}});if(!this.dispatchEvent(i))return;this.errors=[];const n=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:i.detail.values,request:i.detail.request}});let a=await re.fireAsync(this,n,{mode:"pipeline"});s=n.detail.request,a=await r.submit(s,this,a);const o=await r.transform(a,this);this.dispatchEvent(new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:s,response:o}}))}catch(r){this.dispatchEvent(new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:s,exception:r}})),r instanceof k&&(this.errors=r.problems),console.warn("failed to submit form",this,"reason:",r)}finally{this.#be=!1,this.spinner(!1)}}reset(){this.form.reset()}#ve=0;#ye(e){if(c.defaultValue(e,"role","status"),e.hidden=!1,""!==e.textContent.trim())return;const t=document.createElement("span");t.className="ful-sr-only",t.dataset.ref="spinner-label",e.append(t),t.textContent=P.of().t("spinner.loading")}spinner(e){if(e){if(++this.#ve,1!==this.#ve)return}else if(this.#ve=Math.max(0,this.#ve-1),0!==this.#ve)return;c.set(this,"aria-busy",e?"true":null),this.querySelectorAll("ful-spinner").forEach(t=>{const s=t;e?this.#ye(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(t=>{const s=t;if("submit"===s.type||"reset"===s.type)if(e)s.dataset.wd=s.getAttribute("aria-disabled")??"",s.setAttribute("aria-disabled","true");else{if(void 0===s.dataset.wd)return;c.set(s,"aria-disabled",s.dataset.wd||null),delete s.dataset.wd}})}set values(e){ae.mutateIn(this.form,e)}get values(){return ae.extractFrom(this.form)}set errors(e){ae.errors(this.form,e,this.declared("scroll-on-error"))}}const he=new t(100),pe=(e,t)=>he.getOrCompute(`${e}:${t}`,()=>{try{return new RegExp(t,"g")}catch(s){return console.warn(`invalid ${e} attribute`,t,s),null}}),fe=new WeakSet;class me extends oe{static observed=["placeholder"];static attributes=["type","v-type","keep","reject","uppercase:presence","trim:presence","autocomplete"];static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-if="type != \'textarea\'" data-tpl-type="type" placeholder=" " form="">\n <textarea data-tpl-if="type == \'textarea\'" placeholder=" " form=""></textarea>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_input;_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:e}){const t=this._type(),s=this.template().withOverlay({type:t,slots:e}).render();return this._input=s.querySelector("input,textarea"),c.set(this._input,"autocomplete",this.declared("autocomplete")??(this.closest("form")?.getAttribute("autocomplete")??null)),c.forward("input-",this,this._input),this._input.addEventListener("input",e=>{const t=(e=>{const t=e.declared("keep"),s=e.declared("reject");if(null===t||null===s||fe.has(e)||(fe.add(e),console.warn("a ful-input declares both keep and reject: keep is applied, reject is ignored",e)),null!==t){const e=pe("keep",t);return e&&(t=>(t.match(e)??[]).join(""))}if(null!==s){const e=pe("reject",s);return e&&(t=>t.replace(e,""))}return null})(this);if(!t)return;const s=e.target.value,r=t(s);if(s===r)return;const i=e.target.selectionStart;if(e.target.value=r,null===i)return;const n=t(s.slice(0,i)).length;e.target.setSelectionRange(n,n)}),this._input.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()}),{fragment:s,control:this._input,error:s.querySelector("ful-field-error"),label:s.querySelector("label")}}get value(){const e=this.declared("uppercase"),t=this.declared("trim"),s=this._input.value,r=e?s.toUpperCase():s,i=t?r.trim():r;if(""===i)return null;if("number"===this.declared("v-type")){const e=Number(i);return Number.isNaN(e)?i:e}return i}set value(e){this._input.value=""===e||void 0===e?null:e}get placeholder(){const e=this._input.getAttribute("placeholder");return" "===e?null:e}set placeholder(e){c.set(this._input,"placeholder",e??" "),this.reflectTo("placeholder",e)}}class ge extends S{static attributes=["locale","default"];render(){const e=this.textContent.trim(),[t,s,r]=e.split("-").map(Number),i=""===e?null:new Date(t,s-1,r);if(null===i||Number.isNaN(i.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:n}=P.of({locale:this.declared("locale")??void 0});this.replaceChildren(n(i,{year:"numeric",month:"numeric",day:"numeric"}))}}class be extends S{static attributes=["locale","default"];render(){const e=this.textContent.trim(),t=""===e?null:new Date(be.isoToLocal(e));if(null===t||Number.isNaN(t.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:s}=P.of({locale:this.declared("locale")??void 0});this.replaceChildren(s(t,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}))}static#we(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?new Date(`${e}T00:00:00`):new Date(e)}static isoToLocal(e){const t=be.#we(e),s=(e,t)=>String(t).padStart(e,"0");return`${t.getFullYear()}-${s(2,t.getMonth()+1)}-${s(2,t.getDate())}T${s(2,t.getHours())}:${s(2,t.getMinutes())}:${s(2,t.getSeconds())}.${s(3,t.getMilliseconds())}`}static localToIso(e){const t=be.#we(e);return Number.isNaN(t.getTime())?null:t.toISOString()}}class ve extends me{static observed=["step","min","max"];_type(){return"date"}get min(){const e=this._input.min;return""===e?null:e}set min(e){this._input.min=ve.#Ee(e)}get max(){const e=this._input.max;return""===e?null:e}set max(e){this._input.max=ve.#Ee(e)}get step(){const e=this._input.step;return""===e?null:e}set step(e){this._input.step=e??""}static#Ee(e){if(!e)return"";const t=e=>new Date(e.getTime()-6e4*e.getTimezoneOffset()).toISOString().split("T")[0];if("now"===e)return t(new Date);const s=/^([+-])(\d+)([dmy])$/.exec(e);if(!s)return e;const r="-"===s[1]?-1:1,i=+s[2],n=new Date;switch(n.setHours(0,0,0,0),s[3]){case"d":n.setDate(n.getDate()+i*r);break;case"m":{const e=n.getDate();n.setMonth(n.getMonth()+i*r),n.getDate()!==e&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+i*r)}return t(n)}}class ye extends ve{_type(){return"time"}get min(){const e=this._input.min;return""===e?null:e}set min(e){this._input.min=this.#xe(e)}get max(){const e=this._input.max;return""===e?null:e}set max(e){this._input.max=this.#xe(e)}#xe(e){if(!e)return"";const t=new Date;if("now"!==e){const s=/^([+-])(\d+)([hm])$/.exec(e);if(!s)return e;const r="-"===s[1]?-1:1,i=+s[2]*r;"h"===s[3]?t.setHours(t.getHours()+i):t.setMinutes(t.getMinutes()+i)}return ye.#Ae(t,Number(this._input.step)||60)}static#Ae(e,t){const s=e=>String(e).padStart(2,"0"),r=3600*e.getHours()+60*e.getMinutes()+e.getSeconds(),i=Math.floor(r/t)*t,n=s(Math.floor(i/3600)),a=s(Math.floor(i%3600/60));return t%60==0?`${n}:${a}`:`${n}:${a}:${s(i%60)}`}}class we extends me{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){return be.localToIso(this._input.value)}set value(e){this._input.value=e?be.isoToLocal(e):""}get min(){return be.localToIso(this._input.min)}set min(e){this._input.min=e?be.isoToLocal(e):""}get max(){return be.localToIso(this._input.max)}set max(e){this._input.max=e?be.isoToLocal(e):""}get step(){const e=this._input.step;return""===e?null:e}set step(e){this._input.step=e??""}}class Ee extends me{static WARNING_TIMEOUT=5e3;static list(e=[]){const t=new DataTransfer;for(const s of e)t.items.add(s);return t.files}static observed=["placeholder","accept:csv","multiple:presence","item-list:presence","dropzone:presence","max-files:number","max-file-size:number","max-total-size:number","value"];#Se;#Te;#Ce;#_e;#Oe;_type(){return"file"}static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-type="type" placeholder=" " form="">\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <div data-ref="dropzone" class="dropzone" data-tpl-if="slots.dropzone">\n {{{{ slots.dropzone }}}}\n </div>\n <div data-ref="dropzone" class="default-dropzone" data-tpl-if="!slots.dropzone">\n {{ #l10n:t(\'files.dropzone-label\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings role="status" aria-live="polite"></ful-field-warnings>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="files" data-tpl-var="file" data-tpl-data-name="file.name">\n <div><span>{{ file.name }}</span><span>{{ #l10n:bytes(file.size) }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'files.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};#Re;_build(e){const t=super._build(e),s=t.fragment;return this.#Te=s.querySelector("ful-item-list"),this.#Re=e.slots?.items&&!u.isBlank(e.slots.items)?x.fromFragment(e.slots.items):null,this.#Ce=s.querySelector("[data-ref=dropzone]"),this.#_e=s.querySelector("ful-field-warnings"),this.#Oe=s.querySelector("ful-control-group"),this.#_e.addEventListener("animationend",e=>{e.target.remove()}),this.#Te.addEventListener("click",e=>{if(!e.target.closest("button"))return;if(!this._interactive())return;const t=[...this.#Te.children].indexOf(e.target.closest("ful-item"));-1!==t&&(this.files=Ee.list([...this.files].filter((e,s)=>s!==t)),this._notifyChange())}),this.#Ce.addEventListener("click",e=>{this._interactive()&&this.querySelector("input")?.click()}),this.#Ce.addEventListener("dragover",e=>{e.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#Ce.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#Ce.addEventListener("drop",e=>{if(e.preventDefault(),this.toggleAttribute("dragover",!1),!this._interactive())return;const t=[...e.dataTransfer.items].filter(e=>"file"===e.kind).map(e=>e.getAsFile()).filter(e=>null!==e);0===t.length||t.length>1&&!this.multiple||(this.files=Ee.list(t),this._notifyChange())}),this._input.addEventListener("change",e=>{this.#qe()}),{...t,freeze:this.#Oe}}#qe(){this.setCustomValidity(),this.#_e.replaceChildren(),this.#Ne(),this.#Pe(),this.#Le(),this.#ke(),(this.#Re??this.template("items")).withOverlay({files:this.files}).renderTo(this.#Te)}warning(e,t){this.template("warning").withOverlay({key:e,args:t}).appendTo(this.#_e);const s=this.#_e.lastElementChild;setTimeout(()=>s.remove(),Ee.WARNING_TIMEOUT)}#ze(e){const t=e.name.toLowerCase();return this.#Se.some(s=>{const r=s.toLowerCase().split(";")[0].trim();return r.startsWith(".")?t.endsWith(r):r.endsWith("/*")?e.type.startsWith(`${r.slice(0,-1)}`):r.includes("/")&&e.type===r})}#Ne(){if(!this.#Se.length)return;const e=[...this.files].filter(e=>!this.#ze(e));0!==e.length&&(this.warning("files.unacceptable-file-type",{types:this.#Se.join(", ")}),this._input.files=Ee.list([...this.files].filter(t=>!e.includes(t))))}#ke(){null!==this.#Me&&(this.files.length<=this.#Me||(this.warning("files.max-files-exceeded",{count:this.#Me}),this._input.files=Ee.list()))}#Pe(){if(null===this.#De)return;const e=[...this.files].filter(e=>e.size>this.#De);0!==e.length&&(this.warning("files.max-file-size-exceeded",{size:P.of().bytes(this.#De)}),this._input.files=Ee.list([...this.files].filter(t=>!e.includes(t))))}#Le(){null!==this.#Fe&&([...this.files].reduce((e,t)=>e+t.size,0)<=this.#Fe||(this.warning("files.max-total-size-exceeded",{size:P.of().bytes(this.#Fe)}),this._input.files=Ee.list()))}get accept(){return this.#Se}set accept(e){this._input.accept=e.join(","),this.#Se=e,this.reflectTo("accept",e)}get multiple(){return this._input.multiple}set multiple(e){this._input.multiple=e,this.reflectTo("multiple",e)}get files(){return this._input.files}set files(e){this._input.files=e,this.#qe()}get file(){return this.files[0]??null}set file(e){this.files=Ee.list(e?[e]:[])}get value(){const e=Array.from(this._input.files).map(e=>e.name);return this.multiple?e:e[0]??null}set value(e){e||(this.files=Ee.list())}formResetCallback(){this.value=null}get totalsize(){return Array.from(this.files).reduce((e,t)=>e+t.size,0)}#Me;get maxFiles(){return this.#Me}set maxFiles(e){this.#Me=e,this.reflectTo("max-files",e)}#De;get maxFileSize(){return this.#De}set maxFileSize(e){this.#De=e,this.reflectTo("max-file-size",e)}#Fe;get maxTotalSize(){return this.#Fe}set maxTotalSize(e){this.#Fe=e,this.reflectTo("max-total-size",e)}#Ie;get itemList(){return this.#Ie}set itemList(e){this.#Ie=e,this.reflectTo("item-list",e)}#$e;get dropzone(){return this.#$e}set dropzone(e){this.#$e=e,this.reflectTo("dropzone",e)}}const xe=new Map;let Ae=0,Se=!1;const Te=(e,t,s)=>Math.min(Math.max(e,t),Math.max(t,s)),Ce=(e,t)=>{const{invoker:s,stretch:r}=t,i=s.getBoundingClientRect(),n=document.documentElement,a=n.clientWidth,o=n.clientHeight;e.style.removeProperty("margin");const l=getComputedStyle(e),u=parseFloat(l.marginTop)||0,c=parseFloat(l.marginRight)||0,d=parseFloat(l.marginBottom)||0,h=parseFloat(l.marginLeft)||0;if(e.style.right="auto",e.style.bottom="auto",e.style.margin="0",r){const t=Math.min(i.width,a-16);e.style.width=`${t}px`,e.style.left=`${Te(i.left,8,a-t-8)}px`;const s=e.getBoundingClientRect().height;return void(e.style.top=`${Te(i.bottom+u,8,o-s-8)}px`)}const p=(e=>e.matches("ful-note, .ful-note, [placement]"))(e),f=p?e.getAttribute("placement")??"bottom":"bottom";e.style.removeProperty("max-width");const m=Math.min(parseFloat(l.maxWidth)||a,a-16);e.style.maxWidth=`${m}px`,e.style.left="8px";const g=e.getBoundingClientRect().width;let b="right"===f?i.right+h:"left"===f?i.left-c-g:p?i.left+i.width/2-g/2:i.left;b=Te(b,8,a-g-8),e.style.left=`${b}px`,e.style.maxWidth=`${Math.min(m,a-8-b)}px`;const v=e.getBoundingClientRect().height,y="top"===f?i.top-d-v:"right"===f||"left"===f?i.top+i.height/2-v/2:i.bottom+u;e.style.top=`${Te(y,8,o-v-8)}px`,p&&((e,t)=>{const s=t.getBoundingClientRect(),r=e.getBoundingClientRect();e.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-r.left-e.clientLeft+"px"),e.style.setProperty("--ful-note-callout-block",s.top+s.height/2-r.top-e.clientTop+"px")})(e,s)},_e=()=>{Ae=0;for(const[e,t]of xe)e.isConnected&&t.invoker.isConnected?Ce(e,t):xe.delete(e)},Oe=()=>{!Ae&&xe.size>0&&(Ae=requestAnimationFrame(_e))};class Re{static wire(e,t,{prefix:s="ful-anchor",invoke:r=!1,expanded:i=!1,stretch:n=!1,handPlace:a=!1}={}){const o=c.uid(s);r&&(t.id=t.id||o,e.setAttribute("popovertarget",t.id));const l=`--${o}`;if(e.style.anchorName=l,t.style.positionAnchor=l,i&&(e.setAttribute("aria-expanded","false"),t.addEventListener("toggle",t=>{e.setAttribute("aria-expanded","open"===t.newState?"true":"false")})),!a&&CSS.supports("anchor-name: --ful-probe")&&CSS.supports("position-anchor: --ful-probe")&&CSS.supports("position-area: bottom")&&CSS.supports("top: anchor(bottom)")&&CSS.supports("width: anchor-size(width)"))return;const u={invoker:e,stretch:n};t.addEventListener("beforetoggle",e=>{"open"===e.newState&&Ce(t,u)}),t.addEventListener("toggle",e=>{"open"===e.newState?(xe.set(t,u),Ce(t,u)):(xe.delete(t),(e=>{for(const t of["top","left","right","bottom","margin","max-width","width","--ful-note-callout-inline","--ful-note-callout-block"])e.style.removeProperty(t)})(t))}),Se||(Se=!0,document.addEventListener("scroll",Oe,!0),window.addEventListener("resize",Oe))}}class qe{#pe;#fe;#U;#ge;#Be;#je;#C;#He;#We=new ie;constructor({http:e,url:t,method:s,responseMapper:r,prefetch:i,revision:n}){this.#pe=e,this.#fe=t,this.#U=s,this.#ge=r,this.#Be=i,this.#je=n,this.#C=null,this.#He=null}async prefetch(){this.#Be&&await this.#Ve()}async exact(...e){return(await this.#Ve()).filter(({key:t})=>e.some(e=>e==t))}async load(e){return(await this.#Ve()).filter(({label:t})=>(t??"").toLowerCase().includes(e?.toLowerCase()??""))}async invalidate(){this.#We.invalidate(),this.#C=null,this.#He=null}async reconfigureUrl(e){await this.invalidate(),this.#fe=e}async#Ve(){if(null===this.#C){if(null===this.#He){const e=this.#We.hold();this.#He=qe.#Ue(this.#pe,this.#U,this.#fe,this.#je).then(t=>{e.stale||(this.#C=this.#ge(t))}).finally(()=>{e.stale||(this.#He=null)})}await this.#He}if(null===this.#C)throw new Error("superseded by a reconfiguration");return this.#C}static async#Ue(e,t,s,r){const i=`${t}@${s}`;if(null!==r){const e=te.load(i,r);if(void 0!==e)return e}const n=await e.request(t,s).fetchJson();if(null!==r)try{te.save(i,r,n)}catch(e){console.warn("failed to cache the select options",e)}return n}}class Ne{#pe;#fe;#U;#ge;constructor({http:e,url:t,method:s,responseMapper:r}){this.#pe=e,this.#fe=t,this.#U=s,this.#ge=r}async invalidate(){}async reconfigureUrl(e){this.#fe=e}async exact(...e){const t=await this.#pe.request(this.#U,this.#fe).param("k",...e).fetchJson();return this.#ge(t)}async load(e){const t=await this.#pe.request(this.#U,this.#fe).param("s",e).fetchJson();return this.#ge(t)}}class Pe{#C;constructor(e){this.#C=e}update(e){this.#C=e}async invalidate(){}exact(...e){return this.#C.filter(({key:t})=>e.some(e=>e==t))}load(e){return this.#C.filter(({label:t})=>(t??"").toLowerCase().includes(e?.toLowerCase()??""))}}class Le{static from({data:e,http:t,url:s,method:r="POST",mode:i,prefetch:n=!1,revision:a=null,responseMapper:o}){return s?"chunked"===i?new Ne({http:t,url:s,method:r,responseMapper:o}):new qe({http:t,url:s,method:r,responseMapper:o,prefetch:n,revision:a}):new Pe(e??[])}static create(e,t){if(!e.declared("src")){const e=Array.from(t.options?.querySelectorAll("option")??[]);return Le.from({data:e.map(e=>({key:e.getAttribute("value")??e.innerText.trim(),label:e.innerText.trim(),metadata:void 0}))})}return Le.from({http:e.component("http-client"),url:e.declared("src"),method:e.declared("method")??"POST",mode:e.declared("mode"),prefetch:e.declared("preload"),revision:e.declared("revision"),responseMapper:Le.#Ge(e)})}static#Ge(e){return e.declared("k-expr")&&e.declared("l-expr")?t=>e._registry.evaluator().withOverlay(t).evaluateExpression(e.declared("d-expr")??"self").map(t=>{const s=e._registry.evaluator().withOverlay(t);return{key:s.evaluateExpression(e.declared("k-expr")),label:s.evaluateExpression(e.declared("l-expr")),metadata:s.evaluateExpression(e.declared("m-expr")??"self")}}):e.declared("response-mapper")?e.component(e.declared("response-mapper")):e=>e.map(([e,t,s])=>({key:e,label:t,metadata:s}))}}class ke extends S{static attributes=["listbox"];static slots=!0;static template='\n <ful-spinner class="centered" role="status" hidden><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n <p data-ref="empty" aria-live="polite" hidden>{{ #l10n:t(\'dropdown.empty\') }}</p>\n <menu tabindex="-1" role="listbox" hidden></menu>\n ';static templates={options:'\n <li data-tpl-each="self" data-tpl-selected="index == 0" data-tpl-value="index" role="option">\n {{ label }}\n </li>\n '};#Qe;#Ke;#Je;#Xe;#X=new Map;#Ye=new ie;render({slots:e}){const t=this.template().render();this.#Xe=u.isBlank(e.default)?this.template("options"):x.fromFragment(e.default),this.#Qe=t.querySelector("ful-spinner"),this.#Je=t.querySelector("p[data-ref=empty]"),this.#Ke=t.querySelector("menu"),this.#Ke.id=this.declared("listbox")||c.uid("ful-listbox"),this.#Ke.addEventListener("click",e=>{e.stopPropagation();const t=e.target.closest("li");t?this.#Ze(t):this.hide()}),this.replaceChildren(t)}#et(){return this.#Ke?.querySelector("[selected]")??this.#Ke?.firstElementChild??null}#tt(e){if(e){for(const t of this.#Ke.querySelectorAll("li"))t.toggleAttribute("selected",t===e);e.id||=c.uid("ful-option"),this.#st(e.id),e.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#st(null)}acceptSelection(){const e=this.#et();e&&this.#Ze(e)}update(e,t=[]){if(void 0===e)throw new Error("null data");this.#X=new Map(e.map((e,t)=>[String(t),e]));const s=e.map((e,t)=>({index:t,...e}));this.#Xe.withOverlay(s).renderTo(this.#Ke);for(const[s,r]of[...this.#Ke.children].entries()){const i=t.some(t=>t==e[s]?.key);r.toggleAttribute("picked",i),r.setAttribute("aria-selected",i?"true":"false")}this.#Je.toggleAttribute("hidden",0!==e.length),this.#Ke.toggleAttribute("hidden",0===e.length);const r=e.findIndex(({key:e})=>t.some(t=>t==e));this.#tt(r>=0?this.#Ke.children[r]:this.#et())}#Ze(e){const t=e.getAttribute("value"),s=this.#X.get(t);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:t,entry:s}}))}hide(){this.#Ye.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#st(null)}#st(e){this.dispatchEvent(new CustomEvent("activechange",{bubbles:!1,cancelable:!1,detail:{id:e}}))}get shown(){return this.matches(":popover-open")}async show(e,t=[]){const s=this.#Ye.take();this.matches(":popover-open")||this.showPopover(),this.#Ke.setAttribute("hidden",""),this.#Qe.removeAttribute("hidden");try{const r=await e();if(s.stale)return;this.update(r,t)}catch(e){if(s.stale)return;throw this.hide(),e}finally{s.stale||this.#Qe.setAttribute("hidden","")}}async moveOrShow(e,t,s=[]){if(this.shown){const t=this.#et(),s=t?.[(e?"next":"previous")+"ElementSibling"];return void(t&&s&&this.#tt(s))}await this.show(t,s)}jump(e){const t=e?this.#Ke.firstElementChild:this.#Ke.lastElementChild;t&&this.#tt(t)}page(e){const t=this.#et();if(!t)return;const s=Array.from(this.#Ke.children),r=this.#rt(),i=s[Math.max(0,Math.min(s.length-1,s.indexOf(t)+(e?r:-r)))];this.#tt(i)}#rt(){const e=this.#Ke.firstElementChild;return e&&0!==e.offsetHeight?Math.max(1,Math.trunc(this.#Ke.clientHeight/e.offsetHeight)):1}}class ze extends oe{static attributes=["name","loader","k-type","src","method","mode","preload:presence","revision","k-expr","l-expr","d-expr","m-expr","response-mapper"];static observed=["multiple:presence","item-list:presence","value:csv"];static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-control>\n <input type="text" form="" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false">\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n <ful-dropdown popover="manual">{{{{ slots.dropdown }}}}</ful-dropdown>\n </ful-control-group>\n <ful-item-list></ful-item-list>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="entries" data-tpl-var="entry" data-tpl-data-key="entry.key">\n <div><span>{{ entry.label }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'select.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n '};#it;#se;#nt;#at;#Te;#Re;#ot;#lt=!1;#ut=new Map;#ct=new ie;#dt=!1;#ht;#pt;_build({slots:e}){const t=this.declared("name");this.#it=this.component(this.declared("loader")??"loaders:select").create(this,{options:e.options}),this.#ot=this.declared("multiple"),this.#it.prefetch?.()?.catch(e=>{console.warn("failed to prefetch select options",this,"reason:",e)});const s=this.template().withOverlay({slots:e,name:t}).render();this.#at=s.querySelector("input"),this.#Te=s.querySelector("ful-item-list"),this.#Re=e.items&&!u.isBlank(e.items)?x.fromFragment(e.items):null,c.forward("input-",this,this.#at),this.#se=s.querySelector("ful-control"),this.#nt=s.querySelector("ful-dropdown");const r=c.uid("ful-listbox");this.#nt.setAttribute("listbox",r),this.#at.setAttribute("aria-controls",r),this.#nt.addEventListener("beforetoggle",e=>{const t="open"===e.newState;this.#at.setAttribute("aria-expanded",t?"true":"false"),t||this.#at.removeAttribute("aria-activedescendant")}),this.#nt.addEventListener("activechange",e=>{c.set(this.#at,"aria-activedescendant",e.detail.id)});const i=s.querySelector("ful-control-group");return Re.wire(i,this.#nt,{prefix:"ful-select",stretch:!0}),[this.#ht,this.#pt]=ne.throttle(400,()=>this.#ft()),this.#mt(),this.#gt(),this.#bt(),this.#vt(),{fragment:s,control:this.#at,error:s.querySelector("ful-field-error"),label:s.querySelector("label")}}#mt(){this.addEventListener("click",e=>{this._interactive()&&(this.#nt.shown?this.#yt():(this.#at.focus(),this.#ht()))}),this.#Te.addEventListener("click",e=>{e.stopPropagation(),e.target.closest("button")&&this._interactive()&&this.#wt([...this.#Te.children].indexOf(e.target.closest("ful-item")))}),this.#se.addEventListener("click",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t&&(e.stopPropagation(),this.#Et(t))})}#gt(){this.addEventListener("keydown",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t?this.#xt(e,t):"ArrowLeft"===e.code&&e.target===this.#at&&0===this.#at.selectionStart&&0===this.#at.selectionEnd&&this.#At().at(-1)?.focus()})}#bt(){this.#at.addEventListener("change",e=>{e.stopPropagation()}),this.#at.addEventListener("focus",()=>{this.#dt||this.#at.select()}),this.#at.addEventListener("blur",e=>{e.stopPropagation(),e.relatedTarget&&this.contains(e.relatedTarget)||(this.#pt(),this.#yt())}),this.#at.addEventListener("keydown",e=>{this._interactive()&&this.#St(e)}),this.#at.addEventListener("input",e=>{e.stopPropagation(),this._interactive()&&(this.#dt=!0,this.#ht())})}#vt(){this.#nt.addEventListener("change",e=>{e.stopPropagation(),this._interactive()?(this.#ot||this.#ut.clear(),this.#dt=!1,this.#ut.set(this.#Tt(e.detail.entry.key),e.detail.entry),this.#Ct(),this.#_t(),this.#at.focus(),this.#nt.hide(),this.#ot||this.#at.select()):this.#yt()})}async withLoader(e){return await e(this.#it)}async reload(){await(this.#it.invalidate?.()),await(this.#it.prefetch?.());const e=[...this.#ut.keys()];0!==e.length&&await this.#i(e,this.#ct.take())}#At(){return Array.from(this.#se.querySelectorAll(":scope > ful-badge"))}#Et(e){this._interactive()&&this.#wt(this.#At().indexOf(e))}#wt(e){const t=Array.from(this.#ut.keys())[e];void 0!==t&&(this.#ut.delete(t),this.#Ct(),this.#_t())}#xt(e,t){switch(e.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":e.preventDefault(),this.#Et(t),this.#at.focus();break;case"ArrowLeft":e.preventDefault(),(this.#At()[this.#At().indexOf(t)-1]??this.#at).focus();break;case"ArrowRight":e.preventDefault(),(this.#At()[this.#At().indexOf(t)+1]??this.#at).focus();break;case"Escape":this.#at.focus()}}#St(e){switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),this.#Ot(e);break;case"Home":this.#nt.shown&&(e.preventDefault(),this.#nt.jump(!0));break;case"End":this.#nt.shown&&(e.preventDefault(),this.#nt.jump(!1));break;case"PageDown":case"PageUp":this.#nt.shown&&(e.preventDefault(),this.#nt.page("PageDown"===e.code));break;case"Escape":case"Tab":this.#pt(),this.#yt();break;case"NumpadEnter":case"Enter":if(!this.#nt.shown)return;e.preventDefault(),this.#dt=!1,this.#Rt(),this.#nt.acceptSelection();break;case"Backspace":0===this.#at.selectionStart&&0===this.#at.selectionEnd&&this.#wt(this.#ut.size-1)}}#Ot(e){const t="ArrowDown"===e.code;e.altKey?t&&!this.#nt.shown?this.#ft():!t&&this.#nt.shown&&this.#yt():(this.#qt(),this.#nt.moveOrShow(t,()=>this.#it.load(this.#at.value),[...this.#ut.keys()]))}#yt(){this.#nt.hide(),this.#dt=!1,this.#Rt()}#ft(){return this.#qt(),this.#nt.show(()=>this.#it.load(this.#at.value),[...this.#ut.keys()])}#qt(){this.#dt||(this.#at.value="")}#Rt(){const e=this.#ut.values().next().value;this.#at.value=this.#ot?"":e?.label??""}#Nt(){return[...this.#ut.values()]}#Ct(){this._notifyChange({entry:this.entry})}#_t(){const e=this.#ot?Array.from(this.#ut.entries()).map(([e,t],s)=>{const r=document.createElement("ful-badge");return r.setAttribute("role","button"),r.setAttribute("tabindex",0===s?"0":"-1"),r.setAttribute("value",e),r.innerText=t.label,r}):[];for(const e of this.#se.querySelectorAll(":scope > ful-badge"))e.remove();this.#at.before(...e),this.#dt||this.#Rt(),this.#Te.replaceChildren(),(this.#Re??this.template("items")).withOverlay({entries:this.#Nt()}).renderTo(this.#Te)}#Tt(e){switch(this.declared("k-type")){case"number":{const t=""===e?Number.NaN:Number(e);return Number.isNaN(t)?e:t}case"boolean":return!0===e||"true"===e||!1!==e&&"false"!==e&&e;default:return String(e)}}set value(e){const t=(null==e?[]:Array.isArray(e)?e:[e]).map(e=>this.#Tt(e));!this.#lt&&t.some(e=>"string"==typeof e&&e.includes(","))&&(this.#lt=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#ut=new Map(t.map(e=>[e,{key:e,label:e,metadata:void 0}]));const s=this.#ct.take();this.#se&&(this.#_t(),0!==t.length&&this.#i(t,s))}async#i(e,t){const s=await this.#it.exact(...e);if(t.stale)return;const r=new Map(s.map(e=>[this.#Tt(e.key),e]));for(const t of e)this.#ut.has(t)&&(r.has(t)?this.#ut.set(t,r.get(t)):this.#ut.delete(t));this.#_t()}get value(){return this.#ot?[...this.#ut.keys()]:[...this.#ut.keys()][0]??null}get entry(){const e=this.#Nt();return this.#ot?e:e[0]??null}#Ie;get multiple(){return this.#ot}set multiple(e){this.#ot=e,this.reflectTo("multiple",e)}get itemList(){return this.#Ie}set itemList(e){this.#Ie=e,this.reflectTo("item-list",e)}}class Me extends oe{static attributes=["name","type"];static slots=!0;static ROLE="radiogroup";static template='\n <fieldset>\n <legend>\n {{{{ slots.default }}}}\n </legend>\n <header data-tpl-if="slots.header">\n {{{{ slots.header }}}}\n </header>\n <ful-radio-list>\n <div class="label-wrapper" data-tpl-each="inputsAndLabels" data-tpl-var="ial">\n <label>\n {{{{ ial[0] }}}}\n <div>{{{{ ial[1] }}}}</div>\n </label>\n </div>\n </ful-radio-list>\n <ful-field-error></ful-field-error>\n <footer data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </footer>\n </fieldset>\n ';#Pt;#Lt;#kt;_build({slots:e}){const t=this.declared("name")??c.uid("ful-radiogroup"),s=Array.from(e.default.querySelectorAll("ful-radio")),r=s.map(e=>{const s=document.createElement("input");return s.setAttribute("type","radio"),c.forward("input-",this,s),c.forward("",e,s),s.setAttribute("name",`${t}-ignore`),s.setAttribute("form",""),s.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()}),[s,u.fromChildNodes(e)]});s.forEach(e=>{e.remove()});const i=this.template().withOverlay({name:t,slots:e,inputsAndLabels:r}).render();return this.#Pt=i.firstElementChild,this.#Lt=i.querySelector("input[type=radio]"),this.#kt="boolean"===this.declared("type"),{fragment:i,control:this.#Lt,error:i.querySelector("ful-field-error"),described:this,claims:this.#Pt,announces:this,freeze:this.#Pt}}get value(){const e=this.querySelector("input[type=radio]:checked");return e?this.#kt?"true"===e.value:e.value:null}set value(e){const t=this.querySelectorAll("input[type=radio]"),s=()=>{t.forEach(e=>{e.checked=!1})};if(null===e)return void s();const r=this.querySelector(`input[type=radio][value=${CSS.escape(String(e))}]`);null!==r?r.checked=!0:s()}}class De extends oe{static attributes=["type"];static observed=["value:bool"];static slots=!0;static template='\n <ful-choice data-tpl-switch="isSwitch">\n <input type="checkbox" data-tpl-role="isSwitch ? \'switch\' : false" form="" placeholder=" ">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </ful-choice>\n <ful-field-error></ful-field-error>\n ';#zt;#at;_build({slots:e}){const t="switch"===this.declared("type"),s=this.template().withOverlay({slots:e,isSwitch:t}).render();this.#zt=s.firstElementChild,this.#at=s.querySelector("input"),c.forward("input-",this,this.#at),this.#at.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});const r=s.querySelector("label");return{fragment:s,control:this.#at,error:s.querySelector("ful-field-error"),label:r,freeze:this.#zt}}get value(){return this.#at.checked}set value(e){this.#at.checked=e}}class Fe extends S{static attributes=["sorter"];static observed=["order"];#Mt;render(){const e=this.declared("sorter"),t=["asc","desc",null];this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("click",()=>{const s=t[(t.indexOf(this.order)+1)%3];this.dispatchEvent(new CustomEvent("sort:requested",{bubbles:!0,cancelable:!0,detail:{value:{sorter:e,order:s}}}))}),this.addEventListener("keydown",e=>{"Enter"!==e.code&&"Space"!==e.code||(e.preventDefault(),this.click())})}get order(){return this.#Mt||null}set order(e){this.#Mt=e||null,this.reflectTo("order",this.#Mt);const t=this.closest("th");t&&c.set(t,"aria-sort",this.#Mt?"asc"===this.#Mt?"ascending":"descending":null)}}class Ie extends S{static observed=["total:number","current:number"];static attributes=["pages:number"];static config={prevIcon:"chevron-left",nextIcon:"chevron-right",reloadIcon:"arrow-clockwise"};static template='\n <ful-pagination-bar role="navigation" data-tpl-aria-label="#l10n:t(\'pagination.navigation\')">\n <ul>\n <li data-ref="index"> {{ #l10n:t(\'pagination.showing\', { \'current\': curr.label, \'total\': total }) }}</li>\n <li data-ref="reload"><button type="button" data-tpl-aria-label="#l10n:t(\'pagination.reload\')"><ful-icon data-tpl-name="config.reloadIcon" aria-hidden="true"></ful-icon></button></li>\n <li data-ref="prev">\n <button type="button" data-tpl-disabled="prev.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.previous\')" data-tpl-data-page="prev.index">\n <ful-icon data-tpl-name="config.prevIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n <li data-ref="page" data-tpl-each="pages" data-tpl-var="page">\n <button type="button" data-tpl-aria-current="curr.index == page.index ? \'page\' : false" data-tpl-data-page="page.index" >\n {{ page.label }}\n </button>\n </li>\n <li data-ref="next">\n <button type="button" data-tpl-disabled="next.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.next\')" data-tpl-data-page="next.index">\n <ful-icon data-tpl-name="config.nextIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n </ul>\n </ful-pagination-bar>\n ';#Dt=0;#W=0;render(){this.addEventListener("click",e=>{const t=e.target.closest("button");t&&!t.hasAttribute("disabled")&&"page"!==t.getAttribute("aria-current")&&this.dispatchEvent(new CustomEvent("page:requested",{bubbles:!0,cancelable:!0,detail:{value:Number(t.dataset.page??this.#W)}}))})}update({current:e,total:t}={}){void 0!==e&&(this.#W=e??0),void 0!==t&&(this.#Dt=t??0),this.reflectTo("current",this.#W),this.reflectTo("total",this.#Dt);const s=this.#W,r=this.#Dt,i=this.declared("pages")??5,n=Math.max(r,1),a=s>0,o=s+1<n,l={index:a?s-1:null,enabled:a},u={index:s,label:s+1},c={index:o?s+1:null,enabled:o},d=Math.max(1,Math.min(i,n)),h=Math.max(0,Math.min(s-Math.floor((d-1)/2),n-d)),p=Array.from({length:d},(e,t)=>({index:h+t,label:h+t+1})),f=this.contains(document.activeElement)?document.activeElement.closest("li")?.getAttribute("data-ref"):null,m="page"===f?document.activeElement.dataset.page:null;if(this.template().withOverlay({total:n,prev:l,curr:u,next:c,pages:p}).renderTo(this),!f)return;const g=(null===m?null:this.querySelector(`li[data-ref=page] button[data-page="${m}"]`))??this.querySelector(`li[data-ref=${f}] button:not(:disabled)`)??this.querySelector("li[data-ref=page] button[aria-current=page]");g?.focus()}get total(){return this.#Dt}set total(e){this.update({total:e})}get current(){return this.#W}set current(e){this.update({current:e})}}class $e{static parse(e,t){const s=e?h.queryChildren(e,"schema"):null;if(!s)throw new Error('missing expected <schema>: ful-table needs a <template slot="schema"> holding one');const r=document.createElement("tr"),i=document.createElement("tr");i.setAttribute("data-tpl-each","rows");for(const e of s.getAttributeNames()){const t=s.getAttribute(e);r.setAttribute(e,t??""),i.setAttribute(e,t??"")}const n=h.queryChildrenAll(s,"column"),a=n.filter(e=>e.hasAttribute("order")&&e.hasAttribute("sorter")).map(e=>({sorter:e.getAttribute("sorter"),order:e.getAttribute("order")}))[0]??null;for(var o of n){const e=h.queryChildren(o,"title"),t=o.getAttribute("sorter"),s=o.getAttribute("order"),n=e??document.createTextNode(o.getAttribute("title")??"");e?.remove(),o.removeAttribute("sorter"),o.removeAttribute("order"),o.removeAttribute("title");const a=t||s?(()=>{const e=document.createElement("ful-sorter");return t&&e.setAttribute("sorter",t),s&&e.setAttribute("order",s),e.append(n),e})():n,l=document.createElement("th"),u=document.createElement("td");for(const e of o.getAttributeNames()){const t=o.getAttribute(e);l.setAttribute(e,t??""),u.setAttribute(e,t??"")}l.append(a),u.append(...o.childNodes),r.append(l),i.append(u)}return{headersTemplate:t.withOverlay({inHeaders:!0,inRows:!1}).withFragment(u.from(r)),rowsTemplate:t.withOverlay({inHeaders:!1,inRows:!0}).withFragment(u.from(i)),sort:a,length:n.length}}}class Be{#C;constructor(e){this.#C=e}async load(e,t,s){const r=this.#Ft(t),i=e.page*e.size,n=i+e.size;return{data:r.slice(i,n),size:r.length}}#Ft(e){if(!e?.sorter)return this.#C;const{sorter:t,order:s}=e,r="desc"===s?-1:1;return[...this.#C].sort((e,s)=>{const i=e?.[t],n=s?.[t];return i===n?0:null==i?1:null==n?-1:(i<n?-1:1)*r})}update(e){this.#C=e}}class je{#pe;#fe;#U;#ge;constructor(e,t,s,r=e=>e){this.#pe=e,this.#fe=t,this.#U=s,this.#ge=r}async load(e,t,s){const r=Object.entries(s).filter(([e,t])=>t);return await this.#pe.request(this.#U,this.#fe).param("page",e.page).param("size",e.size).param("sort",t?`${t.sorter},${t.order}`:null).param("filters",r.length>0?JSON.stringify(Object.fromEntries(r)):null).fetchJson().then(e=>this.#ge(e))}}class He{static create(e,t){const s=e.getAttribute("src");if(s){const t=e.component("http-client"),r=e.getAttribute("method")??"GET",i=e.hasAttribute("response-mapper")?e.component(e.getAttribute("response-mapper")):e=>e;return new je(t,s,r,i)}return new Be([])}}class We extends S{static attributes=["loader","autoload:presence"];static observed=["page-size:number"];static slots=!0;static config={searchIcon:"search"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <ful-table-wrapper>\n <table>\n <caption data-tpl-if="slots.caption">{{{{ slots.caption }}}}</caption>\n <thead></thead>\n <tbody></tbody>\n <tbody data-ref="initial">\n <tr>\n <td data-tpl-colspan="schema.length">\n <div>\n <p data-tpl-if="config.searchIcon"><ful-icon data-tpl-name="config.searchIcon" aria-hidden="true"></ful-icon></p>\n {{ #l10n:t(\'table.initial\') }}\n </div>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="loading" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-spinner class="big" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="feedback" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <div role="alert">\n <p>{{ #l10n:t(\'table.error\') }}</p>\n <div data-ref="feedback-error"></div>\n </div>\n </td>\n </tr>\n </tbody>\n <tfoot data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </tfoot>\n </table>\n </ful-table-wrapper>\n <ful-pagination current="0" total="1"></ful-pagination>\n ';static templates={row:"\n <tr data-tpl-if=\"pageResponse.data.length == 0\">\n <td data-tpl-colspan=\"schema.length\">\n {{ #l10n:t('table.no-data') }}\n </td>\n </tr>\n {{{{ schema.rowsTemplate.withOverlay({'rows': pageResponse.data}).render() }}}}\n "};#it;#It;#J;#$t;#Bt;#jt;#Ht;#Wt;#Vt={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#Ut=!1;#Gt=new ie;get pageSize(){return this.#Vt.pageRequest.size}set pageSize(e){const t=e??10;t!==this.#Vt.pageRequest.size&&(this.#Vt={...this.#Vt,pageRequest:{page:0,size:t}},this.#Ut&&this.reload())}async render({slots:e}){const t=this.template(),s=$e.parse(e.schema,t),r=t.withOverlay({slots:e,schema:s}).render(),i=h.queryChildren(r,"ful-table-wrapper").querySelector("table");c.forward("table-",this,i),this.#it=this.component(this.declared("loader")??"loaders:table").create(this),this.#It=s,this.#J=i.querySelector(":scope > tbody"),this.#$t=i.querySelector(":scope > tbody[data-ref=loading]"),this.#Bt=i.querySelector(":scope > tbody[data-ref=initial]"),this.#jt=i.querySelector(":scope > tbody[data-ref=feedback]"),this.#Ht=h.queryChildren(r,"ful-pagination"),this.replaceChildren(r);const n=this.querySelector("thead");s.headersTemplate.renderTo(n),this.#Wt=n.querySelectorAll("ful-sorter"),await A.waitForChildren(this);const a=h.queryChildren(this,"ful-form");this.#Vt={pageRequest:{page:0,size:this.declared("page-size")??10},sortRequest:s.sort,filterRequest:a?.values??{}},a?.addEventListener("submit:success",async e=>{await this.load({page:0,size:this.#Vt.pageRequest.size},this.#Vt.sortRequest,e.detail.request)}),this.addEventListener("page:requested",async e=>{await this.load({page:e.detail.value,size:this.#Vt.pageRequest.size},this.#Vt.sortRequest,this.#Vt.filterRequest)}),this.addEventListener("sort:requested",async e=>{const t=e.detail.value.order?e.detail.value:null;await this.load(this.#Vt.pageRequest,t,this.#Vt.filterRequest),this.#Vt.sortRequest===t&&(this.#Wt.forEach(e=>{e.order=null}),e.target.order=e.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){return await this.load(this.#Vt.pageRequest,this.#Vt.sortRequest,this.#Vt.filterRequest)}async load(e,t,s){this.#Ut=!0;const r=this.#Gt.take();this.#J.replaceChildren(),this.#$t.removeAttribute("hidden"),this.#jt.setAttribute("hidden",""),this.#Bt.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const i=await this.#it.load(e,t,s);if(r.stale)return;this.#Vt={pageRequest:e,sortRequest:t,filterRequest:s},this.#qe(e,t,s,i)}catch(e){if(r.stale)return;throw this.#$t.setAttribute("hidden",""),this.#jt.removeAttribute("hidden"),this.#jt.querySelector("[data-ref=feedback-error]").textContent=k.problemsText(e,`${e}`),e}finally{r.stale||this.removeAttribute("aria-busy")}}async withLoader(e){return await e(this.#it)}async resetWithFilter(e){return await this.load({page:0,size:this.#Vt.pageRequest.size},this.#Vt.sortRequest,e)}#qe(e,t,s,r){const i=Math.ceil(r.size/e.size),n=Math.max(0,i-1);e.page>n?this.load({page:n,size:e.size},t,s):(this.#$t.setAttribute("hidden",""),this.#J.replaceChildren(this.template("row").withOverlay({schema:this.#It,pageRequest:e,filterRequest:s,pageResponse:r}).render()),this.#Ht.update({current:e.page,total:i}))}}class Ve{static narrow(e,t){const s=(e??[]).filter(e=>t.includes(e));return s.length>0?s:[...t]}#Qt;#Ke;#Kt;#Jt;#Xt;#Rt;#Yt;#Zt;#es;#ts=!1;#ss=!1;constructor(e,{vocabulary:t,glyphs:s={},labelFor:r=e=>e,display:i=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#Qt=e,this.#Ke=e.nextElementSibling,this.#Kt=t,this.#Jt=s,this.#Xt=r,this.#Rt=i??(e=>s[e]??e),this.#Yt=n,this.#Zt=a,this.#es=[...t],this.#Ke.addEventListener("click",e=>{const t=e.target.closest("li > a");if(!t||!this.#Yt())return;const s=t.getAttribute("value"),r=this.value;this.value=s,this.#Ke.hidePopover?.(),r!==s&&this.#Zt(s)})}get allowed(){return this.#es}set allowed(e){this.#es=Ve.narrow(e,this.#Kt),this.#rs(),!this.#ss&&this.#es.length>1&&(this.#le(),this.#ss=!0),this.#is(),this.pinned&&(this.value=this.#es[0])}get pinned(){return this.#es.length<2}get value(){return this.#Qt.getAttribute("value")}set value(e){this.#Qt.setAttribute("value",e),this.#Qt.textContent=this.#Rt(e),c.set(this.#Qt,"aria-label",this.#Xt(e))}set claimed(e){this.#ts=e,this.#is()}#rs(){this.#Ke.replaceChildren(...this.#es.map(e=>{const t=document.createElement("li");t.setAttribute("role","none");const s=document.createElement("a");s.setAttribute("role","menuitem"),s.setAttribute("tabindex","-1"),s.setAttribute("value",e);const r=this.#Xt(e),i=this.#Jt[e]??e;if(r===e&&i===e)s.innerText=e;else{const e=document.createElement("span");e.innerText=i;const t=document.createElement("span");t.innerText=r,s.append(e,t)}return t.append(s),t}))}#is(){const e=this.pinned;this.#Qt.toggleAttribute("disabled",e||this.#ts),c.set(this.#Qt,"aria-haspopup",e?null:"true"),c.set(this.#Qt,"aria-expanded",e?null:"false"),e?this.#Qt.removeAttribute("popovertarget"):this.#Ke.id&&this.#Qt.setAttribute("popovertarget",this.#Ke.id)}#Te(){return Array.from(this.#Ke.querySelectorAll("li > a"),e=>e)}#le(){const e=this.#Qt,t=this.#Ke;Re.wire(e,t,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),t.addEventListener("toggle",s=>{if("open"!==s.newState)return void(t.contains(document.activeElement)&&e.focus());const r=this.#Te();(r.find(e=>e.getAttribute("value")===this.value)??r[0])?.focus()}),t.addEventListener("keydown",t=>{const s=t.target.closest("li > a");if(!s)return;const r=this.#Te(),i=r.indexOf(s);switch(t.code){case"ArrowDown":t.preventDefault(),r[(i+1)%r.length]?.focus();break;case"ArrowUp":t.preventDefault(),r[(i-1+r.length)%r.length]?.focus();break;case"Home":t.preventDefault(),r[0]?.focus();break;case"End":t.preventDefault(),r[r.length-1]?.focus();break;case"Enter":case"Space":t.preventDefault(),s.click(),e.focus();break;case"Escape":e.focus()}})}}const Ue={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},Ge=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],Qe=[...Ge,"CONTAINS","STARTS_WITH","ENDS_WITH"],Ke=["IGNORE_CASE","CASE_SENSITIVE"],Je={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:Xe}=P.of(),Ye=e=>Xe(`filters.op.${e}`),Ze=e=>Xe(`filters.sensitivity.${e}`),et=e=>Xe(""===e?"filters.boolean.any":`filters.boolean.${e}`);class tt extends me{static observed=["value:json","operators:csv"];static OPERATORS=Ge;static DEFAULT_OPERATOR="EQ";static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_container;_value1;_value2;_build(e){const t=super._build(e),s=t.fragment;return this._container=s.querySelector("ful-control-group"),this._value1=s.querySelector("[data-ref=value1]"),this._value2=s.querySelector("[data-ref=value2]"),this._operator=new Ve(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:Ue,labelFor:Ye,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),this._value2.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()}),null===this._operator.value&&this._showDefaultOperator(),{...t,freeze:this._container,also:[this._value2]}}_showDefaultOperator(){const e=this._defaultOperator(),t=this._operator.allowed;this._showOperator(t.includes(e)?e:t[0])}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||this._showDefaultOperator()}_type(){return"text"}_serialize(e){return e}_deserialize(e){return e}_defaultOperator(){return"EQ"}_vocabulary(){return Ge}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){this._operator?(this._operator.allowed=e,this._syncBetween()):this._declaredOperators=Ve.narrow(e,this._vocabulary())}get value(){return this._tuple()}set value(e){this._applyTuple(e)}_tuple(){const e=this._operator.value,t="BETWEEN"===e?[this._value1.value,this._value2.value]:[this._value1.value];return t.some(e=>""===e)?null:[e,...t.map(e=>this._serialize(e))]}_applyTuple(e){if(null==e)return this._value1.value="",void(this._value2.value="");const[t,...s]=e,r=this._operator.pinned?this._operator.allowed[0]:t;this._showOperator(r),this._value1.value=s[0]?this._deserialize(s[0]):s[0]??"",this._value2.value=s[1]?this._deserialize(s[1]):s[1]??""}_showOperator(e){this._operator.value=e,this._syncBetween()}_syncBetween(){this._value2.toggleAttribute("hidden","BETWEEN"!==this._operator.value)}get disabled(){return super.disabled}set disabled(e){super.disabled=e;for(const t of this._choices())t.claimed=e}_choices(){return[this._operator].filter(e=>e)}}class st extends tt{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(e){return be.localToIso(e)}_deserialize(e){return be.isoToLocal(e)}}class rt extends tt{_type(){return"date"}}class it extends tt{_type(){return"number"}}class nt extends tt{static observed=["sensitivities:csv"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n <button data-ref="sensitivity" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_defaultOperator(){return"CONTAINS"}_vocabulary(){return Qe}_sensitivityButton;_build(e){const t=super._build(e);return this._sensitivityButton=new Ve(t.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:Ke,glyphs:Je,labelFor:Ze,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=Ke[0],t}_choices(){return[...super._choices(),this._sensitivityButton].filter(e=>e)}get _sensitivity(){return this._sensitivityButton.value}_declaredSensitivities;get sensitivities(){return this._sensitivityButton?this._sensitivityButton.allowed:this._declaredSensitivities}set sensitivities(e){if(!this._sensitivityButton)return void(this._declaredSensitivities=Ve.narrow(e,Ke));const t=this._sensitivityButton.value;this._sensitivityButton.allowed=e,this._sensitivityButton.allowed.includes(t)||(this._sensitivityButton.value=this._sensitivityButton.allowed[0])}get value(){const e=this._tuple();return null==e?null:[e[0],this._sensitivity,...e.slice(1)]}set value(e){null!=e?(this._sensitivityButton.allowed.includes(e[1])&&(this._sensitivityButton.value=e[1]),this._applyTuple([e[0],...e.slice(2)])):this._applyTuple(e)}formResetCallback(){if(super.formResetCallback(),!this.hasAttribute("value")){const e=this._sensitivityButton.allowed;this._sensitivityButton.value=e.includes("IGNORE_CASE")?"IGNORE_CASE":e[0]}}}const at=["","true","false"],ot={true:"✓",false:"✗"};class lt extends oe{static observed=["value:json","operators:csv"];static slots=!0;static OPERATORS=["EQ","NEQ"];static DEFAULT_OPERATOR="EQ";static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <button data-ref="value" type="button" form=""></button>\n <ul popover role="menu"></ul>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_value;_container;_build({slots:e}){const t=this.template().withOverlay({slots:e}).render();this._container=t.querySelector("ful-control-group");const s=t.querySelector("[data-ref=value]");this._operator=new Ve(t.querySelector("[data-ref=operator]"),{vocabulary:lt.OPERATORS,glyphs:Ue,labelFor:Ye,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new Ve(s,{vocabulary:at,glyphs:ot,labelFor:et,display:et,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators");const r=this._operator.allowed;return this._operator.value=r.includes(lt.DEFAULT_OPERATOR)?lt.DEFAULT_OPERATOR:r[0],this._value.allowed=null,this._value.value="",{fragment:t,control:s,error:t.querySelector("ful-field-error"),label:t.querySelector("label"),announces:null,freeze:this._container}}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){this._operator?this._operator.allowed=e:this._declaredOperators=Ve.narrow(e,this._vocabulary())}_vocabulary(){return lt.OPERATORS}get value(){return""===this._value.value?null:[this._operator.value,this._value.value]}set value(e){null!=e?(this._operator.value=this._operator.pinned?this._operator.allowed[0]:e[0],this._value.value=e[1]??""):this._value.value=""}get disabled(){return super.disabled}set disabled(e){super.disabled=e;for(const t of[this._operator,this._value].filter(e=>e))t.claimed=e}}class ut{#ns=new WeakSet;#ie=new WeakMap;async request(e,t,s,r){const i=!this.#ns.has(t),n={name:s,section:t,index:r,first:i},a=["section:requested",...null!=r?[`section:requested:#${r}`]:[],...s?[`section:requested:${s}`]:[]],o=[];for(const t of a){const s=new CustomEvent(t,{bubbles:!0,detail:n});e.dispatchEvent(s),o.push(...s.async?.promises??[])}if(0===o.length)return;this.#ns.add(t);let l=this.#ie.get(t);l||(l=new ie,this.#ie.set(t,l));const u=l.take(),c=()=>!u.stale;t.querySelector(":scope > .ful-section-error")?.remove();const d=requestAnimationFrame(()=>{c()&&(t.toggleAttribute("loading",!0),t.setAttribute("aria-busy","true"))});try{return await Promise.all(o)}catch(e){throw c()&&this.#as(t,e),e}finally{cancelAnimationFrame(d),c()&&(t.toggleAttribute("loading",!1),t.removeAttribute("aria-busy"))}}#as(e,t){e.querySelector(":scope > .ful-section-error")?.remove();const s=document.createElement("div");s.className="ful-section-error",s.setAttribute("role","alert"),s.textContent=k.problemsText(t),e.prepend(s)}}let ct=!1;const dt=()=>{ct||(ct=!0,document.addEventListener("click",e=>{const t=e.target.closest?.("[dialog-target]");t&&document.getElementById(t.getAttribute("dialog-target"))?.open?.()}))};class ht extends S{static slots=!0;static attributes=["placement"];static config={icon:"info-circle-fill"};static template='\n <button type="button" class="ful-tip" data-ref="trigger" data-tpl-aria-label="#l10n:t(\'info.tooltip\')"><ful-icon data-tpl-name="config.icon" aria-hidden="true"></ful-icon></button>\n <ful-note popover data-ref="content">{{{{ slots.default }}}}</ful-note>\n ';render({slots:e}){const t=this.template().withOverlay({slots:e}).render(),s=t.querySelector("[data-ref=trigger]"),r=t.querySelector("[data-ref=content]");Re.wire(s,r,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0});const i=this.declared("placement");i&&r.setAttribute("placement",i),this.replaceChildren(t)}}class pt extends S{static attributes=["header"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-dialog">\n <header data-tpl-if="header"><h2>{{ header }}</h2></header>\n <div data-ref="body">{{{{ slots.default }}}}</div>\n <footer>\n <button type="button" data-ref="acknowledge" data-result="acknowledged" data-tpl-if="!slots.buttons" data-tpl-aria-label="#l10n:t(\'dialog.acknowledge\')">{{ #l10n:t(\'dialog.acknowledge\') }}</button>\n {{{{ slots.buttons }}}}\n </footer>\n </dialog>\n ';#os;#J;#ls=new ut;#us=[];render({slots:e}){const t=this.template().withOverlay({slots:e,header:this.declared("header")??""}).render();this.#os=t.querySelector("[data-ref=dialog]"),this.#J=t.querySelector("[data-ref=body]"),this.#os.addEventListener("close",()=>{this.dispatchEvent(new CustomEvent("close",{detail:{result:""===this.#os.returnValue?null:this.#os.returnValue}})),this.#he()}),this.#os.addEventListener("click",e=>{const t=e.target.closest("button[data-result]")?.dataset.result;void 0!==t&&this.#os.close(t)}),this.replaceChildren(t),dt()}#he(){const e=this.#us;this.#us=[];for(const t of e)t(""===this.#os.returnValue?null:this.#os.returnValue)}disconnectedCallback(){this.#he()}open(){return this.ask()}ask(){return this.#os.open||(this.#os.returnValue="",this.#os.showModal(),this.#cs()),new Promise(e=>{this.#us.push(e)})}#cs(){this.#ls.request(this,this.#J,null,null)?.catch(()=>{})}refresh(){return this.#ls.request(this,this.#J,null,null)?.then(void 0,()=>{})}close(e){this.#os.close(e??"")}}class ft extends S{static attributes=["title","placement"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-drawer">\n <header>\n {{{{ slots.header }}}}\n <h2 data-ref="title">{{ title }}</h2>\n <button type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'drawer.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <section data-ref="content">{{{{ slots.default }}}}</section>\n </dialog>\n ';#os;#ds;#$t;#hs;#ps;#ls=new ut;#fs=new ie;render({slots:e}){const t=this.template().withOverlay({slots:e,title:this.declared("title")??""}).render();this.#os=t.querySelector("[data-ref=dialog]"),this.#ds=t.querySelector("[data-ref=title]"),this.#$t=t.querySelector("[data-ref=loading]"),this.#hs=t.querySelector("[data-ref=error]"),this.#ps=t.querySelector("[data-ref=content]");const s=this.declared("placement");s&&this.#os.setAttribute("placement",s),t.querySelector("[data-ref=close]").addEventListener("click",()=>this.close()),this.#os.addEventListener("close",()=>{this.dispatchEvent(new CustomEvent("close"))}),this.replaceChildren(t),dt()}get title(){return this.#ds.textContent}set title(e){this.#ds.textContent=e??""}async update(e,t){const s=this.#fs.take();this.title=e,this.#ps.replaceChildren(),this.#ms(),this.#$t.removeAttribute("hidden"),this.#ps.setAttribute("hidden",""),this.#gs();try{const e=await t();return s.stale||(this.#ps.replaceChildren(e),this.#$t.setAttribute("hidden",""),this.#ps.removeAttribute("hidden")),this.#ps}catch(e){throw s.stale||(this.#hs.removeAttribute("hidden"),this.#hs.textContent=k.problemsText(e),this.#$t.setAttribute("hidden",""),this.#ps.setAttribute("hidden","")),e}}refresh(){return this.#ls.request(this,this.#ps,null,null)?.then(void 0,()=>{})}open(){this.#gs()&&(this.#ms(),this.#ls.request(this,this.#ps,null,null)?.catch(()=>{}))}close(){this.#os.close()}#gs(){return!this.#os.open&&(this.#os.showModal(),!0)}#ms(){this.#hs.replaceChildren(),this.#hs.setAttribute("hidden",""),this.#$t.setAttribute("hidden",""),this.#ps.removeAttribute("hidden")}}const mt=["info","success","warning","error"],gt=new Set;let bt=!1;class vt extends S{static attributes=["timeout:number"];#bs;connectedCallback(){super.connectedCallback(),this.rendered&>.add(this)}disconnectedCallback(){gt.delete(this)}render(){this.#bs=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",P.of().t("toast.region")),bt||(bt=!0,document.addEventListener("show-toast",e=>{for(const t of gt)t.show(e.detail.message,e.detail)})),gt.add(this)}show(e,t={}){const s=mt.includes(t.severity)?t.severity:"info",r=document.createElement("ful-toast");r.classList.add(s),r.setAttribute("role","error"===s?"alert":"status");const i=document.createElement("div");i.textContent=k.problemsText(e,`${e??""}`);const n=document.createElement("button");n.type="button",n.setAttribute("aria-label",P.of().t("toast.dismiss"));const a=document.createElement("ful-icon");a.setAttribute("name","x-lg"),a.setAttribute("aria-hidden","true"),n.append(a),r.append(i,n),r.addEventListener("animationend",()=>{r.classList.contains("ful-toast-out")&&r.remove()});const o=()=>{r.contains(document.activeElement)&&this.focus(),matchMedia("(prefers-reduced-motion: reduce)").matches?r.remove():(r.classList.add("ful-toast-out"),0===r.getAnimations().length&&r.remove())};return n.addEventListener("click",o),this.append(r),setTimeout(o,t.timeout??this.#bs),r}}class yt extends S{static slots=!0;static observed=["active:number"];static template='\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n {{{{ slots.default }}}}\n ';#vs;#ys=[];#ws=[];#ls=new ut;#Es=0;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#vs=t.querySelector("ful-tablist");const s=[...this.#vs.children];this.#ws=[...t.children].filter(e=>e!==this.#vs),s.length!==this.#ws.length&&console.warn(`ful-tabs: ${s.length} tabs declared for ${this.#ws.length} panels, the surplus is left alone`);const r=Math.min(s.length,this.#ws.length);this.#ys=[];for(let e=0;e!==r;++e){const t=this.#ws[e],r=document.createElement("button");r.type="button",r.role="tab",r.id=c.uid("ful-tab"),t.id||(t.id=c.uid("ful-tabpanel")),r.setAttribute("aria-controls",t.id),t.role="tabpanel",t.setAttribute("aria-labelledby",r.id),t.tabIndex=0,r.append(...s[e].childNodes),r.addEventListener("click",()=>{this.active=e}),s[e].replaceWith(r),this.#ys.push(r)}this.#vs.addEventListener("keydown",e=>{const t=this.#Es;let s=null;"ArrowRight"===e.key?s=(t+1)%this.#ys.length:"ArrowLeft"===e.key?s=(t-1+this.#ys.length)%this.#ys.length:"Home"===e.key?s=0:"End"===e.key&&(s=this.#ys.length-1),null!==s&&s!==t&&(e.preventDefault(),this.active=s,this.#ys[s].focus())}),this.replaceChildren(t)}get active(){return this.#Es}refresh(e){const t=e instanceof Element?this.#ws.indexOf(e):Number.isInteger(e)?e:NaN,s=this.#ws[t];if(s)return this.#ls.request(this,s,null,t)?.then(void 0,()=>{});console.warn(`ful-tabs: no panel answers to "${e}"`)}set active(e){const t=Math.min(Math.max(0,Number(e)||0),Math.max(0,this.#ys.length-1)),s=this.#Es;for(const[e,s]of this.#ys.entries())s.setAttribute("aria-selected",e===t?"true":"false"),s.tabIndex=e===t?0:-1,this.#ws[e].hidden=e!==t;this.#Es=t,this.reflectTo("active",t),this.rendered&&t!==s&&this.dispatchEvent(new CustomEvent("change",{detail:{active:t,previous:s}})),this.#ws.length>0&&(t!==s||!this.rendered)&&this.#ls.request(this,this.#ws[t],null,t)?.catch(()=>{})}}class wt extends S{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#Oe;#xs=!1;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#Oe=t.querySelector("ful-accordion-group"),this.replaceChildren(t)}get exclusive(){return this.#xs}set exclusive(e){this.#xs=!0===e,this.reflectTo("exclusive",this.#xs);const t=this.#xs?c.uid("ful-accordion"):null;for(const e of this.#Oe.querySelectorAll(":scope > details"))null===t?e.removeAttribute("name"):e.setAttribute("name",t)}}class Et extends S{static slots=!0;static observed=["progress"];static template="\n <ful-steps><ol data-tpl-aria-label=\"#l10n:t('wizard.progress')\">{{{{ slots.steps }}}}</ol></ful-steps>\n {{{{ slots.default }}}}\n ";#As=[];#Ss=[];#ls=new ut;#Ts=0;#Cs;render({slots:e}){const t=this.template().withOverlay({slots:e}).render(),s=[...t.querySelector("ful-steps ol").children];this.#Ss=[...t.children].filter(e=>"ful-steps"!==e.localName),s.length!==this.#Ss.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#Ss.length} sections, the surplus is left alone`);const r=Math.min(s.length,this.#Ss.length);this.#As=[];for(let e=0;e!==r;++e){const t=document.createElement("li");t.append(...s[e].childNodes),s[e].replaceWith(t),this.#As.push(t),this.#Ss[e].tabIndex=-1}if(this.replaceChildren(t),r>0){const e=this.#Ss.findIndex(e=>"step"===e.getAttribute("aria-current"));this.#_s(-1===e?0:Math.min(e,r-1)),this.#Os(this.#Ts)?.catch(()=>{})}}get index(){return this.#Ts}get step(){return this.#Ss[this.#Ts]?.getAttribute("data-step")??null}get progress(){return this.#Cs}set progress(e){this.#Cs=e,this.reflectTo("progress",e)}next(){return this.#Rs(this.#Ts+1)}prev(){return this.#Rs(this.#Ts-1)}move(e){const t=this.#Ss.findIndex(t=>t.getAttribute("data-step")===e);if(-1!==t)return this.#Rs(t);console.warn(`ful-wizard: no section carries data-step="${e}"`)}refresh(e){const t=e instanceof Element?e:"string"==typeof e?this.#Ss.find(t=>t.getAttribute("data-step")===e):void 0,s=this.#Ss.indexOf(t);if(-1!==s)return this.#Os(s)?.then(void 0,()=>{});console.warn(`ful-wizard: no section answers to "${e}"`)}#Os(e){return this.#ls.request(this,this.#Ss[e],this.#Ss[e].getAttribute("data-step"),e)}#Rs(e){const t=Math.min(Math.max(0,e),Math.max(0,this.#As.length-1));if(t!==this.#Ts)return this.#_s(t),this.#Ss[this.#Ts].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("change",{detail:{index:this.#Ts,step:this.step}})),this.#Os(t)}#_s(e){for(const[t,s]of this.#As.entries())t===e?(s.setAttribute("aria-current","step"),this.#Ss[t].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#Ss[t].removeAttribute("aria-current"));this.#Ts=e}}const xt={en:{"pagination.showing":"Page {current} of {total}","pagination.navigation":"Page navigation","pagination.previous":"Previous","pagination.next":"Next","pagination.reload":"Reload","table.initial":"Start searching to see results.","table.error":"Error while loading data:","table.no-data":"No elements found.","dropdown.empty":"No results","select.remove":"Remove","files.dropzone-label":"Click or drop your files here","files.remove":"Remove","files.unacceptable-file-type":"Only files of type {types} are supported","files.max-file-size-exceeded":"Maximum supported file size is {size}","files.max-total-size-exceeded":"Maximum supported total file size is {size}","files.max-files-exceeded":{one:"Maximum of {count} file exceeded",other:"Maximum of {count} files exceeded"},"filters.op.EQ":"Equals","filters.op.NEQ":"Not equal","filters.op.LT":"Less than","filters.op.GT":"Greater than","filters.op.LTE":"At most","filters.op.GTE":"At least","filters.op.BETWEEN":"Between","filters.op.CONTAINS":"Contains","filters.op.STARTS_WITH":"Starts with","filters.op.ENDS_WITH":"Ends with","filters.sensitivity.IGNORE_CASE":"Ignore case","filters.sensitivity.CASE_SENSITIVE":"Case sensitive","filters.boolean.any":"Any","filters.boolean.true":"Yes","filters.boolean.false":"No","info.tooltip":"More information","dialog.acknowledge":"Got it","drawer.close":"Close","spinner.loading":"Loading…","toast.region":"Notifications","toast.dismiss":"Dismiss","wizard.progress":"Progress"},it:{"pagination.showing":"Pagina {current} di {total}","pagination.navigation":"Navigazione pagine","pagination.previous":"Precedente","pagination.next":"Successivo","pagination.reload":"Ricarica","table.initial":"Avvia la ricerca per visualizzare i risultati.","table.error":"Errore nel caricamento dei dati:","table.no-data":"Nessun elemento trovato.","dropdown.empty":"Nessun risultato","select.remove":"Rimuovi","files.dropzone-label":"Clicca o trascina i file qui","files.remove":"Rimuovi","files.unacceptable-file-type":"Solo i file di tipo {types} sono supportati","files.max-file-size-exceeded":"La dimensione massima di un file è di {size}","files.max-total-size-exceeded":"La dimensione massima complessiva dei file è di {size}","files.max-files-exceeded":{other:"Superato il numero massimo di {count} file"},"filters.op.EQ":"Uguale","filters.op.NEQ":"Diverso","filters.op.LT":"Minore","filters.op.GT":"Maggiore","filters.op.LTE":"Al massimo","filters.op.GTE":"Almeno","filters.op.BETWEEN":"Tra","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Inizia con","filters.op.ENDS_WITH":"Termina con","filters.sensitivity.IGNORE_CASE":"Ignora maiuscole","filters.sensitivity.CASE_SENSITIVE":"Distingui maiuscole","filters.boolean.any":"Qualsiasi","filters.boolean.true":"Sì","filters.boolean.false":"No","info.tooltip":"Maggiori informazioni","dialog.acknowledge":"Ho capito","drawer.close":"Chiudi","spinner.loading":"Caricamento…","toast.region":"Notifiche","toast.dismiss":"Chiudi","wizard.progress":"Avanzamento"},es:{"pagination.showing":"Página {current} de {total}","pagination.navigation":"Navegación de páginas","pagination.previous":"Anterior","pagination.next":"Siguiente","pagination.reload":"Recargar","table.initial":"Inicia la búsqueda para ver los resultados.","table.error":"Error al cargar los datos:","table.no-data":"No se encontraron elementos.","dropdown.empty":"Sin resultados","select.remove":"Eliminar","files.dropzone-label":"Haz clic o arrastra tus archivos aquí","files.remove":"Eliminar","files.unacceptable-file-type":"Solo se admiten archivos de tipo {types}","files.max-file-size-exceeded":"El tamaño máximo de archivo admitido es {size}","files.max-total-size-exceeded":"El tamaño total máximo admitido es {size}","files.max-files-exceeded":{other:"Se ha superado el número máximo de {count} archivos"},"filters.op.EQ":"Igual","filters.op.NEQ":"Distinto","filters.op.LT":"Menor","filters.op.GT":"Mayor","filters.op.LTE":"Como máximo","filters.op.GTE":"Al menos","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Empieza por","filters.op.ENDS_WITH":"Termina por","filters.sensitivity.IGNORE_CASE":"Ignorar mayúsculas","filters.sensitivity.CASE_SENSITIVE":"Distinguir mayúsculas","filters.boolean.any":"Cualquiera","filters.boolean.true":"Sí","filters.boolean.false":"No","info.tooltip":"Más información","dialog.acknowledge":"Entendido","drawer.close":"Cerrar","spinner.loading":"Cargando…","toast.region":"Notificaciones","toast.dismiss":"Cerrar","wizard.progress":"Progreso"},fr:{"pagination.showing":"Page {current} sur {total}","pagination.navigation":"Navigation des pages","pagination.previous":"Précédent","pagination.next":"Suivant","pagination.reload":"Recharger","table.initial":"Lancez la recherche pour voir les résultats.","table.error":"Erreur lors du chargement des données :","table.no-data":"Aucun élément trouvé.","dropdown.empty":"Aucun résultat","select.remove":"Retirer","files.dropzone-label":"Cliquez ou déposez vos fichiers ici","files.remove":"Retirer","files.unacceptable-file-type":"Seuls les fichiers de type {types} sont pris en charge","files.max-file-size-exceeded":"La taille maximale de fichier prise en charge est {size}","files.max-total-size-exceeded":"La taille totale maximale prise en charge est {size}","files.max-files-exceeded":{one:"Nombre maximal de {count} fichier dépassé",other:"Nombre maximal de {count} fichiers dépassé"},"filters.op.EQ":"Égal","filters.op.NEQ":"Différent","filters.op.LT":"Inférieur","filters.op.GT":"Supérieur","filters.op.LTE":"Au plus","filters.op.GTE":"Au moins","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contient","filters.op.STARTS_WITH":"Commence par","filters.op.ENDS_WITH":"Finit par","filters.sensitivity.IGNORE_CASE":"Ignorer la casse","filters.sensitivity.CASE_SENSITIVE":"Respecter la casse","filters.boolean.any":"Indifférent","filters.boolean.true":"Oui","filters.boolean.false":"Non","info.tooltip":"Plus d’informations","dialog.acknowledge":"J’ai compris","drawer.close":"Fermer","spinner.loading":"Chargement…","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};class At{#qs;#Ns;#Ps;constructor(e={}){this.#qs=e.language??navigator?.language??"en",this.#Ns=e.translations??{},this.#Ps=e.httpClient??null}configure(e){const t=this.#Ps??V.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),s=this.#qs.split("-")[0],r={...xt.en,...xt[s],...this.#Ns};e.defineModule("l10n",P).defineComponent("http-client",t).defineElement("ful-tooltip",ht).defineElement("ful-dialog",pt).defineElement("ful-drawer",ft).defineElement("ful-toasts",vt).defineElement("ful-tabs",yt).defineElement("ful-accordion",wt).defineElement("ful-wizard",Et).defineElement("ful-form",de).defineElement("ful-checkbox",De).defineElement("ful-input",me).defineElement("ful-input-file",Ee).defineElement("ful-local-date",ge).defineElement("ful-instant",be).defineElement("ful-input-local-date",ve).defineElement("ful-input-local-time",ye).defineElement("ful-input-instant",we).defineElement("ful-radio-group",Me).defineElement("ful-table",We).defineElement("ful-pagination",Ie).defineElement("ful-sorter",Fe).defineElement("ful-filter-instant",st).defineElement("ful-filter-local-date",rt).defineElement("ful-filter-number",it).defineElement("ful-filter-boolean",lt).defineElement("ful-filter-text",nt).defineElement("ful-select",ze).defineElement("ful-dropdown",ke).defineComponent("loaders:select",Le).defineComponent("loaders:form",ce).defineComponent("loaders:table",He).defineOverlay({l10n:r,locale:this.#qs})}}var St=Object.freeze({__proto__:null,Accordion:wt,Anchors:Re,AsyncEvents:re,Bindings:ae,BooleanFilter:lt,Checkbox:De,Claims:ie,CompareFilter:tt,Dialog:pt,Drawer:ft,Dropdown:ke,Field:oe,Form:de,FormLoader:ce,Input:me,InputFile:Ee,InputInstant:we,InputLocalDate:ve,InputLocalTime:ye,Instant:be,InstantFilter:st,LocalDate:ge,LocalDateFilter:rt,LocalStorage:Z,NumberFilter:it,Pagination:Ie,Plugin:At,RadioGroup:Me,Select:ze,SelectLoader:Le,SessionStorage:ee,SortButton:Fe,Table:We,TableLoader:He,TableSchemaParser:$e,Tabs:yt,TextFilter:nt,Timing:ne,Toasts:vt,Tooltip:ht,VersionedLocalStorage:te,VersionedSessionStorage:se,Wizard:Et});return"undefined"!=typeof window&&(window.ftl=L,window.httpc=J,window.ful=St),e.Accordion=wt,e.Anchors=Re,e.AsyncEvents=re,e.Attributes=c,e.Base64=z,e.Bindings=ae,e.BooleanFilter=lt,e.BoundedCache=t,e.Checkbox=De,e.Claims=ie,e.CompareFilter=tt,e.Dialog=pt,e.Drawer=ft,e.Dropdown=ke,e.ExpressionEvaluator=l,e.Expressions=o,e.Failure=k,e.Field=oe,e.Form=de,e.FormLoader=ce,e.Fragments=u,e.Hex=M,e.HttpClient=V,e.HttpClientBuilder=j,e.HttpClientError=F,e.HttpInterceptorChain=W,e.HttpMultipartRequestCustomizer=K,e.HttpRequestBuilder=Q,e.Input=me,e.InputFile=Ee,e.InputInstant=we,e.InputLocalDate=ve,e.InputLocalTime=ye,e.Instant=be,e.InstantFilter=st,e.LightSlots=d,e.LocalDate=ge,e.LocalDateFilter=rt,e.LocalStorage=Z,e.Localization=P,e.MediaType=D,e.Nodes=h,e.NumberFilter=it,e.Pagination=Ie,e.ParsedElement=S,e.Plugin=At,e.RadioGroup=Me,e.Registry=w,e.RenderError=v,e.Rendering=A,e.Select=ze,e.SelectLoader=Le,e.SessionStorage=ee,e.SortButton=Fe,e.Table=We,e.TableLoader=He,e.TableSchemaParser=$e,e.Tabs=yt,e.Template=b,e.Templates=x,e.TextFilter=nt,e.Timing=ne,e.Toasts=vt,e.Tooltip=ht,e.VersionedLocalStorage=te,e.VersionedSessionStorage=se,e.Wizard=Et,e.registry=E,e}({});
|
|
1
|
+
var fml=function(t){"use strict";class e{#t;#e=new Map;constructor(t){this.#t=t}getOrCompute(t,e){if(this.#e.has(t))return this.#e.get(t);const s=e(t);return this.#e.size>=this.#t&&this.#e.delete(this.#e.keys().next().value),this.#e.set(t,s),s}get size(){return this.#e.size}}const s={ter:Symbol("ternary"),elv:Symbol("elvis"),nullc:Symbol("null-coalescence"),or:Symbol("or"),and:Symbol("and"),eq:Symbol("eq"),cmp:Symbol("cmp"),not:Symbol("not"),access:Symbol("access"),member:Symbol("access-member"),subscript:Symbol("access-subscript"),method:Symbol("access-method-call"),call:Symbol("module-function-call"),tstring:Symbol("tstring"),literal:Symbol("literal"),array:Symbol("array-literal"),dict:Symbol("dict-literal"),function:Symbol("module-function"),symbol:Symbol("symbol"),templated:{ten:Symbol("templated-node"),teh:Symbol("templated-html"),tet:Symbol("templated-text"),tel:Symbol("templated-literal")},dom:{t:Symbol("text"),h:Symbol("html"),n:Symbol("node")}},i=new Map([["true",!0],["false",!1],["null",null],["undefined",void 0]]);class r extends SyntaxError{constructor(t,e,s,i){super(t),this.expected=e,this.found=s,this.location=i,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let s=null;const i=t.find(t=>t.source===this.location.source);i&&(s=i.text.split(/\r\n|\n|\r/g));const r=this.location.start,n=this.location.source&&"function"==typeof this.location.source.offset?this.location.source.offset(r):r,a=this.location.source+":"+n.line+":"+n.column;if(s){const t=this.location.end,i="".padEnd(n.line.toString().length," "),o=s[r.line-1],l=(r.line===t.line?t.column:o.length+1)-r.column||1;e+="\n --\x3e "+a+"\n"+i+" |\n"+n.line+" | "+o+"\n"+i+" | "+"".padEnd(r.column-1," ")+"".padEnd(l,"^")}else e+="\n at "+a}return e}static buildMessage(t,e){function s(t){return t.codePointAt(0).toString(16).toUpperCase()}const i=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function r(t,e){return function(t){return i?t.replace(i,t=>"\\u{"+s(t)+"}"):t}(t.replace(e,"\\$&").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,t=>"\\x0"+s(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+s(t)))}function n(t){return r(t,/[\\"]/g)}function a(t){return r(t,/[\\\]^-]/g)}const o={literal:t=>'"'+n(t.text)+'"',class(t){const e=t.parts.map(t=>Array.isArray(t)?a(t[0])+"-"+a(t[1]):a(t));return"["+(t.inverted?"^":"")+e.join("")+"]"+(t.unicode?"u":"")},any:()=>"any character",end:()=>"end of input",other:t=>t.description};function l(t){return o[t.type](t)}return"Expected "+function(t){const e=t.map(l);if(e.sort(),e.length>0){let t=1;for(let s=1;s<e.length;s++)e[s-1]!==e[s]&&(e[t]=e[s],t++);e.length=t}switch(e.length){case 1:return e[0];case 2:return e[0]+" or "+e[1];default:return e.slice(0,-1).join(", ")+", or "+e[e.length-1]}}(t)+" but "+function(t){return t?'"'+n(t)+'"':"end of input"}(e)+" found."}}const n=(t,e)=>{if("self"===e)return t[t.length-1];for(let s=t.length-1;s>=0;s--){const i=t[s];if(null!=i&&("object"==typeof i||"function"==typeof i)&&e in i)return i[e]}},a=Symbol("BOUND");class o{#s;#i;#r;constructor(t,e,s){this.#s=t,this.#i=e,this.#r=s??e.length}#n(t){return n(this.#i,t)}#a(t,e){const i=0===e?t.lhs:t.rhs[e-1];return i.type===s.symbol?i.value:i.type===s.member?i.rhs:null}#o;#l(){if(!this.#o){const t=t=>n(this.#i.slice(0,this.#r),t);this.#o=new Proxy(this.#i,{get:(e,s)=>s===a?t:this.#n(s)})}return this.#o}[s.and](t){return this.visit(t.lhs)&&this.visit(t.rhs)}[s.or](t){return this.visit(t.lhs)||this.visit(t.rhs)}[s.nullc](t){return this.visit(t.lhs)??this.visit(t.rhs)}[s.not](t){return!this.visit(t.expr)}[s.eq](t){const e=this.visit(t.lhs)===this.visit(t.rhs);return"=="===t.op?e:!e}[s.cmp](t){const e=this.visit(t.lhs),s=this.visit(t.rhs);switch(t.op){case">":return e>s;case"<":return e<s;case">=":return e>=s;case"<=":return e<=s;default:throw new Error(`unknown cmp op ${t.op}`)}}[s.call](t){const e=t.value,s=null===e.module?this.#s:this.#s?.[e.module];if(!s)throw new Error(`Module "${e.module}" not found`);const i=s[e.value];if(!i)throw new Error(`Function "#${null===e.module?"":`${e.module}:`}${e.value}" not found`);const r=t.args.map(t=>this.visit(t));return i.apply(this.#l(),r)}[s.literal](t){return t.value}[s.tstring](t){let e="";const s=t.parts;for(let t=0,i=s.length;t<i;t++){const i=this.visit(s[t]);null!=i&&(e+=i)}return e}[s.symbol](t){return this.#n(t.value)}[s.dict](t){return Object.fromEntries(t.value.map(t=>[this.visit(t[0]),this.visit(t[1])]))}[s.array](t){return t.value.map(t=>this.visit(t))}[s.ter](t){return this.visit(t.cond)?this.visit(t.ifTrue):this.visit(t.ifFalse)}[s.elv](t){return this.visit(t.cond)||this.visit(t.ifFalse)}[s.access](t){let e,i=this.visit(t.lhs);for(let r=0;r!==t.rhs.length;++r){const n=t.rhs[r];if(n.ns&&null==i)return;let a;switch(n.type){case s.member:a=i[n.rhs];break;case s.subscript:a=i[this.visit(n.rhs)];break;case s.method:{if(!i){const e=this.#a(t,r);throw new Error(null===e?"Method missing":`Method missing "${e}"`)}const s=n.args.map(t=>this.visit(t));a=i.apply(e,s);break}}e=i,i=a}return i}visit(t,...e){return this[t.type](t,...e)}visitRoot(t,e){return e?t.map(t=>{switch(t.type){case s.templated.tel:return{type:s.dom.t,value:t.value};case s.templated.tet:return{type:s.dom.t,value:this.visit(t.value)};case s.templated.teh:return{type:s.dom.h,value:this.visit(t.value)};case s.templated.ten:return{type:s.dom.n,value:this.visit(t.value)};default:throw new Error(`unknown node type ${t.type.toString()}`)}}):this.visit(t)}}class l{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static BOUND=a;static#u=new e(1e3);static parse(t,e){const n=e?.toString()+t;return this.#u.getOrCompute(n,()=>function(t,e){const n={},a=(e=void 0!==e?e:{}).grammarSource,o={TemplatedRoot:le,ExpressionRoot:ce};let l=le;const u="{{{{",c="}}}}",d="{{{",h="}}}",p="{{",f="}}",m="\\",g="{",b="?",v=":",y="?:",w="??",E="||",x="&&",A="!",S="?.",C=".",T="[",_="]",k="(",O=",",q=")",L="-",N="'",P='"',R="`",F="}",M="#",I="==",z="!=",D=">=",$=">",B="<=",j="<",H=se("{{{{",!1),V=se("}}}}",!1),W=se("{{{",!1),U=se("}}}",!1),G=se("{{",!1),Q=se("}}",!1),K=ie(["\\","{"],!0,!1,!1),J=se("\\",!1),X={type:"any"},Y=se("{",!1),Z=se("?",!1),tt=se(":",!1),et=se("?:",!1),st=se("??",!1),it=se("||",!1),rt=se("&&",!1),nt=se("!",!1),at=re("member"),ot=se("?.",!1),lt=se(".",!1),ut=re("subscript"),ct=se("[",!1),dt=se("]",!1),ht=re("method-call"),pt=se("(",!1),ft=se(",",!1),mt=se(")",!1),gt=re("module-function-call"),bt=re("number-literal"),vt=se("-",!1),yt=ie([["0","9"]],!1,!1,!1),wt=re("string-literal"),Et=se("'",!1),xt=ie(["'"],!0,!1,!1),At=se('"',!1),St=ie(['"'],!0,!1,!1),Ct=se("`",!1),Tt=re("tstring-expression"),_t=se("}",!1),kt=re("tstring-literal"),Ot=ie(["\\","`","{"],!0,!1,!1),qt=re("array-literal"),Lt=re("dict-literal"),Nt=re("module-function"),Pt=se("#",!1),Rt=ie([["a","z"],["A","Z"],"$","_"],!1,!1,!1),Ft=ie([["a","z"],["A","Z"],"$","_",["0","9"]],!1,!1,!1),Mt=re("identifier-or-keyword"),It=se("==",!1),zt=se("!=",!1),Dt=se(">=",!1),$t=se(">",!1),Bt=se("<=",!1),jt=se("<",!1),Ht=ie([" ","\t","\n","\r"],!1,!1,!1);function Vt(t){return t}function Wt(t,e,s){return{op:e,rhs:s}}function Ut(t,e,s){return{op:e,rhs:s}}function Gt(t){return t}let Qt=0|e.peg$currPos;const Kt=[{line:1,column:1}];let Jt,Xt,Yt=Qt,Zt=e.peg$maxFailExpected||[],te=0|e.peg$silentFails,ee=new Map;if(e.startRule){if(!(e.startRule in o))throw new Error("Can't start parsing from rule \""+e.startRule+'".');l=o[e.startRule]}function se(t,e){return{type:"literal",text:t,ignoreCase:e}}function ie(t,e,s,i){return{type:"class",parts:t,inverted:e,ignoreCase:s,unicode:i}}function re(t){return{type:"other",description:t}}function ne(e){let s,i=Kt[e];if(i)return i;if(e>=Kt.length)s=Kt.length-1;else for(s=e;!Kt[--s];);for(i=Kt[s],i={line:i.line,column:i.column};s<e;)10===t.charCodeAt(s)?(i.line++,i.column=1):i.column++,s++;return Kt[e]=i,i}function ae(t,e,s){const i=ne(t),r=ne(e);return{source:a,start:{offset:t,line:i.line,column:i.column},end:{offset:e,line:r.line,column:r.column}}}function oe(t){Qt<Yt||(Qt>Yt&&(Yt=Qt,Zt=[]),Zt.push(t))}function le(){let t,e;const s=38*Qt+0,i=ee.get(s);if(i)return Qt=i.nextPos,i.result;for(t=[];e=ue(),e!==n;)t.push(e);return ee.set(s,{nextPos:Qt,result:t}),t}function ue(){let e,i,r,a,o;const l=38*Qt+1,b=ee.get(l);return b?(Qt=b.nextPos,b.result):(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+2,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,4)===u?(e=u,Qt+=4):(e=n,0===te&&oe(H)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+3,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,4)===c?(e=c,Qt+=4):(e=n,0===te&&oe(V)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(v=i,i={type:s.templated.ten,value:v}),e=i,e===n&&(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+4,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,3)===d?(e=d,Qt+=3):(e=n,0===te&&oe(W)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+5,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,3)===h?(e=h,Qt+=3):(e=n,0===te&&oe(U)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(i=function(t){return{type:s.templated.teh,value:t}}(i)),e=i,e===n&&(e=Qt,i=Qt,r=function(){let e;const s=38*Qt+6,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===p?(e=p,Qt+=2):(e=n,0===te&&oe(G)),ee.set(s,{nextPos:Qt,result:e}),e)}(),r!==n?(a=ce(),a!==n?(o=function(){let e;const s=38*Qt+7,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===f?(e=f,Qt+=2):(e=n,0===te&&oe(Q)),ee.set(s,{nextPos:Qt,result:e}),e)}(),o!==n?i=a:(Qt=i,i=n)):(Qt=i,i=n)):(Qt=i,i=n),i!==n&&(i=function(t){return{type:s.templated.tet,value:t}}(i)),e=i,e===n&&(e=Qt,i=function(){let e,s,i,r,a,o,l;const u=38*Qt+8,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;for(e=Qt,s=[];;){for(i=Qt,r=[];a=t.charAt(Qt),""!==a&&(Xt=a.charCodeAt(0),92!==Xt&&123!==Xt)?Qt++:(a=n,0===te&&oe(K)),a!==n;)r.push(a);if(r.length<1&&(r=n),i=r!==n?t.substring(i,Qt):r,i===n&&(i=Qt,92===t.charCodeAt(Qt)?(r=m,Qt++):(r=n,0===te&&oe(J)),r!==n?(t.length>Qt?(a=t.charAt(Qt),Qt++):(a=n,0===te&&oe(X)),a!==n?i=Vt(a):(Qt=i,i=n)):(Qt=i,i=n),i===n&&(i=Qt,r=Qt,123===t.charCodeAt(Qt)?(a=g,Qt++):(a=n,0===te&&oe(Y)),a!==n?(o=Qt,te++,123===t.charCodeAt(Qt)?(l=g,Qt++):(l=n,0===te&&oe(Y)),te--,l===n?o=void 0:(Qt=o,o=n),o!==n?(a=[a,o],r=a):(Qt=r,r=n)):(Qt=r,r=n),i=r!==n?t.substring(i,Qt):r)),i===n)break;s.push(i)}return s.length<1&&(s=n),s!==n&&(s=s.join("")),e=s,ee.set(u,{nextPos:Qt,result:e}),e}(),i!==n&&(i=function(t){return{type:s.templated.tel,value:t}}(i)),e=i))),ee.set(l,{nextPos:Qt,result:e}),e);var v}function ce(){let t,e;const s=38*Qt+9,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t=Qt,_e(),e=de(),e!==n?(_e(),t=e):(Qt=t,t=n),ee.set(s,{nextPos:Qt,result:t}),t)}function de(){let e,i,r,a,o,l;const u=38*Qt+10,c=ee.get(u);return c?(Qt=c.nextPos,c.result):(e=Qt,i=he(),i!==n?(_e(),63===t.charCodeAt(Qt)?(r=b,Qt++):(r=n,0===te&&oe(Z)),r!==n?(_e(),a=de(),a!==n?(_e(),58===t.charCodeAt(Qt)?(o=v,Qt++):(o=n,0===te&&oe(tt)),o!==n?(_e(),l=de(),l!==n?e={type:s.ter,cond:i,ifTrue:a,ifFalse:l}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=he()),ee.set(u,{nextPos:Qt,result:e}),e)}function he(){let e,i,r,a;const o=38*Qt+11,l=ee.get(o);return l?(Qt=l.nextPos,l.result):(e=Qt,i=pe(),i!==n?(_e(),t.substr(Qt,2)===y?(r=y,Qt+=2):(r=n,0===te&&oe(et)),r!==n?(_e(),a=he(),a!==n?e={type:s.elv,cond:i,ifFalse:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=pe()),ee.set(o,{nextPos:Qt,result:e}),e)}function pe(){let e,i,r,a;const o=38*Qt+12,l=ee.get(o);return l?(Qt=l.nextPos,l.result):(e=Qt,i=fe(),i!==n?(_e(),t.substr(Qt,2)===w?(r=w,Qt+=2):(r=n,0===te&&oe(st)),r!==n?(_e(),a=pe(),a!==n?e={type:s.nullc,lhs:i,rhs:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=fe()),ee.set(o,{nextPos:Qt,result:e}),e)}function fe(){let e,i,r,a,o,l;const u=38*Qt+13,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;if(e=Qt,i=me(),i!==n){for(r=[];a=Qt,_e(),t.substr(Qt,2)===E?(o=E,Qt+=2):(o=n,0===te&&oe(it)),o!==n?(_e(),l=me(),l!==n?a=l:(Qt=a,a=n)):(Qt=a,a=n),a!==n;)r.push(a);e=function(t,e){let i=t;for(const t of e)i={type:s.or,lhs:i,rhs:t};return i}(i,r)}else Qt=e,e=n;return ee.set(u,{nextPos:Qt,result:e}),e}function me(){let e,i,r,a,o,l;const u=38*Qt+14,c=ee.get(u);if(c)return Qt=c.nextPos,c.result;if(e=Qt,i=ge(),i!==n){for(r=[];a=Qt,_e(),t.substr(Qt,2)===x?(o=x,Qt+=2):(o=n,0===te&&oe(rt)),o!==n?(_e(),l=ge(),l!==n?a=l:(Qt=a,a=n)):(Qt=a,a=n),a!==n;)r.push(a);e=function(t,e){let i=t;for(const t of e)i={type:s.and,lhs:i,rhs:t};return i}(i,r)}else Qt=e,e=n;return ee.set(u,{nextPos:Qt,result:e}),e}function ge(){let t,e,i,r,a,o;const l=38*Qt+15,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(t=Qt,e=be(),e!==n){for(i=[];r=Qt,_e(),a=Ce(),a!==n?(_e(),o=be(),o!==n?r=Wt(0,a,o):(Qt=r,r=n)):(Qt=r,r=n),r!==n;)i.push(r);t=function(t,e){let i=t;for(const t of e)i={type:s.eq,op:t.op,lhs:i,rhs:t.rhs};return i}(e,i)}else Qt=t,t=n;return ee.set(l,{nextPos:Qt,result:t}),t}function be(){let t,e,i,r,a,o;const l=38*Qt+16,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(t=Qt,e=ve(),e!==n){for(i=[];r=Qt,_e(),a=Te(),a!==n?(_e(),o=ve(),o!==n?r=Ut(0,a,o):(Qt=r,r=n)):(Qt=r,r=n),r!==n;)i.push(r);t=function(t,e){let i=t;for(const t of e)i={type:s.cmp,op:t.op,lhs:i,rhs:t.rhs};return i}(e,i)}else Qt=t,t=n;return ee.set(l,{nextPos:Qt,result:t}),t}function ve(){let e,i,r;const a=38*Qt+17,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(e=Qt,33===t.charCodeAt(Qt)?(i=A,Qt++):(i=n,0===te&&oe(nt)),i!==n?(_e(),r=ve(),r!==n?e={type:s.not,expr:r}:(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=function(){let t,e,i,r,a;const o=38*Qt+18,l=ee.get(o);if(l)return Qt=l.nextPos,l.result;if(t=Qt,e=we(),e!==n){for(_e(),i=[];r=Qt,a=ye(),a!==n?(_e(),r=a):(Qt=r,r=n),r!==n;)i.push(r);i.length<1&&(i=n),i!==n?t={type:s.access,lhs:e,rhs:i}:(Qt=t,t=n)}else Qt=t,t=n;return t===n&&(t=we()),ee.set(o,{nextPos:Qt,result:t}),t}()),ee.set(a,{nextPos:Qt,result:e}),e)}function ye(){let e;const i=38*Qt+19,r=ee.get(i);return r?(Qt=r.nextPos,r.result):(e=function(){let e,i,r;const a=38*Qt+20,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(46===t.charCodeAt(Qt)?(i=C,Qt++):(i=n,0===te&&oe(lt))),i!==n?(_e(),r=Se(),r!==n?e={type:s.member,ns:"?."===i,rhs:r}:(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(at)),ee.set(a,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let e,i,r,a,o;const l=38*Qt+21,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(i=null),91===t.charCodeAt(Qt)?(r=T,Qt++):(r=n,0===te&&oe(ct)),r!==n?(_e(),a=de(),a!==n?(_e(),93===t.charCodeAt(Qt)?(o=_,Qt++):(o=n,0===te&&oe(dt)),o!==n?e={type:s.subscript,ns:null!==i,rhs:a}:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(ut)),ee.set(l,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let e,i,r,a,o,l,u,c;const d=38*Qt+22,h=ee.get(d);if(h)return Qt=h.nextPos,h.result;if(te++,e=Qt,t.substr(Qt,2)===S?(i=S,Qt+=2):(i=n,0===te&&oe(ot)),i===n&&(i=null),40===t.charCodeAt(Qt)?(r=k,Qt++):(r=n,0===te&&oe(pt)),r!==n){for(_e(),a=Qt,o=de(),o!==n?(l=_e(),a=o):(Qt=a,a=n),a===n&&(a=null),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=O,Qt++):(u=n,0===te&&oe(ft)),u!==n?(_e(),c=de(),c!==n?(_e(),l=c):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);41===t.charCodeAt(Qt)?(l=q,Qt++):(l=n,0===te&&oe(mt)),l!==n?e=function(t,e,i){return{type:s.method,ns:null!==t,args:null===e?[]:[e,...i]}}(i,a,o):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(ht)),ee.set(d,{nextPos:Qt,result:e}),e}())),ee.set(i,{nextPos:Qt,result:e}),e)}function we(){let e,r,a,o;const l=38*Qt+23,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(e=Qt,40===t.charCodeAt(Qt)?(r=k,Qt++):(r=n,0===te&&oe(pt)),r!==n?(_e(),a=de(),a!==n?(_e(),41===t.charCodeAt(Qt)?(o=q,Qt++):(o=n,0===te&&oe(mt)),o!==n?e=a:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),e===n&&(e=function(){let e,i,r,a,o,l,u,c;const d=38*Qt+24,h=ee.get(d);if(h)return Qt=h.nextPos,h.result;if(te++,e=Qt,i=function(){let e,i,r,a,o;const l=38*Qt+32,u=ee.get(l);return u?(Qt=u.nextPos,u.result):(te++,e=Qt,35===t.charCodeAt(Qt)?(i=M,Qt++):(i=n,0===te&&oe(Pt)),i!==n?(r=Qt,a=Se(),a!==n?(58===t.charCodeAt(Qt)?(o=v,Qt++):(o=n,0===te&&oe(tt)),o!==n?r=a:(Qt=r,r=n)):(Qt=r,r=n),r===n&&(r=null),a=Se(),a!==n?e={type:s.function,module:r,value:a}:(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(i=n,0===te&&oe(Nt)),ee.set(l,{nextPos:Qt,result:e}),e)}(),i!==n)if(40===t.charCodeAt(Qt)?(r=k,Qt++):(r=n,0===te&&oe(pt)),r!==n){for(_e(),a=Qt,o=de(),o!==n?(l=_e(),a=o):(Qt=a,a=n),a===n&&(a=null),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=O,Qt++):(u=n,0===te&&oe(ft)),u!==n?(_e(),c=de(),c!==n?(_e(),l=c):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);41===t.charCodeAt(Qt)?(l=q,Qt++):(l=n,0===te&&oe(mt)),l!==n?e=function(t,e,i){const r=null===e?[]:[e,...i];return{type:s.call,value:t,args:r}}(i,a,o):(Qt=e,e=n)}else Qt=e,e=n;else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(gt)),ee.set(d,{nextPos:Qt,result:e}),e}(),e===n&&(e=function(){let e;const i=38*Qt+25,r=ee.get(i);return r?(Qt=r.nextPos,r.result):(e=function(){let e,i,r,a,o,l,u,c,d,h;const p=38*Qt+26,f=ee.get(p);if(f)return Qt=f.nextPos,f.result;for(te++,e=Qt,i=Qt,r=Qt,45===t.charCodeAt(Qt)?(a=L,Qt++):(a=n,0===te&&oe(vt)),a===n&&(a=null),o=Qt,l=[];u=t.charAt(Qt),Xt=u.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(u=n,0===te&&oe(yt)),u!==n;)l.push(u);if(l.length<1&&(l=n),l!==n){if(u=Qt,46===t.charCodeAt(Qt)?(c=C,Qt++):(c=n,0===te&&oe(lt)),c!==n){for(d=[];h=t.charAt(Qt),Xt=h.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(h=n,0===te&&oe(yt)),h!==n;)d.push(h);c=[c,d],u=c}else Qt=u,u=n;u===n&&(u=null),l=[l,u],o=l}else Qt=o,o=n;if(o===n)if(o=Qt,46===t.charCodeAt(Qt)?(l=C,Qt++):(l=n,0===te&&oe(lt)),l!==n){for(u=[];c=t.charAt(Qt),Xt=c.charCodeAt(0),Xt>=48&&Xt<=57?Qt++:(c=n,0===te&&oe(yt)),c!==n;)u.push(c);u.length<1&&(u=n),u!==n?(l=[l,u],o=l):(Qt=o,o=n)}else Qt=o,o=n;return o!==n?(a=[a,o],r=a):(Qt=r,r=n),i=r!==n?t.substring(i,Qt):r,i!==n&&(i={type:s.literal,value:parseFloat(i)}),e=i,te--,e===n&&(i=n,0===te&&oe(bt)),ee.set(p,{nextPos:Qt,result:e}),e}(),e===n&&(e=Ee(),e===n&&(e=function(){let e,i,r,a,o,l,u;const c=38*Qt+30,d=ee.get(c);if(d)return Qt=d.nextPos,d.result;if(te++,e=Qt,91===t.charCodeAt(Qt)?(i=T,Qt++):(i=n,0===te&&oe(ct)),i!==n){for(_e(),r=de(),r===n&&(r=null),_e(),a=[];o=Qt,44===t.charCodeAt(Qt)?(l=O,Qt++):(l=n,0===te&&oe(ft)),l!==n?(_e(),u=de(),u!==n?(_e(),o=u):(Qt=o,o=n)):(Qt=o,o=n),o!==n;)a.push(o);93===t.charCodeAt(Qt)?(o=_,Qt++):(o=n,0===te&&oe(dt)),o!==n?e=function(t,e){const i=null===t?[]:[t,...e];return{type:s.array,value:i}}(r,a):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(qt)),ee.set(c,{nextPos:Qt,result:e}),e}(),e===n&&(e=function(){let e,i,r,a,o,l,u,c,d,h,p;const f=38*Qt+31,m=ee.get(f);if(m)return Qt=m.nextPos,m.result;if(te++,e=Qt,123===t.charCodeAt(Qt)?(i=g,Qt++):(i=n,0===te&&oe(Y)),i!==n){for(_e(),r=Qt,a=Ee(),a!==n?(o=_e(),58===t.charCodeAt(Qt)?(l=v,Qt++):(l=n,0===te&&oe(tt)),l!==n?(u=_e(),c=de(),c!==n?r=[a,c]:(Qt=r,r=n)):(Qt=r,r=n)):(Qt=r,r=n),r===n&&(r=null),a=_e(),o=[];l=Qt,44===t.charCodeAt(Qt)?(u=O,Qt++):(u=n,0===te&&oe(ft)),u!==n?(c=_e(),d=Ee(),d!==n?(_e(),58===t.charCodeAt(Qt)?(h=v,Qt++):(h=n,0===te&&oe(tt)),h!==n?(_e(),p=de(),p!==n?(_e(),l=[d,p]):(Qt=l,l=n)):(Qt=l,l=n)):(Qt=l,l=n)):(Qt=l,l=n),l!==n;)o.push(l);125===t.charCodeAt(Qt)?(l=F,Qt++):(l=n,0===te&&oe(_t)),l!==n?e=function(t,e){var i=[];return null!==t&&i.push(t),i.push.apply(i,e),{type:s.dict,value:i}}(r,o):(Qt=e,e=n)}else Qt=e,e=n;return te--,e===n&&(i=n,0===te&&oe(Lt)),ee.set(f,{nextPos:Qt,result:e}),e}()))),ee.set(i,{nextPos:Qt,result:e}),e)}(),e===n&&(e=function(){let t,e;const r=38*Qt+34,a=ee.get(r);return a?(Qt=a.nextPos,a.result):(te++,t=Qt,e=Se(),e!==n&&(o=e,e=i.has(o)?{type:s.literal,value:i.get(o)}:{type:s.symbol,value:o}),t=e,te--,t===n&&(e=n,0===te&&oe(Mt)),ee.set(r,{nextPos:Qt,result:t}),t);var o}()))),ee.set(l,{nextPos:Qt,result:e}),e)}function Ee(){let e,i,r,a,o;const l=38*Qt+27,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;if(te++,e=Qt,39===t.charCodeAt(Qt)?(i=N,Qt++):(i=n,0===te&&oe(Et)),i!==n){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),39!==Xt)?Qt++:(o=n,0===te&&oe(xt)),o!==n;)a.push(o);r=t.substring(r,Qt),39===t.charCodeAt(Qt)?(a=N,Qt++):(a=n,0===te&&oe(Et)),a!==n?e={type:s.literal,value:r}:(Qt=e,e=n)}else Qt=e,e=n;if(e===n){if(e=Qt,34===t.charCodeAt(Qt)?(i=P,Qt++):(i=n,0===te&&oe(At)),i!==n){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),34!==Xt)?Qt++:(o=n,0===te&&oe(St)),o!==n;)a.push(o);r=t.substring(r,Qt),34===t.charCodeAt(Qt)?(a=P,Qt++):(a=n,0===te&&oe(At)),a!==n?e={type:s.literal,value:r}:(Qt=e,e=n)}else Qt=e,e=n;if(e===n)if(e=Qt,96===t.charCodeAt(Qt)?(i=R,Qt++):(i=n,0===te&&oe(Ct)),i!==n){for(r=[];a=xe(),a===n&&(a=Ae()),a!==n;)r.push(a);96===t.charCodeAt(Qt)?(a=R,Qt++):(a=n,0===te&&oe(Ct)),a!==n?e={type:s.tstring,parts:r}:(Qt=e,e=n)}else Qt=e,e=n}return te--,e===n&&(i=n,0===te&&oe(wt)),ee.set(l,{nextPos:Qt,result:e}),e}function xe(){let e,s,i,r;const a=38*Qt+28,o=ee.get(a);return o?(Qt=o.nextPos,o.result):(te++,e=Qt,123===t.charCodeAt(Qt)?(s=g,Qt++):(s=n,0===te&&oe(Y)),s!==n?(_e(),i=de(),i!==n?(_e(),125===t.charCodeAt(Qt)?(r=F,Qt++):(r=n,0===te&&oe(_t)),r!==n?e=i:(Qt=e,e=n)):(Qt=e,e=n)):(Qt=e,e=n),te--,e===n&&(s=n,0===te&&oe(Tt)),ee.set(a,{nextPos:Qt,result:e}),e)}function Ae(){let e,i,r,a,o;const l=38*Qt+29,u=ee.get(l);if(u)return Qt=u.nextPos,u.result;for(te++,e=Qt,i=[];;){for(r=Qt,a=[];o=t.charAt(Qt),""!==o&&(Xt=o.charCodeAt(0),92!==Xt&&96!==Xt&&123!==Xt)?Qt++:(o=n,0===te&&oe(Ot)),o!==n;)a.push(o);if(a.length<1&&(a=n),r=a!==n?t.substring(r,Qt):a,r===n&&(r=Qt,92===t.charCodeAt(Qt)?(a=m,Qt++):(a=n,0===te&&oe(J)),a!==n?(t.length>Qt?(o=t.charAt(Qt),Qt++):(o=n,0===te&&oe(X)),o!==n?r=Gt(o):(Qt=r,r=n)):(Qt=r,r=n)),r===n)break;i.push(r)}return i.length<1&&(i=n),i!==n&&(i={type:s.literal,value:i.join("")}),e=i,e===n&&(e=Qt,123===t.charCodeAt(Qt)?(i=g,Qt++):(i=n,0===te&&oe(Y)),i!==n&&(i={type:s.literal,value:i}),e=i),te--,e===n&&(i=n,0===te&&oe(kt)),ee.set(l,{nextPos:Qt,result:e}),e}function Se(){let e,s,i,r,a;const o=38*Qt+33,l=ee.get(o);if(l)return Qt=l.nextPos,l.result;if(e=Qt,s=Qt,i=t.charAt(Qt),Xt=i.charCodeAt(0),Xt>=97&&Xt<=122||Xt>=65&&Xt<=90||36===Xt||95===Xt?Qt++:(i=n,0===te&&oe(Rt)),i!==n){for(r=[];a=t.charAt(Qt),Xt=a.charCodeAt(0),Xt>=97&&Xt<=122||Xt>=65&&Xt<=90||36===Xt||95===Xt||Xt>=48&&Xt<=57?Qt++:(a=n,0===te&&oe(Ft)),a!==n;)r.push(a);i=[i,r],s=i}else Qt=s,s=n;return e=s!==n?t.substring(e,Qt):s,ee.set(o,{nextPos:Qt,result:e}),e}function Ce(){let e;const s=38*Qt+35,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===I?(e=I,Qt+=2):(e=n,0===te&&oe(It)),e===n&&(t.substr(Qt,2)===z?(e=z,Qt+=2):(e=n,0===te&&oe(zt))),ee.set(s,{nextPos:Qt,result:e}),e)}function Te(){let e;const s=38*Qt+36,i=ee.get(s);return i?(Qt=i.nextPos,i.result):(t.substr(Qt,2)===D?(e=D,Qt+=2):(e=n,0===te&&oe(Dt)),e===n&&(62===t.charCodeAt(Qt)?(e=$,Qt++):(e=n,0===te&&oe($t)),e===n&&(t.substr(Qt,2)===B?(e=B,Qt+=2):(e=n,0===te&&oe(Bt)),e===n&&(60===t.charCodeAt(Qt)?(e=j,Qt++):(e=n,0===te&&oe(jt))))),ee.set(s,{nextPos:Qt,result:e}),e)}function _e(){let e,s;const i=38*Qt+37,r=ee.get(i);if(r)return Qt=r.nextPos,r.result;for(te++,e=[];s=t.charAt(Qt),Xt=s.charCodeAt(0),32===Xt||9===Xt||10===Xt||13===Xt?Qt++:(s=n,0===te&&oe(Ht)),s!==n;)e.push(s);return te--,ee.set(i,{nextPos:Qt,result:e}),e}Jt=l();const ke=Jt!==n&&Qt===t.length;function Oe(){throw Jt!==n&&Qt<t.length&&oe({type:"end"}),e=Zt,s=Yt<t.length?function(e=Qt){const s=t.codePointAt(e);return void 0===s?"":String.fromCodePoint(s)}(Yt):null,i=Yt<t.length?ae(Yt,Yt+1):ae(Yt,Yt),new r(r.buildMessage(e,s),e,s,i);var e,s,i}return e.peg$library?{peg$result:Jt,peg$currPos:Qt,peg$FAILED:n,peg$maxFailExpected:Zt,peg$maxFailPos:Yt,peg$success:ke,peg$throw:ke?void 0:Oe}:ke?Jt:void Oe()}(t,{startRule:e===l.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}static evaluate(t,e,s,i,r){return new o(t,e,r).visitRoot(s,i===l.MODE_TEMPLATED)}static interpret(t,e,s,i,r){return l.evaluate(t,e,l.parse(s,i),i,r)}}class u{#s;#i;#r;constructor(t,e,s){this.#s=t,this.#i=e,this.#r=s??e.length}withModule(t,e){const s=t?{[t]:e}:e;return new u({...this.#s,...s},this.#i,this.#r)}withOverlay(...t){return new u(this.#s,0===t.length?this.#i:[...this.#i,...t],this.#r)}resolve(t){return n(this.#i,t)}evaluateExpression(t){return l.interpret(this.#s,this.#i,t,l.MODE_EXPRESSION,this.#r)}evaluateTemplated(t){return l.interpret(this.#s,this.#i,t,l.MODE_TEMPLATED,this.#r)}}class c{static fromHtml(...t){const e=document.createElement("template");return e.innerHTML=t.map(t=>t.trim()).join(""),document.adoptNode(e.content)}static toHtml(t){var e=document.createElement("template");return e.content.appendChild(t),e.innerHTML}static isBlank(t){return 0===t.childElementCount&&""===t.textContent.trim()}static from(...t){const e=new DocumentFragment;for(const s of t)e.appendChild(s);return e}static fromChildNodes(t){const e=new DocumentFragment;for(;t.firstChild;)e.appendChild(t.firstChild);return e}}class d{static id=0;static uid(t){return`${t}-${++d.id}`}static defaultValue(t,e,s){return t.hasAttribute(e)||t.setAttribute(e,s),t.getAttribute(e)}static forward(t,e,s){e.getAttributeNames().filter(e=>e.startsWith(t)).forEach(i=>{const r=i.substring(t.length);if("class"===r){const i=e.getAttribute(`${t}class`)?.split(/\s+/).filter(t=>t.length)??[];return void s.classList.add(...i)}s.setAttribute(r,e.getAttribute(i))})}static set(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)}}class h{static from(t){for(const e of t.children)e.matches('[slot=""]')&&e.removeAttribute("slot");const e=Array.from(t.children).filter(t=>t.matches("[slot]")).map(t=>{t.remove();const e=t.getAttribute("slot");return t.removeAttribute("slot"),[e,h.slotFromNode(t)]}),s=Object.create(null);s.default=new DocumentFragment,s.default.append(...t.childNodes);for(const[t,i]of e)t in s||(s[t]=new DocumentFragment),s[t].append(i);return s}static slotFromNode(t){return t instanceof HTMLTemplateElement?document.adoptNode(t.content):t instanceof HTMLScriptElement&&"text/html"===t.type?c.fromHtml(t.innerHTML):t}}class p{static isParsed(t){for(let e=t;e;e=e.parentNode)if(e.nextSibling)return!0;return!1}static waitDomContentLoaded(t){if("loading"===t.readyState)return new Promise(e=>{t.addEventListener("DOMContentLoaded",()=>e(void 0),{once:!0})});if("complete"===t.readyState)return Promise.resolve();const e=t.defaultView;if(null===e)return Promise.resolve();const[s]=e.performance?.getEntriesByType("navigation")??[];return s?.domContentLoadedEventStart>0?Promise.resolve():new Promise(t=>{const s=()=>{e.removeEventListener("DOMContentLoaded",s),e.removeEventListener("load",s),t(void 0)};e.addEventListener("DOMContentLoaded",s),e.addEventListener("load",s)})}static waitParsed(t){return p.isParsed(t)||"loading"!==t.ownerDocument.readyState?Promise.resolve(t):new Promise(e=>{const s=new MutationObserver(()=>{p.isParsed(t)&&(s.disconnect(),e(t))});for(let e=t.parentNode;e;e=e.parentNode)s.observe(e,{childList:!0});p.waitDomContentLoaded(t.ownerDocument).then(()=>{s.disconnect(),e(t)})})}static queryChildren(t,e){for(const s of t.children)if(s.matches(e))return s;return null}static queryChildrenAll(t,e){const s=[];for(const i of t.children)i.matches(e)&&s.push(i);return s}}class f{#c=new Set;removed(t){return this.#c.has(t)}remove(t){t.replaceChildren?.(),Object.keys(t.dataset||{}).filter(t=>t.startsWith("tpl")).forEach(e=>{delete t.dataset[e]}),this.#c.add(t)}popData(t,e){const s=t.dataset[e];return delete t.dataset[e],s}prepend(t,e){t.parentNode.insertBefore(e,t)}append(t,e){t.parentNode.insertBefore(e,t.nextSibling)}replace(t,e){this.prepend(t,e),this.remove(t)}cleanup(){for(const t of this.#c)t.remove();this.#c.clear()}}class m{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplRemove","tplVerbatim"];static tplIf(t,e,s,i){i.evaluateExpression(e)||s.remove(t)}static tplWith(t,e,s,i){const r=i.evaluateExpression(e),n=s.popData(t,"tplVar"),a=new v(t,i).withOverlay(n?{[n]:r}:r).render();s.replace(t,a)}static tplEach(t,e,s,i){const r=s.popData(t,"tplVar"),n=s.popData(t,"tplStat"),a=new v(t,i),o=i.evaluateExpression(e),l=null===o||"object"!=typeof o?void 0:Object.getPrototypeOf(o),u=o?.[Symbol.iterator]||l!==Object.prototype&&null!==l?null:Object.entries(o),c=o instanceof Map?[...o]:u,d=null===c?o:c.map(([t,e])=>({key:t,value:e}));if(!d?.[Symbol.iterator])throw new Error(`Expected an iterable got '${o}'`);const h=n?d:null,p="number"==typeof h?.length?h.length:h?.size,f="number"==typeof p?p:null;let m=0;for(const e of d){const i=r?{[r]:e}:e,o={index:m,count:m+1,size:f,first:0===m,last:null===f?null:m===f-1,even:m%2==0,odd:m%2==1},l=n?[{[n]:o},i]:[i];s.prepend(t,a.withOverlay(...l).render()),++m}s.remove(t)}static tplWhen(t,e,s,i){i.evaluateExpression(e)||s.remove(t)}static tplVerbatim(t,e,s,i){const r=t.cloneNode(!0);s.replace(t,r)}static tplRemove(t,e,s,i){switch(e.toLowerCase()){case"tag":{const e=c.fromChildNodes(t);"tplVerbatim"in t.dataset?(s.popData(t,"tplVerbatim"),s.replace(t,e)):(s.append(t,e),s.remove(t));break}case"body":t.replaceChildren();break;case"all":s.remove(t)}}static tplClassAppend(t,e,s,i){const r=i.evaluateExpression(e);if(!r)return;const n=(Array.isArray(r)?r:[r]).flatMap(t=>"string"==typeof t?t.split(" "):t).filter(Boolean);0!==n.length&&t.classList.add(...n)}static tplAttrAppend(t,e,s,i){const r=i.evaluateExpression(e);r&&0!==r.length&&(Array.isArray(r[0])?r:[r]).forEach(([e,s])=>{null!=s&&t.setAttribute(e,s)})}static textNode(t,e,i,r){for(const n of r.evaluateTemplated(e))if(null!=n.value)switch(n.type){case s.dom.t:i.prepend(t,document.createTextNode(n.value));break;case s.dom.h:i.prepend(t,c.fromHtml("string"==typeof n.value?n.value:String(n.value)));break;case s.dom.n:if(!(n.value instanceof Node))throw new TypeError(`Expected a Node, got '${typeof n.value}'`);i.prepend(t,n.value)}i.remove(t)}}const g=new e(1e3);function b(t){return g.getOrCompute(t,t=>t.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase())}class v{static fromHtml(t,e,...s){return new v(c.fromHtml(t),new u(e,s))}static fromSelector(t,e,...s){const i=document.querySelector(t);if(!(i instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");return v.fromTemplate(i,e,...s)}static fromTemplate(t,e,...s){const i=document.adoptNode(t.content);return new v(i,new u(e,s))}static fromFragment(t,e,...s){return new v(t,new u(e,s))}#d;#h;constructor(t,e){this.#d=t,this.#h=e}withEvaluator(t){return new v(this.#d,t)}withFragment(t){return new v(t,this.#h)}withModule(t,e){return new v(this.#d,this.#h.withModule(t,e))}withOverlay(...t){return new v(this.#d,this.#h.withOverlay(...t))}evaluateExpression(t,...e){return this.#h.withOverlay(...e).evaluateExpression(t)}evaluateTemplated(t,...e){return this.#h.withOverlay(...e).evaluateTemplated(t)}evaluator(){return this.#h}render(){try{const t=new f,e=document.importNode(this.#d,!0),s=e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e:c.from(e),i=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,v.#p);let r;for(;null!==(r=i.nextNode());){if(t.cleanup(),r.nodeType===Node.TEXT_NODE){try{m.textNode(r,r.nodeValue,t,this.#h)}catch(t){throw y.wrap("Error evaluating text node",r,t)}continue}const e=r;for(const s of m.ORDERED_COMMANDS){if(!(s in e.dataset))continue;const i=t.popData(e,s);try{m[s](e,i,t,this.#h)}catch(t){throw y.wrap(`Error evaluating data-tpl-${b(s)}="${i}"`,e,t)}if(t.removed(e))break}for(const s of Object.keys(e.dataset||{})){if(!s.startsWith("tpl"))continue;const i=b(s),r=t.popData(e,s);try{const t=this.#h.evaluateExpression(r);if("boolean"==typeof t){e.toggleAttribute(i,t);continue}null!=t&&e.setAttribute(i,t)}catch(t){throw y.wrap(`Error evaluating data-tpl-${i}="${r}"`,e,t)}}}return t.cleanup(),s}catch(t){if(t instanceof y)throw t;throw new y("Error rendering template",this.#d,t)}}renderTo(t){t.replaceChildren(this.render())}appendTo(t){t.appendChild(this.render())}renderToSelector(t){const e=document.querySelector(t);e&&this.renderTo(e)}appendToSelector(t){const e=document.querySelector(t);e&&this.appendTo(e)}static#p(t){if(t.nodeType===Node.TEXT_NODE)return t.nodeValue.includes("{{")&&t.nodeValue.includes("}}")?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT;for(const e of t.attributes)if(e.name.startsWith("data-tpl-"))return NodeFilter.FILTER_ACCEPT;return NodeFilter.FILTER_SKIP}}class y extends Error{static FRAMES=3;#f;#m;truncated=!1;static wrap(t,e,s){return s instanceof y&&s.depth>=y.FRAMES?(s.truncated=!0,s):new y(t,e,s)}constructor(t,e,s){super(`${t} in \`${y.describe(e)}\``,{cause:s}),this.name="RenderError",this.#f=e,this.#m=(s instanceof y?s.depth:0)+1}get depth(){return this.#m}get node(){return this.#f}get html(){return y.stringify(this.#f)}static describe(t){if(t.nodeType===Node.TEXT_NODE)return y.#g(String(t.nodeValue).trim());if(t.nodeType===Node.ELEMENT_NODE){const e=t,s=Array.from(e.attributes,t=>` ${t.name}="${t.value}"`).join("");return y.#g(`<${e.localName}${s}>`)}const e=Array.from(t.childNodes).filter(t=>t.nodeType===Node.ELEMENT_NODE||String(t.nodeValue??"").trim().length>0).map(t=>y.describe(t));return y.#g(e.join(""))}static#g(t){return t.length>120?`${t.slice(0,120)}…`:t}static stringify(t){return c.toHtml(y.#b(t.cloneNode(!0)))}static#b(t){t.nodeType===Node.TEXT_NODE&&(t.nodeValue=t.nodeValue.trim());for(let e=0;e<t.childNodes.length;e++){const s=t.childNodes[e];s.nodeType===Node.TEXT_NODE?(s.nodeValue=s.nodeValue.trim(),0===s.nodeValue.length&&(t.removeChild(s),e--)):s.nodeType===Node.ELEMENT_NODE&&y.#b(s)}return t}}class w{#v=new Map;#y;#w=new Promise(t=>{this.#y=t});#E=Promise.withResolvers();constructor(){Promise.all([p.waitDomContentLoaded(document),this.#E.promise]).then(()=>{this.#x()})}ready(){return this.#w}configured(){this.#E.resolve()}async#x(){await this.settled(),document.dispatchEvent(new CustomEvent("ftl:ready",{bubbles:!1,cancelable:!1})),this.#y()}enqueue(t){if(this.#v.has(t))return;const{promise:e,resolve:s}=Promise.withResolvers(),i=p.waitParsed(t).then(()=>t.upgrade()).finally(()=>{this.#v.delete(t),s()});this.#v.set(t,{upgrade:i,finished:e})}async#A(t,e){for(;;){const s=Array.from(this.#v).filter(([e])=>t(e)).map(([,t])=>e(t));if(0===s.length)return;await Promise.all(s)}}settled(){return this.#A(()=>!0,t=>t.finished)}upgraded(t){return this.#A(t,t=>t.upgrade)}whenUpgraded(t){return this.#v.get(t)?.upgrade}pending(){return Array.from(this.#v.keys())}}class E{#S={};#E=!1;#C={string:{unmarshal:(t,e,s)=>t,marshal:(t,e,s)=>null==t?null:String(t)},number:{unmarshal:(t,e,s)=>null===t?null:Number(t),marshal:(t,e,s)=>null==t?null:String(t)},presence:{unmarshal:(t,e,s)=>null!==t,marshal:(t,e,s)=>t?"":null},bool:{unmarshal:(t,e,s)=>"true"===t,marshal:(t,e,s)=>null==t?null:String(!0===t)},json:{unmarshal:(t,e,s)=>null===t?null:JSON.parse(t),marshal:(t,e,s)=>null==t?null:JSON.stringify(t)},csv:{unmarshal:(t,e,s)=>null===t?[]:t.split(",").map(t=>t.trim()).filter(t=>t),marshal:(t,e,s)=>null==t?null:t.join(",")}};#T={};#s;#_=[];#h=new u(void 0,[]);#k=new w;defineElement(t,e){return this.#E?(this.#O(t,e),this):(this.#S[t]=e,this)}static declarationsOf(t){const e=[];for(let s=t;null!==s&&s!==HTMLElement;s=Object.getPrototypeOf(s))e.unshift(s);const s=t=>e.flatMap(e=>Object.getOwnPropertyDescriptor(e,t)?.value??[]);return{observed:s("observed"),attributes:s("attributes")}}static propertyOf(t){return t.replace(/-([a-z])/g,(t,e)=>e.toUpperCase())}#O(t,e){const{observed:s,attributes:i}=E.declarationsOf(e),{template:r,templates:n,slots:a,mappers:o,config:l}=e,u=s.map(t=>t.split(":")[0]),c=[...new Set(u.reverse())].reverse(),d=[...i,...s].reduce((t,e)=>{const[s,i]=e.split(":"),r=i??"string";if(!(r in this.#C)&&!(r in(o??{})))throw new Error(`unsupported attribute type: ${r}`);return t[s]=o?.[r]??this.#C[r],t},{}),h=Object.entries(Object.assign({},n,r?{default:r}:{})).map(([t,e])=>[t,v.fromHtml(e)]),p=Object.fromEntries(h);e.BITS={registry:this,enqueue:t=>this.#k.enqueue(t),SLOTS:a,CONFIG:l,OBSERVED:c,DECLARED:[...new Set([...c,...i.map(t=>t.split(":")[0])])],ATTR_TO_MAPPER:d,ATTR_TO_PROPERTY:Object.fromEntries(c.map(t=>[t,E.propertyOf(t)])),TEMPLATES:p},customElements.define(t,e)}defineModule(t,e){const s=t?{[t]:e}:e;return this.#s={...this.#s,...s},this.#q(),this}defineModules(t){return this.#s=t,this.#q(),this}defineComponent(t,e){return this.#T[t]=e,this}defineData(...t){return this.#_=t,this.#q(),this}defineOverlay(...t){return this.#_=[...this.#_,...t],this.#q(),this}defineMapper(t,e){return this.#C[t]=e,this}plugin(t){return t.configure(this),this}configure(){for(const[t,e]of Object.entries(this.#S))this.#O(t,e),delete this.#S[t];return this.#E=!0,this.#k.configured(),this}settle(t){return this.#k.upgraded(t)}whenUpgraded(t){return this.#k.whenUpgraded(t)}pending(){return this.#k.pending()}ready(){return this.#k.ready()}#q(){this.#h=new u(this.#s,this.#_)}evaluator(){return this.#h}component(t){return this.#T[t]}}const x=new E;class A{static fromHtml(t){return v.fromHtml(t).withEvaluator(x.evaluator())}static fromSelector(t){return v.fromSelector(t).withEvaluator(x.evaluator())}static fromTemplate(t){return v.fromTemplate(t).withEvaluator(x.evaluator())}static fromFragment(t){return v.fromFragment(t).withEvaluator(x.evaluator())}}class S{static waitFor(t){return x.settle(e=>t.contains(e))}static waitForChildren(t){return x.settle(e=>t!==e&&t.contains(e))}}class C extends HTMLElement{static BITS={registry:x,enqueue:t=>{},SLOTS:!1,CONFIG:void 0,OBSERVED:[],DECLARED:[],ATTR_TO_MAPPER:{},ATTR_TO_PROPERTY:{},TEMPLATES:{}};static get observedAttributes(){return this.BITS.OBSERVED}constructor(){super(),this.internals=this.attachInternals()}internals;#L=!1;#N=!1;#P=new Set;#R=null;#F={};#M(){return this.constructor.BITS}#I(t){const e=this.#M().ATTR_TO_MAPPER[t];if(!e)throw new Error(`${this.constructor.name} declares no attribute '${t}': declare it in static observed or static attributes, or read it with getAttribute`);return e}unmarshal(t,e){return this.#I(t).unmarshal(e,t,this)}marshal(t,e){return this.#I(t).marshal(e,t,this)}get _registry(){return this.#M().registry}component(t){return this.#M().registry.component(t)}template(t){const e=this.#M().TEMPLATES[t??"default"];if(!e)throw new Error(`no template named '${t??"default"}' on ${this.constructor.name}`);const s=e.withEvaluator(this.#M().registry.evaluator()),i=this.#M().CONFIG;return i?s.withOverlay({config:i}):s}connectedCallback(){this.#N||this.#M().enqueue(this)}attributeChangedCallback(t,e,s){e!==s&&(this.#P.has(t)||(this.#L?this[this.#M().ATTR_TO_PROPERTY[t]]=this.unmarshal(t,s):null!==this.#R&&t in this.#R&&(this.#R[t]=this.unmarshal(t,s))))}async upgrade(){if(this.#N)return;this.#N=!0;const t=this.#M().SLOTS?h.from(this):void 0,e=Object.fromEntries(this.#M().DECLARED.map(t=>[t,this.unmarshal(t,this.getAttribute(t))])),s=new Set(this.#M().OBSERVED);this.#F=Object.fromEntries(Object.entries(e).filter(([t])=>!s.has(t))),this.#R=e;try{await this.render({slots:t});const s=this.#M().ATTR_TO_PROPERTY;for(const t of this.#M().OBSERVED)this[s[t]]=e[t];this.#L=!0,this.internals.states.add("rendered")}finally{this.#R=null}}render(t){}declared(t){return t in this.#F?this.#F[t]:null!==this.#R&&t in this.#R?this.#R[t]:this.unmarshal(t,this.getAttribute(t))}get rendered(){return this.#L}reflectTo(t,e){const s=this.marshal(t,e);if(s!==this.getAttribute(t)){this.#P.add(t);try{d.set(this,t,s)}finally{this.#P.delete(t)}}}}const T=(t,e)=>{const s=t[l.BOUND];return"function"==typeof s?s(e):t[e]},_=/\{(\w+)\}/g,k=/\{(\d+)\}/g,O=t=>"object"==typeof t&&null!==t&&[Object.prototype,null].includes(Object.getPrototypeOf(t)),q=new Set,L=t=>{q.has(t)||(q.add(t),console.warn(`l10n: ${t}`))},N=new e(100),P=(t,e,s)=>{const i=`${t.name}|${e??""}|${void 0===s?"":JSON.stringify(s)}`;return N.getOrCompute(i,()=>new t(e,s))};class R{static t(t,...e){const s=T(this,"l10n")??{};let i=Object.hasOwn(s,t)?s[t]:void 0;if(void 0===i)return L(`missing message "${t}"`),t;const r=1===e.length&&O(e[0])?e[0]:null;if(O(i))if("number"!=typeof r?.count)L(`plural message "${t}" needs a numeric {count}`),i=i.other;else{const t=T(this,"locale")??navigator?.language??"en";i=i[P(Intl.PluralRules,t).select(r.count)]??i.other}return void 0===i||"object"==typeof i?(L(`plural message "${t}" has no "other" form`),t):r?i.replace(_,(e,s)=>Object.hasOwn(r,s)?String(r[s]):(L(`message "${t}" wants {${s}}`),e)):e.length>0?i.replace(k,(s,i)=>{const r=Number(i);return r>=e.length?(L(`message "${t}" wants {${i}}`),s):String(e[r])}):i}static date(t,e){return P(Intl.DateTimeFormat,T(this,"locale"),e).format(t)}static number(t,e){return P(Intl.NumberFormat,T(this,"locale"),e).format(t)}static bytes(t){const e=P(Intl.NumberFormat,T(this,"locale"),{maximumFractionDigits:2}).format;return t>=1073741824?`${e(t/1024/1024/1024)}GiB`:t>=1048576?`${e(t/1024/1024)}MiB`:t>=1024?`${e(t/1024)}KiB`:`${e(t)}B`}static failure(t){return Array.isArray(t?.problems)&&t.problems.length>0?t.problems.map(t=>{return e=t,("string"==typeof e?.reason&&""!==e.reason.trim()?e.reason:void 0)??R.t.call(this,"failure.no-reason");var e}).join("\n"):void 0!==t?.message?String(t.message):null==t?"":String(t)}static of(t={}){const e=t=>x.evaluator().resolve(t),s=s=>(...i)=>s.apply({l10n:e("l10n"),locale:t.locale??e("locale")},i);return{t:s(R.t),date:s(R.date),number:s(R.number),bytes:s(R.bytes),failure:s(R.failure)}}}var F=Object.freeze({__proto__:null,Attributes:d,BoundedCache:e,ExpressionEvaluator:u,Expressions:l,Fragments:c,LightSlots:h,Localization:R,Nodes:p,ParsedElement:C,Registry:E,RenderError:y,Rendering:S,Template:v,Templates:A,registry:x});class M extends Error{constructor(t,e,s){super(t,{cause:s}),this.name="Failure",this.problems=e}dropping(t){return new M(this.message,M.dropProblemsContext(this.problems,t),this)}static dropProblemsContext(t,e){return t.map(({type:t,context:s,reason:i,details:r})=>({type:t,context:s?.startsWith(e)?s.substring(e.length):s,reason:i,details:r}))}}class I{static STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";static URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";static encode(t,e){const s=e||I.URL_SAFE,i=t.byteLength,r=new Uint8Array(t);let n="";for(let t=0;t<i;t+=3)n+=s[r[t]>>2]+s[(3&r[t])<<4|r[t+1]>>4]+s[(15&r[t+1])<<2|r[t+2]>>6]+s[63&r[t+2]];return i%3==2?n=n.substring(0,n.length-1):i%3==1&&(n=n.substring(0,n.length-2)),n}static decode(t,e){const s=e||I.URL_SAFE;let i=t.length;for(;i>0&&"="===t.charAt(i-1);)--i;const r=t.substring(0,i);if(t.length-i>2||r.includes("=")||0===r.length&&t.length>0)throw new Error("invalid padding");if(r.length%4==1)throw new Error("invalid length");for(const t of r)if(-1===s.indexOf(t))throw new Error(`invalid character '${t}'`);const n=Math.floor(.75*r.length),a=new Uint8Array(n);let o=0,l=0;for(;o<n;){const t=s.indexOf(r.charAt(l++)),e=s.indexOf(r.charAt(l++)),i=s.indexOf(r.charAt(l++)),u=s.indexOf(r.charAt(l++));if(a[o++]=t<<2|e>>4,o===n)break;if(a[o++]=(15&e)<<4|i>>2,o===n)break;a[o++]=(3&i)<<6|u}return a.buffer}}class z{static decode(t){if(t.length%2!=0)throw new Error("invalid length");if(!/^[0-9a-fA-F]*$/.test(t))throw new Error("invalid character");const e=t.length/2;return new Uint8Array(e).map((e,s)=>{const i=2*s,r=t.substring(i,i+2);return parseInt(r,16)})}static encode(t,e){let s=t;return t instanceof ArrayBuffer&&(s=new Uint8Array(t)),ArrayBuffer.isView(t)&&(s=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),Array.from(s).map(t=>t.toString(16)).map(t=>e?t.toUpperCase():t).map(t=>t.padStart(2,"0")).join("")}}class D{#z;#D;constructor(t,e){this.#z=t,this.#D=e}get normalized(){return`${this.#z}/${this.#D}`}get type(){return this.#z}get subtype(){return this.#D}static parse(t){if(!t)return new D("unknown","unknown");const[e,s]=t.split(";"),[i,r]=e.trim().toLowerCase().split("/");return i&&r?new D(i,r):new D("unknown","unknown")}}class $ extends M{constructor(t,e,s,i){super(t,s,i),this.name="HttpClientError",this.status=e}dropping(t){return new $(this.message,this.status,M.dropProblemsContext(this.problems,t),this)}static problem(t,e){return{type:t,context:null,reason:e,details:null}}static of(t,e){const s=String(e?.message??e??"unknown failure");return new $(s,0,[$.problem(t,s)],e)}static async fromResponse(t){switch(D.parse(t.headers.get("Content-Type")).normalized){case"application/failures+json":{const e=await t.json().catch(()=>$.#$);if(e===$.#$)return $.#B(t);if(!Array.isArray(e))return $.#B(t,"does not decode as a failures array");if(0===e.length)return $.#B(t,"carries no failures");const s=`${t.status} ${t.statusText}: ${e.length} failures`;return new $(s,t.status,e)}case"application/problem+json":{const e=await t.json().catch(()=>$.#$);if(e===$.#$)return $.#B(t);if("object"!=typeof e||null===e||Array.isArray(e))return $.#B(t,"does not decode as a problem object");const s=[e.title,e.detail].filter(t=>null!=t).join(" "),i=s?`${t.status} ${t.statusText}: ${s}`:`${t.status} ${t.statusText}`;return new $(i,t.status,Array.isArray(e.problems)&&e.problems.length>0?e.problems:[$.problem("GENERIC_PROBLEM",i)])}default:return $.#j(t)}}static#$=Symbol("unreadable body");static#B(t,e="does not decode as json"){const s=D.parse(t.headers.get("Content-Type")).normalized,i=`${t.status} ${t.statusText}: the ${s} body ${e}`;return new $(i,t.status,[$.problem("GENERIC_PROBLEM",i)])}static async#j(t){const e=await t.text().catch(()=>null),s=null===e?`${t.status} ${t.statusText}: the body could not be read`:`${t.status} ${t.statusText}: ${e}`;return new $(s,t.status,[$.problem("GENERIC_PROBLEM",s)])}}const B=t=>globalThis.document?.querySelector(`meta[name="${t}"]`)?.getAttribute("content")??void 0;class j{async intercept(t,e,s){if(t.origin!==(globalThis.window?.location?.origin??t.origin))return await s.proceed(t,e);const i=B("_csrf_header"),r=B("_csrf");return i&&r&&e.headers.set(i,r),await s.proceed(t,e)}}class H{#H;constructor(t){this.#H=t}async intercept(t,e,s){const i=await s.proceed(t,e);return 401===i.status?(window.location.href=this.#H,new Promise(()=>{})):i}}class V{#V;constructor(){this.#V=[]}withCsrfToken(){return this.#V.push(new j),this}withRedirectOnUnauthorized(t){return this.#V.push(new H(t)),this}withInterceptors(...t){return this.#V.push(...t),this}build(){return new G([...this.#V])}}class W{async intercept(t,e,s){try{return await fetch(t,e)}catch(t){throw $.of("CONNECTION_PROBLEM",t)}}}class U{#V;#W;constructor(t,e){this.#V=t,this.#W=e}async proceed(t,e){const s=this.#V[this.#W];return await s.intercept(t,e,new U(this.#V,this.#W+1))}}class G{#V;static builder(){return new V}constructor(t){this.#V=t||[]}async exchange(t,e,s){const i=[...this.#V,...s||[],new W],r=new U(i,0),n=new URL(new Request(t).url),a={...e,headers:new Headers(e?.headers)};return await r.proceed(n,a)}request(t,e){return J.create(this,t,e)}get(t){return J.create(this,"GET",t)}head(t){return J.create(this,"HEAD",t)}post(t){return J.create(this,"POST",t)}put(t){return J.create(this,"PUT",t)}patch(t){return J.create(this,"PATCH",t)}delete(t){return J.create(this,"DELETE",t)}}const Q=async(t,e)=>{try{return await t[e]()}catch(t){throw $.of("UNMARSHALING_PROBLEM",t)}},K=t=>null==t?[]:"string"==typeof t?new URLSearchParams(t):"function"==typeof t[Symbol.iterator]?t:Object.entries(t);class J{#U;#G;#Q;#K;#J;#X;#Y;#V;#d;static create(t,e,s){const i=s.indexOf("#"),r=-1===i?"":s.slice(i),n=-1===i?s:s.slice(0,i),a=n.indexOf("?");return new J(t,e,-1===a?n:n.slice(0,a),new URLSearchParams(-1===a?"":n.slice(a+1)),new Headers,void 0,{},[],r)}constructor(t,e,s,i,r,n,a,o,l=""){this.#U=t,this.#G=e,this.#Q=s,this.#K=i,this.#X=n,this.#J=r,this.#Y=a,this.#V=o,this.#d=l}headers(t){for(const[e,s]of K(t))this.header(e,s);return this}header(t,e){return null==e?this.#J.delete(t):this.#J.set(t,e),this}params(t){for(const[e,s]of K(t))null==s?this.#K.delete(e):this.#K.set(e,s);return this}param(t,...e){this.#K.delete(t);for(const s of e.filter(t=>null!=t))this.#K.append(t,s);return this}body(t){return this.#X=t,this}json(t){if(void 0===t)return this;const e=JSON.stringify(t);return this.#J.set("Content-Type","application/json"),this.#X=e,this}multipart(t){const e=new FormData;return t(new X(e)),this.#X=e,this}options(t){for(const[e,s]of Object.entries(t))this.#Y[e]=s;return this}option(t,e){return this.#Y[t]=e,this}interceptors(t){for(const e of t)this.#V.push(e);return this}interceptor(t){return this.#V.push(t),this}async exchange(){const t=this.#K.size?`?${this.#K}`:"",e={...this.#Y,headers:this.#J,method:this.#G,body:this.#X};return await this.#U.exchange(`${this.#Q}${t}${this.#d}`,e,this.#V)}async fetch(){try{const t=await this.exchange();if(!t.ok)throw await $.fromResponse(t);return t}catch(t){if(t instanceof M)throw t;throw $.of("UNEXPECTED_PROBLEM",t)}}async fetchText(){const t=await this.fetch();return await Q(t,"text")}async fetchJson(){const t=await this.fetch();return 204===t.status?null:await Q(t,"json")}async fetchBlob(){const t=await this.fetch();return await Q(t,"blob")}async fetchArrayBuffer(){const t=await this.fetch();return await Q(t,"arrayBuffer")}}class X{#Z;constructor(t){this.#Z=t}field(t,e){return this.#Z.append(t,e),this}blob(t,e,s){return this.#Z.append(t,e,s),this}blobs(t,e){for(const s of e)this.#Z.append(t,s);return this}json(t,e,s){const i=new Blob([JSON.stringify(e)],{type:"application/json"});return this.#Z.append(t,i,s),this}}var Y=Object.freeze({__proto__:null,Base64:I,Failure:M,Hex:z,HttpClient:G,HttpClientBuilder:V,HttpClientError:$,HttpInterceptorChain:U,HttpMultipartRequestCustomizer:X,HttpRequestBuilder:J,MediaType:D});const Z=t=>{const e=e=>{try{t().removeItem(e)}catch{}},s=s=>{let i;try{i=t().getItem(s)}catch{return}if(null!==i)try{return JSON.parse(i)}catch{return void e(s)}};return{save:(e,s)=>{t().setItem(e,JSON.stringify(s))},load:s,remove:e,pop:t=>{const i=s(t);return e(t),i}}},tt=t=>({save(e,s,i){t.save(e,{revision:s,data:i})},load(e,s){const i=t.load(e);if(null!=i&&"object"==typeof i&&i.revision===s)return i.data;t.remove(e)}}),et=Z(()=>localStorage),st=Z(()=>sessionStorage),it=tt(et),rt=tt(st);class nt{static async fireAsync(t,e,s){t.dispatchEvent(e);const i=e.async?.promises??[],r=s?.mode??"broadcast";if("pipeline"===r&&i.length>1||"delegate"===r&&1!==i.length)throw Promise.all(i).catch(()=>{}),new Error("pipeline"===r?`[AsyncEvents] Event "${e.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${i.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${e.type}" is configured in 'delegate' mode and requires exactly one async listener, but ${i.length} were registered.`);return"broadcast"===r?Promise.all(i):Promise.resolve(i[0])}static asyncOn(t,e,s,i){const r=async t=>{const e=t;e.async||(e.async={promises:[]});const{promise:i,resolve:r,reject:n}=Promise.withResolvers();e.async.promises.push(i);try{r(await s(e))}catch(t){n(t)}};return t.addEventListener(e,r,i),r}static asyncOff(t,e,s,i){t.removeEventListener(e,s,i)}static mixInto(...t){for(const e of t)Object.assign(e.prototype,{async fireAsync(t,e){return await nt.fireAsync(this,t,e)},asyncOn(t,e,s){return nt.asyncOn(this,t,e,s)},asyncOff(t,e,s){nt.asyncOff(this,t,e,s)}})}}class at{static guard(t,e){window.addEventListener("beforeunload",e=>{t()&&e.preventDefault()},{signal:e})}}class ot{#tt=0;take(){return++this.#tt,this.hold()}hold(){const t=this.#tt,e=this;return{get stale(){return t!==e.#tt}}}invalidate(){++this.#tt}}const lt=t=>{for(let e=t.parentElement;e;e=e.parentElement)if("function"==typeof e.describedBy)return e;return null};class ut{static sleep(t){return new Promise(e=>setTimeout(e,t))}static debounce(t,e,s){const i=s?.immediate??!1;let r=null,n=[],a=0;const o=()=>{const s=performance.now()-a;t>s?r=setTimeout(o,t-s):(r=null,i||e(...n),null===r&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===r&&(r=setTimeout(o,t),i&&e(...n))},()=>{clearTimeout(r??void 0),r=null,n=[]}]}static throttle(t,e,s){const i=s?.leading??!0,r=s?.trailing??!0;let n=null,a=[],o=0;const l=()=>{o=i?performance.now():0,n=null,e(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();o||i||(o=u);const c=0===o?0:t-(u-o);a=s,c<=0||c>t?(null!==n&&(clearTimeout(n),n=null),o=u,e(...a),null===n&&(a=[])):null===n&&r&&(n=setTimeout(l,c))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class ct{static flatten(t,e,s){return Object.keys(t).reduce((i,r)=>{const n=e.length?`${e}.${r}`:r;return s.has(n)||"object"!=typeof t[r]||null===t[r]?i[n]=t[r]:Object.assign(i,ct.flatten(t[r],n,s)),i},{})}static#et=new Set(["__proto__","prototype","constructor"]);static providePath(t,e,s){const i=e.split(".").map(t=>/^[0-9]+$/.test(t)?+t:t);for(const t of i)if(ct.#et.has(t))throw new Error(`unsupported name segment '${t}' in '${e}'`);let r=t??{},n=null;for(let e=0;;++e){const a=i[e],o=i[e-1];if(Number.isInteger(a)&&!Array.isArray(r)&&(null!==n?n[o]=r=[]:t=r=[]),e===i.length-1)return r[a]=void 0!==s?s:a in r?r[a]:null,t;"object"==typeof r[a]&&null!==r[a]||(r[a]={}),n=r,r=r[a]}}static extract(t){if("radio"===t.getAttribute("type")){if(!t.checked)return;return"boolean"===t.dataset.fulBindType?"true"===t.value:t.value}return"checkbox"===t.getAttribute("type")?t.checked:"boolean"===t.dataset.fulBindType?t.value?"true"===t.value:null:"SELECT"===t.tagName&&t.multiple?Array.from(t.selectedOptions).map(t=>t.value):"INPUT"!==t.tagName&&"SELECT"!==t.tagName&&"TEXTAREA"!==t.tagName||""!==t.value&&void 0!==t.value?t.value:null}static#st(t){return"submit"===t.type||"reset"===t.type||"button"===t.type}static extractFrom(t,e){let s={};for(const i of t.elements)i.hasAttribute("name")&&(ct.#st(i)&&i!==e||i.matches(":disabled")&&i!==e||(s=ct.providePath(s,i.getAttribute("name"),ct.extract(i))));return s}static mutate(t,e){if("radio"!==t.getAttribute("type"))if("checkbox"!==t.getAttribute("type")){if("SELECT"===t.tagName&&t.multiple){const s=Array.isArray(e)?e.map(String):null==e?[]:[String(e)];return void Array.from(t.options).forEach(t=>{t.selected=s.includes(t.value)})}t.value=e}else t.checked=e;else t.checked=null!=e&&t.getAttribute("value")===String(e)}static mutateIn(t,e){const s=ct.#it(t);for(const[t,i]of Object.entries(ct.flatten(e,"",new Set(s.keys()))))for(const e of s.get(t)??[])ct.mutate(e,i)}static#it(t){const e=new Map;for(const s of t.elements){const t=s.getAttribute("name");if(!t)continue;const i=e.get(t);i?i.push(s):e.set(t,[s])}return e}static errors(t,e,s){const i=e=>e.closest("form")===t;Array.from(t.querySelectorAll("ful-field-error")).filter(i).forEach(t=>{t.setAttribute("aria-live",s?"off":"polite")});const r=t=>("FIELD_ERROR"===t.type||"INVALID_FORMAT"===t.type)&&t.context,n=e.filter(r),a=e.filter(t=>!r(t)),o=ct.#it(t);for(const t of o.values())t.forEach(t=>{t.setCustomValidity?.("")});const l=[],u=new Map;n.forEach(t=>{const e=t.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=e.length;0!==s;--s){const i=e.slice(0,s).join("."),r=(o.get(i)??[]).filter(t=>"function"==typeof t.setCustomValidity);if(0===r.length)continue;const n=e.slice(s).join(".");return void r.forEach(e=>{const s=u.get(e)??new Map;s.set(n,[...s.get(n)??[],t.reason]),u.set(e,s)})}l.push(t)});for(const[t,e]of u)for(const[s,i]of e)t.setCustomValidity(i.join("\n"),s);const c=[...a,...l];t.querySelectorAll("ful-errors").forEach(t=>{if(!i(t))return;const e=t;if(t.setAttribute("role","alert"),0===c.length)return t.replaceChildren(),void t.setAttribute("hidden","");t.removeAttribute("hidden"),e.innerText=c.map(t=>t.reason).join("\n")}),0!==e.length&&s&&Array.from(t.elements).filter(t=>"fieldset"!==t.localName&&t.matches(":invalid")).sort((t,e)=>t.getBoundingClientRect().y-e.getBoundingClientRect().y)[0]?.focus()}}class dt extends C{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#rt;#nt=null;#at;#ot=[];#lt=null;#ut;#ct;#dt;#ht=[];#pt=null;#ft=null;constructor(){super(),this.internals.role=this.constructor.ROLE}#mt(){return[this.#ct??this.#rt,...this.#ht].filter(t=>t)}#gt({fragment:t,control:e,error:s,label:i=null,described:r=null,claims:n=null,announces:a=e,freeze:o=null,also:l=[]}){if(this.#rt=e,this.#ut=s,this.#ct=n,this.#dt=a,this.#ht=l,o&&o.addEventListener("click",t=>{this.readonly&&t.preventDefault()},!0),this.#at=r??e,s&&(s.id=s.id||d.uid("ful-field-error"),this.#lt=s.id),this.#bt(),i&&dt.#vt(this,i,e),this.addEventListener("keydown",t=>{if("Enter"!==t.key||t.defaultPrevented||t.isComposing)return;const e=t.target;e.form!==this.form&&dt.#yt(e)&&this._requestSubmit()}),this.replaceChildren(t),null!==this.#nt){const t=this.#nt;this.#nt=null,e.focus(t)}if(null!==this.#ft){const{error:t,context:e}=this.#ft;this.#ft=null,this.setCustomValidity(t,e)}}static#yt(t){return t instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(t.type)}describedBy(t){return!!t&&(t.id||(t.id=d.uid("ful-described")),this.#ot.includes(t.id)||this.#ot.push(t.id),this.#bt(),!0)}#bt(){if(!this.#at)return;const t=[...this.#ot,this.#lt].filter(t=>t);t.length&&this.#at.setAttribute("aria-describedby",t.join(" "))}focus(t){this.#rt?this.#rt.focus(t):this.#nt=t??{}}setCustomValidity(t,e){if(this.#ut){if(d.set(this.#dt??this.#rt,"aria-invalid",t?"true":null),!t)return this.internals.setValidity({}),void(this.#ut.innerText="");this.internals.setValidity({customError:!0}," "),this.#ut.innerText=t}else this.#ft=t?{error:t,context:e}:null}get form(){return this.internals.form}_requestSubmit(){const t=this.form;if(!t)return;const e=t.querySelectorAll("button:not(:disabled), input:not(:disabled)");t.requestSubmit([...e].find(e=>"submit"===e.type&&e.form===t))}_notifyChange(t={}){this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{value:this.value,...t}}))}static#wt=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#vt(t,e,s){if(!dt.#wt.has(s.tagName)||"hidden"===s.getAttribute("type"))return e.id||(e.id=d.uid("ful-label")),s.setAttribute("aria-labelledby",e.id),void e.addEventListener("click",()=>t.focus());s.id||(s.id=d.uid("ful-control")),e.setAttribute("for",s.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}async upgrade(){if(await super.upgrade(),null===this.#pt)return;const{value:t}=this.#pt;this.#pt=null,this.value=t}_holdValue(t){this.#pt={value:t}}_heldValue(){return null===this.#pt?this.declared("value"):this.#pt.value}get value(){}set value(t){}formResetCallback(){this.value=this.unmarshal("value",this.getAttribute("value"))}get disabled(){return this.hasAttribute("disabled")}set disabled(t){this.reflectTo("disabled",t);for(const e of this.#mt())e.toggleAttribute("disabled",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){for(const e of this.#mt())e.readOnly=t;this.#dt&&d.set(this.#dt,"aria-readonly",t?"true":null),this.reflectTo("readonly",t)}get required(){return this.hasAttribute("required")}set required(t){this.#dt&&d.set(this.#dt,"aria-required",t?"true":null),this.reflectTo("required",t)}render(t){t.slots?.default&&c.isBlank(t.slots.default)&&t.slots.default.replaceChildren();const e=this._build(t);if(e instanceof Promise)return e.then(t=>this.#gt(t));this.#gt(e)}_build(t){throw new Error(`${this.constructor.name} must implement _build`)}}class ht{#Et;#xt;#G;#At;#St;constructor(t,e,s,i,r){this.#Et=t,this.#xt=e,this.#G=s,this.#At=i,this.#St=r}prepare(t,e){return this.#At(t,e)}async submit(t,e){return await this.#Et.request(this.#G,this.#xt).json(t).fetch()}transform(t,e){return this.#St(t,e)}}class pt{#At;#St;constructor(t,e){this.#At=t,this.#St=e}async prepare(t,e){return await this.#At(t,e)}async submit(t,e,s){return s}async transform(t,e){return await this.#St(t,e)}}class ft{static create(t,e){const s=t.component("http-client"),i=t.declared("request-mapper")?t.component(t.declared("request-mapper")):t=>t,r=t.declared("response-mapper")?t.component(t.declared("response-mapper")):t=>t,n=t.declared("action");if(!n)return new pt(i,r);const a=t.declared("method")??"POST";return new ht(s,n,a,i,r)}}const mt=t=>void 0!==t.form?t.form:t.constructor?.formAssociated?t.internals?.form:void 0;class gt extends C{static attributes=["action","method","loader","request-mapper","response-mapper","clear-invalid-on-change:presence","scroll-on-error:presence","autocomplete","track-changes:presence","guard-leave:presence"];form;render(){const t=document.createElement("form");this.form=t,t.setAttribute("novalidate",""),d.set(t,"autocomplete",this.declared("autocomplete")),d.forward("form-",this,t),t.replaceChildren(...this.childNodes),t.addEventListener("submit",async t=>{t.preventDefault(),t.stopPropagation(),await this.submit(t.submitter??void 0)}),this.addEventListener("click",t=>{const e=t.target;e.closest?.('[aria-disabled="true"]')&&(t.preventDefault(),t.stopImmediatePropagation())},!0),this.declared("clear-invalid-on-change")&&this.addEventListener("change",t=>{mt(t.target)===this.form&&t.target.setCustomValidity?.("")}),this.replaceChildren(t),this.#Ct=this.declared("track-changes")||this.declared("guard-leave"),this.#Ct&&(this.addEventListener("input",t=>this.#Tt(t.target)),this.addEventListener("change",t=>this.#Tt(t.target)),this.addEventListener("focusin",t=>this.#_t(t.target)),this.form.addEventListener("reset",t=>{if(t.target===this.form){for(const t of new Set([...this.#kt.keys(),...this.#Ot().keys()]))this.#qt.set(t,++this.#Lt);0===this.#Nt&&(this.#Nt=requestAnimationFrame(()=>this.#Pt()))}}),S.waitForChildren(this).catch(()=>{}).then(()=>this.commit()),this.#Rt())}connectedCallback(){super.connectedCallback(),this.#Ct&&this.#Rt()}disconnectedCallback(){this.#Ft?.abort(),this.#Ft=null}#Mt=!1;async submit(t){if(this.#Mt)return!1;let e,s,i;this.#Mt=!0,this.spinner(!0);try{const r=this.component(this.declared("loader")??"loaders:form").create(this);e=ct.extractFrom(this.form,t);const n=this.#Ct?{saved:this.#Ot(),upTo:this.#Lt}:null;s=await r.prepare(e,this);const a=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:t,values:e,request:s}});if(!this.dispatchEvent(a))return!1;this.errors=[];const o=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:a.detail.values,request:a.detail.request}});let l=await nt.fireAsync(this,o,{mode:"pipeline"});s=o.detail.request,l=await r.submit(s,this,l);const u=await r.transform(l,this);n&&this.#It(n.saved,n.upTo),i=new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,response:u}})}catch(r){i=new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,exception:r}}),r instanceof M?this.errors=r.problems:console.warn("failed to submit form",this,"reason:",r)}finally{this.#Mt=!1,this.spinner(!1)}return this.dispatchEvent(i),"submit:success"===i.type}async save(t){return!(!this.#Ct||this.dirty)||await this.submit(t)&&!this.dirty}reset(){this.form.reset(),this.#Ct&&this.#Pt()}#kt=new Map;#zt=new Map;#qt=new Map;#Lt=0;#Dt=!1;#Nt=0;#Ft=null;#Ct=!1;get dirty(){if(!this.#Ct)return!1;for(const t of this.#qt.keys()){const e=this.#$t(t);if((this.#kt.has(t)||"[]"!==e)&&(this.#kt.get(t)??this.#zt.get(t))!==e)return!0}return!1}commit(){this.#Ct&&this.#It(this.#Ot(),this.#Lt)}edited(...t){for(const e of t)this.#Tt(e)}#It(t,e){this.#kt=t;for(const[t,s]of this.#qt)s<=e&&this.#qt.delete(t);for(const e of this.#zt.keys())t.has(e)&&this.#zt.delete(e);this.#Pt()}#Bt(t){for(let e=t;e&&e!==this;e=e.parentElement)if(mt(e)===this.form&&e.hasAttribute("name"))return e.getAttribute("name");return null}#Tt(t){if(!this.#Ct)return;const e=this.#Bt(t);null!==e&&(this.#qt.set(e,++this.#Lt),0===this.#Nt&&(this.#Nt=requestAnimationFrame(()=>this.#Pt())))}#_t(t){const e=this.#Bt(t);null===e||this.#kt.has(e)||this.#zt.has(e)||this.#zt.set(e,this.#$t(e))}#jt(){return Array.from(this.form.elements).filter(t=>t.hasAttribute("name")&&!["submit","reset","button"].includes(t.type)&&!t.matches(":disabled"))}#Ot(){const t=new Map;for(const e of this.#jt()){const s=e.getAttribute("name");t.set(s,[...t.get(s)??[],ct.extract(e)])}return new Map(Array.from(t,([t,e])=>[t,JSON.stringify(e)]))}#$t(t){return JSON.stringify(this.#jt().filter(e=>e.getAttribute("name")===t).map(t=>ct.extract(t)))}#Pt(){cancelAnimationFrame(this.#Nt),this.#Nt=0;const t=this.dirty;this.querySelectorAll("button").forEach(e=>{const s=e;s.form===this.form&&"submit"===s.type&&s.toggleAttribute("data-ful-dirty",t)}),t!==this.#Dt&&(this.#Dt=t,t?this.internals.states.add("dirty"):this.internals.states.delete("dirty"),this.dispatchEvent(new CustomEvent("dirty:change",{bubbles:!0,cancelable:!1,detail:{dirty:t}})))}#Rt(){this.declared("guard-leave")&&!this.#Ft&&(this.#Ft=new AbortController,at.guard(()=>this.dirty,this.#Ft.signal))}#Ht=0;#Vt(t){if(d.defaultValue(t,"role","status"),t.hidden=!1,""!==t.textContent.trim())return;const e=document.createElement("span");e.className="ful-sr-only",e.dataset.ref="spinner-label",t.append(e),e.textContent=R.of().t("spinner.loading")}spinner(t){if(t){if(++this.#Ht,1!==this.#Ht)return}else if(this.#Ht=Math.max(0,this.#Ht-1),0!==this.#Ht)return;d.set(this,"aria-busy",t?"true":null),this.querySelectorAll("ful-spinner").forEach(e=>{if(e.closest("form")!==this.form)return;const s=e;t?this.#Vt(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(e=>{const s=e;if(s.form===this.form&&("submit"===s.type||"reset"===s.type))if(t)s.dataset.wd=s.getAttribute("aria-disabled")??"",s.setAttribute("aria-disabled","true");else{if(void 0===s.dataset.wd)return;d.set(s,"aria-disabled",s.dataset.wd||null),delete s.dataset.wd}})}set values(t){ct.mutateIn(this.form,t)}get values(){return ct.extractFrom(this.form)}set errors(t){ct.errors(this.form,t,this.declared("scroll-on-error"))}}const bt=new e(100),vt=(t,e)=>bt.getOrCompute(`${t}:${e}`,()=>{try{return new RegExp(e,"g")}catch(s){return console.warn(`invalid ${t} attribute`,e,s),null}}),yt={numeric:"numeric",decimal:"decimal"},wt=new Set(["date","time","datetime-local","month","week"]),Et={numeric:t=>t.replace(/\D/g,""),decimal:t=>{const e=t.replace(/[^\d.,]/g,""),s=e.search(/[.,]/);return-1===s?e:e.slice(0,s+1)+e.slice(s+1).replace(/[.,]/g,"")}};class xt extends dt{static observed=["placeholder"];static attributes=["type","v-type","keep","reject","uppercase:presence","trim:presence","unsigned:presence","autocomplete"];static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-if="type != \'textarea\'" data-tpl-type="type" placeholder=" " form="">\n <textarea data-tpl-if="type == \'textarea\'" placeholder=" " form=""></textarea>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_input;#Wt=[];#Ut=null;_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:t}){const e=this._type(),s=yt[e],i=s?"text":e,r=this.template().withOverlay({type:i,slots:t}).render();this.#Wt=[...r.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#Wt[0];const n=this.declared("autocomplete")??(this.closest("form")?.getAttribute("autocomplete")??null);const a=(t=>{const e=t.declared("keep"),s=t.declared("reject");if(null!==e&&null!==s&&console.warn("a ful-input declares both keep and reject: keep is applied, reject is ignored",t),null!==e){const t=vt("keep",e);return t&&(e=>(e.match(t)??[]).join(""))}if(null!==s){const t=vt("reject",s);return t&&(e=>e.replace(t,""))}return((t,e)=>{const s=Et[t];return s?e?s:t=>((t,e)=>(t.startsWith("-")?"-":"")+e(t))(t,s):null})(t._type(),t.declared("unsigned"))})(this);for(const t of this.#Wt)this.#Gt(t,s,n,a);return{fragment:r,control:this._input,error:r.querySelector("ful-field-error"),label:r.querySelector("label")}}#Gt(t,e,s,i){e&&d.set(t,"inputmode",e),d.set(t,"autocomplete",s);const r=t.id;d.forward("input-",this,t),t!==this._input&&d.set(t,"id",r||null),this.#Qt(t),t.addEventListener("input",()=>{if(!i)return;const e=t.value,s=i(e);if(e===s)return;const r=t.selectionStart;if(t.value=s,null===r)return;const n=i(e.slice(0,r)).length;t.setSelectionRange(n,n)})}#Qt(t){if(!wt.has(t.type))return void t.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()});let e=!1;const s=()=>{e=!1;const t=JSON.stringify(this.value);t!==this.#Ut&&(this.#Ut=t,this._notifyChange())};t.addEventListener("focus",()=>{this.#Ut=JSON.stringify(this.value)}),t.addEventListener("keydown",t=>{"Enter"!==t.key||t.isComposing?e=!0:s()}),t.addEventListener("blur",s),t.addEventListener("change",t=>{t.stopPropagation(),e||s()})}get value(){const t=this.declared("uppercase"),e=this.declared("trim"),s=this._input?this._input.value:`${this._heldValue()??""}`,i=t?s.toUpperCase():s,r=e?i.trim():i;if(""===r)return null;const n="decimal"===this._type()?r.replaceAll(",","."):r;if("number"===this.declared("v-type")){const t=Number(n);return Number.isNaN(t)?n:t}return n}set value(t){this._input?(this._input.value=""===t||null==t?"":`${t}`,this.#Ut=JSON.stringify(this.value)):this._holdValue(t)}get placeholder(){const t=this._input.getAttribute("placeholder");return" "===t?null:t}set placeholder(t){for(const e of this.#Wt)d.set(e,"placeholder",t??" ");this.reflectTo("placeholder",t)}}const At=t=>""===t?null:t,St=t=>{const[e,s,i]=t.split("-").map(Number),r=new Date(0);return r.setFullYear(e,s-1,i),r.setHours(0,0,0,0),r.getFullYear()===e&&r.getMonth()===s-1&&r.getDate()===i?r:new Date(Number.NaN)};class Ct extends C{static attributes=["locale","default"];render(){const t=St(this.textContent.trim());if(Number.isNaN(t.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:e}=R.of({locale:this.declared("locale")??void 0});this.replaceChildren(e(t,{year:"numeric",month:"numeric",day:"numeric"}))}}class Tt extends C{static attributes=["locale","default"];render(){const t=this.textContent.trim(),e=""===t?null:new Date(Tt.isoToLocal(t));if(null===e||Number.isNaN(e.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:s}=R.of({locale:this.declared("locale")??void 0});this.replaceChildren(s(e,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}))}static#Kt(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?St(t):new Date(t)}static isoToLocal(t){const e=Tt.#Kt(t),s=(t,e)=>String(e).padStart(t,"0");return`${e.getFullYear()}-${s(2,e.getMonth()+1)}-${s(2,e.getDate())}T${s(2,e.getHours())}:${s(2,e.getMinutes())}:${s(2,e.getSeconds())}.${s(3,e.getMilliseconds())}`}static localToIso(t){const e=Tt.#Kt(t);return Number.isNaN(e.getTime())?null:e.toISOString()}}class _t extends xt{static observed=["step","min","max"];_type(){return"date"}get min(){return At(this._input.min)}set min(t){this._input.min=_t.#Jt(t)}get max(){return At(this._input.max)}set max(t){this._input.max=_t.#Jt(t)}get step(){return At(this._input.step)}set step(t){this._input.step=t??""}static#Jt(t){if(!t)return"";const e=t=>new Date(t.getTime()-6e4*t.getTimezoneOffset()).toISOString().split("T")[0];if("now"===t)return e(new Date);const s=/^([+-])(\d+)([dmy])$/.exec(t);if(!s)return t;const i="-"===s[1]?-1:1,r=+s[2],n=new Date;switch(n.setHours(0,0,0,0),s[3]){case"d":n.setDate(n.getDate()+r*i);break;case"m":{const t=n.getDate();n.setMonth(n.getMonth()+r*i),n.getDate()!==t&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+r*i)}return e(n)}}class kt extends _t{_type(){return"time"}get min(){return At(this._input.min)}set min(t){this._input.min=this.#Xt(t)}get max(){return At(this._input.max)}set max(t){this._input.max=this.#Xt(t)}#Xt(t){if(!t)return"";const e=new Date;if("now"!==t){const s=/^([+-])(\d+)([hm])$/.exec(t);if(!s)return t;const i="-"===s[1]?-1:1,r=+s[2]*i;"h"===s[3]?e.setHours(e.getHours()+r):e.setMinutes(e.getMinutes()+r)}return kt.#Yt(e,Number(this._input.step)||60)}static#Yt(t,e){const s=t=>String(t).padStart(2,"0"),i=3600*t.getHours()+60*t.getMinutes()+t.getSeconds(),r=Math.floor(i/e)*e,n=s(Math.floor(r/3600)),a=s(Math.floor(r%3600/60));return e%60==0?`${n}:${a}`:`${n}:${a}:${s(r%60)}`}}class Ot extends xt{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){if(!this._input){const t=this._heldValue();return Tt.localToIso(t?Tt.isoToLocal(t):"")}return Tt.localToIso(this._input.value)}set value(t){this._input?super.value=t?Tt.isoToLocal(t):"":this._holdValue(t)}get min(){return Tt.localToIso(this._input.min)}set min(t){this._input.min=t?Tt.isoToLocal(t):""}get max(){return Tt.localToIso(this._input.max)}set max(t){this._input.max=t?Tt.isoToLocal(t):""}get step(){return At(this._input.step)}set step(t){this._input.step=t??""}}class qt extends xt{static WARNING_TIMEOUT=5e3;static list(t=[]){const e=new DataTransfer;for(const s of t)e.items.add(s);return e.files}static observed=["placeholder","accept:csv","multiple:presence","item-list:presence","dropzone:presence","no-input:presence","max-files:number","max-file-size:number","max-total-size:number","value"];#Zt;#te;#ee;#se;#ie;_type(){return"file"}static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-type="type" placeholder=" " form="">\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <div data-ref="dropzone" class="dropzone" data-tpl-if="slots.dropzone">\n {{{{ slots.dropzone }}}}\n </div>\n <div data-ref="dropzone" class="default-dropzone" data-tpl-if="!slots.dropzone">\n {{ #l10n:t(\'files.dropzone-label\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings role="status" aria-live="polite"></ful-field-warnings>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="files" data-tpl-var="file" data-tpl-data-name="file.name">\n <div><span>{{ file.name }}</span><span>{{ #l10n:bytes(file.size) }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'files.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};#re;_build(t){const e=super._build(t),s=e.fragment;return this.#te=s.querySelector("ful-item-list"),this.#re=t.slots?.items&&!c.isBlank(t.slots.items)?A.fromFragment(t.slots.items):null,this.#ee=s.querySelector("[data-ref=dropzone]"),this.#se=s.querySelector("ful-field-warnings"),this.#ie=s.querySelector("ful-control-group"),this.#se.addEventListener("animationend",t=>{t.target.remove()}),this.#te.addEventListener("click",t=>{if(!t.target.closest("button"))return;if(!this._interactive())return;const e=[...this.#te.children].indexOf(t.target.closest("ful-item"));-1!==e&&(this.files=qt.list([...this.files].filter((t,s)=>s!==e)),this._notifyChange())}),this.#ee.addEventListener("click",t=>{this._interactive()&&this._input.click()}),this.#ee.addEventListener("dragover",t=>{t.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#ee.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#ee.addEventListener("drop",t=>{if(t.preventDefault(),this.toggleAttribute("dragover",!1),!this._interactive())return;const e=[...t.dataTransfer.items].filter(t=>"file"===t.kind).map(t=>t.getAsFile()).filter(t=>null!==t);0===e.length||e.length>1&&!this.multiple||(this.files=qt.list(e),this._notifyChange())}),this._input.addEventListener("change",()=>{this.#ne()},{capture:!0}),{...e,freeze:this.#ie}}#ne(){this.setCustomValidity(),this.#se.replaceChildren(),this.#ae(),this.#oe(),this.#le(),this.#ue(),(this.#re??this.template("items")).withOverlay({files:this.files}).renderTo(this.#te)}warning(t,e){this.template("warning").withOverlay({key:t,args:e}).appendTo(this.#se);const s=this.#se.lastElementChild;setTimeout(()=>s.remove(),qt.WARNING_TIMEOUT)}#ce(t){const e=t.name.toLowerCase();return this.#Zt.some(s=>{const i=s.toLowerCase().split(";")[0].trim();return i.startsWith(".")?e.endsWith(i):i.endsWith("/*")?t.type.startsWith(`${i.slice(0,-1)}`):i.includes("/")&&t.type===i})}#ae(){if(!this.#Zt.length)return;const t=[...this.files].filter(t=>!this.#ce(t));0!==t.length&&(this.warning("files.unacceptable-file-type",{types:this.#Zt.join(", ")}),this._input.files=qt.list([...this.files].filter(e=>!t.includes(e))))}#ue(){null!==this.#de&&(this.files.length<=this.#de||(this.warning("files.max-files-exceeded",{count:this.#de}),this._input.files=qt.list()))}#oe(){if(null===this.#he)return;const t=[...this.files].filter(t=>t.size>this.#he);0!==t.length&&(this.warning("files.max-file-size-exceeded",{size:R.of().bytes(this.#he)}),this._input.files=qt.list([...this.files].filter(e=>!t.includes(e))))}#le(){null!==this.#pe&&([...this.files].reduce((t,e)=>t+e.size,0)<=this.#pe||(this.warning("files.max-total-size-exceeded",{size:R.of().bytes(this.#pe)}),this._input.files=qt.list()))}get accept(){return this.#Zt}set accept(t){this._input.accept=t.join(","),this.#Zt=t,this.reflectTo("accept",t)}get multiple(){return this._input?this._input.multiple:this.declared("multiple")}set multiple(t){this._input.multiple=t,this.reflectTo("multiple",t)}get files(){return this._input?this._input.files:qt.list()}set files(t){this._input.files=t,this.#ne()}get file(){return this.files[0]??null}set file(t){this.files=qt.list(t?[t]:[])}get value(){const t=Array.from(this.files).map(t=>t.name);return this.multiple?t:t[0]??null}set value(t){!t&&this._input&&(this.files=qt.list())}formResetCallback(){this.value=null}get totalSize(){return Array.from(this.files).reduce((t,e)=>t+e.size,0)}#de;get maxFiles(){return this.#de}set maxFiles(t){this.#de=t,this.reflectTo("max-files",t)}#he;get maxFileSize(){return this.#he}set maxFileSize(t){this.#he=t,this.reflectTo("max-file-size",t)}#pe;get maxTotalSize(){return this.#pe}set maxTotalSize(t){this.#pe=t,this.reflectTo("max-total-size",t)}#fe;get itemList(){return this.#fe}set itemList(t){this.#fe=t,this.reflectTo("item-list",t)}#me;get dropzone(){return this.#me}set dropzone(t){this.#me=t,this.reflectTo("dropzone",t)}#ge;get noInput(){return this.#ge}set noInput(t){this.#ge=t,this.reflectTo("no-input",t)}}const Lt=new Map;let Nt=0,Pt=!1;const Rt=(t,e,s)=>Math.min(Math.max(t,e),Math.max(e,s)),Ft=(t,e)=>{const{invoker:s,stretch:i}=e,r=s.getBoundingClientRect(),n=document.documentElement,a=n.clientWidth,o=n.clientHeight;t.style.removeProperty("margin");const l=getComputedStyle(t),u=parseFloat(l.marginTop)||0,c=parseFloat(l.marginRight)||0,d=parseFloat(l.marginBottom)||0,h=parseFloat(l.marginLeft)||0;if(t.style.right="auto",t.style.bottom="auto",t.style.margin="0",i){t.style.removeProperty("width"),t.style.removeProperty("min-width"),t.style.removeProperty("max-width");const e=Math.min(parseFloat(l.maxWidth)||a,a-16);t.style.minWidth=`${Math.min(r.width,a-16)}px`,t.style.maxWidth=`${e}px`;const s=t.getBoundingClientRect().width;t.style.left=`${Rt(r.left,8,a-s-8)}px`;const i=t.getBoundingClientRect().height,n=r.bottom+u,c=n+i<=o-8?n:r.top-d-i;return void(t.style.top=`${Rt(c,8,o-i-8)}px`)}const p=(t=>t.matches("ful-note, .ful-note, [placement]"))(t),f=p?t.getAttribute("placement")??"bottom":"bottom";t.style.removeProperty("max-width");const m=Math.min(parseFloat(l.maxWidth)||a,a-16);t.style.maxWidth=`${m}px`,t.style.left="8px";const g=t.getBoundingClientRect().width;let b="right"===f?r.right+h:"left"===f?r.left-c-g:p?r.left+r.width/2-g/2:r.left;b=Rt(b,8,a-g-8),t.style.left=`${b}px`,t.style.maxWidth=`${Math.min(m,a-8-b)}px`;const v=t.getBoundingClientRect().height,y="top"===f?r.top-d-v:"right"===f||"left"===f?r.top+r.height/2-v/2:r.bottom+u;t.style.top=`${Rt(y,8,o-v-8)}px`,p&&((t,e)=>{const s=e.getBoundingClientRect(),i=t.getBoundingClientRect();t.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-i.left-t.clientLeft+"px"),t.style.setProperty("--ful-note-callout-block",s.top+s.height/2-i.top-t.clientTop+"px")})(t,s)},Mt=()=>{Nt=0;for(const[t,e]of Lt)t.isConnected&&e.invoker.isConnected?Ft(t,e):Lt.delete(t)},It=()=>{!Nt&&Lt.size>0&&(Nt=requestAnimationFrame(Mt))};class zt{static wire(t,e,{prefix:s="ful-anchor",invoke:i=!1,expanded:r=!1,stretch:n=!1,handPlace:a=!1}={}){const o=d.uid(s);if(i)if(e.id=e.id||o,"button"===t.localName||"input"===t.localName)t.setAttribute("popovertarget",e.id);else{let s=!1;t.addEventListener("pointerdown",()=>{s=e.matches(":popover-open")},!0),t.addEventListener("click",()=>{const t=s&&!e.matches(":popover-open");s=!1,t||e.togglePopover()}),t.addEventListener("keydown",t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),e.togglePopover())})}const l=`--${o}`;if(t.style.anchorName=l,e.style.positionAnchor=l,r&&(t.setAttribute("aria-expanded","false"),e.addEventListener("toggle",e=>{t.setAttribute("aria-expanded","open"===e.newState?"true":"false")})),!a&&CSS.supports("anchor-name: --ful-probe")&&CSS.supports("position-anchor: --ful-probe")&&CSS.supports("position-area: bottom")&&CSS.supports("top: anchor(bottom)")&&CSS.supports("width: anchor-size(width)"))return;const u={invoker:t,stretch:n};e.addEventListener("beforetoggle",t=>{"open"===t.newState&&((t,e)=>{t.style.visibility="hidden",queueMicrotask(()=>{t.matches(":popover-open")&&Ft(t,e),t.style.removeProperty("visibility")})})(e,u)}),e.addEventListener("toggle",t=>{"open"===t.newState?(Lt.set(e,u),Ft(e,u)):(Lt.delete(e),(t=>{for(const e of["top","left","right","bottom","margin","max-width","min-width","width","visibility","--ful-note-callout-inline","--ful-note-callout-block"])t.style.removeProperty(e)})(e))}),Pt||(Pt=!0,document.addEventListener("scroll",It,!0),window.addEventListener("resize",It))}static show(t,e,{flip:s=!1,gap:i=0}={}){return"function"!=typeof t.showPopover||t.matches(":popover-open")||t.showPopover(),(()=>{const r=e instanceof Element?e.getBoundingClientRect():e,n=document.documentElement,a=t.getBoundingClientRect(),o=r.bottom+i,l=r.top-i-a.height,u=s&&o+a.height>n.clientHeight-8&&l>=8?l:o;t.style.right="auto",t.style.bottom="auto",t.style.margin="0",t.style.left=`${Rt(r.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,t.style.top=`${Rt(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),t}}const Dt=(t,e)=>t.filter(({key:t})=>e.some(e=>String(e)===String(t))),$t=(t,e)=>t.filter(({label:t})=>(t??"").toLowerCase().includes(e?.toLowerCase()??""));class Bt{#Et;#xt;#G;#St;#be;#ve;#_=null;#ye=null;#we=new ot;constructor({http:t,url:e,method:s,responseMapper:i,prefetch:r,revision:n}){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i,this.#be=r,this.#ve=n}async prefetch(){this.#be&&await this.#Ee()}async exact(...t){return Dt(await this.#Ee(),t)}async load(t){return $t(await this.#Ee(),t)}async invalidate(){this.#we.invalidate(),this.#_=null,this.#ye=null}async#Ee(){if(null===this.#_){if(null===this.#ye){const t=this.#we.hold();this.#ye=Bt.#xe(this.#Et,this.#G,this.#xt,this.#ve).then(e=>{t.stale||(this.#_=this.#St(e))}).finally(()=>{t.stale||(this.#ye=null)})}await this.#ye}if(null===this.#_)throw new Error("superseded by an invalidation");return this.#_}static async#xe(t,e,s,i){const r=`${e}@${s}`;if(null!==i){const t=it.load(r,i);if(void 0!==t)return t}const n=await t.request(e,s).fetchJson();if(null!==i)try{it.save(r,i,n)}catch(t){console.warn("failed to cache the select options",t)}return n}}class jt{#Et;#xt;#G;#St;constructor({http:t,url:e,method:s,responseMapper:i}){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i}async invalidate(){}async exact(...t){const e=await this.#Et.request(this.#G,this.#xt).param("k",...t).fetchJson();return this.#St(e)}async load(t){const e=await this.#Et.request(this.#G,this.#xt).param("s",t).fetchJson();return this.#St(e)}}class Ht{#_;constructor(t){this.#_=t}update(t){this.#_=t}async invalidate(){}exact(...t){return Dt(this.#_,t)}load(t){return $t(this.#_,t)}}class Vt{static from({data:t,http:e,url:s,method:i="POST",mode:r,prefetch:n=!1,revision:a=null,responseMapper:o}){return s?"chunked"===r?new jt({http:e,url:s,method:i,responseMapper:o}):new Bt({http:e,url:s,method:i,responseMapper:o,prefetch:n,revision:a}):new Ht(t??[])}static create(t,e){if(!t.declared("src")){const t=Array.from(e.options?.querySelectorAll("option")??[]);return Vt.from({data:t.map(t=>({key:t.getAttribute("value")??t.innerText.trim(),label:t.innerText.trim(),metadata:void 0}))})}return Vt.from({http:t.component("http-client"),url:t.declared("src"),method:t.declared("method")??"POST",mode:t.declared("mode"),prefetch:t.declared("preload"),revision:Vt.#Ae(t),responseMapper:Vt.#Se(t)})}static#Ae(t){const e=t.declared("revision");if(""!==e)return e;const s=t.component("revision");return null==s?(console.warn("a valueless revision asks the registry for one, and no 'revision' component is defined: the vocabulary will not be cached",t),null):"function"==typeof s?s():s}static#Se(t){return t.declared("k-expr")&&t.declared("l-expr")?e=>t._registry.evaluator().withOverlay(e).evaluateExpression(t.declared("d-expr")??"self").map(e=>{const s=t._registry.evaluator().withOverlay(e);return{key:s.evaluateExpression(t.declared("k-expr")),label:s.evaluateExpression(t.declared("l-expr")),metadata:s.evaluateExpression(t.declared("m-expr")??"self")}}):t.declared("response-mapper")?t.component(t.declared("response-mapper")):t=>t.map(([t,e,s])=>({key:t,label:e,metadata:s}))}}class Wt extends C{static attributes=["listbox"];static slots=!0;static template='\n <ful-spinner class="centered" role="status" hidden><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n <ful-empty data-ref="empty" aria-live="polite" hidden>{{ #l10n:t(\'dropdown.empty\') }}</ful-empty>\n <menu tabindex="-1" role="listbox" hidden></menu>\n ';static templates={options:'\n <li data-tpl-each="self" data-tpl-selected="index == 0" data-tpl-value="index" role="option">\n {{ label }}\n </li>\n '};#Ce;#Te;#_e;#ke;#Y=new Map;#Oe=new ot;render({slots:t}){const e=this.template().render();this.#ke=c.isBlank(t.default)?this.template("options"):A.fromFragment(t.default),this.#Ce=e.querySelector("ful-spinner"),this.#_e=e.querySelector("[data-ref=empty]"),this.#Te=e.querySelector("menu"),this.#Te.id=this.declared("listbox")||d.uid("ful-listbox"),this.#Te.addEventListener("mousedown",t=>{t.target.closest("li")&&t.preventDefault()}),this.#Te.addEventListener("click",t=>{t.stopPropagation();const e=t.target.closest("li");e?e.matches('[aria-disabled="true"]')||this.#qe(e):this.hide()}),this.replaceChildren(e)}#Le(){return!this.#Te||this.#Te.hidden?null:this.#Te.querySelector("li[selected]")??this.#Te.querySelector('li:not([aria-disabled="true"])')}#Ne(t){if(t){for(const e of this.#Te.querySelectorAll("li"))e.toggleAttribute("selected",e===t);t.id||=d.uid("ful-option"),this.#Pe(t.id),t.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#Pe(null)}acceptSelection(){const t=this.#Le();t&&!t.matches('[aria-disabled="true"]')&&this.#qe(t)}update(t,e=[]){if(void 0===t)throw new Error("null data");this.#Y=new Map(t.map((t,e)=>[String(e),t]));const s=t.map((t,e)=>({index:e,...t}));this.#ke.withOverlay(s).renderTo(this.#Te);for(const[s,i]of[...this.#Te.children].entries()){const r=t[s],n=e.some(t=>String(t)===String(r?.key));i.toggleAttribute("picked",n),i.setAttribute("aria-selected",n?"true":"false");const a=!!r?.metadata?.disabled;a?i.setAttribute("aria-disabled","true"):i.removeAttribute("aria-disabled"),a&&r.metadata.reason?i.setAttribute("title",String(r.metadata.reason)):i.removeAttribute("title")}this.#_e.toggleAttribute("hidden",0!==t.length),this.#Te.toggleAttribute("hidden",0===t.length);const i=t.findIndex(({key:t})=>e.some(e=>String(e)===String(t)));this.#Ne(i>=0?this.#Te.children[i]:this.#Te.querySelector('li[selected]:not([aria-disabled="true"])')??this.#Te.querySelector('li:not([aria-disabled="true"])'))}#qe(t){const e=t.getAttribute("value"),s=this.#Y.get(e);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:e,entry:s}}))}hide(){this.#Oe.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#Pe(null)}#Pe(t){this.dispatchEvent(new CustomEvent("activechange",{bubbles:!1,cancelable:!1,detail:{id:t}}))}get shown(){return this.matches(":popover-open")}async show(t,e=[]){const s=this.#Oe.take();this.matches(":popover-open")||this.showPopover(),this.#Te.setAttribute("hidden",""),this.#Ce.removeAttribute("hidden");try{const i=await t();if(s.stale)return;this.update(i,e)}catch(t){if(s.stale)return;throw this.hide(),t}finally{s.stale||this.#Ce.setAttribute("hidden","")}}async moveOrShow(t,e,s=[]){if(this.shown){const e=this.#Le(),s=e?.[(t?"next":"previous")+"ElementSibling"],i=s?this.#Re(s,t):null;return void(e&&i&&this.#Ne(i))}await this.show(e,s)}#Re(t,e){for(let s=t;s;s=s[(e?"next":"previous")+"ElementSibling"])if(!s.matches('[aria-disabled="true"]'))return s;return null}jump(t){if(this.#Te.hidden)return;const e=t?this.#Te.firstElementChild:this.#Te.lastElementChild,s=this.#Re(e,t);s&&this.#Ne(s)}page(t){const e=this.#Le();if(!e)return;let s=e;for(let e=0;e!==this.#Fe();++e){const e=this.#Re(s[(t?"next":"previous")+"ElementSibling"],t);if(!e)break;s=e}this.#Ne(s)}#Fe(){const t=this.#Te.firstElementChild;return t&&0!==t.offsetHeight?Math.max(1,Math.trunc(this.#Te.clientHeight/t.offsetHeight)):1}}class Ut extends dt{static attributes=["name","loader","k-type","mode","preload:presence","revision","k-expr","l-expr","d-expr","m-expr","response-mapper"];static observed=["multiple:presence","item-list:presence","value:csv","src","method"];unmarshal(t,e){return"value"!==t||""!==e||this.hasAttribute("multiple")?super.unmarshal(t,e):[""]}static slots=!0;static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-control>\n <input type="text" form="" autocomplete="off" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-expanded="false">\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n <ful-dropdown popover="manual">{{{{ slots.dropdown }}}}</ful-dropdown>\n </ful-control-group>\n <ful-item-list></ful-item-list>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="entries" data-tpl-var="entry" data-tpl-data-key="entry.key">\n <div><span>{{ entry.label }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'select.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n '};#Me;#Ie={src:null,method:null};#Y;#rt;#ze;#De;#$e;#te;#re;#Be;#je=!1;#He=new Map;#Ve=new ot;#We=!1;#Ue;#Ge;_build({slots:t}){const e=this.declared("name");this.#Y=t.options,this.#Qe(),this.#Be=this.declared("multiple"),this.#Me.prefetch?.()?.catch(t=>{console.warn("failed to prefetch select options",this,"reason:",t)});const s=this.template().withOverlay({slots:t,name:e}).render();this.#De=s.querySelector("ful-control > input"),this.#$e=s.querySelector("label"),this.#te=s.querySelector("ful-item-list"),this.#re=t.items&&!c.isBlank(t.items)?A.fromFragment(t.items):null,d.forward("input-",this,this.#De),this.#rt=s.querySelector("ful-control"),this.#ze=s.querySelector("ful-dropdown");const i=d.uid("ful-listbox");this.#ze.setAttribute("listbox",i),this.#De.setAttribute("aria-controls",i),this.#ze.addEventListener("beforetoggle",t=>{const e="open"===t.newState;this.#De.setAttribute("aria-expanded",e?"true":"false"),e||this.#De.removeAttribute("aria-activedescendant")}),this.#ze.addEventListener("activechange",t=>{d.set(this.#De,"aria-activedescendant",t.detail.id)});const r=s.querySelector("ful-control-group");return zt.wire(r,this.#ze,{prefix:"ful-select",stretch:!0}),[this.#Ue,this.#Ge]=ut.throttle(400,()=>this.#Ke()),this.#Je(),this.#Xe(),this.#Ye(),this.#Ze(),{fragment:s,control:this.#De,error:s.querySelector("ful-field-error"),label:this.#$e}}#Je(){this.addEventListener("click",t=>{if(!this._interactive()||this.#$e.contains(t.target))return;const e=t.target.closest('button, [role="button"], a[href], input, select, textarea');if(!e||e===this.#De){if(this.#ze.shown)return this.#Ge(),void this.#ts();this.#De.focus(),this.#Ue()}}),this.#te.addEventListener("click",t=>{t.stopPropagation(),t.target.closest("button")&&this._interactive()&&this.#es([...this.#te.children].indexOf(t.target.closest("ful-item")))}),this.#rt.addEventListener("click",t=>{const e=t.target instanceof Element?t.target.closest("ful-badge"):null;e&&(t.stopPropagation(),this.#ss(e))})}#Xe(){this.addEventListener("keydown",t=>{const e=t.target instanceof Element?t.target.closest("ful-badge"):null;e?this.#is(t,e):"ArrowLeft"===t.code&&t.target===this.#De&&0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#rs().at(-1)?.focus()})}#Ye(){this.#De.addEventListener("change",t=>{t.stopPropagation()}),this.#De.addEventListener("focus",()=>{this.#We||this.#De.select()}),this.#De.addEventListener("blur",t=>{t.stopPropagation(),t.relatedTarget&&this.contains(t.relatedTarget)||(this.#Ge(),this.#ts(!0))}),this.#De.addEventListener("keydown",t=>{this._interactive()&&this.#ns(t)}),this.#De.addEventListener("input",t=>{t.stopPropagation(),this._interactive()&&(this.#We=!0,this.#Ue())})}#Ze(){this.#ze.addEventListener("change",t=>{t.stopPropagation(),this.#Ge(),this._interactive()?(this.#Be||this.#He.clear(),this.#We=!1,this.#He.set(this.#as(t.detail.entry.key),t.detail.entry),this.#os(),this.#De.focus(),this.#ze.hide(),this.#Be||this.#De.select()):this.#ts()})}async withLoader(t){return await t(this.#Me)}async reload(){await(this.#Me.invalidate?.()),await(this.#Me.prefetch?.());const t=[...this.#He.keys()];0!==t.length&&await this.#n(t,this.#Ve.take()),this.#ze.shown&&await this.#Ke()}get src(){return this.getAttribute("src")}set src(t){this.reflectTo("src",t??null),this.#ls()&&this.reload()}get method(){return this.getAttribute("method")}set method(t){this.reflectTo("method",t??null),this.#ls()&&this.reload()}async reconfigure(t,{notify:e=!1}={}){for(const e of["src","method"])e in t&&this.reflectTo(e,t[e]??null);this.#ls();const s=[...this.#He.keys()];await this.reload();const i=[...this.#He.keys()];e&&i.length!==s.length&&this._notifyChange({entry:this.entry})}#Qe(){this.#Ie={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Me=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#Y})}#ls(){return(this.getAttribute("src")!==this.#Ie.src||this.getAttribute("method")!==this.#Ie.method)&&(this.#Ge(),this.#ts(),this.#Qe(),!0)}#rs(){return Array.from(this.#rt.querySelectorAll(":scope > ful-badge"))}#ss(t){this._interactive()&&this.#es(this.#rs().indexOf(t))}#es(t){const e=Array.from(this.#He.keys())[t];void 0!==e&&(this.#He.delete(e),this.#os())}#is(t,e){switch(t.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":t.preventDefault(),this.#ss(e),this.#De.focus();break;case"ArrowLeft":t.preventDefault(),(this.#rs()[this.#rs().indexOf(e)-1]??this.#De).focus();break;case"ArrowRight":t.preventDefault(),(this.#rs()[this.#rs().indexOf(e)+1]??this.#De).focus();break;case"Escape":this.#De.focus()}}#ns(t){switch(t.code){case"ArrowUp":case"ArrowDown":t.preventDefault(),this.#us(t);break;case"Home":this.#ze.shown&&(t.preventDefault(),this.#ze.jump(!0));break;case"End":this.#ze.shown&&(t.preventDefault(),this.#ze.jump(!1));break;case"PageDown":case"PageUp":this.#ze.shown&&(t.preventDefault(),this.#ze.page("PageDown"===t.code));break;case"Escape":this.#Ge(),this.#ts();break;case"NumpadEnter":case"Enter":if(!this.#ze.shown)return;t.preventDefault(),this.#Ge(),this.#We=!1,this.#cs(),this.#ze.acceptSelection();break;case"Backspace":0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#es(this.#He.size-1);break;case"Tab":this.#Ge(),this.#ts(!0)}}#us(t){const e="ArrowDown"===t.code;t.altKey?e&&!this.#ze.shown?this.#Ke():!e&&this.#ze.shown&&(this.#Ge(),this.#ts()):this.#ze.moveOrShow(e,()=>this.#Me.load(this.#ds()),[...this.#He.keys()])}#ts(t=!1){this.#ze.hide();const e=t&&this.#We&&!this.#Be&&""===this.#De.value&&0!==this.#He.size;this.#We=!1,e&&(this.#He.clear(),this.#os()),this.#cs()}#Ke(){return this.#ze.show(()=>this.#Me.load(this.#ds()),[...this.#He.keys()])}#ds(){return this.#We?this.#De.value:""}get query(){return this.#ds()}#cs(){const t=this.#He.values().next().value;this.#De.value=this.#Be?"":t?.label??""}#hs(){return[...this.#He.values()]}#os(){this.#ps(),this._notifyChange({entry:this.entry})}#ps(){const t=this.#Be?Array.from(this.#He.entries()).map(([t,e],s)=>{const i=document.createElement("ful-badge");return i.setAttribute("role","button"),i.setAttribute("tabindex",0===s?"0":"-1"),i.setAttribute("value",t),i.innerText=e.label,i}):[];for(const t of this.#rt.querySelectorAll(":scope > ful-badge"))t.remove();this.#De.before(...t),this.#We||this.#cs(),this.#te.replaceChildren(),(this.#re??this.template("items")).withOverlay({entries:this.#hs()}).renderTo(this.#te)}#as(t){switch(this.declared("k-type")){case"number":{const e=""===t?Number.NaN:Number(t);return Number.isNaN(e)?t:e}case"boolean":return!0===t||"true"===t||!1!==t&&"false"!==t&&t;default:return String(t)}}set value(t){if(!this.#rt)return void this._holdValue(t);const e=(null==t?[]:Array.isArray(t)?t:[t]).map(t=>this.#as(t)),s=this.#Be?e:e.slice(0,1);!this.#je&&s.some(t=>"string"==typeof t&&t.includes(","))&&(this.#je=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#He=new Map(s.map(t=>[t,{key:t,label:t,metadata:void 0}]));const i=this.#Ve.take();this.#ps(),0!==s.length&&this.#n(s,i)}async#n(t,e){const s=await this.#Me.exact(...t);if(e.stale)return;const i=new Map(s.map(t=>[this.#as(t.key),t]));for(const e of t)this.#He.has(e)&&(i.has(e)?this.#He.set(e,i.get(e)):this.#He.delete(e));this.#ps()}get value(){if(!this.#rt){const t=[this._heldValue()??[]].flat().map(t=>this.#as(t));return this.multiple?t:t[0]??null}return this.#Be?[...this.#He.keys()]:[...this.#He.keys()][0]??null}get entry(){const t=this.#hs();return this.#Be?t:t[0]??null}get disabled(){return super.disabled}set disabled(t){super.disabled=t,t&&this.#ze?.shown&&(this.#Ge(),this.#ts())}get readonly(){return super.readonly}set readonly(t){super.readonly=t,t&&this.#ze?.shown&&(this.#Ge(),this.#ts())}#fe;get multiple(){return this.#Be??this.declared("multiple")}set multiple(t){this.#Be=t,this.reflectTo("multiple",t),t||(this.#He=new Map([...this.#He].slice(0,1))),this.#rt&&this.#ps()}get itemList(){return this.#fe}set itemList(t){this.#fe=t,this.reflectTo("item-list",t)}}class Gt extends dt{static attributes=["name","type"];static slots=!0;static ROLE="radiogroup";static template='\n <fieldset>\n <legend>{{{{ slots.default }}}}</legend>\n <header data-tpl-if="slots.header">\n {{{{ slots.header }}}}\n </header>\n <ful-radio-list>\n <div class="label-wrapper" data-tpl-each="inputsAndLabels" data-tpl-var="ial">\n <label>\n {{{{ ial[0] }}}}\n <div>{{{{ ial[1] }}}}</div>\n </label>\n </div>\n </ful-radio-list>\n <ful-field-error></ful-field-error>\n <footer data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </footer>\n </fieldset>\n ';#fs;#ms;#gs;_build({slots:t}){const e=d.uid(this.declared("name")??"ful-radiogroup"),s=Array.from(t.default.querySelectorAll("ful-radio")),i=s.map(t=>{const s=document.createElement("input");return s.setAttribute("type","radio"),d.forward("input-",this,s),d.forward("",t,s),s.setAttribute("name",`${e}-ignore`),s.setAttribute("form",""),s.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()}),[s,c.fromChildNodes(t)]});s.forEach(t=>{t.remove()}),c.isBlank(t.default)&&t.default.replaceChildren();const r=this.template().withOverlay({name:e,slots:t,inputsAndLabels:i}).render();return this.#fs=r.firstElementChild,this.#ms=r.querySelector("input[type=radio]"),this.#gs="boolean"===this.declared("type"),{fragment:r,control:this.#ms,error:r.querySelector("ful-field-error"),described:this,claims:this.#fs,announces:this,freeze:this.#fs}}get value(){if(!this.#fs){const t=this._heldValue(),e=null===t?null:this.querySelector(`ful-radio[value="${CSS.escape(String(t))}"]`),s=e?.getAttribute("value")??null;return null===s||"boolean"!==this.declared("type")?s:"true"===s}const t=this.querySelector("input[type=radio]:checked");return t?this.#gs?"true"===t.value:t.value:null}set value(t){if(!this.#fs)return void this._holdValue(t);const e=this.querySelectorAll("input[type=radio]"),s=()=>{e.forEach(t=>{t.checked=!1})};if(null===t)return void s();const i=this.querySelector(`input[type=radio][value="${CSS.escape(String(t))}"]`);null!==i?i.checked=!0:s()}}class Qt extends dt{static attributes=["type"];static observed=["value:bool"];static slots=!0;static template='\n <ful-choice data-tpl-switch="isSwitch">\n <input type="checkbox" data-tpl-role="isSwitch ? \'switch\' : false" form="">\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n </ful-choice>\n <ful-field-error></ful-field-error>\n ';#bs;#De;_build({slots:t}){const e="switch"===this.declared("type"),s=this.template().withOverlay({slots:t,isSwitch:e}).render();this.#bs=s.firstElementChild,this.#De=s.querySelector("input"),d.forward("input-",this,this.#De),this.#De.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()});const i=s.querySelector("label");return{fragment:s,control:this.#De,error:s.querySelector("ful-field-error"),label:i,freeze:this.#bs}}get value(){return this.#De?this.#De.checked:Boolean(this._heldValue())}set value(t){this.#De?this.#De.checked=t:this._holdValue(t)}}class Kt extends C{static attributes=["sorter"];static observed=["order"];#vs;render(){const t=this.declared("sorter"),e=["asc","desc",null];this.setAttribute("role","button"),this.setAttribute("tabindex","0"),this.addEventListener("click",()=>{const s=e[(e.indexOf(this.order)+1)%3];this.dispatchEvent(new CustomEvent("sort:requested",{bubbles:!0,cancelable:!1,detail:{value:{sorter:t,order:s}}}))}),this.addEventListener("keydown",t=>{["Enter","NumpadEnter","Space"].includes(t.code)&&(t.preventDefault(),this.click())})}get order(){return this.#vs||null}set order(t){this.#vs=t||null,this.reflectTo("order",this.#vs);const e=this.closest("th");e&&d.set(e,"aria-sort",this.#vs?"asc"===this.#vs?"ascending":"descending":null)}}class Jt extends C{static observed=["total:number","current:number"];static attributes=["pages:number"];static config={prevIcon:"chevron-left",nextIcon:"chevron-right",reloadIcon:"arrow-clockwise"};static template='\n <ful-pagination-bar role="navigation" data-tpl-aria-label="#l10n:t(\'pagination.navigation\')">\n <ul>\n <li data-ref="index"> {{ #l10n:t(\'pagination.showing\', { \'current\': curr.label, \'total\': total }) }}</li>\n <li data-ref="reload"><button type="button" data-tpl-aria-label="#l10n:t(\'pagination.reload\')"><ful-icon data-tpl-name="config.reloadIcon" aria-hidden="true"></ful-icon></button></li>\n <li data-ref="prev">\n <button type="button" data-tpl-disabled="prev.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.previous\')" data-tpl-data-page="prev.index">\n <ful-icon data-tpl-name="config.prevIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n <li data-ref="page" data-tpl-each="pages" data-tpl-var="page">\n <button type="button" data-tpl-aria-current="curr.index == page.index ? \'page\' : false" data-tpl-data-page="page.index" >\n {{ page.label }}\n </button>\n </li>\n <li data-ref="next">\n <button type="button" data-tpl-disabled="next.enabled ? false : true" data-tpl-aria-label="#l10n:t(\'pagination.next\')" data-tpl-data-page="next.index">\n <ful-icon data-tpl-name="config.nextIcon" aria-hidden="true"></ful-icon>\n </button>\n </li>\n </ul>\n </ful-pagination-bar>\n ';#ys=0;#W=0;render(){this.addEventListener("click",t=>{const e=t.target.closest("button");e&&!e.hasAttribute("disabled")&&"page"!==e.getAttribute("aria-current")&&this.dispatchEvent(new CustomEvent("page:requested",{bubbles:!0,cancelable:!1,detail:{value:Number(e.dataset.page??this.#W)}}))})}update({current:t,total:e}={}){void 0!==t&&(this.#W=t??0),void 0!==e&&(this.#ys=e??0),this.reflectTo("current",this.#W),this.reflectTo("total",this.#ys);const s=this.#W,i=this.#ys,r=this.declared("pages")??5,n=Math.max(i,1),a=s>0,o=s+1<n,l={index:a?s-1:null,enabled:a},u={index:s,label:s+1},c={index:o?s+1:null,enabled:o},d=Math.max(1,Math.min(r,n)),h=Math.max(0,Math.min(s-Math.floor((d-1)/2),n-d)),p=Array.from({length:d},(t,e)=>({index:h+e,label:h+e+1})),f=this.contains(document.activeElement)?document.activeElement.closest("li")?.getAttribute("data-ref"):null,m="page"===f?document.activeElement.dataset.page:null;if(this.template().withOverlay({total:n,prev:l,curr:u,next:c,pages:p}).renderTo(this),!f)return;const g=(null===m?null:this.querySelector(`li[data-ref=page] button[data-page="${m}"]`))??this.querySelector(`li[data-ref=${f}] button:not(:disabled)`)??this.querySelector("li[data-ref=page] button[aria-current=page]");g?.focus()}get total(){return this.#ys}set total(t){this.update({total:t})}get current(){return this.#W}set current(t){this.update({current:t})}}class Xt{static parse(t,e){const s=t?p.queryChildren(t,"schema"):null;if(!s)throw new Error('missing expected <schema>: ful-table needs a <template slot="schema"> holding one');const i=document.createElement("tr"),r=document.createElement("tr");r.setAttribute("data-tpl-each","rows");for(const t of s.getAttributeNames()){const e=s.getAttribute(t);i.setAttribute(t,e??""),r.setAttribute(t,e??"")}const n=p.queryChildrenAll(s,"column"),a=n.filter(t=>t.hasAttribute("order")&&t.hasAttribute("sorter")).map(t=>({sorter:t.getAttribute("sorter"),order:t.getAttribute("order")}))[0]??null;for(const t of n){const e=p.queryChildren(t,"title"),s=t.getAttribute("sorter"),n=t.getAttribute("order"),a=e??document.createTextNode(t.getAttribute("title")??"");e?.remove(),t.removeAttribute("sorter"),t.removeAttribute("order"),t.removeAttribute("title");const o=s||n?(()=>{const t=document.createElement("ful-sorter");return s&&t.setAttribute("sorter",s),n&&t.setAttribute("order",n),t.append(a),t})():a,l=document.createElement("th"),u=document.createElement("td");for(const e of t.getAttributeNames()){const s=t.getAttribute(e);l.setAttribute(e,s??""),u.setAttribute(e,s??"")}l.append(o),u.append(...t.childNodes),i.append(l),r.append(u)}return{headersTemplate:e.withOverlay({inHeaders:!0,inRows:!1}).withFragment(c.from(i)),rowsTemplate:e.withOverlay({inHeaders:!1,inRows:!0}).withFragment(c.from(r)),sort:a,length:n.length}}}class Yt{#_;constructor(t){this.#_=t}async load(t,e,s){const i=this.#ws(e),r=Number(t.size),n=t.page*r,a=n+r;return{data:i.slice(n,a),size:i.length}}#ws(t){if(!t?.sorter)return this.#_;const{sorter:e,order:s}=t,i="desc"===s?-1:1;return[...this.#_].sort((t,s)=>{const r=t?.[e],n=s?.[e];return r===n?0:null==r?1:null==n?-1:(r<n?-1:1)*i})}update(t){this.#_=t}}class Zt{#Et;#xt;#G;#St;constructor(t,e,s,i=t=>t){this.#Et=t,this.#xt=e,this.#G=s,this.#St=i}async load(t,e,s){const i=Object.entries(s).filter(([t,e])=>e);return await this.#Et.request(this.#G,this.#xt).param("page",t.page).param("size",t.size).param("sort",e?`${e.sorter},${e.order}`:null).param("filters",i.length>0?JSON.stringify(Object.fromEntries(i)):null).fetchJson().then(t=>this.#St(t))}}class te{static create(t,e){const s=t.getAttribute("src");if(s){const e=t.component("http-client"),i=t.getAttribute("method")??"GET",r=t.hasAttribute("response-mapper")?t.component(t.getAttribute("response-mapper")):t=>t;return new Zt(e,s,i,r)}return new Yt([])}}class ee extends C{static attributes=["loader","autoload:presence"];static observed=["page-size:number","src","method"];static slots=!0;static config={searchIcon:"search",emptyIcon:"inbox"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <ful-table-wrapper>\n <table>\n <caption data-tpl-if="slots.caption">{{{{ slots.caption }}}}</caption>\n <thead></thead>\n <tbody></tbody>\n <tbody data-ref="initial">\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty>\n <ful-icon data-tpl-if="config.searchIcon" data-tpl-name="config.searchIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.initial\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="empty" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty data-tpl-if="slots.empty" data-ref="empty-authors"></ful-empty>\n <ful-empty data-tpl-if="!slots.empty">\n <ful-icon data-tpl-if="config.emptyIcon" data-tpl-name="config.emptyIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.no-data\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="loading" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-spinner class="big" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="feedback" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <div role="alert">\n <p>{{ #l10n:t(\'table.error\') }}</p>\n <div data-ref="feedback-error"></div>\n </div>\n </td>\n </tr>\n </tbody>\n <tfoot data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </tfoot>\n </table>\n </ful-table-wrapper>\n <ful-pagination current="0" total="1"></ful-pagination>\n ';static templates={row:"\n {{{{ schema.rowsTemplate.withOverlay({'rows': pageResponse.data}).render() }}}}\n "};#Me;#Es;#X;#xs;#As;#_e;#Ss;#Cs;#Ts;#_s;#ks;#Os={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#qs=!1;#Ls={};#Ns=null;#Ps=!1;#Rs=null;#Fs=new ot;#Ie={src:null,method:null};get pageSize(){return this.#Os.pageRequest.size}set pageSize(t){const e=Number(t??10);!Number.isFinite(e)||e<=0||e===this.#Os.pageRequest.size||(this.#Os={...this.#Os,pageRequest:{page:0,size:e}},this.#qs&&this.load(this.#Os.pageRequest,this.#Os.sortRequest,this.#Ls))}get src(){return this.getAttribute("src")}set src(t){this.reflectTo("src",t??null),this.#ls()&&this.#qs&&this.reload()}get method(){return this.getAttribute("method")}set method(t){this.reflectTo("method",t??null),this.#ls()&&this.#qs&&this.reload()}async reconfigure(t){for(const e of["src","method"])e in t&&this.reflectTo(e,t[e]??null);return this.#ls(),await this.reload()}#Qe(){this.#Ie={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Me=this.component(this.declared("loader")??"loaders:table").create(this)}#ls(){return(this.getAttribute("src")!==this.#Ie.src||this.getAttribute("method")!==this.#Ie.method)&&(this.#Qe(),this.#Os={...this.#Os,pageRequest:{...this.#Os.pageRequest,page:0}},!0)}async render({slots:t}){const e=this.template(),s=Xt.parse(t.schema,e),i=e.withOverlay({slots:t,schema:s}).render(),r=p.queryChildren(i,"ful-table-wrapper").querySelector("table");d.forward("table-",this,r),this.#Qe(),this.#Es=s,this.#X=r.querySelector(":scope > tbody"),this.#xs=r.querySelector(":scope > tbody[data-ref=loading]"),this.#As=r.querySelector(":scope > tbody[data-ref=initial]"),this.#_e=r.querySelector(":scope > tbody[data-ref=empty]"),this.#Ss=this.#_e.querySelector("ful-empty[data-ref=empty-authors]"),this.#Cs=t.empty&&!c.isBlank(t.empty)?A.fromFragment(t.empty):null,this.#Ts=r.querySelector(":scope > tbody[data-ref=feedback]"),this.#_s=p.queryChildren(i,"ful-pagination"),this.replaceChildren(i);const n=this.querySelector("thead");s.headersTemplate.renderTo(n),this.#ks=n.querySelectorAll("ful-sorter"),await S.waitForChildren(this);const a=p.queryChildren(this,"ful-form"),o=this.declared("page-size");this.#Os={pageRequest:{page:0,size:Number.isFinite(o)&&o>0?o:10},sortRequest:s.sort,filterRequest:a?.values??{}},this.#Ls=this.#Os.filterRequest,this.#Ns=a,a?.addEventListener("submit:success",async t=>{this.#Rs=this.#Ms(0,t.detail.request),await this.#Rs}),this.addEventListener("page:requested",async t=>{t.composedPath().find(t=>t instanceof ee)===this&&await this.#Ms(t.detail.value,this.#Ls)}),this.addEventListener("sort:requested",async t=>{if(t.composedPath().find(t=>t instanceof ee)!==this)return;const e=t.detail.value.order?t.detail.value:null;await this.load(this.#Os.pageRequest,e,this.#Ls),this.#Os.sortRequest===e&&(this.#ks.forEach(t=>{t.order=null}),t.target.order=t.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){if(!this.#Ns||this.#Ps)return await this.load(this.#Os.pageRequest,this.#Os.sortRequest,this.#Os.filterRequest);await this.#Ns.submit()&&await this.#Rs}async load(t,e,s){this.#qs=!0,this.#Ls=s;const i=this.#Fs.take();let r;this.#xs.toggleAttribute("hidden",this.#X.childElementCount>0),this.#Ts.setAttribute("hidden",""),this.#As.setAttribute("hidden",""),this.#_e.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const n=await this.#Me.load(t,e,s);if(i.stale)return;if(r=Math.max(0,Math.ceil(n.size/t.size)-1),!Number.isFinite(r))throw new Error(`ful-table cannot page the loader's answer: it needs { data, size }, size being the total number of rows, and got a size of ${n.size} for pages of ${t.size}. A response of another shape needs a response-mapper`);if(t.page<=r){if(this.#Os={pageRequest:t,sortRequest:e,filterRequest:s},this.#Ps=!0,this.#ne(t,e,s,n),await Promise.all([S.waitForChildren(this.#X),S.waitForChildren(this.#_e)]).catch(()=>{}),i.stale)return;return this.removeAttribute("aria-busy"),void this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:e,filterRequest:s,response:n}}))}}catch(r){if(i.stale)return;throw this.#xs.setAttribute("hidden",""),this.#X.replaceChildren(),this.#Ts.removeAttribute("hidden"),this.#Ts.querySelector("[data-ref=feedback-error]").textContent=R.of().failure(r),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:e,filterRequest:s,exception:r}})),r}return await this.load({page:r,size:t.size},e,s)}async withLoader(t){return await t(this.#Me)}async resetWithFilter(t){return await this.#Ms(0,t)}#Ms(t,e){return this.load({page:t,size:this.#Os.pageRequest.size},this.#Os.sortRequest,e)}#ne(t,e,s,i){const r=Math.ceil(i.size/t.size);this.#xs.setAttribute("hidden",""),this.#X.replaceChildren(this.template("row").withOverlay({schema:this.#Es,pageRequest:t,filterRequest:s,pageResponse:i}).render()),this.#_e.toggleAttribute("hidden",0!==i.data.length),this.#Cs&&0===i.data.length&&this.#Ss.replaceChildren(this.#Cs.withOverlay({schema:this.#Es,pageRequest:t,filterRequest:s,pageResponse:i}).render()),this.#_s.update({current:t.page,total:r})}}const se=(t,e,{items:s,current:i=()=>null})=>{let r="",n=0;e.addEventListener("beforetoggle",s=>{"closed"===s.newState&&e.contains(document.activeElement)&&t()?.focus()}),e.addEventListener("toggle",t=>{if("open"!==t.newState)return;const e=s();(i()??e[0])?.focus()}),e.addEventListener("keydown",e=>{const i=e.target,a=s(),o=a.find(t=>t===i||t.contains(i));if(!o)return;const l=a.indexOf(o);switch(e.code){case"ArrowDown":return e.preventDefault(),void a[(l+1)%a.length]?.focus();case"ArrowUp":return e.preventDefault(),void a[(l-1+a.length)%a.length]?.focus();case"Home":return e.preventDefault(),void a[0]?.focus();case"End":return e.preventDefault(),void a[a.length-1]?.focus();case"Enter":case"NumpadEnter":case"Space":return e.preventDefault(),o.click(),void t()?.focus();case"Escape":return void t()?.focus()}if(1!==e.key.length||e.ctrlKey||e.altKey||e.metaKey)return;const u=Date.now();r=u-n>500?e.key:r+e.key,n=u;const c=r.toLowerCase(),d=[...c].every(t=>t===c[0]),h=d?c[0]:c,p=d?l+1:l,f=[...a.slice(p),...a.slice(0,p)].find(t=>(t.textContent??"").trim().toLowerCase().startsWith(h));f&&(e.preventDefault(),f.focus())})};class ie{static narrow(t,e){const s=(t??[]).filter(t=>e.includes(t));return s.length>0?s:[...e]}#Is;#Te;#zs;#Ds;#$s;#cs;#Bs;#js;#Hs;#Vs=!1;#Ws=!1;constructor(t,{vocabulary:e,glyphs:s={},labelFor:i=t=>t,display:r=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#Is=t,this.#Te=t.nextElementSibling,this.#zs=e,this.#Ds=s,this.#$s=i,this.#cs=r??(t=>s[t]??t),this.#Bs=n,this.#js=a,this.#Hs=[...e],this.#Te.addEventListener("click",t=>{const e=t.target.closest("li > a");if(!e||!this.#Bs())return;const s=e.getAttribute("value"),i=this.value;this.value=s,this.#Te.hidePopover?.(),i!==s&&this.#js(s)})}get allowed(){return this.#Hs}set allowed(t){this.#Hs=ie.narrow(t,this.#zs),this.#Us(),!this.#Ws&&this.#Hs.length>1&&(this.#gt(),this.#Ws=!0),this.#Gs(),this.pinned&&(this.value=this.#Hs[0])}preferring(t){return null!==t&&this.#Hs.includes(t)?t:this.#Hs[0]}get pinned(){return this.#Hs.length<2}set fixed(t){this.#Is.toggleAttribute("hidden",!!t)}get value(){return this.#Is.getAttribute("value")}set value(t){this.#Is.setAttribute("value",t),this.#Is.textContent=this.#cs(t),d.set(this.#Is,"aria-label",this.#$s(t)),this.#Qs()}#Qs(){const t=this.value;for(const e of this.#te())e.setAttribute("aria-checked",String(e.getAttribute("value")===t))}set claimed(t){this.#Vs=t,this.#Gs()}#Us(){this.#Te.replaceChildren(...this.#Hs.map(t=>{const e=document.createElement("li");e.setAttribute("role","none");const s=document.createElement("a");s.setAttribute("role","menuitemradio"),s.setAttribute("tabindex","-1"),s.setAttribute("value",t);const i=this.#$s(t),r=this.#Ds[t]??t;if(i===t&&r===t)s.innerText=t;else{const t=document.createElement("span");t.innerText=r;const e=document.createElement("span");e.innerText=i,s.append(t,e)}return e.append(s),e})),this.#Qs()}#Gs(){const t=this.pinned;this.#Is.toggleAttribute("disabled",t||this.#Vs),d.set(this.#Is,"aria-haspopup",t?null:"true"),d.set(this.#Is,"aria-expanded",t?null:"false"),t?this.#Is.removeAttribute("popovertarget"):this.#Te.id&&this.#Is.setAttribute("popovertarget",this.#Te.id)}#te(){return Array.from(this.#Te.querySelectorAll("li > a"),t=>t)}#gt(){zt.wire(this.#Is,this.#Te,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),se(()=>this.#Is,this.#Te,{items:()=>this.#te(),current:()=>this.#te().find(t=>t.getAttribute("value")===this.value)})}}const re={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},ne=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],ae=[...ne,"CONTAINS","STARTS_WITH","ENDS_WITH"],oe=["IGNORE_CASE","CASE_SENSITIVE"],le={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:ue}=R.of(),ce=t=>ue(`filters.op.${t}`),de=t=>ue(`filters.sensitivity.${t}`),he=t=>ue(""===t?"filters.boolean.any":`filters.boolean.${t}`),pe=t=>t.querySelector(":scope > label")?.textContent.trim()||null,fe=(t,e,{singular:s,plural:i,vocabulary:r,fallback:n})=>{const a=t.declared(s);if(null===a)return;t.hasAttribute(i)&&console.warn(`${t.localName}: ${s} fixes what ${i} offers a menu for, the plural is ignored`,t);const o=r.includes(a);o||console.warn(`${t.localName}: '${a}' is not one of its ${i}, the default is pinned instead`,t),e.allowed=[o?a:n],e.fixed=!0},me=(t,e,s)=>{const i=s.filter(t=>null!=t&&""!=`${t}`);return 0===i.length?null:{label:t,operator:e,operands:i.map(t=>`${t}`)}};class ge extends xt{static observed=["value:json","operators:csv"];static attributes=["operator"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_container;_value1;_value2;_build(t){const e=super._build(t),s=e.fragment;return this._container=s.querySelector("ful-control-group"),this._value1=s.querySelector("[data-ref=value1]"),this._value2=s.querySelector("[data-ref=value2]"),this._operator=new ie(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:re,labelFor:ce,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),fe(this,this._operator,{singular:"operator",plural:"operators",vocabulary:this._vocabulary(),fallback:this._defaultOperator()}),{...e,freeze:this._container,also:[this._value2]}}_showDefaultOperator(){this._showOperator(this._operator.preferring(this._defaultOperator()))}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||this._showDefaultOperator()}_type(){return"text"}_serialize(t){return t}_deserialize(t){return t}_defaultOperator(){return"EQ"}_vocabulary(){return ne}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(t){null===this.declared("operator")&&(this._operator?(this._operator.allowed=t,null!==this._operator.value&&this._showOperator(this._operator.preferring(this._operator.value))):this._declaredOperators=ie.narrow(t,this._vocabulary()))}get value(){return this._operator?this._tuple():this._shownTuple(this._heldValue())}set value(t){this._operator?this._applyTuple(t):this._holdValue(t)}_shownTuple(t){if(null==t)return null;const[e,...s]=t,i=this.declared("operator"),r=this._vocabulary().includes(i),n=null===i?ie.narrow(this.declared("operators"),this._vocabulary()):[r?i:this._defaultOperator()],a=n.includes(e)?e:n[0],o=[s[0],s[1]].map(t=>`${t?this._deserialize(t):t??""}`),l="BETWEEN"===a?o:o.slice(0,1);return l.some(t=>""===t)?null:[a,...l.map(t=>this._serialize(t))]}_tuple(){const t=this._operator.value,e=this.#Ks();return e.some(t=>""===t)?null:[t,...e.map(t=>this._serialize(t))]}_applyTuple(t){if(null==t)return this._value1.value="",void(this._value2.value="");const[e,...s]=t;this._showOperator(this._operator.preferring(e)),this._value1.value=s[0]?this._deserialize(s[0]):s[0]??"",this._value2.value=s[1]?this._deserialize(s[1]):s[1]??""}_showOperator(t){this._operator.value=t,this._syncBetween()}_syncBetween(){this._value2.toggleAttribute("hidden","BETWEEN"!==this._operator.value)}get criterion(){return this._operator?me(pe(this),this._operator.value,this.#Ks()):null}#Ks(){return"BETWEEN"===this._operator.value?[this._value1.value,this._value2.value]:[this._value1.value]}get disabled(){return super.disabled}set disabled(t){super.disabled=t;for(const e of this._choices())e.claimed=t}_choices(){return[this._operator].filter(t=>t)}}class be extends ge{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(t){return Tt.localToIso(t)}_deserialize(t){return Tt.isoToLocal(t)}}class ve extends ge{_type(){return"date"}}class ye extends ge{_type(){return"number"}}class we extends ge{static observed=["sensitivities:csv"];static attributes=["sensitivity"];static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n <button data-ref="sensitivity" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <ful-control>\n <input data-ref="value1" data-tpl-type="type" form="">\n <input data-ref="value2" data-tpl-type="type" form="" hidden>\n </ful-control>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_defaultOperator(){return"CONTAINS"}_vocabulary(){return ae}_sensitivityButton;_build(t){const e=super._build(t);return this._sensitivityButton=new ie(e.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:oe,glyphs:le,labelFor:de,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=oe[0],fe(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:oe,fallback:"IGNORE_CASE"}),e}_choices(){return[...super._choices(),this._sensitivityButton].filter(t=>t)}get _sensitivity(){return this._sensitivityButton.value}_declaredSensitivities;get sensitivities(){return this._sensitivityButton?this._sensitivityButton.allowed:this._declaredSensitivities}set sensitivities(t){if(null!==this.declared("sensitivity"))return;if(!this._sensitivityButton)return void(this._declaredSensitivities=ie.narrow(t,oe));const e=this._sensitivityButton.value;this._sensitivityButton.allowed=t,this._sensitivityButton.value=this._sensitivityButton.preferring(e)}get value(){if(!this._sensitivityButton){const t=this._heldValue(),e=null==t?null:this._shownTuple([t[0],...t.slice(2)]);if(null===e)return null;const s=this.declared("sensitivity"),i=null===s?ie.narrow(this.declared("sensitivities"),oe):[oe.includes(s)?s:"IGNORE_CASE"],r=i.includes(t[1])?t[1]:"IGNORE_CASE";return[e[0],i.includes(r)?r:i[0],...e.slice(1)]}const t=this._tuple();return null==t?null:[t[0],this._sensitivity,...t.slice(1)]}set value(t){this._sensitivityButton?null!=t?(this._sensitivityButton.allowed.includes(t[1])&&(this._sensitivityButton.value=t[1]),this._applyTuple([t[0],...t.slice(2)])):this._applyTuple(t):this._holdValue(t)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const Ee=["","true","false"],xe={true:"✓",false:"✗"};class Ae extends dt{static observed=["value:json","operators:csv"];static slots=!0;static OPERATORS=["EQ","NEQ"];static DEFAULT_OPERATOR="EQ";static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <ful-affix>\n <button data-ref="operator" type="button" form="" aria-expanded="false" aria-haspopup="true"></button>\n <ul popover role="menu"></ul>\n </ful-affix>\n <button data-ref="value" type="button" form=""></button>\n <ul popover role="menu"></ul>\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <ful-field-error></ful-field-error>\n ';_operator;_value;_container;_build({slots:t}){const e=this.template().withOverlay({slots:t}).render();this._container=e.querySelector("ful-control-group");const s=e.querySelector("[data-ref=value]");return this._operator=new ie(e.querySelector("[data-ref=operator]"),{vocabulary:Ae.OPERATORS,glyphs:re,labelFor:ce,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new ie(s,{vocabulary:Ee,glyphs:xe,labelFor:he,display:he,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(Ae.DEFAULT_OPERATOR),this._value.allowed=null,this._value.value="",{fragment:e,control:s,error:e.querySelector("ful-field-error"),label:e.querySelector("label"),announces:null,freeze:this._container}}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(t){this._operator?(this._operator.allowed=t,null!==this._operator.value&&(this._operator.value=this._operator.preferring(this._operator.value))):this._declaredOperators=ie.narrow(t,this._vocabulary())}_vocabulary(){return Ae.OPERATORS}get value(){if(!this._value){const t=this._heldValue(),e=`${t?.[1]??""}`;if(""===e)return null;const s=ie.narrow(this.declared("operators"),this._vocabulary());return[s.includes(t[0])?t[0]:s[0],e]}return""===this._value.value?null:[this._operator.value,this._value.value]}set value(t){this._value?null!=t?(this._operator.value=this._operator.preferring(t[0]),this._value.value=t[1]??""):this._value.value="":this._holdValue(t)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(Ae.DEFAULT_OPERATOR))}get criterion(){if(!this._value)return null;const t=this._value.value;return me(pe(this),this._operator.value,[""===t?"":he(t)])}get disabled(){return super.disabled}set disabled(t){super.disabled=t;for(const e of[this._operator,this._value].filter(t=>t))e.claimed=t}}class Se extends Ut{static attributes=["operator"];#Js(){const t=super.value;return this.multiple?t:null==t?[]:[t]}get value(){const t=this.#Js();if(0===t.length)return null;const e=this.declared("operator");return e?[e,...t]:t}set value(t){const e=this.declared("operator");let s=null==t?[]:Array.isArray(t)?t:[t];e&&s[0]===e&&(s=s.slice(1)),super.value=this.multiple?s:s[0]??null}get criterion(){return me(pe(this),this.declared("operator"),[super.entry].flat().filter(t=>t).map(t=>t.label))}}class Ce extends C{static slots=!0;static attributes=["placement","icon","describes:presence"];static config={icon:"info-circle-fill"};static template='\n <span role="button" tabindex="0" class="ful-tip" data-ref="trigger" data-tpl-aria-label="#l10n:t(\'info.tooltip\')"><ful-icon data-tpl-name="icon ?? config.icon" aria-hidden="true"></ful-icon></span>\n <ful-note popover data-ref="content">{{{{ slots.default }}}}</ful-note>\n ';render({slots:t}){const e=this.template().withOverlay({slots:t,icon:this.declared("icon")}).render(),s=e.querySelector("[data-ref=trigger]"),i=e.querySelector("[data-ref=content]");zt.wire(s,i,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),i.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(e),this.declared("describes")&&Ce.#bt(this,s,i)}static#bt(t,e,s){lt(t)?.describedBy(s)?e.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",t)}}class Te{#Xs=new WeakSet;#Ys=new WeakSet;#ct=new WeakMap;async request(t,e,s,i){const r=!this.#Xs.has(e)&&!this.#Ys.has(e),n={name:s,section:e,index:i,first:r},a=["section:requested",...null!=i?[`section:requested:#${i}`]:[],...s?[`section:requested:${s}`]:[]],o=[];for(const e of a){const s=new CustomEvent(e,{bubbles:!0,detail:n});t.dispatchEvent(s),o.push(...s.async?.promises??[])}if(0===o.length)return;r&&this.#Ys.add(e);let l=this.#ct.get(e);l||(l=new ot,this.#ct.set(e,l));const u=l.take(),c=()=>!u.stale;e.querySelector(":scope > .ful-section-error")?.remove();const d=requestAnimationFrame(()=>{c()&&(e.toggleAttribute("loading",!0),e.setAttribute("aria-busy","true"))});try{const t=await Promise.all(o);return r&&this.#Xs.add(e),t}catch(t){throw c()&&this.#Zs(e,t),t}finally{r&&this.#Ys.delete(e),cancelAnimationFrame(d),c()&&(e.toggleAttribute("loading",!1),e.removeAttribute("aria-busy"))}}#Zs(t,e){t.querySelector(":scope > .ful-section-error")?.remove();const s=document.createElement("div");s.className="ful-section-error",s.setAttribute("role","alert"),s.textContent=R.of().failure(e),t.prepend(s)}}class _e{#ti;#ei;#si;#xs;#ii;#ri=new Te;#ni=new ot;#ai=null;constructor(t,e,s){this.#ti=t,this.#ei=e.querySelector("[data-ref=dialog]"),this.#si=e.querySelector(`[data-ref=${s}]`),this.#xs=e.querySelector("[data-ref=loading]"),this.#ii=e.querySelector("[data-ref=error]")}get dialog(){return this.#ei}get section(){return this.#si}get dirty(){return Array.from(this.#ei.querySelectorAll("ful-form")).some(t=>t.closest("dialog")===this.#ei&&t.dirty)}dismiss(t,e,s){return this.#ai?this.#ai:this.#ti.dispatchEvent(t)?t.cancelable?s&&this.dirty?(this.#ai=s().then(t=>(t&&this.#ei.open&&e(),t)).finally(()=>{this.#ai=null}),this.#ai):(e(),Promise.resolve(!0)):Promise.resolve(!0):Promise.resolve(!1)}onBackdrop(t){const e=t=>{if(t.target!==this.#ei)return!1;const e=this.#ei.getBoundingClientRect();return t.clientX<e.left||t.clientX>e.right||t.clientY<e.top||t.clientY>e.bottom};let s=!1;this.#ei.addEventListener("mousedown",t=>{s=e(t)}),this.#ei.addEventListener("click",i=>{s&&e(i)&&t()})}onSubmitted(t){this.#si.addEventListener("submit:success",e=>{"ful-form"===e.target.localName&&e.target.parentElement===this.#si&&t(e.detail.response)})}restChrome(){this.#ii?.replaceChildren(),this.#ii?.setAttribute("hidden",""),this.#xs?.setAttribute("hidden",""),this.#si?.removeAttribute("hidden")}request(){return this.#ri.request(this.#ti,this.#si,null,null).catch(()=>{})}async update(t,e){const s=this.#ni.take();this.#si.replaceChildren(),this.restChrome(),this.#xs?.removeAttribute("hidden"),this.#si.setAttribute("hidden",""),e();try{const e=await t();return s.stale?null:(this.#si.replaceChildren(e),this.#xs?.setAttribute("hidden",""),this.#si.removeAttribute("hidden"),this.#si)}catch(t){throw s.stale||(this.#ii?.removeAttribute("hidden"),this.#ii&&(this.#ii.textContent=R.of().failure(t)),this.#xs?.setAttribute("hidden",""),this.#si.setAttribute("hidden","")),t}}}let ke=!1;const Oe=()=>{ke||(ke=!0,document.addEventListener("click",t=>{const e=t.target.closest?.("[dialog-target]");e&&document.getElementById(e.getAttribute("dialog-target"))?.open?.()}))};class qe extends C{static attributes=["header","requires-answer:presence","close-on-submit:presence","guard-dismiss:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-dialog">\n <header data-tpl-if="header || slots.header || !requiresAnswer" class="ful-dialog-header">\n {{{{ slots.header }}}}\n <h2 data-tpl-if="header">{{ header }}</h2>\n <button data-tpl-if="!requiresAnswer" type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'dialog.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <div data-ref="body" class="ful-dialog-body">{{{{ slots.default }}}}</div>\n <footer class="ful-dialog-footer"><button type="button" data-ref="acknowledge" data-result="acknowledged" data-tpl-if="!slots.buttons && !closeOnSubmit" data-tpl-aria-label="#l10n:t(\'dialog.acknowledge\')">{{ #l10n:t(\'dialog.acknowledge\') }}</button>{{{{ slots.buttons }}}}</footer>\n </dialog>\n ';#ei;#oi;#li=[];#ui=null;render({slots:t}){const e=this.declared("requires-answer"),s=this.declared("close-on-submit"),i=this.template().withOverlay({slots:t,header:this.declared("header")??"",requiresAnswer:e,closeOnSubmit:s}).render();this.#oi=new _e(this,i,"body"),this.#ei=this.#oi.dialog;const r=i.querySelector("h2");r&&(r.id||=d.uid("ful-dialog-title"),this.#ei.setAttribute("aria-labelledby",r.id)),this.#ei.addEventListener("close",()=>{const t=this.#ci();this.dispatchEvent(new CustomEvent("close",{detail:t})),this.#di(t)}),this.#ei.addEventListener("click",t=>{const e=t.target.closest("button[data-result]");e&&e.closest("dialog")===this.#ei&&this.#ei.close(e.dataset.result)}),e||this.#oi.onBackdrop(()=>this.dismiss("backdrop")),i.querySelector("[data-ref=close]")?.addEventListener("click",()=>this.dismiss("button")),s&&this.#oi.onSubmitted(t=>{this.#ui={dismissed:!1,result:null,response:t},this.#ei.close("submitted")}),this.#ei.addEventListener("cancel",t=>{if(!t.cancelable)return this.#ei.returnValue="",void this.#hi("escape",!1);t.preventDefault(),e||this.dismiss("escape")}),this.replaceChildren(i),Oe()}#ci(){if(this.#ui)return this.#ui;const t=this.#ei?.returnValue??"";return""===t?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:t,response:null}}#di(t){const e=this.#li;this.#li=[];for(const s of e)s(t)}disconnectedCallback(){this.#di(this.#ci())}open(){return this.ask()}ask(){return this.#pi()&&(this.#oi.restChrome(),this.#oi.request()),new Promise(t=>{this.#li.push(t)})}async update(t){return await this.#oi.update(t,()=>this.#pi())}refresh(){return this.#oi.request()}dismiss(t){return this.#ei.open?this.#hi(t,!0):Promise.resolve(!0)}#hi(t,e){return this.#oi.dismiss(new CustomEvent("dialog:dismiss",{cancelable:e,detail:{reason:t}}),()=>this.#ei.close(""),this.declared("guard-dismiss")?Le:null)}close(t){this.#ei.close(t??"")}#pi(){return this.#ei.open&&!this.#ei.matches(":modal")&&this.#ei.removeAttribute("open"),!this.#ei.open&&(this.#ei.returnValue="",this.#ui=null,this.#ei.showModal(),!0)}static async ask(t,e,s=[],{className:i}={}){const r=document.createElement("ful-dialog");if(r.setAttribute("header",t),i&&(r.className=i),"string"==typeof e?r.textContent=e:e&&r.append(e),s.length>0){const t=document.createElement("template");t.setAttribute("slot","buttons");for(const e of s){if(e instanceof Node){t.content.append(e);continue}const[s,i,r]=e,n=document.createElement("button");n.type="button",n.dataset.result=s,r&&(n.className=r),n.textContent=i,t.content.append(n)}r.append(t)}document.body.append(r);try{return await S.waitFor(r),await r.ask()}finally{r.remove()}}static async confirm(t,e,s={},i={}){const r=await qe.ask(t,e,[["cancel",s.cancel??R.of().t("dialog.cancel")],["confirm",s.confirm??R.of().t("dialog.confirm"),"ful-button"]],i);return!r.dismissed&&"confirm"===r.result}}const Le=()=>{const t=R.of();return qe.confirm(t.t("dialog.discard.header"),t.t("dialog.discard.body"),{confirm:t.t("dialog.discard.confirm"),cancel:t.t("dialog.discard.cancel")})};class Ne extends C{static attributes=["header","placement","close-on-submit:presence","guard-dismiss:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-drawer">\n <header>\n {{{{ slots.header }}}}\n <h2 data-ref="title">{{ title }}</h2>\n <button type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'drawer.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <section data-ref="content">{{{{ slots.default }}}}</section>\n </dialog>\n ';#ei;#fi;#oi;#ui=null;#li=[];#mi=!1;#gi=new ot;render({slots:t}){const e=this.template().withOverlay({slots:t,title:this.declared("header")??""}).render();this.#oi=new _e(this,e,"content"),this.#ei=this.#oi.dialog,this.#fi=e.querySelector("[data-ref=title]"),this.#fi.id||=d.uid("ful-drawer-title"),this.#ei.setAttribute("aria-labelledby",this.#fi.id);const s=this.declared("placement");s&&this.#ei.setAttribute("placement",s),e.querySelector("[data-ref=close]").addEventListener("click",()=>this.dismiss("button")),this.#oi.onBackdrop(()=>this.dismiss("backdrop")),this.#ei.addEventListener("cancel",t=>{if(!t.cancelable)return this.#bi(),void this.#hi("escape",!1);t.preventDefault(),this.dismiss("escape")}),this.#ei.addEventListener("click",t=>{const e=t.target.closest("button[data-result]");e&&e.closest("dialog")===this.#ei&&this.close(e.dataset.result)}),this.#ei.addEventListener("close",()=>{const t=this.#ci();this.dispatchEvent(new CustomEvent("close",{detail:t})),this.#di(t)}),this.declared("close-on-submit")&&this.#oi.onSubmitted(t=>{this.#ui={dismissed:!1,result:null,response:t},this.close()}),this.replaceChildren(e),Oe()}get header(){return this.#fi.textContent}set header(t){this.#fi.textContent=t??""}async update(t,e){return this.header=t,await this.#oi.update(e,()=>this.#pi())}refresh(){return this.#oi.request()}#ci(){return this.#ui??{dismissed:!0,result:null,response:null}}#di(t){const e=this.#li;this.#li=[];for(const s of e)s(t)}disconnectedCallback(){this.#di(this.#ci())}open(){return this.ask()}ask(){return this.#pi()&&(this.#oi.restChrome(),this.#oi.request()),new Promise(t=>{this.#li.push(t)})}dismiss(t){return this.#mi||!this.#ei.open?Promise.resolve(!0):this.#hi(t,!0)}#hi(t,e){return this.#oi.dismiss(new CustomEvent("drawer:dismiss",{cancelable:e,detail:{reason:t}}),()=>this.close(),this.declared("guard-dismiss")?Le:null)}close(t){if(this.#mi||!this.#ei.open)return;if(t&&(this.#ui={dismissed:!1,result:t,response:null}),matchMedia("(prefers-reduced-motion: reduce)").matches)return void this.#ei.close();this.#ei.setAttribute("closing","");const e=this.#ei.getAnimations();if(0===e.length)return void this.#vi();this.#mi=!0;const s=this.#gi.take();Promise.allSettled(e.map(t=>t.finished)).then(()=>{s.stale||this.#vi()})}#vi(){this.#bi(),this.#ei.close()}#bi(){this.#mi=!1,this.#gi.invalidate(),this.#ei.removeAttribute("closing")}#pi(){return this.#mi&&(this.#ui=null),this.#bi(),this.#ei.open&&!this.#ei.matches(":modal")&&this.#ei.removeAttribute("open"),!this.#ei.open&&(this.#ui=null,this.#ei.showModal(),!0)}}class Pe extends C{static attributes=["for"];#yi=null;#wi=null;#Ei=t=>{const e=t.target;this.#wi=this.matches(":popover-open")&&this.#yi?.contains(e)?this.#yi:null};connectedCallback(){super.connectedCallback(),this.rendered&&!this.declared("for")&&document.addEventListener("pointerdown",this.#Ei,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this.#Ei,!0)}render(){const t=this.declared("for"),e=t?document.getElementById(t):null;if(t&&!e)throw new Error(`ful-menu names no invoker: for="${t}" must name an element already in the page when the menu upgrades`);this.setAttribute("role","menu"),this.hasAttribute("popover")||this.setAttribute("popover",""),e?(this.#yi=e,e.setAttribute("aria-haspopup","menu"),zt.wire(e,this,{prefix:"ful-menu",invoke:!0,expanded:!0})):this.#xi(),se(()=>this.#yi,this,{items:()=>this.items}),this.#Qs(),this.addEventListener("click",t=>{const e=t.target;this.items.some(t=>t===e||t.contains(e))&&this.hidePopover()})}showFor(t){if(this.declared("for"))throw new Error("ful-menu: showFor serves a menu without for; a menu with for is opened by its invoker");const e=this.#wi;if(this.#wi=null,e===t)return;this.#yi&&this.#yi!==t&&this.#yi.setAttribute("aria-expanded","false"),this.#yi=t,t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded","true"),this.style.margin="";const s=Number.parseFloat(getComputedStyle(this).marginBlockStart)||0,i=this.matches(":popover-open");zt.show(this,t,{flip:!0,gap:s}),i&&this.items[0]?.focus()}get items(){return this.#Qs().filter(t=>!t.hasAttribute("disabled")&&!t.hasAttribute("hidden"))}#xi(){document.addEventListener("pointerdown",this.#Ei,!0),this.addEventListener("toggle",t=>{"closed"===t.newState&&this.#yi?.setAttribute("aria-expanded","false")})}#Qs(){const t=[...this.querySelectorAll(":scope > button, :scope > a[href]")];for(const e of t)e.hasAttribute("role")||e.setAttribute("role","menuitem"),e.tabIndex=-1;return t}}const Re=["info","success","warning","error"],Fe=new Set;let Me=!1;class Ie extends C{static attributes=["timeout:number"];#Ai;connectedCallback(){super.connectedCallback(),this.rendered&&Fe.add(this)}disconnectedCallback(){Fe.delete(this)}render(){this.#Ai=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",R.of().t("toast.region")),this.setAttribute("popover","manual"),Me||(Me=!0,document.addEventListener("show-toast",t=>{if(t.detail)for(const e of Fe)e.show(t.detail.message,t.detail)})),Fe.add(this)}show(t,e={}){const s=Re.includes(e.severity)?e.severity:"info",i=document.createElement("ful-toast");i.classList.add(s),i.setAttribute("role","error"===s?"alert":"status");const r=document.createElement("div");r.textContent=R.of().failure(t);const n=document.createElement("button");n.type="button",n.setAttribute("aria-label",R.of().t("toast.dismiss"));const a=document.createElement("ful-icon");a.setAttribute("name","x-lg"),a.setAttribute("aria-hidden","true"),n.append(a),i.append(r);let o=e.timeout??this.#Ai,l=performance.now(),u=0;const c=()=>{clearTimeout(u),i.contains(document.activeElement)&&this.focus(),matchMedia("(prefers-reduced-motion: reduce)").matches?i.remove():(i.classList.add("ful-toast-out"),0===i.getAnimations().length&&i.remove())};if(e.action?.label){const t=document.createElement("button");t.type="button",t.className="ful-toast-action",t.textContent=String(e.action.label),t.addEventListener("click",()=>{e.action.onClick?.(),c()}),i.append(t)}i.append(n),i.addEventListener("animationend",()=>{i.classList.contains("ful-toast-out")&&i.remove()});let d=0;const h=()=>{0===d&&(clearTimeout(u),o=Math.max(0,o-(performance.now()-l))),++d},p=()=>{0!==d&&0===--d&&(l=performance.now(),u=setTimeout(c,o))};return i.addEventListener("mouseenter",h),i.addEventListener("mouseleave",p),i.addEventListener("focusin",h),i.addEventListener("focusout",p),n.addEventListener("click",c),this.append(i),this.#Si(),u=setTimeout(c,o),i}#Si(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class ze extends C{static slots=!0;static observed=["active:number"];static template='\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-start" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.previous\')"><ful-icon name="chevron-left" aria-hidden="true"></ful-icon></button>\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-end" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.next\')"><ful-icon name="chevron-right" aria-hidden="true"></ful-icon></button>\n {{{{ slots.default }}}}\n ';#Ci;#Ti;#_i;#ki=[];#Oi=[];#ri=new Te;#qi=0;render({slots:t}){const e=this.template().withOverlay({slots:t}).render();this.#Ci=e.querySelector("ful-tablist"),this.#Ti=e.querySelector('[data-ref="scroll-start"]'),this.#_i=e.querySelector('[data-ref="scroll-end"]');const s=[this.#Ci,this.#Ti,this.#_i],i=[...this.#Ci.children];this.#Oi=[...e.children].filter(t=>!s.includes(t)),i.length!==this.#Oi.length&&console.warn(`ful-tabs: ${i.length} tabs declared for ${this.#Oi.length} panels, the surplus is left alone`);const r=Math.min(i.length,this.#Oi.length);this.#ki=[];for(let t=0;t!==r;++t){const e=this.#Oi[t],s=document.createElement("button");s.type="button",s.role="tab",s.id=d.uid("ful-tab"),e.id||(e.id=d.uid("ful-tabpanel")),s.setAttribute("aria-controls",e.id),e.role="tabpanel",e.setAttribute("aria-labelledby",s.id),e.tabIndex=0,s.append(...i[t].childNodes),s.addEventListener("click",()=>{this.active=t}),i[t].replaceWith(s),this.#ki.push(s)}this.#Ci.addEventListener("keydown",t=>{const e=this.#qi;let s=null;"ArrowRight"===t.key?s=(e+1)%this.#ki.length:"ArrowLeft"===t.key?s=(e-1+this.#ki.length)%this.#ki.length:"Home"===t.key?s=0:"End"===t.key&&(s=this.#ki.length-1),null!==s&&s!==e&&(t.preventDefault(),this.active=s,this.#ki[s].focus())}),this.#Ti.addEventListener("click",()=>this.#Li(-1)),this.#_i.addEventListener("click",()=>this.#Li(1)),this.#Ci.addEventListener("scroll",()=>this.#Ni(),{passive:!0});let n=-1;const a=new ResizeObserver(()=>{this.#Ni(),this.#Ci.clientWidth!==n&&(n=this.#Ci.clientWidth,this.#Pi(this.#ki[this.#qi],"auto"))});a.observe(this.#Ci);for(const t of this.#ki)a.observe(t);this.replaceChildren(e)}#Ni(){const t=this.#Ci,e=t.scrollWidth-t.clientWidth,s=Math.abs(t.scrollLeft);this.#Ti.hidden=s<=1,this.#_i.hidden=s>=e-1,this.#Ti.style.blockSize=this.#_i.style.blockSize=`${t.clientHeight}px`}#Ri(){const t=this.#Ci.getBoundingClientRect(),e="rtl"===getComputedStyle(this.#Ci).direction,[s,i]=e?[this.#_i,this.#Ti]:[this.#Ti,this.#_i];return{left:t.left+s.offsetWidth,right:t.right-i.offsetWidth}}#Li(t){const{left:e,right:s}=this.#Ri(),i=t>0!=("rtl"===getComputedStyle(this.#Ci).direction)?t=>t.getBoundingClientRect().right>s+1:t=>t.getBoundingClientRect().left<e-1,r=t>0?this.#ki.find(i):this.#ki.findLast(i);this.#Pi(r,matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth")}#Pi(t,e){if(!t)return;const{left:s,right:i}=this.#Ri(),r=t.getBoundingClientRect();r.right>i?this.#Ci.scrollBy({left:Math.ceil(r.right-i),behavior:e}):r.left<s&&this.#Ci.scrollBy({left:Math.floor(r.left-s),behavior:e})}get active(){return this.#qi}refresh(t){const e=t instanceof Element?this.#Oi.indexOf(t):Number.isInteger(t)?t:NaN,s=this.#Oi[e];if(s)return this.#ri.request(this,s,null,e).catch(()=>{});console.warn(`ful-tabs: no panel answers to "${t}"`)}set active(t){const e=Math.min(Math.max(0,Number(t)||0),Math.max(0,this.#ki.length-1)),s=this.#qi;for(const[t,s]of this.#ki.entries())s.setAttribute("aria-selected",t===e?"true":"false"),s.tabIndex=t===e?0:-1,this.#Oi[t].hidden=t!==e;this.#qi=e,this.reflectTo("active",e),this.#Pi(this.#ki[e],"auto"),this.rendered&&e!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:e,previous:s}})),this.#Oi.length>0&&(e!==s||!this.rendered)&&this.#ri.request(this,this.#Oi[e],null,e).catch(()=>{})}}class De extends C{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#ie;#Fi=!1;render({slots:t}){const e=this.template().withOverlay({slots:t}).render();this.#ie=e.querySelector("ful-accordion-group"),this.replaceChildren(e)}get exclusive(){return this.#Fi}set exclusive(t){this.#Fi=!0===t,this.reflectTo("exclusive",this.#Fi);const e=this.#Fi?d.uid("ful-accordion"):null;for(const t of this.#ie.querySelectorAll(":scope > details"))null===e?t.removeAttribute("name"):t.setAttribute("name",e)}}class $e extends C{static slots=!0;static observed=["progress"];static template="\n <ful-steps><ol data-tpl-aria-label=\"#l10n:t('wizard.progress')\">{{{{ slots.steps }}}}</ol></ful-steps>\n {{{{ slots.default }}}}\n ";#Mi=[];#oi=[];#ri=new Te;#Ii=0;#zi;render({slots:t}){const e=this.template().withOverlay({slots:t}).render(),s=[...e.querySelector("ful-steps ol").children];this.#oi=[...e.children].filter(t=>"ful-steps"!==t.localName),s.length!==this.#oi.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#oi.length} sections, the surplus is left alone`);const i=Math.min(s.length,this.#oi.length);this.#Mi=[];for(let t=0;t!==i;++t){const e=document.createElement("li");e.append(...s[t].childNodes),s[t].replaceWith(e),this.#Mi.push(e),this.#oi[t].tabIndex=-1}if(this.replaceChildren(e),i>0){const t=this.#oi.findIndex(t=>"step"===t.getAttribute("aria-current"));this.#Di(-1===t?0:Math.min(t,i-1)),this.#$i(this.#Ii).catch(()=>{})}}get index(){return this.#Ii}get step(){return this.#oi[this.#Ii]?.getAttribute("data-step")??null}get progress(){return this.#zi}set progress(t){this.#zi=t,this.reflectTo("progress",t)}next(){return this.#Bi(this.#Ii+1)}prev(){return this.#Bi(this.#Ii-1)}move(t){const e=this.#oi.findIndex(e=>e.getAttribute("data-step")===t);if(!(-1===e||e>=this.#Mi.length))return this.#Bi(e);console.warn(`ful-wizard: no section paired with a step carries data-step="${t}"`)}refresh(t){const e=t instanceof Element?this.#oi.indexOf(t):this.#oi.findIndex(e=>e.getAttribute("data-step")===t);if(!(-1===e||e>=this.#Mi.length))return this.#$i(e).catch(()=>{});console.warn(`ful-wizard: no section answers to "${t}"`)}#$i(t){return this.#ri.request(this,this.#oi[t],this.#oi[t].getAttribute("data-step"),t)}#Bi(t){const e=Math.min(Math.max(0,t),Math.max(0,this.#Mi.length-1));if(e!==this.#Ii)return this.#Di(e),this.#oi[this.#Ii].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#Ii,step:this.step}})),this.#$i(e)}#Di(t){for(const[e,s]of this.#Mi.entries())e===t?(s.setAttribute("aria-current","step"),this.#oi[e].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#oi[e].removeAttribute("aria-current"));this.#Ii=t}}const Be={en:{"pagination.showing":"Page {current} of {total}","pagination.navigation":"Page navigation","pagination.previous":"Previous","pagination.next":"Next","pagination.reload":"Reload","table.initial":"Start searching to see results.","table.error":"Error while loading data:","table.no-data":"No elements found.","dropdown.empty":"No results","select.remove":"Remove","files.dropzone-label":"Click or drop your files here","files.remove":"Remove","files.unacceptable-file-type":"Only files of type {types} are supported","files.max-file-size-exceeded":"Maximum supported file size is {size}","files.max-total-size-exceeded":"Maximum supported total file size is {size}","files.max-files-exceeded":{one:"Maximum of {count} file exceeded",other:"Maximum of {count} files exceeded"},"filters.op.EQ":"Equals","filters.op.NEQ":"Not equal","filters.op.LT":"Less than","filters.op.GT":"Greater than","filters.op.LTE":"At most","filters.op.GTE":"At least","filters.op.BETWEEN":"Between","filters.op.CONTAINS":"Contains","filters.op.STARTS_WITH":"Starts with","filters.op.ENDS_WITH":"Ends with","filters.sensitivity.IGNORE_CASE":"Ignore case","filters.sensitivity.CASE_SENSITIVE":"Case sensitive","filters.boolean.any":"Any","filters.boolean.true":"Yes","filters.boolean.false":"No","info.tooltip":"More information","failure.no-reason":"Something went wrong","dialog.acknowledge":"Got it","dialog.close":"Close","dialog.confirm":"Confirm","dialog.cancel":"Cancel","dialog.discard.header":"Unsaved changes","dialog.discard.body":"There are unsaved changes: close anyway?","dialog.discard.confirm":"Close without saving","dialog.discard.cancel":"Keep editing","drawer.close":"Close","spinner.loading":"Loading…","tabs.previous":"Previous tabs","tabs.next":"Next tabs","toast.region":"Notifications","toast.dismiss":"Dismiss","wizard.progress":"Progress"},it:{"pagination.showing":"Pagina {current} di {total}","pagination.navigation":"Navigazione pagine","pagination.previous":"Precedente","pagination.next":"Successivo","pagination.reload":"Ricarica","table.initial":"Avvia la ricerca per visualizzare i risultati.","table.error":"Errore nel caricamento dei dati:","table.no-data":"Nessun elemento trovato.","dropdown.empty":"Nessun risultato","select.remove":"Rimuovi","files.dropzone-label":"Clicca o trascina i file qui","files.remove":"Rimuovi","files.unacceptable-file-type":"Solo i file di tipo {types} sono supportati","files.max-file-size-exceeded":"La dimensione massima di un file è di {size}","files.max-total-size-exceeded":"La dimensione massima complessiva dei file è di {size}","files.max-files-exceeded":{other:"Superato il numero massimo di {count} file"},"filters.op.EQ":"Uguale","filters.op.NEQ":"Diverso","filters.op.LT":"Minore","filters.op.GT":"Maggiore","filters.op.LTE":"Al massimo","filters.op.GTE":"Almeno","filters.op.BETWEEN":"Tra","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Inizia con","filters.op.ENDS_WITH":"Termina con","filters.sensitivity.IGNORE_CASE":"Ignora maiuscole","filters.sensitivity.CASE_SENSITIVE":"Distingui maiuscole","filters.boolean.any":"Qualsiasi","filters.boolean.true":"Sì","filters.boolean.false":"No","info.tooltip":"Maggiori informazioni","failure.no-reason":"Si è verificato un errore","dialog.acknowledge":"Ho capito","dialog.close":"Chiudi","dialog.confirm":"Conferma","dialog.cancel":"Annulla","dialog.discard.header":"Modifiche non salvate","dialog.discard.body":"Ci sono modifiche non salvate: chiudere comunque?","dialog.discard.confirm":"Chiudi senza salvare","dialog.discard.cancel":"Continua a modificare","drawer.close":"Chiudi","spinner.loading":"Caricamento…","tabs.previous":"Schede precedenti","tabs.next":"Schede successive","toast.region":"Notifiche","toast.dismiss":"Chiudi","wizard.progress":"Avanzamento"},es:{"pagination.showing":"Página {current} de {total}","pagination.navigation":"Navegación de páginas","pagination.previous":"Anterior","pagination.next":"Siguiente","pagination.reload":"Recargar","table.initial":"Inicia la búsqueda para ver los resultados.","table.error":"Error al cargar los datos:","table.no-data":"No se encontraron elementos.","dropdown.empty":"Sin resultados","select.remove":"Eliminar","files.dropzone-label":"Haz clic o arrastra tus archivos aquí","files.remove":"Eliminar","files.unacceptable-file-type":"Solo se admiten archivos de tipo {types}","files.max-file-size-exceeded":"El tamaño máximo de archivo admitido es {size}","files.max-total-size-exceeded":"El tamaño total máximo admitido es {size}","files.max-files-exceeded":{one:"Se ha superado el número máximo de {count} archivo",other:"Se ha superado el número máximo de {count} archivos"},"filters.op.EQ":"Igual","filters.op.NEQ":"Distinto","filters.op.LT":"Menor","filters.op.GT":"Mayor","filters.op.LTE":"Como máximo","filters.op.GTE":"Al menos","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Empieza por","filters.op.ENDS_WITH":"Termina por","filters.sensitivity.IGNORE_CASE":"Ignorar mayúsculas","filters.sensitivity.CASE_SENSITIVE":"Distinguir mayúsculas","filters.boolean.any":"Cualquiera","filters.boolean.true":"Sí","filters.boolean.false":"No","info.tooltip":"Más información","failure.no-reason":"Se ha producido un error","dialog.acknowledge":"Entendido","dialog.close":"Cerrar","dialog.confirm":"Confirmar","dialog.cancel":"Cancelar","dialog.discard.header":"Cambios sin guardar","dialog.discard.body":"Hay cambios sin guardar: ¿cerrar de todos modos?","dialog.discard.confirm":"Cerrar sin guardar","dialog.discard.cancel":"Seguir editando","drawer.close":"Cerrar","spinner.loading":"Cargando…","tabs.previous":"Pestañas anteriores","tabs.next":"Pestañas siguientes","toast.region":"Notificaciones","toast.dismiss":"Cerrar","wizard.progress":"Progreso"},fr:{"pagination.showing":"Page {current} sur {total}","pagination.navigation":"Navigation des pages","pagination.previous":"Précédent","pagination.next":"Suivant","pagination.reload":"Recharger","table.initial":"Lancez la recherche pour voir les résultats.","table.error":"Erreur lors du chargement des données :","table.no-data":"Aucun élément trouvé.","dropdown.empty":"Aucun résultat","select.remove":"Retirer","files.dropzone-label":"Cliquez ou déposez vos fichiers ici","files.remove":"Retirer","files.unacceptable-file-type":"Seuls les fichiers de type {types} sont pris en charge","files.max-file-size-exceeded":"La taille maximale de fichier prise en charge est {size}","files.max-total-size-exceeded":"La taille totale maximale prise en charge est {size}","files.max-files-exceeded":{one:"Nombre maximal de {count} fichier dépassé",other:"Nombre maximal de {count} fichiers dépassé"},"filters.op.EQ":"Égal","filters.op.NEQ":"Différent","filters.op.LT":"Inférieur","filters.op.GT":"Supérieur","filters.op.LTE":"Au plus","filters.op.GTE":"Au moins","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contient","filters.op.STARTS_WITH":"Commence par","filters.op.ENDS_WITH":"Finit par","filters.sensitivity.IGNORE_CASE":"Ignorer la casse","filters.sensitivity.CASE_SENSITIVE":"Respecter la casse","filters.boolean.any":"Indifférent","filters.boolean.true":"Oui","filters.boolean.false":"Non","info.tooltip":"Plus d’informations","failure.no-reason":"Une erreur s'est produite","dialog.acknowledge":"J’ai compris","dialog.close":"Fermer","dialog.confirm":"Confirmer","dialog.cancel":"Annuler","dialog.discard.header":"Modifications non enregistrées","dialog.discard.body":"Des modifications ne sont pas enregistrées : fermer quand même ?","dialog.discard.confirm":"Fermer sans enregistrer","dialog.discard.cancel":"Continuer à modifier","drawer.close":"Fermer","spinner.loading":"Chargement…","tabs.previous":"Onglets précédents","tabs.next":"Onglets suivants","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};class je{#ji;#Hi;#Vi;constructor(t={}){const e=t.language||navigator?.language||"en";try{this.#ji=Intl.getCanonicalLocales(String(e).replaceAll("_","-"))[0]}catch{throw new RangeError(`Plugin: language '${e}' is not a language tag: pass a BCP-47 tag such as 'it' or 'it-IT', or leave it out for the browser's language`)}this.#Hi=t.translations??{},this.#Vi=t.httpClient??null}configure(t){const e=this.#Vi??G.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),s=this.#ji.split("-")[0],i={...Be.en,...Be[s],...this.#Hi};t.defineModule("l10n",R).defineComponent("http-client",e).defineElement("ful-tooltip",Ce).defineElement("ful-dialog",qe).defineElement("ful-drawer",Ne).defineElement("ful-menu",Pe).defineElement("ful-toasts",Ie).defineElement("ful-tabs",ze).defineElement("ful-accordion",De).defineElement("ful-wizard",$e).defineElement("ful-form",gt).defineElement("ful-checkbox",Qt).defineElement("ful-input",xt).defineElement("ful-input-file",qt).defineElement("ful-local-date",Ct).defineElement("ful-instant",Tt).defineElement("ful-input-local-date",_t).defineElement("ful-input-local-time",kt).defineElement("ful-input-instant",Ot).defineElement("ful-radio-group",Gt).defineElement("ful-table",ee).defineElement("ful-pagination",Jt).defineElement("ful-sorter",Kt).defineElement("ful-filter-instant",be).defineElement("ful-filter-local-date",ve).defineElement("ful-filter-number",ye).defineElement("ful-filter-boolean",Ae).defineElement("ful-filter-text",we).defineElement("ful-filter-in",Se).defineElement("ful-select",Ut).defineElement("ful-dropdown",Wt).defineComponent("loaders:select",Vt).defineComponent("loaders:form",ft).defineComponent("loaders:table",te).defineOverlay({l10n:i,locale:this.#ji})}}var He=Object.freeze({__proto__:null,Accordion:De,Anchors:zt,AsyncEvents:nt,Bindings:ct,BooleanFilter:Ae,Checkbox:Qt,Claims:ot,CompareFilter:ge,Dialog:qe,Drawer:Ne,Dropdown:Wt,Field:dt,Form:gt,FormLoader:ft,InFilter:Se,Input:xt,InputFile:qt,InputInstant:Ot,InputLocalDate:_t,InputLocalTime:kt,Instant:Tt,InstantFilter:be,LocalDate:Ct,LocalDateFilter:ve,LocalStorage:et,Menu:Pe,NumberFilter:ye,PageLeave:at,Pagination:Jt,Plugin:je,RadioGroup:Gt,Select:Ut,SelectLoader:Vt,SessionStorage:st,SortButton:Kt,Table:ee,TableLoader:te,Tabs:ze,TextFilter:we,Timing:ut,Toasts:Ie,Tooltip:Ce,VersionedLocalStorage:it,VersionedSessionStorage:rt,Wizard:$e,describable:lt});return"undefined"!=typeof window&&(window.ftl=F,window.httpc=Y,window.ful=He),t.Accordion=De,t.Anchors=zt,t.AsyncEvents=nt,t.Attributes=d,t.Base64=I,t.Bindings=ct,t.BooleanFilter=Ae,t.BoundedCache=e,t.Checkbox=Qt,t.Claims=ot,t.CompareFilter=ge,t.Dialog=qe,t.Drawer=Ne,t.Dropdown=Wt,t.ExpressionEvaluator=u,t.Expressions=l,t.Failure=M,t.Field=dt,t.Form=gt,t.FormLoader=ft,t.Fragments=c,t.Hex=z,t.HttpClient=G,t.HttpClientBuilder=V,t.HttpClientError=$,t.HttpInterceptorChain=U,t.HttpMultipartRequestCustomizer=X,t.HttpRequestBuilder=J,t.InFilter=Se,t.Input=xt,t.InputFile=qt,t.InputInstant=Ot,t.InputLocalDate=_t,t.InputLocalTime=kt,t.Instant=Tt,t.InstantFilter=be,t.LightSlots=h,t.LocalDate=Ct,t.LocalDateFilter=ve,t.LocalStorage=et,t.Localization=R,t.MediaType=D,t.Menu=Pe,t.Nodes=p,t.NumberFilter=ye,t.PageLeave=at,t.Pagination=Jt,t.ParsedElement=C,t.Plugin=je,t.RadioGroup=Gt,t.Registry=E,t.RenderError=y,t.Rendering=S,t.Select=Ut,t.SelectLoader=Vt,t.SessionStorage=st,t.SortButton=Kt,t.Table=ee,t.TableLoader=te,t.Tabs=ze,t.Template=v,t.Templates=A,t.TextFilter=we,t.Timing=ut,t.Toasts=Ie,t.Tooltip=Ce,t.VersionedLocalStorage=it,t.VersionedSessionStorage=rt,t.Wizard=$e,t.describable=lt,t.registry=x,t}({});
|
|
2
2
|
//# sourceMappingURL=fml.iife.min.js.map
|