@salla.sa/twilight-components
Version:
Salla Web Component
4 lines • 353 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
function t(t,e){e.forEach((function(e){e&&typeof e!=="string"&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if(n!=="default"&&!(n in t)){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:true,get:function(){return e[n]}})}}))}));return Object.freeze(t)}const e="twilight";const n={hydratedSelectorName:"hydrated",lazyLoad:true,shadowDom:false,slotRelocation:true,updatable:true};var r=typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}var s=i;var a=o;if(typeof r.setTimeout==="function"){s=setTimeout}if(typeof r.clearTimeout==="function"){a=clearTimeout}function u(t){if(s===setTimeout){return setTimeout(t,0)}if((s===i||!s)&&setTimeout){s=setTimeout;return setTimeout(t,0)}try{return s(t,0)}catch(e){try{return s.call(null,t,0)}catch(e){return s.call(this,t,0)}}}function l(t){if(a===clearTimeout){return clearTimeout(t)}if((a===o||!a)&&clearTimeout){a=clearTimeout;return clearTimeout(t)}try{return a(t)}catch(e){try{return a.call(null,t)}catch(e){return a.call(this,t)}}}var c=[];var f=false;var d;var h=-1;function v(){if(!f||!d){return}f=false;if(d.length){c=d.concat(c)}else{h=-1}if(c.length){p()}}function p(){if(f){return}var t=u(v);f=true;var e=c.length;while(e){d=c;c=[];while(++h<e){if(d){d[h].run()}}h=-1;e=c.length}d=null;f=false;l(t)}function g(t){var e=new Array(arguments.length-1);if(arguments.length>1){for(var n=1;n<arguments.length;n++){e[n-1]=arguments[n]}}c.push(new m(t,e));if(c.length===1&&!f){u(p)}}function m(t,e){this.fun=t;this.array=e}m.prototype.run=function(){this.fun.apply(null,this.array)};var b="browser";var w="browser";var y=true;var S={};var k=[];var _="";var j={};var O={};var x={};function E(){}var $=E;var I=E;var T=E;var A=E;var P=E;var R=E;var z=E;function F(t){throw new Error("process.binding is not supported")}function C(){return"/"}function U(t){throw new Error("process.chdir is not supported")}function N(){return 0}var D=r.performance||{};var L=D.now||D.mozNow||D.msNow||D.oNow||D.webkitNow||function(){return(new Date).getTime()};function q(t){var e=L.call(D)*.001;var n=Math.floor(e);var r=Math.floor(e%1*1e9);if(t){n=n-t[0];r=r-t[1];if(r<0){n--;r+=1e9}}return[n,r]}var M=new Date;function B(){var t=new Date;var e=t-M;return e/1e3}var J={nextTick:g,title:b,browser:y,env:S,argv:k,version:_,versions:j,on:$,addListener:I,once:T,off:A,removeListener:P,removeAllListeners:R,emit:z,binding:F,cwd:C,chdir:U,umask:N,hrtime:q,platform:w,release:O,config:x,uptime:B};var G=typeof globalThis!=="undefined"?globalThis:typeof window!=="undefined"?window:typeof global!=="undefined"?global:typeof self!=="undefined"?self:{};function V(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t["default"]:t}function H(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function t(){if(this instanceof t){return Reflect.construct(e,arguments,this.constructor)}return e.apply(this,arguments)};n.prototype=e.prototype}else n={};Object.defineProperty(n,"__esModule",{value:true});Object.keys(t).forEach((function(e){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:true,get:function(){return t[e]}})}));return n}var W;var Q;function K(){if(Q)return W;Q=1;var t=Array.isArray;W=t;return W}var X;var Z;function Y(){if(Z)return X;Z=1;var t=typeof G=="object"&&G&&G.Object===Object&&G;X=t;return X}var tt;var et;function nt(){if(et)return tt;et=1;var t=Y();var e=typeof self=="object"&&self&&self.Object===Object&&self;var n=t||e||Function("return this")();tt=n;return tt}var rt;var it;function ot(){if(it)return rt;it=1;var t=nt();var e=t.Symbol;rt=e;return rt}var st;var at;function ut(){if(at)return st;at=1;var t=ot();var e=Object.prototype;var n=e.hasOwnProperty;var r=e.toString;var i=t?t.toStringTag:undefined;function o(t){var e=n.call(t,i),o=t[i];try{t[i]=undefined;var s=true}catch(t){}var a=r.call(t);if(s){if(e){t[i]=o}else{delete t[i]}}return a}st=o;return st}var lt;var ct;function ft(){if(ct)return lt;ct=1;var t=Object.prototype;var e=t.toString;function n(t){return e.call(t)}lt=n;return lt}var dt;var ht;function vt(){if(ht)return dt;ht=1;var t=ot(),e=ut(),n=ft();var r="[object Null]",i="[object Undefined]";var o=t?t.toStringTag:undefined;function s(t){if(t==null){return t===undefined?i:r}return o&&o in Object(t)?e(t):n(t)}dt=s;return dt}var pt;var gt;function mt(){if(gt)return pt;gt=1;function t(t){return t!=null&&typeof t=="object"}pt=t;return pt}var bt;var wt;function yt(){if(wt)return bt;wt=1;var t=vt(),e=mt();var n="[object Symbol]";function r(r){return typeof r=="symbol"||e(r)&&t(r)==n}bt=r;return bt}var St;var kt;function _t(){if(kt)return St;kt=1;var t=K(),e=yt();var n=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;function i(i,o){if(t(i)){return false}var s=typeof i;if(s=="number"||s=="symbol"||s=="boolean"||i==null||e(i)){return true}return r.test(i)||!n.test(i)||o!=null&&i in Object(o)}St=i;return St}var jt;var Ot;function xt(){if(Ot)return jt;Ot=1;function t(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}jt=t;return jt}var Et;var $t;function It(){if($t)return Et;$t=1;var t=vt(),e=xt();var n="[object AsyncFunction]",r="[object Function]",i="[object GeneratorFunction]",o="[object Proxy]";function s(s){if(!e(s)){return false}var a=t(s);return a==r||a==i||a==n||a==o}Et=s;return Et}var Tt;var At;function Pt(){if(At)return Tt;At=1;var t=nt();var e=t["__core-js_shared__"];Tt=e;return Tt}var Rt;var zt;function Ft(){if(zt)return Rt;zt=1;var t=Pt();var e=function(){var e=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function n(t){return!!e&&e in t}Rt=n;return Rt}var Ct;var Ut;function Nt(){if(Ut)return Ct;Ut=1;var t=Function.prototype;var e=t.toString;function n(t){if(t!=null){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}Ct=n;return Ct}var Dt;var Lt;function qt(){if(Lt)return Dt;Lt=1;var t=It(),e=Ft(),n=xt(),r=Nt();var i=/[\\^$.*+?()[\]{}|]/g;var o=/^\[object .+?Constructor\]$/;var s=Function.prototype,a=Object.prototype;var u=s.toString;var l=a.hasOwnProperty;var c=RegExp("^"+u.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(i){if(!n(i)||e(i)){return false}var s=t(i)?c:o;return s.test(r(i))}Dt=f;return Dt}var Mt;var Bt;function Jt(){if(Bt)return Mt;Bt=1;function t(t,e){return t==null?undefined:t[e]}Mt=t;return Mt}var Gt;var Vt;function Ht(){if(Vt)return Gt;Vt=1;var t=qt(),e=Jt();function n(n,r){var i=e(n,r);return t(i)?i:undefined}Gt=n;return Gt}var Wt;var Qt;function Kt(){if(Qt)return Wt;Qt=1;var t=Ht();var e=t(Object,"create");Wt=e;return Wt}var Xt;var Zt;function Yt(){if(Zt)return Xt;Zt=1;var t=Kt();function e(){this.__data__=t?t(null):{};this.size=0}Xt=e;return Xt}var te;var ee;function ne(){if(ee)return te;ee=1;function t(t){var e=this.has(t)&&delete this.__data__[t];this.size-=e?1:0;return e}te=t;return te}var re;var ie;function oe(){if(ie)return re;ie=1;var t=Kt();var e="__lodash_hash_undefined__";var n=Object.prototype;var r=n.hasOwnProperty;function i(n){var i=this.__data__;if(t){var o=i[n];return o===e?undefined:o}return r.call(i,n)?i[n]:undefined}re=i;return re}var se;var ae;function ue(){if(ae)return se;ae=1;var t=Kt();var e=Object.prototype;var n=e.hasOwnProperty;function r(e){var r=this.__data__;return t?r[e]!==undefined:n.call(r,e)}se=r;return se}var le;var ce;function fe(){if(ce)return le;ce=1;var t=Kt();var e="__lodash_hash_undefined__";function n(n,r){var i=this.__data__;this.size+=this.has(n)?0:1;i[n]=t&&r===undefined?e:r;return this}le=n;return le}var de;var he;function ve(){if(he)return de;he=1;var t=Yt(),e=ne(),n=oe(),r=ue(),i=fe();function o(t){var e=-1,n=t==null?0:t.length;this.clear();while(++e<n){var r=t[e];this.set(r[0],r[1])}}o.prototype.clear=t;o.prototype["delete"]=e;o.prototype.get=n;o.prototype.has=r;o.prototype.set=i;de=o;return de}var pe;var ge;function me(){if(ge)return pe;ge=1;function t(){this.__data__=[];this.size=0}pe=t;return pe}var be;var we;function ye(){if(we)return be;we=1;function t(t,e){return t===e||t!==t&&e!==e}be=t;return be}var Se;var ke;function _e(){if(ke)return Se;ke=1;var t=ye();function e(e,n){var r=e.length;while(r--){if(t(e[r][0],n)){return r}}return-1}Se=e;return Se}var je;var Oe;function xe(){if(Oe)return je;Oe=1;var t=_e();var e=Array.prototype;var n=e.splice;function r(e){var r=this.__data__,i=t(r,e);if(i<0){return false}var o=r.length-1;if(i==o){r.pop()}else{n.call(r,i,1)}--this.size;return true}je=r;return je}var Ee;var $e;function Ie(){if($e)return Ee;$e=1;var t=_e();function e(e){var n=this.__data__,r=t(n,e);return r<0?undefined:n[r][1]}Ee=e;return Ee}var Te;var Ae;function Pe(){if(Ae)return Te;Ae=1;var t=_e();function e(e){return t(this.__data__,e)>-1}Te=e;return Te}var Re;var ze;function Fe(){if(ze)return Re;ze=1;var t=_e();function e(e,n){var r=this.__data__,i=t(r,e);if(i<0){++this.size;r.push([e,n])}else{r[i][1]=n}return this}Re=e;return Re}var Ce;var Ue;function Ne(){if(Ue)return Ce;Ue=1;var t=me(),e=xe(),n=Ie(),r=Pe(),i=Fe();function o(t){var e=-1,n=t==null?0:t.length;this.clear();while(++e<n){var r=t[e];this.set(r[0],r[1])}}o.prototype.clear=t;o.prototype["delete"]=e;o.prototype.get=n;o.prototype.has=r;o.prototype.set=i;Ce=o;return Ce}var De;var Le;function qe(){if(Le)return De;Le=1;var t=Ht(),e=nt();var n=t(e,"Map");De=n;return De}var Me;var Be;function Je(){if(Be)return Me;Be=1;var t=ve(),e=Ne(),n=qe();function r(){this.size=0;this.__data__={hash:new t,map:new(n||e),string:new t}}Me=r;return Me}var Ge;var Ve;function He(){if(Ve)return Ge;Ve=1;function t(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}Ge=t;return Ge}var We;var Qe;function Ke(){if(Qe)return We;Qe=1;var t=He();function e(e,n){var r=e.__data__;return t(n)?r[typeof n=="string"?"string":"hash"]:r.map}We=e;return We}var Xe;var Ze;function Ye(){if(Ze)return Xe;Ze=1;var t=Ke();function e(e){var n=t(this,e)["delete"](e);this.size-=n?1:0;return n}Xe=e;return Xe}var tn;var en;function nn(){if(en)return tn;en=1;var t=Ke();function e(e){return t(this,e).get(e)}tn=e;return tn}var rn;var on;function sn(){if(on)return rn;on=1;var t=Ke();function e(e){return t(this,e).has(e)}rn=e;return rn}var an;var un;function ln(){if(un)return an;un=1;var t=Ke();function e(e,n){var r=t(this,e),i=r.size;r.set(e,n);this.size+=r.size==i?0:1;return this}an=e;return an}var cn;var fn;function dn(){if(fn)return cn;fn=1;var t=Je(),e=Ye(),n=nn(),r=sn(),i=ln();function o(t){var e=-1,n=t==null?0:t.length;this.clear();while(++e<n){var r=t[e];this.set(r[0],r[1])}}o.prototype.clear=t;o.prototype["delete"]=e;o.prototype.get=n;o.prototype.has=r;o.prototype.set=i;cn=o;return cn}var hn;var vn;function pn(){if(vn)return hn;vn=1;var t=dn();var e="Expected a function";function n(r,i){if(typeof r!="function"||i!=null&&typeof i!="function"){throw new TypeError(e)}var o=function(){var t=arguments,e=i?i.apply(this,t):t[0],n=o.cache;if(n.has(e)){return n.get(e)}var s=r.apply(this,t);o.cache=n.set(e,s)||n;return s};o.cache=new(n.Cache||t);return o}n.Cache=t;hn=n;return hn}var gn;var mn;function bn(){if(mn)return gn;mn=1;var t=pn();var e=500;function n(n){var r=t(n,(function(t){if(i.size===e){i.clear()}return t}));var i=r.cache;return r}gn=n;return gn}var wn;var yn;function Sn(){if(yn)return wn;yn=1;var t=bn();var e=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var n=/\\(\\)?/g;var r=t((function(t){var r=[];if(t.charCodeAt(0)===46){r.push("")}t.replace(e,(function(t,e,i,o){r.push(i?o.replace(n,"$1"):e||t)}));return r}));wn=r;return wn}var kn;var _n;function jn(){if(_n)return kn;_n=1;function t(t,e){var n=-1,r=t==null?0:t.length,i=Array(r);while(++n<r){i[n]=e(t[n],n,t)}return i}kn=t;return kn}var On;var xn;function En(){if(xn)return On;xn=1;var t=ot(),e=jn(),n=K(),r=yt();var i=t?t.prototype:undefined,o=i?i.toString:undefined;function s(t){if(typeof t=="string"){return t}if(n(t)){return e(t,s)+""}if(r(t)){return o?o.call(t):""}var i=t+"";return i=="0"&&1/t==-Infinity?"-0":i}On=s;return On}var $n;var In;function Tn(){if(In)return $n;In=1;var t=En();function e(e){return e==null?"":t(e)}$n=e;return $n}var An;var Pn;function Rn(){if(Pn)return An;Pn=1;var t=K(),e=_t(),n=Sn(),r=Tn();function i(i,o){if(t(i)){return i}return e(i,o)?[i]:n(r(i))}An=i;return An}var zn;var Fn;function Cn(){if(Fn)return zn;Fn=1;var t=yt();function e(e){if(typeof e=="string"||t(e)){return e}var n=e+"";return n=="0"&&1/e==-Infinity?"-0":n}zn=e;return zn}var Un;var Nn;function Dn(){if(Nn)return Un;Nn=1;var t=Rn(),e=Cn();function n(n,r){r=t(r,n);var i=0,o=r.length;while(n!=null&&i<o){n=n[e(r[i++])]}return i&&i==o?n:undefined}Un=n;return Un}var Ln;var qn;function Mn(){if(qn)return Ln;qn=1;var t=Dn();function e(e,n,r){var i=e==null?undefined:t(e,n);return i===undefined?r:i}Ln=e;return Ln}var Bn=Mn();var Jn=V(Bn);var Gn={exports:{}};var Vn;function Hn(){if(Vn)return Gn.exports;Vn=1;(function(t,e){!function(e){var n=Object.hasOwnProperty;var r=Array.isArray?Array.isArray:function t(e){return Object.prototype.toString.call(e)==="[object Array]"};var i=10;var o=typeof J=="object"&&typeof J.nextTick=="function";var s=typeof Symbol==="function";var a=typeof Reflect==="object";var u=typeof setImmediate==="function";var l=u?setImmediate:setTimeout;var c=s?a&&typeof Reflect.ownKeys==="function"?Reflect.ownKeys:function(t){var e=Object.getOwnPropertyNames(t);e.push.apply(e,Object.getOwnPropertySymbols(t));return e}:Object.keys;function f(){this._events={};if(this._conf){d.call(this,this._conf)}}function d(t){if(t){this._conf=t;t.delimiter&&(this.delimiter=t.delimiter);if(t.maxListeners!==e){this._maxListeners=t.maxListeners}t.wildcard&&(this.wildcard=t.wildcard);t.newListener&&(this._newListener=t.newListener);t.removeListener&&(this._removeListener=t.removeListener);t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak);t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors);if(this.wildcard){this.listenerTree={}}}}function h(t,e){var n="(node) warning: possible EventEmitter memory "+"leak detected. "+t+" listeners added. "+"Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak){n+=" Event name: "+e+"."}if(typeof J!=="undefined"&&J.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning";r.emitter=this;r.count=t;J.emitWarning(r)}else{console.error(n);if(console.trace){console.trace()}}}var v=function(t,e,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[t];case 2:return[t,e];case 3:return[t,e,n];default:var i=new Array(r);while(r--){i[r]=arguments[r]}return i}};function p(t,n){var r={};var i;var o=t.length;var s=0;for(var a=0;a<o;a++){i=t[a];r[i]=a<s?n[a]:e}return r}function g(t,e,n){this._emitter=t;this._target=e;this._listeners={};this._listenersCount=0;var r,i;if(n.on||n.off){r=n.on;i=n.off}if(e.addEventListener){r=e.addEventListener;i=e.removeEventListener}else if(e.addListener){r=e.addListener;i=e.removeListener}else if(e.on){r=e.on;i=e.off}if(!r&&!i){throw Error("target does not implement any known event API")}if(typeof r!=="function"){throw TypeError("on method must be a function")}if(typeof i!=="function"){throw TypeError("off method must be a function")}this._on=r;this._off=i;var o=t._observers;if(o){o.push(this)}else{t._observers=[this]}}Object.assign(g.prototype,{subscribe:function(t,e,n){var r=this;var i=this._target;var o=this._emitter;var s=this._listeners;var a=function(){var r=v.apply(null,arguments);var s={data:r,name:e,original:t};if(n){var a=n.call(i,s);if(a!==false){o.emit.apply(o,[s.name].concat(r))}return}o.emit.apply(o,[e].concat(r))};if(s[t]){throw Error("Event '"+t+"' is already listening")}this._listenersCount++;if(o._newListener&&o._removeListener&&!r._onNewListener){this._onNewListener=function(n){if(n===e&&s[t]===null){s[t]=a;r._on.call(i,t,a)}};o.on("newListener",this._onNewListener);this._onRemoveListener=function(n){if(n===e&&!o.hasListeners(n)&&s[t]){s[t]=null;r._off.call(i,t,a)}};s[t]=null;o.on("removeListener",this._onRemoveListener)}else{s[t]=a;r._on.call(i,t,a)}},unsubscribe:function(t){var e=this;var n=this._listeners;var r=this._emitter;var i;var o;var s=this._off;var a=this._target;var u;if(t&&typeof t!=="string"){throw TypeError("event must be a string")}function l(){if(e._onNewListener){r.off("newListener",e._onNewListener);r.off("removeListener",e._onRemoveListener);e._onNewListener=null;e._onRemoveListener=null}var t=_.call(r,e);r._observers.splice(t,1)}if(t){i=n[t];if(!i)return;s.call(a,t,i);delete n[t];if(! --this._listenersCount){l()}}else{o=c(n);u=o.length;while(u-- >0){t=o[u];s.call(a,t,n[t])}this._listeners={};this._listenersCount=0;l()}}});function m(t,r,i,o){var s=Object.assign({},r);if(!t)return s;if(typeof t!=="object"){throw TypeError("options must be an object")}var a=Object.keys(t);var u=a.length;var l,c;var f;function d(t){throw Error('Invalid "'+l+'" option value'+(t?". Reason: "+t:""))}for(var h=0;h<u;h++){l=a[h];if(!n.call(r,l)){throw Error('Unknown "'+l+'" option')}c=t[l];if(c!==e){f=i[l];s[l]=f?f(c,d):c}}return s}function b(t,e){if(typeof t!=="function"||!t.hasOwnProperty("prototype")){e("value must be a constructor")}return t}function w(t){var e="value must be type of "+t.join("|");var n=t.length;var r=t[0];var i=t[1];if(n===1){return function(t,n){if(typeof t===r){return t}n(e)}}if(n===2){return function(t,n){var o=typeof t;if(o===r||o===i)return t;n(e)}}return function(r,i){var o=typeof r;var s=n;while(s-- >0){if(o===t[s])return r}i(e)}}var y=w(["function"]);var S=w(["object","function"]);function k(t,e,n){var r;var i;var o=0;var s;var a=new t((function(u,l,c){n=m(n,{timeout:0,overload:false},{timeout:function(t,e){t*=1;if(typeof t!=="number"||t<0||!Number.isFinite(t)){e("timeout must be a positive number")}return t}});r=!n.overload&&typeof t.prototype.cancel==="function"&&typeof c==="function";function f(){if(i){i=null}if(o){clearTimeout(o);o=0}}var d=function(t){f();u(t)};var h=function(t){f();l(t)};if(r){e(d,h,c)}else{i=[function(t){h(t||Error("canceled"))}];e(d,h,(function(t){if(s){throw Error("Unable to subscribe on cancel event asynchronously")}if(typeof t!=="function"){throw TypeError("onCancel callback must be a function")}i.push(t)}));s=true}if(n.timeout>0){o=setTimeout((function(){var t=Error("timeout");t.code="ETIMEDOUT";o=0;a.cancel(t);l(t)}),n.timeout)}}));if(!r){a.cancel=function(t){if(!i){return}var e=i.length;for(var n=1;n<e;n++){i[n](t)}i[0](t);i=null}}return a}function _(t){var e=this._observers;if(!e){return-1}var n=e.length;for(var r=0;r<n;r++){if(e[r]._target===t)return r}return-1}function j(t,e,n,r,i){if(!n){return null}if(r===0){var o=typeof e;if(o==="string"){var s,a,u=0,l=0,f=this.delimiter,d=f.length;if((a=e.indexOf(f))!==-1){s=new Array(5);do{s[u++]=e.slice(l,a);l=a+d}while((a=e.indexOf(f,l))!==-1);s[u++]=e.slice(l);e=s;i=u}else{e=[e];i=1}}else if(o==="object"){i=e.length}else{e=[e];i=1}}var h=null,v,p,g,m,b,w=e[r],y=e[r+1],S,k;if(r===i){if(n._listeners){if(typeof n._listeners==="function"){t&&t.push(n._listeners);h=[n]}else{t&&t.push.apply(t,n._listeners);h=[n]}}}else{if(w==="*"){S=c(n);a=S.length;while(a-- >0){v=S[a];if(v!=="_listeners"){k=j(t,e,n[v],r+1,i);if(k){if(h){h.push.apply(h,k)}else{h=k}}}}return h}else if(w==="**"){b=r+1===i||r+2===i&&y==="*";if(b&&n._listeners){h=j(t,e,n,i,i)}S=c(n);a=S.length;while(a-- >0){v=S[a];if(v!=="_listeners"){if(v==="*"||v==="**"){if(n[v]._listeners&&!b){k=j(t,e,n[v],i,i);if(k){if(h){h.push.apply(h,k)}else{h=k}}}k=j(t,e,n[v],r,i)}else if(v===y){k=j(t,e,n[v],r+2,i)}else{k=j(t,e,n[v],r,i)}if(k){if(h){h.push.apply(h,k)}else{h=k}}}}return h}else if(n[w]){h=j(t,e,n[w],r+1,i)}}p=n["*"];if(p){j(t,e,p,r+1,i)}g=n["**"];if(g){if(r<i){if(g._listeners){j(t,e,g,i,i)}S=c(g);a=S.length;while(a-- >0){v=S[a];if(v!=="_listeners"){if(v===y){j(t,e,g[v],r+2,i)}else if(v===w){j(t,e,g[v],r+1,i)}else{m={};m[v]=g[v];j(t,e,{"**":m},r+1,i)}}}}else if(g._listeners){j(t,e,g,i,i)}else if(g["*"]&&g["*"]._listeners){j(t,e,g["*"],i,i)}}return h}function O(t,e,n){var r=0,i=0,o,s=this.delimiter,a=s.length,u;if(typeof t==="string"){if((o=t.indexOf(s))!==-1){u=new Array(5);do{u[r++]=t.slice(i,o);i=o+a}while((o=t.indexOf(s,i))!==-1);u[r++]=t.slice(i)}else{u=[t];r=1}}else{u=t;r=t.length}if(r>1){for(o=0;o+1<r;o++){if(u[o]==="**"&&u[o+1]==="**"){return}}}var l=this.listenerTree,c;for(o=0;o<r;o++){c=u[o];l=l[c]||(l[c]={});if(o===r-1){if(!l._listeners){l._listeners=e}else{if(typeof l._listeners==="function"){l._listeners=[l._listeners]}if(n){l._listeners.unshift(e)}else{l._listeners.push(e)}if(!l._listeners.warned&&this._maxListeners>0&&l._listeners.length>this._maxListeners){l._listeners.warned=true;h.call(this,l._listeners.length,c)}}return true}}return true}function x(t,e,n,r){var i=c(t);var o=i.length;var s,a,u;var l=t["_listeners"];var f;while(o-- >0){a=i[o];s=t[a];if(a==="_listeners"){u=n}else{u=n?n.concat(a):[a]}f=r||typeof a==="symbol";l&&e.push(f?u:u.join(this.delimiter));if(typeof s==="object"){x.call(this,s,e,u,f)}}return e}function E(t){var e=c(t);var n=e.length;var r,i,o;while(n-- >0){i=e[n];r=t[i];if(r){o=true;if(i!=="_listeners"&&!E(r)){delete t[i]}}}return o}function $(t,e,n){this.emitter=t;this.event=e;this.listener=n}$.prototype.off=function(){this.emitter.off(this.event,this.listener);return this};function I(t,n,r){if(r===true){s=true}else if(r===false){i=true}else{if(!r||typeof r!=="object"){throw TypeError("options should be an object or true")}var i=r.async;var s=r.promisify;var a=r.nextTick;var u=r.objectify}if(i||a||s){var c=n;var f=n._origin||n;if(a&&!o){throw Error("process.nextTick is not supported")}if(s===e){s=n.constructor.name==="AsyncFunction"}n=function(){var t=arguments;var e=this;var n=this.event;return s?a?Promise.resolve():new Promise((function(t){l(t)})).then((function(){e.event=n;return c.apply(e,t)})):(a?J.nextTick:l)((function(){e.event=n;c.apply(e,t)}))};n._async=true;n._origin=f}return[n,u?new $(this,t,n):this]}function T(t){this._events={};this._newListener=false;this._removeListener=false;this.verboseMemoryLeak=false;d.call(this,t)}T.EventEmitter2=T;T.prototype.listenTo=function(t,n,i){if(typeof t!=="object"){throw TypeError("target musts be an object")}var o=this;i=m(i,{on:e,off:e,reducers:e},{on:y,off:y,reducers:S});function s(e){if(typeof e!=="object"){throw TypeError("events must be an object")}var n=i.reducers;var r=_.call(o,t);var s;if(r===-1){s=new g(o,t,i)}else{s=o._observers[r]}var a=c(e);var u=a.length;var l;var f=typeof n==="function";for(var d=0;d<u;d++){l=a[d];s.subscribe(l,e[l]||l,f?n:n&&n[l])}}r(n)?s(p(n)):typeof n==="string"?s(p(n.split(/\s+/))):s(n);return this};T.prototype.stopListeningTo=function(t,e){var n=this._observers;if(!n){return false}var r=n.length;var i;var o=false;if(t&&typeof t!=="object"){throw TypeError("target should be an object")}while(r-- >0){i=n[r];if(!t||i._target===t){i.unsubscribe(e);o=true}}return o};T.prototype.delimiter=".";T.prototype.setMaxListeners=function(t){if(t!==e){this._maxListeners=t;if(!this._conf)this._conf={};this._conf.maxListeners=t}};T.prototype.getMaxListeners=function(){return this._maxListeners};T.prototype.event="";T.prototype.once=function(t,e,n){return this._once(t,e,false,n)};T.prototype.prependOnceListener=function(t,e,n){return this._once(t,e,true,n)};T.prototype._once=function(t,e,n,r){return this._many(t,1,e,n,r)};T.prototype.many=function(t,e,n,r){return this._many(t,e,n,false,r)};T.prototype.prependMany=function(t,e,n,r){return this._many(t,e,n,true,r)};T.prototype._many=function(t,e,n,r,i){var o=this;if(typeof n!=="function"){throw new Error("many only accepts instances of Function")}function s(){if(--e===0){o.off(t,s)}return n.apply(this,arguments)}s._origin=n;return this._on(t,s,r,i)};T.prototype.emit=function(){if(!this._events&&!this._all){return false}this._events||f.call(this);var t=arguments[0],e,n=this.wildcard;var r,i,o,a,u;if(t==="newListener"&&!this._newListener){if(!this._events.newListener){return false}}if(n){e=t;if(t!=="newListener"&&t!=="removeListener"){if(typeof t==="object"){i=t.length;if(s){for(o=0;o<i;o++){if(typeof t[o]==="symbol"){u=true;break}}}if(!u){t=t.join(this.delimiter)}}}}var l=arguments.length;var c;if(this._all&&this._all.length){c=this._all.slice();for(o=0,i=c.length;o<i;o++){this.event=t;switch(l){case 1:c[o].call(this,t);break;case 2:c[o].call(this,t,arguments[1]);break;case 3:c[o].call(this,t,arguments[1],arguments[2]);break;default:c[o].apply(this,arguments)}}}if(n){c=[];j.call(this,c,e,this.listenerTree,0,i)}else{c=this._events[t];if(typeof c==="function"){this.event=t;switch(l){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:r=new Array(l-1);for(a=1;a<l;a++)r[a-1]=arguments[a];c.apply(this,r)}return true}else if(c){c=c.slice()}}if(c&&c.length){if(l>3){r=new Array(l-1);for(a=1;a<l;a++)r[a-1]=arguments[a]}for(o=0,i=c.length;o<i;o++){this.event=t;switch(l){case 1:c[o].call(this);break;case 2:c[o].call(this,arguments[1]);break;case 3:c[o].call(this,arguments[1],arguments[2]);break;default:c[o].apply(this,r)}}return true}else if(!this.ignoreErrors&&!this._all&&t==="error"){if(arguments[1]instanceof Error){throw arguments[1]}else{throw new Error("Uncaught, unspecified 'error' event.")}}return!!this._all};T.prototype.emitAsync=function(){if(!this._events&&!this._all){return false}this._events||f.call(this);var t=arguments[0],e=this.wildcard,n,r;var i,o,a,u;if(t==="newListener"&&!this._newListener){if(!this._events.newListener){return Promise.resolve([false])}}if(e){n=t;if(t!=="newListener"&&t!=="removeListener"){if(typeof t==="object"){o=t.length;if(s){for(a=0;a<o;a++){if(typeof t[a]==="symbol"){r=true;break}}}if(!r){t=t.join(this.delimiter)}}}}var l=[];var c=arguments.length;var d;if(this._all){for(a=0,o=this._all.length;a<o;a++){this.event=t;switch(c){case 1:l.push(this._all[a].call(this,t));break;case 2:l.push(this._all[a].call(this,t,arguments[1]));break;case 3:l.push(this._all[a].call(this,t,arguments[1],arguments[2]));break;default:l.push(this._all[a].apply(this,arguments))}}}if(e){d=[];j.call(this,d,n,this.listenerTree,0)}else{d=this._events[t]}if(typeof d==="function"){this.event=t;switch(c){case 1:l.push(d.call(this));break;case 2:l.push(d.call(this,arguments[1]));break;case 3:l.push(d.call(this,arguments[1],arguments[2]));break;default:i=new Array(c-1);for(u=1;u<c;u++)i[u-1]=arguments[u];l.push(d.apply(this,i))}}else if(d&&d.length){d=d.slice();if(c>3){i=new Array(c-1);for(u=1;u<c;u++)i[u-1]=arguments[u]}for(a=0,o=d.length;a<o;a++){this.event=t;switch(c){case 1:l.push(d[a].call(this));break;case 2:l.push(d[a].call(this,arguments[1]));break;case 3:l.push(d[a].call(this,arguments[1],arguments[2]));break;default:l.push(d[a].apply(this,i))}}}else if(!this.ignoreErrors&&!this._all&&t==="error"){if(arguments[1]instanceof Error){return Promise.reject(arguments[1])}else{return Promise.reject("Uncaught, unspecified 'error' event.")}}return Promise.all(l)};T.prototype.on=function(t,e,n){return this._on(t,e,false,n)};T.prototype.prependListener=function(t,e,n){return this._on(t,e,true,n)};T.prototype.onAny=function(t){return this._onAny(t,false)};T.prototype.prependAny=function(t){return this._onAny(t,true)};T.prototype.addListener=T.prototype.on;T.prototype._onAny=function(t,e){if(typeof t!=="function"){throw new Error("onAny only accepts instances of Function")}if(!this._all){this._all=[]}if(e){this._all.unshift(t)}else{this._all.push(t)}return this};T.prototype._on=function(t,n,r,i){if(typeof t==="function"){this._onAny(t,n);return this}if(typeof n!=="function"){throw new Error("on only accepts instances of Function")}this._events||f.call(this);var o=this,s;if(i!==e){s=I.call(this,t,n,i);n=s[0];o=s[1]}if(this._newListener){this.emit("newListener",t,n)}if(this.wildcard){O.call(this,t,n,r);return o}if(!this._events[t]){this._events[t]=n}else{if(typeof this._events[t]==="function"){this._events[t]=[this._events[t]]}if(r){this._events[t].unshift(n)}else{this._events[t].push(n)}if(!this._events[t].warned&&this._maxListeners>0&&this._events[t].length>this._maxListeners){this._events[t].warned=true;h.call(this,this._events[t].length,t)}}return o};T.prototype.off=function(t,e){if(typeof e!=="function"){throw new Error("removeListener only takes instances of Function")}var n,i=[];if(this.wildcard){var o=typeof t==="string"?t.split(this.delimiter):t.slice();i=j.call(this,null,o,this.listenerTree,0);if(!i)return this}else{if(!this._events[t])return this;n=this._events[t];i.push({_listeners:n})}for(var s=0;s<i.length;s++){var a=i[s];n=a._listeners;if(r(n)){var u=-1;for(var l=0,c=n.length;l<c;l++){if(n[l]===e||n[l].listener&&n[l].listener===e||n[l]._origin&&n[l]._origin===e){u=l;break}}if(u<0){continue}if(this.wildcard){a._listeners.splice(u,1)}else{this._events[t].splice(u,1)}if(n.length===0){if(this.wildcard){delete a._listeners}else{delete this._events[t]}}if(this._removeListener)this.emit("removeListener",t,e);return this}else if(n===e||n.listener&&n.listener===e||n._origin&&n._origin===e){if(this.wildcard){delete a._listeners}else{delete this._events[t]}if(this._removeListener)this.emit("removeListener",t,e)}}this.listenerTree&&E(this.listenerTree);return this};T.prototype.offAny=function(t){var e=0,n=0,r;if(t&&this._all&&this._all.length>0){r=this._all;for(e=0,n=r.length;e<n;e++){if(t===r[e]){r.splice(e,1);if(this._removeListener)this.emit("removeListenerAny",t);return this}}}else{r=this._all;if(this._removeListener){for(e=0,n=r.length;e<n;e++)this.emit("removeListenerAny",r[e])}this._all=[]}return this};T.prototype.removeListener=T.prototype.off;T.prototype.removeAllListeners=function(t){if(t===e){!this._events||f.call(this);return this}if(this.wildcard){var n=j.call(this,null,t,this.listenerTree,0),r,i;if(!n)return this;for(i=0;i<n.length;i++){r=n[i];r._listeners=null}this.listenerTree&&E(this.listenerTree)}else if(this._events){this._events[t]=null}return this};T.prototype.listeners=function(t){var n=this._events;var r,i,o;var s;var a;if(t===e){if(this.wildcard){throw Error("event name required for wildcard emitter")}if(!n){return[]}r=c(n);s=r.length;o=[];while(s-- >0){i=n[r[s]];if(typeof i==="function"){o.push(i)}else{o.push.apply(o,i)}}return o}else{if(this.wildcard){a=this.listenerTree;if(!a)return[];var u=[];var l=typeof t==="string"?t.split(this.delimiter):t.slice();j.call(this,u,l,a,0);return u}if(!n){return[]}i=n[t];if(!i){return[]}return typeof i==="function"?[i]:i}};T.prototype.eventNames=function(t){var e=this._events;return this.wildcard?x.call(this,this.listenerTree,[],null,t):e?c(e):[]};T.prototype.listenerCount=function(t){return this.listeners(t).length};T.prototype.hasListeners=function(t){if(this.wildcard){var n=[];var r=typeof t==="string"?t.split(this.delimiter):t.slice();j.call(this,n,r,this.listenerTree,0);return n.length>0}var i=this._events;var o=this._all;return!!(o&&o.length||i&&(t===e?c(i).length:i[t]))};T.prototype.listenersAny=function(){if(this._all){return this._all}else{return[]}};T.prototype.waitFor=function(t,n){var r=this;var i=typeof n;if(i==="number"){n={timeout:n}}else if(i==="function"){n={filter:n}}n=m(n,{timeout:0,filter:e,handleError:false,Promise,overload:false},{filter:y,Promise:b});return k(n.Promise,(function(e,i,o){function s(){var o=n.filter;if(o&&!o.apply(r,arguments)){return}r.off(t,s);if(n.handleError){var a=arguments[0];a?i(a):e(v.apply(null,arguments).slice(1))}else{e(v.apply(null,arguments))}}o((function(){r.off(t,s)}));r._on(t,s,false)}),{timeout:n.timeout,overload:n.overload})};function A(t,e,n){n=m(n,{Promise,timeout:0,overload:false},{Promise:b});var r=n.Promise;return k(r,(function(n,r,i){var o;if(typeof t.addEventListener==="function"){o=function(){n(v.apply(null,arguments))};i((function(){t.removeEventListener(e,o)}));t.addEventListener(e,o,{once:true});return}var s=function(){a&&t.removeListener("error",a);n(v.apply(null,arguments))};var a;if(e!=="error"){a=function(n){t.removeListener(e,s);r(n)};t.once("error",a)}i((function(){a&&t.removeListener("error",a);t.removeListener(e,s)}));t.once(e,s)}),{timeout:n.timeout,overload:n.overload})}var P=T.prototype;Object.defineProperties(T,{defaultMaxListeners:{get:function(){return P._maxListeners},set:function(t){if(typeof t!=="number"||t<0||Number.isNaN(t)){throw TypeError("n must be a non-negative number")}P._maxListeners=t},enumerable:true},once:{value:A,writable:true,configurable:true}});Object.defineProperties(P,{_maxListeners:{value:i,writable:true,configurable:true},_observers:{value:null,writable:true,configurable:true}});{t.exports=T}}()})(Gn);return Gn.exports}var Wn=Hn();var Qn;var Kn;function Xn(){if(Kn)return Qn;Kn=1;var t=i();var e=o();var n=s();var r=typeof window!=="undefined"?window:G;Qn={assign:t,create:e,trim:n,bind:a,slice:u,each:l,map:c,pluck:f,isList:d,isFunction:h,isObject:v,Global:r};function i(){if(Object.assign){return Object.assign}else{return function t(e,n,r,i){for(var o=1;o<arguments.length;o++){l(Object(arguments[o]),(function(t,n){e[n]=t}))}return e}}}function o(){if(Object.create){return function e(n,r,i,o){var s=u(arguments,1);return t.apply(this,[Object.create(n)].concat(s))}}else{function e(){}return function n(r,i,o,s){var a=u(arguments,1);e.prototype=r;return t.apply(this,[new e].concat(a))}}}function s(){if(String.prototype.trim){return function t(e){return String.prototype.trim.call(e)}}else{return function t(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}}function a(t,e){return function(){return e.apply(t,Array.prototype.slice.call(arguments,0))}}function u(t,e){return Array.prototype.slice.call(t,e||0)}function l(t,e){f(t,(function(t,n){e(t,n);return false}))}function c(t,e){var n=d(t)?[]:{};f(t,(function(t,r){n[r]=e(t,r);return false}));return n}function f(t,e){if(d(t)){for(var n=0;n<t.length;n++){if(e(t[n],n)){return t[n]}}}else{for(var r in t){if(t.hasOwnProperty(r)){if(e(t[r],r)){return t[r]}}}}}function d(t){return t!=null&&typeof t!="function"&&typeof t.length=="number"}function h(t){return t&&{}.toString.call(t)==="[object Function]"}function v(t){return t&&{}.toString.call(t)==="[object Object]"}return Qn}var Zn;var Yn;function tr(){if(Yn)return Zn;Yn=1;var t=Xn();var e=t.slice;var n=t.pluck;var r=t.each;var i=t.bind;var o=t.create;var s=t.isList;var a=t.isFunction;var u=t.isObject;Zn={createStore:f};var l={version:"2.0.12",enabled:false,get:function(t,e){var n=this.storage.read(this._namespacePrefix+t);return this._deserialize(n,e)},set:function(t,e){if(e===undefined){return this.remove(t)}this.storage.write(this._namespacePrefix+t,this._serialize(e));return e},remove:function(t){this.storage.remove(this._namespacePrefix+t)},each:function(t){var e=this;this.storage.each((function(n,r){t.call(e,e._deserialize(n),(r||"").replace(e._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(t){return this._namespacePrefix=="__storejs_"+t+"_"},createStore:function(){return f.apply(this,arguments)},addPlugin:function(t){this._addPlugin(t)},namespace:function(t){return f(this.storage,this.plugins,t)}};function c(){var t=typeof console=="undefined"?null:console;if(!t){return}var e=t.warn?t.warn:t.log;e.apply(t,arguments)}function f(t,f,d){if(!d){d=""}if(t&&!s(t)){t=[t]}if(f&&!s(f)){f=[f]}var h=d?"__storejs_"+d+"_":"";var v=d?new RegExp("^"+h):null;var p=/^[a-zA-Z0-9_\-]*$/;if(!p.test(d)){throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes")}var g={_namespacePrefix:h,_namespaceRegexp:v,_testStorage:function(t){try{var e="__storejs__test__";t.write(e,e);var n=t.read(e)===e;t.remove(e);return n}catch(t){return false}},_assignPluginFnProp:function(t,n){var i=this[n];this[n]=function n(){var o=e(arguments,0);var s=this;function a(){if(!i){return}r(arguments,(function(t,e){o[e]=t}));return i.apply(s,o)}var u=[a].concat(o);return t.apply(s,u)}},_serialize:function(t){return JSON.stringify(t)},_deserialize:function(t,e){if(!t){return e}var n="";try{n=JSON.parse(t)}catch(e){n=t}return n!==undefined?n:e},_addStorage:function(t){if(this.enabled){return}if(this._testStorage(t)){this.storage=t;this.enabled=true}},_addPlugin:function(t){var e=this;if(s(t)){r(t,(function(t){e._addPlugin(t)}));return}var i=n(this.plugins,(function(e){return t===e}));if(i){return}this.plugins.push(t);if(!a(t)){throw new Error("Plugins must be function values that return objects")}var o=t.call(this);if(!u(o)){throw new Error("Plugins must return an object of function properties")}r(o,(function(n,r){if(!a(n)){throw new Error("Bad plugin property: "+r+" from plugin "+t.name+". Plugins should only return functions.")}e._assignPluginFnProp(n,r)}))},addStorage:function(t){c("store.addStorage(storage) is deprecated. Use createStore([storages])");this._addStorage(t)}};var m=o(g,l,{plugins:[]});m.raw={};r(m,(function(t,e){if(a(t)){m.raw[e]=i(m,t)}}));r(t,(function(t){m._addStorage(t)}));r(f,(function(t){m._addPlugin(t)}));return m}return Zn}var er=tr();var nr;var rr;function ir(){if(rr)return nr;rr=1;var t=Xn();var e=t.Global;nr={name:"localStorage",read:r,write:i,each:o,remove:s,clearAll:a};function n(){return e.localStorage}function r(t){return n().getItem(t)}function i(t,e){return n().setItem(t,e)}function o(t){for(var e=n().length-1;e>=0;e--){var i=n().key(e);t(r(i),i)}}function s(t){return n().removeItem(t)}function a(){return n().clear()}return nr}var or=ir();var sr=V(or);var ar=t({__proto__:null,default:sr},[or]);var ur;var lr;function cr(){if(lr)return ur;lr=1;var t=Xn();var e=t.Global;ur={name:"sessionStorage",read:r,write:i,each:o,remove:s,clearAll:a};function n(){return e.sessionStorage}function r(t){return n().getItem(t)}function i(t,e){return n().setItem(t,e)}function o(t){for(var e=n().length-1;e>=0;e--){var i=n().key(e);t(r(i),i)}}function s(t){return n().removeItem(t)}function a(){return n().clear()}return ur}var fr=cr();var dr=V(fr);var hr=t({__proto__:null,default:dr},[fr]);var vr;var pr;function gr(){if(pr)return vr;pr=1;var t=Xn();var e=t.Global;var n=t.trim;vr={name:"cookieStorage",read:i,write:s,each:o,remove:a,clearAll:u};var r=e.document;function i(t){if(!t||!l(t)){return null}var e="(?:^|.*;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(r.cookie.replace(new RegExp(e),"$1"))}function o(t){var e=r.cookie.split(/; ?/g);for(var i=e.length-1;i>=0;i--){if(!n(e[i])){continue}var o=e[i].split("=");var s=unescape(o[0]);var a=unescape(o[1]);t(a,s)}}function s(t,e){if(!t){return}r.cookie=escape(t)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"}function a(t){if(!t||!l(t)){return}r.cookie=escape(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"}function u(){o((function(t,e){a(e)}))}function l(t){return new RegExp("(?:^|;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(r.cookie)}return vr}var mr=gr();var br=V(mr);var wr=t({__proto__:null,default:br},[mr]);var yr;var Sr;function kr(){if(Sr)return yr;Sr=1;yr={name:"memoryStorage",read:e,write:n,each:r,remove:i,clearAll:o};var t={};function e(e){return t[e]}function n(e,n){t[e]=n}function r(e){for(var n in t){if(t.hasOwnProperty(n)){e(t[n],n)}}}function i(e){delete t[e]}function o(e){t={}}return yr}var _r=kr();var jr=V(_r);var Or=t({__proto__:null,default:jr},[_r]);function xr(t,e){void 0===e&&(e=false),t+="";for(var n,r=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],i=["0","1","2","3","4","5","6","7","8","9"],o=(e=e||!Salla.config.get("store.settings.arabic_numbers_enabled"))?r:i,s=e?i:r,a=0;a<o.length;a++)n=new RegExp(o[a],"g"),t=t.replace(n,s[a]);return t.replace(e?"٫":".",e?".":"٫")}function Er(t){var e=("".concat(t).match(/\./g)||[]).length;return e&&1!==e?Er(t.replace(/\.(.+)\./g,".$1")):t}function $r(t){return"".concat(t).startsWith("https://")||"".concat(t).startsWith("http://")}function Ir(t){if($r(t))return t;var e=Salla.config.get("store.url");return e||(e=window.location.href.split("/").slice(0,-1).join("/"),Salla.config.set("store.url",e)),e.rtrim("/")+"/"+(null==t?void 0:t.ltrim("/"))}function Tr(t,e,n){if(n=n||window.location.href,!e||!t)return n;var r=new RegExp("([?&])"+t+"=[^&]+[&]?","g");return(n=n.replace(r,"$1").split("#")[0].replace(/&$|\?$/,"")).includes("?")?n+="&":n+=(n.endsWith("/")?"":"/")+"?",(n+t+"="+encodeURIComponent(e)).replace(/&$|\?$/,"")}function Ar(t){return window.location.origin+"/"+(null==t?void 0:t.ltrim("/"))}function Pr(t){return $r(t)?t:Salla.config.get("theme.assets")?Salla.config.get("theme.assets").replace(":path",null==t?void 0:t.ltrim("/")):Ar("themes/"+Salla.config.get("theme.name")+"/"+(null==t?void 0:t.ltrim("/")))}function Rr(t,e,n){var r,i=t[0];return n&&0==t.length?Array.isArray(n)?(n.push(e),n):[n,e]:Array.isArray(n)?(n.push(e),n):"string"==typeof n?[n,e]:n?(n[i]=Rr(t.slice(1),e,n[i]),n):i?((r={})[i]=Rr(t.slice(1),e),r):""===i?[e]:e}function zr(){return window.self!==window.top}String.prototype.toStudlyCase=function(){return this.trim().replace(/([^a-zA-Z\d].)/g,(function(t){return t.toUpperCase().replace(/[^a-zA-Z\d]/g,"")}))},String.prototype.toDatasetName=function(){return this.startsWith("data-")?this.substr(5).toStudlyCase():this.toStudlyCase()},String.prototype.toSelector=function(){return this.trim().startsWith(".")||this.trim().startsWith("#")?this.toString():"#"+this.toString()},String.prototype.replaceArray=function(t,e){for(var n,r=this,i=0;i<t.length;i++)n=new RegExp(t[i],"g"),r=r.replace(n,e[i]);return r},String.prototype.rtrim=function(t){return void 0===t&&(t="\\s"),this.replace(new RegExp("["+t+"]*$"),"")},String.prototype.ltrim=function(t){return void 0===t&&(t="\\s"),this.replace(new RegExp("^["+t+"]*"),"")},String.prototype.digitsOnly=function(){return Salla.helpers.digitsOnly(this)};var Fr={digitsOnly:function(t){return xr(t,true).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function t(e,n){if(void 0===n&&(n=false),"string"==typeof e)return document.querySelectorAll(e).forEach((function(e){return t(e,n)}));if(e){var r=Salla.helpers.digitsOnly(e.value);return e.min&&r<parseInt(e.min)?e.value=e.min:e.max&&r>parseInt(e.max)?e.value=e.max:e.maxLength>=1&&r.toString().length>e.maxLength?e.value=r.toString().substring(0,e.maxLength):e.value=n||e.dataset.hasOwnProperty("digitsWithDecimal")?Er(r):r.replace(/\D/g,"")}Salla.logger.warn("Can't find Object With Id: "+e)},number:xr,money:function(t,e){void 0===e&&(e=true);var n=Salla.config.currency(null==t?void 0:t.currency).symbol;return t=xr(t="object"==typeof t?t.amount:t)+" "+n,e&&["SAR","ر.س"].includes(n)&&Salla.config.get("store.settings.use_sar_symbol")&&(t=t.replace(n,"<i class=sicon-sar></i>")),t},isIframe:zr,isPreview:function(){return zr()},setNested:function(t,e,n){for(var r=t,i=e.split("."),o=i.length,s=0;s<o-1;s++){var a=i[s];r[a]||(r[a]={}),r=r[a]}return r[i[o-1]]=n,t},getNested:function(t,e,n){var r=Jn(t,e);return void 0!==r?r:n},inputData:function(t,e,n){if(void 0===n&&(n={}),t.includes("[")){var r=t.split("]").join("").split("["),i=r[0],o=n&&"object"==typeof n?n[i]:void 0;return{name:i,value:Rr(r.slice(1),e,o)}}return{name:t,value:e}},url:Object.freeze({__proto__:null,addParamToUrl:Tr,api:function(t){var e;return(null===(e=Salla.config.get("store.api",Ir("")))||void 0===e?void 0:e.rtrim("/"))+"/"+(null==t?void 0:t.ltrim("/"))},asset:Pr,base:function(t){return $r(t)?t:"https://"+new URL(Ir("/")).hostname+"/"+(null==t?void 0:t.ltrim("/"))},baseUrl:Ar,cdn:function(t,e,n){var r="https://cdn.salla.network/";return(e||n)&&(e=e?",width=".concat(e):"",n=n?",height=".concat(n):"",r+="cdn-cgi/image/fit=scale-down".concat(e).concat(n,",onerror=redirect,format=auto/")),r+(null==t?void 0:t.ltrim("/"))},domain:function(t){return $r(t)?t:"".concat(Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/"),"/").concat(null==t?void 0:t.ltrim("/"))},get:Ir,is_full_url:$r,is_page:function(t){return t&&Salla.config.get("page.slug")===t},is_placeholder:function(t){return Pr(salla.config.get("theme.settings.placeholder"))===Pr(t)}}),addParamToUrl:Tr,debounce:function(t,e){e=e||100;var n,r=[];return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];return clearTimeout(n),n=setTimeout((function(){var e=t.apply(void 0,i);r.forEach((function(t){return t(e)})),r=[]}),e),new Promise((function(t){return r.push(t)}))}},hasApplePay:function(){var t;try{return!!(null===(t=window.ApplePaySession)||void 0===t?void 0:t.canMakePayments())}catch(t){return console.error(t),false}}},Cr=function(t,e){return Cr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Cr(t,e)};var Ur=function(){return Ur=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ur.apply(this,arguments)};function Nr(t,e,n){if(2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}"function"==typeof SuppressedError&&SuppressedError;var Dr,Lr,qr,Mr,Br=(Dr=console,Lr=[],qr=[],Mr={log:function(t,e){if(Dr&&salla.config.isDebug()){Lr.push([e,t]),"trace"===salla.config.get("debug")&&(e="trace");var n=Dr.log,r=void 0===e?n:this.__dict__[e]||n,i=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"];qr.forEach((function(t){i[0]+=t[0],i.push(t[1])}));var o={event:"#CFF680",backend:"#7b68ee"}[e];o&&(i[0]+="%c"+e[0].toUpperCase()+e.substring(1),i.push("margin-left: 5px;color: ".concat(o,";font-weight:bold; border:1px solid ").concat(o,"; padding: 2px 6px; border-radius: 5px;"))),r.call.apply(r,Nr([Dr],i.concat.apply(i,t),false))}},__dict__:{trace:Dr.trace,debug:Dr.debug,info:Dr.info,warn:Dr.warn,error:Dr.error}},{event:function(){Mr.log(arguments,"event")},trace:function(){Mr.log(arguments,"trace")},debug:function(){Mr.log(arguments,"debug")},info:function(){Mr.log(arguments,"info")},warn:function(){Mr.log(arguments,"warn")},error:function(){Mr.log(arguments,"error")},log:function(){Mr.log(arguments,void 0)},backend:function(){Mr.log(arguments,"backend")},logs:function(t){[t].flat().forEach((function(t){return t&&Mr.log([t].flat(),"backend")}))},history:function(){return Lr.map((function(t){return Dr.log.apply(Dr,Nr([t[0]],t[1],false))})),Lr},addPrefix:function(t){return Array.isArray(t)?qr.unshift(t):this.warn("addPrefix receives array only!"),this}}),Jr=function(){function t(t,e){void 0===t&&(t={}),void 0===e&&(e={}),this.default_properties=e,this.properties_=Ur(Ur({},this.default_properties),t)}return t.prototype.merge=function(t){var e;return this.properties_=Ur(Ur({},this.properties_),t),this.properties_.store=Ur(Ur({},(null===(e=this.default_properties)||void 0===e?void 0:e.store)||{}),this.properties_.store),this},t.prototype.set=function(t,e){return t.includes(".")?(Salla.helpers.setNested(this.properties_,t,e),this):(this.properties_[t]=e,this)},t.prototype.currency=function(t){return void 0===t&&(t=void 0),t=t||this.get("user.currency_code"),this.get("currencies."+t)||Object.values(this.get("currencies"))[0]},t.prototype.get=function(t,e){return void 0===e&&(e=null),t.includes(".")?Salla.helpers.getNested(this.properties_,t,e):this.properties_.hasOwnProperty(t)?this.properties_[t]||e:e||void 0},t.prototype.all=function(){return this.properties_},t.prototype.isDebug=function(){return this.get("debug")||Salla.storage.get("debug")},t}(),Gr=function(t){function e(){var e=this;return(e=t.call(this,{wildcard:true,delimiter:"::",newListener:false,removeListener:false,maxListeners:10,verboseMemoryLeak:false,ignoreErrors:false})||this).delimiter="::","undefined"!=typeof document&&(e.body=document.querySelector("body")),e.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],e.ingoreLogEvents=["document::click","document::keyup","document::change"],e.noneFireableActions=["document.request"],e.emittedEvents=new Set,e}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Cr(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(e,t),e.prototype.createAndDispatch=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];this.dispatch.apply(this,Nr([t],e,false))},e.prototype.emit=function(e){for(var n,r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];this.emittedEvents.add(e);var o=e.replace("::",".");if(!this.noneFireableActions.includes(o)&&Salla.call&&"function"==typeof Salla.call(o))return Salla.log("'Salla.".concat(o,"(...)' triggered using event '").concat(e,"'")),o=o.split("."),Array.isArray(r[0])&&(r=r[0]),void(n=salla[o[0]])[o[1]].apply(n,r);t.prototype.emit.apply(this,Nr([e],r,false)),this.trackEvents.apply(this,Nr([e],r,false))},e.prototype.onlyWhen=function(t,e){var n=this;return e=e||function(){},new Promise((function(r){return n.emittedEvents.has(t)?r(e()):n.once(t,(function(){return r(e())}))}))},e.prototype.emitAsync=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.emittedEvents.add(e);var i=t.prototype.emitAsync.apply(this,Nr([e],n,false));try{this.trackEvents.apply(this,Nr([e],n,false))}catch(t){Salla.logger.warn("error on tracking event (".concat(e,")"),n,t)}return i},e.prototype.trackEvents=function(t){for(var e,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if("undefined"!=typeof window)try{window.dataLayer=window.dataLayer||[];var i={event:t};n.map((function(t){return"object"==typeof t&&(i=Ur(Ur({},i),t))})),window.dataLayer.push(i)}catch(t){salla.logger.error(t.message)}Salla.logger&&!this.ingoreLogEvents.includes(t)&&(e=Salla.logger).event.apply(e,Nr([t],n,false)),this.dispatch