@salla.sa/twilight-components 2.9.48 → 2.9.49

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.
Files changed (30) hide show
  1. package/dist/cjs/{index-4700898c.js → index-7b85482c.js} +2 -2
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/salla-button_35.cjs.entry.js +11 -4
  4. package/dist/cjs/twilight.cjs.js +1 -1
  5. package/dist/collection/components/salla-cart-summary/salla-cart-summary.js +3 -3
  6. package/dist/collection/components/salla-user-menu/salla-user-menu.js +8 -1
  7. package/dist/components/index.js +2 -2
  8. package/dist/components/salla-cart-summary.js +3 -3
  9. package/dist/components/salla-user-menu.js +8 -1
  10. package/dist/esm/{index-55e33cdf.js → index-adc28dc8.js} +2 -2
  11. package/dist/esm/loader.js +1 -1
  12. package/dist/esm/salla-button_35.entry.js +11 -4
  13. package/dist/esm/twilight.js +1 -1
  14. package/dist/esm-es5/index-adc28dc8.js +24 -0
  15. package/dist/esm-es5/loader.js +1 -1
  16. package/dist/esm-es5/salla-button_35.entry.js +1 -1
  17. package/dist/esm-es5/twilight.js +1 -1
  18. package/dist/twilight/{p-37381192.entry.js → p-7234a2a2.entry.js} +4 -4
  19. package/dist/twilight/{p-0cf11465.system.js → p-a84812f4.system.js} +1 -1
  20. package/dist/twilight/{p-0de275dc.system.entry.js → p-d3daf7a7.system.entry.js} +1 -1
  21. package/dist/twilight/p-e55e8d3d.js +24 -0
  22. package/dist/twilight/p-ea021b56.system.js +24 -0
  23. package/dist/twilight/twilight.esm.js +1 -1
  24. package/dist/twilight/twilight.js +1 -1
  25. package/dist/types/components/salla-cart-summary/salla-cart-summary.d.ts +3 -3
  26. package/dist/types/components/salla-user-menu/salla-user-menu.d.ts +1 -0
  27. package/package.json +3 -3
  28. package/dist/esm-es5/index-55e33cdf.js +0 -24
  29. package/dist/twilight/p-6b7896e1.system.js +0 -24
  30. package/dist/twilight/p-f286c803.js +0 -24
