cui-light
Version:
cUI light framework for the web
1 lines • 185 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("cui-light",[],e):"object"==typeof exports?exports["cui-light"]=e():t["cui-light"]=e()}(window,(function(){return function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";i.r(e),i.d(e,"CUI_LIGHT_VERSION",(function(){return gg})),i.d(e,"CuiInstance",(function(){return En}));class s extends Error{constructor(t,e){super(e),Object.setPrototypeOf(this,new.target.prototype),this.name=t}}class n extends s{constructor(t){super("ItemNotFoundError",t)}}class r extends s{constructor(t){super("ArgumentError",t)}}class o extends s{constructor(t){super("CuiInstanceInitError",t)}}class h extends s{constructor(t){super("RegisterElementError",t)}}class a extends s{constructor(t){super("AnimatorError",t)}}class l extends s{constructor(t){super("CSSVariableError",t)}}class c extends s{constructor(t){super("CuiColorError",t)}}class u extends s{constructor(t){super("CuiPositionError",t)}}const d="dark",p="animation-progress",g="print",v="swiping-on",f={close:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M 1.9999999,1.9999999 18,18"></path><path d="M 18,1.9999999 1.9999999,18"></path></svg>',accordion:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path d="M 5.0000475,7.4490018 10.000024,12.551028 15,7.4490018"></path></svg>',special_menu:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="20" height="20"><path class="menu_handle_2" d="M 1,10 H 19"></path><path class="menu_handle_1" d="M 1,4.8571429 H 19"></path><path class="menu_handle_3" d="M 1,15.142857 H 19"></path></svg>',special_fail:'<svg xmlns="http://www.w3.org/2000/svg" class="special-fail" viewBox="0 0 100 100" width="100" height="100"><path class="circle" d="M 50,7.000001 A 43,43 0 0 1 92.999999,50 43,43 0 0 1 50,92.999999 43,43 0 0 1 7.0000011,50 43,43 0 0 1 50,7.000001 Z"></path><path class="arm_1" d="M 28.536809,28.536809 71.342023,71.342023"></path><path class="arm_2" d="M 71.342023,28.536809 28.536809,71.342023"></path></svg>',special_success:'<svg xmlns="http://www.w3.org/2000/svg" class="special-success" viewBox="0 0 100 100" width="100" height="100"><path class="circle" d="M 50,7 A 43,43 0 0 1 93,50 43,43 0 0 1 50,93 43,43 0 0 1 7,50 43,43 0 0 1 50,7 Z"></path><path class="arm" d="M 22.988405,48.234784 36.946233,72.410453 75.516456,33.84023"></path></svg>'},m="--cui-color-light-app-background",w="--cui-color-dark-app-background",k="--cui-color-light-background",y="--cui-color-dark-background ",b="--cui-color-light-border",M="--cui-color-dark-border",C={light:{base:"--cui-color-light-base",muted:"--cui-color-light-muted",active:"--cui-color-light-active"},dark:{base:"--cui-color-dark-base",muted:"--cui-color-dark-muted",active:"--cui-color-dark-active"},accent:{base:"--cui-color-primary",muted:"--cui-color-primary-muted",active:"--cui-color-primary-active"},secondary:{base:"--cui-color-secondary",muted:"--cui-color-secondary-muted",active:"--cui-color-secondary-active"},success:{base:"--cui-color-success",muted:"--cui-color-success-muted",active:"--cui-color-success-active"},warning:{base:"--cui-color-warning",muted:"--cui-color-warning-muted",active:"--cui-color-warning-active"},error:{base:"--cui-color-error",muted:"--cui-color-error-muted",active:"--cui-color-error-active"}},A={fontSize:"--{prefix}-font-size",lineHeight:"--{prefix}-line-height",animationTime:"--{prefix}-animation-time",animationTimeLong:"--{prefix}-animation-time-long",animationTimeShort:"--{prefix}-animation-time-short",colorLightAppBackground:"--{prefix}-color-light-app-background",colorLightBackground:"--{prefix}-color-light-background",colorLightBorder:"--{prefix}-color-light-border",colorLightBase:"--{prefix}-color-light-base",colorLightActive:"--{prefix}-color-light-active",colorLightMuted:"--{prefix}-color-light-muted",colorDarkAppBackground:"--{prefix}-color-dark-app-background",colorDarkBackground:"--{prefix}-color-dark-background",colorDarkBorder:"--{prefix}-color-dark-border",colorDarkBase:"--{prefix}-color-dark-base",colorDarkActive:"--{prefix}-color-dark-active",colorDarkMuted:"--{prefix}-color-dark-muted",colorAccent:"--{prefix}-color-primary",colorAccentActive:"--{prefix}-color-primary-active",colorAccentMuted:"--{prefix}-color-primary-muted",colorAccentShade:"--{prefix}-color-primary-shade",colorAccentShadeDark:"--{prefix}-color-primary-shade-dark",colorSecondary:"--{prefix}-color-secondary",colorSecondaryActive:"--{prefix}-color-secondary-active",colorSecondaryMuted:"--{prefix}-color-secondary-muted",colorSecondaryShade:"--{prefix}-color-secondary-shade",colorSecondaryShadeDark:"--{prefix}-color-secondary-shade-dark",colorWarning:"--{prefix}-color-warning",colorWarningActive:"--{prefix}-color-warning-active",colorWarningMuted:"--{prefix}-color-warning-muted",colorWarningShade:"--{prefix}-color-warning-shade",colorWarningShadeDark:"--{prefix}-color-warning-shade-dark",colorSuccess:"--{prefix}-color-success",colorSuccessActive:"--{prefix}-color-success-active",colorSuccessMuted:"--{prefix}-color-success-muted",colorSuccessShade:"--{prefix}-color-success-shade",colorSuccessShadeDark:"--{prefix}-color-success-shade-dark",colorError:"--{prefix}-color-error",colorErrorActive:"--{prefix}-color-error-active",colorErrorMuted:"--{prefix}-color-error-muted",colorErrorShade:"--{prefix}-color-error-shade",colorErrorShadeDark:"--{prefix}-color-error-shade-dark",inputBackground:"--{prefix}-input-background-color",colorShade:"--{prefix}-color-shade",colorShadeDarker:"--{prefix}-color-shade-darker",colorShadeLight:"--{prefix}-color-shade-light",colorShadeLighter:"--{prefix}-color-shade-light-lighter",outline:"--{prefix}-outline",borderRadius:"--{prefix}-border-radius",padding:"--{prefix}-padding",margin:"--{prefix}-margin",scrollbarWidth:"--{prefix}-scrollbar-width",componentSpace:"--{prefix}-component-space",accordionIcon:"--{prefix}-accordion-icon"};class E{}E.logLevel="none",E.prefix="cui";const W="instance-initialized",T="instance-finished",x="resize",S="open",L="opened",P="close",I="closed",D="toggle",B="toggled",O="switch",H="switched",N="scroll",$="targetchange",q="intersection",_="keydown",R="windowclick",z="offset",U="progresschange",F="progresschanged",V="globalmove",j="movelock",X="pause",Y="paused",K="sorted",Z="sortstart",G=function*(){let t=0;for(;;){((yield t++)||t>2e5)&&(t=0)}}();function J(t,e=!0){return null!=t&&(!e||!function(t){if("string"==typeof t)return 0===t.length;if("boolean"==typeof t)return t;if(Array.isArray(t))return 0===t.length;return!1}(t))}function Q(t,e){if(!J(t)||!J(e))throw new r("Missing argument value");return`${t}-${e}`}function tt(t){return new Promise(e=>setTimeout(()=>{e(!0)},t))}function et(t,e,i){return t<e?e:t>i?i:t}function it(t,e,i,s){return null==t||isNaN(t)?s:et(t,e,i)}function st(t){return J(t)?`[${t.join("],[")}]`:""}function nt(...t){if(!J(t))return!1;let e=t.length;for(let i=0;i<e;i++)if(!J(t[i]))return!1;return!0}function rt(t){let e="none";return t>=640&&(e="small"),t>=960&&(e="medium"),t>=1200&&(e="large"),t>=1600&&(e="xlarge"),e}function ot(t){let e={};return J(t)?(e=function(t){let e=null;if(J(t)&&t.startsWith("{")&&t.endsWith("}")){try{e=function(t){return t&&t.length>0?JSON.parse(t):{}}(t)}catch(t){console.error((i="An exception occured",s="Functions",n="parseJsonString",`[${(new Date).toLocaleString()}][${null!=s?s:"-"}][${null!=n?n:"-"}][${i}]`),t)}return e}var i,s,n;return null}(t.trim()),J(e)||(t.includes(";")||t.includes(":")?(e={},t.split(";").forEach(t=>{let i=Mt(t),s=void 0,n="";i.length<2||(s=i[0].trim(),n=i[1].trim(),s&&(e[s]=n.replace("U+0003B",";")))})):e=t),e):e}function ht(t,e){let i=parseInt(t);return isNaN(i)?e:i}function at(t,e){return J(t)&&J(e)?t.currentStyle?t.currentStyle[e]:window.getComputedStyle?window.getComputedStyle(t,null).getPropertyValue(e):null:null}function lt(t,e,i){return J(t)&&t>=e&&t<=i}function ct(t,e){return nt(t,e)?ot(t.getAttribute(e)):null}function ut(t){return!!J(t)&&["y","t","true","yes"].includes(t.toLowerCase())}function dt(t,e){return J(t)?ut(t):e}function pt(t,e){return J(t)?t.toLowerCase():e}function gt(t){return"string"==typeof t}function vt(t,e){return J(t)?t.replace("{prefix}",null!=e?e:""):t}function ft(t,e){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t+1))+t}function mt(t,e,i,s){let n=t;n.$handlers={};let r=function(t,e){return t&&J(t.hasAttribute)?e.filter(e=>t.hasAttribute(e)):[]}(t,i);J(r)&&(n.$cuid=t.hasAttribute("cuid")?t.getAttribute("cuid"):function(t){return`${J(t)?t:"cui-element"}-${G.next().value}`}(t.tagName),t.setAttribute("cuid",n.$cuid),r.forEach(i=>{let o=e.find(t=>t.attribute===i);if(J(o))try{s.styleAppender.append(o.getStyle());let e=o.get(t,s);n.$handlers[o.attribute]=e,n.$handlers[o.attribute].handle(ct(t,o.attribute))}catch(t){let e=r?r.join(", "):"";throw new h(`An error occured during [${e}] initialization: ${t.message}`)}}))}function wt(t){if(!J(t))return;let e=t.parentElement;return J(e)&&J(e.$cuid)?e:wt(e)}function kt(t){let e=0;return t?(Array.from(t.children).forEach(t=>{e+=t.getBoundingClientRect().height}),e>0?e+4:e):-1}function yt(t,e){if(nt(t,e))for(let i in t)t.hasOwnProperty(i)&&e(i,t[i])}function bt(t,e,i){let s=-1;switch(t){case"prev":s=e<=0?i-1:e-1;break;case"next":s=e<i-1?e+1:0;break;case"first":s=0;break;case"last":s=i-1;default:s=ht(t,-1)}return s}function Mt(t){let e=[];if(!J(t))return e;let i=t.split(":");return 1===i.length?i:[i.shift(),i.join(":")]}class Ct{constructor(){this.autoLightMode=!1,this.scrollThreshold=20,this.resizeThreshold=20,this.prefix="cui",this.plugins={}}fromInit(t){var e;return this.prefix=null!==(e=t.prefix)&&void 0!==e?e:"cui",this.logLevel=t.logLevel,this.cacheSize=t.cacheSize,this.autoLightMode=t.autoLightMode,this.animationTime=t.animationTime,this.animationTimeShort=t.animationTimeShort,this.animationTimeLong=t.animationTimeLong,this.scrollThreshold=t.scrollThreshold,this.resizeThreshold=t.resizeThreshold,this}}class At{constructor(){this.prefix="cui",this.app="$cui",this.logLevel="warning",this.interaction="async",this.animationTime=300,this.animationTimeShort=150,this.animationTimeLong=500,this.cacheSize=500,this.autoLightMode=!1,this.scrollThreshold=20,this.resizeThreshold=20,this.root=document.body,this.busSetup=void 0,this.development=void 0}}class Et{constructor(t,e){this.level=e,this.component=t,this.id="-"}setLevel(t){this.level=t}setId(t){this.id=t}debug(t,e){"debug"===this.level&&console.log(this.prepString(t,"debug",e))}error(t,e){"error"!==this.level&&"debug"!==this.level&&"warning"!==this.level||console.error(this.prepString(t,"error",e))}warning(t,e){"warning"!==this.level&&"debug"!==this.level||console.warn(this.prepString(t,"warning",e))}exception(t,e){console.error(this.prepString(`An exception occured: ${t.name}: ${t.message}`,"exception",e)),"debug"===this.level&&console.error(t.stack)}performance(t,e){if("debug"!==this.level)return;let i=Date.now();t(),console.log(this.prepString(`Performance measure: ${Date.now()-i}ms`,"performance",e))}prepString(t,e,i){return`[${(new Date).toLocaleString()}][${e}][${this.component}][${null!=i?i:"-"}][${this.id}][${t}]`}}class Wt{static get(t,e){return new Et(t,null!=e?e:E.logLevel)}}var Tt,xt,St,Lt,Pt,It,Dt,Bt,Ot,Ht,Nt,$t,qt=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},_t=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class Rt{constructor(t,e){Tt.set(this,void 0),xt.set(this,void 0),St.set(this,void 0),Lt.set(this,void 0),Pt.set(this,void 0),It.set(this,void 0),Dt.set(this,void 0),qt(this,Tt,void 0),this.plugins=void 0,qt(this,xt,void 0),qt(this,St,t),this._log=Wt.get("CuiMutationObserver"),qt(this,Lt,[]),qt(this,Pt,[]),qt(this,It,e),qt(this,Dt,"")}setPlugins(t){return this.plugins=t,this}setComponents(t){return qt(this,Lt,t),this}setAttributes(t){return qt(this,xt,{attributes:!0,subtree:!0,childList:!0,attributeFilter:t}),qt(this,Pt,t),qt(this,Dt,st(t)),this}start(){return this._log.debug("Starting"),_t(this,xt)?(qt(this,Tt,new MutationObserver(this.mutationCallback.bind(this))),_t(this,Tt).observe(_t(this,St),_t(this,xt)),this._log.debug("Started"),this):(this._log.error("Cannot start - options are not defined"),this)}stop(){return this._log.debug("Stopping"),_t(this,Tt)?(_t(this,Tt).disconnect(),qt(this,Tt,void 0),this._log.debug("Stopped"),this):(this._log.debug("Observer not available"),this)}mutationCallback(t,e){t.forEach(t=>{switch(t.type){case"attributes":const e=t.target;nt(t.attributeName,e)?nt(e.$handlers,e.$handlers[t.attributeName])&&e.$handlers[t.attributeName].refresh(ct(e,t.attributeName)):this._log.error("Mutation attribute doesn't not exisist");break;case"childList":this.handleChildListMutation(t)}J(this.plugins)&&this.plugins.onMutation(t).then(()=>{})})}handleChildListMutation(t){const e=t.addedNodes.length,i=t.removedNodes.length;e>0?(this._log.debug("Registering added nodes: "+e),this.handleAddedNodes(t.addedNodes)):i>0&&(this._log.debug("Removing nodes: "+i),this.handleRemovedNodes(t.removedNodes))}handleAddedNodes(t){t.forEach(t=>{try{mt(t,_t(this,Lt),_t(this,Pt),_t(this,It));let e=t.hasChildNodes()?t.querySelectorAll(_t(this,Dt)):null;J(e)&&e.forEach(t=>{mt(t,_t(this,Lt),_t(this,Pt),_t(this,It))})}catch(t){this._log.exception(t)}})}handleRemovedNodes(t){t.forEach(t=>{this.destroySingleElement(t);let e=t.hasChildNodes()?t.querySelectorAll(_t(this,Dt)):null;J(e)&&e.forEach(t=>{this.destroySingleElement(t)})})}destroySingleElement(t){let e=t;if(e.$handlers)for(let t in e.$handlers)if(e.$handlers.hasOwnProperty(t))try{e.$handlers[t].destroy()}catch(e){this._log.exception(e,"remove - "+t)}}}Tt=new WeakMap,xt=new WeakMap,St=new WeakMap,Lt=new WeakMap,Pt=new WeakMap,It=new WeakMap,Dt=new WeakMap;class zt{constructor(t){Bt.set(this,void 0),Ot.set(this,void 0),Ht.set(this,void 0),Nt.set(this,void 0),$t.set(this,{childList:!0,subtree:!0}),qt(this,Ot,void 0),qt(this,Nt,!1),qt(this,Bt,!1),qt(this,Ht,t)}observe(){_t(this,Bt)||_t(this,Nt)||!_t(this,Ot)||(_t(this,Ot).observe(_t(this,Ht),_t(this,$t)),qt(this,Bt,!0))}unobserve(){_t(this,Bt)&&_t(this,Ot)&&(_t(this,Ot).disconnect(),qt(this,Bt,!1))}isObserving(){return _t(this,Bt)}disable(t){qt(this,Nt,t),_t(this,Nt)&&this.unobserve()}onMutation(t){_t(this,Bt)&&this.unobserve(),qt(this,Ot,new MutationObserver(t))}}Bt=new WeakMap,Ot=new WeakMap,Ht=new WeakMap,Nt=new WeakMap,$t=new WeakMap;var Ut,Ft,Vt,jt,Xt,Yt,Kt=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Zt=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class Gt{constructor(){Ut.set(this,void 0),Ft.set(this,void 0),Vt.set(this,void 0),jt.set(this,!1),Xt.set(this,void 0),Yt.set(this,void 0),Kt(this,Vt,window.requestAnimationFrame.bind(window)),Kt(this,Ut,[]),Kt(this,Ft,[]),Kt(this,Xt,5),Kt(this,Yt,void 0)}onError(t){Kt(this,Yt,t)}mutate(t,e,...i){Zt(this,Ft).push(this.createTask(t,e,...i)),this.schedule()}fetch(t,e,...i){Zt(this,Ut).push(this.createTask(t,e,...i)),this.schedule()}createTask(t,e,...i){return e||i?t.bind(e,...i):t}run(t){let e=null;for(;e=t.shift();)e()}schedule(t){if(!Zt(this,jt)){if(Kt(this,jt,!0),t&&t>=Zt(this,Xt))throw new Error("Fast Dom limit reached");Zt(this,Vt).call(this,this.flush.bind(this,t))}}flush(t){let e=null!=t?t:0,i=null,s=Zt(this,Ut),n=Zt(this,Ft);try{this.run(n),this.run(s)}catch(t){Zt(this,Yt)?Zt(this,Yt).call(this,t):console.error("An error has been captured in interactions: "+t.message),i=t}Kt(this,jt,!1),(i||Zt(this,Ut).length||Zt(this,Ft).length)&&this.schedule(e+1)}}Ut=new WeakMap,Ft=new WeakMap,Vt=new WeakMap,jt=new WeakMap,Xt=new WeakMap,Yt=new WeakMap;class Jt{constructor(){this.isRunning=!1,this.tasks=[],this.raf=window.requestAnimationFrame.bind(window)}mutate(t,e,...i){this.tasks.push(this.createTask(t,e,...i)),this.schedule()}fetch(t,e,...i){this.tasks.push(this.createTask(t,e,...i)),this.schedule()}schedule(){this.isRunning||(this.isRunning=!0,this.raf(this.flush.bind(this)))}flush(){let t=null;for(;t=this.tasks.shift();)try{t()}catch(t){}this.isRunning=!1}createTask(t,e,...i){return e||i?t.bind(e,...i):t}}var Qt,te,ee=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},ie=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class se{constructor(t){Qt.set(this,void 0),te.set(this,void 0),ee(this,Qt,[]),ee(this,te,[]),t&&t.forEach(t=>{if(!J(t.key))throw ee(this,Qt,[]),ee(this,te,[]),new r("Key is empty");this.add(t.key,t.value)})}add(t,e){if(this.throwOnEmptyKey(t),this.containsKey(t))throw new Error("Key already exists");ie(this,Qt).push(t),ie(this,te).push(e)}remove(t){if(!J(t))return;let e=ie(this,Qt).indexOf(t);e>=0&&(ie(this,Qt).splice(e,1),ie(this,te).splice(e,1))}get(t){this.throwOnEmptyKey(t);let e=this.indexOf(t);if(!(e<0))return ie(this,te)[e]}containsKey(t){return J(t)&&this.indexOf(t)>=0}keys(){return ie(this,Qt)}values(){return ie(this,te)}indexOf(t){return J(t)?ie(this,Qt).indexOf(t):-1}update(t,e){this.throwOnEmptyKey(t);let i=this.indexOf(t);if(i<0)throw new n(`Item with key [${t}] not found`);ie(this,te)[i]=e}clear(){ee(this,te,[]),ee(this,Qt,[])}throwOnEmptyKey(t){if(!J(t))throw new r("Key is empty")}}Qt=new WeakMap,te=new WeakMap;var ne,re,oe=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},he=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class ae{constructor(t){ne.set(this,void 0),re.set(this,void 0),oe(this,ne,new se),oe(this,re,null!=t?t:500)}put(t,e){J(t)&&(this.has(t)?he(this,ne).update(t,e):(this.clean(),he(this,ne).add(t,e)))}get(t){if(!this.has(t))return;let e=he(this,ne).get(t);if(e&&e.refresh())return e;he(this,ne).remove(t)}has(t){return!!J(t)&&he(this,ne).containsKey(t)}remove(t){return!!J(t)&&(!!this.has(t)&&(he(this,ne).remove(t),!0))}clear(){he(this,ne).clear()}clean(){he(this,ne).keys().length>=he(this,re)&&he(this,ne).remove(he(this,ne).keys()[0])}}ne=new WeakMap,re=new WeakMap;var le,ce,ue,de=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function h(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,h)}a((s=s.apply(t,e||[])).next())}))},pe=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},ge=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class ve{constructor(){this.queue=[],this.isBusy=!1}idMatches(t,e){return!J(t)||J(t)&&t==e}}class fe extends ve{constructor(t){super(),le.set(this,void 0),ce.set(this,void 0),pe(this,ce,t),pe(this,le,Wt.get("SimpleEventEmitHandler"))}handle(t,e,i){return de(this,void 0,void 0,(function*(){J(t)?(this.queue.push({events:t,cuid:e,args:i}),this.isBusy||this.isBusy||(this.isBusy=!0,this.perform(),this.queue.length>0&&(yield this.perform()),this.isBusy=!1)):ge(this,le).warning("No events provided")}))}perform(){return de(this,void 0,void 0,(function*(){let t=this.queue.shift();if(t)for(let e in t.events){let i=t.events[e];try{this.idMatches(t.cuid,i.$cuid)&&(yield ge(this,ce).execute(i.callback,t.args))}catch(t){ge(this,le).error(t)}}}))}}le=new WeakMap,ce=new WeakMap;class me extends ve{constructor(t){super(),ue.set(this,void 0),pe(this,ue,t)}handle(t,e,i){return de(this,void 0,void 0,(function*(){J(t)&&(this.queue.push({events:t,cuid:e,args:i}),this.isBusy||(this.isBusy=!0,this.perform(),this.queue.length>0&&this.perform(),this.isBusy=!1))}))}perform(){return de(this,void 0,void 0,(function*(){let t=this.queue.shift(),e=[];if(!t)return Promise.all(e);for(let i in t.events){let s=t.events[i];this.idMatches(t.cuid,s.$cuid)&&e.push(ge(this,ue).execute(s.callback,t.args))}return Promise.all(e)}))}}ue=new WeakMap;var we=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function h(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,h)}a((s=s.apply(t,e||[])).next())}))};class ke{execute(t,e){return we(this,void 0,void 0,(function*(){e=null!=e?e:[],t(...e)}))}}var ye,be,Me,Ce,Ae,Ee,We,Te,xe=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function h(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,h)}a((s=s.apply(t,e||[])).next())}))},Se=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Le=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class Pe{constructor(t,e){ye.set(this,void 0),be.set(this,void 0),Me.set(this,void 0),Ce.set(this,void 0),Se(this,ye,{}),Se(this,Me,t),Se(this,Ce,null!=e?e:"CuiEventBus"),Se(this,be,Wt.get(Le(this,Ce)))}on(t,e,i){if(!nt(t,e))throw new r("Missing argument");let s=Le(this,Ce)+"-"+function(){let t=ft(1,1e3),e=ft(1,100);return`${Math.floor(Math.random()*e)}-${Math.floor(t)}`}();return Le(this,ye)[t]||(Le(this,ye)[t]={}),this.isAttached(Le(this,ye)[t],s,i)?null:(Le(this,be).debug(`Attaching new event: [${t}] for: [${s}]`),Le(this,ye)[t][s]={callback:e,$cuid:this.getCuid(i)},s)}detach(t,e){if(!nt(t,e))throw new r("Missing argument");let i=Le(this,ye)[t];Le(this,be).debug(`Detaching item: [${e}] from [${t}]`),this.isAttached(i,e)&&delete i[e]}detachAll(t){J(t)&&Le(this,ye)[t]?delete Le(this,ye)[t]:Le(this,be).error("Event name is missing or incorrect","detachAll")}emit(t,e,...i){return xe(this,void 0,void 0,(function*(){if(!J(t))throw new r("Event name is incorrect");return J(Le(this,ye)[t])&&(Le(this,be).debug(`Emit: [${t}]`),yield Le(this,Me).handle(Le(this,ye)[t],e,i)),!0}))}isSubscribing(t,e,i){let s=Le(this,ye)[t];return this.isAttached(s,e,i)}detachByCuid(t,e){if(!nt(t,e))return;let i=Le(this,ye)[t];J(i)&&yt(Object.assign({},i),(t,s)=>{s.$cuid===e&&delete i[t]})}isAttached(t,e,i){return J(i)?J(t)&&J(e)&&J(t[e])&&t[e].$cuid==i.$cuid:J(t)&&J(e)&&J(t[e])}getCuid(t){return J(t)?t.$cuid:null}}ye=new WeakMap,be=new WeakMap,Me=new WeakMap,Ce=new WeakMap;class Ie{constructor(t){if(Ae.set(this,void 0),Ee.set(this,void 0),We.set(this,void 0),Te.set(this,void 0),Se(this,Ee,Wt.get("CuiEventBus")),Se(this,We,[]),Se(this,Ae,{}),Se(this,Te,0),J(t)){Le(this,Ee).debug("Initiating buses"),(1===t.length?t:t.sort((t,e)=>t.priority-e.priority)).forEach((t,e)=>{Le(this,We).push(this.initBusInstance(t.name,t.handler)),Se(this,Ae,Object.assign(Object.assign({},Le(this,Ae)),this.mapEvents(t.eventsDef,e))),Le(this,Ee).debug(`Bus ${t.name} has been initialized with number: ${e}`)}),Le(this,We).push(this.initBusInstance("DefaultEventBus","tasked")),Se(this,Te,Le(this,We).length-1),Le(this,Ee).debug("Bus initialization finished")}}on(t,e,i){if(!nt(t,e))throw new r("Missing argument");return this.get(t).on(t,e,i)}detach(t,e,i){if(!nt(t,e))throw new r("Missing argument");this.get(t).detach(t,e,i)}detachAll(t){this.get(t).detachAll(t)}emit(t,e,...i){return xe(this,void 0,void 0,(function*(){if(!J(t))throw new r("Event name is incorrect");return this.get(t).emit(t,e,...i)}))}isSubscribing(t,e,i){return this.get(t).isSubscribing(t,e,i)}detachByCuid(t,e){nt(t,e)&&this.get(t).detachByCuid(t,e)}initBusInstance(t,e){if(!nt(t,e))throw new r("Bus name or handler name is incorrect");let i=new ke,s=class{static get(t,e){switch(t){case"tasked":return new me(e);default:return new fe(e)}}}.get(e,i);return new Pe(s,t)}mapEvents(t,e){return t.reduce((t,i)=>t[i]?t:Object.assign(Object.assign({},t),{[i]:e}),{})}get(t){let e=Le(this,Ae)[t];return Le(this,We)[null!=e?e:Le(this,Te)]}}Ae=new WeakMap,Ee=new WeakMap,We=new WeakMap,Te=new WeakMap;new WeakMap,new WeakMap;var De,Be=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i};class Oe{constructor(t){De.set(this,void 0),Be(this,De,t)}append(t){if(J(t)){const e=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style"),s=document.createTextNode(t);i.type="text/css",i.appendChild(s),e.appendChild(i)}return!0}}De=new WeakMap;var He,Ne,$e,qe,_e=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Re=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class ze{constructor(t){He.set(this,void 0),Ne.set(this,void 0),$e.set(this,15),qe.set(this,15),_e(this,He,document.documentElement),_e(this,Ne,t)}setAppBackground(t,e){this.setPropertyIn(m,t.toCssString()),this.setPropertyIn(w,e.toCssString())}setComponentBackground(t,e){this.setPropertyIn(k,t.toCssString()),this.setPropertyIn(y,e.toCssString())}setBordersColors(t,e){this.setPropertyIn(b,t.toCssString()),this.setPropertyIn(M,e.toCssString())}setColor(t,e){var i,s;const n=C[t],r=e.base;if(!J(n)||!J(r))return;const o=null!==(i=e.muted)&&void 0!==i?i:r.clone().lighten(Re(this,$e)),h=null!==(s=e.active)&&void 0!==s?s:r.clone().darken(Re(this,qe));Re(this,Ne).mutate(()=>{this.setProperty(n.base,r.toCssString()),this.setProperty(n.active,h.toCssString()),this.setProperty(n.muted,o.toCssString())},this)}setLightenFactor(t){_e(this,$e,et(t,0,100))}setDarkenFactor(t){_e(this,qe,et(t,0,100))}setProperty(t,e){Re(this,He).style.setProperty(t,e)}setPropertyIn(t,e){nt(e,t)&&Re(this,Ne).mutate(this.setProperty,this,t,e)}}He=new WeakMap,Ne=new WeakMap,$e=new WeakMap,qe=new WeakMap;var Ue,Fe,Ve,je,Xe,Ye,Ke,Ze,Ge=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Je=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class Qe{constructor(t,e){var i;Ue.set(this,void 0),Fe.set(this,void 0),Ve.set(this,void 0),je.set(this,void 0),Xe.set(this,void 0),Ye.set(this,void 0),Ke.set(this,void 0),Ze.set(this,void 0),Ge(this,Ue,[]),Ge(this,Fe,[]),Ge(this,Ve,window.innerWidth),Ge(this,je,!1),Ge(this,Xe,(i=window.innerWidth)<=640?"small":i>640&&i<=960?"medium":i>960&&i<=1200?"large":"xlarge"),Ge(this,Ye,null!=e?e:0),Ge(this,Ke,t),Ge(this,Ze,this.listener.bind(this))}observe(t){Je(this,Ue).findIndex(e=>e===t)<0&&Je(this,Ue).push(t)}unobserve(t){let e=Je(this,Ue).findIndex(e=>e===t);e>=0&&Je(this,Ue).splice(e,1)}connect(){window.addEventListener("resize",Je(this,Ze))}disconnect(){window.removeEventListener("resize",Je(this,Ze))}pushUpdateToItems(t){Je(this,Ue).length<1||(Ge(this,Fe,[]),Je(this,Ue).forEach(e=>{Je(this,Fe).push(e.resize(t))}),Promise.all(Je(this,Fe)),Ge(this,Fe,[]))}listener(t){if(Je(this,je))return;Ge(this,je,!0);const e=window.innerWidth-Je(this,Ve);if(Math.abs(e)>=Je(this,Ye)){const t=rt(window.innerWidth);if(t!==Je(this,Xe)){const e={current:t,previous:Je(this,Xe),width:window.innerWidth,height:window.innerHeight,timestamp:Date.now()};Je(this,Ke).emit(x,"",e),this.pushUpdateToItems(e),Ge(this,Xe,t)}}Ge(this,je,!1)}}Ue=new WeakMap,Fe=new WeakMap,Ve=new WeakMap,je=new WeakMap,Xe=new WeakMap,Ye=new WeakMap,Ke=new WeakMap,Ze=new WeakMap;var ti,ei=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},ii=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class si{constructor(t){ti.set(this,void 0),ei(this,ti,t)}pushState(t,e,i,s,n){this.checkAndCall(()=>{ii(this,ti).pushState(t,e,i,s,n)})}registerElement(t,e,i){this.checkAndCall(()=>{ii(this,ti).registerElement(t,e,i)})}unregisterElement(t,e){this.checkAndCall(()=>{ii(this,ti).unregisterElement(t,e)})}setProperty(t,e,i,s){this.checkAndCall(()=>{ii(this,ti).setProperty(t,e,i,s)})}log(t,e,i){this.checkAndCall(()=>{ii(this,ti).log(t,e,i)})}checkAndCall(t){J(ii(this,ti))&&t()}}ti=new WeakMap;var ni,ri=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},oi=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class hi{constructor(t){ni.set(this,void 0),this.setup=(new Ct).fromInit(t),this.interactions=class{static get(t,e){switch(t){case"async":const t=new Gt;return e&&t.onError(e),t;default:return new Jt}}}.get(t.interaction,this.onInteractionError.bind(this)),this.cache=new ae(this.setup.cacheSize),this.bus=class{static get(t){return J(t)?new Ie(t):new Pe(new me(new ke))}}.get(t.busSetup),this.colors=new ze(this.interactions),this.development=new si(t.development),this.styleAppender=new Oe(this.interactions),ri(this,ni,new Qe(this.bus,this.setup.resizeThreshold)),oi(this,ni).connect()}setLightMode(t){const e=Q(this.setup.prefix,d),i=document.body.classList;"dark"!==t||i.contains(e)?"light"===t&&i.contains(e)&&this.interactions.mutate(()=>{i.remove(e)},this):this.interactions.mutate(()=>{i.add(e)},this)}getLightMode(){const t=Q(this.setup.prefix,d);return document.body.classList.contains(t)?"dark":"light"}setPrintMode(t){const e=Q(this.setup.prefix,g),i=document.body.classList;t&&!i.contains(e)?i.add(e):!t&&i.contains(e)&&i.remove(e)}isPrintMode(){const t=Q(this.setup.prefix,g);return document.body.classList.contains(t)}setProperty(t,e){if(!nt(t,e))throw new l("Property or value was not provided");let i=vt(t,this.setup.prefix);document.documentElement.style.setProperty(i,e)}onInteractionError(t){console.error("An error has been captured from interactions"),console.error(t)}}ni=new WeakMap;var ai,li=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function h(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,h)}a((s=s.apply(t,e||[])).next())}))},ci=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},ui=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class di{constructor(t){ai.set(this,void 0),ci(this,ai,t)}performAction(t,e,i,s){return li(this,void 0,void 0,(function*(){return new Promise(n=>{ui(this,ai).mutate(()=>{e.add(t),t.classList.add(p),setTimeout(()=>{ui(this,ai).mutate(()=>{e.remove(t),t.classList.remove(p),s&&s(),n(!0)},null)},i)},null)})}))}performActions(t,e,i,s){return li(this,void 0,void 0,(function*(){return new Promise(n=>{ui(this,ai).mutate(()=>{e.forEach(e=>e.add(t)),t.classList.add(p),setTimeout(()=>{ui(this,ai).mutate(()=>{e.forEach(e=>e.remove(t)),t.classList.remove(p),s&&s(),n(!0)},null)},i)},null)})}))}performSwitchAction(t,e,i,s,n,r){return li(this,void 0,void 0,(function*(){return new Promise(o=>{ui(this,ai).mutate(()=>{i.forEach(e=>e.add(t)),t.classList.add(p),J(e)&&(s.forEach(t=>t.add(e)),e.classList.add(p)),setTimeout(()=>{ui(this,ai).mutate(()=>{i.forEach(e=>e.remove(t)),t.classList.remove(p),J(e)&&(s.forEach(t=>t.remove(e)),e.classList.remove(p)),n(),o(!0)},null)},r)},null)})}))}}ai=new WeakMap;var pi,gi,vi,fi,mi,wi,ki=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},yi=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class bi{constructor(t){pi.set(this,void 0),ki(this,pi,t)}add(t,e){nt(t,yi(this,pi))&&!t.classList.contains(yi(this,pi))&&t.classList.add(yi(this,pi))}remove(t,e){nt(t,yi(this,pi))&&t.classList.contains(yi(this,pi))&&t.classList.remove(yi(this,pi))}toggle(t,e){nt(t,yi(this,pi))&&(t.classList.contains(yi(this,pi))?t.classList.remove(yi(this,pi)):t.classList.add(yi(this,pi)))}}pi=new WeakMap;class Mi{constructor(t){gi.set(this,void 0),ki(this,gi,t)}add(t,e){if(e)switch(yi(this,gi)){case"dark-mode":e.setLightMode("dark");break;case"light-mode":e.setLightMode("light")}}remove(t,e){if(e)switch(yi(this,gi)){case"dark-mode":e.setLightMode("light");break;case"light-mode":e.setLightMode("dark")}}toggle(t,e){if(e)switch(yi(this,gi)){case"dark-mode":case"light-mode":this.setDarkMode(e)}}setDarkMode(t){"dark"===t.getLightMode()?t.setLightMode("light"):t.setLightMode("dark")}}gi=new WeakMap;class Ci{constructor(t){var e,i;vi.set(this,void 0),fi.set(this,void 0),e=this,i=this,[{set value(t){ki(e,vi,t)}}.value,{set value(t){ki(i,fi,t)}}.value]=Mt(t)}add(t,e){nt(t,yi(this,vi),yi(this,fi))&&t.setAttribute(yi(this,vi),yi(this,fi))}remove(t,e){nt(t,yi(this,vi),yi(this,fi))&&t.hasAttribute(yi(this,vi))&&t.removeAttribute(yi(this,vi))}toggle(t,e){nt(t,yi(this,vi),yi(this,fi))&&(t.hasAttribute(yi(this,vi))?t.removeAttribute(yi(this,vi)):t.setAttribute(yi(this,vi),yi(this,fi)))}}vi=new WeakMap,fi=new WeakMap;class Ai{constructor(t){var e,i;mi.set(this,void 0),wi.set(this,void 0),e=this,i=this,[{set value(t){ki(e,mi,t)}}.value,{set value(t){ki(i,wi,t)}}.value]=Mt(t)}add(t,e){if(!nt(t,yi(this,mi),yi(this,wi)))return;let i=t;i.style&&!i.style[yi(this,mi)]&&(i.style[yi(this,mi)]=yi(this,wi))}remove(t,e){if(!nt(t,yi(this,mi),yi(this,wi)))return;let i=t;i.style&&i.style[yi(this,mi)]&&(i.style[yi(this,mi)]="")}toggle(t,e){if(!nt(t,yi(this,mi),yi(this,wi)))return;let i=t;i.style&&(i.style[yi(this,mi)]?delete i.style[yi(this,mi)]:i.style[yi(this,mi)]=yi(this,wi))}}mi=new WeakMap,wi=new WeakMap;class Ei{constructor(){}add(t,e){}remove(t,e){}toggle(t,e){}}class Wi{static get(t){if(!J(t))return new Ei;switch(t[0]){case".":return new bi(t.substring(1));case"~":return new Mi(t.substring(1));case"&":return new Ci(t.substring(1));case"^":return new Ai(t.substring(1));default:return new bi(t)}}}class Ti{static get(t){if(!J(t))return[];return t.split(",").map(t=>Wi.get(t.trim()))}}var xi,Si,Li,Pi,Ii,Di,Bi=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function o(t){try{a(s.next(t))}catch(t){r(t)}}function h(t){try{a(s.throw(t))}catch(t){r(t)}}function a(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(o,h)}a((s=s.apply(t,e||[])).next())}))},Oi=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Hi=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class Ni{constructor(t,e){xi.set(this,void 0),Si.set(this,void 0),Li.set(this,void 0),Pi.set(this,void 0),Ii.set(this,void 0),Di.set(this,void 0),Oi(this,xi,t),Oi(this,Si,!1),Oi(this,Li,Wt.get("ElementManager")),Oi(this,Ii,e),Oi(this,Pi,Date.now()),Oi(this,Di,new di(e.interactions))}toggleClass(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{e.classList.contains(t)?e.classList.remove(t):e.classList.add(t)},"toggleClass")}))}toggleClassAs(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{let i=e.classList;Hi(this,Ii).interactions.fetch(()=>{i.contains(t)?Hi(this,Ii).interactions.mutate(i.remove,i,t):Hi(this,Ii).interactions.mutate(i.add,i,t)},this)},"toggleClassAs")}))}setClass(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{e.classList.contains(t)||e.classList.add(t)},"setClass")}))}setClassAs(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{let i=e.classList;Hi(this,Ii).interactions.fetch(()=>{i.contains(t)||Hi(this,Ii).interactions.mutate(i.add,i,t)},this)},"setClassAs")}))}removeClass(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{e.classList.contains(t)&&e.classList.remove(t)},"removeClass")}))}removeClassAs(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{let i=e.classList;Hi(this,Ii).interactions.fetch(()=>{i.contains(t)&&Hi(this,Ii).interactions.mutate(i.remove,i,t)},this)},"removeClass")}))}getAttribute(t){return J(t)?Hi(this,xi).reduce((e,i)=>{let s=i.getAttribute(t);return null!=s&&e.push(s),e},[]):[]}setAttribute(t,e){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(i=>{i.setAttribute(t,null!=e?e:"")},"setAttribute")}))}setAttributeAs(t,e){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(i=>{Hi(this,Ii).interactions.mutate(i.setAttribute,i,t,null!=e?e:"")},"setAttributeAs")}))}removeAttribute(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{e.removeAttribute(t)},"removeAttribute")}))}removeAttributeAs(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{Hi(this,Ii).interactions.mutate(e.removeAttribute,e,t)},"removeAttributeAs")}))}toggleAttribute(t,e){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(i=>{i.hasAttribute(t)?i.removeAttribute(t):i.setAttribute(t,null!=e?e:"")},"toggleAttribute")}))}toggleAttributeAs(t,e){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(i=>{Hi(this,Ii).interactions.fetch(()=>{i.hasAttribute(t)?Hi(this,Ii).interactions.mutate(i.removeAttribute,i,t):Hi(this,Ii).interactions.mutate(i.setAttribute,i,t,null!=e?e:"")},this)},"toggleAttributeAs")}))}click(t){return Bi(this,void 0,void 0,(function*(){return!!J(t)&&this.call(e=>{e.addEventListener("click",t)},"click")}))}event(t,e){return Bi(this,void 0,void 0,(function*(){return!(!J(t)||!J(e))&&this.call(i=>{i.addEventListener(t,e)},"event")}))}call(t,e){return Bi(this,void 0,void 0,(function*(){return Hi(this,Si)&&Hi(this,Li).error("Element is locked",e),this.lock(),Hi(this,xi).forEach((e,i)=>{t(e,i)}),this.unlock(),!0}))}animate(t,e){return Bi(this,void 0,void 0,(function*(){if(!J(t))return!1;const i=null!=e?e:Hi(this,Ii).setup.animationTime;return this.call(e=>{this.change(()=>{e.classList.add(t),e.classList.add(p),setTimeout(()=>{this.change(()=>{e.classList.remove(t),e.classList.remove(p)})},i)})})}))}open(t,e,i){return Bi(this,void 0,void 0,(function*(){if(!nt(t,e))return!1;const s=null!=i?i:Hi(this,Ii).setup.animationTime,n=new bi(e);return this.call(e=>{Hi(this,Di).performAction(e,n,null!=s?s:0).then(()=>{e.classList.add(t)})})}))}close(t,e,i){return Bi(this,void 0,void 0,(function*(){if(!nt(t,e))return!1;const s=null!=i?i:Hi(this,Ii).setup.animationTime,n=new bi(e);return this.call(e=>{Hi(this,Di).performAction(e,n,null!=s?s:0).then(()=>{e.classList.remove(t)})})}))}emit(t,...e){J(t)?this.call(i=>{let s=i.$cuid;J(s)&&(Hi(this,Li).debug(`Emitting event ${t} to ${s}`),Hi(this,Ii).bus.emit(t,s,...e))},"emit"):Hi(this,Li).warning("Not enough data to emit event","emit")}on(t,e){let i=[];return nt(t,e)?(this.call(s=>{let n=s;if(J(n)){let s=Hi(this,Ii).bus.on(t,e,n);null!=s&&i.push(s)}},"on"),i):(Hi(this,Li).error("Incorrect arguments","on"),i)}detach(t,e){nt(t,e)||Hi(this,Li).error("Incorrect arguments","detach"),this.call(i=>{let s=i;J(s)&&Hi(this,Ii).bus.detach(t,e,s)},"detach")}read(t,...e){Hi(this,Ii).interactions.fetch(t,this,...e)}change(t,...e){Hi(this,Ii).interactions.mutate(t,this,...e)}elements(){return Hi(this,xi)}count(){return Hi(this,xi).length}lock(){Oi(this,Si,!0)}unlock(){Oi(this,Si,!1)}isLocked(){return Hi(this,Si)}refresh(){return Date.now()-Hi(this,Pi)<36e4}}xi=new WeakMap,Si=new WeakMap,Li=new WeakMap,Pi=new WeakMap,Ii=new WeakMap,Di=new WeakMap;var $i,qi,_i,Ri,zi=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Ui=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class Fi{constructor(t){$i.set(this,void 0),qi.set(this,void 0),_i.set(this,void 0),Ri.set(this,void 0),zi(this,Ri,t),zi(this,qi,[]),zi(this,_i,void 0),zi(this,$i,void 0)}setId(t){return zi(this,$i,t),this}setClasses(...t){return zi(this,qi,t),this}setAttributes(t){return zi(this,_i,t),this}build(t){let e=document.createElement(Ui(this,Ri));return J(Ui(this,$i))&&(e.id=Ui(this,$i)),J(Ui(this,qi))&&e.classList.add(...Ui(this,qi)),J(Ui(this,_i))&&yt(Ui(this,_i),(t,i)=>{e.setAttribute(t,i)}),J(t)&&(e.innerHTML=t),e}}$i=new WeakMap,qi=new WeakMap,_i=new WeakMap,Ri=new WeakMap;var Vi,ji,Xi,Yi,Ki,Zi,Gi=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Ji=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class Qi{constructor(t,e,i){Vi.set(this,void 0),ji.set(this,void 0),Xi.set(this,void 0),Yi.set(this,void 0),Ki.set(this,void 0),Zi.set(this,void 0),Gi(this,Yi,t),Gi(this,Vi,Gi(this,Xi,Gi(this,ji,void 0))),Gi(this,Ki,null!=i?i:""),Gi(this,Zi,e)}createHeader(t,e,i){J(e)||(e=[]),J(i)||(i=[]);let s=new Fi("div");s.setClasses(Ji(this,Yi)+"-dialog-header",...e),Gi(this,Vi,s.build());let n=new Fi("span").setClasses(this.getPrefixedString("-dialog-title")).build(t);Ji(this,Vi).appendChild(n),this.appendChildrens(Ji(this,Vi),...i)}createFooter(t,e){J(t)||(t=[]),J(e)||(e=[]),Gi(this,Xi,new Fi("div").setClasses(this.getPrefixedString("-dialog-footer"),...t).build()),this.appendChildrens(Ji(this,Xi),...e)}createBody(t,e){J(t)||(t=[]),J(e)||(e=[]),Gi(this,ji,new Fi("div").setClasses(this.getPrefixedString("-dialog-body"),...t).build()),this.appendChildrens(Ji(this,ji),...e)}build(t){let e=[this.getPrefixedString("-dialog")];Ji(this,Zi)&&e.push(this.getPrefixedString("-reverse-auto"));let i=new Fi("div").setId(t).setClasses(...e).setAttributes({[this.getPrefixedString("-dialog")]:Ji(this,Ki)}).build(),s=new Fi("div").setClasses(this.getPrefixedString("-dialog-container")).build();return Ji(this,Vi)&&s.appendChild(Ji(this,Vi)),Ji(this,ji)&&s.appendChild(Ji(this,ji)),Ji(this,Xi)&&s.appendChild(Ji(this,Xi)),i.appendChild(s),i}appendChildrens(t,...e){J(e)&&e.forEach(e=>t.appendChild(e))}getPrefixedString(t){return Ji(this,Yi)+t}}Vi=new WeakMap,ji=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,Ki=new WeakMap,Zi=new WeakMap;var ts,es,is,ss,ns,rs,os,hs,as=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},ls=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class cs{constructor(t,e,i){ts.set(this,void 0),es.set(this,void 0),is.set(this,void 0),ss.set(this,void 0),ns.set(this,void 0),as(this,ts,{yes:i.onYes,no:i.onNo,cancel:i.onCancel,ok:i.onOk}),this.content=i.message,this.title=i.title,this.prefix=t.setup.prefix,as(this,es,t),as(this,is,e),this.reverse=!1,as(this,ns,null),this.closeStr=ls(this,es).setup.prefix+"-close",this.iconStr=ls(this,es).setup.prefix+"-icon",as(this,ss,void 0)}getId(){return ls(this,is)}show(t){let e=document.getElementById(ls(this,is));J(e)?this.updateElement(e):(e=this.createElement(),t.appendChild(e)),setTimeout(()=>{as(this,ss,new Ni([e],ls(this,es)));let t=ls(this,ss).on("closed",this.onClose.bind(this));as(this,ns,t.length>0?t[0]:null),ls(this,ss).emit("open")},100)}updateElement(t){let e=t.querySelector(`.${this.prefix}-dialog-title`),i=t.querySelector(`.${this.prefix}-dialog-body>p`);ls(this,es).interactions.mutate(()=>{e&&(e.innerHTML=this.title),i&&(i.innerHTML=this.content)},null)}onClose(t){try{if(J(t)&&t.state&&ls(this,ts)&&J(ls(this,ts)[t.state])){let e=ls(this,ts)[t.state];e&&e()}}finally{null!=ls(this,ns)&&(ls(this,ss)&&ls(this,ss).detach("closed",ls(this,ns)),as(this,ns,null)),as(this,ss,void 0)}}}ts=new WeakMap,es=new WeakMap,is=new WeakMap,ss=new WeakMap,ns=new WeakMap;class us extends cs{constructor(t,e,i){var s;super(t,e,i),rs.set(this,void 0),as(this,rs,e),this.reverse=null!==(s=i.reverse)&&void 0!==s&&s}createElement(){let t=new Qi(this.prefix,this.reverse);return t.createHeader(this.title,[],[new Fi("a").setClasses(this.prefix+"-icon").setAttributes({[this.closeStr]:"state: cancel",[this.iconStr]:"close"}).build()]),t.createBody([],[new Fi("p").build(this.content)]),t.createFooter([this.prefix+"-flex",this.prefix+"-right"],[new Fi("button").setClasses(this.prefix+"-button",this.prefix+"-margin-small-right").setAttributes({[this.closeStr]:"state: cancel"}).build("Cancel"),new Fi("button").setClasses(this.prefix+"-button",this.prefix+"-accent").setAttributes({[this.closeStr]:"state: ok"}).build("Ok")]),t.build(ls(this,rs))}}rs=new WeakMap;class ds extends cs{constructor(t,e,i){var s;super(t,e,i),os.set(this,void 0),as(this,os,e),this.content=i.message,this.title=i.title,this.prefix=t.setup.prefix,this.reverse=null!==(s=i.reverse)&&void 0!==s&&s}createElement(){let t=new Qi(this.prefix,this.reverse);return t.createHeader(this.title,[]),t.createBody([],[new Fi("p").build(this.content)]),t.createFooter([this.prefix+"-flex",this.prefix+"-right"],[new Fi("button").setClasses(this.prefix+"-button",this.prefix+"-accent").setAttributes({[this.closeStr]:"state: ok"}).build("Ok")]),t.build(ls(this,os))}}os=new WeakMap;class ps extends cs{constructor(t,e,i){var s;super(t,e,i),hs.set(this,void 0),as(this,hs,e),this.content=i.message,this.title=i.title,this.prefix=t.setup.prefix,this.reverse=null!==(s=i.reverse)&&void 0!==s&&s}createElement(){let t=new Qi(this.prefix,this.reverse);return t.createHeader(this.title,[],[new Fi("a").setClasses(this.prefix+"-icon").setAttributes({[this.closeStr]:"state: cancel",[this.iconStr]:"close"}).build()]),t.createBody([],[new Fi("p").build(this.content)]),t.createFooter([this.prefix+"-flex",this.prefix+"-right"],[new Fi("button").setClasses(this.prefix+"-button",this.prefix+"-margin-small-right").setAttributes({[this.closeStr]:"state: no"}).build("No"),new Fi("button").setClasses(this.prefix+"-button",this.prefix+"-accent").setAttributes({[this.closeStr]:"state: yes"}).build("Yes")]),t.build(ls(this,hs))}}hs=new WeakMap;var gs,vs,fs,ms,ws,ks,ys=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},bs=function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)};class Ms{constructor(t){gs.set(this,void 0),vs.set(this,void 0),fs.set(this,void 0),ms.set(this,void 0),ws.set(this,void 0),ks.set(this,void 0),ys(this,fs,!1),ys(this,gs,null!=t?t:document.body),ys(this,ms,!1),ys(this,ws,!1),ys(this,vs,void 0),ys(this,ks,void 0),this.onMouseDown=this.onMouseDown.bind(this),this.onMouseUp=this.onMouseUp.bind(this),this.onMouseMove=this.onMouseMove.bind(this),this.onTouchStart=this.onTouchStart.bind(this),this.onTouchEnd=this.onTouchEnd.bind(this),this.onTouchMove=this.onTouchMove.bind(this)}setCallback(t){ys(this,vs,t)}setTarget(t){ys(this,ks,t)}isInProgress(){return bs(this,fs)}preventDefault(t){ys(this,ws,t)}attach(){bs(this,ms)||(bs(this,gs).addEventListener("mousedown",this.onMouseDown,{passive:!1}),bs(this,gs).addEventListener("mouseup",this.onMouseUp,{passive:!1}),bs(this,gs).addEventListener("mousemove",this.onMouseMove,{passive:!1}),bs(this,gs).addEventListener("touchstart",this.onTouchStart,{passive:!1}),bs(this,gs).addEventListener("touchend",this.onTouchEnd,{passive:!1}),bs(this,gs).addEventListener("touchmove",this.onTouchMove,{passive:!1}),ys(this,ms,!0))}detach(){bs(this,ms)&&(bs(this,gs).removeEventListener("mousedown",this.onMouseDown,{passive:!1}),bs(this,gs).removeEventListener("mouseup",this.onMouseUp,{passive:!1}),bs(this,gs).removeEventListener("mousemove",this.onMouseMove,{passive:!1}),bs(this,gs).removeEventListener("touchstart",this.onTouchStart,{passive:!1}),bs(this,gs).removeEventListener("touchend",this.onTouchEnd,{passive:!1}),bs(this,gs).removeEventListener("touchmove",this.onTouchMove,{passive:!1}),ys(this,ms,!1))}isAttached(){return bs(this,ms)}onMouseDown(t){bs(this,fs)||bs(this,ks)&&!bs(this,ks).contains(t.target)||(ys(this,fs,!0),this.publishMouseEvent("down",t))}onMouseUp(t){bs(this,fs)&&(ys(this,fs,!1),this.publishMouseEvent("up",t))}onMouseMove(t){bs(this,fs)&&this.publishMouseEvent("move",t)}onTouchStart(t){bs(this,fs)||bs(this,ks)&&!bs(this,ks).contains(t.target)||(ys(this,fs,!0),this.publishTouchEvent("down",t))}onTouchEnd(t){bs(this,fs)&&(ys(this,fs,!1),this.publishTouchEvent("up",t))}onTouchMove(t){bs(this,fs)&&this.publishTouchEvent("move",t)}publishMouseEvent(t,e){bs(this,ws)&&e.cancelable&&e.preventDefault(),J(bs(this,vs))&&bs(this,vs).call(this,{type:t,x:e.clientX,y:e.clientY,moveX:e.movementX,moveY:e.movementY,target:e.target,event:e})}publishTouchEvent(t,e){if(bs(this,ws)&&e.cancelable&&e.preventDefault(),!J(bs(this,vs)))return;let i=null;e.touches.length>0?i=e.touches[0]:e.changedTouches.length>0&&(i=e.changedTouches[0]),bs(this,vs).call(this,{event:e,type:t,target:e.target,x:J(i)?i.clientX:-1,y:J(i)?i.clientY:-1,moveX:-1,moveY:-1})}}gs=new WeakMap,vs=new WeakMap,fs=new WeakMap,ms=new WeakMap,ws=new WeakMap,ks=new WeakMap;var Cs,As,Es,Ws,Ts,xs=function(t,e,i){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,i),i},Ss=function(t,