UNPKG

@salla.sa/twilight-components

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