@codegouvfr/react-dsfr
Version:
French State Design System React integration library
2 lines • 66.8 kB
JavaScript
/*! DSFR v1.8.5 | SPDX-License-Identifier: MIT | License-Filename: LICENSE.md | restricted use (see terms and conditions) */
const e=new class{constructor(){this.modules={}}create(e){const t=new e;this.modules[t.type]=t}getModule(e){return this.modules[e]}add(e,t){this.modules[e].add(t)}remove(e,t){this.modules[e].remove(t)}get isActive(){return this._isActive}set isActive(e){if(e===this._isActive)return;this._isActive=e;const t=Object.keys(this.modules).map((e=>this.modules[e]));if(e)for(const e of t)e.activate();else for(const e of t)e.deactivate()}get isLegacy(){return this._isLegacy}set isLegacy(e){e!==this._isLegacy&&(this._isLegacy=e)}},t="fr",s="dsfr",i="1.8.5";class n{constructor(e,t,s,i){switch(this.level=e,this.light=t,this.dark=s,i){case"warn":this.logger=console.warn;break;case"error":this.logger=console.error;break;default:this.logger=console.log}}log(...e){const t=new r(s);for(const s of e)t.add(s);this.print(t)}print(e){e.setColor(this.color),this.logger.apply(console,e.getMessage())}get color(){return window.matchMedia("(prefers-color-scheme: dark)").matches?this.dark:this.light}}class r{constructor(e){this.inputs=["%c"],this.styles=["font-family:Marianne","line-height: 1.5"],this.objects=[],e&&this.add(`${e} :`)}add(e){switch(typeof e){case"object":case"function":this.inputs.push("%o "),this.objects.push(e);break;default:this.inputs.push(`${e} `)}}setColor(e){this.styles.push(`color:${e}`)}getMessage(){return[this.inputs.join(""),this.styles.join(";"),...this.objects]}}const o={trace:new n(0,"#616161","#989898"),debug:new n(1,"#000091","#8B8BFF"),info:new n(2,"#007c3b","#00ed70"),warn:new n(3,"#ba4500","#fa5c00","warn"),error:new n(4,"#D80600","#FF4641","error")};const a=new class{constructor(){this.level=2;for(const e in o){const t=o[e];this[e]=(...e)=>{this.level<=t.level&&t.log.apply(t,e)},this[e].print=t.print.bind(t)}}state(){const t=new r;t.add(e),this.trace.print(t)}tree(){const t=e.getModule("stage");if(!t)return;const s=new r;this._branch(t.root,0,s),this.trace.print(s)}_branch(e,t,s){let i="";if(t>0){let e="";for(let s=0;s<t;s++)e+=" ";i+=e+"└─ "}i+=`[${e.id}] ${e.html}`,s.add(i),s.add({"@":e}),s.add("\n");for(const n of e.children)i+=this._branch(n,t+1,s)}},c=e=>{"loading"!==document.readyState?window.requestAnimationFrame(e):document.addEventListener("DOMContentLoaded",e)},h={AUTO:"auto",MANUAL:"manual",RUNTIME:"runtime",LOADED:"loaded",VUE:"vue",ANGULAR:"angular",REACT:"react"};const l=new class{constructor(){this._mode=h.AUTO,this.isStarted=!1,this.starting=this.start.bind(this),this.preventManipulation=!1}configure(e={},t){this.startCallback=t,!0===e.verbose&&(a.level=0),this.mode=e.mode||h.AUTO}set mode(e){switch(e){case h.AUTO:this.preventManipulation=!1,t=this.starting,c(t);break;case h.LOADED:this.preventManipulation=!1,c(this.starting);break;case h.RUNTIME:this.preventManipulation=!1,this.start();break;case h.MANUAL:this.preventManipulation=!1;break;case h.VUE:case h.ANGULAR:case h.REACT:this.preventManipulation=!0;break;default:return void a.error("Illegal mode")}var t;this._mode=e,a.info(`mode set to ${e}`)}get mode(){return this._mode}start(){a.info("start"),this.startCallback()}};class d{constructor(){this._collection=[]}forEach(e){this._collection.forEach(e)}map(e){return this._collection.map(e)}get length(){return this._collection.length}add(e){return!(this._collection.indexOf(e)>-1)&&(this._collection.push(e),this.onAdd&&this.onAdd(),this.onPopulate&&1===this._collection.length&&this.onPopulate(),!0)}remove(e){const t=this._collection.indexOf(e);if(-1===t)return!1;this._collection.splice(t,1),this.onRemove&&this.onRemove(),this.onEmpty&&0===this._collection.length&&this.onEmpty()}execute(...e){for(const t of this._collection)t&&t.apply(null,e)}clear(){this._collection.length=0}clone(){const e=new d;return e._collection=this._collection.slice(),e}get collection(){return this._collection}}class u extends d{constructor(e){super(),this.type=e,this.isActive=!1}activate(){}deactivate(){}}const g=e=>`${t}-${e}`;g.selector=(e,t)=>(void 0===t&&(t="."),`${t}${g(e)}`),(g.attr=e=>`data-${g(e)}`).selector=(e,t)=>{let s=g.attr(e);return void 0!==t&&(s+=`="${t}"`),`[${s}]`},g.event=e=>`${s}.${e}`,g.emission=(e,t)=>`emission:${e}.${t}`;const p=(e,t)=>Array.prototype.slice.call(e.querySelectorAll(t)),m=(e,t)=>{const s=e.parentElement;return s.matches(t)?s:s===document.documentElement?null:m(s,t)};class b{constructor(e,t,s){this.selector=e,this.InstanceClass=t,this.creator=s,this.instances=new d,this.isIntroduced=!1,this._instanceClassName=this.InstanceClass.instanceClassName,this._instanceClassNames=this.getInstanceClassNames(this.InstanceClass),this._property=this._instanceClassName.substring(0,1).toLowerCase()+this._instanceClassName.substring(1);const i=this._instanceClassName.replace(/[^a-zA-Z0-9]+/g,"-").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([0-9])([^0-9])/g,"$1-$2").replace(/([^0-9])([0-9])/g,"$1-$2").toLowerCase();this._attribute=g.attr(`js-${i}`)}getInstanceClassNames(e){const t=Object.getPrototypeOf(e);return t&&"Instance"!==t.instanceClassName?[...this.getInstanceClassNames(t),e.instanceClassName]:[e.instanceClassName]}hasInstanceClassName(e){return this._instanceClassNames.indexOf(e)>-1}introduce(){this.isIntroduced||(this.isIntroduced=!0,e.getModule("stage").parse(document.documentElement,this))}parse(e,t){const s=[];return e.matches&&e.matches(this.selector)&&s.push(e),!t&&e.querySelectorAll&&e.querySelector(this.selector)&&s.push.apply(s,p(e,this.selector)),s}create(e){if(!e.node.matches(this.selector))return;const t=new this.InstanceClass;return this.instances.add(t),t}remove(e){this.instances.remove(e)}dispose(){const e=this.instances.collection;for(let t=e.length-1;t>-1;t--)e[t]._dispose();this.creator=null}get instanceClassName(){return this._instanceClassName}get instanceClassNames(){return this._instanceClassNames}get property(){return this._property}get attribute(){return this._attribute}}class f extends u{constructor(){super("register")}register(t,s,i){const n=new b(t,s,i);return this.add(n),e.isActive&&n.introduce(),n}activate(){for(const e of this.collection)e.introduce()}remove(e){e.dispose(),super.remove(e)}}let _=0;class S{constructor(e,t){t?this.id=t:(_++,this.id=_),this.node=e,this.attributeNames=[],this.instances=[],this._children=[],this._parent=null,this._projects=[]}get proxy(){const e=this;if(!this._proxy){this._proxy={id:this.id,get parent(){return e.parent?e.parent.proxy:null},get children(){return e.children.map((e=>e.proxy))}};for(const e of this.instances)this._proxy[e.registration.property]=e.proxy}return this._proxy}get html(){if(!this.node||!this.node.outerHTML)return"";const e=this.node.outerHTML.indexOf(">");return this.node.outerHTML.substring(0,e+1)}project(e){-1===this._projects.indexOf(e)&&this._projects.push(e)}populate(){const e=this._projects.slice();this._projects.length=0;for(const t of e)this.create(t)}create(e){if(this.hasInstance(e.instanceClassName))return;a.debug(`create instance of ${e.instanceClassName} on element [${this.id}]`);const t=e.create(this);this.instances.push(t),t._config(this,e),this._proxy&&(this._proxy[e.property]=t.proxy)}remove(e){const t=this.instances.indexOf(e);t>-1&&this.instances.splice(t,1),this._proxy&&delete this._proxy[e.registration.property]}get parent(){return this._parent}get ascendants(){return[this.parent,...this.parent.ascendants]}get children(){return this._children}get descendants(){const e=[...this._children];return this._children.forEach((t=>e.push(...t.descendants))),e}addChild(e,t){return this._children.indexOf(e)>-1?null:(e._parent=this,!isNaN(t)&&t>-1&&t<this._children.length?this._children.splice(t,0,e):this._children.push(e),e)}removeChild(e){const t=this._children.indexOf(e);if(-1===t)return null;e._parent=null,this._children.splice(t,1)}emit(t,s){const i=e.getModule("stage").collection,n=[];for(const e of i)n.push(...e._emit(t,s));return n}_emit(e,t){const s=[];for(const i of this.instances)s.push(...i._emitter.emit(e,t));return s}ascend(e,t){return this._parent?this._parent._ascend(e,t):[]}_ascend(e,t){const s=[];for(const i of this.instances)s.push(...i._ascent.emit(e,t));return this._parent&&s.push(...this._parent._ascend(e,t)),s}descend(e,t){const s=[];for(const i of this._children)s.push(...i._descend(e,t));return s}_descend(e,t){const s=[];for(const i of this.instances)s.push(...i._descent.emit(e,t));for(const i of this._children)s.push(...i._descend(e,t));return s}getInstance(e){for(const t of this.instances)if(t.registration.hasInstanceClassName(e))return t;return null}hasInstance(e){return null!==this.getInstance(e)}getDescendantInstances(e,t,s){if(!e)return[];const i=[];for(const n of this._children){const r=n.getInstance(e);r&&(i.push(r),s)||(t&&n.hasInstance(t)||!n.children.length||i.push.apply(i,n.getDescendantInstances(e,t,s)))}return i}getAscendantInstance(e,t){if(!e||!this._parent)return null;const s=this._parent.getInstance(e);return s||(t&&this._parent.hasInstance(t)?null:this._parent.getAscendantInstance(e,t))}dispose(){for(const e of this.instances)e._dispose();this.instances.length=0,e.remove("stage",this),this.parent.removeChild(this),this._children.length=0,a.debug(`remove element [${this.id}] ${this.html}`)}prepare(e){-1===this.attributeNames.indexOf(e)&&this.attributeNames.push(e)}examine(){const e=this.attributeNames.slice();this.attributeNames.length=0;for(let t=this.instances.length-1;t>-1;t--)this.instances[t].examine(e)}}class E extends S{constructor(){super(document.documentElement,"root"),this.node.setAttribute(g.attr("js"),!0)}}class y extends u{constructor(){super("stage"),this.root=new E,super.add(this.root),this.observer=new MutationObserver(this.mutate.bind(this)),this.modifications=[],this.willModify=!1,this.modifying=this.modify.bind(this)}hasElement(e){for(const t of this.collection)if(t.node===e)return!0;return!1}getElement(e){for(const t of this.collection)if(t.node===e)return t;const t=new S(e);return this.add(t),a.debug(`add element [${t.id}] ${t.html}`),t}getProxy(e){if(!this.hasElement(e))return null;return this.getElement(e).proxy}add(e){super.add(e),this.put(e,this.root)}put(e,t){let s=0;for(let i=t.children.length-1;i>-1;i--){const n=t.children[i],r=e.node.compareDocumentPosition(n.node);if(r&Node.DOCUMENT_POSITION_CONTAINS)return void this.put(e,n);if(r&Node.DOCUMENT_POSITION_CONTAINED_BY)t.removeChild(n),e.addChild(n,0);else if(r&Node.DOCUMENT_POSITION_PRECEDING){s=i+1;break}}t.addChild(e,s)}activate(){this.observer.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0})}deactivate(){this.observer.disconnect()}mutate(e){const t=[];e.forEach((e=>{switch(e.type){case"childList":e.removedNodes.forEach((e=>this.dispose(e))),e.addedNodes.forEach((e=>this.parse(e)));break;case"attributes":if(this.hasElement(e.target)){const s=this.getElement(e.target);s.prepare(e.attributeName),-1===t.indexOf(s)&&t.push(s);for(const e of s.descendants)-1===t.indexOf(e)&&t.push(e)}-1===this.modifications.indexOf(e.target)&&this.modifications.push(e.target)}})),t.forEach((e=>e.examine())),this.modifications.length&&!this.willModify&&(this.willModify=!0,window.requestAnimationFrame(this.modifying))}modify(){this.willModify=!1;const e=this.modifications.slice();this.modifications.length=0;for(const t of e)document.documentElement.contains(t)&&this.parse(t)}dispose(e){const t=[];this.forEach((s=>{e.contains(s.node)&&t.push(s)}));for(const e of t)e.dispose(),this.remove(e)}parse(t,s,i){const n=s?[s]:e.getModule("register").collection,r=[];for(const e of n){const s=e.parse(t,i);for(const t of s){const s=this.getElement(t);s.project(e),-1===r.indexOf(s)&&r.push(s)}}for(const e of r)e.populate()}}class v extends u{constructor(){super("render"),this.rendering=this.render.bind(this),this.nexts=new d}activate(){window.requestAnimationFrame(this.rendering)}request(e){this.nexts.add(e)}render(){if(!e.isActive)return;if(window.requestAnimationFrame(this.rendering),this.forEach((e=>e.render())),!this.nexts.length)return;const t=this.nexts.clone();this.nexts.clear(),t.forEach((e=>e.next()))}}class A extends u{constructor(){super("resize"),this.requireResize=!1,this.resizing=this.resize.bind(this);const e=this.request.bind(this);document.fonts&&document.fonts.ready.then(e),window.addEventListener("resize",e),window.addEventListener("orientationchange",e)}activate(){this.request()}request(){this.requireResize||(this.requireResize=!0,window.requestAnimationFrame(this.resizing))}resize(){this.requireResize&&(this.forEach((e=>e.resize())),this.requireResize=!1)}}class C extends u{constructor(){super("lock"),this._isLocked=!1,this._scrollY=0,this.onPopulate=this.lock.bind(this),this.onEmpty=this.unlock.bind(this)}get isLocked(){return this._isLocked}lock(){this._isLocked||(this._isLocked=!0,this._scrollY=window.scrollY,this.isLegacy?document.body.style.top=-1*this._scrollY+"px":document.body.style.setProperty("--scroll-top",-1*this._scrollY+"px"),document.documentElement.setAttribute(g.attr("scrolling"),"false"))}unlock(){this._isLocked&&(this._isLocked=!1,document.documentElement.removeAttribute(g.attr("scrolling")),this.isLegacy?document.body.style.top="":document.body.style.removeProperty("--scroll-top"),window.scroll(0,this._scrollY))}}class T extends u{constructor(){super("load"),this.loading=this.load.bind(this)}activate(){window.addEventListener("load",this.loading)}load(){this.forEach((e=>e.load()))}}const L=["Marianne","Spectral"];class w extends u{constructor(){super("font-swap"),this.swapping=this.swap.bind(this)}activate(){document.fonts&&document.fonts.addEventListener("loadingdone",this.swapping)}swap(){const e=L.filter((e=>document.fonts.check(`16px ${e}`)));this.forEach((t=>t.swapFont(e)))}}class N extends u{constructor(){super("mouse-move"),this.requireMove=!1,this._isMoving=!1,this.moving=this.move.bind(this),this.requesting=this.request.bind(this),this.onPopulate=this.listen.bind(this),this.onEmpty=this.unlisten.bind(this)}listen(){this._isMoving||(this._isMoving=!0,this.requireMove=!1,document.documentElement.addEventListener("mousemove",this.requesting))}unlisten(){this._isMoving&&(this._isMoving=!1,this.requireMove=!1,document.documentElement.removeEventListener("mousemove",this.requesting))}request(e){this._isMoving&&(this.point={x:e.clientX,y:e.clientY},this.requireMove||(this.requireMove=!0,window.requestAnimationFrame(this.moving)))}move(){this.requireMove&&(this.forEach((e=>e.mouseMove(this.point))),this.requireMove=!1)}}const x=new class{constructor(){e.create(f),e.create(y),e.create(v),e.create(A),e.create(C),e.create(T),e.create(w),e.create(N);const t=e.getModule("register");this.register=t.register.bind(t)}get isActive(){return e.isActive}start(){a.debug("START"),e.isActive=!0}stop(){a.debug("STOP"),e.isActive=!1}};const I=e=>{switch(!0){case e.hover:return"-hover";case e.active:return"-active";default:return""}},O=new class{getColor(e,t,s,i={}){const n=`--${e}-${t}-${s}${I(i)}`;return getComputedStyle(document.documentElement).getPropertyValue(n).trim()||null}},D=e=>"."===e.charAt(0)?e.substr(1):e,M=e=>e.className?e.className.split(" "):[],k=(e,t,s)=>{t=D(t);const i=M(e),n=i.indexOf(t);!0===s?n>-1&&i.splice(n,1):-1===n&&i.push(t),e.className=i.join(" ")},R=(e,t)=>k(e,t),P=(e,t)=>k(e,t,!0),H=(e,t)=>M(e).indexOf(D(t))>-1,G=['[tabindex]:not([tabindex="-1"])',"a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details","iframe"].join(),$=e=>e.querySelectorAll(G),q={};q.addClass=R,q.hasClass=H,q.removeClass=P,q.queryParentSelector=m,q.querySelectorAllArray=p,q.queryActions=$;const B={supportLocalStorage:()=>{try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}},supportAspectRatio:()=>!!window.CSS&&CSS.supports("aspect-ratio: 16 / 9")},U={NONE:g.selector("transition-none")},z={};z.TransitionSelector=U;const F=(e,...t)=>(t.forEach((t=>{const s=Object.keys(t).reduce(((e,s)=>(e[s]=Object.getOwnPropertyDescriptor(t,s),e)),{});Object.getOwnPropertySymbols(t).forEach((e=>{const i=Object.getOwnPropertyDescriptor(t,e);i.enumerable&&(s[e]=i)})),Object.defineProperties(e,s)})),e),j={};j.completeAssign=F;const W={},K={};Object.defineProperty(K,"isLegacy",{get:()=>e.isLegacy}),K.setLegacy=()=>{e.isLegacy=!0},W.legacy=K,W.dom=q,W.support=B,W.motion=z,W.property=j,W.ns=g,W.register=x.register,W.state=e,Object.defineProperty(W,"preventManipulation",{get:()=>l.preventManipulation}),Object.defineProperty(W,"stage",{get:()=>e.getModule("stage")}),a.info(`version ${i}`);const Y=t=>e.getModule("stage").getProxy(t);Y.Modes=h,Object.defineProperty(Y,"mode",{set:e=>{l.mode=e},get:()=>l.mode}),Y.internals=W,Y.start=x.start,Y.stop=x.stop,Y.inspector=a,Y.colors=O,l.configure(window[s],Y.start),window[s]=Y;class V{constructor(){this.emissions={}}add(e,t){if("function"!=typeof t)throw new Error("closure must be a function");this.emissions[e]||(this.emissions[e]=[]),this.emissions[e].push(t)}remove(e,t){if(this.emissions[e])if(t){const s=this.emissions[e].indexOf(t);s>-1&&this.emissions[e].splice(s)}else delete this.emissions[e]}emit(e,t){if(!this.emissions[e])return[];const s=[];for(const i of this.emissions[e])i&&s.push(i(t));return s}dispose(){this.emissions=null}}class Q{constructor(e,t){this.id=e,this.minWidth=t}test(){return window.matchMedia(`(min-width: ${this.minWidth}em)`).matches}}const J={XS:new Q("xs",0),SM:new Q("sm",36),MD:new Q("md",48),LG:new Q("lg",62),XL:new Q("xl",78)};class Z{constructor(e=!0){this.jsAttribute=e,this._isRendering=!1,this._isResizing=!1,this._isScrollLocked=!1,this._isLoading=!1,this._isSwappingFont=!1,this._listeners={},this._keyListenerTypes=[],this._keys=[],this.handlingKey=this.handleKey.bind(this),this._emitter=new V,this._ascent=new V,this._descent=new V,this._registrations=[],this._nexts=[]}static get instanceClassName(){return"Instance"}_config(e,t){this.element=e,this.registration=t,this.node=e.node,this.id=e.node.id,this.jsAttribute&&this.setAttribute(t.attribute,!0),this.init()}init(){}get proxy(){const e=this;return{render:()=>e.render(),resize:()=>e.resize()}}register(t,s){const i=e.getModule("register").register(t,s,this);this._registrations.push(i)}getRegisteredInstances(e){for(const t of this._registrations)if(t.hasInstanceClassName(e))return t.instances.collection;return[]}dispatch(e,t,s,i){const n=new CustomEvent(e,{detail:t,bubble:!0===s,cancelable:!0===i});this.node.dispatchEvent(n)}listen(e,t,s){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].indexOf(t)>-1||(this._listeners[e].push(t),this.node.addEventListener(e,t,s))}unlisten(e,t){if(e)if(t){if(!this._listeners[e])return;const s=this._listeners[e].indexOf(t);s>-1&&this._listeners[e].splice(s,1),this.node.removeEventListener(e,t)}else{if(!this._listeners[e])return;for(const t of this._listeners[e])this.node.removeEventListener(e,t);this._listeners[e].length=0}else for(const e in this._listeners)this.unlisten(e)}listenKey(e,t,s=!1,i=!1,n="down"){-1===this._keyListenerTypes.indexOf(n)&&(this.listen(`key${n}`,this.handlingKey),this._keyListenerTypes.push(n)),this._keys.push(new X(n,e,t,s,i))}unlistenKey(e,t){this._keys=this._keys.filter((s=>s.code!==e||s.closure!==t)),this._keyListenerTypes.forEach((e=>{this._keys.some((t=>t.type===e))||this.unlisten(`key${e}`,this.handlingKey)}))}handleKey(e){for(const t of this._keys)t.handle(e)}get isRendering(){return this._isRendering}set isRendering(t){this._isRendering!==t&&(t?e.add("render",this):e.remove("render",this),this._isRendering=t)}render(){}request(t){this._nexts.push(t),e.getModule("render").request(this)}next(){const e=this._nexts.slice();this._nexts.length=0;for(const t of e)t&&t()}get isResizing(){return this._isResizing}set isResizing(t){this._isResizing!==t&&(t?(e.add("resize",this),this.resize()):e.remove("resize",this),this._isResizing=t)}resize(){}isBreakpoint(e){return!0==("string"==typeof e)?J[e.toUpperCase()].test():e.test()}get isScrollLocked(){return this._isScrollLocked}set isScrollLocked(t){this._isScrollLocked!==t&&(t?e.add("lock",this):e.remove("lock",this),this._isScrollLocked=t)}get isLoading(){return this._isLoading}set isLoading(t){this._isLoading!==t&&(t?e.add("load",this):e.remove("load",this),this._isLoading=t)}load(){}get isSwappingFont(){return this._isSwappingFont}set isSwappingFont(t){this._isSwappingFont!==t&&(t?e.add("font-swap",this):e.remove("font-swap",this),this._isSwappingFont=t)}swapFont(){}get isMouseMoving(){return this._isMouseMoving}set isMouseMoving(t){this._isMouseMoving!==t&&(t?e.add("mouse-move",this):e.remove("mouse-move",this),this._isMouseMoving=t)}mouseMove(e){}examine(e){this.node.matches(this.registration.selector)?this.mutate(e):this._dispose()}mutate(e){}_dispose(){a.debug(`dispose instance of ${this.registration.instanceClassName} on element [${this.element.id}]`),this.removeAttribute(this.registration.attribute),this.unlisten(),this._keys=null,this.isRendering=!1,this.isResizing=!1,this._nexts=null,e.getModule("render").nexts.remove(this),this.isScrollLocked=!1,this.isLoading=!1,this.isSwappingFont=!1,this._emitter.dispose(),this._emitter=null,this._ascent.dispose(),this._ascent=null,this._descent.dispose(),this._descent=null,this.element.remove(this);for(const t of this._registrations)e.remove("register",t);this._registrations=null,this.registration.remove(this),this.dispose()}dispose(){}emit(e,t){return this.element.emit(e,t)}addEmission(e,t){this._emitter.add(e,t)}removeEmission(e,t){this._emitter.remove(e,t)}ascend(e,t){return this.element.ascend(e,t)}addAscent(e,t){this._ascent.add(e,t)}removeAscent(e,t){this._ascent.remove(e,t)}descend(e,t){return this.element.descend(e,t)}addDescent(e,t){this._descent.add(e,t)}removeDescent(e,t){this._descent.remove(e,t)}get style(){return this.node.style}addClass(e){R(this.node,e)}removeClass(e){P(this.node,e)}hasClass(e){return H(this.node,e)}get classNames(){return M(this.node)}remove(){this.node.parentNode.removeChild(this.node)}setAttribute(e,t){this.node.setAttribute(e,t)}getAttribute(e){return this.node.getAttribute(e)}hasAttribute(e){return this.node.hasAttribute(e)}removeAttribute(e){this.node.removeAttribute(e)}setProperty(e,t){this.node.style.setProperty(e,t)}removeProperty(e){this.node.style.removeProperty(e)}focus(){this.node.focus()}focusClosest(){const e=this._focusClosest(this.node.parentNode);e&&e.focus()}_focusClosest(e){if(!e)return null;const t=[...$(e)];if(t.length<=1)return this._focusClosest(e.parentNode);{const e=t.indexOf(this.node);return t[e+(e<t.length-1?1:-1)]}}get hasFocus(){return this.node===document.activeElement}matches(e){return this.node.matches(e)}querySelector(e){return this.node.querySelector(e)}querySelectorAll(e){return p(this.node,e)}queryParentSelector(e){return m(this.node,e)}getRect(){return this.node.getBoundingClientRect()}get isLegacy(){return e.isLegacy}}class X{constructor(e,t,s,i,n){this.type=e,this.eventType=`key${e}`,this.code=t,this.closure=s,this.preventDefault=!0===i,this.stopPropagation=!0===n}handle(e){e.type===this.eventType&&e.keyCode===this.code&&(this.closure(e),this.preventDefault&&e.preventDefault(),this.stopPropagation&&e.stopPropagation())}}const ee={DISCLOSE:g.event("disclose"),CONCEAL:g.event("conceal")},te={RESET:g.emission("disclosure","reset"),ADDED:g.emission("disclosure","added"),REMOVED:g.emission("disclosure","removed"),GROUP:g.emission("disclosure","group"),UNGROUP:g.emission("disclosure","ungroup")};class se extends Z{constructor(e,t,s,i){super(),this.type=e,this._selector=t,this.DisclosureButtonInstanceClass=s,this.disclosuresGroupInstanceClassName=i,this.modifier=this._selector+"--"+this.type.id,this.pristine=!0}static get instanceClassName(){return"Disclosure"}init(){this.addDescent(te.RESET,this.reset.bind(this)),this.addDescent(te.GROUP,this.update.bind(this)),this.addDescent(te.UNGROUP,this.update.bind(this)),this.register(`[aria-controls="${this.id}"]`,this.DisclosureButtonInstanceClass),this.ascend(te.ADDED),this.update()}get proxy(){const e=this,t=Object.assign(super.proxy,{disclose:e.disclose.bind(e),focus:e.focus.bind(e)});this.type.canConceal&&(t.conceal=e.conceal.bind(e));return F(t,{get buttons(){return e.buttons.map((e=>e.proxy))},get group(){const t=e.group;return t?t.proxy:null}})}get buttons(){return this.getRegisteredInstances(this.DisclosureButtonInstanceClass.instanceClassName)}update(){this.getGroup()}getGroup(){if(!this.disclosuresGroupInstanceClassName)return void(this._group=null);const e=this.element.getAscendantInstance(this.disclosuresGroupInstanceClassName,this.constructor.instanceClassName);e&&e.validate(this)?this._group=e:this._group=null}get group(){return this._group}disclose(e){return!this.disclosed&&(this.pristine=!1,this.disclosed=!0,!e&&this.group&&(this.group.current=this),!0)}conceal(e,t){return!!this.disclosed&&(!(!this.type.canConceal&&this.group&&this.group.current===this)&&(this.pristine=!1,this.disclosed=!1,!e&&this.group&&this.group.current===this&&(this.group.current=null),t||this.focus(),this.descend(te.RESET),!0))}get disclosed(){return this._disclosed}set disclosed(e){if(this._disclosed!==e){this.dispatch(e?ee.DISCLOSE:ee.CONCEAL,this.type),this._disclosed=e,e?this.addClass(this.modifier):this.removeClass(this.modifier);for(let t=0;t<this.buttons.length;t++)this.buttons[t].apply(e)}}reset(){}toggle(e){if(this.type.canConceal)switch(!0){case!e:case this.disclosed:this.conceal();break;default:this.disclose()}else this.disclose()}get buttonHasFocus(){return!!this.buttons.some((e=>e.hasFocus))}get hasFocus(){return!!super.hasFocus||(!!this.buttonHasFocus||this.querySelectorAll(":focus").length>0)}focus(){for(let e=0;e<this.buttons.length;e++){const t=this.buttons[e];if(t.isPrimary)return void t.focus()}}dispose(){this._group=null,super.dispose(),this.ascend(te.REMOVED)}}class ie extends Z{constructor(e){super(),this.type=e,this.attributeName=e.ariaState?"aria-"+e.id:g.attr(e.id)}static get instanceClassName(){return"DisclosureButton"}init(){this.controlsId=this.getAttribute("aria-controls"),this.isPrimary=this.hasAttribute(this.attributeName),this.isPrimary&&this.disclosed&&this.registration.creator.pristine&&this.registration.creator.disclose(),this.listen("click",this.click.bind(this))}get proxy(){return Object.assign(super.proxy,{focus:this.focus.bind(this)})}click(e){this.registration.creator&&this.registration.creator.toggle(this.isPrimary)}mutate(e){this.isPrimary&&e.indexOf(this.attributeName)>-1&&this.registration.creator&&(this.disclosed?this.registration.creator.disclose():this.type.canConceal&&this.registration.creator.conceal())}apply(e){this.isPrimary&&this.setAttribute(this.attributeName,e)}get disclosed(){return"true"===this.getAttribute(this.attributeName)}}class ne extends Z{constructor(e,t){super(t),this.disclosureInstanceClassName=e,this._index=-1}static get instanceClassName(){return"DisclosuresGroup"}init(){this.addAscent(te.ADDED,this.update.bind(this)),this.addAscent(te.REMOVED,this.update.bind(this)),this.descend(te.GROUP),this.update()}get proxy(){const e=this,t={set index(t){e.index=t},get index(){return e.index},get length(){return e.length},get current(){const t=e.current;return t?t.proxy:null},get members(){return e.members.map((e=>e.proxy))},get hasFocus(){return e.hasFocus}};return F(super.proxy,t)}validate(e){return!0}getMembers(){const e=this.element.getDescendantInstances(this.disclosureInstanceClassName,this.constructor.instanceClassName,!0);this._members=e.filter(this.validate.bind(this))}update(){this.getMembers(),this.getIndex()}get members(){return this._members}get length(){return this.members?this.members.length:0}getIndex(){this._index=-1;for(let e=0;e<this.length;e++)this.index>-1?this.members[e].conceal(!0,!0):this.members[e].disclosed&&(this.index=e)}get index(){return this._index}set index(e){if(!(e<-1||e>=this.length||e===this._index)){this._index=e;for(let t=0;t<this.length;t++){const s=this.members[t];e===t?s.disclose(!0):s.conceal(!0,!0)}this.apply()}}get current(){return-1===this._index?null:this.members[this._index]}set current(e){this.index=this.members.indexOf(e)}get hasFocus(){const e=this.current;return!!e&&e.hasFocus}apply(){}dispose(){super.dispose(),this.descend(te.UNGROUP),this._members=null}}const re={EXPAND:{id:"expanded",ariaState:!0,ariaControls:!0,canConceal:!0},SELECT:{id:"selected",ariaState:!0,ariaControls:!0,canConceal:!1},OPENED:{id:"opened",ariaState:!1,ariaControls:!0,canConceal:!0}};class oe extends ie{constructor(){super(re.EXPAND)}static get instanceClassName(){return"CollapseButton"}}const ae={COLLAPSE:g.selector("collapse"),COLLAPSING:g.selector("collapsing")};const ce={CHANGE:g("equisized")};const he={TOGGLE:g.event("toggle")};const le={INJECT_SVG:`[${g.attr("inject-svg")}]`};const de={ARTWORK_USE:`${g.selector("artwork")} use`},ue=["32x9","16x9","3x2","4x3","1x1","3x4","2x3"],ge=(e,t)=>t.map((t=>g.selector(`${e}--${t}`))).join(","),pe=`${g.selector("responsive-img")}, ${ge("responsive-img",ue)}, ${g.selector("responsive-vid")}, ${ge("responsive-vid",["16x9","4x3","1x1"])}`,me={RATIO:`${g.selector("ratio")}, ${ge("ratio",ue)}, ${pe}`},be=window[s];Y.core={Instance:Z,Breakpoints:J,KeyCodes:{TAB:9,ESCAPE:27,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40},Disclosure:se,DisclosureButton:ie,DisclosuresGroup:ne,DisclosureType:re,DisclosureEvent:ee,DisclosureEmission:te,Collapse:class extends se{constructor(){super(re.EXPAND,ae.COLLAPSE,oe,"CollapsesGroup")}static get instanceClassName(){return"Collapse"}init(){super.init(),this.listen("transitionend",this.transitionend.bind(this))}transitionend(e){this.removeClass(ae.COLLAPSING),this.disclosed||(this.isLegacy?this.style.maxHeight="":this.style.removeProperty("--collapse-max-height"))}unbound(){this.isLegacy?this.style.maxHeight="none":this.style.setProperty("--collapse-max-height","none")}disclose(e){this.disclosed||(this.unbound(),this.request((()=>{this.addClass(ae.COLLAPSING),this.adjust(),this.request((()=>{super.disclose(e)}))})))}conceal(e,t){this.disclosed&&this.request((()=>{this.addClass(ae.COLLAPSING),this.adjust(),this.request((()=>{super.conceal(e,t)}))}))}adjust(){this.setProperty("--collapser","none");const e=this.node.offsetHeight;this.setProperty("--collapse",-e+"px"),this.setProperty("--collapser","")}reset(){this.pristine||(this.disclosed=!1)}},CollapseButton:oe,CollapsesGroup:class extends ne{constructor(){super("Collapse")}static get instanceClassName(){return"CollapsesGroup"}},CollapseSelector:ae,RootSelector:{ROOT:":root"},Equisized:class extends Z{static get instanceClassName(){return"Equisized"}init(){this.ascend(ce.CHANGE)}measure(){return this.isLegacy&&(this.style.width="auto"),this.getRect().width}adjust(e){this.isLegacy&&(this.style.width=`${e}px`)}dispose(){this.ascend(ce.CHANGE)}},EquisizedEmission:ce,Toggle:class extends Z{static get instanceClassName(){return"Toggle"}init(){this.pressed="true"===this.pressed,this.listen("click",this.toggle.bind(this))}toggle(){this.pressed="true"!==this.pressed}get pressed(){return this.getAttribute("aria-pressed")}set pressed(e){this.setAttribute("aria-pressed",e?"true":"false"),this.dispatch(he.TOGGLE,e)}get proxy(){const e=this,t=Object.assign(super.proxy,{toggle:e.toggle.bind(e)});return F(t,{get pressed(){return e.pressed},set pressed(t){e.pressed=t}})}},EquisizedsGroup:class extends Z{static get instanceClassName(){return"EquisizedsGroup"}init(){this.isResizing=!0,this.isLoading=!0,this.addAscent(ce.CHANGE,this.resize.bind(this))}load(){this.resize()}resize(){const e=this.element.getDescendantInstances("Equisized");this.isLegacy||this.style.setProperty("--equisized-width","auto");const t=Math.max(...e.map((e=>e.measure())));this.isLegacy?e.forEach((e=>e.adjust(t))):this.style.setProperty("--equisized-width",`${t}px`)}},InjectSvg:class extends Z{static get instanceClassName(){return"InjectSvg"}init(){this.node&&(this.img=this.node.querySelector("img")),this.isLegacy||this.replace()}get proxy(){const e=this;return Object.assign(super.proxy,{replace:e.replace.bind(e),restore:e.restore.bind(e)})}fetch(){this.img&&(this.imgID=this.img.getAttribute("id"),this.imgClass=this.img.getAttribute("class"),this.imgURL=this.img.getAttribute("src"),fetch(this.imgURL).then((e=>e.text())).then((e=>{const t=(new DOMParser).parseFromString(e,"text/html");this.svg=t.querySelector("svg"),this.svg&&this.replace()})))}replace(){if(!this.svg)return void this.fetch();this.imgID&&void 0!==this.imgID&&this.svg.setAttribute("id",this.imgID);let e=this.imgURL.match(/[ \w-]+\./)[0];e&&(e=e.slice(0,-1),["dark","light","system"].includes(e)&&(this.svg.innerHTML=this.svg.innerHTML.replaceAll('id="artwork-',`id="${e}-artwork-`),this.svg.innerHTML=this.svg.innerHTML.replaceAll('"#artwork-',`"#${e}-artwork-`))),this.imgClass&&void 0!==this.imgClass&&this.svg.setAttribute("class",this.imgClass),this.svg.hasAttribute("xmlns:a")&&this.svg.removeAttribute("xmlns:a"),this.node.setAttribute("data-fr-inject-svg",!0);var t,s;t=this.svg,s={"aria-hidden":!0,focusable:!1},Object.keys(s).forEach((e=>t.setAttribute(e,s[e]))),this.node.replaceChild(this.svg,this.img)}restore(){this.img&&this.svg&&(this.node.setAttribute("data-fr-inject-svg",!1),this.node.replaceChild(this.img,this.svg))}},InjectSvgSelector:le,Artwork:class extends Z{static get instanceClassName(){return"Artwork"}init(){this.isLegacy&&this.replace()}get proxy(){return Object.assign(super.proxy,{replace:this.replace.bind(this)})}fetch(){this.xlink=this.node.getAttribute("xlink:href");const e=this.xlink.split("#");this.svgUrl=e[0],this.svgName=e[1];const t=new XMLHttpRequest;t.onload=()=>{const e=(new DOMParser).parseFromString(t.responseText,"text/html");this.realSvgContent=e.getElementById(this.svgName),this.realSvgContent&&(this.realSvgContent.classList.add(this.node.classList),this.replace())},t.open("GET",this.svgUrl),t.send()}replace(){this.realSvgContent?this.node.parentNode.replaceChild(this.realSvgContent,this.node):this.fetch()}},ArtworkSelector:de,Ratio:class extends Z{static get instanceClassName(){return"Ratio"}init(){if(!be.internals.support.supportAspectRatio()){this.ratio=16/9;for(const e in this.classNames)if(this.registration.selector.indexOf(this.classNames[e])>0){const t=this.classNames[e].split("ratio-");t[1]&&(this.ratio=t[1].split("x")[0]/t[1].split("x")[1])}this.isRendering=!0,this.update()}}render(){this.getRect().width!==this.currentWidth&&this.update()}update(){this.currentWidth=this.getRect().width,this.style.height=this.currentWidth/this.ratio+"px"}},RatioSelector:me},Y.internals.register(Y.core.CollapseSelector.COLLAPSE,Y.core.Collapse),Y.internals.register(Y.core.InjectSvgSelector.INJECT_SVG,Y.core.InjectSvg),Y.internals.register(Y.core.RatioSelector.RATIO,Y.core.Ratio);const fe={SYSTEM:"system",LIGHT:"light",DARK:"dark"},_e={THEME:be.internals.ns.attr("theme"),SCHEME:be.internals.ns.attr("scheme"),TRANSITION:be.internals.ns.attr("transition")},Se={LIGHT:"light",DARK:"dark"},Ee={SCHEME:be.internals.ns.emission("scheme","scheme"),THEME:be.internals.ns.emission("scheme","theme"),ASK:be.internals.ns.emission("scheme","ask")},ye={SCHEME:be.internals.ns.event("scheme"),THEME:be.internals.ns.event("theme")};class ve extends be.core.Instance{constructor(){super(!1)}static get instanceClassName(){return"Scheme"}init(){this.changing=this.change.bind(this),this.hasAttribute(_e.TRANSITION)&&(this.removeAttribute(_e.TRANSITION),this.request(this.restoreTransition.bind(this)));const e=be.internals.support.supportLocalStorage()?localStorage.getItem("scheme"):"",t=this.getAttribute(_e.SCHEME);switch(e){case fe.DARK:case fe.LIGHT:case fe.SYSTEM:this.scheme=e;break;default:switch(t){case fe.DARK:this.scheme=fe.DARK;break;case fe.LIGHT:this.scheme=fe.LIGHT;break;default:this.scheme=fe.SYSTEM}}this.addAscent(Ee.ASK,this.ask.bind(this)),this.addAscent(Ee.SCHEME,this.apply.bind(this))}get proxy(){const e=this,t={get scheme(){return e.scheme},set scheme(t){e.scheme=t}};return be.internals.property.completeAssign(super.proxy,t)}restoreTransition(){this.setAttribute(_e.TRANSITION,"")}ask(){this.descend(Ee.SCHEME,this.scheme)}apply(e){this.scheme=e}get scheme(){return this._scheme}set scheme(e){if(this._scheme!==e){switch(this._scheme=e,e){case fe.SYSTEM:this.listenPreferences();break;case fe.DARK:this.unlistenPreferences(),this.theme=Se.DARK;break;case fe.LIGHT:this.unlistenPreferences(),this.theme=Se.LIGHT;break;default:return void(this.scheme=fe.SYSTEM)}this.descend(Ee.SCHEME,e),be.internals.support.supportLocalStorage()&&localStorage.setItem("scheme",e),this.setAttribute(_e.SCHEME,e),this.dispatch(ye.SCHEME,{scheme:this._scheme})}}get theme(){return this._theme}set theme(e){if(this._theme!==e)switch(e){case Se.LIGHT:case Se.DARK:this._theme=e,this.setAttribute(_e.THEME,e),this.descend(Ee.THEME,e),this.dispatch(ye.THEME,{theme:this._theme})}}listenPreferences(){this.isListening||(this.isListening=!0,this.mediaQuery=window.matchMedia("(prefers-color-scheme: dark)"),this.mediaQuery.addEventListener("change",this.changing),this.change())}unlistenPreferences(){this.isListening&&(this.isListening=!1,this.mediaQuery.removeEventListener("change",this.changing),this.mediaQuery=null)}change(){this.isListening&&(this.theme=this.mediaQuery.matches?Se.DARK:Se.LIGHT)}mutate(e){e.indexOf(_e.SCHEME)>-1&&(this.scheme=this.getAttribute(_e.SCHEME)),e.indexOf(_e.THEME)>-1&&(this.theme=this.getAttribute(_e.THEME))}dispose(){this.unlistenPreferences()}}const Ae={SCHEME:`:root${be.internals.ns.attr.selector("theme")}, :root${be.internals.ns.attr.selector("scheme")}`,SWITCH_THEME:be.internals.ns.selector("switch-theme"),RADIO_BUTTONS:`input[name="${be.internals.ns("radios-theme")}"]`};be.scheme={Scheme:ve,SchemeValue:fe,SchemeSelector:Ae,SchemeEmission:Ee,SchemeTheme:Se,SchemeEvent:ye},be.internals.register(be.scheme.SchemeSelector.SCHEME,be.scheme.Scheme);const Ce={GROUP:be.internals.ns.selector("accordions-group"),COLLAPSE:`${be.internals.ns.selector("accordion")} > ${be.internals.ns.selector("collapse")}`};class Te extends be.core.CollapsesGroup{static get instanceClassName(){return"AccordionsGroup"}validate(e){return e.node.matches(Ce.COLLAPSE)}}be.accordion={AccordionSelector:Ce,AccordionsGroup:Te},be.internals.register(be.accordion.AccordionSelector.GROUP,be.accordion.AccordionsGroup);const Le={EQUISIZED_BUTTON:`${be.internals.ns.selector("btns-group--equisized")} ${be.internals.ns.selector("btn")}`,EQUISIZED_GROUP:be.internals.ns.selector("btns-group--equisized")};be.button={ButtonSelector:Le},be.internals.register(be.button.ButtonSelector.EQUISIZED_BUTTON,be.core.Equisized),be.internals.register(be.button.ButtonSelector.EQUISIZED_GROUP,be.core.EquisizedsGroup);class we extends be.core.Instance{constructor(){super(),this.count=0,this.focusing=this.focus.bind(this)}static get instanceClassName(){return"Breadcrumb"}init(){this.getCollapse(),this.isResizing=!0}get proxy(){const e=this;return Object.assign(super.proxy,{focus:e.focus.bind(e),disclose:e.collapse.disclose.bind(e.collapse)})}getCollapse(){const e=this.collapse;e?e.listen(be.core.DisclosureEvent.DISCLOSE,this.focusing):this.addAscent(be.core.DisclosureEmission.ADDED,this.getCollapse.bind(this))}resize(){const e=this.collapse,t=this.links;e&&t.length&&(this.isBreakpoint(be.core.Breakpoints.MD)?e.buttonHasFocus&&t[0].focus():t.indexOf(document.activeElement)>-1&&e.focus())}get links(){return[...this.querySelectorAll("a[href]")]}get collapse(){return this.element.getDescendantInstances(be.core.Collapse.instanceClassName,null,!0)[0]}focus(){this.count=0,this._focus()}_focus(){const e=this.links[0];e&&(e.focus(),this.request(this.verify.bind(this)))}verify(){if(this.count++,this.count>100)return;const e=this.links[0];e&&document.activeElement!==e&&this._focus()}}const Ne={BREADCRUMB:be.internals.ns.selector("breadcrumb")};be.breadcrumb={BreadcrumbSelector:Ne,Breadcrumb:we},be.internals.register(be.breadcrumb.BreadcrumbSelector.BREADCRUMB,be.breadcrumb.Breadcrumb);class xe extends be.core.Instance{static get instanceClassName(){return"ToggleInput"}get isChecked(){return this.hasAttribute("checked")}}class Ie extends be.core.Instance{static get instanceClassName(){return"ToggleStatusLabel"}init(){this.register(`input[id="${this.getAttribute("for")}"]`,xe),this.update(),this.isSwappingFont=!0}get proxy(){return Object.assign(super.proxy,{update:this.update.bind(this)})}get input(){return this.getRegisteredInstances("ToggleInput")[0]}update(){this.node.style.removeProperty("--toggle-status-width");const e=this.input.isChecked,t=getComputedStyle(this.node,":before");let s=parseFloat(t.width);this.input.node.checked=!e;const i=getComputedStyle(this.node,":before"),n=parseFloat(i.width);n>s&&(s=n),this.input.node.checked=e,this.node.style.setProperty("--toggle-status-width",s/16+"rem")}swapFont(e){this.update()}}const Oe={STATUS_LABEL:`${be.internals.ns.selector("toggle__label")}${be.internals.ns.attr.selector("checked-label")}${be.internals.ns.attr.selector("unchecked-label")}`};be.toggle={ToggleStatusLabel:Ie,ToggleSelector:Oe},be.internals.register(be.toggle.ToggleSelector.STATUS_LABEL,be.toggle.ToggleStatusLabel);const De={LIST:be.internals.ns.selector("sidemenu__list"),COLLAPSE:`${be.internals.ns.selector("sidemenu__item")} > ${be.internals.ns.selector("collapse")}`};class Me extends be.core.CollapsesGroup{static get instanceClassName(){return"SidemenuList"}validate(e){return e.node.matches(De.COLLAPSE)}}be.sidemenu={SidemenuList:Me,SidemenuSelector:De},be.internals.register(be.sidemenu.SidemenuSelector.LIST,be.sidemenu.SidemenuList);const ke={MODAL:be.internals.ns.selector("modal"),SCROLL_SHADOW:be.internals.ns.selector("scroll-shadow"),BODY:be.internals.ns.selector("modal__body")};class Re extends be.core.DisclosureButton{constructor(){super(be.core.DisclosureType.OPENED)}static get instanceClassName(){return"ModalButton"}}const Pe={CONCEALING_BACKDROP:be.internals.ns.attr("concealing-backdrop")};class He extends be.core.Disclosure{constructor(){super(be.core.DisclosureType.OPENED,ke.MODAL,Re,"ModalsGroup"),this.scrolling=this.resize.bind(this,!1),this.resizing=this.resize.bind(this,!0)}static get instanceClassName(){return"Modal"}init(){super.init(),this.listen("click",this.click.bind(this)),this.listenKey(be.core.KeyCodes.ESCAPE,this.conceal.bind(this,!1,!1),!0,!0)}get body(){return this.element.getDescendantInstances("ModalBody","Modal")[0]}click(e){e.target===this.node&&"false"!==this.getAttribute(Pe.CONCEALING_BACKDROP)&&this.conceal()}disclose(e){return!!super.disclose(e)&&(this.body&&this.body.activate(),this.isScrollLocked=!0,this.setAttribute("aria-modal","true"),this.setAttribute("open","true"),!0)}conceal(e,t){return!!super.conceal(e,t)&&(this.isScrollLocked=!1,this.removeAttribute("aria-modal"),this.removeAttribute("open"),this.body&&this.body.deactivate(),!0)}}const Ge=['[tabindex="0"]',"a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable="false"])',"details>summary:first-of-type","details","iframe"].join(),$e=['[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'].join(),qe=(e,t)=>{if(!(e instanceof Element))return!1;const s=window.getComputedStyle(e);if(!s)return!1;if("hidden"===s.visibility)return!1;for(void 0===t&&(t=e);t.contains(e);){if("none"===s.display)return!1;e=e.parentElement}return!0};class Be{constructor(e,t){this.element=null,this.activeElement=null,this.onTrap=e,this.onUntrap=t,this.waiting=this.wait.bind(this),this.handling=this.handle.bind(this),this.focusing=this.maintainFocus.bind(this),this.current=null}get trapped(){return null!==this.element}trap(e){this.trapped&&this.untrap(),this.element=e,this.isTrapping=!0,this.wait(),this.onTrap&&this.onTrap()}wait(){qe(this.element)?this.trapping():window.requestAnimationFrame(this.waiting)}trapping(){if(!this.isTrapping)return;this.isTrapping=!1;const e=this.focusables;e.length&&e[0].focus(),this.element.setAttribute("aria-modal",!0),window.addEventListener("keydown",this.handling),document.body.addEventListener("focus",this.focusing,!0)}stun(e){for(const t of e.children)t!==this.element&&(t.contains(this.element)?this.stun(t):this.stunneds.push(new Ue(t)))}maintainFocus(e){if(!this.element.contains(e.target)){const t=this.focusables;if(0===t.length)return;const s=t[0];e.preventDefault(),s.focus()}}handle(e){if(9!==e.keyCode)return;const t=this.focusables;if(0===t.length)return;const s=t[0],i=t[t.length-1],n=t.indexOf(document.activeElement);e.shiftKey?!this.element.contains(document.activeElement)||n<1?(e.preventDefault(),i.focus()):(document.activeElement.tabIndex>0||t[n-1].tabIndex>0)&&(e.preventDefault(),t[n-1].focus()):this.element.contains(document.activeElement)&&n!==t.length-1&&-1!==n?document.activeElement.tabIndex>0&&(e.preventDefault(),t[n+1].focus()):(e.preventDefault(),s.focus())}get focusables(){let e=be.internals.dom.querySelectorAllArray(this.element,Ge);const t=be.internals.dom.querySelectorAllArray(document.documentElement,'input[type="radio"]');if(t.length){const s={};for(const e of t){const t=e.getAttribute("name");void 0===s[t]&&(s[t]=new ze(t)),s[t].push(e)}e=e.filter((e=>{if("input"!==e.tagName.toLowerCase()||"radio"!==e.getAttribute("type").toLowerCase())return!0;const t=e.getAttribute("name");return s[t].keep(e)}))}const s=be.internals.dom.querySelectorAllArray(this.element,$e);s.sort(((e,t)=>e.tabIndex-t.tabIndex));const i=e.filter((e=>-1===s.indexOf(e)));return s.concat(i).filter((e=>"-1"!==e.tabIndex&&qe(e,this.element)))}untrap(){this.trapped&&(this.isTrapping=!1,this.element.removeAttribute("aria-modal"),window.removeEventListener("keydown",this.handling),document.body.removeEventListener("focus",this.focusing,!0),this.element=null,this.onUntrap&&this.onUntrap())}dispose(){this.untrap()}}class Ue{constructor(e){this.element=e,this.inert=e.getAttribute("inert"),this.element.setAttribute("inert","")}unstun(){null===this.inert?this.element.removeAttribute("inert"):this.element.setAttribute("inert",this.inert)}}class ze{constructor(e){this.name=e,this.buttons=[]}push(e){this.buttons.push(e),(e===document.activeElement||e.checked||void 0===this.selected)&&(this.selected=e)}keep(e){return this.selected===e}}class Fe extends be.core.DisclosuresGroup{constructor(){super("Modal",!1),this.focusTrap=new Be}static get instanceClassName(){return"ModalsGroup"}apply(e,t){super.apply(e,t),null===this.current?this.focusTrap.untrap():this.focusTrap.trap(this.current.node)}}class je extends be.core.Instance{static get instanceClassName(){return"ModalBody"}init(){this.listen("scroll",this.shade.bind(this))}activate(){this.isResizing=!0,this.resize()}deactivate(){this.isResizing=!1}shade(){this.node.scrollHeight>this.node.clientHeight?this.node.offsetHeight+this.node.scrollTop>=this.node.scrollHeight?this.removeClass(ke.SCROLL_SHADOW):this.addClass(ke.SCROLL_SHADOW):this.removeClass(ke.SCROLL_SHADOW)}resize(){this.adjust(),this.request(this.adjust.bind(this))}adjust(){const e=32*(this.isBreakpoint(be.core.Breakpoints.MD)?2:1);this.isLegacy?this.style.maxHeight=window.innerHeight-e+"px":this.style.setProperty("--modal-max-height",window.innerHeight-e+"px"),this.shade()}}be.modal={Modal:He,ModalButton:Re,ModalBody:je,ModalsGroup:Fe,ModalSelector:ke},be.internals.register(be.modal.ModalSelector.MODAL,be.modal.Modal),be.internals.register(be.modal.ModalSelector.BODY,be.modal.ModalBody),be.internals.register(be.core.RootSelector.ROOT,be.modal.ModalsGroup);const We={TOGGLE:be.internals.ns.emission("password","toggle"),ADJUST:be.internals.ns.emission("password","adjust")};class Ke extends be.core.Instance{static get instanceClassName(){return"PasswordToggle"}init(){this.listen("click",this.toggle.bind(this)),this.ascend(We.ADJUST,this.width),this.isSwappingFont=!0,this._isChecked=this.isChecked}get width(){const e=getComputedStyle(this.node.parentNode);return parseInt(e.width)}get isChecked(){return this.node.checked}set isChecked(e){this._isChecked=e,this.ascend(We.TOGGLE,e)}toggle(){this.isChecked=!this._isChecked}swapFont(e){this.ascend(We.ADJUST,this.width)}}class Ye extends be.core.Instance{static get instanceClassName(){return"Password"}init(){this.addAscent(We.TOGGLE,this.toggle.bind(this)),this.addAscent(We.ADJUST,this.adjust.bind(this))}toggle(e){this.descend(We.TOGGLE,e)}adjust(e){this.descend(We.ADJUST,e)}}const Ve={PASSWORD:be.internals.ns.selector("password"),INPUT:be.internals.ns.selector("password__input"),LABEL:be.internals.ns.selector("password__label"),TOOGLE:`${be.internals.ns.selector("password__checkbox")} input[type="checkbox"]`};class Qe extends be.core.Instance{static get instanceClassName(){return"PasswordInput"}init(){this.addDescent(We.TOGGLE,this.toggle.bind(this)),this._isRevealed="password"===this.hasAttribute("type"),this.listen("keydown",this.capslock.bind(this)),this.listen("keyup",this.capslock.bind(this))}toggle(e){this.isRevealed=e,this.setAttribute("type",e?"text":"password")}get isRevealed(){return this._isRevealed}capslock(e){e.getModifierState("CapsLock")?this.node.parentNode.setAttribute(be.internals.ns.attr("capslock"),""):this.node.parentNode.removeAttribute(be.internals.ns.attr("capslock"))}set isRevealed(e){this._isRevealed=e,this.setAttribute("type",e?"text":"password")}}class Je extends be.core.Instance{static get instanceClassName(){return"PasswordLabel"}init(){this.addDescent(We.ADJUST,this.adjust.bind(this))}adjust(e){const t=Math.ceil(e/16);this.node.style.paddingRight=t+"rem"}}be.password={Password:Ye,PasswordToggle:Ke,PasswordSelector:Ve,PasswordInput:Qe,PasswordLabel:Je},be.internals.register(be.password.PasswordSelector.INPUT,be.password.PasswordInput),be.internals.register(be.password.PasswordSelector.PASSWORD,be.password.Password),be.internals.register(be.password.PasswordSelector.TOOGLE,be.password.PasswordToggle),be.int