UNPKG

@engie-group/fluid-design-system

Version:

The Fluid Design System is ENGIE’s open-source library to create, build and deliver ENGIE digital services in a more efficient way.

1 lines 151 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),window.NJStore=window.NJStore||[];const E=(()=>{const E=window.NJStore;return{set(A,v,S){void 0===A.key&&(A.key={key:v,id:E.length}),E[A.key.id]=S},get:(A,v)=>(A.key&&v&&void 0===v.id&&(v=A.key),v&&void 0!==v.id?E[v.id]:null),delete(A,v){if(void 0===A.key)return;const S=A.key;S.key===v&&(delete E[S.id],delete A.key)}}})(),A={setData(A,v,S){E.set(A,v,S)},getData:(A,v)=>E.get(A,v),removeData(A,v){E.delete(A,v)}};class AbstractComponent{constructor(E,A,v={}){!A||A instanceof Element||console.error(Error(`${A} is not an HTML Element`)),this.options=v,this.element=A}static init(E,v={},S){const T=[],_=document.querySelectorAll(S);for(let S=0;S<_.length;S++){const y=_[S];if(!y.key||y.key.key!==E.DATA_KEY){const N=new E(_[S],v);y.key||A.setData(_[S],E.DATA_KEY,N),T.push(N)}}return T}}var v,S,T,_;!function(E){E.LIBRARY_LOG_TAG="[FLUID]",E.KEY_PREFIX="nj",E.DATA_API_KEY=".data-api"}(v||(v={})),function(E){E.mouseenter="mouseover",E.mouseleave="mouseout"}(S||(S={})),function(E){E.beforehide="beforehide",E.click="click",E.close="close",E.closed="closed",E.hide="hide",E.hidden="hidden",E.input="input",E.keydown="keydown",E.keyup="keyup",E.onchange="onchange",E.show="show",E.shown="shown",E.inserted="inserted",E.focusin="focusin",E.focusout="focusout",E.mouseenter="mouseenter",E.mouseleave="mouseleave",E.mouseup="mouseup",E.mousedown="mousedown",E.decrement="decrement",E.increment="increment"}(T||(T={})),function(E){E.click="click",E.dblclick="dblclick",E.mouseup="mouseup",E.mousedown="mousedown",E.contextmenu="contextmenu",E.mousewheel="mousewheel",E.DOMMouseScroll="DOMMouseScroll",E.mouseover="mouseover",E.mouseout="mouseout",E.mousemove="mousemove",E.selectstart="selectstart",E.selectend="selectend",E.keydown="keydown",E.keypress="keypress",E.keyup="keyup",E.orientationchange="orientationchange",E.touchstart="touchstart",E.touchmove="touchmove",E.touchend="touchend",E.touchcancel="touchcancel",E.pointerdown="pointerdown",E.pointermove="pointermove",E.pointerup="pointerup",E.pointerleave="pointerleave",E.pointercancel="pointercancel",E.gesturestart="gesturestart",E.gesturechange="gesturechange",E.gestureend="gestureend",E.focus="focus",E.blur="blur",E.change="change",E.reset="reset",E.select="select",E.submit="submit",E.focusin="focusin",E.focusout="focusout",E.load="load",E.unload="unload",E.beforeunload="beforeunload",E.resize="resize",E.move="move",E.DOMContentLoaded="DOMContentLoaded",E.readystatechange="readystatechange",E.error="error",E.abort="abort",E.scroll="scroll"}(_||(_={}));class EventHandler{static NAMESPACE_REGEX=/[^.]*(?=\..*)\.|.*/;static STRIPNAME_REGEX=/\..*/;static KEYEVENT_REGEX=/^key/;static STRIPUID_REGEX=/::\d+$/;static EVENTREGISTRY={};static uidEvent=1;static getUidEvent(E,A){return A&&`${A}::${EventHandler.uidEvent++}`||E.uidEvent||EventHandler.uidEvent++}static getEvent(E){const A=EventHandler.getUidEvent(E);return E.uidEvent=A,EventHandler.EVENTREGISTRY[A]=EventHandler.EVENTREGISTRY[A]||{}}static fixEvent(E,A){null===E.which&&EventHandler.KEYEVENT_REGEX.test(E.type)&&(E.which=null!==E.charCode?E.charCode:E.keyCode),E.delegateTarget=A}static njHandler(E,A){const handler=v=>(EventHandler.fixEvent(v,E),handler.oneOff&&EventHandler.off(E,v.type,A),A.apply(E,[v]));return handler}static njDelegationHandler(E,A,v){const handler=S=>{const T=E.querySelectorAll(A);for(let A=S.target;A&&A!==this;A=A.parentNode)for(let _=T.length;_>=0;_--)if(T[_]===A)return EventHandler.fixEvent(S,A),handler.oneOff&&EventHandler.off(E,S.type,v),v.apply(A,[S]);return null};return handler}static findHandler(E,A,v=null){for(const S in E){if(!Object.prototype.hasOwnProperty.call(E,S))continue;const T=E[S];if(T.originalHandler===A&&T.delegationSelector===v)return E[S]}return null}static normalizeParams(E,A,v){const T="string"==typeof A,y=T?v:A;let N=E.replace(EventHandler.STRIPNAME_REGEX,"");const C=S[N];C&&(N=C);return"string"==typeof _[N]||(N=E),[T,y,N]}static addHandler(E,A,v,S,T){if("string"!=typeof A||null==E)return;v||(v=S,S=null);const _=EventHandler.getEvent(E);for(const y of A.split(" ")){const[A,N,C]=EventHandler.normalizeParams(y,v,S),L=_[C]||(_[C]={}),w=EventHandler.findHandler(L,N,A?v:null);if(w)return void(w.oneOff=w.oneOff&&T);const I=EventHandler.getUidEvent(N,y.replace(EventHandler.NAMESPACE_REGEX,"")),M=A?EventHandler.njDelegationHandler(E,v,S):EventHandler.njHandler(E,v);M.delegationSelector=A?v:null,M.originalHandler=N,M.oneOff=T,M.uidEvent=I,L[I]=M,E.addEventListener(C,M,A)}}static removeHandler(E,A,v,S,T){const _=EventHandler.findHandler(A[v],S,T);null!==_&&(E.removeEventListener(v,_,Boolean(T)),delete A[v][_.uidEvent])}static removeNamespacedHandlers(E,A,v,S){const T=A[v]||{};for(const _ in T)if(Object.prototype.hasOwnProperty.call(T,_)&&_.indexOf(S)>-1){const S=T[_];EventHandler.removeHandler(E,A,v,S.originalHandler,S.delegationSelector)}}static on(E,A,v,S){EventHandler.addHandler(E,A,v,S,!1)}static one(E,A,v,S){EventHandler.addHandler(E,A,v,S,!0)}static off(E,A,v,S){if("string"!=typeof A||null==E)return;const[T,_,y]=EventHandler.normalizeParams(A,v,S),N=y!==A,C=EventHandler.getEvent(E);if(void 0!==_){if(!C||!C[y])return;return void EventHandler.removeHandler(E,C,y,_,T?v:null)}if("."===A.charAt(0))for(const v in C)Object.prototype.hasOwnProperty.call(C,v)&&EventHandler.removeNamespacedHandlers(E,C,v,A.substr(1));const L=C[y]||{};for(const v in L){if(!Object.prototype.hasOwnProperty.call(L,v))continue;const S=v.replace(EventHandler.STRIPUID_REGEX,"");if(!N||A.indexOf(S)>-1){const A=L[v];EventHandler.removeHandler(E,C,y,A.originalHandler,A.delegationSelector)}}}static trigger(E,A,v){if("string"!=typeof A||null==E)return null;const S=A.replace(EventHandler.STRIPNAME_REGEX,""),T="string"==typeof _[S],y=!0;let N=null;return T?(N=document.createEvent("HTMLEvents"),N.initEvent(S,y,!0)):N=new window.CustomEvent(A,{bubbles:y,cancelable:!0}),void 0!==v&&Object.keys(v).forEach(E=>{Object.defineProperty(N,E,{get:()=>v[E]})}),E.dispatchEvent(N),N}}class Accordion extends AbstractComponent{static NAME=`${v.KEY_PREFIX}-accordion`;static DATA_KEY=`${v.KEY_PREFIX}.accordion`;static EVENT_KEY=`.${Accordion.DATA_KEY}`;static ACTIONS={expand:"accordion-expand",collapse:"accordion-collapse"};static SELECTOR={default:`.${Accordion.NAME}`,details:`details.${Accordion.NAME}-item`,expandAllBtn:`.${Accordion.NAME}__action[data-${Accordion.ACTIONS.expand}]`,collapseAllBtn:`.${Accordion.NAME}__action[data-${Accordion.ACTIONS.collapse}]`};constructor(E){super(Accordion,E),A.setData(E,Accordion.DATA_KEY,this),this.root=E,this.details=this.root.querySelectorAll(Accordion.SELECTOR.details),this.expandAllBtn=this.root.querySelector(Accordion.SELECTOR.expandAllBtn),this.collapseAllBtn=this.root.querySelector(Accordion.SELECTOR.collapseAllBtn),this.setListeners()}static init(E={}){return super.init(this,E,Accordion.SELECTOR.default)}dispose(){A.removeData(this.element,Accordion.DATA_KEY);for(let E=0,A=this.details.length;E<A;E++)EventHandler.off(this.details[E],"toggle");EventHandler.off(this.expandAllBtn,"click"),EventHandler.off(this.expandAllBtn,"click"),this.element=null}static getInstance(E){return A.getData(E,Accordion.DATA_KEY)}setListeners(){for(let E=0,A=this.details.length;E<A;E++)EventHandler.on(this.details[E],"toggle",this.toggleExclusiveAccordion(this.details[E]));EventHandler.on(this.expandAllBtn,"click",this.clickOnAction(Accordion.ACTIONS.expand)),EventHandler.on(this.collapseAllBtn,"click",this.clickOnAction(Accordion.ACTIONS.collapse))}toggleExclusiveAccordion(E){return A=>{const v=E.getAttribute("name");"open"===A.newState&&this.root.querySelectorAll(`${Accordion.SELECTOR.details}[name=${v}][open]`).forEach(A=>{A!==E&&A.removeAttribute("open")})}}clickOnAction(E){return()=>{this.details.forEach(A=>{E===Accordion.ACTIONS.expand?A.setAttribute("open",""):A.removeAttribute("open")})}}}class AutocompleteInput extends AbstractComponent{static NAME=`${v.KEY_PREFIX}-form-item--autocomplete`;static DATA_KEY=`${v.KEY_PREFIX}.autocomplete`;static SELECTOR={default:`.${AutocompleteInput.NAME}`,input:`.${v.KEY_PREFIX}-form-item__field`,list:`.${v.KEY_PREFIX}-form-item__list`};static EVENT={open:`${T.show}${AutocompleteInput.EVENT_KEY}`,onchange:`${T.onchange}${AutocompleteInput.EVENT_KEY}`,close:`${T.hide}${AutocompleteInput.EVENT_KEY}`};static CLASS_NAME={isOpen:`${v.KEY_PREFIX}-form-item--open`,hint:`${v.KEY_PREFIX}-form-item__list-item-hint`,active:"active"};static HIGHLIGHT_OPENING_TAG='<mark class="nj-highlight">';static HIGHLIGHT_CLOSING_TAG="</mark>";options={noResultMessage:"No results",singularResultsMessage:"{x} result",pluralResultsMessage:"{x} results",showResultNumber:!1};currentItemElements=[];isFiltered=!1;constructor(E){super(AutocompleteInput,E),this.dataList=JSON.parse(this.element.dataset.list),this.element.dataset.options&&(this.options={...this.options,...JSON.parse(this.element.dataset.options)}),this.listEl=this.element.querySelector(AutocompleteInput.SELECTOR.list),this.fieldEl=this.element.querySelector(AutocompleteInput.SELECTOR.input),this.itemTemplateEl=this.listEl.firstElementChild,this.itemElements=this.createItemElements(),this.hintEl=this.createHintElement(),this.liveZone=AutocompleteInput.createLiveResultElement(),this.element.prepend(this.liveZone),EventHandler.on(E,"keydown",this.onKeydown.bind(this)),EventHandler.on(E,"focusout",this.onFocusOut.bind(this)),EventHandler.on(this.fieldEl,"click",()=>{this.isFiltered=!1,this.isOpen=!this.isOpen}),EventHandler.on(this.fieldEl,"input",()=>{this.updateList()}),A.setData(E,AutocompleteInput.DATA_KEY,this)}get isOpen(){return!this.listEl.hasAttribute("hidden")}set isOpen(E){E?(this.element.classList.add(AutocompleteInput.CLASS_NAME.isOpen),this.listEl.removeAttribute("hidden"),this.fieldEl.setAttribute("aria-expanded","true"),this.updateList(),this.setActiveOption(),EventHandler.trigger(this.element,AutocompleteInput.EVENT.open)):(this.element.classList.remove(AutocompleteInput.CLASS_NAME.isOpen),this.listEl.setAttribute("hidden","hidden"),this.fieldEl.setAttribute("aria-expanded","false"),this.fieldEl.removeAttribute("aria-activedescendant"),this.unselectOption(),EventHandler.trigger(this.element,AutocompleteInput.EVENT.close))}selectMatchingOption(){const E=this.matchingId??this.currentItemElements[0]?.id;this.currentItemElements.forEach(A=>{A.setAttribute("aria-selected",A.id===E?"true":"false"),A.id===E&&this.fieldEl.setAttribute("aria-activedescendant",A.id)})}getFilteredItemElements(){return this.itemElements.filter(E=>!this.isFiltered||AutocompleteInput.compareText(E.dataset.name,this.fieldEl.value)).slice(0,this.options.limit)}updateList(){this.currentItemElements=this.getFilteredItemElements(),this.currentItemElements.length?(this.currentItemElements.forEach(E=>{E.innerHTML=AutocompleteInput.getElementInnerHtml(E.dataset.name,this.isFiltered?this.fieldEl.value:"")}),this.options.showResultNumber&&this.isFiltered?(this.hintEl.innerHTML=this.createResultsMessageContent(),this.listEl.replaceChildren(this.hintEl,...this.currentItemElements)):this.listEl.replaceChildren(...this.currentItemElements),this.liveZone.innerHTML=this.createResultsMessageContent(!0)):(this.hintEl.innerHTML=this.createResultsMessageContent(),this.listEl.replaceChildren(this.hintEl),this.liveZone.innerHTML=this.createResultsMessageContent(!0))}getNextOptionIndex(E,A){return E>=A-1?0:E+1}getPreviousOptionIndex(E,A){return E<=0?A-1:E-1}selectOption(E){const A=this.currentItemElements;if(A.length){const v=this.matchingId;let S=-1;const T=A.findIndex((E,A)=>(E.id===v&&(S=A),"true"===E.getAttribute("aria-selected"))),_=E(T>=0?T:S,A.length);A.forEach((E,A)=>{E.setAttribute("aria-selected",A===_?"true":"false"),A===_&&(E.scrollIntoView({block:"nearest"}),this.fieldEl.setAttribute("aria-activedescendant",E.id))})}}get matchingId(){return this.itemElements.find(E=>E.dataset.name===this.fieldEl.value)?.id??null}setActiveOption(){this.itemElements.forEach(E=>{this.matchingId===E.id?(E.classList.add(AutocompleteInput.CLASS_NAME.active),E.scrollIntoView({block:"nearest"})):E.classList.remove(AutocompleteInput.CLASS_NAME.active)})}unselectOption(){this.currentItemElements.forEach(E=>E.setAttribute("aria-selected","false"))}onKeydown(E){switch(E.key){case"ArrowDown":E.preventDefault(),this.isOpen?this.selectOption(this.getNextOptionIndex):(this.isFiltered=!1,this.updateList(),this.isOpen=!0,this.selectMatchingOption());break;case"ArrowUp":E.preventDefault(),this.isOpen&&this.selectOption(this.getPreviousOptionIndex);break;case"Escape":E.preventDefault(),this.isOpen&&(this.isOpen=!1,this.fieldEl.focus());break;case"Enter":this.selectCurrentSuggestion(),this.isOpen=!1;break;default:!("Backspace"!==E.key&&1!==E.key.length||E.metaKey||E.altKey||E.ctrlKey)&&(this.isFiltered=!0,this.unselectOption(),setTimeout(()=>{this.setActiveOption()}),this.isOpen||(this.isOpen=!0))}}selectCurrentSuggestion(){const E=this.fieldEl.getAttribute("aria-activedescendant");if(!E)return;const A=this.currentItemElements.find(A=>A.id===E),v=A.dataset.name,S=A.dataset.value;this.fieldEl.value=v,EventHandler.trigger(this.element,AutocompleteInput.EVENT.onchange,{name:v,value:S})}onFocusOut(E){this.element.contains(E.relatedTarget)||(this.isOpen=!1)}static createLiveResultElement(){const E=document.createElement("div");return E.setAttribute("aria-live","polite"),E.setAttribute("aria-atomic","true"),E.classList.add("nj-sr-only"),E}createItemElements(){return this.dataList.map((E,A)=>{const v=this.itemTemplateEl.cloneNode();return v.innerHTML=E.name,v.dataset.name=E.name,v.dataset.value=E.value,v.setAttribute("id",`${this.fieldEl.getAttribute("id")}-option-${A}`),EventHandler.on(v,"click",()=>{this.isOpen=!1,this.fieldEl.value=E.name,EventHandler.trigger(this.element,AutocompleteInput.EVENT.onchange,{name:E.name,value:E.value})}),v})}createHintElement(){const E=this.itemTemplateEl.cloneNode();return E.className=AutocompleteInput.CLASS_NAME.hint,E.innerHTML=this.options.noResultMessage,E.setAttribute("aria-hidden","true"),E}createResultsMessageContent(E=!1){const A=this.currentItemElements;let v;return v=0===A.length?this.options.noResultMessage:`${1===A.length?this.options.singularResultsMessage.replace("{x}",A.length.toString()):this.options.pluralResultsMessage.replace("{x}",A.length.toString())}`,E?`<p>${v}</p>`:v}static init(E={}){return super.init(this,E,AutocompleteInput.SELECTOR.default)}dispose(){A.removeData(this.element,AutocompleteInput.DATA_KEY)}static getElementInnerHtml(E,A){if(void 0===A||""===A?.trim())return E;const v=new RegExp(AutocompleteInput.normalizeString(A),"gi"),S=AutocompleteInput.normalizeString(E).matchAll(v);let T=E,_=0;if(S)for(const E of S){const v=_+E.index,S=T.slice(0,v),y=T.slice(v,v+A.length),N=T.slice(v+A.length,T.length);T=`${S}${this.HIGHLIGHT_OPENING_TAG}${y}${this.HIGHLIGHT_CLOSING_TAG}${N}`,_=_+AutocompleteInput.HIGHLIGHT_OPENING_TAG.length+AutocompleteInput.HIGHLIGHT_CLOSING_TAG.length}return`<span>${T}</span>`}static compareText(E,A){E=AutocompleteInput.normalizeString(E),A=(A=AutocompleteInput.normalizeString(A)).replace(/\(|\)|\\/gi,"");const v=new RegExp(A,"gi");return-1!==E.search(v)}static normalizeString(E){return E.normalize("NFD").replace(/[\u0300-\u036f]/g,"")}static getInstance(E){return A.getData(E,AutocompleteInput.DATA_KEY)}setOptions(E){this.dataList=E,this.itemElements=this.createItemElements(),this.updateList(),this.selectMatchingOption()}}const y={getDataAttributes(E){if(null==E)return{};let A={};if(Object.getOwnPropertyDescriptor(HTMLElement.prototype,"dataset"))A={...E.dataset};else for(let v=0;v<E.attributes.length;v++){const S=E.attributes[v];if(-1!==S.nodeName.indexOf("data-")){const E=S.nodeName.substring(5).replace(/-./g,E=>E.charAt(1).toUpperCase());A[E]=S.nodeValue}}return Object.keys(A).forEach(E=>{A[E]=function normalizeData(E){return"true"===E||"false"!==E&&("null"===E?null:E===Number(E).toString()?Number(E):""===E?null:E)}(A[E])}),A},toggleClass(E,A){null!=E&&(E.classList.contains(A)?E.classList.remove(A):E.classList.add(A))},mergeExtended(E,A,v){for(const S in A)Object.prototype.hasOwnProperty.call(A,S)&&(v&&"[object Object]"===Object.prototype.toString.call(A[S])?E[S]=y.extend(E[S],A[S]):E[S]=A[S]);return E},extend(...E){let A={},v=!1,S=0;for("[object Boolean]"===Object.prototype.toString.call(E[0])&&(v=E[0],S++);S<E.length;S++)A=y.mergeExtended(A,E[S],v);return A},createHtmlNode:E=>(new DOMParser).parseFromString(E,"text/html").body.firstChild};function toType(E){return{}.toString.call(E).match(/\s([a-z]+)/i)[1].toLowerCase()}const N={TRANSITION_END:"transitionend",getUID(E){do{E+=~~(1e6*Math.random())}while(document.getElementById(E));return E},getSelectorFromElement(E){let A=E.getAttribute("data-target");if(!A||"#"===A){const v=E.getAttribute("href");A=v&&"#"!==v?v.trim():""}try{return document.querySelector(A)?A:null}catch(E){return null}},getTransitionDurationFromElement(E){if(!E)return 0;let A=window.getComputedStyle(E).transitionDuration,v=window.getComputedStyle(E).transitionDelay;const S=parseFloat(A),T=parseFloat(v);return S||T?(A=A.split(",")[0],v=v.split(",")[0],1e3*(parseFloat(A)+parseFloat(v))):0},reflow:E=>E.offsetHeight,triggerTransitionEnd(E){const A=new CustomEvent(N.TRANSITION_END,{});E.dispatchEvent(A)},isElement:E=>(E[0]||E).nodeType,emulateTransitionEnd(E,A){let v=!1;const S=A+5;E.addEventListener(N.TRANSITION_END,function listener(){v=!0,E.removeEventListener(N.TRANSITION_END,listener)}),setTimeout(()=>{v||N.triggerTransitionEnd(E)},S)},typeCheckConfig(E,A,v){for(const S in v)if(Object.prototype.hasOwnProperty.call(v,S)){const T=v[S],_=A[S],y=_&&N.isElement(_)?"element":toType(_);if(!new RegExp(T).test(y))throw new Error(`${E.toUpperCase()}: Option "${S}" provided type "${y}" but expected type "${T}".`)}},makeArray:E=>null==E?[]:[].slice.call(E),findShadowRoot(E){if(!document.documentElement.attachShadow)return null;if("function"==typeof E.getRootNode){const A=E.getRootNode();return A instanceof ShadowRoot?A:null}return E instanceof ShadowRoot?E:E.parentNode?N.findShadowRoot(E.parentElement):null},throttle(E,A,v,S,T){let _,y,N,C=null,L=0;const later=()=>{L=Date.now(),C=null,N=E.apply(y,_)};return()=>{const w=Date.now();L||v||(L=w);const I=A-(w-L);return y=T||this,_=arguments,I<=0?(clearTimeout(C),C=null,L=w,N=E.apply(y,_)):!C&&S&&(C=setTimeout(later,I)),N}},coerceBool:E=>Boolean(E)};class Collapse extends AbstractComponent{static NAME=`${v.KEY_PREFIX}-collapse`;static DATA_KEY=`${v.KEY_PREFIX}.collapse`;static EVENT_KEY=`.${Collapse.DATA_KEY}`;static DATA_API_KEY=v.KEY_PREFIX;static hasInit=!1;static CLASS_NAME={show:"show",collapse:`${v.KEY_PREFIX}-collapse`,collapsing:`${v.KEY_PREFIX}-collapsing`,collapsed:`${v.KEY_PREFIX}-collapsed`};static EVENT={show:`${T.show}${Collapse.EVENT_KEY}`,shown:`${T.shown}${Collapse.EVENT_KEY}`,hide:`${T.hide}${Collapse.EVENT_KEY}`,hidden:`${T.hidden}${Collapse.EVENT_KEY}`,clickDataApi:`${T.click}${Collapse.EVENT_KEY}${Collapse.DATA_API_KEY}`};static DEFAULT_OPTIONS={toggle:!1,parent:""};static DEFAULT_TYPE={toggle:"boolean",parent:"(string|element)"};static DIMENSION={width:"width",height:"height"};static SELECTOR={default:`.${Collapse.CLASS_NAME.collapse}`,actives:`.${Collapse.CLASS_NAME.show}, .${Collapse.CLASS_NAME.collapsing}`,dataToggle:'[data-toggle="collapse"]'};constructor(E,v={}){super(Collapse,E,Collapse.getOptions(v)),this.element=E,this.isTransitioning=!1,this.triggerArray=N.makeArray(document.querySelectorAll(`${Collapse.SELECTOR.dataToggle}[href="#${E.id}"],${Collapse.SELECTOR.dataToggle}[data-target="#${E.id}"]`));const S=N.makeArray(document.querySelectorAll(Collapse.SELECTOR.dataToggle));for(let A=0,v=S.length;A<v;A++){const v=S[A],T=N.getSelectorFromElement(v),_=N.makeArray(document.querySelectorAll(T)).filter(A=>A===E);null!==T&&_.length&&(this.selector=T,this.triggerArray.push(v))}this.parent=this.options.parent?this.getParent():null,this.options.parent||this.addAriaAndCollapsedClass(this.element,this.triggerArray),this.options.toggle&&this.toggle(),A.setData(E,Collapse.DATA_KEY,this),Collapse.hasInit||(Collapse.hasInit=!0,this.registerEvents())}toggle(){this.element.classList.contains(Collapse.CLASS_NAME.show)?this.hide():this.show()}show(){if(this.isTransitioning||this.element.classList.contains(Collapse.CLASS_NAME.show))return;let E,v;this.parent&&(E=N.makeArray(this.parent.querySelectorAll(Collapse.SELECTOR.actives)).filter(E=>"string"==typeof this.options.parent?E.getAttribute("data-parent")===this.options.parent:E.classList.contains(Collapse.CLASS_NAME.collapse)),0===E.length&&(E=null));const S=document.querySelector(this.selector);if(E){const T=E.filter(E=>S!==E);if(v=T[0]?A.getData(T[0],Collapse.DATA_KEY):null,v&&v.isTransitioning)return}if(EventHandler.trigger(this.element,Collapse.EVENT.show).defaultPrevented)return;E&&E.forEach(E=>{S!==E&&Collapse.collapseInterface(E,"hide"),v||A.setData(E,Collapse.DATA_KEY,null)});const T=this.getDimension();this.element.classList.remove(Collapse.CLASS_NAME.collapse),this.element.classList.add(Collapse.CLASS_NAME.collapsing),this.element.style[T]=0,this.triggerArray.length&&this.triggerArray.forEach(E=>{E.classList.remove(Collapse.CLASS_NAME.collapsed),E.setAttribute("aria-expanded","true")}),this.setTransitioning(!0);const _=`scroll${T[0].toUpperCase()+T.slice(1)}`,y=N.getTransitionDurationFromElement(this.element);EventHandler.one(this.element,N.TRANSITION_END,()=>{this.element.classList.remove(Collapse.CLASS_NAME.collapsing),this.element.classList.add(Collapse.CLASS_NAME.collapse),this.element.classList.add(Collapse.CLASS_NAME.show),this.element.style[T]="",this.setTransitioning(!1),EventHandler.trigger(this.element,Collapse.EVENT.shown)}),N.emulateTransitionEnd(this.element,y),this.element.style[T]=`${this.element[_]}px`}hide(){if(this.isTransitioning||!this.element.classList.contains(Collapse.CLASS_NAME.show))return;if(EventHandler.trigger(this.element,Collapse.EVENT.hide).defaultPrevented)return;const E=this.getDimension();this.element.style[E]=`${this.element.getBoundingClientRect()[E]}px`,N.reflow(this.element),this.element.classList.add(Collapse.CLASS_NAME.collapsing),this.element.classList.remove(Collapse.CLASS_NAME.collapse),this.element.classList.remove(Collapse.CLASS_NAME.show);const A=this.triggerArray.length;if(A>0)for(let E=0;E<A;E++){const A=this.triggerArray[E],v=N.getSelectorFromElement(A);if(null!==v){document.querySelector(v).classList.contains(Collapse.CLASS_NAME.show)||(A.classList.add(Collapse.CLASS_NAME.collapsed),A.setAttribute("aria-expanded","false"))}}this.setTransitioning(!0);this.element.style[E]="";const v=N.getTransitionDurationFromElement(this.element);EventHandler.one(this.element,N.TRANSITION_END,()=>{this.setTransitioning(!1),this.element.classList.remove(Collapse.CLASS_NAME.collapsing),this.element.classList.add(Collapse.CLASS_NAME.collapse),EventHandler.trigger(this.element,Collapse.EVENT.hidden)}),N.emulateTransitionEnd(this.element,v)}setTransitioning(E){this.isTransitioning=E}dispose(){A.removeData(this.element,Collapse.DATA_KEY),this.options=null,this.parent=null,this.element=null,this.triggerArray=null,this.isTransitioning=null}getDimension(){return this.element.classList.contains(Collapse.DIMENSION.width)?Collapse.DIMENSION.width:Collapse.DIMENSION.height}getParent(){let E;N.isElement(this.options.parent)?E=this.options.parent:this.options.parent&&(E=document.querySelector(this.options.parent));const A=`[data-toggle="collapse"][data-parent="${this.options.parent}"]`;return N.makeArray(E.querySelectorAll(A)).forEach(E=>{this.addAriaAndCollapsedClass(Collapse.getTargetFromElement(E),[E])}),E}addAriaAndCollapsedClass(E,A){if(E){const v=E.classList.contains(Collapse.CLASS_NAME.show);A.length&&A.forEach(E=>{v?E.classList.remove(Collapse.CLASS_NAME.collapsed):E.classList.add(Collapse.CLASS_NAME.collapsed),E.setAttribute("aria-expanded",v)})}}static getOptions(E){return(E={...Collapse.DEFAULT_OPTIONS,...E}).toggle=Boolean(E.toggle),N.typeCheckConfig(Collapse.NAME,E,Collapse.DEFAULT_TYPE),E}static getTargetFromElement(E){const A=N.getSelectorFromElement(E);return A?document.querySelector(A):null}static collapseInterface(E,v){let S=A.getData(E,Collapse.DATA_KEY);const T={...Collapse.DEFAULT_OPTIONS,...y.getDataAttributes(E),..."object"==typeof v&&v?v:{}};if(!S&&T.toggle&&/show|hide/.test(v)&&(T.toggle=!1),S||(S=new Collapse(E,T)),"string"==typeof v){if(void 0===S[v])throw new Error(`No method named "${v}"`);S[v]()}}static getInstance(E){return A.getData(E,Collapse.DATA_KEY)}static init(E={}){return super.init(this,E,Collapse.SELECTOR.default)}registerEvents(){EventHandler.on(document,Collapse.EVENT.clickDataApi,Collapse.SELECTOR.dataToggle,function(E){"A"===E.target.tagName&&E.preventDefault();const A=y.getDataAttributes(this),v=N.getSelectorFromElement(this);N.makeArray(document.querySelectorAll(v)).forEach(E=>{const v=Collapse.getInstance(E);let S;v?(null===v.parent&&"string"==typeof A.parent&&(v.options.parent=A.parent,v.parent=v.getParent()),S="toggle"):S=A,Collapse.collapseInterface(E,S)})})}}var C,L;L={},function(E){function d(){this._delay=0,this._endDelay=0,this._fill="none",this._iterationStart=0,this._iterations=1,this._duration=0,this._playbackRate=1,this._direction="normal",this._easing="linear",this._easingFunction=x}function e(){return E.isDeprecated("Invalid timing inputs","2016-03-02","TypeError exceptions will be thrown instead.",!0)}function f(S,T,_){var y=new d;return T&&(y.fill="both",y.duration="auto"),"number"!=typeof S||isNaN(S)?void 0!==S&&Object.getOwnPropertyNames(S).forEach(function(T){if("auto"!=S[T]){if(("number"==typeof y[T]||"duration"==T)&&("number"!=typeof S[T]||isNaN(S[T])))return;if("fill"==T&&-1==A.indexOf(S[T]))return;if("direction"==T&&-1==v.indexOf(S[T]))return;if("playbackRate"==T&&1!==S[T]&&E.isDeprecated("AnimationEffectTiming.playbackRate","2014-11-28","Use Animation.playbackRate instead."))return;y[T]=S[T]}}):y.duration=S,y}function i(E,A,v,S){return E<0||E>1||v<0||v>1?x:function(T){function f(E,A,v){return 3*E*(1-v)*(1-v)*v+3*A*(1-v)*v*v+v*v*v}if(T<=0){var _=0;return E>0?_=A/E:!A&&v>0&&(_=S/v),_*T}if(T>=1){var y=0;return v<1?y=(S-1)/(v-1):1==v&&E<1&&(y=(A-1)/(E-1)),1+y*(T-1)}for(var N=0,C=1;N<C;){var L=(N+C)/2,w=f(E,v,L);if(Math.abs(T-w)<1e-5)return f(A,S,L);w<T?N=L:C=L}return f(A,S,L)}}function j(E,A){return function(v){if(v>=1)return 1;var S=1/E;return(v+=A*S)-v%S}}function k(E){N||(N=document.createElement("div").style),N.animationTimingFunction="",N.animationTimingFunction=E;var A=N.animationTimingFunction;if(""==A&&e())throw new TypeError(E+" is not a valid value for easing");return A}function l(E){if("linear"==E)return x;var A=L.exec(E);if(A)return i.apply(this,A.slice(1).map(Number));var v=w.exec(E);if(v)return j(Number(v[1]),_);var N=I.exec(E);return N?j(Number(N[1]),{start:S,middle:T,end:_}[N[2]]):y[E]||x}function o(E,A,v){if(null==A)return M;var S=v.delay+E+v.endDelay;return A<Math.min(v.delay,S)?O:A>=Math.min(v.delay+E,S)?D:R}var A="backwards|forwards|both|none".split("|"),v="reverse|alternate|alternate-reverse".split("|"),x=function(E){return E};d.prototype={_setMember:function(A,v){this["_"+A]=v,this._effect&&(this._effect._timingInput[A]=v,this._effect._timing=E.normalizeTimingInput(this._effect._timingInput),this._effect.activeDuration=E.calculateActiveDuration(this._effect._timing),this._effect._animation&&this._effect._animation._rebuildUnderlyingAnimation())},get playbackRate(){return this._playbackRate},set delay(E){this._setMember("delay",E)},get delay(){return this._delay},set endDelay(E){this._setMember("endDelay",E)},get endDelay(){return this._endDelay},set fill(E){this._setMember("fill",E)},get fill(){return this._fill},set iterationStart(E){if((isNaN(E)||E<0)&&e())throw new TypeError("iterationStart must be a non-negative number, received: "+E);this._setMember("iterationStart",E)},get iterationStart(){return this._iterationStart},set duration(E){if("auto"!=E&&(isNaN(E)||E<0)&&e())throw new TypeError("duration must be non-negative or auto, received: "+E);this._setMember("duration",E)},get duration(){return this._duration},set direction(E){this._setMember("direction",E)},get direction(){return this._direction},set easing(E){this._easingFunction=l(k(E)),this._setMember("easing",E)},get easing(){return this._easing},set iterations(E){if((isNaN(E)||E<0)&&e())throw new TypeError("iterations must be non-negative, received: "+E);this._setMember("iterations",E)},get iterations(){return this._iterations}};var S=1,T=.5,_=0,y={ease:i(.25,.1,.25,1),"ease-in":i(.42,0,1,1),"ease-out":i(0,0,.58,1),"ease-in-out":i(.42,0,.58,1),"step-start":j(1,S),"step-middle":j(1,T),"step-end":j(1,_)},N=null,C="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",L=new RegExp("cubic-bezier\\("+C+","+C+","+C+","+C+"\\)"),w=/steps\(\s*(\d+)\s*\)/,I=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/,M=0,O=1,D=2,R=3;E.cloneTimingInput=function c(E){if("number"==typeof E)return E;var A={};for(var v in E)A[v]=E[v];return A},E.makeTiming=f,E.numericTimingToObject=function g(E){return"number"==typeof E&&(E=isNaN(E)?{duration:0}:{duration:E}),E},E.normalizeTimingInput=function h(A,v){return f(A=E.numericTimingToObject(A),v)},E.calculateActiveDuration=function m(E){return Math.abs(function n(E){return 0===E.duration||0===E.iterations?0:E.duration*E.iterations}(E)/E.playbackRate)},E.calculateIterationProgress=function u(E,A,v){var S=o(E,A,v),T=function p(E,A,v,S,T){switch(S){case O:return"backwards"==A||"both"==A?0:null;case R:return v-T;case D:return"forwards"==A||"both"==A?E:null;case M:return null}}(E,v.fill,A,S,v.delay);if(null===T)return null;var _=function q(E,A,v,S,T){var _=T;return 0===E?A!==O&&(_+=v):_+=S/E,_}(v.duration,S,v.iterations,T,v.iterationStart),y=function r(E,A,v,S,T,_){var y=E===1/0?A%1:E%1;return 0!==y||v!==D||0===S||0===T&&0!==_||(y=1),y}(_,v.iterationStart,S,v.iterations,T,v.duration),N=function s(E,A,v,S){return E===D&&A===1/0?1/0:1===v?Math.floor(S)-1:Math.floor(S)}(S,v.iterations,y,_),C=function t(E,A,v){var S=E;if("normal"!==E&&"reverse"!==E){var T=A;"alternate-reverse"===E&&(T+=1),S="normal",T!==1/0&&T%2!=0&&(S="reverse")}return"normal"===S?v:1-v}(v.direction,N,y);return v._easingFunction(C)},E.calculatePhase=o,E.normalizeEasing=k,E.parseEasingFunction=l}(C={}),function(E){function c(E,A){return E in T&&T[E][A]||A}function e(E,S,T){if(!function d(E){return"display"===E||0===E.lastIndexOf("animation",0)||0===E.lastIndexOf("transition",0)}(E)){var _=A[E];if(_)for(var y in v.style[E]=S,_){var N=_[y],C=v.style[N];T[N]=c(N,C)}else T[E]=c(E,S)}}function f(E){var A=[];for(var v in E)if(!(v in["easing","offset","composite"])){var S=E[v];Array.isArray(S)||(S=[S]);for(var T,_=S.length,y=0;y<_;y++)(T={}).offset="offset"in E?E.offset:1==_?1:y/(_-1),"easing"in E&&(T.easing=E.easing),"composite"in E&&(T.composite=E.composite),T[v]=S[y],A.push(T)}return A.sort(function(E,A){return E.offset-A.offset}),A}var A={background:["backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundAttachment","backgroundOrigin","backgroundClip","backgroundColor"],border:["borderTopColor","borderTopStyle","borderTopWidth","borderRightColor","borderRightStyle","borderRightWidth","borderBottomColor","borderBottomStyle","borderBottomWidth","borderLeftColor","borderLeftStyle","borderLeftWidth"],borderBottom:["borderBottomWidth","borderBottomStyle","borderBottomColor"],borderColor:["borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"],borderLeft:["borderLeftWidth","borderLeftStyle","borderLeftColor"],borderRadius:["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],borderRight:["borderRightWidth","borderRightStyle","borderRightColor"],borderTop:["borderTopWidth","borderTopStyle","borderTopColor"],borderWidth:["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],flex:["flexGrow","flexShrink","flexBasis"],font:["fontFamily","fontSize","fontStyle","fontVariant","fontWeight","lineHeight"],margin:["marginTop","marginRight","marginBottom","marginLeft"],outline:["outlineColor","outlineStyle","outlineWidth"],padding:["paddingTop","paddingRight","paddingBottom","paddingLeft"]},v=document.createElementNS("http://www.w3.org/1999/xhtml","div"),S={thin:"1px",medium:"3px",thick:"5px"},T={borderBottomWidth:S,borderLeftWidth:S,borderRightWidth:S,borderTopWidth:S,fontSize:{"xx-small":"60%","x-small":"75%",small:"89%",medium:"100%",large:"120%","x-large":"150%","xx-large":"200%"},fontWeight:{normal:"400",bold:"700"},outlineWidth:S,textShadow:{none:"0px 0px 0px transparent"},boxShadow:{none:"0px 0px 0px 0px transparent"}};E.convertToArrayForm=f,E.normalizeKeyframes=function g(A){if(null==A)return[];window.Symbol&&Symbol.iterator&&Array.prototype.from&&A[Symbol.iterator]&&(A=Array.from(A)),Array.isArray(A)||(A=f(A));for(var v=A.map(function(A){var v={};for(var S in A){var T=A[S];if("offset"==S){if(null!=T){if(T=Number(T),!isFinite(T))throw new TypeError("Keyframe offsets must be numbers.");if(T<0||T>1)throw new TypeError("Keyframe offsets must be between 0 and 1.")}}else if("composite"==S){if("add"==T||"accumulate"==T)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"add compositing is not supported"};if("replace"!=T)throw new TypeError("Invalid composite mode "+T+".")}else T="easing"==S?E.normalizeEasing(T):""+T;e(S,T,v)}return null==v.offset&&(v.offset=null),null==v.easing&&(v.easing="linear"),v}),S=!0,T=-1/0,_=0;_<v.length;_++){var y=v[_].offset;if(null!=y){if(y<T)throw new TypeError("Keyframes are not loosely sorted by offset. Sort or specify offsets.");T=y}else S=!1}return v=v.filter(function(E){return E.offset>=0&&E.offset<=1}),S||function c(){var E=v.length;null==v[E-1].offset&&(v[E-1].offset=1),E>1&&null==v[0].offset&&(v[0].offset=0);for(var A=0,S=v[0].offset,T=1;T<E;T++){var _=v[T].offset;if(null!=_){for(var y=1;y<T-A;y++)v[A+y].offset=S+(_-S)*y/(T-A);A=T,S=_}}}(),v}}(C),function(E){var A={};E.isDeprecated=function(E,v,S,T){var _=T?"are":"is",y=new Date,N=new Date(v);return N.setMonth(N.getMonth()+3),!(y<N&&(E in A||console.warn("Web Animations: "+E+" "+_+" deprecated and will stop working on "+N.toDateString()+". "+S),A[E]=!0,1))},E.deprecated=function(A,v,S,T){var _=T?"are":"is";if(E.isDeprecated(A,v,S,T))throw new Error(A+" "+_+" no longer supported. "+S)}}(C),function(){if(document.documentElement.animate){var E=document.documentElement.animate([],0),A=!0;if(E&&(A=!1,"play|currentTime|pause|reverse|playbackRate|cancel|finish|startTime|playState".split("|").forEach(function(v){void 0===E[v]&&(A=!0)})),!A)return}!function(E,A){A.convertEffectInput=function(v){var S=function d(E){for(var A={},v=0;v<E.length;v++)for(var S in E[v])if("offset"!=S&&"easing"!=S&&"composite"!=S){var T={offset:E[v].offset,easing:E[v].easing,value:E[v][S]};A[S]=A[S]||[],A[S].push(T)}for(var _ in A){var y=A[_];if(0!=y[0].offset||1!=y[y.length-1].offset)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"Partial keyframes are not supported"}}return A}(E.normalizeKeyframes(v)),T=function e(v){var S=[];for(var T in v)for(var _=v[T],y=0;y<_.length-1;y++){var N=y,C=y+1,L=_[N].offset,w=_[C].offset,I=L,M=w;0==y&&(I=-1/0,0==w&&(C=N)),y==_.length-2&&(M=1/0,1==L&&(N=C)),S.push({applyFrom:I,applyTo:M,startOffset:_[N].offset,endOffset:_[C].offset,easingFunction:E.parseEasingFunction(_[N].easing),property:T,interpolation:A.propertyInterpolation(T,_[N].value,_[C].value)})}return S.sort(function(E,A){return E.startOffset-A.startOffset}),S}(S);return function(E,v){if(null!=v)T.filter(function(E){return v>=E.applyFrom&&v<E.applyTo}).forEach(function(S){var T=v-S.startOffset,_=S.endOffset-S.startOffset,y=0==_?0:S.easingFunction(T/_);A.apply(E,S.property,S.interpolation(y))});else for(var _ in S)"offset"!=_&&"easing"!=_&&"composite"!=_&&A.clear(E,_)}}}(C,L),function(E,A){function d(E){return E.replace(/-(.)/g,function(E,A){return A.toUpperCase()})}function e(E,A,S){v[S]=v[S]||[],v[S].push([E,A])}var v={};A.addPropertiesHandler=function f(E,A,v){for(var S=0;S<v.length;S++)e(E,A,d(v[S]))};var S={backgroundColor:"transparent",backgroundPosition:"0% 0%",borderBottomColor:"currentColor",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",borderBottomWidth:"3px",borderLeftColor:"currentColor",borderLeftWidth:"3px",borderRightColor:"currentColor",borderRightWidth:"3px",borderSpacing:"2px",borderTopColor:"currentColor",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderTopWidth:"3px",bottom:"auto",clip:"rect(0px, 0px, 0px, 0px)",color:"black",fontSize:"100%",fontWeight:"400",height:"auto",left:"auto",letterSpacing:"normal",lineHeight:"120%",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",marginTop:"0px",maxHeight:"none",maxWidth:"none",minHeight:"0px",minWidth:"0px",opacity:"1.0",outlineColor:"invert",outlineOffset:"0px",outlineWidth:"3px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",paddingTop:"0px",right:"auto",strokeDasharray:"none",strokeDashoffset:"0px",textIndent:"0px",textShadow:"0px 0px 0px transparent",top:"auto",transform:"",verticalAlign:"0px",visibility:"visible",width:"auto",wordSpacing:"normal",zIndex:"auto"};A.propertyInterpolation=function g(T,_,y){var N=T;/-/.test(T)&&!E.isDeprecated("Hyphenated property names","2016-03-22","Use camelCase instead.",!0)&&(N=d(T)),"initial"!=_&&"initial"!=y||("initial"==_&&(_=S[N]),"initial"==y&&(y=S[N]));for(var C=_==y?[]:v[N],L=0;C&&L<C.length;L++){var w=C[L][0](_),I=C[L][0](y);if(void 0!==w&&void 0!==I){var M=C[L][1](w,I);if(M){var O=A.Interpolation.apply(null,M);return function(E){return 0==E?_:1==E?y:O(E)}}}}return A.Interpolation(!1,!0,function(E){return E?y:_})}}(C,L),function(E,A){A.KeyframeEffect=function(v,S,T,_){var y,N=function d(A){var v=E.calculateActiveDuration(A),d=function(S){return E.calculateIterationProgress(v,S,A)};return d._totalDuration=A.delay+v+A.endDelay,d}(E.normalizeTimingInput(T)),C=A.convertEffectInput(S),k=function(){C(v,y)};return k._update=function(E){return null!==(y=N(E))},k._clear=function(){C(v,null)},k._hasSameTarget=function(E){return v===E},k._target=v,k._totalDuration=N._totalDuration,k._id=_,k}}(C,L),function(E){function d(E,A,v){v.enumerable=!0,v.configurable=!0,Object.defineProperty(E,A,v)}function e(E){this._element=E,this._surrogateStyle=document.createElementNS("http://www.w3.org/1999/xhtml","div").style,this._style=E.style,this._length=0,this._isAnimatedProperty={},this._updateSvgTransformAttr=function c(E,v){return!(!v.namespaceURI||-1==v.namespaceURI.indexOf("/svg"))&&(A in E||(E[A]=/Trident|MSIE|IEMobile|Edge|Android 4/i.test(E.navigator.userAgent)),E[A])}(window,E),this._savedTransformAttr=null;for(var v=0;v<this._style.length;v++){var S=this._style[v];this._surrogateStyle[S]=this._style[S]}this._updateIndices()}function f(E){if(!E._webAnimationsPatchedStyle){var A=new e(E);try{d(E,"style",{get:function(){return A}})}catch(A){E.style._set=function(A,v){E.style[A]=v},E.style._clear=function(A){E.style[A]=""}}E._webAnimationsPatchedStyle=E.style}}var A="_webAnimationsUpdateSvgTransformAttr",v={cssText:1,length:1,parentRule:1},S={getPropertyCSSValue:1,getPropertyPriority:1,getPropertyValue:1,item:1,removeProperty:1,setProperty:1},T={removeProperty:1,setProperty:1};for(var _ in e.prototype={get cssText(){return this._surrogateStyle.cssText},set cssText(E){for(var A={},v=0;v<this._surrogateStyle.length;v++)A[this._surrogateStyle[v]]=!0;for(this._surrogateStyle.cssText=E,this._updateIndices(),v=0;v<this._surrogateStyle.length;v++)A[this._surrogateStyle[v]]=!0;for(var S in A)this._isAnimatedProperty[S]||this._style.setProperty(S,this._surrogateStyle.getPropertyValue(S))},get length(){return this._surrogateStyle.length},get parentRule(){return this._style.parentRule},_updateIndices:function(){for(;this._length<this._surrogateStyle.length;)Object.defineProperty(this,this._length,{configurable:!0,enumerable:!1,get:function(E){return function(){return this._surrogateStyle[E]}}(this._length)}),this._length++;for(;this._length>this._surrogateStyle.length;)this._length--,Object.defineProperty(this,this._length,{configurable:!0,enumerable:!1,value:void 0})},_set:function(A,v){this._style[A]=v,this._isAnimatedProperty[A]=!0,this._updateSvgTransformAttr&&"transform"==E.unprefixedPropertyName(A)&&(null==this._savedTransformAttr&&(this._savedTransformAttr=this._element.getAttribute("transform")),this._element.setAttribute("transform",E.transformToSvgMatrix(v)))},_clear:function(A){this._style[A]=this._surrogateStyle[A],this._updateSvgTransformAttr&&"transform"==E.unprefixedPropertyName(A)&&(this._savedTransformAttr?this._element.setAttribute("transform",this._savedTransformAttr):this._element.removeAttribute("transform"),this._savedTransformAttr=null),delete this._isAnimatedProperty[A]}},S)e.prototype[_]=function(E,A){return function(){var v=this._surrogateStyle[E].apply(this._surrogateStyle,arguments);return A&&(this._isAnimatedProperty[arguments[0]]||this._style[E].apply(this._style,arguments),this._updateIndices()),v}}(_,_ in T);for(var y in document.documentElement.style)y in v||y in S||function(E){d(e.prototype,E,{get:function(){return this._surrogateStyle[E]},set:function(A){this._surrogateStyle[E]=A,this._updateIndices(),this._isAnimatedProperty&&!this._isAnimatedProperty[E]&&(this._style[E]=A)}})}(y);E.apply=function(A,v,S){f(A),A.style._set(E.propertyName(v),S)},E.clear=function(A,v){A._webAnimationsPatchedStyle&&A.style._clear(E.propertyName(v))}}(L),function(E){window.Element.prototype.animate=function(A,v){var S="";return v&&v.id&&(S=v.id),E.timeline._play(E.KeyframeEffect(this,A,v,S))}}(L),function(E){function c(E,A,v){if("number"==typeof E&&"number"==typeof A)return E*(1-v)+A*v;if("boolean"==typeof E&&"boolean"==typeof A)return v<.5?E:A;if(E.length==A.length){for(var S=[],T=0;T<E.length;T++)S.push(c(E[T],A[T],v));return S}throw"Mismatched interpolation arguments "+E+":"+A}E.Interpolation=function(E,A,v){return function(S){return v(c(E,A,S))}}}(L),function(E){var A=function(){function a(E,A){for(var v=[[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]],S=0;S<4;S++)for(var T=0;T<4;T++)for(var _=0;_<4;_++)v[S][T]+=A[S][_]*E[_][T];return v}return function c(E,A,v,S,T){for(var _=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]],y=0;y<4;y++)_[y][3]=T[y];for(y=0;y<3;y++)for(var N=0;N<3;N++)_[3][y]+=E[N]*_[N][y];var C=S[0],L=S[1],w=S[2],I=S[3],M=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];M[0][0]=1-2*(L*L+w*w),M[0][1]=2*(C*L-w*I),M[0][2]=2*(C*w+L*I),M[1][0]=2*(C*L+w*I),M[1][1]=1-2*(C*C+w*w),M[1][2]=2*(L*w-C*I),M[2][0]=2*(C*w-L*I),M[2][1]=2*(L*w+C*I),M[2][2]=1-2*(C*C+L*L),_=a(_,M);var O=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];for(v[2]&&(O[2][1]=v[2],_=a(_,O)),v[1]&&(O[2][1]=0,O[2][0]=v[0],_=a(_,O)),v[0]&&(O[2][0]=0,O[1][0]=v[0],_=a(_,O)),y=0;y<3;y++)for(N=0;N<3;N++)_[y][N]*=A[y];return function b(E){return 0==E[0][2]&&0==E[0][3]&&0==E[1][2]&&0==E[1][3]&&0==E[2][0]&&0==E[2][1]&&1==E[2][2]&&0==E[2][3]&&0==E[3][2]&&1==E[3][3]}(_)?[_[0][0],_[0][1],_[1][0],_[1][1],_[3][0],_[3][1]]:_[0].concat(_[1],_[2],_[3])}}();E.composeMatrix=A,E.quat=function d(A,v,S){var T=E.dot(A,v);T=function c(E,A,v){return Math.max(Math.min(E,v),A)}(T,-1,1);var _=[];if(1===T)_=A;else for(var y=Math.acos(T),N=1*Math.sin(S*y)/Math.sqrt(1-T*T),C=0;C<4;C++)_.push(A[C]*(Math.cos(S*y)-T*N)+v[C]*N);return _}}(L),function(E,A){E.sequenceNumber=0;var d=function(E,A,v){this.target=E,this.currentTime=A,this.timelineTime=v,this.type="finish",this.bubbles=!1,this.cancelable=!1,this.currentTarget=E,this.defaultPrevented=!1,this.eventPhase=Event.AT_TARGET,this.timeStamp=Date.now()};A.Animation=function(A){this.id="",A&&A._id&&(this.id=A._id),this._sequenceNumber=E.sequenceNumber++,this._currentTime=0,this._startTime=null,this._paused=!1,this._playbackRate=1,this._inTimeline=!0,this._finishedFlag=!0,this.onfinish=null,this._finishHandlers=[],this._effect=A,this._inEffect=this._effect._update(0),this._idle=!0,this._currentTimePending=!1},A.Animation.prototype={_ensureAlive:function(){this.playbackRate<0&&0===this.currentTime?this._inEffect=this._effect._update(-1):this._inEffect=this._effect._update(this.currentTime),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,A.timeline._animations.push(this))},_tickCurrentTime:function(E,A){E!=this._currentTime&&(this._currentTime=E,this._isFinished&&!A&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this._ensureAlive())},get currentTime(){return this._idle||this._currentTimePending?null:this._currentTime},set currentTime(E){E=+E,isNaN(E)||(A.restart(),this._paused||null==this._startTime||(this._startTime=this._timeline.currentTime-E/this._playbackRate),this._currentTimePending=!1,this._currentTime!=E&&(this._idle&&(this._idle=!1,this._paused=!0),this._tickCurrentTime(E,!0),A.applyDirtiedAnimation(this)))},get startTime(){return this._startTime},set startTime(E){E=+E,isNaN(E)||this._paused||this._idle||(this._startTime=E,this._tickCurrentTime((this._timeline.currentTime-this._startTime)*this.playbackRate),A.applyDirtiedAnimation(this))},get playbackRate(){return this._playbackRate},set playbackRate(E){if(E!=this._playbackRate){var v=this.currentTime;this._playbackRate=E,this._startTime=null,"paused"!=this.playState&&"idle"!=this.playState&&(this._finishedFlag=!1,this._idle=!1,this._ensureAlive(),A.applyDirtiedAnimation(this)),null!=v&&(this.currentTime=v)}},get _isFinished(){return!this._idle&&(this._playbackRate>0&&this._currentTime>=this._totalDuration||this._playbackRate<0&&this._currentTime<=0)},get _totalDuration(){return this._effect._totalDuration},get playState(){return this._idle?"idle":null==this._startTime&&!this._paused&&0!=this.playbackRate||this._currentTimePending?"pending":this._paused?"paused":this._isFinished?"finished":"running"},_rewind:function(){if(this._playbackRate>=0)this._currentTime=0;else{if(!(this._totalDuration<1/0))throw new DOMException("Unable to rewind negative playback rate animation with infinite duration","InvalidStateError");this._currentTime=this._totalDuration}},play:function(){this._paused=!1,(this._isFinished||this._idle)&&(this._rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this._ensureAlive(),A.applyDirtiedAnimation(this)},pause:function(){this._isFinished||this._paused||this._idle?this._idle&&(this._rewind(),this._idle=!1):this._currentTimePending=!0,this._startTime=null,this._paused=!0},finish:function(){this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this._currentTimePending=!1,A.applyDirtiedAnimation(this))},cancel:function(){this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=0,this._startTime=null,this._effect._update(null),A.applyDirtiedAnimation(this))},reverse:function(){this.playbackRate*=-1,this.play()},addEventListener:function(E,A){"function"==typeof A&&"finish"==E&&this._finishHandlers.push(A)},removeEventListener:function(E,A){if("finish"==E){var v=this._finishHandlers.indexOf(A);v>=0&&this._finishHandlers.splice(v,1)}},_fireEvents:function(E){if(this._isFinished){if(!this._finishedFlag){var A=new d(this,this._currentTime,E),v=this._finishHandlers.concat(this.onfinish?[this.onfinish]:[]);setTimeout(function(){v.forEach(function(E){E.call(A.target,A)})},0),this._finishedFlag=!0}}else this._finishedFlag=!1},_tick:function(E,A){this._idle||this._paused||(null==this._startTime?A&&(this.startTime=E-this._currentTime/this.playbackRate):this._isFinished||this._tickCurrentTime((E-this._startTime)*this.playbackRate)),A&&(this._currentTimePending=!1,this._fireEvents(E))},get _needsTick(){return this.playState in{pending:1,running:1}||!this._finishedFlag},_targetAnimations:function(){var E=this._effect._target;return E._activeAnimations||(E._activeAnimations=[]),E._activeAnimations},_markTarget:function(){var E=this._targetAnimations();-1===E.indexOf(this)&&E.push(this)},_unmarkTarget:function(){var E=this._targetAnimations(),A=E.indexOf(this);-1!==A&&E.splice(A,1)}}}(C,L),function(E,A){function d(E){var A=S;S=[],E<L.currentTime&&(E=L.currentTime),L._animations.sort(e),L._animations=h(E,!0,L._animations)[0],A.forEach(function(A){A[1](E)}),g()}function e(E,A){return E._sequenceNumber-A._sequenceNumber}function f(){this._animations=[],this.currentTime=window.performance&&performance.now?performance.now():0}function g(){N.forEach(function(E){E()}),N.length=0}function h(E,v,S){C=!0,y=!1,A.timeline.currentTime=E,_=!1;var T=[],L=[],w=[],I=[];return S.forEach(function(A){A._tick(E,v),A._inEffect?(L.push(A._effect),A._markTarget()):(T.push(A._effect),A._unmarkTarget()),A._needsTick&&(_=!0);var S=A._inEffect||A._needsTick;A._inTimeline=S,S?w.push(A):I.push(A)}),N.push.apply(N,T),N.push.apply(N,L),_&&requestAnimationFrame(function(){}),C=!1,[w,I]}var v=window.requestAnimationFrame,S=[],T=0;window.requestAnimationFrame=function(E){var A=T++;return 0==S.length&&v(d),S.push([A,E]),A},window.cancelAnimationFrame=function(E){S.forEach(function(A){A[0]==E&&(A[1]=function(){})})},f.prototype={_play:function(v){v._timing=E.normalizeTimingInput(v.timing);var S=new A.Animation(v);return S._idle=!1,S._timeline=this,this._animations.push(S),A.restart(),A.applyDirtiedAnimation(S),S}};var _=!1,y=!1;A.restart=function(){return _||(_=!0,requestAnimationFrame(function(){}),y=!0),y},A.applyDirtiedAnimation=function(E){if(!C){E._markTarget();var v=E._targetAnimations();v.sort(e),h(A.timeline.currentTime,!1,v.slice())[1].forEach(function(E){var A=L._animations.indexOf(E);-1!==A&&L._animations.splice(A,1)}),g()}};var N=[],C=!1,L=new f;A.timeline=L}(C,L),function(E){function c(E,A){for(var v=0,S=0;S<E.length;S++)v+=E[S]*A[S];return v}function d(E,A){return[E[0]*A[0]+E[4]*A[1]+E[8]*A[2]+E[12]*A[3],E[1]*A[0]+E[5]*A[1]+E[9]*A[2]+E[13]*A[3],E[2]*A[0]+E[6]*A[1]+E[10]*A[2]+E[14]*A[3],E[3]*A[0]+E[7]*A[1]+E[11]*A[2]+E[15]*A[3],E[0]*A[4]+E[4]*A[5]+E[8]*A[6]+E[12]*A[7],E[1]*A[4]+E[5]*A[5]+E[9]*A[6]+E[13]*A[7],E[2]*A[4]+E[6]*A[5]+E[10]*A[6]+E[14]*A[7],E[3