@codegouvfr/react-dsfr
Version:
French State Design System React integration library
2 lines • 90.2 kB
JavaScript
/*! DSFR v1.10.2 | 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="@gouvfr",n="1.10.2";class r{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 o(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 o{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 a={log:new r(0,"#616161","#989898"),debug:new r(1,"#000091","#8B8BFF"),info:new r(2,"#007c3b","#00ed70"),warn:new r(3,"#ba4500","#fa5c00","warn"),error:new r(4,"#D80600","#FF4641","error")};const h=new class{constructor(){this.level=2;for(const e in a){const t=a[e];this[e]=(...e)=>{this.level<=t.level&&t.log.apply(t,e)},this[e].print=t.print.bind(t)}}state(){const t=new o;t.add(e),this.log.print(t)}tree(){const t=e.getModule("stage");if(!t)return;const s=new o;this._branch(t.root,0,s),this.log.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)},l={AUTO:"auto",MANUAL:"manual",RUNTIME:"runtime",LOADED:"loaded",VUE:"vue",ANGULAR:"angular",REACT:"react"};const d=new class{constructor(){this._mode=l.AUTO,this.isStarted=!1,this.starting=this.start.bind(this),this.preventManipulation=!1}configure(e={},t,s){this.startCallback=t;const i=e.production&&(!s||"false"!==s.production);switch(!0){case s&&!isNaN(s.level):h.level=Number(s.level);break;case s&&s.verbose&&("true"===s.verbose||1===s.verbose):h.level=0;break;case i:h.level=999;break;case e.verbose:h.level=0}h.info(`version ${n}`),this.mode=e.mode||l.AUTO}set mode(e){switch(e){case l.AUTO:this.preventManipulation=!1,t=this.starting,c(t);break;case l.LOADED:this.preventManipulation=!1,c(this.starting);break;case l.RUNTIME:this.preventManipulation=!1,this.start();break;case l.MANUAL:this.preventManipulation=!1;break;case l.VUE:case l.ANGULAR:case l.REACT:this.preventManipulation=!0;break;default:return void h.error("Illegal mode")}var t;this._mode=e,h.info(`mode set to ${e}`)}get mode(){return this._mode}start(){h.info("start"),this.startCallback()}};class u{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 u;return e._collection=this._collection.slice(),e}get collection(){return this._collection}}class g extends u{constructor(e){super(),this.type=e,this.isActive=!1}activate(){}deactivate(){}}const m=e=>`${t}-${e}`;m.selector=(e,t)=>(void 0===t&&(t="."),`${t}${m(e)}`),(m.attr=e=>`data-${m(e)}`).selector=(e,t)=>{let s=m.attr(e);return void 0!==t&&(s+=`="${t}"`),`[${s}]`},m.event=e=>`${s}.${e}`,m.emission=(e,t)=>`emission:${e}.${t}`;const p=(e,t)=>Array.prototype.slice.call(e.querySelectorAll(t)),b=(e,t)=>{const s=e.parentElement;return s.matches(t)?s:s===document.documentElement?null:b(s,t)};class _{constructor(e,t,s){this.selector=e,this.InstanceClass=t,this.creator=s,this.instances=new u,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=m.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 g{constructor(){super("register")}register(t,s,i){const n=new _(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 E=0;class T{constructor(e,t){t?this.id=t:(E++,this.id=E),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;h.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(let e=this.instances.length-1;e>=0;e--){const t=this.instances[e];t&&t._dispose()}this.instances.length=0,e.remove("stage",this),this.parent.removeChild(this),this._children.length=0,h.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)}}const A={CLICK:m.emission("root","click"),KEYDOWN:m.emission("root","keydown"),KEYUP:m.emission("root","keyup")},S={TAB:{id:"tab",value:9},ESCAPE:{id:"escape",value:27},END:{id:"end",value:35},HOME:{id:"home",value:36},LEFT:{id:"left",value:37},UP:{id:"up",value:38},RIGHT:{id:"right",value:39},DOWN:{id:"down",value:40}},v=e=>Object.values(S).filter((t=>t.value===e))[0];class y extends T{constructor(){super(document.documentElement,"root"),this.node.setAttribute(m.attr("js"),!0),this.listen()}listen(){document.documentElement.addEventListener("click",this.click.bind(this),{capture:!0}),document.documentElement.addEventListener("keydown",this.keydown.bind(this),{capture:!0}),document.documentElement.addEventListener("keyup",this.keyup.bind(this),{capture:!0})}click(e){this.emit(A.CLICK,e.target)}keydown(e){this.emit(A.KEYDOWN,v(e.keyCode))}keyup(e){this.emit(A.KEYUP,v(e.keyCode))}}class C extends g{constructor(){super("stage"),this.root=new y,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 T(e);return this.add(t),h.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 D extends g{constructor(){super("render"),this.rendering=this.render.bind(this),this.nexts=new u}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 w extends g{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 L extends g{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(){if(!this._isLocked){this._isLocked=!0,this._scrollY=window.scrollY;const e=window.innerWidth-document.documentElement.clientWidth;document.documentElement.setAttribute(m.attr("scrolling"),"false"),document.body.style.top=-this._scrollY+"px",this.behavior=getComputedStyle(document.documentElement).getPropertyValue("scroll-behavior"),"smooth"===this.behavior&&(document.documentElement.style.scrollBehavior="auto"),e>0&&document.documentElement.style.setProperty("--scrollbar-width",`${e}px`)}}unlock(){this._isLocked&&(this._isLocked=!1,document.documentElement.removeAttribute(m.attr("scrolling")),document.body.style.top="",window.scrollTo(0,this._scrollY),"smooth"===this.behavior&&document.documentElement.style.removeProperty("scroll-behavior"),document.documentElement.style.removeProperty("--scrollbar-width"))}move(e){this._isLocked?(this._scrollY+=e,document.body.style.top=-this._scrollY+"px"):window.scrollTo(0,window.scrollY+e)}}class N extends g{constructor(){super("load"),this.loading=this.load.bind(this)}activate(){window.addEventListener("load",this.loading)}load(){this.forEach((e=>e.load()))}}const O=["Marianne","Spectral"];class I extends g{constructor(){super("font-swap"),this.swapping=this.swap.bind(this)}activate(){document.fonts&&document.fonts.addEventListener("loadingdone",this.swapping)}swap(){const e=O.filter((e=>document.fonts.check(`16px ${e}`)));this.forEach((t=>t.swapFont(e)))}}class R extends g{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)}}class x extends g{constructor(){super("hash"),this.handling=this.handle.bind(this),this.getLocationHash()}activate(){window.addEventListener("hashchange",this.handling)}deactivate(){window.removeEventListener("hashchange",this.handling)}_sanitize(e){return"#"===e.charAt(0)?e.substring(1):e}set hash(e){const t=this._sanitize(e);this._hash!==t&&(window.location.hash=t)}get hash(){return this._hash}getLocationHash(){const e=window.location.hash;this._hash=this._sanitize(e)}handle(e){this.getLocationHash(),this.forEach((t=>t.handleHash(this._hash,e)))}}const k=new class{constructor(){e.create(f),e.create(C),e.create(D),e.create(w),e.create(L),e.create(N),e.create(I),e.create(R),e.create(x);const t=e.getModule("register");this.register=t.register.bind(t)}get isActive(){return e.isActive}start(){h.debug("START"),e.isActive=!0}stop(){h.debug("STOP"),e.isActive=!1}};const P=e=>{switch(!0){case e.hover:return"-hover";case e.active:return"-active";default:return""}},M=new class{getColor(e,t,s,i={}){const n=`--${e}-${t}-${s}${P(i)}`;return getComputedStyle(document.documentElement).getPropertyValue(n).trim()||null}},H=e=>"."===e.charAt(0)?e.substr(1):e,$=e=>e.className?e.className.split(" "):[],G=(e,t,s)=>{t=H(t);const i=$(e),n=i.indexOf(t);!0===s?n>-1&&i.splice(n,1):-1===n&&i.push(t),e.className=i.join(" ")},B=(e,t)=>G(e,t),U=(e,t)=>G(e,t,!0),q=(e,t)=>$(e).indexOf(H(t))>-1,F=['[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(),z=e=>e.querySelectorAll(F);let j=0;const W=e=>{if(!document.getElementById(e))return e;let t=!0;const s=e;for(;t;)j++,e=`${s}-${j}`,t=document.getElementById(e);return e},K={};K.addClass=B,K.hasClass=q,K.removeClass=U,K.queryParentSelector=b,K.querySelectorAllArray=p,K.queryActions=z,K.uniqueId=W;const Y={supportLocalStorage:()=>{try{return"localStorage"in window&&null!==window.localStorage}catch(e){return!1}},supportAspectRatio:()=>!!window.CSS&&CSS.supports("aspect-ratio: 16 / 9")},V={NONE:m.selector("transition-none")},Q={};Q.TransitionSelector=V;const J=(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),X={};X.completeAssign=J;const Z={},ee={};Object.defineProperty(ee,"isLegacy",{get:()=>e.isLegacy}),ee.setLegacy=()=>{e.isLegacy=!0},Z.legacy=ee,Z.dom=K,Z.support=Y,Z.motion=Q,Z.property=X,Z.ns=m,Z.register=k.register,Z.state=e,Z.query=(e=>{if(e&&e.search){const e=new URLSearchParams(window.location.search).entries();return Object.fromEntries(e)}return null})(window.location),Object.defineProperty(Z,"preventManipulation",{get:()=>d.preventManipulation}),Object.defineProperty(Z,"stage",{get:()=>e.getModule("stage")});const te=t=>e.getModule("stage").getProxy(t);te.version=n,te.prefix=t,te.organisation=i,te.Modes=l,Object.defineProperty(te,"mode",{set:e=>{d.mode=e},get:()=>d.mode}),te.internals=Z,te.version=n,te.start=k.start,te.stop=k.stop,te.inspector=h,te.colors=M;const se=window[s];te.internals.configuration=se,d.configure(se,te.start,te.internals.query),window[s]=te;class ie{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 ne{constructor(e,t){this.id=e,this.minWidth=t}test(){return window.matchMedia(`(min-width: ${this.minWidth}em)`).matches}}const re={XS:new ne("xs",0),SM:new ne("sm",36),MD:new ne("md",48),LG:new ne("lg",62),XL:new ne("xl",78)};class oe{constructor(e=!0){this.jsAttribute=e,this._isRendering=!1,this._isResizing=!1,this._isScrollLocked=!1,this._isLoading=!1,this._isSwappingFont=!1,this._isEnabled=!0,this._isDisposed=!1,this._listeners={},this.handlingClick=this.handleClick.bind(this),this._hashes=[],this._hash="",this._keyListenerTypes=[],this._keys=[],this.handlingKey=this.handleKey.bind(this),this._emitter=new ie,this._ascent=new ie,this._descent=new ie,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 J({render:()=>e.render(),resize:()=>e.resize()},{get node(){return this.node},get isEnabled(){return e.isEnabled},set isEnabled(t){e.isEnabled=t}})}log(...e){e.unshift(`${this.registration.instanceClassName} #${this.id} - `),h.log.apply(h,e)}debug(...e){e.unshift(`${this.registration.instanceClassName} #${this.id} - `),h.debug.apply(h,e)}info(...e){e.unshift(`${this.registration.instanceClassName} #${this.id} - `),h.info.apply(h,e)}warn(...e){e.unshift(`${this.registration.instanceClassName} #${this.id} - `),h.warn.apply(h,e)}error(...e){e.unshift(`${this.registration.instanceClassName} #${this.id} - `),h.error.apply(h,e)}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]=[]);const i=this._listeners[e],n=new he(this.node,e,t,s);i.push(n),n.listen()}unlisten(e,t,s){if(!e){for(const e in this._listeners)this.unlisten(e);return}const i=this._listeners[e];if(!i)return;if(!t)return void i.forEach((t=>this.unlisten(e,t.closure)));const n=i.filter((e=>e.closure===t&&e.matchOptions(s)));n.forEach((e=>e.unlisten())),this._listeners[e]=i.filter((e=>-1===n.indexOf(e)))}listenClick(e){this.listen("click",this.handlingClick,e)}unlistenClick(e){this.unlisten("click",this.handlingClick,e)}handleClick(e){}set hash(t){e.getModule("hash").hash=t}get hash(){return e.getModule("hash").hash}listenHash(t,s){0===this._hashes.length&&e.add("hash",this);const i=new ce(t,s);this._hashes=this._hashes.filter((e=>e.hash!==t)),this._hashes.push(i)}unlistenHash(t){this._hashes=this._hashes.filter((e=>e.hash!==t)),0===this._hashes.length&&e.remove("hash",this)}handleHash(e,t){for(const s of this._hashes)s.handle(e,t)}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 ae(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 isEnabled(){return this._isEnabled}set isEnabled(e){this._isEnabled=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)?re[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){}retrieveNodeId(e,t){if(e.id)return e.id;const s=W(`${this.id}-${t}`);return this.warn(`add id '${s}' to ${t}`),e.setAttribute("id",s),s}get isDisposed(){return this._isDisposed}_dispose(){this.debug(`dispose instance of ${this.registration.instanceClassName} on element [${this.element.id}]`),this.removeAttribute(this.registration.attribute),this.unlisten(),this._hashes=null,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._isDisposed=!0,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){B(this.node,e)}removeClass(e){U(this.node,e)}hasClass(e){return q(this.node,e)}get classNames(){return $(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()}blur(){this.node.blur()}focusClosest(){const e=this._focusClosest(this.node.parentNode);e&&e.focus()}_focusClosest(e){if(!e)return null;const t=[...z(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}scrollIntoView(){const t=this.getRect(),s=e.getModule("lock");t.top<0&&s.move(t.top-50),t.bottom>window.innerHeight&&s.move(t.bottom-window.innerHeight+50)}matches(e){return this.node.matches(e)}querySelector(e){return this.node.querySelector(e)}querySelectorAll(e){return p(this.node,e)}queryParentSelector(e){return b(this.node,e)}getRect(){const e=this.node.getBoundingClientRect();return e.center=e.left+.5*e.width,e.middle=e.top+.5*e.height,e}get isLegacy(){return e.isLegacy}}class ae{constructor(e,t,s,i,n){this.type=e,this.eventType=`key${e}`,this.keyCode=t,this.closure=s,this.preventDefault=!0===i,this.stopPropagation=!0===n}handle(e){e.type===this.eventType&&e.keyCode===this.keyCode.value&&(this.closure(e),this.preventDefault&&e.preventDefault(),this.stopPropagation&&e.stopPropagation())}}class he{constructor(e,t,s,i){this._node=e,this._type=t,this._closure=s,this._options=i}get closure(){return this._closure}listen(){this._node.addEventListener(this._type,this._closure,this._options)}matchOptions(e=null){switch(!0){case null===e:case"boolean"==typeof this._options&&"boolean"==typeof e&&this._options===e:return!0;case Object.keys(this._options).length!==Object.keys(e).length:return!1;case Object.keys(e).every((t=>this._options[t]===e[t])):return!0}return!1}unlisten(){this._node.removeEventListener(this._type,this._closure,this._options)}}class ce{constructor(e,t){this.hash=e,this.add=t}handle(e,t){this.hash===e&&this.add(t)}}const le={DISCLOSE:m.event("disclose"),CONCEAL:m.event("conceal")},de={RESET:m.emission("disclosure","reset"),ADDED:m.emission("disclosure","added"),RETRIEVE:m.emission("disclosure","retrieve"),REMOVED:m.emission("disclosure","removed"),GROUP:m.emission("disclosure","group"),UNGROUP:m.emission("disclosure","ungroup"),SPOTLIGHT:m.emission("disclosure","spotlight")};class ue extends oe{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._isPristine=!0,this._isRetrievingPrimaries=!1,this._hasRetrieved=!1,this._primaryButtons=[]}static get instanceClassName(){return"Disclosure"}init(){this.addDescent(de.RESET,this.reset.bind(this)),this.addDescent(de.GROUP,this.update.bind(this)),this.addDescent(de.UNGROUP,this.update.bind(this)),this.addAscent(de.SPOTLIGHT,this.disclose.bind(this)),this.register(`[aria-controls="${this.id}"]`,this.DisclosureButtonInstanceClass),this.ascend(de.ADDED),this.listenHash(this.id,this._spotlight.bind(this)),this.update()}get isEnabled(){return super.isEnabled}set isEnabled(e){this.isEnabled!==e&&(super.isEnabled=e,e?this.ascend(de.ADDED):this.ascend(de.REMOVED))}get isPristine(){return this._isPristine}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 J(t,{get buttons(){return e.buttons.map((e=>e.proxy))},get group(){const t=e.group;return t?t.proxy:null},get isDisclosed(){return e.isDisclosed}})}get buttons(){return this.getRegisteredInstances(this.DisclosureButtonInstanceClass.instanceClassName)}update(){this.getGroup(),this.retrievePrimaries()}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!(!0===this.isDisclosed||!this.isEnabled)&&(this._isPristine=!1,this.isDisclosed=!0,!e&&this.group&&(this.group.current=this),!0)}conceal(e,t=!0){return!1!==this.isDisclosed&&(!(!this.type.canConceal&&this.group&&this.group.current===this)&&(this.isDisclosed=!1,!e&&this.group&&this.group.current===this&&(this.group.current=null),t||this.focus(),this._isPristine||this.descend(de.RESET),!0))}get isDisclosed(){return this._isDisclosed}set isDisclosed(e){if(this._isDisclosed!==e&&(this.isEnabled||!0!==e)){this.dispatch(e?le.DISCLOSE:le.CONCEAL,this.type),this._isDisclosed=e,e?this.addClass(this.modifier):this.removeClass(this.modifier);for(let t=0;t<this.buttons.length;t++)this.buttons[t].apply(e)}}get isInitiallyDisclosed(){return this.primaryButtons.some((e=>e.isInitiallyDisclosed))}hasRetrieved(){return this._hasRetrieved}reset(){}toggle(e){if(this.type.canConceal)switch(!0){case!e:case this.isDisclosed:this.conceal(!1,!1);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(){this._primaryButtons.length>0&&this._primaryButtons[0].focus()}get primaryButtons(){return this._primaryButtons}retrievePrimaries(){this._isRetrievingPrimaries||(this._isRetrievingPrimaries=!0,this.request(this._retrievePrimaries.bind(this)))}_retrievePrimaries(){if(this._isRetrievingPrimaries=!1,this._primaryButtons=this._electPrimaries(this.buttons),!this._hasRetrieved&&0!==this._primaryButtons.length)if(this.retrieved(),this._hasRetrieved=!0,this.applyAbility(!0),this.group)this.group.retrieve();else if(this._isPristine&&this.isEnabled&&!this.group)switch(!0){case this.hash===this.id:this._spotlight();break;case this.isInitiallyDisclosed:this.disclose()}}retrieved(){}_spotlight(){this.disclose(),this.request((()=>{this.ascend(de.SPOTLIGHT)}))}_electPrimaries(e){return e.filter((e=>e.canDisclose&&!this.node.contains(e.node)))}applyAbility(e=!1){const t=!this._primaryButtons.every((e=>e.isDisabled));this.isEnabled!==t&&(this.isEnabled=t,e||(!this.isEnabled&&this.isDisclosed&&(this.group?this.ascend(de.REMOVED):this.type.canConceal&&this.conceal()),this.isEnabled&&(this.group&&this.ascend(de.ADDED),this.hash===this.id&&this._spotlight())))}dispose(){this._group=null,this._primaryButtons=null,super.dispose(),this.ascend(de.REMOVED)}}class ge extends oe{constructor(e){super(),this.type=e,this.attributeName=e.ariaState?"aria-"+e.id:m.attr(e.id),this._canDisclose=!1}static get instanceClassName(){return"DisclosureButton"}get isPrimary(){return this.registration.creator.primaryButtons.includes(this)}get canDisclose(){return this._canDisclose}get isDisabled(){return this.type.canDisable&&this.hasAttribute("disabled")}init(){this._canDisclose=this.hasAttribute(this.attributeName),this._isInitiallyDisclosed=this.isDisclosed,this._isContained=this.registration.creator.node.contains(this.node),this.controlsId=this.getAttribute("aria-controls"),this.registration.creator.retrievePrimaries(),this.listenClick()}get proxy(){return Object.assign(super.proxy,{focus:this.focus.bind(this)})}handleClick(e){this.registration.creator&&this.registration.creator.toggle(this.canDisclose)}mutate(e){this._canDisclose=this.hasAttribute(this.attributeName),this.registration.creator.applyAbility(),!this._isApplying&&this.isPrimary&&e.indexOf(this.attributeName)>-1&&this.registration.creator&&(this.isDisclosed?this.registration.creator.disclose():this.type.canConceal&&this.registration.creator.conceal())}apply(e){this.canDisclose&&(this._isApplying=!0,this.setAttribute(this.attributeName,e),this.request((()=>{this._isApplying=!1})))}get isDisclosed(){return"true"===this.getAttribute(this.attributeName)}get isInitiallyDisclosed(){return this._isInitiallyDisclosed}focus(){super.focus(),this.scrollIntoView()}measure(e){const t=this.rect;this._dx=e.x-t.x,this._dy=e.y-t.y}get dx(){return this._dx}get dy(){return this._dy}}class me extends oe{constructor(e,t){super(t),this.disclosureInstanceClassName=e,this._members=[],this._index=-1,this._isRetrieving=!1,this._hasRetrieved=!1}static get instanceClassName(){return"DisclosuresGroup"}init(){this.addAscent(de.ADDED,this.update.bind(this)),this.addAscent(de.RETRIEVE,this.retrieve.bind(this)),this.addAscent(de.REMOVED,this.update.bind(this)),this.descend(de.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 J(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)).filter((e=>e.isEnabled));e.filter((e=>!this._members.includes(e))).forEach((e=>e.conceal()))}retrieve(e=!1){this._isRetrieving||this._hasRetrieved&&!e||(this._isRetrieving=!0,this.request(this._retrieve.bind(this)))}_retrieve(){if(this.getMembers(),this._isRetrieving=!1,this._hasRetrieved=!0,this.hash)for(let e=0;e<this.length;e++){const t=this.members[e];if(this.hash===t.id)return this.index=e,this.request((()=>{this.ascend(de.SPOTLIGHT)})),e}for(let e=0;e<this.length;e++){if(this.members[e].isInitiallyDisclosed)return this.index=e,e}return this.getIndex()}update(){this.getMembers(),this._hasRetrieved&&this.getIndex()}get members(){return this._members}get length(){return this.members?this.members.length:0}getIndex(e=-1){this._index=void 0;let t=e;for(let e=0;e<this.length;e++)if(this.members[e].isDisclosed){t=e;break}return this.index=t,t}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.isDisclosed||s.disclose(!0):s.isDisclosed&&s.conceal(!0)}this.apply()}}get current(){return-1===this._index||isNaN(this._index)?null:this._members[this._index]||null}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(de.UNGROUP),this._members=null}}const pe={EXPAND:{id:"expanded",ariaState:!0,ariaControls:!0,canConceal:!0,canDisable:!0},SELECT:{id:"selected",ariaState:!0,ariaControls:!0,canConceal:!1,canDisable:!0},OPENED:{id:"opened",ariaState:!1,ariaControls:!0,canConceal:!0,canDisable:!1}},be={PREVENT_CONCEAL:m.attr.selector("prevent-conceal")};class _e extends ge{constructor(){super(pe.EXPAND)}static get instanceClassName(){return"CollapseButton"}}const fe={COLLAPSE:m.selector("collapse"),COLLAPSING:m.selector("collapsing")};const Ee={CHANGE:m("equisized")};const Te={TOGGLE:m.event("toggle")};const Ae={INJECT_SVG:`[${m.attr("inject-svg")}]`};const Se={ARTWORK_USE:`${m.selector("artwork")} use`},ve={ASSESS_FILE:`${m.attr.selector("assess-file")}`,DETAIL:`${m.attr.selector("assess-file")} [class$="__detail"], ${m.attr.selector("assess-file")} [class*="__detail "]`},ye={UPDATE:m.emission("assess","update"),ADDED:m.emission("assess","added")};const Ce=["32x9","16x9","3x2","4x3","1x1","3x4","2x3"],De=(e,t)=>t.map((t=>m.selector(`${e}--${t}`))).join(","),we=`${m.selector("responsive-img")}, ${De("responsive-img",Ce)}, ${m.selector("responsive-vid")}, ${De("responsive-vid",["16x9","4x3","1x1"])}`,Le={RATIO:`${m.selector("ratio")}, ${De("ratio",Ce)}, ${we}`},Ne=window[s];const Oe={TOP:m.selector("placement--top"),RIGHT:m.selector("placement--right"),BOTTOM:m.selector("placement--bottom"),LEFT:m.selector("placement--left")},Ie={START:m.selector("placement--start"),CENTER:m.selector("placement--center"),END:m.selector("placement--end")},Re={TOP:"place_top",RIGHT:"place_right",BOTTOM:"place_bottom",LEFT:"place_left"},xe={START:"align_start",CENTER:"align_center",END:"align_end"},ke={AUTO:"placement_auto",MANUAL:"placement_manual"};te.core={Instance:oe,Breakpoints:re,KeyCodes:S,Disclosure:ue,DisclosureButton:ge,DisclosuresGroup:me,DisclosureType:pe,DisclosureEvent:le,DisclosureSelector:be,DisclosureEmission:de,Collapse:class extends ue{constructor(){super(pe.EXPAND,fe.COLLAPSE,_e,"CollapsesGroup")}static get instanceClassName(){return"Collapse"}init(){super.init(),this.listen("transitionend",this.transitionend.bind(this))}transitionend(e){this.removeClass(fe.COLLAPSING),this.isDisclosed||(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){if(!0===this.isDisclosed||!this.isEnabled)return!1;this.unbound(),this.request((()=>{this.addClass(fe.COLLAPSING),this.adjust(),this.request((()=>{super.disclose(e)}))}))}conceal(e,t){if(!1===this.isDisclosed)return!1;this.request((()=>{this.addClass(fe.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.isPristine||(this.isDisclosed=!1)}_electPrimaries(e){const t=this.element.parent.instances.map((e=>e.collapsePrimary)).filter((t=>void 0!==t&&e.indexOf(t)>-1));if(1===t.length)return t;if(1===(e=super._electPrimaries(e)).length)return e;const s=e.filter((e=>e.dy>=0));if(s.length>0&&(e=s),1===e.length)return e;const i=Math.min(...e.map((e=>e.dy))),n=e.filter((e=>e.dy===i));return n.length>0&&(e=n),1===e.length||e.sort(((e,t)=>Math.abs(t.dx)-Math.abs(e.dx))),e}},CollapseButton:_e,CollapsesGroup:class extends me{constructor(){super("Collapse")}static get instanceClassName(){return"CollapsesGroup"}},CollapseSelector:fe,RootSelector:{ROOT:":root"},RootEmission:A,Equisized:class extends oe{static get instanceClassName(){return"Equisized"}init(){this.ascend(Ee.CHANGE)}measure(){return this.isLegacy&&(this.style.width="auto"),this.getRect().width}adjust(e){this.isLegacy&&(this.style.width=`${e}px`)}dispose(){this.ascend(Ee.CHANGE)}},EquisizedEmission:Ee,Toggle:class extends oe{static get instanceClassName(){return"Toggle"}init(){this.pressed="true"===this.pressed,this.listenClick()}handleClick(){this.toggle()}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(Te.TOGGLE,e)}get proxy(){const e=this,t=Object.assign(super.proxy,{toggle:e.toggle.bind(e)});return J(t,{get pressed(){return e.pressed},set pressed(t){e.pressed=t}})}},EquisizedsGroup:class extends oe{static get instanceClassName(){return"EquisizedsGroup"}init(){this.isResizing=!0,this.isLoading=!0,this.addAscent(Ee.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 oe{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:Ae,Artwork:class extends oe{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("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:Se,AssessFile:class extends oe{static get instanceClassName(){return"AssessFile"}init(){this.lang=this.getLang(this.node),this.href=this.getAttribute("href"),this.hreflang=this.getAttribute("hreflang"),this.file={},this.gather(),this.addAscent(ye.ADDED,this.update.bind(this)),this.addDescent(ye.ADDED,this.update.bind(this))}getFileLength(){void 0!==this.href?fetch(this.href,{method:"HEAD",mode:"cors"}).then((e=>{this.length=e.headers.get("content-length")||-1,-1===this.length&&h.warn("File size unknown: "+this.href+'\nUnable to get HTTP header: "content-length"'),this.gather()})):this.length=-1}mutate(e){-1!==e.indexOf("href")&&(this.href=this.getAttribute("href"),this.getFileLength()),-1!==e.indexOf("hreflang")&&(this.hreflang=this.getAttribute("hreflang"),this.gather())}gather(){if(this.isLegacy&&(this.length=-1),this.length){if(this.details=[],this.href){const e=this.parseExtension(this.href);e&&this.details.push(e.toUpperCase())}-1!==this.length&&this.details.push(this.bytesToSize(this.length)),this.hreflang&&this.details.push(this.getLangDisplayName(this.hreflang)),this.update()}else this.getFileLength()}update(){this.details&&(this.descend(ye.UPDATE,this.details),this.ascend(ye.UPDATE,this.details))}getLang(e){return e.lang?e.lang:document.documentElement===e?window.navigator.language:this.getLang(e.parentElement)}parseExtension(e){return e.match(/\.(\w{1,9})(?:$|[?#])/)[0].replace(".","")}getLangDisplayName(e){if(this.isLegacy)return e;const t=new Intl.DisplayNames([this.lang],{type:"language"}).of(e);return t.charAt(0).toUpperCase()+t.slice(1)}bytesToSize(e){if(-1===e)return null;let t=["octets","ko","Mo","Go","To"];"bytes"===this.getAttribute(m.attr("assess-file"))&&(t=["bytes","KB","MB","GB","TB"]);const s=parseInt(Math.floor(Math.log(e)/Math.log(1e3)),10);if(0===s)return`${e} ${t[s]}`;const i=e/1e3**s,n=Math.round(100*(i+Number.EPSILON))/100;return`${String(n).replace(".",",")} ${t[s]}`}},AssessDetail:class extends oe{static get instanceClassName(){return"AssessDetail"}init(){this.addDescent(ye.UPDATE,this.update.bind(this)),this.ascend(ye.ADDED)}update(e){this.node.innerHTML=e.join(" - ")}},AssessEmission:ye,AssessSelector:ve,Ratio:class extends oe{static get instanceClassName(){return"Ratio"}init(){if(!Ne.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:Le,Placement:class extends oe{constructor(e=ke.AUTO,t=[Re.BOTTOM,Re.TOP,Re.LEFT,Re.RIGHT],s=[xe.CENTER,xe.START,xe.END],i=16){super(),this._mode=e,this._places=t,this._aligns=s,this._safeAreaMargin=i,this._isShown=!1}static get instanceClassName(){return"Placement"}init(){this.isResizing=!0}get proxy(){const e=this,t=Object.assign(super.proxy,{show:e.show.bind(e),hide:e.hide.bind(e)});return J(t,{get mode(){return e.mode},set mode(t){e.mode=t},get place(){return e.place},set place(t){e.place=t},get align(){return e.align},set align(t){e.align=t},get isShown(){return e.isShown},set isShown(t){e.isShown=t}})}get mode(){return this._mode}set mode(e){this._mode=e}get place(){return this._place}set place(e){if(this._place!==e){switch(this._place){case Re.TOP:this.removeClass(Oe.TOP);break;case Re.RIGHT:this.removeClass(Oe.RIGHT);break;case Re.BOTTOM:this.removeClass(Oe.BOTTOM);break;case Re.LEFT:this.removeClass(Oe.LEFT)}switch(this._place=e,this._place){case Re.TOP:this.addClass(Oe.TOP);break;case Re.RIGHT:this.addClass(Oe.RIGHT);break;case Re.BOTTOM:this.addClass(Oe.BOTTOM);break;case Re.LEFT:this.addClass(Oe.LEFT)}}}get align(){return this._align}set align(e){if(this._align!==e){switch(this._align){case xe.START:this.removeClass(Ie.START);break;case xe.CENTER:this.removeClass(Ie.CENTER);break;case xe.END:this.removeClass(Ie.END)}switch(this._align=e,this._align){case xe.START:this.addClass(Ie.START);break;case xe.CENTER:this.addClass(Ie.CENTER);break;case xe.END:this.addClass(Ie.END)}}}show(){this.isShown=!0}hide(){this.isShown=!1}get isShown(){return this._isShown}set isShown(e){this._isShown!==e&&this.isEnabled&&(this.isRendering=e,this._isShown=e)}setReferent(e){this._referent=e}resize(){this.safeArea={top:this._safeAreaMargin,right:window.innerWidth-this._safeAreaMargin,bottom:window.innerHeight-this._safeAreaMargin,left:this._safeAreaMargin,center:.5*window.innerWidth,middle:.5*window.innerHeight}}render(){if(!this._referent)return;if(this.rect=this.getRect(),this.referentRect=this._referent.getRect(),this.mode===ke.AUTO)switch(this.place=this.getPlace(),this.place){case Re.TOP:case Re.BOTTOM:this.align=this.getHorizontalAlign();break;case Re.LEFT:case Re.RIGHT:this.align=this.getVerticalAlign()}let e,t;switch(this.place){case Re.TOP:t=this.referentRect.top-this.rect.height;break;case Re.RIGHT:e=this.referentRect.right;break;case Re.BOTTOM:t=this.referentRect.bottom;break;case Re.LEFT:e=this.referentRect.left-this.rect.width}switch(this.place){case Re.TOP:case Re.BOTTOM:switch(this.align){case xe.CENTER:e=this.referentRect.center-.5*this.rect.width;break;case xe.START:e=this.referentRect.left;break;case xe.END:e=this.referentRect.right-this.rect.width}break;case Re.RIGHT:case Re.LEFT:switch(this.align){case xe.CENTER:t=this.referentRect.middle-.5*this.rect.height;break;case xe.START:t=this.referentRect.top;break;case xe.END:t=this.referentRect.bottom-this.rect.height}}this._x===e&&this._y===t||(this._x=e+.5|0,this._y=t+.5|0,this.node.style.transform=`translate(${this._x}px,${this._y}px)`)}getPlace(){for(const e of this._places)switch(e){case Re.TOP:if(this.referentRect.top-this.rect.height>this.safeArea.top)return Re.TOP;break;case Re.RIGHT:if(this.referentRect.right+this.rect.width<this.safeArea.right)return Re.RIGHT;break;case Re.BOTTOM:if(this.referentRect.bottom+this.rect.height<this.safeArea.bottom)return Re.BOTTOM;break;case Re.LEFT:if(this.referentRect.left-this.rect.width>this.safeArea.left)return Re.LEFT}return this._places[0]}getHorizontalAlign(){for(const e of this._aligns)switch(e){case xe.CENTER:if(this.referentRect.center-.5*this.rect.width>this.safeArea.left&&this.referentRect.center+.5*this.rect.width<this.safeArea.right)return xe.CENTER;break;case xe.START:if(this.r