@optionfactory/fml 9.0.0-rc29 → 9.0.0-rc30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fml.iife.js +2 -2
- package/dist/fml.iife.js.map +1 -1
- package/dist/fml.iife.min.js +1 -1
- package/dist/fml.iife.min.js.map +1 -1
- package/dist/ful.iife.js +2 -2
- package/dist/ful.iife.js.map +1 -1
- package/dist/ful.iife.min.js +1 -1
- package/dist/ful.iife.min.js.map +1 -1
- package/dist/ful.min.mjs +1 -1
- package/dist/ful.min.mjs.map +1 -1
- package/dist/ful.mjs +2 -2
- package/dist/ful.mjs.map +1 -1
- package/dist/web-types.json +1 -1
- package/package.json +1 -1
package/dist/ful.iife.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ful=function(e,t,s){"use strict";const i=e=>{const t=t=>{try{e().removeItem(t)}catch{}},s=s=>{let i;try{i=e().getItem(s)}catch{return}if(null!==i)try{return JSON.parse(i)}catch{return void t(s)}};return{save:(t,s)=>{e().setItem(t,JSON.stringify(s))},load:s,remove:t,pop:e=>{const i=s(e);return t(e),i}}},r=e=>({save(t,s,i){e.save(t,{revision:s,data:i})},load(t,s){const i=e.load(t);if(null!=i&&"object"==typeof i&&i.revision===s)return i.data;e.remove(t)}}),n=i(()=>localStorage),a=i(()=>sessionStorage),l=r(n),o=r(a);class u{static async fireAsync(e,t,s){e.dispatchEvent(t);const i=t.async?.promises??[],r=s?.mode??"broadcast";if("pipeline"===r&&i.length>1||"delegate"===r&&1!==i.length)throw Promise.all(i).catch(()=>{}),new Error("pipeline"===r?`[AsyncEvents] Event "${t.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${i.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${t.type}" is configured in 'delegate' mode and requires exactly one async listener, but ${i.length} were registered.`);return"broadcast"===r?Promise.all(i):Promise.resolve(i[0])}static asyncOn(e,t,s,i){const r=async e=>{const t=e;t.async||(t.async={promises:[]});const{promise:i,resolve:r,reject:n}=Promise.withResolvers();t.async.promises.push(i);try{r(await s(t))}catch(e){n(e)}};return e.addEventListener(t,r,i),r}static asyncOff(e,t,s,i){e.removeEventListener(t,s,i)}static mixInto(...e){for(const t of e)Object.assign(t.prototype,{async fireAsync(e,t){return await u.fireAsync(this,e,t)},asyncOn(e,t,s){return u.asyncOn(this,e,t,s)},asyncOff(e,t,s){u.asyncOff(this,e,t,s)}})}}class d{static guard(e,t){window.addEventListener("beforeunload",t=>{e()&&t.preventDefault()},{signal:t})}}class c{#e=0;take(){return++this.#e,this.hold()}hold(){const e=this.#e,t=this;return{get stale(){return e!==t.#e}}}invalidate(){++this.#e}}const h=e=>{for(let t=e.parentElement;t;t=t.parentElement)if("function"==typeof t.describedBy)return t;return null};class p{static sleep(e){return new Promise(t=>setTimeout(t,e))}static debounce(e,t,s){const i=s?.immediate??!1;let r=null,n=[],a=0;const l=()=>{const s=performance.now()-a;e>s?r=setTimeout(l,e-s):(r=null,i||t(...n),null===r&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===r&&(r=setTimeout(l,e),i&&t(...n))},()=>{clearTimeout(r??void 0),r=null,n=[]}]}static throttle(e,t,s){const i=s?.leading??!0,r=s?.trailing??!0;let n=null,a=[],l=0;const o=()=>{l=i?performance.now():0,n=null,t(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();l||i||(l=u);const d=0===l?0:e-(u-l);a=s,d<=0||d>e?(null!==n&&(clearTimeout(n),n=null),l=u,t(...a),null===n&&(a=[])):null===n&&r&&(n=setTimeout(o,d))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class f{static flatten(e,t,s){return Object.keys(e).reduce((i,r)=>{const n=t.length?`${t}.${r}`:r;return s.has(n)||"object"!=typeof e[r]||null===e[r]?i[n]=e[r]:Object.assign(i,f.flatten(e[r],n,s)),i},{})}static#t=new Set(["__proto__","prototype","constructor"]);static providePath(e,t,s){const i=t.split(".").map(e=>/^[0-9]+$/.test(e)?+e:e);for(const e of i)if(f.#t.has(e))throw new Error(`unsupported name segment '${e}' in '${t}'`);let r=e??{},n=null;for(let t=0;;++t){const a=i[t],l=i[t-1];if(Number.isInteger(a)&&!Array.isArray(r)&&(null!==n?n[l]=r=[]:e=r=[]),t===i.length-1)return r[a]=void 0!==s?s:a in r?r[a]:null,e;"object"==typeof r[a]&&null!==r[a]||(r[a]={}),n=r,r=r[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#s(e){return"submit"===e.type||"reset"===e.type||"button"===e.type}static extractFrom(e,t){let s={};for(const i of e.elements)i.hasAttribute("name")&&(f.#s(i)&&i!==t||i.matches(":disabled")&&i!==t||(s=f.providePath(s,i.getAttribute("name"),f.extract(i))));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=f.#i(e);for(const[e,i]of Object.entries(f.flatten(t,"",new Set(s.keys()))))for(const t of s.get(e)??[])f.mutate(t,i)}static#i(e){const t=new Map;for(const s of e.elements){const e=s.getAttribute("name");if(!e)continue;const i=t.get(e);i?i.push(s):t.set(e,[s])}return t}static errors(e,t,s){const i=t=>t.closest("form")===e;Array.from(e.querySelectorAll("ful-field-error")).filter(i).forEach(e=>{e.setAttribute("aria-live",s?"off":"polite")});const r=e=>("FIELD_ERROR"===e.type||"INVALID_FORMAT"===e.type)&&e.context,n=t.filter(r),a=t.filter(e=>!r(e)),l=f.#i(e);for(const e of l.values())e.forEach(e=>{e.setCustomValidity?.("")});const o=[],u=new Map;n.forEach(e=>{const t=e.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=t.length;0!==s;--s){const i=t.slice(0,s).join("."),r=(l.get(i)??[]).filter(e=>"function"==typeof e.setCustomValidity);if(0===r.length)continue;const n=t.slice(s).join(".");return void r.forEach(t=>{const s=u.get(t)??new Map;s.set(n,[...s.get(n)??[],e.reason]),u.set(t,s)})}o.push(e)});for(const[e,t]of u)for(const[s,i]of t)e.setCustomValidity(i.join("\n"),s);const d=[...a,...o];e.querySelectorAll("ful-errors").forEach(e=>{if(!i(e))return;const t=e;if(e.setAttribute("role","alert"),0===d.length)return e.replaceChildren(),void e.setAttribute("hidden","");e.removeAttribute("hidden"),t.innerText=d.map(e=>e.reason).join("\n")}),0!==t.length&&s&&Array.from(e.elements).filter(e=>"fieldset"!==e.localName&&e.matches(":invalid")).sort((e,t)=>e.getBoundingClientRect().y-t.getBoundingClientRect().y)[0]?.focus()}}class m extends t.ParsedElement{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#r;#n=null;#a;#l=[];#o=null;#u;#d;#c;#h=[];#p=null;constructor(){super(),this.internals.role=this.constructor.ROLE}#f(){return[this.#d??this.#r,...this.#h].filter(e=>e)}#m({fragment:e,control:s,error:i,label:r=null,described:n=null,claims:a=null,announces:l=s,freeze:o=null,also:u=[]}){if(this.#r=s,this.#u=i,this.#d=a,this.#c=l,this.#h=u,o&&o.addEventListener("click",e=>{this.readonly&&e.preventDefault()},!0),this.#a=n??s,i&&(i.id=i.id||t.Attributes.uid("ful-field-error"),this.#o=i.id),this.#g(),r&&m.#b(this,r,s),this.addEventListener("keydown",e=>{if("Enter"!==e.key||e.defaultPrevented||e.isComposing)return;const t=e.target;t.form!==this.form&&m.#v(t)&&this._requestSubmit()}),this.replaceChildren(e),null!==this.#n){const e=this.#n;this.#n=null,s.focus(e)}}static#v(e){return e instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(e.type)}describedBy(e){return!!e&&(e.id||(e.id=t.Attributes.uid("ful-described")),this.#l.includes(e.id)||this.#l.push(e.id),this.#g(),!0)}#g(){if(!this.#a)return;const e=[...this.#l,this.#o].filter(e=>e);e.length&&this.#a.setAttribute("aria-describedby",e.join(" "))}focus(e){this.#r?this.#r.focus(e):this.#n=e??{}}setCustomValidity(e,s){if(t.Attributes.set(this.#c??this.#r,"aria-invalid",e?"true":null),!e)return this.internals.setValidity({}),void(this.#u.innerText="");this.internals.setValidity({customError:!0}," "),this.#u.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#y=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#b(e,s,i){if(!m.#y.has(i.tagName)||"hidden"===i.getAttribute("type"))return s.id||(s.id=t.Attributes.uid("ful-label")),i.setAttribute("aria-labelledby",s.id),void s.addEventListener("click",()=>e.focus());i.id||(i.id=t.Attributes.uid("ful-control")),s.setAttribute("for",i.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}async upgrade(){if(await super.upgrade(),null===this.#p)return;const{value:e}=this.#p;this.#p=null,this.value=e}_holdValue(e){this.#p={value:e}}_heldValue(){return null===this.#p?this.declared("value"):this.#p.value}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.#f())t.toggleAttribute("disabled",e)}get readonly(){return this.hasAttribute("readonly")}set readonly(e){for(const t of this.#f())t.readOnly=e;this.#c&&t.Attributes.set(this.#c,"aria-readonly",e?"true":null),this.reflectTo("readonly",e)}get required(){return this.hasAttribute("required")}set required(e){this.#c&&t.Attributes.set(this.#c,"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.#m(e));this.#m(t)}_build(e){throw new Error(`${this.constructor.name} must implement _build`)}}class g{#w;#E;#A;#x;#S;constructor(e,t,s,i,r){this.#w=e,this.#E=t,this.#A=s,this.#x=i,this.#S=r}prepare(e,t){return this.#x(e,t)}async submit(e,t){return await this.#w.request(this.#A,this.#E).json(e).fetch()}transform(e,t){return this.#S(e,t)}}class b{#x;#S;constructor(e,t){this.#x=e,this.#S=t}async prepare(e,t){return await this.#x(e,t)}async submit(e,t,s){return s}async transform(e,t){return await this.#S(e,t)}}class v{static create(e,t){const s=e.component("http-client"),i=e.declared("request-mapper")?e.component(e.declared("request-mapper")):e=>e,r=e.declared("response-mapper")?e.component(e.declared("response-mapper")):e=>e,n=e.declared("action");if(!n)return new b(i,r);const a=e.declared("method")??"POST";return new g(s,n,a,i,r)}}const y=e=>void 0!==e.form?e.form:e.constructor?.formAssociated?e.internals?.form:void 0;class w extends t.ParsedElement{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",""),t.Attributes.set(e,"autocomplete",this.declared("autocomplete")),t.Attributes.forward("form-",this,e),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=>{y(e.target)===this.form&&e.target.setCustomValidity?.("")}),this.replaceChildren(e),this.#_=this.declared("track-changes")||this.declared("guard-leave"),this.#_&&(this.addEventListener("input",e=>this.#C(e.target)),this.addEventListener("change",e=>this.#C(e.target)),this.addEventListener("focusin",e=>this.#k(e.target)),this.form.addEventListener("reset",e=>{if(e.target===this.form){for(const e of new Set([...this.#q.keys(),...this.#T().keys()]))this.#L.set(e,++this.#N);0===this.#O&&(this.#O=requestAnimationFrame(()=>this.#z()))}}),t.Rendering.waitForChildren(this).catch(()=>{}).then(()=>this.commit()),this.#R())}connectedCallback(){super.connectedCallback(),this.#_&&this.#R()}disconnectedCallback(){this.#F?.abort(),this.#F=null}#I=!1;async submit(e){if(this.#I)return!1;let t,i,r;this.#I=!0,this.spinner(!0);try{const s=this.component(this.declared("loader")??"loaders:form").create(this);t=f.extractFrom(this.form,e);const n=this.#_?{saved:this.#T(),upTo:this.#N}:null;i=await s.prepare(t,this);const a=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:e,values:t,request:i}});if(!this.dispatchEvent(a))return!1;this.errors=[];const l=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:a.detail.values,request:a.detail.request}});let o=await u.fireAsync(this,l,{mode:"pipeline"});i=l.detail.request,o=await s.submit(i,this,o);const d=await s.transform(o,this);n&&this.#M(n.saved,n.upTo),r=new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:i,response:d}})}catch(n){r=new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:i,exception:n}}),n instanceof s.Failure?this.errors=n.problems:console.warn("failed to submit form",this,"reason:",n)}finally{this.#I=!1,this.spinner(!1)}return this.dispatchEvent(r),"submit:success"===r.type}async save(e){return!(!this.#_||this.dirty)||await this.submit(e)&&!this.dirty}reset(){this.form.reset(),this.#_&&this.#z()}#q=new Map;#P=new Map;#L=new Map;#N=0;#B=!1;#O=0;#F=null;#_=!1;get dirty(){if(!this.#_)return!1;for(const e of this.#L.keys()){const t=this.#D(e);if((this.#q.has(e)||"[]"!==t)&&(this.#q.get(e)??this.#P.get(e))!==t)return!0}return!1}commit(){this.#_&&this.#M(this.#T(),this.#N)}edited(...e){for(const t of e)this.#C(t)}#M(e,t){this.#q=e;for(const[e,s]of this.#L)s<=t&&this.#L.delete(e);for(const t of this.#P.keys())e.has(t)&&this.#P.delete(t);this.#z()}#$(e){for(let t=e;t&&t!==this;t=t.parentElement)if(y(t)===this.form&&t.hasAttribute("name"))return t.getAttribute("name");return null}#C(e){if(!this.#_)return;const t=this.#$(e);null!==t&&(this.#L.set(t,++this.#N),0===this.#O&&(this.#O=requestAnimationFrame(()=>this.#z())))}#k(e){const t=this.#$(e);null===t||this.#q.has(t)||this.#P.has(t)||this.#P.set(t,this.#D(t))}#W(){return Array.from(this.form.elements).filter(e=>e.hasAttribute("name")&&!["submit","reset","button"].includes(e.type)&&!e.matches(":disabled"))}#T(){const e=new Map;for(const t of this.#W()){const s=t.getAttribute("name");e.set(s,[...e.get(s)??[],f.extract(t)])}return new Map(Array.from(e,([e,t])=>[e,JSON.stringify(t)]))}#D(e){return JSON.stringify(this.#W().filter(t=>t.getAttribute("name")===e).map(e=>f.extract(e)))}#z(){cancelAnimationFrame(this.#O),this.#O=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.#B&&(this.#B=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}})))}#R(){this.declared("guard-leave")&&!this.#F&&(this.#F=new AbortController,d.guard(()=>this.dirty,this.#F.signal))}#V=0;#H(e){if(t.Attributes.defaultValue(e,"role","status"),e.hidden=!1,""!==e.textContent.trim())return;const s=document.createElement("span");s.className="ful-sr-only",s.dataset.ref="spinner-label",e.append(s),s.textContent=t.Localization.of().t("spinner.loading")}spinner(e){if(e){if(++this.#V,1!==this.#V)return}else if(this.#V=Math.max(0,this.#V-1),0!==this.#V)return;t.Attributes.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.#H(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(s=>{const i=s;if(i.form===this.form&&("submit"===i.type||"reset"===i.type))if(e)i.dataset.wd=i.getAttribute("aria-disabled")??"",i.setAttribute("aria-disabled","true");else{if(void 0===i.dataset.wd)return;t.Attributes.set(i,"aria-disabled",i.dataset.wd||null),delete i.dataset.wd}})}set values(e){f.mutateIn(this.form,e)}get values(){return f.extractFrom(this.form)}set errors(e){f.errors(this.form,e,this.declared("scroll-on-error"))}}const E=new t.BoundedCache(100),A=(e,t)=>E.getOrCompute(`${e}:${t}`,()=>{try{return new RegExp(t,"g")}catch(s){return console.warn(`invalid ${e} attribute`,t,s),null}}),x={numeric:"numeric",decimal:"decimal"},S=new Set(["date","time","datetime-local","month","week"]),_={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 C extends m{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;#j=[];#G=null;_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:e}){const t=this._type(),s=x[t],i=s?"text":t,r=this.template().withOverlay({type:i,slots:e}).render();this.#j=[...r.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#j[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=A("keep",t);return e&&(t=>(t.match(e)??[]).join(""))}if(null!==s){const e=A("reject",s);return e&&(t=>t.replace(e,""))}return((e,t)=>{const s=_[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.#j)this.#K(e,s,n,a);return{fragment:r,control:this._input,error:r.querySelector("ful-field-error"),label:r.querySelector("label")}}#K(e,s,i,r){s&&t.Attributes.set(e,"inputmode",s),t.Attributes.set(e,"autocomplete",i);const n=e.id;t.Attributes.forward("input-",this,e),e!==this._input&&t.Attributes.set(e,"id",n||null),this.#U(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)})}#U(e){if(!S.has(e.type))return void e.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});let t=!1;const s=()=>{t=!1;const e=JSON.stringify(this.value);e!==this.#G&&(this.#G=e,this._notifyChange())};e.addEventListener("focus",()=>{this.#G=JSON.stringify(this.value)}),e.addEventListener("keydown",e=>{"Enter"!==e.key||e.isComposing?t=!0:s()}),e.addEventListener("blur",s),e.addEventListener("change",e=>{e.stopPropagation(),t||s()})}get value(){const e=this.declared("uppercase"),t=this.declared("trim"),s=this._input?this._input.value:`${this._heldValue()??""}`,i=e?s.toUpperCase():s,r=t?i.trim():i;if(""===r)return null;const n="decimal"===this._type()?r.replaceAll(",","."):r;if("number"===this.declared("v-type")){const e=Number(n);return Number.isNaN(e)?n:e}return n}set value(e){this._input?(this._input.value=""===e||null==e?"":`${e}`,this.#G=JSON.stringify(this.value)):this._holdValue(e)}get placeholder(){const e=this._input.getAttribute("placeholder");return" "===e?null:e}set placeholder(e){for(const s of this.#j)t.Attributes.set(s,"placeholder",e??" ");this.reflectTo("placeholder",e)}}const k=e=>""===e?null:e,q=e=>{const[t,s,i]=e.split("-").map(Number),r=new Date(0);return r.setFullYear(t,s-1,i),r.setHours(0,0,0,0),r.getFullYear()===t&&r.getMonth()===s-1&&r.getDate()===i?r:new Date(Number.NaN)};class T extends t.ParsedElement{static attributes=["locale","default"];render(){const e=q(this.textContent.trim());if(Number.isNaN(e.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:s}=t.Localization.of({locale:this.declared("locale")??void 0});this.replaceChildren(s(e,{year:"numeric",month:"numeric",day:"numeric"}))}}class L extends t.ParsedElement{static attributes=["locale","default"];render(){const e=this.textContent.trim(),s=""===e?null:new Date(L.isoToLocal(e));if(null===s||Number.isNaN(s.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:i}=t.Localization.of({locale:this.declared("locale")??void 0});this.replaceChildren(i(s,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}))}static#Q(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?q(e):new Date(e)}static isoToLocal(e){const t=L.#Q(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=L.#Q(e);return Number.isNaN(t.getTime())?null:t.toISOString()}}class N extends C{static observed=["step","min","max"];_type(){return"date"}get min(){return k(this._input.min)}set min(e){this._input.min=N.#J(e)}get max(){return k(this._input.max)}set max(e){this._input.max=N.#J(e)}get step(){return k(this._input.step)}set step(e){this._input.step=e??""}static#J(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 i="-"===s[1]?-1:1,r=+s[2],n=new Date;switch(n.setHours(0,0,0,0),s[3]){case"d":n.setDate(n.getDate()+r*i);break;case"m":{const e=n.getDate();n.setMonth(n.getMonth()+r*i),n.getDate()!==e&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+r*i)}return t(n)}}class O extends N{_type(){return"time"}get min(){return k(this._input.min)}set min(e){this._input.min=this.#Y(e)}get max(){return k(this._input.max)}set max(e){this._input.max=this.#Y(e)}#Y(e){if(!e)return"";const t=new Date;if("now"!==e){const s=/^([+-])(\d+)([hm])$/.exec(e);if(!s)return e;const i="-"===s[1]?-1:1,r=+s[2]*i;"h"===s[3]?t.setHours(t.getHours()+r):t.setMinutes(t.getMinutes()+r)}return O.#X(t,Number(this._input.step)||60)}static#X(e,t){const s=e=>String(e).padStart(2,"0"),i=3600*e.getHours()+60*e.getMinutes()+e.getSeconds(),r=Math.floor(i/t)*t,n=s(Math.floor(r/3600)),a=s(Math.floor(r%3600/60));return t%60==0?`${n}:${a}`:`${n}:${a}:${s(r%60)}`}}class z extends C{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){if(!this._input){const e=this._heldValue();return L.localToIso(e?L.isoToLocal(e):"")}return L.localToIso(this._input.value)}set value(e){this._input?super.value=e?L.isoToLocal(e):"":this._holdValue(e)}get min(){return L.localToIso(this._input.min)}set min(e){this._input.min=e?L.isoToLocal(e):""}get max(){return L.localToIso(this._input.max)}set max(e){this._input.max=e?L.isoToLocal(e):""}get step(){return k(this._input.step)}set step(e){this._input.step=e??""}}class R extends C{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"];#Z;#ee;#te;#se;#ie;_type(){return"file"}static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-type="type" placeholder=" " form="">\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <div data-ref="dropzone" class="dropzone" data-tpl-if="slots.dropzone">\n {{{{ slots.dropzone }}}}\n </div>\n <div data-ref="dropzone" class="default-dropzone" data-tpl-if="!slots.dropzone">\n {{ #l10n:t(\'files.dropzone-label\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings role="status" aria-live="polite"></ful-field-warnings>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="files" data-tpl-var="file" data-tpl-data-name="file.name">\n <div><span>{{ file.name }}</span><span>{{ #l10n:bytes(file.size) }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'files.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};#re;_build(e){const s=super._build(e),i=s.fragment;return this.#ee=i.querySelector("ful-item-list"),this.#re=e.slots?.items&&!t.Fragments.isBlank(e.slots.items)?t.Templates.fromFragment(e.slots.items):null,this.#te=i.querySelector("[data-ref=dropzone]"),this.#se=i.querySelector("ful-field-warnings"),this.#ie=i.querySelector("ful-control-group"),this.#se.addEventListener("animationend",e=>{e.target.remove()}),this.#ee.addEventListener("click",e=>{if(!e.target.closest("button"))return;if(!this._interactive())return;const t=[...this.#ee.children].indexOf(e.target.closest("ful-item"));-1!==t&&(this.files=R.list([...this.files].filter((e,s)=>s!==t)),this._notifyChange())}),this.#te.addEventListener("click",e=>{this._interactive()&&this._input.click()}),this.#te.addEventListener("dragover",e=>{e.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#te.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#te.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=R.list(t),this._notifyChange())}),this._input.addEventListener("change",()=>{this.#ne()},{capture:!0}),{...s,freeze:this.#ie}}#ne(){this.setCustomValidity(),this.#se.replaceChildren(),this.#ae(),this.#le(),this.#oe(),this.#ue(),(this.#re??this.template("items")).withOverlay({files:this.files}).renderTo(this.#ee)}warning(e,t){this.template("warning").withOverlay({key:e,args:t}).appendTo(this.#se);const s=this.#se.lastElementChild;setTimeout(()=>s.remove(),R.WARNING_TIMEOUT)}#de(e){const t=e.name.toLowerCase();return this.#Z.some(s=>{const i=s.toLowerCase().split(";")[0].trim();return i.startsWith(".")?t.endsWith(i):i.endsWith("/*")?e.type.startsWith(`${i.slice(0,-1)}`):i.includes("/")&&e.type===i})}#ae(){if(!this.#Z.length)return;const e=[...this.files].filter(e=>!this.#de(e));0!==e.length&&(this.warning("files.unacceptable-file-type",{types:this.#Z.join(", ")}),this._input.files=R.list([...this.files].filter(t=>!e.includes(t))))}#ue(){null!==this.#ce&&(this.files.length<=this.#ce||(this.warning("files.max-files-exceeded",{count:this.#ce}),this._input.files=R.list()))}#le(){if(null===this.#he)return;const e=[...this.files].filter(e=>e.size>this.#he);0!==e.length&&(this.warning("files.max-file-size-exceeded",{size:t.Localization.of().bytes(this.#he)}),this._input.files=R.list([...this.files].filter(t=>!e.includes(t))))}#oe(){null!==this.#pe&&([...this.files].reduce((e,t)=>e+t.size,0)<=this.#pe||(this.warning("files.max-total-size-exceeded",{size:t.Localization.of().bytes(this.#pe)}),this._input.files=R.list()))}get accept(){return this.#Z}set accept(e){this._input.accept=e.join(","),this.#Z=e,this.reflectTo("accept",e)}get multiple(){return this._input?this._input.multiple:this.declared("multiple")}set multiple(e){this._input.multiple=e,this.reflectTo("multiple",e)}get files(){return this._input?this._input.files:R.list()}set files(e){this._input.files=e,this.#ne()}get file(){return this.files[0]??null}set file(e){this.files=R.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._input&&(this.files=R.list())}formResetCallback(){this.value=null}get totalsize(){return Array.from(this.files).reduce((e,t)=>e+t.size,0)}#ce;get maxFiles(){return this.#ce}set maxFiles(e){this.#ce=e,this.reflectTo("max-files",e)}#he;get maxFileSize(){return this.#he}set maxFileSize(e){this.#he=e,this.reflectTo("max-file-size",e)}#pe;get maxTotalSize(){return this.#pe}set maxTotalSize(e){this.#pe=e,this.reflectTo("max-total-size",e)}#fe;get itemList(){return this.#fe}set itemList(e){this.#fe=e,this.reflectTo("item-list",e)}#me;get dropzone(){return this.#me}set dropzone(e){this.#me=e,this.reflectTo("dropzone",e)}}const F=new Map;let I=0,M=!1;const P=(e,t,s)=>Math.min(Math.max(e,t),Math.max(t,s)),B=(e,t)=>{const{invoker:s,stretch:i}=t,r=s.getBoundingClientRect(),n=document.documentElement,a=n.clientWidth,l=n.clientHeight;e.style.removeProperty("margin");const o=getComputedStyle(e),u=parseFloat(o.marginTop)||0,d=parseFloat(o.marginRight)||0,c=parseFloat(o.marginBottom)||0,h=parseFloat(o.marginLeft)||0;if(e.style.right="auto",e.style.bottom="auto",e.style.margin="0",i){e.style.removeProperty("width"),e.style.removeProperty("min-width"),e.style.removeProperty("max-width");const t=Math.min(parseFloat(o.maxWidth)||a,a-16);e.style.minWidth=`${Math.min(r.width,a-16)}px`,e.style.maxWidth=`${t}px`;const s=e.getBoundingClientRect().width;e.style.left=`${P(r.left,8,a-s-8)}px`;const i=e.getBoundingClientRect().height,n=r.bottom+u,d=n+i<=l-8?n:r.top-c-i;return void(e.style.top=`${P(d,8,l-i-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(o.maxWidth)||a,a-16);e.style.maxWidth=`${m}px`,e.style.left="8px";const g=e.getBoundingClientRect().width;let b="right"===f?r.right+h:"left"===f?r.left-d-g:p?r.left+r.width/2-g/2:r.left;b=P(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?r.top-c-v:"right"===f||"left"===f?r.top+r.height/2-v/2:r.bottom+u;e.style.top=`${P(y,8,l-v-8)}px`,p&&((e,t)=>{const s=t.getBoundingClientRect(),i=e.getBoundingClientRect();e.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-i.left-e.clientLeft+"px"),e.style.setProperty("--ful-note-callout-block",s.top+s.height/2-i.top-e.clientTop+"px")})(e,s)},D=()=>{I=0;for(const[e,t]of F)e.isConnected&&t.invoker.isConnected?B(e,t):F.delete(e)},$=()=>{!I&&F.size>0&&(I=requestAnimationFrame(D))};class W{static wire(e,s,{prefix:i="ful-anchor",invoke:r=!1,expanded:n=!1,stretch:a=!1,handPlace:l=!1}={}){const o=t.Attributes.uid(i);if(r)if(s.id=s.id||o,"button"===e.localName||"input"===e.localName)e.setAttribute("popovertarget",s.id);else{let t=!1;e.addEventListener("pointerdown",()=>{t=s.matches(":popover-open")},!0),e.addEventListener("click",()=>{const e=t&&!s.matches(":popover-open");t=!1,e||s.togglePopover()}),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s.togglePopover())})}const u=`--${o}`;if(e.style.anchorName=u,s.style.positionAnchor=u,n&&(e.setAttribute("aria-expanded","false"),s.addEventListener("toggle",t=>{e.setAttribute("aria-expanded","open"===t.newState?"true":"false")})),!l&&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 d={invoker:e,stretch:a};s.addEventListener("beforetoggle",e=>{"open"===e.newState&&((e,t)=>{e.style.visibility="hidden",queueMicrotask(()=>{e.matches(":popover-open")&&B(e,t),e.style.removeProperty("visibility")})})(s,d)}),s.addEventListener("toggle",e=>{"open"===e.newState?(F.set(s,d),B(s,d)):(F.delete(s),(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)})(s))}),M||(M=!0,document.addEventListener("scroll",$,!0),window.addEventListener("resize",$))}static show(e,t,{flip:s=!1,gap:i=0}={}){return"function"!=typeof e.showPopover||e.matches(":popover-open")||e.showPopover(),(()=>{const r=t instanceof Element?t.getBoundingClientRect():t,n=document.documentElement,a=e.getBoundingClientRect(),l=r.bottom+i,o=r.top-i-a.height,u=s&&l+a.height>n.clientHeight-8&&o>=8?o:l;e.style.right="auto",e.style.bottom="auto",e.style.margin="0",e.style.left=`${P(r.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,e.style.top=`${P(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),e}}const V=(e,t)=>e.filter(({key:e})=>t.some(t=>String(t)===String(e))),H=(e,t)=>e.filter(({label:e})=>(e??"").toLowerCase().includes(t?.toLowerCase()??""));class j{#w;#E;#A;#S;#ge;#be;#ve=null;#ye=null;#we=new c;constructor({http:e,url:t,method:s,responseMapper:i,prefetch:r,revision:n}){this.#w=e,this.#E=t,this.#A=s,this.#S=i,this.#ge=r,this.#be=n}async prefetch(){this.#ge&&await this.#Ee()}async exact(...e){return V(await this.#Ee(),e)}async load(e){return H(await this.#Ee(),e)}async invalidate(){this.#we.invalidate(),this.#ve=null,this.#ye=null}async#Ee(){if(null===this.#ve){if(null===this.#ye){const e=this.#we.hold();this.#ye=j.#Ae(this.#w,this.#A,this.#E,this.#be).then(t=>{e.stale||(this.#ve=this.#S(t))}).finally(()=>{e.stale||(this.#ye=null)})}await this.#ye}if(null===this.#ve)throw new Error("superseded by an invalidation");return this.#ve}static async#Ae(e,t,s,i){const r=`${t}@${s}`;if(null!==i){const e=l.load(r,i);if(void 0!==e)return e}const n=await e.request(t,s).fetchJson();if(null!==i)try{l.save(r,i,n)}catch(e){console.warn("failed to cache the select options",e)}return n}}class G{#w;#E;#A;#S;constructor({http:e,url:t,method:s,responseMapper:i}){this.#w=e,this.#E=t,this.#A=s,this.#S=i}async invalidate(){}async exact(...e){const t=await this.#w.request(this.#A,this.#E).param("k",...e).fetchJson();return this.#S(t)}async load(e){const t=await this.#w.request(this.#A,this.#E).param("s",e).fetchJson();return this.#S(t)}}class K{#ve;constructor(e){this.#ve=e}update(e){this.#ve=e}async invalidate(){}exact(...e){return V(this.#ve,e)}load(e){return H(this.#ve,e)}}class U{static from({data:e,http:t,url:s,method:i="POST",mode:r,prefetch:n=!1,revision:a=null,responseMapper:l}){return s?"chunked"===r?new G({http:t,url:s,method:i,responseMapper:l}):new j({http:t,url:s,method:i,responseMapper:l,prefetch:n,revision:a}):new K(e??[])}static create(e,t){if(!e.declared("src")){const e=Array.from(t.options?.querySelectorAll("option")??[]);return U.from({data:e.map(e=>({key:e.getAttribute("value")??e.innerText.trim(),label:e.innerText.trim(),metadata:void 0}))})}return U.from({http:e.component("http-client"),url:e.declared("src"),method:e.declared("method")??"POST",mode:e.declared("mode"),prefetch:e.declared("preload"),revision:U.#xe(e),responseMapper:U.#Se(e)})}static#xe(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#Se(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 Q extends t.ParsedElement{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 '};#_e;#Ce;#ke;#qe;#Te=new Map;#Le=new c;render({slots:e}){const s=this.template().render();this.#qe=t.Fragments.isBlank(e.default)?this.template("options"):t.Templates.fromFragment(e.default),this.#_e=s.querySelector("ful-spinner"),this.#ke=s.querySelector("[data-ref=empty]"),this.#Ce=s.querySelector("menu"),this.#Ce.id=this.declared("listbox")||t.Attributes.uid("ful-listbox"),this.#Ce.addEventListener("mousedown",e=>{e.target.closest("li")&&e.preventDefault()}),this.#Ce.addEventListener("click",e=>{e.stopPropagation();const t=e.target.closest("li");t?t.matches('[aria-disabled="true"]')||this.#Ne(t):this.hide()}),this.replaceChildren(s)}#Oe(){return!this.#Ce||this.#Ce.hidden?null:this.#Ce.querySelector("li[selected]")??this.#Ce.querySelector('li:not([aria-disabled="true"])')}#ze(e){if(e){for(const t of this.#Ce.querySelectorAll("li"))t.toggleAttribute("selected",t===e);e.id||=t.Attributes.uid("ful-option"),this.#Re(e.id),e.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#Re(null)}acceptSelection(){const e=this.#Oe();e&&!e.matches('[aria-disabled="true"]')&&this.#Ne(e)}update(e,t=[]){if(void 0===e)throw new Error("null data");this.#Te=new Map(e.map((e,t)=>[String(t),e]));const s=e.map((e,t)=>({index:t,...e}));this.#qe.withOverlay(s).renderTo(this.#Ce);for(const[s,i]of[...this.#Ce.children].entries()){const r=e[s],n=t.some(e=>String(e)===String(r?.key));i.toggleAttribute("picked",n),i.setAttribute("aria-selected",n?"true":"false");const a=!!r?.metadata?.disabled;a?i.setAttribute("aria-disabled","true"):i.removeAttribute("aria-disabled"),a&&r.metadata.reason?i.setAttribute("title",String(r.metadata.reason)):i.removeAttribute("title")}this.#ke.toggleAttribute("hidden",0!==e.length),this.#Ce.toggleAttribute("hidden",0===e.length);const i=e.findIndex(({key:e})=>t.some(t=>String(t)===String(e)));this.#ze(i>=0?this.#Ce.children[i]:this.#Ce.querySelector('li[selected]:not([aria-disabled="true"])')??this.#Ce.querySelector('li:not([aria-disabled="true"])'))}#Ne(e){const t=e.getAttribute("value"),s=this.#Te.get(t);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:t,entry:s}}))}hide(){this.#Le.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#Re(null)}#Re(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.#Le.take();this.matches(":popover-open")||this.showPopover(),this.#Ce.setAttribute("hidden",""),this.#_e.removeAttribute("hidden");try{const i=await e();if(s.stale)return;this.update(i,t)}catch(e){if(s.stale)return;throw this.hide(),e}finally{s.stale||this.#_e.setAttribute("hidden","")}}async moveOrShow(e,t,s=[]){if(this.shown){const t=this.#Oe(),s=t?.[(e?"next":"previous")+"ElementSibling"],i=s?this.#Fe(s,e):null;return void(t&&i&&this.#ze(i))}await this.show(t,s)}#Fe(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){if(this.#Ce.hidden)return;const t=e?this.#Ce.firstElementChild:this.#Ce.lastElementChild,s=this.#Fe(t,e);s&&this.#ze(s)}page(e){const t=this.#Oe();if(!t)return;let s=t;for(let t=0;t!==this.#Ie();++t){const t=this.#Fe(s[(e?"next":"previous")+"ElementSibling"],e);if(!t)break;s=t}this.#ze(s)}#Ie(){const e=this.#Ce.firstElementChild;return e&&0!==e.offsetHeight?Math.max(1,Math.trunc(this.#Ce.clientHeight/e.offsetHeight)):1}}class J extends m{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 '};#Me;#Pe={src:null,method:null};#Te;#r;#Be;#De;#$e;#ee;#re;#We;#Ve=!1;#He=new Map;#je=new c;#Ge=!1;#Ke;#Ue;_build({slots:e}){const s=this.declared("name");this.#Te=e.options,this.#Qe(),this.#We=this.declared("multiple"),this.#Me.prefetch?.()?.catch(e=>{console.warn("failed to prefetch select options",this,"reason:",e)});const i=this.template().withOverlay({slots:e,name:s}).render();this.#De=i.querySelector("ful-control > input"),this.#$e=i.querySelector("label"),this.#ee=i.querySelector("ful-item-list"),this.#re=e.items&&!t.Fragments.isBlank(e.items)?t.Templates.fromFragment(e.items):null,t.Attributes.forward("input-",this,this.#De),this.#r=i.querySelector("ful-control"),this.#Be=i.querySelector("ful-dropdown");const r=t.Attributes.uid("ful-listbox");this.#Be.setAttribute("listbox",r),this.#De.setAttribute("aria-controls",r),this.#Be.addEventListener("beforetoggle",e=>{const t="open"===e.newState;this.#De.setAttribute("aria-expanded",t?"true":"false"),t||this.#De.removeAttribute("aria-activedescendant")}),this.#Be.addEventListener("activechange",e=>{t.Attributes.set(this.#De,"aria-activedescendant",e.detail.id)});const n=i.querySelector("ful-control-group");return W.wire(n,this.#Be,{prefix:"ful-select",stretch:!0}),[this.#Ke,this.#Ue]=p.throttle(400,()=>this.#Je()),this.#Ye(),this.#Xe(),this.#Ze(),this.#et(),{fragment:i,control:this.#De,error:i.querySelector("ful-field-error"),label:this.#$e}}#Ye(){this.addEventListener("click",e=>{if(!this._interactive()||this.#$e.contains(e.target))return;const t=e.target.closest('button, [role="button"], a[href], input, select, textarea');if(!t||t===this.#De){if(this.#Be.shown)return this.#Ue(),void this.#tt();this.#De.focus(),this.#Ke()}}),this.#ee.addEventListener("click",e=>{e.stopPropagation(),e.target.closest("button")&&this._interactive()&&this.#st([...this.#ee.children].indexOf(e.target.closest("ful-item")))}),this.#r.addEventListener("click",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t&&(e.stopPropagation(),this.#it(t))})}#Xe(){this.addEventListener("keydown",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t?this.#rt(e,t):"ArrowLeft"===e.code&&e.target===this.#De&&0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#nt().at(-1)?.focus()})}#Ze(){this.#De.addEventListener("change",e=>{e.stopPropagation()}),this.#De.addEventListener("focus",()=>{this.#Ge||this.#De.select()}),this.#De.addEventListener("blur",e=>{e.stopPropagation(),e.relatedTarget&&this.contains(e.relatedTarget)||(this.#Ue(),this.#tt(!0))}),this.#De.addEventListener("keydown",e=>{this._interactive()&&this.#at(e)}),this.#De.addEventListener("input",e=>{e.stopPropagation(),this._interactive()&&(this.#Ge=!0,this.#Ke())})}#et(){this.#Be.addEventListener("change",e=>{e.stopPropagation(),this.#Ue(),this._interactive()?(this.#We||this.#He.clear(),this.#Ge=!1,this.#He.set(this.#lt(e.detail.entry.key),e.detail.entry),this.#ot(),this.#De.focus(),this.#Be.hide(),this.#We||this.#De.select()):this.#tt()})}async withLoader(e){return await e(this.#Me)}async reload(){await(this.#Me.invalidate?.()),await(this.#Me.prefetch?.());const e=[...this.#He.keys()];0!==e.length&&await this.#ut(e,this.#je.take()),this.#Be.shown&&await this.#Je()}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#dt()&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#dt()&&this.reload()}async reconfigure(e,{notify:t=!1}={}){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);this.#dt();const s=[...this.#He.keys()];await this.reload();const i=[...this.#He.keys()];t&&i.length!==s.length&&this._notifyChange({entry:this.entry})}#Qe(){this.#Pe={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Me=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#Te})}#dt(){return(this.getAttribute("src")!==this.#Pe.src||this.getAttribute("method")!==this.#Pe.method)&&(this.#Ue(),this.#tt(),this.#Qe(),!0)}#nt(){return Array.from(this.#r.querySelectorAll(":scope > ful-badge"))}#it(e){this._interactive()&&this.#st(this.#nt().indexOf(e))}#st(e){const t=Array.from(this.#He.keys())[e];void 0!==t&&(this.#He.delete(t),this.#ot())}#rt(e,t){switch(e.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":e.preventDefault(),this.#it(t),this.#De.focus();break;case"ArrowLeft":e.preventDefault(),(this.#nt()[this.#nt().indexOf(t)-1]??this.#De).focus();break;case"ArrowRight":e.preventDefault(),(this.#nt()[this.#nt().indexOf(t)+1]??this.#De).focus();break;case"Escape":this.#De.focus()}}#at(e){switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),this.#ct(e);break;case"Home":this.#Be.shown&&(e.preventDefault(),this.#Be.jump(!0));break;case"End":this.#Be.shown&&(e.preventDefault(),this.#Be.jump(!1));break;case"PageDown":case"PageUp":this.#Be.shown&&(e.preventDefault(),this.#Be.page("PageDown"===e.code));break;case"Escape":this.#Ue(),this.#tt();break;case"NumpadEnter":case"Enter":if(!this.#Be.shown)return;e.preventDefault(),this.#Ue(),this.#Ge=!1,this.#ht(),this.#Be.acceptSelection();break;case"Backspace":0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#st(this.#He.size-1);break;case"Tab":this.#Ue(),this.#tt(!0)}}#ct(e){const t="ArrowDown"===e.code;e.altKey?t&&!this.#Be.shown?this.#Je():!t&&this.#Be.shown&&(this.#Ue(),this.#tt()):this.#Be.moveOrShow(t,()=>this.#Me.load(this.#pt()),[...this.#He.keys()])}#tt(e=!1){this.#Be.hide();const t=e&&this.#Ge&&!this.#We&&""===this.#De.value&&0!==this.#He.size;this.#Ge=!1,t&&(this.#He.clear(),this.#ot()),this.#ht()}#Je(){return this.#Be.show(()=>this.#Me.load(this.#pt()),[...this.#He.keys()])}#pt(){return this.#Ge?this.#De.value:""}get query(){return this.#pt()}#ht(){const e=this.#He.values().next().value;this.#De.value=this.#We?"":e?.label??""}#ft(){return[...this.#He.values()]}#ot(){this.#mt(),this._notifyChange({entry:this.entry})}#mt(){const e=this.#We?Array.from(this.#He.entries()).map(([e,t],s)=>{const i=document.createElement("ful-badge");return i.setAttribute("role","button"),i.setAttribute("tabindex",0===s?"0":"-1"),i.setAttribute("value",e),i.innerText=t.label,i}):[];for(const e of this.#r.querySelectorAll(":scope > ful-badge"))e.remove();this.#De.before(...e),this.#Ge||this.#ht(),this.#ee.replaceChildren(),(this.#re??this.template("items")).withOverlay({entries:this.#ft()}).renderTo(this.#ee)}#lt(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){if(!this.#r)return void this._holdValue(e);const t=(null==e?[]:Array.isArray(e)?e:[e]).map(e=>this.#lt(e)),s=this.#We?t:t.slice(0,1);!this.#Ve&&s.some(e=>"string"==typeof e&&e.includes(","))&&(this.#Ve=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#He=new Map(s.map(e=>[e,{key:e,label:e,metadata:void 0}]));const i=this.#je.take();this.#mt(),0!==s.length&&this.#ut(s,i)}async#ut(e,t){const s=await this.#Me.exact(...e);if(t.stale)return;const i=new Map(s.map(e=>[this.#lt(e.key),e]));for(const t of e)this.#He.has(t)&&(i.has(t)?this.#He.set(t,i.get(t)):this.#He.delete(t));this.#mt()}get value(){if(!this.#r){const e=[this._heldValue()??[]].flat().map(e=>this.#lt(e));return this.multiple?e:e[0]??null}return this.#We?[...this.#He.keys()]:[...this.#He.keys()][0]??null}get entry(){const e=this.#ft();return this.#We?e:e[0]??null}get disabled(){return super.disabled}set disabled(e){super.disabled=e,e&&this.#Be?.shown&&(this.#Ue(),this.#tt())}get readonly(){return super.readonly}set readonly(e){super.readonly=e,e&&this.#Be?.shown&&(this.#Ue(),this.#tt())}#fe;get multiple(){return this.#We??this.declared("multiple")}set multiple(e){this.#We=e,this.reflectTo("multiple",e),e||(this.#He=new Map([...this.#He].slice(0,1))),this.#r&&this.#mt()}get itemList(){return this.#fe}set itemList(e){this.#fe=e,this.reflectTo("item-list",e)}}class Y extends m{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 ';#gt;#bt;#vt;_build({slots:e}){const s=t.Attributes.uid(this.declared("name")??"ful-radiogroup"),i=Array.from(e.default.querySelectorAll("ful-radio")),r=i.map(e=>{const i=document.createElement("input");return i.setAttribute("type","radio"),t.Attributes.forward("input-",this,i),t.Attributes.forward("",e,i),i.setAttribute("name",`${s}-ignore`),i.setAttribute("form",""),i.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()}),[i,t.Fragments.fromChildNodes(e)]});i.forEach(e=>{e.remove()});const n=this.template().withOverlay({name:s,slots:e,inputsAndLabels:r}).render();return this.#gt=n.firstElementChild,this.#bt=n.querySelector("input[type=radio]"),this.#vt="boolean"===this.declared("type"),{fragment:n,control:this.#bt,error:n.querySelector("ful-field-error"),described:this,claims:this.#gt,announces:this,freeze:this.#gt}}get value(){if(!this.#gt){const e=this._heldValue(),t=null===e?null:this.querySelector(`ful-radio[value="${CSS.escape(String(e))}"]`),s=t?.getAttribute("value")??null;return null===s||"boolean"!==this.declared("type")?s:"true"===s}const e=this.querySelector("input[type=radio]:checked");return e?this.#vt?"true"===e.value:e.value:null}set value(e){if(!this.#gt)return void this._holdValue(e);const t=this.querySelectorAll("input[type=radio]"),s=()=>{t.forEach(e=>{e.checked=!1})};if(null===e)return void s();const i=this.querySelector(`input[type=radio][value="${CSS.escape(String(e))}"]`);null!==i?i.checked=!0:s()}}class X extends m{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 ';#yt;#De;_build({slots:e}){const s="switch"===this.declared("type"),i=this.template().withOverlay({slots:e,isSwitch:s}).render();this.#yt=i.firstElementChild,this.#De=i.querySelector("input"),t.Attributes.forward("input-",this,this.#De),this.#De.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});const r=i.querySelector("label");return{fragment:i,control:this.#De,error:i.querySelector("ful-field-error"),label:r,freeze:this.#yt}}get value(){return this.#De?this.#De.checked:Boolean(this._heldValue())}set value(e){this.#De?this.#De.checked=e:this._holdValue(e)}}class Z extends t.ParsedElement{static attributes=["sorter"];static observed=["order"];#wt;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.#wt||null}set order(e){this.#wt=e||null,this.reflectTo("order",this.#wt);const s=this.closest("th");s&&t.Attributes.set(s,"aria-sort",this.#wt?"asc"===this.#wt?"ascending":"descending":null)}}class ee extends t.ParsedElement{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 ';#Et=0;#At=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.#At)}}))})}update({current:e,total:t}={}){void 0!==e&&(this.#At=e??0),void 0!==t&&(this.#Et=t??0),this.reflectTo("current",this.#At),this.reflectTo("total",this.#Et);const s=this.#At,i=this.#Et,r=this.declared("pages")??5,n=Math.max(i,1),a=s>0,l=s+1<n,o={index:a?s-1:null,enabled:a},u={index:s,label:s+1},d={index:l?s+1:null,enabled:l},c=Math.max(1,Math.min(r,n)),h=Math.max(0,Math.min(s-Math.floor((c-1)/2),n-c)),p=Array.from({length:c},(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:o,curr:u,next:d,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.#Et}set total(e){this.update({total:e})}get current(){return this.#At}set current(e){this.update({current:e})}}class te{static parse(e,s){const i=e?t.Nodes.queryChildren(e,"schema"):null;if(!i)throw new Error('missing expected <schema>: ful-table needs a <template slot="schema"> holding one');const r=document.createElement("tr"),n=document.createElement("tr");n.setAttribute("data-tpl-each","rows");for(const e of i.getAttributeNames()){const t=i.getAttribute(e);r.setAttribute(e,t??""),n.setAttribute(e,t??"")}const a=t.Nodes.queryChildrenAll(i,"column"),l=a.filter(e=>e.hasAttribute("order")&&e.hasAttribute("sorter")).map(e=>({sorter:e.getAttribute("sorter"),order:e.getAttribute("order")}))[0]??null;for(const e of a){const s=t.Nodes.queryChildren(e,"title"),i=e.getAttribute("sorter"),a=e.getAttribute("order"),l=s??document.createTextNode(e.getAttribute("title")??"");s?.remove(),e.removeAttribute("sorter"),e.removeAttribute("order"),e.removeAttribute("title");const o=i||a?(()=>{const e=document.createElement("ful-sorter");return i&&e.setAttribute("sorter",i),a&&e.setAttribute("order",a),e.append(l),e})():l,u=document.createElement("th"),d=document.createElement("td");for(const t of e.getAttributeNames()){const s=e.getAttribute(t);u.setAttribute(t,s??""),d.setAttribute(t,s??"")}u.append(o),d.append(...e.childNodes),r.append(u),n.append(d)}return{headersTemplate:s.withOverlay({inHeaders:!0,inRows:!1}).withFragment(t.Fragments.from(r)),rowsTemplate:s.withOverlay({inHeaders:!1,inRows:!0}).withFragment(t.Fragments.from(n)),sort:l,length:a.length}}}class se{#ve;constructor(e){this.#ve=e}async load(e,t,s){const i=this.#xt(t),r=Number(e.size),n=e.page*r,a=n+r;return{data:i.slice(n,a),size:i.length}}#xt(e){if(!e?.sorter)return this.#ve;const{sorter:t,order:s}=e,i="desc"===s?-1:1;return[...this.#ve].sort((e,s)=>{const r=e?.[t],n=s?.[t];return r===n?0:null==r?1:null==n?-1:(r<n?-1:1)*i})}update(e){this.#ve=e}}class ie{#w;#E;#A;#S;constructor(e,t,s,i=e=>e){this.#w=e,this.#E=t,this.#A=s,this.#S=i}async load(e,t,s){const i=Object.entries(s).filter(([e,t])=>t);return await this.#w.request(this.#A,this.#E).param("page",e.page).param("size",e.size).param("sort",t?`${t.sorter},${t.order}`:null).param("filters",i.length>0?JSON.stringify(Object.fromEntries(i)):null).fetchJson().then(e=>this.#S(e))}}class re{static create(e,t){const s=e.getAttribute("src");if(s){const t=e.component("http-client"),i=e.getAttribute("method")??"GET",r=e.hasAttribute("response-mapper")?e.component(e.getAttribute("response-mapper")):e=>e;return new ie(t,s,i,r)}return new se([])}}class ne extends t.ParsedElement{static attributes=["loader","autoload:presence"];static observed=["page-size:number","src","method"];static slots=!0;static config={searchIcon:"search",emptyIcon:"inbox"};static template='\n <ful-form data-tpl-if="slots.filters">\n {{{{ slots.filters }}}}\n </ful-form>\n <ful-table-wrapper>\n <table>\n <caption data-tpl-if="slots.caption">{{{{ slots.caption }}}}</caption>\n <thead></thead>\n <tbody></tbody>\n <tbody data-ref="initial">\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty>\n <ful-icon data-tpl-if="config.searchIcon" data-tpl-name="config.searchIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.initial\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="empty" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-empty data-tpl-if="slots.empty" data-ref="empty-authors"></ful-empty>\n <ful-empty data-tpl-if="!slots.empty">\n <ful-icon data-tpl-if="config.emptyIcon" data-tpl-name="config.emptyIcon" aria-hidden="true"></ful-icon>\n {{ #l10n:t(\'table.no-data\') }}\n </ful-empty>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="loading" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <ful-spinner class="big" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner>\n </td>\n </tr>\n </tbody>\n <tbody data-ref="feedback" hidden>\n <tr>\n <td data-tpl-colspan="schema.length">\n <div role="alert">\n <p>{{ #l10n:t(\'table.error\') }}</p>\n <div data-ref="feedback-error"></div>\n </div>\n </td>\n </tr>\n </tbody>\n <tfoot data-tpl-if="slots.footer">\n {{{{ slots.footer }}}}\n </tfoot>\n </table>\n </ful-table-wrapper>\n <ful-pagination current="0" total="1"></ful-pagination>\n ';static templates={row:"\n {{{{ schema.rowsTemplate.withOverlay({'rows': pageResponse.data}).render() }}}}\n "};#Me;#St;#_t;#Ct;#kt;#ke;#qt;#Tt;#Lt;#Nt;#Ot;#zt={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#Rt=!1;#Ft={};#It=null;#Mt=!1;#Pt=null;#Bt=new c;#Pe={src:null,method:null};get pageSize(){return this.#zt.pageRequest.size}set pageSize(e){const t=Number(e??10);Number.isNaN(t)||t===this.#zt.pageRequest.size||(this.#zt={...this.#zt,pageRequest:{page:0,size:t}},this.#Rt&&this.load(this.#zt.pageRequest,this.#zt.sortRequest,this.#Ft))}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#dt()&&this.#Rt&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#dt()&&this.#Rt&&this.reload()}async reconfigure(e){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);return this.#dt(),await this.reload()}#Qe(){this.#Pe={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Me=this.component(this.declared("loader")??"loaders:table").create(this)}#dt(){return(this.getAttribute("src")!==this.#Pe.src||this.getAttribute("method")!==this.#Pe.method)&&(this.#Qe(),this.#zt={...this.#zt,pageRequest:{...this.#zt.pageRequest,page:0}},!0)}async render({slots:e}){const s=this.template(),i=te.parse(e.schema,s),r=s.withOverlay({slots:e,schema:i}).render(),n=t.Nodes.queryChildren(r,"ful-table-wrapper").querySelector("table");t.Attributes.forward("table-",this,n),this.#Qe(),this.#St=i,this.#_t=n.querySelector(":scope > tbody"),this.#Ct=n.querySelector(":scope > tbody[data-ref=loading]"),this.#kt=n.querySelector(":scope > tbody[data-ref=initial]"),this.#ke=n.querySelector(":scope > tbody[data-ref=empty]"),this.#qt=this.#ke.querySelector("ful-empty[data-ref=empty-authors]"),this.#Tt=e.empty&&!t.Fragments.isBlank(e.empty)?t.Templates.fromFragment(e.empty):null,this.#Lt=n.querySelector(":scope > tbody[data-ref=feedback]"),this.#Nt=t.Nodes.queryChildren(r,"ful-pagination"),this.replaceChildren(r);const a=this.querySelector("thead");i.headersTemplate.renderTo(a),this.#Ot=a.querySelectorAll("ful-sorter"),await t.Rendering.waitForChildren(this);const l=t.Nodes.queryChildren(this,"ful-form");this.#zt={pageRequest:{page:0,size:this.declared("page-size")??10},sortRequest:i.sort,filterRequest:l?.values??{}},this.#Ft=this.#zt.filterRequest,this.#It=l,l?.addEventListener("submit:success",async e=>{this.#Pt=this.#Dt(0,e.detail.request),await this.#Pt}),this.addEventListener("page:requested",async e=>{e.target.closest("ful-table")===this&&await this.#Dt(e.detail.value,this.#Ft)}),this.addEventListener("sort:requested",async e=>{if(e.target.closest("ful-table")!==this)return;const t=e.detail.value.order?e.detail.value:null;await this.load(this.#zt.pageRequest,t,this.#Ft),this.#zt.sortRequest===t&&(this.#Ot.forEach(e=>{e.order=null}),e.target.order=e.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){if(!this.#It||this.#Mt)return await this.load(this.#zt.pageRequest,this.#zt.sortRequest,this.#zt.filterRequest);await this.#It.submit()&&await this.#Pt}async load(e,s,i){this.#Rt=!0,this.#Ft=i;const r=this.#Bt.take();let n;this.#Ct.toggleAttribute("hidden",this.#_t.childElementCount>0),this.#Lt.setAttribute("hidden",""),this.#kt.setAttribute("hidden",""),this.#ke.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const a=await this.#Me.load(e,s,i);if(r.stale)return;if(n=Math.max(0,Math.ceil(a.size/e.size)-1),e.page<=n){if(this.#zt={pageRequest:e,sortRequest:s,filterRequest:i},this.#Mt=!0,this.#ne(e,s,i,a),await Promise.all([t.Rendering.waitForChildren(this.#_t),t.Rendering.waitForChildren(this.#ke)]).catch(()=>{}),r.stale)return;return this.removeAttribute("aria-busy"),void this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:s,filterRequest:i,response:a}}))}}catch(n){if(r.stale)return;throw this.#Ct.setAttribute("hidden",""),this.#_t.replaceChildren(),this.#Lt.removeAttribute("hidden"),this.#Lt.querySelector("[data-ref=feedback-error]").textContent=t.Localization.of().failure(n),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:s,filterRequest:i,exception:n}})),n}return await this.load({page:n,size:e.size},s,i)}async withLoader(e){return await e(this.#Me)}async resetWithFilter(e){return await this.#Dt(0,e)}#Dt(e,t){return this.load({page:e,size:this.#zt.pageRequest.size},this.#zt.sortRequest,t)}#ne(e,t,s,i){const r=Math.ceil(i.size/e.size);this.#Ct.setAttribute("hidden",""),this.#_t.replaceChildren(this.template("row").withOverlay({schema:this.#St,pageRequest:e,filterRequest:s,pageResponse:i}).render()),this.#ke.toggleAttribute("hidden",0!==i.data.length),this.#Tt&&0===i.data.length&&this.#qt.replaceChildren(this.#Tt.withOverlay({schema:this.#St,pageRequest:e,filterRequest:s,pageResponse:i}).render()),this.#Nt.update({current:e.page,total:r})}}const ae=(e,t,{items:s,current:i=()=>null})=>{let r="",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();(i()??t[0])?.focus()}),t.addEventListener("keydown",t=>{const i=t.target,a=s(),l=a.find(e=>e===i||e.contains(i));if(!l)return;const o=a.indexOf(l);switch(t.code){case"ArrowDown":return t.preventDefault(),void a[(o+1)%a.length]?.focus();case"ArrowUp":return t.preventDefault(),void a[(o-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(),l.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();r=u-n>500?t.key:r+t.key,n=u;const d=r.toLowerCase(),c=[...d].every(e=>e===d[0]),h=c?d[0]:d,p=c?o+1:o,f=[...a.slice(p),...a.slice(0,p)].find(e=>(e.textContent??"").trim().toLowerCase().startsWith(h));f&&(t.preventDefault(),f.focus())})};class le{static narrow(e,t){const s=(e??[]).filter(e=>t.includes(e));return s.length>0?s:[...t]}#$t;#Ce;#Wt;#Vt;#Ht;#ht;#jt;#Gt;#Kt;#Ut=!1;#Qt=!1;constructor(e,{vocabulary:t,glyphs:s={},labelFor:i=e=>e,display:r=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#$t=e,this.#Ce=e.nextElementSibling,this.#Wt=t,this.#Vt=s,this.#Ht=i,this.#ht=r??(e=>s[e]??e),this.#jt=n,this.#Gt=a,this.#Kt=[...t],this.#Ce.addEventListener("click",e=>{const t=e.target.closest("li > a");if(!t||!this.#jt())return;const s=t.getAttribute("value"),i=this.value;this.value=s,this.#Ce.hidePopover?.(),i!==s&&this.#Gt(s)})}get allowed(){return this.#Kt}set allowed(e){this.#Kt=le.narrow(e,this.#Wt),this.#Jt(),!this.#Qt&&this.#Kt.length>1&&(this.#m(),this.#Qt=!0),this.#Yt(),this.pinned&&(this.value=this.#Kt[0])}preferring(e){return null!==e&&this.#Kt.includes(e)?e:this.#Kt[0]}get pinned(){return this.#Kt.length<2}set fixed(e){this.#$t.toggleAttribute("hidden",!!e)}get value(){return this.#$t.getAttribute("value")}set value(e){this.#$t.setAttribute("value",e),this.#$t.textContent=this.#ht(e),t.Attributes.set(this.#$t,"aria-label",this.#Ht(e)),this.#Xt()}#Xt(){const e=this.value;for(const t of this.#ee())t.setAttribute("aria-checked",String(t.getAttribute("value")===e))}set claimed(e){this.#Ut=e,this.#Yt()}#Jt(){this.#Ce.replaceChildren(...this.#Kt.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 i=this.#Ht(e),r=this.#Vt[e]??e;if(i===e&&r===e)s.innerText=e;else{const e=document.createElement("span");e.innerText=r;const t=document.createElement("span");t.innerText=i,s.append(e,t)}return t.append(s),t})),this.#Xt()}#Yt(){const e=this.pinned;this.#$t.toggleAttribute("disabled",e||this.#Ut),t.Attributes.set(this.#$t,"aria-haspopup",e?null:"true"),t.Attributes.set(this.#$t,"aria-expanded",e?null:"false"),e?this.#$t.removeAttribute("popovertarget"):this.#Ce.id&&this.#$t.setAttribute("popovertarget",this.#Ce.id)}#ee(){return Array.from(this.#Ce.querySelectorAll("li > a"),e=>e)}#m(){W.wire(this.#$t,this.#Ce,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),ae(()=>this.#$t,this.#Ce,{items:()=>this.#ee(),current:()=>this.#ee().find(e=>e.getAttribute("value")===this.value)})}}const oe={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},ue=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],de=[...ue,"CONTAINS","STARTS_WITH","ENDS_WITH"],ce=["IGNORE_CASE","CASE_SENSITIVE"],he={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:pe}=t.Localization.of(),fe=e=>pe(`filters.op.${e}`),me=e=>pe(`filters.sensitivity.${e}`),ge=e=>pe(""===e?"filters.boolean.any":`filters.boolean.${e}`),be=e=>e.querySelector(":scope > label")?.textContent.trim()||null,ve=(e,t,{singular:s,plural:i,vocabulary:r,fallback:n})=>{const a=e.declared(s);if(null===a)return;e.hasAttribute(i)&&console.warn(`${e.localName}: ${s} fixes what ${i} offers a menu for, the plural is ignored`,e);const l=r.includes(a);l||console.warn(`${e.localName}: '${a}' is not one of its ${i}, the default is pinned instead`,e),t.allowed=[l?a:n],t.fixed=!0},ye=(e,t,s)=>{const i=s.filter(e=>null!=e&&""!=`${e}`);return 0===i.length?null:{label:e,operator:t,operands:i.map(e=>`${e}`)}};class we extends C{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 le(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:oe,labelFor:fe,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),ve(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 ue}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){null===this.declared("operator")&&(this._operator?(this._operator.allowed=e,null!==this._operator.value&&this._showOperator(this._operator.preferring(this._operator.value))):this._declaredOperators=le.narrow(e,this._vocabulary()))}get value(){return this._operator?this._tuple():this._shownTuple(this._heldValue())}set value(e){this._operator?this._applyTuple(e):this._holdValue(e)}_shownTuple(e){if(null==e)return null;const[t,...s]=e,i=this.declared("operator"),r=this._vocabulary().includes(i),n=null===i?le.narrow(this.declared("operators"),this._vocabulary()):[r?i:this._defaultOperator()],a=n.includes(t)?t:n[0],l=[s[0],s[1]].map(e=>`${e?this._deserialize(e):e??""}`),o="BETWEEN"===a?l:l.slice(0,1);return o.some(e=>""===e)?null:[a,...o.map(e=>this._serialize(e))]}_tuple(){const e=this._operator.value,t=this.#Zt();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;this._showOperator(this._operator.preferring(t)),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 this._operator?ye(be(this),this._operator.value,this.#Zt()):null}#Zt(){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 Ee extends we{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(e){return L.localToIso(e)}_deserialize(e){return L.isoToLocal(e)}}class Ae extends we{_type(){return"date"}}class xe extends we{_type(){return"number"}}class Se extends we{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 de}_sensitivityButton;_build(e){const t=super._build(e);return this._sensitivityButton=new le(t.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:ce,glyphs:he,labelFor:me,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=ce[0],ve(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:ce,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=le.narrow(e,ce));const t=this._sensitivityButton.value;this._sensitivityButton.allowed=e,this._sensitivityButton.value=this._sensitivityButton.preferring(t)}get value(){if(!this._sensitivityButton){const e=this._heldValue(),t=null==e?null:this._shownTuple([e[0],...e.slice(2)]);if(null===t)return null;const s=this.declared("sensitivity"),i=null===s?le.narrow(this.declared("sensitivities"),ce):[ce.includes(s)?s:"IGNORE_CASE"],r=i.includes(e[1])?e[1]:"IGNORE_CASE";return[t[0],i.includes(r)?r:i[0],...t.slice(1)]}const e=this._tuple();return null==e?null:[e[0],this._sensitivity,...e.slice(1)]}set value(e){this._sensitivityButton?null!=e?(this._sensitivityButton.allowed.includes(e[1])&&(this._sensitivityButton.value=e[1]),this._applyTuple([e[0],...e.slice(2)])):this._applyTuple(e):this._holdValue(e)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const _e=["","true","false"],Ce={true:"✓",false:"✗"};class ke extends m{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 le(t.querySelector("[data-ref=operator]"),{vocabulary:ke.OPERATORS,glyphs:oe,labelFor:fe,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new le(s,{vocabulary:_e,glyphs:Ce,labelFor:ge,display:ge,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(ke.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,null!==this._operator.value&&(this._operator.value=this._operator.preferring(this._operator.value))):this._declaredOperators=le.narrow(e,this._vocabulary())}_vocabulary(){return ke.OPERATORS}get value(){if(!this._value){const e=this._heldValue(),t=`${e?.[1]??""}`;if(""===t)return null;const s=le.narrow(this.declared("operators"),this._vocabulary());return[s.includes(e[0])?e[0]:s[0],t]}return""===this._value.value?null:[this._operator.value,this._value.value]}set value(e){this._value?null!=e?(this._operator.value=this._operator.preferring(e[0]),this._value.value=e[1]??""):this._value.value="":this._holdValue(e)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(ke.DEFAULT_OPERATOR))}get criterion(){if(!this._value)return null;const e=this._value.value;return ye(be(this),this._operator.value,[""===e?"":ge(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 qe extends J{static attributes=["operator"];#es(){const e=super.value;return this.multiple?e:null==e?[]:[e]}get value(){const e=this.#es();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 ye(be(this),this.declared("operator"),[super.entry].flat().filter(e=>e).map(e=>e.label))}}class Te extends t.ParsedElement{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]"),i=t.querySelector("[data-ref=content]");W.wire(s,i,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),i.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(t),this.declared("describes")&&Te.#g(this,s,i)}static#g(e,t,s){h(e)?.describedBy(s)?t.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",e)}}class Le{#ts=new WeakSet;#d=new WeakMap;async request(e,t,s,i){const r=!this.#ts.has(t),n={name:s,section:t,index:i,first:r},a=["section:requested",...null!=i?[`section:requested:#${i}`]:[],...s?[`section:requested:${s}`]:[]],l=[];for(const t of a){const s=new CustomEvent(t,{bubbles:!0,detail:n});e.dispatchEvent(s),l.push(...s.async?.promises??[])}if(0===l.length)return;this.#ts.add(t);let o=this.#d.get(t);o||(o=new c,this.#d.set(t,o));const u=o.take(),d=()=>!u.stale;t.querySelector(":scope > .ful-section-error")?.remove();const h=requestAnimationFrame(()=>{d()&&(t.toggleAttribute("loading",!0),t.setAttribute("aria-busy","true"))});try{return await Promise.all(l)}catch(e){throw d()&&this.#ss(t,e),e}finally{cancelAnimationFrame(h),d()&&(t.toggleAttribute("loading",!1),t.removeAttribute("aria-busy"))}}#ss(e,s){e.querySelector(":scope > .ful-section-error")?.remove();const i=document.createElement("div");i.className="ful-section-error",i.setAttribute("role","alert"),i.textContent=t.Localization.of().failure(s),e.prepend(i)}}class Ne{#is;#rs;#ns;#Ct;#as;#ls=new Le;#os=new c;#us=null;constructor(e,t,s){this.#is=e,this.#rs=t.querySelector("[data-ref=dialog]"),this.#ns=t.querySelector(`[data-ref=${s}]`),this.#Ct=t.querySelector("[data-ref=loading]"),this.#as=t.querySelector("[data-ref=error]")}get dialog(){return this.#rs}get section(){return this.#ns}get dirty(){return Array.from(this.#rs.querySelectorAll("ful-form")).some(e=>e.closest("dialog")===this.#rs&&e.dirty)}dismiss(e,t,s){return this.#us?this.#us:this.#is.dispatchEvent(e)?e.cancelable?s&&this.dirty?(this.#us=s().then(e=>(e&&this.#rs.open&&t(),e)).finally(()=>{this.#us=null}),this.#us):(t(),Promise.resolve(!0)):Promise.resolve(!0):Promise.resolve(!1)}onBackdrop(e){let t=!1;this.#rs.addEventListener("mousedown",e=>{t=e.target===this.#rs}),this.#rs.addEventListener("click",s=>{t&&s.target===this.#rs&&e()})}onSubmitted(e){this.#ns.addEventListener("submit:success",t=>{"ful-form"===t.target.localName&&t.target.parentElement===this.#ns&&e(t.detail.response)})}restChrome(){this.#as?.replaceChildren(),this.#as?.setAttribute("hidden",""),this.#Ct?.setAttribute("hidden",""),this.#ns?.removeAttribute("hidden")}request(){return this.#ls.request(this.#is,this.#ns,null,null).catch(()=>{})}async update(e,s){const i=this.#os.take();this.#ns.replaceChildren(),this.restChrome(),this.#Ct?.removeAttribute("hidden"),this.#ns.setAttribute("hidden",""),s();try{const t=await e();return i.stale?null:(this.#ns.replaceChildren(t),this.#Ct?.setAttribute("hidden",""),this.#ns.removeAttribute("hidden"),this.#ns)}catch(e){throw i.stale||(this.#as?.removeAttribute("hidden"),this.#as&&(this.#as.textContent=t.Localization.of().failure(e)),this.#Ct?.setAttribute("hidden",""),this.#ns.setAttribute("hidden","")),e}}}let Oe=!1;const ze=()=>{Oe||(Oe=!0,document.addEventListener("click",e=>{const t=e.target.closest?.("[dialog-target]");t&&document.getElementById(t.getAttribute("dialog-target"))?.open?.()}))};class Re extends t.ParsedElement{static attributes=["header","requires-answer:presence","close-on-submit:presence","guard-dismiss:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-dialog">\n <header data-tpl-if="header || slots.header || !requiresAnswer" class="ful-dialog-header">\n {{{{ slots.header }}}}\n <h2 data-tpl-if="header">{{ header }}</h2>\n <button data-tpl-if="!requiresAnswer" type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'dialog.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <div data-ref="body" class="ful-dialog-body">{{{{ slots.default }}}}</div>\n <footer class="ful-dialog-footer"><button type="button" data-ref="acknowledge" data-result="acknowledged" data-tpl-if="!slots.buttons && !closeOnSubmit" data-tpl-aria-label="#l10n:t(\'dialog.acknowledge\')">{{ #l10n:t(\'dialog.acknowledge\') }}</button>{{{{ slots.buttons }}}}</footer>\n </dialog>\n ';#rs;#ds;#cs=[];#hs=null;render({slots:e}){const s=this.declared("requires-answer"),i=this.declared("close-on-submit"),r=this.template().withOverlay({slots:e,header:this.declared("header")??"",requiresAnswer:s,closeOnSubmit:i}).render();this.#ds=new Ne(this,r,"body"),this.#rs=this.#ds.dialog;const n=r.querySelector("h2");n&&(n.id||=t.Attributes.uid("ful-dialog-title"),this.#rs.setAttribute("aria-labelledby",n.id)),this.#rs.addEventListener("close",()=>{const e=this.#ps();this.dispatchEvent(new CustomEvent("close",{detail:e})),this.#fs(e)}),this.#rs.addEventListener("click",e=>{const t=e.target.closest("button[data-result]");t&&t.closest("dialog")===this.#rs&&this.#rs.close(t.dataset.result)}),s||this.#ds.onBackdrop(()=>this.dismiss("backdrop")),r.querySelector("[data-ref=close]")?.addEventListener("click",()=>this.dismiss("button")),i&&this.#ds.onSubmitted(e=>{this.#hs={dismissed:!1,result:null,response:e},this.#rs.close("submitted")}),this.#rs.addEventListener("cancel",e=>{if(!e.cancelable)return this.#rs.returnValue="",void this.#ms("escape",!1);e.preventDefault(),s||this.dismiss("escape")}),this.replaceChildren(r),ze()}#ps(){if(this.#hs)return this.#hs;const e=this.#rs?.returnValue??"";return""===e?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:e,response:null}}#fs(e){const t=this.#cs;this.#cs=[];for(const s of t)s(e)}disconnectedCallback(){this.#fs(this.#ps())}open(){return this.ask()}ask(){return this.#gs()&&(this.#ds.restChrome(),this.#ds.request()),new Promise(e=>{this.#cs.push(e)})}async update(e){return await this.#ds.update(e,()=>this.#gs())}refresh(){return this.#ds.request()}dismiss(e){return this.#rs.open?this.#ms(e,!0):Promise.resolve(!0)}#ms(e,t){return this.#ds.dismiss(new CustomEvent("dialog:dismiss",{cancelable:t,detail:{reason:e}}),()=>this.#rs.close(""),this.declared("guard-dismiss")?Fe:null)}close(e){this.#rs.close(e??"")}#gs(){return this.#rs.open&&!this.#rs.matches(":modal")&&this.#rs.removeAttribute("open"),!this.#rs.open&&(this.#rs.returnValue="",this.#hs=null,this.#rs.showModal(),!0)}static async ask(e,s,i=[],{className:r}={}){const n=document.createElement("ful-dialog");if(n.setAttribute("header",e),r&&(n.className=r),"string"==typeof s?n.textContent=s:s&&n.append(s),i.length>0){const e=document.createElement("template");e.setAttribute("slot","buttons");for(const t of i){if(t instanceof Node){e.content.append(t);continue}const[s,i,r]=t,n=document.createElement("button");n.type="button",n.dataset.result=s,r&&(n.className=r),n.textContent=i,e.content.append(n)}n.append(e)}document.body.append(n);try{return await t.Rendering.waitFor(n),await n.ask()}finally{n.remove()}}static async confirm(e,s,i={},r={}){const n=await Re.ask(e,s,[["cancel",i.cancel??t.Localization.of().t("dialog.cancel")],["confirm",i.confirm??t.Localization.of().t("dialog.confirm"),"ful-button"]],r);return!n.dismissed&&"confirm"===n.result}}const Fe=()=>{const e=t.Localization.of();return Re.confirm(e.t("dialog.discard.header"),e.t("dialog.discard.body"),{confirm:e.t("dialog.discard.confirm"),cancel:e.t("dialog.discard.cancel")})};class Ie extends t.ParsedElement{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 ';#rs;#bs;#ds;#hs=null;#cs=[];#vs=!1;#ys=e=>{e.target===this.#rs&&this.#ws()};render({slots:e}){const s=this.template().withOverlay({slots:e,title:this.declared("header")??""}).render();this.#ds=new Ne(this,s,"content"),this.#rs=this.#ds.dialog,this.#bs=s.querySelector("[data-ref=title]"),this.#bs.id||=t.Attributes.uid("ful-drawer-title"),this.#rs.setAttribute("aria-labelledby",this.#bs.id);const i=this.declared("placement");i&&this.#rs.setAttribute("placement",i),s.querySelector("[data-ref=close]").addEventListener("click",()=>this.dismiss("button")),this.#ds.onBackdrop(()=>this.dismiss("backdrop")),this.#rs.addEventListener("cancel",e=>{if(!e.cancelable)return this.#Es(),void this.#ms("escape",!1);e.preventDefault(),this.dismiss("escape")}),this.#rs.addEventListener("click",e=>{const t=e.target.closest("button[data-result]");t&&t.closest("dialog")===this.#rs&&this.close(t.dataset.result)}),this.#rs.addEventListener("close",()=>{const e=this.#ps();this.dispatchEvent(new CustomEvent("close",{detail:e})),this.#fs(e)}),this.declared("close-on-submit")&&this.#ds.onSubmitted(e=>{this.#hs={dismissed:!1,result:null,response:e},this.close()}),this.replaceChildren(s),ze()}get header(){return this.#bs.textContent}set header(e){this.#bs.textContent=e??""}async update(e,t){return this.header=e,await this.#ds.update(t,()=>this.#gs())}refresh(){return this.#ds.request()}#ps(){return this.#hs??{dismissed:!0,result:null,response:null}}#fs(e){const t=this.#cs;this.#cs=[];for(const s of t)s(e)}disconnectedCallback(){this.#fs(this.#ps())}open(){return this.ask()}ask(){return this.#gs()&&(this.#ds.restChrome(),this.#ds.request()),new Promise(e=>{this.#cs.push(e)})}dismiss(e){return this.#vs||!this.#rs.open?Promise.resolve(!0):this.#ms(e,!0)}#ms(e,t){return this.#ds.dismiss(new CustomEvent("drawer:dismiss",{cancelable:t,detail:{reason:e}}),()=>this.close(),this.declared("guard-dismiss")?Fe:null)}close(e){!this.#vs&&this.#rs.open&&(e&&(this.#hs={dismissed:!1,result:e,response:null}),matchMedia("(prefers-reduced-motion: reduce)").matches?this.#rs.close():(this.#rs.setAttribute("closing",""),0!==this.#rs.getAnimations().length?(this.#vs=!0,this.#rs.addEventListener("animationend",this.#ys)):this.#ws()))}#ws(){this.#Es(),this.#rs.close()}#Es(){this.#vs=!1,this.#rs.removeEventListener("animationend",this.#ys),this.#rs.removeAttribute("closing")}#gs(){return this.#vs&&(this.#hs=null),this.#Es(),this.#rs.open&&!this.#rs.matches(":modal")&&this.#rs.removeAttribute("open"),!this.#rs.open&&(this.#hs=null,this.#rs.showModal(),!0)}}class Me extends t.ParsedElement{static attributes=["for"];#As=null;#xs=null;#Ss=e=>{const t=e.target;this.#xs=this.matches(":popover-open")&&this.#As?.contains(t)?this.#As:null};connectedCallback(){super.connectedCallback(),this.rendered&&!this.declared("for")&&document.addEventListener("pointerdown",this.#Ss,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this.#Ss,!0)}render(){const e=this.declared("for"),t=e?document.getElementById(e):null;if(e&&!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?(this.#As=t,t.setAttribute("aria-haspopup","menu"),W.wire(t,this,{prefix:"ful-menu",invoke:!0,expanded:!0})):this.#_s(),ae(()=>this.#As,this,{items:()=>this.items}),this.#Xt(),this.addEventListener("click",e=>{const t=e.target;this.items.some(e=>e===t||e.contains(t))&&this.hidePopover()})}showFor(e){if(this.declared("for"))throw new Error("ful-menu: showFor serves a menu without for; a menu with for is opened by its invoker");const t=this.#xs;if(this.#xs=null,t===e)return;this.#As&&this.#As!==e&&this.#As.setAttribute("aria-expanded","false"),this.#As=e,e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","true"),this.style.margin="";const s=Number.parseFloat(getComputedStyle(this).marginBlockStart)||0,i=this.matches(":popover-open");W.show(this,e,{flip:!0,gap:s}),i&&this.items[0]?.focus()}get items(){return this.#Xt().filter(e=>!e.hasAttribute("disabled")&&!e.hasAttribute("hidden"))}#_s(){document.addEventListener("pointerdown",this.#Ss,!0),this.addEventListener("toggle",e=>{"closed"===e.newState&&this.#As?.setAttribute("aria-expanded","false")})}#Xt(){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 Pe=["info","success","warning","error"],Be=new Set;let De=!1;class $e extends t.ParsedElement{static attributes=["timeout:number"];#Cs;connectedCallback(){super.connectedCallback(),this.rendered&&Be.add(this)}disconnectedCallback(){Be.delete(this)}render(){this.#Cs=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",t.Localization.of().t("toast.region")),this.setAttribute("popover","manual"),De||(De=!0,document.addEventListener("show-toast",e=>{if(e.detail)for(const t of Be)t.show(e.detail.message,e.detail)})),Be.add(this)}show(e,s={}){const i=Pe.includes(s.severity)?s.severity:"info",r=document.createElement("ful-toast");r.classList.add(i),r.setAttribute("role","error"===i?"alert":"status");const n=document.createElement("div");n.textContent=t.Localization.of().failure(e);const a=document.createElement("button");a.type="button",a.setAttribute("aria-label",t.Localization.of().t("toast.dismiss"));const l=document.createElement("ful-icon");l.setAttribute("name","x-lg"),l.setAttribute("aria-hidden","true"),a.append(l),r.append(n);let o=s.timeout??this.#Cs,u=performance.now(),d=0;const c=()=>{clearTimeout(d),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(s.action?.label){const e=document.createElement("button");e.type="button",e.className="ful-toast-action",e.textContent=String(s.action.label),e.addEventListener("click",()=>{s.action.onClick?.(),c()}),r.append(e)}r.append(a),r.addEventListener("animationend",()=>{r.classList.contains("ful-toast-out")&&r.remove()});let h=0;const p=()=>{0===h&&(clearTimeout(d),o=Math.max(0,o-(performance.now()-u))),++h},f=()=>{0!==h&&0===--h&&(u=performance.now(),d=setTimeout(c,o))};return r.addEventListener("mouseenter",p),r.addEventListener("mouseleave",f),r.addEventListener("focusin",p),r.addEventListener("focusout",f),a.addEventListener("click",c),this.append(r),this.#ks(),d=setTimeout(c,o),r}#ks(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class We extends t.ParsedElement{static slots=!0;static observed=["active:number"];static template='\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-start" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.previous\')"><ful-icon name="chevron-left" aria-hidden="true"></ful-icon></button>\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-end" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.next\')"><ful-icon name="chevron-right" aria-hidden="true"></ful-icon></button>\n {{{{ slots.default }}}}\n ';#qs;#Ts;#Ls;#Ns=[];#Os=[];#ls=new Le;#zs=0;render({slots:e}){const s=this.template().withOverlay({slots:e}).render();this.#qs=s.querySelector("ful-tablist"),this.#Ts=s.querySelector('[data-ref="scroll-start"]'),this.#Ls=s.querySelector('[data-ref="scroll-end"]');const i=[this.#qs,this.#Ts,this.#Ls],r=[...this.#qs.children];this.#Os=[...s.children].filter(e=>!i.includes(e)),r.length!==this.#Os.length&&console.warn(`ful-tabs: ${r.length} tabs declared for ${this.#Os.length} panels, the surplus is left alone`);const n=Math.min(r.length,this.#Os.length);this.#Ns=[];for(let e=0;e!==n;++e){const s=this.#Os[e],i=document.createElement("button");i.type="button",i.role="tab",i.id=t.Attributes.uid("ful-tab"),s.id||(s.id=t.Attributes.uid("ful-tabpanel")),i.setAttribute("aria-controls",s.id),s.role="tabpanel",s.setAttribute("aria-labelledby",i.id),s.tabIndex=0,i.append(...r[e].childNodes),i.addEventListener("click",()=>{this.active=e}),r[e].replaceWith(i),this.#Ns.push(i)}this.#qs.addEventListener("keydown",e=>{const t=this.#zs;let s=null;"ArrowRight"===e.key?s=(t+1)%this.#Ns.length:"ArrowLeft"===e.key?s=(t-1+this.#Ns.length)%this.#Ns.length:"Home"===e.key?s=0:"End"===e.key&&(s=this.#Ns.length-1),null!==s&&s!==t&&(e.preventDefault(),this.active=s,this.#Ns[s].focus())}),this.#Ts.addEventListener("click",()=>this.#Rs(-1)),this.#Ls.addEventListener("click",()=>this.#Rs(1)),this.#qs.addEventListener("scroll",()=>this.#Fs(),{passive:!0});let a=-1;const l=new ResizeObserver(()=>{this.#Fs(),this.#qs.clientWidth!==a&&(a=this.#qs.clientWidth,this.#Is(this.#Ns[this.#zs],"auto"))});l.observe(this.#qs);for(const e of this.#Ns)l.observe(e);this.replaceChildren(s)}#Fs(){const e=this.#qs,t=e.scrollWidth-e.clientWidth,s=Math.abs(e.scrollLeft);this.#Ts.hidden=s<=1,this.#Ls.hidden=s>=t-1,this.#Ts.style.blockSize=this.#Ls.style.blockSize=`${e.clientHeight}px`}#Ms(){const e=this.#qs.getBoundingClientRect(),t="rtl"===getComputedStyle(this.#qs).direction,[s,i]=t?[this.#Ls,this.#Ts]:[this.#Ts,this.#Ls];return{left:e.left+s.offsetWidth,right:e.right-i.offsetWidth}}#Rs(e){const{left:t,right:s}=this.#Ms(),i=e>0!=("rtl"===getComputedStyle(this.#qs).direction)?e=>e.getBoundingClientRect().right>s+1:e=>e.getBoundingClientRect().left<t-1,r=e>0?this.#Ns.find(i):this.#Ns.findLast(i);this.#Is(r,matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth")}#Is(e,t){if(!e)return;const{left:s,right:i}=this.#Ms(),r=e.getBoundingClientRect();r.right>i?this.#qs.scrollBy({left:Math.ceil(r.right-i),behavior:t}):r.left<s&&this.#qs.scrollBy({left:Math.floor(r.left-s),behavior:t})}get active(){return this.#zs}refresh(e){const t=e instanceof Element?this.#Os.indexOf(e):Number.isInteger(e)?e:NaN,s=this.#Os[t];if(s)return this.#ls.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.#Ns.length-1)),s=this.#zs;for(const[e,s]of this.#Ns.entries())s.setAttribute("aria-selected",e===t?"true":"false"),s.tabIndex=e===t?0:-1,this.#Os[e].hidden=e!==t;this.#zs=t,this.reflectTo("active",t),this.#Is(this.#Ns[t],"auto"),this.rendered&&t!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:t,previous:s}})),this.#Os.length>0&&(t!==s||!this.rendered)&&this.#ls.request(this,this.#Os[t],null,t).catch(()=>{})}}class Ve extends t.ParsedElement{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#ie;#Ps=!1;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#ie=t.querySelector("ful-accordion-group"),this.replaceChildren(t)}get exclusive(){return this.#Ps}set exclusive(e){this.#Ps=!0===e,this.reflectTo("exclusive",this.#Ps);const s=this.#Ps?t.Attributes.uid("ful-accordion"):null;for(const e of this.#ie.querySelectorAll(":scope > details"))null===s?e.removeAttribute("name"):e.setAttribute("name",s)}}class He extends t.ParsedElement{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 ";#Bs=[];#ds=[];#ls=new Le;#Ds=0;#$s;render({slots:e}){const t=this.template().withOverlay({slots:e}).render(),s=[...t.querySelector("ful-steps ol").children];this.#ds=[...t.children].filter(e=>"ful-steps"!==e.localName),s.length!==this.#ds.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#ds.length} sections, the surplus is left alone`);const i=Math.min(s.length,this.#ds.length);this.#Bs=[];for(let e=0;e!==i;++e){const t=document.createElement("li");t.append(...s[e].childNodes),s[e].replaceWith(t),this.#Bs.push(t),this.#ds[e].tabIndex=-1}if(this.replaceChildren(t),i>0){const e=this.#ds.findIndex(e=>"step"===e.getAttribute("aria-current"));this.#Ws(-1===e?0:Math.min(e,i-1)),this.#Vs(this.#Ds).catch(()=>{})}}get index(){return this.#Ds}get step(){return this.#ds[this.#Ds]?.getAttribute("data-step")??null}get progress(){return this.#$s}set progress(e){this.#$s=e,this.reflectTo("progress",e)}next(){return this.#Hs(this.#Ds+1)}prev(){return this.#Hs(this.#Ds-1)}move(e){const t=this.#ds.findIndex(t=>t.getAttribute("data-step")===e);if(!(-1===t||t>=this.#Bs.length))return this.#Hs(t);console.warn(`ful-wizard: no section paired with a step carries data-step="${e}"`)}refresh(e){const t=e instanceof Element?this.#ds.indexOf(e):this.#ds.findIndex(t=>t.getAttribute("data-step")===e);if(!(-1===t||t>=this.#Bs.length))return this.#Vs(t).catch(()=>{});console.warn(`ful-wizard: no section answers to "${e}"`)}#Vs(e){return this.#ls.request(this,this.#ds[e],this.#ds[e].getAttribute("data-step"),e)}#Hs(e){const t=Math.min(Math.max(0,e),Math.max(0,this.#Bs.length-1));if(t!==this.#Ds)return this.#Ws(t),this.#ds[this.#Ds].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#Ds,step:this.step}})),this.#Vs(t)}#Ws(e){for(const[t,s]of this.#Bs.entries())t===e?(s.setAttribute("aria-current","step"),this.#ds[t].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#ds[t].removeAttribute("aria-current"));this.#Ds=e}}const je={en:{"pagination.showing":"Page {current} of {total}","pagination.navigation":"Page navigation","pagination.previous":"Previous","pagination.next":"Next","pagination.reload":"Reload","table.initial":"Start searching to see results.","table.error":"Error while loading data:","table.no-data":"No elements found.","dropdown.empty":"No results","select.remove":"Remove","files.dropzone-label":"Click or drop your files here","files.remove":"Remove","files.unacceptable-file-type":"Only files of type {types} are supported","files.max-file-size-exceeded":"Maximum supported file size is {size}","files.max-total-size-exceeded":"Maximum supported total file size is {size}","files.max-files-exceeded":{one:"Maximum of {count} file exceeded",other:"Maximum of {count} files exceeded"},"filters.op.EQ":"Equals","filters.op.NEQ":"Not equal","filters.op.LT":"Less than","filters.op.GT":"Greater than","filters.op.LTE":"At most","filters.op.GTE":"At least","filters.op.BETWEEN":"Between","filters.op.CONTAINS":"Contains","filters.op.STARTS_WITH":"Starts with","filters.op.ENDS_WITH":"Ends with","filters.sensitivity.IGNORE_CASE":"Ignore case","filters.sensitivity.CASE_SENSITIVE":"Case sensitive","filters.boolean.any":"Any","filters.boolean.true":"Yes","filters.boolean.false":"No","info.tooltip":"More information","failure.no-reason":"Something went wrong","dialog.acknowledge":"Got it","dialog.close":"Close","dialog.confirm":"Confirm","dialog.cancel":"Cancel","dialog.discard.header":"Unsaved changes","dialog.discard.body":"There are unsaved changes: close anyway?","dialog.discard.confirm":"Close without saving","dialog.discard.cancel":"Keep editing","drawer.close":"Close","spinner.loading":"Loading…","tabs.previous":"Previous tabs","tabs.next":"Next tabs","toast.region":"Notifications","toast.dismiss":"Dismiss","wizard.progress":"Progress"},it:{"pagination.showing":"Pagina {current} di {total}","pagination.navigation":"Navigazione pagine","pagination.previous":"Precedente","pagination.next":"Successivo","pagination.reload":"Ricarica","table.initial":"Avvia la ricerca per visualizzare i risultati.","table.error":"Errore nel caricamento dei dati:","table.no-data":"Nessun elemento trovato.","dropdown.empty":"Nessun risultato","select.remove":"Rimuovi","files.dropzone-label":"Clicca o trascina i file qui","files.remove":"Rimuovi","files.unacceptable-file-type":"Solo i file di tipo {types} sono supportati","files.max-file-size-exceeded":"La dimensione massima di un file è di {size}","files.max-total-size-exceeded":"La dimensione massima complessiva dei file è di {size}","files.max-files-exceeded":{other:"Superato il numero massimo di {count} file"},"filters.op.EQ":"Uguale","filters.op.NEQ":"Diverso","filters.op.LT":"Minore","filters.op.GT":"Maggiore","filters.op.LTE":"Al massimo","filters.op.GTE":"Almeno","filters.op.BETWEEN":"Tra","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Inizia con","filters.op.ENDS_WITH":"Termina con","filters.sensitivity.IGNORE_CASE":"Ignora maiuscole","filters.sensitivity.CASE_SENSITIVE":"Distingui maiuscole","filters.boolean.any":"Qualsiasi","filters.boolean.true":"Sì","filters.boolean.false":"No","info.tooltip":"Maggiori informazioni","failure.no-reason":"Si è verificato un errore","dialog.acknowledge":"Ho capito","dialog.close":"Chiudi","dialog.confirm":"Conferma","dialog.cancel":"Annulla","dialog.discard.header":"Modifiche non salvate","dialog.discard.body":"Ci sono modifiche non salvate: chiudere comunque?","dialog.discard.confirm":"Chiudi senza salvare","dialog.discard.cancel":"Continua a modificare","drawer.close":"Chiudi","spinner.loading":"Caricamento…","tabs.previous":"Schede precedenti","tabs.next":"Schede successive","toast.region":"Notifiche","toast.dismiss":"Chiudi","wizard.progress":"Avanzamento"},es:{"pagination.showing":"Página {current} de {total}","pagination.navigation":"Navegación de páginas","pagination.previous":"Anterior","pagination.next":"Siguiente","pagination.reload":"Recargar","table.initial":"Inicia la búsqueda para ver los resultados.","table.error":"Error al cargar los datos:","table.no-data":"No se encontraron elementos.","dropdown.empty":"Sin resultados","select.remove":"Eliminar","files.dropzone-label":"Haz clic o arrastra tus archivos aquí","files.remove":"Eliminar","files.unacceptable-file-type":"Solo se admiten archivos de tipo {types}","files.max-file-size-exceeded":"El tamaño máximo de archivo admitido es {size}","files.max-total-size-exceeded":"El tamaño total máximo admitido es {size}","files.max-files-exceeded":{one:"Se ha superado el número máximo de {count} archivo",other:"Se ha superado el número máximo de {count} archivos"},"filters.op.EQ":"Igual","filters.op.NEQ":"Distinto","filters.op.LT":"Menor","filters.op.GT":"Mayor","filters.op.LTE":"Como máximo","filters.op.GTE":"Al menos","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Empieza por","filters.op.ENDS_WITH":"Termina por","filters.sensitivity.IGNORE_CASE":"Ignorar mayúsculas","filters.sensitivity.CASE_SENSITIVE":"Distinguir mayúsculas","filters.boolean.any":"Cualquiera","filters.boolean.true":"Sí","filters.boolean.false":"No","info.tooltip":"Más información","failure.no-reason":"Se ha producido un error","dialog.acknowledge":"Entendido","dialog.close":"Cerrar","dialog.confirm":"Confirmar","dialog.cancel":"Cancelar","dialog.discard.header":"Cambios sin guardar","dialog.discard.body":"Hay cambios sin guardar: ¿cerrar de todos modos?","dialog.discard.confirm":"Cerrar sin guardar","dialog.discard.cancel":"Seguir editando","drawer.close":"Cerrar","spinner.loading":"Cargando…","tabs.previous":"Pestañas anteriores","tabs.next":"Pestañas siguientes","toast.region":"Notificaciones","toast.dismiss":"Cerrar","wizard.progress":"Progreso"},fr:{"pagination.showing":"Page {current} sur {total}","pagination.navigation":"Navigation des pages","pagination.previous":"Précédent","pagination.next":"Suivant","pagination.reload":"Recharger","table.initial":"Lancez la recherche pour voir les résultats.","table.error":"Erreur lors du chargement des données :","table.no-data":"Aucun élément trouvé.","dropdown.empty":"Aucun résultat","select.remove":"Retirer","files.dropzone-label":"Cliquez ou déposez vos fichiers ici","files.remove":"Retirer","files.unacceptable-file-type":"Seuls les fichiers de type {types} sont pris en charge","files.max-file-size-exceeded":"La taille maximale de fichier prise en charge est {size}","files.max-total-size-exceeded":"La taille totale maximale prise en charge est {size}","files.max-files-exceeded":{one:"Nombre maximal de {count} fichier dépassé",other:"Nombre maximal de {count} fichiers dépassé"},"filters.op.EQ":"Égal","filters.op.NEQ":"Différent","filters.op.LT":"Inférieur","filters.op.GT":"Supérieur","filters.op.LTE":"Au plus","filters.op.GTE":"Au moins","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contient","filters.op.STARTS_WITH":"Commence par","filters.op.ENDS_WITH":"Finit par","filters.sensitivity.IGNORE_CASE":"Ignorer la casse","filters.sensitivity.CASE_SENSITIVE":"Respecter la casse","filters.boolean.any":"Indifférent","filters.boolean.true":"Oui","filters.boolean.false":"Non","info.tooltip":"Plus d’informations","failure.no-reason":"Une erreur s'est produite","dialog.acknowledge":"J’ai compris","dialog.close":"Fermer","dialog.confirm":"Confirmer","dialog.cancel":"Annuler","dialog.discard.header":"Modifications non enregistrées","dialog.discard.body":"Des modifications ne sont pas enregistrées : fermer quand même ?","dialog.discard.confirm":"Fermer sans enregistrer","dialog.discard.cancel":"Continuer à modifier","drawer.close":"Fermer","spinner.loading":"Chargement…","tabs.previous":"Onglets précédents","tabs.next":"Onglets suivants","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};return e.Accordion=Ve,e.Anchors=W,e.AsyncEvents=u,e.Bindings=f,e.BooleanFilter=ke,e.Checkbox=X,e.Claims=c,e.CompareFilter=we,e.Dialog=Re,e.Drawer=Ie,e.Dropdown=Q,e.Field=m,e.Form=w,e.FormLoader=v,e.InFilter=qe,e.Input=C,e.InputFile=R,e.InputInstant=z,e.InputLocalDate=N,e.InputLocalTime=O,e.Instant=L,e.InstantFilter=Ee,e.LocalDate=T,e.LocalDateFilter=Ae,e.LocalStorage=n,e.Menu=Me,e.NumberFilter=xe,e.PageLeave=d,e.Pagination=ee,e.Plugin=class{#js;#Gs;#Ks;constructor(e={}){this.#js=e.language??navigator?.language??"en",this.#Gs=e.translations??{},this.#Ks=e.httpClient??null}configure(e){const i=this.#Ks??s.HttpClient.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),r=this.#js.split("-")[0].toLowerCase(),n={...je.en,...je[r],...this.#Gs};e.defineModule("l10n",t.Localization).defineComponent("http-client",i).defineElement("ful-tooltip",Te).defineElement("ful-dialog",Re).defineElement("ful-drawer",Ie).defineElement("ful-menu",Me).defineElement("ful-toasts",$e).defineElement("ful-tabs",We).defineElement("ful-accordion",Ve).defineElement("ful-wizard",He).defineElement("ful-form",w).defineElement("ful-checkbox",X).defineElement("ful-input",C).defineElement("ful-input-file",R).defineElement("ful-local-date",T).defineElement("ful-instant",L).defineElement("ful-input-local-date",N).defineElement("ful-input-local-time",O).defineElement("ful-input-instant",z).defineElement("ful-radio-group",Y).defineElement("ful-table",ne).defineElement("ful-pagination",ee).defineElement("ful-sorter",Z).defineElement("ful-filter-instant",Ee).defineElement("ful-filter-local-date",Ae).defineElement("ful-filter-number",xe).defineElement("ful-filter-boolean",ke).defineElement("ful-filter-text",Se).defineElement("ful-filter-in",qe).defineElement("ful-select",J).defineElement("ful-dropdown",Q).defineComponent("loaders:select",U).defineComponent("loaders:form",v).defineComponent("loaders:table",re).defineOverlay({l10n:n,locale:this.#js})}},e.RadioGroup=Y,e.Select=J,e.SelectLoader=U,e.SessionStorage=a,e.SortButton=Z,e.Table=ne,e.TableLoader=re,e.TableSchemaParser=te,e.Tabs=We,e.TextFilter=Se,e.Timing=p,e.Toasts=$e,e.Tooltip=Te,e.VersionedLocalStorage=l,e.VersionedSessionStorage=o,e.Wizard=He,e.describable=h,e}({},ftl,httpc);
|
|
1
|
+
var ful=function(e,t,s){"use strict";const i=e=>{const t=t=>{try{e().removeItem(t)}catch{}},s=s=>{let i;try{i=e().getItem(s)}catch{return}if(null!==i)try{return JSON.parse(i)}catch{return void t(s)}};return{save:(t,s)=>{e().setItem(t,JSON.stringify(s))},load:s,remove:t,pop:e=>{const i=s(e);return t(e),i}}},r=e=>({save(t,s,i){e.save(t,{revision:s,data:i})},load(t,s){const i=e.load(t);if(null!=i&&"object"==typeof i&&i.revision===s)return i.data;e.remove(t)}}),n=i(()=>localStorage),a=i(()=>sessionStorage),l=r(n),o=r(a);class u{static async fireAsync(e,t,s){e.dispatchEvent(t);const i=t.async?.promises??[],r=s?.mode??"broadcast";if("pipeline"===r&&i.length>1||"delegate"===r&&1!==i.length)throw Promise.all(i).catch(()=>{}),new Error("pipeline"===r?`[AsyncEvents] Event "${t.type}" is configured in 'pipeline' mode and expects at most one async listener, but ${i.length} listeners were triggered on this element.`:`[AsyncEvents] Event "${t.type}" is configured in 'delegate' mode and requires exactly one async listener, but ${i.length} were registered.`);return"broadcast"===r?Promise.all(i):Promise.resolve(i[0])}static asyncOn(e,t,s,i){const r=async e=>{const t=e;t.async||(t.async={promises:[]});const{promise:i,resolve:r,reject:n}=Promise.withResolvers();t.async.promises.push(i);try{r(await s(t))}catch(e){n(e)}};return e.addEventListener(t,r,i),r}static asyncOff(e,t,s,i){e.removeEventListener(t,s,i)}static mixInto(...e){for(const t of e)Object.assign(t.prototype,{async fireAsync(e,t){return await u.fireAsync(this,e,t)},asyncOn(e,t,s){return u.asyncOn(this,e,t,s)},asyncOff(e,t,s){u.asyncOff(this,e,t,s)}})}}class d{static guard(e,t){window.addEventListener("beforeunload",t=>{e()&&t.preventDefault()},{signal:t})}}class c{#e=0;take(){return++this.#e,this.hold()}hold(){const e=this.#e,t=this;return{get stale(){return e!==t.#e}}}invalidate(){++this.#e}}const h=e=>{for(let t=e.parentElement;t;t=t.parentElement)if("function"==typeof t.describedBy)return t;return null};class p{static sleep(e){return new Promise(t=>setTimeout(t,e))}static debounce(e,t,s){const i=s?.immediate??!1;let r=null,n=[],a=0;const l=()=>{const s=performance.now()-a;e>s?r=setTimeout(l,e-s):(r=null,i||t(...n),null===r&&(n=[]))};return[(...s)=>{n=s,a=performance.now(),null===r&&(r=setTimeout(l,e),i&&t(...n))},()=>{clearTimeout(r??void 0),r=null,n=[]}]}static throttle(e,t,s){const i=s?.leading??!0,r=s?.trailing??!0;let n=null,a=[],l=0;const o=()=>{l=i?performance.now():0,n=null,t(...a),null===n&&(a=[])};return[(...s)=>{const u=performance.now();l||i||(l=u);const d=0===l?0:e-(u-l);a=s,d<=0||d>e?(null!==n&&(clearTimeout(n),n=null),l=u,t(...a),null===n&&(a=[])):null===n&&r&&(n=setTimeout(o,d))},()=>{clearTimeout(n??void 0),n=null,a=[]}]}}class f{static flatten(e,t,s){return Object.keys(e).reduce((i,r)=>{const n=t.length?`${t}.${r}`:r;return s.has(n)||"object"!=typeof e[r]||null===e[r]?i[n]=e[r]:Object.assign(i,f.flatten(e[r],n,s)),i},{})}static#t=new Set(["__proto__","prototype","constructor"]);static providePath(e,t,s){const i=t.split(".").map(e=>/^[0-9]+$/.test(e)?+e:e);for(const e of i)if(f.#t.has(e))throw new Error(`unsupported name segment '${e}' in '${t}'`);let r=e??{},n=null;for(let t=0;;++t){const a=i[t],l=i[t-1];if(Number.isInteger(a)&&!Array.isArray(r)&&(null!==n?n[l]=r=[]:e=r=[]),t===i.length-1)return r[a]=void 0!==s?s:a in r?r[a]:null,e;"object"==typeof r[a]&&null!==r[a]||(r[a]={}),n=r,r=r[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#s(e){return"submit"===e.type||"reset"===e.type||"button"===e.type}static extractFrom(e,t){let s={};for(const i of e.elements)i.hasAttribute("name")&&(f.#s(i)&&i!==t||i.matches(":disabled")&&i!==t||(s=f.providePath(s,i.getAttribute("name"),f.extract(i))));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=f.#i(e);for(const[e,i]of Object.entries(f.flatten(t,"",new Set(s.keys()))))for(const t of s.get(e)??[])f.mutate(t,i)}static#i(e){const t=new Map;for(const s of e.elements){const e=s.getAttribute("name");if(!e)continue;const i=t.get(e);i?i.push(s):t.set(e,[s])}return t}static errors(e,t,s){const i=t=>t.closest("form")===e;Array.from(e.querySelectorAll("ful-field-error")).filter(i).forEach(e=>{e.setAttribute("aria-live",s?"off":"polite")});const r=e=>("FIELD_ERROR"===e.type||"INVALID_FORMAT"===e.type)&&e.context,n=t.filter(r),a=t.filter(e=>!r(e)),l=f.#i(e);for(const e of l.values())e.forEach(e=>{e.setCustomValidity?.("")});const o=[],u=new Map;n.forEach(e=>{const t=e.context.replace(/\[/g,".").replace(/\]\./g,".").replace(/\]/g,"").split(".");for(let s=t.length;0!==s;--s){const i=t.slice(0,s).join("."),r=(l.get(i)??[]).filter(e=>"function"==typeof e.setCustomValidity);if(0===r.length)continue;const n=t.slice(s).join(".");return void r.forEach(t=>{const s=u.get(t)??new Map;s.set(n,[...s.get(n)??[],e.reason]),u.set(t,s)})}o.push(e)});for(const[e,t]of u)for(const[s,i]of t)e.setCustomValidity(i.join("\n"),s);const d=[...a,...o];e.querySelectorAll("ful-errors").forEach(e=>{if(!i(e))return;const t=e;if(e.setAttribute("role","alert"),0===d.length)return e.replaceChildren(),void e.setAttribute("hidden","");e.removeAttribute("hidden"),t.innerText=d.map(e=>e.reason).join("\n")}),0!==t.length&&s&&Array.from(e.elements).filter(e=>"fieldset"!==e.localName&&e.matches(":invalid")).sort((e,t)=>e.getBoundingClientRect().y-t.getBoundingClientRect().y)[0]?.focus()}}class m extends t.ParsedElement{static formAssociated=!0;static observed=["disabled:presence","readonly:presence","required:presence","value"];static ROLE="presentation";#r;#n=null;#a;#l=[];#o=null;#u;#d;#c;#h=[];#p=null;constructor(){super(),this.internals.role=this.constructor.ROLE}#f(){return[this.#d??this.#r,...this.#h].filter(e=>e)}#m({fragment:e,control:s,error:i,label:r=null,described:n=null,claims:a=null,announces:l=s,freeze:o=null,also:u=[]}){if(this.#r=s,this.#u=i,this.#d=a,this.#c=l,this.#h=u,o&&o.addEventListener("click",e=>{this.readonly&&e.preventDefault()},!0),this.#a=n??s,i&&(i.id=i.id||t.Attributes.uid("ful-field-error"),this.#o=i.id),this.#g(),r&&m.#b(this,r,s),this.addEventListener("keydown",e=>{if("Enter"!==e.key||e.defaultPrevented||e.isComposing)return;const t=e.target;t.form!==this.form&&m.#v(t)&&this._requestSubmit()}),this.replaceChildren(e),null!==this.#n){const e=this.#n;this.#n=null,s.focus(e)}}static#v(e){return e instanceof HTMLInputElement&&!["file","button","submit","reset","image"].includes(e.type)}describedBy(e){return!!e&&(e.id||(e.id=t.Attributes.uid("ful-described")),this.#l.includes(e.id)||this.#l.push(e.id),this.#g(),!0)}#g(){if(!this.#a)return;const e=[...this.#l,this.#o].filter(e=>e);e.length&&this.#a.setAttribute("aria-describedby",e.join(" "))}focus(e){this.#r?this.#r.focus(e):this.#n=e??{}}setCustomValidity(e,s){if(t.Attributes.set(this.#c??this.#r,"aria-invalid",e?"true":null),!e)return this.internals.setValidity({}),void(this.#u.innerText="");this.internals.setValidity({customError:!0}," "),this.#u.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#y=new Set(["BUTTON","INPUT","METER","OUTPUT","PROGRESS","SELECT","TEXTAREA"]);static#b(e,s,i){if(!m.#y.has(i.tagName)||"hidden"===i.getAttribute("type"))return s.id||(s.id=t.Attributes.uid("ful-label")),i.setAttribute("aria-labelledby",s.id),void s.addEventListener("click",()=>e.focus());i.id||(i.id=t.Attributes.uid("ful-control")),s.setAttribute("for",i.id)}_interactive(){return!this.matches(":disabled")&&!this.readonly}async upgrade(){if(await super.upgrade(),null===this.#p)return;const{value:e}=this.#p;this.#p=null,this.value=e}_holdValue(e){this.#p={value:e}}_heldValue(){return null===this.#p?this.declared("value"):this.#p.value}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.#f())t.toggleAttribute("disabled",e)}get readonly(){return this.hasAttribute("readonly")}set readonly(e){for(const t of this.#f())t.readOnly=e;this.#c&&t.Attributes.set(this.#c,"aria-readonly",e?"true":null),this.reflectTo("readonly",e)}get required(){return this.hasAttribute("required")}set required(e){this.#c&&t.Attributes.set(this.#c,"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.#m(e));this.#m(t)}_build(e){throw new Error(`${this.constructor.name} must implement _build`)}}class g{#w;#E;#A;#x;#S;constructor(e,t,s,i,r){this.#w=e,this.#E=t,this.#A=s,this.#x=i,this.#S=r}prepare(e,t){return this.#x(e,t)}async submit(e,t){return await this.#w.request(this.#A,this.#E).json(e).fetch()}transform(e,t){return this.#S(e,t)}}class b{#x;#S;constructor(e,t){this.#x=e,this.#S=t}async prepare(e,t){return await this.#x(e,t)}async submit(e,t,s){return s}async transform(e,t){return await this.#S(e,t)}}class v{static create(e,t){const s=e.component("http-client"),i=e.declared("request-mapper")?e.component(e.declared("request-mapper")):e=>e,r=e.declared("response-mapper")?e.component(e.declared("response-mapper")):e=>e,n=e.declared("action");if(!n)return new b(i,r);const a=e.declared("method")??"POST";return new g(s,n,a,i,r)}}const y=e=>void 0!==e.form?e.form:e.constructor?.formAssociated?e.internals?.form:void 0;class w extends t.ParsedElement{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",""),t.Attributes.set(e,"autocomplete",this.declared("autocomplete")),t.Attributes.forward("form-",this,e),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=>{y(e.target)===this.form&&e.target.setCustomValidity?.("")}),this.replaceChildren(e),this.#_=this.declared("track-changes")||this.declared("guard-leave"),this.#_&&(this.addEventListener("input",e=>this.#C(e.target)),this.addEventListener("change",e=>this.#C(e.target)),this.addEventListener("focusin",e=>this.#k(e.target)),this.form.addEventListener("reset",e=>{if(e.target===this.form){for(const e of new Set([...this.#q.keys(),...this.#T().keys()]))this.#L.set(e,++this.#N);0===this.#O&&(this.#O=requestAnimationFrame(()=>this.#z()))}}),t.Rendering.waitForChildren(this).catch(()=>{}).then(()=>this.commit()),this.#R())}connectedCallback(){super.connectedCallback(),this.#_&&this.#R()}disconnectedCallback(){this.#F?.abort(),this.#F=null}#I=!1;async submit(e){if(this.#I)return!1;let t,i,r;this.#I=!0,this.spinner(!0);try{const s=this.component(this.declared("loader")??"loaders:form").create(this);t=f.extractFrom(this.form,e);const n=this.#_?{saved:this.#T(),upTo:this.#N}:null;i=await s.prepare(t,this);const a=new CustomEvent("submit",{bubbles:!0,cancelable:!0,detail:{submitter:e,values:t,request:i}});if(!this.dispatchEvent(a))return!1;this.errors=[];const l=new CustomEvent("submit:requested",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:a.detail.values,request:a.detail.request}});let o=await u.fireAsync(this,l,{mode:"pipeline"});i=l.detail.request,o=await s.submit(i,this,o);const d=await s.transform(o,this);n&&this.#P(n.saved,n.upTo),r=new CustomEvent("submit:success",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:i,response:d}})}catch(n){r=new CustomEvent("submit:failure",{bubbles:!0,cancelable:!1,detail:{submitter:e,values:t,request:i,exception:n}}),n instanceof s.Failure?this.errors=n.problems:console.warn("failed to submit form",this,"reason:",n)}finally{this.#I=!1,this.spinner(!1)}return this.dispatchEvent(r),"submit:success"===r.type}async save(e){return!(!this.#_||this.dirty)||await this.submit(e)&&!this.dirty}reset(){this.form.reset(),this.#_&&this.#z()}#q=new Map;#M=new Map;#L=new Map;#N=0;#B=!1;#O=0;#F=null;#_=!1;get dirty(){if(!this.#_)return!1;for(const e of this.#L.keys()){const t=this.#D(e);if((this.#q.has(e)||"[]"!==t)&&(this.#q.get(e)??this.#M.get(e))!==t)return!0}return!1}commit(){this.#_&&this.#P(this.#T(),this.#N)}edited(...e){for(const t of e)this.#C(t)}#P(e,t){this.#q=e;for(const[e,s]of this.#L)s<=t&&this.#L.delete(e);for(const t of this.#M.keys())e.has(t)&&this.#M.delete(t);this.#z()}#$(e){for(let t=e;t&&t!==this;t=t.parentElement)if(y(t)===this.form&&t.hasAttribute("name"))return t.getAttribute("name");return null}#C(e){if(!this.#_)return;const t=this.#$(e);null!==t&&(this.#L.set(t,++this.#N),0===this.#O&&(this.#O=requestAnimationFrame(()=>this.#z())))}#k(e){const t=this.#$(e);null===t||this.#q.has(t)||this.#M.has(t)||this.#M.set(t,this.#D(t))}#W(){return Array.from(this.form.elements).filter(e=>e.hasAttribute("name")&&!["submit","reset","button"].includes(e.type)&&!e.matches(":disabled"))}#T(){const e=new Map;for(const t of this.#W()){const s=t.getAttribute("name");e.set(s,[...e.get(s)??[],f.extract(t)])}return new Map(Array.from(e,([e,t])=>[e,JSON.stringify(t)]))}#D(e){return JSON.stringify(this.#W().filter(t=>t.getAttribute("name")===e).map(e=>f.extract(e)))}#z(){cancelAnimationFrame(this.#O),this.#O=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.#B&&(this.#B=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}})))}#R(){this.declared("guard-leave")&&!this.#F&&(this.#F=new AbortController,d.guard(()=>this.dirty,this.#F.signal))}#V=0;#H(e){if(t.Attributes.defaultValue(e,"role","status"),e.hidden=!1,""!==e.textContent.trim())return;const s=document.createElement("span");s.className="ful-sr-only",s.dataset.ref="spinner-label",e.append(s),s.textContent=t.Localization.of().t("spinner.loading")}spinner(e){if(e){if(++this.#V,1!==this.#V)return}else if(this.#V=Math.max(0,this.#V-1),0!==this.#V)return;t.Attributes.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.#H(s):(s.hidden=!0,s.querySelector(":scope > [data-ref=spinner-label]")?.remove())}),this.querySelectorAll("input,button").forEach(s=>{const i=s;if(i.form===this.form&&("submit"===i.type||"reset"===i.type))if(e)i.dataset.wd=i.getAttribute("aria-disabled")??"",i.setAttribute("aria-disabled","true");else{if(void 0===i.dataset.wd)return;t.Attributes.set(i,"aria-disabled",i.dataset.wd||null),delete i.dataset.wd}})}set values(e){f.mutateIn(this.form,e)}get values(){return f.extractFrom(this.form)}set errors(e){f.errors(this.form,e,this.declared("scroll-on-error"))}}const E=new t.BoundedCache(100),A=(e,t)=>E.getOrCompute(`${e}:${t}`,()=>{try{return new RegExp(t,"g")}catch(s){return console.warn(`invalid ${e} attribute`,t,s),null}}),x={numeric:"numeric",decimal:"decimal"},S=new Set(["date","time","datetime-local","month","week"]),_={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 C extends m{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;#j=[];#G=null;_type(){return this.declared("type")??("number"===this.declared("v-type")?"number":"text")}_build({slots:e}){const t=this._type(),s=x[t],i=s?"text":t,r=this.template().withOverlay({type:i,slots:e}).render();this.#j=[...r.querySelectorAll(":is(ful-control-group, ful-control) > :is(input, textarea)")],this._input=this.#j[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=A("keep",t);return e&&(t=>(t.match(e)??[]).join(""))}if(null!==s){const e=A("reject",s);return e&&(t=>t.replace(e,""))}return((e,t)=>{const s=_[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.#j)this.#K(e,s,n,a);return{fragment:r,control:this._input,error:r.querySelector("ful-field-error"),label:r.querySelector("label")}}#K(e,s,i,r){s&&t.Attributes.set(e,"inputmode",s),t.Attributes.set(e,"autocomplete",i);const n=e.id;t.Attributes.forward("input-",this,e),e!==this._input&&t.Attributes.set(e,"id",n||null),this.#U(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)})}#U(e){if(!S.has(e.type))return void e.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});let t=!1;const s=()=>{t=!1;const e=JSON.stringify(this.value);e!==this.#G&&(this.#G=e,this._notifyChange())};e.addEventListener("focus",()=>{this.#G=JSON.stringify(this.value)}),e.addEventListener("keydown",e=>{"Enter"!==e.key||e.isComposing?t=!0:s()}),e.addEventListener("blur",s),e.addEventListener("change",e=>{e.stopPropagation(),t||s()})}get value(){const e=this.declared("uppercase"),t=this.declared("trim"),s=this._input?this._input.value:`${this._heldValue()??""}`,i=e?s.toUpperCase():s,r=t?i.trim():i;if(""===r)return null;const n="decimal"===this._type()?r.replaceAll(",","."):r;if("number"===this.declared("v-type")){const e=Number(n);return Number.isNaN(e)?n:e}return n}set value(e){this._input?(this._input.value=""===e||null==e?"":`${e}`,this.#G=JSON.stringify(this.value)):this._holdValue(e)}get placeholder(){const e=this._input.getAttribute("placeholder");return" "===e?null:e}set placeholder(e){for(const s of this.#j)t.Attributes.set(s,"placeholder",e??" ");this.reflectTo("placeholder",e)}}const k=e=>""===e?null:e,q=e=>{const[t,s,i]=e.split("-").map(Number),r=new Date(0);return r.setFullYear(t,s-1,i),r.setHours(0,0,0,0),r.getFullYear()===t&&r.getMonth()===s-1&&r.getDate()===i?r:new Date(Number.NaN)};class T extends t.ParsedElement{static attributes=["locale","default"];render(){const e=q(this.textContent.trim());if(Number.isNaN(e.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:s}=t.Localization.of({locale:this.declared("locale")??void 0});this.replaceChildren(s(e,{year:"numeric",month:"numeric",day:"numeric"}))}}class L extends t.ParsedElement{static attributes=["locale","default"];render(){const e=this.textContent.trim(),s=""===e?null:new Date(L.isoToLocal(e));if(null===s||Number.isNaN(s.getTime()))return void this.replaceChildren(this.declared("default")??"");const{date:i}=t.Localization.of({locale:this.declared("locale")??void 0});this.replaceChildren(i(s,{year:"numeric",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",hour12:!1}))}static#Q(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)?q(e):new Date(e)}static isoToLocal(e){const t=L.#Q(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=L.#Q(e);return Number.isNaN(t.getTime())?null:t.toISOString()}}class N extends C{static observed=["step","min","max"];_type(){return"date"}get min(){return k(this._input.min)}set min(e){this._input.min=N.#J(e)}get max(){return k(this._input.max)}set max(e){this._input.max=N.#J(e)}get step(){return k(this._input.step)}set step(e){this._input.step=e??""}static#J(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 i="-"===s[1]?-1:1,r=+s[2],n=new Date;switch(n.setHours(0,0,0,0),s[3]){case"d":n.setDate(n.getDate()+r*i);break;case"m":{const e=n.getDate();n.setMonth(n.getMonth()+r*i),n.getDate()!==e&&n.setDate(0);break}case"y":n.setFullYear(n.getFullYear()+r*i)}return t(n)}}class O extends N{_type(){return"time"}get min(){return k(this._input.min)}set min(e){this._input.min=this.#Y(e)}get max(){return k(this._input.max)}set max(e){this._input.max=this.#Y(e)}#Y(e){if(!e)return"";const t=new Date;if("now"!==e){const s=/^([+-])(\d+)([hm])$/.exec(e);if(!s)return e;const i="-"===s[1]?-1:1,r=+s[2]*i;"h"===s[3]?t.setHours(t.getHours()+r):t.setMinutes(t.getMinutes()+r)}return O.#X(t,Number(this._input.step)||60)}static#X(e,t){const s=e=>String(e).padStart(2,"0"),i=3600*e.getHours()+60*e.getMinutes()+e.getSeconds(),r=Math.floor(i/t)*t,n=s(Math.floor(r/3600)),a=s(Math.floor(r%3600/60));return t%60==0?`${n}:${a}`:`${n}:${a}:${s(r%60)}`}}class z extends C{static observed=["step","min","max"];_type(){return"datetime-local"}get value(){if(!this._input){const e=this._heldValue();return L.localToIso(e?L.isoToLocal(e):"")}return L.localToIso(this._input.value)}set value(e){this._input?super.value=e?L.isoToLocal(e):"":this._holdValue(e)}get min(){return L.localToIso(this._input.min)}set min(e){this._input.min=e?L.isoToLocal(e):""}get max(){return L.localToIso(this._input.max)}set max(e){this._input.max=e?L.isoToLocal(e):""}get step(){return k(this._input.step)}set step(e){this._input.step=e??""}}class R extends C{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"];#Z;#ee;#te;#se;#ie;_type(){return"file"}static template='\n <label>{{{{ slots.default }}}}</label>\n {{{{ slots.info }}}}\n <ful-control-group>\n <ful-affix data-tpl-if="slots.before">{{{{ slots.before }}}}</ful-affix>\n <input data-tpl-type="type" placeholder=" " form="">\n <ful-affix data-tpl-if="slots.after">{{{{ slots.after }}}}</ful-affix>\n </ful-control-group>\n <div data-ref="dropzone" class="dropzone" data-tpl-if="slots.dropzone">\n {{{{ slots.dropzone }}}}\n </div>\n <div data-ref="dropzone" class="default-dropzone" data-tpl-if="!slots.dropzone">\n {{ #l10n:t(\'files.dropzone-label\') }}\n </div>\n <ful-item-list></ful-item-list>\n <ful-field-warnings role="status" aria-live="polite"></ful-field-warnings>\n <ful-field-error></ful-field-error>\n ';static templates={items:'\n <ful-item data-tpl-each="files" data-tpl-var="file" data-tpl-data-name="file.name">\n <div><span>{{ file.name }}</span><span>{{ #l10n:bytes(file.size) }}</span><button type="button" data-tpl-aria-label="#l10n:t(\'files.remove\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button></div>\n </ful-item>\n ',warning:"<ful-field-warning>{{ #l10n:t(key, args) }}</ful-field-warning>"};#re;_build(e){const s=super._build(e),i=s.fragment;return this.#ee=i.querySelector("ful-item-list"),this.#re=e.slots?.items&&!t.Fragments.isBlank(e.slots.items)?t.Templates.fromFragment(e.slots.items):null,this.#te=i.querySelector("[data-ref=dropzone]"),this.#se=i.querySelector("ful-field-warnings"),this.#ie=i.querySelector("ful-control-group"),this.#se.addEventListener("animationend",e=>{e.target.remove()}),this.#ee.addEventListener("click",e=>{if(!e.target.closest("button"))return;if(!this._interactive())return;const t=[...this.#ee.children].indexOf(e.target.closest("ful-item"));-1!==t&&(this.files=R.list([...this.files].filter((e,s)=>s!==t)),this._notifyChange())}),this.#te.addEventListener("click",e=>{this._interactive()&&this._input.click()}),this.#te.addEventListener("dragover",e=>{e.preventDefault(),this.toggleAttribute("dragover",!0)}),this.#te.addEventListener("dragleave",()=>{this.toggleAttribute("dragover",!1)}),this.#te.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=R.list(t),this._notifyChange())}),this._input.addEventListener("change",()=>{this.#ne()},{capture:!0}),{...s,freeze:this.#ie}}#ne(){this.setCustomValidity(),this.#se.replaceChildren(),this.#ae(),this.#le(),this.#oe(),this.#ue(),(this.#re??this.template("items")).withOverlay({files:this.files}).renderTo(this.#ee)}warning(e,t){this.template("warning").withOverlay({key:e,args:t}).appendTo(this.#se);const s=this.#se.lastElementChild;setTimeout(()=>s.remove(),R.WARNING_TIMEOUT)}#de(e){const t=e.name.toLowerCase();return this.#Z.some(s=>{const i=s.toLowerCase().split(";")[0].trim();return i.startsWith(".")?t.endsWith(i):i.endsWith("/*")?e.type.startsWith(`${i.slice(0,-1)}`):i.includes("/")&&e.type===i})}#ae(){if(!this.#Z.length)return;const e=[...this.files].filter(e=>!this.#de(e));0!==e.length&&(this.warning("files.unacceptable-file-type",{types:this.#Z.join(", ")}),this._input.files=R.list([...this.files].filter(t=>!e.includes(t))))}#ue(){null!==this.#ce&&(this.files.length<=this.#ce||(this.warning("files.max-files-exceeded",{count:this.#ce}),this._input.files=R.list()))}#le(){if(null===this.#he)return;const e=[...this.files].filter(e=>e.size>this.#he);0!==e.length&&(this.warning("files.max-file-size-exceeded",{size:t.Localization.of().bytes(this.#he)}),this._input.files=R.list([...this.files].filter(t=>!e.includes(t))))}#oe(){null!==this.#pe&&([...this.files].reduce((e,t)=>e+t.size,0)<=this.#pe||(this.warning("files.max-total-size-exceeded",{size:t.Localization.of().bytes(this.#pe)}),this._input.files=R.list()))}get accept(){return this.#Z}set accept(e){this._input.accept=e.join(","),this.#Z=e,this.reflectTo("accept",e)}get multiple(){return this._input?this._input.multiple:this.declared("multiple")}set multiple(e){this._input.multiple=e,this.reflectTo("multiple",e)}get files(){return this._input?this._input.files:R.list()}set files(e){this._input.files=e,this.#ne()}get file(){return this.files[0]??null}set file(e){this.files=R.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._input&&(this.files=R.list())}formResetCallback(){this.value=null}get totalsize(){return Array.from(this.files).reduce((e,t)=>e+t.size,0)}#ce;get maxFiles(){return this.#ce}set maxFiles(e){this.#ce=e,this.reflectTo("max-files",e)}#he;get maxFileSize(){return this.#he}set maxFileSize(e){this.#he=e,this.reflectTo("max-file-size",e)}#pe;get maxTotalSize(){return this.#pe}set maxTotalSize(e){this.#pe=e,this.reflectTo("max-total-size",e)}#fe;get itemList(){return this.#fe}set itemList(e){this.#fe=e,this.reflectTo("item-list",e)}#me;get dropzone(){return this.#me}set dropzone(e){this.#me=e,this.reflectTo("dropzone",e)}}const F=new Map;let I=0,P=!1;const M=(e,t,s)=>Math.min(Math.max(e,t),Math.max(t,s)),B=(e,t)=>{const{invoker:s,stretch:i}=t,r=s.getBoundingClientRect(),n=document.documentElement,a=n.clientWidth,l=n.clientHeight;e.style.removeProperty("margin");const o=getComputedStyle(e),u=parseFloat(o.marginTop)||0,d=parseFloat(o.marginRight)||0,c=parseFloat(o.marginBottom)||0,h=parseFloat(o.marginLeft)||0;if(e.style.right="auto",e.style.bottom="auto",e.style.margin="0",i){e.style.removeProperty("width"),e.style.removeProperty("min-width"),e.style.removeProperty("max-width");const t=Math.min(parseFloat(o.maxWidth)||a,a-16);e.style.minWidth=`${Math.min(r.width,a-16)}px`,e.style.maxWidth=`${t}px`;const s=e.getBoundingClientRect().width;e.style.left=`${M(r.left,8,a-s-8)}px`;const i=e.getBoundingClientRect().height,n=r.bottom+u,d=n+i<=l-8?n:r.top-c-i;return void(e.style.top=`${M(d,8,l-i-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(o.maxWidth)||a,a-16);e.style.maxWidth=`${m}px`,e.style.left="8px";const g=e.getBoundingClientRect().width;let b="right"===f?r.right+h:"left"===f?r.left-d-g:p?r.left+r.width/2-g/2:r.left;b=M(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?r.top-c-v:"right"===f||"left"===f?r.top+r.height/2-v/2:r.bottom+u;e.style.top=`${M(y,8,l-v-8)}px`,p&&((e,t)=>{const s=t.getBoundingClientRect(),i=e.getBoundingClientRect();e.style.setProperty("--ful-note-callout-inline",s.left+s.width/2-i.left-e.clientLeft+"px"),e.style.setProperty("--ful-note-callout-block",s.top+s.height/2-i.top-e.clientTop+"px")})(e,s)},D=()=>{I=0;for(const[e,t]of F)e.isConnected&&t.invoker.isConnected?B(e,t):F.delete(e)},$=()=>{!I&&F.size>0&&(I=requestAnimationFrame(D))};class W{static wire(e,s,{prefix:i="ful-anchor",invoke:r=!1,expanded:n=!1,stretch:a=!1,handPlace:l=!1}={}){const o=t.Attributes.uid(i);if(r)if(s.id=s.id||o,"button"===e.localName||"input"===e.localName)e.setAttribute("popovertarget",s.id);else{let t=!1;e.addEventListener("pointerdown",()=>{t=s.matches(":popover-open")},!0),e.addEventListener("click",()=>{const e=t&&!s.matches(":popover-open");t=!1,e||s.togglePopover()}),e.addEventListener("keydown",e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),s.togglePopover())})}const u=`--${o}`;if(e.style.anchorName=u,s.style.positionAnchor=u,n&&(e.setAttribute("aria-expanded","false"),s.addEventListener("toggle",t=>{e.setAttribute("aria-expanded","open"===t.newState?"true":"false")})),!l&&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 d={invoker:e,stretch:a};s.addEventListener("beforetoggle",e=>{"open"===e.newState&&((e,t)=>{e.style.visibility="hidden",queueMicrotask(()=>{e.matches(":popover-open")&&B(e,t),e.style.removeProperty("visibility")})})(s,d)}),s.addEventListener("toggle",e=>{"open"===e.newState?(F.set(s,d),B(s,d)):(F.delete(s),(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)})(s))}),P||(P=!0,document.addEventListener("scroll",$,!0),window.addEventListener("resize",$))}static show(e,t,{flip:s=!1,gap:i=0}={}){return"function"!=typeof e.showPopover||e.matches(":popover-open")||e.showPopover(),(()=>{const r=t instanceof Element?t.getBoundingClientRect():t,n=document.documentElement,a=e.getBoundingClientRect(),l=r.bottom+i,o=r.top-i-a.height,u=s&&l+a.height>n.clientHeight-8&&o>=8?o:l;e.style.right="auto",e.style.bottom="auto",e.style.margin="0",e.style.left=`${M(r.left,8,Math.max(8,n.clientWidth-a.width-8))}px`,e.style.top=`${M(u,8,Math.max(8,n.clientHeight-a.height-8))}px`})(),e}}const V=(e,t)=>e.filter(({key:e})=>t.some(t=>String(t)===String(e))),H=(e,t)=>e.filter(({label:e})=>(e??"").toLowerCase().includes(t?.toLowerCase()??""));class j{#w;#E;#A;#S;#ge;#be;#ve=null;#ye=null;#we=new c;constructor({http:e,url:t,method:s,responseMapper:i,prefetch:r,revision:n}){this.#w=e,this.#E=t,this.#A=s,this.#S=i,this.#ge=r,this.#be=n}async prefetch(){this.#ge&&await this.#Ee()}async exact(...e){return V(await this.#Ee(),e)}async load(e){return H(await this.#Ee(),e)}async invalidate(){this.#we.invalidate(),this.#ve=null,this.#ye=null}async#Ee(){if(null===this.#ve){if(null===this.#ye){const e=this.#we.hold();this.#ye=j.#Ae(this.#w,this.#A,this.#E,this.#be).then(t=>{e.stale||(this.#ve=this.#S(t))}).finally(()=>{e.stale||(this.#ye=null)})}await this.#ye}if(null===this.#ve)throw new Error("superseded by an invalidation");return this.#ve}static async#Ae(e,t,s,i){const r=`${t}@${s}`;if(null!==i){const e=l.load(r,i);if(void 0!==e)return e}const n=await e.request(t,s).fetchJson();if(null!==i)try{l.save(r,i,n)}catch(e){console.warn("failed to cache the select options",e)}return n}}class G{#w;#E;#A;#S;constructor({http:e,url:t,method:s,responseMapper:i}){this.#w=e,this.#E=t,this.#A=s,this.#S=i}async invalidate(){}async exact(...e){const t=await this.#w.request(this.#A,this.#E).param("k",...e).fetchJson();return this.#S(t)}async load(e){const t=await this.#w.request(this.#A,this.#E).param("s",e).fetchJson();return this.#S(t)}}class K{#ve;constructor(e){this.#ve=e}update(e){this.#ve=e}async invalidate(){}exact(...e){return V(this.#ve,e)}load(e){return H(this.#ve,e)}}class U{static from({data:e,http:t,url:s,method:i="POST",mode:r,prefetch:n=!1,revision:a=null,responseMapper:l}){return s?"chunked"===r?new G({http:t,url:s,method:i,responseMapper:l}):new j({http:t,url:s,method:i,responseMapper:l,prefetch:n,revision:a}):new K(e??[])}static create(e,t){if(!e.declared("src")){const e=Array.from(t.options?.querySelectorAll("option")??[]);return U.from({data:e.map(e=>({key:e.getAttribute("value")??e.innerText.trim(),label:e.innerText.trim(),metadata:void 0}))})}return U.from({http:e.component("http-client"),url:e.declared("src"),method:e.declared("method")??"POST",mode:e.declared("mode"),prefetch:e.declared("preload"),revision:U.#xe(e),responseMapper:U.#Se(e)})}static#xe(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#Se(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 Q extends t.ParsedElement{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 '};#_e;#Ce;#ke;#qe;#Te=new Map;#Le=new c;render({slots:e}){const s=this.template().render();this.#qe=t.Fragments.isBlank(e.default)?this.template("options"):t.Templates.fromFragment(e.default),this.#_e=s.querySelector("ful-spinner"),this.#ke=s.querySelector("[data-ref=empty]"),this.#Ce=s.querySelector("menu"),this.#Ce.id=this.declared("listbox")||t.Attributes.uid("ful-listbox"),this.#Ce.addEventListener("mousedown",e=>{e.target.closest("li")&&e.preventDefault()}),this.#Ce.addEventListener("click",e=>{e.stopPropagation();const t=e.target.closest("li");t?t.matches('[aria-disabled="true"]')||this.#Ne(t):this.hide()}),this.replaceChildren(s)}#Oe(){return!this.#Ce||this.#Ce.hidden?null:this.#Ce.querySelector("li[selected]")??this.#Ce.querySelector('li:not([aria-disabled="true"])')}#ze(e){if(e){for(const t of this.#Ce.querySelectorAll("li"))t.toggleAttribute("selected",t===e);e.id||=t.Attributes.uid("ful-option"),this.#Re(e.id),e.scrollIntoView({block:"nearest",behavior:matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth"})}else this.#Re(null)}acceptSelection(){const e=this.#Oe();e&&!e.matches('[aria-disabled="true"]')&&this.#Ne(e)}update(e,t=[]){if(void 0===e)throw new Error("null data");this.#Te=new Map(e.map((e,t)=>[String(t),e]));const s=e.map((e,t)=>({index:t,...e}));this.#qe.withOverlay(s).renderTo(this.#Ce);for(const[s,i]of[...this.#Ce.children].entries()){const r=e[s],n=t.some(e=>String(e)===String(r?.key));i.toggleAttribute("picked",n),i.setAttribute("aria-selected",n?"true":"false");const a=!!r?.metadata?.disabled;a?i.setAttribute("aria-disabled","true"):i.removeAttribute("aria-disabled"),a&&r.metadata.reason?i.setAttribute("title",String(r.metadata.reason)):i.removeAttribute("title")}this.#ke.toggleAttribute("hidden",0!==e.length),this.#Ce.toggleAttribute("hidden",0===e.length);const i=e.findIndex(({key:e})=>t.some(t=>String(t)===String(e)));this.#ze(i>=0?this.#Ce.children[i]:this.#Ce.querySelector('li[selected]:not([aria-disabled="true"])')??this.#Ce.querySelector('li:not([aria-disabled="true"])'))}#Ne(e){const t=e.getAttribute("value"),s=this.#Te.get(t);this.hide(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,cancelable:!1,detail:{index:t,entry:s}}))}hide(){this.#Le.invalidate(),this.matches(":popover-open")&&this.hidePopover(),this.#Re(null)}#Re(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.#Le.take();this.matches(":popover-open")||this.showPopover(),this.#Ce.setAttribute("hidden",""),this.#_e.removeAttribute("hidden");try{const i=await e();if(s.stale)return;this.update(i,t)}catch(e){if(s.stale)return;throw this.hide(),e}finally{s.stale||this.#_e.setAttribute("hidden","")}}async moveOrShow(e,t,s=[]){if(this.shown){const t=this.#Oe(),s=t?.[(e?"next":"previous")+"ElementSibling"],i=s?this.#Fe(s,e):null;return void(t&&i&&this.#ze(i))}await this.show(t,s)}#Fe(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){if(this.#Ce.hidden)return;const t=e?this.#Ce.firstElementChild:this.#Ce.lastElementChild,s=this.#Fe(t,e);s&&this.#ze(s)}page(e){const t=this.#Oe();if(!t)return;let s=t;for(let t=0;t!==this.#Ie();++t){const t=this.#Fe(s[(e?"next":"previous")+"ElementSibling"],e);if(!t)break;s=t}this.#ze(s)}#Ie(){const e=this.#Ce.firstElementChild;return e&&0!==e.offsetHeight?Math.max(1,Math.trunc(this.#Ce.clientHeight/e.offsetHeight)):1}}class J extends m{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 '};#Pe;#Me={src:null,method:null};#Te;#r;#Be;#De;#$e;#ee;#re;#We;#Ve=!1;#He=new Map;#je=new c;#Ge=!1;#Ke;#Ue;_build({slots:e}){const s=this.declared("name");this.#Te=e.options,this.#Qe(),this.#We=this.declared("multiple"),this.#Pe.prefetch?.()?.catch(e=>{console.warn("failed to prefetch select options",this,"reason:",e)});const i=this.template().withOverlay({slots:e,name:s}).render();this.#De=i.querySelector("ful-control > input"),this.#$e=i.querySelector("label"),this.#ee=i.querySelector("ful-item-list"),this.#re=e.items&&!t.Fragments.isBlank(e.items)?t.Templates.fromFragment(e.items):null,t.Attributes.forward("input-",this,this.#De),this.#r=i.querySelector("ful-control"),this.#Be=i.querySelector("ful-dropdown");const r=t.Attributes.uid("ful-listbox");this.#Be.setAttribute("listbox",r),this.#De.setAttribute("aria-controls",r),this.#Be.addEventListener("beforetoggle",e=>{const t="open"===e.newState;this.#De.setAttribute("aria-expanded",t?"true":"false"),t||this.#De.removeAttribute("aria-activedescendant")}),this.#Be.addEventListener("activechange",e=>{t.Attributes.set(this.#De,"aria-activedescendant",e.detail.id)});const n=i.querySelector("ful-control-group");return W.wire(n,this.#Be,{prefix:"ful-select",stretch:!0}),[this.#Ke,this.#Ue]=p.throttle(400,()=>this.#Je()),this.#Ye(),this.#Xe(),this.#Ze(),this.#et(),{fragment:i,control:this.#De,error:i.querySelector("ful-field-error"),label:this.#$e}}#Ye(){this.addEventListener("click",e=>{if(!this._interactive()||this.#$e.contains(e.target))return;const t=e.target.closest('button, [role="button"], a[href], input, select, textarea');if(!t||t===this.#De){if(this.#Be.shown)return this.#Ue(),void this.#tt();this.#De.focus(),this.#Ke()}}),this.#ee.addEventListener("click",e=>{e.stopPropagation(),e.target.closest("button")&&this._interactive()&&this.#st([...this.#ee.children].indexOf(e.target.closest("ful-item")))}),this.#r.addEventListener("click",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t&&(e.stopPropagation(),this.#it(t))})}#Xe(){this.addEventListener("keydown",e=>{const t=e.target instanceof Element?e.target.closest("ful-badge"):null;t?this.#rt(e,t):"ArrowLeft"===e.code&&e.target===this.#De&&0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#nt().at(-1)?.focus()})}#Ze(){this.#De.addEventListener("change",e=>{e.stopPropagation()}),this.#De.addEventListener("focus",()=>{this.#Ge||this.#De.select()}),this.#De.addEventListener("blur",e=>{e.stopPropagation(),e.relatedTarget&&this.contains(e.relatedTarget)||(this.#Ue(),this.#tt(!0))}),this.#De.addEventListener("keydown",e=>{this._interactive()&&this.#at(e)}),this.#De.addEventListener("input",e=>{e.stopPropagation(),this._interactive()&&(this.#Ge=!0,this.#Ke())})}#et(){this.#Be.addEventListener("change",e=>{e.stopPropagation(),this.#Ue(),this._interactive()?(this.#We||this.#He.clear(),this.#Ge=!1,this.#He.set(this.#lt(e.detail.entry.key),e.detail.entry),this.#ot(),this.#De.focus(),this.#Be.hide(),this.#We||this.#De.select()):this.#tt()})}async withLoader(e){return await e(this.#Pe)}async reload(){await(this.#Pe.invalidate?.()),await(this.#Pe.prefetch?.());const e=[...this.#He.keys()];0!==e.length&&await this.#ut(e,this.#je.take()),this.#Be.shown&&await this.#Je()}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#dt()&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#dt()&&this.reload()}async reconfigure(e,{notify:t=!1}={}){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);this.#dt();const s=[...this.#He.keys()];await this.reload();const i=[...this.#He.keys()];t&&i.length!==s.length&&this._notifyChange({entry:this.entry})}#Qe(){this.#Me={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Pe=this.component(this.declared("loader")??"loaders:select").create(this,{options:this.#Te})}#dt(){return(this.getAttribute("src")!==this.#Me.src||this.getAttribute("method")!==this.#Me.method)&&(this.#Ue(),this.#tt(),this.#Qe(),!0)}#nt(){return Array.from(this.#r.querySelectorAll(":scope > ful-badge"))}#it(e){this._interactive()&&this.#st(this.#nt().indexOf(e))}#st(e){const t=Array.from(this.#He.keys())[e];void 0!==t&&(this.#He.delete(t),this.#ot())}#rt(e,t){switch(e.code){case"NumpadEnter":case"Enter":case"Space":case"Backspace":case"Delete":e.preventDefault(),this.#it(t),this.#De.focus();break;case"ArrowLeft":e.preventDefault(),(this.#nt()[this.#nt().indexOf(t)-1]??this.#De).focus();break;case"ArrowRight":e.preventDefault(),(this.#nt()[this.#nt().indexOf(t)+1]??this.#De).focus();break;case"Escape":this.#De.focus()}}#at(e){switch(e.code){case"ArrowUp":case"ArrowDown":e.preventDefault(),this.#ct(e);break;case"Home":this.#Be.shown&&(e.preventDefault(),this.#Be.jump(!0));break;case"End":this.#Be.shown&&(e.preventDefault(),this.#Be.jump(!1));break;case"PageDown":case"PageUp":this.#Be.shown&&(e.preventDefault(),this.#Be.page("PageDown"===e.code));break;case"Escape":this.#Ue(),this.#tt();break;case"NumpadEnter":case"Enter":if(!this.#Be.shown)return;e.preventDefault(),this.#Ue(),this.#Ge=!1,this.#ht(),this.#Be.acceptSelection();break;case"Backspace":0===this.#De.selectionStart&&0===this.#De.selectionEnd&&this.#st(this.#He.size-1);break;case"Tab":this.#Ue(),this.#tt(!0)}}#ct(e){const t="ArrowDown"===e.code;e.altKey?t&&!this.#Be.shown?this.#Je():!t&&this.#Be.shown&&(this.#Ue(),this.#tt()):this.#Be.moveOrShow(t,()=>this.#Pe.load(this.#pt()),[...this.#He.keys()])}#tt(e=!1){this.#Be.hide();const t=e&&this.#Ge&&!this.#We&&""===this.#De.value&&0!==this.#He.size;this.#Ge=!1,t&&(this.#He.clear(),this.#ot()),this.#ht()}#Je(){return this.#Be.show(()=>this.#Pe.load(this.#pt()),[...this.#He.keys()])}#pt(){return this.#Ge?this.#De.value:""}get query(){return this.#pt()}#ht(){const e=this.#He.values().next().value;this.#De.value=this.#We?"":e?.label??""}#ft(){return[...this.#He.values()]}#ot(){this.#mt(),this._notifyChange({entry:this.entry})}#mt(){const e=this.#We?Array.from(this.#He.entries()).map(([e,t],s)=>{const i=document.createElement("ful-badge");return i.setAttribute("role","button"),i.setAttribute("tabindex",0===s?"0":"-1"),i.setAttribute("value",e),i.innerText=t.label,i}):[];for(const e of this.#r.querySelectorAll(":scope > ful-badge"))e.remove();this.#De.before(...e),this.#Ge||this.#ht(),this.#ee.replaceChildren(),(this.#re??this.template("items")).withOverlay({entries:this.#ft()}).renderTo(this.#ee)}#lt(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){if(!this.#r)return void this._holdValue(e);const t=(null==e?[]:Array.isArray(e)?e:[e]).map(e=>this.#lt(e)),s=this.#We?t:t.slice(0,1);!this.#Ve&&s.some(e=>"string"==typeof e&&e.includes(","))&&(this.#Ve=!0,console.warn("a ful-select key cannot contain a comma: it is unexpressible in the value attribute",this)),this.#He=new Map(s.map(e=>[e,{key:e,label:e,metadata:void 0}]));const i=this.#je.take();this.#mt(),0!==s.length&&this.#ut(s,i)}async#ut(e,t){const s=await this.#Pe.exact(...e);if(t.stale)return;const i=new Map(s.map(e=>[this.#lt(e.key),e]));for(const t of e)this.#He.has(t)&&(i.has(t)?this.#He.set(t,i.get(t)):this.#He.delete(t));this.#mt()}get value(){if(!this.#r){const e=[this._heldValue()??[]].flat().map(e=>this.#lt(e));return this.multiple?e:e[0]??null}return this.#We?[...this.#He.keys()]:[...this.#He.keys()][0]??null}get entry(){const e=this.#ft();return this.#We?e:e[0]??null}get disabled(){return super.disabled}set disabled(e){super.disabled=e,e&&this.#Be?.shown&&(this.#Ue(),this.#tt())}get readonly(){return super.readonly}set readonly(e){super.readonly=e,e&&this.#Be?.shown&&(this.#Ue(),this.#tt())}#fe;get multiple(){return this.#We??this.declared("multiple")}set multiple(e){this.#We=e,this.reflectTo("multiple",e),e||(this.#He=new Map([...this.#He].slice(0,1))),this.#r&&this.#mt()}get itemList(){return this.#fe}set itemList(e){this.#fe=e,this.reflectTo("item-list",e)}}class Y extends m{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 ';#gt;#bt;#vt;_build({slots:e}){const s=t.Attributes.uid(this.declared("name")??"ful-radiogroup"),i=Array.from(e.default.querySelectorAll("ful-radio")),r=i.map(e=>{const i=document.createElement("input");return i.setAttribute("type","radio"),t.Attributes.forward("input-",this,i),t.Attributes.forward("",e,i),i.setAttribute("name",`${s}-ignore`),i.setAttribute("form",""),i.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()}),[i,t.Fragments.fromChildNodes(e)]});i.forEach(e=>{e.remove()});const n=this.template().withOverlay({name:s,slots:e,inputsAndLabels:r}).render();return this.#gt=n.firstElementChild,this.#bt=n.querySelector("input[type=radio]"),this.#vt="boolean"===this.declared("type"),{fragment:n,control:this.#bt,error:n.querySelector("ful-field-error"),described:this,claims:this.#gt,announces:this,freeze:this.#gt}}get value(){if(!this.#gt){const e=this._heldValue(),t=null===e?null:this.querySelector(`ful-radio[value="${CSS.escape(String(e))}"]`),s=t?.getAttribute("value")??null;return null===s||"boolean"!==this.declared("type")?s:"true"===s}const e=this.querySelector("input[type=radio]:checked");return e?this.#vt?"true"===e.value:e.value:null}set value(e){if(!this.#gt)return void this._holdValue(e);const t=this.querySelectorAll("input[type=radio]"),s=()=>{t.forEach(e=>{e.checked=!1})};if(null===e)return void s();const i=this.querySelector(`input[type=radio][value="${CSS.escape(String(e))}"]`);null!==i?i.checked=!0:s()}}class X extends m{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 ';#yt;#De;_build({slots:e}){const s="switch"===this.declared("type"),i=this.template().withOverlay({slots:e,isSwitch:s}).render();this.#yt=i.firstElementChild,this.#De=i.querySelector("input"),t.Attributes.forward("input-",this,this.#De),this.#De.addEventListener("change",e=>{e.stopPropagation(),this._notifyChange()});const r=i.querySelector("label");return{fragment:i,control:this.#De,error:i.querySelector("ful-field-error"),label:r,freeze:this.#yt}}get value(){return this.#De?this.#De.checked:Boolean(this._heldValue())}set value(e){this.#De?this.#De.checked=e:this._holdValue(e)}}class Z extends t.ParsedElement{static attributes=["sorter"];static observed=["order"];#wt;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.#wt||null}set order(e){this.#wt=e||null,this.reflectTo("order",this.#wt);const s=this.closest("th");s&&t.Attributes.set(s,"aria-sort",this.#wt?"asc"===this.#wt?"ascending":"descending":null)}}class ee extends t.ParsedElement{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 ';#Et=0;#At=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.#At)}}))})}update({current:e,total:t}={}){void 0!==e&&(this.#At=e??0),void 0!==t&&(this.#Et=t??0),this.reflectTo("current",this.#At),this.reflectTo("total",this.#Et);const s=this.#At,i=this.#Et,r=this.declared("pages")??5,n=Math.max(i,1),a=s>0,l=s+1<n,o={index:a?s-1:null,enabled:a},u={index:s,label:s+1},d={index:l?s+1:null,enabled:l},c=Math.max(1,Math.min(r,n)),h=Math.max(0,Math.min(s-Math.floor((c-1)/2),n-c)),p=Array.from({length:c},(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:o,curr:u,next:d,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.#Et}set total(e){this.update({total:e})}get current(){return this.#At}set current(e){this.update({current:e})}}class te{static parse(e,s){const i=e?t.Nodes.queryChildren(e,"schema"):null;if(!i)throw new Error('missing expected <schema>: ful-table needs a <template slot="schema"> holding one');const r=document.createElement("tr"),n=document.createElement("tr");n.setAttribute("data-tpl-each","rows");for(const e of i.getAttributeNames()){const t=i.getAttribute(e);r.setAttribute(e,t??""),n.setAttribute(e,t??"")}const a=t.Nodes.queryChildrenAll(i,"column"),l=a.filter(e=>e.hasAttribute("order")&&e.hasAttribute("sorter")).map(e=>({sorter:e.getAttribute("sorter"),order:e.getAttribute("order")}))[0]??null;for(const e of a){const s=t.Nodes.queryChildren(e,"title"),i=e.getAttribute("sorter"),a=e.getAttribute("order"),l=s??document.createTextNode(e.getAttribute("title")??"");s?.remove(),e.removeAttribute("sorter"),e.removeAttribute("order"),e.removeAttribute("title");const o=i||a?(()=>{const e=document.createElement("ful-sorter");return i&&e.setAttribute("sorter",i),a&&e.setAttribute("order",a),e.append(l),e})():l,u=document.createElement("th"),d=document.createElement("td");for(const t of e.getAttributeNames()){const s=e.getAttribute(t);u.setAttribute(t,s??""),d.setAttribute(t,s??"")}u.append(o),d.append(...e.childNodes),r.append(u),n.append(d)}return{headersTemplate:s.withOverlay({inHeaders:!0,inRows:!1}).withFragment(t.Fragments.from(r)),rowsTemplate:s.withOverlay({inHeaders:!1,inRows:!0}).withFragment(t.Fragments.from(n)),sort:l,length:a.length}}}class se{#ve;constructor(e){this.#ve=e}async load(e,t,s){const i=this.#xt(t),r=Number(e.size),n=e.page*r,a=n+r;return{data:i.slice(n,a),size:i.length}}#xt(e){if(!e?.sorter)return this.#ve;const{sorter:t,order:s}=e,i="desc"===s?-1:1;return[...this.#ve].sort((e,s)=>{const r=e?.[t],n=s?.[t];return r===n?0:null==r?1:null==n?-1:(r<n?-1:1)*i})}update(e){this.#ve=e}}class ie{#w;#E;#A;#S;constructor(e,t,s,i=e=>e){this.#w=e,this.#E=t,this.#A=s,this.#S=i}async load(e,t,s){const i=Object.entries(s).filter(([e,t])=>t);return await this.#w.request(this.#A,this.#E).param("page",e.page).param("size",e.size).param("sort",t?`${t.sorter},${t.order}`:null).param("filters",i.length>0?JSON.stringify(Object.fromEntries(i)):null).fetchJson().then(e=>this.#S(e))}}class re{static create(e,t){const s=e.getAttribute("src");if(s){const t=e.component("http-client"),i=e.getAttribute("method")??"GET",r=e.hasAttribute("response-mapper")?e.component(e.getAttribute("response-mapper")):e=>e;return new ie(t,s,i,r)}return new se([])}}class ne extends t.ParsedElement{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 "};#Pe;#St;#_t;#Ct;#kt;#ke;#qt;#Tt;#Lt;#Nt;#Ot;#zt={pageRequest:{page:0,size:10},sortRequest:null,filterRequest:{}};#Rt=!1;#Ft={};#It=null;#Pt=!1;#Mt=null;#Bt=new c;#Me={src:null,method:null};get pageSize(){return this.#zt.pageRequest.size}set pageSize(e){const t=Number(e??10);Number.isNaN(t)||t===this.#zt.pageRequest.size||(this.#zt={...this.#zt,pageRequest:{page:0,size:t}},this.#Rt&&this.load(this.#zt.pageRequest,this.#zt.sortRequest,this.#Ft))}get src(){return this.getAttribute("src")}set src(e){this.reflectTo("src",e??null),this.#dt()&&this.#Rt&&this.reload()}get method(){return this.getAttribute("method")}set method(e){this.reflectTo("method",e??null),this.#dt()&&this.#Rt&&this.reload()}async reconfigure(e){for(const t of["src","method"])t in e&&this.reflectTo(t,e[t]??null);return this.#dt(),await this.reload()}#Qe(){this.#Me={src:this.getAttribute("src"),method:this.getAttribute("method")},this.#Pe=this.component(this.declared("loader")??"loaders:table").create(this)}#dt(){return(this.getAttribute("src")!==this.#Me.src||this.getAttribute("method")!==this.#Me.method)&&(this.#Qe(),this.#zt={...this.#zt,pageRequest:{...this.#zt.pageRequest,page:0}},!0)}async render({slots:e}){const s=this.template(),i=te.parse(e.schema,s),r=s.withOverlay({slots:e,schema:i}).render(),n=t.Nodes.queryChildren(r,"ful-table-wrapper").querySelector("table");t.Attributes.forward("table-",this,n),this.#Qe(),this.#St=i,this.#_t=n.querySelector(":scope > tbody"),this.#Ct=n.querySelector(":scope > tbody[data-ref=loading]"),this.#kt=n.querySelector(":scope > tbody[data-ref=initial]"),this.#ke=n.querySelector(":scope > tbody[data-ref=empty]"),this.#qt=this.#ke.querySelector("ful-empty[data-ref=empty-authors]"),this.#Tt=e.empty&&!t.Fragments.isBlank(e.empty)?t.Templates.fromFragment(e.empty):null,this.#Lt=n.querySelector(":scope > tbody[data-ref=feedback]"),this.#Nt=t.Nodes.queryChildren(r,"ful-pagination"),this.replaceChildren(r);const a=this.querySelector("thead");i.headersTemplate.renderTo(a),this.#Ot=a.querySelectorAll("ful-sorter"),await t.Rendering.waitForChildren(this);const l=t.Nodes.queryChildren(this,"ful-form");this.#zt={pageRequest:{page:0,size:this.declared("page-size")??10},sortRequest:i.sort,filterRequest:l?.values??{}},this.#Ft=this.#zt.filterRequest,this.#It=l,l?.addEventListener("submit:success",async e=>{this.#Mt=this.#Dt(0,e.detail.request),await this.#Mt}),this.addEventListener("page:requested",async e=>{e.composedPath().find(e=>e instanceof ne)===this&&await this.#Dt(e.detail.value,this.#Ft)}),this.addEventListener("sort:requested",async e=>{if(e.composedPath().find(e=>e instanceof ne)!==this)return;const t=e.detail.value.order?e.detail.value:null;await this.load(this.#zt.pageRequest,t,this.#Ft),this.#zt.sortRequest===t&&(this.#Ot.forEach(e=>{e.order=null}),e.target.order=e.detail.value.order)}),this.declared("autoload")&&this.reload()}async reload(){if(!this.#It||this.#Pt)return await this.load(this.#zt.pageRequest,this.#zt.sortRequest,this.#zt.filterRequest);await this.#It.submit()&&await this.#Mt}async load(e,s,i){this.#Rt=!0,this.#Ft=i;const r=this.#Bt.take();let n;this.#Ct.toggleAttribute("hidden",this.#_t.childElementCount>0),this.#Lt.setAttribute("hidden",""),this.#kt.setAttribute("hidden",""),this.#ke.setAttribute("hidden",""),this.setAttribute("aria-busy","true");try{const a=await this.#Pe.load(e,s,i);if(r.stale)return;if(n=Math.max(0,Math.ceil(a.size/e.size)-1),e.page<=n){if(this.#zt={pageRequest:e,sortRequest:s,filterRequest:i},this.#Pt=!0,this.#ne(e,s,i,a),await Promise.all([t.Rendering.waitForChildren(this.#_t),t.Rendering.waitForChildren(this.#ke)]).catch(()=>{}),r.stale)return;return this.removeAttribute("aria-busy"),void this.dispatchEvent(new CustomEvent("load:success",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:s,filterRequest:i,response:a}}))}}catch(n){if(r.stale)return;throw this.#Ct.setAttribute("hidden",""),this.#_t.replaceChildren(),this.#Lt.removeAttribute("hidden"),this.#Lt.querySelector("[data-ref=feedback-error]").textContent=t.Localization.of().failure(n),this.removeAttribute("aria-busy"),this.dispatchEvent(new CustomEvent("load:failure",{bubbles:!0,cancelable:!1,detail:{pageRequest:e,sortRequest:s,filterRequest:i,exception:n}})),n}return await this.load({page:n,size:e.size},s,i)}async withLoader(e){return await e(this.#Pe)}async resetWithFilter(e){return await this.#Dt(0,e)}#Dt(e,t){return this.load({page:e,size:this.#zt.pageRequest.size},this.#zt.sortRequest,t)}#ne(e,t,s,i){const r=Math.ceil(i.size/e.size);this.#Ct.setAttribute("hidden",""),this.#_t.replaceChildren(this.template("row").withOverlay({schema:this.#St,pageRequest:e,filterRequest:s,pageResponse:i}).render()),this.#ke.toggleAttribute("hidden",0!==i.data.length),this.#Tt&&0===i.data.length&&this.#qt.replaceChildren(this.#Tt.withOverlay({schema:this.#St,pageRequest:e,filterRequest:s,pageResponse:i}).render()),this.#Nt.update({current:e.page,total:r})}}const ae=(e,t,{items:s,current:i=()=>null})=>{let r="",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();(i()??t[0])?.focus()}),t.addEventListener("keydown",t=>{const i=t.target,a=s(),l=a.find(e=>e===i||e.contains(i));if(!l)return;const o=a.indexOf(l);switch(t.code){case"ArrowDown":return t.preventDefault(),void a[(o+1)%a.length]?.focus();case"ArrowUp":return t.preventDefault(),void a[(o-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(),l.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();r=u-n>500?t.key:r+t.key,n=u;const d=r.toLowerCase(),c=[...d].every(e=>e===d[0]),h=c?d[0]:d,p=c?o+1:o,f=[...a.slice(p),...a.slice(0,p)].find(e=>(e.textContent??"").trim().toLowerCase().startsWith(h));f&&(t.preventDefault(),f.focus())})};class le{static narrow(e,t){const s=(e??[]).filter(e=>t.includes(e));return s.length>0?s:[...t]}#$t;#Ce;#Wt;#Vt;#Ht;#ht;#jt;#Gt;#Kt;#Ut=!1;#Qt=!1;constructor(e,{vocabulary:t,glyphs:s={},labelFor:i=e=>e,display:r=null,interactive:n=()=>!0,onPick:a=()=>{}}){this.#$t=e,this.#Ce=e.nextElementSibling,this.#Wt=t,this.#Vt=s,this.#Ht=i,this.#ht=r??(e=>s[e]??e),this.#jt=n,this.#Gt=a,this.#Kt=[...t],this.#Ce.addEventListener("click",e=>{const t=e.target.closest("li > a");if(!t||!this.#jt())return;const s=t.getAttribute("value"),i=this.value;this.value=s,this.#Ce.hidePopover?.(),i!==s&&this.#Gt(s)})}get allowed(){return this.#Kt}set allowed(e){this.#Kt=le.narrow(e,this.#Wt),this.#Jt(),!this.#Qt&&this.#Kt.length>1&&(this.#m(),this.#Qt=!0),this.#Yt(),this.pinned&&(this.value=this.#Kt[0])}preferring(e){return null!==e&&this.#Kt.includes(e)?e:this.#Kt[0]}get pinned(){return this.#Kt.length<2}set fixed(e){this.#$t.toggleAttribute("hidden",!!e)}get value(){return this.#$t.getAttribute("value")}set value(e){this.#$t.setAttribute("value",e),this.#$t.textContent=this.#ht(e),t.Attributes.set(this.#$t,"aria-label",this.#Ht(e)),this.#Xt()}#Xt(){const e=this.value;for(const t of this.#ee())t.setAttribute("aria-checked",String(t.getAttribute("value")===e))}set claimed(e){this.#Ut=e,this.#Yt()}#Jt(){this.#Ce.replaceChildren(...this.#Kt.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 i=this.#Ht(e),r=this.#Vt[e]??e;if(i===e&&r===e)s.innerText=e;else{const e=document.createElement("span");e.innerText=r;const t=document.createElement("span");t.innerText=i,s.append(e,t)}return t.append(s),t})),this.#Xt()}#Yt(){const e=this.pinned;this.#$t.toggleAttribute("disabled",e||this.#Ut),t.Attributes.set(this.#$t,"aria-haspopup",e?null:"true"),t.Attributes.set(this.#$t,"aria-expanded",e?null:"false"),e?this.#$t.removeAttribute("popovertarget"):this.#Ce.id&&this.#$t.setAttribute("popovertarget",this.#Ce.id)}#ee(){return Array.from(this.#Ce.querySelectorAll("li > a"),e=>e)}#m(){W.wire(this.#$t,this.#Ce,{prefix:"ful-filter-menu",invoke:!0,expanded:!0}),ae(()=>this.#$t,this.#Ce,{items:()=>this.#ee(),current:()=>this.#ee().find(e=>e.getAttribute("value")===this.value)})}}const oe={EQ:"=",NEQ:"≠",LT:"<",GT:">",LTE:"≤",GTE:"≥",BETWEEN:"↔",CONTAINS:"…a…",STARTS_WITH:"a…",ENDS_WITH:"…a"},ue=["EQ","NEQ","LT","GT","LTE","GTE","BETWEEN"],de=[...ue,"CONTAINS","STARTS_WITH","ENDS_WITH"],ce=["IGNORE_CASE","CASE_SENSITIVE"],he={IGNORE_CASE:"aa",CASE_SENSITIVE:"Aa"},{t:pe}=t.Localization.of(),fe=e=>pe(`filters.op.${e}`),me=e=>pe(`filters.sensitivity.${e}`),ge=e=>pe(""===e?"filters.boolean.any":`filters.boolean.${e}`),be=e=>e.querySelector(":scope > label")?.textContent.trim()||null,ve=(e,t,{singular:s,plural:i,vocabulary:r,fallback:n})=>{const a=e.declared(s);if(null===a)return;e.hasAttribute(i)&&console.warn(`${e.localName}: ${s} fixes what ${i} offers a menu for, the plural is ignored`,e);const l=r.includes(a);l||console.warn(`${e.localName}: '${a}' is not one of its ${i}, the default is pinned instead`,e),t.allowed=[l?a:n],t.fixed=!0},ye=(e,t,s)=>{const i=s.filter(e=>null!=e&&""!=`${e}`);return 0===i.length?null:{label:e,operator:t,operands:i.map(e=>`${e}`)}};class we extends C{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 le(s.querySelector("[data-ref=operator]"),{vocabulary:this._vocabulary(),glyphs:oe,labelFor:fe,interactive:()=>this._interactive(),onPick:()=>{this._syncBetween(),this._notifyChange()}}),this.operators=this.declared("operators"),null===this._operator.value&&this._showDefaultOperator(),ve(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 ue}_declaredOperators;get operators(){return this._operator?this._operator.allowed:this._declaredOperators}set operators(e){null===this.declared("operator")&&(this._operator?(this._operator.allowed=e,null!==this._operator.value&&this._showOperator(this._operator.preferring(this._operator.value))):this._declaredOperators=le.narrow(e,this._vocabulary()))}get value(){return this._operator?this._tuple():this._shownTuple(this._heldValue())}set value(e){this._operator?this._applyTuple(e):this._holdValue(e)}_shownTuple(e){if(null==e)return null;const[t,...s]=e,i=this.declared("operator"),r=this._vocabulary().includes(i),n=null===i?le.narrow(this.declared("operators"),this._vocabulary()):[r?i:this._defaultOperator()],a=n.includes(t)?t:n[0],l=[s[0],s[1]].map(e=>`${e?this._deserialize(e):e??""}`),o="BETWEEN"===a?l:l.slice(0,1);return o.some(e=>""===e)?null:[a,...o.map(e=>this._serialize(e))]}_tuple(){const e=this._operator.value,t=this.#Zt();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;this._showOperator(this._operator.preferring(t)),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 this._operator?ye(be(this),this._operator.value,this.#Zt()):null}#Zt(){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 Ee extends we{_defaultOperator(){return"LTE"}_type(){return"datetime-local"}_serialize(e){return L.localToIso(e)}_deserialize(e){return L.isoToLocal(e)}}class Ae extends we{_type(){return"date"}}class xe extends we{_type(){return"number"}}class Se extends we{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 de}_sensitivityButton;_build(e){const t=super._build(e);return this._sensitivityButton=new le(t.fragment.querySelector("[data-ref=sensitivity]"),{vocabulary:ce,glyphs:he,labelFor:me,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._sensitivityButton.allowed=null,this._sensitivityButton.value=ce[0],ve(this,this._sensitivityButton,{singular:"sensitivity",plural:"sensitivities",vocabulary:ce,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=le.narrow(e,ce));const t=this._sensitivityButton.value;this._sensitivityButton.allowed=e,this._sensitivityButton.value=this._sensitivityButton.preferring(t)}get value(){if(!this._sensitivityButton){const e=this._heldValue(),t=null==e?null:this._shownTuple([e[0],...e.slice(2)]);if(null===t)return null;const s=this.declared("sensitivity"),i=null===s?le.narrow(this.declared("sensitivities"),ce):[ce.includes(s)?s:"IGNORE_CASE"],r=i.includes(e[1])?e[1]:"IGNORE_CASE";return[t[0],i.includes(r)?r:i[0],...t.slice(1)]}const e=this._tuple();return null==e?null:[e[0],this._sensitivity,...e.slice(1)]}set value(e){this._sensitivityButton?null!=e?(this._sensitivityButton.allowed.includes(e[1])&&(this._sensitivityButton.value=e[1]),this._applyTuple([e[0],...e.slice(2)])):this._applyTuple(e):this._holdValue(e)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._sensitivityButton.value=this._sensitivityButton.preferring("IGNORE_CASE"))}}const _e=["","true","false"],Ce={true:"✓",false:"✗"};class ke extends m{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 le(t.querySelector("[data-ref=operator]"),{vocabulary:ke.OPERATORS,glyphs:oe,labelFor:fe,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this._value=new le(s,{vocabulary:_e,glyphs:Ce,labelFor:ge,display:ge,interactive:()=>this._interactive(),onPick:()=>this._notifyChange()}),this.operators=this.declared("operators"),this._operator.value=this._operator.preferring(ke.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,null!==this._operator.value&&(this._operator.value=this._operator.preferring(this._operator.value))):this._declaredOperators=le.narrow(e,this._vocabulary())}_vocabulary(){return ke.OPERATORS}get value(){if(!this._value){const e=this._heldValue(),t=`${e?.[1]??""}`;if(""===t)return null;const s=le.narrow(this.declared("operators"),this._vocabulary());return[s.includes(e[0])?e[0]:s[0],t]}return""===this._value.value?null:[this._operator.value,this._value.value]}set value(e){this._value?null!=e?(this._operator.value=this._operator.preferring(e[0]),this._value.value=e[1]??""):this._value.value="":this._holdValue(e)}formResetCallback(){super.formResetCallback(),this.hasAttribute("value")||(this._operator.value=this._operator.preferring(ke.DEFAULT_OPERATOR))}get criterion(){if(!this._value)return null;const e=this._value.value;return ye(be(this),this._operator.value,[""===e?"":ge(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 qe extends J{static attributes=["operator"];#es(){const e=super.value;return this.multiple?e:null==e?[]:[e]}get value(){const e=this.#es();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 ye(be(this),this.declared("operator"),[super.entry].flat().filter(e=>e).map(e=>e.label))}}class Te extends t.ParsedElement{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]"),i=t.querySelector("[data-ref=content]");W.wire(s,i,{prefix:"ful-tooltip",invoke:!0,expanded:!0,handPlace:!0}),i.setAttribute("placement",this.declared("placement")??"top"),this.replaceChildren(t),this.declared("describes")&&Te.#g(this,s,i)}static#g(e,t,s){h(e)?.describedBy(s)?t.tabIndex=-1:console.warn("a ful-tooltip declares describes but stands in nothing that takes a description",e)}}class Le{#ts=new WeakSet;#d=new WeakMap;async request(e,t,s,i){const r=!this.#ts.has(t),n={name:s,section:t,index:i,first:r},a=["section:requested",...null!=i?[`section:requested:#${i}`]:[],...s?[`section:requested:${s}`]:[]],l=[];for(const t of a){const s=new CustomEvent(t,{bubbles:!0,detail:n});e.dispatchEvent(s),l.push(...s.async?.promises??[])}if(0===l.length)return;this.#ts.add(t);let o=this.#d.get(t);o||(o=new c,this.#d.set(t,o));const u=o.take(),d=()=>!u.stale;t.querySelector(":scope > .ful-section-error")?.remove();const h=requestAnimationFrame(()=>{d()&&(t.toggleAttribute("loading",!0),t.setAttribute("aria-busy","true"))});try{return await Promise.all(l)}catch(e){throw d()&&this.#ss(t,e),e}finally{cancelAnimationFrame(h),d()&&(t.toggleAttribute("loading",!1),t.removeAttribute("aria-busy"))}}#ss(e,s){e.querySelector(":scope > .ful-section-error")?.remove();const i=document.createElement("div");i.className="ful-section-error",i.setAttribute("role","alert"),i.textContent=t.Localization.of().failure(s),e.prepend(i)}}class Ne{#is;#rs;#ns;#Ct;#as;#ls=new Le;#os=new c;#us=null;constructor(e,t,s){this.#is=e,this.#rs=t.querySelector("[data-ref=dialog]"),this.#ns=t.querySelector(`[data-ref=${s}]`),this.#Ct=t.querySelector("[data-ref=loading]"),this.#as=t.querySelector("[data-ref=error]")}get dialog(){return this.#rs}get section(){return this.#ns}get dirty(){return Array.from(this.#rs.querySelectorAll("ful-form")).some(e=>e.closest("dialog")===this.#rs&&e.dirty)}dismiss(e,t,s){return this.#us?this.#us:this.#is.dispatchEvent(e)?e.cancelable?s&&this.dirty?(this.#us=s().then(e=>(e&&this.#rs.open&&t(),e)).finally(()=>{this.#us=null}),this.#us):(t(),Promise.resolve(!0)):Promise.resolve(!0):Promise.resolve(!1)}onBackdrop(e){let t=!1;this.#rs.addEventListener("mousedown",e=>{t=e.target===this.#rs}),this.#rs.addEventListener("click",s=>{t&&s.target===this.#rs&&e()})}onSubmitted(e){this.#ns.addEventListener("submit:success",t=>{"ful-form"===t.target.localName&&t.target.parentElement===this.#ns&&e(t.detail.response)})}restChrome(){this.#as?.replaceChildren(),this.#as?.setAttribute("hidden",""),this.#Ct?.setAttribute("hidden",""),this.#ns?.removeAttribute("hidden")}request(){return this.#ls.request(this.#is,this.#ns,null,null).catch(()=>{})}async update(e,s){const i=this.#os.take();this.#ns.replaceChildren(),this.restChrome(),this.#Ct?.removeAttribute("hidden"),this.#ns.setAttribute("hidden",""),s();try{const t=await e();return i.stale?null:(this.#ns.replaceChildren(t),this.#Ct?.setAttribute("hidden",""),this.#ns.removeAttribute("hidden"),this.#ns)}catch(e){throw i.stale||(this.#as?.removeAttribute("hidden"),this.#as&&(this.#as.textContent=t.Localization.of().failure(e)),this.#Ct?.setAttribute("hidden",""),this.#ns.setAttribute("hidden","")),e}}}let Oe=!1;const ze=()=>{Oe||(Oe=!0,document.addEventListener("click",e=>{const t=e.target.closest?.("[dialog-target]");t&&document.getElementById(t.getAttribute("dialog-target"))?.open?.()}))};class Re extends t.ParsedElement{static attributes=["header","requires-answer:presence","close-on-submit:presence","guard-dismiss:presence"];static slots=!0;static template='\n <dialog data-ref="dialog" class="ful-dialog">\n <header data-tpl-if="header || slots.header || !requiresAnswer" class="ful-dialog-header">\n {{{{ slots.header }}}}\n <h2 data-tpl-if="header">{{ header }}</h2>\n <button data-tpl-if="!requiresAnswer" type="button" data-ref="close" data-tpl-aria-label="#l10n:t(\'dialog.close\')"><ful-icon name="x-lg" aria-hidden="true"></ful-icon></button>\n </header>\n <section data-ref="loading" hidden><ful-spinner class="centered" role="status"><span class="ful-sr-only">{{ #l10n:t(\'spinner.loading\') }}</span></ful-spinner></section>\n <section data-ref="error" role="alert" hidden></section>\n <div data-ref="body" class="ful-dialog-body">{{{{ slots.default }}}}</div>\n <footer class="ful-dialog-footer"><button type="button" data-ref="acknowledge" data-result="acknowledged" data-tpl-if="!slots.buttons && !closeOnSubmit" data-tpl-aria-label="#l10n:t(\'dialog.acknowledge\')">{{ #l10n:t(\'dialog.acknowledge\') }}</button>{{{{ slots.buttons }}}}</footer>\n </dialog>\n ';#rs;#ds;#cs=[];#hs=null;render({slots:e}){const s=this.declared("requires-answer"),i=this.declared("close-on-submit"),r=this.template().withOverlay({slots:e,header:this.declared("header")??"",requiresAnswer:s,closeOnSubmit:i}).render();this.#ds=new Ne(this,r,"body"),this.#rs=this.#ds.dialog;const n=r.querySelector("h2");n&&(n.id||=t.Attributes.uid("ful-dialog-title"),this.#rs.setAttribute("aria-labelledby",n.id)),this.#rs.addEventListener("close",()=>{const e=this.#ps();this.dispatchEvent(new CustomEvent("close",{detail:e})),this.#fs(e)}),this.#rs.addEventListener("click",e=>{const t=e.target.closest("button[data-result]");t&&t.closest("dialog")===this.#rs&&this.#rs.close(t.dataset.result)}),s||this.#ds.onBackdrop(()=>this.dismiss("backdrop")),r.querySelector("[data-ref=close]")?.addEventListener("click",()=>this.dismiss("button")),i&&this.#ds.onSubmitted(e=>{this.#hs={dismissed:!1,result:null,response:e},this.#rs.close("submitted")}),this.#rs.addEventListener("cancel",e=>{if(!e.cancelable)return this.#rs.returnValue="",void this.#ms("escape",!1);e.preventDefault(),s||this.dismiss("escape")}),this.replaceChildren(r),ze()}#ps(){if(this.#hs)return this.#hs;const e=this.#rs?.returnValue??"";return""===e?{dismissed:!0,result:null,response:null}:{dismissed:!1,result:e,response:null}}#fs(e){const t=this.#cs;this.#cs=[];for(const s of t)s(e)}disconnectedCallback(){this.#fs(this.#ps())}open(){return this.ask()}ask(){return this.#gs()&&(this.#ds.restChrome(),this.#ds.request()),new Promise(e=>{this.#cs.push(e)})}async update(e){return await this.#ds.update(e,()=>this.#gs())}refresh(){return this.#ds.request()}dismiss(e){return this.#rs.open?this.#ms(e,!0):Promise.resolve(!0)}#ms(e,t){return this.#ds.dismiss(new CustomEvent("dialog:dismiss",{cancelable:t,detail:{reason:e}}),()=>this.#rs.close(""),this.declared("guard-dismiss")?Fe:null)}close(e){this.#rs.close(e??"")}#gs(){return this.#rs.open&&!this.#rs.matches(":modal")&&this.#rs.removeAttribute("open"),!this.#rs.open&&(this.#rs.returnValue="",this.#hs=null,this.#rs.showModal(),!0)}static async ask(e,s,i=[],{className:r}={}){const n=document.createElement("ful-dialog");if(n.setAttribute("header",e),r&&(n.className=r),"string"==typeof s?n.textContent=s:s&&n.append(s),i.length>0){const e=document.createElement("template");e.setAttribute("slot","buttons");for(const t of i){if(t instanceof Node){e.content.append(t);continue}const[s,i,r]=t,n=document.createElement("button");n.type="button",n.dataset.result=s,r&&(n.className=r),n.textContent=i,e.content.append(n)}n.append(e)}document.body.append(n);try{return await t.Rendering.waitFor(n),await n.ask()}finally{n.remove()}}static async confirm(e,s,i={},r={}){const n=await Re.ask(e,s,[["cancel",i.cancel??t.Localization.of().t("dialog.cancel")],["confirm",i.confirm??t.Localization.of().t("dialog.confirm"),"ful-button"]],r);return!n.dismissed&&"confirm"===n.result}}const Fe=()=>{const e=t.Localization.of();return Re.confirm(e.t("dialog.discard.header"),e.t("dialog.discard.body"),{confirm:e.t("dialog.discard.confirm"),cancel:e.t("dialog.discard.cancel")})};class Ie extends t.ParsedElement{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 ';#rs;#bs;#ds;#hs=null;#cs=[];#vs=!1;#ys=e=>{e.target===this.#rs&&this.#ws()};render({slots:e}){const s=this.template().withOverlay({slots:e,title:this.declared("header")??""}).render();this.#ds=new Ne(this,s,"content"),this.#rs=this.#ds.dialog,this.#bs=s.querySelector("[data-ref=title]"),this.#bs.id||=t.Attributes.uid("ful-drawer-title"),this.#rs.setAttribute("aria-labelledby",this.#bs.id);const i=this.declared("placement");i&&this.#rs.setAttribute("placement",i),s.querySelector("[data-ref=close]").addEventListener("click",()=>this.dismiss("button")),this.#ds.onBackdrop(()=>this.dismiss("backdrop")),this.#rs.addEventListener("cancel",e=>{if(!e.cancelable)return this.#Es(),void this.#ms("escape",!1);e.preventDefault(),this.dismiss("escape")}),this.#rs.addEventListener("click",e=>{const t=e.target.closest("button[data-result]");t&&t.closest("dialog")===this.#rs&&this.close(t.dataset.result)}),this.#rs.addEventListener("close",()=>{const e=this.#ps();this.dispatchEvent(new CustomEvent("close",{detail:e})),this.#fs(e)}),this.declared("close-on-submit")&&this.#ds.onSubmitted(e=>{this.#hs={dismissed:!1,result:null,response:e},this.close()}),this.replaceChildren(s),ze()}get header(){return this.#bs.textContent}set header(e){this.#bs.textContent=e??""}async update(e,t){return this.header=e,await this.#ds.update(t,()=>this.#gs())}refresh(){return this.#ds.request()}#ps(){return this.#hs??{dismissed:!0,result:null,response:null}}#fs(e){const t=this.#cs;this.#cs=[];for(const s of t)s(e)}disconnectedCallback(){this.#fs(this.#ps())}open(){return this.ask()}ask(){return this.#gs()&&(this.#ds.restChrome(),this.#ds.request()),new Promise(e=>{this.#cs.push(e)})}dismiss(e){return this.#vs||!this.#rs.open?Promise.resolve(!0):this.#ms(e,!0)}#ms(e,t){return this.#ds.dismiss(new CustomEvent("drawer:dismiss",{cancelable:t,detail:{reason:e}}),()=>this.close(),this.declared("guard-dismiss")?Fe:null)}close(e){!this.#vs&&this.#rs.open&&(e&&(this.#hs={dismissed:!1,result:e,response:null}),matchMedia("(prefers-reduced-motion: reduce)").matches?this.#rs.close():(this.#rs.setAttribute("closing",""),0!==this.#rs.getAnimations().length?(this.#vs=!0,this.#rs.addEventListener("animationend",this.#ys)):this.#ws()))}#ws(){this.#Es(),this.#rs.close()}#Es(){this.#vs=!1,this.#rs.removeEventListener("animationend",this.#ys),this.#rs.removeAttribute("closing")}#gs(){return this.#vs&&(this.#hs=null),this.#Es(),this.#rs.open&&!this.#rs.matches(":modal")&&this.#rs.removeAttribute("open"),!this.#rs.open&&(this.#hs=null,this.#rs.showModal(),!0)}}class Pe extends t.ParsedElement{static attributes=["for"];#As=null;#xs=null;#Ss=e=>{const t=e.target;this.#xs=this.matches(":popover-open")&&this.#As?.contains(t)?this.#As:null};connectedCallback(){super.connectedCallback(),this.rendered&&!this.declared("for")&&document.addEventListener("pointerdown",this.#Ss,!0)}disconnectedCallback(){document.removeEventListener("pointerdown",this.#Ss,!0)}render(){const e=this.declared("for"),t=e?document.getElementById(e):null;if(e&&!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?(this.#As=t,t.setAttribute("aria-haspopup","menu"),W.wire(t,this,{prefix:"ful-menu",invoke:!0,expanded:!0})):this.#_s(),ae(()=>this.#As,this,{items:()=>this.items}),this.#Xt(),this.addEventListener("click",e=>{const t=e.target;this.items.some(e=>e===t||e.contains(t))&&this.hidePopover()})}showFor(e){if(this.declared("for"))throw new Error("ful-menu: showFor serves a menu without for; a menu with for is opened by its invoker");const t=this.#xs;if(this.#xs=null,t===e)return;this.#As&&this.#As!==e&&this.#As.setAttribute("aria-expanded","false"),this.#As=e,e.setAttribute("aria-haspopup","menu"),e.setAttribute("aria-expanded","true"),this.style.margin="";const s=Number.parseFloat(getComputedStyle(this).marginBlockStart)||0,i=this.matches(":popover-open");W.show(this,e,{flip:!0,gap:s}),i&&this.items[0]?.focus()}get items(){return this.#Xt().filter(e=>!e.hasAttribute("disabled")&&!e.hasAttribute("hidden"))}#_s(){document.addEventListener("pointerdown",this.#Ss,!0),this.addEventListener("toggle",e=>{"closed"===e.newState&&this.#As?.setAttribute("aria-expanded","false")})}#Xt(){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 Me=["info","success","warning","error"],Be=new Set;let De=!1;class $e extends t.ParsedElement{static attributes=["timeout:number"];#Cs;connectedCallback(){super.connectedCallback(),this.rendered&&Be.add(this)}disconnectedCallback(){Be.delete(this)}render(){this.#Cs=this.declared("timeout")||5e3,this.setAttribute("role","region"),this.setAttribute("tabindex","-1"),this.setAttribute("aria-label",t.Localization.of().t("toast.region")),this.setAttribute("popover","manual"),De||(De=!0,document.addEventListener("show-toast",e=>{if(e.detail)for(const t of Be)t.show(e.detail.message,e.detail)})),Be.add(this)}show(e,s={}){const i=Me.includes(s.severity)?s.severity:"info",r=document.createElement("ful-toast");r.classList.add(i),r.setAttribute("role","error"===i?"alert":"status");const n=document.createElement("div");n.textContent=t.Localization.of().failure(e);const a=document.createElement("button");a.type="button",a.setAttribute("aria-label",t.Localization.of().t("toast.dismiss"));const l=document.createElement("ful-icon");l.setAttribute("name","x-lg"),l.setAttribute("aria-hidden","true"),a.append(l),r.append(n);let o=s.timeout??this.#Cs,u=performance.now(),d=0;const c=()=>{clearTimeout(d),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(s.action?.label){const e=document.createElement("button");e.type="button",e.className="ful-toast-action",e.textContent=String(s.action.label),e.addEventListener("click",()=>{s.action.onClick?.(),c()}),r.append(e)}r.append(a),r.addEventListener("animationend",()=>{r.classList.contains("ful-toast-out")&&r.remove()});let h=0;const p=()=>{0===h&&(clearTimeout(d),o=Math.max(0,o-(performance.now()-u))),++h},f=()=>{0!==h&&0===--h&&(u=performance.now(),d=setTimeout(c,o))};return r.addEventListener("mouseenter",p),r.addEventListener("mouseleave",f),r.addEventListener("focusin",p),r.addEventListener("focusout",f),a.addEventListener("click",c),this.append(r),this.#ks(),d=setTimeout(c,o),r}#ks(){this.isConnected&&(this.matches(":popover-open")&&this.hidePopover(),this.showPopover())}}class We extends t.ParsedElement{static slots=!0;static observed=["active:number"];static template='\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-start" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.previous\')"><ful-icon name="chevron-left" aria-hidden="true"></ful-icon></button>\n <ful-tablist role="tablist">{{{{ slots.tabs }}}}</ful-tablist>\n <button type="button" class="ful-tabs-scroll" data-ref="scroll-end" tabindex="-1" hidden data-tpl-aria-label="#l10n:t(\'tabs.next\')"><ful-icon name="chevron-right" aria-hidden="true"></ful-icon></button>\n {{{{ slots.default }}}}\n ';#qs;#Ts;#Ls;#Ns=[];#Os=[];#ls=new Le;#zs=0;render({slots:e}){const s=this.template().withOverlay({slots:e}).render();this.#qs=s.querySelector("ful-tablist"),this.#Ts=s.querySelector('[data-ref="scroll-start"]'),this.#Ls=s.querySelector('[data-ref="scroll-end"]');const i=[this.#qs,this.#Ts,this.#Ls],r=[...this.#qs.children];this.#Os=[...s.children].filter(e=>!i.includes(e)),r.length!==this.#Os.length&&console.warn(`ful-tabs: ${r.length} tabs declared for ${this.#Os.length} panels, the surplus is left alone`);const n=Math.min(r.length,this.#Os.length);this.#Ns=[];for(let e=0;e!==n;++e){const s=this.#Os[e],i=document.createElement("button");i.type="button",i.role="tab",i.id=t.Attributes.uid("ful-tab"),s.id||(s.id=t.Attributes.uid("ful-tabpanel")),i.setAttribute("aria-controls",s.id),s.role="tabpanel",s.setAttribute("aria-labelledby",i.id),s.tabIndex=0,i.append(...r[e].childNodes),i.addEventListener("click",()=>{this.active=e}),r[e].replaceWith(i),this.#Ns.push(i)}this.#qs.addEventListener("keydown",e=>{const t=this.#zs;let s=null;"ArrowRight"===e.key?s=(t+1)%this.#Ns.length:"ArrowLeft"===e.key?s=(t-1+this.#Ns.length)%this.#Ns.length:"Home"===e.key?s=0:"End"===e.key&&(s=this.#Ns.length-1),null!==s&&s!==t&&(e.preventDefault(),this.active=s,this.#Ns[s].focus())}),this.#Ts.addEventListener("click",()=>this.#Rs(-1)),this.#Ls.addEventListener("click",()=>this.#Rs(1)),this.#qs.addEventListener("scroll",()=>this.#Fs(),{passive:!0});let a=-1;const l=new ResizeObserver(()=>{this.#Fs(),this.#qs.clientWidth!==a&&(a=this.#qs.clientWidth,this.#Is(this.#Ns[this.#zs],"auto"))});l.observe(this.#qs);for(const e of this.#Ns)l.observe(e);this.replaceChildren(s)}#Fs(){const e=this.#qs,t=e.scrollWidth-e.clientWidth,s=Math.abs(e.scrollLeft);this.#Ts.hidden=s<=1,this.#Ls.hidden=s>=t-1,this.#Ts.style.blockSize=this.#Ls.style.blockSize=`${e.clientHeight}px`}#Ps(){const e=this.#qs.getBoundingClientRect(),t="rtl"===getComputedStyle(this.#qs).direction,[s,i]=t?[this.#Ls,this.#Ts]:[this.#Ts,this.#Ls];return{left:e.left+s.offsetWidth,right:e.right-i.offsetWidth}}#Rs(e){const{left:t,right:s}=this.#Ps(),i=e>0!=("rtl"===getComputedStyle(this.#qs).direction)?e=>e.getBoundingClientRect().right>s+1:e=>e.getBoundingClientRect().left<t-1,r=e>0?this.#Ns.find(i):this.#Ns.findLast(i);this.#Is(r,matchMedia("(prefers-reduced-motion: reduce)").matches?"auto":"smooth")}#Is(e,t){if(!e)return;const{left:s,right:i}=this.#Ps(),r=e.getBoundingClientRect();r.right>i?this.#qs.scrollBy({left:Math.ceil(r.right-i),behavior:t}):r.left<s&&this.#qs.scrollBy({left:Math.floor(r.left-s),behavior:t})}get active(){return this.#zs}refresh(e){const t=e instanceof Element?this.#Os.indexOf(e):Number.isInteger(e)?e:NaN,s=this.#Os[t];if(s)return this.#ls.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.#Ns.length-1)),s=this.#zs;for(const[e,s]of this.#Ns.entries())s.setAttribute("aria-selected",e===t?"true":"false"),s.tabIndex=e===t?0:-1,this.#Os[e].hidden=e!==t;this.#zs=t,this.reflectTo("active",t),this.#Is(this.#Ns[t],"auto"),this.rendered&&t!==s&&this.dispatchEvent(new CustomEvent("tabs:change",{detail:{active:t,previous:s}})),this.#Os.length>0&&(t!==s||!this.rendered)&&this.#ls.request(this,this.#Os[t],null,t).catch(()=>{})}}class Ve extends t.ParsedElement{static slots=!0;static observed=["exclusive:presence"];static template="\n <ful-accordion-group>{{{{ slots.default }}}}</ful-accordion-group>\n ";#ie;#Ms=!1;render({slots:e}){const t=this.template().withOverlay({slots:e}).render();this.#ie=t.querySelector("ful-accordion-group"),this.replaceChildren(t)}get exclusive(){return this.#Ms}set exclusive(e){this.#Ms=!0===e,this.reflectTo("exclusive",this.#Ms);const s=this.#Ms?t.Attributes.uid("ful-accordion"):null;for(const e of this.#ie.querySelectorAll(":scope > details"))null===s?e.removeAttribute("name"):e.setAttribute("name",s)}}class He extends t.ParsedElement{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 ";#Bs=[];#ds=[];#ls=new Le;#Ds=0;#$s;render({slots:e}){const t=this.template().withOverlay({slots:e}).render(),s=[...t.querySelector("ful-steps ol").children];this.#ds=[...t.children].filter(e=>"ful-steps"!==e.localName),s.length!==this.#ds.length&&console.warn(`ful-wizard: ${s.length} steps declared for ${this.#ds.length} sections, the surplus is left alone`);const i=Math.min(s.length,this.#ds.length);this.#Bs=[];for(let e=0;e!==i;++e){const t=document.createElement("li");t.append(...s[e].childNodes),s[e].replaceWith(t),this.#Bs.push(t),this.#ds[e].tabIndex=-1}if(this.replaceChildren(t),i>0){const e=this.#ds.findIndex(e=>"step"===e.getAttribute("aria-current"));this.#Ws(-1===e?0:Math.min(e,i-1)),this.#Vs(this.#Ds).catch(()=>{})}}get index(){return this.#Ds}get step(){return this.#ds[this.#Ds]?.getAttribute("data-step")??null}get progress(){return this.#$s}set progress(e){this.#$s=e,this.reflectTo("progress",e)}next(){return this.#Hs(this.#Ds+1)}prev(){return this.#Hs(this.#Ds-1)}move(e){const t=this.#ds.findIndex(t=>t.getAttribute("data-step")===e);if(!(-1===t||t>=this.#Bs.length))return this.#Hs(t);console.warn(`ful-wizard: no section paired with a step carries data-step="${e}"`)}refresh(e){const t=e instanceof Element?this.#ds.indexOf(e):this.#ds.findIndex(t=>t.getAttribute("data-step")===e);if(!(-1===t||t>=this.#Bs.length))return this.#Vs(t).catch(()=>{});console.warn(`ful-wizard: no section answers to "${e}"`)}#Vs(e){return this.#ls.request(this,this.#ds[e],this.#ds[e].getAttribute("data-step"),e)}#Hs(e){const t=Math.min(Math.max(0,e),Math.max(0,this.#Bs.length-1));if(t!==this.#Ds)return this.#Ws(t),this.#ds[this.#Ds].focus(),this.rendered&&this.dispatchEvent(new CustomEvent("wizard:change",{detail:{index:this.#Ds,step:this.step}})),this.#Vs(t)}#Ws(e){for(const[t,s]of this.#Bs.entries())t===e?(s.setAttribute("aria-current","step"),this.#ds[t].setAttribute("aria-current","step")):(s.removeAttribute("aria-current"),this.#ds[t].removeAttribute("aria-current"));this.#Ds=e}}const je={en:{"pagination.showing":"Page {current} of {total}","pagination.navigation":"Page navigation","pagination.previous":"Previous","pagination.next":"Next","pagination.reload":"Reload","table.initial":"Start searching to see results.","table.error":"Error while loading data:","table.no-data":"No elements found.","dropdown.empty":"No results","select.remove":"Remove","files.dropzone-label":"Click or drop your files here","files.remove":"Remove","files.unacceptable-file-type":"Only files of type {types} are supported","files.max-file-size-exceeded":"Maximum supported file size is {size}","files.max-total-size-exceeded":"Maximum supported total file size is {size}","files.max-files-exceeded":{one:"Maximum of {count} file exceeded",other:"Maximum of {count} files exceeded"},"filters.op.EQ":"Equals","filters.op.NEQ":"Not equal","filters.op.LT":"Less than","filters.op.GT":"Greater than","filters.op.LTE":"At most","filters.op.GTE":"At least","filters.op.BETWEEN":"Between","filters.op.CONTAINS":"Contains","filters.op.STARTS_WITH":"Starts with","filters.op.ENDS_WITH":"Ends with","filters.sensitivity.IGNORE_CASE":"Ignore case","filters.sensitivity.CASE_SENSITIVE":"Case sensitive","filters.boolean.any":"Any","filters.boolean.true":"Yes","filters.boolean.false":"No","info.tooltip":"More information","failure.no-reason":"Something went wrong","dialog.acknowledge":"Got it","dialog.close":"Close","dialog.confirm":"Confirm","dialog.cancel":"Cancel","dialog.discard.header":"Unsaved changes","dialog.discard.body":"There are unsaved changes: close anyway?","dialog.discard.confirm":"Close without saving","dialog.discard.cancel":"Keep editing","drawer.close":"Close","spinner.loading":"Loading…","tabs.previous":"Previous tabs","tabs.next":"Next tabs","toast.region":"Notifications","toast.dismiss":"Dismiss","wizard.progress":"Progress"},it:{"pagination.showing":"Pagina {current} di {total}","pagination.navigation":"Navigazione pagine","pagination.previous":"Precedente","pagination.next":"Successivo","pagination.reload":"Ricarica","table.initial":"Avvia la ricerca per visualizzare i risultati.","table.error":"Errore nel caricamento dei dati:","table.no-data":"Nessun elemento trovato.","dropdown.empty":"Nessun risultato","select.remove":"Rimuovi","files.dropzone-label":"Clicca o trascina i file qui","files.remove":"Rimuovi","files.unacceptable-file-type":"Solo i file di tipo {types} sono supportati","files.max-file-size-exceeded":"La dimensione massima di un file è di {size}","files.max-total-size-exceeded":"La dimensione massima complessiva dei file è di {size}","files.max-files-exceeded":{other:"Superato il numero massimo di {count} file"},"filters.op.EQ":"Uguale","filters.op.NEQ":"Diverso","filters.op.LT":"Minore","filters.op.GT":"Maggiore","filters.op.LTE":"Al massimo","filters.op.GTE":"Almeno","filters.op.BETWEEN":"Tra","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Inizia con","filters.op.ENDS_WITH":"Termina con","filters.sensitivity.IGNORE_CASE":"Ignora maiuscole","filters.sensitivity.CASE_SENSITIVE":"Distingui maiuscole","filters.boolean.any":"Qualsiasi","filters.boolean.true":"Sì","filters.boolean.false":"No","info.tooltip":"Maggiori informazioni","failure.no-reason":"Si è verificato un errore","dialog.acknowledge":"Ho capito","dialog.close":"Chiudi","dialog.confirm":"Conferma","dialog.cancel":"Annulla","dialog.discard.header":"Modifiche non salvate","dialog.discard.body":"Ci sono modifiche non salvate: chiudere comunque?","dialog.discard.confirm":"Chiudi senza salvare","dialog.discard.cancel":"Continua a modificare","drawer.close":"Chiudi","spinner.loading":"Caricamento…","tabs.previous":"Schede precedenti","tabs.next":"Schede successive","toast.region":"Notifiche","toast.dismiss":"Chiudi","wizard.progress":"Avanzamento"},es:{"pagination.showing":"Página {current} de {total}","pagination.navigation":"Navegación de páginas","pagination.previous":"Anterior","pagination.next":"Siguiente","pagination.reload":"Recargar","table.initial":"Inicia la búsqueda para ver los resultados.","table.error":"Error al cargar los datos:","table.no-data":"No se encontraron elementos.","dropdown.empty":"Sin resultados","select.remove":"Eliminar","files.dropzone-label":"Haz clic o arrastra tus archivos aquí","files.remove":"Eliminar","files.unacceptable-file-type":"Solo se admiten archivos de tipo {types}","files.max-file-size-exceeded":"El tamaño máximo de archivo admitido es {size}","files.max-total-size-exceeded":"El tamaño total máximo admitido es {size}","files.max-files-exceeded":{one:"Se ha superado el número máximo de {count} archivo",other:"Se ha superado el número máximo de {count} archivos"},"filters.op.EQ":"Igual","filters.op.NEQ":"Distinto","filters.op.LT":"Menor","filters.op.GT":"Mayor","filters.op.LTE":"Como máximo","filters.op.GTE":"Al menos","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contiene","filters.op.STARTS_WITH":"Empieza por","filters.op.ENDS_WITH":"Termina por","filters.sensitivity.IGNORE_CASE":"Ignorar mayúsculas","filters.sensitivity.CASE_SENSITIVE":"Distinguir mayúsculas","filters.boolean.any":"Cualquiera","filters.boolean.true":"Sí","filters.boolean.false":"No","info.tooltip":"Más información","failure.no-reason":"Se ha producido un error","dialog.acknowledge":"Entendido","dialog.close":"Cerrar","dialog.confirm":"Confirmar","dialog.cancel":"Cancelar","dialog.discard.header":"Cambios sin guardar","dialog.discard.body":"Hay cambios sin guardar: ¿cerrar de todos modos?","dialog.discard.confirm":"Cerrar sin guardar","dialog.discard.cancel":"Seguir editando","drawer.close":"Cerrar","spinner.loading":"Cargando…","tabs.previous":"Pestañas anteriores","tabs.next":"Pestañas siguientes","toast.region":"Notificaciones","toast.dismiss":"Cerrar","wizard.progress":"Progreso"},fr:{"pagination.showing":"Page {current} sur {total}","pagination.navigation":"Navigation des pages","pagination.previous":"Précédent","pagination.next":"Suivant","pagination.reload":"Recharger","table.initial":"Lancez la recherche pour voir les résultats.","table.error":"Erreur lors du chargement des données :","table.no-data":"Aucun élément trouvé.","dropdown.empty":"Aucun résultat","select.remove":"Retirer","files.dropzone-label":"Cliquez ou déposez vos fichiers ici","files.remove":"Retirer","files.unacceptable-file-type":"Seuls les fichiers de type {types} sont pris en charge","files.max-file-size-exceeded":"La taille maximale de fichier prise en charge est {size}","files.max-total-size-exceeded":"La taille totale maximale prise en charge est {size}","files.max-files-exceeded":{one:"Nombre maximal de {count} fichier dépassé",other:"Nombre maximal de {count} fichiers dépassé"},"filters.op.EQ":"Égal","filters.op.NEQ":"Différent","filters.op.LT":"Inférieur","filters.op.GT":"Supérieur","filters.op.LTE":"Au plus","filters.op.GTE":"Au moins","filters.op.BETWEEN":"Entre","filters.op.CONTAINS":"Contient","filters.op.STARTS_WITH":"Commence par","filters.op.ENDS_WITH":"Finit par","filters.sensitivity.IGNORE_CASE":"Ignorer la casse","filters.sensitivity.CASE_SENSITIVE":"Respecter la casse","filters.boolean.any":"Indifférent","filters.boolean.true":"Oui","filters.boolean.false":"Non","info.tooltip":"Plus d’informations","failure.no-reason":"Une erreur s'est produite","dialog.acknowledge":"J’ai compris","dialog.close":"Fermer","dialog.confirm":"Confirmer","dialog.cancel":"Annuler","dialog.discard.header":"Modifications non enregistrées","dialog.discard.body":"Des modifications ne sont pas enregistrées : fermer quand même ?","dialog.discard.confirm":"Fermer sans enregistrer","dialog.discard.cancel":"Continuer à modifier","drawer.close":"Fermer","spinner.loading":"Chargement…","tabs.previous":"Onglets précédents","tabs.next":"Onglets suivants","toast.region":"Notifications","toast.dismiss":"Fermer","wizard.progress":"Progression"}};return e.Accordion=Ve,e.Anchors=W,e.AsyncEvents=u,e.Bindings=f,e.BooleanFilter=ke,e.Checkbox=X,e.Claims=c,e.CompareFilter=we,e.Dialog=Re,e.Drawer=Ie,e.Dropdown=Q,e.Field=m,e.Form=w,e.FormLoader=v,e.InFilter=qe,e.Input=C,e.InputFile=R,e.InputInstant=z,e.InputLocalDate=N,e.InputLocalTime=O,e.Instant=L,e.InstantFilter=Ee,e.LocalDate=T,e.LocalDateFilter=Ae,e.LocalStorage=n,e.Menu=Pe,e.NumberFilter=xe,e.PageLeave=d,e.Pagination=ee,e.Plugin=class{#js;#Gs;#Ks;constructor(e={}){this.#js=e.language??navigator?.language??"en",this.#Gs=e.translations??{},this.#Ks=e.httpClient??null}configure(e){const i=this.#Ks??s.HttpClient.builder().withCsrfToken().withRedirectOnUnauthorized("/").build(),r=this.#js.split("-")[0].toLowerCase(),n={...je.en,...je[r],...this.#Gs};e.defineModule("l10n",t.Localization).defineComponent("http-client",i).defineElement("ful-tooltip",Te).defineElement("ful-dialog",Re).defineElement("ful-drawer",Ie).defineElement("ful-menu",Pe).defineElement("ful-toasts",$e).defineElement("ful-tabs",We).defineElement("ful-accordion",Ve).defineElement("ful-wizard",He).defineElement("ful-form",w).defineElement("ful-checkbox",X).defineElement("ful-input",C).defineElement("ful-input-file",R).defineElement("ful-local-date",T).defineElement("ful-instant",L).defineElement("ful-input-local-date",N).defineElement("ful-input-local-time",O).defineElement("ful-input-instant",z).defineElement("ful-radio-group",Y).defineElement("ful-table",ne).defineElement("ful-pagination",ee).defineElement("ful-sorter",Z).defineElement("ful-filter-instant",Ee).defineElement("ful-filter-local-date",Ae).defineElement("ful-filter-number",xe).defineElement("ful-filter-boolean",ke).defineElement("ful-filter-text",Se).defineElement("ful-filter-in",qe).defineElement("ful-select",J).defineElement("ful-dropdown",Q).defineComponent("loaders:select",U).defineComponent("loaders:form",v).defineComponent("loaders:table",re).defineOverlay({l10n:n,locale:this.#js})}},e.RadioGroup=Y,e.Select=J,e.SelectLoader=U,e.SessionStorage=a,e.SortButton=Z,e.Table=ne,e.TableLoader=re,e.TableSchemaParser=te,e.Tabs=We,e.TextFilter=Se,e.Timing=p,e.Toasts=$e,e.Tooltip=Te,e.VersionedLocalStorage=l,e.VersionedSessionStorage=o,e.Wizard=He,e.describable=h,e}({},ftl,httpc);
|
|
2
2
|
//# sourceMappingURL=ful.iife.min.js.map
|