@salla.sa/twilight-components 2.14.145 → 2.14.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{app-globals-11cff6bd.js → app-globals-1c4dc47c.js} +2933 -1159
- package/dist/cjs/app-globals-1c4dc47c.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/components/index.js +2932 -1158
- package/dist/components/index.js.map +1 -1
- package/dist/esm/{app-globals-7e4f7df9.js → app-globals-97d2497d.js} +2933 -1159
- package/dist/esm/app-globals-97d2497d.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/app-globals-97d2497d.js +25 -0
- package/dist/esm-es5/app-globals-97d2497d.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/{p-582bc399.system.js → p-02b00785.system.js} +2 -2
- package/dist/twilight/p-591846bc.system.js +25 -0
- package/dist/twilight/p-591846bc.system.js.map +1 -0
- package/dist/twilight/p-92483be2.js +25 -0
- package/dist/twilight/p-92483be2.js.map +1 -0
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/package.json +5 -5
- package/dist/cjs/app-globals-11cff6bd.js.map +0 -1
- package/dist/esm/app-globals-7e4f7df9.js.map +0 -1
- package/dist/esm-es5/app-globals-7e4f7df9.js +0 -25
- package/dist/esm-es5/app-globals-7e4f7df9.js.map +0 -1
- package/dist/twilight/p-3adbf730.js +0 -25
- package/dist/twilight/p-3adbf730.js.map +0 -1
- package/dist/twilight/p-cc475dfb.system.js +0 -25
- package/dist/twilight/p-cc475dfb.system.js.map +0 -1
- /package/dist/twilight/{p-582bc399.system.js.map → p-02b00785.system.js.map} +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
var __extends=this&&this.__extends||function(){var e=function(t,r){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]};return e(t,r)};return function(t,r){if(typeof r!=="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}();var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];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,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?r(e.value):i(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,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(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,s[0]&&(r=0)),r)try{if(n=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:r.label++;return{value:s[1],done:false};case 5:r.label++;i=s[1];s=[0];continue;case 7:s=r.ops.pop();r.trys.pop();continue;default:if(!(a=r.trys,a=a.length>0&&a[a.length-1])&&(s[0]===6||s[0]===2)){r=0;continue}if(s[0]===3&&(!a||s[1]>a[0]&&s[1]<a[3])){r.label=s[1];break}if(s[0]===6&&r.label<a[1]){r.label=a[1];a=s;break}if(a&&r.label<a[2]){r.label=a[2];r.ops.push(s);break}if(a[2])r.ops.pop();r.trys.pop();continue}s=t.call(e,r)}catch(e){s=[6,e];i=0}finally{n=a=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __asyncValues=this&&this.__asyncValues||function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof __values==="function"?__values(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(t){r[t]=e[t]&&function(r){return new Promise((function(n,a){r=e[t](r),i(n,a,r.done,r.value)}))}}function i(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}};var __await=this&&this.__await||function(e){return this instanceof __await?(this.v=e,this):new __await(e)};var __asyncDelegator=this&&this.__asyncDelegator||function(e){var t,r;return t={},n("next"),n("throw",(function(e){throw e})),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:__await(e[n](t)),done:false}:i?i(t):t}:i}};var __asyncGenerator=this&&this.__asyncGenerator||function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,a=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){if(n[e])i[e]=function(t){return new Promise((function(r,n){a.push([e,t,r,n])>1||s(e,t)}))}}function s(e,t){try{l(n[e](t))}catch(e){d(a[0][3],e)}}function l(e){e.value instanceof __await?Promise.resolve(e.value.v).then(c,u):d(a[0][2],e)}function c(e){s("next",e)}function u(e){s("throw",e)}function d(e,t){if(e(t),a.shift(),a.length)s(a[0][0],a[0][1])}};var __spreadArray=this&&this.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,a;n<i;n++){if(a||!(n in t)){if(!a)a=Array.prototype.slice.call(t,0,n);a[n]=t[n]}}return e.concat(a||Array.prototype.slice.call(t))};var __values=this&&this.__values||function(e){var t=typeof Symbol==="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length==="number")return{next:function(){if(e&&n>=e.length)e=void 0;return{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};var _q;
|
|
2
|
+
/*!
|
|
3
|
+
* Crafted with ❤ by Salla
|
|
4
|
+
*/import{c as commonjsGlobal,a as createCommonjsModule}from"./_commonjsHelpers-1415ffd3.js";var isArray$1=Array.isArray;var isArray_1=isArray$1;var freeGlobal=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal;var _freeGlobal=freeGlobal;var freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;var root=_freeGlobal||freeSelf||Function("return this")();var _root=root;var Symbol$1=_root.Symbol;var _Symbol=Symbol$1;var objectProto$4=Object.prototype;var hasOwnProperty$4=objectProto$4.hasOwnProperty;var nativeObjectToString$1=objectProto$4.toString;var symToStringTag$1=_Symbol?_Symbol.toStringTag:undefined;function getRawTag(e){var t=hasOwnProperty$4.call(e,symToStringTag$1),r=e[symToStringTag$1];try{e[symToStringTag$1]=undefined;var n=true}catch(e){}var i=nativeObjectToString$1.call(e);if(n){if(t){e[symToStringTag$1]=r}else{delete e[symToStringTag$1]}}return i}var _getRawTag=getRawTag;var objectProto$3=Object.prototype;var nativeObjectToString=objectProto$3.toString;function objectToString(e){return nativeObjectToString.call(e)}var _objectToString=objectToString;var nullTag="[object Null]",undefinedTag="[object Undefined]";var symToStringTag=_Symbol?_Symbol.toStringTag:undefined;function baseGetTag(e){if(e==null){return e===undefined?undefinedTag:nullTag}return symToStringTag&&symToStringTag in Object(e)?_getRawTag(e):_objectToString(e)}var _baseGetTag=baseGetTag;function isObjectLike(e){return e!=null&&typeof e=="object"}var isObjectLike_1=isObjectLike;var symbolTag="[object Symbol]";function isSymbol(e){return typeof e=="symbol"||isObjectLike_1(e)&&_baseGetTag(e)==symbolTag}var isSymbol_1=isSymbol;var reIsDeepProp=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,reIsPlainProp=/^\w*$/;function isKey(e,t){if(isArray_1(e)){return false}var r=typeof e;if(r=="number"||r=="symbol"||r=="boolean"||e==null||isSymbol_1(e)){return true}return reIsPlainProp.test(e)||!reIsDeepProp.test(e)||t!=null&&e in Object(t)}var _isKey=isKey;function isObject$3(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var isObject_1=isObject$3;var asyncTag="[object AsyncFunction]",funcTag="[object Function]",genTag="[object GeneratorFunction]",proxyTag="[object Proxy]";function isFunction$3(e){if(!isObject_1(e)){return false}var t=_baseGetTag(e);return t==funcTag||t==genTag||t==asyncTag||t==proxyTag}var isFunction_1=isFunction$3;var coreJsData=_root["__core-js_shared__"];var _coreJsData=coreJsData;var maskSrcKey=function(){var e=/[^.]+$/.exec(_coreJsData&&_coreJsData.keys&&_coreJsData.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function isMasked(e){return!!maskSrcKey&&maskSrcKey in e}var _isMasked=isMasked;var funcProto$1=Function.prototype;var funcToString$1=funcProto$1.toString;function toSource(e){if(e!=null){try{return funcToString$1.call(e)}catch(e){}try{return e+""}catch(e){}}return""}var _toSource=toSource;var reRegExpChar=/[\\^$.*+?()[\]{}|]/g;var reIsHostCtor=/^\[object .+?Constructor\]$/;var funcProto=Function.prototype,objectProto$2=Object.prototype;var funcToString=funcProto.toString;var hasOwnProperty$3=objectProto$2.hasOwnProperty;var reIsNative=RegExp("^"+funcToString.call(hasOwnProperty$3).replace(reRegExpChar,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function baseIsNative(e){if(!isObject_1(e)||_isMasked(e)){return false}var t=isFunction_1(e)?reIsNative:reIsHostCtor;return t.test(_toSource(e))}var _baseIsNative=baseIsNative;function getValue(e,t){return e==null?undefined:e[t]}var _getValue=getValue;function getNative(e,t){var r=_getValue(e,t);return _baseIsNative(r)?r:undefined}var _getNative=getNative;var nativeCreate=_getNative(Object,"create");var _nativeCreate=nativeCreate;function hashClear(){this.__data__=_nativeCreate?_nativeCreate(null):{};this.size=0}var _hashClear=hashClear;function hashDelete(e){var t=this.has(e)&&delete this.__data__[e];this.size-=t?1:0;return t}var _hashDelete=hashDelete;var HASH_UNDEFINED$1="__lodash_hash_undefined__";var objectProto$1=Object.prototype;var hasOwnProperty$2=objectProto$1.hasOwnProperty;function hashGet(e){var t=this.__data__;if(_nativeCreate){var r=t[e];return r===HASH_UNDEFINED$1?undefined:r}return hasOwnProperty$2.call(t,e)?t[e]:undefined}var _hashGet=hashGet;var objectProto=Object.prototype;var hasOwnProperty$1=objectProto.hasOwnProperty;function hashHas(e){var t=this.__data__;return _nativeCreate?t[e]!==undefined:hasOwnProperty$1.call(t,e)}var _hashHas=hashHas;var HASH_UNDEFINED="__lodash_hash_undefined__";function hashSet(e,t){var r=this.__data__;this.size+=this.has(e)?0:1;r[e]=_nativeCreate&&t===undefined?HASH_UNDEFINED:t;return this}var _hashSet=hashSet;function Hash(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}Hash.prototype.clear=_hashClear;Hash.prototype["delete"]=_hashDelete;Hash.prototype.get=_hashGet;Hash.prototype.has=_hashHas;Hash.prototype.set=_hashSet;var _Hash=Hash;function listCacheClear(){this.__data__=[];this.size=0}var _listCacheClear=listCacheClear;function eq(e,t){return e===t||e!==e&&t!==t}var eq_1=eq;function assocIndexOf(e,t){var r=e.length;while(r--){if(eq_1(e[r][0],t)){return r}}return-1}var _assocIndexOf=assocIndexOf;var arrayProto=Array.prototype;var splice=arrayProto.splice;function listCacheDelete(e){var t=this.__data__,r=_assocIndexOf(t,e);if(r<0){return false}var n=t.length-1;if(r==n){t.pop()}else{splice.call(t,r,1)}--this.size;return true}var _listCacheDelete=listCacheDelete;function listCacheGet(e){var t=this.__data__,r=_assocIndexOf(t,e);return r<0?undefined:t[r][1]}var _listCacheGet=listCacheGet;function listCacheHas(e){return _assocIndexOf(this.__data__,e)>-1}var _listCacheHas=listCacheHas;function listCacheSet(e,t){var r=this.__data__,n=_assocIndexOf(r,e);if(n<0){++this.size;r.push([e,t])}else{r[n][1]=t}return this}var _listCacheSet=listCacheSet;function ListCache(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}ListCache.prototype.clear=_listCacheClear;ListCache.prototype["delete"]=_listCacheDelete;ListCache.prototype.get=_listCacheGet;ListCache.prototype.has=_listCacheHas;ListCache.prototype.set=_listCacheSet;var _ListCache=ListCache;var Map=_getNative(_root,"Map");var _Map=Map;function mapCacheClear(){this.size=0;this.__data__={hash:new _Hash,map:new(_Map||_ListCache),string:new _Hash}}var _mapCacheClear=mapCacheClear;function isKeyable(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}var _isKeyable=isKeyable;function getMapData(e,t){var r=e.__data__;return _isKeyable(t)?r[typeof t=="string"?"string":"hash"]:r.map}var _getMapData=getMapData;function mapCacheDelete(e){var t=_getMapData(this,e)["delete"](e);this.size-=t?1:0;return t}var _mapCacheDelete=mapCacheDelete;function mapCacheGet(e){return _getMapData(this,e).get(e)}var _mapCacheGet=mapCacheGet;function mapCacheHas(e){return _getMapData(this,e).has(e)}var _mapCacheHas=mapCacheHas;function mapCacheSet(e,t){var r=_getMapData(this,e),n=r.size;r.set(e,t);this.size+=r.size==n?0:1;return this}var _mapCacheSet=mapCacheSet;function MapCache(e){var t=-1,r=e==null?0:e.length;this.clear();while(++t<r){var n=e[t];this.set(n[0],n[1])}}MapCache.prototype.clear=_mapCacheClear;MapCache.prototype["delete"]=_mapCacheDelete;MapCache.prototype.get=_mapCacheGet;MapCache.prototype.has=_mapCacheHas;MapCache.prototype.set=_mapCacheSet;var _MapCache=MapCache;var FUNC_ERROR_TEXT="Expected a function";function memoize(e,t){if(typeof e!="function"||t!=null&&typeof t!="function"){throw new TypeError(FUNC_ERROR_TEXT)}var r=function(){var n=arguments,i=t?t.apply(this,n):n[0],a=r.cache;if(a.has(i)){return a.get(i)}var o=e.apply(this,n);r.cache=a.set(i,o)||a;return o};r.cache=new(memoize.Cache||_MapCache);return r}memoize.Cache=_MapCache;var memoize_1=memoize;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(e){var t=memoize_1(e,(function(e){if(r.size===MAX_MEMOIZE_SIZE){r.clear()}return e}));var r=t.cache;return t}var _memoizeCapped=memoizeCapped;var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;var reEscapeChar=/\\(\\)?/g;var stringToPath=_memoizeCapped((function(e){var t=[];if(e.charCodeAt(0)===46){t.push("")}e.replace(rePropName,(function(e,r,n,i){t.push(n?i.replace(reEscapeChar,"$1"):r||e)}));return t}));var _stringToPath=stringToPath;function arrayMap(e,t){var r=-1,n=e==null?0:e.length,i=Array(n);while(++r<n){i[r]=t(e[r],r,e)}return i}var _arrayMap=arrayMap;var INFINITY$1=1/0;var symbolProto=_Symbol?_Symbol.prototype:undefined,symbolToString=symbolProto?symbolProto.toString:undefined;function baseToString(e){if(typeof e=="string"){return e}if(isArray_1(e)){return _arrayMap(e,baseToString)+""}if(isSymbol_1(e)){return symbolToString?symbolToString.call(e):""}var t=e+"";return t=="0"&&1/e==-INFINITY$1?"-0":t}var _baseToString=baseToString;function toString$1(e){return e==null?"":_baseToString(e)}var toString_1=toString$1;function castPath(e,t){if(isArray_1(e)){return e}return _isKey(e,t)?[e]:_stringToPath(toString_1(e))}var _castPath=castPath;var INFINITY=1/0;function toKey(e){if(typeof e=="string"||isSymbol_1(e)){return e}var t=e+"";return t=="0"&&1/e==-INFINITY?"-0":t}var _toKey=toKey;function baseGet(e,t){t=_castPath(t,e);var r=0,n=t.length;while(e!=null&&r<n){e=e[_toKey(t[r++])]}return r&&r==n?e:undefined}var _baseGet=baseGet;function get(e,t,r){var n=e==null?undefined:_baseGet(e,t);return n===undefined?r:n}var get_1=get;var eventemitter2=createCommonjsModule((function(e,t){!function(t){var r=Object.hasOwnProperty;var n=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 r="(node) warning: possible EventEmitter memory "+"leak detected. "+e+" listeners added. "+"Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak){r+=" Event name: "+t+"."}if(typeof process!=="undefined"&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning";n.emitter=this;n.count=e;process.emitWarning(n)}else{console.error(r);if(console.trace){console.trace()}}}var h=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:var i=new Array(n);while(n--){i[n]=arguments[n]}return i}};function v(e,r){var n={};var i;var a=e.length;var o=r?r.length:0;for(var s=0;s<a;s++){i=e[s];n[i]=s<o?r[s]:t}return n}function g(e,t,r){this._emitter=e;this._target=t;this._listeners={};this._listenersCount=0;var n,i;if(r.on||r.off){n=r.on;i=r.off}if(t.addEventListener){n=t.addEventListener;i=t.removeEventListener}else if(t.addListener){n=t.addListener;i=t.removeListener}else if(t.on){n=t.on;i=t.off}if(!n&&!i){throw Error("target does not implement any known event API")}if(typeof n!=="function"){throw TypeError("on method must be a function")}if(typeof i!=="function"){throw TypeError("off method must be a function")}this._on=n;this._off=i;var a=e._observers;if(a){a.push(this)}else{e._observers=[this]}}Object.assign(g.prototype,{subscribe:function(e,t,r){var n=this;var i=this._target;var a=this._emitter;var o=this._listeners;var s=function(){var n=h.apply(null,arguments);var o={data:n,name:t,original:e};if(r){var s=r.call(i,o);if(s!==false){a.emit.apply(a,[o.name].concat(n))}return}a.emit.apply(a,[t].concat(n))};if(o[e]){throw Error("Event '"+e+"' is already listening")}this._listenersCount++;if(a._newListener&&a._removeListener&&!n._onNewListener){this._onNewListener=function(r){if(r===t&&o[e]===null){o[e]=s;n._on.call(i,e,s)}};a.on("newListener",this._onNewListener);this._onRemoveListener=function(r){if(r===t&&!a.hasListeners(r)&&o[e]){o[e]=null;n._off.call(i,e,s)}};o[e]=null;a.on("removeListener",this._onRemoveListener)}else{o[e]=s;n._on.call(i,e,s)}},unsubscribe:function(e){var t=this;var r=this._listeners;var n=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){n.off("newListener",t._onNewListener);n.off("removeListener",t._onRemoveListener);t._onNewListener=null;t._onRemoveListener=null}var e=$.call(n,t);n._observers.splice(e,1)}if(e){i=r[e];if(!i)return;o.call(s,e,i);delete r[e];if(! --this._listenersCount){c()}}else{a=u(r);l=a.length;while(l-- >0){e=a[l];o.call(s,e,r[e])}this._listeners={};this._listenersCount=0;c()}}});function m(e,n,i,a){var o=Object.assign({},n);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&&!r.call(n,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 r=e.length;var n=e[0];var i=e[1];if(r===1){return function(e,r){if(typeof e===n){return e}r(t)}}if(r===2){return function(e,r){var a=typeof e;if(a===n||a===i)return e;r(t)}}return function(n,i){var a=typeof n;var o=r;while(o-- >0){if(a===e[o])return n}i(t)}}var _=b(["function"]);var w=b(["object","function"]);function S(e,t,r){var n;var i;var a=0;var o;var s=new e((function(l,c,u){r=m(r,{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}});n=!r.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(n){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(r.timeout>0){a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT";a=0;s.cancel(e);c(e)}),r.timeout)}}));if(!n){s.cancel=function(e){if(!i){return}var t=i.length;for(var r=1;r<t;r++){i[r](e)}i[0](e);i=null}}return s}function $(e){var t=this._observers;if(!t){return-1}var r=t.length;for(var n=0;n<r;n++){if(t[n]._target===e)return n}return-1}function k(e,t,r,n,i){if(!r){return null}if(n===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[n],_=t[n+1],w,S;if(n===i){if(r._listeners){if(typeof r._listeners==="function"){e&&e.push(r._listeners);p=[r]}else{e&&e.push.apply(e,r._listeners);p=[r]}}}else{if(b==="*"){w=u(r);s=w.length;while(s-- >0){h=w[s];if(h!=="_listeners"){S=k(e,t,r[h],n+1,i);if(S){if(p){p.push.apply(p,S)}else{p=S}}}}return p}else if(b==="**"){y=n+1===i||n+2===i&&_==="*";if(y&&r._listeners){p=k(e,t,r,i,i)}w=u(r);s=w.length;while(s-- >0){h=w[s];if(h!=="_listeners"){if(h==="*"||h==="**"){if(r[h]._listeners&&!y){S=k(e,t,r[h],i,i);if(S){if(p){p.push.apply(p,S)}else{p=S}}}S=k(e,t,r[h],n,i)}else if(h===_){S=k(e,t,r[h],n+2,i)}else{S=k(e,t,r[h],n,i)}if(S){if(p){p.push.apply(p,S)}else{p=S}}}}return p}else if(r[b]){p=k(e,t,r[b],n+1,i)}}v=r["*"];if(v){k(e,t,v,n+1,i)}g=r["**"];if(g){if(n<i){if(g._listeners){k(e,t,g,i,i)}w=u(g);s=w.length;while(s-- >0){h=w[s];if(h!=="_listeners"){if(h===_){k(e,t,g[h],n+2,i)}else if(h===b){k(e,t,g[h],n+1,i)}else{m={};m[h]=g[h];k(e,t,{"**":m},n+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 E(e,t,r){var n=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[n++]=e.slice(i,a);i=a+s}while((a=e.indexOf(o,i))!==-1);l[n++]=e.slice(i)}else{l=[e];n=1}}else{l=e;n=e.length}if(n>1){for(a=0;a+1<n;a++){if(l[a]==="**"&&l[a+1]==="**"){return}}}var c=this.listenerTree,u;for(a=0;a<n;a++){u=l[a];c=c[u]||(c[u]={});if(a===n-1){if(!c._listeners){c._listeners=t}else{if(typeof c._listeners==="function"){c._listeners=[c._listeners]}if(r){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 x(e,t,r,n){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=r}else{l=r?r.concat(s):[s]}d=n||typeof s==="symbol";c&&t.push(d?l:l.join(this.delimiter));if(typeof o==="object"){x.call(this,o,t,l,d)}}return t}function A(e){var t=u(e);var r=t.length;var n,i,a;while(r-- >0){i=t[r];n=e[i];if(n){a=true;if(i!=="_listeners"&&!A(n)){delete e[i]}}}return a}function O(e,t,r){this.emitter=e;this.event=t;this.listener=r}O.prototype.off=function(){this.emitter.off(this.event,this.listener);return this};function P(e,r,n){if(n===true){o=true}else if(n===false){i=true}else{if(!n||typeof n!=="object"){throw TypeError("options should be an object or true")}var i=n.async;var o=n.promisify;var s=n.nextTick;var l=n.objectify}if(i||s||o){var u=r;var d=r._origin||r;if(s&&!a){throw Error("process.nextTick is not supported")}if(o===t){o=r.constructor.name==="AsyncFunction"}r=function(){var e=arguments;var t=this;var r=this.event;return o?s?Promise.resolve():new Promise((function(e){c(e)})).then((function(){t.event=r;return u.apply(t,e)})):(s?process.nextTick:c)((function(){t.event=r;u.apply(t,e)}))};r._async=true;r._origin=d}return[r,l?new O(this,e,r):this]}function j(e){this._events={};this._newListener=false;this._removeListener=false;this.verboseMemoryLeak=false;f.call(this,e)}j.EventEmitter2=j;j.prototype.listenTo=function(e,r,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:_,off:_,reducers:w});function o(t){if(typeof t!=="object"){throw TypeError("events must be an object")}var r=i.reducers;var n=$.call(a,e);var o;if(n===-1){o=new g(a,e,i)}else{o=a._observers[n]}var s=u(t);var l=s.length;var c;var d=typeof r==="function";for(var f=0;f<l;f++){c=s[f];o.subscribe(c,t[c]||c,d?r:r&&r[c])}}n(r)?o(v(r)):typeof r==="string"?o(v(r.split(/\s+/))):o(r);return this};j.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r){return false}var n=r.length;var i;var a=false;if(e&&typeof e!=="object"){throw TypeError("target should be an object")}while(n-- >0){i=r[n];if(!e||i._target===e){i.unsubscribe(t);a=true}}return a};j.prototype.delimiter=".";j.prototype.setMaxListeners=function(e){if(e!==t){this._maxListeners=e;if(!this._conf)this._conf={};this._conf.maxListeners=e}};j.prototype.getMaxListeners=function(){return this._maxListeners};j.prototype.event="";j.prototype.once=function(e,t,r){return this._once(e,t,false,r)};j.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,true,r)};j.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)};j.prototype.many=function(e,t,r,n){return this._many(e,t,r,false,n)};j.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,true,n)};j.prototype._many=function(e,t,r,n,i){var a=this;if(typeof r!=="function"){throw new Error("many only accepts instances of Function")}function o(){if(--t===0){a.off(e,o)}return r.apply(this,arguments)}o._origin=r;return this._on(e,o,n,i)};j.prototype.emit=function(){if(!this._events&&!this._all){return false}this._events||d.call(this);var e=arguments[0],t,r=this.wildcard;var n,i,a,s,l;if(e==="newListener"&&!this._newListener){if(!this._events.newListener){return false}}if(r){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(r){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:n=new Array(c-1);for(s=1;s<c;s++)n[s-1]=arguments[s];u.apply(this,n)}return true}else if(u){u=u.slice()}}if(u&&u.length){if(c>3){n=new Array(c-1);for(s=1;s<c;s++)n[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,n)}}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};j.prototype.emitAsync=function(){if(!this._events&&!this._all){return false}this._events||d.call(this);var e=arguments[0],t=this.wildcard,r,n;var i,a,s,l;if(e==="newListener"&&!this._newListener){if(!this._events.newListener){return Promise.resolve([false])}}if(t){r=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"){n=true;break}}}if(!n){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,r,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)};j.prototype.on=function(e,t,r){return this._on(e,t,false,r)};j.prototype.prependListener=function(e,t,r){return this._on(e,t,true,r)};j.prototype.onAny=function(e){return this._onAny(e,false)};j.prototype.prependAny=function(e){return this._onAny(e,true)};j.prototype.addListener=j.prototype.on;j.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};j.prototype._on=function(e,r,n,i){if(typeof e==="function"){this._onAny(e,r);return this}if(typeof r!=="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,r,i);r=o[0];a=o[1]}if(this._newListener){this.emit("newListener",e,r)}if(this.wildcard){E.call(this,e,r,n);return a}if(!this._events[e]){this._events[e]=r}else{if(typeof this._events[e]==="function"){this._events[e]=[this._events[e]]}if(n){this._events[e].unshift(r)}else{this._events[e].push(r)}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};j.prototype.off=function(e,t){if(typeof t!=="function"){throw new Error("removeListener only takes instances of Function")}var r,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;r=this._events[e];i.push({_listeners:r})}for(var o=0;o<i.length;o++){var s=i[o];r=s._listeners;if(n(r)){var l=-1;for(var c=0,u=r.length;c<u;c++){if(r[c]===t||r[c].listener&&r[c].listener===t||r[c]._origin&&r[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(r.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(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t){if(this.wildcard){delete s._listeners}else{delete this._events[e]}if(this._removeListener)this.emit("removeListener",e,t)}}this.listenerTree&&A(this.listenerTree);return this};j.prototype.offAny=function(e){var t=0,r=0,n;if(e&&this._all&&this._all.length>0){n=this._all;for(t=0,r=n.length;t<r;t++){if(e===n[t]){n.splice(t,1);if(this._removeListener)this.emit("removeListenerAny",e);return this}}}else{n=this._all;if(this._removeListener){for(t=0,r=n.length;t<r;t++)this.emit("removeListenerAny",n[t])}this._all=[]}return this};j.prototype.removeListener=j.prototype.off;j.prototype.removeAllListeners=function(e){if(e===t){!this._events||d.call(this);return this}if(this.wildcard){var r=k.call(this,null,e,this.listenerTree,0),n,i;if(!r)return this;for(i=0;i<r.length;i++){n=r[i];n._listeners=null}this.listenerTree&&A(this.listenerTree)}else if(this._events){this._events[e]=null}return this};j.prototype.listeners=function(e){var r=this._events;var n,i,a;var o;var s;if(e===t){if(this.wildcard){throw Error("event name required for wildcard emitter")}if(!r){return[]}n=u(r);o=n.length;a=[];while(o-- >0){i=r[n[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(!r){return[]}i=r[e];if(!i){return[]}return typeof i==="function"?[i]:i}};j.prototype.eventNames=function(e){var t=this._events;return this.wildcard?x.call(this,this.listenerTree,[],null,e):t?u(t):[]};j.prototype.listenerCount=function(e){return this.listeners(e).length};j.prototype.hasListeners=function(e){if(this.wildcard){var r=[];var n=typeof e==="string"?e.split(this.delimiter):e.slice();k.call(this,r,n,this.listenerTree,0);return r.length>0}var i=this._events;var a=this._all;return!!(a&&a.length||i&&(e===t?u(i).length:i[e]))};j.prototype.listenersAny=function(){if(this._all){return this._all}else{return[]}};j.prototype.waitFor=function(e,r){var n=this;var i=typeof r;if(i==="number"){r={timeout:r}}else if(i==="function"){r={filter:r}}r=m(r,{timeout:0,filter:t,handleError:false,Promise:Promise,overload:false},{filter:_,Promise:y});return S(r.Promise,(function(t,i,a){function o(){var a=r.filter;if(a&&!a.apply(n,arguments)){return}n.off(e,o);if(r.handleError){var s=arguments[0];s?i(s):t(h.apply(null,arguments).slice(1))}else{t(h.apply(null,arguments))}}a((function(){n.off(e,o)}));n._on(e,o,false)}),{timeout:r.timeout,overload:r.overload})};function I(e,t,r){r=m(r,{Promise:Promise,timeout:0,overload:false},{Promise:y});var n=r.Promise;return S(n,(function(r,n,i){var a;if(typeof e.addEventListener==="function"){a=function(){r(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);r(h.apply(null,arguments))};var s;if(t!=="error"){s=function(r){e.removeListener(t,o);n(r)};e.once("error",s)}i((function(){s&&e.removeListener("error",s);e.removeListener(t,o)}));e.once(t,o)}),{timeout:r.timeout,overload:r.overload})}var C=j.prototype;Object.defineProperties(j,{defaultMaxListeners:{get:function(){return C._maxListeners},set:function(e){if(typeof e!=="number"||e<0||Number.isNaN(e)){throw TypeError("n must be a non-negative number")}C._maxListeners=e},enumerable:true},once:{value:I,writable:true,configurable:true}});Object.defineProperties(C,{_maxListeners:{value:i,writable:true,configurable:true},_observers:{value:null,writable:true,configurable:true}});if(typeof t==="function"&&t.amd){t((function(){return j}))}else{e.exports=j}}()}));var assign=make_assign();var create$2=make_create();var trim$2=make_trim();var Global$3=typeof window!=="undefined"?window:commonjsGlobal;var util={assign:assign,create:create$2,trim:trim$2,bind:bind$2,slice:slice$1,each:each$5,map:map,pluck:pluck$1,isList:isList$1,isFunction:isFunction$2,isObject:isObject$2,Global:Global$3};function make_assign(){if(Object.assign){return Object.assign}else{return function e(t,r,n,i){for(var a=1;a<arguments.length;a++){each$5(Object(arguments[a]),(function(e,r){t[r]=e}))}return t}}}function make_create(){if(Object.create){return function e(t,r,n,i){var a=slice$1(arguments,1);return assign.apply(this,[Object.create(t)].concat(a))}}else{function e(){}return function t(r,n,i,a){var o=slice$1(arguments,1);e.prototype=r;return assign.apply(this,[new e].concat(o))}}}function make_trim(){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 bind$2(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}}function slice$1(e,t){return Array.prototype.slice.call(e,t||0)}function each$5(e,t){pluck$1(e,(function(e,r){t(e,r);return false}))}function map(e,t){var r=isList$1(e)?[]:{};pluck$1(e,(function(e,n){r[n]=t(e,n);return false}));return r}function pluck$1(e,t){if(isList$1(e)){for(var r=0;r<e.length;r++){if(t(e[r],r)){return e[r]}}}else{for(var n in e){if(e.hasOwnProperty(n)){if(t(e[n],n)){return e[n]}}}}}function isList$1(e){return e!=null&&typeof e!="function"&&typeof e.length=="number"}function isFunction$2(e){return e&&{}.toString.call(e)==="[object Function]"}function isObject$2(e){return e&&{}.toString.call(e)==="[object Object]"}var slice=util.slice;var pluck=util.pluck;var each$4=util.each;var bind$1=util.bind;var create$1=util.create;var isList=util.isList;var isFunction$1=util.isFunction;var isObject$1=util.isObject;var storeEngine={createStore:createStore};var storeAPI={version:"2.0.12",enabled:false,get:function(e,t){var r=this.storage.read(this._namespacePrefix+e);return this._deserialize(r,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(r,n){e.call(t,t._deserialize(r),(n||"").replace(t._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(e){return this._namespacePrefix=="__storejs_"+e+"_"},createStore:function(){return createStore.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return createStore(this.storage,this.plugins,e)}};function _warn(){var e=typeof console=="undefined"?null:console;if(!e){return}var t=e.warn?e.warn:e.log;t.apply(e,arguments)}function createStore(e,t,r){if(!r){r=""}if(e&&!isList(e)){e=[e]}if(t&&!isList(t)){t=[t]}var n=r?"__storejs_"+r+"_":"";var i=r?new RegExp("^"+n):null;var a=/^[a-zA-Z0-9_\-]*$/;if(!a.test(r)){throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes")}var o={_namespacePrefix:n,_namespaceRegexp:i,_testStorage:function(e){try{var t="__storejs__test__";e.write(t,t);var r=e.read(t)===t;e.remove(t);return r}catch(e){return false}},_assignPluginFnProp:function(e,t){var r=this[t];this[t]=function t(){var n=slice(arguments,0);var i=this;function a(){if(!r){return}each$4(arguments,(function(e,t){n[t]=e}));return r.apply(i,n)}var o=[a].concat(n);return e.apply(i,o)}},_serialize:function(e){return JSON.stringify(e)},_deserialize:function(e,t){if(!e){return t}var r="";try{r=JSON.parse(e)}catch(t){r=e}return r!==undefined?r: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(isList(e)){each$4(e,(function(e){t._addPlugin(e)}));return}var r=pluck(this.plugins,(function(t){return e===t}));if(r){return}this.plugins.push(e);if(!isFunction$1(e)){throw new Error("Plugins must be function values that return objects")}var n=e.call(this);if(!isObject$1(n)){throw new Error("Plugins must return an object of function properties")}each$4(n,(function(r,n){if(!isFunction$1(r)){throw new Error("Bad plugin property: "+n+" from plugin "+e.name+". Plugins should only return functions.")}t._assignPluginFnProp(r,n)}))},addStorage:function(e){_warn("store.addStorage(storage) is deprecated. Use createStore([storages])");this._addStorage(e)}};var s=create$1(o,storeAPI,{plugins:[]});s.raw={};each$4(s,(function(e,t){if(isFunction$1(e)){s.raw[t]=bind$1(s,e)}}));each$4(e,(function(e){s._addStorage(e)}));each$4(t,(function(e){s._addPlugin(e)}));return s}var Global$2=util.Global;var localStorage_1={name:"localStorage",read:read$3,write:write$3,each:each$3,remove:remove$3,clearAll:clearAll$3};function localStorage$1(){return Global$2.localStorage}function read$3(e){return localStorage$1().getItem(e)}function write$3(e,t){return localStorage$1().setItem(e,t)}function each$3(e){for(var t=localStorage$1().length-1;t>=0;t--){var r=localStorage$1().key(t);e(read$3(r),r)}}function remove$3(e){return localStorage$1().removeItem(e)}function clearAll$3(){return localStorage$1().clear()}var n$4=Object.freeze(Object.assign(Object.create(null),localStorage_1,{default:localStorage_1}));var Global$1=util.Global;var sessionStorage_1={name:"sessionStorage",read:read$2,write:write$2,each:each$2,remove:remove$2,clearAll:clearAll$2};function sessionStorage$1(){return Global$1.sessionStorage}function read$2(e){return sessionStorage$1().getItem(e)}function write$2(e,t){return sessionStorage$1().setItem(e,t)}function each$2(e){for(var t=sessionStorage$1().length-1;t>=0;t--){var r=sessionStorage$1().key(t);e(read$2(r),r)}}function remove$2(e){return sessionStorage$1().removeItem(e)}function clearAll$2(){return sessionStorage$1().clear()}var o$3=Object.freeze(Object.assign(Object.create(null),sessionStorage_1,{default:sessionStorage_1}));var Global=util.Global;var trim$1=util.trim;var cookieStorage$1={name:"cookieStorage",read:read$1,write:write$1,each:each$1,remove:remove$1,clearAll:clearAll$1};var doc=Global.document;function read$1(e){if(!e||!_has(e)){return null}var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(doc.cookie.replace(new RegExp(t),"$1"))}function each$1(e){var t=doc.cookie.split(/; ?/g);for(var r=t.length-1;r>=0;r--){if(!trim$1(t[r])){continue}var n=t[r].split("=");var i=unescape(n[0]);var a=unescape(n[1]);e(a,i)}}function write$1(e,t){if(!e){return}doc.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/"}function remove$1(e){if(!e||!_has(e)){return}doc.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/"}function clearAll$1(){each$1((function(e,t){remove$1(t)}))}function _has(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(doc.cookie)}var i$3=Object.freeze(Object.assign(Object.create(null),cookieStorage$1,{default:cookieStorage$1}));var memoryStorage_1={name:"memoryStorage",read:read,write:write,each:each,remove:remove,clearAll:clearAll};var memoryStorage={};function read(e){return memoryStorage[e]}function write(e,t){memoryStorage[e]=t}function each(e){for(var t in memoryStorage){if(memoryStorage.hasOwnProperty(t)){e(memoryStorage[t],t)}}}function remove(e){delete memoryStorage[e]}function clearAll(e){memoryStorage={}}var a$3=Object.freeze(Object.assign(Object.create(null),memoryStorage_1,{default:memoryStorage_1}));function s$1(e,t){void 0===t&&(t=!1),e+="";for(var r,n=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],i=["0","1","2","3","4","5","6","7","8","9"],a=(t=t||!Salla.config.get("store.settings.arabic_numbers_enabled"))?n:i,o=t?i:n,s=0;s<a.length;s++)r=new RegExp(a[s],"g"),e=e.replace(r,o[s]);return e.replace(t?"٫":".",t?".":"٫")}function l$2(e){var t=("".concat(e).match(/\./g)||[]).length;return t&&1!==t?l$2(e.replace(/\.(.+)\./g,".$1")):e}function c$3(e){return"".concat(e).startsWith("https://")||"".concat(e).startsWith("http://")}function u$3(e){if(c$3(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 p$1(e,t,r){if(r=r||window.location.href,!t||!e)return r;var n=new RegExp("([?&])"+e+"=[^&]+[&]?","g");return(r=r.replace(n,"$1").split("#")[0].replace(/&$|\?$/,"")).includes("?")?r+="&":r+=(r.endsWith("/")?"":"/")+"?",(r+e+"="+encodeURIComponent(t)).replace(/&$|\?$/,"")}function f$2(e){return window.location.origin+"/"+(null==e?void 0:e.ltrim("/"))}function d$3(e){return c$3(e)?e:Salla.config.get("theme.assets")?Salla.config.get("theme.assets").replace(":path",null==e?void 0:e.ltrim("/")):f$2("themes/"+Salla.config.get("theme.name")+"/"+(null==e?void 0:e.ltrim("/")))}function g$3(e,t,r){var n,i=e[0];return r&&0==e.length?Array.isArray(r)?(r.push(t),r):[r,t]:Array.isArray(r)?(r.push(t),r):"string"==typeof r?[r,t]:r?(r[i]=g$3(e.slice(1),t,r[i]),r):i?((n={})[i]=g$3(e.slice(1),t),n):""===i?[t]:t}function h$3(){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 r,n=this,i=0;i<e.length;i++)r=new RegExp(e[i],"g"),n=n.replace(r,t[i]);return n},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 v$2={digitsOnly:function(e){return s$1(e,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function e(t,r){if(void 0===r&&(r=!1),"string"==typeof t)return document.querySelectorAll(t).forEach((function(t){return e(t,r)}));if(t){var n=Salla.helpers.digitsOnly(t.value);return t.min&&n<parseInt(t.min)?t.value=t.min:t.max&&n>parseInt(t.max)?t.value=t.max:t.maxLength>=1&&n.toString().length>t.maxLength?t.value=n.toString().substring(0,t.maxLength):t.value=r||t.dataset.hasOwnProperty("digitsWithDecimal")?l$2(n):n.replace(/\D/g,"")}Salla.logger.warn("Can't find Object With Id: "+t)},number:s$1,money:function(e,t){void 0===t&&(t=!0);var r=Salla.config.currency(null==e?void 0:e.currency).symbol;return e=s$1(e="object"==typeof e?e.amount:e)+" "+r,t&&["SAR","ر.س"].includes(r)&&Salla.config.get("store.settings.use_sar_symbol")&&(e=e.replace(r,"<i class=sicon-sar></i>")),e},isIframe:h$3,isPreview:function(){return h$3()},setNested:function(e,t,r){for(var n=e,i=t.split("."),a=i.length,o=0;o<a-1;o++){var s=i[o];n[s]||(n[s]={}),n=n[s]}return n[i[a-1]]=r,e},getNested:function(e,t,r){var n=get_1(e,t);return void 0!==n?n:r},inputData:function(e,t,r){if(void 0===r&&(r={}),e.includes("[")){var n=e.split("]").join("").split("["),i=n[0],a=r&&"object"==typeof r?r[i]:void 0;return{name:i,value:g$3(n.slice(1),t,a)}}return{name:e,value:t}},url:Object.freeze({__proto__:null,addParamToUrl:p$1,api:function(e){var t;return(null===(t=Salla.config.get("store.api",u$3("")))||void 0===t?void 0:t.rtrim("/"))+"/"+(null==e?void 0:e.ltrim("/"))},asset:d$3,base:function(e){return c$3(e)?e:"https://"+new URL(u$3("/")).hostname+"/"+(null==e?void 0:e.ltrim("/"))},baseUrl:f$2,cdn:function(e,t,r){var n="https://cdn.salla.network/";return(t||r)&&(t=t?",width=".concat(t):"",r=r?",height=".concat(r):"",n+="cdn-cgi/image/fit=scale-down".concat(t).concat(r,",onerror=redirect,format=auto/")),n+(null==e?void 0:e.ltrim("/"))},domain:function(e){return c$3(e)?e:"".concat(Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/"),"/").concat(null==e?void 0:e.ltrim("/"))},get:u$3,is_full_url:c$3,is_page:function(e){return e&&Salla.config.get("page.slug")===e},is_placeholder:function(e){return d$3(salla.config.get("theme.settings.placeholder"))===d$3(e)}}),addParamToUrl:p$1,debounce:function(e,t){t=t||100;var r,n=[];return function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return clearTimeout(r),r=setTimeout((function(){var t=e.apply(void 0,i);n.forEach((function(e){return e(t)})),n=[]}),t),new Promise((function(e){return n.push(e)}))}},hasApplePay:function(){var e;try{return!!(null===(e=window.ApplePaySession)||void 0===e?void 0:e.canMakePayments())}catch(e){return console.error(e),!1}}},y$3=function(e,t){return y$3=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},y$3(e,t)};var m$3=function(){return m$3=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},m$3.apply(this,arguments)};function w$2(e,t,r){if(r||2===arguments.length)for(var n,i=0,a=t.length;i<a;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var S$2,b$5,_$2,x$3,k$3=(S$2=console,b$5=[],_$2=[],x$3={log:function(e,t){if(S$2&&salla.config.isDebug()){b$5.push([t,e]),"trace"===salla.config.get("debug")&&(t="trace");var r=S$2.log,n=void 0===t?r:this.__dict__[t]||r,i=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"];_$2.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;"))),n.call.apply(n,w$2([S$2],i.concat.apply(i,e),!1))}},__dict__:{trace:S$2.trace,debug:S$2.debug,info:S$2.info,warn:S$2.warn,error:S$2.error}},{event:function(){x$3.log(arguments,"event")},trace:function(){x$3.log(arguments,"trace")},debug:function(){x$3.log(arguments,"debug")},info:function(){x$3.log(arguments,"info")},warn:function(){x$3.log(arguments,"warn")},error:function(){x$3.log(arguments,"error")},log:function(){x$3.log(arguments,void 0)},backend:function(){x$3.log(arguments,"backend")},logs:function(e){[e].flat().forEach((function(e){return e&&x$3.log([e].flat(),"backend")}))},history:function(){return b$5.map((function(e){return S$2.log.apply(S$2,w$2([e[0]],e[1],!1))})),b$5},addPrefix:function(e){return Array.isArray(e)?_$2.unshift(e):this.warn("addPrefix receives array only!"),this}}),A$3=function(){function e(e,t){void 0===e&&(e={}),void 0===t&&(t={}),this.default_properties=t,this.properties_=m$3(m$3({},this.default_properties),e)}return e.prototype.merge=function(e){var t;return this.properties_=m$3(m$3({},this.properties_),e),this.properties_.store=m$3(m$3({},(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}(),E$3=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 r(){this.constructor=e}y$3(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(t,e),t.prototype.createAndDispatch=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];this.dispatch.apply(this,w$2([e],t,!1))},t.prototype.emit=function(t){for(var r,n=[],i=1;i<arguments.length;i++)n[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(n[0])&&(n=n[0]),void(r=salla[a[0]])[a[1]].apply(r,n);e.prototype.emit.apply(this,w$2([t],n,!1)),this.trackEvents.apply(this,w$2([t],n,!1))},t.prototype.onlyWhen=function(e,t){var r=this;return t=t||function(){},new Promise((function(n){return r.emittedEvents.has(e)?n(t()):r.once(e,(function(){return n(t())}))}))},t.prototype.emitAsync=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];this.emittedEvents.add(t);var i=e.prototype.emitAsync.apply(this,w$2([t],r,!1));try{this.trackEvents.apply(this,w$2([t],r,!1))}catch(e){Salla.logger.warn("error on tracking event (".concat(t,")"),r,e)}return i},t.prototype.trackEvents=function(e){for(var t,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];if("undefined"!=typeof window)try{window.dataLayer=window.dataLayer||[];var i={event:e};r.map((function(e){return"object"==typeof e&&(i=m$3(m$3({},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,w$2([e],r,!1)),this.dispatchMobileEvent.apply(this,w$2([e],r,!1))},t.prototype.dispatch=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return this.emit.apply(this,w$2([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,r=Object.entries(e);t<r.length;t++){var n=r[t],i=n[0],a=n[1];this.dispatch(i,a)}else Salla.log("No Events To Dispatch!",e)},t.prototype.addListener=function(e,t,r){return this.on(e,t,r)},t.prototype.addEventListener=function(e,t,r){return this.on(e,t,r)},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}(eventemitter2.EventEmitter2),L$3=storeEngine.createStore([n$4,o$3,i$3,a$3],[]),T$2=storeEngine.createStore([o$3],[]),O$2=storeEngine.createStore([i$3],[]),j$3=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,r){return e.set(t,r)})),this.store=L$3,this.session=T$2,this.cookie=O$2}return e.prototype.set=function(e,t){var r;if(e.includes(".")){var n=e.split(".")[0],i=((r={})[n]=this.store.get(n),r);return i=Salla.helpers.setNested(i,e,t),this.store.set(n,i[n])}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 r;if(e.includes(".")){var n=e.split(".")[0];return Salla.helpers.getNested(((r={})[n]=this.store.get(n),r),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,r,n){void 0===r&&(r=10),void 0===n&&(n="store");var i=this.prefixKey(e),a=(new Date).getTime()+60*r*1e3;return this[n].set(i,{value:t,expiry:a})},e.prototype.getWithTTL=function(e,t,r){void 0===t&&(t=null),void 0===r&&(r="store");var n=this.prefixKey(e),i=this[r].get(n);return i?(new Date).getTime()>i.expiry?(this[r].remove(n),t):i.value:t},e}(),P$2=function(){function e(){var e=this;this.keysToRemove=["__said","__ssid","theme_edit","ws_port","s-token"],this.dynamicKeysToRemove=["affiliate","cart"],Salla.event.on("cookies::remove",(function(t){return e.remove(t)})),Salla.event.on("cookies::add",(function(t,r){return e.set(t,r)}))}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,r){void 0===t&&(t=""),void 0===r&&(r=10);var n="";if(r){var i=new Date;i.setTime(i.getTime()+24*r*60*60*1e3),n="; expires="+i.toUTCString()}var a=salla.helpers.isIframe()?"None":"Lax";return document.cookie="".concat(e,"=").concat(t).concat(n,"; 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(r){return e||t.keysToRemove.includes(r)||t.dynamicKeysToRemove.some((function(e){return r.startsWith(e)}))})).forEach((function(e){return t.remove(e)})),this},e.prototype.getCookieByPrefix=function(e){return document.cookie.split("; ").map((function(e){return e.split("=")[0]})).filter((function(t){return t.startsWith(e)}))},e.prototype.clearCookieByPrefix=function(e){var t=this;return this.getCookieByPrefix(e).forEach((function(e){return t.remove(e)}))},e}();"undefined"!=typeof window&&(window.salla=window.salla||window.Salla||{},window.Salla=window.salla),"undefined"!=typeof global&&(global.salla=global.salla||global.Salla||{},global.Salla=global.salla),Salla.status="base",Salla.config=new A$3,Salla.logger=k$3,Salla.event=new E$3,Salla.helpers=v$2,Salla.storage=new j$3,Salla.cookie=new P$2,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"2.14.145 - June 15, 2025 17:09:31"};var W$3=Salla;var evEmitter=createCommonjsModule((function(e){(function(t,r){if(e.exports){e.exports=r()}else{t.EvEmitter=r()}})(typeof window!="undefined"?window:commonjsGlobal,(function(){function e(){}var t=e.prototype;t.on=function(e,t){if(!e||!t)return this;var r=this._events=this._events||{};var n=r[e]=r[e]||[];if(!n.includes(t)){n.push(t)}return this};t.once=function(e,t){if(!e||!t)return this;this.on(e,t);var r=this._onceEvents=this._onceEvents||{};var n=r[e]=r[e]||{};n[t]=true;return this};t.off=function(e,t){var r=this._events&&this._events[e];if(!r||!r.length)return this;var n=r.indexOf(t);if(n!=-1){r.splice(n,1)}return this};t.emitEvent=function(e,t){var r=this._events&&this._events[e];if(!r||!r.length)return this;r=r.slice(0);t=t||[];var n=this._onceEvents&&this._onceEvents[e];for(var i=0,a=r;i<a.length;i++){var o=a[i];var s=n&&n[o];if(s){this.off(e,o);delete n[o]}o.apply(this,t)}return this};t.allOff=function(){delete this._events;delete this._onceEvents;return this};return e}))}));var utils$2=createCommonjsModule((function(e){(function(t,r){if(e.exports){e.exports=r(t)}else{t.fizzyUIUtils=r(t)}})(commonjsGlobal,(function e(t){var r={};r.extend=function(e,t){return Object.assign(e,t)};r.modulo=function(e,t){return(e%t+t)%t};r.makeArray=function(e){if(Array.isArray(e))return e;if(e===null||e===undefined)return[];var t=typeof e=="object"&&typeof e.length=="number";if(t)return __spreadArray([],e,true);return[e]};r.removeFrom=function(e,t){var r=e.indexOf(t);if(r!=-1){e.splice(r,1)}};r.getParent=function(e,t){while(e.parentNode&&e!=document.body){e=e.parentNode;if(e.matches(t))return e}};r.getQueryElement=function(e){if(typeof e=="string"){return document.querySelector(e)}return e};r.handleEvent=function(e){var t="on"+e.type;if(this[t]){this[t](e)}};r.filterFindElements=function(e,t){e=r.makeArray(e);return e.filter((function(e){return e instanceof HTMLElement})).reduce((function(e,r){if(!t){e.push(r);return e}if(r.matches(t)){e.push(r)}var n=r.querySelectorAll(t);e=e.concat.apply(e,n);return e}),[])};r.debounceMethod=function(e,t,r){r=r||100;var n=e.prototype[t];var i=t+"Timeout";e.prototype[t]=function(){var e=this;clearTimeout(this[i]);var t=arguments;this[i]=setTimeout((function(){n.apply(e,t);delete e[i]}),r)}};r.docReady=function(e){var t=document.readyState;if(t=="complete"||t=="interactive"){setTimeout(e)}else{document.addEventListener("DOMContentLoaded",e)}};r.toDashed=function(e){return e.replace(/(.)([A-Z])/g,(function(e,t,r){return t+"-"+r})).toLowerCase()};var n=t.console;r.htmlInit=function(e,i){r.docReady((function(){var a=r.toDashed(i);var o="data-"+a;var s=document.querySelectorAll("[".concat(o,"]"));var l=t.jQuery;__spreadArray([],s,true).forEach((function(t){var r=t.getAttribute(o);var a;try{a=r&&JSON.parse(r)}catch(e){if(n){n.error("Error parsing ".concat(o," on ").concat(t.className,": ").concat(e))}return}var s=new e(t,a);if(l){l.data(t,i,s)}}))}))};return r}))}));var core=createCommonjsModule((function(e){(function(t,r){if(e.exports){e.exports=r(t,evEmitter,utils$2)}else{t.InfiniteScroll=r(t,t.EvEmitter,t.fizzyUIUtils)}})(window,(function e(t,r,n){var i=t.jQuery;var a={};function o(e,t){var r=n.getQueryElement(e);if(!r){console.error("Bad element for InfiniteScroll: "+(r||e));return}e=r;if(e.infiniteScrollGUID){var s=a[e.infiniteScrollGUID];s.option(t);return s}this.element=e;this.options=__assign({},o.defaults);this.option(t);if(i){this.$element=i(this.element)}this.create()}o.defaults={};o.create={};o.destroy={};var s=o.prototype;Object.assign(s,r.prototype);var l=0;s.create=function(){var e=this.guid=++l;this.element.infiniteScrollGUID=e;a[e]=this;this.pageIndex=1;this.loadCount=0;this.updateGetPath();var t=this.getPath&&this.getPath();if(!t){console.error("Disabling InfiniteScroll");return}this.updateGetAbsolutePath();this.log("initialized",[this.element.className]);this.callOnInit();for(var r in o.create){o.create[r].call(this)}};s.option=function(e){Object.assign(this.options,e)};s.callOnInit=function(){var e=this.options.onInit;if(e){e.call(this,this)}};s.dispatchEvent=function(e,t,r){this.log(e,r);var n=t?[t].concat(r):r;this.emitEvent(e,n);if(!i||!this.$element){return}e+=".infiniteScroll";var a=e;if(t){var o=i.Event(t);o.type=e;a=o}this.$element.trigger(a,r)};var c={initialized:function(e){return"on ".concat(e)},request:function(e){return"URL: ".concat(e)},load:function(e,t){return"".concat(e.title||"",". URL: ").concat(t)},error:function(e,t){return"".concat(e,". URL: ").concat(t)},append:function(e,t,r){return"".concat(r.length," items. URL: ").concat(t)},last:function(e,t){return"URL: ".concat(t)},history:function(e,t){return"URL: ".concat(t)},pageIndex:function(e,t){return"current page determined to be: ".concat(e," from ").concat(t)}};s.log=function(e,t){if(!this.options.debug)return;var r="[InfiniteScroll] ".concat(e);var n=c[e];if(n)r+=". "+n.apply(this,t);console.log(r)};s.updateMeasurements=function(){this.windowHeight=t.innerHeight;var e=this.element.getBoundingClientRect();this.top=e.top+t.scrollY};s.updateScroller=function(){var e=this.options.elementScroll;if(!e){this.scroller=t;return}this.scroller=e===true?this.element:n.getQueryElement(e);if(!this.scroller){throw new Error("Unable to find elementScroll: ".concat(e))}};s.updateGetPath=function(){var e=this.options.path;if(!e){console.error("InfiniteScroll path option required. Set as: ".concat(e));return}var t=typeof e;if(t=="function"){this.getPath=e;return}var r=t=="string"&&e.match("{{#}}");if(r){this.updateGetPathTemplate(e);return}this.updateGetPathSelector(e)};s.updateGetPathTemplate=function(e){var t=this;this.getPath=function(){var r=t.pageIndex+1;return e.replace("{{#}}",r)};var r=e.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)");var n=new RegExp(r);var i=location.href.match(n);if(i){this.pageIndex=parseInt(i[1],10);this.log("pageIndex",[this.pageIndex,"template string"])}};var u=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/];var d=o.getPathParts=function(e){if(!e)return;for(var t=0,r=u;t<r.length;t++){var n=r[t];var i=e.match(n);if(i){var a=i[1],o=i[2],s=i[3];return{begin:a,index:o,end:s}}}};s.updateGetPathSelector=function(e){var t=this;var r=document.querySelector(e);if(!r){console.error("Bad InfiniteScroll path option. Next link not found: ".concat(e));return}var n=r.getAttribute("href");var i=d(n);if(!i){console.error("InfiniteScroll unable to parse next link href: ".concat(n));return}var a=i.begin,o=i.index,s=i.end;this.isPathSelector=true;this.getPath=function(){return a+(t.pageIndex+1)+s};this.pageIndex=parseInt(o,10)-1;this.log("pageIndex",[this.pageIndex,"next link"])};s.updateGetAbsolutePath=function(){var e=this;var t=this.getPath();var r=t.match(/^http/)||t.match(/^\//);if(r){this.getAbsolutePath=this.getPath;return}var n=location.pathname;var i=t.match(/^\?/);var a=n.substring(0,n.lastIndexOf("/"));var o=i?n:a+"/";this.getAbsolutePath=function(){return o+e.getPath()}};o.create.hideNav=function(){var e=n.getQueryElement(this.options.hideNav);if(!e)return;e.style.display="none";this.nav=e};o.destroy.hideNav=function(){if(this.nav)this.nav.style.display=""};s.destroy=function(){this.allOff();for(var e in o.destroy){o.destroy[e].call(this)}delete this.element.infiniteScrollGUID;delete a[this.guid];if(i&&this.$element){i.removeData(this.element,"infiniteScroll")}};o.throttle=function(e,t){t=t||200;var r,n;return function(){var i=this;var a=+new Date;var o=arguments;var s=function(){r=a;e.apply(i,o)};if(r&&a<r+t){clearTimeout(n);n=setTimeout(s,t)}else{s()}}};o.data=function(e){e=n.getQueryElement(e);var t=e&&e.infiniteScrollGUID;return t&&a[t]};o.setJQuery=function(e){i=e};n.htmlInit(o,"infinite-scroll");s._init=function(){};var f=t.jQueryBridget;if(i&&f){f("infiniteScroll",o,i)}return o}))}));var pageLoad=createCommonjsModule((function(e){(function(t,r){if(e.exports){e.exports=r(t,core)}else{r(t,t.InfiniteScroll)}})(window,(function e(t,r){var n=r.prototype;Object.assign(r.defaults,{loadOnScroll:true,checkLastPage:true,responseBody:"text",domParseResponse:true});r.create.pageLoad=function(){this.canLoad=true;this.on("scrollThreshold",this.onScrollThresholdLoad);this.on("load",this.checkLastPage);if(this.options.outlayer){this.on("append",this.onAppendOutlayer)}};n.onScrollThresholdLoad=function(){if(this.options.loadOnScroll)this.loadNextPage()};var i=new DOMParser;n.loadNextPage=function(){var e=this;if(this.isLoading||!this.canLoad)return;var t=this.options,r=t.responseBody,n=t.domParseResponse,a=t.fetchOptions;var o=this.getAbsolutePath();this.isLoading=true;if(typeof a=="function")a=a();var s=fetch(o,a).then((function(t){if(!t.ok){var a=new Error(t.statusText);e.onPageError(a,o,t);return{response:t}}return t[r]().then((function(a){var s=r=="text"&&n;if(s){a=i.parseFromString(a,"text/html")}if(t.status==204){e.lastPageReached(a,o);return{body:a,response:t}}else{return e.onPageLoad(a,o,t)}}))})).catch((function(t){e.onPageError(t,o)}));this.dispatchEvent("request",null,[o,s]);return s};n.onPageLoad=function(e,t,r){if(!this.options.append){this.isLoading=false}this.pageIndex++;this.loadCount++;this.dispatchEvent("load",null,[e,t,r]);return this.appendNextPage(e,t,r)};n.appendNextPage=function(e,t,r){var n=this;var i=this.options,o=i.append,s=i.responseBody,l=i.domParseResponse;var c=s=="text"&&l;if(!c||!o)return{body:e,response:r};var u=e.querySelectorAll(o);var d={body:e,response:r,items:u};if(!u||!u.length){this.lastPageReached(e,t);return d}var f=a(u);var p=function(){n.appendItems(u,f);n.isLoading=false;n.dispatchEvent("append",null,[e,t,u,r]);return d};if(this.options.outlayer){return this.appendOutlayerItems(f,p)}else{return p()}};n.appendItems=function(e,t){if(!e||!e.length)return;t=t||a(e);o(t);this.element.appendChild(t)};function a(e){var t=document.createDocumentFragment();if(e)t.append.apply(t,e);return t}function o(e){var t=e.querySelectorAll("script");for(var r=0,n=t;r<n.length;r++){var i=n[r];var a=document.createElement("script");var o=i.attributes;for(var s=0,l=o;s<l.length;s++){var c=l[s];a.setAttribute(c.name,c.value)}a.innerHTML=i.innerHTML;i.parentNode.replaceChild(a,i)}}n.appendOutlayerItems=function(e,n){var i=r.imagesLoaded||t.imagesLoaded;if(!i){console.error("[InfiniteScroll] imagesLoaded required for outlayer option");this.isLoading=false;return}return new Promise((function(t){i(e,(function(){var e=n();t(e)}))}))};n.onAppendOutlayer=function(e,t,r){this.options.outlayer.appended(r)};n.checkLastPage=function(e,t){var r=this.options,n=r.checkLastPage,i=r.path;if(!n)return;if(typeof i=="function"){var a=this.getPath();if(!a){this.lastPageReached(e,t);return}}var o;if(typeof n=="string"){o=n}else if(this.isPathSelector){o=i}if(!o||!e.querySelector)return;var s=e.querySelector(o);if(!s)this.lastPageReached(e,t)};n.lastPageReached=function(e,t){this.canLoad=false;this.dispatchEvent("last",null,[e,t])};n.onPageError=function(e,t,r){this.isLoading=false;this.canLoad=false;this.dispatchEvent("error",null,[e,t,r]);return e};r.create.prefill=function(){if(!this.options.prefill)return;var e=this.options.append;if(!e){console.error("append option required for prefill. Set as :".concat(e));return}this.updateMeasurements();this.updateScroller();this.isPrefilling=true;this.on("append",this.prefill);this.once("error",this.stopPrefill);this.once("last",this.stopPrefill);this.prefill()};n.prefill=function(){var e=this.getPrefillDistance();this.isPrefilling=e>=0;if(this.isPrefilling){this.log("prefill");this.loadNextPage()}else{this.stopPrefill()}};n.getPrefillDistance=function(){if(this.options.elementScroll){return this.scroller.clientHeight-this.scroller.scrollHeight}return this.windowHeight-this.element.clientHeight};n.stopPrefill=function(){this.log("stopPrefill");this.off("append",this.prefill)};return r}))}));var scrollWatch=createCommonjsModule((function(e){(function(t,r){if(e.exports){e.exports=r(t,core,utils$2)}else{r(t,t.InfiniteScroll,t.fizzyUIUtils)}})(window,(function e(t,r,n){var i=r.prototype;Object.assign(r.defaults,{scrollThreshold:400});r.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this);this.resizeHandler=this.onResize.bind(this);var e=this.options.scrollThreshold;var t=e||e===0;if(t)this.enableScrollWatch()};r.destroy.scrollWatch=function(){this.disableScrollWatch()};i.enableScrollWatch=function(){if(this.isScrollWatching)return;this.isScrollWatching=true;this.updateMeasurements();this.updateScroller();this.on("last",this.disableScrollWatch);this.bindScrollWatchEvents(true)};i.disableScrollWatch=function(){if(!this.isScrollWatching)return;this.bindScrollWatchEvents(false);delete this.isScrollWatching};i.bindScrollWatchEvents=function(e){var r=e?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.pageScrollHandler);t[r]("resize",this.resizeHandler)};i.onPageScroll=r.throttle((function(){var e=this.getBottomDistance();if(e<=this.options.scrollThreshold){this.dispatchEvent("scrollThreshold")}}));i.getBottomDistance=function(){var e,r;if(this.options.elementScroll){e=this.scroller.scrollHeight;r=this.scroller.scrollTop+this.scroller.clientHeight}else{e=this.top+this.element.clientHeight;r=t.scrollY+this.windowHeight}return e-r};i.onResize=function(){this.updateMeasurements()};n.debounceMethod(r,"onResize",150);return r}))}));var history_1=createCommonjsModule((function(e){(function(t,r){if(e.exports){e.exports=r(t,core,utils$2)}else{r(t,t.InfiniteScroll,t.fizzyUIUtils)}})(window,(function e(t,r,n){var i=r.prototype;Object.assign(r.defaults,{history:"replace"});var a=document.createElement("a");r.create.history=function(){if(!this.options.history)return;a.href=this.getAbsolutePath();var e=a.origin||a.protocol+"//"+a.host;var t=e==location.origin;if(!t){console.error("[InfiniteScroll] cannot set history with different origin: "+"".concat(a.origin," on ").concat(location.origin," . History behavior disabled."));return}if(this.options.append){this.createHistoryAppend()}else{this.createHistoryPageLoad()}};i.createHistoryAppend=function(){this.updateMeasurements();this.updateScroller();this.scrollPages=[{top:0,path:location.href,title:document.title}];this.scrollPage=this.scrollPages[0];this.scrollHistoryHandler=this.onScrollHistory.bind(this);this.unloadHandler=this.onUnload.bind(this);this.scroller.addEventListener("scroll",this.scrollHistoryHandler);this.on("append",this.onAppendHistory);this.bindHistoryAppendEvents(true)};i.bindHistoryAppendEvents=function(e){var r=e?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.scrollHistoryHandler);t[r]("unload",this.unloadHandler)};i.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)};r.destroy.history=i.destroyHistory=function(){var e=this.options.history&&this.options.append;if(e){this.bindHistoryAppendEvents(false)}};i.onAppendHistory=function(e,t,r){if(!r||!r.length)return;var n=r[0];var i=this.getElementScrollY(n);a.href=t;this.scrollPages.push({top:i,path:a.href,title:e.title})};i.getElementScrollY=function(e){if(this.options.elementScroll){return e.offsetTop-this.top}else{var r=e.getBoundingClientRect();return r.top+t.scrollY}};i.onScrollHistory=function(){var e=this.getClosestScrollPage();if(e!=this.scrollPage){this.scrollPage=e;this.setHistory(e.title,e.path)}};n.debounceMethod(r,"onScrollHistory",150);i.getClosestScrollPage=function(){var e;if(this.options.elementScroll){e=this.scroller.scrollTop+this.scroller.clientHeight/2}else{e=t.scrollY+this.windowHeight/2}var r;for(var n=0,i=this.scrollPages;n<i.length;n++){var a=i[n];if(a.top>=e)break;r=a}return r};i.setHistory=function(e,t){var r=this.options.history;var n=r&&history[r+"State"];if(!n)return;history[r+"State"](null,e,t);if(this.options.historyTitle)document.title=e;this.dispatchEvent("history",null,[e,t])};i.onUnload=function(){if(this.scrollPage.top===0)return;var e=t.scrollY-this.scrollPage.top+this.top;this.destroyHistory();scrollTo(0,e)};i.onPageLoadHistory=function(e,t){this.setHistory(e.title,t)};return r}))}));var button=createCommonjsModule((function(e){(function(t,r){if(e.exports){e.exports=r(t,core,utils$2)}else{r(t,t.InfiniteScroll,t.fizzyUIUtils)}})(window,(function e(t,r,n){var i=function(){function e(e,t){this.element=e;this.infScroll=t;this.clickHandler=this.onClick.bind(this);this.element.addEventListener("click",this.clickHandler);t.on("request",this.disable.bind(this));t.on("load",this.enable.bind(this));t.on("error",this.hide.bind(this));t.on("last",this.hide.bind(this))}e.prototype.onClick=function(e){e.preventDefault();this.infScroll.loadNextPage()};e.prototype.enable=function(){this.element.removeAttribute("disabled")};e.prototype.disable=function(){this.element.disabled="disabled"};e.prototype.hide=function(){this.element.style.display="none"};e.prototype.destroy=function(){this.element.removeEventListener("click",this.clickHandler)};return e}();r.create.button=function(){var e=n.getQueryElement(this.options.button);if(e){this.button=new i(e,this)}};r.destroy.button=function(){if(this.button)this.button.destroy()};r.Button=i;return r}))}));var status=createCommonjsModule((function(e){(function(t,r){if(e.exports){e.exports=r(t,core,utils$2)}else{r(t,t.InfiniteScroll,t.fizzyUIUtils)}})(window,(function e(t,r,n){var i=r.prototype;r.create.status=function(){var e=n.getQueryElement(this.options.status);if(!e)return;this.statusElement=e;this.statusEventElements={request:e.querySelector(".infinite-scroll-request"),error:e.querySelector(".infinite-scroll-error"),last:e.querySelector(".infinite-scroll-last")};this.on("request",this.showRequestStatus);this.on("error",this.showErrorStatus);this.on("last",this.showLastStatus);this.bindHideStatus("on")};i.bindHideStatus=function(e){var t=this.options.append?"append":"load";this[e](t,this.hideAllStatus)};i.showRequestStatus=function(){this.showStatus("request")};i.showErrorStatus=function(){this.showStatus("error")};i.showLastStatus=function(){this.showStatus("last");this.bindHideStatus("off")};i.showStatus=function(e){o(this.statusElement);this.hideStatusEventElements();var t=this.statusEventElements[e];o(t)};i.hideAllStatus=function(){a(this.statusElement);this.hideStatusEventElements()};i.hideStatusEventElements=function(){for(var e in this.statusEventElements){var t=this.statusEventElements[e];a(t)}};function a(e){s(e,"none")}function o(e){s(e,"block")}function s(e,t){if(e){e.style.display=t}}return r}))}));var js=createCommonjsModule((function(e){
|
|
5
|
+
/*!
|
|
6
|
+
* Infinite Scroll v4.0.1
|
|
7
|
+
* Automatically add next page
|
|
8
|
+
*
|
|
9
|
+
* Licensed GPLv3 for open source use
|
|
10
|
+
* or Infinite Scroll Commercial License for commercial use
|
|
11
|
+
*
|
|
12
|
+
* https://infinite-scroll.com
|
|
13
|
+
* Copyright 2018-2020 Metafizzy
|
|
14
|
+
*/
|
|
15
|
+
(function(t,r){if(e.exports){e.exports=r(core,pageLoad,scrollWatch,history_1,button,status)}})(window,(function e(t){return t}))}));var lang=createCommonjsModule((function(e,t){
|
|
16
|
+
/*!
|
|
17
|
+
* Lang.js for Laravel localization in JavaScript.
|
|
18
|
+
*
|
|
19
|
+
* @version 1.1.12
|
|
20
|
+
* @license MIT https://github.com/rmariuzzo/Lang.js/blob/master/LICENSE
|
|
21
|
+
* @site https://github.com/rmariuzzo/Lang.js
|
|
22
|
+
* @author Rubens Mariuzzo <rubens@mariuzzo.com>
|
|
23
|
+
*/
|
|
24
|
+
(function(t,r){{e.exports=r()}})(commonjsGlobal,(function(){function e(){if(typeof document!=="undefined"&&document.documentElement){return document.documentElement.lang}}function t(e){if(e==="-Inf"){return-Infinity}else if(e==="+Inf"||e==="Inf"||e==="*"){return Infinity}return parseInt(e,10)}var r=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/;var n=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/;var i={locale:"en"};var a=function(t){t=t||{};this.locale=t.locale||e()||i.locale;this.fallback=t.fallback;this.messages=t.messages};a.prototype.setMessages=function(e){this.messages=e};a.prototype.getLocale=function(){return this.locale||this.fallback};a.prototype.setLocale=function(e){this.locale=e};a.prototype.getFallback=function(){return this.fallback};a.prototype.setFallback=function(e){this.fallback=e};a.prototype.has=function(e,t){if(typeof e!=="string"||!this.messages){return false}return this._getMessage(e,t)!==null};a.prototype.get=function(e,t,r){if(!this.has(e,r)){return e}var n=this._getMessage(e,r);if(n===null){return e}if(t){n=this._applyReplacements(n,t)}return n};a.prototype.trans=function(e,t){return this.get(e,t)};a.prototype.choice=function(e,t,r,i){r=typeof r!=="undefined"?r:{};r.count=t;var a=this.get(e,r,i);if(a===null||a===undefined){return a}var o=a.split("|");var s=[];for(var l=0;l<o.length;l++){o[l]=o[l].trim();if(n.test(o[l])){var c=o[l].split(/\s/);s.push(c.shift());o[l]=c.join(" ")}}if(o.length===1){return a}for(var u=0;u<s.length;u++){if(this._testInterval(t,s[u])){return o[u]}}i=i||this._getLocale(e);var d=this._getPluralForm(t,i);return o[d]};a.prototype.transChoice=function(e,t,r){return this.choice(e,t,r)};a.prototype._parseKey=function(e,t){if(typeof e!=="string"||typeof t!=="string"){return null}var r=e.split(".");var n=r[0].replace(/\//g,".");return{source:t+"."+n,sourceFallback:this.getFallback()+"."+n,entries:r.slice(1)}};a.prototype._getMessage=function(e,t){t=t||this.getLocale();e=this._parseKey(e,t);if(this.messages[e.source]===undefined&&this.messages[e.sourceFallback]===undefined){return null}var r=this.messages[e.source];var n=e.entries.slice();var i=n.join(".");r=r!==undefined?this._getValueInKey(r,i):undefined;if(typeof r!=="string"&&this.messages[e.sourceFallback]){r=this.messages[e.sourceFallback];n=e.entries.slice();i="";while(n.length&&r!==undefined){var i=!i?n.shift():i.concat(".",n.shift());if(r[i]){r=r[i];i=""}}}if(typeof r!=="string"){return null}return r};a.prototype._getValueInKey=function(e,t){if(typeof e[t]==="string"){return e[t]}t=t.replace(/\[(\w+)\]/g,".$1");t=t.replace(/^\./,"");var r=t.split(".");for(var n=0,i=r.length;n<i;++n){var a=r.slice(0,n+1).join(".");var o=r.slice(n+1,r.length).join(".");if(e[a]){return this._getValueInKey(e[a],o)}}return e};a.prototype._getLocale=function(e){e=this._parseKey(e,this.locale);if(this.messages[e.source]){return this.locale}if(this.messages[e.sourceFallback]){return this.fallback}return null};a.prototype._findMessageInTree=function(e,t){while(e.length&&t!==undefined){var r=e.join(".");if(t[r]){t=t[r];break}t=t[e.shift()]}return t};a.prototype._sortReplacementKeys=function(e,t){return t.length-e.length};a.prototype._applyReplacements=function(e,t){var r=Object.keys(t).sort(this._sortReplacementKeys);r.forEach((function(r){e=e.replace(new RegExp(":"+r,"gi"),(function(e){var n=t[r];var i=e===e.toUpperCase();if(i){return n.toUpperCase()}var a=e===e.replace(/\w/i,(function(e){return e.toUpperCase()}));if(a){return n.charAt(0).toUpperCase()+n.slice(1)}return n}))}));return e};a.prototype._testInterval=function(e,n){if(typeof n!=="string"){throw"Invalid interval: should be a string."}n=n.trim();var i=n.match(r);if(!i){throw"Invalid interval: "+n}if(i[2]){var a=i[2].split(",");for(var o=0;o<a.length;o++){if(parseInt(a[o],10)===e){return true}}}else{i=i.filter((function(e){return!!e}));var s=i[1];var l=t(i[2]);if(l===Infinity){l=-Infinity}var c=t(i[3]);var u=i[4];return(s==="["?e>=l:e>l)&&(u==="]"?e<=c:e<c)}return false};a.prototype._getPluralForm=function(e,t){switch(t){case"az":case"bo":case"dz":case"id":case"ja":case"jv":case"ka":case"km":case"kn":case"ko":case"ms":case"th":case"tr":case"vi":case"zh":return 0;case"af":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"ur":case"zu":return e==1?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"hy":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return e===0||e===1?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2;case"cs":case"sk":return e==1?0:e>=2&&e<=4?1:2;case"ga":return e==1?0:e==2?1:2;case"lt":return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2;case"sl":return e%100==1?0:e%100==2?1:e%100==3||e%100==4?2:3;case"mk":return e%10==1?0:1;case"mt":return e==1?0:e===0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3;case"lv":return e===0?0:e%10==1&&e%100!=11?1:2;case"pl":return e==1?0:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?1:2;case"cy":return e==1?0:e==2?1:e==8||e==11?2:3;case"ro":return e==1?0:e===0||e%100>0&&e%100<20?1:2;case"ar":return e===0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5;default:return 0}};return a}))}));function bind(e,t){return function r(){return e.apply(t,arguments)}}var toString=Object.prototype.toString;var getPrototypeOf=Object.getPrototypeOf;var iterator=Symbol.iterator,toStringTag=Symbol.toStringTag;var kindOf=function(e){return function(t){var r=toString.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())}}(Object.create(null));var kindOfTest=function(e){e=e.toLowerCase();return function(t){return kindOf(t)===e}};var typeOfTest=function(e){return function(t){return typeof t===e}};var isArray=Array.isArray;var isUndefined=typeOfTest("undefined");function isBuffer(e){return e!==null&&!isUndefined(e)&&e.constructor!==null&&!isUndefined(e.constructor)&&isFunction(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}var isArrayBuffer=kindOfTest("ArrayBuffer");function isArrayBufferView(e){var t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&isArrayBuffer(e.buffer)}return t}var isString=typeOfTest("string");var isFunction=typeOfTest("function");var isNumber=typeOfTest("number");var isObject=function(e){return e!==null&&typeof e==="object"};var isBoolean=function(e){return e===true||e===false};var isPlainObject=function(e){if(kindOf(e)!=="object"){return false}var t=getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(toStringTag in e)&&!(iterator in e)};var isDate=kindOfTest("Date");var isFile=kindOfTest("File");var isBlob=kindOfTest("Blob");var isFileList=kindOfTest("FileList");var isStream=function(e){return isObject(e)&&isFunction(e.pipe)};var isFormData=function(e){var t;return e&&(typeof FormData==="function"&&e instanceof FormData||isFunction(e.append)&&((t=kindOf(e))==="formdata"||t==="object"&&isFunction(e.toString)&&e.toString()==="[object FormData]"))};var isURLSearchParams=kindOfTest("URLSearchParams");var _r=["ReadableStream","Request","Response","Headers"].map(kindOfTest),isReadableStream=_r[0],isRequest=_r[1],isResponse=_r[2],isHeaders=_r[3];var trim=function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function forEach(e,t,r){var n=r===void 0?{}:r,i=n.allOwnKeys,a=i===void 0?false:i;if(e===null||typeof e==="undefined"){return}var o;var s;if(typeof e!=="object"){e=[e]}if(isArray(e)){for(o=0,s=e.length;o<s;o++){t.call(null,e[o],o,e)}}else{var l=a?Object.getOwnPropertyNames(e):Object.keys(e);var c=l.length;var u=void 0;for(o=0;o<c;o++){u=l[o];t.call(null,e[u],u,e)}}}function findKey(e,t){t=t.toLowerCase();var r=Object.keys(e);var n=r.length;var i;while(n-- >0){i=r[n];if(t===i.toLowerCase()){return i}}return null}var _global=function(){if(typeof globalThis!=="undefined")return globalThis;return typeof self!=="undefined"?self:typeof window!=="undefined"?window:global}();var isContextDefined=function(e){return!isUndefined(e)&&e!==_global};function merge(){var e=(isContextDefined(this)&&this||{}).caseless;var t={};var r=function(r,n){var i=e&&findKey(t,n)||n;if(isPlainObject(t[i])&&isPlainObject(r)){t[i]=merge(t[i],r)}else if(isPlainObject(r)){t[i]=merge({},r)}else if(isArray(r)){t[i]=r.slice()}else{t[i]=r}};for(var n=0,i=arguments.length;n<i;n++){arguments[n]&&forEach(arguments[n],r)}return t}var extend=function(e,t,r,n){var i=n===void 0?{}:n,a=i.allOwnKeys;forEach(t,(function(t,n){if(r&&isFunction(t)){e[n]=bind(t,r)}else{e[n]=t}}),{allOwnKeys:a});return e};var stripBOM=function(e){if(e.charCodeAt(0)===65279){e=e.slice(1)}return e};var inherits=function(e,t,r,n){e.prototype=Object.create(t.prototype,n);e.prototype.constructor=e;Object.defineProperty(e,"super",{value:t.prototype});r&&Object.assign(e.prototype,r)};var toFlatObject=function(e,t,r,n){var i;var a;var o;var s={};t=t||{};if(e==null)return t;do{i=Object.getOwnPropertyNames(e);a=i.length;while(a-- >0){o=i[a];if((!n||n(o,e,t))&&!s[o]){t[o]=e[o];s[o]=true}}e=r!==false&&getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t};var endsWith=function(e,t,r){e=String(e);if(r===undefined||r>e.length){r=e.length}r-=t.length;var n=e.indexOf(t,r);return n!==-1&&n===r};var toArray=function(e){if(!e)return null;if(isArray(e))return e;var t=e.length;if(!isNumber(t))return null;var r=new Array(t);while(t-- >0){r[t]=e[t]}return r};var isTypedArray=function(e){return function(t){return e&&t instanceof e}}(typeof Uint8Array!=="undefined"&&getPrototypeOf(Uint8Array));var forEachEntry=function(e,t){var r=e&&e[iterator];var n=r.call(e);var i;while((i=n.next())&&!i.done){var a=i.value;t.call(e,a[0],a[1])}};var matchAll=function(e,t){var r;var n=[];while((r=e.exec(t))!==null){n.push(r)}return n};var isHTMLForm=kindOfTest("HTMLFormElement");var toCamelCase=function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function e(t,r,n){return r.toUpperCase()+n}))};var hasOwnProperty=function(e){var t=e.hasOwnProperty;return function(e,r){return t.call(e,r)}}(Object.prototype);var isRegExp=kindOfTest("RegExp");var reduceDescriptors=function(e,t){var r=Object.getOwnPropertyDescriptors(e);var n={};forEach(r,(function(r,i){var a;if((a=t(r,i,e))!==false){n[i]=a||r}}));Object.defineProperties(e,n)};var freezeMethods=function(e){reduceDescriptors(e,(function(t,r){if(isFunction(e)&&["arguments","caller","callee"].indexOf(r)!==-1){return false}var n=e[r];if(!isFunction(n))return;t.enumerable=false;if("writable"in t){t.writable=false;return}if(!t.set){t.set=function(){throw Error("Can not rewrite read-only method '"+r+"'")}}}))};var toObjectSet=function(e,t){var r={};var n=function(e){e.forEach((function(e){r[e]=true}))};isArray(e)?n(e):n(String(e).split(t));return r};var noop=function(){};var toFiniteNumber=function(e,t){return e!=null&&Number.isFinite(e=+e)?e:t};function isSpecCompliantForm(e){return!!(e&&isFunction(e.append)&&e[toStringTag]==="FormData"&&e[iterator])}var toJSONObject=function(e){var t=new Array(10);var r=function(e,n){if(isObject(e)){if(t.indexOf(e)>=0){return}if(!("toJSON"in e)){t[n]=e;var i=isArray(e)?[]:{};forEach(e,(function(e,t){var a=r(e,n+1);!isUndefined(a)&&(i[t]=a)}));t[n]=undefined;return i}}return e};return r(e,0)};var isAsyncFn=kindOfTest("AsyncFunction");var isThenable=function(e){return e&&(isObject(e)||isFunction(e))&&isFunction(e.then)&&isFunction(e.catch)};var _setImmediate=function(e,t){if(e){return setImmediate}return t?function(e,t){_global.addEventListener("message",(function(r){var n=r.source,i=r.data;if(n===_global&&i===e){t.length&&t.shift()()}}),false);return function(r){t.push(r);_global.postMessage(e,"*")}}("axios@".concat(Math.random()),[]):function(e){return setTimeout(e)}}(typeof setImmediate==="function",isFunction(_global.postMessage));var asap=typeof queueMicrotask!=="undefined"?queueMicrotask.bind(_global):typeof process!=="undefined"&&process.nextTick||_setImmediate;var isIterable=function(e){return e!=null&&isFunction(e[iterator])};var utils$1={isArray:isArray,isArrayBuffer:isArrayBuffer,isBuffer:isBuffer,isFormData:isFormData,isArrayBufferView:isArrayBufferView,isString:isString,isNumber:isNumber,isBoolean:isBoolean,isObject:isObject,isPlainObject:isPlainObject,isReadableStream:isReadableStream,isRequest:isRequest,isResponse:isResponse,isHeaders:isHeaders,isUndefined:isUndefined,isDate:isDate,isFile:isFile,isBlob:isBlob,isRegExp:isRegExp,isFunction:isFunction,isStream:isStream,isURLSearchParams:isURLSearchParams,isTypedArray:isTypedArray,isFileList:isFileList,forEach:forEach,merge:merge,extend:extend,trim:trim,stripBOM:stripBOM,inherits:inherits,toFlatObject:toFlatObject,kindOf:kindOf,kindOfTest:kindOfTest,endsWith:endsWith,toArray:toArray,forEachEntry:forEachEntry,matchAll:matchAll,isHTMLForm:isHTMLForm,hasOwnProperty:hasOwnProperty,hasOwnProp:hasOwnProperty,reduceDescriptors:reduceDescriptors,freezeMethods:freezeMethods,toObjectSet:toObjectSet,toCamelCase:toCamelCase,noop:noop,toFiniteNumber:toFiniteNumber,findKey:findKey,global:_global,isContextDefined:isContextDefined,isSpecCompliantForm:isSpecCompliantForm,toJSONObject:toJSONObject,isAsyncFn:isAsyncFn,isThenable:isThenable,setImmediate:_setImmediate,asap:asap,isIterable:isIterable};function AxiosError(e,t,r,n,i){Error.call(this);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor)}else{this.stack=(new Error).stack}this.message=e;this.name="AxiosError";t&&(this.code=t);r&&(this.config=r);n&&(this.request=n);if(i){this.response=i;this.status=i.status?i.status:null}}utils$1.inherits(AxiosError,Error,{toJSON:function e(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:utils$1.toJSONObject(this.config),code:this.code,status:this.status}}});var prototype$1=AxiosError.prototype;var descriptors={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){descriptors[e]={value:e}}));Object.defineProperties(AxiosError,descriptors);Object.defineProperty(prototype$1,"isAxiosError",{value:true});AxiosError.from=function(e,t,r,n,i,a){var o=Object.create(prototype$1);utils$1.toFlatObject(e,o,(function e(t){return t!==Error.prototype}),(function(e){return e!=="isAxiosError"}));AxiosError.call(o,e.message,t,r,n,i);o.cause=e;o.name=e.name;a&&Object.assign(o,a);return o};var httpAdapter=null;function isVisitable(e){return utils$1.isPlainObject(e)||utils$1.isArray(e)}function removeBrackets(e){return utils$1.endsWith(e,"[]")?e.slice(0,-2):e}function renderKey(e,t,r){if(!e)return t;return e.concat(t).map((function e(t,n){t=removeBrackets(t);return!r&&n?"["+t+"]":t})).join(r?".":"")}function isFlatArray(e){return utils$1.isArray(e)&&!e.some(isVisitable)}var predicates=utils$1.toFlatObject(utils$1,{},null,(function e(t){return/^is[A-Z]/.test(t)}));function toFormData(e,t,r){if(!utils$1.isObject(e)){throw new TypeError("target must be an object")}t=t||new FormData;r=utils$1.toFlatObject(r,{metaTokens:true,dots:false,indexes:false},false,(function e(t,r){return!utils$1.isUndefined(r[t])}));var n=r.metaTokens;var i=r.visitor||u;var a=r.dots;var o=r.indexes;var s=r.Blob||typeof Blob!=="undefined"&&Blob;var l=s&&utils$1.isSpecCompliantForm(t);if(!utils$1.isFunction(i)){throw new TypeError("visitor must be a function")}function c(e){if(e===null)return"";if(utils$1.isDate(e)){return e.toISOString()}if(utils$1.isBoolean(e)){return e.toString()}if(!l&&utils$1.isBlob(e)){throw new AxiosError("Blob is not supported. Use a Buffer instead.")}if(utils$1.isArrayBuffer(e)||utils$1.isTypedArray(e)){return l&&typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function u(e,r,i){var s=e;if(e&&!i&&typeof e==="object"){if(utils$1.endsWith(r,"{}")){r=n?r:r.slice(0,-2);e=JSON.stringify(e)}else if(utils$1.isArray(e)&&isFlatArray(e)||(utils$1.isFileList(e)||utils$1.endsWith(r,"[]"))&&(s=utils$1.toArray(e))){r=removeBrackets(r);s.forEach((function e(n,i){!(utils$1.isUndefined(n)||n===null)&&t.append(o===true?renderKey([r],i,a):o===null?r:r+"[]",c(n))}));return false}}if(isVisitable(e)){return true}t.append(renderKey(i,r,a),c(e));return false}var d=[];var f=Object.assign(predicates,{defaultVisitor:u,convertValue:c,isVisitable:isVisitable});function p(e,r){if(utils$1.isUndefined(e))return;if(d.indexOf(e)!==-1){throw Error("Circular reference detected in "+r.join("."))}d.push(e);utils$1.forEach(e,(function e(n,a){var o=!(utils$1.isUndefined(n)||n===null)&&i.call(t,n,utils$1.isString(a)?a.trim():a,r,f);if(o===true){p(n,r?r.concat(a):[a])}}));d.pop()}if(!utils$1.isObject(e)){throw new TypeError("data must be an object")}p(e);return t}function encode$1(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function e(r){return t[r]}))}function AxiosURLSearchParams(e,t){this._pairs=[];e&&toFormData(e,this,t)}var prototype=AxiosURLSearchParams.prototype;prototype.append=function e(t,r){this._pairs.push([t,r])};prototype.toString=function e(t){var r=t?function(e){return t.call(this,e,encode$1)}:encode$1;return this._pairs.map((function e(t){return r(t[0])+"="+r(t[1])}),"").join("&")};function encode(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function buildURL(e,t,r){if(!t){return e}var n=r&&r.encode||encode;if(utils$1.isFunction(r)){r={serialize:r}}var i=r&&r.serialize;var a;if(i){a=i(t,r)}else{a=utils$1.isURLSearchParams(t)?t.toString():new AxiosURLSearchParams(t,r).toString(n)}if(a){var o=e.indexOf("#");if(o!==-1){e=e.slice(0,o)}e+=(e.indexOf("?")===-1?"?":"&")+a}return e}var InterceptorManager=function(){function e(){this.handlers=[]}e.prototype.use=function(e,t,r){this.handlers.push({fulfilled:e,rejected:t,synchronous:r?r.synchronous:false,runWhen:r?r.runWhen:null});return this.handlers.length-1};e.prototype.eject=function(e){if(this.handlers[e]){this.handlers[e]=null}};e.prototype.clear=function(){if(this.handlers){this.handlers=[]}};e.prototype.forEach=function(e){utils$1.forEach(this.handlers,(function t(r){if(r!==null){e(r)}}))};return e}();var transitionalDefaults={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};var URLSearchParams$1=typeof URLSearchParams!=="undefined"?URLSearchParams:AxiosURLSearchParams;var FormData$1=typeof FormData!=="undefined"?FormData:null;var Blob$1=typeof Blob!=="undefined"?Blob:null;var platform$1={isBrowser:true,classes:{URLSearchParams:URLSearchParams$1,FormData:FormData$1,Blob:Blob$1},protocols:["http","https","file","blob","url","data"]};var hasBrowserEnv=typeof window!=="undefined"&&typeof document!=="undefined";var _navigator=typeof navigator==="object"&&navigator||undefined;var hasStandardBrowserEnv=hasBrowserEnv&&(!_navigator||["ReactNative","NativeScript","NS"].indexOf(_navigator.product)<0);var hasStandardBrowserWebWorkerEnv=function(){return typeof WorkerGlobalScope!=="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts==="function"}();var origin=hasBrowserEnv&&window.location.href||"http://localhost";var utils=Object.freeze({__proto__:null,hasBrowserEnv:hasBrowserEnv,hasStandardBrowserWebWorkerEnv:hasStandardBrowserWebWorkerEnv,hasStandardBrowserEnv:hasStandardBrowserEnv,navigator:_navigator,origin:origin});var platform=__assign(__assign({},utils),platform$1);function toURLEncodedForm(e,t){return toFormData(e,new platform.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){if(platform.isNode&&utils$1.isBuffer(e)){this.append(t,e.toString("base64"));return false}return n.defaultVisitor.apply(this,arguments)}},t))}function parsePropPath(e){return utils$1.matchAll(/\w+|\[(\w*)]/g,e).map((function(e){return e[0]==="[]"?"":e[1]||e[0]}))}function arrayToObject(e){var t={};var r=Object.keys(e);var n;var i=r.length;var a;for(n=0;n<i;n++){a=r[n];t[a]=e[a]}return t}function formDataToJSON(e){function t(e,r,n,i){var a=e[i++];if(a==="__proto__")return true;var o=Number.isFinite(+a);var s=i>=e.length;a=!a&&utils$1.isArray(n)?n.length:a;if(s){if(utils$1.hasOwnProp(n,a)){n[a]=[n[a],r]}else{n[a]=r}return!o}if(!n[a]||!utils$1.isObject(n[a])){n[a]=[]}var l=t(e,r,n[a],i);if(l&&utils$1.isArray(n[a])){n[a]=arrayToObject(n[a])}return!o}if(utils$1.isFormData(e)&&utils$1.isFunction(e.entries)){var r={};utils$1.forEachEntry(e,(function(e,n){t(parsePropPath(e),n,r,0)}));return r}return null}function stringifySafely(e,t,r){if(utils$1.isString(e)){try{(t||JSON.parse)(e);return utils$1.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(r||JSON.stringify)(e)}var defaults={transitional:transitionalDefaults,adapter:["xhr","http","fetch"],transformRequest:[function e(t,r){var n=r.getContentType()||"";var i=n.indexOf("application/json")>-1;var a=utils$1.isObject(t);if(a&&utils$1.isHTMLForm(t)){t=new FormData(t)}var o=utils$1.isFormData(t);if(o){return i?JSON.stringify(formDataToJSON(t)):t}if(utils$1.isArrayBuffer(t)||utils$1.isBuffer(t)||utils$1.isStream(t)||utils$1.isFile(t)||utils$1.isBlob(t)||utils$1.isReadableStream(t)){return t}if(utils$1.isArrayBufferView(t)){return t.buffer}if(utils$1.isURLSearchParams(t)){r.setContentType("application/x-www-form-urlencoded;charset=utf-8",false);return t.toString()}var s;if(a){if(n.indexOf("application/x-www-form-urlencoded")>-1){return toURLEncodedForm(t,this.formSerializer).toString()}if((s=utils$1.isFileList(t))||n.indexOf("multipart/form-data")>-1){var l=this.env&&this.env.FormData;return toFormData(s?{"files[]":t}:t,l&&new l,this.formSerializer)}}if(a||i){r.setContentType("application/json",false);return stringifySafely(t)}return t}],transformResponse:[function e(t){var r=this.transitional||defaults.transitional;var n=r&&r.forcedJSONParsing;var i=this.responseType==="json";if(utils$1.isResponse(t)||utils$1.isReadableStream(t)){return t}if(t&&utils$1.isString(t)&&(n&&!this.responseType||i)){var a=r&&r.silentJSONParsing;var o=!a&&i;try{return JSON.parse(t)}catch(e){if(o){if(e.name==="SyntaxError"){throw AxiosError.from(e,AxiosError.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:platform.classes.FormData,Blob:platform.classes.Blob},validateStatus:function e(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":undefined}}};utils$1.forEach(["delete","get","head","post","put","patch"],(function(e){defaults.headers[e]={}}));var ignoreDuplicateOf=utils$1.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var parseHeaders=function(e){var t={};var r;var n;var i;e&&e.split("\n").forEach((function e(a){i=a.indexOf(":");r=a.substring(0,i).trim().toLowerCase();n=a.substring(i+1).trim();if(!r||t[r]&&ignoreDuplicateOf[r]){return}if(r==="set-cookie"){if(t[r]){t[r].push(n)}else{t[r]=[n]}}else{t[r]=t[r]?t[r]+", "+n:n}}));return t};var $internals=Symbol("internals");function normalizeHeader(e){return e&&String(e).trim().toLowerCase()}function normalizeValue(e){if(e===false||e==null){return e}return utils$1.isArray(e)?e.map(normalizeValue):String(e)}function parseTokens(e){var t=Object.create(null);var r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;var n;while(n=r.exec(e)){t[n[1]]=n[2]}return t}var isValidHeaderName=function(e){return/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim())};function matchHeaderValue(e,t,r,n,i){if(utils$1.isFunction(n)){return n.call(this,t,r)}if(i){t=r}if(!utils$1.isString(t))return;if(utils$1.isString(n)){return t.indexOf(n)!==-1}if(utils$1.isRegExp(n)){return n.test(t)}}function formatHeader(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))}function buildAccessors(e,t){var r=utils$1.toCamelCase(" "+t);["get","set","has"].forEach((function(n){Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:true})}))}var AxiosHeaders=function(){function e(e){e&&this.set(e)}e.prototype.set=function(e,t,r){var n=this;function i(e,t,r){var i=normalizeHeader(t);if(!i){throw new Error("header name must be a non-empty string")}var a=utils$1.findKey(n,i);if(!a||n[a]===undefined||r===true||r===undefined&&n[a]!==false){n[a||t]=normalizeValue(e)}}var a=function(e,t){return utils$1.forEach(e,(function(e,r){return i(e,r,t)}))};if(utils$1.isPlainObject(e)||e instanceof this.constructor){a(e,t)}else if(utils$1.isString(e)&&(e=e.trim())&&!isValidHeaderName(e)){a(parseHeaders(e),t)}else if(utils$1.isObject(e)&&utils$1.isIterable(e)){var o={},s=void 0,l=void 0;for(var c=0,u=e;c<u.length;c++){var d=u[c];if(!utils$1.isArray(d)){throw TypeError("Object iterator must return a key-value pair")}o[l=d[0]]=(s=o[l])?utils$1.isArray(s)?__spreadArray(__spreadArray([],s,true),[d[1]],false):[s,d[1]]:d[1]}a(o,t)}else{e!=null&&i(t,e,r)}return this};e.prototype.get=function(e,t){e=normalizeHeader(e);if(e){var r=utils$1.findKey(this,e);if(r){var n=this[r];if(!t){return n}if(t===true){return parseTokens(n)}if(utils$1.isFunction(t)){return t.call(this,n,r)}if(utils$1.isRegExp(t)){return t.exec(n)}throw new TypeError("parser must be boolean|regexp|function")}}};e.prototype.has=function(e,t){e=normalizeHeader(e);if(e){var r=utils$1.findKey(this,e);return!!(r&&this[r]!==undefined&&(!t||matchHeaderValue(this,this[r],r,t)))}return false};e.prototype.delete=function(e,t){var r=this;var n=false;function i(e){e=normalizeHeader(e);if(e){var i=utils$1.findKey(r,e);if(i&&(!t||matchHeaderValue(r,r[i],i,t))){delete r[i];n=true}}}if(utils$1.isArray(e)){e.forEach(i)}else{i(e)}return n};e.prototype.clear=function(e){var t=Object.keys(this);var r=t.length;var n=false;while(r--){var i=t[r];if(!e||matchHeaderValue(this,this[i],i,e,true)){delete this[i];n=true}}return n};e.prototype.normalize=function(e){var t=this;var r={};utils$1.forEach(this,(function(n,i){var a=utils$1.findKey(r,i);if(a){t[a]=normalizeValue(n);delete t[i];return}var o=e?formatHeader(i):String(i).trim();if(o!==i){delete t[i]}t[o]=normalizeValue(n);r[o]=true}));return this};e.prototype.concat=function(){var e;var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}return(e=this.constructor).concat.apply(e,__spreadArray([this],t,false))};e.prototype.toJSON=function(e){var t=Object.create(null);utils$1.forEach(this,(function(r,n){r!=null&&r!==false&&(t[n]=e&&utils$1.isArray(r)?r.join(", "):r)}));return t};e.prototype[Symbol.iterator]=function(){return Object.entries(this.toJSON())[Symbol.iterator]()};e.prototype.toString=function(){return Object.entries(this.toJSON()).map((function(e){var t=e[0],r=e[1];return t+": "+r})).join("\n")};e.prototype.getSetCookie=function(){return this.get("set-cookie")||[]};Object.defineProperty(e.prototype,Symbol.toStringTag,{get:function(){return"AxiosHeaders"},enumerable:false,configurable:true});e.from=function(e){return e instanceof this?e:new this(e)};e.concat=function(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}var n=new this(e);t.forEach((function(e){return n.set(e)}));return n};e.accessor=function(e){var t=this[$internals]=this[$internals]={accessors:{}};var r=t.accessors;var n=this.prototype;function i(e){var t=normalizeHeader(e);if(!r[t]){buildAccessors(n,e);r[t]=true}}utils$1.isArray(e)?e.forEach(i):i(e);return this};return e}();AxiosHeaders.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);utils$1.reduceDescriptors(AxiosHeaders.prototype,(function(e,t){var r=e.value;var n=t[0].toUpperCase()+t.slice(1);return{get:function(){return r},set:function(e){this[n]=e}}}));utils$1.freezeMethods(AxiosHeaders);function transformData(e,t){var r=this||defaults;var n=t||r;var i=AxiosHeaders.from(n.headers);var a=n.data;utils$1.forEach(e,(function e(n){a=n.call(r,a,i.normalize(),t?t.status:undefined)}));i.normalize();return a}function isCancel(e){return!!(e&&e.__CANCEL__)}function CanceledError(e,t,r){AxiosError.call(this,e==null?"canceled":e,AxiosError.ERR_CANCELED,t,r);this.name="CanceledError"}utils$1.inherits(CanceledError,AxiosError,{__CANCEL__:true});function settle(e,t,r){var n=r.config.validateStatus;if(!r.status||!n||n(r.status)){e(r)}else{t(new AxiosError("Request failed with status code "+r.status,[AxiosError.ERR_BAD_REQUEST,AxiosError.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}}function parseProtocol(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function speedometer(e,t){e=e||10;var r=new Array(e);var n=new Array(e);var i=0;var a=0;var o;t=t!==undefined?t:1e3;return function s(l){var c=Date.now();var u=n[a];if(!o){o=c}r[i]=l;n[i]=c;var d=a;var f=0;while(d!==i){f+=r[d++];d=d%e}i=(i+1)%e;if(i===a){a=(a+1)%e}if(c-o<t){return}var p=u&&c-u;return p?Math.round(f*1e3/p):undefined}}function throttle(e,t){var r=0;var n=1e3/t;var i;var a;var o=function(t,n){if(n===void 0){n=Date.now()}r=n;i=null;if(a){clearTimeout(a);a=null}e.apply(null,t)};var s=function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}var s=Date.now();var l=s-r;if(l>=n){o(e,s)}else{i=e;if(!a){a=setTimeout((function(){a=null;o(i)}),n-l)}}};var l=function(){return i&&o(i)};return[s,l]}var progressEventReducer=function(e,t,r){if(r===void 0){r=3}var n=0;var i=speedometer(50,250);return throttle((function(r){var a;var o=r.loaded;var s=r.lengthComputable?r.total:undefined;var l=o-n;var c=i(l);var u=o<=s;n=o;var d=(a={loaded:o,total:s,progress:s?o/s:undefined,bytes:l,rate:c?c:undefined,estimated:c&&s&&u?(s-o)/c:undefined,event:r,lengthComputable:s!=null},a[t?"download":"upload"]=true,a);e(d)}),r)};var progressEventDecorator=function(e,t){var r=e!=null;return[function(n){return t[0]({lengthComputable:r,total:e,loaded:n})},t[1]]};var asyncDecorator=function(e){return function(){var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}return utils$1.asap((function(){return e.apply(void 0,t)}))}};var isURLSameOrigin=platform.hasStandardBrowserEnv?function(e,t){return function(r){r=new URL(r,platform.origin);return e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)}}(new URL(platform.origin),platform.navigator&&/(msie|trident)/i.test(platform.navigator.userAgent)):function(){return true};var cookies=platform.hasStandardBrowserEnv?{write:function(e,t,r,n,i,a){var o=[e+"="+encodeURIComponent(t)];utils$1.isNumber(r)&&o.push("expires="+new Date(r).toGMTString());utils$1.isString(n)&&o.push("path="+n);utils$1.isString(i)&&o.push("domain="+i);a===true&&o.push("secure");document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function isAbsoluteURL(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function combineURLs(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function buildFullPath(e,t,r){var n=!isAbsoluteURL(t);if(e&&(n||r==false)){return combineURLs(e,t)}return t}var headersToObject=function(e){return e instanceof AxiosHeaders?__assign({},e):e};function mergeConfig$1(e,t){t=t||{};var r={};function n(e,t,r,n){if(utils$1.isPlainObject(e)&&utils$1.isPlainObject(t)){return utils$1.merge.call({caseless:n},e,t)}else if(utils$1.isPlainObject(t)){return utils$1.merge({},t)}else if(utils$1.isArray(t)){return t.slice()}return t}function i(e,t,r,i){if(!utils$1.isUndefined(t)){return n(e,t,r,i)}else if(!utils$1.isUndefined(e)){return n(undefined,e,r,i)}}function a(e,t){if(!utils$1.isUndefined(t)){return n(undefined,t)}}function o(e,t){if(!utils$1.isUndefined(t)){return n(undefined,t)}else if(!utils$1.isUndefined(e)){return n(undefined,e)}}function s(r,i,a){if(a in t){return n(r,i)}else if(a in e){return n(undefined,r)}}var l={url:a,method:a,data:a,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:s,headers:function(e,t,r){return i(headersToObject(e),headersToObject(t),r,true)}};utils$1.forEach(Object.keys(Object.assign({},e,t)),(function n(a){var o=l[a]||i;var c=o(e[a],t[a],a);utils$1.isUndefined(c)&&o!==s||(r[a]=c)}));return r}var resolveConfig=function(e){var t=mergeConfig$1({},e);var r=t.data,n=t.withXSRFToken,i=t.xsrfHeaderName,a=t.xsrfCookieName,o=t.headers,s=t.auth;t.headers=o=AxiosHeaders.from(o);t.url=buildURL(buildFullPath(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer);if(s){o.set("Authorization","Basic "+btoa((s.username||"")+":"+(s.password?unescape(encodeURIComponent(s.password)):"")))}var l;if(utils$1.isFormData(r)){if(platform.hasStandardBrowserEnv||platform.hasStandardBrowserWebWorkerEnv){o.setContentType(undefined)}else if((l=o.getContentType())!==false){var c=l?l.split(";").map((function(e){return e.trim()})).filter(Boolean):[],u=c[0],d=c.slice(1);o.setContentType(__spreadArray([u||"multipart/form-data"],d,true).join("; "))}}if(platform.hasStandardBrowserEnv){n&&utils$1.isFunction(n)&&(n=n(t));if(n||n!==false&&isURLSameOrigin(t.url)){var f=i&&a&&cookies.read(a);if(f){o.set(i,f)}}}return t};var isXHRAdapterSupported=typeof XMLHttpRequest!=="undefined";var xhrAdapter=isXHRAdapterSupported&&function(e){return new Promise((function t(r,n){var i,a;var o=resolveConfig(e);var s=o.data;var l=AxiosHeaders.from(o.headers).normalize();var c=o.responseType,u=o.onUploadProgress,d=o.onDownloadProgress;var f;var p,h;var v,g;function m(){v&&v();g&&g();o.cancelToken&&o.cancelToken.unsubscribe(f);o.signal&&o.signal.removeEventListener("abort",f)}var y=new XMLHttpRequest;y.open(o.method.toUpperCase(),o.url,true);y.timeout=o.timeout;function b(){if(!y){return}var t=AxiosHeaders.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders());var i=!c||c==="text"||c==="json"?y.responseText:y.response;var a={data:i,status:y.status,statusText:y.statusText,headers:t,config:e,request:y};settle((function e(t){r(t);m()}),(function e(t){n(t);m()}),a);y=null}if("onloadend"in y){y.onloadend=b}else{y.onreadystatechange=function e(){if(!y||y.readyState!==4){return}if(y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)){return}setTimeout(b)}}y.onabort=function t(){if(!y){return}n(new AxiosError("Request aborted",AxiosError.ECONNABORTED,e,y));y=null};y.onerror=function t(){n(new AxiosError("Network Error",AxiosError.ERR_NETWORK,e,y));y=null};y.ontimeout=function t(){var r=o.timeout?"timeout of "+o.timeout+"ms exceeded":"timeout exceeded";var i=o.transitional||transitionalDefaults;if(o.timeoutErrorMessage){r=o.timeoutErrorMessage}n(new AxiosError(r,i.clarifyTimeoutError?AxiosError.ETIMEDOUT:AxiosError.ECONNABORTED,e,y));y=null};s===undefined&&l.setContentType(null);if("setRequestHeader"in y){utils$1.forEach(l.toJSON(),(function e(t,r){y.setRequestHeader(r,t)}))}if(!utils$1.isUndefined(o.withCredentials)){y.withCredentials=!!o.withCredentials}if(c&&c!=="json"){y.responseType=o.responseType}if(d){i=progressEventReducer(d,true),h=i[0],g=i[1];y.addEventListener("progress",h)}if(u&&y.upload){a=progressEventReducer(u),p=a[0],v=a[1];y.upload.addEventListener("progress",p);y.upload.addEventListener("loadend",v)}if(o.cancelToken||o.signal){f=function(t){if(!y){return}n(!t||t.type?new CanceledError(null,e,y):t);y.abort();y=null};o.cancelToken&&o.cancelToken.subscribe(f);if(o.signal){o.signal.aborted?f():o.signal.addEventListener("abort",f)}}var _=parseProtocol(o.url);if(_&&platform.protocols.indexOf(_)===-1){n(new AxiosError("Unsupported protocol "+_+":",AxiosError.ERR_BAD_REQUEST,e));return}y.send(s||null)}))};var composeSignals=function(e,t){var r=(e=e?e.filter(Boolean):[]).length;if(t||r){var n=new AbortController;var i;var a=function(e){if(!i){i=true;s();var t=e instanceof Error?e:this.reason;n.abort(t instanceof AxiosError?t:new CanceledError(t instanceof Error?t.message:t))}};var o=t&&setTimeout((function(){o=null;a(new AxiosError("timeout ".concat(t," of ms exceeded"),AxiosError.ETIMEDOUT))}),t);var s=function(){if(e){o&&clearTimeout(o);o=null;e.forEach((function(e){e.unsubscribe?e.unsubscribe(a):e.removeEventListener("abort",a)}));e=null}};e.forEach((function(e){return e.addEventListener("abort",a)}));var l=n.signal;l.unsubscribe=function(){return utils$1.asap(s)};return l}};var streamChunk=function(e,t){var r,n,i;return __generator(this,(function(a){switch(a.label){case 0:r=e.byteLength;if(!(!t||r<t))return[3,2];return[4,e];case 1:a.sent();return[2];case 2:n=0;a.label=3;case 3:if(!(n<r))return[3,5];i=n+t;return[4,e.slice(n,i)];case 4:a.sent();n=i;return[3,3];case 5:return[2]}}))};var readBytes=function(e,t){return __asyncGenerator(this,arguments,(function(){var r,n,i,a,o;var s,l,c,u;return __generator(this,(function(d){switch(d.label){case 0:d.trys.push([0,7,8,13]);r=true,n=__asyncValues(readStream(e));d.label=1;case 1:return[4,__await(n.next())];case 2:if(!(i=d.sent(),s=i.done,!s))return[3,6];u=i.value;r=false;a=u;return[5,__values(__asyncDelegator(__asyncValues(streamChunk(a,t))))];case 3:return[4,__await.apply(void 0,[d.sent()])];case 4:d.sent();d.label=5;case 5:r=true;return[3,1];case 6:return[3,13];case 7:o=d.sent();l={error:o};return[3,13];case 8:d.trys.push([8,,11,12]);if(!(!r&&!s&&(c=n.return)))return[3,10];return[4,__await(c.call(n))];case 9:d.sent();d.label=10;case 10:return[3,12];case 11:if(l)throw l.error;return[7];case 12:return[7];case 13:return[2]}}))}))};var readStream=function(e){return __asyncGenerator(this,arguments,(function(){var t,r,n,i;return __generator(this,(function(a){switch(a.label){case 0:if(!e[Symbol.asyncIterator])return[3,4];return[5,__values(__asyncDelegator(__asyncValues(e)))];case 1:return[4,__await.apply(void 0,[a.sent()])];case 2:a.sent();return[4,__await(void 0)];case 3:return[2,a.sent()];case 4:t=e.getReader();a.label=5;case 5:a.trys.push([5,,12,14]);a.label=6;case 6:return[4,__await(t.read())];case 7:r=a.sent(),n=r.done,i=r.value;if(n){return[3,11]}return[4,__await(i)];case 8:return[4,a.sent()];case 9:a.sent();a.label=10;case 10:return[3,6];case 11:return[3,14];case 12:return[4,__await(t.cancel())];case 13:a.sent();return[7];case 14:return[2]}}))}))};var trackStream=function(e,t,r,n){var i=readBytes(e,t);var a=0;var o;var s=function(e){if(!o){o=true;n&&n(e)}};return new ReadableStream({pull:function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,o,l,c,u;return __generator(this,(function(d){switch(d.label){case 0:d.trys.push([0,2,,3]);return[4,i.next()];case 1:t=d.sent(),n=t.done,o=t.value;if(n){s();e.close();return[2]}l=o.byteLength;if(r){c=a+=l;r(c)}e.enqueue(new Uint8Array(o));return[3,3];case 2:u=d.sent();s(u);throw u;case 3:return[2]}}))}))},cancel:function(e){s(e);return i.return()}},{highWaterMark:2})};var isFetchSupported=typeof fetch==="function"&&typeof Request==="function"&&typeof Response==="function";var isReadableStreamSupported=isFetchSupported&&typeof ReadableStream==="function";var encodeText=isFetchSupported&&(typeof TextEncoder==="function"?function(e){return function(t){return e.encode(t)}}(new TextEncoder):function(e){return __awaiter(void 0,void 0,void 0,(function(){var t;return __generator(this,(function(r){switch(r.label){case 0:t=Uint8Array.bind;return[4,new Response(e).arrayBuffer()];case 1:return[2,new(t.apply(Uint8Array,[void 0,r.sent()]))]}}))}))});var test=function(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}try{return!!e.apply(void 0,t)}catch(e){return false}};var supportsRequestStream=isReadableStreamSupported&&test((function(){var e=false;var t=new Request(platform.origin,{body:new ReadableStream,method:"POST",get duplex(){e=true;return"half"}}).headers.has("Content-Type");return e&&!t}));var DEFAULT_CHUNK_SIZE=64*1024;var supportsResponseStream=isReadableStreamSupported&&test((function(){return utils$1.isReadableStream(new Response("").body)}));var resolvers={stream:supportsResponseStream&&function(e){return e.body}};isFetchSupported&&function(e){["text","arrayBuffer","blob","formData","stream"].forEach((function(t){!resolvers[t]&&(resolvers[t]=utils$1.isFunction(e[t])?function(e){return e[t]()}:function(e,r){throw new AxiosError("Response type '".concat(t,"' is not supported"),AxiosError.ERR_NOT_SUPPORT,r)})}))}(new Response);var getBodyLength=function(e){return __awaiter(void 0,void 0,void 0,(function(){var t;return __generator(this,(function(r){switch(r.label){case 0:if(e==null){return[2,0]}if(utils$1.isBlob(e)){return[2,e.size]}if(!utils$1.isSpecCompliantForm(e))return[3,2];t=new Request(platform.origin,{method:"POST",body:e});return[4,t.arrayBuffer()];case 1:return[2,r.sent().byteLength];case 2:if(utils$1.isArrayBufferView(e)||utils$1.isArrayBuffer(e)){return[2,e.byteLength]}if(utils$1.isURLSearchParams(e)){e=e+""}if(!utils$1.isString(e))return[3,4];return[4,encodeText(e)];case 3:return[2,r.sent().byteLength];case 4:return[2]}}))}))};var resolveBodyLength=function(e,t){return __awaiter(void 0,void 0,void 0,(function(){var r;return __generator(this,(function(n){r=utils$1.toFiniteNumber(e.getContentLength());return[2,r==null?getBodyLength(t):r]}))}))};var fetchAdapter=isFetchSupported&&function(e){return __awaiter(void 0,void 0,void 0,(function(){var t,r,n,i,a,o,s,l,c,u,d,f,p,h,v,g,m,y,b,_,w,S,$,k,E,x,A,O,P,j,$,I,C,T;return __generator(this,(function(F){switch(F.label){case 0:t=resolveConfig(e),r=t.url,n=t.method,i=t.data,a=t.signal,o=t.cancelToken,s=t.timeout,l=t.onDownloadProgress,c=t.onUploadProgress,u=t.responseType,d=t.headers,f=t.withCredentials,p=f===void 0?"same-origin":f,h=t.fetchOptions;u=u?(u+"").toLowerCase():"text";v=composeSignals([a,o&&o.toAbortSignal()],s);m=v&&v.unsubscribe&&function(){v.unsubscribe()};F.label=1;case 1:F.trys.push([1,7,,8]);b=c&&supportsRequestStream&&n!=="get"&&n!=="head";if(!b)return[3,3];return[4,resolveBodyLength(d,i)];case 2:b=(y=F.sent())!==0;F.label=3;case 3:if(b){_=new Request(r,{method:"POST",body:i,duplex:"half"});w=void 0;if(utils$1.isFormData(i)&&(w=_.headers.get("content-type"))){d.setContentType(w)}if(_.body){S=progressEventDecorator(y,progressEventReducer(asyncDecorator(c))),$=S[0],k=S[1];i=trackStream(_.body,DEFAULT_CHUNK_SIZE,$,k)}}if(!utils$1.isString(p)){p=p?"include":"omit"}E="credentials"in Request.prototype;g=new Request(r,__assign(__assign({},h),{signal:v,method:n.toUpperCase(),headers:d.normalize().toJSON(),body:i,duplex:"half",credentials:E?p:undefined}));return[4,fetch(g,h)];case 4:x=F.sent();A=supportsResponseStream&&(u==="stream"||u==="response");if(supportsResponseStream&&(l||A&&m)){O={};["status","statusText","headers"].forEach((function(e){O[e]=x[e]}));P=utils$1.toFiniteNumber(x.headers.get("content-length"));j=l&&progressEventDecorator(P,progressEventReducer(asyncDecorator(l),true))||[],$=j[0],I=j[1];x=new Response(trackStream(x.body,DEFAULT_CHUNK_SIZE,$,(function(){I&&I();m&&m()})),O)}u=u||"text";return[4,resolvers[utils$1.findKey(resolvers,u)||"text"](x,e)];case 5:C=F.sent();!A&&m&&m();return[4,new Promise((function(t,r){settle(t,r,{data:C,headers:AxiosHeaders.from(x.headers),status:x.status,statusText:x.statusText,config:e,request:g})}))];case 6:return[2,F.sent()];case 7:T=F.sent();m&&m();if(T&&T.name==="TypeError"&&/Load failed|fetch/i.test(T.message)){throw Object.assign(new AxiosError("Network Error",AxiosError.ERR_NETWORK,e,g),{cause:T.cause||T})}throw AxiosError.from(T,T&&T.code,e,g);case 8:return[2]}}))}))};var knownAdapters={http:httpAdapter,xhr:xhrAdapter,fetch:fetchAdapter};utils$1.forEach(knownAdapters,(function(e,t){if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var renderReason=function(e){return"- ".concat(e)};var isResolvedHandle=function(e){return utils$1.isFunction(e)||e===null||e===false};var adapters={getAdapter:function(e){e=utils$1.isArray(e)?e:[e];var t=e.length;var r;var n;var i={};for(var a=0;a<t;a++){r=e[a];var o=void 0;n=r;if(!isResolvedHandle(r)){n=knownAdapters[(o=String(r)).toLowerCase()];if(n===undefined){throw new AxiosError("Unknown adapter '".concat(o,"'"))}}if(n){break}i[o||"#"+a]=n}if(!n){var s=Object.entries(i).map((function(e){var t=e[0],r=e[1];return"adapter ".concat(t," ")+(r===false?"is not supported by the environment":"is not available in the build")}));var l=t?s.length>1?"since :\n"+s.map(renderReason).join("\n"):" "+renderReason(s[0]):"as no adapter specified";throw new AxiosError("There is no suitable adapter to dispatch the request "+l,"ERR_NOT_SUPPORT")}return n},adapters:knownAdapters};function throwIfCancellationRequested(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new CanceledError(null,e)}}function dispatchRequest(e){throwIfCancellationRequested(e);e.headers=AxiosHeaders.from(e.headers);e.data=transformData.call(e,e.transformRequest);if(["post","put","patch"].indexOf(e.method)!==-1){e.headers.setContentType("application/x-www-form-urlencoded",false)}var t=adapters.getAdapter(e.adapter||defaults.adapter);return t(e).then((function t(r){throwIfCancellationRequested(e);r.data=transformData.call(e,e.transformResponse,r);r.headers=AxiosHeaders.from(r.headers);return r}),(function t(r){if(!isCancel(r)){throwIfCancellationRequested(e);if(r&&r.response){r.response.data=transformData.call(e,e.transformResponse,r.response);r.response.headers=AxiosHeaders.from(r.response.headers)}}return Promise.reject(r)}))}var VERSION="1.10.0";var validators$1={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){validators$1[e]=function r(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var deprecatedWarnings={};validators$1.transitional=function e(t,r,n){function i(e,t){return"[Axios v"+VERSION+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(e,n,a){if(t===false){throw new AxiosError(i(n," has been removed"+(r?" in "+r:"")),AxiosError.ERR_DEPRECATED)}if(r&&!deprecatedWarnings[n]){deprecatedWarnings[n]=true;console.warn(i(n," has been deprecated since v"+r+" and will be removed in the near future"))}return t?t(e,n,a):true}};validators$1.spelling=function e(t){return function(e,r){console.warn("".concat(r," is likely a misspelling of ").concat(t));return true}};function assertOptions(e,t,r){if(typeof e!=="object"){throw new AxiosError("options must be an object",AxiosError.ERR_BAD_OPTION_VALUE)}var n=Object.keys(e);var i=n.length;while(i-- >0){var a=n[i];var o=t[a];if(o){var s=e[a];var l=s===undefined||o(s,a,e);if(l!==true){throw new AxiosError("option "+a+" must be "+l,AxiosError.ERR_BAD_OPTION_VALUE)}continue}if(r!==true){throw new AxiosError("Unknown option "+a,AxiosError.ERR_BAD_OPTION)}}}var validator={assertOptions:assertOptions,validators:validators$1};var validators=validator.validators;var Axios=function(){function e(e){this.defaults=e||{};this.interceptors={request:new InterceptorManager,response:new InterceptorManager}}e.prototype.request=function(e,t){return __awaiter(this,void 0,void 0,(function(){var r,n,i;return __generator(this,(function(a){switch(a.label){case 0:a.trys.push([0,2,,3]);return[4,this._request(e,t)];case 1:return[2,a.sent()];case 2:r=a.sent();if(r instanceof Error){n={};Error.captureStackTrace?Error.captureStackTrace(n):n=new Error;i=n.stack?n.stack.replace(/^.+\n/,""):"";try{if(!r.stack){r.stack=i}else if(i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))){r.stack+="\n"+i}}catch(e){}}throw r;case 3:return[2]}}))}))};e.prototype._request=function(e,t){if(typeof e==="string"){t=t||{};t.url=e}else{t=e||{}}t=mergeConfig$1(this.defaults,t);var r=t.transitional,n=t.paramsSerializer,i=t.headers;if(r!==undefined){validator.assertOptions(r,{silentJSONParsing:validators.transitional(validators.boolean),forcedJSONParsing:validators.transitional(validators.boolean),clarifyTimeoutError:validators.transitional(validators.boolean)},false)}if(n!=null){if(utils$1.isFunction(n)){t.paramsSerializer={serialize:n}}else{validator.assertOptions(n,{encode:validators.function,serialize:validators.function},true)}}if(t.allowAbsoluteUrls!==undefined);else if(this.defaults.allowAbsoluteUrls!==undefined){t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls}else{t.allowAbsoluteUrls=true}validator.assertOptions(t,{baseUrl:validators.spelling("baseURL"),withXsrfToken:validators.spelling("withXSRFToken")},true);t.method=(t.method||this.defaults.method||"get").toLowerCase();var a=i&&utils$1.merge(i.common,i[t.method]);i&&utils$1.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete i[e]}));t.headers=AxiosHeaders.concat(a,i);var o=[];var s=true;this.interceptors.request.forEach((function e(r){if(typeof r.runWhen==="function"&&r.runWhen(t)===false){return}s=s&&r.synchronous;o.unshift(r.fulfilled,r.rejected)}));var l=[];this.interceptors.response.forEach((function e(t){l.push(t.fulfilled,t.rejected)}));var c;var u=0;var d;if(!s){var f=[dispatchRequest.bind(this),undefined];f.unshift.apply(f,o);f.push.apply(f,l);d=f.length;c=Promise.resolve(t);while(u<d){c=c.then(f[u++],f[u++])}return c}d=o.length;var p=t;u=0;while(u<d){var h=o[u++];var v=o[u++];try{p=h(p)}catch(e){v.call(this,e);break}}try{c=dispatchRequest.call(this,p)}catch(e){return Promise.reject(e)}u=0;d=l.length;while(u<d){c=c.then(l[u++],l[u++])}return c};e.prototype.getUri=function(e){e=mergeConfig$1(this.defaults,e);var t=buildFullPath(e.baseURL,e.url,e.allowAbsoluteUrls);return buildURL(t,e.params,e.paramsSerializer)};return e}();utils$1.forEach(["delete","get","head","options"],(function e(t){Axios.prototype[t]=function(e,r){return this.request(mergeConfig$1(r||{},{method:t,url:e,data:(r||{}).data}))}}));utils$1.forEach(["post","put","patch"],(function e(t){function r(e){return function r(n,i,a){return this.request(mergeConfig$1(a||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}Axios.prototype[t]=r();Axios.prototype[t+"Form"]=r(true)}));var CancelToken=function(){function e(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}var t;this.promise=new Promise((function e(r){t=r}));var r=this;this.promise.then((function(e){if(!r._listeners)return;var t=r._listeners.length;while(t-- >0){r._listeners[t](e)}r._listeners=null}));this.promise.then=function(e){var t;var n=new Promise((function(e){r.subscribe(e);t=e})).then(e);n.cancel=function e(){r.unsubscribe(t)};return n};e((function e(n,i,a){if(r.reason){return}r.reason=new CanceledError(n,i,a);t(r.reason)}))}e.prototype.throwIfRequested=function(){if(this.reason){throw this.reason}};e.prototype.subscribe=function(e){if(this.reason){e(this.reason);return}if(this._listeners){this._listeners.push(e)}else{this._listeners=[e]}};e.prototype.unsubscribe=function(e){if(!this._listeners){return}var t=this._listeners.indexOf(e);if(t!==-1){this._listeners.splice(t,1)}};e.prototype.toAbortSignal=function(){var e=this;var t=new AbortController;var r=function(e){t.abort(e)};this.subscribe(r);t.signal.unsubscribe=function(){return e.unsubscribe(r)};return t.signal};e.source=function(){var t;var r=new e((function e(r){t=r}));return{token:r,cancel:t}};return e}();function spread(e){return function t(r){return e.apply(null,r)}}function isAxiosError(e){return utils$1.isObject(e)&&e.isAxiosError===true}var HttpStatusCode={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(HttpStatusCode).forEach((function(e){var t=e[0],r=e[1];HttpStatusCode[r]=t}));function createInstance(e){var t=new Axios(e);var r=bind(Axios.prototype.request,t);utils$1.extend(r,Axios.prototype,t,{allOwnKeys:true});utils$1.extend(r,t,null,{allOwnKeys:true});r.create=function t(r){return createInstance(mergeConfig$1(e,r))};return r}var axios=createInstance(defaults);axios.Axios=Axios;axios.CanceledError=CanceledError;axios.CancelToken=CancelToken;axios.isCancel=isCancel;axios.VERSION=VERSION;axios.toFormData=toFormData;axios.AxiosError=AxiosError;axios.Cancel=axios.CanceledError;axios.all=function e(t){return Promise.all(t)};axios.spread=spread;axios.isAxiosError=isAxiosError;axios.mergeConfig=mergeConfig$1;axios.AxiosHeaders=AxiosHeaders;axios.formToJSON=function(e){return formDataToJSON(utils$1.isHTMLForm(e)?new FormData(e):e)};axios.getAdapter=adapters.getAdapter;axios.HttpStatusCode=HttpStatusCode;axios.default=axios;var InvalidTokenError=function(e){__extends(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(Error);InvalidTokenError.prototype.name="InvalidTokenError";function b64DecodeUnicode(e){return decodeURIComponent(atob(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();if(r.length<2){r="0"+r}return"%"+r})))}function base64UrlDecode(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return b64DecodeUnicode(t)}catch(e){return atob(t)}}function jwtDecode(e,t){if(typeof e!=="string"){throw new InvalidTokenError("Invalid token specified: must be a string")}t||(t={});var r=t.header===true?0:1;var n=e.split(".")[r];if(typeof n!=="string"){throw new InvalidTokenError("Invalid token specified: missing part #".concat(r+1))}var i;try{i=base64UrlDecode(n)}catch(e){throw new InvalidTokenError("Invalid token specified: invalid base64 for part #".concat(r+1," (").concat(e.message,")"))}try{return JSON.parse(i)}catch(e){throw new InvalidTokenError("Invalid token specified: invalid json for part #".concat(r+1," (").concat(e.message,")"))}}function n$2(e,t,r,n,i){for(t=t.split?t.split("."):t,n=0;n<t.length;n++)e=e?e[t[n]]:i;return e===i?r:e}var e="undefined",o$1="object",b$3="any",m$1="*",j$1="__";"undefined"!=typeof process?process:{};var $$1="undefined"!=typeof document;"undefined"!=typeof Deno&&void 0!==Deno.core;$$1&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function M$1(e,t){return t.charAt(0)[e]()+t.slice(1)}var U$1=M$1.bind(null,"toUpperCase"),H$1=M$1.bind(null,"toLowerCase");function J$2(e){return Y$1(e)?U$1("null"):"object"==typeof e?yn(e):Object.prototype.toString.call(e).slice(8,-1)}function R$1(e,t){void 0===t&&(t=!0);var r=J$2(e);return t?H$1(r):r}function V$1(e,t){return typeof t===e}var W$1=V$1.bind(null,"function"),q$1=V$1.bind(null,"string"),I$2=V$1.bind(null,"undefined");var Q$1=V$1.bind(null,"boolean");V$1.bind(null,"symbol");function Y$1(e){return null===e}function nn(e){return"number"===R$1(e)&&!isNaN(e)}function rn(e){return"array"===R$1(e)}function on(e){if(!un(e))return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function un(e){return e&&("object"==typeof e||null!==e)}function yn(e){return W$1(e.constructor)?e.constructor.name:null}function hn(e){return e instanceof Error||q$1(e.message)&&e.constructor&&nn(e.constructor.stackTraceLimit)}function On(e,t){if("object"!=typeof t||Y$1(t))return!1;if(t instanceof e)return!0;var r=R$1(new e(""));if(hn(t))for(;t;){if(R$1(t)===r)return!0;t=Object.getPrototypeOf(t)}return!1}On.bind(null,TypeError);On.bind(null,SyntaxError);function $n(e,t){var r=e instanceof Element||e instanceof HTMLDocument;return r&&t?Tn(e,t):r}function Tn(e,t){return void 0===t&&(t=""),e&&e.nodeName===t.toUpperCase()}function _n(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}_n($n,"form");_n($n,"button");_n($n,"input");_n($n,"select");function n$1(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function s(e){return function(e){for(var t,r=Object.create(null),n=/([^&=]+)=?([^&]*)/g;t=n.exec(e);){var i=n$1(t[1]),a=n$1(t[2]);"[]"===i.substring(i.length-2)?(r[i=i.substring(0,i.length-2)]||(r[i]=[])).push(a):r[i]=""===a||a}for(var o in r){var s=o.split("[");s.length>1&&(m$2(r,s.map((function(e){return e.replace(/[?[\]\\ ]/g,"")})),r[o]),delete r[o])}return r}(function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return $$1&&window.location.search.substring(1)}(e))}function m$2(e,t,r){for(var n=t.length-1,i=0;i<n;++i){var a=t[i];if("__proto__"===a||"constructor"===a)break;a in e||(e[a]={}),e=e[a]}e[t[n]]=r}function y$1(){for(var e="",t=0,r=4294967295*Math.random()|0;t++<36;){var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&r;e+="-"==n||"4"==n?n:("x"==n?i:3&i|8).toString(16),r=t%8==0?4294967295*Math.random()|0:r>>4}return e}var l$1="global",o$2=j$1+"global"+j$1,n$3=typeof self===o$1&&self.self===self&&self||typeof global===o$1&&global.global===global&&global||void 0;function a$2(e){return n$3[o$2][e]}function f$1(e,t){return n$3[o$2][e]=t}function i$2(e){delete n$3[o$2][e]}function u$1(e,t,r){var n;try{if(b$2(e)){var i=window[e];n=i[t].bind(i)}}catch(e){}return n||r}n$3[o$2]||(n$3[o$2]={});var c$1={};function b$2(t){if(typeof c$1[t]!==e)return c$1[t];try{var r=window[t];r.setItem(e,e),r.removeItem(e)}catch(e){return c$1[t]=!1}return c$1[t]=!0}function g$1(){return g$1=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},g$1.apply(this,arguments)}var h$1="function",v$1="undefined",y$2="@@redux/"+Math.random().toString(36),b$1=function(){return typeof Symbol===h$1&&Symbol.observable||"@@observable"}(),I$1=" != "+h$1;function w$1(e,t,r){var n;if(typeof t===h$1&&typeof r===v$1&&(r=t,t=void 0),typeof r!==v$1){if(typeof r!==h$1)throw new Error("enhancer"+I$1);return r(w$1)(e,t)}if(typeof e!==h$1)throw new Error("reducer"+I$1);var i=e,a=t,o=[],s=o,l=!1;function c(){s===o&&(s=o.slice())}function u(){return a}function d(e){if(typeof e!==h$1)throw new Error("Listener"+I$1);var t=!0;return c(),s.push(e),function(){if(t){t=!1,c();var r=s.indexOf(e);s.splice(r,1)}}}function f(e){if(!on(e))throw new Error("Act != obj");if(typeof e.type===v$1)throw new Error("ActType "+v$1);if(l)throw new Error("Dispatch in reducer");try{l=!0,a=i(a,e)}finally{l=!1}for(var t=o=s,r=0;r<t.length;r++)(0,t[r])();return e}return f({type:"@@redux/INIT"}),(n={dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if(typeof e!==h$1)throw new Error("next reducer"+I$1);i=e,f({type:"@@redux/INIT"})}})[b$1]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e)throw new TypeError("Observer != obj");function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[b$1]=function(){return this},e},n}function E$1(e,t){var r=t&&t.type;return"action "+(r&&r.toString()||"?")+"reducer "+e+" returns "+v$1}function P$1(){var e=[].slice.call(arguments);return 0===e.length?function(e){return e}:1===e.length?e[0]:e.reduce((function(e,t){return function(){return e(t.apply(void 0,[].slice.call(arguments)))}}))}function S$1(){var e=arguments;return function(t){return function(r,n,i){var a,o=t(r,n,i),s=o.dispatch,l={getState:o.getState,dispatch:function(e){return s(e)}};return a=[].slice.call(e).map((function(e){return e(l)})),g$1({},o,{dispatch:s=P$1.apply(void 0,a)(o.dispatch)})}}}var N$1=j$1+"anon_id",A$1=j$1+"user_id",_$1=j$1+"user_traits",j$2="userId",k$1="anonymousId",x$1=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],T$1=["name","EVENTS","config","loaded"],z$1=x$1.reduce((function(e,t){return e[t]=t,e}),{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),M$2=/^utm_/,q$2=/^an_prop_/,V$2=/^an_trait_/;function C$1(e){var t=e.storage.setItem;return function(r){return function(n){return function(i){if(i.type===z$1.bootstrap){var a=i.params,o=i.user,s=i.persistedUser,l=i.initialUser,c=s.userId===o.userId;s.anonymousId!==o.anonymousId&&t(N$1,o.anonymousId),c||t(A$1,o.userId),l.traits&&t(_$1,g$1({},c&&s.traits?s.traits:{},l.traits));var u=Object.keys(i.params);if(u.length){var d=a.an_uid,f=a.an_event,p=u.reduce((function(e,t){if(t.match(M$2)||t.match(/^(d|g)clid/)){var r=t.replace(M$2,"");e.campaign["campaign"===r?"name":r]=a[t]}return t.match(q$2)&&(e.props[t.replace(q$2,"")]=a[t]),t.match(V$2)&&(e.traits[t.replace(V$2,"")]=a[t]),e}),{campaign:{},props:{},traits:{}});r.dispatch(g$1({type:z$1.params,raw:a},p,d?{userId:d}:{})),d&&setTimeout((function(){return e.identify(d,p.traits)}),0),f&&setTimeout((function(){return e.track(f,p.props)}),0),Object.keys(p.campaign).length&&r.dispatch({type:z$1.campaign,campaign:p.campaign})}}return n(i)}}}}function U$2(e){return function(t,r){if(void 0===t&&(t={}),void 0===r&&(r={}),r.type===z$1.setItemEnd){if(r.key===N$1)return g$1({},t,{anonymousId:r.value});if(r.key===A$1)return g$1({},t,{userId:r.value})}switch(r.type){case z$1.identify:return Object.assign({},t,{userId:r.userId,traits:g$1({},t.traits,r.traits)});case z$1.reset:return[A$1,N$1,_$1].forEach((function(t){e.removeItem(t)})),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function R$2(e){return{userId:e.getItem(A$1),anonymousId:e.getItem(N$1),traits:e.getItem(_$1)}}var $$2=function(e){return j$1+"TEMP"+j$1+e};function D$1(e){var t=e.storage,r=t.setItem,n=t.removeItem,i=t.getItem;return function(e){return function(t){return function(a){var o=a.userId,s=a.traits,l=a.options;if(a.type===z$1.reset&&([A$1,_$1,N$1].forEach((function(e){n(e)})),[j$2,k$1,"traits"].forEach((function(e){i$2($$2(e))}))),a.type===z$1.identify){i(N$1)||r(N$1,y$1());var c=i(A$1),u=i(_$1)||{};c&&c!==o&&e.dispatch({type:z$1.userIdChanged,old:{userId:c,traits:u},new:{userId:o,traits:s},options:l}),o&&r(A$1,o),s&&r(_$1,g$1({},u,s))}return t(a)}}}}var B$1={};function L$1(e,t){B$1[e]&&W$1(B$1[e])&&(B$1[e](t),delete B$1[e])}function J$1(e,t,r){return new Promise((function(n,i){return t()?n(e):r<1?i(g$1({},e,{queue:!0})):new Promise((function(e){return setTimeout(e,10)})).then((function(a){return J$1(e,t,r-10).then(n,i)}))}))}function X(e){return{abort:e}}var H$2=function(e){var t=e.data,r=e.action,n=e.instance,i=e.state,a=e.allPlugins,o=e.allMatches,s=e.store,l=e.EVENTS;try{var c=i.plugins,u=i.context,d=r.type,f=d.match(W$2),p=t.exact.map((function(e){return e.pluginName}));f&&(p=o.during.map((function(e){return e.pluginName})));var h=function(e,t){return function(r,n,i){var a=n.config,o=n.name,s=o+"."+r.type;i&&(s=i.event);var l=r.type.match(W$2)?function(e,t,r,n,i){return function(a,o){var s=n?n.name:e,l=o&&ne(o)?o:r;if(n&&(!(l=o&&ne(o)?o:[e]).includes(e)||1!==l.length))throw new Error("Method "+t+" can only abort "+e+" plugin. "+JSON.stringify(l)+" input valid");return g$1({},i,{abort:{reason:a,plugins:l,caller:t,_:s}})}}(o,s,t,i,r):function(e,t){return function(){throw new Error(e.type+" action not cancellable. Remove abort in "+t)}}(r,s);return{payload:ae(r),instance:e,config:a||{},abort:l}}}(n,p),v=t.exact.reduce((function(e,t){var r=t.pluginName,n=t.methodName,i=!1;return n.match(/^initialize/)||n.match(/^reset/)||(i=!c[r].loaded),u.offline&&n.match(/^(page|track|identify)/)&&(i=!0),e[""+r]=i,e}),{});return Promise.resolve(t.exact.reduce((function(e,i,o){try{var s=i.pluginName;return Promise.resolve(e).then((function(e){function i(){return Promise.resolve(e)}var o=function(){if(t.namespaced&&t.namespaced[s])return Promise.resolve(t.namespaced[s].reduce((function(e,t,r){try{return Promise.resolve(e).then((function(e){return t.method&&W$1(t.method)?(function(e,t){var r=ie(e);if(r&&r.name===t){var n=ie(r.method);throw new Error([t+" plugin is calling method "+e,"Plugins cant call self","Use "+r.method+" "+(n?"or "+n.method:"")+" in "+t+" plugin insteadof "+e].join("\n"))}}(t.methodName,t.pluginName),Promise.resolve(t.method({payload:e,instance:n,abort:(r=e,i=s,o=t.pluginName,function(e,t){return g$1({},r,{abort:{reason:e,plugins:t||[i],caller:d,from:o||i}})}),config:Q$2(t.pluginName,c,a),plugins:c})).then((function(t){var r=on(t)?t:{};return Promise.resolve(g$1({},e,r))}))):e;var r,i,o}))}catch(e){return Promise.reject(e)}}),Promise.resolve(r))).then((function(t){e[s]=t}));e[s]=r}();return o&&o.then?o.then(i):i()}))}catch(e){return Promise.reject(e)}}),Promise.resolve({}))).then((function(e){return Promise.resolve(t.exact.reduce((function(r,i,o){try{var l=t.exact.length===o+1,u=i.pluginName,p=a[u];return Promise.resolve(r).then((function(t){var r=e[u]?e[u]:{};if(f&&(r=t),ee(r,u))return K$1({data:r,method:d,instance:n,pluginName:u,store:s}),Promise.resolve(t);if(ee(t,u))return l&&K$1({data:t,method:d,instance:n,store:s}),Promise.resolve(t);if(v.hasOwnProperty(u)&&!0===v[u])return s.dispatch({type:"queue",plugin:u,payload:r,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(t);var i=h(e[u],a[u]);return Promise.resolve(p[d]({abort:i.abort,payload:r,instance:n,config:Q$2(u,c,a),plugins:c})).then((function(i){var a=on(i)?i:{},o=g$1({},t,a),l=e[u];if(ee(l,u))K$1({data:l,method:d,instance:n,pluginName:u,store:s});else{var c=d+":"+u;(c.match(/:/g)||[]).length<2&&!d.match(F$1)&&!d.match(G$1)&&n.dispatch(g$1({},f?o:r,{type:c,_:{called:c,from:"submethod"}}))}return Promise.resolve(o)}))}))}catch(e){return Promise.reject(e)}}),Promise.resolve(r))).then((function(e){if(!(d.match(W$2)||d.match(/^registerPlugin/)||d.match(G$1)||d.match(F$1)||d.match(/^params/)||d.match(/^userIdChanged/))){if(l.plugins.includes(d),e._&&e._.originalAction===d)return e;var r=g$1({},e,{_:{originalAction:e.type,called:e.type,from:"engineEnd"}});te(e,t.exact.length)&&!d.match(/End$/)&&(r=g$1({},r,{type:e.type+"Aborted"})),s.dispatch(r)}return e}))}))}catch(e){return Promise.reject(e)}},W$2=/Start$/,F$1=/^bootstrap/,G$1=/^ready/;function K$1(e){var t=e.pluginName,r=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(g$1({},e.data,{type:r,_:{called:r,from:"abort"}}))}function Q$2(e,t,r){var n=t[e]||r[e];return n&&n.config?n.config:{}}function Y(e,t){return t.reduce((function(t,r){return r[e]?t.concat({methodName:e,pluginName:r.name,method:r[e]}):t}),[])}function Z(e,t){var r=e.replace(W$2,""),n=t?":"+t:"";return[""+e+n,""+r+n,r+"End"+n]}function ee(e,t){var r=e.abort;return!!r&&(!0===r||re(r,t)||r&&re(r.plugins,t))}function te(e,t){var r=e.abort;if(!r)return!1;if(!0===r||q$1(r))return!0;var n=r.plugins;return ne(r)&&r.length===t||ne(n)&&n.length===t}function ne(e){return Array.isArray(e)}function re(e,t){return!(!e||!ne(e))&&e.includes(t)}function ie(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function ae(e){return Object.keys(e).reduce((function(t,r){return"type"===r||(t[r]=on(e[r])?Object.assign({},e[r]):e[r]),t}),{})}function oe(e,t,r){var n={};return function(i){return function(a){return function(o){try{var s,l=function(e){return s?e:a(d)},c=o.type,u=o.plugins,d=o;if(o.abort)return Promise.resolve(a(o));if(c===z$1.enablePlugin&&i.dispatch({type:z$1.initializeStart,plugins:u,disabled:[],fromEnable:!0,meta:o.meta}),c===z$1.disablePlugin&&setTimeout((function(){return L$1(o.meta.rid,{payload:o})}),0),c===z$1.initializeEnd){var f=t(),p=Object.keys(f),h=p.filter((function(e){return u.includes(e)})).map((function(e){return f[e]})),v=[],g=[],m=o.disabled,y=h.map((function(e){var t=e.loaded,r=e.name,a=e.config;return J$1(e,(function(){return t({config:a})}),1e4).then((function(t){return n[r]||(i.dispatch({type:z$1.pluginReadyType(r),name:r,events:Object.keys(e).filter((function(e){return!T$1.includes(e)}))}),n[r]=!0),v=v.concat(r),e})).catch((function(e){if(e instanceof Error)throw new Error(e);return g=g.concat(e.name),e}))}));Promise.all(y).then((function(e){var t={plugins:v,failed:g,disabled:m};setTimeout((function(){p.length===y.length+m.length&&i.dispatch(g$1({},{type:z$1.ready},t))}),0)}))}var b=function(){if(c!==z$1.bootstrap)return/^ready:([^:]*)$/.test(c)&&setTimeout((function(){return function(e,t,r){var n={},i=t(),a=e.getState(),o=a.plugins,s=a.queue,l=a.user;if(!a.context.offline&&s&&s.actions&&s.actions.length){var c=s.actions.reduce((function(e,t,r){return o[t.plugin].loaded?(e.process.push(t),e.processIndex.push(r)):(e.requeue.push(t),e.requeueIndex.push(r)),e}),{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(c.processIndex&&c.processIndex.length){c.processIndex.forEach((function(t){var a=s.actions[t],c=a.plugin,u=a.payload.type,d=i[c][u];if(d&&W$1(d)){var f,p=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),[j$2,k$1].reduce((function(r,n){return e.hasOwnProperty(n)&&t[n]&&t[n]!==e[n]&&(r[n]=t[n]),r}),e)}(a.payload,l),h=n[p.meta.rid];if(!h&&(f=d({payload:p,config:o[c].config,instance:r,abort:X}))&&on(f)&&f.abort)return void(n[p.meta.rid]=!0);if(!h){var v=u+":"+c;e.dispatch(g$1({},p,{type:v,_:{called:v,from:"queueDrain"}}))}}}));var u=s.actions.filter((function(e,t){return!~c.processIndex.indexOf(t)}));s.actions=u}}}(i,t,e)}),0),Promise.resolve(function(e,t,r,n,i){try{var a=W$1(t)?t():t,o=e.type,s=o.replace(W$2,"");if(e._&&e._.called)return Promise.resolve(e);var l=r.getState(),c=(f=a,void 0===(p=l.plugins)&&(p={}),void 0===(h=e.options)&&(h={}),Object.keys(f).filter((function(e){var t=h.plugins||{};return Q$1(t[e])?t[e]:!1!==t.all&&(!p[e]||!1!==p[e].enabled)})).map((function(e){return f[e]})));o===z$1.initializeStart&&e.fromEnable&&(c=Object.keys(l.plugins).filter((function(t){var r=l.plugins[t];return e.plugins.includes(t)&&!r.initialized})).map((function(e){return a[e]})));var u=c.map((function(e){return e.name})),d=function(e,t,r){var n=Z(e).map((function(e){return Y(e,t)}));return t.reduce((function(r,n){var i=n.name,a=Z(e,i).map((function(e){return Y(e,t)})),o=a[0],s=a[1],l=a[2];return o.length&&(r.beforeNS[i]=o),s.length&&(r.duringNS[i]=s),l.length&&(r.afterNS[i]=l),r}),{before:n[0],beforeNS:{},during:n[1],duringNS:{},after:n[2],afterNS:{}})}(o,c);return Promise.resolve(H$2({action:e,data:{exact:d.before,namespaced:d.beforeNS},state:l,allPlugins:a,allMatches:d,instance:r,store:n,EVENTS:i})).then((function(e){function t(){var t=function(){if(o.match(W$2))return Promise.resolve(H$2({action:g$1({},c,{type:s+"End"}),data:{exact:d.after,namespaced:d.afterNS},state:l,allPlugins:a,allMatches:d,instance:r,store:n,EVENTS:i})).then((function(e){e.meta&&e.meta.hasCallback&&L$1(e.meta.rid,{payload:e})}))}();return t&&t.then?t.then((function(){return e})):e}if(te(e,u.length))return e;var c,f=function(){if(o!==s)return Promise.resolve(H$2({action:g$1({},e,{type:s}),data:{exact:d.during,namespaced:d.duringNS},state:l,allPlugins:a,allMatches:d,instance:r,store:n,EVENTS:i})).then((function(e){c=e}));c=e}();return f&&f.then?f.then(t):t()}))}catch(e){return Promise.reject(e)}var f,p,h}(o,t,e,i,r)).then((function(e){return s=1,a(e)}))}();return Promise.resolve(b&&b.then?b.then(l):l(b))}catch(e){return Promise.reject(e)}}}}}function ue(e){return function(t){return function(t){return function(r){var n=r.type,i=r.key,a=r.value,o=r.options;if(n===z$1.setItem||n===z$1.removeItem){if(r.abort)return t(r);n===z$1.setItem?e.setItem(i,a,o):e.removeItem(i,o)}return t(r)}}}}var ce=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(t,r){e[r]=e[r].concat(t)},this.removeMiddleware=function(t,r){var n=e[r].findIndex((function(e){return e===t}));-1!==n&&(e[r]=[].concat(e[r].slice(0,n),e[r].slice(n+1)))},this.dynamicMiddlewares=function(t){return function(r){return function(n){return function(i){var a={getState:r.getState,dispatch:function(e){return r.dispatch(e)}},o=e[t].map((function(e){return e(a)}));return P$1.apply(void 0,o)(n)(i)}}}}};function se(e){return function(t,r){void 0===t&&(t={});var n={};if("initialize:aborted"===r.type)return t;if(/^registerPlugin:([^:]*)$/.test(r.type)){var i=le(r.type,"registerPlugin"),a=e()[i];if(!a||!i)return t;var o=r.enabled,s=a.config;return n[i]={enabled:o,initialized:!!o&&Boolean(!a.initialize),loaded:!!o&&Boolean(a.loaded({config:s})),config:s},g$1({},t,n)}if(/^initialize:([^:]*)$/.test(r.type)){var l=le(r.type,z$1.initialize),c=e()[l];return c&&l?(n[l]=g$1({},t[l],{initialized:!0,loaded:Boolean(c.loaded({config:c.config}))}),g$1({},t,n)):t}if(/^ready:([^:]*)$/.test(r.type))return n[r.name]=g$1({},t[r.name],{loaded:!0}),g$1({},t,n);switch(r.type){case z$1.disablePlugin:return g$1({},t,fe(r.plugins,!1,t));case z$1.enablePlugin:return g$1({},t,fe(r.plugins,!0,t));default:return t}}}function le(e,t){return e.substring(t.length+1,e.length)}function fe(e,t,r){return e.reduce((function(e,n){return e[n]=g$1({},r[n],{enabled:t}),e}),r)}function de(e){try{return JSON.parse(JSON.stringify(e))}catch(e){}return e}var pe={last:{},history:[]};function me(e,t){void 0===e&&(e=pe);var r=t.options,n=t.meta;if(t.type===z$1.track){var i=de(g$1({event:t.event,properties:t.properties},Object.keys(r).length&&{options:r},{meta:n}));return g$1({},e,{last:i,history:e.history.concat(i)})}return e}var ge={actions:[]};function he(e,t){void 0===e&&(e=ge);var r=t.payload;switch(t.type){case"queue":var n;return n=r&&r.type&&r.type===z$1.identify?[t].concat(e.actions):e.actions.concat(t),g$1({},e,{actions:n});case"dequeue":return[];default:return e}}var ve=/#.*$/;function ye(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(ve,""):"")}var be,Ie=function(e){if(void 0===e&&(e={}),!$$1)return e;var t=document,r=t.title,n=t.referrer,i=window,a=i.location,o=i.innerWidth,s=i.innerHeight,l=a.hash,c=a.search,u=function(e){var t=function(){if($$1)for(var e,t=document.getElementsByTagName("link"),r=0;e=t[r];r++)if("canonical"===e.getAttribute("rel"))return e.getAttribute("href")}();return t?t.match(/\?/)?t:t+e:window.location.href.replace(ve,"")}(c),d={title:r,url:u,path:ye(u),hash:l,search:c,width:o,height:s};return n&&""!==n&&(d.referrer=n),g$1({},d,e)},we={last:{},history:[]};function Ee(e,t){void 0===e&&(e=we);var r=t.options;if(t.type===z$1.page){var n=de(g$1({properties:t.properties,meta:t.meta},Object.keys(r).length&&{options:r}));return g$1({},e,{last:n,history:e.history.concat(n)})}return e}be={};var Pe={initialized:!1,sessionId:y$1(),app:null,version:null,debug:!1,offline:!!$$1&&!navigator.onLine,os:{name:"na"},userAgent:$$1?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.14"},timezone:void 0,locale:void 0,campaign:{},referrer:be};function Se(e,t){void 0===e&&(e=Pe);var r=e.initialized,n=t.campaign;switch(t.type){case z$1.campaign:return g$1({},e,{campaign:n});case z$1.offline:return g$1({},e,{offline:!0});case z$1.online:return g$1({},e,{offline:!1});default:return r?e:g$1({},Pe,e,{initialized:!0})}}var Ne=["plugins","reducers","storage"];function Ae(){return f$1("analytics",[]),function(e){return function(t,r,n){var i=e(t,r,n),a=i.dispatch;return Object.assign(i,{dispatch:function(e){return n$3[o$2].analytics.push(e.action||e),a(e)}})}}}function _e(e){return function(){return P$1(P$1.apply(null,arguments),Ae())}}function Oe(e){return e?rn(e)?e:[e]:[]}function je(e,t,r){void 0===e&&(e={});var n,i,a=y$1();return t&&(B$1[a]=(n=t,i=function(e){for(var t,r=e||Array.prototype.slice.call(arguments),n=0;n<r.length;n++)if(W$1(r[n])){t=r[n];break}return t}(r),function(e){i&&i(e),n(e)})),g$1({},e,{rid:a,ts:(new Date).getTime()},t?{hasCallback:!0}:{})}function ke(e){void 0===e&&(e={});var t=e.reducers||{},r=e.initialUser||{},n=(e.plugins||[]).reduce((function(e,t){if(W$1(t))return e.middlewares=e.middlewares.concat(t),e;if(t.NAMESPACE&&(t.name=t.NAMESPACE),!t.name)throw new Error("https://lytics.dev/errors/1");t.config||(t.config={});var r=t.EVENTS?Object.keys(t.EVENTS).map((function(e){return t.EVENTS[e]})):[];e.pluginEnabled[t.name]=!(!1===t.enabled||!1===t.config.enabled),delete t.enabled,t.methods&&(e.methods[t.name]=Object.keys(t.methods).reduce((function(e,r){var n;return e[r]=(n=t.methods[r],function(){for(var e=Array.prototype.slice.call(arguments),t=new Array(n.length),r=0;r<e.length;r++)t[r]=e[r];return t[t.length]=S,n.apply({instance:S},t)}),e}),{}),delete t.methods);var n=Object.keys(t).concat(r),i=new Set(e.events.concat(n));if(e.events=Array.from(i),e.pluginsArray=e.pluginsArray.concat(t),e.plugins[t.name])throw new Error(t.name+"AlreadyLoaded");return e.plugins[t.name]=t,e.plugins[t.name].loaded||(e.plugins[t.name].loaded=function(){return!0}),e}),{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),i=e.storage?e.storage:{getItem:a$2,setItem:f$1,removeItem:i$2},a=function(e){return function(t,r,n){return r.getState("user")[t]||(n&&on(n)&&n[t]?n[t]:R$2(e)[t]||a$2($$2(t))||null)}}(i),o=n.plugins,l=n.events.filter((function(e){return!T$1.includes(e)})).sort(),c=new Set(l.concat(x$1).filter((function(e){return!T$1.includes(e)}))),u=Array.from(c).sort(),d=function(){return o},f=new ce,p=f.addMiddleware,h=f.removeMiddleware,v=f.dynamicMiddlewares,g=function(){throw new Error("Abort disabled inListener")},m=s(),y=R$2(i),b=g$1({},y,r,m.an_uid?{userId:m.an_uid}:{},m.an_aid?{anonymousId:m.an_aid}:{});b.anonymousId||(b.anonymousId=y$1());var _=g$1({enable:function(e,t){return new Promise((function(r){C.dispatch({type:z$1.enablePlugin,plugins:Oe(e),_:{originalAction:z$1.enablePlugin}},r,[t])}))},disable:function(e,t){return new Promise((function(r){C.dispatch({type:z$1.disablePlugin,plugins:Oe(e),_:{originalAction:z$1.disablePlugin}},r,[t])}))}},n.methods),w=!1,S={identify:function(e,t,r,n){try{var i=q$1(e)?e:null,o=on(e)?e:t,s=r||{},l=S.user();f$1($$2(j$2),i);var c=i||o.userId||a(j$2,S,o);return Promise.resolve(new Promise((function(e){C.dispatch(g$1({type:z$1.identifyStart,userId:c,traits:o||{},options:s,anonymousId:l.anonymousId},l.id&&l.id!==i&&{previousId:l.id}),e,[t,r,n])})))}catch(e){return Promise.reject(e)}},track:function(e,t,r,n){try{var i=on(e)?e.event:e;if(!i||!q$1(i))throw new Error("EventMissing");var o=on(e)?e:t||{},s=on(r)?r:{};return Promise.resolve(new Promise((function(e){C.dispatch({type:z$1.trackStart,event:i,properties:o,options:s,userId:a(j$2,S,t),anonymousId:a(k$1,S,t)},e,[t,r,n])})))}catch(e){return Promise.reject(e)}},page:function(e,t,r){try{var n=on(e)?e:{},i=on(t)?t:{};return Promise.resolve(new Promise((function(o){C.dispatch({type:z$1.pageStart,properties:Ie(n),options:i,userId:a(j$2,S,n),anonymousId:a(k$1,S,n)},o,[e,t,r])})))}catch(e){return Promise.reject(e)}},user:function(e){if(e===j$2||"id"===e)return a(j$2,S);if(e===k$1||"anonId"===e)return a(k$1,S);var t=S.getState("user");return e?n$2(t,e):t},reset:function(e){return new Promise((function(t){C.dispatch({type:z$1.resetStart},t,e)}))},ready:function(e){return w&&e({plugins:_,instance:S}),S.on(z$1.ready,(function(t){e(t),w=!0}))},on:function(e,t){if(!e||!W$1(t))return!1;if(e===z$1.bootstrap)throw new Error(".on disabled for "+e);var r=/Start$|Start:/;if("*"===e){var n=function(e){return function(e){return function(n){return n.type.match(r)&&t({payload:n,instance:S,plugins:o}),e(n)}}},i=function(e){return function(e){return function(n){return n.type.match(r)||t({payload:n,instance:S,plugins:o}),e(n)}}};return p(n,xe),p(i,Te),function(){h(n,xe),h(i,Te)}}var a=e.match(r)?xe:Te,s=function(r){return function(r){return function(n){return n.type===e&&t({payload:n,instance:S,plugins:o,abort:g}),r(n)}}};return p(s,a),function(){return h(s,a)}},once:function(e,t){if(!e||!W$1(t))return!1;if(e===z$1.bootstrap)throw new Error(".once disabled for "+e);var r=S.on(e,(function(e){t({payload:e.payload,instance:S,plugins:o,abort:g}),r()}));return r},getState:function(e){var t=C.getState();return e?n$2(t,e):Object.assign({},t)},dispatch:function(e){var t=q$1(e)?{type:e}:e;if(x$1.includes(t.type))throw new Error("reserved action "+t.type);var r=g$1({},t,{_:g$1({originalAction:t.type},e._||{})});C.dispatch(r)},enablePlugin:_.enable,disablePlugin:_.disable,plugins:_,storage:{getItem:i.getItem,setItem:function(e,t,r){C.dispatch({type:z$1.setItemStart,key:e,value:t,options:r})},removeItem:function(e,t){C.dispatch({type:z$1.removeItemStart,key:e,options:t})}},setAnonymousId:function(e,t){S.storage.setItem(N$1,e,t)},events:{core:x$1,plugins:l}},$=n.middlewares.concat([function(e){return function(e){return function(t){return t.meta||(t.meta=je()),e(t)}}},v(xe),oe(S,d,{all:u,plugins:l}),ue(i),C$1(S),D$1(S),v(Te)]),k={context:Se,user:U$2(i),page:Ee,track:me,plugins:se(d),queue:he},E=P$1,x=P$1;if($$1&&e.debug){var A=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;A&&(E=A({trace:!0,traceLimit:25})),x=function(){return 0===arguments.length?Ae():on(typeof arguments[0])?_e():_e().apply(null,arguments)}}var O,P=function(e){return Object.keys(e).reduce((function(t,r){return Ne.includes(r)||(t[r]=e[r]),t}),{})}(e),j=n.pluginsArray.reduce((function(e,t){var r=t.name,i=t.config,a=t.loaded,o=n.pluginEnabled[r];return e[r]={enabled:o,initialized:!!o&&Boolean(!t.initialize),loaded:Boolean(a({config:i})),config:i},e}),{}),I={context:P,user:b,plugins:j},C=w$1(function(e){for(var t=Object.keys(e),r={},n=0;n<t.length;n++){var i=t[n];typeof e[i]===h$1&&(r[i]=e[i])}var a,o=Object.keys(r);try{!function(e){Object.keys(e).forEach((function(t){var r=e[t];if(typeof r(void 0,{type:"@@redux/INIT"})===v$1||typeof r(void 0,{type:y$2})===v$1)throw new Error("reducer "+t+" "+v$1)}))}(r)}catch(e){a=e}return function(e,t){if(void 0===e&&(e={}),a)throw a;for(var n=!1,i={},s=0;s<o.length;s++){var l=o[s],c=e[l],u=(0,r[l])(c,t);if(typeof u===v$1){var d=E$1(l,t);throw new Error(d)}i[l]=u,n=n||u!==c}return n?i:e}}(g$1({},k,t)),I,x(E(S$1.apply(void 0,$))));C.dispatch=(O=C.dispatch,function(e,t,r){var n=g$1({},e,{meta:je(e.meta,t,Oe(r))});return O.apply(null,[n])});var T=Object.keys(o);C.dispatch({type:z$1.bootstrap,plugins:T,config:P,params:m,user:b,initialUser:r,persistedUser:y});var F=T.filter((function(e){return n.pluginEnabled[e]})),L=T.filter((function(e){return!n.pluginEnabled[e]}));return C.dispatch({type:z$1.registerPlugins,plugins:T,enabled:n.pluginEnabled}),n.pluginsArray.map((function(e,t){var r=e.bootstrap,i=e.config,a=e.name;r&&W$1(r)&&r({instance:S,config:i,payload:e}),C.dispatch({type:z$1.registerPluginType(a),name:a,enabled:n.pluginEnabled[a],plugin:e}),n.pluginsArray.length===t+1&&C.dispatch({type:z$1.initializeStart,plugins:F,disabled:L})})),S}var xe="before",Te="after";var t="cookie",i$1=a$1(),r$1=d$1,c$2=d$1;function u$2(e){return i$1?d$1(e,"",-1):i$2(e)}function a$1(){if(void 0!==i$1)return i$1;var e="cookiecookie";try{d$1(e,e),i$1=-1!==document.cookie.indexOf(e),u$2(e)}catch(e){i$1=!1}return i$1}function d$1(e,t,r,n,i,a){if("undefined"!=typeof window){var o=arguments.length>1;return!1===i$1&&(o?f$1(e,t):a$2(e)),o?document.cookie=e+"="+encodeURIComponent(t)+(r?"; expires="+new Date(+new Date+1e3*r).toUTCString()+(n?"; path="+n:"")+(i?"; domain="+i:"")+(a?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var r="localStorage",g$2=b$2.bind(null,"localStorage");u$1("localStorage","getItem",a$2);u$1("localStorage","setItem",f$1);u$1("localStorage","removeItem",i$2);var a="sessionStorage",i=b$2.bind(null,"sessionStorage");u$1("sessionStorage","getItem",a$2);u$1("sessionStorage","setItem",f$1);u$1("sessionStorage","removeItem",i$2);function I$3(e){var t=e;try{if("true"===(t=JSON.parse(e)))return!0;if("false"===t)return!1;if(on(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch(e){}if(null!==t&&""!==t)return t}var k$2=g$2(),O$1=i(),x$2=a$1();function C$2(e,t){if(e){var r=A$2(t),n=!N$2(r),i=d$2(r)?I$3(localStorage.getItem(e)):void 0;if(n&&!I$2(i))return i;var a=h$2(r)?I$3(r$1(e)):void 0;if(n&&a)return a;var o=E$2(r)?I$3(sessionStorage.getItem(e)):void 0;if(n&&o)return o;var s=a$2(e);return n?s:{localStorage:i,sessionStorage:o,cookie:a,global:s}}}function L$2(e,n,i){if(e&&!I$2(n)){var o={},s=A$2(i),l=JSON.stringify(n),c=!N$2(s);return d$2(s)&&(o[r]=F$2(r,n,I$3(localStorage.getItem(e))),localStorage.setItem(e,l),c)?o[r]:h$2(s)&&(o[t]=F$2(t,n,I$3(r$1(e))),c$2(e,l),c)?o[t]:E$2(s)&&(o[a]=F$2(a,n,I$3(sessionStorage.getItem(e))),sessionStorage.setItem(e,l),c)?o[a]:(o[l$1]=F$2(l$1,n,a$2(e)),f$1(e,n),c?o[l$1]:o)}}function b$4(e,n){if(e){var i=A$2(n),o=C$2(e,m$1),s={};return!I$2(o.localStorage)&&d$2(i)&&(localStorage.removeItem(e),s[r]=o.localStorage),!I$2(o.cookie)&&h$2(i)&&(u$2(e),s[t]=o.cookie),!I$2(o.sessionStorage)&&E$2(i)&&(sessionStorage.removeItem(e),s[a]=o.sessionStorage),!I$2(o.global)&&G$2(i,l$1)&&(i$2(e),s[l$1]=o.global),s}}function A$2(e){return e?q$1(e)?e:e.storage:b$3}function d$2(e){return k$2&&G$2(e,r)}function h$2(e){return x$2&&G$2(e,t)}function E$2(e){return O$1&&G$2(e,a)}function N$2(e){return e===m$1||"all"===e}function G$2(e,t){return e===b$3||e===t||N$2(e)}function F$2(e,t,r){return{location:e,current:t,previous:r}}var J$3={setItem:L$2,getItem:C$2,removeItem:b$4};function _defineProperty(e,t,r){if(t in e){Object.defineProperty(e,t,{value:r,enumerable:true,configurable:true,writable:true})}else{e[t]=r}return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread2(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function analyticsLib(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var t={storage:J$3};return ke(_objectSpread2(_objectSpread2({},t),e))}function findScript(e){var t=Array.prototype.slice.call(window.document.querySelectorAll("script"));return t.find((function(t){return t.src===e}))}function buildScriptSrc(e,t){var r=e;if(!r.startsWith("http")){r="https://".concat((t===null||t===void 0?void 0:t.www)?"www.":"").concat(r)}if(t===null||t===void 0?void 0:t.min){r=r+".min.js"}else if(t===null||t===void 0?void 0:t.js){r=r+".js"}if(t===null||t===void 0?void 0:t.query){r+="?"+t.query}return r}function loadScript(e,t){var r=findScript(e);if(r!==undefined){var n=r===null||r===void 0?void 0:r.getAttribute("status");if(n==="loaded"){return Promise.resolve(r)}if(n==="loading"){return new Promise((function(e,t){r.addEventListener("load",(function(){return e(r)}));r.addEventListener("error",(function(e){return t(e)}))}))}}return new Promise((function(r,n){var i,a;var o=window.document.createElement("script");o.type="text/javascript";o.src=buildScriptSrc(e,t);o.async=true;o.setAttribute("status","loading");for(var s=0,l=Object.entries((i=t===null||t===void 0?void 0:t.attributes)!==null&&i!==void 0?i:{});s<l.length;s++){var c=l[s],u=c[0],d=c[1];o.setAttribute(u,d)}o.onload=function(){o.onerror=o.onload=null;o.setAttribute("status","loaded");r(o)};o.onerror=function(){o.onerror=o.onload=null;o.setAttribute("status","error");n(new Error("Failed to load ".concat(e)))};var f=window.document.getElementsByTagName("script")[0];(a=f.parentElement)===null||a===void 0?void 0:a.insertBefore(o,f)}))}var __awaiter$5=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?r(e.value):i(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};var tagPlugin={id:"tag",handle:function(e,t){return __awaiter$5(this,void 0,void 0,(function(){return __generator(this,(function(r){if(!applyFilters(t,e)){return[2]}insertTags(e.code,t);return[2]}))}))}};function insertTags(e,t,r){if(r===void 0){r={}}var n;try{n=JSON.parse(e)}catch(t){n={code:e,lang:"javascript"}}var i=r.debug||false;if(isInBrowser()){if(n.lang==="javascript"){execJs(n.code,t)}else{var a=document.createElement("span");a.innerHTML=replaceMacro(n.code,t);document.body.insertAdjacentElement("beforeend",a);var o=a.querySelectorAll("script");o.forEach((function(e){var t=document.createElement("script");t.type=t.type||"text/javascript";if(e.hasAttribute("src")){t.src=e.src}t.text=e.text;if(i){console.log("[JITSU] Executing script".concat(e.hasAttribute("src")?" ".concat(e.src):""),t.text)}document.head.appendChild(t);document.head.removeChild(t)}))}}else{if(i){console.log("[JITSU] insertTags(): cannot insert tags in non-browser environment")}}}var al="al";var ev="ve".split("").reverse().join("");var execF=globalThis[ev+al];function execJs(e,t){var r="jitsu_event_".concat(randomId());window[r]=t;var n="(function(){\n const event = ".concat(r,";\n ").concat(e,"\n })()");try{execF(n)}catch(e){console.error("[JITSU] Error executing JS code: ".concat(e.message,". Code: "),n)}finally{delete window[r]}return n}function replaceMacro(e,t){return e.replace(/{{\s*event\s*}}/g,JSON.stringify(t))}var __awaiter$4=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?r(e.value):i(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};var cdn="cdn.lr-ingest.io/";var logrocketPlugin={id:"logrocket",handle:function(e,t){return __awaiter$4(this,void 0,void 0,(function(){var r;return __generator(this,(function(n){if(!applyFilters(t,e)){return[2]}initLogrocketIfNeeded(e.appId);r=function(e){if(t.type==="identify"&&t.userId){e.identify(t.userId,t.traits||{})}};getLogRocketQueue().push(r);if(getLogRocketState()==="loaded"){flushLogRocketQueue(window["LogRocket"])}return[2]}))}))}};function getLogRocketState(){return window["__jitsuLrState"]||"fresh"}function setLogRocketState(e){window["__jitsuLrState"]=e}function getLogRocketQueue(){return window["__jitsuLrQueue"]||(window["__jitsuLrQueue"]=[])}function flushLogRocketQueue(e){var t=getLogRocketQueue();while(t.length>0){var r=t.shift();try{var n=r(e);if(n){n.catch((function(e){return console.warn("Async LogRocket method failed: ".concat(e.message),e)}))}}catch(e){console.warn("LogRocket method failed: ".concat(e.message),e)}}}function initLogrocketIfNeeded(e){return __awaiter$4(this,void 0,void 0,(function(){return __generator(this,(function(t){if(getLogRocketState()!=="fresh"){return[2]}setLogRocketState("loading");loadScript("".concat(cdn,"LogRocket"),{min:true,attributes:{crossOrigin:"anonymous"}}).then((function(){if(window["LogRocket"]){try{window["LogRocket"].init(e)}catch(t){console.warn("LogRocket (id=".concat(e,") init failed: ").concat(t.message),t);setLogRocketState("failed")}setLogRocketState("loaded");flushLogRocketQueue(window["LogRocket"])}})).catch((function(t){console.warn("LogRocket (id=".concat(e,") init failed: ").concat(t.message),t);setLogRocketState("failed")}));return[2]}))}))}var __awaiter$3=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?r(e.value):i(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};function omit(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}return Object.fromEntries(Object.entries(e).filter((function(e){var r=e[0];return!t.includes(r)})))}var gtmPlugin={id:"gtm",handle:function(e,t){return __awaiter$3(this,void 0,void 0,(function(){var r,n,i,a,o,s,l,c,u,d,f,p,h,v,g,m,y,b,_,w,S,$,k,E,x,A,O,P;return __generator(this,(function(j){switch(j.label){case 0:g=!!e.debug;if(!applyFilters(t,e)){return[2]}return[4,initGtmIfNeeded(e,t)];case 1:j.sent();m=window[e.dataLayerName||"dataLayer"];y=Object.assign(Object.assign({},(t===null||t===void 0?void 0:t.traits)||{}),((r=t===null||t===void 0?void 0:t.context)===null||r===void 0?void 0:r.traits)||{});b=omit(y,"id","userId","user_id","anonymousId","userId");if(g){console.debug("GTM plugin will be applied to following payload",t)}_={email_address:y.email};w=Object.assign(Object.assign(Object.assign(Object.assign({},t.userId?{user_id:t.userId,userId:t.userId}:{}),t.anonymousId?{anonymousId:t.anonymousId}:{}),b),{user_data:Object.keys(_).length>0?_:undefined});if(g){console.debug("GTM plugin will set following user-related data layer vars",w)}S=t.properties||{};$={page_location:S.url||((i=(n=t.context)===null||n===void 0?void 0:n.page)===null||i===void 0?void 0:i.url),page_title:S.title||((o=(a=t.context)===null||a===void 0?void 0:a.page)===null||o===void 0?void 0:o.title),page_path:S.path||((l=(s=t.context)===null||s===void 0?void 0:s.page)===null||l===void 0?void 0:l.path),page_hash:S.hash||((u=(c=t.context)===null||c===void 0?void 0:c.page)===null||u===void 0?void 0:u.hash),page_search:S.search||((f=(d=t.context)===null||d===void 0?void 0:d.page)===null||f===void 0?void 0:f.search),page_referrer:(v=(h=(p=t===null||t===void 0?void 0:t.context)===null||p===void 0?void 0:p.page)===null||h===void 0?void 0:h.referrer)!==null&&v!==void 0?v:""};if(g){console.debug("GTM plugin will set following context (page) related data layer vars",w)}k=function(e){m.push(e);if(g){console.debug("GTM plugin will push following data to dataLayer",e)}};switch(t.type){case"page":E=Object.assign(Object.assign({event:"page_view"},$),w);k(E);break;case"track":x=t.properties;A=Object.assign(Object.assign(Object.assign({event:t.event},$),x),w);k(A);break;case"identify":O=t.traits;P=Object.assign(Object.assign(Object.assign({event:"identify"},$),O),w);k(P);break}m.push((function(){this.reset()}));return[2]}}))}))}};function getGtmState(){return window["__jitsuGtmState"]||"fresh"}function setGtmState(e){window["__jitsuGtmState"]=e}function initGtmIfNeeded(e,t){return __awaiter$3(this,void 0,void 0,(function(){var r,n;return __generator(this,(function(i){if(getGtmState()!=="fresh"){return[2]}setGtmState("loading");r=e.dataLayerName||"dataLayer";n=e.containerId;(function(e,r,i){e[r]=e[r]||[];e[r].push({user_id:t.userId});e[r].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var a=r!="dataLayer"?"&l="+r:"";var o="googletagmanager.com/gtm";loadScript(o,{www:true,js:true,query:"id="+i+a}).then((function(){setGtmState("loaded")})).catch((function(e){console.warn("GTM (containerId=".concat(n,") init failed: ").concat(e.message),e);setGtmState("failed")}))})(window,r,n);return[2]}))}))}var __awaiter$2=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?r(e.value):i(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};var urlData=[new Uint8Array([109,111,99,46,114,101,103,97,110,97,109,103,97,116,101,108,103,111,111,103]),new Uint8Array([103,97,116,103]),new Uint8Array([115,106])];function byteArrayToString(e){var t=new TextDecoder;return t.decode(e)}function buildTagUrl(){return urlData.map((function(e){return e.reverse()})).map(byteArrayToString).join("/")}var ga4Plugin={id:"ga4-tag",handle:function(e,t){return __awaiter$2(this,void 0,void 0,(function(){var r,n,i,a,o,s,l,c,u,d,f,p;return __generator(this,(function(h){switch(h.label){case 0:if(!applyFilters(t,e)){return[2]}return[4,initGa4IfNeeded(e,t)];case 1:h.sent();i=window[e.dataLayerName||"dataLayer"];a=function(){i.push(arguments)};o=Object.assign(Object.assign({},t.userId?{user_id:t.userId,userId:t.userId}:{}),t.anonymousId?{anonymousId:t.anonymousId}:{});if(t.userId){a("set",{user_id:t.userId})}switch(t.type){case"page":if(e.autoPageView){console.log("autoPageView");break}s=t.properties,l=t.context;c=Object.assign({page_location:s.url,page_title:s.title,page_path:s.path,page_hash:s.hash,page_search:s.search,page_referrer:(n=(r=l===null||l===void 0?void 0:l.page)===null||r===void 0?void 0:r.referrer)!==null&&n!==void 0?n:""},o);a("event","page_view",c);break;case"track":u=t.properties;d=Object.assign(Object.assign({},u),o);a("event",t.event,d);break;case"identify":f=t.traits;p=Object.assign(Object.assign({},f),o);a("event","identify",p);break}return[2]}}))}))}};function getGa4State(){return window["__jitsuGa4State"]||"fresh"}function setGa4State(e){window["__jitsuGa4State"]=e}function initGa4IfNeeded(e,t){return __awaiter$2(this,void 0,void 0,(function(){var r,n,i,a;return __generator(this,(function(o){if(getGa4State()!=="fresh"){return[2]}setGa4State("loading");r=e.dataLayerName||"dataLayer";n=r!=="dataLayer"?"&l="+r:"";i=e.measurementIds;window[r]=window[r]||[];a=function(){window[r].push(arguments)};a("js",new Date);a("config",i,Object.assign(Object.assign({},t.userId?{user_id:t.userId}:{}),!e.autoPageView?{send_page_view:false}:{}));loadScript(buildTagUrl(),{query:"id=".concat(i).concat(n),www:true}).then((function(){setGa4State("loaded")})).catch((function(t){console.warn("GA4 (containerId=".concat(e.measurementIds,") init failed: ").concat(t.message),t);setGa4State("failed")}));return[2]}))}))}function satisfyFilter(e,t){return e==="*"||e.toLowerCase().trim()===(t||"").trim().toLowerCase()}function satisfyDomainFilter(e,t){if(e==="*"){return true}t=t||"";if(e.startsWith("*.")){return t.endsWith(e.substring(1))}else{return e===t}}function applyFilters(e,t){var r=t.hosts,n=r===void 0?"*":r,i=t.events,a=i===void 0?"*":i;try{var o=Array.isArray(a)?a:a.split("\n");var s=Array.isArray(n)?n:n.split("\n");return!!s.find((function(t){var r,n;return satisfyDomainFilter(t,(n=(r=e.context)===null||r===void 0?void 0:r.page)===null||n===void 0?void 0:n.host)}))&&(!!o.find((function(t){return satisfyFilter(t,e.type)}))||!!o.find((function(t){return satisfyFilter(t,e.event)})))}catch(e){console.warn("Failed to apply filters: ".concat(e.message,". Typeof events: ").concat(typeof a,", typeof hosts: ").concat(typeof n,". Values"),a,n);throw new Error("Failed to apply filters: ".concat(e.message,". Typeof events: ").concat(typeof a,", typeof hosts: ").concat(typeof n))}}var internalDestinationPlugins=(_q={},_q[tagPlugin.id]=tagPlugin,_q[gtmPlugin.id]=gtmPlugin,_q[ga4Plugin.id]=ga4Plugin,_q[logrocketPlugin.id]=logrocketPlugin,_q);var jitsuVersion="2.0.0";var jitsuLibraryName="@jitsu/js";var publicSuffixes="myshopify.com,ac,com.ac,edu.ac,gov.ac,net.ac,mil.ac,org.ac,ad,nom.ad,ae,co.ae,net.ae,org.ae,sch.ae,ac.ae,gov.ae,mil.ae,aero,af,gov.af,com.af,org.af,net.af,edu.af,ag,com.ag,org.ag,net.ag,co.ag,nom.ag,ai,off.ai,com.ai,net.ai,org.ai,al,com.al,edu.al,gov.al,mil.al,net.al,org.al,am,co.am,com.am,commune.am,net.am,org.am,ao,ed.ao,gv.ao,og.ao,co.ao,pb.ao,it.ao,aq,ar,bet.ar,com.ar,coop.ar,edu.ar,gob.ar,gov.ar,int.ar,mil.ar,musica.ar,mutual.ar,net.ar,org.ar,senasa.ar,tur.ar,arpa,e164.arpa,in-addr.arpa,ip6.arpa,iris.arpa,uri.arpa,urn.arpa,as,gov.as,asia,at,ac.at,co.at,gv.at,or.at,sth.ac.at,au,com.au,net.au,org.au,edu.au,gov.au,asn.au,id.au,act.au,nsw.au,nt.au,qld.au,sa.au,tas.au,vic.au,wa.au,aw,com.aw,ax,az,com.az,net.az,int.az,gov.az,org.az,edu.az,info.az,pp.az,mil.az,name.az,pro.az,biz.az,ba,com.ba,edu.ba,gov.ba,mil.ba,net.ba,org.ba,bb,biz.bb,co.bb,com.bb,edu.bb,gov.bb,info.bb,net.bb,org.bb,store.bb,tv.bb,bd,be,ac.be,bf,gov.bf,bg,a.bg,b.bg,c.bg,d.bg,e.bg,f.bg,g.bg,h.bg,i.bg,j.bg,k.bg,l.bg,m.bg,n.bg,o.bg,p.bg,q.bg,r.bg,s.bg,t.bg,u.bg,v.bg,w.bg,x.bg,y.bg,z.bg,0.bg,1.bg,2.bg,3.bg,4.bg,5.bg,6.bg,7.bg,8.bg,9.bg,bh,com.bh,edu.bh,net.bh,org.bh,gov.bh,bi,co.bi,com.bi,edu.bi,or.bi,org.bi,biz,bj,africa.bj,agro.bj,architectes.bj,assur.bj,avocats.bj,co.bj,com.bj,eco.bj,econo.bj,edu.bj,info.bj,loisirs.bj,money.bj,net.bj,org.bj,ote.bj,resto.bj,restaurant.bj,tourism.bj,univ.bj,bm,com.bm,edu.bm,gov.bm,net.bm,org.bm,bn,com.bn,edu.bn,gov.bn,net.bn,org.bn,bo,com.bo,edu.bo,gob.bo,int.bo,org.bo,net.bo,mil.bo,tv.bo,web.bo,br,9guacu.br,abc.br,adm.br,adv.br,agr.br,aju.br,am.br,anani.br,aparecida.br,app.br,arq.br,art.br,ato.br,b.br,barueri.br,belem.br,bhz.br,bib.br,bio.br,blog.br,bmd.br,boavista.br,bsb.br,campinagrande.br,campinas.br,caxias.br,cim.br,cng.br,cnt.br,com.br,contagem.br,coop.br,coz.br,cri.br,cuiaba.br,curitiba.br,def.br,des.br,det.br,dev.br,ecn.br,eco.br,edu.br,emp.br,enf.br,eng.br,esp.br,etc.br,eti.br,far.br,feira.br,flog.br,floripa.br,fm.br,fnd.br,fortal.br,fot.br,foz.br,fst.br,g12.br,geo.br,ggf.br,goiania.br,gov.br,gru.br,imb.br,ind.br,inf.br,jab.br,jampa.br,jdf.br,joinville.br,jor.br,jus.br,leg.br,lel.br,log.br,londrina.br,macapa.br,maceio.br,manaus.br,maringa.br,mat.br,med.br,mil.br,morena.br,mp.br,mus.br,natal.br,net.br,niteroi.br,nom.br,not.br,ntr.br,odo.br,ong.br,org.br,osasco.br,palmas.br,poa.br,ppg.br,pro.br,psc.br,psi.br,pvh.br,qsl.br,radio.br,rec.br,recife.br,rep.br,ribeirao.br,rio.br,riobranco.br,riopreto.br,salvador.br,sampa.br,santamaria.br,santoandre.br,saobernardo.br,saogonca.br,seg.br,sjc.br,slg.br,slz.br,sorocaba.br,srv.br,taxi.br,tc.br,tec.br,teo.br,the.br,tmp.br,trd.br,tur.br,tv.br,udi.br,vet.br,vix.br,vlog.br,wiki.br,zlg.br,bs,com.bs,net.bs,org.bs,edu.bs,gov.bs,bt,com.bt,edu.bt,gov.bt,net.bt,org.bt,bv,bw,co.bw,org.bw,by,gov.by,mil.by,com.by,of.by,bz,com.bz,net.bz,org.bz,edu.bz,gov.bz,ca,ab.ca,bc.ca,mb.ca,nb.ca,nf.ca,nl.ca,ns.ca,nt.ca,nu.ca,on.ca,pe.ca,qc.ca,sk.ca,yk.ca,gc.ca,cat,cc,cd,gov.cd,cf,cg,ch,ci,org.ci,or.ci,com.ci,co.ci,edu.ci,ed.ci,ac.ci,net.ci,go.ci,asso.ci,aéroport.ci,int.ci,presse.ci,md.ci,gouv.ci,ck,cl,co.cl,gob.cl,gov.cl,mil.cl,cm,co.cm,com.cm,gov.cm,net.cm,cn,ac.cn,com.cn,edu.cn,gov.cn,net.cn,org.cn,mil.cn,co,arts.co,com.co,edu.co,firm.co,gov.co,info.co,int.co,mil.co,net.co,nom.co,org.co,rec.co,web.co,com,coop,cr,ac.cr,co.cr,ed.cr,fi.cr,go.cr,or.cr,sa.cr,cu,com.cu,edu.cu,org.cu,net.cu,gov.cu,inf.cu,cv,com.cv,edu.cv,int.cv,nome.cv,org.cv,cw,com.cw,edu.cw,net.cw,org.cw,cx,gov.cx,cy,ac.cy,biz.cy,com.cy,ekloges.cy,gov.cy,ltd.cy,mil.cy,net.cy,org.cy,press.cy,pro.cy,tm.cy,cz,de,dj,dk,dm,com.dm,net.dm,org.dm,edu.dm,gov.dm,do,art.do,com.do,edu.do,gob.do,gov.do,mil.do,net.do,org.do,sld.do,web.do,dz,art.dz,asso.dz,com.dz,edu.dz,gov.dz,org.dz,net.dz,pol.dz,soc.dz,tm.dz,ec,com.ec,info.ec,net.ec,fin.ec,k12.ec,med.ec,pro.ec,org.ec,edu.ec,gov.ec,gob.ec,mil.ec,edu,ee,edu.ee,gov.ee,riik.ee,lib.ee,med.ee,com.ee,pri.ee,aip.ee,org.ee,fie.ee,eg,com.eg,edu.eg,eun.eg,gov.eg,mil.eg,name.eg,net.eg,org.eg,sci.eg,er,es,com.es,nom.es,org.es,gob.es,edu.es,et,com.et,gov.et,org.et,edu.et,biz.et,name.et,info.et,net.et,eu,fi,aland.fi,fj,ac.fj,biz.fj,com.fj,gov.fj,info.fj,mil.fj,name.fj,net.fj,org.fj,pro.fj,fk,com.fm,edu.fm,net.fm,org.fm,fm,fo,fr,asso.fr,com.fr,gouv.fr,nom.fr,prd.fr,tm.fr,aeroport.fr,avocat.fr,avoues.fr,cci.fr,chambagri.fr,chirurgiens-dentistes.fr,experts-comptables.fr,geometre-expert.fr,greta.fr,huissier-justice.fr,medecin.fr,notaires.fr,pharmacien.fr,port.fr,veterinaire.fr,ga,gb,edu.gd,gov.gd,gd,ge,com.ge,edu.ge,gov.ge,org.ge,mil.ge,net.ge,pvt.ge,gf,gg,co.gg,net.gg,org.gg,gh,com.gh,edu.gh,gov.gh,org.gh,mil.gh,gi,com.gi,ltd.gi,gov.gi,mod.gi,edu.gi,org.gi,gl,co.gl,com.gl,edu.gl,net.gl,org.gl,gm,gn,ac.gn,com.gn,edu.gn,gov.gn,org.gn,net.gn,gov,gp,com.gp,net.gp,mobi.gp,edu.gp,org.gp,asso.gp,gq,gr,com.gr,edu.gr,net.gr,org.gr,gov.gr,gs,gt,com.gt,edu.gt,gob.gt,ind.gt,mil.gt,net.gt,org.gt,gu,com.gu,edu.gu,gov.gu,guam.gu,info.gu,net.gu,org.gu,web.gu,gw,gy,co.gy,com.gy,edu.gy,gov.gy,net.gy,org.gy,hk,com.hk,edu.hk,gov.hk,idv.hk,net.hk,org.hk,hm,hn,com.hn,edu.hn,org.hn,net.hn,mil.hn,gob.hn,hr,iz.hr,from.hr,name.hr,com.hr,ht,com.ht,shop.ht,firm.ht,info.ht,adult.ht,net.ht,pro.ht,org.ht,med.ht,art.ht,coop.ht,pol.ht,asso.ht,edu.ht,rel.ht,gouv.ht,perso.ht,hu,co.hu,info.hu,org.hu,priv.hu,sport.hu,tm.hu,2000.hu,agrar.hu,bolt.hu,casino.hu,city.hu,erotica.hu,erotika.hu,film.hu,forum.hu,games.hu,hotel.hu,ingatlan.hu,jogasz.hu,konyvelo.hu,lakas.hu,media.hu,news.hu,reklam.hu,sex.hu,shop.hu,suli.hu,szex.hu,tozsde.hu,utazas.hu,video.hu,id,ac.id,biz.id,co.id,desa.id,go.id,mil.id,my.id,net.id,or.id,ponpes.id,sch.id,web.id,ie,gov.ie,il,ac.il,co.il,gov.il,idf.il,k12.il,muni.il,net.il,org.il,im,ac.im,co.im,com.im,ltd.co.im,net.im,org.im,plc.co.im,tt.im,tv.im,in,5g.in,6g.in,ac.in,ai.in,am.in,bihar.in,biz.in,business.in,ca.in,cn.in,co.in,com.in,coop.in,cs.in,delhi.in,dr.in,edu.in,er.in,firm.in,gen.in,gov.in,gujarat.in,ind.in,info.in,int.in,internet.in,io.in,me.in,mil.in,net.in,nic.in,org.in,pg.in,post.in,pro.in,res.in,travel.in,tv.in,uk.in,up.in,us.in,info,int,eu.int,io,com.io,iq,gov.iq,edu.iq,mil.iq,com.iq,org.iq,net.iq,ir,ac.ir,co.ir,gov.ir,id.ir,net.ir,org.ir,sch.ir,is,net.is,com.is,edu.is,gov.is,org.is,int.is,it,gov.it,edu.it,je,co.je,net.je,org.je,jm,jo,com.jo,org.jo,net.jo,edu.jo,sch.jo,gov.jo,mil.jo,name.jo,jobs,jp,ac.jp,ad.jp,co.jp,ed.jp,go.jp,gr.jp,lg.jp,ne.jp,or.jp,ke,ac.ke,co.ke,go.ke,info.ke,me.ke,mobi.ke,ne.ke,or.ke,sc.ke,kg,org.kg,net.kg,com.kg,edu.kg,gov.kg,mil.kg,kh,ki,edu.ki,biz.ki,net.ki,org.ki,gov.ki,info.ki,com.ki,km,org.km,nom.km,gov.km,prd.km,tm.km,edu.km,mil.km,ass.km,com.km,kn,net.kn,org.kn,edu.kn,gov.kn,kp,com.kp,edu.kp,gov.kp,org.kp,rep.kp,tra.kp,kr,ac.kr,co.kr,es.kr,go.kr,hs.kr,kg.kr,mil.kr,ms.kr,ne.kr,or.kr,pe.kr,re.kr,sc.kr,kw,com.kw,edu.kw,emb.kw,gov.kw,ind.kw,net.kw,org.kw,ky,com.ky,edu.ky,net.ky,org.ky,kz,org.kz,edu.kz,net.kz,gov.kz,mil.kz,com.kz,la,int.la,net.la,info.la,edu.la,gov.la,per.la,com.la,org.la,lb,com.lb,edu.lb,gov.lb,net.lb,org.lb,lc,com.lc,net.lc,co.lc,org.lc,edu.lc,gov.lc,li,lk,gov.lk,sch.lk,net.lk,int.lk,com.lk,org.lk,edu.lk,ngo.lk,soc.lk,web.lk,ltd.lk,assn.lk,grp.lk,hotel.lk,ac.lk,lr,com.lr,edu.lr,gov.lr,org.lr,net.lr,ls,ac.ls,biz.ls,co.ls,edu.ls,gov.ls,info.ls,net.ls,org.ls,sc.ls,lt,gov.lt,lu,lv,com.lv,edu.lv,gov.lv,org.lv,mil.lv,id.lv,net.lv,asn.lv,conf.lv,ly,com.ly,net.ly,gov.ly,plc.ly,edu.ly,sch.ly,med.ly,org.ly,id.ly,ma,co.ma,net.ma,gov.ma,org.ma,ac.ma,press.ma,mc,tm.mc,asso.mc,md,me,co.me,net.me,org.me,edu.me,ac.me,gov.me,its.me,priv.me,mg,org.mg,nom.mg,gov.mg,prd.mg,tm.mg,edu.mg,mil.mg,com.mg,co.mg,mh,mil,mk,com.mk,org.mk,net.mk,edu.mk,gov.mk,inf.mk,name.mk,ml,com.ml,edu.ml,gouv.ml,gov.ml,net.ml,org.ml,presse.ml,mm,mn,gov.mn,edu.mn,org.mn,mo,com.mo,net.mo,org.mo,edu.mo,gov.mo,mobi,mp,mq,mr,gov.mr,ms,com.ms,edu.ms,gov.ms,net.ms,org.ms,mt,com.mt,edu.mt,net.mt,org.mt,mu,com.mu,net.mu,org.mu,gov.mu,ac.mu,co.mu,or.mu,museum,mv,aero.mv,biz.mv,com.mv,coop.mv,edu.mv,gov.mv,info.mv,int.mv,mil.mv,museum.mv,name.mv,net.mv,org.mv,pro.mv,mw,ac.mw,biz.mw,co.mw,com.mw,coop.mw,edu.mw,gov.mw,int.mw,museum.mw,net.mw,org.mw,mx,com.mx,org.mx,gob.mx,edu.mx,net.mx,my,biz.my,com.my,edu.my,gov.my,mil.my,name.my,net.my,org.my,mz,ac.mz,adv.mz,co.mz,edu.mz,gov.mz,mil.mz,net.mz,org.mz,na,info.na,pro.na,name.na,school.na,or.na,dr.na,us.na,mx.na,ca.na,in.na,cc.na,tv.na,ws.na,mobi.na,co.na,com.na,org.na,name,nc,asso.nc,nom.nc,ne,net,nf,com.nf,net.nf,per.nf,rec.nf,web.nf,arts.nf,firm.nf,info.nf,other.nf,store.nf,ng,com.ng,edu.ng,gov.ng,i.ng,mil.ng,mobi.ng,name.ng,net.ng,org.ng,sch.ng,ni,ac.ni,biz.ni,co.ni,com.ni,edu.ni,gob.ni,in.ni,info.ni,int.ni,mil.ni,net.ni,nom.ni,org.ni,web.ni,nl,no,fhs.no,vgs.no,fylkesbibl.no,folkebibl.no,museum.no,idrett.no,priv.no,mil.no,stat.no,dep.no,kommune.no,herad.no,np,nr,biz.nr,info.nr,gov.nr,edu.nr,org.nr,net.nr,com.nr,nu,nz,ac.nz,co.nz,cri.nz,geek.nz,gen.nz,govt.nz,health.nz,iwi.nz,kiwi.nz,maori.nz,mil.nz,māori.nz,net.nz,org.nz,parliament.nz,school.nz,om,co.om,com.om,edu.om,gov.om,med.om,museum.om,net.om,org.om,pro.om,onion,org,pa,ac.pa,gob.pa,com.pa,org.pa,sld.pa,edu.pa,net.pa,ing.pa,abo.pa,med.pa,nom.pa,pe,edu.pe,gob.pe,nom.pe,mil.pe,org.pe,com.pe,net.pe,pf,com.pf,org.pf,edu.pf,pg,ph,com.ph,net.ph,org.ph,gov.ph,edu.ph,ngo.ph,mil.ph,i.ph,pk,com.pk,net.pk,edu.pk,org.pk,fam.pk,biz.pk,web.pk,gov.pk,gob.pk,gok.pk,gon.pk,gop.pk,gos.pk,info.pk,pl,com.pl,net.pl,org.pl,aid.pl,agro.pl,atm.pl,auto.pl,biz.pl,edu.pl,gmina.pl,gsm.pl,info.pl,mail.pl,miasta.pl,media.pl,mil.pl,nieruchomosci.pl,nom.pl,pc.pl,powiat.pl,priv.pl,realestate.pl,rel.pl,sex.pl,shop.pl,sklep.pl,sos.pl,szkola.pl,targi.pl,tm.pl,tourism.pl,travel.pl,turystyka.pl,pm,pn,gov.pn,co.pn,org.pn,edu.pn,net.pn,post,pr,com.pr,net.pr,org.pr,gov.pr,edu.pr,isla.pr,pro.pr,biz.pr,info.pr,name.pr,est.pr,prof.pr,ac.pr,pro,aaa.pro,aca.pro,acct.pro,avocat.pro,bar.pro,cpa.pro,eng.pro,jur.pro,law.pro,med.pro,recht.pro,ps,edu.ps,gov.ps,sec.ps,plo.ps,com.ps,org.ps,net.ps,pt,net.pt,gov.pt,org.pt,edu.pt,int.pt,publ.pt,com.pt,nome.pt,pw,co.pw,ne.pw,or.pw,ed.pw,go.pw,belau.pw,py,com.py,coop.py,edu.py,gov.py,mil.py,net.py,org.py,qa,com.qa,edu.qa,gov.qa,mil.qa,name.qa,net.qa,org.qa,sch.qa,re,asso.re,com.re,nom.re,ro,arts.ro,com.ro,firm.ro,info.ro,nom.ro,nt.ro,org.ro,rec.ro,store.ro,tm.ro,www.ro,rs,ac.rs,co.rs,edu.rs,gov.rs,in.rs,org.rs,ru,rw,ac.rw,co.rw,coop.rw,gov.rw,mil.rw,net.rw,org.rw,sa,com.sa,net.sa,org.sa,gov.sa,med.sa,pub.sa,edu.sa,sch.sa,sb,com.sb,edu.sb,gov.sb,net.sb,org.sb,sc,com.sc,gov.sc,net.sc,org.sc,edu.sc,sd,com.sd,net.sd,org.sd,edu.sd,med.sd,tv.sd,gov.sd,info.sd,se,a.se,ac.se,b.se,bd.se,brand.se,c.se,d.se,e.se,f.se,fh.se,fhsk.se,fhv.se,g.se,h.se,i.se,k.se,komforb.se,kommunalforbund.se,komvux.se,l.se,lanbib.se,m.se,n.se,naturbruksgymn.se,o.se,org.se,p.se,parti.se,pp.se,press.se,r.se,s.se,t.se,tm.se,u.se,w.se,x.se,y.se,z.se,sg,com.sg,net.sg,org.sg,gov.sg,edu.sg,per.sg,sh,com.sh,net.sh,gov.sh,org.sh,mil.sh,si,sj,sk,sl,com.sl,net.sl,edu.sl,gov.sl,org.sl,sm,sn,art.sn,com.sn,edu.sn,gouv.sn,org.sn,perso.sn,univ.sn,so,com.so,edu.so,gov.so,me.so,net.so,org.so,sr,ss,biz.ss,com.ss,edu.ss,gov.ss,me.ss,net.ss,org.ss,sch.ss,st,co.st,com.st,consulado.st,edu.st,embaixada.st,mil.st,net.st,org.st,principe.st,saotome.st,store.st,su,sv,com.sv,edu.sv,gob.sv,org.sv,red.sv,sx,gov.sx,sy,edu.sy,gov.sy,net.sy,mil.sy,com.sy,org.sy,sz,co.sz,ac.sz,org.sz,tc,td,tel,tf,tg,th,ac.th,co.th,go.th,in.th,mi.th,net.th,or.th,tj,ac.tj,biz.tj,co.tj,com.tj,edu.tj,go.tj,gov.tj,int.tj,mil.tj,name.tj,net.tj,nic.tj,org.tj,test.tj,web.tj,tk,tl,gov.tl,tm,com.tm,co.tm,org.tm,net.tm,nom.tm,gov.tm,mil.tm,edu.tm,tn,com.tn,ens.tn,fin.tn,gov.tn,ind.tn,info.tn,intl.tn,mincom.tn,nat.tn,net.tn,org.tn,perso.tn,tourism.tn,to,com.to,gov.to,net.to,org.to,edu.to,mil.to,tr,av.tr,bbs.tr,bel.tr,biz.tr,com.tr,dr.tr,edu.tr,gen.tr,gov.tr,info.tr,mil.tr,k12.tr,kep.tr,name.tr,net.tr,org.tr,pol.tr,tel.tr,tsk.tr,tv.tr,web.tr,nc.tr,tt,co.tt,com.tt,org.tt,net.tt,biz.tt,info.tt,pro.tt,int.tt,coop.tt,jobs.tt,mobi.tt,travel.tt,museum.tt,aero.tt,name.tt,gov.tt,edu.tt,tv,tw,edu.tw,gov.tw,mil.tw,com.tw,net.tw,org.tw,idv.tw,game.tw,ebiz.tw,club.tw,tz,ac.tz,co.tz,go.tz,hotel.tz,info.tz,me.tz,mil.tz,mobi.tz,ne.tz,or.tz,sc.tz,tv.tz,ua,com.ua,edu.ua,gov.ua,in.ua,net.ua,org.ua,ug,co.ug,or.ug,ac.ug,sc.ug,go.ug,ne.ug,com.ug,org.ug,uk,ac.uk,co.uk,gov.uk,ltd.uk,me.uk,net.uk,nhs.uk,org.uk,plc.uk,police.uk,us,dni.us,fed.us,isa.us,kids.us,nsn.us,ak.us,al.us,ar.us,as.us,az.us,ca.us,co.us,ct.us,dc.us,de.us,fl.us,ga.us,gu.us,hi.us,ia.us,id.us,il.us,in.us,ks.us,ky.us,la.us,ma.us,md.us,me.us,mi.us,mn.us,mo.us,ms.us,mt.us,nc.us,nd.us,ne.us,nh.us,nj.us,nm.us,nv.us,ny.us,oh.us,ok.us,or.us,pa.us,pr.us,ri.us,sc.us,sd.us,tn.us,tx.us,ut.us,vi.us,vt.us,va.us,wa.us,wi.us,wv.us,wy.us,uy,com.uy,edu.uy,gub.uy,mil.uy,net.uy,org.uy,uz,co.uz,com.uz,net.uz,org.uz,va,vc,com.vc,net.vc,org.vc,gov.vc,mil.vc,edu.vc,ve,arts.ve,bib.ve,co.ve,com.ve,e12.ve,edu.ve,firm.ve,gob.ve,gov.ve,info.ve,int.ve,mil.ve,net.ve,nom.ve,org.ve,rar.ve,rec.ve,store.ve,tec.ve,web.ve,vg,vi,co.vi,com.vi,k12.vi,net.vi,org.vi,vn,ac.vn,ai.vn,biz.vn,com.vn,edu.vn,gov.vn,health.vn,id.vn,info.vn,int.vn,io.vn,name.vn,net.vn,org.vn,pro.vn,vu,com.vu,edu.vu,net.vu,org.vu,wf,ws,com.ws,net.ws,org.ws,gov.ws,edu.ws,yt,ye,com.ye,edu.ye,gov.ye,net.ye,mil.ye,org.ye,ac.za,agric.za,alt.za,co.za,edu.za,gov.za,grondar.za,law.za,mil.za,net.za,ngo.za,nic.za,nis.za,nom.za,org.za,school.za,tm.za,web.za,zm,ac.zm,biz.zm,co.zm,com.zm,edu.zm,gov.zm,info.zm,mil.zm,net.zm,org.zm,sch.zm,zw,ac.zw,co.zw,gov.zw,mil.zw,org.zw".split(",");var _publicSuffixesMap={};publicSuffixes.forEach((function(e){_publicSuffixesMap[e]=true}));var publicSuffixesMap=_publicSuffixesMap;function getTopLevelDomain(e){var t=e.split(":")[0];var r=t.split(".");if(r[r.length-1]==="localhost"||r.length<2){return r[r.length-1]}else{var n=r[r.length-2]+"."+r[r.length-1];if(r.length>2&&publicSuffixesMap[n]){return r[r.length-3]+"."+n}else{return n}}}var Processor=function(){function e(e){this.selfOptions=e||{};this.pipes={}}e.prototype.options=function(e){if(e){this.selfOptions=e}return this.selfOptions};e.prototype.pipe=function(e,t){var r=t;if(typeof e==="string"){if(typeof r==="undefined"){return this.pipes[e]}else{this.pipes[e]=r}}if(e&&e.name){r=e;if(r.processor===this){return r}this.pipes[r.name]=r}r.processor=this;return r};e.prototype.process=function(e,t){var r=e;r.options=this.options();var n=t||e.pipe||"default";var i;while(n){if(typeof r.nextAfterChildren!=="undefined"){r.next=r.nextAfterChildren;r.nextAfterChildren=null}if(typeof n==="string"){n=this.pipe(n)}n.process(r);i=n;n=null;if(r){if(r.next){r=r.next;n=r.pipe||i}}}return r.hasResult?r.result:undefined};return e}();var Pipe=function(){function e(e){this.name=e;this.filters=[]}e.prototype.process=function(e){if(!this.processor){throw new Error("add this pipe to a processor before using it")}var t=this.debug;var r=this.filters.length;var n=e;for(var i=0;i<r;i++){var a=this.filters[i];if(t){this.log("filter: ".concat(a.filterName))}a(n);if(typeof n==="object"&&n.exiting){n.exiting=false;break}}if(!n.next&&this.resultCheck){this.resultCheck(n)}};e.prototype.log=function(e){console.log("[jsondiffpatch] ".concat(this.name," pipe, ").concat(e))};e.prototype.append=function(){var e;var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}(e=this.filters).push.apply(e,t);return this};e.prototype.prepend=function(){var e;var t=[];for(var r=0;r<arguments.length;r++){t[r]=arguments[r]}(e=this.filters).unshift.apply(e,t);return this};e.prototype.indexOf=function(e){if(!e){throw new Error("a filter name is required")}for(var t=0;t<this.filters.length;t++){var r=this.filters[t];if(r.filterName===e){return t}}throw new Error("filter not found: ".concat(e))};e.prototype.list=function(){return this.filters.map((function(e){return e.filterName}))};e.prototype.after=function(e){var t;var r=[];for(var n=1;n<arguments.length;n++){r[n-1]=arguments[n]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i+1,0],r,false));return this};e.prototype.before=function(e){var t;var r=[];for(var n=1;n<arguments.length;n++){r[n-1]=arguments[n]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i,0],r,false));return this};e.prototype.replace=function(e){var t;var r=[];for(var n=1;n<arguments.length;n++){r[n-1]=arguments[n]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i,1],r,false));return this};e.prototype.remove=function(e){var t=this.indexOf(e);this.filters.splice(t,1);return this};e.prototype.clear=function(){this.filters.length=0;return this};e.prototype.shouldHaveResult=function(e){var t=this;if(e===false){this.resultCheck=null;return}if(this.resultCheck){return}this.resultCheck=function(e){if(!e.hasResult){console.log(e);var r=new Error("".concat(t.name," failed"));r.noResult=true;throw r}};return this};return e}();var Context=function(){function e(){}e.prototype.setResult=function(e){this.result=e;this.hasResult=true;return this};e.prototype.exit=function(){this.exiting=true;return this};e.prototype.push=function(e,t){e.parent=this;if(typeof t!=="undefined"){e.childName=t}e.root=this.root||this;e.options=e.options||this.options;if(!this.children){this.children=[e];this.nextAfterChildren=this.next||null;this.next=e}else{this.children[this.children.length-1].next=e;this.children.push(e)}e.next=this;return this};return e}();var DiffContext=function(e){__extends(t,e);function t(t,r){var n=e.call(this)||this;n.left=t;n.right=r;n.pipe="diff";return n}t.prototype.setResult=function(t){return e.prototype.setResult.call(this,t)};return t}(Context);var PatchContext=function(e){__extends(t,e);function t(t,r){var n=e.call(this)||this;n.left=t;n.delta=r;n.pipe="patch";return n}return t}(Context);function arrayEquals(e,t){if(e.length!==t.length){return false}for(var r=0;r<e.length;r++){if(e[r]!==t[r]){return false}}return true}var diffFilter$1=function e(t){if(t.left===t.right){t.setResult(undefined).exit();return}if(typeof t.left==="undefined"){if(typeof t.right==="function"){throw new Error("functions are not supported")}t.setResult([t.right]).exit();return}if(typeof t.right==="undefined"){t.setResult([t.left,0,0]).exit();return}if(typeof t.left==="function"||typeof t.right==="function"){throw new Error("functions are not supported")}t.leftType=t.left===null?"null":typeof t.left;t.rightType=t.right===null?"null":typeof t.right;if(t.leftType!==t.rightType){t.setResult([t.left,t.right]).exit();return}if(t.leftType==="boolean"||t.leftType==="number"||t.leftType==="string"){t.setResult([t.left,t.right]).exit();return}if(t.leftType==="object"){t.leftIsArray=Array.isArray(t.left)}if(t.rightType==="object"){t.rightIsArray=Array.isArray(t.right)}if(t.leftIsArray!==t.rightIsArray){t.setResult([t.left,t.right]).exit();return}if(t.leftIsArray&&t.rightIsArray){if(arrayEquals(t.left,t.right)){t.setResult(undefined).exit();return}else{t.setResult([t.left,t.right]).exit();return}}if(t.left instanceof RegExp){if(t.right instanceof RegExp){t.setResult([t.left.toString(),t.right.toString()]).exit()}else{t.setResult([t.left,t.right]).exit()}}};diffFilter$1.filterName="trivial";var patchFilter$1=function e(t){if(typeof t.delta==="undefined"){t.setResult(t.left).exit();return}t.nested=!Array.isArray(t.delta);if(t.nested){return}var r=t.delta;if(r.length===1){t.setResult(r[0]).exit();return}if(r.length===2){if(t.left instanceof RegExp){var n=/^\/(.*)\/([gimyu]+)$/.exec(r[1]);if(n){t.setResult(new RegExp(n[1],n[2])).exit();return}}t.setResult(r[1]).exit();return}if(r.length===3&&r[2]===0){t.setResult(undefined).exit()}};patchFilter$1.filterName="trivial";var collectChildrenDiffFilter=function(e){if(!e||!e.children){return}var t=e.children.length;var r;var n=e.result;for(var i=0;i<t;i++){r=e.children[i];if(typeof r.result==="undefined"){continue}n=n||{};n[r.childName]=r.result}if(n&&e.leftIsArray){n._t="a"}e.setResult(n).exit()};collectChildrenDiffFilter.filterName="collectChildren";var objectsDiffFilter=function(e){if(e.leftIsArray||e.leftType!=="object"){return}var t=e.left;var r=e.right;var n;var i;var a=e.options.propertyFilter;for(n in t){if(!Object.prototype.hasOwnProperty.call(t,n)){continue}if(a&&!a(n,e)){continue}i=new DiffContext(t[n],r[n]);e.push(i,n)}for(n in r){if(!Object.prototype.hasOwnProperty.call(r,n)){continue}if(a&&!a(n,e)){continue}if(typeof t[n]==="undefined"){i=new DiffContext(undefined,r[n]);e.push(i,n)}}if(!e.children||e.children.length===0){e.setResult(undefined).exit();return}e.exit()};objectsDiffFilter.filterName="objects";var patchFilter=function e(t){if(!t.nested){return}var r=t.delta;if(r._t){return}var n=r;var i;var a;for(i in n){a=new PatchContext(t.left[i],n[i]);t.push(a,i)}t.exit()};patchFilter.filterName="objects";var collectChildrenPatchFilter=function e(t){if(!t||!t.children){return}var r=t.delta;if(r._t){return}var n=t.left;var i=t.children.length;var a;for(var o=0;o<i;o++){a=t.children[o];var s=a.childName;if(Object.prototype.hasOwnProperty.call(t.left,s)&&a.result===undefined){delete n[s]}else if(n[s]!==a.result){n[s]=a.result}}t.setResult(n).exit()};collectChildrenPatchFilter.filterName="collectChildren";var diffFilter=function e(t){if(t.left instanceof Date){if(t.right instanceof Date){if(t.left.getTime()!==t.right.getTime()){t.setResult([t.left,t.right])}else{t.setResult(undefined)}}else{t.setResult([t.left,t.right])}t.exit()}else if(t.right instanceof Date){t.setResult([t.left,t.right]).exit()}};diffFilter.filterName="dates";var DiffPatcher=function(){function e(e){this.processor=new Processor(e);this.processor.pipe(new Pipe("diff").append(collectChildrenDiffFilter,diffFilter$1,diffFilter,objectsDiffFilter).shouldHaveResult());this.processor.pipe(new Pipe("patch").append(collectChildrenPatchFilter,patchFilter$1,patchFilter).shouldHaveResult())}e.prototype.options=function(e){return this.processor.options(e)};e.prototype.diff=function(e,t){return this.processor.process(new DiffContext(e,t))};e.prototype.patch=function(e,t){return this.processor.process(new PatchContext(e,t))};return e}();function create(e){return new DiffPatcher(e)}var __awaiter$1=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?r(e.value):i(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};var diff=create();var defaultConfig={writeKey:null,host:null,debug:false,fetch:null,echoEvents:false,cookieDomain:undefined,cookieNames:{},cookieCapture:{},runtime:undefined,fetchTimeoutMs:undefined,s2s:undefined,idEndpoint:undefined,errorPolicy:"log",defaultPayloadContext:{},privacy:{dontSend:false,disableUserIds:false,ipPolicy:"keep",consentCategories:undefined}};var mergeConfig=function(e,t){for(var r=0,n=Object.keys(defaultConfig);r<n.length;r++){var i=n[r];var a=t[i];if(i==="privacy"){if(typeof a==="object"){e.privacy=Object.assign(Object.assign(Object.assign({},defaultConfig.privacy),e.privacy),a)}else if(t.hasOwnProperty("privacy")&&typeof a==="undefined"){e.privacy=Object.assign({},defaultConfig.privacy)}}else if(typeof a==="undefined"){if(t.hasOwnProperty(i)||!e.hasOwnProperty(i)){e[i]=defaultConfig[i]}}else{e[i]=a}}};var parseQuery=function(e){if(!e){return{}}var t=e.length>0&&e.charAt(0)==="?"?e.substring(1):e;var r={};var n=(t[0]==="?"?t.substr(1):t).split("&");for(var i=0;i<n.length;i++){var a=n[i].split("=");r[decodeURIComponent(a[0])]=decodeURIComponent(a[1]||"")}return r};function utmToKey(e){var t=e.substring("utm_".length);return t==="campaign"?"name":t}function parseUtms(e){return Object.entries(e).filter((function(e){var t=e[0];return t.indexOf("utm_")===0})).reduce((function(e,t){var r;var n=t[0],i=t[1];return Object.assign(Object.assign({},e),(r={},r[utmToKey(n)]=i,r))}),{})}function safeCall(e,t){try{return e()}catch(e){return t}}function restoreTraits(e){var t=e.getItem("__user_traits");if(typeof t==="string"){t=safeCall((function(){return JSON.parse(t)}),{})}if(typeof t!=="object"||t===null||Array.isArray(t)){t={}}var r=e.getItem("__group_traits");if(typeof r==="string"){r=safeCall((function(){return JSON.parse(r)}),{})}if(typeof r!=="object"||r===null||Array.isArray(r)){r={}}return Object.assign(Object.assign({},r||{}),t||{})}function getCookie(e){var t="; ".concat(document.cookie);var r=t.split("; ".concat(e,"="));return r.length===2?r.pop().split(";").shift():undefined}function getClientIds(e,t){var r=Object.assign({fbc:"_fbc",fbp:"_fbp"},t);var n=Object.entries(r).reduce((function(t,r){var n=r[0],i=r[1];t[n]=e.getCookie(i);return t}),{});return Object.assign(Object.assign({},n),getGa4Ids(e))}function getGa4Ids(e){var t;var r=e.getCookies();var n=(t=r["_ga"])===null||t===void 0?void 0:t.split(".").slice(-2).join(".");var i=Object.entries(r).filter((function(e){var t=e[0];return t.startsWith("_ga_")}));var a=i.length>0?Object.fromEntries(i.map((function(e){var t=e[0],r=e[1];if(typeof r!=="string"){return null}var n=r.split(".");if(n.length<3){return null}return[t.substring("_ga_".length),n[2]]})).filter((function(e){return e!==null}))):undefined;if(n||a){return{ga4:{clientId:n,sessionIds:a}}}else{return undefined}}function removeCookie(e,t){var r=t.domain,n=t.secure;document.cookie=e+"=;domain="+r+";path=/"+";expires=Thu, 01 Jan 1970 00:00:01 GMT;SameSite="+(n?"None":"Lax")+(n?";secure":"")}function setCookie(e,t,r){var n=r.domain,i=r.secure;document.cookie=e+"="+t+";domain="+n+";path=/"+";expires="+new Date((new Date).getTime()+1e3*60*60*24*365*5).toUTCString()+";SameSite="+(i?"None":"Lax")+(i?";secure":"")}var defaultCookie2Key={__anon_id:"__eventn_id",__user_id:"__eventn_uid",__user_traits:"__eventn_id_usr",__group_id:"__group_id",__group_traits:"__group_traits"};var cookieStorage=function(e,t){return{setItem:function(r,n){var i=t(r)||r;if(typeof n==="undefined"){removeCookie(i,{domain:e,secure:window.location.protocol==="https:"});return}var a=typeof n==="object"&&n!==null?encodeURIComponent(JSON.stringify(n)):n;setCookie(i,a,{domain:e,secure:window.location.protocol==="https:"})},getItem:function(e){var r=t(e)||e;var n=getCookie(r);if(e==="__anon_id"){return n}if(typeof n==="undefined"&&e==="__user_id"){var i=parse(getCookie(t("__user_traits")||"__eventn_id_usr"))||{};return i.internal_id||i.user_id||i.id||i.userId}return parse(n)},removeItem:function(r){removeCookie(t(r)||r,{domain:e,secure:window.location.protocol==="https:"})},reset:function(){for(var r=0,n=Object.keys(defaultCookie2Key);r<n.length;r++){var i=n[r];removeCookie(t(i)||i,{domain:e,secure:window.location.protocol==="https:"})}}}};function windowRuntime(e){var t=function(t){var r,n,i,a,o;switch(t){case"__anon_id":return((r=e.cookieNames)===null||r===void 0?void 0:r.anonymousId)||defaultCookie2Key.__anon_id;case"__user_id":return((n=e.cookieNames)===null||n===void 0?void 0:n.userId)||defaultCookie2Key.__user_id;case"__user_traits":return((i=e.cookieNames)===null||i===void 0?void 0:i.userTraits)||defaultCookie2Key.__user_traits;case"__group_id":return((a=e.cookieNames)===null||a===void 0?void 0:a.groupId)||defaultCookie2Key.__group_id;case"__group_traits":return((o=e.cookieNames)===null||o===void 0?void 0:o.groupTraits)||defaultCookie2Key.__group_traits;default:return t}};return{getCookie:function(e){var t="; ".concat(document.cookie);var r=t.split("; ".concat(e,"="));return r.length===2?r.pop().split(";").shift():undefined},getCookies:function(){var e="; ".concat(document.cookie);var t={};var r=e.matchAll(/(\w+)=([^;]+)/g);for(var n=0,i=r;n<i.length;n++){var a=i[n];t[a[1]]=a[2]}return t},documentEncoding:function(){return window.document.characterSet},timezoneOffset:function(){return(new Date).getTimezoneOffset()},store:function(){return cookieStorage(e.cookieDomain||getTopLevelDomain(window.location.hostname),t)},language:function(){return window.navigator.language},pageTitle:function(){return window.document.title},pageUrl:function(){return window.location.href},referrer:function(){return window.document.referrer},screen:function(){return{width:window.screen.width,height:window.screen.height,innerWidth:window.innerWidth,innerHeight:window.innerHeight,density:Math.floor(window.devicePixelRatio)}},userAgent:function(){return window.navigator.userAgent}}}function createInMemoryStorage(e){var t={};return{reset:function(){Object.keys(t).forEach((function(e){return delete t[e]}))},setItem:function(r,n){if(e){console.log("[JITSU EMPTY RUNTIME] Set storage item ".concat(r,"=").concat(JSON.stringify(n)))}if(typeof n==="undefined"){delete t[r]}else{t[r]=n}},getItem:function(r){var n=t[r];if(e){console.log("[JITSU EMPTY RUNTIME] Get storage item ".concat(r,"=").concat(JSON.stringify(n)))}return n},removeItem:function(r){if(e){console.log("[JITSU EMPTY RUNTIME] Get storage item ".concat(r,"=").concat(t[r]))}delete t[r]}}}var emptyRuntime=function(e){return{documentEncoding:function(){return undefined},timezoneOffset:function(){return undefined},getCookie:function(e){return undefined},getCookies:function(){return{}},store:function(){return createInMemoryStorage(e.debug)},language:function(){return undefined},pageTitle:function(){return undefined},pageUrl:function(){return undefined},referrer:function(){return undefined},screen:function(){return undefined},userAgent:function(){return undefined}}};function deepMerge(e,t){if(typeof t!=="object"||t===null){return t}if(typeof e!=="object"||e===null){return t}return Object.entries(t).reduce((function(t,r){var n=r[0],i=r[1];t[n]=deepMerge(e[n],i);return t}),e)}function isInBrowser(){return typeof document!=="undefined"&&typeof window!=="undefined"}function fixPath(e){if(e.indexOf("//")===0&&e.lastIndexOf("/")===1){return"/"}return e}var hashRegex=/#.*$/;function urlPath(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g;var r=t.exec(e);var n=r&&r[3]?r[3].split("?")[0].replace(hashRegex,""):"";return"/"+n}function adjustPayload(e,t,r,n){var i,a,o,s,l,c,u,d,f,p,h,v,g,m;var y=t.runtime||(isInBrowser()?windowRuntime(t):emptyRuntime(t));var b=y.pageUrl();var _=safeCall((function(){return new URL(b)}),undefined);var w=_?parseQuery(_.search):{};var S=e.properties||{};if(e.type==="page"&&(S.url||b)){var $=S.url||b;S.url=$.replace(hashRegex,"");S.path=fixPath(urlPath($))}var k=deepMerge(t.defaultPayloadContext,((i=e.properties)===null||i===void 0?void 0:i.context)||((a=e.options)===null||a===void 0?void 0:a.context)||{});(o=e.properties)===null||o===void 0?true:delete o.context;var E=y.referrer();var x={library:{name:jitsuLibraryName,version:jitsuVersion,env:isInBrowser()?"browser":"node"},consent:((s=t.privacy)===null||s===void 0?void 0:s.consentCategories)?{categoryPreferences:t.privacy.consentCategories}:undefined,userAgent:(l=y.userAgent)===null||l===void 0?void 0:l.call(y),locale:(c=y.language)===null||c===void 0?void 0:c.call(y),screen:(u=y.screen)===null||u===void 0?void 0:u.call(y),ip:(d=y===null||y===void 0?void 0:y.ip)===null||d===void 0?void 0:d.call(y),traits:e.type!="identify"&&e.type!="group"?Object.assign(Object.assign({},restoreTraits(r)||{}),((f=e===null||e===void 0?void 0:e.options)===null||f===void 0?void 0:f.traits)||{}):undefined,page:{path:S.path||_&&_.pathname,referrer:E,referring_domain:safeCall((function(){return E&&new URL(E).hostname})),host:_&&_.host,search:S.search||_&&_.search,title:S.title||y.pageTitle(),url:S.url||b,encoding:S.encoding||y.documentEncoding()},clientIds:!((p=t.privacy)===null||p===void 0?void 0:p.disableUserIds)?getClientIds(y,t.cookieCapture):undefined,campaign:parseUtms(w)};var A=Object.assign(Object.assign({},e),{userId:((h=e===null||e===void 0?void 0:e.options)===null||h===void 0?void 0:h.userId)||(e===null||e===void 0?void 0:e.userId),anonymousId:((v=e===null||e===void 0?void 0:e.options)===null||v===void 0?void 0:v.anonymousId)||(e===null||e===void 0?void 0:e.anonymousId),groupId:((g=e===null||e===void 0?void 0:e.options)===null||g===void 0?void 0:g.groupId)||r.getItem("__group_id"),timestamp:(new Date).toISOString(),sentAt:(new Date).toISOString(),messageId:randomId(S.path||_&&_.pathname),writeKey:maskWriteKey(t.writeKey),context:deepMerge(x,k)});delete A.meta;delete A.options;if((m=t.privacy)===null||m===void 0?void 0:m.disableUserIds){delete A.userId;delete A.anonymousId;delete A.context.traits;delete A.groupId}return A}function isDiff(e){var t=Object.keys(e);return t.length===1&&t[0]==="__diff"}function processDestinations(e,t,r,n,i){return __awaiter$1(this,void 0,void 0,(function(){var a,o,s,l,c,u,d,f,p,h,d,v,g,m,h;return __generator(this,(function(y){switch(y.label){case 0:a=[];o=0,s=e;y.label=1;case 1:if(!(o<s.length))return[3,5];l=s[o];c=[r];if(l.newEvents){try{c=l.newEvents.map((function(e){return e==="same"?r:isDiff(e)?diff.patch(r,e.__diff):e}))}catch(e){console.error("[JITSU] Error applying '".concat(l.id,"' changes to event: ").concat(e===null||e===void 0?void 0:e.message),e)}}u=Object.assign(Object.assign({},l.credentials),l.options);if(!(l.deviceOptions.type==="internal-plugin"))return[3,2];d=internalDestinationPlugins[l.deviceOptions.name];if(d){for(f=0,p=c;f<p.length;f++){h=p[f];try{a.push(d.handle(Object.assign(Object.assign({},u),{debug:n}),h))}catch(e){console.warn("[JITSU] Error processing event with internal plugin '".concat(l.deviceOptions.name,"': ").concat(e===null||e===void 0?void 0:e.message),e)}}}else{console.warn("[JITSU] Unknown internal plugin '".concat(l.deviceOptions.name,"' for destination '").concat(l.id,"'"))}return[3,4];case 2:if(!(l.deviceOptions.type==="analytics-plugin"))return[3,4];return[4,loadScript(l.deviceOptions.packageCdn)];case 3:y.sent();d=window[l.deviceOptions.moduleVarName];if(!d){console.warn("[JITSU] Broken plugin '".concat(l.deviceOptions.packageCdn,"' for destination '").concat(l.id,"' - it doesn't export '").concat(l.deviceOptions.moduleVarName,"' variable"))}else{v=void 0;try{v=(typeof d==="function"?d:d.init)(u)}catch(e){console.warn("[JITSU] Error creating plugin '".concat(l.deviceOptions.moduleVarName,"@").concat(l.deviceOptions.packageCdn,"' for destination '").concat(l.id,"': ").concat(e===null||e===void 0?void 0:e.message),e)}try{if(n){console.log("[JITSU] Plugin '".concat(l.deviceOptions.moduleVarName,"@").concat(l.deviceOptions.packageCdn,"' for destination '").concat(l.id,"' initialized with config:"),v.config)}v.initialize({config:v.config,instance:i})}catch(e){console.warn("[JITSU] Error initializing plugin '".concat(l.deviceOptions.moduleVarName,"@").concat(l.deviceOptions.packageCdn,"' for destination '").concat(l.id,"': ").concat(e===null||e===void 0?void 0:e.message,". Config: ").concat(JSON.stringify(v.config)),e);return[3,4]}if(v[t]){for(g=0,m=c;g<m.length;g++){h=m[g];try{v[t]({payload:h,config:v.config,instance:i})}catch(e){console.warn("[JITSU] Error processing ".concat(t,"() with plugin '").concat(l.deviceOptions.moduleVarName,"@").concat(l.deviceOptions.packageCdn,"' for destination '").concat(l.id,"': ").concat(e===null||e===void 0?void 0:e.message),e)}}}}y.label=4;case 4:o++;return[3,1];case 5:return[2]}}))}))}function looksLikeCuid(e){return e.length===25&&e.charAt(0)==="c"}function validateWriteKey(e){if(e){var t=e.split(":",2),r=t[1];if(!r&&!looksLikeCuid(e)){throw new Error("Legacy write key detected - ".concat(e,"! This format doesn't work anymore, it should be 'key:secret'. Please download a new key from Jitsu UI"))}}return e}function maskWriteKey(e){if(e){var t=e.split(":",2),r=t[0],n=t[1];if(n){return"".concat(r,":***")}else{return"***"}}return e}function getErrorHandler(e){var t=e.errorPolicy||"log";if(typeof t==="function"){return t}else if(t==="rethrow"){return function(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}throw new Error(e)}}else{return function(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}console.error.apply(console,__spreadArray([e],t,false))}}}function send(e,t,r,n,i){return __awaiter$1(this,void 0,void 0,(function(){var a,o,s,l,c,u,d,f,p,h,v,g,m,y,b,_;return __generator(this,(function(w){switch(w.label){case 0:s=!!r.s2s;l=r.debug?{"X-Enable-Debug":"true"}:{};c=adjustPayload(t,r,i);if(r.echoEvents){console.log("[JITSU DEBUG] sending '".concat(e,"' event:"),c);return[2]}u=s?"".concat(r.host,"/api/s/s2s/").concat(e):"".concat(r.host,"/api/s/").concat(e);d=r.fetch||globalThis.fetch;if(!d){throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope")}f=r.fetchTimeoutMs?new AbortController:undefined;p=r.fetchTimeoutMs?setTimeout((function(){f.abort()}),r.fetchTimeoutMs):undefined;h=r.writeKey?{"X-Write-Key":r.writeKey}:{};v=typeof((a=r.privacy)===null||a===void 0?void 0:a.ipPolicy)==="undefined"||((o=r.privacy)===null||o===void 0?void 0:o.ipPolicy)==="keep"?{}:{"X-IP-Policy":r.privacy.ipPolicy};w.label=1;case 1:w.trys.push([1,3,,4]);return[4,d(u,{method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},h),l),v),body:JSON.stringify(c),signal:f===null||f===void 0?void 0:f.signal})];case 2:g=w.sent();if(p){clearTimeout(p)}return[3,4];case 3:m=w.sent();getErrorHandler(r)("Call to ".concat(u," failed with error ").concat(m.message));return[2,Promise.resolve()];case 4:w.trys.push([4,6,,7]);return[4,g.text()];case 5:y=w.sent();return[3,7];case 6:b=w.sent();console.warn("Can't read response text from ".concat(u," (status - ").concat(g.status," ").concat(g.statusText,"): ").concat(b===null||b===void 0?void 0:b.message));return[3,7];case 7:if(r.debug){console.log("[JITSU DEBUG] ".concat(u," replied ").concat(g.status,": ").concat(y,". Original payload:\n").concat(JSON.stringify(c,null,2)))}if(!g.ok){getErrorHandler(r)("Call to ".concat(u," failed with error: ").concat(g.status," - ").concat(g.statusText,": ").concat(y));return[2,Promise.resolve()]}try{_=JSON.parse(y)}catch(e){getErrorHandler(r)("Can't parse JSON: ".concat(y,": ").concat(e===null||e===void 0?void 0:e.message));return[2,Promise.resolve()]}if(_.destinations&&_.destinations.length>0){if(r.s2s){console.warn("[JITSU] ".concat(t.type," responded with list of ").concat(_.destinations.length," destinations. However, this code is running in server-to-server mode, so destinations will be ignored"),r.debug?JSON.stringify(_.destinations,null,2):undefined)}else{if(isInBrowser()){if(r.debug){console.log("[JITSU] Processing device destinations: ",JSON.stringify(_.destinations,null,2))}return[2,processDestinations(_.destinations,e,c,!!r.debug,n)]}}}return[2,c]}}))}))}var controllingTraits=["$doNotSend"];function stripControllingTraits(e){var t=Object.assign({},e);for(var r=0,n=controllingTraits;r<n.length;r++){var i=n[r];delete t[i]}return t}var jitsuAnalyticsPlugin=function(e,t){if(e===void 0){e={}}mergeConfig(e,e);return{name:"jitsu",config:e,initialize:function(e){return __awaiter$1(void 0,void 0,void 0,(function(){var t,r,n,i,a,o;return __generator(this,(function(s){switch(s.label){case 0:t=e.config;if(t.debug){console.debug("[JITSU DEBUG] Initializing Jitsu plugin with config: ",JSON.stringify(t,null,2))}if(!t.host&&!t.echoEvents){throw new Error("Please specify host variable in jitsu plugin initialization, or set echoEvents to true")}validateWriteKey(t.writeKey);if(!t.idEndpoint)return[3,4];if(!isInBrowser()){console.error("[JITSU] 'idEndpoint' option can be used only in browser environment");return[2]}s.label=1;case 1:s.trys.push([1,3,,4]);r=t.fetch||globalThis.fetch;n=new AbortController;setTimeout((function(){return n.abort()}),1e3);i=t.cookieDomain||getTopLevelDomain(window.location.hostname);return[4,r(t.idEndpoint+"?domain="+encodeURIComponent(i),{credentials:"include",signal:n.signal})];case 2:a=s.sent();if(!a.ok){console.error("[JITSU] Can't fetch idEndpoint: ".concat(a.status," - ").concat(a.statusText))}else if(t.debug){console.log("[JITSU DEBUG] Fetch idEndpoint: ".concat(a.status))}return[3,4];case 3:o=s.sent();console.error("[JITSU] Can't fetch idEndpoint: ".concat(o.message));return[3,4];case 4:return[2]}}))}))},page:function(e){var r;var n=e.payload,i=e.config,a=e.instance;if((r=i.privacy)===null||r===void 0?void 0:r.dontSend){return}return send("page",n,i,a,t)},track:function(e){var r;var n=e.payload,i=e.config,a=e.instance;if((r=i.privacy)===null||r===void 0?void 0:r.dontSend){return}return send("track",n,i,a,t)},identify:function(e){var r,n,i;var a=e.payload,o=e.config,s=e.instance;if(((r=o.privacy)===null||r===void 0?void 0:r.dontSend)||((n=o.privacy)===null||n===void 0?void 0:n.disableUserIds)){return}t.setItem("__user_id",a.userId);var l=(i=a.traits)===null||i===void 0?void 0:i.$doNotSend;if(a.traits&&typeof a.traits==="object"){a.traits=stripControllingTraits(a.traits);t.setItem("__user_traits",a.traits)}if(l){return Promise.resolve()}return send("identify",a,o,s,t)},reset:function(e){var r=e.config,n=e.instance;t.reset();if(r.debug){console.log("[JITSU DEBUG] Resetting Jitsu plugin storage")}},methods:{configure:function(r){var n,i,a,o;var s=((n=e.privacy)===null||n===void 0?void 0:n.disableUserIds)||((i=e.privacy)===null||i===void 0?void 0:i.dontSend);mergeConfig(e,r);var l=((a=e.privacy)===null||a===void 0?void 0:a.disableUserIds)||((o=e.privacy)===null||o===void 0?void 0:o.dontSend);if(!l&&s){if(e.debug){console.log("[JITSU] Enabling Anonymous ID. Generating new Id.")}var c=this.instance;var u=uuid();var d=c.user();if(d){d.anonymousId=u}t.setItem("__anon_id",u);c.setAnonymousId(u)}},group:function(r,n,i,a){var o,s;if(((o=e.privacy)===null||o===void 0?void 0:o.dontSend)||((s=e.privacy)===null||s===void 0?void 0:s.disableUserIds)){return}if(typeof r==="number"){r=r+""}var l=this.instance;var c=l.user();var u=(i===null||i===void 0?void 0:i.userId)||(c===null||c===void 0?void 0:c.userId);var d=(i===null||i===void 0?void 0:i.anonymousId)||(c===null||c===void 0?void 0:c.anonymousId)||t.getItem("__anon_id");t.setItem("__group_id",r);var f=n===null||n===void 0?void 0:n.$doNotSend;if(n&&typeof n==="object"){n=stripControllingTraits(n);t.setItem("__group_traits",n)}if(f){return Promise.resolve()}return send("group",Object.assign(Object.assign({type:"group",groupId:r,traits:n},d?{anonymousId:d}:{}),u?{userId:u}:{}),e,l,t)}}}};var seedCounter=0;function getSeed(){var e;seedCounter=(seedCounter+1)%Number.MAX_SAFE_INTEGER;var t=Date.now()%2147483647;var r=isInBrowser()?((e=window===null||window===void 0?void 0:window.performance)===null||e===void 0?void 0:e.now())||t:t;return r+seedCounter}function randomId(e){if(e===void 0){e=""}var t=Date.now();return(Math.random()*t*hash(e!==null&&e!==void 0?e:"",getSeed())%Number.MAX_SAFE_INTEGER).toString(36)+(Math.random()*t*hash(e!==null&&e!==void 0?e:"",getSeed())%Number.MAX_SAFE_INTEGER).toString(36)}function uuid(){var e="",t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",r=0,n=Math.random()*4294967295|0;while(r++<36){var i=t[r-1],a=n&15,o=i=="x"?a:a&3|8;e+=i=="-"||i=="4"?i:o.toString(16);n=r%8==0?Math.random()*4294967295|0:n>>4}return e}function hash(e,t){if(t===void 0){t=0}var r=3735928559^t,n=1103547991^t;for(var i=0,a=void 0;i<e.length;i++){a=e.charCodeAt(i);r=Math.imul(r^a,2654435761);n=Math.imul(n^a,1597334677)}r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909);n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909);return 4294967296*(2097151&n)+(r>>>0)}var __awaiter=function(e,t,r,n){function i(e){return e instanceof r?e:new r((function(t){t(e)}))}return new(r||(r=Promise))((function(r,a){function o(e){try{l(n.next(e))}catch(e){a(e)}}function s(e){try{l(n["throw"](e))}catch(e){a(e)}}function l(e){e.done?r(e.value):i(e.value).then(o,s)}l((n=n.apply(e,t||[])).next())}))};function parse(e){var t=e;if((e===null||e===void 0?void 0:e.indexOf("%7B%22"))===0){t=decodeURIComponent(e)}try{t=JSON.parse(t);if(t==="true")return true;if(t==="false")return false;if(typeof t==="object")return t;if(parseFloat(t)===t){t=parseFloat(t)}}catch(e){}if(t===null||t===""){return}return t}function createUnderlyingAnalyticsInstance(e,t,r){if(r===void 0){r=[]}var n,i,a;var o={};var s=function(t){return{setItem:function(r,n){var i,a;if(((i=e.privacy)===null||i===void 0?void 0:i.dontSend)||((a=e.privacy)===null||a===void 0?void 0:a.disableUserIds)){return}if(e.debug){console.log("[JITSU DEBUG] Caching storage setItem: ".concat(r,"=").concat(n))}o[r]=n;t.setItem(r,n)},getItem:function(r){var n,i;if(((n=e.privacy)===null||n===void 0?void 0:n.dontSend)||((i=e.privacy)===null||i===void 0?void 0:i.disableUserIds)){return}var a=o[r]||t.getItem(r);if(e.debug){console.log("[JITSU DEBUG] Caching storage getItem: ".concat(r,"=").concat(a,". Evicted from cache: ").concat(!o[r]))}return a},reset:function(){for(var e=0,r=__spreadArray([],Object.keys(o),true);e<r.length;e++){var n=r[e];delete o[n]}t.reset()},removeItem:function(r){if(e.debug){console.log("[JITSU DEBUG] Caching storage removeItem: ".concat(r))}delete o[r];t.removeItem(r)}}};var l=s(((n=t.store)===null||n===void 0?void 0:n.call(t))||createInMemoryStorage(e.debug));var c=analyticsLib({debug:!!e.debug,storage:l,plugins:__spreadArray([jitsuAnalyticsPlugin(e,l)],r,true)});var u=Object.assign(Object.assign({},c),{page:function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e.length===2&&typeof e[0]==="string"&&typeof e[1]==="object"){return c.page(Object.assign({name:e[0]},e[1]))}else{return c.page.apply(c,e)}},identify:function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e[0]&&typeof e[0]!=="object"&&typeof e[0]!=="string"){e[0]=e[0]+""}var r=c.storage;var n=s(r);if(typeof e[0]==="string"){n.setItem("__user_id",e[0])}else if(typeof e[0]==="object"){n.setItem("__user_traits",e[0])}if(e.length===2&&typeof e[1]==="object"){n.setItem("__user_traits",e[1])}return c.identify.apply(c,e)},setAnonymousId:function(t){if(e.debug){console.log("[JITSU DEBUG] Setting anonymous id to "+t)}l.setItem("__anon_id",t);var r=c.user();if(r){r.anonymousId=t}c.setAnonymousId(t)},reset:function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(e.debug){console.log("[JITSU DEBUG] Called reset(). Storage state",JSON.stringify(c.user()))}l.reset();return[4,c.reset()];case 1:t.sent();this.setAnonymousId(uuid());if(e.debug){console.log("[JITSU DEBUG] User state after reset",JSON.stringify(c.user()))}return[2]}}))}))},configure:function(t){return __awaiter(this,void 0,void 0,(function(){var r,n,i,a,o;return __generator(this,(function(s){if(e.debug){console.log("[JITSU DEBUG] Update Jitsu config with",JSON.stringify(t))}if(((r=t.privacy)===null||r===void 0?void 0:r.disableUserIds)||((n=t.privacy)===null||n===void 0?void 0:n.dontSend)){l.reset()}for(i=0,a=Object.values(c.plugins);i<a.length;i++){o=a[i];if(typeof o["configure"]==="function"){o["configure"](t)}}return[2]}))}))},group:function(e,t,r,n){return __awaiter(this,void 0,void 0,(function(){var i,a,o,s,l,u;return __generator(this,(function(d){switch(d.label){case 0:i=[];a=0,o=Object.values(c.plugins);d.label=1;case 1:if(!(a<o.length))return[3,4];s=o[a];if(!s["group"])return[3,3];u=(l=i).push;return[4,s["group"](e,t,r,n)];case 2:u.apply(l,[d.sent()]);d.label=3;case 3:a++;return[3,1];case 4:return[2,i[0]]}}))}))}});if(((i=e.privacy)===null||i===void 0?void 0:i.disableUserIds)||((a=e.privacy)===null||a===void 0?void 0:a.dontSend)){l.reset()}return u}function fixOptions(e){var t,r;return Object.assign(Object.assign({},e),{host:((t=e.host)!==null&&t!==void 0?t:"").indexOf("https://")!==0&&((r=e.host)!==null&&r!==void 0?r:"").indexOf("http://")!==0?"https://".concat(e.host):e.host})}function jitsuAnalytics(e){var t=fixOptions(e);var r=isInBrowser();var n=t.runtime||(r?windowRuntime(t):emptyRuntime(t));return createUnderlyingAnalyticsInstance(t,n)}var n=function(e,t,r){return alert(e)},l=function(e,t){return n(e,o.error,t)},o={error:"error",success:"success",info:"info"};var c={fire:function(e,t,r){return n(e,t,r)},setNotifier:function(e){n=e,salla.event.emit("twilight::notifier.changed")},error:l,success:function(e,t){return n(e,o.success,t)},info:function(e,t){return n(e,o.info,t)},sallaInitiated:function(){var e=window.location.href.match(/([\?\&]danger=)[^&]+/g);e&&(window.history.replaceState(null,document.title,window.location.pathname),salla.event.once("twilight::notifier.changed",(function(){e.forEach((function(e){e=decodeURI(e.replace("?danger=","").replace("&danger=",""));var t=document.createElement("div");t.innerText=e,l(t.innerHTML),salla.event.emit("twilight::error",e)}))})))},types:o};var d=function(){function e(e,t){return this.api=e,this.event=t,new Proxy(this,{get:function(r,n){return"event"===n?t:"api"===n?e:e&&e[n]||r[n]}})}return e}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){for(var t=this;t;){if(t.matches(e))return t;t=t.parentElement}}),Element.prototype.getElementSallaData=function(e){var t;var r=[];for(var n=1;n<arguments.length;n++){r[n-1]=arguments[n]}if(!this.getAttribute)return;if(this.hasAttribute("data-json"))try{return JSON.parse(this.getAttribute("data-json"))}catch(e){}var i=this.getAttribute("data-function");if(i&&window[i])return"function"==typeof window[i]?this.getFilteredData((t=window[i]).call.apply(t,__spreadArray([this],r,false))):this.getFilteredData(window[i]);var a=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if(a="FORM"===this.tagName?this:a||this.closest("form")||this.closest("[salla-form-data]")||this,a&&"FORM"===a.tagName)return this.getFilteredData(new FormData(a),null,a);var o=a.querySelectorAll("[name]");if(!o.length)return this.getFilteredData();var s=Object.assign({},this.dataset);return o.forEach((function(e){if(!["checkbox","radio"].includes(e.type)||e.checked)try{var t=Salla.helpers.inputData(e.name,e.value,s);s[t.name]=t.value}catch(t){Salla.log(e.name+" can't be send")}})),this.getFilteredData(s)},Element.prototype.canEventFireHook=function(e){return!!this.hasAttribute&&this.hasAttribute(Salla.api.hooksPrefix+e.type)},Element.prototype.hasAttributeStartsWith=function(e,t){e=e.toLowerCase();for(var r=0;r<this.attributes.length;r++){var n=this.attributes[r].name.toLowerCase();if(0===n.indexOf(e))return!t||n}return!1},HTMLFormElement.prototype.getAjaxFormData=function(e){var t=this.querySelectorAll('input[type="file"]');t.forEach((function(e){e.files.length||e.setAttribute("disabled","")}));var r=new FormData(this);return t.forEach((function(e){e.files.length||e.removeAttribute("disabled")})),{formData:this.getFilteredData(r,e),url:this.getAttribute("action"),method:this.getAttribute("method")||"post",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}},Element.prototype.getFilteredData=function(e,t,r){var n=this;if(e===void 0){e=null}if(t===void 0){t=null}if(r===void 0){r=null}return e=e||(r===null||r===void 0?void 0:r.dataset)||this.dataset,r&&this.name&&void 0!==this.value&&(e=function(e,t,r){e instanceof FormData?e.append(t,r):e[t]=r;return e}(e,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((function(i){var a=(r===null||r===void 0?void 0:r.dataset[i])||n.dataset[i];if(a){var o=window[a];if("function"==typeof o){if(!o(e,r||n,t)&&e)throw"Data failed to be pass verify function window.".concat(a,"(formData, element, event)!");return o(e,r||n,t)}Salla.log("window."+a+"() not found!")}})),e},HTMLAnchorElement.prototype.getAjaxFormData=function(e){return{formData:this.getFilteredData(null,e),url:this.getAttribute("href"),method:this.dataset.type||"get",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}};var u=function(){function e(){this.events={},this.namespace="";var e=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(e&&e.length>1?e[1]:"").toLowerCase()}e.prototype.after_init=function(){this.createDynamicFunctions()};e.prototype.createDynamicFunctions=function(){var e=this;Object.keys(this.events).forEach((function(t){e.createDynamicEventFuns(t),e.createDynamicListenerFuns(t)}))};e.prototype.createDynamicEventFuns=function(e){if(this[e])return;var t=this;this[e]=function(){var r=[];for(var n=0;n<arguments.length;n++){r[n]=arguments[n]}return t.dispatch.apply(t,__spreadArray([e],r,false))}};e.prototype.createDynamicListenerFuns=function(e){var t="on"+e.charAt(0).toUpperCase()+e.slice(1);if(this[t])return;var r=this;this[t]=function(t){var n=this;return r.on(e,(function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}return __awaiter(n,void 0,void 0,(function(){return __generator(this,(function(r){return[2,t.apply(void 0,e)]}))}))}))}};e.prototype.getEventName=function(e){return e=this.events[e]||e,!this.namespace||e.includes("::")?e:this.namespace+Salla.event.delimiter+e};e.prototype.dispatch=function(e){var t;var r=[];for(var n=1;n<arguments.length;n++){r[n-1]=arguments[n]}return(t=Salla.event).emitAsync.apply(t,__spreadArray([this.getEventName(e)],r,false))};e.prototype.on=function(e,t,r){if(r===void 0){r={}}return Salla.event.addListener(this.getEventName(e),t,r)};e.prototype.once=function(e,t){return Salla.event.once(this.getEventName(e),t)};return e}();function h(e){e&&e.sallaInitiated&&!e.initiated&&(e.sallaInitiated(),e.initiated=!0)}Salla.event.auth=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="auth",t.events={login:"login",logout:"logout",codeSent:"code.sent",codeNotSent:"code.not-sent",verified:"verified",verificationFailed:"verification.failed",loggedIn:"logged.in",registered:"registered",registrationFailed:"registration.failed",loggedOut:"logged.out",failedLogout:"failed.logout",refreshFailed:"refresh.failed",tokenFetched:"token.fetched",tokenInvalid:"token.invalid"},t.after_init();return t}t.prototype.login=function(e){return e?(e.type&&this.setTypeActionOnVerified(e.type),this.next_event=e.next_event||null,this.dispatch.apply(this,__spreadArray(["login"],arguments,false))):(this.next_event=null,this.dispatch.apply(this,__spreadArray(["login"],arguments,false)))};t.prototype.loggedIn=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){return[2,Salla.profile.info().finally((function(){return t.dispatch("loggedIn",e)}))]}))}))};t.prototype.setTypeActionOnVerified=function(e){this.type_action_on_verified=e};t.prototype.getTypeActionOnVerified=function(){return this.type_action_on_verified||"redirect"};return t}(u)),Salla.event.cart=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="cart",t.events={latestFetched:"latest.fetched",latestFailed:"latest.failed",updated:"updated",itemUpdated:"item.updated",itemUpdatedFailed:"item.updated.failed",itemAdded:"item.added",itemAddedFailed:"item.added.failed",itemDeleted:"item.deleted",itemDeletedFailed:"item.deleted.failed",submitted:"submitted",submitFailed:"submit.failed",imageDeleted:"image.deleted",imageNotDeleted:"image.not.deleted",detailsFetched:"details.fetched",detailsNotFetched:"details.not.fetched",successReset:"success.reset",priceQuoteSucceeded:"price-quote.succeeded",priceQuoteFailed:"price-quote.failed",offersFetched:"offers.fetched",offersFailed:"offers.failed",couponAdded:"coupon.added",couponDeleted:"coupon.deleted",couponAdditionFailed:"coupon.addition.failed",couponDeletionFailed:"coupon.deletion.failed",quickOrderSettingFetched:"quick-order.fetched",quickOrderSettingFailed:"quick-order.failed",quickOrderSucceeded:"quick-order.succeeded",quickOrderFailed:"quick-order.failed",submitting:"submitting"},t.after_init();return t}t.prototype.updated=function(e){var t;return Salla.cookie.set("fresh_summary",1),e&&"object"==typeof e?(e.offer&&salla.product.event.offerExisted(e.offer),e.redirect&&(salla.log("The current cart is purchased!"),salla.cart.api.reset()),e.cart?(salla.storage.set("cart.summary",{total:e.cart.total,sub_total:e.cart.sub_total,discount:e.cart.discount,tax_amount:e.cart.tax_amount,total_discount:e.cart.total_discount,real_shipping_cost:e.cart.real_shipping_cost,count:e.cart.count,shipping_cost:((t=e.cart.free_shipping_bar)===null||t===void 0?void 0:t.has_free_shipping)?0:e.cart.real_shipping_cost}),this.dispatch("updated",e.cart)):void salla.log("Failed to get the cart summary!")):(Salla.logger.info("Cart summary not an object!",e),this.dispatch("updated"))};t.prototype.latestFetched=function(e){return this.updated(e.data),this.dispatch("latestFetched",e)};t.prototype.itemAdded=function(e,t){return this.updated(e.data),this.dispatch("itemAdded",e,t)};t.prototype.itemDeleted=function(e,t){return this.updated(e.data),this.dispatch("itemDeleted",e,t)};t.prototype.itemUpdated=function(e,t){return this.updated(e.data),this.dispatch("itemUpdated",e,t)};t.prototype.couponAdded=function(e,t){return this.updated(e.data),this.dispatch("couponAdded",e,t)};t.prototype.couponDeleted=function(e,t){return this.updated(e.data),this.dispatch("couponDeleted",e,t)};return t}(u)),Salla.event.order=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="order",t.events={canceled:"canceled",notCanceled:"not.canceled",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",invoiceSent:"invoice.sent",invoiceNotSent:"invoice.not.sent",ordersFetched:"order.fetched",ordersNotFetched:"order.not.fetched"},t.after_init();return t}return t}(u)),Salla.event.scope=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="scope",t.events={fetched:"fetched",notFetched:"not.fetched",productAvailabilityFetched:"product-availability.fetched",productAvailabilityNotFetched:"product-availability.not.fetched",changeSucceeded:"changed",changeFailed:"not.changed"},t.after_init();return t}return t}(u)),Salla.event.rating=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="rating",t.events={orderNotFetched:"order.not.fetched",orderFetched:"order.fetched",storeRated:"store.rated",storeFailed:"store.failed",productsRated:"products.rated",productsFailed:"products.failed",shippingRated:"shipping.rated",shippingFailed:"shipping.failed"},t.after_init();return t}return t}(u)),Salla.event.booking=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.events={added:"added",additionFailed:"addition.failed"},t.after_init();return t}return t}(u)),Salla.event.comment=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="comment",t.events={added:"added",additionFailed:"addition.failed",fetched:"fetched",fetchFailed:"fetch.failed"},t.after_init();return t}return t}(u)),Salla.event.landing=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="landing",t.events={detailsFetched:"order.fetched",getDetailsFailed:"get.details.failed",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",breadcrumbFetched:"breadcrumb.fetched",breadcrumbFetchFailed:"breadcrumb.fetch.failed"},t.after_init();return t}return t}(u)),Salla.event.loyalty=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="loyalty",t.events={exchangeSucceeded:"exchange.succeeded",exchangeFailed:"exchange.failed",programFetched:"program.fetched",programNotFetched:"program.not.fetched",resetSucceeded:"exchange-reset.succeeded",resetFailed:"exchange-reset.failed"},t.after_init();return t}t.prototype.exchangeSucceeded=function(e,t){return salla.cart.event.updated(e.data),this.dispatch("exchangeSucceeded",e,t)};t.prototype.resetSucceeded=function(e){return salla.cart.event.updated(e.data),this.dispatch("resetSucceeded",e)};return t}(u)),Salla.event.product=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="product",t.events={priceUpdated:"price.updated",priceUpdateFailed:"price.updated.failed",availabilitySubscribed:"availability.subscribed",availabilitySubscribeFailed:"availability.subscribe.failed",categoriesFetched:"categories.fetched",categoriesFailed:"categories.failed",searchFailed:"search.failed",searchResults:"search.results",offerExisted:"offer.existed",fetchOffersFailed:"fetch.offers.failed",offersFetched:"offers.fetched",sizeGuideFetched:"size-guide.fetched",sizeGuideFetchFailed:"size-guide.failed",giftFetched:"gift.fetched",giftFetchFailed:"gift.failed",detailFetched:"detail.fetched",detailFetchFailed:"detail.failed",addGiftToCartSucceeded:"gift.add-to-cart.succeeded",addGiftToCartFailed:"gift.add-to-cart.failed",giftImageUploadSucceeded:"gift.image-upload.succeeded",giftImageUploadFailed:"gift.image-upload.failed",productListFetchSucceeded:"fetch.succeeded",productListFetchFailed:"fetch.failed",productOptionsFetched:"options.fetched",productOptionsNotFetched:"options.not.fetched"},t.after_init();return t}return t}(u)),Salla.event.profile=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="profile",t.events={updated:"updated",updateFailed:"update.failed",verificationCodeSent:"verification.code.sent",updateContactsFailed:"update.contacts.failed",verified:"verified",unverified:"unverified",infoFetched:"info.fetched",infoNotFetched:"info.not.fetched",settingsUpdated:"settings.updated",updateSettingsFailed:"update.settings.failed",deleted:"deleted",notDeleted:"not.deleted"},t.after_init();return t}return t}(u)),Salla.event.currency=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="currency",t.events={changed:"changed",failed:"failed",fetched:"fetched",failedToFetch:"failed.to.fetch"},t.after_init();return t}return t}(u)),Salla.event.document=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="document",t.events={click:"click",change:"change",submit:"submit",keyup:"keyup",leaving:"leaving",request:"request",requestFailed:"request.failed"},t.after_init();return t}t.prototype.onClick=function(e,t){this.fireCallableFuns("click",e,t)};t.prototype.onChange=function(e,t){this.fireCallableFuns("change",e,t)};t.prototype.onSubmit=function(e,t){this.fireCallableFuns("submit",e,t)};t.prototype.onKeyup=function(e,t){this.fireCallableFuns("keyup",e,t)};t.prototype.fireCallableFuns=function(e,t,r){this.on(e,(function(e){"function"!=typeof t?"function"==typeof r&&e.target.matches(t)&&r(e):t(e)}))};t.prototype.fireEvent=function(e,t){var r=[];for(var n=2;n<arguments.length;n++){r[n-2]=arguments[n]}return this.fireEventForElements.apply(this,__spreadArray([e,t,!1],r,false))};t.prototype.fireEventForAll=function(e,t){var r=[];for(var n=2;n<arguments.length;n++){r[n-2]=arguments[n]}return this.fireEventForElements.apply(this,__spreadArray([e,t,!0],r,false))};t.prototype.fireEventForElements=function(e,t,r){var n=this;var i=[];for(var a=3;a<arguments.length;a++){i[a-3]=arguments[a]}if("string"==typeof e){if(r)return document.querySelectorAll(e).forEach((function(e){return n.fireEventForElements.apply(n,__spreadArray([e,t,!1],i,false))}));e=document.querySelector(e)}if(!e)return void salla.log("Failed To get element to fire event: "+t);var o=new(CustomEvent.bind.apply(CustomEvent,__spreadArray([void 0,t],i,false)));return e.dispatchEvent(o)};return t}(u)),Salla.event.wishlist=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="wishlist",t.events={added:"added",removed:"removed",additionFailed:"addition.failed",removingFailed:"removing.failed"},t.after_init();return t}return t}(u)),Salla.event.infiniteScroll=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="infiniteScroll",t.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},t.after_init();return t}return t}(u)),Salla.event.notifications=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="notifications",t.events={fetched:"fetched",fetchFailed:"fetch.failed"},t.after_init();return t}return t}(u)),Salla.event.component=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="component",t.events={menuFetched:"menus.fetched",menuFetchFailed:"menus.fetch.failed",reviewsFetched:"reviews.fetched",reviewsFetchFailed:"reviews.fetch.failed"},t.after_init();return t}return t}(u)),Salla.event.advertisement=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="advertisement",t.events={fetched:"advertisement.fetched",fetchFailed:"advertisement.not.fetched"},t.after_init();return t}return t}(u)),Salla.event.navigation=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="navigation",t.events={breadcrumbFetched:"breadcrumb.fetched",breadcrumbFetchFailed:"breadcrumb.fetch.failed"},t.after_init();return t}return t}(u)),Salla.event.metadata=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="metadata",t.events={valueFetched:"value.fetched",valueNotFetch:"value.not.fetched"},t.after_init();return t}return t}(u)),Salla.event.on("twilight::initiated",(function(){Object.keys(Salla).forEach((function(e){"object"==typeof(e=Salla[e])&&(h(e),Object.keys(e).forEach((function(t){h(e[t])})))}))})),Salla.config.default_properties={debug:"undefined"!=typeof process&&"development"==="production",token:null,fastRequests:!0,canLeave:!0,store:{api:["group","test"].includes(window.location.hostname.split(".").pop())?window.location.origin+"/api/v1/":"https://api.salla.dev/store/v1/"},currencies:{SAR:{code:"SAR",name:"ريال سعودي",symbol:"ر.س",amount:1,country_code:"sa"}}},Salla.config.merge(Salla.config.default_properties),Salla.config.triedToGetCurrencies_=!1,Salla.config.triedToGetLanguages_=!1,Salla.config.isUser=function(){return"user"===Salla.config.get("user.type")},Salla.config.isGuest=function(){return!Salla.config.isUser()},Salla.config.languages=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t;var r,n;return __generator(this,(function(i){switch(i.label){case 0:if(Salla.config.triedToGetLanguages_)return[2,Salla.config.get("languages")];Salla.config.triedToGetLanguages_=!0;e=!0,t=[];return[4,salla.document.api.request("languages",null,"get")];case 1:return[2,((n=(r=i.sent())===null||r===void 0?void 0:r.data)===null||n===void 0?void 0:n.map((function(r){e&&(t=[],e=!1),r.code=r.code||r.iso_code,r.url=salla.url.get(r.code),r.is_rtl=r.is_rtl||r.rtl,t.push(r)})),Salla.config.set("languages",t),t)]}}))}))},Salla.config.currencies=function(){return __awaiter(void 0,void 0,void 0,(function(){var e,t;var r,n;return __generator(this,(function(i){switch(i.label){case 0:if(Salla.config.triedToGetCurrencies_)return[2,Salla.config.get("currencies")];Salla.config.triedToGetCurrencies_=!0;e=!0,t={};return[4,salla.currency.api.list()];case 1:return[2,((n=(r=i.sent())===null||r===void 0?void 0:r.data)===null||n===void 0?void 0:n.map((function(r){e&&(t={},e=!1),r.country_code=r.code.substr(0,2).toLowerCase(),t[r.code]=r})),Salla.config.set("currencies",t),t)]}}))}))};var p=function(){function e(){this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.endpointsMethods={},this.endpointsHeaders={};var e=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(e&&e.length>1?e[1]:"").toLowerCase(),this.debounce={request:void 0,time:300,enabled:!0,exclude:[]}}e.prototype.after_init=function(){};e.prototype.normalRequest=function(e,t,r){if(t===void 0){t=void 0}if(r===void 0){r=null}var n=Array.isArray(e),i=n?this.getUrl.apply(this,e):this.getUrl(e);e=n?e[0]:e,r=r||this.endpointsMethods[e]||"post";var a=this.endpointsHeaders[e];if("get"===r&&t instanceof FormData){var o={};Array.from(t.entries()).forEach((function(e){o[e[0]]=e[1]})),t={params:o}}return a&&"get"===r&&(t=t?Object.assign(t,a):a),this.webEndpoints.includes(e)?i=salla.url.get(i):"http"!==i.substring(0,4)&&(i=salla.url.api(i)),Salla.api.request(i,t,r,{headers:a})};e.prototype.request=function(e,t,r){if(t===void 0){t=void 0}if(r===void 0){r=null}return!salla.api.isFastRequestsAllowed()&&this.debounce.enabled?(this.debounce.request||(this.debounce.request=salla.helpers.debounce(this.normalRequest.bind(this),this.debounce.time)),this.debounce.request(e,t,r)):this.normalRequest(e,t,r)};e.prototype.getUrl=function(e){var t=this.endpoints[e]||e;var r=/{[^{}]+}/i;for(var n=1;n<arguments.length;n++)t=t.replace(r,arguments[n]);return t};e.prototype.event=function(){return salla.event[this.className]};return e}();var g=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.addToCartTries=0,t.namespace="cart",t._pendingCartIdRequest=null,t.endpoints={latest:"cart/latest",latestApi:"cart/latest",details:"cart/{cart}",quickAdd:"cart/{cart}/item/{product}/quick-add",addItem:"cart/{cart}/item/{product}/add",deleteItem:"cart/{cart}/item/{item}",updateItem:"cart/{cart}/item/{item}",deleteImage:"cart/{cart}/image/{image}",uploadImage:"cart/{cart}/image",status:"cart/{cart}/status",addCoupon:"cart/{id}/coupon",deleteCoupon:"cart/{id}/coupon",getQuickOrderSettings:"checkout/quick-order",createQuickOrder:"checkout/quick-order",priceQuote:"cart/{cartId}/price-quote",offers:"offers/cart/{cartId}",giftCartDetails:"cart/{cartId}/buy-as-gift",cartGiftToCart:"cart/{cart_id}/buy-as-gift"},t.endpointsMethods={latest:"get",details:"get",status:"get",updateItem:"post",deleteItem:"delete",deleteImage:"delete",deleteCoupon:"put",getQuickOrderSettings:"get",offers:"get",giftCartDetails:"get"},t.webEndpoints=["latest"],t.latestCart=null,t.after_init(),salla.event.on("api::initiated",(function(){return salla.api.cart.getCurrentCartId(!1,"api::initiated")})),salla.event.on("auth::token.fetched",t._checkCurrentCart),salla.event.on("auth::token.invalid",t._checkCurrentCart),salla.event.on("auth::verified",(function(){return salla.api.cart.getCurrentCartId(!0,"auth::verified")}),{async:!0}),salla.event.on("twilight::initiated",(function(){return salla.api.cart.syncGuestCart()})),salla.event.on("profile::info.fetched",t._checkCurrentCart),salla.event.on("twilight::error",(function(e){return(e.includes("Cart not available")||e.includes("السلة غير متاحة"))&&salla.cart.api.reset()}));return t}t.prototype._checkCurrentCart=function(){var e,t;var r=salla.storage.get("cart"),n=(e=salla.config.get("user"))===null||e===void 0?void 0:e.id,i=(t=salla.config.get("store"))===null||t===void 0?void 0:t.id;r&&r.id&&(r.user_id===n&&r.store_id===i||(salla.log("cart",{user_id:r.user_id,store_id:r.store_id}),salla.log("current",{user_id:n,store_id:i}),salla.log("Api:: case2 => The cart is not belong to current "+(r.user_id!==n?"user":"store")+"!"),salla.cart.api.reset()),salla.url.is_page("cart")&&r.id!==salla.config.get("page.id")&&(salla.log("cart",{user_id:r.user_id,store_id:r.store_id}),salla.log("current",{user_id:n,store_id:i}),salla.log("Api:: case2 => The cart is different between storage:".concat(r.id," & session:").concat(salla.config.get("page.id")," !")),salla.cart.api.reset()))};t.prototype.getCurrentCartId=function(e,t){if(e===void 0){e=!1}if(t===void 0){t="getCurrentCartId"}return __awaiter(this,void 0,void 0,(function(){var r;var n=this;return __generator(this,(function(i){if(Salla.cart.api._pendingCartIdRequest)return[2,Salla.cart.api._pendingCartIdRequest];Salla.cart.api._pendingCartIdRequest=function(){return __awaiter(n,void 0,void 0,(function(){var r,n;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,,2,3]);if(!e){if(Salla.cart.api.latestCart)return[2,Salla.cart.api.latestCart.cart.id];r=Salla.storage.get("cart.id");if(r)return[2,r]}return[4,Salla.cart.api.latest(t)];case 1:n=i.sent();return[2,(Salla.cart.api.latestCart=n.data,Salla.cart.api.latestCart.cart.id)];case 2:Salla.cart.api._pendingCartIdRequest=null;return[7];case 3:return[2]}}))}))}();r=Salla.cart.api._pendingCartIdRequest;return[2,(Salla.cart.api._pendingCartIdRequest=null,r)]}))}))};t.prototype.getUploadImageEndpoint=function(e){return salla.url.api(this.getUrl("uploadImage",e||salla.storage.get("cart.id")))};t.prototype.latest=function(e){if(e===void 0){e="direct"}return this.request(salla.auth.api.isSessionless()?"latestApi":"latest",{params:{source:"",callerName:e}}).then((function(e){return salla.api.cart.set(e.data.cart),salla.event.cart.latestFetched(e),e})).catch((function(e){throw salla.api.cart.reset(),salla.event.cart.latestFailed(e),e}))};t.prototype.details=function(e,t){if(t===void 0){t=[]}return __awaiter(this,void 0,void 0,(function(){var r;return __generator(this,(function(n){switch(n.label){case 0:r=e;if(r)return[3,2];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.details")];case 1:r=n.sent();n.label=2;case 2:return[2,(e=r,this.request(["details",e],{params:{with:t}}).then((function(e){return salla.cart.event.detailsFetched(e),e})).catch((function(e){throw salla.cart.event.detailsNotFetched(e),e})))]}}))}))};t.prototype.quickAdd=function(e,t,r){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(n){return[2,this.addItem({id:e,quantity:t,offerType:r,endpoint:"quickAdd"})]}))}))};t.prototype.addItem=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n,i;return __generator(this,(function(a){switch(a.label){case 0:t=this.getCartPayload(e);if(!t.id){r='There is no product "id"!';return[2,(salla.cart.event.itemAddedFailed(r),salla.api.errorPromise(r))]}n=salla.form.getPossibleValue(t.payload,["endpoint"]);n&&["addItem","quickAdd"].includes(n)||(n=salla.form.getPossibleValue(t.payload,["quantity","donating_amount"])?"addItem":"quickAdd");return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.addItem")];case 1:i=a.sent();return[2,this.request([n,i,t.id],t.payload).then((function(e){return salla.cart.api.addToCartTries=0,salla.cart.event.itemAdded(e,t.id),e})).catch((function(r){if(!salla.cart.api.addToCartTries)return salla.cart.api.addToCartTries++,salla.cart.reset(),salla.cart.api.addItem(e);throw salla.cart.event.itemAddedFailed(r,t.id),r}))]}}))}))};t.prototype.deleteItem=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n;return __generator(this,(function(i){switch(i.label){case 0:t=this.getCartPayload(e);if(!t.id){r='There is no "id"!';return[2,(salla.cart.event.itemDeletedFailed(r),salla.api.errorPromise(r))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.deleteItem")];case 1:n=i.sent();return[2,this.request(["deleteItem",n,t.id]).then((function(e){return salla.cart.event.itemDeleted(e,t.id),e})).catch((function(e){throw salla.cart.event.itemDeletedFailed(e,t.id),e}))]}}))}))};t.prototype.updateItem=function(e){var t;return __awaiter(this,void 0,void 0,(function(){var r,n,i;return __generator(this,(function(a){switch(a.label){case 0:r=this.getCartPayload(e);if(!r.id){n='There is no "id"!';return[2,(salla.cart.event.itemUpdatedFailed(n),salla.api.errorPromise(n))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.updateItem")];case 1:i=a.sent();return[2,("Object"===((t=r.payload.constructor)===null||t===void 0?void 0:t.name)?r.payload._method="PUT":r.payload.append("_method","PUT"),this.request(["updateItem",i,r.id],r.payload).then((function(e){return salla.cart.event.itemUpdated(e,r.id),e})).catch((function(e){throw salla.cart.event.itemUpdatedFailed(e,r.id),e})))]}}))}))};t.prototype.deleteImage=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(n){switch(n.label){case 0:if(!(e=salla.form.getPossibleValue(e,["id","image_id","photo_id"]))){t='There is no "id"!';return[2,(salla.cart.event.imageNotDeleted(t),salla.api.errorPromise(t))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.deleteImage")];case 1:r=n.sent();return[2,this.request(["deleteImage",r,e]).then((function(t){return salla.cart.event.imageDeleted(t,e),t})).catch((function(t){throw salla.cart.event.imageNotDeleted(t,e),t}))]}}))}))};t.prototype.status=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n;return __generator(this,(function(i){switch(i.label){case 0:t=e;if(t)return[3,2];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.status")];case 1:t=i.sent();i.label=2;case 2:e=t;r=salla.helpers.hasApplePay();i.label=3;case 3:i.trys.push([3,5,,6]);return[4,salla.cart.event.submitting()];case 4:i.sent();return[3,6];case 5:n=i.sent();salla.log("Error on: salla.cart.event.submitting()");return[3,6];case 6:return[2,this.request(["status",e],{params:{has_apple_pay:r}})]}}))}))};t.prototype.submit=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:if(salla.config.isGuest())return[2,(salla.log("it looks that the current user is not logged-in, lets login then submit"),salla.cart.loginOnCartPage())];e=this.status;return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.submit")];case 1:e.apply(this,[t.sent()]).then((function(e){var t;var r=(t=e.data.next_step)===null||t===void 0?void 0:t.to;if(r||(window.history.pushState({},"",salla.url.addParamToUrl("reload","empty_next_step")),window.history.pushState({},"",salla.url.addParamToUrl("acitve",!1===e.data.active?"false":"true_or_undfined")),salla.cart.reset(),window.location.reload()),!["checkout","refresh","login"].includes(r)){var n="Can't find next_step );";throw salla.cart.reset(),salla.cart.event.submitFailed(n),n}return salla.cart.event.submitted(e),"login"===r?salla.cart.loginOnCartPage():"checkout"===r?window.location.href=e.data.next_step.url+(salla.helpers.hasApplePay()?"?has_apple_pay=true":""):(window.history.pushState({},"",salla.url.addParamToUrl("reload","refresh")),void window.location.reload())})).catch((function(e){var t,r;salla.cart.api.tries=salla.cart.api.tries||0,salla.cart.reset();var n=404===((r=(t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.data)===null||r===void 0?void 0:r.status);if(n&&0===salla.cart.api.tries)return salla.cart.api.tries++,salla.log("we recived that the current cart is not found, we will try to re-submit one more time"),salla.cart.submit();throw n&&salla.error(salla.lang.get("pages.checkout.try_again")),salla.cart.event.submitFailed(e),e}));return[2]}}))}))};t.prototype.getCartPayload=function(e){var t=(e===null||e===void 0?void 0:e.data)||("object"==typeof e?e:void 0);return e=t?salla.form.getPossibleValue(t,["prod_id","product_id","item_id","id"]):e,t="object"==typeof t?t:void 0,{id:e,payload:t}};t.prototype.normalRequest=function(t,r,n){var i=this;if(r===void 0){r=void 0}if(n===void 0){n=null}return e.prototype.normalRequest.call(this,t,r,n).catch((function(e){return __awaiter(i,void 0,void 0,(function(){var t;return __generator(this,(function(r){throw 403===((t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.status)&&(this.reset(),salla.error(salla.lang.get("pages.checkout.try_again"))),e}))}))}))};t.prototype.reset=function(){salla.api.cart.latestCart=null,salla.storage.remove("cart"),salla.cookie.clearCookieByPrefix(salla.api.cart.getCartCookiePrefix()),salla.cart.event.successReset()};t.prototype.addCoupon=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(n){switch(n.label){case 0:if(e=e.data||e,!(e=salla.form.getPossibleValue(e,["coupon"]))){t=new Error('There is no "Coupon Code"!');return[2,(t.name="EmptyCoupon",salla.event.cart.couponAdditionFailed(t),salla.api.errorPromise(t))]}return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.addCoupon")];case 1:r=n.sent();return[2,this.request(["addCoupon",r],{coupon:e}).then((function(e){return salla.event.cart.couponAdded(e,r),e})).catch((function(e){throw salla.event.cart.couponAdditionFailed(e,r),e}))]}}))}))};t.prototype.deleteCoupon=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.deleteCoupon")];case 1:e=t.sent();return[2,this.request(["deleteCoupon",e],{}).then((function(t){return salla.event.cart.couponDeleted(t,e),t})).catch((function(t){throw salla.event.cart.couponDeletionFailed(t,e),t}))]}}))}))};t.prototype.getQuickOrderSettings=function(){return this.request("getQuickOrderSettings").then((function(e){return salla.event.cart.quickOrderSettingFetched(e),e})).catch((function(e){throw salla.event.cart.quickOrderSettingFailed(e),e}))};t.prototype.createQuickOrder=function(e){return this.request("createQuickOrder",e).then((function(e){return salla.event.cart.quickOrderSucceeded(e),e})).catch((function(e){throw salla.event.cart.quickOrderFailed(e),e}))};t.prototype.priceQuote=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n,i;return __generator(this,(function(a){switch(a.label){case 0:if(!salla.config.isGuest())return[3,1];t=(salla.auth.api.setAfterLoginEvent("cart::priceQuote",e),void salla.event.dispatch("login::open"));return[3,4];case 1:r=this.request;n=["priceQuote"];i=e;if(i)return[3,3];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.priceQuote")];case 2:i=a.sent();a.label=3;case 3:t=r.apply(this,[n.concat([i])]).then((function(e){return salla.cart.api.reset(),salla.event.cart.priceQuoteSucceeded(e).then((function(){return setTimeout((function(){return window.location.href=salla.url.get("/")}),1e3),e}))})).catch((function(e){return salla.event.cart.priceQuoteFailed(e).then((function(){var t;throw 404===((t=e.error)===null||t===void 0?void 0:t.code)&&window.location.reload(),e}))}));a.label=4;case 4:return[2,t]}}))}))};t.prototype.loginOnCartPage=function(){salla.auth.setCanRedirect(!1),salla.event.dispatch("login::open",{withoutReload:!0}),salla.auth.event.onLoggedIn((function(){salla.event.dispatch("login::close"),salla.cart.submit()}))};t.prototype.set=function(e){salla.storage.set("cart",e),salla.api.cart.syncGuestCart()};t.prototype.offers=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.offers")];case 1:e=t.sent();return[2,this.request(["offers",e]).then((function(e){return salla.event.cart.offersFetched(e),e})).catch((function(e){throw salla.event.cart.offersFailed(e),e}))]}}))}))};t.prototype.getGiftCartDetails=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.getGiftCartDetails")];case 1:e=t.sent();return[2,this.request(["giftCartDetails",e]).then((function(t){return salla.product.event.giftFetched(t,e),t})).catch((function(t){throw salla.product.event.giftFetchFailed(t,e),t}))]}}))}))};t.prototype.addCartGiftToCart=function(e,t){if(t===void 0){t=!1}return __awaiter(this,void 0,void 0,(function(){var r;return __generator(this,(function(n){switch(n.label){case 0:return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.addCartGiftToCart")];case 1:r=n.sent();return[2,this.request(["cartGiftToCart",r],e).then((function(e){return salla.product.event.addGiftToCartSucceeded(e,r),t&&(window.location.href=e.redirect),e})).catch((function(e){throw salla.product.event.addGiftToCartFailed(e,r),e}))]}}))}))};t.prototype.syncGuestCart=function(){var e,t;return __awaiter(this,void 0,void 0,(function(){var r,n,i,a,o,s;return __generator(this,(function(l){switch(l.label){case 0:if(!salla.config.isGuest())return[2];r=salla.api.cart.getCartCookiePrefix(),n=salla.cookie.getCookieByPrefix(r),i=salla.storage.get("cart.id");if(!(!i&&n.length))return[3,4];l.label=1;case 1:l.trys.push([1,3,,4]);return[4,salla.api.cart.latest()];case 2:a=l.sent(),o=(t=(e=a.data)===null||e===void 0?void 0:e.cart)===null||t===void 0?void 0:t.id;o&&salla.api.cart.setCartCookie(r,o);return[3,4];case 3:s=l.sent();salla.log("Failed to fetch latest cart:",s);return[3,4];case 4:salla.cookie.clearCookieByPrefix(r),i&&(salla.config.set("headers.s-cart-id",i),salla.api.cart.setCartCookie(r,i));return[2]}}))}))};t.prototype.setCartCookie=function(e,t){salla.cookie.set("".concat(e,"-").concat(t),t,1)};t.prototype.getCartCookiePrefix=function(){return"cart-id-"+salla.config.get("store.id")};return t}(p);var f=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="loyalty",t.endpoints={getProgram:"loyalty",exchange:"loyalty/exchange",reset:"loyalty/exchange"},t.endpointsMethods={getProgram:"get",reset:"put"},t.after_init();return t}t.prototype.getProgram=function(){return this.request("getProgram").then((function(e){return salla.loyalty.event.programFetched(e),e})).catch((function(e){throw salla.loyalty.event.programNotFetched(e),e}))};t.prototype.exchange=function(e,t){if(t===void 0){t=null}return __awaiter(this,void 0,void 0,(function(){var r,n,i;return __generator(this,(function(a){switch(a.label){case 0:if(!(e=salla.form.getPossibleValue(e,["id","loyalty_prize_id","prize_id"]))){r="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.exchangeFailed(r),salla.api.errorPromise(r))]}n=t;if(n)return[3,2];return[4,salla.cart.getCurrentCartId(!1,"salla.api.loyalty.exchange")];case 1:n=a.sent();a.label=2;case 2:if(!(t=n)){i="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.exchangeFailed(i),salla.api.errorPromise(i))]}return[2,this.request("exchange",{loyalty_prize_id:e,cart_id:t}).then((function(t){return salla.loyalty.event.exchangeSucceeded(t,e),t})).catch((function(t){throw salla.loyalty.event.exchangeFailed(t,e),t}))]}}))}))};t.prototype.reset=function(e){if(e===void 0){e=null}return __awaiter(this,void 0,void 0,(function(){var t,r;return __generator(this,(function(n){switch(n.label){case 0:t=e;if(t)return[3,2];return[4,salla.cart.getCurrentCartId(!1,"salla.api.loyalty.reset")];case 1:t=n.sent();n.label=2;case 2:if(!(e=t)){r="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.resetFailed(r),salla.api.errorPromise(r))]}return[2,this.request("reset",{cart_id:e}).then((function(e){return salla.loyalty.event.resetSucceeded(e),e})).catch((function(e){throw salla.loyalty.event.resetFailed(e),e}))]}}))}))};return t}(p);var m=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="auth",t.canRedirect_=!0,t.afterLoginEvent={event:null,payload:null},t.endpoints={login:"auth/{type}/send_verification",resend:"auth/resend_verification",verify:"auth/{type}/verify",register:"auth/register",logout:"logout",refresh:"auth/refresh"},t.webEndpoints=["logout","auth/jwt","refresh"],t.endpointsMethods={logout:"get"},t.inIframe=salla.helpers.isIframe(),t.after_init();return t}t.prototype.setAfterLoginEvent=function(e,t){salla.api.auth.afterLoginEvent={event:e,payload:t}};t.prototype.setCanRedirect=function(e){salla.api.auth.canRedirect_=e};t.prototype.canRedirect=function(){return salla.api.auth.canRedirect_&&!salla.api.auth.afterLoginEvent.event};t.prototype.login=function(e){(e===null||e===void 0?void 0:e.data)&&(e=e.data);var t=salla.form.getPossibleValue(e,["type"]);if(!["email","mobile"].includes(t)){var r="Login type should be in: [email, mobile]";return salla.auth.event.codeNotSent(r),salla.api.errorPromise(r)}return this.request(["login",t],e).then((function(e){return salla.auth.event.codeSent(e,t),e})).catch((function(e){throw salla.auth.event.codeNotSent(e,t),salla.auth.api.trackBlockedError(e,"login"),e}))};t.prototype.verify=function(e,t){if(t===void 0){t=!0}return __awaiter(this,void 0,void 0,(function(){var r,n,i;return __generator(this,(function(a){switch(a.label){case 0:r=salla.form.getPossibleValue(e,["type"]);if(!r){n="Failed to know what's login type!";return[2,(salla.auth.event.verificationFailed(n),salla.api.errorPromise(n))]}t=!1!==salla.form.getPossibleValue(e,["supportWebAuth"])&&t,salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event);return[4,salla.auth.api.request(["verify",r],e)];case 1:i=a.sent();return[2,200!==(i===null||i===void 0?void 0:i.status)?(salla.auth.event.verificationFailed(i,r),salla.api.errorPromise(i)):salla.auth.api.handlAfterAuthenticatedResponse(i,t)]}}))}))};t.prototype.handlAfterAuthenticatedResponse=function(e,t){var r;return __awaiter(this,void 0,void 0,(function(){var n,i,a;return __generator(this,(function(o){switch(o.label){case 0:e.data||(e={data:e});n="authenticated"===((r=e.data)===null||r===void 0?void 0:r.case);n&&salla.auth.event.tokenFetched(e.data.token);i=t&&!this.inIframe&&!this.isSessionless();if(!i)return[3,2];return[4,salla.auth.api.request("auth/jwt",{callerName:"salla.auth.api.handlAfterAuthenticatedResponse"})];case 1:i=o.sent();o.label=2;case 2:i;a=n;if(!a)return[3,4];return[4,salla.auth.event.loggedIn(e).then((function(){return salla.auth.api.afterUserLogin()}))];case 3:a=o.sent();o.label=4;case 4:a;return[4,salla.auth.event.verified(e,e.data.verification.type)];case 5:return[2,(o.sent(),salla.api.successPromise(e))]}}))}))};t.prototype.resend=function(e){var t;return(e=e.data||e).type=e.type||"mobile","mobile"!==e.type||e.phone&&e.country_code?"email"!==e.type||e.email?this.request("resend",e).then((function(t){return salla.auth.event.codeSent(t,e),t})).catch((function(t){throw salla.auth.event.codeNotSent(t,e),salla.auth.api.trackBlockedError(t,"resend"),t})):(salla.auth.event.codeNotSent(t="There is no email!",e),salla.api.errorPromise(t)):(salla.auth.event.codeNotSent(t="There is no phone or country_code!",e),salla.api.errorPromise(t))};t.prototype.register=function(e){var t=this;var r;return e.data&&(r=e.element,e=e.data),salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event),this.request("register",e).then((function(e){return __awaiter(t,void 0,void 0,(function(){var t,n;var i;return __generator(this,(function(a){switch(a.label){case 0:salla.auth.event.registered.call(r,e);t="authenticated"===((i=e.data)===null||i===void 0?void 0:i.case);if(!t)return[3,3];salla.auth.event.tokenFetched(e.data.token);n=!this.inIframe&&!this.isSessionless();if(!n)return[3,2];return[4,salla.auth.request("auth/jwt",{callerName:"salla.auth.api.register"})];case 1:n=a.sent();a.label=2;case 2:t=(n,salla.auth.event.loggedIn(e),salla.auth.api.afterUserLogin());a.label=3;case 3:return[2,(t,e)]}}))}))})).catch((function(e){throw salla.auth.event.registrationFailed.call(r,e),salla.auth.api.trackBlockedError(e,"register"),e}))};t.prototype.handleIframeReadyAction=function(e,t){var r;(r=e.contentWindow)===null||r===void 0?void 0:r.postMessage({source:"logout",type:"init",data:{id:salla.config.get("store.id"),lang:"ar",appUrl:t,apiUrl:salla.config.get("store.api").replace(/\/+$/,""),settings:salla.config.all(),storage:{}}},"*")};t.prototype.appendIframeAndLogout=function(){var e=this;return new Promise((function(t){var r=salla.config.get("login.url","https://accounts.salla.com");var n=document.createElement("iframe");n.style.display="none",n.src="".concat(r,"/logout");var i=function(a){if("login"!==a.data.source)return;var o=a.data.type.replace("iframe::","");if(salla.log("iframe::logout-iframe message received",a.data),["logged-out","ready"].includes(o)){if("ready"===o)return e.handleIframeReadyAction(n,r);window.removeEventListener("message",i),n.remove(),t()}};window.addEventListener("message",i),document.body.appendChild(n)}))};t.prototype.logout=function(e){var t=this;if(e===void 0){e="twilight"}return salla.storage.clearAll(),salla.cookie.clearAll(),e=encodeURI(e),salla.auth.event.loggedOut().then((function(){return t.appendIframeAndLogout()})).then((function(){var t=salla.url.get("logout?from=".concat(e));console.log("Going to ".concat(t,", to do any thing before this action use: salla.auth.even.onLoggedOut(()=>{...})"));try{location.href=t}catch(e){salla.log(e)}})).catch((function(e){return console.error("Error during logout:",e)}))};t.prototype.refresh=function(){return this.request("refresh").then((function(e){return salla.auth.event.tokenFetched(e.data.token),e})).catch((function(e){throw salla.auth.event.refreshFailed(e),e}))};t.prototype.afterUserLogin=function(){this.afterLoginEvent.event&&salla.event.emit(this.afterLoginEvent.event,this.afterLoginEvent.payload)};t.prototype.isSessionless=function(){return"sessionless"===salla.config.get("auth.mode")};t.prototype.trackBlockedError=function(e,t){var r,n;blockedByProxy=void 0===((n=(r=e===null||e===void 0?void 0:e.response)===null||r===void 0?void 0:r.headers)===null||n===void 0?void 0:n["s-ray"]),blockedByProxy&&salla.analytics.track("BlockedByProxy",{class:"auth",function:t,reason:"non-server-request",message:e.message})};return t}(p);var v=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="order",t.endpoints={cancel:"orders/cancel/{id}",createCartFromOrder:"reorder/{id}",sendInvoice:"orders/send/{id}",fetch:"orders"},t.endpointsMethods={createCartFromOrder:"get",fetch:"get"},t.after_init();return t}t.prototype.show=function(e){var t=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["id","order_id"]);salla.event.dispatch("mobile::order.placed",{order_id:t}),location.href=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["url"])};t.prototype.cancel=function(e){return e=e||Salla.config.get("page.id"),this.request(["cancel",e],{params:{has_apple_pay:salla.helpers.hasApplePay()}}).then((function(t){return salla.event.order.canceled(t,e),t})).catch((function(t){throw salla.event.order.notCanceled(t,e),t}))};t.prototype.createCartFromOrder=function(e){return e=e||salla.config.get("page.id"),this.request(["createCartFromOrder",e]).then((function(t){return salla.cart.reset(),salla.event.order.orderCreated(t,e),window.location.href=t.data.url,t})).catch((function(t){throw salla.event.order.orderCreationFailed(t,e),t}))};t.prototype.sendInvoice=function(e){var t=salla.form.getPossibleValue(e,["id"])||salla.config.get("page.id");if(!t||isNaN(t)){var r="There is no id!";return salla.order.event.invoiceNotSent(r),salla.api.errorPromise(r)}return this.request(["sendInvoice",t],e).then((function(e){return salla.event.order.invoiceSent(e,t),e})).catch((function(e){throw salla.event.order.invoiceNotSent(e,t),e}))};t.prototype.fetch=function(e){return this.request(["fetch"],{params:e}).then((function(e){return salla.event.order.ordersFetched(e),e})).catch((function(e){throw salla.event.order.ordersNotFetched(e),e}))};return t}(p);var y=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="product",t.previousQuery="",t.endpoints={getPrice:"products/{id}/price",availabilitySubscribe:"products/{id}/availability-notify",search:"products/search",details:"products/{product_id}/details",categories:"products/categories/{?id}",offers:"products/{product_id}/specialoffer",getSizeGuides:"products/{prod_id}/size-guides",giftProductDetails:"products/{product_id}/buy-as-gift",productGiftToCart:"products/{product_id}/buy-as-gift",giftImage:"products/buy-as-gift/image",buyNow:"products/{product_id}/buy-now",fetch:"products",fetchOptions:"products/options"},t.endpointsMethods={details:"get",giftProductDetails:"get",fetch:"get",offers:"get",fetchOptions:"get"},t.after_init();return t}t.prototype.getPrice=function(e){var t=e.data||e,r=salla.form.getPossibleValue(t,["id","prod_id","product_id"]);return this.request(["getPrice",r],"object"==typeof t?t:void 0).then((function(e){return salla.product.event.priceUpdated(e,r),e})).catch((function(e){throw salla.product.event.priceUpdateFailed(e,r),e}))};t.prototype.categories=function(e){return this.request(["categories",e||""],null,"get").then((function(e){return salla.product.event.categoriesFetched(e),e})).catch((function(e){throw salla.product.event.categoriesFailed(e),e}))};t.prototype.availabilitySubscribe=function(e){var t=e.data||e;return e=salla.form.getPossibleValue(t,["id","prod_id"]),this.request(["availabilitySubscribe",e],"object"==typeof t?t:void 0).then((function(t){return salla.product.event.availabilitySubscribed(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribeFailed(t,e),t}))};t.prototype.search=function(e){var t;var r=e.data;if(r||(r={params:"string"==typeof e?{query:e}:e}),!(e=r instanceof FormData?r.get("query"):r.query||((t=r.params)===null||t===void 0?void 0:t.query))){var n='There is no "query"!';return salla.product.event.searchFailed(n),salla.api.errorPromise(n)}if(e===salla.api.product.previousQuery){var i="Query is same as previous one!";return salla.product.event.searchFailed(i),salla.api.product.previousQuery=null,salla.api.errorPromise(i)}return salla.api.product.previousQuery=e,this.request("search",r,"get").then((function(t){return salla.product.event.searchResults(t,e),t})).catch((function(t){throw salla.product.event.searchFailed(t,e),t}))};t.prototype.offers=function(e){if(!(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)|e,["product_id","id"]))){var t='There is no "product_id"!';return salla.product.event.fetchOffersFailed(t),salla.api.errorPromise(t)}return this.request(["offers",e]).then((function(t){return salla.product.event.offersFetched(t,e),t})).catch((function(t){throw salla.product.event.fetchOffersFailed(t,e),t}))};t.prototype.getSizeGuides=function(e){return this.request("products/".concat(e,"/size-guides"),null,"get").then((function(t){return salla.product.event.sizeGuideFetched(t,e),t})).catch((function(t){throw salla.product.event.sizeGuideFetchFailed(t,e),t}))};t.prototype.getGiftProductDetails=function(e){return this.request(["giftProductDetails",e]).then((function(t){return salla.product.event.giftFetched(t,e),t})).catch((function(t){throw salla.product.event.giftFetchFailed(t,e),t}))};t.prototype.getDetails=function(e,t){if(t===void 0){t=[]}if(!Array.isArray(t)){var r="withItems should be array.";return salla.product.event.detailFetchFailed(r),salla.api.errorPromise(r)}if(!e){var n="productId is not passed.";return salla.product.event.detailFetchFailed(n),salla.api.errorPromise(n)}return this.request(["details",e],{params:{with:t}}).then((function(t){return salla.product.event.detailFetched(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribeFailed(t,e),t}))};t.prototype.addProductGiftToCart=function(e,t,r){if(r===void 0){r=!1}return this.request(["productGiftToCart",e],t).then((function(t){return salla.product.event.addGiftToCartSucceeded(t,e),r&&(window.location.href=t.redirect),t})).catch((function(t){throw salla.product.event.addGiftToCartFailed(t,e),t}))};t.prototype.uploadGiftImage=function(e){return this.request("giftImage",e).then((function(e){return salla.product.event.giftImageUploadSucceeded(e),e})).catch((function(e){throw salla.product.event.giftImageUploadFailed(e),e}))};t.prototype.fetch=function(e){var t=this;if(!e.source){var r="Source cannot be empty. Please provide one.";return salla.product.event.productListFetchFailed(r),salla.api.errorPromise(r)}var n=!e.source_value,i="string"==typeof e.source_value&&"[]"===e.source_value,a=Array.isArray(e.source_value)&&!e.source_value.length;if((n||i||a)&&!["offers","latest","sales","wishlist","top-rated"].includes(e.source)){var o="Source value cannot be empty. Please provide one.";return salla.product.event.productListFetchFailed(o),salla.api.errorPromise(o)}if(["categories","brands","tags","selected"].includes(e.source)&&!Array.isArray(e.source_value)){var s="SourceValue type error. Expected an array.";return salla.product.event.productListFetchFailed(s),salla.api.errorPromise(s)}if("search"===e.source&&"string"!=typeof e.source_value){var l="SourceValue type error. Expected a string.";return salla.product.event.productListFetchFailed(l),salla.api.errorPromise(l)}if("related"===e.source&&isNaN(e.source_value)){var c="SourceValue type error. Expected a number.";return salla.product.event.productListFetchFailed(c),salla.api.errorPromise(c)}return this.request(this.endpoints.fetch,{params:e},"get").then((function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){return[2,(salla.product.event.productListFetchSucceeded(e),e)]}))}))})).catch((function(e){throw salla.product.event.productListFetchFailed(e),e}))};t.prototype.fetchOptions=function(e,t){if(t===void 0){t={}}if(!e||0===e.length){var r="At least one product ID is required. Please provide a valid list of product IDs.";return salla.product.event.productOptionsNotFetched(r),salla.api.errorPromise(r)}var n=t.with,i=n===void 0?[]:n,a={selected:e};return i.length>0&&(a.with=i),this.request(this.endpoints.fetchOptions,{params:a},"get").then((function(e){return salla.product.event.productOptionsFetched(e),e})).catch((function(e){throw salla.product.event.productOptionsNotFetched(e),e}))};return t}(p);var w=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="profile",t.endpoints={info:"auth/user",update:"profile/update",updateContacts:"profile/contacts/update",updateSettings:"profile/settings",verify:"profile/verify",delete:"profile"},t.endpointsMethods={delete:"delete"},t.after_init();return t}t.prototype.info=function(){return this.request("info",null,"get").then((function(e){var t={id:e.data.id,type:"user",email:e.data.email,mobile:e.data.phone.code+e.data.phone.number,country_code:e.data.phone.country,language_code:e.data.language,currency_code:e.data.currency,notifications:e.data.notifications,pending_orders:e.data.pending_orders,avatar:e.data.avatar,first_name:e.data.first_name,last_name:e.data.last_name,is_hidden_name:e.data.is_hidden_name,is_notifiable:e.data.is_notifiable,can_comment:salla.config.get("user.can_comment"),fetched_at:Date.now()};return salla.config.set("user",t),salla.storage.set("user",t),salla.profile.event.infoFetched(e),e})).catch((function(e){throw salla.profile.event.infoNotFetched(e),e}))};t.prototype.update=function(e){if(Salla.config.get("store.features").includes("sso-login")){var t="SSO login is enabled. You cannot update your profile.";return Salla.error(t),Promise.reject(new Error(t))}return this.request("update",e).then((function(e){return salla.profile.event.updated(e),e})).catch((function(e){throw salla.event.profile.updateFailed(e),e}))};t.prototype.updateContacts=function(e){return this.request("updateContacts",e).then((function(e){return salla.profile.event.verificationCodeSent(e),e})).catch((function(e){throw salla.event.profile.updateContactsFailed(e),e}))};t.prototype.verify=function(e){return this.request("verify",e).then((function(e){return salla.profile.event.verified(e),e})).catch((function(e){throw salla.event.profile.unverified(e),e}))};t.prototype.updateSettings=function(e){return this.request("updateSettings",e).then((function(e){return salla.event.profile.settingsUpdated(e),e})).catch((function(e){throw salla.event.profile.updateSettingsFailed(e),e}))};t.prototype.delete=function(){return this.request("delete").then((function(e){return salla.storage.clearAll(),salla.cookie.clearAll(),salla.auth.api.appendIframeAndLogout().then((function(){salla.event.profile.deleted(e),window.location.href=salla.url.get("logout")})),e})).catch((function(e){throw salla.event.profile.notDeleted(e),e}))};return t}(p);var b=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="comment",t.endpoints={addComment:"{type}/{id}/comments",comments:"/comments"},t.after_init();return t}t.prototype.add=function(e){if((e===null||e===void 0?void 0:e.data)&&(e=e.data),"string"==typeof(e=this.getCommentPayload(e,!0)))return salla.event.comment.additionFailed(e),salla.api.errorPromise(e);if(!e.comment){var t="can't find comment content!";return salla.event.comment.additionFailed(t),salla.api.errorPromise(t)}return this.request(["addComment","blog"==e.type?"blogs":e.type,e.id],{comment:e.comment}).then((function(t){return salla.event.comment.added(t,e.id),t})).catch((function(t){throw salla.event.comment.additionFailed(t,e.id),t}))};t.prototype.getCommentPayload=function(e,t){if(t===void 0){t=!1}var r={};if(["id","type","comment","per_page","page","sort"].forEach((function(t){var n=salla.form.getPossibleValue(e,[t]);n&&(r[t]=n)})),!t){var n=e.ids;if(n&&(r.ids=Array.isArray(n)?n:[n]),!r.ids||!r.ids.length)return"Failed to get ids!"}return r.type&&["products","pages","product","page","blogs","blog"].includes(r.type)?(r.type+=["product","page"].includes(r.type)?"s":"",r):"Failed to get type one of:(products, product, page, pages, blog, blogs)!"};t.prototype.fetchComments=function(e){if("string"==typeof(e=this.getCommentPayload(e)))return salla.event.comment.fetchFailed(e),salla.api.errorPromise(e);var t={per_page:e.per_page||5,page:e.page||1,type:e.type,ids:e.ids};return e.sort&&(t.sort=e.sort),this.request(["comments"],{params:t},"get").then((function(t){return salla.event.comment.fetched(t,e),t})).catch((function(t){throw salla.event.comment.fetchFailed(t,e),t}))};t.prototype.getComments=function(e,t,r,n,i){if(r===void 0){r=1}if(n===void 0){n=5}var a=Array.isArray(t)?t:[t];return this.fetchComments({ids:a,type:"".concat(e,"s"),page:r,per_page:n,sort:i})};return t}(p);var _=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="currency",t.endpoints={change:"/",list:"currencies"},t.endpointsMethods={change:"get",list:"get"},t.webEndpoints=["change"],t.after_init();return t}t.prototype.change=function(e){if(!(e=salla.form.getPossibleValue(e.data||e,["currency","code"]))){var t="Can't find currency code!";return salla.currency.event.failed(t),salla.api.errorPromise(t)}return this.request("change",{params:{change_currency:"",currency:e}}).then((function(t){return salla.cookie.set("fresh_summary",1),salla.storage.set("cart",""),salla.currency.event.changed(t,e),t})).catch((function(t){throw salla.currency.event.failed(t,e),t}))};t.prototype.list=function(){return this.request("list").then((function(e){return salla.currency.event.fetched(e),e})).catch((function(e){throw salla.currency.event.failedToFetch(e),e}))};return t}(p);var F=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="document";return t}t.prototype.reload=function(){window.location.reload()};return t}(p);var S=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="rating",t.endpoints={store:"rating/store",products:"rating/products",shipping:"rating/shipping",order:"rating/{order_id}"},t.endpointsMethods={order:"get"},t.after_init();return t}t.prototype.order=function(e){var t="object"==typeof e?e:{},r=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["order_id","id"]);if(!r){var n='There is no "order_id"!';return salla.event.rating.orderNotFetched(n),salla.api.errorPromise(n)}return this.request(["order",r],t).then((function(e){return salla.event.rating.orderFetched(e,r),e})).catch((function(e){throw salla.event.rating.orderNotFetched(e,r),e}))};t.prototype.store=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.storeFailed(t),salla.api.errorPromise(t)}return this.request("store",e).then((function(t){return salla.event.rating.storeRated(t,e),t})).catch((function(t){throw salla.event.rating.storeFailed(t,e),t}))};t.prototype.products=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.productsFailed(t),salla.api.errorPromise(t)}return this.request("products",e).then((function(t){return salla.event.rating.productsRated(t,e),t})).catch((function(t){throw salla.event.rating.productsFailed(t,e),t}))};t.prototype.shipping=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.shippingFailed(t),salla.api.errorPromise(t)}return this.request("shipping",e).then((function(t){return salla.event.rating.shippingRated(t,e),t})).catch((function(t){throw salla.event.rating.shippingFailed(t,e),t}))};return t}(p);var C=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="wishlist",t.endpoints={add:"products/favorites/{id}",remove:"products/favorites/{id}"},t.endpointsMethods={remove:"delete"},t.after_init();return t}t.prototype.toggle=function(e){return salla.storage.get("salla::wishlist",[]).includes(e)?this.remove(e):this.add(e)};t.prototype.add=function(e){var t=this;var r;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(r=salla.lang.get("common.messages.must_login")),salla.error(r),salla.api.errorPromise(r)):(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["product_id","id"]))?this.request(["add",e]).then((function(r){return t.updateWishlistStorage(e),salla.wishlist.event.added(r,e),r})).catch((function(t){throw salla.wishlist.event.additionFailed(t,e),t})):(salla.wishlist.event.additionFailed(r="Failed to get product id!"),salla.api.errorPromise(r))};t.prototype.remove=function(e){var t=this;var r;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(r=salla.lang.get("common.messages.must_login")),salla.error(r),salla.api.errorPromise(r)):(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["product_id","id"]))?this.request(["remove",e]).then((function(r){return t.updateWishlistStorage(e,!1),salla.wishlist.event.removed(r,e),r})).catch((function(t){throw salla.wishlist.event.removingFailed(t,e),t})):(salla.wishlist.event.removingFailed(r="Failed to get id!"),salla.api.errorPromise(r))};t.prototype.updateWishlistStorage=function(e,t){if(t===void 0){t=!0}var r=salla.storage.get("salla::wishlist",[]);t?r.push(e):r.splice(r.indexOf(e),1),salla.storage.set("salla::wishlist",r)};return t}(p);var k=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="scopes",t.endpoints={get:"scopes",change:"scopes",getProductAvailability:"scopes/availability?product_id={id}"},t.after_init();return t}t.prototype.get=function(){return this.request("scopes",null,"get").then((function(e){return salla.scope.event.fetched(e),e})).catch((function(e){throw salla.scope.event.notFetched(e),e}))};t.prototype.change=function(e){return this.request("scopes",e).then((function(e){return salla.scope.event.changeSucceeded(e),e})).catch((function(e){throw salla.scope.event.changeFailed(e),e}))};t.prototype.getProductAvailability=function(e){if(e===void 0){e=null}return this.request("scopes/availability?product_id=".concat(e),null,"get").then((function(t){return salla.scope.event.productAvailabilityFetched(t,e),t})).catch((function(e){throw salla.scope.event.productAvailabilityNotFetched(e),e}))};return t}(p);var P=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.endpoints={add:"cart/booking/product/{id}"},t.endpointsMethods={add:"get"};return t}t.prototype.add=function(e,t){if(t===void 0){t=!0}return __awaiter(this,void 0,void 0,(function(){var r;return __generator(this,(function(n){if(!e){r="Please provide product id.";return[2,(salla.booking.event.additionFailed(r),salla.api.errorPromise(r))]}return[2,this.request(["add",e]).then((function(e){return salla.booking.event.added(e),t&&"booking"===e.data.redirect.to&&(window.location.href=e.data.redirect.url),e})).catch((function(e){throw salla.booking.event.additionFailed(e),e}))]}))}))};return t}(p);var q=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="landing",t.endpoints={getDetails:"landing/{landing_page_id}",createCartFromPage:"landing/{landing_page_id}",breadcrumbs:"breadcrumbs"},t.endpointsMethods={getDetails:"get",breadcrumbs:"get"},t.after_init();return t}t.prototype.getDetails=function(e){if(!e){var t="page landing id not passed";return salla.event.landing.getDetailsFailed(t),salla.api.errorPromise(t)}return this.request(["getDetails",e]).then((function(t){return salla.event.landing.detailsFetched(t,e),t})).catch((function(t){throw salla.event.landing.getDetailsFailed(t,e),t}))};t.prototype.createCartFromPage=function(e){if(!e){var t="page landing id not passed";return salla.event.landing.orderCreationFailed(t),salla.api.errorPromise(t)}return salla.config.isGuest()?(salla.auth.api.setAfterLoginEvent("landing::createCartFromPage",e),salla.event.dispatch("login::open"),salla.api.successPromise("")):this.request(["createCartFromPage",e]).then((function(t){return salla.event.landing.orderCreated(t,e).then((function(){return location.href=t.data.url})),t})).catch((function(t){throw salla.event.landing.orderCreationFailed(t,e),t}))};t.prototype.fetchBreadcrumbs=function(e){if(!e.page){var t="The 'page' parameter is required for the Breadcrumb API. Please provide a valid 'page' parameter.";return salla.event.landing.breadcrumbFetchFailed(t),salla.api.errorPromise(t)}if("product.single"===e.page&&!e.id&&!e.parent_id){var r="The 'id' and 'parent_id' parameters are required when the 'page' parameter is set to 'product.single'. Please provide valid values for both parameters.";return salla.event.landing.breadcrumbFetchFailed(r),salla.api.errorPromise(r)}if(["product.index","customer.orders.single","product.index.tag","page-single","landing-page","brands.single","blog.single","blog.index.author","blog.index.category","blog.index.tag"].includes(e.page)&&!e.id){var n="The 'id' parameter is required when the 'page' parameter is set to ".concat(e.page,". Please provide valid value for the 'ID' parameter.");return salla.event.landing.breadcrumbFetchFailed(n),salla.api.errorPromise(n)}return this.request("breadcrumbs",{params:e}).then((function(e){return salla.event.landing.breadcrumbFetched(e),e})).catch((function(e){throw salla.event.landing.breadcrumbFetchFailed(e),e}))};return t}(p);var A=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="notifications",t.endpoints={fetch:"notifications"},t.endpointsMethods={fetch:"get"},t.after_init();return t}t.prototype.fetch=function(e){return this.request(["fetch"],{params:e}).then((function(e){return salla.event.notifications.fetched(e),e})).catch((function(e){throw salla.event.notifications.fetchFailed(e),e}))};return t}(p);var x=function(){function e(){var e=this;this.inIframe=salla.helpers.isIframe(),salla.event.on("twilight::before.ready",(function(t){return __awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.initiateRequest(t)];case 1:return[2,e.sent()]}}))}))})),salla.event.on("profile::info.fetched",(function(t){return e.setCurrencyAndLanguage(t)})),salla.event.on("auth::token.fetched",(function(t){salla.storage.set("token",t),e.inIframe&&salla.log("token fetched iframe"),e.inIframe&&salla.cookie.set("s-token",t,60),e.setToken(t)})),salla.event.on("auth::token.invalid",(function(){salla.storage.remove("user"),salla.storage.remove("token")})),this.notifier_handler_disabled=!1,this.axios=axios.create({baseURL:Salla.config.get("store.api",Salla.config.get("store.url")),headers:{common:{"X-Requested-With":"XMLHttpRequest","S-SOURCE":"twilight","S-APP-VERSION":"v2.0.0","S-APP-OS":"browser","cache-control":"no-cache"}}}),Salla.onReady((function(){Salla.helpers.url.is_page("cart")&&Salla.config.set("store.settings.use_sar_symbol",!1)})),this.axios.interceptors.request.use((function(e){return"preview"===Salla.config.get("theme.mode")&&(e.url=Salla.url.addParamToUrl("use_username_url",1,e.url)),["coupon","price","item"].some((function(t){return e.url.includes(t)}))&&!e.url.includes("add")&&Salla.config.set("store.settings.use_sar_symbol",!1),e}),(function(e){return Promise.reject(e)}))}e.prototype.getHeaders=function(){return this.axios.defaults.headers.common};e.prototype.getHeader=function(e){var t;return(t=Object.entries(this.getHeaders()).filter((function(t){var r=t[0],n=t[1];return r.toLowerCase()===e.toLowerCase()}))[0])===null||t===void 0?void 0:t[1]};e.prototype.setHeaders=function(e){var t=this;return Object.entries(e).forEach((function(e){return t.setHeader(e[0],e[1])})),this};e.prototype.setHeader=function(e,t){return salla.infiniteScroll.fetchOptions.headers[e]=this.axios.defaults.headers.common[e]=t,this};e.prototype.withoutNotifier=function(e){return __awaiter(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(r){switch(r.label){case 0:this.notifier_handler_disabled=!0;return[4,e().finally((function(){t.notifier_handler_disabled=!1}))];case 1:return[2,r.sent()]}}))}))};e.prototype.initiateRequest=function(e){var t,r,n;return __awaiter(this,void 0,void 0,(function(){var i,a;return __generator(this,(function(o){switch(o.label){case 0:this.axios.defaults.baseURL=Salla.config.get("store.api",Salla.config.get("store.url")),this.setHeaders(__assign({"Store-Identifier":Salla.config.get("store.id"),currency:((t=e.user)===null||t===void 0?void 0:t.currency_code)||"SAR","accept-language":salla.lang.getLocale(),"s-user-id":(r=e.user)===null||r===void 0?void 0:r.id,"s-country":(n=e.user)===null||n===void 0?void 0:n.country_code},e.headers||{}));i=Salla.storage.get("scope",Salla.config.get("store.scope"));i&&this.setHeaders({"s-scope-type":i.type,"s-scope-id":i.id});a=Salla.storage.session.get("s-utms");a&&this.setHeaders(a);return[4,this.injectTokenToTheRequests(e)];case 1:o.sent(),salla.storage.get("affiliate_code")&&this.setHeader("s-affiliate-code",salla.storage.get("affiliate_code"));return[2]}}))}))};e.prototype.injectTokenToTheRequests=function(e){var t,r;return __awaiter(this,void 0,void 0,(function(){var n,i,a,o,s,l,c,u,d,f,p;var h=this;return __generator(this,(function(v){switch(v.label){case 0:n=salla.storage.get("token"),i="guest"===((t=e.user)===null||t===void 0?void 0:t.type),a=parseInt(((r=e.user)===null||r===void 0?void 0:r.id)||0),o=parseInt(salla.storage.get("user.id")||0),s=salla.auth.api.isSessionless(),l=function(e){h.setToken(e),salla.event.emit("api::initiated")},c=function(){return __awaiter(h,void 0,void 0,(function(){var e;var t=this;return __generator(this,(function(r){switch(r.label){case 0:if(!(i||s||!a))return[3,1];e=salla.auth.event.tokenInvalid();return[3,3];case 1:salla.log("Api:: case 1 => current is is guest & web session available");return[4,salla.auth.api.refresh().then((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,salla.profile.info()];case 1:e.sent();return[2]}}))}))})).catch((function(){return salla.auth.event.tokenInvalid()}))];case 2:e=r.sent();r.label=3;case 3:e;return[2]}}))}))};if(!!n)return[3,2];salla.log("Api:: case 1 => current is is guest");return[4,c()];case 1:return[2,void v.sent()];case 2:d=jwtDecode(n);if(!(Date.now()/1e3>d.exp))return[3,4];salla.log("Api:: case 2 => current user is logged-in and there is a token, but it's expired");return[4,c()];case 3:f=void v.sent();return[3,8];case 4:u=s?parseInt(d.sub)!==o:!o||!a||o!==a||parseInt(d.sub)!==a;if(!u)return[3,6];salla.log("Api:: case 3 => there is a token and user in session/local missing or mismatch"),salla.log("sub:".concat(d.sub," userIdInWeb:").concat(a," userIdInStorage:").concat(o,", isSessionless:").concat(s),d.sub,a,o),this.setHeader("Authorization","Bearer "+n);return[4,salla.profile.info().then((function(e){return __awaiter(h,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=!this.inIframe&&!s;if(!e)return[3,2];return[4,salla.auth.api.request("auth/jwt",{callerName:"salla.auth.request.injectTokenToTheRequests"})];case 1:e=t.sent();t.label=2;case 2:e,l(n);return[2]}}))}))})).catch((function(){salla.log("Api:: case 3 => failed get fresh profile"),h.setHeader("Authorization",null),salla.auth.event.tokenInvalid()}))];case 5:p=void v.sent();return[3,7];case 6:p=(salla.log("Api:: case 4 => current user is logged-in and there is a token, and it's not expired"),void l(n));v.label=7;case 7:f=p;v.label=8;case 8:return[2,f]}}))}))};e.prototype.setToken=function(e){return this.setHeader("Authorization","Bearer "+e),salla.event.emit("api::token.injected",e),this.token=e,this};e.prototype.setCurrencyAndLanguage=function(e){return this.setHeaders({currency:e.data.currency,"accept-language":e.data.language})};e.prototype.request=function(e,t,r,n){var i=this;if(t===void 0){t=void 0}if(r===void 0){r="get"}if(n===void 0){n={}}var a={endPoint:e,payload:t,method:r,options:n},o="undefined"!=typeof event?event.currentTarget:null,s=!1;return"SALLA-BUTTON"===(o===null||o===void 0?void 0:o.tagName)&&(s=!0),s&&(o===null||o===void 0?void 0:o.load()),this.axios[a.method](a.endPoint,a.payload,a.options).then((function(e){return s&&(o===null||o===void 0?void 0:o.stop()),e.data&&e.request&&(e=e.data),i.handleAfterResponseActions(e),e})).catch((function(e){throw s&&(o===null||o===void 0?void 0:o.stop()),salla.event.document.requestFailed(a,e),i.handleErrorResponse(e),e}))};e.prototype.handleAfterResponseActions=function(e){if(!e)return;var t=e.data,r=e.googleTags,n=r===void 0?null:r,i=t&&t.googleTags?t.googleTags:n;try{dataLayer&&i&&dataLayer.push(i)}catch(e){salla.logger.error(e.message)}this.fireEventsForResponse(e),this.showAlert(e)};e.prototype.fireEventsForResponse=function(e){var t,r;var n=(e===null||e===void 0?void 0:e.events)||((t=e.data)===null||t===void 0?void 0:t.events)||((r=e.error)===null||r===void 0?void 0:r.events);"string"==typeof n&&(n=JSON.parse(n)),n&&Object.keys(n).forEach((function(e){return salla.event.dispatch(e,n[e])}))};e.prototype.handleErrorResponse=function(e){if(e.response&&e.response.data)return e.response.data.error&&e.response.data.error.fields&&!this.notifier_handler_disabled?this.handleInvalidFields(e):this.handleAfterResponseActions(e.response.data)};e.prototype.showAlert=function(e){var t,r;if(e&&!this.notifier_handler_disabled)return e.case&&e.msg?salla.notify.fire(e.msg,e.case,e):e.hasOwnProperty("success")&&((t=e.data)===null||t===void 0?void 0:t.message)?salla.notify.fire((r=e.data)===null||r===void 0?void 0:r.message,e.success?salla.notify.types.success:salla.notify.types.error,e):e.error&&e.error.message&&"FORBIDDEN"!==e.error.message?salla.error(e.error.message,e):void 0};e.prototype.handleInvalidFields=function(e){var t=e.response.data.error.fields,r=[];Object.keys(t).forEach((function(e){var n=t[e];Array.isArray(n)?n.forEach((function(e){return r.push(e)})):r.push(n)}));var n=(r.length>1?"* ":"")+r.join("\n* ");salla.error(n,e)};e.prototype.isFastRequestsAllowed=function(){return Salla.config.get("fastRequests")};e.prototype.promise=function(e,t){if(t===void 0){t=!0}return new Promise((function(r,n){return t?r(e):n(e)}))};e.prototype.errorPromise=function(e){return this.promise(e,!1)};e.prototype.successPromise=function(e){return this.promise(e,!0)};return e}();var E=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="component",t.endpoints={getMenus:"menus/{headOrFoot}?store_id={store}&lang={lang}",reviews:"reviews"},t.endpointsMethods={getMenus:"get",reviews:"get"};return t}t.prototype.getMenus=function(e){if(e===void 0){e="header"}return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.request(["getMenus",e,salla.config.get("store.id"),salla.lang.getLocale()]).then((function(e){return salla.event.component.menuFetched(e),e})).catch((function(e){throw salla.event.component.menuFetchFailed(e),e}))]}))}))};t.prototype.getReviews=function(e){var t=e.per_page,r=t===void 0?5:t,n=e.type,i=n===void 0?"all":n,a=e.items;return __awaiter(this,void 0,void 0,(function(){var e,t,n,o,s;return __generator(this,(function(l){if(!i){e="Review type cannot be empty. Please provide one.";return[2,(salla.event.component.reviewsFetchFailed(e),salla.api.errorPromise(e))]}t=!a||"string"==typeof a&&"[]"===a||Array.isArray(a)&&!a.length;if(!new Set(["all","store","categories","products","json"]).has(i)){n="Invalid review type. Please provide a valid type.";return[2,(salla.event.component.reviewsFetchFailed(n),salla.api.errorPromise(n))]}if("all"!==i&&"store"!==i&&t){o="Items cannot be empty. Please provide one.";return[2,(salla.event.component.reviewsFetchFailed(o),salla.api.errorPromise(o))]}if(new Set(["products","categories"]).has(i)&&!Array.isArray(a)){s="Items value must be an array of ".concat(i," id for review type of ").concat(i,".");return[2,(salla.event.component.reviewsFetchFailed(s),salla.api.errorPromise(s))]}return[2,this.request(["reviews"],{params:{per_page:r,type:i,items:a}},"get").then((function(e){return salla.event.component.reviewsFetched(e),e})).catch((function(e){throw salla.event.component.reviewsFetchFailed(e),e}))]}))}))};return t}(p);var I=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.endpoints={fetch:"advertisements"},t.endpointsMethods={fetch:"get"};return t}t.prototype.fetch=function(e){if(e===void 0){e=null}return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(r){t=e?{page:e}:{};return[2,this.request(["fetch"],{params:t}).then((function(e){return salla.event.advertisement.fetched(e),e})).catch((function(e){throw salla.event.advertisement.fetchFailed(e),e}))]}))}))};return t}(p);var T=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="navigation",t.endpoints={breadcrumbs:"breadcrumbs"},t.endpointsMethods={breadcrumbs:"get"},t.after_init();return t}t.prototype.fetchBreadcrumbs=function(e){if(!e.page){var t="The 'page' parameter is required for the Breadcrumb API. Please provide a valid 'page' parameter.";return salla.event.navigation.breadcrumbFetchFailed(t),salla.api.errorPromise(t)}if(["product.single","product.index","customer.orders.single","product.index.tag","page-single","landing-page","brands.single","blog.single","blog.index.author","blog.index.category","blog.index.tag"].includes(e.page)&&!e.id){var r="The 'id' parameter is required when the 'page' parameter is set to ".concat(e.page,". Please provide valid value for the 'ID' parameter.");return salla.event.navigation.breadcrumbFetchFailed(r),salla.api.errorPromise(r)}return this.request("breadcrumbs",{params:e}).then((function(e){return salla.event.navigation.breadcrumbFetched(e),e})).catch((function(e){throw salla.event.navigation.breadcrumbFetchFailed(e),e}))};return t}(p);var L=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="metadata",t.endpoints={fetchValues:"https://api.salla.dev/store/v1/metadata/values"},t.endpointsMethods={fetchValues:"get"};return t}t.prototype.fetchValues=function(e,t){return __awaiter(this,void 0,void 0,(function(){var r,n;return __generator(this,(function(i){if(!e||!t){r="Please provide entity type and entity ids.";return[2,(salla.metadata.event.valueNotFetch(r),salla.api.errorPromise(r))]}n={type:e,entities:Array.isArray(t)?t:[t]};return[2,this.request(this.endpoints.fetchValues,{params:n},"get").then((function(e){return salla.metadata.event.valueFetched(e),e})).catch((function(e){throw salla.metadata.event.valueNotFetch(e),e}))]}))}))};return t}(p);var R=function(){function e(e){var t,r,n;"ready"!==W$3.status?e?(W$3.config.merge(e),["salla.sa","salla.group"].includes(location.hostname)&&!((t=W$3.config.get("store.url"))===null||t===void 0?void 0:t.includes(location.hostname))&&W$3.config.get("store.username")&&W$3.config.set("store.url",window.location.origin+"/"+W$3.config.get("store.username")),(e===null||e===void 0?void 0:e.events)&&W$3.event.dispatchEvents(e===null||e===void 0?void 0:e.events),e._token&&salla.api.setHeader("X-CSRF-TOKEN",e._token),this.injectMaintenanceAlert(),this.injectTemplateStoreAlert(),this.injectThemePreviewAlert(),this.injectAppInstallAlert(),this.applyContentCopyright(),this.injectEditAlert(),((r=e===null||e===void 0?void 0:e.user)===null||r===void 0?void 0:r.language_code)&&salla.lang.setLocale((n=e===null||e===void 0?void 0:e.user)===null||n===void 0?void 0:n.language_code),salla.lang.loadStoreTranslations(),this.setSallaReady(e)):this.setSallaReady(e):salla.log("Trying to re-initiate Salla, while its status === 'ready'!")}e.prototype.applyContentCopyright=function(){if(!salla.config.get("store.settings.content_copyright"))return;["contextmenu","selectstart","copy"].forEach((function(e){document.addEventListener(e,(function(e){return e.preventDefault()}))})),document.addEventListener("keydown",(function(e){var t=e.key.toLowerCase();("f12"===t||e.ctrlKey&&e.shiftKey&&["i","j","c"].includes(t)||e.ctrlKey&&"u"===t)&&(e.preventDefault(),e.stopPropagation())}));var e=document.createElement("style");e.textContent="\n body {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n img {\n pointer-events: none;\n -webkit-user-drag: none;\n }\n ",document.head.appendChild(e)};e.prototype.injectMaintenanceAlert=function(){salla.config.get("maintenance")&&(document.body.classList.add("has-maintenance-bar"),document.querySelector("salla-maintenance-alert")?salla.logger.warn("salla-maintenance-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.prepend(document.createElement("salla-maintenance-alert"))})))};e.prototype.injectTemplateStoreAlert=function(){salla.config.get("store.template")&&(document.body.classList.add("has-bottom-alert"),document.querySelector("salla-bottom-alert")?salla.logger.warn("salla-bottom-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.append(document.createElement("salla-bottom-alert"))})))};e.prototype.injectAppInstallAlert=function(){salla.config.get("store.app_install_prompt")&&salla.config.get("store.apps")&&!salla.storage.get("app_install_prompt_disabled")&&(document.body.classList.add("has-app-install-alert"),document.querySelector("salla-app-install-alert")?salla.logger.warn("salla-app-install-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.append(document.createElement("salla-app-install-alert"))})))};e.prototype.injectThemePreviewAlert=function(){"preview"===salla.config.get("theme.mode")&&(document.body.classList.add("has-preview-bar"),document.querySelector("#s-theme_preview_bar")?salla.logger.warn("#s-theme_preview_bar element Existed before!"):salla.lang.onLoaded((function(){var e=document.createElement("div");e.id="s-theme_preview_bar",e.setAttribute("style","display: flex; justify-content: space-between; text-align: center; background-color: #232323; color: #fff; padding: 10px; font-size: 0.875rem; line-height: 1.25rem; position: relative;"),e.innerHTML='\n <div style="display:flex; align-items:center;">\n <img width="32" src="https://cdn.salla.network/images/logo/logo-light.svg">\n <span style="margin:0 10px;">'.concat(salla.lang.get("blocks.header.preview_mode"),': <span style="background:rgba(255,255,255,0.25);border-radius:15px; padding:2px 15px 4px">').concat(salla.config.get("theme.name"),'</span></span>\n </div>\n <a href="').concat(salla.url.get("preview_theme/cancel/preview"),'" style="line-height:32px; width:32px;"><i class="sicon-cancel"></i></a>\n '),document.body.prepend(e)})))};e.prototype.injectEditAlert=function(){var e=salla.config.get("edit");e&&(document.querySelector("#s-edit-alert")?salla.logger.warn("#s-edit-alert element Existed before!"):salla.lang.onLoaded((function(){var t=document.createElement("div");t.id="s-edit-alert",t.innerHTML='\n <a href="'.concat(e,'" style="display:block; background-color:').concat(salla.config.get("theme.color.primary","#5cd5c4"),"; color:").concat(salla.config.get("theme.color.reverse","#fff"),'; padding: 10px; text-align:center; font-size: 0.875rem; line-height: 1.25rem;">\n <i class="sicon-edit"></i> \n ').concat(salla.lang.get("pages.products.quick_edit"),"\n </a>\n "),document.body.prepend(t)})))};e.prototype.handleElementAjaxRequest=function(e,t){var r=this;if(!(t instanceof HTMLFormElement||t instanceof HTMLAnchorElement))return salla.logger.warn("trying to call ajax from non Element!!"),!1;e.preventDefault();var n=t.getAjaxFormData(e),i=n.method?n.method.toLowerCase():void 0;salla.api.request(n.url,n.formData,i).then((function(e){return e.data&&e.request&&(e=e.data),salla.api.handleAfterResponseActions(e),r.callAjaxEvent(n.events.success,e,n.formData),e})).catch((function(e){throw salla.api.handleErrorResponse(e),r.callAjaxEvent(n.events.fail,e,n.formData),e}))};e.prototype.callAjaxEvent=function(e,t,r){if(e){if(r instanceof FormData){var n={};Array.from(r.entries()).forEach((function(e){n[e[0]]=e[1]})),r=n}window[e]?window[e](t,r):salla.event.dispatch(e,t,r)}};e.prototype.setSallaReady=function(e){this.storeUTMs(),W$3.event.emitAsync("twilight::before.ready",e),W$3.status="ready",W$3.event.dispatch("twilight::initiated",e),window.dispatchEvent(new CustomEvent("twilight::initiated",{detail:e}))};e.prototype.storeUTMs=function(){var e={fbclid:"facebook",gad_source:"google",ttclid:"tiktok",twclid:"twitter",scid:"snapchat"},t=["fbclid","gad_source","ttclid","twclid","scid"],r=__spreadArray(["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],t,true),n={},i={};window.location.search.replace("?","").split("&").map((function(e){return e.split("=")})).filter((function(e){var t=e[0];return r.includes(t.toLowerCase())})).forEach((function(e){var t=e[0],r=e[1];return n[t.toLowerCase()]=r}));var a=t.find((function(e){return n[e]}));!n.utm_source&&a&&(n.utm_source=e[a],n.utm_campaign=n.utm_campaign||"Using the CLICKID ".concat(a," provided by ").concat(n.utm_source),n.utm_term=n.utm_term||"".concat(a,": ").concat(n[a])),n.utm_source&&(Object.entries(n).filter((function(e){var r=e[0];return!t.includes(r)})).forEach((function(e){var t=e[0],r=e[1];return i["s-".concat(t.replace("_","-"))]=r})),i["s-utm-referrer"]=document.referrer,salla.storage.session.set("s-utms",i),this.logUTMVisitData(i))};e.prototype.logUTMVisitData=function(e){return __awaiter(this,void 0,void 0,(function(){var t,r,n;return __generator(this,(function(i){t=e["s-utm-source"],r=e["s-utm-medium"],n=e["s-utm-campaign"];e&&"affiliate"===t&&r&&n&&fetch(salla.config.get("affiliate.utm_url"),{method:"POST",mode:"cors",headers:{"Content-Type":"application/json","s-utm-source":t,"s-utm-medium":r,"s-utm-campaign":n}}).then((function(e){if(e.ok){var t=new URL(window.location.href),r=window.history.state;t.searchParams.delete("utm_source"),t.searchParams.delete("utm_medium"),t.searchParams.delete("utm_campaign"),window.history.replaceState(r,"",t)}}));return[2]}))}))};return e}();var O=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){return{event:"Product Added",properties:{cart_id:this.item.cart_id,product_id:this.item.id,category:this.item.category,name:this.item.name,brand:this.item.brand,variant:this.item.variant,price:this.item.price,quantity:this.item.quantity,sku:this.item.sku,coupon:this.item.coupon,position:this.item.position,url:this.item.url,image_url:this.item.image_url}}};e.shouldSend=function(){return"customer.wishlist"!==salla.config.get("page.slug")};return e}();var D=function(){function e(e){this.product=e[0]}e.prototype.toSegment=function(){return{event:"Product Viewed",properties:{product_id:this.product.id,category:this.product.category,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:this.product.quantity,currency:this.product.currency,coupon:this.product.coupon,position:this.product.position,value:this.product.value,sku:this.product.sku,url:this.product.url,image_url:this.product.image_url}}};return e}();var j=function(){function e(e){this.cart=e[0]}e.prototype.toSegment=function(){var e;return{event:"Cart Viewed",properties:{cart_id:(e=this.cart.cart_id)===null||e===void 0?void 0:e.toString(),products:this.cart.products.map((function(e){var t;return{product_id:(t=e.id)===null||t===void 0?void 0:t.toString(),name:e.name,price:e.price,category:e.category,sku:e.sku,position:e.position,url:e.url,image_url:e.image_url}}))}}};return e}();var N=function(){function e(e){var t=e===null||e===void 0?void 0:e.nextPage;if(this.listId=null,"index"===salla.config.get("page.slug"))this.listId="home_page";else if(t){var r=new URL(t),n=r.searchParams.get("source"),i=r.searchParams.getAll("source_value[]");this.listId="".concat(n,"_").concat(i.join("_"))}this.products=e===null||e===void 0?void 0:e.data}e.prototype.toSegment=function(){return{event:"Product List Viewed",properties:{list_id:this.listId,category:salla.config.get("page.title"),products:this.products.map((function(e){var t,r,n;return{product_id:e.id,category:(t=e.category)===null||t===void 0?void 0:t.name,name:e.name,brand:(r=e.brand)===null||r===void 0?void 0:r.name,variant:e.variant,price:e.price,quantity:Number(e.quantity),sku:e.sku,position:0,url:e.url,image_url:(n=e.image)===null||n===void 0?void 0:n.url}}))}}};e.shouldSend=function(){return!["index","customer.wishlist"].includes(salla.config.get("page.slug"))};return e}();var U=function(){function e(e){this.query=e}e.prototype.toSegment=function(){return{event:"Products Searched",properties:{query:this.query}}};return e}();var M=function(){function e(){}e.prototype.toSegment=function(){return{event:"Signed Up",properties:{context:{traits:Salla.config.get("user")}}}};e.shouldSend=function(){return"user"===Salla.config.get("user.type")||(Salla.profile.event.onInfoFetched((function(){return Salla.event.emit("Signed Up")})),!1)};return e}();var V=function(){function e(){}e.prototype.toSegment=function(){return{event:"Signed In",properties:{context:{traits:Salla.config.get("user")}}}};e.shouldSend=function(){return"user"===Salla.config.get("user.type")||(Salla.profile.event.onInfoFetched((function(){return Salla.event.emit("Signed In")})),!1)};return e}();var $=function(){function e(e){}e.prototype.toSegment=function(){return{event:"Signed Out",properties:{}}};return e}();var G=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){var e,t,r,n,i,a,o,s,l,c,u,d,f;return{event:"Product Removed",properties:{cart_id:(e=this.item)===null||e===void 0?void 0:e.cart_id,product_id:(t=this.item)===null||t===void 0?void 0:t.product_id,category:(r=this.item)===null||r===void 0?void 0:r.category,name:(n=this.item)===null||n===void 0?void 0:n.name,brand:(i=this.item)===null||i===void 0?void 0:i.brand,variant:(a=this.item)===null||a===void 0?void 0:a.variant,price:(o=this.item)===null||o===void 0?void 0:o.price,quantity:(s=this.item)===null||s===void 0?void 0:s.quantity,sku:(l=this.item)===null||l===void 0?void 0:l.sku,coupon:(c=this.item)===null||c===void 0?void 0:c.coupon,position:(u=this.item)===null||u===void 0?void 0:u.position,url:(d=this.item)===null||d===void 0?void 0:d.url,image_url:(f=this.item)===null||f===void 0?void 0:f.image_url}}};return e}();var H=function(){function e(e){this.product=e.product}e.prototype.toSegment=function(){var e,t;return{event:"Product Added to Wishlist",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),product_id:this.product.id,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:Math.max(1,Number(this.product.quantity)),sku:this.product.sku,coupon:this.product.coupon,position:Number(this.product.position),url:this.product.url,image_url:(t=(e=this.product)===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}}};return e}();var B=function(){function e(e){this.product=e.product}e.prototype.toSegment=function(){var e,t;return{event:"Product Removed from Wishlist",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),product_id:this.product.id,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:Math.max(1,Number(this.product.quantity)),sku:this.product.sku,coupon:this.product.coupon,position:Number(this.product.position),url:this.product.url,image_url:(t=(e=this.product)===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}}};return e}();var z=function(){function e(e){this.details=e[0]}e.prototype.toSegment=function(){return{event:"Order Completed",properties:this.details}};return e}();var Q=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){return{event:"Wishlist Product Added to Cart",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),cart_id:this.item.cart_id,product_id:this.item.id,category:this.item.category,name:this.item.name,brand:this.item.brand,variant:this.item.variant,price:this.item.price,quantity:this.item.quantity,sku:this.item.sku,coupon:this.item.coupon,position:this.item.position,url:this.item.url,image_url:this.item.image_url}}};e.shouldSend=function(){return"customer.wishlist"===salla.config.get("page.slug")};return e}();var W=function(){function e(e){this.data=e}e.prototype.toSegment=function(){var e,t,r,n,i,a,o,s,l,c;return{event:"Product Shared",properties:{product_id:((e=this.data.product)===null||e===void 0?void 0:e.id)||salla.config.get("page.id"),sku:(t=this.data.product)===null||t===void 0?void 0:t.sku,category:(n=(r=this.data.product)===null||r===void 0?void 0:r.category)===null||n===void 0?void 0:n.name,name:(i=this.data.product)===null||i===void 0?void 0:i.name,brand:(a=this.data.product)===null||a===void 0?void 0:a.brand,variant:(o=this.data.product)===null||o===void 0?void 0:o.variant,price:(s=this.data.product)===null||s===void 0?void 0:s.price,url:(l=this.data.product)===null||l===void 0?void 0:l.url,image_url:(c=this.data.product)===null||c===void 0?void 0:c.image_url,share_via:this.data.share_via,recipient:this.data.recipient}}};e.shouldSend=function(){return"product.single"===salla.config.get("page.slug")};return e}();var K=function(){function e(e){this.details=e}e.prototype.toSegment=function(){return{event:"Product Reviewed",properties:{product_id:this.details.product_id,review_id:this.details.order_id,review_body:this.details.comment,rating:this.details.rating}}};e.registerEvents=function(){salla.event.rating.onProductsRated((function(e,t){var r=t.products,n=t.order_id;Object.values(r).forEach((function(e){Salla.event.emit("Product Reviewed",{product_id:e.product_id,review_id:n,review_body:e.comment,rating:e.rating})}))}))};return e}();var J=function(){function e(){}e.registerEvents=function(){K.registerEvents()};e.transform=function(e,t){try{var r=this.events[e]||[];for(var n=0,i=r;n<i.length;n++){var a=i[n];if(!a||"function"==typeof a.shouldSend&&!a.shouldSend())continue;var o=new a(t).toSegment();return{event:o.event,properties:o.properties}}return null}catch(e){return console.error("Failed to transform event:",e),null}};e.events={"Order Completed":[z],"Product Added":[O,Q],"Product Removed":[G],"Product Viewed":[D],"Product Added to Wishlist":[H],"Product Removed from Wishlist":[B],"Cart Viewed":[j],"Products Searched":[U],"Product List Viewed":[N],"Signed Up":[M],"Signed In":[V],"Signed Out":[$],"Product Reviewed":[K],"Product Shared":[W]};return e}();W$3.onReady=W$3.onReady||function(e){return new Promise((function(t){return"ready"===salla.status?t(e?e(salla.config.all()):salla.config.all()):W$3.onInitiated((function(r){return t(e?e(r):r)}))}))},W$3.status="loading",W$3.notify=c,W$3.lang=new(function(e){__extends(t,e);function t(t){var r=this;(t=t||{}).messages=t.messages||window.translations,t.locale=t.locale||(window.locale||navigator.language||navigator.userLanguage||"ar").split("-")[0],t.fallback=t.fallback||t.locale,r=e.call(this,t)||this,r.translationsLoaded=!1;return r}t.prototype.onLoaded=function(e){var t=this;return new Promise((function(r){if(t.translationsLoaded)return r(e?e():null);Salla.event.once("languages::translations.loaded",(function(){return r(e?e():null)}))}))};t.prototype.loadStoreTranslations=function(){if(this.hash=salla.config.get("theme.translations_hash",salla.config.get("store.id","twilight")),this.message||(salla.log("try to load translations from localstorage"),this.messages=salla.storage.get("s_translations.".concat(this.hash)),this.messages&&(this.translationsLoaded=!0)&&e.prototype.setMessages.call(this,this.messages)),this.messages)return salla.event.dispatch("languages::translations.loaded"),void salla.logger.info("The messages of transactions is already loaded");salla.url.get("")?this.loadScript(salla.url.get("languages/assets/".concat(this.hash,".js"))):this.loadScript("https://cdn.salla.network/js/translations.js",!1)};t.prototype.setMessages=function(t){e.prototype.setMessages.call(this,t),salla.event.dispatch("languages::translations.loaded"),this.translationsLoaded=!0};t.prototype.loadScript=function(e,t){var r=this;if(t===void 0){t=!0}var n=document.createElement("script");n.src=e,n.onload=function(){var e;if(window.translations)return salla.storage.remove("s_translations"),salla.storage.set("s_translations",(e={},e[r.hash]=window.translations,e)),r.setMessages(window.translations);n.onerror()},n.onerror=function(){if(t)return salla.logger.warn("Failed to load Translations for store, lets try load it from CDN"),r.loadScript("https://cdn.salla.network/js/translations.js",!1);salla.logger.error("Failed to load Translations, check your network logs for more details\nor: salla.lang.setMessages({....}), see https://docs.salla.dev for more information's.")},document.head.appendChild(n)};t.prototype.getWithDefault=function(e,t,r,n){var i=this.get(e,r,n);return i!==e?i:t};t.prototype.get=function(t,r,n){var i=t;(window.translations||this.translationsLoaded)&&(i="trans."+t);var a=e.prototype.get.call(this,i,r,n);return a!==i?a:e.prototype.get.call(this,i,r,"en").replace(i,t)};t.prototype.set=function(e,t){return salla.helpers.setNested(this.messages["".concat(this.getLocale(),".trans")],e,t),this};t.prototype.add=function(e,t){var r=this;return Object.entries(t).forEach((function(t){return salla.helpers.setNested(r.messages[t[0]+".trans"],e,t[1])})),this};t.prototype.addBulk=function(e){var t=this;return Object.entries(e).forEach((function(e){var r=e[0],n=e[1];t.add(r,n)})),this};return t}(lang)),W$3.form=new(function(){function e(){}e.prototype.submit=function(e,t){var r,n,i,a;if(t===void 0){t=null}return __awaiter(this,void 0,void 0,(function(){var o,s,l;return __generator(this,(function(c){switch(c.label){case 0:o=t;if("SubmitEvent"===((r=t===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)||"submit"===(t===null||t===void 0?void 0:t.type)){if(t.preventDefault(),"FORM"!==((n=t.target)===null||n===void 0?void 0:n.tagName))return[2,(Salla.logger.warn("Failed find the target element for submit action. make sure you submit a form element"),new Promise((function(){throw"Failed find the target element for submit action. make sure you submit a form element"})))];"SALLA-BUTTON"===((a=(i=t===null||t===void 0?void 0:t.submitter)===null||i===void 0?void 0:i.parentElement)===null||a===void 0?void 0:a.tagName)&&t.submitter.parentElement.load(),o=t.target.getElementSallaData(),salla.log("Data from element",o)}if(/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/gm.test(e))return[2,salla.api.request(e,o,"post").finally((function(){var e;loaderSupported&&((e=t===null||t===void 0?void 0:t.submitter)===null||e===void 0?void 0:e.parentElement.stop())}))];s=e.split("."),l=s.splice(-1);return[4,salla.call(s.join("."))[l](o).finally((function(){var e,r;return(r=(e=t===null||t===void 0?void 0:t.submitter)===null||e===void 0?void 0:e.parentElement)===null||r===void 0?void 0:r.stop()})).catch((function(e){throw salla.logger.warn(e),e}))];case 1:return[2,c.sent()]}}))}))};e.prototype.onSubmit=function(e,t){return salla.form.submit(e,t),!1};e.prototype.onChange=function(e,t){var r;return(t===null||t===void 0?void 0:t.currentTarget)?"FORM"!==((r=t===null||t===void 0?void 0:t.currentTarget)===null||r===void 0?void 0:r.tagName)||t.currentTarget.checkValidity()?(salla.form.submit(e,t.currentTarget.getElementSallaData()),!0):(salla.logger.warn("Trying to trigger '".concat(e,"' without filling required fields!")),!1):(salla.logger.warn("Trying to trigger '".concat(e,"' without event!")),!1)};e.prototype.getPossibleValue=function(e,t,r){if(r===void 0){r=!1}if(!e)return;if("object"!=typeof e)return e;var n;for(var i=0;i<t.length&&!(n=e[t[i]])&&!("undefined"!=typeof FormData&&e instanceof FormData&&(n=e.get(t[i])));i++);return n=n||e,"object"!=typeof n||r?n:void 0};return e}()),W$3.infiniteScroll=new(function(e){__extends(t,e);function t(t,r){var n=this;n=e.call(this,t,r)||this,n.options={path:".infinite-scroll-btn",history:"push",status:".infinite-scroll-status",append:".list-block"},n.fetchOptions={headers:{"S-INFINITE-SCROLL":!0,"S-Source":"twilight","cache-control":"no-cache",pragma:"no-cache"}},n.instances=[];return n}t.prototype.initiate=function(e,t,r,n){if(n===void 0){n=!1}n?((r=r||{}).fetchOptions=__assign(__assign({},this.fetchOptions),r.fetchOptions||{}),r.responseBody="json"):r=this.getCustomOptions(t,r);var i="string"!=typeof e?e:document.querySelector(e),a=r.path;if(!i||!a||"string"==typeof a&&!document.querySelector(a))return void Salla.logger.warn(i?"Path Option (a link that has next page link) Not Existed!":"Container For InfiniteScroll not Existed!");var o=new js(i,r);return o.on("scrollThreshold",Salla.infiniteScroll.event.scrollThreshold),o.on("request",Salla.infiniteScroll.event.request),o.on("load",Salla.infiniteScroll.event.load),o.on("append",Salla.infiniteScroll.event.append),o.on("error",Salla.infiniteScroll.event.error),o.on("last",Salla.infiniteScroll.event.last),o.on("history",Salla.infiniteScroll.event.history),this.instances.push(o),o};t.prototype.getCustomOptions=function(e,t){return(t="object"==typeof e&&e||t||this.options).fetchOptions=this.fetchOptions,t.path=t.path||this.options.path,t.button=t.button||t.path,t.status=t.status||this.options.status,t.hasOwnProperty("history")||(t.history=this.options.history),t.nextPage=t.nextPage||t.next_page,t.append="string"==typeof e&&e||t.append||this.options.append,t};t.prototype.loadNextPage=function(e){("string"!=typeof e?e:document.querySelector(e)).loadNextPage()};t.prototype.destroy=function(e){("string"!=typeof e?e:document.querySelector(e)).destroy()};return t}(d))(void 0,salla.event.infiniteScroll),W$3.api=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.auth=new m,t.cart=new g,t.loyalty=new f,t.order=new v,t.rating=new S,t.product=new y,t.profile=new w,t.comment=new b,t.currency=new _,t.document=new F,t.wishlist=new C,t.scope=new k,t.booking=new P,t.landing=new q,t.notifications=new A,t.component=new E,t.advertisement=new I,t.navigation=new T,t.metadata=new L;return t}return t}(x)),W$3.sso=new(function(){function e(){var e=this;Salla.onReady((function(){return e.init()}))}e.prototype.init=function(){var e;if(salla.config.get("store.features").includes("sso-login")){if(window.location.hostname.includes("salla"))return salla.log("SSO is not supported yet for stores without custom domain.");salla.auth.event.onLoggedOut((function(){return new Promise((function(e){var t=document.createElement("iframe");t.style.display="none",t.src=salla.url.get("sso/logout"),document.body.appendChild(t),t.onload=function(){document.body.removeChild(t),e()}}))})),(e=document.querySelector("salla-login-modal"))===null||e===void 0?void 0:e.remove(),Salla.event.removeAllListeners("login::open"),Salla.event.prependListener("login::open",(function(){var e=window.location.pathname+window.location.search,t="".concat(window.location.origin,"/sso/login?intended_to=").concat(encodeURIComponent(e));return console.log("Redirecting to:",t),window.location.href=t,!0}))}};return e}()),W$3.intend=new(function(){function e(){var e=this;Salla.onReady((function(){return e.init()}))}e.prototype.init=function(){if(Salla.config.isUser())return;var e=new URLSearchParams(window.location.search);if(e.has("intended_to"))try{var t=new URL(e.get("intended_to"));if(t.hostname!==window.location.hostname)return;return this.handleAfterLoginEvent(t)}catch(e){return void console.warn("Invalid URL provided in intended_to parameter")}};e.prototype.handleAfterLoginEvent=function(e){var t="intend::user.logged.in";Salla.event.on(t,(function(){return window.location=e})),Salla.api.auth.setAfterLoginEvent(t),Salla.api.auth.setCanRedirect(!1),Salla.event.on("salla-login::ready",(function(){return Salla.event.emit("login::open",{withoutReload:!0})}))};return e}()),["cart","auth","order","scope","rating","comment","loyalty","product","profile","currency","document","wishlist","booking","landing","metadata"].forEach((function(e){return W$3[e]=new d(W$3.api[e],W$3.event[e])})),W$3.call=function(e){var t=W$3,r=e.split(".");for(;r.length&&(t=t[r.shift()]););return t},W$3.analytics=new(function(){function e(){var e=this;this.history=[],this.customTrackers=[],this.mappedEvents={"wishlist::added":"Product Added to Wishlist","wishlist::removed":"Product Removed from Wishlist","salla-products-list::products.fetched":"Product List Viewed","auth::registered":"Signed Up","auth::logged.in":"Signed In","auth::logged.out":"Signed Out","share-element":"Product Shared"},salla.event.onAny((function(t,r){try{if(Object.keys(e.mappedEvents).includes(t)){var n=e.mappedEvents[t];return void salla.event.emit(n,r)}if(!salla.config.get("jitsu.events",[]).includes(t))return;var i=J.transform(t,r);i&&e.track(i.event,i.properties)}catch(t){salla.log("Error in analytics event handling:",t)}})),salla.event.on("twilight::init",(function(t){var r,n,i;var a=(t===null||t===void 0?void 0:t.jitsu)||{},o=a.host,s=a.key;e.analytics=null,o&&s?(J.registerEvents(),e.analytics=jitsuAnalytics({host:o,writeKey:s}),"user"===((r=t===null||t===void 0?void 0:t.user)===null||r===void 0?void 0:r.type)&&e.analytics.identify(t===null||t===void 0?void 0:t.user),e.page({context:{store_id:(n=t===null||t===void 0?void 0:t.store)===null||n===void 0?void 0:n.id,version:(i=t===null||t===void 0?void 0:t.jitsu)===null||i===void 0?void 0:i.version}})):salla.log("Jitsu configuration is missing. Analytics will not be tracked.")}))}e.prototype.track=function(e,t){var r=this;if(t===void 0){t={}}return this.analytics?(t=this.finalPayload(t),this.analytics.track(e,t).then((function(n){return r.pushEventToCustomTrackers("track",e,t),n})).then((function(){r.history.push({action:"track",eventName:e,payload:t})})).catch((function(e){return salla.log("Error tracking event:",e),Promise.reject(e)}))):(salla.log("Jitsu configuration is missing. Analytics will not be tracked."),Promise.resolve())};e.prototype.page=function(e){var t=this;if(e===void 0){e={}}return this.analytics?(e=this.finalPayload(e),this.analytics.page(e).then((function(r){return t.pushEventToCustomTrackers("page",e),r})).then((function(){t.history.push({action:"page",payload:e})})).catch((function(e){return salla.log("Error tracking page event:",e),Promise.reject(e)}))):(salla.log("Jitsu configuration is missing. Analytics will not be tracked."),Promise.resolve())};e.prototype.finalPayload=function(e){if(e===void 0){e={}}var t={context:{version:salla.config.get("jitsu.version",1),store_id:salla.config.get("store.id")}};var r=salla.storage.session.get("s-utms");if(r){var n=r["s-utm-campaign"],i=r["s-utm-source"],a=r["s-utm-medium"],o=r["s-utm-term"],s=r["s-utm-content"],l=r["s-utm-referrer"];t.context.campaign={name:n,source:i,medium:a,term:o,content:s,referrer:l}}return __assign(__assign({},t),e)};e.prototype.registerTracker=function(e){"object"==typeof e?"string"==typeof e.name&&e.name?"function"==typeof e.track?"function"==typeof e.page?this.customTrackers.find((function(t){return t.name===e.name}))?salla.log("tracker with the same name already exists!"):(this.customTrackers.push(e),this.history.forEach((function(t){return"track"===t.action?e.track(t.eventName,t.payload):"page"===t.action?e.page(t.payload):void 0}))):salla.log("tracker.page most be a function!"):salla.log("tracker.track most be a function!"):salla.log("tracker.name most be a string!"):salla.log('tracker most be an object {name:"tracker name", track: callback, page: callback}!')};e.prototype.pushEventToCustomTrackers=function(e,t,r){if(r===void 0){r={}}this.customTrackers.forEach((function(n){return n[e](t,r)}))};return e}()),W$3.init=function(e){return new R(e)},salla.event.once("twilight::init",salla.init),salla.event.on("twilight::api",(function(e){var t=e===null||e===void 0?void 0:e.events;t&&salla.event.dispatchEvents(t)})),W$3.success=W$3.notify.success,W$3.error=W$3.notify.error,W$3.versions.twilight="2.14.145 - June 15, 2025 17:09:39",W$3.onInitiated=function(e){return salla.event.once("twilight::initiated",e)},window.dispatchEvent(new CustomEvent("salla::created"));var lazyload_min=createCommonjsModule((function(e,t){!function(t,r){e.exports=r()}(commonjsGlobal,(function(){function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.apply(this,arguments)}var t="undefined"!=typeof window,r=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),n=t&&"IntersectionObserver"in window,i=t&&"classList"in document.createElement("p"),a=t&&window.devicePixelRatio>1,o={elements_selector:".lazy",container:r||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},s=function(t){return e({},o,t)},l=function(e,t){var r,n="LazyLoad::Initialized",i=new e(t);try{r=new CustomEvent(n,{detail:{instance:i}})}catch(e){(r=document.createEvent("CustomEvent")).initCustomEvent(n,!1,!1,{instance:i})}window.dispatchEvent(r)},c="src",u="srcset",d="sizes",f="poster",p="llOriginalAttrs",h="data",v="loading",g="loaded",m="applied",y="error",b="native",_="data-",w="ll-status",S=function(e,t){return e.getAttribute(_+t)},$=function(e){return S(e,w)},k=function(e,t){return function(e,t,r){var n="data-ll-status";null!==r?e.setAttribute(n,r):e.removeAttribute(n)}(e,0,t)},E=function(e){return k(e,null)},x=function(e){return null===$(e)},A=function(e){return $(e)===b},O=[v,g,m,y],P=function(e,t,r,n){e&&(void 0===n?void 0===r?e(t):e(t,r):e(t,r,n))},j=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},I=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},C=function(e){return e.llTempImage},T=function(e,t){if(t){var r=t._observer;r&&r.unobserve(e)}},F=function(e,t){e&&(e.loadingCount+=t)},L=function(e,t){e&&(e.toLoadCount=t)},R=function(e){for(var t,r=[],n=0;t=e.children[n];n+=1)"SOURCE"===t.tagName&&r.push(t);return r},N=function(e,t){var r=e.parentNode;r&&"PICTURE"===r.tagName&&R(r).forEach(t)},z=function(e,t){R(e).forEach(t)},D=[c],q=[c,f],U=[c,u,d],M=[h],H=function(e){return!!e[p]},B=function(e){return e[p]},G=function(e){return delete e[p]},W=function(e,t){if(!H(e)){var r={};t.forEach((function(t){r[t]=e.getAttribute(t)})),e[p]=r}},V=function(e,t){if(H(e)){var r=B(e);t.forEach((function(t){!function(e,t,r){r?e.setAttribute(t,r):e.removeAttribute(t)}(e,t,r[t])}))}},J=function(e,t,r){j(e,t.class_applied),k(e,m),r&&(t.unobserve_completed&&T(e,t),P(t.callback_applied,e,r))},K=function(e,t,r){j(e,t.class_loading),k(e,v),r&&(F(r,1),P(t.callback_loading,e,r))},Q=function(e,t,r){r&&e.setAttribute(t,r)},X=function(e,t){Q(e,d,S(e,t.data_sizes)),Q(e,u,S(e,t.data_srcset)),Q(e,c,S(e,t.data_src))},Y={IMG:function(e,t){N(e,(function(e){W(e,U),X(e,t)})),W(e,U),X(e,t)},IFRAME:function(e,t){W(e,D),Q(e,c,S(e,t.data_src))},VIDEO:function(e,t){z(e,(function(e){W(e,D),Q(e,c,S(e,t.data_src))})),W(e,q),Q(e,f,S(e,t.data_poster)),Q(e,c,S(e,t.data_src)),e.load()},OBJECT:function(e,t){W(e,M),Q(e,h,S(e,t.data_src))}},Z=["IMG","IFRAME","VIDEO","OBJECT"],ee=function(e,t){!t||function(e){return e.loadingCount>0}(t)||function(e){return e.toLoadCount>0}(t)||P(e.callback_finish,t)},te=function(e,t,r){e.addEventListener(t,r),e.llEvLisnrs[t]=r},re=function(e,t,r){e.removeEventListener(t,r)},ne=function(e){return!!e.llEvLisnrs},ie=function(e){if(ne(e)){var t=e.llEvLisnrs;for(var r in t){var n=t[r];re(e,r,n)}delete e.llEvLisnrs}},ae=function(e,t,r){!function(e){delete e.llTempImage}(e),F(r,-1),function(e){e&&(e.toLoadCount-=1)}(r),I(e,t.class_loading),t.unobserve_completed&&T(e,r)},oe=function(e,t,r){var n=C(e)||e;ne(n)||function(e,t,r){ne(e)||(e.llEvLisnrs={});var n="VIDEO"===e.tagName?"loadeddata":"load";te(e,n,t),te(e,"error",r)}(n,(function(i){!function(e,t,r,n){var i=A(t);ae(t,r,n),j(t,r.class_loaded),k(t,g),P(r.callback_loaded,t,n),i||ee(r,n)}(0,e,t,r),ie(n)}),(function(i){!function(e,t,r,n){var i=A(t);ae(t,r,n),j(t,r.class_error),k(t,y),P(r.callback_error,t,n),r.restore_on_error&&V(t,U),i||ee(r,n)}(0,e,t,r),ie(n)}))},se=function(e,t,r){!function(e){return Z.indexOf(e.tagName)>-1}(e)?function(e,t,r){!function(e){e.llTempImage=document.createElement("IMG")}(e),oe(e,t,r),function(e){H(e)||(e[p]={backgroundImage:e.style.backgroundImage})}(e),function(e,t,r){var n=S(e,t.data_bg),i=S(e,t.data_bg_hidpi),o=a&&i?i:n;o&&(e.style.backgroundImage='url("'.concat(o,'")'),C(e).setAttribute(c,o),K(e,t,r))}(e,t,r),function(e,t,r){var n=S(e,t.data_bg_multi),i=S(e,t.data_bg_multi_hidpi),o=a&&i?i:n;o&&(e.style.backgroundImage=o,J(e,t,r))}(e,t,r),function(e,t,r){var n=S(e,t.data_bg_set);if(n){var i=n.split("|"),a=i.map((function(e){return"image-set(".concat(e,")")}));e.style.backgroundImage=a.join(),""===e.style.backgroundImage&&(a=i.map((function(e){return"-webkit-image-set(".concat(e,")")})),e.style.backgroundImage=a.join()),J(e,t,r)}}(e,t,r)}(e,t,r):function(e,t,r){oe(e,t,r),function(e,t,r){var n=Y[e.tagName];n&&(n(e,t),K(e,t,r))}(e,t,r)}(e,t,r)},le=function(e){e.removeAttribute(c),e.removeAttribute(u),e.removeAttribute(d)},ce=function(e){N(e,(function(e){V(e,U)})),V(e,U)},ue={IMG:ce,IFRAME:function(e){V(e,D)},VIDEO:function(e){z(e,(function(e){V(e,D)})),V(e,q),e.load()},OBJECT:function(e){V(e,M)}},de=function(e,t){(function(e){var t=ue[e.tagName];t?t(e):function(e){if(H(e)){var t=B(e);e.style.backgroundImage=t.backgroundImage}}(e)})(e),function(e,t){x(e)||A(e)||(I(e,t.class_entered),I(e,t.class_exited),I(e,t.class_applied),I(e,t.class_loading),I(e,t.class_loaded),I(e,t.class_error))}(e,t),E(e),G(e)},fe=["IMG","IFRAME","VIDEO"],pe=function(e){return e.use_native&&"loading"in HTMLImageElement.prototype},he=function(e,t,r){e.forEach((function(e){return function(e){return e.isIntersecting||e.intersectionRatio>0}(e)?function(e,t,r,n){var i=function(e){return O.indexOf($(e))>=0}(e);k(e,"entered"),j(e,r.class_entered),I(e,r.class_exited),function(e,t,r){t.unobserve_entered&&T(e,r)}(e,r,n),P(r.callback_enter,e,t,n),i||se(e,r,n)}(e.target,e,t,r):function(e,t,r,n){x(e)||(j(e,r.class_exited),function(e,t,r,n){r.cancel_on_exit&&function(e){return $(e)===v}(e)&&"IMG"===e.tagName&&(ie(e),function(e){N(e,(function(e){le(e)})),le(e)}(e),ce(e),I(e,r.class_loading),F(n,-1),E(e),P(r.callback_cancel,e,t,n))}(e,t,r,n),P(r.callback_exit,e,t,n))}(e.target,e,t,r)}))},ve=function(e){return Array.prototype.slice.call(e)},ge=function(e){return e.container.querySelectorAll(e.elements_selector)},me=function(e){return function(e){return $(e)===y}(e)},ye=function(e,t){return function(e){return ve(e).filter(x)}(e||ge(t))},be=function(e,r){var i=s(e);this._settings=i,this.loadingCount=0,function(e,t){n&&!pe(e)&&(t._observer=new IntersectionObserver((function(r){he(r,e,t)}),function(e){return{root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}}(e)))}(i,this),function(e,r){t&&(r._onlineHandler=function(){!function(e,t){var r;(r=ge(e),ve(r).filter(me)).forEach((function(t){I(t,e.class_error),E(t)})),t.update()}(e,r)},window.addEventListener("online",r._onlineHandler))}(i,this),this.update(r)};return be.prototype={update:function(e){var t,i,a=this._settings,o=ye(e,a);L(this,o.length),!r&&n?pe(a)?function(e,t,r){e.forEach((function(e){-1!==fe.indexOf(e.tagName)&&function(e,t,r){e.setAttribute("loading","lazy"),oe(e,t,r),function(e,t){var r=Y[e.tagName];r&&r(e,t)}(e,t),k(e,b)}(e,t,r)})),L(r,0)}(o,a,this):(i=o,function(e){e.disconnect()}(t=this._observer),function(e,t){t.forEach((function(t){e.observe(t)}))}(t,i)):this.loadAll(o)},destroy:function(){this._observer&&this._observer.disconnect(),t&&window.removeEventListener("online",this._onlineHandler),ge(this._settings).forEach((function(e){G(e)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){var t=this,r=this._settings;ye(e,r).forEach((function(e){T(e,t),se(e,r,t)}))},restoreAll:function(){var e=this._settings;ge(e).forEach((function(t){de(t,e)}))}},be.load=function(e,t){var r=s(t);se(e,r)},be.resetStatus=function(e){E(e)},t&&function(e,t){if(t)if(t.length)for(var r,n=0;r=t[n];n+=1)l(e,r);else l(e,t)}(be,window.lazyLoadOptions),be}))}));function appGlobalScript(){if(!document.lazyLoadInstance){document.lazyLoadInstance=new lazyload_min({use_native:true});document.lazyLoadBackgrounds=new lazyload_min({elements_selector:".lazy[data-bg]:not(.loaded)"})}if(document.readyState!=="complete"){document.addEventListener("DOMContentLoaded",(function(){return document.lazyLoadInstance.update()}));document.addEventListener("DOMContentLoaded",(function(){return document.lazyLoadBackgrounds.update()}))}salla.infiniteScroll.event.onAppend((function(){document.lazyLoadInstance.update();document.lazyLoadBackgrounds.update()}))}var globalScripts=appGlobalScript;export{globalScripts as g};
|
|
25
|
+
//# sourceMappingURL=app-globals-97d2497d.js.map
|