@@ -0,0 +1,24 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import{c as t,a as e}from"./p-f84bae34.js";var i,n=Array.isArray,r="object"==typeof self&&self&&self.Object===Object&&self,s="object"==typeof t&&t&&t.Object===Object&&t||r||Function("return this")(),a=s.Symbol,o=Object.prototype,l=o.hasOwnProperty,u=o.toString,c=a?a.toStringTag:void 0,h=Object.prototype.toString,f=a?a.toStringTag:void 0,d=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":f&&f in Object(t)?function(t){var e=l.call(t,c),i=t[c];try{t[c]=void 0;var n=!0}catch(t){}var r=u.call(t);return n&&(e?t[c]=i:delete t[c]),r}(t):function(t){return h.call(t)}(t)},p=function(t){return"symbol"==typeof t||function(t){return null!=t&&"object"==typeof t}(t)&&"[object Symbol]"==d(t)},g=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,m=/^\w*$/,v=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)},w=s["__core-js_shared__"],y=(i=/[^.]+$/.exec(w&&w.keys&&w.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",b=Function.prototype.toString,S=/^\[object .+?Constructor\]$/,k=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),E=function(t){return!(!v(t)||(e=t,y&&y in e))&&(function(t){if(!v(t))return!1;var e=d(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}(t)?k:S).test(function(t){if(null!=t){try{return b.call(t)}catch(t){}try{return t+""}catch(t){}}return""}(t));var e},j=function(t,e){var i=function(t,e){return null==t?void 0:t[e]}(t,e);return E(i)?i:void 0},x=j(Object,"create"),_=Object.prototype.hasOwnProperty,F=Object.prototype.hasOwnProperty;function A(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}A.prototype.clear=function(){this.__data__=x?x(null):{},this.size=0},A.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},A.prototype.get=function(t){var e=this.__data__;if(x){var i=e[t];return"__lodash_hash_undefined__"===i?void 0:i}return _.call(e,t)?e[t]:void 0},A.prototype.has=function(t){var e=this.__data__;return x?void 0!==e[t]:F.call(e,t)},A.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=x&&void 0===e?"__lodash_hash_undefined__":e,this};var O=A,T=function(t,e){for(var i=t.length;i--;)if((n=t[i][0])===(r=e)||n!=n&&r!=r)return i;var n,r;return-1},R=Array.prototype.splice;function C(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}C.prototype.clear=function(){this.__data__=[],this.size=0},C.prototype.delete=function(t){var e=this.__data__,i=T(e,t);return!(i<0||(i==e.length-1?e.pop():R.call(e,i,1),--this.size,0))},C.prototype.get=function(t){var e=this.__data__,i=T(e,t);return i<0?void 0:e[i][1]},C.prototype.has=function(t){return T(this.__data__,t)>-1},C.prototype.set=function(t,e){var i=this.__data__,n=T(i,t);return n<0?(++this.size,i.push([t,e])):i[n][1]=e,this};var I=C,P=j(s,"Map"),L=function(t,e){var i,n,r=t.__data__;return("string"==(n=typeof(i=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==i:null===i)?r["string"==typeof e?"string":"hash"]:r.map};function $(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e<i;){var n=t[e];this.set(n[0],n[1])}}$.prototype.clear=function(){this.size=0,this.__data__={hash:new O,map:new(P||I),string:new O}},$.prototype.delete=function(t){var e=L(this,t).delete(t);return this.size-=e?1:0,e},$.prototype.get=function(t){return L(this,t).get(t)},$.prototype.has=function(t){return L(this,t).has(t)},$.prototype.set=function(t,e){var i=L(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this};var D=$;function N(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var i=function(){var n=arguments,r=e?e.apply(this,n):n[0],s=i.cache;if(s.has(r))return s.get(r);var a=t.apply(this,n);return i.cache=s.set(r,a)||s,a};return i.cache=new(N.Cache||D),i}N.Cache=D;var q=N,U=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,z=/\\(\\)?/g,B=function(){var t=q((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(U,(function(t,i,n,r){e.push(n?r.replace(z,"$1"):i||t)})),e}),(function(t){return 500===e.size&&e.clear(),t})),e=t.cache;return t}(),M=a?a.prototype:void 0,J=M?M.toString:void 0,H=function t(e){if("string"==typeof e)return e;if(n(e))return function(t,e){for(var i=-1,n=null==t?0:t.length,r=Array(n);++i<n;)r[i]=e(t[i],i,t);return r}(e,t)+"";if(p(e))return J?J.call(e):"";var i=e+"";return"0"==i&&1/e==-1/0?"-0":i},G=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&&!p(t))||m.test(t)||!g.test(t)||null!=e&&t in Object(e)}(t,e)?[t]:B(function(t){return null==t?"":H(t)}(t))},Q=function(t){if("string"==typeof t||p(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e},V=function(t,e,i){var n=null==t?void 0:function(t,e){for(var i=0,n=(e=G(e,t)).length;null!=t&&i<n;)t=t[Q(e[i++])];return i&&i==n?t:void 0}(t,e);return void 0===n?i:n},W=e((function(t){!function(e){var i=Object.hasOwnProperty,n=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 h(t,e){var i="(node) warning: possible EventEmitter memory leak detected. "+t+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(i+=" Event name: "+e+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(i);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=t,process.emitWarning(n)}else console.error(i),console.trace&&console.trace()}var f=function(t,e,i){var n=arguments.length;switch(n){case 0:return[];case 1:return[t];case 2:return[t,e];case 3:return[t,e,i];default:for(var r=new Array(n);n--;)r[n]=arguments[n];return r}};function d(t,i){for(var n={},r=t.length,s=i?i.length:0,a=0;a<r;a++)n[t[a]]=a<s?i[a]:e;return n}function p(t,e,i){var n,r;if(this._emitter=t,this._target=e,this._listeners={},this._listenersCount=0,(i.on||i.off)&&(n=i.on,r=i.off),e.addEventListener?(n=e.addEventListener,r=e.removeEventListener):e.addListener?(n=e.addListener,r=e.removeListener):e.on&&(n=e.on,r=e.off),!n&&!r)throw Error("target does not implement any known event API");if("function"!=typeof n)throw TypeError("on method must be a function");if("function"!=typeof r)throw TypeError("off method must be a function");this._on=n,this._off=r;var s=t._observers;s?s.push(this):t._observers=[this]}function g(t,n,r,s){var a=Object.assign({},n);if(!t)return a;if("object"!=typeof t)throw TypeError("options must be an object");var o,l,u,c=Object.keys(t),h=c.length;function f(t){throw Error('Invalid "'+o+'" option value'+(t?". Reason: "+t:""))}for(var d=0;d<h;d++){if(o=c[d],!s&&!i.call(n,o))throw Error('Unknown "'+o+'" option');(l=t[o])!==e&&(a[o]=(u=r[o])?u(l,f):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("|"),i=t.length,n=t[0],r=t[1];return 1===i?function(t,i){if(typeof t===n)return t;i(e)}:2===i?function(t,i){var s=typeof t;if(s===n||s===r)return t;i(e)}:function(n,r){for(var s=typeof n,a=i;a-- >0;)if(s===t[a])return n;r(e)}}Object.assign(p.prototype,{subscribe:function(t,e,i){var n=this,r=this._target,s=this._emitter,a=this._listeners,o=function(){var n=f.apply(null,arguments),a={data:n,name:e,original:t};if(i){var o=i.call(r,a);!1!==o&&s.emit.apply(s,[a.name].concat(n))}else s.emit.apply(s,[e].concat(n))};if(a[t])throw Error("Event '"+t+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!n._onNewListener?(this._onNewListener=function(i){i===e&&null===a[t]&&(a[t]=o,n._on.call(r,t,o))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(i){i===e&&!s.hasListeners(i)&&a[t]&&(a[t]=null,n._off.call(r,t,o))},a[t]=null,s.on("removeListener",this._onRemoveListener)):(a[t]=o,n._on.call(r,t,o))},unsubscribe:function(t){var e,i,n,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(n=(i=l(s)).length;n-- >0;)o.call(u,t=i[n],s[t]);this._listeners={},this._listenersCount=0,c()}}});var w=v(["function"]),y=v(["object","function"]);function b(t,e,i){var n,r,s,a=0,o=new t((function(l,u,c){function h(){r&&(r=null),a&&(clearTimeout(a),a=0)}i=g(i,{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 f=function(t){h(),l(t)},d=function(t){h(),u(t)};(n=!i.overload&&"function"==typeof t.prototype.cancel&&"function"==typeof c)?e(f,d,c):(r=[function(t){d(t||Error("canceled"))}],e(f,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),i.timeout>0&&(a=setTimeout((function(){var t=Error("timeout");t.code="ETIMEDOUT",a=0,o.cancel(t),u(t)}),i.timeout))}));return n||(o.cancel=function(t){if(r){for(var e=r.length,i=1;i<e;i++)r[i](t);r[0](t),r=null}}),o}function S(t){var e=this._observers;if(!e)return-1;for(var i=e.length,n=0;n<i;n++)if(e[n]._target===t)return n;return-1}function k(t,e,i,n,r){if(!i)return null;if(0===n){var s=typeof e;if("string"===s){var a,o,u=0,c=0,h=this.delimiter,f=h.length;if(-1!==(o=e.indexOf(h))){a=new Array(5);do{a[u++]=e.slice(c,o),c=o+f}while(-1!==(o=e.indexOf(h,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[n],E=e[n+1];if(n===r)i._listeners&&("function"==typeof i._listeners?(t&&t.push(i._listeners),b=[i]):(t&&t.push.apply(t,i._listeners),b=[i]));else{if("*"===S){for(o=(w=l(i)).length;o-- >0;)"_listeners"!==(d=w[o])&&(y=k(t,e,i[d],n+1,r))&&(b?b.push.apply(b,y):b=y);return b}if("**"===S){for((v=n+1===r||n+2===r&&"*"===E)&&i._listeners&&(b=k(t,e,i,r,r)),o=(w=l(i)).length;o-- >0;)"_listeners"!==(d=w[o])&&("*"===d||"**"===d?(i[d]._listeners&&!v&&(y=k(t,e,i[d],r,r))&&(b?b.push.apply(b,y):b=y),y=k(t,e,i[d],n,r)):y=k(t,e,i[d],d===E?n+2:n,r),y&&(b?b.push.apply(b,y):b=y));return b}i[S]&&(b=k(t,e,i[S],n+1,r))}if((p=i["*"])&&k(t,e,p,n+1,r),g=i["**"])if(n<r)for(g._listeners&&k(t,e,g,r,r),o=(w=l(g)).length;o-- >0;)"_listeners"!==(d=w[o])&&(d===E?k(t,e,g[d],n+2,r):d===S?k(t,e,g[d],n+1,r):((m={})[d]=g[d],k(t,e,{"**":m},n+1,r)));else g._listeners?k(t,e,g,r,r):g["*"]&&g["*"]._listeners&&k(t,e,g["*"],r,r);return b}function E(t,e,i){var n,r,s=0,a=0,o=this.delimiter,l=o.length;if("string"==typeof t)if(-1!==(n=t.indexOf(o))){r=new Array(5);do{r[s++]=t.slice(a,n),a=n+l}while(-1!==(n=t.indexOf(o,a)));r[s++]=t.slice(a)}else r=[t],s=1;else r=t,s=t.length;if(s>1)for(n=0;n+1<s;n++)if("**"===r[n]&&"**"===r[n+1])return;var u,c=this.listenerTree;for(n=0;n<s;n++)if(c=c[u=r[n]]||(c[u]={}),n===s-1)return c._listeners?("function"==typeof c._listeners&&(c._listeners=[c._listeners]),i?c._listeners.unshift(e):c._listeners.push(e),!c._listeners.warned&&this._maxListeners>0&&c._listeners.length>this._maxListeners&&(c._listeners.warned=!0,h.call(this,c._listeners.length,u))):c._listeners=e,!0;return!0}function j(t,e,i,n){for(var r,s,a,o,u=l(t),c=u.length,h=t._listeners;c-- >0;)r=t[s=u[c]],a="_listeners"===s?i:i?i.concat(s):[s],o=n||"symbol"==typeof s,h&&e.push(o?a:a.join(this.delimiter)),"object"==typeof r&&j.call(this,r,e,a,o);return e}function x(t){for(var e,i,n,r=l(t),s=r.length;s-- >0;)(e=t[i=r[s]])&&(n=!0,"_listeners"===i||x(e)||delete t[i]);return n}function _(t,e,i){this.emitter=t,this.event=e,this.listener=i}function F(t,i,n){if(!0===n)a=!0;else if(!1===n)s=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var s=n.async,a=n.promisify,l=n.nextTick,u=n.objectify}if(s||l||a){var c=i,h=i._origin||i;if(l&&!r)throw Error("process.nextTick is not supported");a===e&&(a="AsyncFunction"===i.constructor.name),(i=function(){var t=arguments,e=this,i=this.event;return a?l?Promise.resolve():new Promise((function(t){o(t)})).then((function(){return e.event=i,c.apply(e,t)})):(l?process.nextTick:o)((function(){e.event=i,c.apply(e,t)}))})._async=!0,i._origin=h}return[i,u?new _(this,t,i):this]}function A(t){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,c.call(this,t)}_.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},A.EventEmitter2=A,A.prototype.listenTo=function(t,i,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 i,n=r.reducers,a=S.call(s,t);i=-1===a?new p(s,t,r):s._observers[a];for(var o,u=l(e),c=u.length,h="function"==typeof n,f=0;f<c;f++)i.subscribe(o=u[f],e[o]||o,h?n:n&&n[o])}return r=g(r,{on:e,off:e,reducers:e},{on:w,off:w,reducers:y}),n(i)?a(d(i)):a("string"==typeof i?d(i.split(/\s+/)):i),this},A.prototype.stopListeningTo=function(t,e){var i=this._observers;if(!i)return!1;var n,r=i.length,s=!1;if(t&&"object"!=typeof t)throw TypeError("target should be an object");for(;r-- >0;)n=i[r],t&&n._target!==t||(n.unsubscribe(e),s=!0);return s},A.prototype.delimiter=".",A.prototype.setMaxListeners=function(t){t!==e&&(this._maxListeners=t,this._conf||(this._conf={}),this._conf.maxListeners=t)},A.prototype.getMaxListeners=function(){return this._maxListeners},A.prototype.event="",A.prototype.once=function(t,e,i){return this._once(t,e,!1,i)},A.prototype.prependOnceListener=function(t,e,i){return this._once(t,e,!0,i)},A.prototype._once=function(t,e,i,n){return this._many(t,1,e,i,n)},A.prototype.many=function(t,e,i,n){return this._many(t,e,i,!1,n)},A.prototype.prependMany=function(t,e,i,n){return this._many(t,e,i,!0,n)},A.prototype._many=function(t,e,i,n,r){var s=this;if("function"!=typeof i)throw new Error("many only accepts instances of Function");function a(){return 0==--e&&s.off(t,a),i.apply(this,arguments)}return a._origin=i,this._on(t,a,n,r)},A.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var t,e,i,n,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(i=o.length,s)for(n=0;n<i;n++)if("symbol"==typeof o[n]){a=!0;break}a||(o=o.join(this.delimiter))}var c,h=arguments.length;if(this._all&&this._all.length)for(n=0,i=(c=this._all.slice()).length;n<i;n++)switch(this.event=o,h){case 1:c[n].call(this,o);break;case 2:c[n].call(this,o,arguments[1]);break;case 3:c[n].call(this,o,arguments[1],arguments[2]);break;default:c[n].apply(this,arguments)}if(l)k.call(this,c=[],t,this.listenerTree,0,i);else{if("function"==typeof(c=this._events[o])){switch(this.event=o,h){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=new Array(h-1),r=1;r<h;r++)e[r-1]=arguments[r];c.apply(this,e)}return!0}c&&(c=c.slice())}if(c&&c.length){if(h>3)for(e=new Array(h-1),r=1;r<h;r++)e[r-1]=arguments[r];for(n=0,i=c.length;n<i;n++)switch(this.event=o,h){case 1:c[n].call(this);break;case 2:c[n].call(this,arguments[1]);break;case 3:c[n].call(this,arguments[1],arguments[2]);break;default:c[n].apply(this,e)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},A.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var t,e,i,n,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(n=o.length,s)for(r=0;r<n;r++)if("symbol"==typeof o[r]){e=!0;break}e||(o=o.join(this.delimiter))}var c,h=[],f=arguments.length;if(this._all)for(r=0,n=this._all.length;r<n;r++)switch(this.event=o,f){case 1:h.push(this._all[r].call(this,o));break;case 2:h.push(this._all[r].call(this,o,arguments[1]));break;case 3:h.push(this._all[r].call(this,o,arguments[1],arguments[2]));break;default:h.push(this._all[r].apply(this,arguments))}if(l?k.call(this,c=[],t,this.listenerTree,0):c=this._events[o],"function"==typeof c)switch(this.event=o,f){case 1:h.push(c.call(this));break;case 2:h.push(c.call(this,arguments[1]));break;case 3:h.push(c.call(this,arguments[1],arguments[2]));break;default:for(i=new Array(f-1),a=1;a<f;a++)i[a-1]=arguments[a];h.push(c.apply(this,i))}else if(c&&c.length){if(c=c.slice(),f>3)for(i=new Array(f-1),a=1;a<f;a++)i[a-1]=arguments[a];for(r=0,n=c.length;r<n;r++)switch(this.event=o,f){case 1:h.push(c[r].call(this));break;case 2:h.push(c[r].call(this,arguments[1]));break;case 3:h.push(c[r].call(this,arguments[1],arguments[2]));break;default:h.push(c[r].apply(this,i))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(h)},A.prototype.on=function(t,e,i){return this._on(t,e,!1,i)},A.prototype.prependListener=function(t,e,i){return this._on(t,e,!0,i)},A.prototype.onAny=function(t){return this._onAny(t,!1)},A.prototype.prependAny=function(t){return this._onAny(t,!0)},A.prototype.addListener=A.prototype.on,A.prototype._onAny=function(t,e){if("function"!=typeof t)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),e?this._all.unshift(t):this._all.push(t),this},A.prototype._on=function(t,i,n,r){if("function"==typeof t)return this._onAny(t,i),this;if("function"!=typeof i)throw new Error("on only accepts instances of Function");this._events||u.call(this);var s,a=this;return r!==e&&(i=(s=F.call(this,t,i,r))[0],a=s[1]),this._newListener&&this.emit("newListener",t,i),this.wildcard?(E.call(this,t,i,n),a):(this._events[t]?("function"==typeof this._events[t]&&(this._events[t]=[this._events[t]]),n?this._events[t].unshift(i):this._events[t].push(i),!this._events[t].warned&&this._maxListeners>0&&this._events[t].length>this._maxListeners&&(this._events[t].warned=!0,h.call(this,this._events[t].length,t))):this._events[t]=i,a)},A.prototype.off=function(t,e){if("function"!=typeof e)throw new Error("removeListener only takes instances of Function");var i,r=[];if(this.wildcard){var s="string"==typeof t?t.split(this.delimiter):t.slice();if(!(r=k.call(this,null,s,this.listenerTree,0)))return this}else{if(!this._events[t])return this;r.push({_listeners:i=this._events[t]})}for(var a=0;a<r.length;a++){var o=r[a];if(n(i=o._listeners)){for(var l=-1,u=0,c=i.length;u<c;u++)if(i[u]===e||i[u].listener&&i[u].listener===e||i[u]._origin&&i[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===i.length&&(this.wildcard?delete o._listeners:delete this._events[t]),this._removeListener&&this.emit("removeListener",t,e),this}(i===e||i.listener&&i.listener===e||i._origin&&i._origin===e)&&(this.wildcard?delete o._listeners:delete this._events[t],this._removeListener&&this.emit("removeListener",t,e))}return this.listenerTree&&x(this.listenerTree),this},A.prototype.offAny=function(t){var e,i=0,n=0;if(t&&this._all&&this._all.length>0){for(i=0,n=(e=this._all).length;i<n;i++)if(t===e[i])return e.splice(i,1),this._removeListener&&this.emit("removeListenerAny",t),this}else{if(e=this._all,this._removeListener)for(i=0,n=e.length;i<n;i++)this.emit("removeListenerAny",e[i]);this._all=[]}return this},A.prototype.removeListener=A.prototype.off,A.prototype.removeAllListeners=function(t){if(t===e)return!this._events||u.call(this),this;if(this.wildcard){var i,n=k.call(this,null,t,this.listenerTree,0);if(!n)return this;for(i=0;i<n.length;i++)n[i]._listeners=null;this.listenerTree&&x(this.listenerTree)}else this._events&&(this._events[t]=null);return this},A.prototype.listeners=function(t){var i,n,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=(i=l(o)).length,r=[];s-- >0;)"function"==typeof(n=o[i[s]])?r.push(n):r.push.apply(r,n);return r}if(this.wildcard){if(!(a=this.listenerTree))return[];var u=[],c="string"==typeof t?t.split(this.delimiter):t.slice();return k.call(this,u,c,a,0),u}return o&&(n=o[t])?"function"==typeof n?[n]:n:[]},A.prototype.eventNames=function(t){var e=this._events;return this.wildcard?j.call(this,this.listenerTree,[],null,t):e?l(e):[]},A.prototype.listenerCount=function(t){return this.listeners(t).length},A.prototype.hasListeners=function(t){if(this.wildcard){var i=[],n="string"==typeof t?t.split(this.delimiter):t.slice();return k.call(this,i,n,this.listenerTree,0),i.length>0}var r=this._events,s=this._all;return!!(s&&s.length||r&&(t===e?l(r).length:r[t]))},A.prototype.listenersAny=function(){return this._all?this._all:[]},A.prototype.waitFor=function(t,i){var n=this,r=typeof i;return"number"===r?i={timeout:i}:"function"===r&&(i={filter:i}),b((i=g(i,{timeout:0,filter:e,handleError:!1,Promise,overload:!1},{filter:w,Promise:m})).Promise,(function(e,r,s){function a(){var s=i.filter;if(!s||s.apply(n,arguments))if(n.off(t,a),i.handleError){var o=arguments[0];o?r(o):e(f.apply(null,arguments).slice(1))}else e(f.apply(null,arguments))}s((function(){n.off(t,a)})),n._on(t,a,!1)}),{timeout:i.timeout,overload:i.overload})};var O=A.prototype;Object.defineProperties(A,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(t){if("number"!=typeof t||t<0||Number.isNaN(t))throw TypeError("n must be a non-negative number");O._maxListeners=t},enumerable:!0},once:{value:function(t,e,i){return b((i=g(i,{Promise,timeout:0,overload:!1},{Promise:m})).Promise,(function(i,n,r){var s;if("function"==typeof t.addEventListener)return s=function(){i(f.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),i(f.apply(null,arguments))};"error"!==e&&(a=function(i){t.removeListener(e,o),n(i)},t.once("error",a)),r((function(){a&&t.removeListener("error",a),t.removeListener(e,o)})),t.once(e,o)}),{timeout:i.timeout,overload:i.overload})},writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=A}()})),Z=Object.assign?Object.assign:function(t){for(var e=1;e<arguments.length;e++)et(Object(arguments[e]),(function(e,i){t[i]=e}));return t},X=function(){if(Object.create)return function(t,e,i,n){var r=tt(arguments,1);return Z.apply(this,[Object.create(t)].concat(r))};{function t(){}return function(e,i,n,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 i=nt(t)?[]:{};return it(t,(function(t,n){return i[n]=e(t,n),!1})),i},pluck:it,isList:nt,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){it(t,(function(t,i){return e(t,i),!1}))}function it(t,e){if(nt(t)){for(var i=0;i<t.length;i++)if(e(t[i],i))return t[i]}else for(var n in t)if(t.hasOwnProperty(n)&&e(t[n],n))return t[n]}function nt(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,ht=Y.isObject,ft={createStore:pt},dt={version:"2.0.12",enabled:!1,get:function(t,e){var i=this.storage.read(this._namespacePrefix+t);return this._deserialize(i,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(i,n){t.call(e,e._deserialize(i),(n||"").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,i){i||(i=""),t&&!ut(t)&&(t=[t]),e&&!ut(e)&&(e=[e]);var n=i?"__storejs_"+i+"_":"",r=i?new RegExp("^"+n):null;if(!/^[a-zA-Z0-9_\-]*$/.test(i))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var s=lt({_namespacePrefix:n,_namespaceRegexp:r,_testStorage:function(t){try{var e="__storejs__test__";t.write(e,e);var i=t.read(e)===e;return t.remove(e),i}catch(t){return!1}},_assignPluginFnProp:function(t,e){var i=this[e];this[e]=function(){var e=rt(arguments,0),n=this;function r(){if(i)return at(arguments,(function(t,i){e[i]=t})),i.apply(n,e)}var s=[r].concat(e);return t.apply(n,s)}},_serialize:function(t){return JSON.stringify(t)},_deserialize:function(t,e){if(!t)return e;var i="";try{i=JSON.parse(t)}catch(e){i=t}return void 0!==i?i: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 new Error("Plugins must be function values that return objects");var i=t.call(this);if(!ht(i))throw new Error("Plugins must return an object of function properties");at(i,(function(i,n){if(!ct(i))throw new Error("Bad plugin property: "+n+" from plugin "+t.name+". Plugins should only return functions.");e._assignPluginFnProp(i,n)}))}},addStorage:function(t){!function(){var t="undefined"==typeof 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 i=vt().key(e);t(wt(i),i)}},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:kt,write:function(t,e){return St().setItem(t,e)},each:function(t){for(var e=St().length-1;e>=0;e--){var i=St().key(e);t(kt(i),i)}},remove:function(t){return St().removeItem(t)},clearAll:function(){return St().clear()}};function St(){return yt.sessionStorage}function kt(t){return St().getItem(t)}var Et=Y.trim,jt={name:"cookieStorage",read:function(t){if(!t||!At(t))return null;var e="(?:^|.*;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(xt.cookie.replace(new RegExp(e),"$1"))},write:function(t,e){t&&(xt.cookie=escape(t)+"="+escape(e)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")},each:_t,remove:Ft,clearAll:function(){_t((function(t,e){Ft(e)}))}},xt=Y.Global.document;function _t(t){for(var e=xt.cookie.split(/; ?/g),i=e.length-1;i>=0;i--)if(Et(e[i])){var n=e[i].split("="),r=unescape(n[0]);t(unescape(n[1]),r)}}function Ft(t){t&&At(t)&&(xt.cookie=escape(t)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function At(t){return new RegExp("(?:^|;\\s*)"+escape(t).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(xt.cookie)}var Ot={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 Rt(t,e=!1){t+="";let i,n=["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"],r=["0","1","2","3","4","5","6","7","8","9"],s=(e=e||!Salla.config.get("store.settings.arabic_numbers_enabled"))?n:r,a=e?r:n;for(let e=0;e<s.length;e++)i=new RegExp(s[e],"g"),t=t.replace(i,a[e]);return t}function Ct(t){let e=(t.match(/\./g)||[]).length;return e&&1!==e?Ct(t.replace(/\.(.+)\./g,".$1")):t}function It(t,e,i){let n=t[0];return i&&0==t.length?Array.isArray(i)?(i.push(e),i):[i,e]:Array.isArray(i)?(i.push(e),i):"string"==typeof i?[i,e]:i?(i[n]=It(t.slice(1),e,i[n]),i):n?{[n]:It(t.slice(1),e)}:""===n?[e]:e}function Pt(t){return Salla.config.get("store.url",window.location.href.split("/").slice(0,-1).join("/")).rtrim("/")+"/"+t.ltrim("/")}var Lt={digitsOnly:function(t){return Rt(t,!0).replace(/[^0-9.]/g,"").replace("..",".").rtrim(".")},inputDigitsOnly:function t(e,i=!1){if("string"==typeof e)return document.querySelectorAll(e).forEach((e=>t(e,i)));if(!e)return void Salla.logger.warn("Can't find Object With Id: "+e);let n=Salla.helpers.digitsOnly(e.value);return e.value=e.min&&n<e.min?e.min:e.max&&n>e.max?e.max:e.maxLength>=1&&n.toString().length>e.maxLength?n.toString().substring(0,e.maxLength):i||e.dataset.hasOwnProperty("digitsWithDecimal")?Ct(n):n.replace(/\D/g,"")},number:Rt,money:function(t){let e=Salla.config.currency(t?.currency).symbol;return Rt(t="object"==typeof t?t.amount:t)+" "+e},setNested:function(t,e,i){let n=t,r=e.split("."),s=r.length;for(let t=0;t<s-1;t++){let e=r[t];n[e]||(n[e]={}),n=n[e]}return n[r[s-1]]=i,t},getNested:function(t,e,i){let n=V(t,e);return void 0!==n?n:i},inputData:function(t,e,i={}){if(t.includes("[")){let n=t.split("]").join("").split("[");return{name:n[0],value:It(n.slice(1),e,i[n[0]])}}return{name:t,value:e}},url:{get:Pt,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",Pt("")).rtrim("/")+"/"+t.ltrim("/")}},addParamToUrl:function(t,e){if(!e||!t)return window.location.href;let i=new RegExp("([?&])"+t+"=[^&]+[&]?","g"),n=window.location.href.replace(i,"$1").replace(/&$|\?$/,"");return n+=(n.includes("?")?"&":"?")+t+"="+encodeURIComponent(e),n.replace(/&$|\?$/,"")},debounce:function(t,e){e=e||100;let i,n=[];return function(...r){return clearTimeout(i),i=setTimeout((()=>{let e=t(...r);n.forEach((t=>t(e))),n=[]}),e),new Promise((t=>n.push(t)))}}},$t=function(t){let e={log:function(e,i){if(!t)return;if(!salla.config.isDebug())return;"trace"===salla.config.get("debug")&&(i="trace");let n=t.log,r=void 0===i?n:this.__dict__[i]||n,s=["%cTwilight","color: #5cd5c4;font-weight:bold; border:1px solid #5cd5c4; padding: 2px 6px; border-radius: 5px;"],a={event:"#CFF680",backend:"#7b68ee"}[i];a&&(s[0]+="%c"+i[0].toUpperCase()+i.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 Dt=ft.createStore([mt,bt,jt,Ot],[]);"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=$t,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 i=t.replace("::",".");if(!this.noneFireableActions.includes(i)&&void 0!==Salla.call&&"function"==typeof Salla.call(i))return Salla.log(`'Salla.${i}(...)' triggered using event '${t}'`),i=i.split("."),void salla[i[0]][i[1]](...e);if(super.emit(t,...e),"undefined"!=typeof window){window.dataLayer=window.dataLayer||[];let i={event:t};e.map((t=>"object"==typeof t&&(i={...i,...t}))),window.dataLayer.push(i)}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,i]of Object.entries(t))this.dispatch(e,i);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=Dt}set(t,e){if(t.includes(".")){let i=t.split(".")[0],n={[i]:this.store.get(i)};return n=Salla.helpers.setNested(n,t,e),this.store.set(i,n[i])}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="",i=10){let n="";if(i){let t=new Date;t.setTime(t.getTime()+24*i*60*60*1e3),n="; expires="+t.toUTCString()}return document.cookie=`${t}=${e}${n}"; 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 i=t[e],n=i.indexOf("="),r=n>-1?i.substr(0,n):i;this.remove(r)}}},Salla.helpers=Lt,Salla.log=Salla.logger.log,Salla.money=Salla.helpers.money,Salla.url=Salla.helpers.url,Salla.versions={base:"[VI]{version}[/VI]"};var Nt,qt=Salla,Ut=e((function(e){!function(t,i){e.exports?e.exports=i():t.EvEmitter=i()}("undefined"!=typeof window?window:t,(function(){function t(){}let e=t.prototype;return e.on=function(t,e){if(!t||!e)return this;let i=this._events=this._events||{},n=i[t]=i[t]||[];return n.includes(e)||n.push(e),this},e.once=function(t,e){if(!t||!e)return this;this.on(t,e);let i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this},e.off=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;let n=i.indexOf(e);return-1!=n&&i.splice(n,1),this},e.emitEvent=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;i=i.slice(0),e=e||[];let n=this._onceEvents&&this._onceEvents[t];for(let r of i)n&&n[r]&&(this.off(t,r),delete n[r]),r.apply(this,e);return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t}))})),zt=e((function(e){!function(t,i){e.exports?e.exports=i(t):t.fizzyUIUtils=i(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 i=t.indexOf(e);-1!=i&&t.splice(i,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,i){return(t=e.makeArray(t)).filter((t=>t instanceof HTMLElement)).reduce(((t,e)=>{if(!i)return t.push(e),t;e.matches(i)&&t.push(e);let n=e.querySelectorAll(i);return t.concat(...n)}),[])},debounceMethod:function(t,e,i){i=i||100;let n=t.prototype[e],r=e+"Timeout";t.prototype[e]=function(){clearTimeout(this[r]);let t=arguments;this[r]=setTimeout((()=>{n.apply(this,t),delete this[r]}),i)}},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,i){return e+"-"+i})).toLowerCase()}},i=t.console;return e.htmlInit=function(n,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(i&&i.error(`Error parsing ${s} on ${t.className}: ${e}`))}let l=new n(t,e);o&&o.data(t,r,l)}))}))},e}))})),Bt=e((function(t){!function(e,i){t.exports?t.exports=i(e,Ut,zt):e.InfiniteScroll=i(e,e.EvEmitter,e.fizzyUIUtils)}(window,(function(t,e,i){let n=t.jQuery,r={};function s(t,e){let a=i.getQueryElement(t);if(a){if((t=a).infiniteScrollGUID){let i=r[t.infiniteScrollGUID];return i.option(e),i}this.element=t,this.options={...s.defaults},this.option(e),n&&(this.$element=n(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,i){this.log(t,i);let r=e?[e].concat(i):i;if(this.emitEvent(t,r),!n||!this.$element)return;let s=t+=".infiniteScroll";if(e){let i=n.Event(e);i.type=t,s=i}this.$element.trigger(s,i)};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,i)=>`${i.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 i=`[InfiniteScroll] ${t}`,n=l[t];n&&(i+=". "+n.apply(this,e)),console.log(i)},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:i.getQueryElement(e),!this.scroller)throw new 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?)"),i=new RegExp(e),n=location.href.match(i);n&&(this.pageIndex=parseInt(n[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 i=t.match(e);if(i){let[,t,e,n]=i;return{begin:t,index:e,end:n}}}};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 i=e.getAttribute("href"),n=c(i);if(!n)return void console.error(`InfiniteScroll unable to parse next link href: ${i}`);let{begin:r,index:s,end:a}=n;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,i=t.match(/^\?/),n=e.substring(0,e.lastIndexOf("/")),r=i?e:n+"/";this.getAbsolutePath=()=>r+this.getPath()},s.create.hideNav=function(){let t=i.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],n&&this.$element&&n.removeData(this.element,"infiniteScroll")},s.throttle=function(t,e){let i,n;return e=e||200,function(){let r=+new Date,s=arguments,a=()=>{i=r,t.apply(this,s)};i&&r<i+e?(clearTimeout(n),n=setTimeout(a,e)):a()}},s.data=function(t){let e=(t=i.getQueryElement(t))&&t.infiniteScrollGUID;return e&&r[e]},s.setJQuery=function(t){n=t},i.htmlInit(s,"infinite-scroll"),a._init=function(){};let{jQueryBridget:h}=t;return n&&h&&h("infiniteScroll",s,n),s}))})),Mt=(e((function(t){!function(e,i){t.exports?t.exports=i(e,Bt):i(e,e.InfiniteScroll)}(window,(function(t,e){let i=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)},i.onScrollThresholdLoad=function(){this.options.loadOnScroll&&this.loadNextPage()};let n=new DOMParser;function r(t){let e=document.createDocumentFragment();return t&&e.append(...t),e}return i.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:t,domParseResponse:e,fetchOptions:i}=this.options,r=this.getAbsolutePath();this.isLoading=!0,"function"==typeof i&&(i=i());let s=fetch(r,i).then((i=>{if(!i.ok){let t=new Error(i.statusText);return this.onPageError(t,r,i),{response:i}}return i[t]().then((s=>("text"==t&&e&&(s=n.parseFromString(s,"text/html")),204==i.status?(this.lastPageReached(s,r),{body:s,response:i}):this.onPageLoad(s,r,i))))})).catch((t=>{this.onPageError(t,r)}));return this.dispatchEvent("request",null,[r,s]),s},i.onPageLoad=function(t,e,i){return this.options.append||(this.isLoading=!1),this.pageIndex++,this.loadCount++,this.dispatchEvent("load",null,[t,e,i]),this.appendNextPage(t,e,i)},i.appendNextPage=function(t,e,i){let{append:n,responseBody:s,domParseResponse:a}=this.options;if("text"!=s||!a||!n)return{body:t,response:i};let o=t.querySelectorAll(n),l={body:t,response:i,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,i]),l);return this.options.outlayer?this.appendOutlayerItems(u,c):c()},i.appendItems=function(t,e){t&&t.length&&(function(t){let e=t.querySelectorAll("script");for(let t of e){let e=document.createElement("script"),i=t.attributes;for(let t of i)e.setAttribute(t.name,t.value);e.innerHTML=t.innerHTML,t.parentNode.replaceChild(e,t)}}(e=e||r(t)),this.element.appendChild(e))},i.appendOutlayerItems=function(i,n){let r=e.imagesLoaded||t.imagesLoaded;return r?new Promise((function(t){r(i,(function(){let e=n();t(e)}))})):(console.error("[InfiniteScroll] imagesLoaded required for outlayer option"),void(this.isLoading=!1))},i.onAppendOutlayer=function(t,e,i){this.options.outlayer.appended(i)},i.checkLastPage=function(t,e){let i,{checkLastPage:n,path:r}=this.options;if(n){if("function"==typeof r&&!this.getPath())return void this.lastPageReached(t,e);"string"==typeof n?i=n:this.isPathSelector&&(i=r),i&&t.querySelector&&(t.querySelector(i)||this.lastPageReached(t,e))}},i.lastPageReached=function(t,e){this.canLoad=!1,this.dispatchEvent("last",null,[t,e])},i.onPageError=function(t,e,i){return this.isLoading=!1,this.canLoad=!1,this.dispatchEvent("error",null,[t,e,i]),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}`)},i.prefill=function(){let t=this.getPrefillDistance();this.isPrefilling=t>=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},i.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},i.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},e}))})),e((function(t){!function(e,i){t.exports?t.exports=i(e,Bt,zt):i(e,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,i){let n=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()},n.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},n.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},n.bindScrollWatchEvents=function(e){let i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.pageScrollHandler),t[i]("resize",this.resizeHandler)},n.onPageScroll=e.throttle((function(){this.getBottomDistance()<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")})),n.getBottomDistance=function(){let e,i;return this.options.elementScroll?(e=this.scroller.scrollHeight,i=this.scroller.scrollTop+this.scroller.clientHeight):(e=this.top+this.element.clientHeight,i=t.scrollY+this.windowHeight),e-i},n.onResize=function(){this.updateMeasurements()},i.debounceMethod(e,"onResize",150),e}))})),e((function(t){!function(e,i){t.exports?t.exports=i(e,Bt,zt):i(e,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,i){let n=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.`))},n.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)},n.bindHistoryAppendEvents=function(e){let i=e?"addEventListener":"removeEventListener";this.scroller[i]("scroll",this.scrollHistoryHandler),t[i]("unload",this.unloadHandler)},n.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},e.destroy.history=n.destroyHistory=function(){this.options.history&&this.options.append&&this.bindHistoryAppendEvents(!1)},n.onAppendHistory=function(t,e,i){if(!i||!i.length)return;let n=this.getElementScrollY(i[0]);r.href=e,this.scrollPages.push({top:n,path:r.href,title:t.title})},n.getElementScrollY=function(e){return this.options.elementScroll?e.offsetTop-this.top:e.getBoundingClientRect().top+t.scrollY},n.onScrollHistory=function(){let t=this.getClosestScrollPage();t!=this.scrollPage&&(this.scrollPage=t,this.setHistory(t.title,t.path))},i.debounceMethod(e,"onScrollHistory",150),n.getClosestScrollPage=function(){let e,i;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;i=t}return i},n.setHistory=function(t,e){let i=this.options.history;i&&history[i+"State"]&&(history[i+"State"](null,t,e),this.options.historyTitle&&(document.title=t),this.dispatchEvent("history",null,[t,e]))},n.onUnload=function(){if(0===this.scrollPage.top)return;let e=t.scrollY-this.scrollPage.top+this.top;this.destroyHistory(),scrollTo(0,e)},n.onPageLoadHistory=function(t,e){this.setHistory(t.title,e)},e}))})),e((function(t){!function(e,i){t.exports?t.exports=i(0,Bt,zt):i(0,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,i){class n{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=i.getQueryElement(this.options.button);t&&(this.button=new n(t,this))},e.destroy.button=function(){this.button&&this.button.destroy()},e.Button=n,e}))})),e((function(t){!function(e,i){t.exports?t.exports=i(0,Bt,zt):i(0,e.InfiniteScroll,e.fizzyUIUtils)}(window,(function(t,e,i){let n=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=i.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"))},n.bindHideStatus=function(t){this[t](this.options.append?"append":"load",this.hideAllStatus)},n.showRequestStatus=function(){this.showStatus("request")},n.showErrorStatus=function(){this.showStatus("error")},n.showLastStatus=function(){this.showStatus("last"),this.bindHideStatus("off")},n.showStatus=function(t){s(this.statusElement),this.hideStatusEventElements(),s(this.statusEventElements[t])},n.hideAllStatus=function(){r(this.statusElement),this.hideStatusEventElements()},n.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=Bt)}))),Jt=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*([\[\]])$/,i=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/,n="en",r=function(t){this.locale=(t=t||{}).locale||function(){if("undefined"!=typeof document&&document.documentElement)return document.documentElement.lang}()||n,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,i){if(!this.has(t,i))return t;var n=this._getMessage(t,i);return null===n?t:(e&&(n=this._applyReplacements(n,e)),n)},r.prototype.trans=function(t,e){return this.get(t,e)},r.prototype.choice=function(t,e,n,r){(n=void 0!==n?n:{}).count=e;var s=this.get(t,n,r);if(null==s)return s;for(var a=s.split("|"),o=[],l=0;l<a.length;l++)if(a[l]=a[l].trim(),i.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,i){return this.choice(t,e,i)},r.prototype._parseKey=function(t,e){if("string"!=typeof t||"string"!=typeof e)return null;var i=t.split("."),n=i[0].replace(/\//g,".");return{source:e+"."+n,sourceFallback:this.getFallback()+"."+n,entries:i.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 i=this.messages[t.source],n=t.entries.slice(),r=n.join(".");if("string"!=typeof(i=void 0!==i?this._getValueInKey(i,r):void 0)&&this.messages[t.sourceFallback])for(i=this.messages[t.sourceFallback],n=t.entries.slice(),r="";n.length&&void 0!==i;)i[r=r?r.concat(".",n.shift()):n.shift()]&&(i=i[r],r="");return"string"!=typeof i?null:i},r.prototype._getValueInKey=function(t,e){if("string"==typeof t[e])return t[e];for(var i=(e=(e=e.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),n=0,r=i.length;n<r;++n){var s=i.slice(0,n+1).join("."),a=i.slice(n+1,i.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 i=t.join(".");if(e[i]){e=e[i];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(i){t=t.replace(new RegExp(":"+i,"gi"),(function(t){var n=e[i];return t===t.toUpperCase()?n.toUpperCase():t===t.replace(/\w/i,(function(t){return t.toUpperCase()}))?n.charAt(0).toUpperCase()+n.slice(1):n}))})),t},r.prototype._testInterval=function(i,n){if("string"!=typeof n)throw"Invalid interval: should be a string.";var r=(n=n.trim()).match(e);if(!r)throw"Invalid interval: "+n;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?i>=a:i>a)&&("]"===r[4]?i<=o:i<o)}for(var l=r[2].split(","),u=0;u<l.length;u++)if(parseInt(l[u],10)===i)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}()})),Ht=function(t,e){return function(){for(var i=new Array(arguments.length),n=0;n<i.length;n++)i[n]=arguments[n];return t.apply(e,i)}},Gt=Object.prototype.toString,Qt=(Nt=Object.create(null),function(t){var e=Gt.call(t);return Nt[e]||(Nt[e]=e.slice(8,-1).toLowerCase())});function Vt(t){return t=t.toLowerCase(),function(e){return Qt(e)===t}}function Wt(t){return Array.isArray(t)}function Zt(t){return void 0===t}var Xt=Vt("ArrayBuffer");function Kt(t){return null!==t&&"object"==typeof t}function Yt(t){if("object"!==Qt(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var te=Vt("Date"),ee=Vt("File"),ie=Vt("Blob"),ne=Vt("FileList");function re(t){return"[object Function]"===Gt.call(t)}var se=Vt("URLSearchParams");function ae(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),Wt(t))for(var i=0,n=t.length;i<n;i++)e.call(null,t[i],i,t);else for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.call(null,t[r],r,t)}var oe,le=(oe="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return oe&&t instanceof oe}),ue={isArray:Wt,isArrayBuffer:Xt,isBuffer:function(t){return null!==t&&!Zt(t)&&null!==t.constructor&&!Zt(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||re(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Xt(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:function(t){return"number"==typeof t},isObject:Kt,isPlainObject:Yt,isUndefined:Zt,isDate:te,isFile:ee,isBlob:ie,isFunction:re,isStream:function(t){return Kt(t)&&re(t.pipe)},isURLSearchParams:se,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:ae,merge:function t(){var e={};function i(i,n){e[n]=Yt(e[n])&&Yt(i)?t(e[n],i):Yt(i)?t({},i):Wt(i)?i.slice():i}for(var n=0,r=arguments.length;n<r;n++)ae(arguments[n],i);return e},extend:function(t,e,i){return ae(e,(function(e,n){t[n]=i&&"function"==typeof e?Ht(e,i):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,i,n){t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,i&&Object.assign(t.prototype,i)},toFlatObject:function(t,e,i){var n,r,s,a={};e=e||{};do{for(r=(n=Object.getOwnPropertyNames(t)).length;r-- >0;)a[s=n[r]]||(e[s]=t[s],a[s]=!0);t=Object.getPrototypeOf(t)}while(t&&(!i||i(t,e))&&t!==Object.prototype);return e},kindOf:Qt,kindOfTest:Vt,endsWith:function(t,e,i){t=String(t),(void 0===i||i>t.length)&&(i=t.length);var n=t.indexOf(e,i-=e.length);return-1!==n&&n===i},toArray:function(t){if(!t)return null;var e=t.length;if(Zt(e))return null;for(var i=new Array(e);e-- >0;)i[e]=t[e];return i},isTypedArray:le,isFileList:ne};function ce(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var he=function(t,e,i){if(!e)return t;var n;if(i)n=i(e);else if(ue.isURLSearchParams(e))n=e.toString();else{var r=[];ue.forEach(e,(function(t,e){null!=t&&(ue.isArray(t)?e+="[]":t=[t],ue.forEach(t,(function(t){ue.isDate(t)?t=t.toISOString():ue.isObject(t)&&(t=JSON.stringify(t)),r.push(ce(e)+"="+ce(t))})))})),n=r.join("&")}if(n){var s=t.indexOf("#");-1!==s&&(t=t.slice(0,s)),t+=(-1===t.indexOf("?")?"?":"&")+n}return t};function fe(){this.handlers=[]}fe.prototype.use=function(t,e,i){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1},fe.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},fe.prototype.forEach=function(t){ue.forEach(this.handlers,(function(e){null!==e&&t(e)}))};var de=fe,pe=function(t,e){ue.forEach(t,(function(i,n){n!==e&&n.toUpperCase()===e.toUpperCase()&&(t[e]=i,delete t[n])}))};function ge(t,e,i,n,r){Error.call(this),this.message=t,this.name="AxiosError",e&&(this.code=e),i&&(this.config=i),n&&(this.request=n),r&&(this.response=r)}ue.inherits(ge,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 me=ge.prototype,ve={};["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){ve[t]={value:t}})),Object.defineProperties(ge,ve),Object.defineProperty(me,"isAxiosError",{value:!0}),ge.from=function(t,e,i,n,r,s){var a=Object.create(me);return ue.toFlatObject(t,a,(function(t){return t!==Error.prototype})),ge.call(a,t.message,e,i,n,r),a.name=t.name,s&&Object.assign(a,s),a};var we=ge,ye={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},be=function(t,e){e=e||new FormData;var i=[];function n(t){return null===t?"":ue.isDate(t)?t.toISOString():ue.isArrayBuffer(t)||ue.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(r,s){if(ue.isPlainObject(r)||ue.isArray(r)){if(-1!==i.indexOf(r))throw Error("Circular reference detected in "+s);i.push(r),ue.forEach(r,(function(i,r){if(!ue.isUndefined(i)){var a,o=s?s+"."+r:r;if(i&&!s&&"object"==typeof i)if(ue.endsWith(r,"{}"))i=JSON.stringify(i);else if(ue.endsWith(r,"[]")&&(a=ue.toArray(i)))return void a.forEach((function(t){!ue.isUndefined(t)&&e.append(o,n(t))}));t(i,o)}})),i.pop()}else e.append(s,n(r))}(t),e},Se=ue.isStandardBrowserEnv()?{write:function(t,e,i,n,r,s){var a=[];a.push(t+"="+encodeURIComponent(e)),ue.isNumber(i)&&a.push("expires="+new Date(i).toGMTString()),ue.isString(n)&&a.push("path="+n),ue.isString(r)&&a.push("domain="+r),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new 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(){}},ke=function(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e},Ee=["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"],je=ue.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),i=document.createElement("a");function n(t){var n=t;return e&&(i.setAttribute("href",n),n=i.href),i.setAttribute("href",n),{href:i.href,protocol:i.protocol?i.protocol.replace(/:$/,""):"",host:i.host,search:i.search?i.search.replace(/^\?/,""):"",hash:i.hash?i.hash.replace(/^#/,""):"",hostname:i.hostname,port:i.port,pathname:"/"===i.pathname.charAt(0)?i.pathname:"/"+i.pathname}}return t=n(window.location.href),function(e){var i=ue.isString(e)?n(e):e;return i.protocol===t.protocol&&i.host===t.host}}():function(){return!0};function xe(t){we.call(this,null==t?"canceled":t,we.ERR_CANCELED),this.name="CanceledError"}ue.inherits(xe,we,{__CANCEL__:!0});var _e=xe,Fe={"Content-Type":"application/x-www-form-urlencoded"};function Ae(t,e){!ue.isUndefined(t)&&ue.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var Oe,Te={transitional:ye,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Oe=function(t){return new Promise((function(e,i){var n,r=t.data,s=t.headers,a=t.responseType;function o(){t.cancelToken&&t.cancelToken.unsubscribe(n),t.signal&&t.signal.removeEventListener("abort",n)}ue.isFormData(r)&&ue.isStandardBrowserEnv()&&delete s["Content-Type"];var l=new XMLHttpRequest;if(t.auth){var u=t.auth.username||"",c=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";s.Authorization="Basic "+btoa(u+":"+c)}var h=ke(t.baseURL,t.url);function f(){if(l){var n="getAllResponseHeaders"in l?function(t){var e,i,n,r={};return t?(ue.forEach(t.split("\n"),(function(t){if(n=t.indexOf(":"),e=ue.trim(t.substr(0,n)).toLowerCase(),i=ue.trim(t.substr(n+1)),e){if(r[e]&&Ee.indexOf(e)>=0)return;r[e]="set-cookie"===e?(r[e]?r[e]:[]).concat([i]):r[e]?r[e]+", "+i:i}})),r):r}(l.getAllResponseHeaders()):null;!function(t,e,i){var n=i.config.validateStatus;i.status&&n&&!n(i.status)?e(new we("Request failed with status code "+i.status,[we.ERR_BAD_REQUEST,we.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):t(i)}((function(t){e(t),o()}),(function(t){i(t),o()}),{data:a&&"text"!==a&&"json"!==a?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:n,config:t,request:l}),l=null}}if(l.open(t.method.toUpperCase(),he(h,t.params,t.paramsSerializer),!0),l.timeout=t.timeout,"onloadend"in l?l.onloadend=f:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(f)},l.onabort=function(){l&&(i(new we("Request aborted",we.ECONNABORTED,t,l)),l=null)},l.onerror=function(){i(new we("Network Error",we.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),i(new we(e,(t.transitional||ye).clarifyTimeoutError?we.ETIMEDOUT:we.ECONNABORTED,t,l)),l=null},ue.isStandardBrowserEnv()){var d=(t.withCredentials||je(h))&&t.xsrfCookieName?Se.read(t.xsrfCookieName):void 0;d&&(s[t.xsrfHeaderName]=d)}"setRequestHeader"in l&&ue.forEach(s,(function(t,e){void 0===r&&"content-type"===e.toLowerCase()?delete s[e]:l.setRequestHeader(e,t)})),ue.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)&&(n=function(t){l&&(i(!t||t&&t.type?new _e:t),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(n),t.signal&&(t.signal.aborted?n():t.signal.addEventListener("abort",n))),r||(r=null);var p,g=(p=/^([-+\w]{1,25})(:?\/\/|:)/.exec(h))&&p[1]||"";g&&-1===["http","https","file"].indexOf(g)?i(new we("Unsupported protocol "+g+":",we.ERR_BAD_REQUEST,t)):l.send(r)}))}),Oe),transformRequest:[function(t,e){if(pe(e,"Accept"),pe(e,"Content-Type"),ue.isFormData(t)||ue.isArrayBuffer(t)||ue.isBuffer(t)||ue.isStream(t)||ue.isFile(t)||ue.isBlob(t))return t;if(ue.isArrayBufferView(t))return t.buffer;if(ue.isURLSearchParams(t))return Ae(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var i,n=ue.isObject(t),r=e&&e["Content-Type"];if((i=ue.isFileList(t))||n&&"multipart/form-data"===r){var s=this.env&&this.env.FormData;return be(i?{"files[]":t}:t,s&&new s)}return n||"application/json"===r?(Ae(e,"application/json"),function(t){if(ue.isString(t))try{return(0,JSON.parse)(t),ue.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||Te.transitional,i=!(e&&e.silentJSONParsing)&&"json"===this.responseType;if(i||e&&e.forcedJSONParsing&&ue.isString(t)&&t.length)try{return JSON.parse(t)}catch(t){if(i){if("SyntaxError"===t.name)throw we.from(t,we.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, */*"}}};ue.forEach(["delete","get","head"],(function(t){Te.headers[t]={}})),ue.forEach(["post","put","patch"],(function(t){Te.headers[t]=ue.merge(Fe)}));var Re=Te,Ce=function(t,e,i){var n=this||Re;return ue.forEach(i,(function(i){t=i.call(n,t,e)})),t},Ie=function(t){return!(!t||!t.__CANCEL__)};function Pe(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new _e}var Le=function(t){return Pe(t),t.headers=t.headers||{},t.data=Ce.call(t,t.data,t.headers,t.transformRequest),t.headers=ue.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),ue.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||Re.adapter)(t).then((function(e){return Pe(t),e.data=Ce.call(t,e.data,e.headers,t.transformResponse),e}),(function(e){return Ie(e)||(Pe(t),e&&e.response&&(e.response.data=Ce.call(t,e.response.data,e.response.headers,t.transformResponse))),Promise.reject(e)}))},$e=function(t,e){e=e||{};var i={};function n(t,e){return ue.isPlainObject(t)&&ue.isPlainObject(e)?ue.merge(t,e):ue.isPlainObject(e)?ue.merge({},e):ue.isArray(e)?e.slice():e}function r(i){return ue.isUndefined(e[i])?ue.isUndefined(t[i])?void 0:n(void 0,t[i]):n(t[i],e[i])}function s(t){if(!ue.isUndefined(e[t]))return n(void 0,e[t])}function a(i){return ue.isUndefined(e[i])?ue.isUndefined(t[i])?void 0:n(void 0,t[i]):n(void 0,e[i])}function o(i){return i in e?n(t[i],e[i]):i in t?n(void 0,t[i]):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 ue.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=l[t]||r,n=e(t);ue.isUndefined(n)&&e!==o||(i[t]=n)})),i},De={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){De[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}}));var Ne={};De.transitional=function(t,e,i){function n(t,e){return"[Axios v0.27.2] Transitional option '"+t+"'"+e+(i?". "+i:"")}return function(i,r,s){if(!1===t)throw new we(n(r," has been removed"+(e?" in "+e:"")),we.ERR_DEPRECATED);return e&&!Ne[r]&&(Ne[r]=!0,console.warn(n(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(i,r,s)}};var qe={assertOptions:function(t,e,i){if("object"!=typeof t)throw new we("options must be an object",we.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(t),r=n.length;r-- >0;){var s=n[r],a=e[s];if(a){var o=t[s],l=void 0===o||a(o,s,t);if(!0!==l)throw new we("option "+s+" must be "+l,we.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new we("Unknown option "+s,we.ERR_BAD_OPTION)}},validators:De},Ue=qe.validators;function ze(t){this.defaults=t,this.interceptors={request:new de,response:new de}}ze.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=$e(this.defaults,e)).method=e.method?e.method.toLowerCase():this.defaults.method?this.defaults.method.toLowerCase():"get";var i=e.transitional;void 0!==i&&qe.assertOptions(i,{silentJSONParsing:Ue.transitional(Ue.boolean),forcedJSONParsing:Ue.transitional(Ue.boolean),clarifyTimeoutError:Ue.transitional(Ue.boolean)},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var s,a=[];if(this.interceptors.response.forEach((function(t){a.push(t.fulfilled,t.rejected)})),!r){var o=[Le,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(a),s=Promise.resolve(e);o.length;)s=s.then(o.shift(),o.shift());return s}for(var l=e;n.length;){var u=n.shift(),c=n.shift();try{l=u(l)}catch(t){c(t);break}}try{s=Le(l)}catch(t){return Promise.reject(t)}for(;a.length;)s=s.then(a.shift(),a.shift());return s},ze.prototype.getUri=function(t){t=$e(this.defaults,t);var e=ke(t.baseURL,t.url);return he(e,t.params,t.paramsSerializer)},ue.forEach(["delete","get","head","options"],(function(t){ze.prototype[t]=function(e,i){return this.request($e(i||{},{method:t,url:e,data:(i||{}).data}))}})),ue.forEach(["post","put","patch"],(function(t){function e(e){return function(i,n,r){return this.request($e(r||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}ze.prototype[t]=e(),ze.prototype[t+"Form"]=e(!0)}));var Be=ze;function Me(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var i=this;this.promise.then((function(t){if(i._listeners){var e,n=i._listeners.length;for(e=0;e<n;e++)i._listeners[e](t);i._listeners=null}})),this.promise.then=function(t){var e,n=new Promise((function(t){i.subscribe(t),e=t})).then(t);return n.cancel=function(){i.unsubscribe(e)},n},t((function(t){i.reason||(i.reason=new _e(t),e(i.reason))}))}Me.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Me.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},Me.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},Me.source=function(){var t;return{token:new Me((function(e){t=e})),cancel:t}};var Je=Me,He=function t(e){var i=new Be(e),n=Ht(Be.prototype.request,i);return ue.extend(n,Be.prototype,i),ue.extend(n,i),n.create=function(i){return t($e(e,i))},n}(Re);He.Axios=Be,He.CanceledError=_e,He.CancelToken=Je,He.isCancel=Ie,He.VERSION="0.27.2",He.toFormData=be,He.AxiosError=we,He.Cancel=He.CanceledError,He.all=function(t){return Promise.all(t)},He.spread=function(t){return function(e){return t.apply(null,e)}},He.isAxiosError=function(t){return ue.isObject(t)&&!0===t.isAxiosError};var Ge=He;Ge.default=He;var Qe=Ge;function Ve(t){this.message=t}(Ve.prototype=new Error).name="InvalidCharacterError";var We="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new Ve("'atob' failed: The string to be decoded is not correctly encoded.");for(var i,n,r=0,s=0,a="";n=e.charAt(s++);~n&&(i=r%4?64*i+n:n,r++%4)?a+=String.fromCharCode(255&i>>(-2*r&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};function Ze(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(We(t).replace(/(.)/g,(function(t,e){var i=e.charCodeAt(0).toString(16).toUpperCase();return i.length<2&&(i="0"+i),"%"+i})))}(e)}catch(t){return We(e)}}function Xe(t){this.message=t}function Ke(t,e){if("string"!=typeof t)throw new Xe("Invalid token specified");var i=!0===(e=e||{}).header?0:1;try{return JSON.parse(Ze(t.split(".")[i]))}catch(t){throw new Xe("Invalid token specified: "+t.message)}}(Xe.prototype=new Error).name="InvalidTokenError";let Ye=function(t){return alert(t)},ti=function(t,e){return Ye(t,ei.error,e)},ei={error:"error",success:"success",info:"info"};var ii={fire:function(t,e,i){return Ye(t,e,i)},setNotifier:function(t){Ye=t,salla.event.emit("twilight::notifier.changed")},error:ti,success:function(t,e){return Ye(t,ei.success,e)},info:function(t,e){return Ye(t,ei.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=>{ti(decodeURI(t.replace("?danger=","").replace("&danger=","")))}))})))},types:ei};class ni{constructor(t,e){return this.api=t,this.event=e,new Proxy(this,{get:function(i,n){return"event"===n?e:"api"===n?t:t&&t[n]||i[n]}})}}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 i,n=this,r=0;r<t.length;r++)i=new RegExp(t[r],"g"),n=n.replace(i,e[r]);return n},String.prototype.rtrim=function(t){return void 0===t&&(t="\\s"),this.replace(new RegExp("["+t+"]*$"),"")},String.prototype.ltrim=function(t){return void 0===t&&(t="\\s"),this.replace(new RegExp("^["+t+"]*"),"")},String.prototype.digitsOnly=function(){return Salla.helpers.digitsOnly(this)},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 i=this.getAttribute("data-function");if(i&&window[i])return"function"==typeof window[i]?this.getFilteredData(window[i].call(this,...e)):this.getFilteredData(window[i]);let n=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if(n="FORM"===this.tagName?this:n||this.closest("form")||this.closest("[salla-form-data]")||this,n&&"FORM"===n.tagName)return this.getFilteredData(new FormData(n),null,n);let r=n.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 i=0;i<this.attributes.length;i++){let n=this.attributes[i].name.toLowerCase();if(0===n.indexOf(t))return!e||n}return!1},HTMLFormElement.prototype.getAjaxFormData=function(t){var e=this.querySelectorAll('input[type="file"]');e.forEach((t=>{t.files.length||t.setAttribute("disabled","")}));var i=new FormData(this);return e.forEach((t=>{t.files.length||t.removeAttribute("disabled")})),{formData:this.getFilteredData(i,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,i=null){return t=t||i?.dataset||this.dataset,i&&this.name&&void 0!==this.value&&(t=function(t,e,i){return t instanceof FormData?t.append(e,i):t[e]=i,t}(t,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((n=>{let r=i?.dataset[n]||this.dataset[n];if(r){var s=window[r];if("function"==typeof s){if(!s(t,i||this,e)&&t)throw`Data failed to be pass verify function window.${r}(formData, element, event)!`;return s(t,i||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 ri{constructor(){this.events={},this.namespace="";let t=/function (.{1,})\(/.exec(this.constructor.toString());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(...i){return e.dispatch(t,...i)}}createDynamicListenerFuns(t){let e="on"+t.charAt(0).toUpperCase()+t.slice(1);if(this[e])return;let i=this;this[e]=function(e){return i.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 si(t){t&&t.sallaInitiated&&!t.initiated&&(t.sallaInitiated(),t.initiated=!0)}Salla.event.auth=new class extends ri{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){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 ri{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",couponAdded:"coupon.added",couponDeleted:"coupon.deleted",couponAdditionFailed:"coupon.addition.failed",couponDeletionFailed:"coupon.deletion.failed",quickCheckoutSettingFetched:"quick-checkout.fetched",quickCheckoutSettingFailed:"quick-checkout.failed",quickCheckoutSucceeded:"quick-checkout.succeeded",quickCheckoutFailed:"quick-checkout.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 ri{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 ri{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 ri{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 ri{constructor(){super(),this.namespace="comment",this.events={added:"added",additionFailed:"addition.failed"},this.after_init()}},Salla.event.loyalty=new class extends ri{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 ri{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",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 ri{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 ri{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 ri{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,i){this.on(t,(t=>{"function"!=typeof e?"function"==typeof i&&t.target.matches(e)&&i(t):e(t)}))}fireEvent(t,e,...i){return this.fireEventForElements(t,e,!1,...i)}fireEventForAll(t,e,...i){return this.fireEventForElements(t,e,!0,...i)}fireEventForElements(t,e,i,...n){if("string"==typeof t){if(i)return document.querySelectorAll(t).forEach((t=>this.fireEventForElements(t,e,!1,...n)));t=document.querySelector(t)}if(!t)return void salla.log("Failed To get element to fire event: "+e);const r=new CustomEvent(e,...n);return t.dispatchEvent(r)}},Salla.event.wishlist=new class extends ri{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 ri{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 ri{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])&&(si(t),Object.keys(t).forEach((e=>{si(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((i=>{t&&(e=[],t=!1),i.code=i.code||i.iso_code,i.url=salla.url.get(i.code),i.is_rtl=i.is_rtl||i.rtl,e.push(i)})),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((i=>{t&&(e={},t=!1),i.country_code=i.code.substr(0,2).toLowerCase(),e[i.code]=i})),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 ai{constructor(){this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.endpointsMethods={},this.endpointsHeaders={};let t=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(t&&t.length>1?t[1]:"").toLowerCase(),this.debounce={request:void 0,time:300,enabled:!0,exclude:[]}}after_init(){}normalRequest(t,e,i=null){let n=Array.isArray(t),r=n?this.getUrl(...t):this.getUrl(t),s=this.endpointsHeaders[t=n?t[0]:t];if("get"===(i=i||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"===i&&(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,i,{headers:s})}request(t,e,i=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,i)):this.normalRequest(t,e,i)}getUrl(t){let e=this.endpoints[t]||t;const i=/{[^{}]+}/i;for(let t=1;t<arguments.length;t++)e=e.replace(i,arguments[t]);return e}event(){return salla.event[this.className]}}class oi extends ai{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",getQuickCheckout:"checkout/quick-checkout",createQuickCheckout:"checkout/quick-checkout"},this.endpointsMethods={latest:"get",details:"get",status:"get",updateItem:"post",deleteItem:"delete",deleteImage:"delete",deleteCoupon:"put",getQuickCheckout:"get"},this.webEndpoints=["latest"],this.latestCart=null,this.after_init()}async getCurrentCartId(){if(salla.cart.api.latestCart)return salla.cart.api.latestCart.cart.id;let t=await this.latest();return salla.cart.api.latestCart=t.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 i=salla.form.getPossibleValue(e.payload,["endpoint"]);i&&["addItem","quickAdd"].includes(i)||(i=salla.form.getPossibleValue(e.payload,["quantity","donating_amount"])?"addItem":"quickAdd");let n=await this.getCurrentCartId();return this.request([i,n,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 i=await this.getCurrentCartId();return this.request(["deleteItem",i,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 i=await this.getCurrentCartId();return"Object"===e.payload.constructor?.name?e.payload._method="PUT":e.payload.append("_method","PUT"),this.request(["updateItem",i,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,i=null){return super.normalRequest(t,e,i).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=new 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}))}getQuickCheckoutSettings(){return this.request("getQuickCheckout").then((t=>(salla.event.cart.quickCheckoutSettingFetched(t),t))).catch((t=>{throw salla.event.cart.quickCheckoutSettingFailed(t),t}))}createQuickCheckout(t){return this.request("createQuickCheckout",t).then((t=>(salla.event.cart.quickCheckoutSucceeded(t),t))).catch((t=>{throw salla.event.cart.quickCheckoutFailed(t),t}))}}class li extends ai{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 ui extends ai{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 i=salla.form.getPossibleValue(t,["type"]);if(!i){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 n=await this.request(["verify",i],t);if(200!==n?.status)return salla.auth.event.verificationFailed(n,i),salla.api.errorPromise(n);let r="authenticated"===n.data?.case;return r&&salla.auth.event.tokenFetched(n.data.token),e&&await this.request("auth/jwt"),r&&salla.auth.event.loggedIn(n),salla.auth.event.verified(n,i),salla.auth.api.afterUserLogin(),salla.api.successPromise(n)}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");salla.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 ci extends ai{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.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 hi extends ai{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",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={get:"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,i=salla.form.getPossibleValue(e,["id","prod_id","product_id"]);return this.request(["getPrice",i],"object"==typeof e?e:void 0).then((function(t){return salla.product.event.priceUpdated(t,i),t})).catch((function(t){throw salla.product.event.priceUpdateFailed(t,i),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}))}addGiftToCart(t,e,i=!1){return this.request(["giftToCart",t],e).then((e=>(salla.product.event.addGiftToCartSucceeded(e,t),i&&(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 fi extends ai{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 di extends ai{constructor(){super(),this.namespace="comment",this.endpoints={add:"{type}/{id}/comments"},this.after_init()}add(t){t?.data&&(t=t.data);let e,i=salla.form.getPossibleValue(t,["id"]),n=salla.form.getPossibleValue(t,["type"]),r=salla.form.getPossibleValue(t,["comment"]);return i?n&&["products","pages","product","page"].includes(n)?r?(n+=["product","page"].includes(n)?"s":"",this.request(["add",n,i],{comment:r}).then((function(t){return salla.event.comment.added(t,i),t})).catch((function(t){throw salla.event.comment.additionFailed(t,i),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 pi extends ai{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 gi extends ai{constructor(){super(),this.namespace="document"}}class mi extends ai{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:{},i=salla.form.getPossibleValue(t?.data||t,["order_id","id"]);if(!i){let t='There is no "order_id"!';return salla.event.rating.orderNotFetched(t),salla.api.errorPromise(t)}return this.request(["order",i],e).then((function(t){return salla.event.rating.orderFetched(t,i),t})).catch((function(t){throw salla.event.rating.orderNotFetched(t,i),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 vi extends ai{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 i=salla.storage.get("salla::wishlist",[]);e?i.push(t):i.splice(i.indexOf(t),1),salla.storage.set("salla::wishlist",i)}}class wi extends ai{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 yi extends ai{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 bi{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 i=e.getAjaxFormData(t),n=i.method?i.method.toLowerCase():void 0;salla.api.request(i.url,i.formData,n).then((t=>(t.data&&t.request&&(t=t.data),salla.api.handleAfterResponseActions(t),this.callAjaxEvent(i.events.success,t,i.formData),t))).catch((t=>{throw salla.api.handleErrorResponse(t),this.callAjaxEvent(i.events.fail,t,i.formData),t}))}callAjaxEvent(t,e,i){if(t){if(i instanceof FormData){const t={};Array.from(i.entries()).forEach((function(e){t[e[0]]=e[1]})),i=t}window[t]?window[t](e,i):salla.event.dispatch(t,e,i)}}setSallaReady(t){qt.status="ready",qt.event.dispatch("twilight::initiated",t),window.dispatchEvent(new CustomEvent("salla::ready"))}}qt.status="loading",qt.notify=ii,qt.lang=new class extends Jt{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 i=document.createElement("script");i.src=t,i.onload=()=>{if(window.translations)return this.setMessages(window.translations);i.onerror()},i.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(i)}get(t,e,i){return window.translations&&(t="trans."+t),super.get(t,e,i)}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 i=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(),i=e.target.getElementSallaData(),salla.log("Data from element",i)}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,i,"post").finally((()=>{loaderSupported&&e?.submitter?.parentElement.stop()}));let n=t.split("."),r=n.splice(-1);return await salla.call(n.join("."))[r](i).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,i=!1){if(!t)return;if("object"!=typeof t)return t;let n;for(let i=0;i<e.length&&!(n=t[e[i]])&&!("undefined"!=typeof FormData&&t instanceof FormData&&(n=t.get(e[i])));i++);return n=n||t,"object"!=typeof n||i?n:void 0}},qt.helpers.app=new class{toggleClassIf(t,e,i,n){return document.querySelectorAll(t).forEach((t=>this.toggleElementClassIf(t,e,i,n))),this}toggleElementClassIf(t,e,i,n){e=Array.isArray(e)?e:e.split(" "),i=Array.isArray(i)?i:i.split(" ");let r=n(t);return t?.classList.remove(...r?i:e),t?.classList.add(...r?e:i),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(String(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,i,n={}){return"object"==typeof e?(this.element(e).addEventListener(t,i,n),this):(document.querySelectorAll(e).forEach((e=>e.addEventListener(t,i,n))),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 ni{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,i){i=this.getCustomOptions(e,i);let n="string"!=typeof t?t:document.querySelector(t),r=i.path;if(!n||!r||"string"==typeof r&&!document.querySelector(r))return void Salla.logger.warn(n?"Path Option (a link that has next page link) Not Existed!":"Container For InfiniteScroll not Existed!");let s=new Mt(n,i);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",(()=>this.initiateRequest())),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=Qe.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(){this.axios.defaults.baseURL=Salla.config.get("store.api",Salla.config.get("store.url")),this.setHeaders({"Store-Identifier":Salla.config.get("store.id"),currency:Salla.config.get("user.currency_code","SAR"),"accept-language":salla.lang.getLocale(),"s-user-id":Salla.config.get("user.id")});let t=salla.storage.get("scope");t&&this.setHeaders({"s-scope-type":t.type,"s-scope-id":t.id}),this.injectTokenToTheRequests()}injectTokenToTheRequests(){let t=salla.storage.get("token"),e=Salla.config.isGuest(),i=salla.storage.get("cart");if(i&&(i.user_id!==Salla.config.get("user.id")||i.store_id!==Salla.config.get("store.id")))return salla.log("Auth:: The cart is not belong to current "+(i.user_id!==Salla.config.get("user.id")?"user":"store")+"!"),void salla.cart.api.reset();if(e&&!t)return;if(e&&t)return salla.log("Auth:: Token without user!"),salla.storage.remove("token"),void salla.cart.api.reset();if(!t)return salla.cart.api.reset(),void salla.auth.api.refresh();let n=Ke(t);return Date.now()/1e3>n.exp?(salla.log("Auth:: An expired token!"),salla.storage.remove("token"),salla.cart.api.reset(),void salla.auth.api.refresh()):n.sub!==Salla.config.get("user.id")?(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()):void this.setToken(t)}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,i="get",n={}){let r={endPoint:t,payload:e,method:i,options:n},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:i=null}=t,n=e&&e.googleTags?e.googleTags:i;dataLayer&&n&&dataLayer.push(n),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,i=[];Object.keys(e).forEach((t=>{let n=e[t];Array.isArray(n)?n.forEach((t=>i.push(t))):i.push(n)}));let n=(i.length>1?"* ":"")+i.join("\n* ");salla.error(n,t)}isFastRequestsAllowed(){return Salla.config.get("fastRequests")}promise(t,e=!0){return new Promise(((i,n)=>e?i(t):n(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(i){i.innerHTML=t.sections[e]}))}))}}{constructor(){super(),this.auth=new ui,this.cart=new oi,this.loyalty=new li,this.order=new ci,this.rating=new mi,this.product=new hi,this.profile=new fi,this.comment=new di,this.currency=new pi,this.document=new gi,this.wishlist=new vi,this.scope=new wi,this.booking=new yi}},qt.cart=new ni(qt.api.cart,qt.event.cart),qt.auth=new ni(qt.api.auth,qt.event.auth),qt.order=new ni(qt.api.order,qt.event.order),qt.scope=new ni(qt.api.scope,qt.event.scope),qt.rating=new ni(qt.api.rating,qt.event.rating),qt.comment=new ni(qt.api.comment,qt.event.comment),qt.loyalty=new ni(qt.api.loyalty,qt.event.loyalty),qt.product=new ni(qt.api.product,qt.event.product),qt.profile=new ni(qt.api.profile,qt.event.profile),qt.currency=new ni(qt.api.currency,qt.event.currency),qt.document=new ni(qt.api.document,qt.event.document),qt.wishlist=new ni(qt.api.wishlist,qt.event.wishlist),qt.booking=new ni(qt.api.booking,qt.event.booking),qt.call=t=>{let e=qt,i=t.split(".");for(;i.length&&(e=e[i.shift()]););return e},qt.init=t=>new bi(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.event.dispatch("twilight::ready"),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"));