@optionfactory/fml 9.0.0-rc22 → 9.0.0-rc24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
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")}},r=new Map([["true",!0],["false",!1],["null",null],["undefined",void 0]]);class i extends SyntaxError{constructor(t,e,s,r){super(t),this.expected=e,this.found=s,this.location=r,this.name="SyntaxError"}format(t){let e="Error: "+this.message;if(this.location){let s=null;const r=t.find(t=>t.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 t=this.location.end,r="".padEnd(n.line.toString().length," "),o=s[i.line-1],l=(i.line===t.line?t.column:o.length+1)-i.column||1;e+="\n --\x3e "+a+"\n"+r+" |\n"+n.line+" | "+o+"\n"+r+" | "+"".padEnd(i.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 r=Object.prototype.hasOwnProperty.call(RegExp.prototype,"unicode")?new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]","gu"):null;function i(t){return r?t.replace(r,t=>"\\u{"+s(t)+"}"):t}function n(t){return i(t.replace(/\\/g,"\\\\").replace(/"/g,'\\"').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 a(t){return i(t.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,t=>"\\x0"+s(t)).replace(/[\x10-\x1F\x7F-\x9F]/g,t=>"\\x"+s(t)))}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 r=t[s];if(null!=r&&("object"==typeof r||"function"==typeof r)&&e in r)return r[e]}};class a{#s;#r;constructor(t,e){this.#s=t,this.#r=e}#i(t){return n(this.#r,t)}#n(t,e){const r=0===e?t.lhs:t.rhs[e-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:(t,e)=>this.#i(e)})),this.#a}[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 r=s[e.value];if(!r)throw new Error(`Function "#${null===e.module?"":`${e.module}:`}${e.value}" not found`);const i=t.args.map(t=>this.visit(t));return r.apply(this.#o(),i)}[s.literal](t){return t.value}[s.tstring](t){let e="";const s=t.parts;for(let t=0,r=s.length;t<r;t++){const r=this.visit(s[t]);null!=r&&(e+=r)}return e}[s.symbol](t){return this.#i(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,r=this.visit(t.lhs);for(let i=0;i!==t.rhs.length;++i){const n=t.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 e=this.#n(t,i);throw new Error(null===e?"Method missing":`Method missing "${e}"`)}const s=n.args.map(t=>this.visit(t));a=r.apply(e,s);break}}e=r,r=a}return r}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 o{static MODE_EXPRESSION=Symbol("MODE_EXPRESSION");static MODE_TEMPLATED=Symbol("MODE_TEMPLATED");static#l=new e(1e3);static parse(t,e){const n=e?.toString()+t;return this.#l.getOrCompute(n,()=>function(t,e){const n={},a=(e=void 0!==e?e:{}).grammarSource,o={TemplatedRoot:me,ExpressionRoot:be};let l=me;const u="{{{{",c="}}}}",d="{{{",h="}}}",p="{{",f="}}",m="\\",g="{",b="?",v=":",y="?:",w="??",E="||",x="&&",A="!",S="?.",T=".",C="[",_="]",O="(",k=",",q=")",L="-",R="'",N='"',P="`",M="}",F="#",D="==",z="!=",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=ue("{{{{",!1),Y=ue("}}}}",!1),Z=ue("{{{",!1),tt=ue("}}}",!1),et=ue("{{",!1),st=ue("}}",!1),rt=ce(["\\","{"],!0,!1,!1),it=ue("\\",!1),nt={type:"any"},at=ue("{",!1),ot=ue("?",!1),lt=ue(":",!1),ut=ue("?:",!1),ct=ue("??",!1),dt=ue("||",!1),ht=ue("&&",!1),pt=ue("!",!1),ft=de("member"),mt=ue("?.",!1),gt=ue(".",!1),bt=de("subscript"),vt=ue("[",!1),yt=ue("]",!1),wt=de("method-call"),Et=ue("(",!1),xt=ue(",",!1),At=ue(")",!1),St=de("module-function-call"),Tt=de("number-literal"),Ct=ue("-",!1),_t=ce([["0","9"]],!1,!1,!1),Ot=de("string-literal"),kt=ue("'",!1),qt=ce(["'"],!0,!1,!1),Lt=ue('"',!1),Rt=ce(['"'],!0,!1,!1),Nt=ue("`",!1),Pt=de("tstring-expression"),Mt=ue("}",!1),Ft=de("tstring-literal"),Dt=ce(["\\","`","{"],!0,!1,!1),zt=de("array-literal"),It=de("dict-literal"),$t=de("module-function"),Bt=ue("#",!1),jt=ce([["a","z"],["A","Z"],"$","_"],!1,!1,!1),Ht=ce([["a","z"],["A","Z"],"$","_",["0","9"]],!1,!1,!1),Wt=de("identifier-or-keyword"),Vt=ue("==",!1),Ut=ue("!=",!1),Gt=ue(">=",!1),Qt=ue(">",!1),Kt=ue("<=",!1),Jt=ue("<",!1),Xt=ce([" ","\t","\n","\r"],!1,!1,!1);function Yt(t){return t}function Zt(t,e,s){return{op:e,rhs:s}}function te(t,e,s){return{op:e,rhs:s}}function ee(t){return t}let se=0|e.peg$currPos;const re=[{line:1,column:1}];let ie,ne=se,ae=e.peg$maxFailExpected||[],oe=0|e.peg$silentFails,le={};if(e.startRule){if(!(e.startRule in o))throw new Error("Can't start parsing from rule \""+e.startRule+'".');l=o[e.startRule]}function ue(t,e){return{type:"literal",text:t,ignoreCase:e}}function ce(t,e,s,r){return{type:"class",parts:t,inverted:e,ignoreCase:s,unicode:r}}function de(t){return{type:"other",description:t}}function he(e){let s,r=re[e];if(r)return r;if(e>=re.length)s=re.length-1;else for(s=e;!re[--s];);for(r=re[s],r={line:r.line,column:r.column};s<e;)10===t.charCodeAt(s)?(r.line++,r.column=1):r.column++,s++;return re[e]=r,r}function pe(t,e,s){const r=he(t),i=he(e);return{source:a,start:{offset:t,line:r.line,column:r.column},end:{offset:e,line:i.line,column:i.column}}}function fe(t){se<ne||(se>ne&&(ne=se,ae=[]),ae.push(t))}function me(){let t,e;const s=38*se+0,r=le[s];if(r)return se=r.nextPos,r.result;for(t=[],e=ge();e!==n;)t.push(e),e=ge();return le[s]={nextPos:se,result:t},t}function ge(){let e,r,i,a,o;const l=38*se+1,b=le[l];return b?(se=b.nextPos,b.result):(e=se,r=se,i=function(){let e;const s=38*se+2,r=le[s];return r?(se=r.nextPos,r.result):(t.substr(se,4)===u?(e=u,se+=4):(e=n,0===oe&&fe(X)),le[s]={nextPos:se,result:e},e)}(),i!==n?(a=be(),a!==n?(o=function(){let e;const s=38*se+3,r=le[s];return r?(se=r.nextPos,r.result):(t.substr(se,4)===c?(e=c,se+=4):(e=n,0===oe&&fe(Y)),le[s]={nextPos:se,result:e},e)}(),o!==n?r=a:(se=r,r=n)):(se=r,r=n)):(se=r,r=n),r!==n&&(v=r,r={type:s.templated.ten,value:v}),e=r,e===n&&(e=se,r=se,i=function(){let e;const s=38*se+4,r=le[s];return r?(se=r.nextPos,r.result):(t.substr(se,3)===d?(e=d,se+=3):(e=n,0===oe&&fe(Z)),le[s]={nextPos:se,result:e},e)}(),i!==n?(a=be(),a!==n?(o=function(){let e;const s=38*se+5,r=le[s];return r?(se=r.nextPos,r.result):(t.substr(se,3)===h?(e=h,se+=3):(e=n,0===oe&&fe(tt)),le[s]={nextPos:se,result:e},e)}(),o!==n?r=a:(se=r,r=n)):(se=r,r=n)):(se=r,r=n),r!==n&&(r=function(t){return{type:s.templated.teh,value:t}}(r)),e=r,e===n&&(e=se,r=se,i=function(){let e;const s=38*se+6,r=le[s];return r?(se=r.nextPos,r.result):(t.substr(se,2)===p?(e=p,se+=2):(e=n,0===oe&&fe(et)),le[s]={nextPos:se,result:e},e)}(),i!==n?(a=be(),a!==n?(o=function(){let e;const s=38*se+7,r=le[s];return r?(se=r.nextPos,r.result):(t.substr(se,2)===f?(e=f,se+=2):(e=n,0===oe&&fe(st)),le[s]={nextPos:se,result:e},e)}(),o!==n?r=a:(se=r,r=n)):(se=r,r=n)):(se=r,r=n),r!==n&&(r=function(t){return{type:s.templated.tet,value:t}}(r)),e=r,e===n&&(e=se,r=function(){let e,s,r,i,a,o,l;const u=38*se+8,c=le[u];if(c)return se=c.nextPos,c.result;if(e=se,s=[],r=se,i=[],a=t.charAt(se),H.test(a)?se++:(a=n,0===oe&&fe(rt)),a!==n)for(;a!==n;)i.push(a),a=t.charAt(se),H.test(a)?se++:(a=n,0===oe&&fe(rt));else i=n;if(r=i!==n?t.substring(r,se):i,r===n&&(r=se,92===t.charCodeAt(se)?(i=m,se++):(i=n,0===oe&&fe(it)),i!==n?(t.length>se?(a=t.charAt(se),se++):(a=n,0===oe&&fe(nt)),a!==n?r=a:(se=r,r=n)):(se=r,r=n),r===n&&(r=se,i=se,123===t.charCodeAt(se)?(a=g,se++):(a=n,0===oe&&fe(at)),a!==n?(o=se,oe++,123===t.charCodeAt(se)?(l=g,se++):(l=n,0===oe&&fe(at)),oe--,l===n?o=void 0:(se=o,o=n),o!==n?(a=[a,o],i=a):(se=i,i=n)):(se=i,i=n),r=i!==n?t.substring(r,se):i)),r!==n)for(;r!==n;){if(s.push(r),r=se,i=[],a=t.charAt(se),H.test(a)?se++:(a=n,0===oe&&fe(rt)),a!==n)for(;a!==n;)i.push(a),a=t.charAt(se),H.test(a)?se++:(a=n,0===oe&&fe(rt));else i=n;r=i!==n?t.substring(r,se):i,r===n&&(r=se,92===t.charCodeAt(se)?(i=m,se++):(i=n,0===oe&&fe(it)),i!==n?(t.length>se?(a=t.charAt(se),se++):(a=n,0===oe&&fe(nt)),a!==n?r=Yt(a):(se=r,r=n)):(se=r,r=n),r===n&&(r=se,i=se,123===t.charCodeAt(se)?(a=g,se++):(a=n,0===oe&&fe(at)),a!==n?(o=se,oe++,123===t.charCodeAt(se)?(l=g,se++):(l=n,0===oe&&fe(at)),oe--,l===n?o=void 0:(se=o,o=n),o!==n?(a=[a,o],i=a):(se=i,i=n)):(se=i,i=n),r=i!==n?t.substring(r,se):i))}else s=n;return s!==n&&(s=s.join("")),e=s,le[u]={nextPos:se,result:e},e}(),r!==n&&(r=function(t){return{type:s.templated.tel,value:t}}(r)),e=r))),le[l]={nextPos:se,result:e},e);var v}function be(){let t,e;const s=38*se+9,r=le[s];return r?(se=r.nextPos,r.result):(t=se,Pe(),e=ve(),e!==n?(Pe(),t=e):(se=t,t=n),le[s]={nextPos:se,result:t},t)}function ve(){let e,r,i,a,o,l;const u=38*se+10,c=le[u];return c?(se=c.nextPos,c.result):(e=se,r=ye(),r!==n?(Pe(),63===t.charCodeAt(se)?(i=b,se++):(i=n,0===oe&&fe(ot)),i!==n?(Pe(),a=ve(),a!==n?(Pe(),58===t.charCodeAt(se)?(o=v,se++):(o=n,0===oe&&fe(lt)),o!==n?(Pe(),l=ve(),l!==n?e={type:s.ter,cond:r,ifTrue:a,ifFalse:l}:(se=e,e=n)):(se=e,e=n)):(se=e,e=n)):(se=e,e=n)):(se=e,e=n),e===n&&(e=ye()),le[u]={nextPos:se,result:e},e)}function ye(){let e,r,i,a;const o=38*se+11,l=le[o];return l?(se=l.nextPos,l.result):(e=se,r=we(),r!==n?(Pe(),t.substr(se,2)===y?(i=y,se+=2):(i=n,0===oe&&fe(ut)),i!==n?(Pe(),a=ye(),a!==n?e={type:s.elv,cond:r,ifFalse:a}:(se=e,e=n)):(se=e,e=n)):(se=e,e=n),e===n&&(e=we()),le[o]={nextPos:se,result:e},e)}function we(){let e,r,i,a;const o=38*se+12,l=le[o];return l?(se=l.nextPos,l.result):(e=se,r=Ee(),r!==n?(Pe(),t.substr(se,2)===w?(i=w,se+=2):(i=n,0===oe&&fe(ct)),i!==n?(Pe(),a=we(),a!==n?e={type:s.nullc,lhs:r,rhs:a}:(se=e,e=n)):(se=e,e=n)):(se=e,e=n),e===n&&(e=Ee()),le[o]={nextPos:se,result:e},e)}function Ee(){let e,r,i,a,o,l;const u=38*se+13,c=le[u];if(c)return se=c.nextPos,c.result;if(e=se,r=xe(),r!==n){for(i=[],a=se,Pe(),t.substr(se,2)===E?(o=E,se+=2):(o=n,0===oe&&fe(dt)),o!==n?(Pe(),l=xe(),l!==n?a=l:(se=a,a=n)):(se=a,a=n);a!==n;)i.push(a),a=se,Pe(),t.substr(se,2)===E?(o=E,se+=2):(o=n,0===oe&&fe(dt)),o!==n?(Pe(),l=xe(),l!==n?a=l:(se=a,a=n)):(se=a,a=n);e=function(t,e){let r=t;for(const t of e)r={type:s.or,lhs:r,rhs:t};return r}(r,i)}else se=e,e=n;return le[u]={nextPos:se,result:e},e}function xe(){let e,r,i,a,o,l;const u=38*se+14,c=le[u];if(c)return se=c.nextPos,c.result;if(e=se,r=Ae(),r!==n){for(i=[],a=se,Pe(),t.substr(se,2)===x?(o=x,se+=2):(o=n,0===oe&&fe(ht)),o!==n?(Pe(),l=Ae(),l!==n?a=l:(se=a,a=n)):(se=a,a=n);a!==n;)i.push(a),a=se,Pe(),t.substr(se,2)===x?(o=x,se+=2):(o=n,0===oe&&fe(ht)),o!==n?(Pe(),l=Ae(),l!==n?a=l:(se=a,a=n)):(se=a,a=n);e=function(t,e){let r=t;for(const t of e)r={type:s.and,lhs:r,rhs:t};return r}(r,i)}else se=e,e=n;return le[u]={nextPos:se,result:e},e}function Ae(){let t,e,r,i,a,o;const l=38*se+15,u=le[l];if(u)return se=u.nextPos,u.result;if(t=se,e=Se(),e!==n){for(r=[],i=se,Pe(),a=Re(),a!==n?(Pe(),o=Se(),o!==n?i=Zt(0,a,o):(se=i,i=n)):(se=i,i=n);i!==n;)r.push(i),i=se,Pe(),a=Re(),a!==n?(Pe(),o=Se(),o!==n?i=Zt(0,a,o):(se=i,i=n)):(se=i,i=n);t=function(t,e){let r=t;for(const t of e)r={type:s.eq,op:t.op,lhs:r,rhs:t.rhs};return r}(e,r)}else se=t,t=n;return le[l]={nextPos:se,result:t},t}function Se(){let t,e,r,i,a,o;const l=38*se+16,u=le[l];if(u)return se=u.nextPos,u.result;if(t=se,e=Te(),e!==n){for(r=[],i=se,Pe(),a=Ne(),a!==n?(Pe(),o=Te(),o!==n?i=te(0,a,o):(se=i,i=n)):(se=i,i=n);i!==n;)r.push(i),i=se,Pe(),a=Ne(),a!==n?(Pe(),o=Te(),o!==n?i=te(0,a,o):(se=i,i=n)):(se=i,i=n);t=function(t,e){let r=t;for(const t of e)r={type:s.cmp,op:t.op,lhs:r,rhs:t.rhs};return r}(e,r)}else se=t,t=n;return le[l]={nextPos:se,result:t},t}function Te(){let e,r,i;const a=38*se+17,o=le[a];return o?(se=o.nextPos,o.result):(e=se,33===t.charCodeAt(se)?(r=A,se++):(r=n,0===oe&&fe(pt)),r!==n?(Pe(),i=Te(),i!==n?e={type:s.not,expr:i}:(se=e,e=n)):(se=e,e=n),e===n&&(e=function(){let t,e,r,i,a;const o=38*se+18,l=le[o];if(l)return se=l.nextPos,l.result;if(t=se,e=_e(),e!==n){if(Pe(),r=[],i=se,a=Ce(),a!==n?(Pe(),i=a):(se=i,i=n),i!==n)for(;i!==n;)r.push(i),i=se,a=Ce(),a!==n?(Pe(),i=a):(se=i,i=n);else r=n;r!==n?t={type:s.access,lhs:e,rhs:r}:(se=t,t=n)}else se=t,t=n;return t===n&&(t=_e()),le[o]={nextPos:se,result:t},t}()),le[a]={nextPos:se,result:e},e)}function Ce(){let e;const r=38*se+19,i=le[r];return i?(se=i.nextPos,i.result):(e=function(){let e,r,i;const a=38*se+20,o=le[a];return o?(se=o.nextPos,o.result):(oe++,e=se,t.substr(se,2)===S?(r=S,se+=2):(r=n,0===oe&&fe(mt)),r===n&&(46===t.charCodeAt(se)?(r=T,se++):(r=n,0===oe&&fe(gt))),r!==n?(Pe(),i=Le(),i!==n?e={type:s.member,ns:"?."===r,rhs:i}:(se=e,e=n)):(se=e,e=n),oe--,e===n&&(r=n,0===oe&&fe(ft)),le[a]={nextPos:se,result:e},e)}(),e===n&&(e=function(){let e,r,i,a,o;const l=38*se+21,u=le[l];return u?(se=u.nextPos,u.result):(oe++,e=se,t.substr(se,2)===S?(r=S,se+=2):(r=n,0===oe&&fe(mt)),r===n&&(r=null),91===t.charCodeAt(se)?(i=C,se++):(i=n,0===oe&&fe(vt)),i!==n?(Pe(),a=ve(),a!==n?(Pe(),93===t.charCodeAt(se)?(o=_,se++):(o=n,0===oe&&fe(yt)),o!==n?e={type:s.subscript,ns:null!==r,rhs:a}:(se=e,e=n)):(se=e,e=n)):(se=e,e=n),oe--,e===n&&(r=n,0===oe&&fe(bt)),le[l]={nextPos:se,result:e},e)}(),e===n&&(e=function(){let e,r,i,a,o,l,u,c;const d=38*se+22,h=le[d];if(h)return se=h.nextPos,h.result;if(oe++,e=se,t.substr(se,2)===S?(r=S,se+=2):(r=n,0===oe&&fe(mt)),r===n&&(r=null),40===t.charCodeAt(se)?(i=O,se++):(i=n,0===oe&&fe(Et)),i!==n){for(Pe(),a=se,o=ve(),o!==n?(l=Pe(),a=o):(se=a,a=n),a===n&&(a=null),o=[],l=se,44===t.charCodeAt(se)?(u=k,se++):(u=n,0===oe&&fe(xt)),u!==n?(Pe(),c=ve(),c!==n?(Pe(),l=c):(se=l,l=n)):(se=l,l=n);l!==n;)o.push(l),l=se,44===t.charCodeAt(se)?(u=k,se++):(u=n,0===oe&&fe(xt)),u!==n?(Pe(),c=ve(),c!==n?(Pe(),l=c):(se=l,l=n)):(se=l,l=n);41===t.charCodeAt(se)?(l=q,se++):(l=n,0===oe&&fe(At)),l!==n?e=function(t,e,r){return{type:s.method,ns:null!==t,args:null===e?[]:[e,...r]}}(r,a,o):(se=e,e=n)}else se=e,e=n;return oe--,e===n&&(r=n,0===oe&&fe(wt)),le[d]={nextPos:se,result:e},e}())),le[r]={nextPos:se,result:e},e)}function _e(){let e,i,a,o;const l=38*se+23,u=le[l];return u?(se=u.nextPos,u.result):(e=se,40===t.charCodeAt(se)?(i=O,se++):(i=n,0===oe&&fe(Et)),i!==n?(Pe(),a=ve(),a!==n?(Pe(),41===t.charCodeAt(se)?(o=q,se++):(o=n,0===oe&&fe(At)),o!==n?e=a:(se=e,e=n)):(se=e,e=n)):(se=e,e=n),e===n&&(e=function(){let e,r,i,a,o,l,u,c;const d=38*se+24,h=le[d];if(h)return se=h.nextPos,h.result;if(oe++,e=se,r=function(){let e,r,i,a,o;const l=38*se+32,u=le[l];return u?(se=u.nextPos,u.result):(oe++,e=se,35===t.charCodeAt(se)?(r=F,se++):(r=n,0===oe&&fe(Bt)),r!==n?(i=se,a=Le(),a!==n?(58===t.charCodeAt(se)?(o=v,se++):(o=n,0===oe&&fe(lt)),o!==n?i=a:(se=i,i=n)):(se=i,i=n),i===n&&(i=null),a=Le(),a!==n?e={type:s.function,module:i,value:a}:(se=e,e=n)):(se=e,e=n),oe--,e===n&&(r=n,0===oe&&fe($t)),le[l]={nextPos:se,result:e},e)}(),r!==n)if(40===t.charCodeAt(se)?(i=O,se++):(i=n,0===oe&&fe(Et)),i!==n){for(Pe(),a=se,o=ve(),o!==n?(l=Pe(),a=o):(se=a,a=n),a===n&&(a=null),o=[],l=se,44===t.charCodeAt(se)?(u=k,se++):(u=n,0===oe&&fe(xt)),u!==n?(Pe(),c=ve(),c!==n?(Pe(),l=c):(se=l,l=n)):(se=l,l=n);l!==n;)o.push(l),l=se,44===t.charCodeAt(se)?(u=k,se++):(u=n,0===oe&&fe(xt)),u!==n?(Pe(),c=ve(),c!==n?(Pe(),l=c):(se=l,l=n)):(se=l,l=n);41===t.charCodeAt(se)?(l=q,se++):(l=n,0===oe&&fe(At)),l!==n?e=function(t,e,r){const i=null===e?[]:[e,...r];return{type:s.call,value:t,args:i}}(r,a,o):(se=e,e=n)}else se=e,e=n;else se=e,e=n;return oe--,e===n&&(r=n,0===oe&&fe(St)),le[d]={nextPos:se,result:e},e}(),e===n&&(e=function(){let e;const r=38*se+25,i=le[r];return i?(se=i.nextPos,i.result):(e=function(){let e,r,i,a,o,l,u,c,d,h;const p=38*se+26,f=le[p];if(f)return se=f.nextPos,f.result;if(oe++,e=se,r=se,i=se,45===t.charCodeAt(se)?(a=L,se++):(a=n,0===oe&&fe(Ct)),a===n&&(a=null),o=se,l=[],u=t.charAt(se),W.test(u)?se++:(u=n,0===oe&&fe(_t)),u!==n)for(;u!==n;)l.push(u),u=t.charAt(se),W.test(u)?se++:(u=n,0===oe&&fe(_t));else l=n;if(l!==n){if(u=se,46===t.charCodeAt(se)?(c=T,se++):(c=n,0===oe&&fe(gt)),c!==n){for(d=[],h=t.charAt(se),W.test(h)?se++:(h=n,0===oe&&fe(_t));h!==n;)d.push(h),h=t.charAt(se),W.test(h)?se++:(h=n,0===oe&&fe(_t));c=[c,d],u=c}else se=u,u=n;u===n&&(u=null),l=[l,u],o=l}else se=o,o=n;if(o===n)if(o=se,46===t.charCodeAt(se)?(l=T,se++):(l=n,0===oe&&fe(gt)),l!==n){if(u=[],c=t.charAt(se),W.test(c)?se++:(c=n,0===oe&&fe(_t)),c!==n)for(;c!==n;)u.push(c),c=t.charAt(se),W.test(c)?se++:(c=n,0===oe&&fe(_t));else u=n;u!==n?(l=[l,u],o=l):(se=o,o=n)}else se=o,o=n;return o!==n?(a=[a,o],i=a):(se=i,i=n),r=i!==n?t.substring(r,se):i,r!==n&&(r={type:s.literal,value:parseFloat(r)}),e=r,oe--,e===n&&(r=n,0===oe&&fe(Tt)),le[p]={nextPos:se,result:e},e}(),e===n&&(e=Oe(),e===n&&(e=function(){let e,r,i,a,o,l,u;const c=38*se+30,d=le[c];if(d)return se=d.nextPos,d.result;if(oe++,e=se,91===t.charCodeAt(se)?(r=C,se++):(r=n,0===oe&&fe(vt)),r!==n){for(Pe(),i=ve(),i===n&&(i=null),Pe(),a=[],o=se,44===t.charCodeAt(se)?(l=k,se++):(l=n,0===oe&&fe(xt)),l!==n?(Pe(),u=ve(),u!==n?(Pe(),o=u):(se=o,o=n)):(se=o,o=n);o!==n;)a.push(o),o=se,44===t.charCodeAt(se)?(l=k,se++):(l=n,0===oe&&fe(xt)),l!==n?(Pe(),u=ve(),u!==n?(Pe(),o=u):(se=o,o=n)):(se=o,o=n);93===t.charCodeAt(se)?(o=_,se++):(o=n,0===oe&&fe(yt)),o!==n?e=function(t,e){const r=null===t?[]:[t,...e];return{type:s.array,value:r}}(i,a):(se=e,e=n)}else se=e,e=n;return oe--,e===n&&(r=n,0===oe&&fe(zt)),le[c]={nextPos:se,result:e},e}(),e===n&&(e=function(){let e,r,i,a,o,l,u,c,d,h,p;const f=38*se+31,m=le[f];if(m)return se=m.nextPos,m.result;if(oe++,e=se,123===t.charCodeAt(se)?(r=g,se++):(r=n,0===oe&&fe(at)),r!==n){for(Pe(),i=se,a=Oe(),a!==n?(o=Pe(),58===t.charCodeAt(se)?(l=v,se++):(l=n,0===oe&&fe(lt)),l!==n?(u=Pe(),c=ve(),c!==n?i=[a,c]:(se=i,i=n)):(se=i,i=n)):(se=i,i=n),i===n&&(i=null),a=Pe(),o=[],l=se,44===t.charCodeAt(se)?(u=k,se++):(u=n,0===oe&&fe(xt)),u!==n?(c=Pe(),d=Oe(),d!==n?(Pe(),58===t.charCodeAt(se)?(h=v,se++):(h=n,0===oe&&fe(lt)),h!==n?(Pe(),p=ve(),p!==n?(Pe(),l=[d,p]):(se=l,l=n)):(se=l,l=n)):(se=l,l=n)):(se=l,l=n);l!==n;)o.push(l),l=se,44===t.charCodeAt(se)?(u=k,se++):(u=n,0===oe&&fe(xt)),u!==n?(c=Pe(),d=Oe(),d!==n?(Pe(),58===t.charCodeAt(se)?(h=v,se++):(h=n,0===oe&&fe(lt)),h!==n?(Pe(),p=ve(),p!==n?(Pe(),l=[d,p]):(se=l,l=n)):(se=l,l=n)):(se=l,l=n)):(se=l,l=n);125===t.charCodeAt(se)?(l=M,se++):(l=n,0===oe&&fe(Mt)),l!==n?e=function(t,e){var r=[];return null!==t&&r.push(t),r.push.apply(r,e),{type:s.dict,value:r}}(i,o):(se=e,e=n)}else se=e,e=n;return oe--,e===n&&(r=n,0===oe&&fe(It)),le[f]={nextPos:se,result:e},e}()))),le[r]={nextPos:se,result:e},e)}(),e===n&&(e=function(){let t,e;const i=38*se+34,a=le[i];return a?(se=a.nextPos,a.result):(oe++,t=se,e=Le(),e!==n&&(o=e,e=r.has(o)?{type:s.literal,value:r.get(o)}:{type:s.symbol,value:o}),t=e,oe--,t===n&&(e=n,0===oe&&fe(Wt)),le[i]={nextPos:se,result:t},t);var o}()))),le[l]={nextPos:se,result:e},e)}function Oe(){let e,r,i,a,o;const l=38*se+27,u=le[l];if(u)return se=u.nextPos,u.result;if(oe++,e=se,39===t.charCodeAt(se)?(r=R,se++):(r=n,0===oe&&fe(kt)),r!==n){for(i=se,a=[],o=t.charAt(se),V.test(o)?se++:(o=n,0===oe&&fe(qt));o!==n;)a.push(o),o=t.charAt(se),V.test(o)?se++:(o=n,0===oe&&fe(qt));i=t.substring(i,se),39===t.charCodeAt(se)?(a=R,se++):(a=n,0===oe&&fe(kt)),a!==n?e={type:s.literal,value:i}:(se=e,e=n)}else se=e,e=n;if(e===n){if(e=se,34===t.charCodeAt(se)?(r=N,se++):(r=n,0===oe&&fe(Lt)),r!==n){for(i=se,a=[],o=t.charAt(se),U.test(o)?se++:(o=n,0===oe&&fe(Rt));o!==n;)a.push(o),o=t.charAt(se),U.test(o)?se++:(o=n,0===oe&&fe(Rt));i=t.substring(i,se),34===t.charCodeAt(se)?(a=N,se++):(a=n,0===oe&&fe(Lt)),a!==n?e={type:s.literal,value:i}:(se=e,e=n)}else se=e,e=n;if(e===n)if(e=se,96===t.charCodeAt(se)?(r=P,se++):(r=n,0===oe&&fe(Nt)),r!==n){for(i=[],a=ke(),a===n&&(a=qe());a!==n;)i.push(a),a=ke(),a===n&&(a=qe());96===t.charCodeAt(se)?(a=P,se++):(a=n,0===oe&&fe(Nt)),a!==n?e={type:s.tstring,parts:i}:(se=e,e=n)}else se=e,e=n}return oe--,e===n&&(r=n,0===oe&&fe(Ot)),le[l]={nextPos:se,result:e},e}function ke(){let e,s,r,i;const a=38*se+28,o=le[a];return o?(se=o.nextPos,o.result):(oe++,e=se,123===t.charCodeAt(se)?(s=g,se++):(s=n,0===oe&&fe(at)),s!==n?(Pe(),r=ve(),r!==n?(Pe(),125===t.charCodeAt(se)?(i=M,se++):(i=n,0===oe&&fe(Mt)),i!==n?e=r:(se=e,e=n)):(se=e,e=n)):(se=e,e=n),oe--,e===n&&(s=n,0===oe&&fe(Pt)),le[a]={nextPos:se,result:e},e)}function qe(){let e,r,i,a,o;const l=38*se+29,u=le[l];if(u)return se=u.nextPos,u.result;if(oe++,e=se,r=[],i=se,a=[],o=t.charAt(se),G.test(o)?se++:(o=n,0===oe&&fe(Dt)),o!==n)for(;o!==n;)a.push(o),o=t.charAt(se),G.test(o)?se++:(o=n,0===oe&&fe(Dt));else a=n;if(i=a!==n?t.substring(i,se):a,i===n&&(i=se,92===t.charCodeAt(se)?(a=m,se++):(a=n,0===oe&&fe(it)),a!==n?(t.length>se?(o=t.charAt(se),se++):(o=n,0===oe&&fe(nt)),o!==n?i=o:(se=i,i=n)):(se=i,i=n)),i!==n)for(;i!==n;){if(r.push(i),i=se,a=[],o=t.charAt(se),G.test(o)?se++:(o=n,0===oe&&fe(Dt)),o!==n)for(;o!==n;)a.push(o),o=t.charAt(se),G.test(o)?se++:(o=n,0===oe&&fe(Dt));else a=n;i=a!==n?t.substring(i,se):a,i===n&&(i=se,92===t.charCodeAt(se)?(a=m,se++):(a=n,0===oe&&fe(it)),a!==n?(t.length>se?(o=t.charAt(se),se++):(o=n,0===oe&&fe(nt)),o!==n?i=ee(o):(se=i,i=n)):(se=i,i=n))}else r=n;return r!==n&&(r={type:s.literal,value:r.join("")}),e=r,e===n&&(e=se,123===t.charCodeAt(se)?(r=g,se++):(r=n,0===oe&&fe(at)),r!==n&&(r={type:s.literal,value:r}),e=r),oe--,e===n&&(r=n,0===oe&&fe(Ft)),le[l]={nextPos:se,result:e},e}function Le(){let e,s,r,i,a;const o=38*se+33,l=le[o];if(l)return se=l.nextPos,l.result;if(e=se,s=se,r=t.charAt(se),Q.test(r)?se++:(r=n,0===oe&&fe(jt)),r!==n){for(i=[],a=t.charAt(se),K.test(a)?se++:(a=n,0===oe&&fe(Ht));a!==n;)i.push(a),a=t.charAt(se),K.test(a)?se++:(a=n,0===oe&&fe(Ht));r=[r,i],s=r}else se=s,s=n;return e=s!==n?t.substring(e,se):s,le[o]={nextPos:se,result:e},e}function Re(){let e;const s=38*se+35,r=le[s];return r?(se=r.nextPos,r.result):(t.substr(se,2)===D?(e=D,se+=2):(e=n,0===oe&&fe(Vt)),e===n&&(t.substr(se,2)===z?(e=z,se+=2):(e=n,0===oe&&fe(Ut))),le[s]={nextPos:se,result:e},e)}function Ne(){let e;const s=38*se+36,r=le[s];return r?(se=r.nextPos,r.result):(t.substr(se,2)===I?(e=I,se+=2):(e=n,0===oe&&fe(Gt)),e===n&&(62===t.charCodeAt(se)?(e=$,se++):(e=n,0===oe&&fe(Qt)),e===n&&(t.substr(se,2)===B?(e=B,se+=2):(e=n,0===oe&&fe(Kt)),e===n&&(60===t.charCodeAt(se)?(e=j,se++):(e=n,0===oe&&fe(Jt))))),le[s]={nextPos:se,result:e},e)}function Pe(){let e,s;const r=38*se+37,i=le[r];if(i)return se=i.nextPos,i.result;for(oe++,e=[],s=t.charAt(se),J.test(s)?se++:(s=n,0===oe&&fe(Xt));s!==n;)e.push(s),s=t.charAt(se),J.test(s)?se++:(s=n,0===oe&&fe(Xt));return oe--,le[r]={nextPos:se,result:e},e}ie=l();const Me=ie!==n&&se===t.length;function Fe(){throw ie!==n&&se<t.length&&fe({type:"end"}),e=ae,s=ne<t.length?function(e=se){const s=t.codePointAt(e);return void 0===s?"":String.fromCodePoint(s)}(ne):null,r=ne<t.length?pe(ne,ne+1):pe(ne,ne),new i(i.buildMessage(e,s),e,s,r);var e,s,r}return e.peg$library?{peg$result:ie,peg$currPos:se,peg$FAILED:n,peg$maxFailExpected:ae,peg$maxFailPos:ne,peg$success:Me,peg$throw:Me?void 0:Fe}:Me?ie:void Fe()}(t,{startRule:e===o.MODE_TEMPLATED?"TemplatedRoot":"ExpressionRoot"}))}static evaluate(t,e,s,r){return new a(t,e).visitRoot(s,r===o.MODE_TEMPLATED)}static interpret(t,e,s,r){return o.evaluate(t,e,o.parse(s,r),r)}}class l{#s;#r;constructor(t,e){this.#s=t,this.#r=e}withModule(t,e){const s=t?{[t]:e}:e;return new l({...this.#s,...s},this.#r)}withOverlay(...t){return new l(this.#s,0===t.length?this.#r:[...this.#r,...t])}resolve(t){return n(this.#r,t)}evaluateExpression(t){return o.interpret(this.#s,this.#r,t,o.MODE_EXPRESSION)}evaluateTemplated(t){return o.interpret(this.#s,this.#r,t,o.MODE_TEMPLATED)}}class u{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 c{static id=0;static uid(t){return`${t}-${++c.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(r=>{const i=r.substring(t.length);if("class"===i){const r=e.getAttribute(`${t}class`)?.split(/\s+/).filter(t=>t.length)??[];return void s.classList.add(...r)}s.setAttribute(i,e.getAttribute(r))})}static set(t,e,s){null==s?t.removeAttribute(e):t.setAttribute(e,s)}}class d{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,d.slotFromNode(t)]}),s={};s.default=new DocumentFragment,s.default.append(...t.childNodes);for(const[t,r]of e)t in s||(s[t]=new DocumentFragment),s[t].append(r);return s}static slotFromNode(t){return t instanceof HTMLTemplateElement?document.adoptNode(t.content):t instanceof HTMLScriptElement&&"text/html"===t.type?u.fromHtml(t.innerHTML):t}}class h{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;return null===e?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 h.isParsed(t)?Promise.resolve(t):new Promise(e=>{const s=new MutationObserver(()=>{h.isParsed(t)&&(s.disconnect(),e(t))});for(let e=t.parentNode;e;e=e.parentNode)s.observe(e,{childList:!0});h.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 r of t.children)r.matches(e)&&s.push(r);return s}}class p{#u=new Set;removed(t){return this.#u.has(t)}remove(t){t.replaceChildren?.(),Object.keys(t.dataset||{}).filter(t=>t.startsWith("tpl")).forEach(e=>{delete t.dataset[e]}),this.#u.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.#u)t.remove();this.#u.clear()}}class f{static ORDERED_COMMANDS=["tplIf","tplWith","tplEach","tplWhen","tplClassAppend","tplAttrAppend","tplRemove","tplVerbatim"];static tplIf(t,e,s,r){r.evaluateExpression(e)||s.remove(t)}static tplWith(t,e,s,r){const i=r.evaluateExpression(e),n=s.popData(t,"tplVar"),a=new b(t,r).withOverlay(n?{[n]:i}:i).render();s.replace(t,a)}static tplEach(t,e,s,r){const i=s.popData(t,"tplVar"),n=s.popData(t,"tplStat"),a=new b(t,r),o=r.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 r=i?{[i]: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},r]:[r];s.prepend(t,a.withOverlay(...l).render()),++m}s.remove(t)}static tplWhen(t,e,s,r){r.evaluateExpression(e)||s.remove(t)}static tplVerbatim(t,e,s,r){const i=t.cloneNode(!0);s.replace(t,i)}static tplRemove(t,e,s,r){switch(e.toLowerCase()){case"tag":{const e=u.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,r){const i=r.evaluateExpression(e);if(!i)return;const n=(Array.isArray(i)?i:[i]).flatMap(t=>"string"==typeof t?t.split(" "):t).filter(Boolean);0!==n.length&&t.classList.add(...n)}static tplAttrAppend(t,e,s,r){const i=r.evaluateExpression(e);i&&0!==i.length&&(Array.isArray(i[0])?i:[i]).forEach(([e,s])=>{t.setAttribute(e,s)})}static textNode(t,e,r,i){for(const n of i.evaluateTemplated(e))if(null!=n.value)switch(n.type){case s.dom.t:r.prepend(t,document.createTextNode(n.value));break;case s.dom.h:r.prepend(t,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(t,n.value)}r.remove(t)}}const m=new e(1e3);function g(t){return m.getOrCompute(t,t=>t.substring(3).split(/(?=[A-Z])/).join("-").toLowerCase())}class b{static fromHtml(t,e,...s){return new b(u.fromHtml(t),new l(e,s))}static fromSelector(t,e,...s){const r=document.querySelector(t);if(!(r instanceof HTMLTemplateElement))throw new Error("template selector does not match any template tag");return b.fromTemplate(r,e,...s)}static fromTemplate(t,e,...s){const r=document.adoptNode(t.content);return new b(r,new l(e,s))}static fromFragment(t,e,...s){return new b(t,new l(e,s))}#c;#d;constructor(t,e){this.#c=t,this.#d=e}withEvaluator(t){return new b(this.#c,t)}withFragment(t){return new b(t,this.#d)}withModule(t,e){return new b(this.#c,this.#d.withModule(t,e))}withOverlay(...t){return new b(this.#c,this.#d.withOverlay(...t))}evaluateExpression(t,...e){return this.#d.withOverlay(...e).evaluateExpression(t)}evaluateTemplated(t,...e){return this.#d.withOverlay(...e).evaluateTemplated(t)}evaluator(){return this.#d}render(){try{const t=new p,e=document.importNode(this.#c,!0),s=e.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e:u.from(e),r=document.createNodeIterator(s,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,b.#h);let i;for(;null!==(i=r.nextNode());){if(t.cleanup(),i.nodeType===Node.TEXT_NODE){try{f.textNode(i,i.nodeValue,t,this.#d)}catch(t){throw v.wrap("Error evaluating text node",i,t)}continue}const e=i;for(const s of f.ORDERED_COMMANDS){if(!(s in e.dataset))continue;const r=t.popData(e,s);try{f[s](e,r,t,this.#d)}catch(t){throw v.wrap(`Error evaluating data-tpl-${g(s)}="${r}"`,e,t)}if(t.removed(e))break}for(const s of Object.keys(e.dataset||{})){if(!s.startsWith("tpl"))continue;const r=g(s),i=t.popData(e,s);try{const t=this.#d.evaluateExpression(i);if("boolean"==typeof t){e.toggleAttribute(r,t);continue}null!=t&&e.setAttribute(r,t)}catch(t){throw v.wrap(`Error evaluating data-tpl-${r}="${i}"`,e,t)}}}return t.cleanup(),s}catch(t){if(t instanceof v)throw t;throw new v("Error rendering template",this.#c,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#h(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 v extends Error{static FRAMES=3;#p;#f;truncated=!1;static wrap(t,e,s){return s instanceof v&&s.depth>=v.FRAMES?(s.truncated=!0,s):new v(t,e,s)}constructor(t,e,s){super(`${t} in \`${v.describe(e)}\``,{cause:s}),this.name="RenderError",this.#p=e,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(t){if(t.nodeType===Node.TEXT_NODE)return v.#m(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 v.#m(`<${e.localName}${s}>`)}const e=Array.from(t.childNodes).filter(t=>t.nodeType===Node.ELEMENT_NODE||String(t.nodeValue??"").trim().length>0).map(t=>v.describe(t));return v.#m(e.join(""))}static#m(t){return t.length>120?`${t.slice(0,120)}…`:t}static stringify(t){return u.toHtml(v.#g(t.cloneNode(!0)))}static#g(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&&v.#g(s)}return t}}class y{#b=new Map;#v;#y=new Promise(t=>{this.#v=t});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(t){if(this.#b.has(t))return;const{promise:e,resolve:s}=Promise.withResolvers(),r=h.waitParsed(t).then(()=>t.upgrade()).finally(()=>{this.#b.delete(t),s()});this.#b.set(t,{upgrade:r,finished:e})}async#E(t,e){for(;;){const s=Array.from(this.#b).filter(([e])=>t(e)).map(([,t])=>e(t));if(0===s.length)return;await Promise.all(s)}}settled(){return this.#E(()=>!0,t=>t.finished)}upgraded(t){return this.#E(t,t=>t.upgrade)}whenUpgraded(t){return this.#b.get(t)?.upgrade}pending(){return Array.from(this.#b.keys())}}class w{#x={};#A=!1;#S={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;#C=[];#d=new l(void 0,[]);#_=new y;defineElement(t,e){return this.#A?(this.#O(t,e),this):(this.#x[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:r}=w.declarationsOf(e),{template:i,templates:n,slots:a,mappers:o,config:l}=e,u=s.map(t=>t.split(":")[0]),c=[...new Set(u.reverse())].reverse(),d=[...r,...s].reduce((t,e)=>{const[s,r]=e.split(":"),i=r??"string";if(!(i in this.#S)&&!(i in(o??{})))throw new Error(`unsupported attribute type: ${i}`);return t[s]=o?.[i]??this.#S[i],t},{}),h=Object.entries(Object.assign({},n,i?{default:i}:{})).map(([t,e])=>[t,b.fromHtml(e)]),p=Object.fromEntries(h);e.BITS={registry:this,enqueue:t=>this.#_.enqueue(t),SLOTS:a,CONFIG:l,OBSERVED:c,DECLARED:[...new Set([...c,...r.map(t=>t.split(":")[0])])],ATTR_TO_MAPPER:d,ATTR_TO_PROPERTY:Object.fromEntries(c.map(t=>[t,w.propertyOf(t)])),TEMPLATES:p},customElements.define(t,e)}defineModule(t,e){const s=t?{[t]:e}:e;return this.#s={...this.#s,...s},this.#k(),this}defineModules(t){return this.#s=t,this.#k(),this}defineComponent(t,e){return this.#T[t]=e,this}defineData(...t){return this.#C=t,this.#k(),this}defineOverlay(...t){return this.#C=[...this.#C,...t],this.#k(),this}defineMapper(t,e){return this.#S[t]=e,this}plugin(t){return t.configure(this),this}configure(){for(const[t,e]of Object.entries(this.#x))this.#O(t,e),delete this.#x[t];return this.#A=!0,this}settle(t){return this.#_.upgraded(t)}whenUpgraded(t){return this.#_.whenUpgraded(t)}pending(){return this.#_.pending()}ready(){return this.#_.ready()}#k(){this.#d=new l(this.#s,this.#C)}evaluator(){return this.#d}component(t){return this.#T[t]}}const E=new w;class x{static fromHtml(t){return b.fromHtml(t).withEvaluator(E.evaluator())}static fromSelector(t){return b.fromSelector(t).withEvaluator(E.evaluator())}static fromTemplate(t){return b.fromTemplate(t).withEvaluator(E.evaluator())}static fromFragment(t){return b.fromFragment(t).withEvaluator(E.evaluator())}}class A{static waitFor(t){return E.settle(e=>t.contains(e))}static waitForChildren(t){return E.settle(e=>t!==e&&t.contains(e))}}class S extends HTMLElement{static BITS={registry:E,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;#q=!1;#L=!1;#R=new Set;#N=null;#P={};#M(){return this.constructor.BITS}#F(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.#F(t).unmarshal(e,t,this)}marshal(t,e){return this.#F(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()),r=this.#M().CONFIG;return r?s.withOverlay({config:r}):s}connectedCallback(){this.#L||this.#M().enqueue(this)}attributeChangedCallback(t,e,s){e!==s&&(this.#R.has(t)||(this.#q?this[this.#M().ATTR_TO_PROPERTY[t]]=this.unmarshal(t,s):null!==this.#N&&t in this.#N&&(this.#N[t]=this.unmarshal(t,s))))}async upgrade(){if(this.#L)return;this.#L=!0;const t=this.#M().SLOTS?d.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.#P=Object.fromEntries(Object.entries(e).filter(([t])=>!s.has(t))),this.#N=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.#q=!0,this.internals.states.add("rendered")}finally{this.#N=null}}render(t){}declared(t){return t in this.#P?this.#P[t]:null!==this.#N&&t in this.#N?this.#N[t]:this.unmarshal(t,this.getAttribute(t))}get rendered(){return this.#q}reflectTo(t,e){const s=this.marshal(t,e);if(s!==this.getAttribute(t)){this.#R.add(t);try{c.set(this,t,s)}finally{this.#R.delete(t)}}}}const T=/\{(\w+)\}/g,C=/\{(\d+)\}/g,_=t=>"object"==typeof t&&null!==t&&!Array.isArray(t),O=new Set,k=t=>{O.has(t)||(O.add(t),console.warn(`l10n: ${t}`))},q=new e(100),L=(t,e,s)=>{const r=`${t.name}|${e??""}|${void 0===s?"":JSON.stringify(s)}`;return q.getOrCompute(r,()=>new t(e,s))};class R{static t(t,...e){const s=this.l10n??{};let r=Object.hasOwn(s,t)?s[t]:void 0;if(void 0===r)return k(`missing message "${t}"`),t;const i=1===e.length&&_(e[0])?e[0]:null;if(_(r))if("number"!=typeof i?.count)k(`plural message "${t}" needs a numeric {count}`),r=r.other;else{const t=this.locale??navigator?.language??"en";r=r[L(Intl.PluralRules,t).select(i.count)]??r.other}return void 0===r||"object"==typeof r?(k(`plural message "${t}" has no "other" form`),t):i?r.replace(T,(e,s)=>Object.hasOwn(i,s)?String(i[s]):(k(`message "${t}" wants {${s}}`),e)):e.length>0?r.replace(C,(s,r)=>{const i=Number(r);return i>=e.length?(k(`message "${t}" wants {${r}}`),s):String(e[i])}):r}static date(t,e){return L(Intl.DateTimeFormat,this.locale,e).format(t)}static number(t,e){return L(Intl.NumberFormat,this.locale,e).format(t)}static bytes(t){const e=L(Intl.NumberFormat,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=>E.evaluator().resolve(t),s=s=>(...r)=>s.apply({l10n:e("l10n"),locale:t.locale??e("locale")},r);return{t:s(R.t),date:s(R.date),number:s(R.number),bytes:s(R.bytes),failure:s(R.failure)}}}var N=Object.freeze({__proto__:null,Attributes:c,BoundedCache:e,ExpressionEvaluator:l,Expressions:o,Fragments:u,LightSlots:d,Localization:R,Nodes:h,ParsedElement:S,Registry:w,RenderError:v,Rendering:A,Template:b,Templates:x,registry:E});class P extends Error{constructor(t,e,s){super(t,{cause:s}),this.name="Failure",this.problems=e}dropping(t){return new P(this.message,P.dropProblemsContext(this.problems,t),this)}static dropProblemsContext(t,e){return t.map(({type:t,context:s,reason:r,details:i})=>({type:t,context:s?.startsWith(e)?s.substring(e.length):s,reason:r,details:i}))}}class M{static STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";static URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";static encode(t,e){const s=e||M.URL_SAFE,r=t.byteLength,i=new Uint8Array(t);let n="";for(let t=0;t<r;t+=3)n+=s[i[t]>>2]+s[(3&i[t])<<4|i[t+1]>>4]+s[(15&i[t+1])<<2|i[t+2]>>6]+s[63&i[t+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(t,e){const s=e||M.URL_SAFE;let r=t.length;for(;r>0&&"="===t.charAt(r-1);)--r;const i=t.substring(0,r);if(t.length-r>2||i.includes("=")||0===i.length&&t.length>0)throw new Error("invalid padding");if(i.length%4==1)throw new Error("invalid length");for(const t of i)if(-1===s.indexOf(t))throw new Error(`invalid character '${t}'`);const n=Math.floor(.75*i.length),a=new Uint8Array(n);let o=0,l=0;for(;o<n;){const t=s.indexOf(i.charAt(l++)),e=s.indexOf(i.charAt(l++)),r=s.indexOf(i.charAt(l++)),u=s.indexOf(i.charAt(l++));if(a[o++]=t<<2|e>>4,o===n)break;if(a[o++]=(15&e)<<4|r>>2,o===n)break;a[o++]=(3&r)<<6|u}return a.buffer}}class F{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 r=2*s,i=t.substring(r,r+2);return parseInt(i,16)})}static encode(t,e){return Array.from(t).map(t=>t.toString(16)).map(t=>e?t.toUpperCase():t).map(t=>t.padStart(2,"0")).join("")}}class D{#D;#z;constructor(t,e){this.#D=t,this.#z=e}get normalized(){return`${this.#D}/${this.#z}`}get type(){return this.#D}get subtype(){return this.#z}static parse(t){if(!t)return new D("unknown","unknown");const[e,s]=t.split(";"),[r,i]=e.trim().toLowerCase().split("/");return r&&i?new D(r,i):new D("unknown","unknown")}}class z extends P{constructor(t,e,s,r){super(t,s,r),this.name="HttpClientError",this.status=e}dropping(t){return new z(this.message,this.status,P.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 z(s,0,[z.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(()=>z.#I);if(e===z.#I)return z.#$(t);if(!Array.isArray(e))return z.#$(t,"as a failures array");const s=`${t.status} ${t.statusText}: ${e.length} failures`;return new z(s,t.status,e)}case"application/problem+json":{const e=await t.json().catch(()=>z.#I);if(e===z.#I)return z.#$(t);if("object"!=typeof e||null===e||Array.isArray(e))return z.#$(t,"as a problem object");const s=`${t.status} ${t.statusText}: ${e.title} ${e.detail}`;return new z(s,t.status,e.problems||[z.problem("GENERIC_PROBLEM",s)])}default:return z.#B(t)}}static#I=Symbol("unreadable body");static#$(t,e="as json"){const s=D.parse(t.headers.get("Content-Type")).normalized,r=`${t.status} ${t.statusText}: the ${s} body does not decode ${e}`;return new z(r,t.status,[z.problem("GENERIC_PROBLEM",r)])}static async#B(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 z(s,t.status,[z.problem("GENERIC_PROBLEM",s)])}}const I=t=>globalThis.document?.querySelector(`meta[name="${t}"]`)?.getAttribute("content")??void 0;class ${async intercept(t,e,s){if(t.origin!==(globalThis.window?.location?.origin??t.origin))return await s.proceed(t,e);const r=I("_csrf_header"),i=I("_csrf");return r&&i&&e.headers.set(r,i),await s.proceed(t,e)}}class B{#j;constructor(t){this.#j=t}async intercept(t,e,s){const r=await s.proceed(t,e);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(t){return this.#H.push(new B(t)),this}withInterceptors(...t){return this.#H.push(...t),this}build(){return new V(this.#H)}}class H{async intercept(t,e,s){try{return await fetch(t,e)}catch(t){throw z.of("CONNECTION_PROBLEM",t)}}}class W{#H;#W;constructor(t,e){this.#H=t,this.#W=e}async proceed(t,e){const s=this.#H[this.#W];return await s.intercept(t,e,new W(this.#H,this.#W+1))}}class V{#H;static builder(){return new j}constructor(t){this.#H=t||[]}async exchange(t,e,s){const r=[...this.#H,...s||[],new H],i=new W(r,0),n=new URL(new Request(t).url),a={...e,headers:new Headers(e?.headers)};return await i.proceed(n,a)}request(t,e){return Q.create(this,t,e)}get(t){return Q.create(this,"GET",t)}head(t){return Q.create(this,"HEAD",t)}post(t){return Q.create(this,"POST",t)}put(t){return Q.create(this,"PUT",t)}patch(t){return Q.create(this,"PATCH",t)}delete(t){return Q.create(this,"DELETE",t)}}const U=async(t,e)=>{try{return await t[e]()}catch(t){throw z.of("UNMARSHALING_PROBLEM",t)}},G=t=>null==t?[]:"string"==typeof t?new URLSearchParams(t):"function"==typeof t[Symbol.iterator]?t:Object.entries(t);class Q{#V;#U;#G;#Q;#K;#J;#X;#H;#c;static create(t,e,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(t,e,-1===a?n:n.slice(0,a),new URLSearchParams(-1===a?"":n.slice(a+1)),new Headers,void 0,{},[],i)}constructor(t,e,s,r,i,n,a,o,l=""){this.#V=t,this.#U=e,this.#G=s,this.#Q=r,this.#J=n,this.#K=i,this.#X=a,this.#H=o,this.#c=l}headers(t){for(const[e,s]of G(t))this.header(e,s);return this}header(t,e){return null==e?this.#K.delete(t):this.#K.set(t,e),this}params(t){for(const[e,s]of G(t))null==s?this.#Q.delete(e):this.#Q.set(e,s);return this}param(t,...e){this.#Q.delete(t);for(const s of e.filter(t=>null!=t))this.#Q.append(t,s);return this}body(t){return this.#J=t,this}json(t){if(void 0===t)return this;const e=JSON.stringify(t);return this.#K.set("Content-Type","application/json"),this.#J=e,this}multipart(t){const e=new FormData;return t(new K(e)),this.#J=e,this}options(t){for(const[e,s]of Object.entries(t))this.#X[e]=s;return this}option(t,e){return this.#X[t]=e,this}interceptors(t){for(const e of t)this.#H.push(e);return this}interceptor(t){return this.#H.push(t),this}async exchange(){const t=this.#Q.size?`?${this.#Q}`:"",e={...this.#X,headers:this.#K,method:this.#U,body:this.#J};return await this.#V.exchange(`${this.#G}${t}${this.#c}`,e,this.#H)}async fetch(){try{const t=await this.exchange();if(!t.ok)throw await z.fromResponse(t);return t}catch(t){if(t instanceof P)throw t;throw z.of("UNEXPECTED_PROBLEM",t)}}async fetchText(){const t=await this.fetch();return await U(t,"text")}async fetchJson(){const t=await this.fetch();return 204===t.status?null:await U(t,"json")}async fetchBlob(){const t=await this.fetch();return await U(t,"blob")}async fetchArrayBuffer(){const t=await this.fetch();return await U(t,"arrayBuffer")}}class K{#Y;constructor(t){this.#Y=t}field(t,e){return this.#Y.append(t,e),this}blob(t,e,s){return this.#Y.append(t,e,s),this}blobs(t,e){for(const s of e)this.#Y.append(t,s);return this}json(t,e,s){const r=new Blob([JSON.stringify(e)],{type:"application/json"});return this.#Y.append(t,r,s),this}}var J=Object.freeze({__proto__:null,Base64:M,Failure:P,Hex:F,HttpClient:V,HttpClientBuilder:j,HttpClientError:z,HttpInterceptorChain:W,HttpMultipartRequestCustomizer:K,HttpRequestBuilder:Q,MediaType:D});const X=t=>{const e=e=>{try{t().removeItem(e)}catch{}},s=s=>{let r;try{r=t().getItem(s)}catch{return}if(null!==r)try{return JSON.parse(r)}catch{return void e(s)}};return{save:(e,s)=>{t().setItem(e,JSON.stringify(s))},load:s,remove:e,pop:t=>{const r=s(t);return e(t),r}}},Y=t=>({save(e,s,r){t.save(e,{revision:s,data:r})},load(e,s){const r=t.load(e);if(null!=r&&"object"==typeof r&&r.revision===s)return r.data;t.remove(e)}}),Z=X(()=>localStorage),tt=X(()=>sessionStorage),et=Y(Z),st=Y(tt);class rt{static async fireAsync(t,e,s){t.dispatchEvent(e);const r=e.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 "${e.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${r.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${e.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(t,e,s,r){const i=async t=>{const e=t;e.async||(e.async={promises:[]});const{promise:r,resolve:i,reject:n}=Promise.withResolvers();e.async.promises.push(r);try{i(await s(e))}catch(t){n(t)}};return t.addEventListener(e,i,r),i}static asyncOff(t,e,s,r){t.removeEventListener(e,s,r)}static mixInto(...t){for(const e of t)Object.assign(e.prototype,{async fireAsync(t,e){return await rt.fireAsync(this,t,e)},asyncOn(t,e,s){return rt.asyncOn(this,t,e,s)},asyncOff(t,e,s){rt.asyncOff(this,t,e,s)}})}}class it{static guard(t,e){window.addEventListener("beforeunload",e=>{t()&&e.preventDefault()},{signal:e})}}class nt{#Z=0;take(){return++this.#Z,this.hold()}hold(){const t=this.#Z,e=this;return{get stale(){return t!==e.#Z}}}invalidate(){++this.#Z}}const at=t=>{for(let e=t.parentElement;e;e=e.parentElement)if("function"==typeof e.describedBy)return e;return null};class ot{static sleep(t){return new Promise(e=>setTimeout(e,t))}static debounce(t,e,s){const r=s?.immediate??!1;let i=null,n=[],a=0;const o=()=>{const s=performance.now()-a;t>s?i=setTimeout(o,t-s):(i=null,r||e(...n),null===i&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===i&&(i=setTimeout(o,t),r&&e(...n))},()=>{clearTimeout(i??void 0),i=null,n=[]}]}static throttle(t,e,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,e(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();o||r||(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&&i&&(n=setTimeout(l,c))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class lt{static flatten(t,e,s){return Object.keys(t).reduce((r,i)=>{const n=e.length?`${e}.${i}`:i;return s.has(n)||"object"!=typeof t[i]||null===t[i]?r[n]=t[i]:Object.assign(r,lt.flatten(t[i],n,s)),r},{})}static#tt=new Set(["__proto__","prototype","constructor"]);static providePath(t,e,s){const r=e.split(".").map(t=>/^[0-9]+$/.test(t)?+t:t);for(const t of r)if(lt.#tt.has(t))throw new Error(`unsupported name segment '${t}' in '${e}'`);let i=t??{},n=null;for(let e=0;;++e){const a=r[e],o=r[e-1];if(Number.isInteger(a)&&!Array.isArray(i)&&(null!==n?n[o]=i=[]:t=i=[]),e===r.length-1)return i[a]=void 0!==s?s:a in i?i[a]:null,t;"object"==typeof i[a]&&null!==i[a]||(i[a]={}),n=i,i=i[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#et(t){return"submit"===t.type||"reset"===t.type||"button"===t.type}static extractFrom(t,e){let s={};for(const r of t.elements)r.hasAttribute("name")&&(lt.#et(r)&&r!==e||r.matches(":disabled")&&r!==e||(s=lt.providePath(s,r.getAttribute("name"),lt.extract(r))));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=lt.#st(t);for(const[t,r]of Object.entries(lt.flatten(e,"",new Set(s.keys()))))for(const e of s.get(t)??[])lt.mutate(e,r)}static#st(t){const e=new Map;for(const s of t.elements){const t=s.getAttribute("name");if(!t)continue;const r=e.get(t);r?r.push(s):e.set(t,[s])}return e}static errors(t,e,s){const r=e=>e.closest("form")===t;Array.from(t.querySelectorAll("ful-field-error")).filter(r).forEach(t=>{t.setAttribute("aria-live",s?"off":"polite")});const i=t=>("FIELD_ERROR"===t.type||"INVALID_FORMAT"===t.type)&&t.context,n=e.filter(i),a=e.filter(t=>!i(t)),o=lt.#st(t);for(const t of o.values())t.forEach(t=>{t.setCustomValidity?.("")});const l=[];n.forEach(t=>{const e=t.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=e.length;0!==s;--s){const r=e.slice(0,s).join("."),i=o.get(r)??[];if(0===i.length)continue;const n=e.slice(s).join(".");return void i.forEach(e=>{e.setCustomValidity?.(t.reason,n)})}l.push(t)});const u=[...a,...l];t.querySelectorAll("ful-errors").forEach(t=>{if(!r(t))return;const e=t;if(t.setAttribute("role","alert"),0===u.length)return t.replaceChildren(),void t.setAttribute("hidden","");t.removeAttribute("hidden"),e.innerText=u.map(t=>t.reason).join("\n")}),0!==e.length&&s&&Array.from(t.elements).filter(t=>t.matches(":invalid")).sort((t,e)=>t.getBoundingClientRect().y-e.getBoundingClientRect().y)[0]?.focus()}}class ut extends S{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#rt;#it=null;#nt;#at=[];#ot=null;#lt;#ut;#ct;#dt=[];constructor(){super(),this.internals.role=this.constructor.ROLE}#ht(){return[this.#ut??this.#rt,...this.#dt].filter(t=>t)}#pt({fragment:t,control:e,error:s,label:r=null,described:i=null,claims:n=null,announces:a=e,freeze:o=null,also:l=[]}){if(this.#rt=e,this.#lt=s,this.#ut=n,this.#ct=a,this.#dt=l,o&&o.addEventListener("click",t=>{this.readonly&&t.preventDefault()},!0),this.#nt=i??e,s&&(s.id=s.id||c.uid("ful-field-error"),this.#ot=s.id),this.#ft(),r&&ut.#mt(this,r,e),this.addEventListener("keydown",t=>{if("Enter"!==t.key||t.defaultPrevented||t.isComposing)return;const e=t.target;e.form!==this.form&&ut.#gt(e)&&this._requestSubmit()}),this.replaceChildren(t),null!==this.#it){const t=this.#it;this.#it=null,e.focus(t)}}static#gt(t){return t instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(t.type)}describedBy(t){return!!t&&(t.id||(t.id=c.uid("ful-described")),this.#at.includes(t.id)||this.#at.push(t.id),this.#ft(),!0)}#ft(){if(!this.#nt)return;const t=[...this.#at,this.#ot].filter(t=>t);t.length&&this.#nt.setAttribute("aria-describedby",t.join(" "))}focus(t){this.#rt?this.#rt.focus(t):this.#it=t??{}}setCustomValidity(t,e){if(c.set(this.#ct??this.#rt,"aria-invalid",t?"true":null),!t)return this.internals.setValidity({}),void(this.#lt.innerText="");this.internals.setValidity({customError:!0}," "),this.#lt.innerText=t}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#bt=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#mt(t,e,s){if(!ut.#bt.has(s.tagName)||"hidden"===s.getAttribute("type"))return e.id||(e.id=c.uid("ful-label")),s.setAttribute("aria-labelledby",e.id),void e.addEventListener("click",()=>t.focus());s.id||(s.id=c.uid("ful-control")),e.setAttribute("for",s.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}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.#ht())e.toggleAttribute("disabled",t)}get readonly(){return this.hasAttribute("readonly")}set readonly(t){for(const e of this.#ht())e.readOnly=t;this.#ct&&c.set(this.#ct,"aria-readonly",t?"true":null),this.reflectTo("readonly",t)}get required(){return this.hasAttribute("required")}set required(t){this.#ct&&c.set(this.#ct,"aria-required",t?"true":null),this.reflectTo("required",t)}render(t){const e=this._build(t);if(e instanceof Promise)return e.then(t=>this.#pt(t));this.#pt(e)}_build(t){throw new Error(`${this.constructor.name} must implement _build`)}}class ct{#vt;#yt;#U;#wt;#Et;constructor(t,e,s,r,i){this.#vt=t,this.#yt=e,this.#U=s,this.#wt=r,this.#Et=i}prepare(t,e){return this.#wt(t,e)}async submit(t,e){return await this.#vt.request(this.#U,this.#yt).json(t).fetch()}transform(t,e){return this.#Et(t,e)}}class dt{#wt;#Et;constructor(t,e){this.#wt=t,this.#Et=e}async prepare(t,e){return await this.#wt(t,e)}async submit(t,e,s){return s}async transform(t,e){return await this.#Et(t,e)}}class ht{static create(t,e){const s=t.component("http-client"),r=t.declared("request-mapper")?t.component(t.declared("request-mapper")):t=>t,i=t.declared("response-mapper")?t.component(t.declared("response-mapper")):t=>t,n=t.declared("action");if(!n)return new dt(r,i);const a=t.declared("method")??"POST";return new ct(s,n,a,r,i)}}const pt=t=>void 0!==t.form?t.form:t.constructor?.formAssociated?t.internals?.form:void 0;class ft extends S{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",""),c.forward("form-",this,t),c.set(t,"autocomplete",this.declared("autocomplete")),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=>{pt(t.target)===this.form&&t.target.setCustomValidity?.("")}),this.replaceChildren(t),this.#xt=this.declared("track-changes")||this.declared("guard-leave"),this.#xt&&(this.addEventListener("input",t=>this.#At(t.target)),this.addEventListener("change",t=>this.#At(t.target)),this.addEventListener("focusin",t=>this.#St(t.target)),A.waitForChildren(this).catch(()=>{}).then(()=>this.commit()),this.#Tt())}connectedCallback(){super.connectedCallback(),this.#xt&&this.#Tt()}disconnectedCallback(){this.#Ct?.abort(),this.#Ct=null}#_t=!1;async submit(t){if(this.#_t)return;let e,s;this.#_t=!0,this.spinner(!0);try{const r=this.component(this.declared("loader")??"loaders:form").create(this);e=lt.extractFrom(this.form,t);const i=this.#xt?{saved:this.#Ot(),upTo:this.#kt}:null;s=await r.prepare(e,this);const n=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:t,values:e,request:s}});if(!this.dispatchEvent(n))return;this.errors=[];const a=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:n.detail.values,request:n.detail.request}});let o=await rt.fireAsync(this,a,{mode:"pipeline"});s=a.detail.request,o=await r.submit(s,this,o);const l=await r.transform(o,this);i&&this.#qt(i.saved,i.upTo),this.dispatchEvent(new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,response:l}}))}catch(r){this.dispatchEvent(new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:t,values:e,request:s,exception:r}})),r instanceof P?this.errors=r.problems:console.warn("failed to submit form",this,"reason:",r)}finally{this.#_t=!1,this.spinner(!1)}}reset(){if(this.form.reset(),this.#xt){for(const t of new Set([...this.#Lt.keys(),...this.#Ot().keys()]))this.#Rt.set(t,++this.#kt);this.#Nt()}}#Lt=new Map;#Pt=new Map;#Rt=new Map;#kt=0;#Mt=!1;#Ft=0;#Ct=null;#xt=!1;get dirty(){if(!this.#xt)return!1;for(const t of this.#Rt.keys()){const e=this.#Dt(t);if((this.#Lt.has(t)||"[]"!==e)&&(this.#Lt.get(t)??this.#Pt.get(t))!==e)return!0}return!1}commit(){this.#xt&&this.#qt(this.#Ot(),this.#kt)}edited(t){this.#At(t)}#qt(t,e){this.#Lt=t;for(const[t,s]of this.#Rt)s<=e&&this.#Rt.delete(t);for(const e of this.#Pt.keys())t.has(e)&&this.#Pt.delete(e);this.#Nt()}#zt(t){for(let e=t;e&&e!==this;e=e.parentElement)if(pt(e)===this.form&&e.hasAttribute("name"))return e.getAttribute("name");return null}#At(t){if(!this.#xt)return;const e=this.#zt(t);null!==e&&(this.#Rt.set(e,++this.#kt),0===this.#Ft&&(this.#Ft=requestAnimationFrame(()=>this.#Nt())))}#St(t){const e=this.#zt(t);null===e||this.#Lt.has(e)||this.#Pt.has(e)||this.#Pt.set(e,this.#Dt(e))}#It(){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.#It()){const s=e.getAttribute("name");t.set(s,[...t.get(s)??[],lt.extract(e)])}return new Map(Array.from(t,([t,e])=>[t,JSON.stringify(e)]))}#Dt(t){return JSON.stringify(this.#It().filter(e=>e.getAttribute("name")===t).map(t=>lt.extract(t)))}#Nt(){cancelAnimationFrame(this.#Ft),this.#Ft=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.#Mt&&(this.#Mt=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}})))}#Tt(){this.declared("guard-leave")&&!this.#Ct&&(this.#Ct=new AbortController,it.guard(()=>this.dirty,this.#Ct.signal))}#$t=0;#Bt(t){if(c.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.#$t,1!==this.#$t)return}else if(this.#$t=Math.max(0,this.#$t-1),0!==this.#$t)return;c.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.#Bt(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;c.set(s,"aria-disabled",s.dataset.wd||null),delete s.dataset.wd}})}set values(t){lt.mutateIn(this.form,t)}get values(){return lt.extractFrom(this.form)}set errors(t){lt.errors(this.form,t,this.declared("scroll-on-error"))}}const mt=new e(100),gt=(t,e)=>mt.getOrCompute(`${t}:${e}`,()=>{try{return new RegExp(e,"g")}catch(s){return console.warn(`invalid ${t} attribute`,e,s),null}}),bt={numeric:"numeric",decimal:"decimal"},vt=new Set(["date","time","datetime-local","month","week"]),yt={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 wt extends ut{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;#jt=[];_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:t}){const e=this._type(),s=bt[e],r=s?"text":e,i=this.template().withOverlay({type:r,slots:t}).render();this.#jt=[...i.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#jt[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=gt("keep",e);return t&&(e=>(e.match(t)??[]).join(""))}if(null!==s){const t=gt("reject",s);return t&&(e=>e.replace(t,""))}return((t,e)=>{const s=yt[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.#jt)this.#Ht(t,s,n,a);return{fragment:i,control:this._input,error:i.querySelector("ful-field-error"),label:i.querySelector("label")}}#Ht(t,e,s,r){e&&c.set(t,"inputmode",e),c.set(t,"autocomplete",s);const i=t.id;c.forward("input-",this,t),t!==this._input&&c.set(t,"id",i||null),this.#Wt(t),t.addEventListener("input",()=>{if(!r)return;const e=t.value,s=r(e);if(e===s)return;const i=t.selectionStart;if(t.value=s,null===i)return;const n=r(e.slice(0,i)).length;t.setSelectionRange(n,n)})}#Wt(t){if(!vt.has(t.type))return void t.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()});let e=null,s=!1;const r=()=>{s=!1;const t=JSON.stringify(this.value);t!==e&&(e=t,this._notifyChange())};t.addEventListener("focus",()=>{e=JSON.stringify(this.value)}),t.addEventListener("keydown",t=>{"Enter"!==t.key||t.isComposing?s=!0:r()}),t.addEventListener("blur",r),t.addEventListener("change",t=>{t.stopPropagation(),s||r()})}get value(){const t=this.declared("uppercase"),e=this.declared("trim"),s=this._input.value,r=t?s.toUpperCase():s,i=e?r.trim():r;if(""===i)return null;const n="decimal"===this._type()?i.replaceAll(",","."):i;if("number"===this.declared("v-type")){const t=Number(n);return Number.isNaN(t)?n:t}return n}set value(t){this._input.value=""===t||null==t?"":`${t}`}get placeholder(){const t=this._input.getAttribute("placeholder");return" "===t?null:t}set placeholder(t){for(const e of this.#jt)c.set(e,"placeholder",t??" ");this.reflectTo("placeholder",t)}}const Et=t=>""===t?null:t;class xt extends S{static attributes=["locale","default"];render(){const t=this.textContent.trim(),[e,s,r]=t.split("-").map(Number),i=""===t?null:new Date(e,s-1,r);if(null===i||Number.isNaN(i.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:n}=R.of({locale:this.declared("locale")??void 0});this.replaceChildren(n(i,{year:"numeric",month:"numeric",day:"numeric"}))}}class At extends S{static attributes=["locale","default"];render(){const t=this.textContent.trim(),e=""===t?null:new Date(At.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#Vt(t){return/^\d{4}-\d{2}-\d{2}$/.test(t)?new Date(`${t}T00:00:00`):new Date(t)}static isoToLocal(t){const e=At.#Vt(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=At.#Vt(t);return Number.isNaN(e.getTime())?null:e.toISOString()}}class St extends wt{static observed=["step","min","max"];_type(){return"date"}get min(){return Et(this._input.min)}set min(t){this._input.min=St.#Ut(t)}get max(){return Et(this._input.max)}set max(t){this._input.max=St.#Ut(t)}get step(){return Et(this._input.step)}set step(t){this._input.step=t??""}static#Ut(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 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 t=n.getDate();n.setMonth(n.getMonth()+i*r),n.getDate()!==t&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+i*r)}return e(n)}}class Tt extends St{_type(){return"time"}get min(){return Et(this._input.min)}set min(t){this._input.min=this.#Gt(t)}get max(){return Et(this._input.max)}set max(t){this._input.max=this.#Gt(t)}#Gt(t){if(!t)return"";const e=new Date;if("now"!==t){const s=/^([+-])(\d+)([hm])$/.exec(t);if(!s)return t;const r="-"===s[1]?-1:1,i=+s[2]*r;"h"===s[3]?e.setHours(e.getHours()+i):e.setMinutes(e.getMinutes()+i)}return Tt.#Qt(e,Number(this._input.step)||60)}static#Qt(t,e){const s=t=>String(t).padStart(2,"0"),r=3600*t.getHours()+60*t.getMinutes()+t.getSeconds(),i=Math.floor(r/e)*e,n=s(Math.floor(i/3600)),a=s(Math.floor(i%3600/60));return e%60==0?`${n}:${a}`:`${n}:${a}:${s(i%60)}`}}class Ct extends wt{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){return At.localToIso(this._input.value)}set value(t){super.value=t?At.isoToLocal(t):""}get min(){return At.localToIso(this._input.min)}set min(t){this._input.min=t?At.isoToLocal(t):""}get max(){return At.localToIso(this._input.max)}set max(t){this._input.max=t?At.isoToLocal(t):""}get step(){return Et(this._input.step)}set step(t){this._input.step=t??""}}class _t extends wt{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","max-files:number","max-file-size:number","max-total-size:number","value"];#Kt;#Jt;#Xt;#Yt;#Zt;_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>"};#te;_build(t){const e=super._build(t),s=e.fragment;return this.#Jt=s.querySelector("ful-item-list"),this.#te=t.slots?.items&&!u.isBlank(t.slots.items)?x.fromFragment(t.slots.items):null,this.#Xt=s.querySelector("[data-ref=dropzone]"),this.#Yt=s.querySelector("ful-field-warnings"),this.#Zt=s.querySelector("ful-control-group"),this.#Yt.addEventListener("animationend",t=>{t.target.remove()}),this.#Jt.addEventListener("click",t=>{if(!t.target.closest("button"))return;if(!this._interactive())return;const e=[...this.#Jt.children].indexOf(t.target.closest("ful-item"));-1!==e&&(this.files=_t.list([...this.files].filter((t,s)=>s!==e)),this._notifyChange())}),this.#Xt.addEventListener("click",t=>{this._interactive()&&this._input.click()}),this.#Xt.addEventListener("dragover",t=>{t.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#Xt.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#Xt.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=_t.list(e),this._notifyChange())}),this._input.addEventListener("change",t=>{this.#ee()}),{...e,freeze:this.#Zt}}#ee(){this.setCustomValidity(),this.#Yt.replaceChildren(),this.#se(),this.#re(),this.#ie(),this.#ne(),(this.#te??this.template("items")).withOverlay({files:this.files}).renderTo(this.#Jt)}warning(t,e){this.template("warning").withOverlay({key:t,args:e}).appendTo(this.#Yt);const s=this.#Yt.lastElementChild;setTimeout(()=>s.remove(),_t.WARNING_TIMEOUT)}#ae(t){const e=t.name.toLowerCase();return this.#Kt.some(s=>{const r=s.toLowerCase().split(";")[0].trim();return r.startsWith(".")?e.endsWith(r):r.endsWith("/*")?t.type.startsWith(`${r.slice(0,-1)}`):r.includes("/")&&t.type===r})}#se(){if(!this.#Kt.length)return;const t=[...this.files].filter(t=>!this.#ae(t));0!==t.length&&(this.warning("files.unacceptable-file-type",{types:this.#Kt.join(", ")}),this._input.files=_t.list([...this.files].filter(e=>!t.includes(e))))}#ne(){null!==this.#oe&&(this.files.length<=this.#oe||(this.warning("files.max-files-exceeded",{count:this.#oe}),this._input.files=_t.list()))}#re(){if(null===this.#le)return;const t=[...this.files].filter(t=>t.size>this.#le);0!==t.length&&(this.warning("files.max-file-size-exceeded",{size:R.of().bytes(this.#le)}),this._input.files=_t.list([...this.files].filter(e=>!t.includes(e))))}#ie(){null!==this.#ue&&([...this.files].reduce((t,e)=>t+e.size,0)<=this.#ue||(this.warning("files.max-total-size-exceeded",{size:R.of().bytes(this.#ue)}),this._input.files=_t.list()))}get accept(){return this.#Kt}set accept(t){this._input.accept=t.join(","),this.#Kt=t,this.reflectTo("accept",t)}get multiple(){return this._input.multiple}set multiple(t){this._input.multiple=t,this.reflectTo("multiple",t)}get files(){return this._input.files}set files(t){this._input.files=t,this.#ee()}get file(){return this.files[0]??null}set file(t){this.files=_t.list(t?[t]:[])}get value(){const t=Array.from(this._input.files).map(t=>t.name);return this.multiple?t:t[0]??null}set value(t){t||(this.files=_t.list())}formResetCallback(){this.value=null}get totalsize(){return Array.from(this.files).reduce((t,e)=>t+e.size,0)}#oe;get maxFiles(){return this.#oe}set maxFiles(t){this.#oe=t,this.reflectTo("max-files",t)}#le;get maxFileSize(){return this.#le}set maxFileSize(t){this.#le=t,this.reflectTo("max-file-size",t)}#ue;get maxTotalSize(){return this.#ue}set maxTotalSize(t){this.#ue=t,this.reflectTo("max-total-size",t)}#ce;get itemList(){return this.#ce}set itemList(t){this.#ce=t,this.reflectTo("item-list",t)}#de;get dropzone(){return this.#de}set dropzone(t){this.#de=t,this.reflectTo("dropzone",t)}}const Ot=new Map;let kt=0,qt=!1;const Lt=(t,e,s)=>Math.min(Math.max(t,e),Math.max(e,s)),Rt=(t,e)=>{const{invoker:s,stretch:r}=e,i=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",r){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(i.width,a-16)}px`,t.style.maxWidth=`${e}px`;const s=t.getBoundingClientRect().width;t.style.left=`${Lt(i.left,8,a-s-8)}px`;const r=t.getBoundingClientRect().height,n=i.bottom+u,c=n+r<=o-8?n:i.top-d-r;return void(t.style.top=`${Lt(c,8,o-r-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?i.right+h:"left"===f?i.left-c-g:p?i.left+i.width/2-g/2:i.left;b=Lt(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?i.top-d-v:"right"===f||"left"===f?i.top+i.height/2-v/2:i.bottom+u;t.style.top=`${Lt(y,8,o-v-8)}px`,p&&((t,e)=>{const s=e.getBoundingClientRect(),r=t.getBoundingClientRect();t.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-r.left-t.clientLeft+"px"),t.style.setProperty("--ful-note-callout-block",s.top+s.height/2-r.top-t.clientTop+"px")})(t,s)},Nt=()=>{kt=0;for(const[t,e]of Ot)t.isConnected&&e.invoker.isConnected?Rt(t,e):Ot.delete(t)},Pt=()=>{!kt&&Ot.size>0&&(kt=requestAnimationFrame(Nt))};class Mt{static wire(t,e,{prefix:s="ful-anchor",invoke:r=!1,expanded:i=!1,stretch:n=!1,handPlace:a=!1}={}){const o=c.uid(s);r&&(e.id=e.id||o,"button"===t.localName||"input"===t.localName?t.setAttribute("popovertarget",e.id):(t.addEventListener("click",()=>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,i&&(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")&&Rt(t,e),t.style.removeProperty("visibility")})})(e,u)}),e.addEventListener("toggle",t=>{"open"===t.newState?(Ot.set(e,u),Rt(e,u)):(Ot.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))}),qt||(qt=!0,document.addEventListener("scroll",Pt,!0),window.addEventListener("resize",Pt))}static show(t,e,{flip:s=!1,gap:r=0}={}){return"function"!=typeof t.showPopover||t.matches(":popover-open")||t.showPopover(),(()=>{const i=e instanceof Element?e.getBoundingClientRect():e,n=document.documentElement,a=t.getBoundingClientRect(),o=i.bottom+r,l=i.top-r-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=`${Lt(i.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,t.style.top=`${Lt(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),t}}const Ft=(t,e)=>t.filter(({key:t})=>e.some(e=>e==t)),Dt=(t,e)=>t.filter(({label:t})=>(t??"").toLowerCase().includes(e?.toLowerCase()??""));class zt{#vt;#yt;#U;#Et;#he;#pe;#C=null;#fe=null;#me=new nt;constructor({http:t,url:e,method:s,responseMapper:r,prefetch:i,revision:n}){this.#vt=t,this.#yt=e,this.#U=s,this.#Et=r,this.#he=i,this.#pe=n}async prefetch(){this.#he&&await this.#ge()}async exact(...t){return Ft(await this.#ge(),t)}async load(t){return Dt(await this.#ge(),t)}async invalidate(){this.#me.invalidate(),this.#C=null,this.#fe=null}async#ge(){if(null===this.#C){if(null===this.#fe){const t=this.#me.hold();this.#fe=zt.#be(this.#vt,this.#U,this.#yt,this.#pe).then(e=>{t.stale||(this.#C=this.#Et(e))}).finally(()=>{t.stale||(this.#fe=null)})}await this.#fe}if(null===this.#C)throw new Error("superseded by an invalidation");return this.#C}static async#be(t,e,s,r){const i=`${e}@${s}`;if(null!==r){const t=et.load(i,r);if(void 0!==t)return t}const n=await t.request(e,s).fetchJson();if(null!==r)try{et.save(i,r,n)}catch(t){console.warn("failed to cache the select options",t)}return n}}class It{#vt;#yt;#U;#Et;constructor({http:t,url:e,method:s,responseMapper:r}){this.#vt=t,this.#yt=e,this.#U=s,this.#Et=r}async invalidate(){}async exact(...t){const e=await this.#vt.request(this.#U,this.#yt).param("k",...t).fetchJson();return this.#Et(e)}async load(t){const e=await this.#vt.request(this.#U,this.#yt).param("s",t).fetchJson();return this.#Et(e)}}class $t{#C;constructor(t){this.#C=t}update(t){this.#C=t}async invalidate(){}exact(...t){return Ft(this.#C,t)}load(t){return Dt(this.#C,t)}}class Bt{static from({data:t,http:e,url:s,method:r="POST",mode:i,prefetch:n=!1,revision:a=null,responseMapper:o}){return s?"chunked"===i?new It({http:e,url:s,method:r,responseMapper:o}):new zt({http:e,url:s,method:r,responseMapper:o,prefetch:n,revision:a}):new $t(t??[])}static create(t,e){if(!t.declared("src")){const t=Array.from(e.options?.querySelectorAll("option")??[]);return Bt.from({data:t.map(t=>({key:t.getAttribute("value")??t.innerText.trim(),label:t.innerText.trim(),metadata:void 0}))})}return Bt.from({http:t.component("http-client"),url:t.declared("src"),method:t.declared("method")??"POST",mode:t.declared("mode"),prefetch:t.declared("preload"),revision:Bt.#ve(t),responseMapper:Bt.#ye(t)})}static#ve(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#ye(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 jt 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 <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 '};#we;#Ee;#xe;#Ae;#X=new Map;#Se=new nt;render({slots:t}){const e=this.template().render();this.#Ae=u.isBlank(t.default)?this.template("options"):x.fromFragment(t.default),this.#we=e.querySelector("ful-spinner"),this.#xe=e.querySelector("[data-ref=empty]"),this.#Ee=e.querySelector("menu"),this.#Ee.id=this.declared("listbox")||c.uid("ful-listbox"),this.#Ee.addEventListener("mousedown",t=>{t.target.closest("li")&&t.preventDefault()}),this.#Ee.addEventListener("click",t=>{t.stopPropagation();const e=t.target.closest("li");e?e.matches('[aria-disabled="true"]')||this.#Te(e):this.hide()}),this.replaceChildren(e)}#Ce(){return this.#Ee?.querySelector('[selected]:not([aria-disabled="true"])')??this.#Ee?.querySelector('li:not([aria-disabled="true"])')??null}#_e(t){if(t){for(const e of this.#Ee.querySelectorAll("li"))e.toggleAttribute("selected",e===t);t.id||=c.uid("ful-option"),this.#Oe(t.id),t.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#Oe(null)}acceptSelection(){const t=this.#Ce();t&&this.#Te(t)}update(t,e=[]){if(void 0===t)throw new Error("null data");this.#X=new Map(t.map((t,e)=>[String(e),t]));const s=t.map((t,e)=>({index:e,...t}));this.#Ae.withOverlay(s).renderTo(this.#Ee);for(const[s,r]of[...this.#Ee.children].entries()){const i=t[s],n=e.some(t=>t==i?.key);r.toggleAttribute("picked",n),r.setAttribute("aria-selected",n?"true":"false");const a=!!i?.metadata?.disabled;a?r.setAttribute("aria-disabled","true"):r.removeAttribute("aria-disabled"),a&&i.metadata.reason?r.setAttribute("title",String(i.metadata.reason)):r.removeAttribute("title")}this.#xe.toggleAttribute("hidden",0!==t.length),this.#Ee.toggleAttribute("hidden",0===t.length);const r=t.findIndex(({key:t})=>e.some(e=>e==t));this.#_e(r>=0?this.#Ee.children[r]:this.#Ce())}#Te(t){const e=t.getAttribute("value"),s=this.#X.get(e);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:e,entry:s}}))}hide(){this.#Se.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#Oe(null)}#Oe(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.#Se.take();this.matches(":popover-open")||this.showPopover(),this.#Ee.setAttribute("hidden",""),this.#we.removeAttribute("hidden");try{const r=await t();if(s.stale)return;this.update(r,e)}catch(t){if(s.stale)return;throw this.hide(),t}finally{s.stale||this.#we.setAttribute("hidden","")}}async moveOrShow(t,e,s=[]){if(this.shown){const e=this.#Ce(),s=e?.[(t?"next":"previous")+"ElementSibling"],r=s?this.#ke(s,t):null;return void(e&&r&&this.#_e(r))}await this.show(e,s)}#ke(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){const e=t?this.#Ee.firstElementChild:this.#Ee.lastElementChild,s=this.#ke(e,t);s&&this.#_e(s)}page(t){const e=this.#Ce();if(!e)return;let s=e;for(let e=0;e!==this.#qe();++e){const e=this.#ke(s[(t?"next":"previous")+"ElementSibling"],t);if(!e)break;s=e}this.#_e(s)}#qe(){const t=this.#Ee.firstElementChild;return t&&0!==t.offsetHeight?Math.max(1,Math.trunc(this.#Ee.clientHeight/t.offsetHeight)):1}}class Ht extends ut{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 '};#Le;#Re={src:null,method:null};#X;#rt;#Ne;#Pe;#Jt;#te;#Me;#Fe=!1;#De=new Map;#ze=new nt;#Ie=!1;#$e;#Be;_build({slots:t}){const e=this.declared("name");this.#X=t.options,this.#je(),this.#Me=this.declared("multiple"),this.#Le.prefetch?.()?.catch(t=>{console.warn("failed to prefetch select options",this,"reason:",t)});const s=this.template().withOverlay({slots:t,name:e}).render();this.#Pe=s.querySelector("ful-control > input"),this.#Jt=s.querySelector("ful-item-list"),this.#te=t.items&&!u.isBlank(t.items)?x.fromFragment(t.items):null,c.forward("input-",this,this.#Pe),this.#rt=s.querySelector("ful-control"),this.#Ne=s.querySelector("ful-dropdown");const r=c.uid("ful-listbox");this.#Ne.setAttribute("listbox",r),this.#Pe.setAttribute("aria-controls",r),this.#Ne.addEventListener("beforetoggle",t=>{const e="open"===t.newState;this.#Pe.setAttribute("aria-expanded",e?"true":"false"),e||this.#Pe.removeAttribute("aria-activedescendant")}),this.#Ne.addEventListener("activechange",t=>{c.set(this.#Pe,"aria-activedescendant",t.detail.id)});const i=s.querySelector("ful-control-group");return Mt.wire(i,this.#Ne,{prefix:"ful-select",stretch:!0}),[this.#$e,this.#Be]=ot.throttle(400,()=>this.#He()),this.#We(),this.#Ve(),this.#Ue(),this.#Ge(),{fragment:s,control:this.#Pe,error:s.querySelector("ful-field-error"),label:s.querySelector("label")}}#We(){this.addEventListener("click",t=>{if(!this._interactive())return;const e=t.target.closest('button, [role="button"], a[href], input, select, textarea');e&&e!==this.#Pe||(this.#Ne.shown?this.#Qe():(this.#Pe.focus(),this.#$e()))}),this.#Jt.addEventListener("click",t=>{t.stopPropagation(),t.target.closest("button")&&this._interactive()&&this.#Ke([...this.#Jt.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.#Je(e))})}#Ve(){this.addEventListener("keydown",t=>{const e=t.target instanceof Element?t.target.closest("ful-badge"):null;e?this.#Xe(t,e):"ArrowLeft"===t.code&&t.target===this.#Pe&&0===this.#Pe.selectionStart&&0===this.#Pe.selectionEnd&&this.#Ye().at(-1)?.focus()})}#Ue(){this.#Pe.addEventListener("change",t=>{t.stopPropagation()}),this.#Pe.addEventListener("focus",()=>{this.#Ie||this.#Pe.select()}),this.#Pe.addEventListener("blur",t=>{t.stopPropagation(),t.relatedTarget&&this.contains(t.relatedTarget)||(this.#Be(),this.#Qe(!0))}),this.#Pe.addEventListener("keydown",t=>{this._interactive()&&this.#Ze(t)}),this.#Pe.addEventListener("input",t=>{t.stopPropagation(),this._interactive()&&(this.#Ie=!0,this.#$e())})}#Ge(){this.#Ne.addEventListener("change",t=>{t.stopPropagation(),this._interactive()?(this.#Me||this.#De.clear(),this.#Ie=!1,this.#De.set(this.#ts(t.detail.entry.key),t.detail.entry),this.#es(),this.#Pe.focus(),this.#Ne.hide(),this.#Me||this.#Pe.select()):this.#Qe()})}async withLoader(t){return await t(this.#Le)}async reload(){await(this.#Le.invalidate?.()),await(this.#Le.prefetch?.());const t=[...this.#De.keys()];0!==t.length&&await this.#i(t,this.#ze.take())}get src(){return this.getAttribute("src")}set src(t){this.reflectTo("src",t??null),this.#ss()&&this.reload()}get method(){return this.getAttribute("method")}set method(t){this.reflectTo("method",t??null),this.#ss()&&this.reload()}async reconfigure(t,{notify:e=!1}={}){for(const e of["src","method"])e in t&&this.reflectTo(e,t[e]??null);this.#ss();const s=[...this.#De.keys()];await this.reload();const r=[...this.#De.keys()];e&&r.length!==s.length&&this._notifyChange({entry:this.entry})}#je(){this.#Re={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Le=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#X})}#ss(){return(this.getAttribute("src")!==this.#Re.src||this.getAttribute("method")!==this.#Re.method)&&(this.#Be(),this.#Qe(),this.#je(),!0)}#Ye(){return Array.from(this.#rt.querySelectorAll(":scope > ful-badge"))}#Je(t){this._interactive()&&this.#Ke(this.#Ye().indexOf(t))}#Ke(t){const e=Array.from(this.#De.keys())[t];void 0!==e&&(this.#De.delete(e),this.#es())}#Xe(t,e){switch(t.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":t.preventDefault(),this.#Je(e),this.#Pe.focus();break;case"ArrowLeft":t.preventDefault(),(this.#Ye()[this.#Ye().indexOf(e)-1]??this.#Pe).focus();break;case"ArrowRight":t.preventDefault(),(this.#Ye()[this.#Ye().indexOf(e)+1]??this.#Pe).focus();break;case"Escape":this.#Pe.focus()}}#Ze(t){switch(t.code){case"ArrowUp":case"ArrowDown":t.preventDefault(),this.#rs(t);break;case"Home":this.#Ne.shown&&(t.preventDefault(),this.#Ne.jump(!0));break;case"End":this.#Ne.shown&&(t.preventDefault(),this.#Ne.jump(!1));break;case"PageDown":case"PageUp":this.#Ne.shown&&(t.preventDefault(),this.#Ne.page("PageDown"===t.code));break;case"Escape":this.#Be(),this.#Qe();break;case"NumpadEnter":case"Enter":if(!this.#Ne.shown)return;t.preventDefault(),this.#Ie=!1,this.#is(),this.#Ne.acceptSelection();break;case"Backspace":0===this.#Pe.selectionStart&&0===this.#Pe.selectionEnd&&this.#Ke(this.#De.size-1);break;case"Tab":this.#Be(),this.#Qe(!0)}}#rs(t){const e="ArrowDown"===t.code;t.altKey?e&&!this.#Ne.shown?this.#He():!e&&this.#Ne.shown&&this.#Qe():this.#Ne.moveOrShow(e,()=>this.#Le.load(this.#ns()),[...this.#De.keys()])}#Qe(t=!1){this.#Ne.hide();const e=t&&this.#Ie&&!this.#Me&&""===this.#Pe.value&&0!==this.#De.size;this.#Ie=!1,e&&(this.#De.clear(),this.#es()),this.#is()}#He(){return this.#Ne.show(()=>this.#Le.load(this.#ns()),[...this.#De.keys()])}#ns(){return this.#Ie?this.#Pe.value:""}get query(){return this.#ns()}#is(){const t=this.#De.values().next().value;this.#Pe.value=this.#Me?"":t?.label??""}#as(){return[...this.#De.values()]}#es(){this.#os(),this._notifyChange({entry:this.entry})}#os(){const t=this.#Me?Array.from(this.#De.entries()).map(([t,e],s)=>{const r=document.createElement("ful-badge");return r.setAttribute("role","button"),r.setAttribute("tabindex",0===s?"0":"-1"),r.setAttribute("value",t),r.innerText=e.label,r}):[];for(const t of this.#rt.querySelectorAll(":scope > ful-badge"))t.remove();this.#Pe.before(...t),this.#Ie||this.#is(),this.#Jt.replaceChildren(),(this.#te??this.template("items")).withOverlay({entries:this.#as()}).renderTo(this.#Jt)}#ts(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){const e=(null==t?[]:Array.isArray(t)?t:[t]).map(t=>this.#ts(t));!this.#Fe&&e.some(t=>"string"==typeof t&&t.includes(","))&&(this.#Fe=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#De=new Map(e.map(t=>[t,{key:t,label:t,metadata:void 0}]));const s=this.#ze.take();this.#rt&&(this.#os(),0!==e.length&&this.#i(e,s))}async#i(t,e){const s=await this.#Le.exact(...t);if(e.stale)return;const r=new Map(s.map(t=>[this.#ts(t.key),t]));for(const e of t)this.#De.has(e)&&(r.has(e)?this.#De.set(e,r.get(e)):this.#De.delete(e));this.#os()}get value(){return this.#Me?[...this.#De.keys()]:[...this.#De.keys()][0]??null}get entry(){const t=this.#as();return this.#Me?t:t[0]??null}#ce;get multiple(){return this.#Me}set multiple(t){this.#Me=t,this.reflectTo("multiple",t)}get itemList(){return this.#ce}set itemList(t){this.#ce=t,this.reflectTo("item-list",t)}}class Wt extends ut{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 ';#ls;#us;#cs;_build({slots:t}){const e=this.declared("name")??c.uid("ful-radiogroup"),s=Array.from(t.default.querySelectorAll("ful-radio")),r=s.map(t=>{const s=document.createElement("input");return s.setAttribute("type","radio"),c.forward("input-",this,s),c.forward("",t,s),s.setAttribute("name",`${e}-ignore`),s.setAttribute("form",""),s.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()}),[s,u.fromChildNodes(t)]});s.forEach(t=>{t.remove()});const i=this.template().withOverlay({name:e,slots:t,inputsAndLabels:r}).render();return this.#ls=i.firstElementChild,this.#us=i.querySelector("input[type=radio]"),this.#cs="boolean"===this.declared("type"),{fragment:i,control:this.#us,error:i.querySelector("ful-field-error"),described:this,claims:this.#ls,announces:this,freeze:this.#ls}}get value(){const t=this.querySelector("input[type=radio]:checked");return t?this.#cs?"true"===t.value:t.value:null}set value(t){const e=this.querySelectorAll("input[type=radio]"),s=()=>{e.forEach(t=>{t.checked=!1})};if(null===t)return void s();const r=this.querySelector(`input[type=radio][value=${CSS.escape(String(t))}]`);null!==r?r.checked=!0:s()}}class Vt extends ut{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 ';#ds;#Pe;_build({slots:t}){const e="switch"===this.declared("type"),s=this.template().withOverlay({slots:t,isSwitch:e}).render();this.#ds=s.firstElementChild,this.#Pe=s.querySelector("input"),c.forward("input-",this,this.#Pe),this.#Pe.addEventListener("change",t=>{t.stopPropagation(),this._notifyChange()});const r=s.querySelector("label");return{fragment:s,control:this.#Pe,error:s.querySelector("ful-field-error"),label:r,freeze:this.#ds}}get value(){return this.#Pe.checked}set value(t){this.#Pe.checked=t}}class Ut extends S{static attributes=["sorter"];static observed=["order"];#hs;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.#hs||null}set order(t){this.#hs=t||null,this.reflectTo("order",this.#hs);const e=this.closest("th");e&&c.set(e,"aria-sort",this.#hs?"asc"===this.#hs?"ascending":"descending":null)}}class Gt 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 ';#ps=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.#ps=e??0),this.reflectTo("current",this.#W),this.reflectTo("total",this.#ps);const s=this.#W,r=this.#ps,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},(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.#ps}set total(t){this.update({total:t})}get current(){return this.#W}set current(t){this.update({current:t})}}class Qt{static parse(t,e){const s=t?h.queryChildren(t,"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 t of s.getAttributeNames()){const e=s.getAttribute(t);r.setAttribute(t,e??""),i.setAttribute(t,e??"")}const n=h.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=h.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),r.append(l),i.append(u)}return{headersTemplate:e.withOverlay({inHeaders:!0,inRows:!1}).withFragment(u.from(r)),rowsTemplate:e.withOverlay({inHeaders:!1,inRows:!0}).withFragment(u.from(i)),sort:a,length:n.length}}}class Kt{#C;constructor(t){this.#C=t}async load(t,e,s){const r=this.#fs(e),i=t.page*t.size,n=i+t.size;return{data:r.slice(i,n),size:r.length}}#fs(t){if(!t?.sorter)return this.#C;const{sorter:e,order:s}=t,r="desc"===s?-1:1;return[...this.#C].sort((t,s)=>{const i=t?.[e],n=s?.[e];return i===n?0:null==i?1:null==n?-1:(i<n?-1:1)*r})}update(t){this.#C=t}}class Jt{#vt;#yt;#U;#Et;constructor(t,e,s,r=t=>t){this.#vt=t,this.#yt=e,this.#U=s,this.#Et=r}async load(t,e,s){const r=Object.entries(s).filter(([t,e])=>e);return await this.#vt.request(this.#U,this.#yt).param("page",t.page).param("size",t.size).param("sort",e?`${e.sorter},${e.order}`:null).param("filters",r.length>0?JSON.stringify(Object.fromEntries(r)):null).fetchJson().then(t=>this.#Et(t))}}class Xt{static create(t,e){const s=t.getAttribute("src");if(s){const e=t.component("http-client"),r=t.getAttribute("method")??"GET",i=t.hasAttribute("response-mapper")?t.component(t.getAttribute("response-mapper")):t=>t;return new Jt(e,s,r,i)}return new Kt([])}}class Yt extends S{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 "};#Le;#ms;#J;#gs;#bs;#xe;#vs;#ys;#ws;#Es;#xs;#As={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#Ss=!1;#Ts=new nt;#Re={src:null,method:null};get pageSize(){return this.#As.pageRequest.size}set pageSize(t){const e=t??10;e!==this.#As.pageRequest.size&&(this.#As={...this.#As,pageRequest:{page:0,size:e}},this.#Ss&&this.reload())}get src(){return this.getAttribute("src")}set src(t){this.reflectTo("src",t??null),this.#ss()&&this.#Ss&&this.reload()}get method(){return this.getAttribute("method")}set method(t){this.reflectTo("method",t??null),this.#ss()&&this.#Ss&&this.reload()}async reconfigure(t){for(const e of["src","method"])e in t&&this.reflectTo(e,t[e]??null);return this.#ss(),await this.reload()}#je(){this.#Re={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Le=this.component(this.declared("loader")??"loaders:table").create(this)}#ss(){return(this.getAttribute("src")!==this.#Re.src||this.getAttribute("method")!==this.#Re.method)&&(this.#je(),this.#As={...this.#As,pageRequest:{...this.#As.pageRequest,page:0}},!0)}async render({slots:t}){const e=this.template(),s=Qt.parse(t.schema,e),r=e.withOverlay({slots:t,schema:s}).render(),i=h.queryChildren(r,"ful-table-wrapper").querySelector("table");c.forward("table-",this,i),this.#je(),this.#ms=s,this.#J=i.querySelector(":scope > tbody"),this.#gs=i.querySelector(":scope > tbody[data-ref=loading]"),this.#bs=i.querySelector(":scope > tbody[data-ref=initial]"),this.#xe=i.querySelector(":scope > tbody[data-ref=empty]"),this.#vs=this.#xe.querySelector("ful-empty[data-ref=empty-authors]"),this.#ys=t.empty&&!u.isBlank(t.empty)?x.fromFragment(t.empty):null,this.#ws=i.querySelector(":scope > tbody[data-ref=feedback]"),this.#Es=h.queryChildren(r,"ful-pagination"),this.replaceChildren(r);const n=this.querySelector("thead");s.headersTemplate.renderTo(n),this.#xs=n.querySelectorAll("ful-sorter"),await A.waitForChildren(this);const a=h.queryChildren(this,"ful-form");this.#As={pageRequest:{page:0,size:this.declared("page-size")??10},sortRequest:s.sort,filterRequest:a?.values??{}},a?.addEventListener("submit:success",async t=>{await this.#Cs(0,t.detail.request)}),this.addEventListener("page:requested",async t=>{await this.#Cs(t.detail.value,this.#As.filterRequest)}),this.addEventListener("sort:requested",async t=>{const e=t.detail.value.order?t.detail.value:null;await this.load(this.#As.pageRequest,e,this.#As.filterRequest),this.#As.sortRequest===e&&(this.#xs.forEach(t=>{t.order=null}),t.target.order=t.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){return await this.load(this.#As.pageRequest,this.#As.sortRequest,this.#As.filterRequest)}async load(t,e,s){this.#Ss=!0;const r=this.#Ts.take();let i;this.#gs.toggleAttribute("hidden",this.#J.childElementCount>0),this.#ws.setAttribute("hidden",""),this.#bs.setAttribute("hidden",""),this.#xe.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const n=await this.#Le.load(t,e,s);if(r.stale)return;if(i=Math.max(0,Math.ceil(n.size/t.size)-1),t.page<=i)return this.#As={pageRequest:t,sortRequest:e,filterRequest:s},this.#ee(t,e,s,n),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(i){if(r.stale)return;throw this.#gs.setAttribute("hidden",""),this.#J.replaceChildren(),this.#ws.removeAttribute("hidden"),this.#ws.querySelector("[data-ref=feedback-error]").textContent=R.of().failure(i),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:t,sortRequest:e,filterRequest:s,exception:i}})),i}return await this.load({page:i,size:t.size},e,s)}async withLoader(t){return await t(this.#Le)}async resetWithFilter(t){return await this.#Cs(0,t)}#Cs(t,e){return this.load({page:t,size:this.#As.pageRequest.size},this.#As.sortRequest,e)}#ee(t,e,s,r){const i=Math.ceil(r.size/t.size);this.#gs.setAttribute("hidden",""),this.#J.replaceChildren(this.template("row").withOverlay({schema:this.#ms,pageRequest:t,filterRequest:s,pageResponse:r}).render()),this.#xe.toggleAttribute("hidden",0!==r.data.length),this.#ys&&0===r.data.length&&this.#vs.replaceChildren(this.#ys.withOverlay({schema:this.#ms,pageRequest:t,filterRequest:s,pageResponse:r}).render()),this.#Es.update({current:t.page,total:i})}}const Zt=(t,e,{items:s,current:r=()=>null})=>{let i="",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();(r()??e[0])?.focus()}),e.addEventListener("keydown",e=>{const r=e.target,a=s(),o=a.find(t=>t===r||t.contains(r));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();i=u-n>500?e.key:i+e.key,n=u;const c=i.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 te{static narrow(t,e){const s=(t??[]).filter(t=>e.includes(t));return s.length>0?s:[...e]}#_s;#Ee;#Os;#ks;#qs;#is;#Ls;#Rs;#Ns;#Ps=!1;#Ms=!1;constructor(t,{vocabulary:e,glyphs:s={},labelFor:r=t=>t,display:i=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#_s=t,this.#Ee=t.nextElementSibling,this.#Os=e,this.#ks=s,this.#qs=r,this.#is=i??(t=>s[t]??t),this.#Ls=n,this.#Rs=a,this.#Ns=[...e],this.#Ee.addEventListener("click",t=>{const e=t.target.closest("li > a");if(!e||!this.#Ls())return;const s=e.getAttribute("value"),r=this.value;this.value=s,this.#Ee.hidePopover?.(),r!==s&&this.#Rs(s)})}get allowed(){return this.#Ns}set allowed(t){this.#Ns=te.narrow(t,this.#Os),this.#Fs(),!this.#Ms&&this.#Ns.length>1&&(this.#pt(),this.#Ms=!0),this.#Ds(),this.pinned&&(this.value=this.#Ns[0])}preferring(t){return null!==t&&this.#Ns.includes(t)?t:this.#Ns[0]}get pinned(){return this.#Ns.length<2}set fixed(t){this.#_s.toggleAttribute("hidden",!!t)}get value(){return this.#_s.getAttribute("value")}set value(t){this.#_s.setAttribute("value",t),this.#_s.textContent=this.#is(t),c.set(this.#_s,"aria-label",this.#qs(t)),this.#zs()}#zs(){const t=this.value;for(const e of this.#Jt())e.setAttribute("aria-checked",String(e.getAttribute("value")===t))}set claimed(t){this.#Ps=t,this.#Ds()}#Fs(){this.#Ee.replaceChildren(...this.#Ns.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 r=this.#qs(t),i=this.#ks[t]??t;if(r===t&&i===t)s.innerText=t;else{const t=document.createElement("span");t.innerText=i;const e=document.createElement("span");e.innerText=r,s.append(t,e)}return e.append(s),e})),this.#zs()}#Ds(){const t=this.pinned;this.#_s.toggleAttribute("disabled",t||this.#Ps),c.set(this.#_s,"aria-haspopup",t?null:"true"),c.set(this.#_s,"aria-expanded",t?null:"false"),t?this.#_s.removeAttribute("popovertarget"):this.#Ee.id&&this.#_s.setAttribute("popovertarget",this.#Ee.id)}#Jt(){return Array.from(this.#Ee.querySelectorAll("li > a"),t=>t)}#pt(){Mt.wire(this.#_s,this.#Ee,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),Zt(this.#_s,this.#Ee,{items:()=>this.#Jt(),current:()=>this.#Jt().find(t=>t.getAttribute("value")===this.value)})}}const ee={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},se=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],re=[...se,"CONTAINS","STARTS_WITH","ENDS_WITH"],ie=["IGNORE_CASE","CASE_SENSITIVE"],ne={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:ae}=R.of(),oe=t=>ae(`filters.op.${t}`),le=t=>ae(`filters.sensitivity.${t}`),ue=t=>ae(""===t?"filters.boolean.any":`filters.boolean.${t}`),ce=t=>t.querySelector(":scope > label")?.textContent.trim()||null,de=(t,e,{singular:s,plural:r,vocabulary:i,fallback:n})=>{const a=t.declared(s);if(null===a)return;t.hasAttribute(r)&&console.warn(`${t.localName}: ${s} fixes what ${r} offers a menu for, the plural is ignored`,t);const o=i.includes(a);o||console.warn(`${t.localName}: '${a}' is not one of its ${r}, the default is pinned instead`,t),e.allowed=[o?a:n],e.fixed=!0},he=(t,e,s)=>{const r=s.filter(t=>null!=t&&""!=`${t}`);return 0===r.length?null:{label:t,operator:e,operands:r.map(t=>`${t}`)}};class pe extends wt{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 te(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:ee,labelFor:oe,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),de(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 se}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(t){null===this.declared("operator")&&(this._operator?(this._operator.allowed=t,this._syncBetween()):this._declaredOperators=te.narrow(t,this._vocabulary()))}get value(){return this._tuple()}set value(t){this._applyTuple(t)}_tuple(){const t=this._operator.value,e=this.#Is();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,r=this._operator.pinned?this._operator.allowed[0]:e;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(t){this._operator.value=t,this._syncBetween()}_syncBetween(){this._value2.toggleAttribute("hidden","BETWEEN"!==this._operator.value)}get criterion(){return he(ce(this),this._operator.value,this.#Is())}#Is(){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 fe extends pe{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(t){return At.localToIso(t)}_deserialize(t){return At.isoToLocal(t)}}class me extends pe{_type(){return"date"}}class ge extends pe{_type(){return"number"}}class be extends pe{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 re}_sensitivityButton;_build(t){const e=super._build(t);return this._sensitivityButton=new te(e.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:ie,glyphs:ne,labelFor:le,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=ie[0],de(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:ie,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=te.narrow(t,ie));const e=this._sensitivityButton.value;this._sensitivityButton.allowed=t,this._sensitivityButton.value=this._sensitivityButton.preferring(e)}get value(){const t=this._tuple();return null==t?null:[t[0],this._sensitivity,...t.slice(1)]}set value(t){null!=t?(this._sensitivityButton.allowed.includes(t[1])&&(this._sensitivityButton.value=t[1]),this._applyTuple([t[0],...t.slice(2)])):this._applyTuple(t)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const ve=["","true","false"],ye={true:"✓",false:"✗"};class we extends ut{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 te(e.querySelector("[data-ref=operator]"),{vocabulary:we.OPERATORS,glyphs:ee,labelFor:oe,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new te(s,{vocabulary:ve,glyphs:ye,labelFor:ue,display:ue,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(we.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:this._declaredOperators=te.narrow(t,this._vocabulary())}_vocabulary(){return we.OPERATORS}get value(){return""===this._value.value?null:[this._operator.value,this._value.value]}set value(t){null!=t?(this._operator.value=this._operator.pinned?this._operator.allowed[0]:t[0],this._value.value=t[1]??""):this._value.value=""}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(we.DEFAULT_OPERATOR))}get criterion(){const t=this._value.value;return he(ce(this),this._operator.value,[""===t?"":ue(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 Ee extends Ht{static attributes=["operator"];#$s(){const t=super.value;return this.multiple?t:null==t?[]:[t]}get value(){const t=this.#$s();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 he(ce(this),this.declared("operator"),[super.entry].flat().filter(t=>t).map(t=>t.label))}}class xe extends S{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]"),r=e.querySelector("[data-ref=content]");Mt.wire(s,r,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),r.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(e),this.declared("describes")&&xe.#ft(this,s,r)}static#ft(t,e,s){at(t)?.describedBy(s)?e.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",t)}}class Ae{#Bs=new WeakSet;#ut=new WeakMap;async request(t,e,s,r){const i=!this.#Bs.has(e),n={name:s,section:e,index:r,first:i},a=["section:requested",...null!=r?[`section:requested:#${r}`]:[],...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;this.#Bs.add(e);let l=this.#ut.get(e);l||(l=new nt,this.#ut.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{return await Promise.all(o)}catch(t){throw c()&&this.#js(e,t),t}finally{cancelAnimationFrame(d),c()&&(e.toggleAttribute("loading",!1),e.removeAttribute("aria-busy"))}}#js(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 Se{#Hs;#Ws;#Vs;#gs;#Us;#Gs=new Ae;#Qs=new nt;constructor(t,e,s){this.#Hs=t,this.#Ws=e.querySelector("[data-ref=dialog]"),this.#Vs=e.querySelector(`[data-ref=${s}]`),this.#gs=e.querySelector("[data-ref=loading]"),this.#Us=e.querySelector("[data-ref=error]")}get dialog(){return this.#Ws}get section(){return this.#Vs}dismiss(t,e){this.#Hs.dispatchEvent(t)&&t.cancelable&&e()}onBackdrop(t){let e=!1;this.#Ws.addEventListener("mousedown",t=>{e=t.target===this.#Ws}),this.#Ws.addEventListener("click",s=>{e&&s.target===this.#Ws&&t()})}onSubmitted(t){this.#Vs.addEventListener("submit:success",e=>{e.target===h.queryChildren(this.#Vs,"ful-form")&&t(e.detail.response)})}restChrome(){this.#Us?.replaceChildren(),this.#Us?.setAttribute("hidden",""),this.#gs?.setAttribute("hidden",""),this.#Vs?.removeAttribute("hidden")}request(){return this.#Gs.request(this.#Hs,this.#Vs,null,null).catch(()=>{})}async update(t,e){const s=this.#Qs.take();this.#Vs.replaceChildren(),this.restChrome(),this.#gs?.removeAttribute("hidden"),this.#Vs.setAttribute("hidden",""),e();try{const e=await t();return s.stale||(this.#Vs.replaceChildren(e),this.#gs?.setAttribute("hidden",""),this.#Vs.removeAttribute("hidden")),this.#Vs}catch(t){throw s.stale||(this.#Us?.removeAttribute("hidden"),this.#Us&&(this.#Us.textContent=R.of().failure(t)),this.#gs?.setAttribute("hidden",""),this.#Vs.setAttribute("hidden","")),t}}}let Te=!1;const Ce=()=>{Te||(Te=!0,document.addEventListener("click",t=>{const e=t.target.closest?.("[dialog-target]");e&&document.getElementById(e.getAttribute("dialog-target"))?.open?.()}))};class _e extends S{static attributes=["header","requires-answer:presence","close-on-submit: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">\n <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>\n {{{{ slots.buttons }}}}\n </footer>\n </dialog>\n ';#Ws;#Ks;#Js=[];#Xs=null;render({slots:t}){const e=this.declared("requires-answer"),s=this.declared("close-on-submit"),r=this.template().withOverlay({slots:t,header:this.declared("header")??"",requiresAnswer:e,closeOnSubmit:s}).render();this.#Ks=new Se(this,r,"body"),this.#Ws=this.#Ks.dialog;const i=r.querySelector("h2");i&&(i.id||=c.uid("ful-dialog-title"),this.#Ws.setAttribute("aria-labelledby",i.id)),this.#Ws.addEventListener("close",()=>{const t=this.#Ys();this.dispatchEvent(new CustomEvent("close",{detail:t})),this.#Zs(t)}),this.#Ws.addEventListener("click",t=>{const e=t.target.closest("button[data-result]")?.dataset.result;void 0!==e&&this.#Ws.close(e)});const n=(t,e=!1)=>this.#Ks.dismiss(new CustomEvent("dialog:dismiss",{cancelable:!e,detail:{reason:t}}),()=>this.#Ws.close(""));e||this.#Ks.onBackdrop(()=>n("backdrop")),r.querySelector("[data-ref=close]")?.addEventListener("click",()=>n("button")),s&&this.#Ks.onSubmitted(t=>{this.#Xs={dismissed:!1,result:null,response:t},this.#Ws.close("submitted")}),this.#Ws.addEventListener("cancel",t=>{if(!t.cancelable)return this.#Ws.returnValue="",void n("escape",!0);t.preventDefault(),e||n("escape")}),this.replaceChildren(r),Ce()}#Ys(){if(this.#Xs)return this.#Xs;const t=this.#Ws?.returnValue??"";return""===t?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:t,response:null}}#Zs(t){const e=this.#Js;this.#Js=[];for(const s of e)s(t)}disconnectedCallback(){this.#Zs(this.#Ys())}open(){return this.ask()}ask(){return this.#tr()&&(this.#Ks.restChrome(),this.#Ks.request()),new Promise(t=>{this.#Js.push(t)})}async update(t){return await this.#Ks.update(t,()=>this.#tr())}refresh(){return this.#Ks.request()}close(t){this.#Ws.close(t??"")}#tr(){return!this.#Ws.open&&(this.#Ws.returnValue="",this.#Xs=null,this.#Ws.showModal(),!0)}static async ask(t,e,s=[],{className:r}={}){const i=document.createElement("ful-dialog");if(i.setAttribute("header",t),r&&(i.className=r),"string"==typeof e?i.textContent=e:e&&i.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,r,i]=e,n=document.createElement("button");n.type="button",n.dataset.result=s,i&&(n.className=i),n.textContent=r,t.content.append(n)}i.append(t)}document.body.append(i);try{return await A.waitFor(i),await i.ask()}finally{i.remove()}}static async confirm(t,e,s={},r={}){const i=await _e.ask(t,e,[["cancel",s.cancel??R.of().t("dialog.cancel")],["confirm",s.confirm??R.of().t("dialog.confirm"),"ful-button"]],r);return!i.dismissed&&"confirm"===i.result}}class Oe extends S{static attributes=["header","placement","close-on-submit: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 ';#Ws;#er;#Ks;#Xs=null;#sr=!1;#rr=t=>{t.target===this.#Ws&&this.#ir()};render({slots:t}){const e=this.template().withOverlay({slots:t,title:this.declared("header")??""}).render();this.#Ks=new Se(this,e,"content"),this.#Ws=this.#Ks.dialog,this.#er=e.querySelector("[data-ref=title]"),this.#er.id||=c.uid("ful-drawer-title"),this.#Ws.setAttribute("aria-labelledby",this.#er.id);const s=this.declared("placement");s&&this.#Ws.setAttribute("placement",s);const r=(t,e=!1)=>this.#Ks.dismiss(new CustomEvent("drawer:dismiss",{cancelable:!e,detail:{reason:t}}),()=>this.close());e.querySelector("[data-ref=close]").addEventListener("click",()=>r("button")),this.#Ks.onBackdrop(()=>r("backdrop")),this.#Ws.addEventListener("cancel",t=>{if(!t.cancelable)return this.#nr(),void r("escape",!0);t.preventDefault(),r("escape")}),this.#Ws.addEventListener("close",()=>{this.dispatchEvent(new CustomEvent("close",{detail:this.#Xs??{dismissed:!0,response:null}}))}),this.declared("close-on-submit")&&this.#Ks.onSubmitted(t=>{this.#Xs={dismissed:!1,response:t},this.close()}),this.replaceChildren(e),Ce()}get header(){return this.#er.textContent}set header(t){this.#er.textContent=t??""}async update(t,e){return this.header=t,await this.#Ks.update(e,()=>this.#tr())}refresh(){return this.#Ks.request()}open(){this.#tr()&&(this.#Ks.restChrome(),this.#Ks.request())}close(){!this.#sr&&this.#Ws.open&&(matchMedia("(prefers-reduced-motion: reduce)").matches?this.#Ws.close():(this.#Ws.setAttribute("closing",""),0!==this.#Ws.getAnimations().length?(this.#sr=!0,this.#Ws.addEventListener("animationend",this.#rr)):this.#ir()))}#ir(){this.#nr(),this.#Ws.close()}#nr(){this.#sr=!1,this.#Ws.removeEventListener("animationend",this.#rr),this.#Ws.removeAttribute("closing")}#tr(){return this.#nr(),!this.#Ws.open&&(this.#Xs=null,this.#Ws.showModal(),!0)}}class ke extends S{static attributes=["for"];render(){const t=this.declared("for"),e=t?document.getElementById(t):null;if(!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.setAttribute("aria-haspopup","menu"),Mt.wire(e,this,{prefix:"ful-menu",invoke:!0,expanded:!0}),Zt(e,this,{items:()=>this.items}),this.#zs(),this.addEventListener("click",t=>{const e=t.target;this.items.some(t=>t===e||t.contains(e))&&this.hidePopover()})}get items(){return this.#zs().filter(t=>!t.hasAttribute("disabled")&&!t.hasAttribute("hidden"))}#zs(){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 qe=["info","success","warning","error"],Le=new Set;let Re=!1;class Ne extends S{static attributes=["timeout:number"];#ar;connectedCallback(){super.connectedCallback(),this.rendered&&Le.add(this)}disconnectedCallback(){Le.delete(this)}render(){this.#ar=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"),Re||(Re=!0,document.addEventListener("show-toast",t=>{if(t.detail)for(const e of Le)e.show(t.detail.message,t.detail)})),Le.add(this)}show(t,e={}){const s=qe.includes(e.severity)?e.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=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),r.append(i);let o=e.timeout??this.#ar,l=performance.now(),u=0;const c=()=>{clearTimeout(u),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())};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()}),r.append(t)}r.append(n),r.addEventListener("animationend",()=>{r.classList.contains("ful-toast-out")&&r.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 r.addEventListener("mouseenter",h),r.addEventListener("mouseleave",p),r.addEventListener("focusin",h),r.addEventListener("focusout",p),n.addEventListener("click",c),this.append(r),this.#or(),u=setTimeout(c,o),r}#or(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class Pe extends S{static slots=!0;static observed=["active:number"];static template='\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n {{{{ slots.default }}}}\n ';#lr;#ur=[];#cr=[];#Gs=new Ae;#dr=0;render({slots:t}){const e=this.template().withOverlay({slots:t}).render();this.#lr=e.querySelector("ful-tablist");const s=[...this.#lr.children];this.#cr=[...e.children].filter(t=>t!==this.#lr),s.length!==this.#cr.length&&console.warn(`ful-tabs: ${s.length} tabs declared for ${this.#cr.length} panels, the surplus is left alone`);const r=Math.min(s.length,this.#cr.length);this.#ur=[];for(let t=0;t!==r;++t){const e=this.#cr[t],r=document.createElement("button");r.type="button",r.role="tab",r.id=c.uid("ful-tab"),e.id||(e.id=c.uid("ful-tabpanel")),r.setAttribute("aria-controls",e.id),e.role="tabpanel",e.setAttribute("aria-labelledby",r.id),e.tabIndex=0,r.append(...s[t].childNodes),r.addEventListener("click",()=>{this.active=t}),s[t].replaceWith(r),this.#ur.push(r)}this.#lr.addEventListener("keydown",t=>{const e=this.#dr;let s=null;"ArrowRight"===t.key?s=(e+1)%this.#ur.length:"ArrowLeft"===t.key?s=(e-1+this.#ur.length)%this.#ur.length:"Home"===t.key?s=0:"End"===t.key&&(s=this.#ur.length-1),null!==s&&s!==e&&(t.preventDefault(),this.active=s,this.#ur[s].focus())}),this.replaceChildren(e)}get active(){return this.#dr}refresh(t){const e=t instanceof Element?this.#cr.indexOf(t):Number.isInteger(t)?t:NaN,s=this.#cr[e];if(s)return this.#Gs.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.#ur.length-1)),s=this.#dr;for(const[t,s]of this.#ur.entries())s.setAttribute("aria-selected",t===e?"true":"false"),s.tabIndex=t===e?0:-1,this.#cr[t].hidden=t!==e;this.#dr=e,this.reflectTo("active",e),this.rendered&&e!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:e,previous:s}})),this.#cr.length>0&&(e!==s||!this.rendered)&&this.#Gs.request(this,this.#cr[e],null,e).catch(()=>{})}}class Me extends S{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#Zt;#hr=!1;render({slots:t}){const e=this.template().withOverlay({slots:t}).render();this.#Zt=e.querySelector("ful-accordion-group"),this.replaceChildren(e)}get exclusive(){return this.#hr}set exclusive(t){this.#hr=!0===t,this.reflectTo("exclusive",this.#hr);const e=this.#hr?c.uid("ful-accordion"):null;for(const t of this.#Zt.querySelectorAll(":scope > details"))null===e?t.removeAttribute("name"):t.setAttribute("name",e)}}class Fe 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 ";#pr=[];#Ks=[];#Gs=new Ae;#fr=0;#mr;render({slots:t}){const e=this.template().withOverlay({slots:t}).render(),s=[...e.querySelector("ful-steps ol").children];this.#Ks=[...e.children].filter(t=>"ful-steps"!==t.localName),s.length!==this.#Ks.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#Ks.length} sections, the surplus is left alone`);const r=Math.min(s.length,this.#Ks.length);this.#pr=[];for(let t=0;t!==r;++t){const e=document.createElement("li");e.append(...s[t].childNodes),s[t].replaceWith(e),this.#pr.push(e),this.#Ks[t].tabIndex=-1}if(this.replaceChildren(e),r>0){const t=this.#Ks.findIndex(t=>"step"===t.getAttribute("aria-current"));this.#gr(-1===t?0:Math.min(t,r-1)),this.#br(this.#fr).catch(()=>{})}}get index(){return this.#fr}get step(){return this.#Ks[this.#fr]?.getAttribute("data-step")??null}get progress(){return this.#mr}set progress(t){this.#mr=t,this.reflectTo("progress",t)}next(){return this.#vr(this.#fr+1)}prev(){return this.#vr(this.#fr-1)}move(t){const e=this.#Ks.findIndex(e=>e.getAttribute("data-step")===t);if(-1!==e)return this.#vr(e);console.warn(`ful-wizard: no section carries data-step="${t}"`)}refresh(t){const e=t instanceof Element?t:"string"==typeof t?this.#Ks.find(e=>e.getAttribute("data-step")===t):void 0,s=this.#Ks.indexOf(e);if(-1!==s)return this.#br(s).catch(()=>{});console.warn(`ful-wizard: no section answers to "${t}"`)}#br(t){return this.#Gs.request(this,this.#Ks[t],this.#Ks[t].getAttribute("data-step"),t)}#vr(t){const e=Math.min(Math.max(0,t),Math.max(0,this.#pr.length-1));if(e!==this.#fr)return this.#gr(e),this.#Ks[this.#fr].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#fr,step:this.step}})),this.#br(e)}#gr(t){for(const[e,s]of this.#pr.entries())e===t?(s.setAttribute("aria-current","step"),this.#Ks[e].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#Ks[e].removeAttribute("aria-current"));this.#fr=t}}const De={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","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","failure.no-reason":"Si è verificato un errore","dialog.acknowledge":"Ho capito","dialog.close":"Chiudi","dialog.confirm":"Conferma","dialog.cancel":"Annulla","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":{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","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","failure.no-reason":"Une erreur s'est produite","dialog.acknowledge":"J’ai compris","dialog.close":"Fermer","dialog.confirm":"Confirmer","dialog.cancel":"Annuler","drawer.close":"Fermer","spinner.loading":"Chargement…","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};class ze{#yr;#wr;#Er;constructor(t={}){this.#yr=t.language??navigator?.language??"en",this.#wr=t.translations??{},this.#Er=t.httpClient??null}configure(t){const e=this.#Er??V.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),s=this.#yr.split("-")[0].toLowerCase(),r={...De.en,...De[s],...this.#wr};t.defineModule("l10n",R).defineComponent("http-client",e).defineElement("ful-tooltip",xe).defineElement("ful-dialog",_e).defineElement("ful-drawer",Oe).defineElement("ful-menu",ke).defineElement("ful-toasts",Ne).defineElement("ful-tabs",Pe).defineElement("ful-accordion",Me).defineElement("ful-wizard",Fe).defineElement("ful-form",ft).defineElement("ful-checkbox",Vt).defineElement("ful-input",wt).defineElement("ful-input-file",_t).defineElement("ful-local-date",xt).defineElement("ful-instant",At).defineElement("ful-input-local-date",St).defineElement("ful-input-local-time",Tt).defineElement("ful-input-instant",Ct).defineElement("ful-radio-group",Wt).defineElement("ful-table",Yt).defineElement("ful-pagination",Gt).defineElement("ful-sorter",Ut).defineElement("ful-filter-instant",fe).defineElement("ful-filter-local-date",me).defineElement("ful-filter-number",ge).defineElement("ful-filter-boolean",we).defineElement("ful-filter-text",be).defineElement("ful-filter-in",Ee).defineElement("ful-select",Ht).defineElement("ful-dropdown",jt).defineComponent("loaders:select",Bt).defineComponent("loaders:form",ht).defineComponent("loaders:table",Xt).defineOverlay({l10n:r,locale:this.#yr})}}var Ie=Object.freeze({__proto__:null,Accordion:Me,Anchors:Mt,AsyncEvents:rt,Bindings:lt,BooleanFilter:we,Checkbox:Vt,Claims:nt,CompareFilter:pe,Dialog:_e,Drawer:Oe,Dropdown:jt,Field:ut,Form:ft,FormLoader:ht,InFilter:Ee,Input:wt,InputFile:_t,InputInstant:Ct,InputLocalDate:St,InputLocalTime:Tt,Instant:At,InstantFilter:fe,LocalDate:xt,LocalDateFilter:me,LocalStorage:Z,Menu:ke,NumberFilter:ge,PageLeave:it,Pagination:Gt,Plugin:ze,RadioGroup:Wt,Select:Ht,SelectLoader:Bt,SessionStorage:tt,SortButton:Ut,Table:Yt,TableLoader:Xt,TableSchemaParser:Qt,Tabs:Pe,TextFilter:be,Timing:ot,Toasts:Ne,Tooltip:xe,VersionedLocalStorage:et,VersionedSessionStorage:st,Wizard:Fe,describable:at});return"undefined"!=typeof window&&(window.ftl=N,window.httpc=J,window.ful=Ie),t.Accordion=Me,t.Anchors=Mt,t.AsyncEvents=rt,t.Attributes=c,t.Base64=M,t.Bindings=lt,t.BooleanFilter=we,t.BoundedCache=e,t.Checkbox=Vt,t.Claims=nt,t.CompareFilter=pe,t.Dialog=_e,t.Drawer=Oe,t.Dropdown=jt,t.ExpressionEvaluator=l,t.Expressions=o,t.Failure=P,t.Field=ut,t.Form=ft,t.FormLoader=ht,t.Fragments=u,t.Hex=F,t.HttpClient=V,t.HttpClientBuilder=j,t.HttpClientError=z,t.HttpInterceptorChain=W,t.HttpMultipartRequestCustomizer=K,t.HttpRequestBuilder=Q,t.InFilter=Ee,t.Input=wt,t.InputFile=_t,t.InputInstant=Ct,t.InputLocalDate=St,t.InputLocalTime=Tt,t.Instant=At,t.InstantFilter=fe,t.LightSlots=d,t.LocalDate=xt,t.LocalDateFilter=me,t.LocalStorage=Z,t.Localization=R,t.MediaType=D,t.Menu=ke,t.Nodes=h,t.NumberFilter=ge,t.PageLeave=it,t.Pagination=Gt,t.ParsedElement=S,t.Plugin=ze,t.RadioGroup=Wt,t.Registry=w,t.RenderError=v,t.Rendering=A,t.Select=Ht,t.SelectLoader=Bt,t.SessionStorage=tt,t.SortButton=Ut,t.Table=Yt,t.TableLoader=Xt,t.TableSchemaParser=Qt,t.Tabs=Pe,t.Template=b,t.Templates=x,t.TextFilter=be,t.Timing=ot,t.Toasts=Ne,t.Tooltip=xe,t.VersionedLocalStorage=et,t.VersionedSessionStorage=st,t.Wizard=Fe,t.describable=at,t.registry=E,t}({});
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){return this.visit(e.lhs)??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="(",k=",",q=")",L="-",P="'",R='"',N="`",M="}",F="#",D="==",z="!=",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"),ke=ut("'",!1),qe=ct(["'"],!0,!1,!1),Le=ut('"',!1),Pe=ct(['"'],!0,!1,!1),Re=ut("`",!1),Ne=dt("tstring-expression"),Me=ut("}",!1),Fe=dt("tstring-literal"),De=ct(["\\","`","{"],!0,!1,!1),ze=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,Nt(),t=vt(),t!==n?(Nt(),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?(Nt(),63===e.charCodeAt(st)?(i=b,st++):(i=n,0===ot&&ft(oe)),i!==n?(Nt(),a=vt(),a!==n?(Nt(),58===e.charCodeAt(st)?(o=v,st++):(o=n,0===ot&&ft(le)),o!==n?(Nt(),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?(Nt(),e.substr(st,2)===y?(i=y,st+=2):(i=n,0===ot&&ft(ue)),i!==n?(Nt(),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?(Nt(),e.substr(st,2)===w?(i=w,st+=2):(i=n,0===ot&&ft(ce)),i!==n?(Nt(),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,Nt(),e.substr(st,2)===E?(o=E,st+=2):(o=n,0===ot&&ft(de)),o!==n?(Nt(),l=xt(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);a!==n;)i.push(a),a=st,Nt(),e.substr(st,2)===E?(o=E,st+=2):(o=n,0===ot&&ft(de)),o!==n?(Nt(),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,Nt(),e.substr(st,2)===x?(o=x,st+=2):(o=n,0===ot&&ft(he)),o!==n?(Nt(),l=At(),l!==n?a=l:(st=a,a=n)):(st=a,a=n);a!==n;)i.push(a),a=st,Nt(),e.substr(st,2)===x?(o=x,st+=2):(o=n,0===ot&&ft(he)),o!==n?(Nt(),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,Nt(),a=Pt(),a!==n?(Nt(),o=St(),o!==n?i=Ze(0,a,o):(st=i,i=n)):(st=i,i=n);i!==n;)r.push(i),i=st,Nt(),a=Pt(),a!==n?(Nt(),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,Nt(),a=Rt(),a!==n?(Nt(),o=Tt(),o!==n?i=et(0,a,o):(st=i,i=n)):(st=i,i=n);i!==n;)r.push(i),i=st,Nt(),a=Rt(),a!==n?(Nt(),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?(Nt(),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(Nt(),r=[],i=st,a=Ct(),a!==n?(Nt(),i=a):(st=i,i=n),i!==n)for(;i!==n;)r.push(i),i=st,a=Ct(),a!==n?(Nt(),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?(Nt(),i=Lt(),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?(Nt(),a=vt(),a!==n?(Nt(),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(Nt(),a=st,o=vt(),o!==n?(l=Nt(),a=o):(st=a,a=n),a===n&&(a=null),o=[],l=st,44===e.charCodeAt(st)?(u=k,st++):(u=n,0===ot&&ft(xe)),u!==n?(Nt(),c=vt(),c!==n?(Nt(),l=c):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=k,st++):(u=n,0===ot&&ft(xe)),u!==n?(Nt(),c=vt(),c!==n?(Nt(),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?(Nt(),a=vt(),a!==n?(Nt(),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=F,st++):(r=n,0===ot&&ft(Be)),r!==n?(i=st,a=Lt(),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=Lt(),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(Nt(),a=st,o=vt(),o!==n?(l=Nt(),a=o):(st=a,a=n),a===n&&(a=null),o=[],l=st,44===e.charCodeAt(st)?(u=k,st++):(u=n,0===ot&&ft(xe)),u!==n?(Nt(),c=vt(),c!==n?(Nt(),l=c):(st=l,l=n)):(st=l,l=n);l!==n;)o.push(l),l=st,44===e.charCodeAt(st)?(u=k,st++):(u=n,0===ot&&ft(xe)),u!==n?(Nt(),c=vt(),c!==n?(Nt(),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=L,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(Nt(),i=vt(),i===n&&(i=null),Nt(),a=[],o=st,44===e.charCodeAt(st)?(l=k,st++):(l=n,0===ot&&ft(xe)),l!==n?(Nt(),u=vt(),u!==n?(Nt(),o=u):(st=o,o=n)):(st=o,o=n);o!==n;)a.push(o),o=st,44===e.charCodeAt(st)?(l=k,st++):(l=n,0===ot&&ft(xe)),l!==n?(Nt(),u=vt(),u!==n?(Nt(),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(ze)),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(Nt(),i=st,a=Ot(),a!==n?(o=Nt(),58===e.charCodeAt(st)?(l=v,st++):(l=n,0===ot&&ft(le)),l!==n?(u=Nt(),c=vt(),c!==n?i=[a,c]:(st=i,i=n)):(st=i,i=n)):(st=i,i=n),i===n&&(i=null),a=Nt(),o=[],l=st,44===e.charCodeAt(st)?(u=k,st++):(u=n,0===ot&&ft(xe)),u!==n?(c=Nt(),d=Ot(),d!==n?(Nt(),58===e.charCodeAt(st)?(h=v,st++):(h=n,0===ot&&ft(le)),h!==n?(Nt(),p=vt(),p!==n?(Nt(),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=k,st++):(u=n,0===ot&&ft(xe)),u!==n?(c=Nt(),d=Ot(),d!==n?(Nt(),58===e.charCodeAt(st)?(h=v,st++):(h=n,0===ot&&ft(le)),h!==n?(Nt(),p=vt(),p!==n?(Nt(),l=[d,p]):(st=l,l=n)):(st=l,l=n)):(st=l,l=n)):(st=l,l=n);125===e.charCodeAt(st)?(l=M,st++):(l=n,0===ot&&ft(Me)),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=Lt(),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(ke)),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(ke)),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=R,st++):(r=n,0===ot&&ft(Le)),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=R,st++):(a=n,0===ot&&ft(Le)),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=N,st++):(r=n,0===ot&&ft(Re)),r!==n){for(i=[],a=kt(),a===n&&(a=qt());a!==n;)i.push(a),a=kt(),a===n&&(a=qt());96===e.charCodeAt(st)?(a=N,st++):(a=n,0===ot&&ft(Re)),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 kt(){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?(Nt(),r=vt(),r!==n?(Nt(),125===e.charCodeAt(st)?(i=M,st++):(i=n,0===ot&&ft(Me)),i!==n?t=r:(st=t,t=n)):(st=t,t=n)):(st=t,t=n),ot--,t===n&&(s=n,0===ot&&ft(Ne)),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(Fe)),lt[l]={nextPos:st,result:t},t}function Lt(){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)===z?(t=z,st+=2):(t=n,0===ot&&ft(Ue))),lt[s]={nextPos:st,result:t},t)}function Rt(){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 Nt(){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 Mt=it!==n&&st===e.length;function Ft(){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:Mt,peg$throw:Mt?void 0:Ft}:Mt?it:void Ft()}(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?.[Symbol.iterator]||l!==Object.prototype&&null!==l?null:Object.entries(o),c=o instanceof Map?[...o]:u,d=null===c?o:c.map(([e,t])=>({key:e,value:t}));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 t of d){const r=i?{[i]:t}:t,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},r]:[r];s.prepend(e,a.withOverlay(...l).render()),++m}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=u.fromChildNodes(e);"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");return b.fromTemplate(r,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:u.from(t),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-${r}="${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){return u.toHtml(v.#g(e.cloneNode(!0)))}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.#k(),this}defineModules(e){return this.#s=e,this.#k(),this}defineComponent(e,t){return this.#T[e]=t,this}defineData(...e){return this.#C=e,this.#k(),this}defineOverlay(...e){return this.#C=[...this.#C,...e],this.#k(),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()}#k(){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;#L=!1;#P=new Set;#R=null;#N={};#M(){return this.constructor.BITS}#F(e){const t=this.#M().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.#F(e).unmarshal(t,e,this)}marshal(e,t){return this.#F(e).marshal(t,e,this)}get _registry(){return this.#M().registry}component(e){return this.#M().registry.component(e)}template(e){const t=this.#M().TEMPLATES[e??"default"];if(!t)throw new Error(`no template named '${e??"default"}' on ${this.constructor.name}`);const s=t.withEvaluator(this.#M().registry.evaluator()),r=this.#M().CONFIG;return r?s.withOverlay({config:r}):s}connectedCallback(){this.#L||this.#M().enqueue(this)}attributeChangedCallback(e,t,s){t!==s&&(this.#P.has(e)||(this.#q?this[this.#M().ATTR_TO_PROPERTY[e]]=this.unmarshal(e,s):null!==this.#R&&e in this.#R&&(this.#R[e]=this.unmarshal(e,s))))}async upgrade(){if(this.#L)return;this.#L=!0;const e=this.#M().SLOTS?d.from(this):void 0,t=Object.fromEntries(this.#M().DECLARED.map(e=>[e,this.unmarshal(e,this.getAttribute(e))])),s=new Set(this.#M().OBSERVED);this.#N=Object.fromEntries(Object.entries(t).filter(([e])=>!s.has(e))),this.#R=t;try{await this.render({slots:e});const s=this.#M().ATTR_TO_PROPERTY;for(const e of this.#M().OBSERVED)this[s[e]]=t[e];this.#q=!0,this.internals.states.add("rendered")}finally{this.#R=null}}render(e){}declared(e){return e in this.#N?this.#N[e]:null!==this.#R&&e in this.#R?this.#R[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,k=e=>{O.has(e)||(O.add(e),console.warn(`l10n: ${e}`))},q=new t(100),L=(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){const s=this.l10n??{};let r=Object.hasOwn(s,e)?s[e]:void 0;if(void 0===r)return k(`missing message "${e}"`),e;const i=1===t.length&&_(t[0])?t[0]:null;if(_(r))if("number"!=typeof i?.count)k(`plural message "${e}" needs a numeric {count}`),r=r.other;else{const e=this.locale??navigator?.language??"en";r=r[L(Intl.PluralRules,e).select(i.count)]??r.other}return void 0===r||"object"==typeof r?(k(`plural message "${e}" has no "other" form`),e):i?r.replace(T,(t,s)=>Object.hasOwn(i,s)?String(i[s]):(k(`message "${e}" wants {${s}}`),t)):t.length>0?r.replace(C,(s,r)=>{const i=Number(r);return i>=t.length?(k(`message "${e}" wants {${r}}`),s):String(t[i])}):r}static date(e,t){return L(Intl.DateTimeFormat,this.locale,t).format(e)}static number(e,t){return L(Intl.NumberFormat,this.locale,t).format(e)}static bytes(e){const t=L(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 failure(e){return Array.isArray(e?.problems)&&e.problems.length>0?e.problems.map(e=>{return t=e,("string"==typeof t?.reason&&""!==t.reason.trim()?t.reason:void 0)??P.t.call(this,"failure.no-reason");var t}).join("\n"):void 0!==e?.message?String(e.message):null==e?"":String(e)}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),failure:s(P.failure)}}}var R=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 N extends Error{constructor(e,t,s){super(e,{cause:s}),this.name="Failure",this.problems=t}dropping(e){return new N(this.message,N.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}))}}class M{static STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";static URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";static encode(e,t){const s=t||M.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||M.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}}class F{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;#z;constructor(e,t){this.#D=e,this.#z=t}get normalized(){return`${this.#D}/${this.#z}`}get type(){return this.#D}get subtype(){return this.#z}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 z extends N{constructor(e,t,s,r){super(e,s,r),this.name="HttpClientError",this.status=t}dropping(e){return new z(this.message,this.status,N.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 z(s,0,[z.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(()=>z.#I);if(t===z.#I)return z.#$(e);if(!Array.isArray(t))return z.#$(e,"as a failures array");const s=`${e.status} ${e.statusText}: ${t.length} failures`;return new z(s,e.status,t)}case"application/problem+json":{const t=await e.json().catch(()=>z.#I);if(t===z.#I)return z.#$(e);if("object"!=typeof t||null===t||Array.isArray(t))return z.#$(e,"as a problem object");const s=`${e.status} ${e.statusText}: ${t.title} ${t.detail}`;return new z(s,e.status,t.problems||[z.problem("GENERIC_PROBLEM",s)])}default:return z.#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 z(r,e.status,[z.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 z(s,e.status,[z.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 z.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 z.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))this.header(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);for(const s of t.filter(e=>null!=e))this.#Q.append(e,s);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 z.fromResponse(e);return e}catch(e){if(e instanceof N)throw e;throw z.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:M,Failure:N,Hex:F,HttpClient:V,HttpClientBuilder:j,HttpClientError:z,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{static guard(e,t){window.addEventListener("beforeunload",t=>{e()&&t.preventDefault()},{signal:t})}}class ne{#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}}const ae=e=>{for(let t=e.parentElement;t;t=t.parentElement)if("function"==typeof t.describedBy)return t;return null};class oe{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 le{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,le.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(le.#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")&&(le.#te(r)&&r!==t||r.matches(":disabled")&&r!==t||(s=le.providePath(s,r.getAttribute("name"),le.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=le.#se(e);for(const[e,r]of Object.entries(le.flatten(t,"",new Set(s.keys()))))for(const t of s.get(e)??[])le.mutate(t,r)}static#se(e){const t=new Map;for(const s of e.elements){const e=s.getAttribute("name");if(!e)continue;const r=t.get(e);r?r.push(s):t.set(e,[s])}return t}static errors(e,t,s){const r=t=>t.closest("form")===e;Array.from(e.querySelectorAll("ful-field-error")).filter(r).forEach(e=>{e.setAttribute("aria-live",s?"off":"polite")});const i=e=>("FIELD_ERROR"===e.type||"INVALID_FORMAT"===e.type)&&e.context,n=t.filter(i),a=t.filter(e=>!i(e)),o=le.#se(e);for(const e of o.values())e.forEach(e=>{e.setCustomValidity?.("")});const l=[];n.forEach(e=>{const t=e.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=t.length;0!==s;--s){const r=t.slice(0,s).join("."),i=(o.get(r)??[]).filter(e=>"function"==typeof e.setCustomValidity);if(0===i.length)continue;const n=t.slice(s).join(".");return void i.forEach(t=>{t.setCustomValidity?.(e.reason,n)})}l.push(e)});const u=[...a,...l];e.querySelectorAll("ful-errors").forEach(e=>{if(!r(e))return;const t=e;if(e.setAttribute("role","alert"),0===u.length)return e.replaceChildren(),void e.setAttribute("hidden","");e.removeAttribute("hidden"),t.innerText=u.map(e=>e.reason).join("\n")}),0!==t.length&&s&&Array.from(e.elements).filter(e=>e.matches(":invalid")).sort((e,t)=>e.getBoundingClientRect().y-t.getBoundingClientRect().y)[0]?.focus()}}class ue extends S{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#re;#ie=null;#ne;#ae=[];#oe=null;#le;#ue;#ce;#de=[];constructor(){super(),this.internals.role=this.constructor.ROLE}#he(){return[this.#ue??this.#re,...this.#de].filter(e=>e)}#pe({fragment:e,control:t,error:s,label:r=null,described:i=null,claims:n=null,announces:a=t,freeze:o=null,also:l=[]}){if(this.#re=t,this.#le=s,this.#ue=n,this.#ce=a,this.#de=l,o&&o.addEventListener("click",e=>{this.readonly&&e.preventDefault()},!0),this.#ne=i??t,s&&(s.id=s.id||c.uid("ful-field-error"),this.#oe=s.id),this.#fe(),r&&ue.#me(this,r,t),this.addEventListener("keydown",e=>{if("Enter"!==e.key||e.defaultPrevented||e.isComposing)return;const t=e.target;t.form!==this.form&&ue.#ge(t)&&this._requestSubmit()}),this.replaceChildren(e),null!==this.#ie){const e=this.#ie;this.#ie=null,t.focus(e)}}static#ge(e){return e instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(e.type)}describedBy(e){return!!e&&(e.id||(e.id=c.uid("ful-described")),this.#ae.includes(e.id)||this.#ae.push(e.id),this.#fe(),!0)}#fe(){if(!this.#ne)return;const e=[...this.#ae,this.#oe].filter(e=>e);e.length&&this.#ne.setAttribute("aria-describedby",e.join(" "))}focus(e){this.#re?this.#re.focus(e):this.#ie=e??{}}setCustomValidity(e,t){if(c.set(this.#ce??this.#re,"aria-invalid",e?"true":null),!e)return this.internals.setValidity({}),void(this.#le.innerText="");this.internals.setValidity({customError:!0}," "),this.#le.innerText=e}get form(){return this.internals.form}_requestSubmit(){const e=this.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#be=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#me(e,t,s){if(!ue.#be.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.#he())t.toggleAttribute("disabled",e)}get readonly(){return this.hasAttribute("readonly")}set readonly(e){for(const t of this.#he())t.readOnly=e;this.#ce&&c.set(this.#ce,"aria-readonly",e?"true":null),this.reflectTo("readonly",e)}get required(){return this.hasAttribute("required")}set required(e){this.#ce&&c.set(this.#ce,"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.#pe(e));this.#pe(t)}_build(e){throw new Error(`${this.constructor.name} must implement _build`)}}class ce{#ve;#ye;#U;#we;#Ee;constructor(e,t,s,r,i){this.#ve=e,this.#ye=t,this.#U=s,this.#we=r,this.#Ee=i}prepare(e,t){return this.#we(e,t)}async submit(e,t){return await this.#ve.request(this.#U,this.#ye).json(e).fetch()}transform(e,t){return this.#Ee(e,t)}}class de{#we;#Ee;constructor(e,t){this.#we=e,this.#Ee=t}async prepare(e,t){return await this.#we(e,t)}async submit(e,t,s){return s}async transform(e,t){return await this.#Ee(e,t)}}class he{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 de(r,i);const a=e.declared("method")??"POST";return new ce(s,n,a,r,i)}}const pe=e=>void 0!==e.form?e.form:e.constructor?.formAssociated?e.internals?.form:void 0;class fe extends S{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 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=>{pe(e.target)===this.form&&e.target.setCustomValidity?.("")}),this.replaceChildren(e),this.#xe=this.declared("track-changes")||this.declared("guard-leave"),this.#xe&&(this.addEventListener("input",e=>this.#Ae(e.target)),this.addEventListener("change",e=>this.#Ae(e.target)),this.addEventListener("focusin",e=>this.#Se(e.target)),A.waitForChildren(this).catch(()=>{}).then(()=>this.commit()),this.#Te())}connectedCallback(){super.connectedCallback(),this.#xe&&this.#Te()}disconnectedCallback(){this.#Ce?.abort(),this.#Ce=null}#_e=!1;async submit(e){if(this.#_e)return!1;let t,s;this.#_e=!0,this.spinner(!0);try{const r=this.component(this.declared("loader")??"loaders:form").create(this);t=le.extractFrom(this.form,e);const i=this.#xe?{saved:this.#Oe(),upTo:this.#ke}:null;s=await r.prepare(t,this);const n=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:e,values:t,request:s}});if(!this.dispatchEvent(n))return!1;this.errors=[];const a=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:n.detail.values,request:n.detail.request}});let o=await re.fireAsync(this,a,{mode:"pipeline"});s=a.detail.request,o=await r.submit(s,this,o);const l=await r.transform(o,this);return i&&this.#qe(i.saved,i.upTo),this.dispatchEvent(new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:s,response:l}})),!0}catch(r){return this.dispatchEvent(new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:s,exception:r}})),r instanceof N?this.errors=r.problems:console.warn("failed to submit form",this,"reason:",r),!1}finally{this.#_e=!1,this.spinner(!1)}}async save(e){return!(!this.#xe||this.dirty)||await this.submit(e)&&!this.dirty}reset(){if(this.form.reset(),this.#xe){for(const e of new Set([...this.#Le.keys(),...this.#Oe().keys()]))this.#Pe.set(e,++this.#ke);this.#Re()}}#Le=new Map;#Ne=new Map;#Pe=new Map;#ke=0;#Me=!1;#Fe=0;#Ce=null;#xe=!1;get dirty(){if(!this.#xe)return!1;for(const e of this.#Pe.keys()){const t=this.#De(e);if((this.#Le.has(e)||"[]"!==t)&&(this.#Le.get(e)??this.#Ne.get(e))!==t)return!0}return!1}commit(){this.#xe&&this.#qe(this.#Oe(),this.#ke)}edited(...e){for(const t of e)this.#Ae(t)}#qe(e,t){this.#Le=e;for(const[e,s]of this.#Pe)s<=t&&this.#Pe.delete(e);for(const t of this.#Ne.keys())e.has(t)&&this.#Ne.delete(t);this.#Re()}#ze(e){for(let t=e;t&&t!==this;t=t.parentElement)if(pe(t)===this.form&&t.hasAttribute("name"))return t.getAttribute("name");return null}#Ae(e){if(!this.#xe)return;const t=this.#ze(e);null!==t&&(this.#Pe.set(t,++this.#ke),0===this.#Fe&&(this.#Fe=requestAnimationFrame(()=>this.#Re())))}#Se(e){const t=this.#ze(e);null===t||this.#Le.has(t)||this.#Ne.has(t)||this.#Ne.set(t,this.#De(t))}#Ie(){return Array.from(this.form.elements).filter(e=>e.hasAttribute("name")&&!["submit","reset","button"].includes(e.type)&&!e.matches(":disabled"))}#Oe(){const e=new Map;for(const t of this.#Ie()){const s=t.getAttribute("name");e.set(s,[...e.get(s)??[],le.extract(t)])}return new Map(Array.from(e,([e,t])=>[e,JSON.stringify(t)]))}#De(e){return JSON.stringify(this.#Ie().filter(t=>t.getAttribute("name")===e).map(e=>le.extract(e)))}#Re(){cancelAnimationFrame(this.#Fe),this.#Fe=0;const e=this.dirty;this.querySelectorAll("button").forEach(t=>{const s=t;s.form===this.form&&"submit"===s.type&&s.toggleAttribute("data-ful-dirty",e)}),e!==this.#Me&&(this.#Me=e,e?this.internals.states.add("dirty"):this.internals.states.delete("dirty"),this.dispatchEvent(new CustomEvent("dirty:change",{bubbles:!0,cancelable:!1,detail:{dirty:e}})))}#Te(){this.declared("guard-leave")&&!this.#Ce&&(this.#Ce=new AbortController,ie.guard(()=>this.dirty,this.#Ce.signal))}#$e=0;#Be(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.#$e,1!==this.#$e)return}else if(this.#$e=Math.max(0,this.#$e-1),0!==this.#$e)return;c.set(this,"aria-busy",e?"true":null),this.querySelectorAll("ful-spinner").forEach(t=>{if(t.closest("form")!==this.form)return;const s=t;e?this.#Be(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(t=>{const s=t;if(s.form===this.form&&("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){le.mutateIn(this.form,e)}get values(){return le.extractFrom(this.form)}set errors(e){le.errors(this.form,e,this.declared("scroll-on-error"))}}const me=new t(100),ge=(e,t)=>me.getOrCompute(`${e}:${t}`,()=>{try{return new RegExp(t,"g")}catch(s){return console.warn(`invalid ${e} attribute`,t,s),null}}),be={numeric:"numeric",decimal:"decimal"},ve=new Set(["date","time","datetime-local","month","week"]),ye={numeric:e=>e.replace(/\D/g,""),decimal:e=>{const t=e.replace(/[^\d.,]/g,""),s=t.search(/[.,]/);return-1===s?t:t.slice(0,s+1)+t.slice(s+1).replace(/[.,]/g,"")}};class we extends ue{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;#je=[];_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:e}){const t=this._type(),s=be[t],r=s?"text":t,i=this.template().withOverlay({type:r,slots:e}).render();this.#je=[...i.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#je[0];const n=this.declared("autocomplete")??(this.closest("form")?.getAttribute("autocomplete")??null);const a=(e=>{const t=e.declared("keep"),s=e.declared("reject");if(null!==t&&null!==s&&console.warn("a ful-input declares both keep and reject: keep is applied, reject is ignored",e),null!==t){const e=ge("keep",t);return e&&(t=>(t.match(e)??[]).join(""))}if(null!==s){const e=ge("reject",s);return e&&(t=>t.replace(e,""))}return((e,t)=>{const s=ye[e];return s?t?s:e=>((e,t)=>(e.startsWith("-")?"-":"")+t(e))(e,s):null})(e._type(),e.declared("unsigned"))})(this);for(const e of this.#je)this.#He(e,s,n,a);return{fragment:i,control:this._input,error:i.querySelector("ful-field-error"),label:i.querySelector("label")}}#He(e,t,s,r){t&&c.set(e,"inputmode",t),c.set(e,"autocomplete",s);const i=e.id;c.forward("input-",this,e),e!==this._input&&c.set(e,"id",i||null),this.#We(e),e.addEventListener("input",()=>{if(!r)return;const t=e.value,s=r(t);if(t===s)return;const i=e.selectionStart;if(e.value=s,null===i)return;const n=r(t.slice(0,i)).length;e.setSelectionRange(n,n)})}#We(e){if(!ve.has(e.type))return void e.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});let t=null,s=!1;const r=()=>{s=!1;const e=JSON.stringify(this.value);e!==t&&(t=e,this._notifyChange())};e.addEventListener("focus",()=>{t=JSON.stringify(this.value)}),e.addEventListener("keydown",e=>{"Enter"!==e.key||e.isComposing?s=!0:r()}),e.addEventListener("blur",r),e.addEventListener("change",e=>{e.stopPropagation(),s||r()})}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;const n="decimal"===this._type()?i.replaceAll(",","."):i;if("number"===this.declared("v-type")){const e=Number(n);return Number.isNaN(e)?n:e}return n}set value(e){this._input.value=""===e||null==e?"":`${e}`}get placeholder(){const e=this._input.getAttribute("placeholder");return" "===e?null:e}set placeholder(e){for(const t of this.#je)c.set(t,"placeholder",e??" ");this.reflectTo("placeholder",e)}}const Ee=e=>""===e?null:e;class xe 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 Ae extends S{static attributes=["locale","default"];render(){const e=this.textContent.trim(),t=""===e?null:new Date(Ae.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#Ve(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?new Date(`${e}T00:00:00`):new Date(e)}static isoToLocal(e){const t=Ae.#Ve(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=Ae.#Ve(e);return Number.isNaN(t.getTime())?null:t.toISOString()}}class Se extends we{static observed=["step","min","max"];_type(){return"date"}get min(){return Ee(this._input.min)}set min(e){this._input.min=Se.#Ue(e)}get max(){return Ee(this._input.max)}set max(e){this._input.max=Se.#Ue(e)}get step(){return Ee(this._input.step)}set step(e){this._input.step=e??""}static#Ue(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 Te extends Se{_type(){return"time"}get min(){return Ee(this._input.min)}set min(e){this._input.min=this.#Ge(e)}get max(){return Ee(this._input.max)}set max(e){this._input.max=this.#Ge(e)}#Ge(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 Te.#Qe(t,Number(this._input.step)||60)}static#Qe(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 Ce extends we{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){return Ae.localToIso(this._input.value)}set value(e){super.value=e?Ae.isoToLocal(e):""}get min(){return Ae.localToIso(this._input.min)}set min(e){this._input.min=e?Ae.isoToLocal(e):""}get max(){return Ae.localToIso(this._input.max)}set max(e){this._input.max=e?Ae.isoToLocal(e):""}get step(){return Ee(this._input.step)}set step(e){this._input.step=e??""}}class _e extends we{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"];#Ke;#Je;#Xe;#Ye;#Ze;_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>"};#et;_build(e){const t=super._build(e),s=t.fragment;return this.#Je=s.querySelector("ful-item-list"),this.#et=e.slots?.items&&!u.isBlank(e.slots.items)?x.fromFragment(e.slots.items):null,this.#Xe=s.querySelector("[data-ref=dropzone]"),this.#Ye=s.querySelector("ful-field-warnings"),this.#Ze=s.querySelector("ful-control-group"),this.#Ye.addEventListener("animationend",e=>{e.target.remove()}),this.#Je.addEventListener("click",e=>{if(!e.target.closest("button"))return;if(!this._interactive())return;const t=[...this.#Je.children].indexOf(e.target.closest("ful-item"));-1!==t&&(this.files=_e.list([...this.files].filter((e,s)=>s!==t)),this._notifyChange())}),this.#Xe.addEventListener("click",e=>{this._interactive()&&this._input.click()}),this.#Xe.addEventListener("dragover",e=>{e.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#Xe.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#Xe.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=_e.list(t),this._notifyChange())}),this._input.addEventListener("change",e=>{this.#tt()}),{...t,freeze:this.#Ze}}#tt(){this.setCustomValidity(),this.#Ye.replaceChildren(),this.#st(),this.#rt(),this.#it(),this.#nt(),(this.#et??this.template("items")).withOverlay({files:this.files}).renderTo(this.#Je)}warning(e,t){this.template("warning").withOverlay({key:e,args:t}).appendTo(this.#Ye);const s=this.#Ye.lastElementChild;setTimeout(()=>s.remove(),_e.WARNING_TIMEOUT)}#at(e){const t=e.name.toLowerCase();return this.#Ke.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})}#st(){if(!this.#Ke.length)return;const e=[...this.files].filter(e=>!this.#at(e));0!==e.length&&(this.warning("files.unacceptable-file-type",{types:this.#Ke.join(", ")}),this._input.files=_e.list([...this.files].filter(t=>!e.includes(t))))}#nt(){null!==this.#ot&&(this.files.length<=this.#ot||(this.warning("files.max-files-exceeded",{count:this.#ot}),this._input.files=_e.list()))}#rt(){if(null===this.#lt)return;const e=[...this.files].filter(e=>e.size>this.#lt);0!==e.length&&(this.warning("files.max-file-size-exceeded",{size:P.of().bytes(this.#lt)}),this._input.files=_e.list([...this.files].filter(t=>!e.includes(t))))}#it(){null!==this.#ut&&([...this.files].reduce((e,t)=>e+t.size,0)<=this.#ut||(this.warning("files.max-total-size-exceeded",{size:P.of().bytes(this.#ut)}),this._input.files=_e.list()))}get accept(){return this.#Ke}set accept(e){this._input.accept=e.join(","),this.#Ke=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.#tt()}get file(){return this.files[0]??null}set file(e){this.files=_e.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=_e.list())}formResetCallback(){this.value=null}get totalsize(){return Array.from(this.files).reduce((e,t)=>e+t.size,0)}#ot;get maxFiles(){return this.#ot}set maxFiles(e){this.#ot=e,this.reflectTo("max-files",e)}#lt;get maxFileSize(){return this.#lt}set maxFileSize(e){this.#lt=e,this.reflectTo("max-file-size",e)}#ut;get maxTotalSize(){return this.#ut}set maxTotalSize(e){this.#ut=e,this.reflectTo("max-total-size",e)}#ct;get itemList(){return this.#ct}set itemList(e){this.#ct=e,this.reflectTo("item-list",e)}#dt;get dropzone(){return this.#dt}set dropzone(e){this.#dt=e,this.reflectTo("dropzone",e)}}const Oe=new Map;let ke=0,qe=!1;const Le=(e,t,s)=>Math.min(Math.max(e,t),Math.max(t,s)),Pe=(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){e.style.removeProperty("width"),e.style.removeProperty("min-width"),e.style.removeProperty("max-width");const t=Math.min(parseFloat(l.maxWidth)||a,a-16);e.style.minWidth=`${Math.min(i.width,a-16)}px`,e.style.maxWidth=`${t}px`;const s=e.getBoundingClientRect().width;e.style.left=`${Le(i.left,8,a-s-8)}px`;const r=e.getBoundingClientRect().height,n=i.bottom+u,c=n+r<=o-8?n:i.top-d-r;return void(e.style.top=`${Le(c,8,o-r-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=Le(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=`${Le(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)},Re=()=>{ke=0;for(const[e,t]of Oe)e.isConnected&&t.invoker.isConnected?Pe(e,t):Oe.delete(e)},Ne=()=>{!ke&&Oe.size>0&&(ke=requestAnimationFrame(Re))};class Me{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,"button"===e.localName||"input"===e.localName?e.setAttribute("popovertarget",t.id):(e.addEventListener("click",()=>t.togglePopover()),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t.togglePopover())})));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&&((e,t)=>{e.style.visibility="hidden",queueMicrotask(()=>{e.matches(":popover-open")&&Pe(e,t),e.style.removeProperty("visibility")})})(t,u)}),t.addEventListener("toggle",e=>{"open"===e.newState?(Oe.set(t,u),Pe(t,u)):(Oe.delete(t),(e=>{for(const t of["top","left","right","bottom","margin","max-width","min-width","width","visibility","--ful-note-callout-inline","--ful-note-callout-block"])e.style.removeProperty(t)})(t))}),qe||(qe=!0,document.addEventListener("scroll",Ne,!0),window.addEventListener("resize",Ne))}static show(e,t,{flip:s=!1,gap:r=0}={}){return"function"!=typeof e.showPopover||e.matches(":popover-open")||e.showPopover(),(()=>{const i=t instanceof Element?t.getBoundingClientRect():t,n=document.documentElement,a=e.getBoundingClientRect(),o=i.bottom+r,l=i.top-r-a.height,u=s&&o+a.height>n.clientHeight-8&&l>=8?l:o;e.style.right="auto",e.style.bottom="auto",e.style.margin="0",e.style.left=`${Le(i.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,e.style.top=`${Le(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),e}}const Fe=(e,t)=>e.filter(({key:e})=>t.some(t=>t==e)),De=(e,t)=>e.filter(({label:e})=>(e??"").toLowerCase().includes(t?.toLowerCase()??""));class ze{#ve;#ye;#U;#Ee;#ht;#pt;#C=null;#ft=null;#mt=new ne;constructor({http:e,url:t,method:s,responseMapper:r,prefetch:i,revision:n}){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r,this.#ht=i,this.#pt=n}async prefetch(){this.#ht&&await this.#gt()}async exact(...e){return Fe(await this.#gt(),e)}async load(e){return De(await this.#gt(),e)}async invalidate(){this.#mt.invalidate(),this.#C=null,this.#ft=null}async#gt(){if(null===this.#C){if(null===this.#ft){const e=this.#mt.hold();this.#ft=ze.#bt(this.#ve,this.#U,this.#ye,this.#pt).then(t=>{e.stale||(this.#C=this.#Ee(t))}).finally(()=>{e.stale||(this.#ft=null)})}await this.#ft}if(null===this.#C)throw new Error("superseded by an invalidation");return this.#C}static async#bt(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 Ie{#ve;#ye;#U;#Ee;constructor({http:e,url:t,method:s,responseMapper:r}){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r}async invalidate(){}async exact(...e){const t=await this.#ve.request(this.#U,this.#ye).param("k",...e).fetchJson();return this.#Ee(t)}async load(e){const t=await this.#ve.request(this.#U,this.#ye).param("s",e).fetchJson();return this.#Ee(t)}}class $e{#C;constructor(e){this.#C=e}update(e){this.#C=e}async invalidate(){}exact(...e){return Fe(this.#C,e)}load(e){return De(this.#C,e)}}class Be{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 Ie({http:t,url:s,method:r,responseMapper:o}):new ze({http:t,url:s,method:r,responseMapper:o,prefetch:n,revision:a}):new $e(e??[])}static create(e,t){if(!e.declared("src")){const e=Array.from(t.options?.querySelectorAll("option")??[]);return Be.from({data:e.map(e=>({key:e.getAttribute("value")??e.innerText.trim(),label:e.innerText.trim(),metadata:void 0}))})}return Be.from({http:e.component("http-client"),url:e.declared("src"),method:e.declared("method")??"POST",mode:e.declared("mode"),prefetch:e.declared("preload"),revision:Be.#vt(e),responseMapper:Be.#yt(e)})}static#vt(e){const t=e.declared("revision");if(""!==t)return t;const s=e.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",e),null):"function"==typeof s?s():s}static#yt(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 je 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 <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 '};#wt;#Et;#xt;#At;#X=new Map;#St=new ne;render({slots:e}){const t=this.template().render();this.#At=u.isBlank(e.default)?this.template("options"):x.fromFragment(e.default),this.#wt=t.querySelector("ful-spinner"),this.#xt=t.querySelector("[data-ref=empty]"),this.#Et=t.querySelector("menu"),this.#Et.id=this.declared("listbox")||c.uid("ful-listbox"),this.#Et.addEventListener("mousedown",e=>{e.target.closest("li")&&e.preventDefault()}),this.#Et.addEventListener("click",e=>{e.stopPropagation();const t=e.target.closest("li");t?t.matches('[aria-disabled="true"]')||this.#Tt(t):this.hide()}),this.replaceChildren(t)}#Ct(){return this.#Et?.querySelector('[selected]:not([aria-disabled="true"])')??this.#Et?.querySelector('li:not([aria-disabled="true"])')??null}#_t(e){if(e){for(const t of this.#Et.querySelectorAll("li"))t.toggleAttribute("selected",t===e);e.id||=c.uid("ful-option"),this.#Ot(e.id),e.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#Ot(null)}acceptSelection(){const e=this.#Ct();e&&this.#Tt(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.#At.withOverlay(s).renderTo(this.#Et);for(const[s,r]of[...this.#Et.children].entries()){const i=e[s],n=t.some(e=>e==i?.key);r.toggleAttribute("picked",n),r.setAttribute("aria-selected",n?"true":"false");const a=!!i?.metadata?.disabled;a?r.setAttribute("aria-disabled","true"):r.removeAttribute("aria-disabled"),a&&i.metadata.reason?r.setAttribute("title",String(i.metadata.reason)):r.removeAttribute("title")}this.#xt.toggleAttribute("hidden",0!==e.length),this.#Et.toggleAttribute("hidden",0===e.length);const r=e.findIndex(({key:e})=>t.some(t=>t==e));this.#_t(r>=0?this.#Et.children[r]:this.#Ct())}#Tt(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.#St.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#Ot(null)}#Ot(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.#St.take();this.matches(":popover-open")||this.showPopover(),this.#Et.setAttribute("hidden",""),this.#wt.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.#wt.setAttribute("hidden","")}}async moveOrShow(e,t,s=[]){if(this.shown){const t=this.#Ct(),s=t?.[(e?"next":"previous")+"ElementSibling"],r=s?this.#kt(s,e):null;return void(t&&r&&this.#_t(r))}await this.show(t,s)}#kt(e,t){for(let s=e;s;s=s[(t?"next":"previous")+"ElementSibling"])if(!s.matches('[aria-disabled="true"]'))return s;return null}jump(e){const t=e?this.#Et.firstElementChild:this.#Et.lastElementChild,s=this.#kt(t,e);s&&this.#_t(s)}page(e){const t=this.#Ct();if(!t)return;let s=t;for(let t=0;t!==this.#qt();++t){const t=this.#kt(s[(e?"next":"previous")+"ElementSibling"],e);if(!t)break;s=t}this.#_t(s)}#qt(){const e=this.#Et.firstElementChild;return e&&0!==e.offsetHeight?Math.max(1,Math.trunc(this.#Et.clientHeight/e.offsetHeight)):1}}class He extends ue{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(e,t){return"value"!==e||""!==t||this.hasAttribute("multiple")?super.unmarshal(e,t):[""]}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 '};#Lt;#Pt={src:null,method:null};#X;#re;#Rt;#Nt;#Je;#et;#Mt;#Ft=!1;#Dt=new Map;#zt=new ne;#It=!1;#$t;#Bt;_build({slots:e}){const t=this.declared("name");this.#X=e.options,this.#jt(),this.#Mt=this.declared("multiple"),this.#Lt.prefetch?.()?.catch(e=>{console.warn("failed to prefetch select options",this,"reason:",e)});const s=this.template().withOverlay({slots:e,name:t}).render();this.#Nt=s.querySelector("ful-control > input"),this.#Je=s.querySelector("ful-item-list"),this.#et=e.items&&!u.isBlank(e.items)?x.fromFragment(e.items):null,c.forward("input-",this,this.#Nt),this.#re=s.querySelector("ful-control"),this.#Rt=s.querySelector("ful-dropdown");const r=c.uid("ful-listbox");this.#Rt.setAttribute("listbox",r),this.#Nt.setAttribute("aria-controls",r),this.#Rt.addEventListener("beforetoggle",e=>{const t="open"===e.newState;this.#Nt.setAttribute("aria-expanded",t?"true":"false"),t||this.#Nt.removeAttribute("aria-activedescendant")}),this.#Rt.addEventListener("activechange",e=>{c.set(this.#Nt,"aria-activedescendant",e.detail.id)});const i=s.querySelector("ful-control-group");return Me.wire(i,this.#Rt,{prefix:"ful-select",stretch:!0}),[this.#$t,this.#Bt]=oe.throttle(400,()=>this.#Ht()),this.#Wt(),this.#Vt(),this.#Ut(),this.#Gt(),{fragment:s,control:this.#Nt,error:s.querySelector("ful-field-error"),label:s.querySelector("label")}}#Wt(){this.addEventListener("click",e=>{if(!this._interactive())return;const t=e.target.closest('button, [role="button"], a[href], input, select, textarea');t&&t!==this.#Nt||(this.#Rt.shown?this.#Qt():(this.#Nt.focus(),this.#$t()))}),this.#Je.addEventListener("click",e=>{e.stopPropagation(),e.target.closest("button")&&this._interactive()&&this.#Kt([...this.#Je.children].indexOf(e.target.closest("ful-item")))}),this.#re.addEventListener("click",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t&&(e.stopPropagation(),this.#Jt(t))})}#Vt(){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.#Nt&&0===this.#Nt.selectionStart&&0===this.#Nt.selectionEnd&&this.#Yt().at(-1)?.focus()})}#Ut(){this.#Nt.addEventListener("change",e=>{e.stopPropagation()}),this.#Nt.addEventListener("focus",()=>{this.#It||this.#Nt.select()}),this.#Nt.addEventListener("blur",e=>{e.stopPropagation(),e.relatedTarget&&this.contains(e.relatedTarget)||(this.#Bt(),this.#Qt(!0))}),this.#Nt.addEventListener("keydown",e=>{this._interactive()&&this.#Zt(e)}),this.#Nt.addEventListener("input",e=>{e.stopPropagation(),this._interactive()&&(this.#It=!0,this.#$t())})}#Gt(){this.#Rt.addEventListener("change",e=>{e.stopPropagation(),this._interactive()?(this.#Mt||this.#Dt.clear(),this.#It=!1,this.#Dt.set(this.#es(e.detail.entry.key),e.detail.entry),this.#ts(),this.#Nt.focus(),this.#Rt.hide(),this.#Mt||this.#Nt.select()):this.#Qt()})}async withLoader(e){return await e(this.#Lt)}async reload(){await(this.#Lt.invalidate?.()),await(this.#Lt.prefetch?.());const e=[...this.#Dt.keys()];0!==e.length&&await this.#i(e,this.#zt.take())}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#ss()&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#ss()&&this.reload()}async reconfigure(e,{notify:t=!1}={}){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);this.#ss();const s=[...this.#Dt.keys()];await this.reload();const r=[...this.#Dt.keys()];t&&r.length!==s.length&&this._notifyChange({entry:this.entry})}#jt(){this.#Pt={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Lt=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#X})}#ss(){return(this.getAttribute("src")!==this.#Pt.src||this.getAttribute("method")!==this.#Pt.method)&&(this.#Bt(),this.#Qt(),this.#jt(),!0)}#Yt(){return Array.from(this.#re.querySelectorAll(":scope > ful-badge"))}#Jt(e){this._interactive()&&this.#Kt(this.#Yt().indexOf(e))}#Kt(e){const t=Array.from(this.#Dt.keys())[e];void 0!==t&&(this.#Dt.delete(t),this.#ts())}#Xt(e,t){switch(e.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":e.preventDefault(),this.#Jt(t),this.#Nt.focus();break;case"ArrowLeft":e.preventDefault(),(this.#Yt()[this.#Yt().indexOf(t)-1]??this.#Nt).focus();break;case"ArrowRight":e.preventDefault(),(this.#Yt()[this.#Yt().indexOf(t)+1]??this.#Nt).focus();break;case"Escape":this.#Nt.focus()}}#Zt(e){switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),this.#rs(e);break;case"Home":this.#Rt.shown&&(e.preventDefault(),this.#Rt.jump(!0));break;case"End":this.#Rt.shown&&(e.preventDefault(),this.#Rt.jump(!1));break;case"PageDown":case"PageUp":this.#Rt.shown&&(e.preventDefault(),this.#Rt.page("PageDown"===e.code));break;case"Escape":this.#Bt(),this.#Qt();break;case"NumpadEnter":case"Enter":if(!this.#Rt.shown)return;e.preventDefault(),this.#It=!1,this.#is(),this.#Rt.acceptSelection();break;case"Backspace":0===this.#Nt.selectionStart&&0===this.#Nt.selectionEnd&&this.#Kt(this.#Dt.size-1);break;case"Tab":this.#Bt(),this.#Qt(!0)}}#rs(e){const t="ArrowDown"===e.code;e.altKey?t&&!this.#Rt.shown?this.#Ht():!t&&this.#Rt.shown&&this.#Qt():this.#Rt.moveOrShow(t,()=>this.#Lt.load(this.#ns()),[...this.#Dt.keys()])}#Qt(e=!1){this.#Rt.hide();const t=e&&this.#It&&!this.#Mt&&""===this.#Nt.value&&0!==this.#Dt.size;this.#It=!1,t&&(this.#Dt.clear(),this.#ts()),this.#is()}#Ht(){return this.#Rt.show(()=>this.#Lt.load(this.#ns()),[...this.#Dt.keys()])}#ns(){return this.#It?this.#Nt.value:""}get query(){return this.#ns()}#is(){const e=this.#Dt.values().next().value;this.#Nt.value=this.#Mt?"":e?.label??""}#as(){return[...this.#Dt.values()]}#ts(){this.#os(),this._notifyChange({entry:this.entry})}#os(){const e=this.#Mt?Array.from(this.#Dt.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.#re.querySelectorAll(":scope > ful-badge"))e.remove();this.#Nt.before(...e),this.#It||this.#is(),this.#Je.replaceChildren(),(this.#et??this.template("items")).withOverlay({entries:this.#as()}).renderTo(this.#Je)}#es(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.#es(e));!this.#Ft&&t.some(e=>"string"==typeof e&&e.includes(","))&&(this.#Ft=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#Dt=new Map(t.map(e=>[e,{key:e,label:e,metadata:void 0}]));const s=this.#zt.take();this.#re&&(this.#os(),0!==t.length&&this.#i(t,s))}async#i(e,t){const s=await this.#Lt.exact(...e);if(t.stale)return;const r=new Map(s.map(e=>[this.#es(e.key),e]));for(const t of e)this.#Dt.has(t)&&(r.has(t)?this.#Dt.set(t,r.get(t)):this.#Dt.delete(t));this.#os()}get value(){return this.#Mt?[...this.#Dt.keys()]:[...this.#Dt.keys()][0]??null}get entry(){const e=this.#as();return this.#Mt?e:e[0]??null}#ct;get multiple(){return this.#Mt}set multiple(e){this.#Mt=e,this.reflectTo("multiple",e)}get itemList(){return this.#ct}set itemList(e){this.#ct=e,this.reflectTo("item-list",e)}}class We extends ue{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 ';#ls;#us;#cs;_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.#ls=i.firstElementChild,this.#us=i.querySelector("input[type=radio]"),this.#cs="boolean"===this.declared("type"),{fragment:i,control:this.#us,error:i.querySelector("ful-field-error"),described:this,claims:this.#ls,announces:this,freeze:this.#ls}}get value(){const e=this.querySelector("input[type=radio]:checked");return e?this.#cs?"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 Ve extends ue{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 ';#ds;#Nt;_build({slots:e}){const t="switch"===this.declared("type"),s=this.template().withOverlay({slots:e,isSwitch:t}).render();this.#ds=s.firstElementChild,this.#Nt=s.querySelector("input"),c.forward("input-",this,this.#Nt),this.#Nt.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});const r=s.querySelector("label");return{fragment:s,control:this.#Nt,error:s.querySelector("ful-field-error"),label:r,freeze:this.#ds}}get value(){return this.#Nt.checked}set value(e){this.#Nt.checked=e}}class Ue extends S{static attributes=["sorter"];static observed=["order"];#hs;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:!1,detail:{value:{sorter:e,order:s}}}))}),this.addEventListener("keydown",e=>{["Enter","NumpadEnter","Space"].includes(e.code)&&(e.preventDefault(),this.click())})}get order(){return this.#hs||null}set order(e){this.#hs=e||null,this.reflectTo("order",this.#hs);const t=this.closest("th");t&&c.set(t,"aria-sort",this.#hs?"asc"===this.#hs?"ascending":"descending":null)}}class Ge 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 ';#ps=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:!1,detail:{value:Number(t.dataset.page??this.#W)}}))})}update({current:e,total:t}={}){void 0!==e&&(this.#W=e??0),void 0!==t&&(this.#ps=t??0),this.reflectTo("current",this.#W),this.reflectTo("total",this.#ps);const s=this.#W,r=this.#ps,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.#ps}set total(e){this.update({total:e})}get current(){return this.#W}set current(e){this.update({current:e})}}class Qe{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(const e of n){const t=h.queryChildren(e,"title"),s=e.getAttribute("sorter"),n=e.getAttribute("order"),a=t??document.createTextNode(e.getAttribute("title")??"");t?.remove(),e.removeAttribute("sorter"),e.removeAttribute("order"),e.removeAttribute("title");const o=s||n?(()=>{const e=document.createElement("ful-sorter");return s&&e.setAttribute("sorter",s),n&&e.setAttribute("order",n),e.append(a),e})():a,l=document.createElement("th"),u=document.createElement("td");for(const t of e.getAttributeNames()){const s=e.getAttribute(t);l.setAttribute(t,s??""),u.setAttribute(t,s??"")}l.append(o),u.append(...e.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 Ke{#C;constructor(e){this.#C=e}async load(e,t,s){const r=this.#fs(t),i=e.page*e.size,n=i+e.size;return{data:r.slice(i,n),size:r.length}}#fs(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{#ve;#ye;#U;#Ee;constructor(e,t,s,r=e=>e){this.#ve=e,this.#ye=t,this.#U=s,this.#Ee=r}async load(e,t,s){const r=Object.entries(s).filter(([e,t])=>t);return await this.#ve.request(this.#U,this.#ye).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.#Ee(e))}}class Xe{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 Ke([])}}class Ye extends S{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 "};#Lt;#ms;#J;#gs;#bs;#xt;#vs;#ys;#ws;#Es;#xs;#As={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#Ss=!1;#Ts=new ne;#Pt={src:null,method:null};get pageSize(){return this.#As.pageRequest.size}set pageSize(e){const t=e??10;t!==this.#As.pageRequest.size&&(this.#As={...this.#As,pageRequest:{page:0,size:t}},this.#Ss&&this.reload())}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#ss()&&this.#Ss&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#ss()&&this.#Ss&&this.reload()}async reconfigure(e){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);return this.#ss(),await this.reload()}#jt(){this.#Pt={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Lt=this.component(this.declared("loader")??"loaders:table").create(this)}#ss(){return(this.getAttribute("src")!==this.#Pt.src||this.getAttribute("method")!==this.#Pt.method)&&(this.#jt(),this.#As={...this.#As,pageRequest:{...this.#As.pageRequest,page:0}},!0)}async render({slots:e}){const t=this.template(),s=Qe.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.#jt(),this.#ms=s,this.#J=i.querySelector(":scope > tbody"),this.#gs=i.querySelector(":scope > tbody[data-ref=loading]"),this.#bs=i.querySelector(":scope > tbody[data-ref=initial]"),this.#xt=i.querySelector(":scope > tbody[data-ref=empty]"),this.#vs=this.#xt.querySelector("ful-empty[data-ref=empty-authors]"),this.#ys=e.empty&&!u.isBlank(e.empty)?x.fromFragment(e.empty):null,this.#ws=i.querySelector(":scope > tbody[data-ref=feedback]"),this.#Es=h.queryChildren(r,"ful-pagination"),this.replaceChildren(r);const n=this.querySelector("thead");s.headersTemplate.renderTo(n),this.#xs=n.querySelectorAll("ful-sorter"),await A.waitForChildren(this);const a=h.queryChildren(this,"ful-form");this.#As={pageRequest:{page:0,size:this.declared("page-size")??10},sortRequest:s.sort,filterRequest:a?.values??{}},a?.addEventListener("submit:success",async e=>{await this.#Cs(0,e.detail.request)}),this.addEventListener("page:requested",async e=>{await this.#Cs(e.detail.value,this.#As.filterRequest)}),this.addEventListener("sort:requested",async e=>{const t=e.detail.value.order?e.detail.value:null;await this.load(this.#As.pageRequest,t,this.#As.filterRequest),this.#As.sortRequest===t&&(this.#xs.forEach(e=>{e.order=null}),e.target.order=e.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){return await this.load(this.#As.pageRequest,this.#As.sortRequest,this.#As.filterRequest)}async load(e,t,s){this.#Ss=!0;const r=this.#Ts.take();let i;this.#gs.toggleAttribute("hidden",this.#J.childElementCount>0),this.#ws.setAttribute("hidden",""),this.#bs.setAttribute("hidden",""),this.#xt.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const n=await this.#Lt.load(e,t,s);if(r.stale)return;if(i=Math.max(0,Math.ceil(n.size/e.size)-1),e.page<=i)return this.#As={pageRequest:e,sortRequest:t,filterRequest:s},this.#tt(e,t,s,n),this.removeAttribute("aria-busy"),void this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:t,filterRequest:s,response:n}}))}catch(i){if(r.stale)return;throw this.#gs.setAttribute("hidden",""),this.#J.replaceChildren(),this.#ws.removeAttribute("hidden"),this.#ws.querySelector("[data-ref=feedback-error]").textContent=P.of().failure(i),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:t,filterRequest:s,exception:i}})),i}return await this.load({page:i,size:e.size},t,s)}async withLoader(e){return await e(this.#Lt)}async resetWithFilter(e){return await this.#Cs(0,e)}#Cs(e,t){return this.load({page:e,size:this.#As.pageRequest.size},this.#As.sortRequest,t)}#tt(e,t,s,r){const i=Math.ceil(r.size/e.size);this.#gs.setAttribute("hidden",""),this.#J.replaceChildren(this.template("row").withOverlay({schema:this.#ms,pageRequest:e,filterRequest:s,pageResponse:r}).render()),this.#xt.toggleAttribute("hidden",0!==r.data.length),this.#ys&&0===r.data.length&&this.#vs.replaceChildren(this.#ys.withOverlay({schema:this.#ms,pageRequest:e,filterRequest:s,pageResponse:r}).render()),this.#Es.update({current:e.page,total:i})}}const Ze=(e,t,{items:s,current:r=()=>null})=>{let i="",n=0;t.addEventListener("beforetoggle",s=>{"closed"===s.newState&&t.contains(document.activeElement)&&e.focus()}),t.addEventListener("toggle",e=>{if("open"!==e.newState)return;const t=s();(r()??t[0])?.focus()}),t.addEventListener("keydown",t=>{const r=t.target,a=s(),o=a.find(e=>e===r||e.contains(r));if(!o)return;const l=a.indexOf(o);switch(t.code){case"ArrowDown":return t.preventDefault(),void a[(l+1)%a.length]?.focus();case"ArrowUp":return t.preventDefault(),void a[(l-1+a.length)%a.length]?.focus();case"Home":return t.preventDefault(),void a[0]?.focus();case"End":return t.preventDefault(),void a[a.length-1]?.focus();case"Enter":case"NumpadEnter":case"Space":return t.preventDefault(),o.click(),void e.focus();case"Escape":return void e.focus()}if(1!==t.key.length||t.ctrlKey||t.altKey||t.metaKey)return;const u=Date.now();i=u-n>500?t.key:i+t.key,n=u;const c=i.toLowerCase(),d=[...c].every(e=>e===c[0]),h=d?c[0]:c,p=d?l+1:l,f=[...a.slice(p),...a.slice(0,p)].find(e=>(e.textContent??"").trim().toLowerCase().startsWith(h));f&&(t.preventDefault(),f.focus())})};class et{static narrow(e,t){const s=(e??[]).filter(e=>t.includes(e));return s.length>0?s:[...t]}#_s;#Et;#Os;#ks;#qs;#is;#Ls;#Ps;#Rs;#Ns=!1;#Ms=!1;constructor(e,{vocabulary:t,glyphs:s={},labelFor:r=e=>e,display:i=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#_s=e,this.#Et=e.nextElementSibling,this.#Os=t,this.#ks=s,this.#qs=r,this.#is=i??(e=>s[e]??e),this.#Ls=n,this.#Ps=a,this.#Rs=[...t],this.#Et.addEventListener("click",e=>{const t=e.target.closest("li > a");if(!t||!this.#Ls())return;const s=t.getAttribute("value"),r=this.value;this.value=s,this.#Et.hidePopover?.(),r!==s&&this.#Ps(s)})}get allowed(){return this.#Rs}set allowed(e){this.#Rs=et.narrow(e,this.#Os),this.#Fs(),!this.#Ms&&this.#Rs.length>1&&(this.#pe(),this.#Ms=!0),this.#Ds(),this.pinned&&(this.value=this.#Rs[0])}preferring(e){return null!==e&&this.#Rs.includes(e)?e:this.#Rs[0]}get pinned(){return this.#Rs.length<2}set fixed(e){this.#_s.toggleAttribute("hidden",!!e)}get value(){return this.#_s.getAttribute("value")}set value(e){this.#_s.setAttribute("value",e),this.#_s.textContent=this.#is(e),c.set(this.#_s,"aria-label",this.#qs(e)),this.#zs()}#zs(){const e=this.value;for(const t of this.#Je())t.setAttribute("aria-checked",String(t.getAttribute("value")===e))}set claimed(e){this.#Ns=e,this.#Ds()}#Fs(){this.#Et.replaceChildren(...this.#Rs.map(e=>{const t=document.createElement("li");t.setAttribute("role","none");const s=document.createElement("a");s.setAttribute("role","menuitemradio"),s.setAttribute("tabindex","-1"),s.setAttribute("value",e);const r=this.#qs(e),i=this.#ks[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})),this.#zs()}#Ds(){const e=this.pinned;this.#_s.toggleAttribute("disabled",e||this.#Ns),c.set(this.#_s,"aria-haspopup",e?null:"true"),c.set(this.#_s,"aria-expanded",e?null:"false"),e?this.#_s.removeAttribute("popovertarget"):this.#Et.id&&this.#_s.setAttribute("popovertarget",this.#Et.id)}#Je(){return Array.from(this.#Et.querySelectorAll("li > a"),e=>e)}#pe(){Me.wire(this.#_s,this.#Et,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),Ze(this.#_s,this.#Et,{items:()=>this.#Je(),current:()=>this.#Je().find(e=>e.getAttribute("value")===this.value)})}}const tt={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},st=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],rt=[...st,"CONTAINS","STARTS_WITH","ENDS_WITH"],it=["IGNORE_CASE","CASE_SENSITIVE"],nt={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:at}=P.of(),ot=e=>at(`filters.op.${e}`),lt=e=>at(`filters.sensitivity.${e}`),ut=e=>at(""===e?"filters.boolean.any":`filters.boolean.${e}`),ct=e=>e.querySelector(":scope > label")?.textContent.trim()||null,dt=(e,t,{singular:s,plural:r,vocabulary:i,fallback:n})=>{const a=e.declared(s);if(null===a)return;e.hasAttribute(r)&&console.warn(`${e.localName}: ${s} fixes what ${r} offers a menu for, the plural is ignored`,e);const o=i.includes(a);o||console.warn(`${e.localName}: '${a}' is not one of its ${r}, the default is pinned instead`,e),t.allowed=[o?a:n],t.fixed=!0},ht=(e,t,s)=>{const r=s.filter(e=>null!=e&&""!=`${e}`);return 0===r.length?null:{label:e,operator:t,operands:r.map(e=>`${e}`)}};class pt extends we{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(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 et(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:tt,labelFor:ot,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),dt(this,this._operator,{singular:"operator",plural:"operators",vocabulary:this._vocabulary(),fallback:this._defaultOperator()}),{...t,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(e){return e}_deserialize(e){return e}_defaultOperator(){return"EQ"}_vocabulary(){return st}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){null===this.declared("operator")&&(this._operator?(this._operator.allowed=e,this._syncBetween()):this._declaredOperators=et.narrow(e,this._vocabulary()))}get value(){return this._tuple()}set value(e){this._applyTuple(e)}_tuple(){const e=this._operator.value,t=this.#Is();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 criterion(){return ht(ct(this),this._operator.value,this.#Is())}#Is(){return"BETWEEN"===this._operator.value?[this._value1.value,this._value2.value]:[this._value1.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 ft extends pt{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(e){return Ae.localToIso(e)}_deserialize(e){return Ae.isoToLocal(e)}}class mt extends pt{_type(){return"date"}}class gt extends pt{_type(){return"number"}}class bt extends pt{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 rt}_sensitivityButton;_build(e){const t=super._build(e);return this._sensitivityButton=new et(t.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:it,glyphs:nt,labelFor:lt,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=it[0],dt(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:it,fallback:"IGNORE_CASE"}),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(null!==this.declared("sensitivity"))return;if(!this._sensitivityButton)return void(this._declaredSensitivities=et.narrow(e,it));const t=this._sensitivityButton.value;this._sensitivityButton.allowed=e,this._sensitivityButton.value=this._sensitivityButton.preferring(t)}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(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const vt=["","true","false"],yt={true:"✓",false:"✗"};class wt extends ue{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]");return this._operator=new et(t.querySelector("[data-ref=operator]"),{vocabulary:wt.OPERATORS,glyphs:tt,labelFor:ot,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new et(s,{vocabulary:vt,glyphs:yt,labelFor:ut,display:ut,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(wt.DEFAULT_OPERATOR),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=et.narrow(e,this._vocabulary())}_vocabulary(){return wt.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=""}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(wt.DEFAULT_OPERATOR))}get criterion(){const e=this._value.value;return ht(ct(this),this._operator.value,[""===e?"":ut(e)])}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 Et extends He{static attributes=["operator"];#$s(){const e=super.value;return this.multiple?e:null==e?[]:[e]}get value(){const e=this.#$s();if(0===e.length)return null;const t=this.declared("operator");return t?[t,...e]:e}set value(e){const t=this.declared("operator");let s=null==e?[]:Array.isArray(e)?e:[e];t&&s[0]===t&&(s=s.slice(1)),super.value=this.multiple?s:s[0]??null}get criterion(){return ht(ct(this),this.declared("operator"),[super.entry].flat().filter(e=>e).map(e=>e.label))}}class xt extends S{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:e}){const t=this.template().withOverlay({slots:e,icon:this.declared("icon")}).render(),s=t.querySelector("[data-ref=trigger]"),r=t.querySelector("[data-ref=content]");Me.wire(s,r,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),r.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(t),this.declared("describes")&&xt.#fe(this,s,r)}static#fe(e,t,s){ae(e)?.describedBy(s)?t.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",e)}}class At{#Bs=new WeakSet;#ue=new WeakMap;async request(e,t,s,r){const i=!this.#Bs.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.#Bs.add(t);let l=this.#ue.get(t);l||(l=new ne,this.#ue.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.#js(t,e),e}finally{cancelAnimationFrame(d),c()&&(t.toggleAttribute("loading",!1),t.removeAttribute("aria-busy"))}}#js(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=P.of().failure(t),e.prepend(s)}}class St{#Hs;#Ws;#Vs;#gs;#Us;#Gs=new At;#Qs=new ne;#Ks=null;constructor(e,t,s){this.#Hs=e,this.#Ws=t.querySelector("[data-ref=dialog]"),this.#Vs=t.querySelector(`[data-ref=${s}]`),this.#gs=t.querySelector("[data-ref=loading]"),this.#Us=t.querySelector("[data-ref=error]")}get dialog(){return this.#Ws}get section(){return this.#Vs}get dirty(){return Array.from(this.#Ws.querySelectorAll("ful-form")).some(e=>e.closest("dialog")===this.#Ws&&e.dirty)}dismiss(e,t,s){return this.#Ks?this.#Ks:this.#Hs.dispatchEvent(e)?e.cancelable?s&&this.dirty?(this.#Ks=s().then(e=>(e&&this.#Ws.open&&t(),e)).finally(()=>{this.#Ks=null}),this.#Ks):(t(),Promise.resolve(!0)):Promise.resolve(!0):Promise.resolve(!1)}onBackdrop(e){let t=!1;this.#Ws.addEventListener("mousedown",e=>{t=e.target===this.#Ws}),this.#Ws.addEventListener("click",s=>{t&&s.target===this.#Ws&&e()})}onSubmitted(e){this.#Vs.addEventListener("submit:success",t=>{t.target===h.queryChildren(this.#Vs,"ful-form")&&e(t.detail.response)})}restChrome(){this.#Us?.replaceChildren(),this.#Us?.setAttribute("hidden",""),this.#gs?.setAttribute("hidden",""),this.#Vs?.removeAttribute("hidden")}request(){return this.#Gs.request(this.#Hs,this.#Vs,null,null).catch(()=>{})}async update(e,t){const s=this.#Qs.take();this.#Vs.replaceChildren(),this.restChrome(),this.#gs?.removeAttribute("hidden"),this.#Vs.setAttribute("hidden",""),t();try{const t=await e();return s.stale?null:(this.#Vs.replaceChildren(t),this.#gs?.setAttribute("hidden",""),this.#Vs.removeAttribute("hidden"),this.#Vs)}catch(e){throw s.stale||(this.#Us?.removeAttribute("hidden"),this.#Us&&(this.#Us.textContent=P.of().failure(e)),this.#gs?.setAttribute("hidden",""),this.#Vs.setAttribute("hidden","")),e}}}let Tt=!1;const Ct=()=>{Tt||(Tt=!0,document.addEventListener("click",e=>{const t=e.target.closest?.("[dialog-target]");t&&document.getElementById(t.getAttribute("dialog-target"))?.open?.()}))};class _t extends S{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">\n <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>\n {{{{ slots.buttons }}}}\n </footer>\n </dialog>\n ';#Ws;#Js;#Xs=[];#Ys=null;render({slots:e}){const t=this.declared("requires-answer"),s=this.declared("close-on-submit"),r=this.template().withOverlay({slots:e,header:this.declared("header")??"",requiresAnswer:t,closeOnSubmit:s}).render();this.#Js=new St(this,r,"body"),this.#Ws=this.#Js.dialog;const i=r.querySelector("h2");i&&(i.id||=c.uid("ful-dialog-title"),this.#Ws.setAttribute("aria-labelledby",i.id)),this.#Ws.addEventListener("close",()=>{const e=this.#Zs();this.dispatchEvent(new CustomEvent("close",{detail:e})),this.#er(e)}),this.#Ws.addEventListener("click",e=>{const t=e.target.closest("button[data-result]")?.dataset.result;void 0!==t&&this.#Ws.close(t)}),t||this.#Js.onBackdrop(()=>this.dismiss("backdrop")),r.querySelector("[data-ref=close]")?.addEventListener("click",()=>this.dismiss("button")),s&&this.#Js.onSubmitted(e=>{this.#Ys={dismissed:!1,result:null,response:e},this.#Ws.close("submitted")}),this.#Ws.addEventListener("cancel",e=>{if(!e.cancelable)return this.#Ws.returnValue="",void this.#tr("escape",!1);e.preventDefault(),t||this.dismiss("escape")}),this.replaceChildren(r),Ct()}#Zs(){if(this.#Ys)return this.#Ys;const e=this.#Ws?.returnValue??"";return""===e?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:e,response:null}}#er(e){const t=this.#Xs;this.#Xs=[];for(const s of t)s(e)}disconnectedCallback(){this.#er(this.#Zs())}open(){return this.ask()}ask(){return this.#sr()&&(this.#Js.restChrome(),this.#Js.request()),new Promise(e=>{this.#Xs.push(e)})}async update(e){return await this.#Js.update(e,()=>this.#sr())}refresh(){return this.#Js.request()}dismiss(e){return this.#Ws.open?this.#tr(e,!0):Promise.resolve(!0)}#tr(e,t){return this.#Js.dismiss(new CustomEvent("dialog:dismiss",{cancelable:t,detail:{reason:e}}),()=>this.#Ws.close(""),this.declared("guard-dismiss")?Ot:null)}close(e){this.#Ws.close(e??"")}#sr(){return!this.#Ws.open&&(this.#Ws.returnValue="",this.#Ys=null,this.#Ws.showModal(),!0)}static async ask(e,t,s=[],{className:r}={}){const i=document.createElement("ful-dialog");if(i.setAttribute("header",e),r&&(i.className=r),"string"==typeof t?i.textContent=t:t&&i.append(t),s.length>0){const e=document.createElement("template");e.setAttribute("slot","buttons");for(const t of s){if(t instanceof Node){e.content.append(t);continue}const[s,r,i]=t,n=document.createElement("button");n.type="button",n.dataset.result=s,i&&(n.className=i),n.textContent=r,e.content.append(n)}i.append(e)}document.body.append(i);try{return await A.waitFor(i),await i.ask()}finally{i.remove()}}static async confirm(e,t,s={},r={}){const i=await _t.ask(e,t,[["cancel",s.cancel??P.of().t("dialog.cancel")],["confirm",s.confirm??P.of().t("dialog.confirm"),"ful-button"]],r);return!i.dismissed&&"confirm"===i.result}}const Ot=()=>{const e=P.of();return _t.confirm(e.t("dialog.discard.header"),e.t("dialog.discard.body"),{confirm:e.t("dialog.discard.confirm"),cancel:e.t("dialog.discard.cancel")})};class kt extends S{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 ';#Ws;#rr;#Js;#Ys=null;#Xs=[];#ir=!1;#nr=e=>{e.target===this.#Ws&&this.#ar()};render({slots:e}){const t=this.template().withOverlay({slots:e,title:this.declared("header")??""}).render();this.#Js=new St(this,t,"content"),this.#Ws=this.#Js.dialog,this.#rr=t.querySelector("[data-ref=title]"),this.#rr.id||=c.uid("ful-drawer-title"),this.#Ws.setAttribute("aria-labelledby",this.#rr.id);const s=this.declared("placement");s&&this.#Ws.setAttribute("placement",s),t.querySelector("[data-ref=close]").addEventListener("click",()=>this.dismiss("button")),this.#Js.onBackdrop(()=>this.dismiss("backdrop")),this.#Ws.addEventListener("cancel",e=>{if(!e.cancelable)return this.#or(),void this.#tr("escape",!1);e.preventDefault(),this.dismiss("escape")}),this.#Ws.addEventListener("click",e=>{const t=e.target.closest("button[data-result]")?.dataset.result;void 0!==t&&this.close(t)}),this.#Ws.addEventListener("close",()=>{const e=this.#Zs();this.dispatchEvent(new CustomEvent("close",{detail:e})),this.#er(e)}),this.declared("close-on-submit")&&this.#Js.onSubmitted(e=>{this.#Ys={dismissed:!1,result:null,response:e},this.close()}),this.replaceChildren(t),Ct()}get header(){return this.#rr.textContent}set header(e){this.#rr.textContent=e??""}async update(e,t){return this.header=e,await this.#Js.update(t,()=>this.#sr())}refresh(){return this.#Js.request()}#Zs(){return this.#Ys??{dismissed:!0,result:null,response:null}}#er(e){const t=this.#Xs;this.#Xs=[];for(const s of t)s(e)}disconnectedCallback(){this.#er(this.#Zs())}open(){return this.ask()}ask(){return this.#sr()&&(this.#Js.restChrome(),this.#Js.request()),new Promise(e=>{this.#Xs.push(e)})}dismiss(e){return this.#ir||!this.#Ws.open?Promise.resolve(!0):this.#tr(e,!0)}#tr(e,t){return this.#Js.dismiss(new CustomEvent("drawer:dismiss",{cancelable:t,detail:{reason:e}}),()=>this.close(),this.declared("guard-dismiss")?Ot:null)}close(e){!this.#ir&&this.#Ws.open&&(e&&(this.#Ys={dismissed:!1,result:e,response:null}),matchMedia("(prefers-reduced-motion: reduce)").matches?this.#Ws.close():(this.#Ws.setAttribute("closing",""),0!==this.#Ws.getAnimations().length?(this.#ir=!0,this.#Ws.addEventListener("animationend",this.#nr)):this.#ar()))}#ar(){this.#or(),this.#Ws.close()}#or(){this.#ir=!1,this.#Ws.removeEventListener("animationend",this.#nr),this.#Ws.removeAttribute("closing")}#sr(){return this.#or(),!this.#Ws.open&&(this.#Ys=null,this.#Ws.showModal(),!0)}}class qt extends S{static attributes=["for"];render(){const e=this.declared("for"),t=e?document.getElementById(e):null;if(!t)throw new Error(`ful-menu names no invoker: for="${e??""}" must name an element already in the page when the menu upgrades`);this.setAttribute("role","menu"),this.hasAttribute("popover")||this.setAttribute("popover",""),t.setAttribute("aria-haspopup","menu"),Me.wire(t,this,{prefix:"ful-menu",invoke:!0,expanded:!0}),Ze(t,this,{items:()=>this.items}),this.#zs(),this.addEventListener("click",e=>{const t=e.target;this.items.some(e=>e===t||e.contains(t))&&this.hidePopover()})}get items(){return this.#zs().filter(e=>!e.hasAttribute("disabled")&&!e.hasAttribute("hidden"))}#zs(){const e=[...this.querySelectorAll(":scope > button, :scope > a[href]")];for(const t of e)t.hasAttribute("role")||t.setAttribute("role","menuitem"),t.tabIndex=-1;return e}}const Lt=["info","success","warning","error"],Pt=new Set;let Rt=!1;class Nt extends S{static attributes=["timeout:number"];#lr;connectedCallback(){super.connectedCallback(),this.rendered&&Pt.add(this)}disconnectedCallback(){Pt.delete(this)}render(){this.#lr=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",P.of().t("toast.region")),this.setAttribute("popover","manual"),Rt||(Rt=!0,document.addEventListener("show-toast",e=>{if(e.detail)for(const t of Pt)t.show(e.detail.message,e.detail)})),Pt.add(this)}show(e,t={}){const s=Lt.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=P.of().failure(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);let o=t.timeout??this.#lr,l=performance.now(),u=0;const c=()=>{clearTimeout(u),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())};if(t.action?.label){const e=document.createElement("button");e.type="button",e.className="ful-toast-action",e.textContent=String(t.action.label),e.addEventListener("click",()=>{t.action.onClick?.(),c()}),r.append(e)}r.append(n),r.addEventListener("animationend",()=>{r.classList.contains("ful-toast-out")&&r.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 r.addEventListener("mouseenter",h),r.addEventListener("mouseleave",p),r.addEventListener("focusin",h),r.addEventListener("focusout",p),n.addEventListener("click",c),this.append(r),this.#ur(),u=setTimeout(c,o),r}#ur(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class Mt extends S{static slots=!0;static observed=["active:number"];static template='\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n {{{{ slots.default }}}}\n ';#cr;#dr=[];#hr=[];#Gs=new At;#pr=0;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#cr=t.querySelector("ful-tablist");const s=[...this.#cr.children];this.#hr=[...t.children].filter(e=>e!==this.#cr),s.length!==this.#hr.length&&console.warn(`ful-tabs: ${s.length} tabs declared for ${this.#hr.length} panels, the surplus is left alone`);const r=Math.min(s.length,this.#hr.length);this.#dr=[];for(let e=0;e!==r;++e){const t=this.#hr[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.#dr.push(r)}this.#cr.addEventListener("keydown",e=>{const t=this.#pr;let s=null;"ArrowRight"===e.key?s=(t+1)%this.#dr.length:"ArrowLeft"===e.key?s=(t-1+this.#dr.length)%this.#dr.length:"Home"===e.key?s=0:"End"===e.key&&(s=this.#dr.length-1),null!==s&&s!==t&&(e.preventDefault(),this.active=s,this.#dr[s].focus())}),this.replaceChildren(t)}get active(){return this.#pr}refresh(e){const t=e instanceof Element?this.#hr.indexOf(e):Number.isInteger(e)?e:NaN,s=this.#hr[t];if(s)return this.#Gs.request(this,s,null,t).catch(()=>{});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.#dr.length-1)),s=this.#pr;for(const[e,s]of this.#dr.entries())s.setAttribute("aria-selected",e===t?"true":"false"),s.tabIndex=e===t?0:-1,this.#hr[e].hidden=e!==t;this.#pr=t,this.reflectTo("active",t),this.rendered&&t!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:t,previous:s}})),this.#hr.length>0&&(t!==s||!this.rendered)&&this.#Gs.request(this,this.#hr[t],null,t).catch(()=>{})}}class Ft extends S{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#Ze;#fr=!1;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#Ze=t.querySelector("ful-accordion-group"),this.replaceChildren(t)}get exclusive(){return this.#fr}set exclusive(e){this.#fr=!0===e,this.reflectTo("exclusive",this.#fr);const t=this.#fr?c.uid("ful-accordion"):null;for(const e of this.#Ze.querySelectorAll(":scope > details"))null===t?e.removeAttribute("name"):e.setAttribute("name",t)}}class Dt 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 ";#mr=[];#Js=[];#Gs=new At;#gr=0;#br;render({slots:e}){const t=this.template().withOverlay({slots:e}).render(),s=[...t.querySelector("ful-steps ol").children];this.#Js=[...t.children].filter(e=>"ful-steps"!==e.localName),s.length!==this.#Js.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#Js.length} sections, the surplus is left alone`);const r=Math.min(s.length,this.#Js.length);this.#mr=[];for(let e=0;e!==r;++e){const t=document.createElement("li");t.append(...s[e].childNodes),s[e].replaceWith(t),this.#mr.push(t),this.#Js[e].tabIndex=-1}if(this.replaceChildren(t),r>0){const e=this.#Js.findIndex(e=>"step"===e.getAttribute("aria-current"));this.#vr(-1===e?0:Math.min(e,r-1)),this.#yr(this.#gr).catch(()=>{})}}get index(){return this.#gr}get step(){return this.#Js[this.#gr]?.getAttribute("data-step")??null}get progress(){return this.#br}set progress(e){this.#br=e,this.reflectTo("progress",e)}next(){return this.#wr(this.#gr+1)}prev(){return this.#wr(this.#gr-1)}move(e){const t=this.#Js.findIndex(t=>t.getAttribute("data-step")===e);if(-1!==t)return this.#wr(t);console.warn(`ful-wizard: no section carries data-step="${e}"`)}refresh(e){const t=e instanceof Element?e:"string"==typeof e?this.#Js.find(t=>t.getAttribute("data-step")===e):void 0,s=this.#Js.indexOf(t);if(-1!==s)return this.#yr(s).catch(()=>{});console.warn(`ful-wizard: no section answers to "${e}"`)}#yr(e){return this.#Gs.request(this,this.#Js[e],this.#Js[e].getAttribute("data-step"),e)}#wr(e){const t=Math.min(Math.max(0,e),Math.max(0,this.#mr.length-1));if(t!==this.#gr)return this.#vr(t),this.#Js[this.#gr].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#gr,step:this.step}})),this.#yr(t)}#vr(e){for(const[t,s]of this.#mr.entries())t===e?(s.setAttribute("aria-current","step"),this.#Js[t].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#Js[t].removeAttribute("aria-current"));this.#gr=e}}const zt={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…","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…","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…","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…","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};class It{#Er;#xr;#Ar;constructor(e={}){this.#Er=e.language??navigator?.language??"en",this.#xr=e.translations??{},this.#Ar=e.httpClient??null}configure(e){const t=this.#Ar??V.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),s=this.#Er.split("-")[0].toLowerCase(),r={...zt.en,...zt[s],...this.#xr};e.defineModule("l10n",P).defineComponent("http-client",t).defineElement("ful-tooltip",xt).defineElement("ful-dialog",_t).defineElement("ful-drawer",kt).defineElement("ful-menu",qt).defineElement("ful-toasts",Nt).defineElement("ful-tabs",Mt).defineElement("ful-accordion",Ft).defineElement("ful-wizard",Dt).defineElement("ful-form",fe).defineElement("ful-checkbox",Ve).defineElement("ful-input",we).defineElement("ful-input-file",_e).defineElement("ful-local-date",xe).defineElement("ful-instant",Ae).defineElement("ful-input-local-date",Se).defineElement("ful-input-local-time",Te).defineElement("ful-input-instant",Ce).defineElement("ful-radio-group",We).defineElement("ful-table",Ye).defineElement("ful-pagination",Ge).defineElement("ful-sorter",Ue).defineElement("ful-filter-instant",ft).defineElement("ful-filter-local-date",mt).defineElement("ful-filter-number",gt).defineElement("ful-filter-boolean",wt).defineElement("ful-filter-text",bt).defineElement("ful-filter-in",Et).defineElement("ful-select",He).defineElement("ful-dropdown",je).defineComponent("loaders:select",Be).defineComponent("loaders:form",he).defineComponent("loaders:table",Xe).defineOverlay({l10n:r,locale:this.#Er})}}var $t=Object.freeze({__proto__:null,Accordion:Ft,Anchors:Me,AsyncEvents:re,Bindings:le,BooleanFilter:wt,Checkbox:Ve,Claims:ne,CompareFilter:pt,Dialog:_t,Drawer:kt,Dropdown:je,Field:ue,Form:fe,FormLoader:he,InFilter:Et,Input:we,InputFile:_e,InputInstant:Ce,InputLocalDate:Se,InputLocalTime:Te,Instant:Ae,InstantFilter:ft,LocalDate:xe,LocalDateFilter:mt,LocalStorage:Z,Menu:qt,NumberFilter:gt,PageLeave:ie,Pagination:Ge,Plugin:It,RadioGroup:We,Select:He,SelectLoader:Be,SessionStorage:ee,SortButton:Ue,Table:Ye,TableLoader:Xe,TableSchemaParser:Qe,Tabs:Mt,TextFilter:bt,Timing:oe,Toasts:Nt,Tooltip:xt,VersionedLocalStorage:te,VersionedSessionStorage:se,Wizard:Dt,describable:ae});return"undefined"!=typeof window&&(window.ftl=R,window.httpc=J,window.ful=$t),e.Accordion=Ft,e.Anchors=Me,e.AsyncEvents=re,e.Attributes=c,e.Base64=M,e.Bindings=le,e.BooleanFilter=wt,e.BoundedCache=t,e.Checkbox=Ve,e.Claims=ne,e.CompareFilter=pt,e.Dialog=_t,e.Drawer=kt,e.Dropdown=je,e.ExpressionEvaluator=l,e.Expressions=o,e.Failure=N,e.Field=ue,e.Form=fe,e.FormLoader=he,e.Fragments=u,e.Hex=F,e.HttpClient=V,e.HttpClientBuilder=j,e.HttpClientError=z,e.HttpInterceptorChain=W,e.HttpMultipartRequestCustomizer=K,e.HttpRequestBuilder=Q,e.InFilter=Et,e.Input=we,e.InputFile=_e,e.InputInstant=Ce,e.InputLocalDate=Se,e.InputLocalTime=Te,e.Instant=Ae,e.InstantFilter=ft,e.LightSlots=d,e.LocalDate=xe,e.LocalDateFilter=mt,e.LocalStorage=Z,e.Localization=P,e.MediaType=D,e.Menu=qt,e.Nodes=h,e.NumberFilter=gt,e.PageLeave=ie,e.Pagination=Ge,e.ParsedElement=S,e.Plugin=It,e.RadioGroup=We,e.Registry=w,e.RenderError=v,e.Rendering=A,e.Select=He,e.SelectLoader=Be,e.SessionStorage=ee,e.SortButton=Ue,e.Table=Ye,e.TableLoader=Xe,e.TableSchemaParser=Qe,e.Tabs=Mt,e.Template=b,e.Templates=x,e.TextFilter=bt,e.Timing=oe,e.Toasts=Nt,e.Tooltip=xt,e.VersionedLocalStorage=te,e.VersionedSessionStorage=se,e.Wizard=Dt,e.describable=ae,e.registry=E,e}({});
2
2
  //# sourceMappingURL=fml.iife.min.js.map