@salla.sa/twilight-components 2.11.21 → 2.11.23
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-f18513f9.js → app-globals-7253a431.js} +2232 -39
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-button_37.cjs.entry.js +2 -2
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/components/salla-file-upload/salla-file-upload.js +4 -4
- package/dist/components/index.js +2232 -39
- package/dist/components/salla-file-upload2.js +2 -2
- package/dist/esm/{app-globals-9127a6ae.js → app-globals-a043cc09.js} +2232 -39
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-button_37.entry.js +2 -2
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/app-globals-a043cc09.js +30 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-button_37.entry.js +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/p-11ec9d06.system.js +30 -0
- package/dist/twilight/{p-5fc3f873.system.js → p-1b87ab66.system.js} +1 -1
- package/dist/twilight/p-2c5db3b4.js +24 -0
- package/dist/twilight/{p-a55496d9.system.entry.js → p-729ff20d.system.entry.js} +1 -1
- package/dist/twilight/{p-5f625abf.entry.js → p-a495ee03.entry.js} +1 -1
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/components/salla-file-upload/salla-file-upload.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +3 -3
- package/dist/esm-es5/app-globals-9127a6ae.js +0 -24
- package/dist/twilight/p-a6b1a735.js +0 -24
- package/dist/twilight/p-dddd2139.system.js +0 -24
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{c as t,a as e}from"./p-f84bae34.js";var n=Array.isArray,i="object"==typeof self&&self&&self.Object===Object&&self,r="object"==typeof t&&t&&t.Object===Object&&t||i||Function("return this")(),s=r.Symbol,a=Object.prototype,o=a.hasOwnProperty,l=a.toString,u=s?s.toStringTag:void 0,c=Object.prototype.toString,f=s?s.toStringTag:void 0,h=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?function(t){var e=o.call(t,u),n=t[u];try{t[u]=void 0;var i=!0}catch(t){}var r=l.call(t);return i&&(e?t[u]=n:delete t[u]),r}(t):function(t){return c.call(t)}(t)},d=function(t){return"symbol"==typeof t||function(t){return null!=t&&"object"==typeof t}(t)&&"[object Symbol]"==h(t)},p=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,g=/^\w*$/,m=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},v=r["__core-js_shared__"],w=function(){var t=/[^.]+$/.exec(v&&v.keys&&v.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),y=Function.prototype.toString,b=/^\[object .+?Constructor\]$/,S=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),_=function(t){return!(!m(t)||function(t){return!!w&&w in t}(t))&&(function(t){if(!m(t))return!1;var e=h(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)?S:b).test(function(t){if(null!=t){try{return y.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t))},E=function(t,e){var n=function(t,e){return null==t?void 0:t[e]}(t,e);return _(n)?n:void 0},j=E(Object,"create"),k=Object.prototype.hasOwnProperty,x=Object.prototype.hasOwnProperty;function O(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}O.prototype.clear=function(){this.__data__=j?j(null):{},this.size=0},O.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},O.prototype.get=function(t){var e=this.__data__;if(j){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return k.call(e,t)?e[t]:void 0},O.prototype.has=function(t){var e=this.__data__;return j?void 0!==e[t]:x.call(e,t)},O.prototype.set=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=j&&void 0===e?"__lodash_hash_undefined__":e,this};var F=O,A=function(t,e){return t===e||t!=t&&e!=e},T=function(t,e){for(var n=t.length;n--;)if(A(t[n][0],e))return n;return-1},I=Array.prototype.splice;function R(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}R.prototype.clear=function(){this.__data__=[],this.size=0},R.prototype.delete=function(t){var e=this.__data__,n=T(e,t);return!(n<0||(n==e.length-1?e.pop():I.call(e,n,1),--this.size,0))},R.prototype.get=function(t){var e=this.__data__,n=T(e,t);return n<0?void 0:e[n][1]},R.prototype.has=function(t){return T(this.__data__,t)>-1},R.prototype.set=function(t,e){var n=this.__data__,i=T(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this};var C=R,L=E(r,"Map"),P=function(t,e){var n=t.__data__;return function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}(e)?n["string"==typeof e?"string":"hash"]:n.map};function D(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var i=t[e];this.set(i[0],i[1])}}D.prototype.clear=function(){this.size=0,this.__data__={hash:new F,map:new(L||C),string:new F}},D.prototype.delete=function(t){var e=P(this,t).delete(t);return this.size-=e?1:0,e},D.prototype.get=function(t){return P(this,t).get(t)},D.prototype.has=function(t){return P(this,t).has(t)},D.prototype.set=function(t,e){var n=P(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this};var N=D;function q(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var i=arguments,r=e?e.apply(this,i):i[0],s=n.cache;if(s.has(r))return s.get(r);var a=t.apply(this,i);return n.cache=s.set(r,a)||s,a};return n.cache=new(q.Cache||N),n}q.Cache=N;var $=q,U=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/\\(\\)?/g,M=function(){var t=$((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(U,(function(t,n,i,r){e.push(i?r.replace(z,"$1"):n||t)})),e}),(function(t){return 500===e.size&&e.clear(),t})),e=t.cache;return t}(),B=s?s.prototype:void 0,J=B?B.toString:void 0,G=function t(e){if("string"==typeof e)return e;if(n(e))return function(t,e){for(var n=-1,i=null==t?0:t.length,r=Array(i);++n<i;)r[n]=e(t[n],n,t);return r}(e,t)+"";if(d(e))return J?J.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i},H=function(t,e){return n(t)?t:function(t,e){if(n(t))return!1;var i=typeof t;return!("number"!=i&&"symbol"!=i&&"boolean"!=i&&null!=t&&!d(t))||g.test(t)||!p.test(t)||null!=e&&t in Object(e)}(t,e)?[t]:M(function(t){return null==t?"":G(t)}(t))},Q=function(t){if("string"==typeof t||d(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},V=function(t,e,n){var i=null==t?void 0:function(t,e){for(var n=0,i=(e=H(e,t)).length;null!=t&&n<i;)t=t[Q(e[n++])];return n&&n==i?t:void 0}(t,e);return void 0===i?n:i},W=e((function(t){!function(e){var n=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},r="object"==typeof process&&"function"==typeof process.nextTick,s="function"==typeof Symbol,a="object"==typeof Reflect,o="function"==typeof setImmediate?setImmediate:setTimeout,l=s?a&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(t){var e=Object.getOwnPropertyNames(t);return e.push.apply(e,Object.getOwnPropertySymbols(t)),e}:Object.keys;function u(){this._events={},this._conf&&c.call(this,this._conf)}function c(t){t&&(this._conf=t,t.delimiter&&(this.delimiter=t.delimiter),t.maxListeners!==e&&(this._maxListeners=t.maxListeners),t.wildcard&&(this.wildcard=t.wildcard),t.newListener&&(this._newListener=t.newListener),t.removeListener&&(this._removeListener=t.removeListener),t.verboseMemoryLeak&&(this.verboseMemoryLeak=t.verboseMemoryLeak),t.ignoreErrors&&(this.ignoreErrors=t.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function f(t,e){var n="(node) warning: possible EventEmitter memory leak detected. "+t+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+e+"."),"undefined"!=typeof process&&process.emitWarning){var i=Error(n);i.name="MaxListenersExceededWarning",i.emitter=this,i.count=t,process.emitWarning(i)}else console.error(n),console.trace&&console.trace()}var h=function(t,e,n){var i=arguments.length;switch(i){case 0:return[];case 1:return[t];case 2:return[t,e];case 3:return[t,e,n];default:for(var r=Array(i);i--;)r[i]=arguments[i];return r}};function d(t,n){for(var i={},r=t.length,s=n?n.length:0,a=0;a<r;a++)i[t[a]]=a<s?n[a]:e;return i}function p(t,e,n){var i,r;if(this._emitter=t,this._target=e,this._listeners={},this._listenersCount=0,(n.on||n.off)&&(i=n.on,r=n.off),e.addEventListener?(i=e.addEventListener,r=e.removeEventListener):e.addListener?(i=e.addListener,r=e.removeListener):e.on&&(i=e.on,r=e.off),!i&&!r)throw Error("target does not implement any known event API");if("function"!=typeof i)throw TypeError("on method must be a function");if("function"!=typeof r)throw TypeError("off method must be a function");this._on=i,this._off=r;var s=t._observers;s?s.push(this):t._observers=[this]}function g(t,i,r,s){var a=Object.assign({},i);if(!t)return a;if("object"!=typeof t)throw TypeError("options must be an object");var o,l,u,c=Object.keys(t),f=c.length;function h(t){throw Error('Invalid "'+o+'" option value'+(t?". Reason: "+t:""))}for(var d=0;d<f;d++){if(o=c[d],!s&&!n.call(i,o))throw Error('Unknown "'+o+'" option');(l=t[o])!==e&&(a[o]=(u=r[o])?u(l,h):l)}return a}function m(t,e){return"function"==typeof t&&t.hasOwnProperty("prototype")||e("value must be a constructor"),t}function v(t){var e="value must be type of "+t.join("|"),n=t.length,i=t[0],r=t[1];return 1===n?function(t,n){if(typeof t===i)return t;n(e)}:2===n?function(t,n){var s=typeof t;if(s===i||s===r)return t;n(e)}:function(i,r){for(var s=typeof i,a=n;a-- >0;)if(s===t[a])return i;r(e)}}Object.assign(p.prototype,{subscribe:function(t,e,n){var i=this,r=this._target,s=this._emitter,a=this._listeners,o=function(){var i=h.apply(null,arguments),a={data:i,name:e,original:t};if(n){var o=n.call(r,a);!1!==o&&s.emit.apply(s,[a.name].concat(i))}else s.emit.apply(s,[e].concat(i))};if(a[t])throw Error("Event '"+t+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!i._onNewListener?(this._onNewListener=function(n){n===e&&null===a[t]&&(a[t]=o,i._on.call(r,t,o))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===e&&!s.hasListeners(n)&&a[t]&&(a[t]=null,i._off.call(r,t,o))},a[t]=null,s.on("removeListener",this._onRemoveListener)):(a[t]=o,i._on.call(r,t,o))},unsubscribe:function(t){var e,n,i,r=this,s=this._listeners,a=this._emitter,o=this._off,u=this._target;if(t&&"string"!=typeof t)throw TypeError("event must be a string");function c(){r._onNewListener&&(a.off("newListener",r._onNewListener),a.off("removeListener",r._onRemoveListener),r._onNewListener=null,r._onRemoveListener=null);var t=S.call(a,r);a._observers.splice(t,1)}if(t){if(!(e=s[t]))return;o.call(u,t,e),delete s[t],--this._listenersCount||c()}else{for(i=(n=l(s)).length;i-- >0;)o.call(u,t=n[i],s[t]);this._listeners={},this._listenersCount=0,c()}}});var w=v(["function"]),y=v(["object","function"]);function b(t,e,n){var i,r,s,a=0,o=new t((function(l,u,c){function f(){r&&(r=null),a&&(clearTimeout(a),a=0)}n=g(n,{timeout:0,overload:!1},{timeout:function(t,e){return("number"!=typeof(t*=1)||t<0||!Number.isFinite(t))&&e("timeout must be a positive number"),t}});var h=function(t){f(),l(t)},d=function(t){f(),u(t)};(i=!n.overload&&"function"==typeof t.prototype.cancel&&"function"==typeof c)?e(h,d,c):(r=[function(t){d(t||Error("canceled"))}],e(h,d,(function(t){if(s)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof t)throw TypeError("onCancel callback must be a function");r.push(t)})),s=!0),n.timeout>0&&(a=setTimeout((function(){var t=Error("timeout");t.code="ETIMEDOUT",a=0,o.cancel(t),u(t)}),n.timeout))}));return i||(o.cancel=function(t){if(r){for(var e=r.length,n=1;n<e;n++)r[n](t);r[0](t),r=null}}),o}function S(t){var e=this._observers;if(!e)return-1;for(var n=e.length,i=0;i<n;i++)if(e[i]._target===t)return i;return-1}function _(t,e,n,i,r){if(!n)return null;if(0===i){var s=typeof e;if("string"===s){var a,o,u=0,c=0,f=this.delimiter,h=f.length;if(-1!==(o=e.indexOf(f))){a=[,,,,,];do{a[u++]=e.slice(c,o),c=o+h}while(-1!==(o=e.indexOf(f,c)));a[u++]=e.slice(c),e=a,r=u}else e=[e],r=1}else"object"===s?r=e.length:(e=[e],r=1)}var d,p,g,m,v,w,y,b=null,S=e[i],E=e[i+1];if(i===r)n._listeners&&("function"==typeof n._listeners?(t&&t.push(n._listeners),b=[n]):(t&&t.push.apply(t,n._listeners),b=[n]));else{if("*"===S){for(o=(w=l(n)).length;o-- >0;)"_listeners"!==(d=w[o])&&(y=_(t,e,n[d],i+1,r))&&(b?b.push.apply(b,y):b=y);return b}if("**"===S){for((v=i+1===r||i+2===r&&"*"===E)&&n._listeners&&(b=_(t,e,n,r,r)),o=(w=l(n)).length;o-- >0;)"_listeners"!==(d=w[o])&&("*"===d||"**"===d?(n[d]._listeners&&!v&&(y=_(t,e,n[d],r,r))&&(b?b.push.apply(b,y):b=y),y=_(t,e,n[d],i,r)):y=_(t,e,n[d],d===E?i+2:i,r),y&&(b?b.push.apply(b,y):b=y));return b}n[S]&&(b=_(t,e,n[S],i+1,r))}if((p=n["*"])&&_(t,e,p,i+1,r),g=n["**"])if(i<r)for(g._listeners&&_(t,e,g,r,r),o=(w=l(g)).length;o-- >0;)"_listeners"!==(d=w[o])&&(d===E?_(t,e,g[d],i+2,r):d===S?_(t,e,g[d],i+1,r):((m={})[d]=g[d],_(t,e,{"**":m},i+1,r)));else g._listeners?_(t,e,g,r,r):g["*"]&&g["*"]._listeners&&_(t,e,g["*"],r,r);return b}function E(t,e,n){var i,r,s=0,a=0,o=this.delimiter,l=o.length;if("string"==typeof t)if(-1!==(i=t.indexOf(o))){r=[,,,,,];do{r[s++]=t.slice(a,i),a=i+l}while(-1!==(i=t.indexOf(o,a)));r[s++]=t.slice(a)}else r=[t],s=1;else r=t,s=t.length;if(s>1)for(i=0;i+1<s;i++)if("**"===r[i]&&"**"===r[i+1])return;var u,c=this.listenerTree;for(i=0;i<s;i++)if(c=c[u=r[i]]||(c[u]={}),i===s-1)return c._listeners?("function"==typeof c._listeners&&(c._listeners=[c._listeners]),n?c._listeners.unshift(e):c._listeners.push(e),!c._listeners.warned&&this._maxListeners>0&&c._listeners.length>this._maxListeners&&(c._listeners.warned=!0,f.call(this,c._listeners.length,u))):c._listeners=e,!0;return!0}function j(t,e,n,i){for(var r,s,a,o,u=l(t),c=u.length,f=t._listeners;c-- >0;)r=t[s=u[c]],a="_listeners"===s?n:n?n.concat(s):[s],o=i||"symbol"==typeof s,f&&e.push(o?a:a.join(this.delimiter)),"object"==typeof r&&j.call(this,r,e,a,o);return e}function k(t){for(var e,n,i,r=l(t),s=r.length;s-- >0;)(e=t[n=r[s]])&&(i=!0,"_listeners"===n||k(e)||delete t[n]);return i}function x(t,e,n){this.emitter=t,this.event=e,this.listener=n}function O(t,n,i){if(!0===i)a=!0;else if(!1===i)s=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var s=i.async,a=i.promisify,l=i.nextTick,u=i.objectify}if(s||l||a){var c=n,f=n._origin||n;if(l&&!r)throw Error("process.nextTick is not supported");a===e&&(a="AsyncFunction"===n.constructor.name),(n=function(){var t=arguments,e=this,n=this.event;return a?l?Promise.resolve():new Promise((function(t){o(t)})).then((function(){return e.event=n,c.apply(e,t)})):(l?process.nextTick:o)((function(){e.event=n,c.apply(e,t)}))})._async=!0,n._origin=f}return[n,u?new x(this,t,n):this]}function F(t){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,c.call(this,t)}x.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},F.EventEmitter2=F,F.prototype.listenTo=function(t,n,r){if("object"!=typeof t)throw TypeError("target musts be an object");var s=this;function a(e){if("object"!=typeof e)throw TypeError("events must be an object");var n,i=r.reducers,a=S.call(s,t);n=-1===a?new p(s,t,r):s._observers[a];for(var o,u=l(e),c=u.length,f="function"==typeof i,h=0;h<c;h++)n.subscribe(o=u[h],e[o]||o,f?i:i&&i[o])}return r=g(r,{on:e,off:e,reducers:e},{on:w,off:w,reducers:y}),i(n)?a(d(n)):a("string"==typeof n?d(n.split(/\s+/)):n),this},F.prototype.stopListeningTo=function(t,e){var n=this._observers;if(!n)return!1;var i,r=n.length,s=!1;if(t&&"object"!=typeof t)throw TypeError("target should be an object");for(;r-- >0;)i=n[r],t&&i._target!==t||(i.unsubscribe(e),s=!0);return s},F.prototype.delimiter=".",F.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},F.prototype.getMaxListeners=function(){return this._maxListeners},F.prototype.event="",F.prototype.once=function(t,e,n){return this._once(t,e,!1,n)},F.prototype.prependOnceListener=function(t,e,n){return this._once(t,e,!0,n)},F.prototype._once=function(t,e,n,i){return this._many(t,1,e,n,i)},F.prototype.many=function(t,e,n,i){return this._many(t,e,n,!1,i)},F.prototype.prependMany=function(t,e,n,i){return this._many(t,e,n,!0,i)},F.prototype._many=function(t,e,n,i,r){var s=this;if("function"!=typeof n)throw Error("many only accepts instances of Function");function a(){return 0==--e&&s.off(t,a),n.apply(this,arguments)}return a._origin=n,this._on(t,a,i,r)},F.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var t,e,n,i,r,a,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(l&&(t=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,s)for(i=0;i<n;i++)if("symbol"==typeof o[i]){a=!0;break}a||(o=o.join(this.delimiter))}var c,f=arguments.length;if(this._all&&this._all.length)for(i=0,n=(c=this._all.slice()).length;i<n;i++)switch(this.event=o,f){case 1:c[i].call(this,o);break;case 2:c[i].call(this,o,arguments[1]);break;case 3:c[i].call(this,o,arguments[1],arguments[2]);break;default:c[i].apply(this,arguments)}if(l)_.call(this,c=[],t,this.listenerTree,0,n);else{if("function"==typeof(c=this._events[o])){switch(this.event=o,f){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(e=Array(f-1),r=1;r<f;r++)e[r-1]=arguments[r];c.apply(this,e)}return!0}c&&(c=c.slice())}if(c&&c.length){if(f>3)for(e=Array(f-1),r=1;r<f;r++)e[r-1]=arguments[r];for(i=0,n=c.length;i<n;i++)switch(this.event=o,f){case 1:c[i].call(this);break;case 2:c[i].call(this,arguments[1]);break;case 3:c[i].call(this,arguments[1],arguments[2]);break;default:c[i].apply(this,e)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:Error("Uncaught, unspecified 'error' event.");return!!this._all},F.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var t,e,n,i,r,a,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(l&&(t=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(i=o.length,s)for(r=0;r<i;r++)if("symbol"==typeof o[r]){e=!0;break}e||(o=o.join(this.delimiter))}var c,f=[],h=arguments.length;if(this._all)for(r=0,i=this._all.length;r<i;r++)switch(this.event=o,h){case 1:f.push(this._all[r].call(this,o));break;case 2:f.push(this._all[r].call(this,o,arguments[1]));break;case 3:f.push(this._all[r].call(this,o,arguments[1],arguments[2]));break;default:f.push(this._all[r].apply(this,arguments))}if(l?_.call(this,c=[],t,this.listenerTree,0):c=this._events[o],"function"==typeof c)switch(this.event=o,h){case 1:f.push(c.call(this));break;case 2:f.push(c.call(this,arguments[1]));break;case 3:f.push(c.call(this,arguments[1],arguments[2]));break;default:for(n=Array(h-1),a=1;a<h;a++)n[a-1]=arguments[a];f.push(c.apply(this,n))}else if(c&&c.length){if(c=c.slice(),h>3)for(n=Array(h-1),a=1;a<h;a++)n[a-1]=arguments[a];for(r=0,i=c.length;r<i;r++)switch(this.event=o,h){case 1:f.push(c[r].call(this));break;case 2:f.push(c[r].call(this,arguments[1]));break;case 3:f.push(c[r].call(this,arguments[1],arguments[2]));break;default:f.push(c[r].apply(this,n))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return Promise.reject(arguments[1]instanceof Error?arguments[1]:"Uncaught, unspecified 'error' event.");return Promise.all(f)},F.prototype.on=function(t,e,n){return this._on(t,e,!1,n)},F.prototype.prependListener=function(t,e,n){return this._on(t,e,!0,n)},F.prototype.onAny=function(t){return this._onAny(t,!1)},F.prototype.prependAny=function(t){return this._onAny(t,!0)},F.prototype.addListener=F.prototype.on,F.prototype._onAny=function(t,e){if("function"!=typeof t)throw Error("onAny only accepts instances of Function");return this._all||(this._all=[]),e?this._all.unshift(t):this._all.push(t),this},F.prototype._on=function(t,n,i,r){if("function"==typeof t)return this._onAny(t,n),this;if("function"!=typeof n)throw Error("on only accepts instances of Function");this._events||u.call(this);var s,a=this;return r!==e&&(n=(s=O.call(this,t,n,r))[0],a=s[1]),this._newListener&&this.emit("newListener",t,n),this.wildcard?(E.call(this,t,n,i),a):(this._events[t]?("function"==typeof this._events[t]&&(this._events[t]=[this._events[t]]),i?this._events[t].unshift(n):this._events[t].push(n),!this._events[t].warned&&this._maxListeners>0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,f.call(this,this._events[t].length,t))):this._events[t]=n,a)},F.prototype.off=function(t,e){if("function"!=typeof e)throw Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var s="string"==typeof t?t.split(this.delimiter):t.slice();if(!(r=_.call(this,null,s,this.listenerTree,0)))return this}else{if(!this._events[t])return this;r.push({_listeners:n=this._events[t]})}for(var a=0;a<r.length;a++){var o=r[a];if(i(n=o._listeners)){for(var l=-1,u=0,c=n.length;u<c;u++)if(n[u]===e||n[u].listener&&n[u].listener===e||n[u]._origin&&n[u]._origin===e){l=u;break}if(l<0)continue;return this.wildcard?o._listeners.splice(l,1):this._events[t].splice(l,1),0===n.length&&(this.wildcard?delete o._listeners:delete this._events[t]),this._removeListener&&this.emit("removeListener",t,e),this}(n===e||n.listener&&n.listener===e||n._origin&&n._origin===e)&&(this.wildcard?delete o._listeners:delete this._events[t],this._removeListener&&this.emit("removeListener",t,e))}return this.listenerTree&&k(this.listenerTree),this},F.prototype.offAny=function(t){var e,n=0,i=0;if(t&&this._all&&this._all.length>0){for(n=0,i=(e=this._all).length;n<i;n++)if(t===e[n])return e.splice(n,1),this._removeListener&&this.emit("removeListenerAny",t),this}else{if(e=this._all,this._removeListener)for(n=0,i=e.length;n<i;n++)this.emit("removeListenerAny",e[n]);this._all=[]}return this},F.prototype.removeListener=F.prototype.off,F.prototype.removeAllListeners=function(t){if(t===e)return!this._events||u.call(this),this;if(this.wildcard){var n,i=_.call(this,null,t,this.listenerTree,0);if(!i)return this;for(n=0;n<i.length;n++)i[n]._listeners=null;this.listenerTree&&k(this.listenerTree)}else this._events&&(this._events[t]=null);return this},F.prototype.listeners=function(t){var n,i,r,s,a,o=this._events;if(t===e){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!o)return[];for(s=(n=l(o)).length,r=[];s-- >0;)"function"==typeof(i=o[n[s]])?r.push(i):r.push.apply(r,i);return r}if(this.wildcard){if(!(a=this.listenerTree))return[];var u=[],c="string"==typeof t?t.split(this.delimiter):t.slice();return _.call(this,u,c,a,0),u}return o&&(i=o[t])?"function"==typeof i?[i]:i:[]},F.prototype.eventNames=function(t){var e=this._events;return this.wildcard?j.call(this,this.listenerTree,[],null,t):e?l(e):[]},F.prototype.listenerCount=function(t){return this.listeners(t).length},F.prototype.hasListeners=function(t){if(this.wildcard){var n=[],i="string"==typeof t?t.split(this.delimiter):t.slice();return _.call(this,n,i,this.listenerTree,0),n.length>0}var r=this._events,s=this._all;return!!(s&&s.length||r&&(t===e?l(r).length:r[t]))},F.prototype.listenersAny=function(){return this._all?this._all:[]},F.prototype.waitFor=function(t,n){var i=this,r=typeof n;return"number"===r?n={timeout:n}:"function"===r&&(n={filter:n}),b((n=g(n,{timeout:0,filter:e,handleError:!1,Promise,overload:!1},{filter:w,Promise:m})).Promise,(function(e,r,s){function a(){var s=n.filter;if(!s||s.apply(i,arguments))if(i.off(t,a),n.handleError){var o=arguments[0];o?r(o):e(h.apply(null,arguments).slice(1))}else e(h.apply(null,arguments))}s((function(){i.off(t,a)})),i._on(t,a,!1)}),{timeout:n.timeout,overload:n.overload})};var A=F.prototype;Object.defineProperties(F,{defaultMaxListeners:{get:function(){return A._maxListeners},set:function(t){if("number"!=typeof t||t<0||Number.isNaN(t))throw TypeError("n must be a non-negative number");A._maxListeners=t},enumerable:!0},once:{value:function(t,e,n){return b((n=g(n,{Promise,timeout:0,overload:!1},{Promise:m})).Promise,(function(n,i,r){var s;if("function"==typeof t.addEventListener)return s=function(){n(h.apply(null,arguments))},r((function(){t.removeEventListener(e,s)})),void t.addEventListener(e,s,{once:!0});var a,o=function(){a&&t.removeListener("error",a),n(h.apply(null,arguments))};"error"!==e&&(a=function(n){t.removeListener(e,o),i(n)},t.once("error",a)),r((function(){a&&t.removeListener("error",a),t.removeListener(e,o)})),t.once(e,o)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(A,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=F}()})),Z=Object.assign?Object.assign:function(t){for(var e=1;e<arguments.length;e++)et(Object(arguments[e]),(function(e,n){t[n]=e}));return t},X=function(){if(Object.create)return function(t,e,n,i){var r=tt(arguments,1);return Z.apply(this,[Object.create(t)].concat(r))};{function t(){}return function(e,n,i,r){var s=tt(arguments,1);return t.prototype=e,Z.apply(this,[new t].concat(s))}}}(),K="undefined"!=typeof window?window:t,Y={assign:Z,create:X,trim:String.prototype.trim?function(t){return String.prototype.trim.call(t)}:function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},bind:function(t,e){return function(){return e.apply(t,Array.prototype.slice.call(arguments,0))}},slice:tt,each:et,map:function(t,e){var n=it(t)?[]:{};return nt(t,(function(t,i){return n[i]=e(t,i),!1})),n},pluck:nt,isList:it,isFunction:function(t){return t&&"[object Function]"==={}.toString.call(t)},isObject:function(t){return t&&"[object Object]"==={}.toString.call(t)},Global:K};function tt(t,e){return Array.prototype.slice.call(t,e||0)}function et(t,e){nt(t,(function(t,n){return e(t,n),!1}))}function nt(t,e){if(it(t)){for(var n=0;n<t.length;n++)if(e(t[n],n))return t[n]}else for(var i in t)if(t.hasOwnProperty(i)&&e(t[i],i))return t[i]}function it(t){return null!=t&&"function"!=typeof t&&"number"==typeof t.length}var rt=Y.slice,st=Y.pluck,at=Y.each,ot=Y.bind,lt=Y.create,ut=Y.isList,ct=Y.isFunction,ft=Y.isObject,ht={createStore:pt},dt={version:"2.0.12",enabled:!1,get:function(t,e){var n=this.storage.read(this._namespacePrefix+t);return this._deserialize(n,e)},set:function(t,e){return void 0===e?this.remove(t):(this.storage.write(this._namespacePrefix+t,this._serialize(e)),e)},remove:function(t){this.storage.remove(this._namespacePrefix+t)},each:function(t){var e=this;this.storage.each((function(n,i){t.call(e,e._deserialize(n),(i||"").replace(e._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(t){return this._namespacePrefix=="__storejs_"+t+"_"},createStore:function(){return pt.apply(this,arguments)},addPlugin:function(t){this._addPlugin(t)},namespace:function(t){return pt(this.storage,this.plugins,t)}};function pt(t,e,n){n||(n=""),t&&!ut(t)&&(t=[t]),e&&!ut(e)&&(e=[e]);var i=n?"__storejs_"+n+"_":"",r=n?RegExp("^"+i):null;if(!/^[a-zA-Z0-9_\-]*$/.test(n))throw Error("store.js namespaces can only have alphanumerics + underscores and dashes");var s=lt({_namespacePrefix:i,_namespaceRegexp:r,_testStorage:function(t){try{var e="__storejs__test__";t.write(e,e);var n=t.read(e)===e;return t.remove(e),n}catch(t){return!1}},_assignPluginFnProp:function(t,e){var n=this[e];this[e]=function(){var e=rt(arguments,0),i=this;function r(){if(n)return at(arguments,(function(t,n){e[n]=t})),n.apply(i,e)}var s=[r].concat(e);return t.apply(i,s)}},_serialize:function(t){return JSON.stringify(t)},_deserialize:function(t,e){if(!t)return e;var n="";try{n=JSON.parse(t)}catch(e){n=t}return void 0!==n?n:e},_addStorage:function(t){this.enabled||this._testStorage(t)&&(this.storage=t,this.enabled=!0)},_addPlugin:function(t){var e=this;if(ut(t))at(t,(function(t){e._addPlugin(t)}));else if(!st(this.plugins,(function(e){return t===e}))){if(this.plugins.push(t),!ct(t))throw Error("Plugins must be function values that return objects");var n=t.call(this);if(!ft(n))throw Error("Plugins must return an object of function properties");at(n,(function(n,i){if(!ct(n))throw Error("Bad plugin property: "+i+" from plugin "+t.name+". Plugins should only return functions.");e._assignPluginFnProp(n,i)}))}},addStorage:function(t){!function(){var t=void 0===console?null:console;t&&(t.warn?t.warn:t.log).apply(t,arguments)}("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(t)}},dt,{plugins:[]});return s.raw={},at(s,(function(t,e){ct(t)&&(s.raw[e]=ot(s,t))})),at(t,(function(t){s._addStorage(t)})),at(e,(function(t){s._addPlugin(t)})),s}var gt=Y.Global,mt={name:"localStorage",read:wt,write:function(t,e){return vt().setItem(t,e)},each:function(t){for(var e=vt().length-1;e>=0;e--){var n=vt().key(e);t(wt(n),n)}},remove:function(t){return vt().removeItem(t)},clearAll:function(){return vt().clear()}};function vt(){return gt.localStorage}function wt(t){return vt().getItem(t)}var yt=Y.Global,bt={name:"sessionStorage",read:_t,write:function(t,e){return St().setItem(t,e)},each:function(t){for(var e=St().length-1;e>=0;e--){var n=St().key(e);t(_t(n),n)}},remove:function(t){return St().removeItem(t)},clearAll:function(){return St().clear()}};function St(){return yt.sessionStorage}function _t(t){return St().getItem(t)}var Et=Y.trim,jt={name:"cookieStorage",read:function(t){if(!t||!Ft(t))return null;var e="(?:^|.*;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(kt.cookie.replace(RegExp(e),"$1"))},write:function(t,e){t&&(kt.cookie=escape(t)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")},each:xt,remove:Ot,clearAll:function(){xt((function(t,e){Ot(e)}))}},kt=Y.Global.document;function xt(t){for(var e=kt.cookie.split(/; ?/g),n=e.length-1;n>=0;n--)if(Et(e[n])){var i=e[n].split("="),r=unescape(i[0]);t(unescape(i[1]),r)}}function Ot(t){t&&Ft(t)&&(kt.cookie=escape(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function Ft(t){return RegExp("(?:^|;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(kt.cookie)}var At={name:"memoryStorage",read:function(t){return Tt[t]},write:function(t,e){Tt[t]=e},each:function(t){for(var e in Tt)Tt.hasOwnProperty(e)&&t(Tt[e],e)},remove:function(t){delete Tt[t]},clearAll:function(){Tt={}}},Tt={};function It(t,e=!1){t+="";let n,i=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],r=["0","1","2","3","4","5","6","7","8","9"],s=(e=e||!Salla.config.get("store.settings.arabic_numbers_enabled"))?i:r,a=e?r:i;for(let e=0;e<s.length;e++)n=RegExp(s[e],"g"),t=t.replace(n,a[e]);return t}function Rt(t){let e=(t.match(/\./g)||[]).length;return e&&1!==e?Rt(t.replace(/\.(.+)\./g,".$1")):t}function Ct(t,e,n){let i=t[0];return n&&0==t.length?Array.isArray(n)?(n.push(e),n):[n,e]:Array.isArray(n)?(n.push(e),n):"string"==typeof n?[n,e]:n?(n[i]=Ct(t.slice(1),e,n[i]),n):i?{[i]:Ct(t.slice(1),e)}:""===i?[e]:e}function Lt(t){return Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/")+"/"+t.ltrim("/")}var Pt={digitsOnly:function(t){return It(t,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function t(e,n=!1){if("string"==typeof e)return document.querySelectorAll(e).forEach((e=>t(e,n)));if(!e)return void Salla.logger.warn("Can't find Object With Id: "+e);let i=Salla.helpers.digitsOnly(e.value);return e.value=e.min&&i<e.min?e.min:e.max&&i>e.max?e.max:e.maxLength>=1&&(""+i).length>e.maxLength?(""+i).substring(0,e.maxLength):n||e.dataset.hasOwnProperty("digitsWithDecimal")?Rt(i):i.replace(/\D/g,"")},number:It,money:function(t){let e=Salla.config.currency(t?.currency).symbol;return It(t="object"==typeof t?t.amount:t)+" "+e},setNested:function(t,e,n){let i=t,r=e.split("."),s=r.length;for(let t=0;t<s-1;t++){let e=r[t];i[e]||(i[e]={}),i=i[e]}return i[r[s-1]]=n,t},getNested:function(t,e,n){let i=V(t,e);return void 0!==i?i:n},inputData:function(t,e,n={}){if(t.includes("[")){let i=t.split("]").join("").split("[");return{name:i[0],value:Ct(i.slice(1),e,n[i[0]])}}return{name:t,value:e}},url:{get:Lt,asset:function(t){return function(t){return window.location.origin+"/"+t.ltrim("/")}("themes/"+Salla.config.get("theme.name")+"/"+t.ltrim("/"))},cdn:function(t){return"https://cdn.salla.network/"+t.ltrim("/")},is_page:function(t){return t&&Salla.config.get("page.slug")===t},api:function(t){return Salla.config.get("store.api",Lt("")).rtrim("/")+"/"+t.ltrim("/")}},addParamToUrl:function(t,e){if(!e||!t)return window.location.href;let n=RegExp("([?&])"+t+"=[^&]+[&]?","g"),i=window.location.href.replace(n,"$1").replace(/&$|\?$/,"");return i+=(i.includes("?")?"&":"?")+t+"="+encodeURIComponent(e),i.replace(/&$|\?$/,"")},debounce:function(t,e){e=e||100;let n,i=[];return function(...r){return clearTimeout(n),n=setTimeout((()=>{let e=t(...r);i.forEach((t=>t(e))),i=[]}),e),new Promise((t=>i.push(t)))}}},Dt=function(t){let e={log:function(e,n){if(!t)return;if(!salla.config.isDebug())return;"trace"===salla.config.get("debug")&&(n="trace");let i=t.log,r=void 0===n?i:this.__dict__[n]||i,s=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"],a={event:"#CFF680",backend:"#7b68ee"}[n];a&&(s[0]+="%c"+n[0].toUpperCase()+n.substring(1),s.push(`margin-left: 5px;color: ${a};font-weight:bold; border:1px solid ${a}; padding: 2px 6px; border-radius: 5px;`)),r.call(t,...s.concat(...e))},__dict__:{trace:t.trace,debug:t.debug,info:t.info,warn:t.warn,error:t.error}};return{event:function(){e.log(arguments,"event")},trace:function(){e.log(arguments,"trace")},debug:function(){e.log(arguments,"debug")},info:function(){e.log(arguments,"info")},warn:function(){e.log(arguments,"warn")},error:function(){e.log(arguments,"error")},log:function(){e.log(arguments,void 0)},backend:function(){e.log(arguments,"backend")},logs:function(t){[t].flat().forEach((t=>t&&e.log([t].flat(),"backend")))}}}(console);const Nt=ht.createStore([mt,bt,jt,At],[]);"undefined"==typeof global?(window.salla=window.salla||window.Salla||{},window.Salla=window.salla):(global.salla=global.salla||global.Salla||{},global.Salla=global.salla),Salla.status="base",Salla.config=new class{constructor(t={},e={}){this.default_properties=e,this.properties_={...this.default_properties,...t}}merge(t){return Object.assign(this.properties_,t),this.properties_.store={...this.default_properties.store,...this.properties_.store},this}set(t,e){return t.includes(".")?(Salla.helpers.setNested(this.properties_,t,e),this):(this.properties_[t]=e,this)}get(t,e=null){return t.includes(".")?Salla.helpers.getNested(this.properties_,t,e):this.properties_.hasOwnProperty(t)?this.properties_[t]||e:e||void 0}all(){return this.properties_}isDebug(){return this.get("debug")||Salla.storage.get("debug")}},Salla.logger=Dt,Salla.event=new class extends W{constructor(){super({wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1}),this.delimiter="::","undefined"!=typeof document&&(this.body=document.querySelector("body")),this.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],this.ingoreLogEvents=["document::click","document::keyup","document::change"],this.noneFireableActions=["document.request"]}createAndDispatch(t,...e){this.dispatch(t,...e)}emit(t,...e){let n=t.replace("::",".");if(!this.noneFireableActions.includes(n)&&void 0!==Salla.call&&"function"==typeof Salla.call(n))return Salla.log(`'Salla.${n}(...)' triggered using event '${t}'`),n=n.split("."),void salla[n[0]][n[1]](...e);if(super.emit(t,...e),"undefined"!=typeof window){window.dataLayer=window.dataLayer||[];let n={event:t};e.map((t=>"object"==typeof t&&(n={...n,...t}))),window.dataLayer.push(n)}Salla.logger&&!this.ingoreLogEvents.includes(t)&&Salla.logger.event(t,...e),this.dispatchMobileEvent(t,{...e.values()})}dispatch(t,...e){return this.emit(t,...e)}dispatchEvents(t){if(t&&"object"==typeof t)for(const[e,n]of Object.entries(t))this.dispatch(e,n);else Salla.log("No Events To Dispatch!",t)}addListener(t,e){return this.on(t,e)}addEventListener(t,e){return this.on(t,e)}listen(t,e){return this.on(t,e)}registerGlobalListener(t,e){return this.onAny(e)}dispatchMobileEvent(t,e={}){if(!("undefined"!=typeof window&&window.dataLayer&&dataLayer[0]&&dataLayer[0].page&&dataLayer[0].page.mobileApp))return"";if(window.webkit)try{window.webkit.messageHandlers.callbackHandler.postMessage(JSON.stringify({event:t,details:e}))}catch(t){Salla.log(t,"The native context does not exist yet")}else if(Android)try{Android.customEventWithData(t,JSON.stringify({details:e}))}catch(t){Salla.log(t,"The native context does not exist yet")}}},Salla.storage=new class{constructor(){Salla.event.on("storage::item.remove",(t=>this.remove(t))),Salla.event.on("storage::item.set",((t,e)=>this.set(t,e))),this.store=Nt}set(t,e){if(t.includes(".")){let n=t.split(".")[0],i={[n]:this.store.get(n)};return i=Salla.helpers.setNested(i,t,e),this.store.set(n,i[n])}return this.store.set(t,e)}remove(t){return this.store.remove(t)}clearAll(){return this.store.clearAll()}get(t,e){if(t.includes(".")){let e=t.split(".")[0];return Salla.helpers.getNested({[e]:this.store.get(e)},t)}return this.store.get(t,e)}},Salla.cookie=new class{constructor(){Salla.event.on("cookies::remove",(t=>this.remove(t))),Salla.event.on("cookies::add",((t,e)=>this.set(t,e)))}get(t){return document.cookie.split("; ").find((e=>e.startsWith(t+"=")))?.split("=")[1]}set(t,e="",n=10){let i="";if(n){let t=new Date;t.setTime(t.getTime()+24*n*60*60*1e3),i="; expires="+t.toUTCString()}return document.cookie=`${t}=${e}${i}"; path=/; secure; SameSite=Lax"`,this}remove(t){return document.cookie=t+"=; Max-Age=0; path=/;",this}clearAll(){let t=document.cookie.split(";");for(let e=0;e<t.length;e++){let n=t[e],i=n.indexOf("="),r=i>-1?n.substr(0,i):n;this.remove(r)}}},Salla.helpers=Pt,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"[VI]{version}[/VI]"};var qt=Salla,$t=e((function(e){!function(t,n){e.exports?e.exports=n():t.EvEmitter=n()}("undefined"!=typeof window?window:t,(function(){function t(){}let e=t.prototype;return e.on=function(t,e){if(!t||!e)return this;let n=this._events=this._events||{},i=n[t]=n[t]||[];return i.includes(e)||i.push(e),this},e.once=function(t,e){if(!t||!e)return this;this.on(t,e);let n=this._onceEvents=this._onceEvents||{};return(n[t]=n[t]||{})[e]=!0,this},e.off=function(t,e){let n=this._events&&this._events[t];if(!n||!n.length)return this;let i=n.indexOf(e);return-1!=i&&n.splice(i,1),this},e.emitEvent=function(t,e){let n=this._events&&this._events[t];if(!n||!n.length)return this;n=n.slice(0),e=e||[];let i=this._onceEvents&&this._onceEvents[t];for(let r of n)i&&i[r]&&(this.off(t,r),delete i[r]),r.apply(this,e);return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t}))})),Ut=e((function(e){!function(t,n){e.exports?e.exports=n(t):t.fizzyUIUtils=n(t)}(t,(function(t){let e={extend:function(t,e){return Object.assign(t,e)},modulo:function(t,e){return(t%e+e)%e},makeArray:function(t){return Array.isArray(t)?t:null==t?[]:"object"==typeof t&&"number"==typeof t.length?[...t]:[t]},removeFrom:function(t,e){let n=t.indexOf(e);-1!=n&&t.splice(n,1)},getParent:function(t,e){for(;t.parentNode&&t!=document.body;)if((t=t.parentNode).matches(e))return t},getQueryElement:function(t){return"string"==typeof t?document.querySelector(t):t},handleEvent:function(t){let e="on"+t.type;this[e]&&this[e](t)},filterFindElements:function(t,n){return(t=e.makeArray(t)).filter((t=>t instanceof HTMLElement)).reduce(((t,e)=>{if(!n)return t.push(e),t;e.matches(n)&&t.push(e);let i=e.querySelectorAll(n);return t.concat(...i)}),[])},debounceMethod:function(t,e,n){n=n||100;let i=t.prototype[e],r=e+"Timeout";t.prototype[e]=function(){clearTimeout(this[r]);let t=arguments;this[r]=setTimeout((()=>{i.apply(this,t),delete this[r]}),n)}},docReady:function(t){let e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},toDashed:function(t){return t.replace(/(.)([A-Z])/g,(function(t,e,n){return e+"-"+n})).toLowerCase()}},n=t.console;return e.htmlInit=function(i,r){e.docReady((function(){let s="data-"+e.toDashed(r),a=document.querySelectorAll(`[${s}]`),o=t.jQuery;[...a].forEach((t=>{let e,a=t.getAttribute(s);try{e=a&&JSON.parse(a)}catch(e){return void(n&&n.error(`Error parsing ${s} on ${t.className}: ${e}`))}let l=new i(t,e);o&&o.data(t,r,l)}))}))},e}))})),zt=e((function(t){!function(e,n){t.exports?t.exports=n(e,$t,Ut):e.InfiniteScroll=n(e,e.EvEmitter,e.fizzyUIUtils)}(window,(function(t,e,n){let i=t.jQuery,r={};function s(t,e){let a=n.getQueryElement(t);if(a){if((t=a).infiniteScrollGUID){let n=r[t.infiniteScrollGUID];return n.option(e),n}this.element=t,this.options={...s.defaults},this.option(e),i&&(this.$element=i(this.element)),this.create()}else console.error("Bad element for InfiniteScroll: "+(a||t))}s.defaults={},s.create={},s.destroy={};let a=s.prototype;Object.assign(a,e.prototype);let o=0;a.create=function(){let t=this.guid=++o;if(this.element.infiniteScrollGUID=t,r[t]=this,this.pageIndex=1,this.loadCount=0,this.updateGetPath(),this.getPath&&this.getPath()){this.updateGetAbsolutePath(),this.log("initialized",[this.element.className]),this.callOnInit();for(let t in s.create)s.create[t].call(this)}else console.error("Disabling InfiniteScroll")},a.option=function(t){Object.assign(this.options,t)},a.callOnInit=function(){let t=this.options.onInit;t&&t.call(this,this)},a.dispatchEvent=function(t,e,n){this.log(t,n);let r=e?[e].concat(n):n;if(this.emitEvent(t,r),!i||!this.$element)return;let s=t+=".infiniteScroll";if(e){let n=i.Event(e);n.type=t,s=n}this.$element.trigger(s,n)};let l={initialized:t=>"on "+t,request:t=>"URL: "+t,load:(t,e)=>`${t.title||""}. URL: ${e}`,error:(t,e)=>`${t}. URL: ${e}`,append:(t,e,n)=>`${n.length} items. URL: ${e}`,last:(t,e)=>"URL: "+e,history:(t,e)=>"URL: "+e,pageIndex:function(t,e){return`current page determined to be: ${t} from ${e}`}};a.log=function(t,e){if(!this.options.debug)return;let n="[InfiniteScroll] "+t,i=l[t];i&&(n+=". "+i.apply(this,e)),console.log(n)},a.updateMeasurements=function(){this.windowHeight=t.innerHeight;let e=this.element.getBoundingClientRect();this.top=e.top+t.scrollY},a.updateScroller=function(){let e=this.options.elementScroll;if(e){if(this.scroller=!0===e?this.element:n.getQueryElement(e),!this.scroller)throw Error("Unable to find elementScroll: "+e)}else this.scroller=t},a.updateGetPath=function(){let t=this.options.path;if(!t)return void console.error("InfiniteScroll path option required. Set as: "+t);let e=typeof t;"function"!=e?"string"==e&&t.match("{{#}}")?this.updateGetPathTemplate(t):this.updateGetPathSelector(t):this.getPath=t},a.updateGetPathTemplate=function(t){this.getPath=()=>t.replace("{{#}}",this.pageIndex+1);let e=t.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)"),n=RegExp(e),i=location.href.match(n);i&&(this.pageIndex=parseInt(i[1],10),this.log("pageIndex",[this.pageIndex,"template string"]))};let u=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/],c=s.getPathParts=function(t){if(t)for(let e of u){let n=t.match(e);if(n){let[,t,e,i]=n;return{begin:t,index:e,end:i}}}};a.updateGetPathSelector=function(t){let e=document.querySelector(t);if(!e)return void console.error("Bad InfiniteScroll path option. Next link not found: "+t);let n=e.getAttribute("href"),i=c(n);if(!i)return void console.error("InfiniteScroll unable to parse next link href: "+n);let{begin:r,index:s,end:a}=i;this.isPathSelector=!0,this.getPath=()=>r+(this.pageIndex+1)+a,this.pageIndex=parseInt(s,10)-1,this.log("pageIndex",[this.pageIndex,"next link"])},a.updateGetAbsolutePath=function(){let t=this.getPath();if(t.match(/^http/)||t.match(/^\//))return void(this.getAbsolutePath=this.getPath);let{pathname:e}=location,n=t.match(/^\?/),i=e.substring(0,e.lastIndexOf("/")),r=n?e:i+"/";this.getAbsolutePath=()=>r+this.getPath()},s.create.hideNav=function(){let t=n.getQueryElement(this.options.hideNav);t&&(t.style.display="none",this.nav=t)},s.destroy.hideNav=function(){this.nav&&(this.nav.style.display="")},a.destroy=function(){this.allOff();for(let t in s.destroy)s.destroy[t].call(this);delete this.element.infiniteScrollGUID,delete r[this.guid],i&&this.$element&&i.removeData(this.element,"infiniteScroll")},s.throttle=function(t,e){let n,i;return e=e||200,function(){let r=+new Date,s=arguments,a=()=>{n=r,t.apply(this,s)};n&&r<n+e?(clearTimeout(i),i=setTimeout(a,e)):a()}},s.data=function(t){let e=(t=n.getQueryElement(t))&&t.infiniteScrollGUID;return e&&r[e]},s.setJQuery=function(t){i=t},n.htmlInit(s,"infinite-scroll"),a._init=function(){};let{jQueryBridget:f}=t;return i&&f&&f("infiniteScroll",s,i),s}))})),Mt=(e((function(t){!function(e,n){t.exports?t.exports=n(e,zt):n(e,e.InfiniteScroll)}(window,(function(t,e){let n=e.prototype;Object.assign(e.defaults,{loadOnScroll:!0,checkLastPage:!0,responseBody:"text",domParseResponse:!0}),e.create.pageLoad=function(){this.canLoad=!0,this.on("scrollThreshold",this.onScrollThresholdLoad),this.on("load",this.checkLastPage),this.options.outlayer&&this.on("append",this.onAppendOutlayer)},n.onScrollThresholdLoad=function(){this.options.loadOnScroll&&this.loadNextPage()};let i=new DOMParser;function r(t){let e=document.createDocumentFragment();return t&&e.append(...t),e}return n.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:t,domParseResponse:e,fetchOptions:n}=this.options,r=this.getAbsolutePath();this.isLoading=!0,"function"==typeof n&&(n=n());let s=fetch(r,n).then((n=>n.ok?n[t]().then((s=>("text"==t&&e&&(s=i.parseFromString(s,"text/html")),204==n.status?(this.lastPageReached(s,r),{body:s,response:n}):this.onPageLoad(s,r,n)))):(this.onPageError(Error(n.statusText),r,n),{response:n}))).catch((t=>{this.onPageError(t,r)}));return this.dispatchEvent("request",null,[r,s]),s},n.onPageLoad=function(t,e,n){return this.options.append||(this.isLoading=!1),this.pageIndex++,this.loadCount++,this.dispatchEvent("load",null,[t,e,n]),this.appendNextPage(t,e,n)},n.appendNextPage=function(t,e,n){let{append:i,responseBody:s,domParseResponse:a}=this.options;if("text"!=s||!a||!i)return{body:t,response:n};let o=t.querySelectorAll(i),l={body:t,response:n,items:o};if(!o||!o.length)return this.lastPageReached(t,e),l;let u=r(o),c=()=>(this.appendItems(o,u),this.isLoading=!1,this.dispatchEvent("append",null,[t,e,o,n]),l);return this.options.outlayer?this.appendOutlayerItems(u,c):c()},n.appendItems=function(t,e){t&&t.length&&(function(t){let e=t.querySelectorAll("script");for(let t of e){let e=document.createElement("script"),n=t.attributes;for(let t of n)e.setAttribute(t.name,t.value);e.innerHTML=t.innerHTML,t.parentNode.replaceChild(e,t)}}(e=e||r(t)),this.element.appendChild(e))},n.appendOutlayerItems=function(n,i){let r=e.imagesLoaded||t.imagesLoaded;return r?new Promise((function(t){r(n,(function(){let e=i();t(e)}))})):(console.error("[InfiniteScroll] imagesLoaded required for outlayer option"),void(this.isLoading=!1))},n.onAppendOutlayer=function(t,e,n){this.options.outlayer.appended(n)},n.checkLastPage=function(t,e){let n,{checkLastPage:i,path:r}=this.options;if(i){if("function"==typeof r&&!this.getPath())return void this.lastPageReached(t,e);"string"==typeof i?n=i:this.isPathSelector&&(n=r),n&&t.querySelector&&(t.querySelector(n)||this.lastPageReached(t,e))}},n.lastPageReached=function(t,e){this.canLoad=!1,this.dispatchEvent("last",null,[t,e])},n.onPageError=function(t,e,n){return this.isLoading=!1,this.canLoad=!1,this.dispatchEvent("error",null,[t,e,n]),t},e.create.prefill=function(){if(!this.options.prefill)return;let t=this.options.append;t?(this.updateMeasurements(),this.updateScroller(),this.isPrefilling=!0,this.on("append",this.prefill),this.once("error",this.stopPrefill),this.once("last",this.stopPrefill),this.prefill()):console.error("append option required for prefill. Set as :"+t)},n.prefill=function(){let t=this.getPrefillDistance();this.isPrefilling=t>=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},n.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},n.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},e}))})),e((function(t){!function(e,n){t.exports?t.exports=n(e,zt,Ut):n(e,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,n){let i=e.prototype;return Object.assign(e.defaults,{scrollThreshold:400}),e.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);let t=this.options.scrollThreshold;(t||0===t)&&this.enableScrollWatch()},e.destroy.scrollWatch=function(){this.disableScrollWatch()},i.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},i.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},i.bindScrollWatchEvents=function(e){let n=e?"addEventListener":"removeEventListener";this.scroller[n]("scroll",this.pageScrollHandler),t[n]("resize",this.resizeHandler)},i.onPageScroll=e.throttle((function(){this.getBottomDistance()<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")})),i.getBottomDistance=function(){let e,n;return this.options.elementScroll?(e=this.scroller.scrollHeight,n=this.scroller.scrollTop+this.scroller.clientHeight):(e=this.top+this.element.clientHeight,n=t.scrollY+this.windowHeight),e-n},i.onResize=function(){this.updateMeasurements()},n.debounceMethod(e,"onResize",150),e}))})),e((function(t){!function(e,n){t.exports?t.exports=n(e,zt,Ut):n(e,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,n){let i=e.prototype;Object.assign(e.defaults,{history:"replace"});let r=document.createElement("a");return e.create.history=function(){this.options.history&&(r.href=this.getAbsolutePath(),(r.origin||r.protocol+"//"+r.host)==location.origin?this.options.append?this.createHistoryAppend():this.createHistoryPageLoad():console.error(`[InfiniteScroll] cannot set history with different origin: ${r.origin} on ${location.origin} . History behavior disabled.`))},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(!0)},i.bindHistoryAppendEvents=function(e){let n=e?"addEventListener":"removeEventListener";this.scroller[n]("scroll",this.scrollHistoryHandler),t[n]("unload",this.unloadHandler)},i.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},e.destroy.history=i.destroyHistory=function(){this.options.history&&this.options.append&&this.bindHistoryAppendEvents(!1)},i.onAppendHistory=function(t,e,n){if(!n||!n.length)return;let i=this.getElementScrollY(n[0]);r.href=e,this.scrollPages.push({top:i,path:r.href,title:t.title})},i.getElementScrollY=function(e){return this.options.elementScroll?e.offsetTop-this.top:e.getBoundingClientRect().top+t.scrollY},i.onScrollHistory=function(){let t=this.getClosestScrollPage();t!=this.scrollPage&&(this.scrollPage=t,this.setHistory(t.title,t.path))},n.debounceMethod(e,"onScrollHistory",150),i.getClosestScrollPage=function(){let e,n;e=this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:t.scrollY+this.windowHeight/2;for(let t of this.scrollPages){if(t.top>=e)break;n=t}return n},i.setHistory=function(t,e){let n=this.options.history;n&&history[n+"State"]&&(history[n+"State"](null,t,e),this.options.historyTitle&&(document.title=t),this.dispatchEvent("history",null,[t,e]))},i.onUnload=function(){if(0===this.scrollPage.top)return;let e=t.scrollY-this.scrollPage.top+this.top;this.destroyHistory(),scrollTo(0,e)},i.onPageLoadHistory=function(t,e){this.setHistory(t.title,e)},e}))})),e((function(t){!function(e,n){t.exports?t.exports=n(0,zt,Ut):n(0,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,n){class i{constructor(t,e){this.element=t,this.infScroll=e,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),e.on("request",this.disable.bind(this)),e.on("load",this.enable.bind(this)),e.on("error",this.hide.bind(this)),e.on("last",this.hide.bind(this))}onClick(t){t.preventDefault(),this.infScroll.loadNextPage()}enable(){this.element.removeAttribute("disabled")}disable(){this.element.disabled="disabled"}hide(){this.element.style.display="none"}destroy(){this.element.removeEventListener("click",this.clickHandler)}}return e.create.button=function(){let t=n.getQueryElement(this.options.button);t&&(this.button=new i(t,this))},e.destroy.button=function(){this.button&&this.button.destroy()},e.Button=i,e}))})),e((function(t){!function(e,n){t.exports?t.exports=n(0,zt,Ut):n(0,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,n){let i=e.prototype;function r(t){a(t,"none")}function s(t){a(t,"block")}function a(t,e){t&&(t.style.display=e)}return e.create.status=function(){let t=n.getQueryElement(this.options.status);t&&(this.statusElement=t,this.statusEventElements={request:t.querySelector(".infinite-scroll-request"),error:t.querySelector(".infinite-scroll-error"),last:t.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(t){this[t](this.options.append?"append":"load",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(t){s(this.statusElement),this.hideStatusEventElements(),s(this.statusEventElements[t])},i.hideAllStatus=function(){r(this.statusElement),this.hideStatusEventElements()},i.hideStatusEventElements=function(){for(let t in this.statusEventElements)r(this.statusEventElements[t])},e}))})),e((function(t){
|
|
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
|
-
window,t.exports&&(t.exports=zt)}))),Bt=e((function(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
|
-
t.exports=function(){function t(t){return"-Inf"===t?-1/0:"+Inf"===t||"Inf"===t||"*"===t?1/0:parseInt(t,10)}var e=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/,n=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/,i="en",r=function(t){this.locale=(t=t||{}).locale||function(){if("undefined"!=typeof document&&document.documentElement)return document.documentElement.lang}()||i,this.fallback=t.fallback,this.messages=t.messages};return r.prototype.setMessages=function(t){this.messages=t},r.prototype.getLocale=function(){return this.locale||this.fallback},r.prototype.setLocale=function(t){this.locale=t},r.prototype.getFallback=function(){return this.fallback},r.prototype.setFallback=function(t){this.fallback=t},r.prototype.has=function(t,e){return!("string"!=typeof t||!this.messages)&&null!==this._getMessage(t,e)},r.prototype.get=function(t,e,n){if(!this.has(t,n))return t;var i=this._getMessage(t,n);return null===i?t:(e&&(i=this._applyReplacements(i,e)),i)},r.prototype.trans=function(t,e){return this.get(t,e)},r.prototype.choice=function(t,e,i,r){(i=void 0!==i?i:{}).count=e;var s=this.get(t,i,r);if(null==s)return s;for(var a=s.split("|"),o=[],l=0;l<a.length;l++)if(a[l]=a[l].trim(),n.test(a[l])){var u=a[l].split(/\s/);o.push(u.shift()),a[l]=u.join(" ")}if(1===a.length)return s;for(var c=0;c<o.length;c++)if(this._testInterval(e,o[c]))return a[c];return r=r||this._getLocale(t),a[this._getPluralForm(e,r)]},r.prototype.transChoice=function(t,e,n){return this.choice(t,e,n)},r.prototype._parseKey=function(t,e){if("string"!=typeof t||"string"!=typeof e)return null;var n=t.split("."),i=n[0].replace(/\//g,".");return{source:e+"."+i,sourceFallback:this.getFallback()+"."+i,entries:n.slice(1)}},r.prototype._getMessage=function(t,e){if(e=e||this.getLocale(),t=this._parseKey(t,e),void 0===this.messages[t.source]&&void 0===this.messages[t.sourceFallback])return null;var n=this.messages[t.source],i=t.entries.slice(),r=i.join(".");if("string"!=typeof(n=void 0!==n?this._getValueInKey(n,r):void 0)&&this.messages[t.sourceFallback])for(n=this.messages[t.sourceFallback],i=t.entries.slice(),r="";i.length&&void 0!==n;)n[r=r?r.concat(".",i.shift()):i.shift()]&&(n=n[r],r="");return"string"!=typeof n?null:n},r.prototype._getValueInKey=function(t,e){if("string"==typeof t[e])return t[e];for(var n=(e=(e=e.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),i=0,r=n.length;i<r;++i){var s=n.slice(0,i+1).join("."),a=n.slice(i+1,n.length).join(".");if(t[s])return this._getValueInKey(t[s],a)}return t},r.prototype._getLocale=function(t){return t=this._parseKey(t,this.locale),this.messages[t.source]?this.locale:this.messages[t.sourceFallback]?this.fallback:null},r.prototype._findMessageInTree=function(t,e){for(;t.length&&void 0!==e;){var n=t.join(".");if(e[n]){e=e[n];break}e=e[t.shift()]}return e},r.prototype._sortReplacementKeys=function(t,e){return e.length-t.length},r.prototype._applyReplacements=function(t,e){return Object.keys(e).sort(this._sortReplacementKeys).forEach((function(n){t=t.replace(RegExp(":"+n,"gi"),(function(t){var i=e[n];return t===t.toUpperCase()?i.toUpperCase():t===t.replace(/\w/i,(function(t){return t.toUpperCase()}))?i.charAt(0).toUpperCase()+i.slice(1):i}))})),t},r.prototype._testInterval=function(n,i){if("string"!=typeof i)throw"Invalid interval: should be a string.";var r=(i=i.trim()).match(e);if(!r)throw"Invalid interval: "+i;if(!r[2]){var s=(r=r.filter((function(t){return!!t})))[1],a=t(r[2]);a===1/0&&(a=-1/0);var o=t(r[3]);return("["===s?n>=a:n>a)&&("]"===r[4]?n<=o:n<o)}for(var l=r[2].split(","),u=0;u<l.length;u++)if(parseInt(l[u],10)===n)return!0;return!1},r.prototype._getPluralForm=function(t,e){switch(e){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 1==t?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 0===t||1===t?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2;case"cs":case"sk":return 1==t?0:t>=2&&t<=4?1:2;case"ga":return 1==t?0:2==t?1:2;case"lt":return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2;case"sl":return t%100==1?0:t%100==2?1:t%100==3||t%100==4?2:3;case"mk":return t%10==1?0:1;case"mt":return 1==t?0:0===t||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3;case"lv":return 0===t?0:t%10==1&&t%100!=11?1:2;case"pl":return 1==t?0:t%10>=2&&t%10<=4&&(t%100<12||t%100>14)?1:2;case"cy":return 1==t?0:2==t?1:8==t||11==t?2:3;case"ro":return 1==t?0:0===t||t%100>0&&t%100<20?1:2;case"ar":return 0===t?0:1==t?1:2==t?2:t%100>=3&&t%100<=10?3:t%100>=11&&t%100<=99?4:5;default:return 0}},r}()})),Jt=function(t,e){return function(){for(var n=Array(arguments.length),i=0;i<n.length;i++)n[i]=arguments[i];return t.apply(e,n)}},Gt=Object.prototype.toString,Ht=function(t){return function(e){var n=Gt.call(e);return t[n]||(t[n]=n.slice(8,-1).toLowerCase())}}(Object.create(null));function Qt(t){return t=t.toLowerCase(),function(e){return Ht(e)===t}}function Vt(t){return Array.isArray(t)}function Wt(t){return void 0===t}var Zt=Qt("ArrayBuffer");function Xt(t){return null!==t&&"object"==typeof t}function Kt(t){if("object"!==Ht(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var Yt=Qt("Date"),te=Qt("File"),ee=Qt("Blob"),ne=Qt("FileList");function ie(t){return"[object Function]"===Gt.call(t)}var re=Qt("URLSearchParams");function se(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),Vt(t))for(var n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.call(null,t[r],r,t)}var ae=function(t){return function(e){return t&&e instanceof t}}("undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array)),oe={isArray:Vt,isArrayBuffer:Zt,isBuffer:function(t){return null!==t&&!Wt(t)&&null!==t.constructor&&!Wt(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||Gt.call(t)===e||ie(t.toString)&&""+t===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Zt(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:Xt,isPlainObject:Kt,isUndefined:Wt,isDate:Yt,isFile:te,isBlob:ee,isFunction:ie,isStream:function(t){return Xt(t)&&ie(t.pipe)},isURLSearchParams:re,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:se,merge:function t(){var e={};function n(n,i){e[i]=Kt(e[i])&&Kt(n)?t(e[i],n):Kt(n)?t({},n):Vt(n)?n.slice():n}for(var i=0,r=arguments.length;i<r;i++)se(arguments[i],n);return e},extend:function(t,e,n){return se(e,(function(e,i){t[i]=n&&"function"==typeof e?Jt(e,n):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,n,i){t.prototype=Object.create(e.prototype,i),t.prototype.constructor=t,n&&Object.assign(t.prototype,n)},toFlatObject:function(t,e,n){var i,r,s,a={};e=e||{};do{for(r=(i=Object.getOwnPropertyNames(t)).length;r-- >0;)a[s=i[r]]||(e[s]=t[s],a[s]=!0);t=Object.getPrototypeOf(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:Ht,kindOfTest:Qt,endsWith:function(t,e,n){t+="",(void 0===n||n>t.length)&&(n=t.length);var i=t.indexOf(e,n-=e.length);return-1!==i&&i===n},toArray:function(t){if(!t)return null;var e=t.length;if(Wt(e))return null;for(var n=Array(e);e-- >0;)n[e]=t[e];return n},isTypedArray:ae,isFileList:ne};function le(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var ue=function(t,e,n){if(!e)return t;var i;if(n)i=n(e);else if(oe.isURLSearchParams(e))i=""+e;else{var r=[];oe.forEach(e,(function(t,e){null!=t&&(oe.isArray(t)?e+="[]":t=[t],oe.forEach(t,(function(t){oe.isDate(t)?t=t.toISOString():oe.isObject(t)&&(t=JSON.stringify(t)),r.push(le(e)+"="+le(t))})))})),i=r.join("&")}if(i){var s=t.indexOf("#");-1!==s&&(t=t.slice(0,s)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t};function ce(){this.handlers=[]}ce.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},ce.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},ce.prototype.forEach=function(t){oe.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var fe=ce,he=function(t,e){oe.forEach(t,(function(n,i){i!==e&&i.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[i])}))};function de(t,e,n,i,r){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),i&&(this.request=i),r&&(this.response=r)}oe.inherits(de,Error,{toJSON:function(){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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var pe=de.prototype,ge={};["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"].forEach((function(t){ge[t]={value:t}})),Object.defineProperties(de,ge),Object.defineProperty(pe,"isAxiosError",{value:!0}),de.from=function(t,e,n,i,r,s){var a=Object.create(pe);return oe.toFlatObject(t,a,(function(t){return t!==Error.prototype})),de.call(a,t.message,e,n,i,r),a.name=t.name,s&&Object.assign(a,s),a};var me=de,ve={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},we=function(t,e){e=e||new FormData;var n=[];function i(t){return null===t?"":oe.isDate(t)?t.toISOString():oe.isArrayBuffer(t)||oe.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(r,s){if(oe.isPlainObject(r)||oe.isArray(r)){if(-1!==n.indexOf(r))throw Error("Circular reference detected in "+s);n.push(r),oe.forEach(r,(function(n,r){if(!oe.isUndefined(n)){var a,o=s?s+"."+r:r;if(n&&!s&&"object"==typeof n)if(oe.endsWith(r,"{}"))n=JSON.stringify(n);else if(oe.endsWith(r,"[]")&&(a=oe.toArray(n)))return void a.forEach((function(t){!oe.isUndefined(t)&&e.append(o,i(t))}));t(n,o)}})),n.pop()}else e.append(s,i(r))}(t),e},ye=oe.isStandardBrowserEnv()?{write:function(t,e,n,i,r,s){var a=[];a.push(t+"="+encodeURIComponent(e)),oe.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),oe.isString(i)&&a.push("path="+i),oe.isString(r)&&a.push("domain="+r),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},be=function(t,e){return t&&!function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}(e)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e},Se=["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"],_e=oe.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var i=t;return e&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=oe.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0};function Ee(t){me.call(this,null==t?"canceled":t,me.ERR_CANCELED),this.name="CanceledError"}oe.inherits(Ee,me,{__CANCEL__:!0});var je=Ee,ke=function(t){return new Promise((function(e,n){var i,r=t.data,s=t.headers,a=t.responseType;function o(){t.cancelToken&&t.cancelToken.unsubscribe(i),t.signal&&t.signal.removeEventListener("abort",i)}oe.isFormData(r)&&oe.isStandardBrowserEnv()&&delete s["Content-Type"];var l=new XMLHttpRequest;t.auth&&(s.Authorization="Basic "+btoa((t.auth.username||"")+":"+(t.auth.password?unescape(encodeURIComponent(t.auth.password)):"")));var u=be(t.baseURL,t.url);function c(){if(l){var i="getAllResponseHeaders"in l?function(t){var e,n,i,r={};return t?(oe.forEach(t.split("\n"),(function(t){if(i=t.indexOf(":"),e=oe.trim(t.substr(0,i)).toLowerCase(),n=oe.trim(t.substr(i+1)),e){if(r[e]&&Se.indexOf(e)>=0)return;r[e]="set-cookie"===e?(r[e]?r[e]:[]).concat([n]):r[e]?r[e]+", "+n:n}})),r):r}(l.getAllResponseHeaders()):null;!function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new me("Request failed with status code "+n.status,[me.ERR_BAD_REQUEST,me.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}((function(t){e(t),o()}),(function(t){n(t),o()}),{data:a&&"text"!==a&&"json"!==a?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:i,config:t,request:l}),l=null}}if(l.open(t.method.toUpperCase(),ue(u,t.params,t.paramsSerializer),!0),l.timeout=t.timeout,"onloadend"in l?l.onloadend=c:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(c)},l.onabort=function(){l&&(n(new me("Request aborted",me.ECONNABORTED,t,l)),l=null)},l.onerror=function(){n(new me("Network Error",me.ERR_NETWORK,t,l,l)),l=null},l.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new me(e,(t.transitional||ve).clarifyTimeoutError?me.ETIMEDOUT:me.ECONNABORTED,t,l)),l=null},oe.isStandardBrowserEnv()){var f=(t.withCredentials||_e(u))&&t.xsrfCookieName?ye.read(t.xsrfCookieName):void 0;f&&(s[t.xsrfHeaderName]=f)}"setRequestHeader"in l&&oe.forEach(s,(function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete s[e]:l.setRequestHeader(e,t)})),oe.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),a&&"json"!==a&&(l.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&l.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(i=function(t){l&&(n(!t||t&&t.type?new je:t),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(i),t.signal&&(t.signal.aborted?i():t.signal.addEventListener("abort",i))),r||(r=null);var h=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(u);h&&-1===["http","https","file"].indexOf(h)?n(new me("Unsupported protocol "+h+":",me.ERR_BAD_REQUEST,t)):l.send(r)}))},xe={"Content-Type":"application/x-www-form-urlencoded"};function Oe(t,e){!oe.isUndefined(t)&&oe.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var Fe={transitional:ve,adapter:function(){var t;return("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(t=ke),t}(),transformRequest:[function(t,e){if(he(e,"Accept"),he(e,"Content-Type"),oe.isFormData(t)||oe.isArrayBuffer(t)||oe.isBuffer(t)||oe.isStream(t)||oe.isFile(t)||oe.isBlob(t))return t;if(oe.isArrayBufferView(t))return t.buffer;if(oe.isURLSearchParams(t))return Oe(e,"application/x-www-form-urlencoded;charset=utf-8"),""+t;var n,i=oe.isObject(t),r=e&&e["Content-Type"];if((n=oe.isFileList(t))||i&&"multipart/form-data"===r){var s=this.env&&this.env.FormData;return we(n?{"files[]":t}:t,s&&new s)}return i||"application/json"===r?(Oe(e,"application/json"),function(t){if(oe.isString(t))try{return(0,JSON.parse)(t),oe.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||Fe.transitional,n=!(e&&e.silentJSONParsing)&&"json"===this.responseType;if(n||e&&e.forcedJSONParsing&&oe.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(n){if("SyntaxError"===t.name)throw me.from(t,me.ERR_BAD_RESPONSE,this,null,this.response);throw t}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:null},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};oe.forEach(["delete","get","head"],(function(t){Fe.headers[t]={}})),oe.forEach(["post","put","patch"],(function(t){Fe.headers[t]=oe.merge(xe)}));var Ae=Fe,Te=function(t,e,n){var i=this||Ae;return oe.forEach(n,(function(n){t=n.call(i,t,e)})),t},Ie=function(t){return!(!t||!t.__CANCEL__)};function Re(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new je}var Ce=function(t){return Re(t),t.headers=t.headers||{},t.data=Te.call(t,t.data,t.headers,t.transformRequest),t.headers=oe.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),oe.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Ae.adapter)(t).then((function(e){return Re(t),e.data=Te.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return Ie(e)||(Re(t),e&&e.response&&(e.response.data=Te.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},Le=function(t,e){e=e||{};var n={};function i(t,e){return oe.isPlainObject(t)&&oe.isPlainObject(e)?oe.merge(t,e):oe.isPlainObject(e)?oe.merge({},e):oe.isArray(e)?e.slice():e}function r(n){return oe.isUndefined(e[n])?oe.isUndefined(t[n])?void 0:i(void 0,t[n]):i(t[n],e[n])}function s(t){if(!oe.isUndefined(e[t]))return i(void 0,e[t])}function a(n){return oe.isUndefined(e[n])?oe.isUndefined(t[n])?void 0:i(void 0,t[n]):i(void 0,e[n])}function o(n){return n in e?i(t[n],e[n]):n in t?i(void 0,t[n]):void 0}var l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o};return oe.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=l[t]||r,i=e(t);oe.isUndefined(i)&&e!==o||(n[t]=i)})),n},Pe={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){Pe[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));var De={};Pe.transitional=function(t,e,n){function i(t,e){return"[Axios v0.27.2] Transitional option '"+t+"'"+e+(n?". "+n:"")}return function(n,r,s){if(!1===t)throw new me(i(r," has been removed"+(e?" in "+e:"")),me.ERR_DEPRECATED);return e&&!De[r]&&(De[r]=!0,console.warn(i(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,s)}};var Ne={assertOptions:function(t,e,n){if("object"!=typeof t)throw new me("options must be an object",me.ERR_BAD_OPTION_VALUE);for(var i=Object.keys(t),r=i.length;r-- >0;){var s=i[r],a=e[s];if(a){var o=t[s],l=void 0===o||a(o,s,t);if(!0!==l)throw new me("option "+s+" must be "+l,me.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new me("Unknown option "+s,me.ERR_BAD_OPTION)}},validators:Pe},qe=Ne.validators;function $e(t){this.defaults=t,this.interceptors={request:new fe,response:new fe}}$e.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=Le(this.defaults,e)).method=e.method?e.method.toLowerCase():this.defaults.method?this.defaults.method.toLowerCase():"get";var n=e.transitional;void 0!==n&&Ne.assertOptions(n,{silentJSONParsing:qe.transitional(qe.boolean),forcedJSONParsing:qe.transitional(qe.boolean),clarifyTimeoutError:qe.transitional(qe.boolean)},!1);var i=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,i.unshift(t.fulfilled,t.rejected))}));var s,a=[];if(this.interceptors.response.forEach((function(t){a.push(t.fulfilled,t.rejected)})),!r){var o=[Ce,void 0];for(Array.prototype.unshift.apply(o,i),o=o.concat(a),s=Promise.resolve(e);o.length;)s=s.then(o.shift(),o.shift());return s}for(var l=e;i.length;){var u=i.shift(),c=i.shift();try{l=u(l)}catch(t){c(t);break}}try{s=Ce(l)}catch(t){return Promise.reject(t)}for(;a.length;)s=s.then(a.shift(),a.shift());return s},$e.prototype.getUri=function(t){t=Le(this.defaults,t);var e=be(t.baseURL,t.url);return ue(e,t.params,t.paramsSerializer)},oe.forEach(["delete","get","head","options"],(function(t){$e.prototype[t]=function(e,n){return this.request(Le(n||{},{method:t,url:e,data:(n||{}).data}))}})),oe.forEach(["post","put","patch"],(function(t){function e(e){return function(n,i,r){return this.request(Le(r||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:i}))}}$e.prototype[t]=e(),$e.prototype[t+"Form"]=e(!0)}));var Ue=$e;function ze(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;this.promise.then((function(t){if(n._listeners){var e,i=n._listeners.length;for(e=0;e<i;e++)n._listeners[e](t);n._listeners=null}})),this.promise.then=function(t){var e,i=new Promise((function(t){n.subscribe(t),e=t})).then(t);return i.cancel=function(){n.unsubscribe(e)},i},t((function(t){n.reason||(n.reason=new je(t),e(n.reason))}))}ze.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},ze.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},ze.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},ze.source=function(){var t;return{token:new ze((function(e){t=e})),cancel:t}};var Me=ze,Be=function t(e){var n=new Ue(e),i=Jt(Ue.prototype.request,n);return oe.extend(i,Ue.prototype,n),oe.extend(i,n),i.create=function(n){return t(Le(e,n))},i}(Ae);Be.Axios=Ue,Be.CanceledError=je,Be.CancelToken=Me,Be.isCancel=Ie,Be.VERSION="0.27.2",Be.toFormData=we,Be.AxiosError=me,Be.Cancel=Be.CanceledError,Be.all=function(t){return Promise.all(t)},Be.spread=function(t){return function(e){return t.apply(null,e)}},Be.isAxiosError=function(t){return oe.isObject(t)&&!0===t.isAxiosError};var Je=Be;Je.default=Be;var Ge=Je;function He(t){this.message=t}(He.prototype=Error()).name="InvalidCharacterError";var Qe="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=(t+"").replace(/=+$/,"");if(e.length%4==1)throw new He("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,r=0,s=0,a="";i=e.charAt(s++);~i&&(n=r%4?64*n+i:i,r++%4)?a+=String.fromCharCode(255&n>>(-2*r&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return a};function Ve(t){var e=t.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(Qe(t).replace(/(.)/g,(function(t,e){var n=e.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(e)}catch(t){return Qe(e)}}function We(t){this.message=t}function Ze(t,e){if("string"!=typeof t)throw new We("Invalid token specified");var n=!0===(e=e||{}).header?0:1;try{return JSON.parse(Ve(t.split(".")[n]))}catch(t){throw new We("Invalid token specified: "+t.message)}}(We.prototype=Error()).name="InvalidTokenError";let Xe=function(t){return alert(t)},Ke=function(t,e){return Xe(t,Ye.error,e)},Ye={error:"error",success:"success",info:"info"};var tn={fire:function(t,e,n){return Xe(t,e,n)},setNotifier:function(t){Xe=t,salla.event.emit("twilight::notifier.changed")},error:Ke,success:function(t,e){return Xe(t,Ye.success,e)},info:function(t,e){return Xe(t,Ye.info,e)},sallaInitiated:function(){let t=window.location.href.match(/([\?\&]danger=)[^&]+/g);t&&(window.history.replaceState(null,document.title,window.location.pathname),salla.event.once("twilight::notifier.changed",(()=>{t.forEach((t=>{Ke(decodeURI(t.replace("?danger=","").replace("&danger=","")))}))})))},types:Ye};class en{constructor(t,e){return this.api=t,this.event=e,new Proxy(this,{get:function(n,i){return"event"===i?e:"api"===i?t:t&&t[i]||n[i]}})}}String.prototype.toStudlyCase=function(){return this.trim().replace(/([^a-zA-Z\d].)/g,(function(t){return t.toUpperCase().replace(/[^a-zA-Z\d]/g,"")}))},String.prototype.toDatasetName=function(){return this.startsWith("data-")?this.substr(5).toStudlyCase():this.toStudlyCase()},String.prototype.toSelector=function(){return this.trim().startsWith(".")||this.trim().startsWith("#")?this:"#"+this},String.prototype.replaceArray=function(t,e){for(var n,i=this,r=0;r<t.length;r++)n=RegExp(t[r],"g"),i=i.replace(n,e[r]);return i},String.prototype.rtrim=function(t){return void 0===t&&(t="\\s"),this.replace(RegExp("["+t+"]*$"),"")},String.prototype.ltrim=function(t){return void 0===t&&(t="\\s"),this.replace(RegExp("^["+t+"]*"),"")},String.prototype.digitsOnly=function(){return Salla.helpers.digitsOnly(this)},Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){for(var e=this;e;){if(e.matches(t))return e;e=e.parentElement}}),Element.prototype.getElementSallaData=function(t,...e){if(!this.getAttribute)return;if(this.hasAttribute("data-json"))try{return JSON.parse(this.getAttribute("data-json"))}catch(t){}let n=this.getAttribute("data-function");if(n&&window[n])return"function"==typeof window[n]?this.getFilteredData(window[n].call(this,...e)):this.getFilteredData(window[n]);let i=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if(i="FORM"===this.tagName?this:i||this.closest("form")||this.closest("[salla-form-data]")||this,i&&"FORM"===i.tagName)return this.getFilteredData(new FormData(i),null,i);let r=i.querySelectorAll("[name]");if(!r.length)return this.getFilteredData();let s=Object.assign({},this.dataset);return r.forEach((t=>{if(!["checkbox","radio"].includes(t.type)||t.checked)try{let e=Salla.helpers.inputData(t.name,t.value,s);s[e.name]=e.value}catch(e){Salla.log(t.name+" can't be send")}})),this.getFilteredData(s)},Element.prototype.canEventFireHook=function(t){return!!this.hasAttribute&&this.hasAttribute(Salla.api.hooksPrefix+t.type)},Element.prototype.hasAttributeStartsWith=function(t,e){t=t.toLowerCase();for(var n=0;n<this.attributes.length;n++){let i=this.attributes[n].name.toLowerCase();if(0===i.indexOf(t))return!e||i}return!1},HTMLFormElement.prototype.getAjaxFormData=function(t){var e=this.querySelectorAll('input[type="file"]');e.forEach((t=>{t.files.length||t.setAttribute("disabled","")}));var n=new FormData(this);return e.forEach((t=>{t.files.length||t.removeAttribute("disabled")})),{formData:this.getFilteredData(n,t),url:this.getAttribute("action"),method:this.getAttribute("method")||"post",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}},Element.prototype.getFilteredData=function(t=null,e=null,n=null){return t=t||n?.dataset||this.dataset,n&&this.name&&void 0!==this.value&&(t=function(t,e,n){return t instanceof FormData?t.append(e,n):t[e]=n,t}(t,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((i=>{let r=n?.dataset[i]||this.dataset[i];if(r){var s=window[r];if("function"==typeof s){if(!s(t,n||this,e)&&t)throw`Data failed to be pass verify function window.${r}(formData, element, event)!`;return s(t,n||this,e)}Salla.log("window."+r+"() not found!")}})),t},HTMLAnchorElement.prototype.getAjaxFormData=function(t){return{formData:this.getFilteredData(null,t),url:this.getAttribute("href"),method:this.dataset.type||"get",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}};class nn{constructor(){this.events={},this.namespace="";let t=/function (.{1,})\(/.exec(""+this.constructor);this.className=(t&&t.length>1?t[1]:"").toLowerCase()}after_init(){this.createDynamicFunctions()}createDynamicFunctions(){Object.keys(this.events).forEach((t=>{this.createDynamicEventFuns(t),this.createDynamicListenerFuns(t)}))}createDynamicEventFuns(t){if(this[t])return;let e=this;this[t]=function(...n){return e.dispatch(t,...n)}}createDynamicListenerFuns(t){let e="on"+t.charAt(0).toUpperCase()+t.slice(1);if(this[e])return;let n=this;this[e]=function(e){return n.on(t,(async(...t)=>e(...t)))}}getEventName(t){return t=this.events[t]||t,!this.namespace||t.includes("::")?t:this.namespace+Salla.event.delimiter+t}dispatch(t,...e){return Salla.event.emitAsync(this.getEventName(t),...e)}on(t,e){return Salla.event.addListener(this.getEventName(t),e)}once(t,e){return Salla.event.once(this.getEventName(t),e)}}function rn(t){t&&t.sallaInitiated&&!t.initiated&&(t.sallaInitiated(),t.initiated=!0)}Salla.event.auth=new class extends nn{constructor(){super(),this.namespace="auth",this.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"},this.after_init()}login(t){return t?(t.type&&this.setTypeActionOnVerified(t.type),this.next_event=t.next_event||null,this.dispatch("login",...arguments)):(this.next_event=null,this.dispatch("login",...arguments))}loggedIn(t){return Salla.profile.info().finally((()=>this.dispatch("loggedIn",t)))}setTypeActionOnVerified(t){this.type_action_on_verified=t}getTypeActionOnVerified(){return this.type_action_on_verified||"redirect"}},Salla.event.cart=new class extends nn{constructor(){super(),this.namespace="cart",this.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",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"},this.after_init()}updated(t){return Salla.cookie.set("fresh_summary",1),t&&"object"==typeof t?(t.offer&&salla.product.event.offerExisted(t.offer),t.redirect&&(salla.log("The current cart is purchased!"),salla.cart.api.reset()),t.cart?(salla.storage.set("cart.summary",{total:t.cart.total,sub_total:t.cart.sub_total,discount:t.cart.discount,real_shipping_cost:t.cart.real_shipping_cost,count:t.cart.count,shipping_cost:t.cart.free_shipping_bar?.has_free_shipping?0:t.cart.real_shipping_cost}),this.dispatch("updated",t.cart)):void salla.log("Failed to get the cart summary!")):(Salla.logger.info("Cart summary not an object!",t),this.dispatch("updated"))}latestFetched(t){return this.updated(t.data),this.dispatch("latestFetched",t)}itemAdded(t,e){return this.updated(t.data),this.dispatch("itemAdded",t,e)}itemDeleted(t,e){return this.updated(t.data),this.dispatch("itemDeleted",t,e)}itemUpdated(t,e){return this.updated(t.data),this.dispatch("itemUpdated",t,e)}couponAdded(t,e){return this.updated(t.data),this.dispatch("couponAdded",t,e)}couponDeleted(t,e){return this.updated(t.data),this.dispatch("couponDeleted",t,e)}},Salla.event.order=new class extends nn{constructor(){super(),this.namespace="order",this.events={canceled:"canceled",notCanceled:"not.canceled",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",invoiceSent:"invoice.sent",invoiceNotSent:"invoice.not.sent"},this.after_init()}},Salla.event.scope=new class extends nn{constructor(){super(),this.namespace="scope",this.events={fetched:"fetched",notFetched:"not.fetched",productAvailabilityFetched:"product-availability.fetched",productAvailabilityNotFetched:"product-availability.not.fetched",changeSucceeded:"changed",changeFailed:"not.changed"},this.after_init()}},Salla.event.rating=new class extends nn{constructor(){super(),this.namespace="rating",this.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"},this.after_init()}},Salla.event.comment=new class extends nn{constructor(){super(),this.namespace="comment",this.events={added:"added",additionFailed:"addition.failed"},this.after_init()}},Salla.event.loyalty=new class extends nn{constructor(){super(),this.namespace="loyalty",this.events={exchangeSucceeded:"exchange.succeeded",exchangeFailed:"exchange.failed",programFetched:"program.fetched",programNotFetched:"program.not.fetched",resetSucceeded:"exchange-reset.succeeded",resetFailed:"exchange-reset.failed"},this.after_init()}},Salla.event.product=new class extends nn{constructor(){super(),this.namespace="product",this.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"},this.after_init()}},Salla.event.profile=new class extends nn{constructor(){super(),this.namespace="profile",this.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"},this.after_init()}},Salla.event.currency=new class extends nn{constructor(){super(),this.namespace="currency",this.events={changed:"changed",failed:"failed",fetched:"fetched",failedToFetch:"failed.to.fetch"},this.after_init()}},Salla.event.document=new class extends nn{constructor(){super(),this.namespace="document",this.events={click:"click",change:"change",submit:"submit",keyup:"keyup",leaving:"leaving",request:"request",requestFailed:"request.failed"},this.after_init()}onClick(t,e){this.fireCallableFuns("click",t,e)}onChange(t,e){this.fireCallableFuns("change",t,e)}onSubmit(t,e){this.fireCallableFuns("submit",t,e)}onKeyup(t,e){this.fireCallableFuns("keyup",t,e)}fireCallableFuns(t,e,n){this.on(t,(t=>{"function"!=typeof e?"function"==typeof n&&t.target.matches(e)&&n(t):e(t)}))}fireEvent(t,e,...n){return this.fireEventForElements(t,e,!1,...n)}fireEventForAll(t,e,...n){return this.fireEventForElements(t,e,!0,...n)}fireEventForElements(t,e,n,...i){if("string"==typeof t){if(n)return document.querySelectorAll(t).forEach((t=>this.fireEventForElements(t,e,!1,...i)));t=document.querySelector(t)}if(!t)return void salla.log("Failed To get element to fire event: "+e);const r=new CustomEvent(e,...i);return t.dispatchEvent(r)}},Salla.event.wishlist=new class extends nn{constructor(){super(),this.namespace="wishlist",this.events={added:"added",removed:"removed",additionFailed:"addition.failed",removingFailed:"removing.failed"},this.after_init()}},Salla.event.infiniteScroll=new class extends nn{constructor(){super(),this.namespace="infiniteScroll",this.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},this.after_init()}},Salla.event.booking=new class extends nn{constructor(){super(),this.namespace="booking",this.events={added:"added",additionFailed:"addition.failed"},this.after_init()}},Salla.event.on("twilight::initiated",(()=>{Object.keys(Salla).forEach((t=>{"object"==typeof(t=Salla[t])&&(rn(t),Object.keys(t).forEach((e=>{rn(t[e])})))}))})),Salla.config.default_properties={debug:"undefined"!=typeof process&&!1,token:null,fastRequests:!0,canLeave:!0,store:{api:"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=()=>"user"===Salla.config.get("user.type"),Salla.config.isGuest=()=>!Salla.config.isUser(),Salla.config.languages=async()=>{if(Salla.config.triedToGetLanguages_)return Salla.config.get("languages");Salla.config.triedToGetLanguages_=!0;let t=!0,e=[];return(await salla.document.api.request("languages",null,"get"))?.data?.map((n=>{t&&(e=[],t=!1),n.code=n.code||n.iso_code,n.url=salla.url.get(n.code),n.is_rtl=n.is_rtl||n.rtl,e.push(n)})),Salla.config.set("languages",e),e},Salla.config.currencies=async()=>{if(Salla.config.triedToGetCurrencies_)return Salla.config.get("currencies");Salla.config.triedToGetCurrencies_=!0;let t=!0,e={};return(await salla.currency.api.list())?.data?.map((n=>{t&&(e={},t=!1),n.country_code=n.code.substr(0,2).toLowerCase(),e[n.code]=n})),Salla.config.set("currencies",e),e},Salla.config.currency=t=>(t=t||Salla.config.get("user.currency_code"),Salla.config.get("currencies."+t)||Object.values(Salla.config.get("currencies"))[0]);class sn{constructor(){this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.endpointsMethods={},this.endpointsHeaders={};let t=/function (.{1,})\(/.exec(""+this.constructor);this.className=(t&&t.length>1?t[1]:"").toLowerCase(),this.debounce={request:void 0,time:300,enabled:!0,exclude:[]}}after_init(){}normalRequest(t,e,n=null){let i=Array.isArray(t),r=i?this.getUrl(...t):this.getUrl(t),s=this.endpointsHeaders[t=i?t[0]:t];if("get"===(n=n||this.endpointsMethods[t]||"post")&&e instanceof FormData){let t={};Array.from(e.entries()).forEach((function(e){t[e[0]]=e[1]})),e={params:t}}return s&&"get"===n&&(e=e?Object.assign(e,s):s),this.webEndpoints.includes(t)?r=salla.url.get(r):"http"!==r.substring(0,4)&&(r=salla.url.api(r)),Salla.api.request(r,e,n,{headers:s})}request(t,e,n=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(t,e,n)):this.normalRequest(t,e,n)}getUrl(t){let e=this.endpoints[t]||t;const n=/{[^{}]+}/i;for(let t=1;t<arguments.length;t++)e=e.replace(n,arguments[t]);return e}event(){return salla.event[this.className]}}class an extends sn{constructor(){super(),this.namespace="cart",this.endpoints={latest:"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-checkout",createQuickOrder:"checkout/quick-checkout",priceQuote:"cart/{cartId}/price-quote"},this.endpointsMethods={latest:"get",details:"get",status:"get",updateItem:"post",deleteItem:"delete",deleteImage:"delete",deleteCoupon:"put",getQuickOrderSettings:"get"},this.webEndpoints=["latest"],this.latestCart=null,this.after_init(),salla.event.on("request::initiated",(()=>this.getCurrentCartId()))}async getCurrentCartId(){if(salla.cart.api.latestCart)return salla.cart.api.latestCart.cart.id;let t=salla.storage.get("cart.id");if(t)return t;let e=await this.latest();return salla.cart.api.latestCart=e.data,salla.cart.api.latestCart.cart.id}getUploadImageEndpoint(t){return salla.url.api(this.getUrl("uploadImage",t||salla.storage.get("cart.id")))}latest(){return this.request("latest",{params:{source:""}}).then((t=>(salla.storage.set("cart",t.data.cart),salla.event.cart.latestFetched(t),t))).catch((t=>{throw salla.storage.set("cart",""),salla.event.cart.latestFailed(t),t}))}async details(){let t=await this.getCurrentCartId();return this.request(["details",t]).then((function(t){return salla.cart.event.detailsFetched(t),t})).catch((function(t){throw salla.cart.event.detailsNotFetched(t),t}))}async quickAdd(t,e){return this.addItem({id:t,quantity:e,endpoint:"quickAdd"})}async addItem(t){let e=this.getCartPayload(t);if(!e.id){let t='There is no product "id"!';return salla.cart.event.itemAddedFailed(t),salla.api.errorPromise(t)}let n=salla.form.getPossibleValue(e.payload,["endpoint"]);n&&["addItem","quickAdd"].includes(n)||(n=salla.form.getPossibleValue(e.payload,["quantity","donating_amount"])?"addItem":"quickAdd");let i=await this.getCurrentCartId();return this.request([n,i,e.id],e.payload).then((function(t){return salla.cart.event.itemAdded(t,e.id),t})).catch((function(t){throw salla.cart.event.itemAddedFailed(t,e.id),t}))}async deleteItem(t){let e=this.getCartPayload(t);if(!e.id){let t='There is no "id"!';return salla.cart.event.itemDeletedFailed(t),salla.api.errorPromise(t)}let n=await this.getCurrentCartId();return this.request(["deleteItem",n,e.id]).then((function(t){return salla.cart.event.itemDeleted(t,e.id),t})).catch((function(t){throw salla.cart.event.itemDeletedFailed(t,e.id),t}))}async updateItem(t){let e=this.getCartPayload(t);if(!e.id){let t='There is no "id"!';return salla.cart.event.itemUpdatedFailed(t),salla.api.errorPromise(t)}let n=await this.getCurrentCartId();return"Object"===e.payload.constructor?.name?e.payload._method="PUT":e.payload.append("_method","PUT"),this.request(["updateItem",n,e.id],e.payload).then((function(t){return salla.cart.event.itemUpdated(t,e.id),t})).catch((function(t){throw salla.cart.event.itemUpdatedFailed(t,e.id),t}))}async deleteImage(t){if(!(t=salla.form.getPossibleValue(t,["id","image_id","photo_id"]))){let t='There is no "id"!';return salla.cart.event.imageNotDeleted(t),salla.api.errorPromise(t)}let e=await this.getCurrentCartId();return this.request(["deleteImage",e,t]).then((function(e){return salla.cart.event.imageDeleted(e,t),e})).catch((function(e){throw salla.cart.event.imageNotDeleted(e,t),e}))}async status(t){return this.request(["status",t||await this.getCurrentCartId()],{params:{has_apple_pay:!!window.ApplePaySession}})}async submit(){this.status(await this.getCurrentCartId()).then((t=>{let e=t.data.next_step.to;if(!["checkout","refresh","login"].includes(e)){let t="Can't find next_step );";throw salla.cart.event.submitFailed(t),t}if(salla.cart.event.submitted(t),"login"===e)return salla.auth.setCanRedirect(!1),salla.event.dispatch("login::open"),void salla.auth.event.onLoggedIn((()=>{salla.event.dispatch("login::close"),this.submit()}));"checkout"===e?window.location.href=t.data.next_step.url+(window.ApplePaySession?"?has_apple_pay=true":""):window.location.reload()})).catch((function(t){throw salla.cart.event.submitFailed(t),t}))}getCartPayload(t){let e=t?.data||("object"==typeof t?t:void 0);return t=e?salla.form.getPossibleValue(e,["prod_id","product_id","item_id","id"]):t,e="object"==typeof e?e:void 0,{id:t,payload:e}}normalRequest(t,e,n=null){return super.normalRequest(t,e,n).catch((t=>{throw 403===t?.response?.status&&(salla.cart.api.reset(),salla.error(salla.lang.get("pages.checkout.try_again"))),t}))}reset(){salla.api.cart.latestCart=null,salla.storage.remove("cart"),salla.cart.event.successReset()}async addCoupon(t){if(t=t.data||t,!(t=salla.form.getPossibleValue(t,["coupon"]))){let t=Error('There is no "Coupon Code"!');return t.name="EmptyCoupon",salla.event.cart.couponAdditionFailed(t),salla.api.errorPromise(t)}let e=await salla.cart.api.getCurrentCartId();return this.request(["addCoupon",e],{coupon:t}).then((function(t){return salla.event.cart.couponAdded(t,e),t})).catch((function(t){throw salla.event.cart.couponAdditionFailed(t,e),t}))}async deleteCoupon(){let t=await salla.cart.api.getCurrentCartId();return this.request(["deleteCoupon",t],{}).then((function(e){return salla.event.cart.couponDeleted(e,t),e})).catch((function(e){throw salla.event.cart.couponDeletionFailed(e,t),e}))}getQuickOrderSettings(){return this.request("getQuickOrderSettings").then((t=>(salla.event.cart.quickOrderSettingFetched(t),t))).catch((t=>{throw salla.event.cart.quickOrderSettingFailed(t),t}))}createQuickOrder(t){return this.request("createQuickOrder",t).then((t=>(salla.event.cart.quickOrderSucceeded(t),t))).catch((t=>{throw salla.event.cart.quickOrderFailed(t),t}))}async priceQuote(t){return salla.config.isGuest()?(salla.auth.api.setAfterLoginEvent("cart::priceQuote",t),void salla.event.dispatch("login::open")):this.request(["priceQuote",t||await this.getCurrentCartId()]).then((t=>(salla.cart.api.reset(),salla.event.cart.priceQuoteSucceeded(t).then((()=>(setTimeout((()=>window.location.href=salla.url.get("/")),1e3),t)))))).catch((t=>salla.event.cart.priceQuoteFailed(t).then((()=>{throw 404===t.error?.code&&window.location.reload(),t}))))}}class on extends sn{constructor(){super(),this.namespace="loyalty",this.endpoints={getProgram:"loyalty",exchange:"loyalty/exchange",reset:"loyalty/exchange"},this.endpointsMethods={getProgram:"get",reset:"put"},this.after_init()}getProgram(){return this.request("getProgram").then((t=>(salla.loyalty.event.programFetched(t),t))).catch((t=>{throw salla.loyalty.event.programNotFetched(t),t}))}async exchange(t,e=null){if(!(t=salla.form.getPossibleValue(t,["id","loyalty_prize_id","prize_id"]))){let t="Unable to find cart id. Please provide one.";return salla.loyalty.event.exchangeFailed(t),salla.api.errorPromise(t)}if(!(e=e||await salla.cart.getCurrentCartId())){let t="Unable to find cart id. Please provide one.";return salla.loyalty.event.exchangeFailed(t),salla.api.errorPromise(t)}return this.request("exchange",{loyalty_prize_id:t,cart_id:e}).then((function(e){return salla.loyalty.event.exchangeSucceeded(e,t),e})).catch((function(e){throw salla.loyalty.event.exchangeFailed(e,t),e}))}async reset(t=null){if(!(t=t||await salla.cart.getCurrentCartId())){let t="Unable to find cart id. Please provide one.";return salla.loyalty.event.resetFailed(t),salla.api.errorPromise(t)}return this.request("reset",{cart_id:t}).then((t=>(salla.loyalty.event.resetSucceeded(t),t))).catch((t=>{throw salla.loyalty.event.resetFailed(t),t}))}}class ln extends sn{constructor(){super(),this.namespace="auth",this.canRedirect_=!0,this.afterLoginEvent={event:null,payload:null},this.endpoints={login:"auth/{type}/send_verification",resend:"auth/resend_verification",verify:"auth/{type}/verify",register:"auth/register",logout:"logout",refresh:"auth/refresh"},this.webEndpoints=["logout","auth/jwt","refresh"],this.endpointsMethods={logout:"get"},this.after_init()}setAfterLoginEvent(t,e){salla.api.auth.afterLoginEvent={event:t,payload:e}}setCanRedirect(t){salla.api.auth.canRedirect_=t}canRedirect(){return salla.api.auth.canRedirect_&&!salla.api.auth.afterLoginEvent.event}login(t){t?.data&&(t=t.data);let e=salla.form.getPossibleValue(t,["type"]);if(!["email","mobile"].includes(e)){let t="Login type should be in: [email, mobile]";return salla.auth.event.codeNotSent(t),salla.api.errorPromise(t)}return this.request(["login",e],t).then((function(t){return salla.auth.event.codeSent(t,e),t})).catch((function(t){throw salla.auth.event.codeNotSent(t,e),t}))}async verify(t,e=!0){let n=salla.form.getPossibleValue(t,["type"]);if(!n){let t="Failed to know what's login type!";return salla.auth.event.verificationFailed(t),salla.api.errorPromise(t)}e=!1!==salla.form.getPossibleValue(t,["supportWebAuth"])&&e,salla.auth.event.next_event&&(t.next_event=salla.auth.event.next_event);let i=await salla.auth.api.request(["verify",n],t);if(200!==i?.status)return salla.auth.event.verificationFailed(i,n),salla.api.errorPromise(i);let r="authenticated"===i.data?.case;return r&&salla.auth.event.tokenFetched(i.data.token),e&&await salla.auth.api.request("auth/jwt"),r&&salla.auth.event.loggedIn(i).then((()=>salla.auth.api.afterUserLogin())),salla.auth.event.verified(i,n),salla.api.successPromise(i)}resend(t){let e;return(t=t.data||t).type=t.type||"mobile","mobile"!==t.type||t.phone&&t.country_code?"email"!==t.type||t.email?this.request("resend",t).then((function(e){return salla.auth.event.codeSent(e,t),e})).catch((function(e){throw salla.auth.event.codeNotSent(e,t),e})):(salla.auth.event.codeNotSent(e="There is no email!",t),salla.api.errorPromise(e)):(salla.auth.event.codeNotSent(e="There is no phone or country_code!",t),salla.api.errorPromise(e))}register(t){let e;return t.data&&(e=t.element,t=t.data),salla.auth.event.next_event&&(t.next_event=salla.auth.event.next_event),this.request("register",t).then((async function(t){return salla.auth.event.registered.call(e,t),"authenticated"===t.data?.case&&(salla.auth.event.tokenFetched(t.data.token),await salla.auth.request("auth/jwt"),salla.auth.event.loggedIn(t),salla.auth.api.afterUserLogin()),t})).catch((function(t){throw salla.auth.event.registrationFailed.call(e,t),t}))}logout(){return salla.storage.clearAll(),salla.cookie.clearAll(),salla.auth.event.loggedOut().then((()=>{let t=salla.url.get("logout");console.log(`Going to ${t}, to do any thing before this action use: salla.auth.even.onLoggedOut(()=>{...})`),location.href=t}))}refresh(){return this.request("refresh").then((function(t){return salla.auth.event.tokenFetched(t.data.token),t})).catch((function(t){throw salla.auth.event.refreshFailed(t),t}))}afterUserLogin(){this.afterLoginEvent.event&&salla.event.emit(this.afterLoginEvent.event,this.afterLoginEvent.payload)}}class un extends sn{constructor(){super(),this.namespace="order",this.endpoints={cancel:"orders/cancel/{id}",createCartFromOrder:"reorder/{id}",sendInvoice:"orders/send/{id}"},this.endpointsMethods={createCartFromOrder:"get"},this.after_init()}show(t){let e=salla.form.getPossibleValue(t?.data||t,["id","order_id"]);salla.event.dispatch("mobile::order.placed",{order_id:e}),location.href=salla.form.getPossibleValue(t?.data||t,["url"])}cancel(t){return t=t||Salla.config.get("page.id"),this.request(["cancel",t],{params:{has_apple_pay:!!window.ApplePaySession}}).then((function(e){return salla.event.order.canceled(e,t),e})).catch((function(e){throw salla.event.order.notCanceled(e,t),e}))}createCartFromOrder(t){return t=t||salla.config.get("page.id"),this.request(["createCartFromOrder",t]).then((function(e){return salla.cart.reset(),salla.storage.set("cart",{id:e.data.cart_id,user_id:salla.config.get("user.id")}),salla.event.order.orderCreated(e,t),window.location.href=e.data.url,e})).catch((function(e){throw salla.event.order.orderCreationFailed(e,t),e}))}sendInvoice(t){let e=salla.form.getPossibleValue(t,["id"])||salla.config.get("page.id");if(!e||isNaN(e)){let t="There is no id!";return salla.order.event.invoiceNotSent(t),salla.api.errorPromise(t)}return this.request(["sendInvoice",e],t).then((t=>(salla.event.order.invoiceSent(t,e),t))).catch((t=>{throw salla.event.order.invoiceNotSent(t,e),t}))}}class cn extends sn{constructor(){super(),this.namespace="product",this.previousQuery="",this.endpoints={get:"products/{id}/details",getPrice:"products/{id}/price",availabilitySubscribe:"products/{id}/availability-notify",search:"products/search",detail:"products/{product_id}/details",categories:"products/categories/{?id}",offers:"products/{product_id}/specialoffer",getSizeGuides:"products/{prod_id}/size-guides",giftDetail:"products/{product_id}/buy-as-gift",giftToCart:"products/{product_id}/buy-as-gift",giftImage:"products/buy-as-gift/image"},this.endpointsMethods={detail:"get",giftDetail:"get"},this.after_init()}get(t,e=[]){return Array.isArray(e)?t?this.request(["get",t],{params:{with:e}}).then((function(t){return t})).catch((function(t){throw t})):salla.api.errorPromise("productId is not passed."):salla.api.errorPromise("withItems should be array.")}getPrice(t){let e=t.data||t,n=salla.form.getPossibleValue(e,["id","prod_id","product_id"]);return this.request(["getPrice",n],"object"==typeof e?e:void 0).then((function(t){return salla.product.event.priceUpdated(t,n),t})).catch((function(t){throw salla.product.event.priceUpdateFailed(t,n),t}))}categories(t){return this.request(["categories",t||""],null,"get").then((function(t){return salla.product.event.categoriesFetched(t),t})).catch((function(t){throw salla.product.event.categoriesFailed(t),t}))}availabilitySubscribe(t){let e=t.data||t;return t=salla.form.getPossibleValue(e,["id","prod_id"]),this.request(["availabilitySubscribe",t],"object"==typeof e?e:void 0).then((function(e){return salla.product.event.availabilitySubscribed(e,t),e})).catch((function(e){throw salla.product.event.availabilitySubscribedFailed(e,t),e}))}search(t){let e=t.data;if(e||(e={params:"string"==typeof t?{query:t}:t}),!(t=e instanceof FormData?e.get("query"):e.query||e.params?.query)){let t='There is no "query"!';return salla.product.event.searchFailed(t),salla.api.errorPromise(t)}if(t===salla.api.product.previousQuery){let t="Query is same as previous one!";return salla.product.event.searchFailed(t),salla.api.product.previousQuery=null,salla.api.errorPromise(t)}return salla.api.product.previousQuery=t,this.request("search",e,"get").then((function(e){return salla.product.event.searchResults(e,t),e})).catch((function(e){throw salla.product.event.searchFailed(e,t),e}))}offers(t){if(!(t=salla.form.getPossibleValue(t?.data|t,["product_id","id"]))){let t='There is no "product_id"!';return salla.offer.event.fetchDetailsFailed(t),salla.api.errorPromise(t)}return this.request(["offers",t]).then((function(e){return salla.product.event.offersFetched(e,t),e})).catch((function(e){throw salla.product.event.fetchOffersFailed(e,t),e}))}getSizeGuides(t){return this.request(`products/${t}/size-guides`,null,"get").then((e=>(salla.product.event.sizeGuideFetched(e,t),e))).catch((e=>{throw salla.product.event.sizeGuideFetchFailed(e,t),e}))}getGiftDetails(t){return this.request(["giftDetail",t]).then((e=>(salla.product.event.giftFetched(e,t),e))).catch((e=>{throw salla.product.event.giftFetchFailed(e,t),e}))}getDetails(t,e=[]){if(!Array.isArray(e)){let t="withItems should be array.";return salla.product.event.detailFetchFailed(t),salla.api.errorPromise(t)}if(!t){let t="productId is not passed.";return salla.product.event.detailFetchFailed(t),salla.api.errorPromise(t)}return this.request(["detail",t],{params:{with:e}}).then((function(e){return salla.product.event.detailFetched(e,t),e})).catch((function(e){throw salla.product.event.detailFetchFailed(e,t),e}))}addGiftToCart(t,e,n=!1){return this.request(["giftToCart",t],e).then((e=>(salla.product.event.addGiftToCartSucceeded(e,t),n&&(window.location.href=e.redirect),response))).catch((e=>{throw salla.product.event.addGiftToCartFailed(e,t),e}))}uploadGiftImage(t){return this.request("giftImage",t).then((t=>(salla.product.event.giftImageUploadSucceeded(t),t))).catch((t=>{throw salla.product.event.giftImageUploadFailed(t),t}))}}class fn extends sn{constructor(){super(),this.namespace="profile",this.endpoints={info:"auth/user",update:"profile/update",updateContacts:"profile/contacts/update",updateSettings:"profile/settings",verify:"profile/verify",delete:"profile"},this.endpointsMethods={delete:"delete"},this.after_init()}info(){return this.request("info",null,"get").then((t=>{let e={id:t.data.id,type:"user",email:t.data.email,mobile:t.data.phone.code+t.data.phone.number,country_code:t.data.phone.country,language_code:t.data.language,currency_code:t.data.currency,notifications:t.data.notifications,pending_orders:t.data.pending_orders,avatar:t.data.avatar,first_name:t.data.first_name,last_name:t.data.last_name,fetched_at:Date.now()};return salla.config.set("user",e),salla.storage.set("user",e),salla.profile.event.infoFetched(t),t})).catch((t=>{throw salla.profile.event.infoNotFetched(t),t}))}update(t){return this.request("update",t).then((t=>(salla.profile.event.updated(t),t))).catch((t=>{throw salla.event.profile.updateFailed(t),t}))}updateContacts(t){return this.request("updateContacts",t).then((t=>(salla.profile.event.verificationCodeSent(t),t))).catch((t=>{throw salla.event.profile.updateContactsFailed(t),t}))}verify(t){return this.request("verify",t).then((t=>(salla.profile.event.verified(t),t))).catch((t=>{throw salla.event.profile.unVerified(t),t}))}updateSettings(t){return this.request("updateSettings",t).then((t=>(salla.event.profile.settingsUpdated(t),t))).catch((t=>{throw salla.event.profile.updateSettingsFailed(t),t}))}delete(){return this.request("delete").then((t=>(salla.storage.clearAll(),salla.cookie.clearAll(),salla.event.profile.deleted(t),window.location.href=salla.url.get("logout"),t))).catch((t=>{throw salla.event.profile.notDeleted(t),t}))}}class hn extends sn{constructor(){super(),this.namespace="comment",this.endpoints={add:"{type}/{id}/comments"},this.after_init()}add(t){t?.data&&(t=t.data);let e,n=salla.form.getPossibleValue(t,["id"]),i=salla.form.getPossibleValue(t,["type"]),r=salla.form.getPossibleValue(t,["comment"]);return n?i&&["products","pages","product","page"].includes(i)?r?(i+=["product","page"].includes(i)?"s":"",this.request(["add",i,n],{comment:r}).then((function(t){return salla.event.comment.added(t,n),t})).catch((function(t){throw salla.event.comment.additionFailed(t,n),t}))):(salla.event.comment.additionFailed(e="can't find comment content!"),salla.api.errorPromise(e)):(salla.event.comment.additionFailed(e="Failed to get type one of:(products, product, page, pages)!"),salla.api.errorPromise(e)):(salla.event.comment.additionFailed(e="Failed to get id!"),salla.api.errorPromise(e))}}class dn extends sn{constructor(){super(),this.namespace="currency",this.endpoints={change:"/",list:"currencies"},this.endpointsMethods={change:"get",list:"get"},this.webEndpoints=["change"],this.after_init()}change(t){if(!(t=salla.form.getPossibleValue(t.data||t,["currency","code"]))){let t="Can't find currency code!";return salla.currency.event.failed(t),salla.api.errorPromise(t)}return this.request("change",{params:{change_currency:"",currency:t}}).then((function(e){return salla.cookie.set("fresh_summary",1),salla.storage.set("cart",""),salla.currency.event.changed(e,t),e})).catch((function(e){throw salla.currency.event.failed(e,t),e}))}list(){return this.request("list").then((function(t){return salla.currency.event.fetched(t),t})).catch((function(t){throw salla.currency.event.failedToFetch(t),t}))}}class pn extends sn{constructor(){super(),this.namespace="document"}}class gn extends sn{constructor(){super(),this.namespace="rating",this.endpoints={store:"rating/store",products:"rating/products",shipping:"rating/shipping",order:"rating/{order_id}"},this.endpointsMethods={order:"get"},this.after_init()}order(t){let e="object"==typeof t?t:{},n=salla.form.getPossibleValue(t?.data||t,["order_id","id"]);if(!n){let t='There is no "order_id"!';return salla.event.rating.orderNotFetched(t),salla.api.errorPromise(t)}return this.request(["order",n],e).then((function(t){return salla.event.rating.orderFetched(t,n),t})).catch((function(t){throw salla.event.rating.orderNotFetched(t,n),t}))}store(t){if(!(t=t.data||t)){let t='There is no "data"!';return salla.event.rating.storeFailed(t),salla.api.errorPromise(t)}return this.request("store",t).then((function(e){return salla.event.rating.storeRated(e,t),e})).catch((function(e){throw salla.event.rating.storeFailed(e,t),e}))}products(t){if(!(t=t.data||t)){let t='There is no "data"!';return salla.event.rating.productsFailed(t),salla.api.errorPromise(t)}return this.request("products",t).then((function(e){return salla.event.rating.productsRated(e,t),e})).catch((function(e){throw salla.event.rating.productsFailed(e,t),e}))}shipping(t){if(!(t=t.data||t)){let t='There is no "data"!';return salla.event.rating.shippingFailed(t),salla.api.errorPromise(t)}return this.request("shipping",t).then((function(e){return salla.event.rating.shippingRated(e,t),e})).catch((function(e){throw salla.event.rating.shippingFailed(e,t),e}))}}class mn extends sn{constructor(){super(),this.namespace="wishlist",this.endpoints={add:"products/favorites/{id}",remove:"products/favorites/{id}"},this.endpointsMethods={remove:"delete"},this.after_init()}toggle(t){return salla.storage.get("salla::wishlist",[]).includes(t)?this.remove(t):this.add(t)}add(t){let e;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(e=salla.lang.get("common.messages.must_login")),salla.error(e),salla.api.errorPromise(e)):(t=salla.form.getPossibleValue(t?.data||t,["product_id","id"]))?this.request(["add",t]).then((e=>(this.updateWishlistStorage(t),salla.wishlist.event.added(e,t),e))).catch((function(e){throw salla.wishlist.event.additionFailed(e,t),e})):(salla.wishlist.event.additionFailed(e="Failed to get product id!"),salla.api.errorPromise(e))}remove(t){let e;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(e=salla.lang.get("common.messages.must_login")),salla.error(e),salla.api.errorPromise(e)):(t=salla.form.getPossibleValue(t?.data||t,["product_id","id"]))?this.request(["remove",t]).then((e=>(this.updateWishlistStorage(t,!1),salla.wishlist.event.removed(e,t),e))).catch((function(e){throw salla.wishlist.event.removingFailed(e,t),e})):(salla.wishlist.event.removingFailed(e="Failed to get id!"),salla.api.errorPromise(e))}updateWishlistStorage(t,e=!0){let n=salla.storage.get("salla::wishlist",[]);e?n.push(t):n.splice(n.indexOf(t),1),salla.storage.set("salla::wishlist",n)}}class vn extends sn{constructor(){super(),this.namespace="scopes",this.endpoints={get:"scopes",change:"scopes",getProductAvailability:"scopes/availability?product_id={id}"},this.after_init()}get(){return this.request("scopes",null,"get").then((t=>(salla.scope.event.fetched(t),t))).catch((t=>{throw salla.scope.event.notFetched(t),t}))}change(t){return this.request("scopes",t).then((t=>(salla.scope.event.changeSucceeded(t),t))).catch((t=>{throw salla.scope.event.changeFailed(t),t}))}getProductAvailability(t=null){return this.request("scopes/availability?product_id="+t,null,"get").then((e=>(salla.scope.event.productAvailabilityFetched(e,t),e))).catch((t=>{throw salla.scope.event.productAvailabilityNotFetched(t),resp}))}}class wn extends sn{constructor(){super(),this.namespace="booking",this.endpoints={add:"cart/booking/product/{id}"},this.endpointsMethods={add:"get"}}async add(t,e=!0){if(!t){let t="Please provide product id.";return salla.booking.event.additionFailed(t),salla.api.errorPromise(t)}return this.request(["add",t]).then((function(t){return salla.booking.event.added(t),e&&"booking"===t.data.redirect.to&&(window.location.href=t.data.redirect.url),t})).catch((function(t){throw salla.booking.event.additionFailed(t),t}))}}class yn{constructor(t){"ready"!==qt.status?t?(qt.config.merge(t),t?.events&&qt.event.dispatchEvents(t?.events),t._token&&salla.api.setHeader("X-CSRF-TOKEN",t._token),this.injectMaintenanceAlert(),this.injectThemePreviewAlert(),this.injectEditAlert(),t?.user?.language_code&&salla.lang.setLocale(t?.user?.language_code),salla.lang.loadStoreTranslations(),this.setSallaReady(t)):this.setSallaReady(t):salla.log("Trying to re-initiate Salla, while its status === 'ready'!")}injectMaintenanceAlert(){salla.config.get("maintenance")&&(document.querySelector(".store-notify")?salla.logger.warn(".store-notify element Existed before!"):salla.lang.onLoaded((()=>{const t=document.createElement("div");t.classList.add("store-notify"),t.style="background-color: #d63031; color: #fff; padding: 10px 15px; text-align: center; font-size: 17px;",t.innerHTML=`<p style="margin:0 !important;">${salla.lang.get("blocks.header.maintenance_alert")}</p>`,document.body.prepend(t)})))}injectThemePreviewAlert(){"preview"===salla.config.get("theme.mode")&&(document.querySelector("#s-theme_preview_bar")?salla.logger.warn("#s-theme_preview_bar element Existed before!"):salla.lang.onLoaded((()=>{let t=document.createElement("div");t.id="s-theme_preview_bar",t.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;"),t.innerHTML=`\n <div style="display:flex; align-items:center;">\n <img width="32" src="https://assets.salla.sa/cp/assets/images/logo-new.png">\n <span style="margin:0 10px;">${salla.lang.get("blocks.header.preview_mode")}: <span style="background:rgba(255,255,255,0.25);border-radius:15px; padding:2px 15px 4px">${salla.config.get("theme.name")}</span></span>\n </div>\n <a href="${salla.url.get("preview_theme/cancel/preview")}" style="line-height:32px; width:32px;"><i class="sicon-cancel"></i></a>\n `,document.body.prepend(t)})))}injectEditAlert(){let t=salla.config.get("edit");t&&(document.querySelector("#s-edit-alert")?salla.logger.warn("#s-edit-alert element Existed before!"):salla.lang.onLoaded((()=>{let e=document.createElement("div");e.id="s-edit-alert",e.innerHTML=`\n <a href="${t}" style="display:block; background-color:${salla.config.get("theme.color.primary","#5cd5c4")}; color:${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 ${salla.lang.get("pages.products.quick_edit")}\n </a>\n `,document.body.prepend(e)})))}handleElementAjaxRequest(t,e){if(!(e instanceof HTMLFormElement||e instanceof HTMLAnchorElement))return salla.logger.warn("trying to call ajax from non Element!!"),!1;t.preventDefault();let n=e.getAjaxFormData(t),i=n.method?n.method.toLowerCase():void 0;salla.api.request(n.url,n.formData,i).then((t=>(t.data&&t.request&&(t=t.data),salla.api.handleAfterResponseActions(t),this.callAjaxEvent(n.events.success,t,n.formData),t))).catch((t=>{throw salla.api.handleErrorResponse(t),this.callAjaxEvent(n.events.fail,t,n.formData),t}))}callAjaxEvent(t,e,n){if(t){if(n instanceof FormData){const t={};Array.from(n.entries()).forEach((function(e){t[e[0]]=e[1]})),n=t}window[t]?window[t](e,n):salla.event.dispatch(t,e,n)}}setSallaReady(t){qt.status="ready",qt.event.dispatch("twilight::initiated",t),window.dispatchEvent(new CustomEvent("twilight::initiated",{detail:t}))}}qt.status="loading",qt.notify=tn,qt.lang=new class extends Bt{constructor(t){(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,super(t),this.translationsLoaded=!1}onLoaded(t){if(this.translationsLoaded)return t();Salla.event.once("languages::translations.loaded",t)}loadStoreTranslations(){if(this.messages)return void window.addEventListener("load",(()=>{salla.event.dispatch("languages::translations.loaded"),salla.logger.info("The messages of transactions is already loaded")}));if(!salla.url.get(""))return void this.loadScript("https://cdn.salla.network/js/translations.js",!1);let t=salla.config.get("theme.translations_hash",salla.config.get("store.id","twilight"));this.loadScript(salla.url.get(`languages/assets/${t}.js`))}setMessages(t){super.setMessages(t),salla.event.dispatch("languages::translations.loaded"),this.translationsLoaded=!0}loadScript(t,e=!0){let n=document.createElement("script");n.src=t,n.onload=()=>{if(window.translations)return this.setMessages(window.translations);n.onerror()},n.onerror=()=>{if(e)return salla.logger.warn("Failed to load Translations for store, lets try load it from CDN"),this.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)}get(t,e,n){return window.translations&&(t="trans."+t),super.get(t,e,n)}set(t,e){return salla.helpers.setNested(this.messages[this.getLocale()+".trans"],t,e),this}},qt.form=new class{async submit(t,e=null){let n=e;if("SubmitEvent"===e?.constructor?.name||"submit"===e?.type){if(e.preventDefault(),"FORM"!==e.target?.tagName)return Salla.logger.warn("Failed find the target element for submit action. make sure you submit a form element"),new Promise((()=>{throw"Failed find the target element for submit action. make sure you submit a form element"}));"SALLA-BUTTON"===e?.submitter?.parentElement?.tagName&&e.submitter.parentElement.load(),n=e.target.getElementSallaData(),salla.log("Data from element",n)}if(/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/gm.test(t))return salla.api.normalRequest(t,n,"post").finally((()=>{loaderSupported&&e?.submitter?.parentElement.stop()}));let i=t.split("."),r=i.splice(-1);return await salla.call(i.join("."))[r](n).finally((()=>e?.submitter?.parentElement?.stop())).catch((t=>{throw salla.logger.warn(t),t}))}onSubmit(t,e){return salla.form.submit(t,e),!1}onChange(t,e){return e?.currentTarget?"FORM"!==e?.currentTarget?.tagName||e.currentTarget.checkValidity()?(salla.form.submit(t,e.currentTarget.getElementSallaData()),!0):(salla.logger.warn(`Trying to trigger '${t}' without filling required fields!`),!1):(salla.logger.warn(`Trying to trigger '${t}' without event!`),!1)}getPossibleValue(t,e,n=!1){if(!t)return;if("object"!=typeof t)return t;let i;for(let n=0;n<e.length&&!(i=t[e[n]])&&!("undefined"!=typeof FormData&&t instanceof FormData&&(i=t.get(e[n])));n++);return i=i||t,"object"!=typeof i||n?i:void 0}},qt.helpers.app=new class{toggleClassIf(t,e,n,i){return document.querySelectorAll(t).forEach((t=>this.toggleElementClassIf(t,e,n,i))),this}toggleElementClassIf(t,e,n,i){e=Array.isArray(e)?e:e.split(" "),n=Array.isArray(n)?n:n.split(" ");let r=i(t);return t?.classList.remove(...r?n:e),t?.classList.add(...r?e:n),this}isValidEmail(t){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test((t+"").toLowerCase())}element(t){return"object"==typeof t?t:document.querySelector(t)}watchElement(t,e){return this[t]=this.element(e),this}watchElements(t){return Object.entries(t).forEach((t=>this.watchElement(t[0],t[1]))),this}on(t,e,n,i={}){return"object"==typeof e?(this.element(e).addEventListener(t,n,i),this):(document.querySelectorAll(e).forEach((e=>e.addEventListener(t,n,i))),this)}onClick(t,e){return this.on("click",t,e)}onKeyUp(t,e){return this.on("keyup",t,e)}onEnter(t,e){return this.onKeyUp(t,(t=>13===t.keyCode&&e(t))),this}all(t,e){return document.querySelectorAll(t).forEach(e),this}hideElement(t){return this.element(t).style.display="none",this}showElement(t,e="block"){return this.element(t).style.display=e,this}removeClass(t,e){return this.element(t).classList.remove(...Array.from(arguments).slice(1)),this}addClass(t,e){return this.element(t).classList.add(...Array.from(arguments).slice(1)),this}debounce(t,...e){return this.debounce_||(this.debounce_=Salla.helpers.debounce(((t,...e)=>t(...e)),500)),this.debounce_(t,...e)}},qt.infiniteScroll=new class extends en{constructor(t,e){super(t,e),this.options={path:".infinite-scroll-btn",history:"push",status:".infinite-scroll-status",append:".list-block"},this.fetchOptions={headers:{"S-INFINITE-SCROLL":!0}},this.instances=[]}initiate(t,e,n){n=this.getCustomOptions(e,n);let i="string"!=typeof t?t:document.querySelector(t),r=n.path;if(!i||!r||"string"==typeof r&&!document.querySelector(r))return void Salla.logger.warn(i?"Path Option (a link that has next page link) Not Existed!":"Container For InfiniteScroll not Existed!");let s=new Mt(i,n);return s.on("scrollThreshold",Salla.infiniteScroll.event.scrollThreshold),s.on("request",Salla.infiniteScroll.event.request),s.on("load",Salla.infiniteScroll.event.load),s.on("append",Salla.infiniteScroll.event.append),s.on("error",Salla.infiniteScroll.event.error),s.on("last",Salla.infiniteScroll.event.last),s.on("history",Salla.infiniteScroll.event.history),this.instances.push(s),s}getCustomOptions(t,e){return(e="object"==typeof t&&t||e||this.options).fetchOptions=this.fetchOptions,e.path=e.path||this.options.path,e.button=e.button||e.path,e.status=e.status||this.options.status,e.hasOwnProperty("history")||(e.history=this.options.history),e.nextPage=e.nextPage||e.next_page,e.append="string"==typeof t&&t||e.append||this.options.append,e}}(void 0,salla.event.infiniteScroll),qt.api=new class extends class{constructor(){salla.event.on("twilight::initiated",(t=>this.initiateRequest(t))),salla.event.on("profile::info.fetched",(t=>this.setCurrencyAndLanguage(t))),salla.event.on("auth::token.fetched",(t=>{salla.storage.set("token",t),this.setToken(t),salla.cart.api.reset()})),this.notifier_handler_disabled=!1,this.axios=Ge.create({headers:{common:{"X-Requested-With":"XMLHttpRequest","S-SOURCE":"twilight","S-APP-VERSION":"v2.0.0","S-APP-OS":"browser"}}})}getHeaders(){return this.axios.defaults.headers.common}setHeaders(t){return Object.entries(t).forEach((t=>this.setHeader(t[0],t[1]))),this}setHeader(t,e){return salla.infiniteScroll.fetchOptions.headers[t]=this.axios.defaults.headers.common[t]=e,this}async withoutNotifier(t){return this.notifier_handler_disabled=!0,await t().finally((()=>{this.notifier_handler_disabled=!1}))}initiateRequest(t){this.axios.defaults.baseURL=Salla.config.get("store.api",Salla.config.get("store.url")),this.setHeaders({"Store-Identifier":Salla.config.get("store.id"),currency:t.user?.currency_code||"SAR","accept-language":salla.lang.getLocale(),"s-user-id":t.user?.id});let e=salla.storage.get("scope");e&&this.setHeaders({"s-scope-type":e.type,"s-scope-id":e.id}),this.injectTokenToTheRequests(t)}injectTokenToTheRequests(t){let e=salla.storage.get("token"),n=Salla.config.isGuest(),i=salla.storage.get("cart"),r=t.user?.id,s=salla.storage.get("user.id");if(s&&s!==r&&salla.storage.remove("user"),i&&(i.user_id!==r||i.store_id!==t.store?.id))return salla.log("cart",{user_id:i.user_id,store_id:i.store_id}),salla.log("current",{user_id:r,store_id:t.store?.id}),salla.log("Auth:: The cart is not belong to current "+(i.user_id!==r?"user":"store")+"!"),void salla.cart.api.reset();if(n&&!e)return;if(n&&e)return salla.log("Auth:: Token without user!"),salla.storage.remove("token"),void salla.cart.api.reset();if(!e)return salla.cart.api.reset(),void salla.auth.api.refresh();let a=Ze(e);return Date.now()/1e3>a.exp?(salla.log("Auth:: An expired token!"),salla.storage.remove("token"),salla.cart.api.reset(),void salla.auth.api.refresh()):a.sub!==r?(salla.log("Auth:: The user id is not match the token details!"),salla.storage.remove("token"),salla.cart.api.reset(),void salla.auth.api.refresh()):(this.setToken(e),void salla.event.emit("request::initiated"))}setToken(t){return this.setHeader("Authorization","Bearer "+t)}setCurrencyAndLanguage(t){return this.setHeaders({currency:t.data.currency,"accept-language":t.data.language})}request(t,e,n="get",i={}){let r={endPoint:t,payload:e,method:n,options:i},s="undefined"!=typeof event?event.currentTarget:null,a=!1;return"SALLA-BUTTON"===s?.tagName&&(a=!0),a&&s?.load(),this.axios[r.method](r.endPoint,r.payload,r.options).then((t=>(a&&s?.stop(),t.data&&t.request&&(t=t.data),this.handleAfterResponseActions(t),t))).catch((t=>{throw a&&s?.stop(),salla.event.document.requestFailed(r,t),this.handleErrorResponse(t),t}))}handleAfterResponseActions(t){if(!t)return;let{data:e,googleTags:n=null}=t,i=e&&e.googleTags?e.googleTags:n;dataLayer&&i&&dataLayer.push(i),this.fireEventsForResponse(t),this.showAlert(t),this.renderSections(t)}fireEventsForResponse(t){let e=t?.events||t.data?.events||t.error?.events;"string"==typeof e&&(e=JSON.parse(e)),e&&Object.keys(e).forEach((t=>salla.event.dispatch(t,e[t])))}handleErrorResponse(t){if(t.response&&t.response.data)return t.response.data.error&&t.response.data.error.fields&&!this.notifier_handler_disabled?this.handleInvalidFields(t):this.handleAfterResponseActions(t.response.data)}showAlert(t){if(t&&!this.notifier_handler_disabled)return t.case&&t.msg?salla.notify.fire(t.msg,t.case,t):t.hasOwnProperty("success")&&t.data?.message?salla.notify.fire(t.data?.message,t.success?salla.notify.types.success:salla.notify.types.error,t):t.error&&t.error.message&&"FORBIDDEN"!==t.error.message?salla.error(t.error.message,t):void 0}handleInvalidFields(t){let e=t.response.data.error.fields,n=[];Object.keys(e).forEach((t=>{let i=e[t];Array.isArray(i)?i.forEach((t=>n.push(t))):n.push(i)}));let i=(n.length>1?"* ":"")+n.join("\n* ");salla.error(i,t)}isFastRequestsAllowed(){return Salla.config.get("fastRequests")}promise(t,e=!0){return new Promise(((n,i)=>e?n(t):i(t)))}errorPromise(t){return this.promise(t,!1)}successPromise(t){return this.promise(t,!0)}renderSections(t){t.sections&&Object.keys(t.sections).forEach((e=>{document.querySelectorAll(e.toSelector()).forEach((function(n){n.innerHTML=t.sections[e]}))}))}}{constructor(){super(),this.auth=new ln,this.cart=new an,this.loyalty=new on,this.order=new un,this.rating=new gn,this.product=new cn,this.profile=new fn,this.comment=new hn,this.currency=new dn,this.document=new pn,this.wishlist=new mn,this.scope=new vn,this.booking=new wn}},qt.cart=new en(qt.api.cart,qt.event.cart),qt.auth=new en(qt.api.auth,qt.event.auth),qt.order=new en(qt.api.order,qt.event.order),qt.scope=new en(qt.api.scope,qt.event.scope),qt.rating=new en(qt.api.rating,qt.event.rating),qt.comment=new en(qt.api.comment,qt.event.comment),qt.loyalty=new en(qt.api.loyalty,qt.event.loyalty),qt.product=new en(qt.api.product,qt.event.product),qt.profile=new en(qt.api.profile,qt.event.profile),qt.currency=new en(qt.api.currency,qt.event.currency),qt.document=new en(qt.api.document,qt.event.document),qt.wishlist=new en(qt.api.wishlist,qt.event.wishlist),qt.booking=new en(qt.api.booking,qt.event.booking),qt.call=t=>{let e=qt,n=t.split(".");for(;n.length&&(e=e[n.shift()]););return e},qt.init=t=>new yn(t),salla.event.once("twilight::init",salla.init),salla.event.once("twilight::api",(t=>{let e=t?.events;e&&salla.event.dispatchEvents(e)})),qt.success=qt.notify.success,qt.error=qt.notify.error,qt.versions.twilight="[VI]{version}[/VI]",qt.onInitiated=t=>salla.event.once("twilight::initiated",t),qt.onReady=qt.onReady||function(t){"ready"!==salla.status?qt.onInitiated(t):t(salla.config.all())},window.dispatchEvent(new CustomEvent("salla::created"));var bn=e((function(t){t.exports=function(){function t(){return(t=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var e="undefined"!=typeof window,n=e&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),i=e&&"IntersectionObserver"in window,r=e&&"classList"in document.createElement("p"),s=e&&window.devicePixelRatio>1,a={elements_selector:".lazy",container:n||e?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},o=function(e){return t({},a,e)},l=function(t,e){var n,i="LazyLoad::Initialized",r=new t(e);try{n=new CustomEvent(i,{detail:{instance:r}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent(i,!1,!1,{instance:r})}window.dispatchEvent(n)},u="src",c="srcset",f="sizes",h="poster",d="llOriginalAttrs",p="data",g="loading",m="loaded",v="applied",w="error",y="native",b=function(t,e){return t.getAttribute("data-"+e)},S=function(t){return b(t,"ll-status")},_=function(t,e){return function(t,e,n){var i="data-ll-status";null!==n?t.setAttribute(i,n):t.removeAttribute(i)}(t,0,e)},E=function(t){return _(t,null)},j=function(t){return null===S(t)},k=function(t){return S(t)===y},x=[g,m,v,w],O=function(t,e,n,i){t&&(void 0===i?void 0===n?t(e):t(e,n):t(e,n,i))},F=function(t,e){r?t.classList.add(e):t.className+=(t.className?" ":"")+e},A=function(t,e){r?t.classList.remove(e):t.className=t.className.replace(RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},T=function(t){return t.llTempImage},I=function(t,e){if(e){var n=e._observer;n&&n.unobserve(t)}},R=function(t,e){t&&(t.loadingCount+=e)},C=function(t,e){t&&(t.toLoadCount=e)},L=function(t){for(var e,n=[],i=0;e=t.children[i];i+=1)"SOURCE"===e.tagName&&n.push(e);return n},P=function(t,e){var n=t.parentNode;n&&"PICTURE"===n.tagName&&L(n).forEach(e)},D=function(t,e){L(t).forEach(e)},N=[u],q=[u,h],$=[u,c,f],U=[p],z=function(t){return!!t[d]},M=function(t){return t[d]},B=function(t){return delete t[d]},J=function(t,e){if(!z(t)){var n={};e.forEach((function(e){n[e]=t.getAttribute(e)})),t[d]=n}},G=function(t,e){if(z(t)){var n=M(t);e.forEach((function(e){!function(t,e,n){n?t.setAttribute(e,n):t.removeAttribute(e)}(t,e,n[e])}))}},H=function(t,e,n){F(t,e.class_applied),_(t,v),n&&(e.unobserve_completed&&I(t,e),O(e.callback_applied,t,n))},Q=function(t,e,n){F(t,e.class_loading),_(t,g),n&&(R(n,1),O(e.callback_loading,t,n))},V=function(t,e,n){n&&t.setAttribute(e,n)},W=function(t,e){V(t,f,b(t,e.data_sizes)),V(t,c,b(t,e.data_srcset)),V(t,u,b(t,e.data_src))},Z={IMG:function(t,e){P(t,(function(t){J(t,$),W(t,e)})),J(t,$),W(t,e)},IFRAME:function(t,e){J(t,N),V(t,u,b(t,e.data_src))},VIDEO:function(t,e){D(t,(function(t){J(t,N),V(t,u,b(t,e.data_src))})),J(t,q),V(t,h,b(t,e.data_poster)),V(t,u,b(t,e.data_src)),t.load()},OBJECT:function(t,e){J(t,U),V(t,p,b(t,e.data_src))}},X=["IMG","IFRAME","VIDEO","OBJECT"],K=function(t,e){!e||function(t){return t.loadingCount>0}(e)||function(t){return t.toLoadCount>0}(e)||O(t.callback_finish,e)},Y=function(t,e,n){t.addEventListener(e,n),t.llEvLisnrs[e]=n},tt=function(t,e,n){t.removeEventListener(e,n)},et=function(t){return!!t.llEvLisnrs},nt=function(t){if(et(t)){var e=t.llEvLisnrs;for(var n in e)tt(t,n,e[n]);delete t.llEvLisnrs}},it=function(t,e,n){!function(t){delete t.llTempImage}(t),R(n,-1),function(t){t&&(t.toLoadCount-=1)}(n),A(t,e.class_loading),e.unobserve_completed&&I(t,n)},rt=function(t,e,n){var i=T(t)||t;et(i)||function(t,e,n){et(t)||(t.llEvLisnrs={}),Y(t,"VIDEO"===t.tagName?"loadeddata":"load",e),Y(t,"error",n)}(i,(function(){!function(t,e,n,i){var r=k(e);it(e,n,i),F(e,n.class_loaded),_(e,m),O(n.callback_loaded,e,i),r||K(n,i)}(0,t,e,n),nt(i)}),(function(){!function(t,e,n,i){var r=k(e);it(e,n,i),F(e,n.class_error),_(e,w),O(n.callback_error,e,i),n.restore_on_error&&G(e,$),r||K(n,i)}(0,t,e,n),nt(i)}))},st=function(t,e,n){!function(t){return X.indexOf(t.tagName)>-1}(t)?function(t,e,n){!function(t){t.llTempImage=document.createElement("IMG")}(t),rt(t,e,n),function(t){z(t)||(t[d]={backgroundImage:t.style.backgroundImage})}(t),function(t,e,n){var i=b(t,e.data_bg),r=b(t,e.data_bg_hidpi),a=s&&r?r:i;a&&(t.style.backgroundImage='url("'.concat(a,'")'),T(t).setAttribute(u,a),Q(t,e,n))}(t,e,n),function(t,e,n){var i=b(t,e.data_bg_multi),r=b(t,e.data_bg_multi_hidpi),a=s&&r?r:i;a&&(t.style.backgroundImage=a,H(t,e,n))}(t,e,n),function(t,e,n){var i=b(t,e.data_bg_set);if(i){var r=i.split("|"),s=r.map((function(t){return"image-set(".concat(t,")")}));t.style.backgroundImage=s.join(),""===t.style.backgroundImage&&(s=r.map((function(t){return"-webkit-image-set(".concat(t,")")})),t.style.backgroundImage=s.join()),H(t,e,n)}}(t,e,n)}(t,e,n):function(t,e,n){rt(t,e,n),function(t,e,n){var i=Z[t.tagName];i&&(i(t,e),Q(t,e,n))}(t,e,n)}(t,e,n)},at=function(t){t.removeAttribute(u),t.removeAttribute(c),t.removeAttribute(f)},ot=function(t){P(t,(function(t){G(t,$)})),G(t,$)},lt={IMG:ot,IFRAME:function(t){G(t,N)},VIDEO:function(t){D(t,(function(t){G(t,N)})),G(t,q),t.load()},OBJECT:function(t){G(t,U)}},ut=["IMG","IFRAME","VIDEO"],ct=function(t){return t.use_native&&"loading"in HTMLImageElement.prototype},ft=function(t){return Array.prototype.slice.call(t)},ht=function(t){return t.container.querySelectorAll(t.elements_selector)},dt=function(t){return function(t){return S(t)===w}(t)},pt=function(t,e){return function(t){return ft(t).filter(j)}(t||ht(e))},gt=function(t,n){var r=o(t);this._settings=r,this.loadingCount=0,function(t,e){i&&!ct(t)&&(e._observer=new IntersectionObserver((function(n){!function(t,e,n){t.forEach((function(t){return function(t){return t.isIntersecting||t.intersectionRatio>0}(t)?function(t,e,n,i){var r=function(t){return x.indexOf(S(t))>=0}(t);_(t,"entered"),F(t,n.class_entered),A(t,n.class_exited),function(t,e,n){e.unobserve_entered&&I(t,n)}(t,n,i),O(n.callback_enter,t,e,i),r||st(t,n,i)}(t.target,t,e,n):function(t,e,n,i){j(t)||(F(t,n.class_exited),function(t,e,n,i){n.cancel_on_exit&&function(t){return S(t)===g}(t)&&"IMG"===t.tagName&&(nt(t),function(t){P(t,(function(t){at(t)})),at(t)}(t),ot(t),A(t,n.class_loading),R(i,-1),E(t),O(n.callback_cancel,t,e,i))}(t,e,n,i),O(n.callback_exit,t,e,i))}(t.target,t,e,n)}))}(n,t,e)}),function(t){return{root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}}(t)))}(r,this),function(t,n){e&&(n._onlineHandler=function(){!function(t,e){var n;(n=ht(t),ft(n).filter(dt)).forEach((function(e){A(e,t.class_error),E(e)})),e.update()}(t,n)},window.addEventListener("online",n._onlineHandler))}(r,this),this.update(n)};return gt.prototype={update:function(t){var e,r,s=this._settings,a=pt(t,s);C(this,a.length),!n&&i?ct(s)?function(t,e,n){t.forEach((function(t){-1!==ut.indexOf(t.tagName)&&function(t,e,n){t.setAttribute("loading","lazy"),rt(t,e,n),function(t,e){var n=Z[t.tagName];n&&n(t,e)}(t,e),_(t,y)}(t,e,n)})),C(n,0)}(a,s,this):(r=a,function(t){t.disconnect()}(e=this._observer),function(t,e){e.forEach((function(e){t.observe(e)}))}(e,r)):this.loadAll(a)},destroy:function(){this._observer&&this._observer.disconnect(),e&&window.removeEventListener("online",this._onlineHandler),ht(this._settings).forEach((function(t){B(t)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){var e=this,n=this._settings;pt(t,n).forEach((function(t){I(t,e),st(t,n,e)}))},restoreAll:function(){var t=this._settings;ht(t).forEach((function(e){!function(t,e){(function(t){var e=lt[t.tagName];e?e(t):function(t){if(z(t)){var e=M(t);t.style.backgroundImage=e.backgroundImage}}(t)})(t),function(t,e){j(t)||k(t)||(A(t,e.class_entered),A(t,e.class_exited),A(t,e.class_applied),A(t,e.class_loading),A(t,e.class_loaded),A(t,e.class_error))}(t,e),E(t),B(t)}(e,t)}))}},gt.load=function(t,e){var n=o(e);st(t,n)},gt.resetStatus=function(t){E(t)},e&&function(t,e){if(e)if(e.length)for(var n,i=0;n=e[i];i+=1)l(t,n);else l(t,e)}(gt,window.lazyLoadOptions),gt}()}));const Sn=function(){document.lazyLoadInstance||(document.lazyLoadInstance=new bn({})),salla.infiniteScroll.event.onAppend((()=>document.lazyLoadInstance.update()))};export{Sn as g}
|