@salla.sa/twilight 2.7.14 → 2.7.15
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.
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2013 hij1nx
|
|
7
7
|
* Licensed under the MIT license.
|
|
8
|
-
*/!function(e,t){!function(t){var r=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="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(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function c(){this._events={},this._conf&&u.call(this,this._conf)}function u(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function h(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var d=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function f(e,r){for(var n={},i=e.length,s=r?r.length:0,a=0;a<i;a++)n[e[a]]=a<s?r[a]:t;return n}function p(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)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 i)throw TypeError("off method must be a function");this._on=n,this._off=i;var s=e._observers;s?s.push(this):e._observers=[this]}function g(e,n,i,s){var a=Object.assign({},n);if(!e)return a;if("object"!=typeof e)throw TypeError("options must be an object");var o,l,c,u=Object.keys(e),h=u.length;function d(e){throw Error('Invalid "'+o+'" option value'+(e?". Reason: "+e:""))}for(var f=0;f<h;f++){if(o=u[f],!s&&!r.call(n,o))throw Error('Unknown "'+o+'" option');(l=e[o])!==t&&(c=i[o],a[o]=c?c(l,d):l)}return a}function m(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function v(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var s=typeof e;if(s===n||s===i)return e;r(t)}:function(n,i){for(var s=typeof n,a=r;a-- >0;)if(s===e[a])return n;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,s=this._emitter,a=this._listeners,o=function(){var n=d.apply(null,arguments),a={data:n,name:t,original:e};if(r){var o=r.call(i,a);!1!==o&&s.emit.apply(s,[a.name].concat(n))}else s.emit.apply(s,[t].concat(n))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===a[e]&&(a[e]=o,n._on.call(i,e,o))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!s.hasListeners(r)&&a[e]&&(a[e]=null,n._off.call(i,e,o))},a[e]=null,s.on("removeListener",this._onRemoveListener)):(a[e]=o,n._on.call(i,e,o))},unsubscribe:function(e){var t,r,n,i=this,s=this._listeners,a=this._emitter,o=this._off,c=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function u(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=_.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=s[e]))return;o.call(c,e,t),delete s[e],--this._listenersCount||u()}else{for(n=(r=l(s)).length;n-- >0;)e=r[n],o.call(c,e,s[e]);this._listeners={},this._listenersCount=0,u()}}});var y=v(["function"]),b=v(["object","function"]);function w(e,t,r){var n,i,s,a=0,o=new e((function(l,c,u){function h(){i&&(i=null),a&&(clearTimeout(a),a=0)}r=g(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var d=function(e){h(),l(e)},f=function(e){h(),c(e)};n?t(d,f,u):(i=[function(e){f(e||Error("canceled"))}],t(d,f,(function(e){if(s)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),s=!0),r.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,o.cancel(e),c(e)}),r.timeout))}));return n||(o.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),o}function _(e){var t=this._observers;if(!t)return-1;for(var r=t.length,n=0;n<r;n++)if(t[n]._target===e)return n;return-1}function E(e,t,r,n,i){if(!r)return null;if(0===n){var s=typeof t;if("string"===s){var a,o,c=0,u=0,h=this.delimiter,d=h.length;if(-1!==(o=t.indexOf(h))){a=new Array(5);do{a[c++]=t.slice(u,o),u=o+d}while(-1!==(o=t.indexOf(h,u)));a[c++]=t.slice(u),t=a,i=c}else t=[t],i=1}else"object"===s?i=t.length:(t=[t],i=1)}var f,p,g,m,v,y,b,w=null,_=t[n],S=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),w=[r]):(e&&e.push.apply(e,r._listeners),w=[r]));else{if("*"===_){for(o=(y=l(r)).length;o-- >0;)"_listeners"!==(f=y[o])&&(b=E(e,t,r[f],n+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===_){for((v=n+1===i||n+2===i&&"*"===S)&&r._listeners&&(w=E(e,t,r,i,i)),o=(y=l(r)).length;o-- >0;)"_listeners"!==(f=y[o])&&("*"===f||"**"===f?(r[f]._listeners&&!v&&(b=E(e,t,r[f],i,i))&&(w?w.push.apply(w,b):w=b),b=E(e,t,r[f],n,i)):b=E(e,t,r[f],f===S?n+2:n,i),b&&(w?w.push.apply(w,b):w=b));return w}r[_]&&(w=E(e,t,r[_],n+1,i))}if((p=r["*"])&&E(e,t,p,n+1,i),g=r["**"])if(n<i)for(g._listeners&&E(e,t,g,i,i),o=(y=l(g)).length;o-- >0;)"_listeners"!==(f=y[o])&&(f===S?E(e,t,g[f],n+2,i):f===_?E(e,t,g[f],n+1,i):((m={})[f]=g[f],E(e,t,{"**":m},n+1,i)));else g._listeners?E(e,t,g,i,i):g["*"]&&g["*"]._listeners&&E(e,t,g["*"],i,i);return w}function S(e,t,r){var n,i,s=0,a=0,o=this.delimiter,l=o.length;if("string"==typeof e)if(-1!==(n=e.indexOf(o))){i=new Array(5);do{i[s++]=e.slice(a,n),a=n+l}while(-1!==(n=e.indexOf(o,a)));i[s++]=e.slice(a)}else i=[e],s=1;else i=e,s=e.length;if(s>1)for(n=0;n+1<s;n++)if("**"===i[n]&&"**"===i[n+1])return;var c,u=this.listenerTree;for(n=0;n<s;n++)if(u=u[c=i[n]]||(u[c]={}),n===s-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),r?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,c))):u._listeners=t,!0;return!0}function x(e,t,r,n){for(var i,s,a,o,c=l(e),u=c.length,h=e._listeners;u-- >0;)i=e[s=c[u]],a="_listeners"===s?r:r?r.concat(s):[s],o=n||"symbol"==typeof s,h&&t.push(o?a:a.join(this.delimiter)),"object"==typeof i&&x.call(this,i,t,a,o);return t}function A(e){for(var t,r,n,i=l(e),s=i.length;s-- >0;)(t=e[r=i[s]])&&(n=!0,"_listeners"===r||A(t)||delete e[r]);return n}function P(e,t,r){this.emitter=e,this.event=t,this.listener=r}function F(e,r,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,c=n.objectify}if(s||l||a){var u=r,h=r._origin||r;if(l&&!i)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===r.constructor.name),r=function(){var e=arguments,t=this,r=this.event;return a?l?Promise.resolve():new Promise((function(e){o(e)})).then((function(){return t.event=r,u.apply(t,e)})):(l?process.nextTick:o)((function(){t.event=r,u.apply(t,e)}))},r._async=!0,r._origin=h}return[r,c?new P(this,e,r):this]}function L(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,u.call(this,e)}P.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},L.EventEmitter2=L,L.prototype.listenTo=function(e,r,i){if("object"!=typeof e)throw TypeError("target musts be an object");var s=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var r,n=i.reducers,a=_.call(s,e);r=-1===a?new p(s,e,i):s._observers[a];for(var o,c=l(t),u=c.length,h="function"==typeof n,d=0;d<u;d++)o=c[d],r.subscribe(o,t[o]||o,h?n:n&&n[o])}return i=g(i,{on:t,off:t,reducers:t},{on:y,off:y,reducers:b}),n(r)?a(f(r)):a("string"==typeof r?f(r.split(/\s+/)):r),this},L.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,s=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),s=!0);return s},L.prototype.delimiter=".",L.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},L.prototype.getMaxListeners=function(){return this._maxListeners},L.prototype.event="",L.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},L.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},L.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},L.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},L.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},L.prototype._many=function(e,t,r,n,i){var s=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&s.off(e,a),r.apply(this,arguments)}return a._origin=r,this._on(e,a,n,i)},L.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var e,t,r,n,i,a,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(l&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,s)for(n=0;n<r;n++)if("symbol"==typeof o[n]){a=!0;break}a||(o=o.join(this.delimiter))}var u,h=arguments.length;if(this._all&&this._all.length)for(n=0,r=(u=this._all.slice()).length;n<r;n++)switch(this.event=o,h){case 1:u[n].call(this,o);break;case 2:u[n].call(this,o,arguments[1]);break;case 3:u[n].call(this,o,arguments[1],arguments[2]);break;default:u[n].apply(this,arguments)}if(l)u=[],E.call(this,u,e,this.listenerTree,0,r);else{if("function"==typeof(u=this._events[o])){switch(this.event=o,h){case 1:u.call(this);break;case 2:u.call(this,arguments[1]);break;case 3:u.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(h-1),i=1;i<h;i++)t[i-1]=arguments[i];u.apply(this,t)}return!0}u&&(u=u.slice())}if(u&&u.length){if(h>3)for(t=new Array(h-1),i=1;i<h;i++)t[i-1]=arguments[i];for(n=0,r=u.length;n<r;n++)switch(this.event=o,h){case 1:u[n].call(this);break;case 2:u[n].call(this,arguments[1]);break;case 3:u[n].call(this,arguments[1],arguments[2]);break;default:u[n].apply(this,t)}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},L.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var e,t,r,n,i,a,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(l&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,s)for(i=0;i<n;i++)if("symbol"==typeof o[i]){t=!0;break}t||(o=o.join(this.delimiter))}var u,h=[],d=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=o,d){case 1:h.push(this._all[i].call(this,o));break;case 2:h.push(this._all[i].call(this,o,arguments[1]));break;case 3:h.push(this._all[i].call(this,o,arguments[1],arguments[2]));break;default:h.push(this._all[i].apply(this,arguments))}if(l?(u=[],E.call(this,u,e,this.listenerTree,0)):u=this._events[o],"function"==typeof u)switch(this.event=o,d){case 1:h.push(u.call(this));break;case 2:h.push(u.call(this,arguments[1]));break;case 3:h.push(u.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(d-1),a=1;a<d;a++)r[a-1]=arguments[a];h.push(u.apply(this,r))}else if(u&&u.length){if(u=u.slice(),d>3)for(r=new Array(d-1),a=1;a<d;a++)r[a-1]=arguments[a];for(i=0,n=u.length;i<n;i++)switch(this.event=o,d){case 1:h.push(u[i].call(this));break;case 2:h.push(u[i].call(this,arguments[1]));break;case 3:h.push(u[i].call(this,arguments[1],arguments[2]));break;default:h.push(u[i].apply(this,r))}}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)},L.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},L.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},L.prototype.onAny=function(e){return this._onAny(e,!1)},L.prototype.prependAny=function(e){return this._onAny(e,!0)},L.prototype.addListener=L.prototype.on,L.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},L.prototype._on=function(e,r,n,i){if("function"==typeof e)return this._onAny(e,r),this;if("function"!=typeof r)throw new Error("on only accepts instances of Function");this._events||c.call(this);var s,a=this;return i!==t&&(r=(s=F.call(this,e,r,i))[0],a=s[1]),this._newListener&&this.emit("newListener",e,r),this.wildcard?(S.call(this,e,r,n),a):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),n?this._events[e].unshift(r):this._events[e].push(r),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=r,a)},L.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var s="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=E.call(this,null,s,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var a=0;a<i.length;a++){var o=i[a];if(r=o._listeners,n(r)){for(var l=-1,c=0,u=r.length;c<u;c++)if(r[c]===t||r[c].listener&&r[c].listener===t||r[c]._origin&&r[c]._origin===t){l=c;break}if(l<0)continue;return this.wildcard?o._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete o._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete o._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&A(this.listenerTree),this},L.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},L.prototype.removeListener=L.prototype.off,L.prototype.removeAllListeners=function(e){if(e===t)return!this._events||c.call(this),this;if(this.wildcard){var r,n=E.call(this,null,e,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&A(this.listenerTree)}else this._events&&(this._events[e]=null);return this},L.prototype.listeners=function(e){var r,n,i,s,a,o=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!o)return[];for(s=(r=l(o)).length,i=[];s-- >0;)"function"==typeof(n=o[r[s]])?i.push(n):i.push.apply(i,n);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var c=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,c,u,a,0),c}return o&&(n=o[e])?"function"==typeof n?[n]:n:[]},L.prototype.eventNames=function(e){var t=this._events;return this.wildcard?x.call(this,this.listenerTree,[],null,e):t?l(t):[]},L.prototype.listenerCount=function(e){return this.listeners(e).length},L.prototype.hasListeners=function(e){if(this.wildcard){var r=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,s=this._all;return!!(s&&s.length||i&&(e===t?l(i).length:i[e]))},L.prototype.listenersAny=function(){return this._all?this._all:[]},L.prototype.waitFor=function(e,r){var n=this,i=typeof r;return"number"===i?r={timeout:r}:"function"===i&&(r={filter:r}),w((r=g(r,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:y,Promise:m})).Promise,(function(t,i,s){function a(){var s=r.filter;if(!s||s.apply(n,arguments))if(n.off(e,a),r.handleError){var o=arguments[0];o?i(o):t(d.apply(null,arguments).slice(1))}else t(d.apply(null,arguments))}s((function(){n.off(e,a)})),n._on(e,a,!1)}),{timeout:r.timeout,overload:r.overload})};var O=L.prototype;Object.defineProperties(L,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");O._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return w((r=g(r,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,(function(r,n,i){var s;if("function"==typeof e.addEventListener)return s=function(){r(d.apply(null,arguments))},i((function(){e.removeEventListener(t,s)})),void e.addEventListener(t,s,{once:!0});var a,o=function(){a&&e.removeListener("error",a),r(d.apply(null,arguments))};"error"!==t&&(a=function(r){e.removeListener(t,o),n(r)},e.once("error",a)),i((function(){a&&e.removeListener("error",a),e.removeListener(t,o)})),e.once(t,o)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=L}()}(E);var S=E.exports;class x extends a{constructor(e){super(e),this.namespace="infiniteScroll",this.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},this.after_init()}}class A{constructor(e){this.parent=e,this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.endpointsMethods={},this.endpointsHeaders={};var 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(e,t,r=null){let n=this,i=Array.isArray(e),s=i?this.getUrl(...e):this.getUrl(e);e=i?e[0]:e,r=r||this.endpointsMethods[e]||"post";let a=this.endpointsHeaders[e];if("get"===r&&t instanceof FormData){var o={};Array.from(t.entries()).forEach((function(e){o[e[0]]=e[1]})),t={params:o}}a&&"get"===r&&(t=t?Object.assign(t,a):a);let l={namespace:this.namespace,action:e,url:s,payload:t,method:r,headers:a};try{salla.event.document.request(l)}catch(e){return salla.event.document.requestFailed(l),new Promise((()=>{throw e}))}this.webEndpoints.includes(e)?s=salla.url.get(s):"http"!==s.substring(0,4)&&(s=salla.url.api(s));let c="undefined"!=typeof event?event.currentTarget:null,u=!1;return"SALLA-BUTTON"===c?.tagName&&(u=!0),u&&c?.load(),this.parent[r](s,t,{headers:a}).then((e=>(u&&c?.stop(),e.data&&e.request&&(e=e.data),n.handleAfterResponseActions(e),e))).catch((e=>{throw u&&c?.stop(),salla.event.document.requestFailed(l,e),n.handleErrorResponse(e),e}))}request(e,t,r=null){return!this.isFastRequestsAllowed()&&this.debounce.enabled?(this.debounce.request||(this.debounce.request=salla.helpers.debounce(this.normalRequest.bind(this),this.debounce.time)),this.debounce.request(e,t,r)):this.normalRequest(e,t,r)}getUrl(e){let t=this.endpoints[e]||e;const r=/{[^{}]+}/i;for(let e=1;e<arguments.length;e++)t=t.replace(r,arguments[e]);return t}handleAfterResponseActions(e){if(!e)return;let{data:t,googleTags:r=null}=e,n=t&&t.googleTags?t.googleTags:r;dataLayer&&n&&dataLayer.push(n),this.fireEventsForResponse(e),this.renderSections(e),this.showAlert(e),e.data?.token&&salla.event.auth.tokenFetched(e.data.token)}fireEventsForResponse(e){let t=e.events||e.data?.events||e.error?.events;"string"==typeof t&&(t=JSON.parse(t)),t&&Object.keys(t).forEach((e=>salla.event.dispatch(e,t[e])))}renderSections(e){e.sections&&Object.keys(e.sections).forEach((t=>{document.querySelectorAll(t.toSelector()).forEach((function(r){r.innerHTML=e.sections[t]}))}))}handleErrorResponse(e){if(e.response&&e.response.data)return e.response.data.error&&e.response.data.error.fields&&!salla.config.get("sdk.notifier_handler_disabled",!1)?this.handleInvalidFields(e):this.handleAfterResponseActions(e.response.data)}showAlert(e){if(e&&!salla.config.get("sdk.notifier_handler_disabled",!1))return e.case&&e.msg?salla.notify.fire(e.msg,e.case,e):e.hasOwnProperty("success")&&e.data?.message?salla.notify.fire(e.data?.message,e.success?salla.notify.types.success:salla.notify.types.error,e):e.error&&e.error.message&&"FORBIDDEN"!==e.error.message?salla.error(e.error.message,e):void 0}handleInvalidFields(e){let t=e.response.data.error.fields,r=[];Object.keys(t).forEach((e=>{let n=t[e];Array.isArray(n)?n.forEach((e=>r.push(e))):r.push(n)}));let n=(r.length>1?"* ":"")+r.join("\n* ");salla.error(n,e)}event(){return salla.event[this.className]}getPossibleValue(e,t,r=!1){if(!e)return;if("object"!=typeof e)return e;let n;for(let r=0;r<t.length&&!(n=e[t[r]])&&!("undefined"!=typeof FormData&&e instanceof FormData&&(n=e.get(t[r])));r++);return n=n||e,"object"!=typeof n||r?n:void 0}isFastRequestsAllowed(){return salla.config.get("fastRequests")}promise(e,t=!0){return new Promise(((r,n)=>t?r(e):n(e)))}errorPromise(e){return this.promise(e,!1)}successPromise(e){return this.promise(e,!0)}}class P extends A{constructor(e){super(e),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"},this.endpointsMethods={latest:"get",details:"get",status:"get",updateItem:"post",deleteItem:"delete",deleteImage:"delete",deleteCoupon:"put"},this.webEndpoints=["latest"],this.after_init()}async getCurrentCartId(){return salla.storage.get("cart.id")||(await this.latest()).data.cart.id}getUploadImageEndpoint(e){return salla.url.api(this.getUrl("uploadImage",e||salla.storage.get("cart.id")))}latest(){return this.request("latest",{params:{source:""}}).then((e=>(salla.storage.set("cart",e.data.cart),salla.event.cart.latestFetched(e),e))).catch((e=>{throw salla.storage.set("cart",""),salla.event.cart.latestFailed(e),e}))}async details(){let e=await this.getCurrentCartId();return this.request(["details",e]).then((function(e){return salla.cart.event.detailsFetched(e),e})).catch((function(e){throw salla.cart.event.detailsNotFetched(e),e}))}async quickAdd(e){return this.addItem(e)}async addItem(e){let t=this.getCartPayload(e);if(!t.id){let e='There is no product "id"!';return salla.cart.event.itemAddedFailed(e),this.errorPromise(e)}let r=this.getPossibleValue(t.payload,["quantity","donating_amount"])?"addItem":"quickAdd",n=await this.getCurrentCartId();return this.request([r,n,t.id],t.payload).then((function(e){return salla.cart.event.itemAdded(e,t.id),e})).catch((function(e){throw salla.cart.event.itemAddedFailed(e,t.id),e}))}async deleteItem(e){let t=this.getCartPayload(e);if(!t.id){let e='There is no "id"!';return salla.cart.event.itemDeletedFailed(e),this.errorPromise(e)}let r=await this.getCurrentCartId();return this.request(["deleteItem",r,t.id]).then((function(e){return salla.cart.event.itemDeleted(e,t.id),e})).catch((function(e){throw salla.cart.event.itemDeletedFailed(e,t.id),e}))}async updateItem(e){let t=this.getCartPayload(e);if(!t.id){let e='There is no "id"!';return salla.cart.event.itemUpdatedFailed(e),this.errorPromise(e)}let r=await this.getCurrentCartId();return"Object"===t.payload.constructor?.name?t.payload._method="PUT":t.payload.append("_method","PUT"),this.request(["updateItem",r,t.id],t.payload).then((function(e){return salla.cart.event.itemUpdated(e,t.id),e})).catch((function(e){throw salla.cart.event.itemUpdatedFailed(e,t.id),e}))}async deleteImage(e){if(!(e=this.getPossibleValue(e,["id","image_id","photo_id"]))){let e='There is no "id"!';return salla.cart.event.imageNotDeleted(e),this.errorPromise(e)}let t=await this.getCurrentCartId();return this.request(["deleteImage",t,e]).then((function(t){return salla.cart.event.imageDeleted(t,e),t})).catch((function(t){throw salla.cart.event.imageNotDeleted(t,e),t}))}async status(e){return e=e||await this.getCurrentCartId(),this.request(["status",e],{params:{has_apple_pay:!!window.ApplePaySession}})}async submit(){this.status(await this.getCurrentCartId()).then((e=>{let t=e.data.next_step.to;if(!["checkout","refresh","login"].includes(t)){let e="Can't find next_step );";throw salla.cart.event.submitFailed(e),e}if(salla.cart.event.submitted(e),"login"===t)return salla.auth.setCanRedirect(!1),salla.event.dispatch("login::open"),void salla.auth.event.onLoggedIn((e=>{salla.event.dispatch("login::close"),this.submit()}));"checkout"===t?window.location.href=e.data.next_step.url+(window.ApplePaySession?"?has_apple_pay=true":""):window.location.reload()})).catch((function(e){throw salla.cart.event.submitFailed(e),e}))}getCartPayload(e){let t=e?.data||("object"==typeof e?e:void 0);return e=t?this.getPossibleValue(t,["prod_id","product_id","item_id","id"]):e,t="object"==typeof t?t:void 0,{id:e,payload:t}}handleAfterResponseActions(e){if(403===e.status){salla.storage.remove("cart");let e=salla.lang.get("pages.checkout.try_again");throw salla.error(e),e}super.handleAfterResponseActions(e)}reset(){salla.storage.remove("cart"),salla.cart.event.successReset()}async addCoupon(e){if(e=e.data||e,!(e=this.getPossibleValue(e,["coupon"]))){let e=new Error('There is no "Coupon Code"!');return e.name="EmptyCoupon",salla.event.cart.couponAdditionFailed(e),this.errorPromise(e)}let t=await salla.cart.api.getCurrentCartId();return this.request(["addCoupon",t],{coupon:e}).then((function(e){return salla.event.cart.couponAdded(e,t),e})).catch((function(e){throw salla.event.cart.couponAdditionFailed(e,t),e}))}async deleteCoupon(){let e=await salla.cart.api.getCurrentCartId();return this.request(["deleteCoupon",e],{}).then((function(t){return salla.event.cart.couponDeleted(t,e),t})).catch((function(t){throw salla.event.cart.couponDeletionFailed(t,e),t}))}}class F extends A{constructor(e){super(e),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((e=>(salla.loyalty.event.programFetched(e),e))).catch((e=>{throw salla.loyalty.event.programNotFetched(e),e}))}async exchange(e,t=null){if(!(e=this.getPossibleValue(e,["id","loyalty_prize_id","prize_id"]))){let e="Unable to find cart id. Please provide one.";return salla.loyalty.event.exchangeFailed(e),this.errorPromise(e)}if(!(t=t||await salla.cart.getCurrentCartId())){let e="Unable to find cart id. Please provide one.";return salla.loyalty.event.exchangeFailed(e),this.errorPromise(e)}return this.request("exchange",{loyalty_prize_id:e,cart_id:t}).then((function(t){return salla.loyalty.event.exchangeSucceeded(t,e),t})).catch((function(t){throw salla.loyalty.event.exchangeFailed(t,e),t}))}async reset(e=null){if(!(e=e||await salla.cart.getCurrentCartId())){let e="Unable to find cart id. Please provide one.";return salla.loyalty.event.resetFailed(e),this.errorPromise(e)}return this.request("reset",{cart_id:e}).then((e=>(salla.loyalty.event.resetSucceeded(e),e))).catch((e=>{throw salla.loyalty.event.resetFailed(e),e}))}}class L extends A{constructor(e){super(e),this.namespace="auth",this.canRedirect_=!0,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()}setCanRedirect(e){salla.api.auth.canRedirect_=e}canRedirect(){return salla.api.auth.canRedirect_}login(e){e.data&&(e=e.data);let t=this.getPossibleValue(e,["type"]);if(!["email","mobile"].includes(t)){let e="Login type should be in: [email, mobile]";return salla.auth.event.codeNotSent(e),this.errorPromise(e)}return this.request(["login",t],e).then((function(e){return salla.auth.event.codeSent(e,t),e})).catch((function(e){throw salla.auth.event.codeNotSent(e,t),e}))}async verify(e,t=!0){let r=this.getPossibleValue(e,["type"]);if(!r){let e="Failed to know what's login type!";return salla.auth.event.verificationFailed(e),this.errorPromise(e)}t=!1!==this.getPossibleValue(e,["supportWebAuth"])&&t,salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event);let n=await this.request(["verify",r],e);return 200!==n?.status?(salla.auth.event.verificationFailed(n,r),this.errorPromise(n)):(t&&await this.request("auth/jwt"),"authenticated"===n.data?.case&&salla.auth.event.loggedIn(n),salla.auth.event.verified(n,r),this.successPromise(n))}resend(e){let t;return(e=e.data||e).type=e.type||"mobile","mobile"!==e.type||e.phone&&e.country_code?"email"!==e.type||e.email?this.request("resend",e).then((function(t){return salla.auth.event.codeSent(t,e),t})).catch((function(t){throw salla.auth.event.codeNotSent(t,e),t})):(salla.auth.event.codeNotSent(t="There is no email!",e),this.errorPromise(t)):(salla.auth.event.codeNotSent(t="There is no phone or country_code!",e),this.errorPromise(t))}register(e){let t;return e.data&&(t=e.element,e=e.data),salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event),this.request("register",e).then((async function(e){return salla.auth.event.registered.call(t,e),"authenticated"===e.data?.case&&(await salla.auth.api.request("auth/jwt"),salla.auth.event.loggedIn(e)),e})).catch((function(e){throw salla.auth.event.registrationFailed.call(t,e),e}))}logout(){return this.request("logout").then((function(e){return salla.auth.event.loggedOut(e),salla.log("Reloading after 0.1 sec..."),setTimeout((()=>location.reload()),100),e})).catch((function(e){throw salla.auth.event.failedLogout(e),e}))}refresh(){return this.request("refresh").catch((function(e){throw salla.auth.event.refreshFailed(e),e}))}}class O extends A{constructor(e){super(e),this.namespace="order",this.endpoints={cancel:"orders/cancel/{id}",createCartFromOrder:"reorder/{id}",sendInvoice:"orders/send/{id}"},this.endpointsMethods={createCartFromOrder:"get"},this.after_init()}show(e){let t=this.getPossibleValue(e?.data||e,["id","order_id"]);salla.event.dispatch("mobile::order.placed",{order_id:t}),location.href=this.getPossibleValue(e?.data||e,["url"])}cancel(e){return e=e||salla.config.get("page.id"),this.request(["cancel",e],{params:{has_apple_pay:!!window.ApplePaySession}}).then((function(t){return salla.event.order.canceled(t,e),t})).catch((function(t){throw salla.event.order.notCanceled(t,e),t}))}createCartFromOrder(e){return e=e||salla.config.get("page.id"),this.request(["createCartFromOrder",e]).then((function(t){return salla.storage.set("cart",{id:t.data.cart_id,user_id:salla.config.get("user.id")}),salla.event.order.orderCreated(t,e),window.location.href=t.data.url,t})).catch((function(t){throw salla.event.order.orderCreationFailed(t,e),t}))}sendInvoice(e){let t=this.getPossibleValue(e,["id"])||salla.config.get("page.id");if(!t||isNaN(t)){let e="There is no id!";return salla.order.event.invoiceNotSent(e),this.errorPromise(e)}return this.request(["sendInvoice",t],e).then((e=>(salla.event.order.invoiceSent(e,t),e))).catch((e=>{throw salla.event.order.invoiceNotSent(e,t),e}))}}class k extends A{constructor(e){super(e),this.namespace="product",this.previousQuery="",this.endpoints={getPrice:"products/{id}/price",availabilitySubscribe:"products/{id}/availability-notify",search:"products/search",categories:"products/categories/{?id}",purchaseNow:"checkout/quick-purchase/{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={giftDetail:"get"},this.webEndpoints=["purchaseNow"],this.after_init()}getPrice(e){let t=e.data||e,r=this.getPossibleValue(t,["id","prod_id","product_id"]);return this.request(["getPrice",r],"object"==typeof t?t:void 0).then((function(e){return salla.product.event.priceUpdated(e,r),e})).catch((function(e){throw salla.product.event.priceUpdateFailed(e,r),e}))}categories(e){return this.request(["categories",e||""],null,"get").then((function(e){return salla.product.event.categoriesFetched(e),e})).catch((function(e){throw salla.product.event.categoriesFailed(e),e}))}availabilitySubscribe(e){let t=e.data||e;return e=this.getPossibleValue(t,["id","prod_id"]),this.request(["availabilitySubscribe",e],"object"==typeof t?t:void 0).then((function(t){return salla.product.event.availabilitySubscribed(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribedFailed(t,e),t}))}search(e){let t=e.data;if(t||(t={params:"string"==typeof e?{query:e}:e}),!(e=t instanceof FormData?t.get("query"):t.query||t.params?.query)){let e='There is no "query"!';return salla.product.event.searchFailed(e),this.errorPromise(e)}if(e===salla.api.product.previousQuery){let e="Query is same as previous one!";return salla.product.event.searchFailed(e),salla.api.product.previousQuery=null,this.errorPromise(e)}return salla.api.product.previousQuery=e,this.request("search",t,"get").then((function(t){return salla.product.event.searchResults(t,e),t})).catch((function(t){throw salla.product.event.searchFailed(t,e),t}))}offers(e){if(!(e=this.getPossibleValue(e?.data|e,["product_id","id"]))){let e='There is no "product_id"!';return salla.offer.event.fetchDetailsFailed(e),this.errorPromise(e)}return this.request(["offers",e]).then((function(t){return salla.product.event.offersFetched(t,e),t})).catch((function(t){throw salla.product.event.fetchOffersFailed(t,e),t}))}purchaseNow(e){if(salla.config.isGuest())return salla.auth.event.dispatch("login");let t=e.product_data,r=this.getPossibleValue(t,["id","prod_id"]);if(!e.is_applepay)return this.request(["quickPurchase",r],"object"==typeof t?t:void 0).then((function(e){return e})).catch((function(e){throw e}));salla.event.dispatch("payments::apple-pay.start-transaction",{amount:e.total,currency:e.currency,requiredShippingContactFields:e.require_shipping?["postalAddress"]:null,shippingMethods:e.require_shipping?[]:null,supportedNetworks:e.applepay_supported_networks,validateMerchant:{url:baseUrl+"checkout/applepay/validate",onFailed:({response:e})=>{console.log("validateMerchant Failed!")},onSuccess:e=>(console.log("validateMerchant Success"),this.request(["quickPurchase",r],"object"==typeof t?t:void 0))},authorized:{url:baseUrl+"/checkout/{id}/payments/submit",onFailed:e=>{console.log("authorized Failed!"),window.Salla.Payments.ApplePay.onCancel({},e.data.error.message)},onSuccess:e=>{console.log(e),window.location.href=e.redirect.url,console.log("authorized Success:: redirect to thank you page, order placed")}},shippingMethodSelected:e.require_shipping?{url:baseUrl+"/checkout/{id}/shipping/details",onFailed:e=>{console.log("select shipping method failed!")},onSuccess:e=>{console.log("select shipping method success")}}:null,shippingContactSelected:e.require_shipping?{url:baseUrl+"/checkout/{id}/address/add",onFailed:e=>{console.log("created contact failed!")},onSuccess:e=>{console.log("created contact success : ",e.data.address_id)}}:null,recalculateTotal:{url:baseUrl+"/checkout/{id}/payments/recalculate"},onError:function(e){console.log(e),salla.notify.error(e)}})}getSizeGuides(e){return this.request(`products/${e}/size-guides`,null,"get").then((t=>(salla.product.event.sizeGuideFetched(t,e),t))).catch((t=>{throw salla.product.event.sizeGuideFetchFailed(t,e),t}))}getGiftDetails(e){return this.request(["giftDetail",e]).then((t=>(salla.product.event.giftFetched(t,e),t))).catch((t=>{throw salla.product.event.giftFetchFailed(t,e),t}))}addGiftToCart(e,t,r=!1){return this.request(["giftToCart",e],t).then((t=>(salla.product.event.addGiftToCartSucceeded(t,e),r&&(window.location.href=t.redirect),response))).catch((t=>{throw salla.product.event.addGiftToCartFailed(t,e),t}))}uploadGiftImage(e){return this.request("giftImage",e).then((e=>(salla.product.event.giftImageUploadSucceeded(e),e))).catch((e=>{throw salla.product.event.giftImageUploadFailed(e),e}))}}class T extends A{constructor(e){super(e),this.namespace="profile",this.endpoints={info:"auth/user",update:"profile/update",updateContacts:"profile/contacts/update",verify:"profile/verify"},this.after_init()}info(){return this.request("info",null,"get").then((e=>(salla.profile.event.infoFetched(e),e))).catch((e=>{throw salla.profile.event.infoNotFetched(e),e}))}update(e){return this.request("update",e).then((e=>(salla.profile.event.updated(e),e))).catch((e=>{throw salla.event.profile.updateFailed(e),e}))}updateContacts(e){return this.request("updateContacts",e).then((e=>(salla.profile.event.verificationCodeSent(e),e))).catch((e=>{throw salla.event.profile.updateContactsFailed(e),e}))}verify(e){return this.request("verify",e).then((e=>(salla.profile.event.verified(e),e))).catch((e=>{throw salla.event.profile.unVerified(e),e}))}}class j extends A{constructor(e){super(e),this.namespace="comment",this.endpoints={add:"{type}/{id}/comments"},this.after_init()}add(e){e?.data&&(e=e.data);let t,{id:r,type:n,comment:i}=Object.fromEntries(e);return r?n&&["products","pages","product","page"].includes(n)?i?(n+=["product","page"].includes(n)?"s":"",this.request(["add",n,r],{comment:i}).then((function(e){return salla.event.comment.added(e,r),e})).catch((function(e){throw salla.event.comment.additionFailed(e,r),e}))):(salla.event.comment.additionFailed(t="can't find comment content!"),this.errorPromise(t)):(salla.event.comment.additionFailed(t="Failed to get type one of:(products, product, page, pages)!"),this.errorPromise(t)):(salla.event.comment.additionFailed(t="Failed to get id!"),this.errorPromise(t))}}class C extends A{constructor(e){super(e),this.namespace="currency",this.endpoints={change:"/",list:"currencies"},this.endpointsMethods={change:"get",list:"get"},this.webEndpoints=["change"],this.after_init()}change(e){if(!(e=this.getPossibleValue(e.data||e,["currency","code"]))){let e="Can't find currency code!";return salla.currency.event.failed(e),this.errorPromise(e)}return this.request("change",{params:{change_currency:"",currency:e}}).then((function(t){return salla.cookie.set("fresh_summary",1),salla.storage.set("cart",""),salla.currency.event.changed(t,e),t})).catch((function(t){throw salla.currency.event.failed(t,e),t}))}list(){return this.request("list").then((function(e){return salla.currency.event.fetched(e),e})).catch((function(e){throw salla.currency.event.failedToFetch(e),e}))}}class R extends A{constructor(e){super(e),this.namespace="document"}}class I extends A{constructor(e){super(e),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(e){let t="object"==typeof e?e:{},r=this.getPossibleValue(e?.data||e,["order_id","id"]);if(!r){let e='There is no "order_id"!';return salla.event.rating.orderNotFetched(e),this.errorPromise(e)}return this.request(["order",r],t).then((function(e){return salla.event.rating.orderFetched(e,r),e})).catch((function(e){throw salla.event.rating.orderNotFetched(e,r),e}))}store(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.rating.storeFailed(e),this.errorPromise(e)}return this.request("store",e).then((function(t){return salla.event.rating.storeRated(t,e),t})).catch((function(t){throw salla.event.rating.storeFailed(t,e),t}))}products(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.rating.productsFailed(e),this.errorPromise(e)}return this.request("products",e).then((function(t){return salla.event.rating.productsRated(t,e),t})).catch((function(t){throw salla.event.rating.productsFailed(t,e),t}))}shipping(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.rating.shippingFailed(e),this.errorPromise(e)}return this.request("shipping",e).then((function(t){return salla.event.rating.shippingRated(t,e),t})).catch((function(t){throw salla.event.rating.shippingFailed(t,e),t}))}}class q{constructor(e){salla.config.merge(e),e?(e._token&&(salla.api.defaults.headers.common["X-CSRF-TOKEN"]=e._token),this.injectMaintenanceAlert(),this.injectThemePreviewAlert(),this.injectEditAlert(),e?.user?.language_code&&salla.lang.setLocale(e?.user?.language_code),salla.lang.loadStoreTranslations(),salla.twilight.event.initiated(e)):salla.twilight.event.initiated(e)}injectMaintenanceAlert(){salla.config.get("maintenance")&&(document.querySelector(".store-notify")?salla.logger.warn(".store-notify element Existed before!"):salla.lang.onLoaded((()=>{var e=document.createElement("div");e.classList.add("store-notify"),e.style="background-color: #d63031; color: #fff; padding: 10px 15px; text-align: center; font-size: 17px;",e.innerHTML=`<p style="margin:0 !important;">${salla.lang.get("blocks.header.maintenance_alert")}</p>`,document.body.prepend(e)})))}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 e=document.createElement("div");e.id="s-theme_preview_bar",e.setAttribute("style","display: flex; justify-content: space-between; text-align: center; background-color: #232323; color: #fff; padding: 10px; font-size: 0.875rem; line-height: 1.25rem; position: relative;"),e.innerHTML=`\n <div style="display:flex; align-items:center;">\n <img width="32" src="https://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(e)})))}injectEditAlert(){let e=salla.config.get("edit");e&&(document.querySelector("#s-edit-alert")?salla.logger.warn("#s-edit-alert element Existed before!"):salla.lang.onLoaded((()=>{let t=document.createElement("div");t.id="s-edit-alert",t.innerHTML=`\n <a href="${e}" 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(t)})))}handleElementAjaxRequest(e,t){if(!(t instanceof HTMLFormElement||t instanceof HTMLAnchorElement))return salla.logger.warn("trying to call ajax from non Element!!"),!1;e.preventDefault();let r=t.getAjaxFormData(e),n=r.method?r.method.toLowerCase():void 0;salla.api.document.request(r.url,r.formData,n).then((e=>(e.data&&e.request&&(e=e.data),salla.api.document.handleAfterResponseActions(e),this.callAjaxEvent(r.events.success,e,r.formData),e))).catch((e=>{throw salla.api.document.handleErrorResponse(e),this.callAjaxEvent(r.events.fail,e,r.formData),e}))}callAjaxEvent(e,t,r){if(e){if(r instanceof FormData){var n={};Array.from(r.entries()).forEach((function(e){n[e[0]]=e[1]})),r=n}window[e]?window[e](t,r):salla.event.dispatch(e,t,r)}}}class N extends A{constructor(e){super(e),this.namespace="twilight",this.after_init()}init(e){let t=e?.events;return salla.isInitiated||(delete e.events,new q(e),salla.isInitiated=!0),t&&salla.event.dispatchEvents(t),this.successPromise(e)}api(e){let t=e?.events;return t&&salla.event.dispatchEvents(t),this.successPromise(e)}}class D extends A{constructor(e){super(e),this.namespace="wishlist",this.endpoints={add:"products/favorites/{id}",remove:"products/favorites/{id}"},this.endpointsMethods={remove:"delete"},this.after_init()}toggle(e){return salla.storage.get("salla::wishlist",[]).includes(e)?this.remove(e):this.add(e)}add(e){let t;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(t=salla.lang.get("common.messages.must_login")),salla.error(t),this.errorPromise(t)):(e=this.getPossibleValue(e?.data||e,["product_id","id"]))?this.request(["add",e]).then((t=>(this.updateWishlistStorage(e),salla.wishlist.event.added(t,e),t))).catch((function(t){throw salla.wishlist.event.additionFailed(t,e),t})):(salla.wishlist.event.additionFailed(t="Failed to get product id!"),this.errorPromise(t))}remove(e){let t;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(t=salla.lang.get("common.messages.must_login")),salla.error(t),this.errorPromise(t)):(e=this.getPossibleValue(e?.data||e,["product_id","id"]))?this.request(["remove",e]).then((t=>(this.updateWishlistStorage(e,!1),salla.wishlist.event.removed(t,e),t))).catch((function(t){throw salla.wishlist.event.removingFailed(t,e),t})):(salla.wishlist.event.removingFailed(t="Failed to get id!"),this.errorPromise(t))}updateWishlistStorage(e,t=!0){let r=salla.storage.get("salla::wishlist",[]);t?r.push(e):r.splice(r.indexOf(e),1),salla.storage.set("salla::wishlist",r)}}class U extends A{constructor(e){super(e),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((e=>(salla.scope.event.fetched(e),e))).catch((e=>{throw salla.scope.event.notFetched(e),e}))}change(e){return this.request("scopes",e).then((e=>(salla.scope.event.changeSucceeded(e),e))).catch((e=>{throw salla.scope.event.changeFailed(e),e}))}getProductAvailability(e=null){return this.request(`scopes/availability?product_id=${e}`,null,"get").then((t=>(salla.scope.event.productAvailabilityFetched(t,e),t))).catch((e=>{throw salla.scope.event.productAvailabilityNotFetched(e),resp}))}}var M,$={exports:{}},H={exports:{}},z=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},B=z,G=Object.prototype.toString,V=(M=Object.create(null),function(e){var t=G.call(e);return M[t]||(M[t]=t.slice(8,-1).toLowerCase())});function W(e){return e=e.toLowerCase(),function(t){return V(t)===e}}function J(e){return Array.isArray(e)}function Q(e){return void 0===e}var K=W("ArrayBuffer");function Z(e){return null!==e&&"object"==typeof e}function X(e){if("object"!==V(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var Y=W("Date"),ee=W("File"),te=W("Blob"),re=W("FileList");function ne(e){return"[object Function]"===G.call(e)}var ie=W("URLSearchParams");function se(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),J(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var ae,oe=(ae="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return ae&&e instanceof ae}),le={isArray:J,isArrayBuffer:K,isBuffer:function(e){return null!==e&&!Q(e)&&null!==e.constructor&&!Q(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||G.call(e)===t||ne(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&K(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Z,isPlainObject:X,isUndefined:Q,isDate:Y,isFile:ee,isBlob:te,isFunction:ne,isStream:function(e){return Z(e)&&ne(e.pipe)},isURLSearchParams:ie,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:se,merge:function e(){var t={};function r(r,n){X(t[n])&&X(r)?t[n]=e(t[n],r):X(r)?t[n]=e({},r):J(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)se(arguments[n],r);return t},extend:function(e,t,r){return se(t,(function(t,n){e[n]=r&&"function"==typeof t?B(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r){var n,i,s,a={};t=t||{};do{for(i=(n=Object.getOwnPropertyNames(e)).length;i-- >0;)a[s=n[i]]||(t[s]=e[s],a[s]=!0);e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:V,kindOfTest:W,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;var t=e.length;if(Q(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:oe,isFileList:re},ce=le;function ue(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var he=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(ce.isURLSearchParams(t))n=t.toString();else{var i=[];ce.forEach(t,(function(e,t){null!=e&&(ce.isArray(e)?t+="[]":e=[e],ce.forEach(e,(function(e){ce.isDate(e)?e=e.toISOString():ce.isObject(e)&&(e=JSON.stringify(e)),i.push(ue(t)+"="+ue(e))})))})),n=i.join("&")}if(n){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e},de=le;function fe(){this.handlers=[]}fe.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},fe.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},fe.prototype.forEach=function(e){de.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var pe,ge,me=fe,ve=le;function ye(){if(ge)return pe;ge=1;var e=le;function t(e,t,r,n,i){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}e.inherits(t,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 r=t.prototype,n={};return["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(e){n[e]={value:e}})),Object.defineProperties(t,n),Object.defineProperty(r,"isAxiosError",{value:!0}),t.from=function(n,i,s,a,o,l){var c=Object.create(r);return e.toFlatObject(n,c,(function(e){return e!==Error.prototype})),t.call(c,n.message,i,s,a,o),c.name=n.name,l&&Object.assign(c,l),c},pe=t}var be,we,_e,Ee,Se,xe,Ae={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};function Pe(){if(we)return be;we=1;var e=le;return be=function(t,r){r=r||new FormData;var n=[];function i(t){return null===t?"":e.isDate(t)?t.toISOString():e.isArrayBuffer(t)||e.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(s,a){if(e.isPlainObject(s)||e.isArray(s)){if(-1!==n.indexOf(s))throw Error("Circular reference detected in "+a);n.push(s),e.forEach(s,(function(n,s){if(!e.isUndefined(n)){var o,l=a?a+"."+s:s;if(n&&!a&&"object"==typeof n)if(e.endsWith(s,"{}"))n=JSON.stringify(n);else if(e.endsWith(s,"[]")&&(o=e.toArray(n)))return void o.forEach((function(t){!e.isUndefined(t)&&r.append(l,i(t))}));t(n,l)}})),n.pop()}else r.append(a,i(s))}(t),r},be}function Fe(){if(Ee)return _e;Ee=1;var e=ye();return _e=function(t,r,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?r(new e("Request failed with status code "+n.status,[e.ERR_BAD_REQUEST,e.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}}function Le(){if(xe)return Se;xe=1;var e=le;return Se=e.isStandardBrowserEnv()?{write:function(t,r,n,i,s,a){var o=[];o.push(t+"="+encodeURIComponent(r)),e.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),e.isString(i)&&o.push("path="+i),e.isString(s)&&o.push("domain="+s),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}}var Oe,ke,Te,je,Ce,Re,Ie,qe,Ne,De,Ue,Me,$e=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},He=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},ze=function(e,t){return e&&!$e(t)?He(e,t):t};function Be(){if(ke)return Oe;ke=1;var e=le,t=["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"];return Oe=function(r){var n,i,s,a={};return r?(e.forEach(r.split("\n"),(function(r){if(s=r.indexOf(":"),n=e.trim(r.substr(0,s)).toLowerCase(),i=e.trim(r.substr(s+1)),n){if(a[n]&&t.indexOf(n)>=0)return;a[n]="set-cookie"===n?(a[n]?a[n]:[]).concat([i]):a[n]?a[n]+", "+i:i}})),a):a}}function Ge(){if(je)return Te;je=1;var e=le;return Te=e.isStandardBrowserEnv()?function(){var t,r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var t=e;return r&&(n.setAttribute("href",t),t=n.href),n.setAttribute("href",t),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(r){var n=e.isString(r)?i(r):r;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},Te}function Ve(){if(Re)return Ce;Re=1;var e=ye();function t(t){e.call(this,null==t?"canceled":t,e.ERR_CANCELED),this.name="CanceledError"}return le.inherits(t,e,{__CANCEL__:!0}),Ce=t}function We(){return qe||(qe=1,Ie=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}),Ie}function Je(){if(De)return Ne;De=1;var e=le,t=Fe(),r=Le(),n=he,i=ze,s=Be(),a=Ge(),o=Ae,l=ye(),c=Ve(),u=We();return Ne=function(h){return new Promise((function(d,f){var p,g=h.data,m=h.headers,v=h.responseType;function y(){h.cancelToken&&h.cancelToken.unsubscribe(p),h.signal&&h.signal.removeEventListener("abort",p)}e.isFormData(g)&&e.isStandardBrowserEnv()&&delete m["Content-Type"];var b=new XMLHttpRequest;if(h.auth){var w=h.auth.username||"",_=h.auth.password?unescape(encodeURIComponent(h.auth.password)):"";m.Authorization="Basic "+btoa(w+":"+_)}var E=i(h.baseURL,h.url);function S(){if(b){var e="getAllResponseHeaders"in b?s(b.getAllResponseHeaders()):null,r={data:v&&"text"!==v&&"json"!==v?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:e,config:h,request:b};t((function(e){d(e),y()}),(function(e){f(e),y()}),r),b=null}}if(b.open(h.method.toUpperCase(),n(E,h.params,h.paramsSerializer),!0),b.timeout=h.timeout,"onloadend"in b?b.onloadend=S:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(S)},b.onabort=function(){b&&(f(new l("Request aborted",l.ECONNABORTED,h,b)),b=null)},b.onerror=function(){f(new l("Network Error",l.ERR_NETWORK,h,b,b)),b=null},b.ontimeout=function(){var e=h.timeout?"timeout of "+h.timeout+"ms exceeded":"timeout exceeded",t=h.transitional||o;h.timeoutErrorMessage&&(e=h.timeoutErrorMessage),f(new l(e,t.clarifyTimeoutError?l.ETIMEDOUT:l.ECONNABORTED,h,b)),b=null},e.isStandardBrowserEnv()){var x=(h.withCredentials||a(E))&&h.xsrfCookieName?r.read(h.xsrfCookieName):void 0;x&&(m[h.xsrfHeaderName]=x)}"setRequestHeader"in b&&e.forEach(m,(function(e,t){void 0===g&&"content-type"===t.toLowerCase()?delete m[t]:b.setRequestHeader(t,e)})),e.isUndefined(h.withCredentials)||(b.withCredentials=!!h.withCredentials),v&&"json"!==v&&(b.responseType=h.responseType),"function"==typeof h.onDownloadProgress&&b.addEventListener("progress",h.onDownloadProgress),"function"==typeof h.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",h.onUploadProgress),(h.cancelToken||h.signal)&&(p=function(e){b&&(f(!e||e&&e.type?new c:e),b.abort(),b=null)},h.cancelToken&&h.cancelToken.subscribe(p),h.signal&&(h.signal.aborted?p():h.signal.addEventListener("abort",p))),g||(g=null);var A=u(E);A&&-1===["http","https","file"].indexOf(A)?f(new l("Unsupported protocol "+A+":",l.ERR_BAD_REQUEST,h)):b.send(g)}))},Ne}var Qe=le,Ke=function(e,t){ve.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},Ze=ye(),Xe=Ae,Ye=Pe(),et={"Content-Type":"application/x-www-form-urlencoded"};function tt(e,t){!Qe.isUndefined(e)&&Qe.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var rt,nt={transitional:Xe,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(rt=Je()),rt),transformRequest:[function(e,t){if(Ke(t,"Accept"),Ke(t,"Content-Type"),Qe.isFormData(e)||Qe.isArrayBuffer(e)||Qe.isBuffer(e)||Qe.isStream(e)||Qe.isFile(e)||Qe.isBlob(e))return e;if(Qe.isArrayBufferView(e))return e.buffer;if(Qe.isURLSearchParams(e))return tt(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var r,n=Qe.isObject(e),i=t&&t["Content-Type"];if((r=Qe.isFileList(e))||n&&"multipart/form-data"===i){var s=this.env&&this.env.FormData;return Ye(r?{"files[]":e}:e,s&&new s)}return n||"application/json"===i?(tt(t,"application/json"),function(e,t,r){if(Qe.isString(e))try{return(t||JSON.parse)(e),Qe.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||nt.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&Qe.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Ze.from(e,Ze.ERR_BAD_RESPONSE,this,null,this.response);throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Me?Ue:(Me=1,Ue=null)},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Qe.forEach(["delete","get","head"],(function(e){nt.headers[e]={}})),Qe.forEach(["post","put","patch"],(function(e){nt.headers[e]=Qe.merge(et)}));var it,st,at=nt,ot=le,lt=at;function ct(){return st?it:(st=1,it=function(e){return!(!e||!e.__CANCEL__)})}var ut=le,ht=function(e,t,r){var n=this||lt;return ot.forEach(r,(function(r){e=r.call(n,e,t)})),e},dt=ct(),ft=at,pt=Ve();function gt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pt}var mt,vt,yt=le,bt=function(e,t){t=t||{};var r={};function n(e,t){return yt.isPlainObject(e)&&yt.isPlainObject(t)?yt.merge(e,t):yt.isPlainObject(t)?yt.merge({},t):yt.isArray(t)?t.slice():t}function i(r){return yt.isUndefined(t[r])?yt.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function s(e){if(!yt.isUndefined(t[e]))return n(void 0,t[e])}function a(r){return yt.isUndefined(t[r])?yt.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function o(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):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 yt.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=l[e]||i,n=t(e);yt.isUndefined(n)&&t!==o||(r[e]=n)})),r};function wt(){return vt?mt:(vt=1,mt={version:"0.27.2"})}var _t=wt().version,Et=ye(),St={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){St[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var xt={};St.transitional=function(e,t,r){function n(e,t){return"[Axios v"+_t+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,s){if(!1===e)throw new Et(n(i," has been removed"+(t?" in "+t:"")),Et.ERR_DEPRECATED);return t&&!xt[i]&&(xt[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,s)}};var At,Pt,Ft,Lt,Ot,kt,Tt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Et("options must be an object",Et.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),i=n.length;i-- >0;){var s=n[i],a=t[s];if(a){var o=e[s],l=void 0===o||a(o,s,e);if(!0!==l)throw new Et("option "+s+" must be "+l,Et.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Et("Unknown option "+s,Et.ERR_BAD_OPTION)}},validators:St},jt=le,Ct=he,Rt=me,It=function(e){return gt(e),e.headers=e.headers||{},e.data=ht.call(e,e.data,e.headers,e.transformRequest),e.headers=ut.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ut.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||ft.adapter)(e).then((function(t){return gt(e),t.data=ht.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return dt(t)||(gt(e),t&&t.response&&(t.response.data=ht.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},qt=bt,Nt=ze,Dt=Tt,Ut=Dt.validators;function Mt(e){this.defaults=e,this.interceptors={request:new Rt,response:new Rt}}Mt.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=qt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&Dt.assertOptions(r,{silentJSONParsing:Ut.transitional(Ut.boolean),forcedJSONParsing:Ut.transitional(Ut.boolean),clarifyTimeoutError:Ut.transitional(Ut.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var s,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!i){var o=[It,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(a),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var l=t;n.length;){var c=n.shift(),u=n.shift();try{l=c(l)}catch(e){u(e);break}}try{s=It(l)}catch(e){return Promise.reject(e)}for(;a.length;)s=s.then(a.shift(),a.shift());return s},Mt.prototype.getUri=function(e){e=qt(this.defaults,e);var t=Nt(e.baseURL,e.url);return Ct(t,e.params,e.paramsSerializer)},jt.forEach(["delete","get","head","options"],(function(e){Mt.prototype[e]=function(t,r){return this.request(qt(r||{},{method:e,url:t,data:(r||{}).data}))}})),jt.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(qt(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Mt.prototype[e]=t(),Mt.prototype[e+"Form"]=t(!0)}));var $t=le,Ht=z,zt=Mt,Bt=bt;var Gt=function e(t){var r=new zt(t),n=Ht(zt.prototype.request,r);return $t.extend(n,zt.prototype,r),$t.extend(n,r),n.create=function(r){return e(Bt(t,r))},n}(at);Gt.Axios=zt,Gt.CanceledError=Ve(),Gt.CancelToken=function(){if(Pt)return At;Pt=1;var e=Ve();function t(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var r;this.promise=new Promise((function(e){r=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(t){n.reason||(n.reason=new e(t),r(n.reason))}))}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},t.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},t.source=function(){var e;return{token:new t((function(t){e=t})),cancel:e}},At=t}(),Gt.isCancel=ct(),Gt.VERSION=wt().version,Gt.toFormData=Pe(),Gt.AxiosError=ye(),Gt.Cancel=Gt.CanceledError,Gt.all=function(e){return Promise.all(e)},Gt.spread=Lt?Ft:(Lt=1,Ft=function(e){return function(t){return e.apply(null,t)}}),Gt.isAxiosError=function(){if(kt)return Ot;kt=1;var e=le;return Ot=function(t){return e.isObject(t)&&!0===t.isAxiosError}}(),H.exports=Gt,H.exports.default=Gt,function(e){e.exports=H.exports}($);var Vt=_($.exports);function Wt(e){this.message=e}Wt.prototype=new Error,Wt.prototype.name="InvalidCharacterError";var Jt="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Wt("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,s=0,a="";n=t.charAt(s++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};function Qt(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Jt(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return Jt(t)}}function Kt(e){this.message=e}Kt.prototype=new Error,Kt.prototype.name="InvalidTokenError";class Zt{constructor(e,t){return this.api=e,this.event=t,new Proxy(this,{get:function(r,n){return"event"===n?t:"api"===n&&"twilight"!==e?.namespace?e:e&&e[n]||r[n]}})}}var Xt,Yt={exports:{}},er={exports:{}},tr={exports:{}};function rr(){return Xt||(Xt=1,function(e){!function(t,r){e.exports?e.exports=r():t.EvEmitter=r()}("undefined"!=typeof window?window:w,(function(){function e(){}let t=e.prototype;return t.on=function(e,t){if(!e||!t)return this;let r=this._events=this._events||{},n=r[e]=r[e]||[];return n.includes(t)||n.push(t),this},t.once=function(e,t){if(!e||!t)return this;this.on(e,t);let r=this._onceEvents=this._onceEvents||{};return(r[e]=r[e]||{})[t]=!0,this},t.off=function(e,t){let r=this._events&&this._events[e];if(!r||!r.length)return this;let n=r.indexOf(t);return-1!=n&&r.splice(n,1),this},t.emitEvent=function(e,t){let r=this._events&&this._events[e];if(!r||!r.length)return this;r=r.slice(0),t=t||[];let n=this._onceEvents&&this._onceEvents[e];for(let i of r){n&&n[i]&&(this.off(e,i),delete n[i]),i.apply(this,t)}return this},t.allOff=function(){return delete this._events,delete this._onceEvents,this},e}))}(tr)),tr.exports}var nr,ir,sr={exports:{}};function ar(){return nr||(nr=1,function(e){!function(t,r){e.exports?e.exports=r(t):t.fizzyUIUtils=r(t)}(w,(function(e){let t={extend:function(e,t){return Object.assign(e,t)},modulo:function(e,t){return(e%t+t)%t},makeArray:function(e){if(Array.isArray(e))return e;if(null==e)return[];return"object"==typeof e&&"number"==typeof e.length?[...e]:[e]},removeFrom:function(e,t){let r=e.indexOf(t);-1!=r&&e.splice(r,1)},getParent:function(e,t){for(;e.parentNode&&e!=document.body;)if((e=e.parentNode).matches(t))return e},getQueryElement:function(e){return"string"==typeof e?document.querySelector(e):e},handleEvent:function(e){let t="on"+e.type;this[t]&&this[t](e)},filterFindElements:function(e,r){return(e=t.makeArray(e)).filter((e=>e instanceof HTMLElement)).reduce(((e,t)=>{if(!r)return e.push(t),e;t.matches(r)&&e.push(t);let n=t.querySelectorAll(r);return e=e.concat(...n)}),[])},debounceMethod:function(e,t,r){r=r||100;let n=e.prototype[t],i=t+"Timeout";e.prototype[t]=function(){clearTimeout(this[i]);let e=arguments;this[i]=setTimeout((()=>{n.apply(this,e),delete this[i]}),r)}},docReady:function(e){let t=document.readyState;"complete"==t||"interactive"==t?setTimeout(e):document.addEventListener("DOMContentLoaded",e)},toDashed:function(e){return e.replace(/(.)([A-Z])/g,(function(e,t,r){return t+"-"+r})).toLowerCase()}},r=e.console;return t.htmlInit=function(n,i){t.docReady((function(){let s="data-"+t.toDashed(i),a=document.querySelectorAll(`[${s}]`),o=e.jQuery;[...a].forEach((e=>{let t,a=e.getAttribute(s);try{t=a&&JSON.parse(a)}catch(t){return void(r&&r.error(`Error parsing ${s} on ${e.className}: ${t}`))}let l=new n(e,t);o&&o.data(e,i,l)}))}))},t}))}(sr)),sr.exports}function or(){return ir||(ir=1,function(e){!function(t,r){e.exports?e.exports=r(t,rr(),ar()):t.InfiniteScroll=r(t,t.EvEmitter,t.fizzyUIUtils)}(window,(function(e,t,r){let n=e.jQuery,i={};function s(e,t){let a=r.getQueryElement(e);if(a){if((e=a).infiniteScrollGUID){let r=i[e.infiniteScrollGUID];return r.option(t),r}this.element=e,this.options={...s.defaults},this.option(t),n&&(this.$element=n(this.element)),this.create()}else console.error("Bad element for InfiniteScroll: "+(a||e))}s.defaults={},s.create={},s.destroy={};let a=s.prototype;Object.assign(a,t.prototype);let o=0;a.create=function(){let e=this.guid=++o;if(this.element.infiniteScrollGUID=e,i[e]=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 e in s.create)s.create[e].call(this)}else console.error("Disabling InfiniteScroll")},a.option=function(e){Object.assign(this.options,e)},a.callOnInit=function(){let e=this.options.onInit;e&&e.call(this,this)},a.dispatchEvent=function(e,t,r){this.log(e,r);let i=t?[t].concat(r):r;if(this.emitEvent(e,i),!n||!this.$element)return;let s=e+=".infiniteScroll";if(t){let r=n.Event(t);r.type=e,s=r}this.$element.trigger(s,r)};let l={initialized:e=>`on ${e}`,request:e=>`URL: ${e}`,load:(e,t)=>`${e.title||""}. URL: ${t}`,error:(e,t)=>`${e}. URL: ${t}`,append:(e,t,r)=>`${r.length} items. URL: ${t}`,last:(e,t)=>`URL: ${t}`,history:(e,t)=>`URL: ${t}`,pageIndex:function(e,t){return`current page determined to be: ${e} from ${t}`}};a.log=function(e,t){if(!this.options.debug)return;let r=`[InfiniteScroll] ${e}`,n=l[e];n&&(r+=". "+n.apply(this,t)),console.log(r)},a.updateMeasurements=function(){this.windowHeight=e.innerHeight;let t=this.element.getBoundingClientRect();this.top=t.top+e.scrollY},a.updateScroller=function(){let t=this.options.elementScroll;if(t){if(this.scroller=!0===t?this.element:r.getQueryElement(t),!this.scroller)throw new Error(`Unable to find elementScroll: ${t}`)}else this.scroller=e},a.updateGetPath=function(){let e=this.options.path;if(!e)return void console.error(`InfiniteScroll path option required. Set as: ${e}`);let t=typeof e;"function"!=t?"string"==t&&e.match("{{#}}")?this.updateGetPathTemplate(e):this.updateGetPathSelector(e):this.getPath=e},a.updateGetPathTemplate=function(e){this.getPath=()=>{let t=this.pageIndex+1;return e.replace("{{#}}",t)};let t=e.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)"),r=new RegExp(t),n=location.href.match(r);n&&(this.pageIndex=parseInt(n[1],10),this.log("pageIndex",[this.pageIndex,"template string"]))};let c=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/],u=s.getPathParts=function(e){if(e)for(let t of c){let r=e.match(t);if(r){let[,e,t,n]=r;return{begin:e,index:t,end:n}}}};a.updateGetPathSelector=function(e){let t=document.querySelector(e);if(!t)return void console.error(`Bad InfiniteScroll path option. Next link not found: ${e}`);let r=t.getAttribute("href"),n=u(r);if(!n)return void console.error(`InfiniteScroll unable to parse next link href: ${r}`);let{begin:i,index:s,end:a}=n;this.isPathSelector=!0,this.getPath=()=>i+(this.pageIndex+1)+a,this.pageIndex=parseInt(s,10)-1,this.log("pageIndex",[this.pageIndex,"next link"])},a.updateGetAbsolutePath=function(){let e=this.getPath();if(e.match(/^http/)||e.match(/^\//))return void(this.getAbsolutePath=this.getPath);let{pathname:t}=location,r=e.match(/^\?/),n=t.substring(0,t.lastIndexOf("/")),i=r?t:n+"/";this.getAbsolutePath=()=>i+this.getPath()},s.create.hideNav=function(){let e=r.getQueryElement(this.options.hideNav);e&&(e.style.display="none",this.nav=e)},s.destroy.hideNav=function(){this.nav&&(this.nav.style.display="")},a.destroy=function(){this.allOff();for(let e in s.destroy)s.destroy[e].call(this);delete this.element.infiniteScrollGUID,delete i[this.guid],n&&this.$element&&n.removeData(this.element,"infiniteScroll")},s.throttle=function(e,t){let r,n;return t=t||200,function(){let i=+new Date,s=arguments,a=()=>{r=i,e.apply(this,s)};r&&i<r+t?(clearTimeout(n),n=setTimeout(a,t)):a()}},s.data=function(e){let t=(e=r.getQueryElement(e))&&e.infiniteScrollGUID;return t&&i[t]},s.setJQuery=function(e){n=e},r.htmlInit(s,"infinite-scroll"),a._init=function(){};let{jQueryBridget:h}=e;return n&&h&&h("infiniteScroll",s,n),s}))}(er)),er.exports}var lr,cr={exports:{}};function ur(){return lr||(lr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or()):r(t,t.InfiniteScroll)}(window,(function(e,t){let r=t.prototype;Object.assign(t.defaults,{loadOnScroll:!0,checkLastPage:!0,responseBody:"text",domParseResponse:!0}),t.create.pageLoad=function(){this.canLoad=!0,this.on("scrollThreshold",this.onScrollThresholdLoad),this.on("load",this.checkLastPage),this.options.outlayer&&this.on("append",this.onAppendOutlayer)},r.onScrollThresholdLoad=function(){this.options.loadOnScroll&&this.loadNextPage()};let n=new DOMParser;function i(e){let t=document.createDocumentFragment();return e&&t.append(...e),t}return r.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:e,domParseResponse:t,fetchOptions:r}=this.options,i=this.getAbsolutePath();this.isLoading=!0,"function"==typeof r&&(r=r());let s=fetch(i,r).then((r=>{if(!r.ok){let e=new Error(r.statusText);return this.onPageError(e,i,r),{response:r}}return r[e]().then((s=>("text"==e&&t&&(s=n.parseFromString(s,"text/html")),204==r.status?(this.lastPageReached(s,i),{body:s,response:r}):this.onPageLoad(s,i,r))))})).catch((e=>{this.onPageError(e,i)}));return this.dispatchEvent("request",null,[i,s]),s},r.onPageLoad=function(e,t,r){return this.options.append||(this.isLoading=!1),this.pageIndex++,this.loadCount++,this.dispatchEvent("load",null,[e,t,r]),this.appendNextPage(e,t,r)},r.appendNextPage=function(e,t,r){let{append:n,responseBody:s,domParseResponse:a}=this.options;if(!("text"==s&&a)||!n)return{body:e,response:r};let o=e.querySelectorAll(n),l={body:e,response:r,items:o};if(!o||!o.length)return this.lastPageReached(e,t),l;let c=i(o),u=()=>(this.appendItems(o,c),this.isLoading=!1,this.dispatchEvent("append",null,[e,t,o,r]),l);return this.options.outlayer?this.appendOutlayerItems(c,u):u()},r.appendItems=function(e,t){e&&e.length&&(function(e){let t=e.querySelectorAll("script");for(let e of t){let t=document.createElement("script"),r=e.attributes;for(let e of r)t.setAttribute(e.name,e.value);t.innerHTML=e.innerHTML,e.parentNode.replaceChild(t,e)}}(t=t||i(e)),this.element.appendChild(t))},r.appendOutlayerItems=function(r,n){let i=t.imagesLoaded||e.imagesLoaded;return i?new Promise((function(e){i(r,(function(){let t=n();e(t)}))})):(console.error("[InfiniteScroll] imagesLoaded required for outlayer option"),void(this.isLoading=!1))},r.onAppendOutlayer=function(e,t,r){this.options.outlayer.appended(r)},r.checkLastPage=function(e,t){let r,{checkLastPage:n,path:i}=this.options;if(n){if("function"==typeof i){if(!this.getPath())return void this.lastPageReached(e,t)}"string"==typeof n?r=n:this.isPathSelector&&(r=i),r&&e.querySelector&&(e.querySelector(r)||this.lastPageReached(e,t))}},r.lastPageReached=function(e,t){this.canLoad=!1,this.dispatchEvent("last",null,[e,t])},r.onPageError=function(e,t,r){return this.isLoading=!1,this.canLoad=!1,this.dispatchEvent("error",null,[e,t,r]),e},t.create.prefill=function(){if(!this.options.prefill)return;let e=this.options.append;e?(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 :${e}`)},r.prefill=function(){let e=this.getPrefillDistance();this.isPrefilling=e>=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},r.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},r.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},t}))}(cr)),cr.exports}var hr,dr={exports:{}};function fr(){return hr||(hr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or(),ar()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;return Object.assign(t.defaults,{scrollThreshold:400}),t.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);let e=this.options.scrollThreshold;(e||0===e)&&this.enableScrollWatch()},t.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(t){let r=t?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.pageScrollHandler),e[r]("resize",this.resizeHandler)},n.onPageScroll=t.throttle((function(){this.getBottomDistance()<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")})),n.getBottomDistance=function(){let t,r;return this.options.elementScroll?(t=this.scroller.scrollHeight,r=this.scroller.scrollTop+this.scroller.clientHeight):(t=this.top+this.element.clientHeight,r=e.scrollY+this.windowHeight),t-r},n.onResize=function(){this.updateMeasurements()},r.debounceMethod(t,"onResize",150),t}))}(dr)),dr.exports}var pr,gr={exports:{}};function mr(){return pr||(pr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or(),ar()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;Object.assign(t.defaults,{history:"replace"});let i=document.createElement("a");return t.create.history=function(){if(!this.options.history)return;i.href=this.getAbsolutePath(),(i.origin||i.protocol+"//"+i.host)==location.origin?this.options.append?this.createHistoryAppend():this.createHistoryPageLoad():console.error(`[InfiniteScroll] cannot set history with different origin: ${i.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(t){let r=t?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.scrollHistoryHandler),e[r]("unload",this.unloadHandler)},n.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},t.destroy.history=n.destroyHistory=function(){this.options.history&&this.options.append&&this.bindHistoryAppendEvents(!1)},n.onAppendHistory=function(e,t,r){if(!r||!r.length)return;let n=r[0],s=this.getElementScrollY(n);i.href=t,this.scrollPages.push({top:s,path:i.href,title:e.title})},n.getElementScrollY=function(t){if(this.options.elementScroll)return t.offsetTop-this.top;return t.getBoundingClientRect().top+e.scrollY},n.onScrollHistory=function(){let e=this.getClosestScrollPage();e!=this.scrollPage&&(this.scrollPage=e,this.setHistory(e.title,e.path))},r.debounceMethod(t,"onScrollHistory",150),n.getClosestScrollPage=function(){let t,r;t=this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:e.scrollY+this.windowHeight/2;for(let e of this.scrollPages){if(e.top>=t)break;r=e}return r},n.setHistory=function(e,t){let r=this.options.history;r&&history[r+"State"]&&(history[r+"State"](null,e,t),this.options.historyTitle&&(document.title=e),this.dispatchEvent("history",null,[e,t]))},n.onUnload=function(){if(0===this.scrollPage.top)return;let t=e.scrollY-this.scrollPage.top+this.top;this.destroyHistory(),scrollTo(0,t)},n.onPageLoadHistory=function(e,t){this.setHistory(e.title,t)},t}))}(gr)),gr.exports}var vr,yr={exports:{}};function br(){return vr||(vr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or(),ar()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){class n{constructor(e,t){this.element=e,this.infScroll=t,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),t.on("request",this.disable.bind(this)),t.on("load",this.enable.bind(this)),t.on("error",this.hide.bind(this)),t.on("last",this.hide.bind(this))}onClick(e){e.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 t.create.button=function(){let e=r.getQueryElement(this.options.button);e&&(this.button=new n(e,this))},t.destroy.button=function(){this.button&&this.button.destroy()},t.Button=n,t}))}(yr)),yr.exports}var wr,_r={exports:{}};function Er(){return wr||(wr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or(),ar()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;function i(e){a(e,"none")}function s(e){a(e,"block")}function a(e,t){e&&(e.style.display=t)}return t.create.status=function(){let e=r.getQueryElement(this.options.status);e&&(this.statusElement=e,this.statusEventElements={request:e.querySelector(".infinite-scroll-request"),error:e.querySelector(".infinite-scroll-error"),last:e.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},n.bindHideStatus=function(e){let t=this.options.append?"append":"load";this[e](t,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(e){s(this.statusElement),this.hideStatusEventElements(),s(this.statusEventElements[e])},n.hideAllStatus=function(){i(this.statusElement),this.hideStatusEventElements()},n.hideStatusEventElements=function(){for(let e in this.statusEventElements){i(this.statusEventElements[e])}},t}))}(_r)),_r.exports}
|
|
8
|
+
*/!function(e,t){!function(t){var r=Object.hasOwnProperty,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i="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(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function c(){this._events={},this._conf&&u.call(this,this._conf)}function u(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==t&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function h(e,t){var r="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(r+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var n=new Error(r);n.name="MaxListenersExceededWarning",n.emitter=this,n.count=e,process.emitWarning(n)}else console.error(r),console.trace&&console.trace()}var d=function(e,t,r){var n=arguments.length;switch(n){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,r];default:for(var i=new Array(n);n--;)i[n]=arguments[n];return i}};function f(e,r){for(var n={},i=e.length,s=r?r.length:0,a=0;a<i;a++)n[e[a]]=a<s?r[a]:t;return n}function p(e,t,r){var n,i;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(r.on||r.off)&&(n=r.on,i=r.off),t.addEventListener?(n=t.addEventListener,i=t.removeEventListener):t.addListener?(n=t.addListener,i=t.removeListener):t.on&&(n=t.on,i=t.off),!n&&!i)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 i)throw TypeError("off method must be a function");this._on=n,this._off=i;var s=e._observers;s?s.push(this):e._observers=[this]}function g(e,n,i,s){var a=Object.assign({},n);if(!e)return a;if("object"!=typeof e)throw TypeError("options must be an object");var o,l,c,u=Object.keys(e),h=u.length;function d(e){throw Error('Invalid "'+o+'" option value'+(e?". Reason: "+e:""))}for(var f=0;f<h;f++){if(o=u[f],!s&&!r.call(n,o))throw Error('Unknown "'+o+'" option');(l=e[o])!==t&&(c=i[o],a[o]=c?c(l,d):l)}return a}function m(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function v(e){var t="value must be type of "+e.join("|"),r=e.length,n=e[0],i=e[1];return 1===r?function(e,r){if(typeof e===n)return e;r(t)}:2===r?function(e,r){var s=typeof e;if(s===n||s===i)return e;r(t)}:function(n,i){for(var s=typeof n,a=r;a-- >0;)if(s===e[a])return n;i(t)}}Object.assign(p.prototype,{subscribe:function(e,t,r){var n=this,i=this._target,s=this._emitter,a=this._listeners,o=function(){var n=d.apply(null,arguments),a={data:n,name:t,original:e};if(r){var o=r.call(i,a);!1!==o&&s.emit.apply(s,[a.name].concat(n))}else s.emit.apply(s,[t].concat(n))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,s._newListener&&s._removeListener&&!n._onNewListener?(this._onNewListener=function(r){r===t&&null===a[e]&&(a[e]=o,n._on.call(i,e,o))},s.on("newListener",this._onNewListener),this._onRemoveListener=function(r){r===t&&!s.hasListeners(r)&&a[e]&&(a[e]=null,n._off.call(i,e,o))},a[e]=null,s.on("removeListener",this._onRemoveListener)):(a[e]=o,n._on.call(i,e,o))},unsubscribe:function(e){var t,r,n,i=this,s=this._listeners,a=this._emitter,o=this._off,c=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function u(){i._onNewListener&&(a.off("newListener",i._onNewListener),a.off("removeListener",i._onRemoveListener),i._onNewListener=null,i._onRemoveListener=null);var e=_.call(a,i);a._observers.splice(e,1)}if(e){if(!(t=s[e]))return;o.call(c,e,t),delete s[e],--this._listenersCount||u()}else{for(n=(r=l(s)).length;n-- >0;)e=r[n],o.call(c,e,s[e]);this._listeners={},this._listenersCount=0,u()}}});var y=v(["function"]),b=v(["object","function"]);function w(e,t,r){var n,i,s,a=0,o=new e((function(l,c,u){function h(){i&&(i=null),a&&(clearTimeout(a),a=0)}r=g(r,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),n=!r.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var d=function(e){h(),l(e)},f=function(e){h(),c(e)};n?t(d,f,u):(i=[function(e){f(e||Error("canceled"))}],t(d,f,(function(e){if(s)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");i.push(e)})),s=!0),r.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,o.cancel(e),c(e)}),r.timeout))}));return n||(o.cancel=function(e){if(i){for(var t=i.length,r=1;r<t;r++)i[r](e);i[0](e),i=null}}),o}function _(e){var t=this._observers;if(!t)return-1;for(var r=t.length,n=0;n<r;n++)if(t[n]._target===e)return n;return-1}function E(e,t,r,n,i){if(!r)return null;if(0===n){var s=typeof t;if("string"===s){var a,o,c=0,u=0,h=this.delimiter,d=h.length;if(-1!==(o=t.indexOf(h))){a=new Array(5);do{a[c++]=t.slice(u,o),u=o+d}while(-1!==(o=t.indexOf(h,u)));a[c++]=t.slice(u),t=a,i=c}else t=[t],i=1}else"object"===s?i=t.length:(t=[t],i=1)}var f,p,g,m,v,y,b,w=null,_=t[n],S=t[n+1];if(n===i)r._listeners&&("function"==typeof r._listeners?(e&&e.push(r._listeners),w=[r]):(e&&e.push.apply(e,r._listeners),w=[r]));else{if("*"===_){for(o=(y=l(r)).length;o-- >0;)"_listeners"!==(f=y[o])&&(b=E(e,t,r[f],n+1,i))&&(w?w.push.apply(w,b):w=b);return w}if("**"===_){for((v=n+1===i||n+2===i&&"*"===S)&&r._listeners&&(w=E(e,t,r,i,i)),o=(y=l(r)).length;o-- >0;)"_listeners"!==(f=y[o])&&("*"===f||"**"===f?(r[f]._listeners&&!v&&(b=E(e,t,r[f],i,i))&&(w?w.push.apply(w,b):w=b),b=E(e,t,r[f],n,i)):b=E(e,t,r[f],f===S?n+2:n,i),b&&(w?w.push.apply(w,b):w=b));return w}r[_]&&(w=E(e,t,r[_],n+1,i))}if((p=r["*"])&&E(e,t,p,n+1,i),g=r["**"])if(n<i)for(g._listeners&&E(e,t,g,i,i),o=(y=l(g)).length;o-- >0;)"_listeners"!==(f=y[o])&&(f===S?E(e,t,g[f],n+2,i):f===_?E(e,t,g[f],n+1,i):((m={})[f]=g[f],E(e,t,{"**":m},n+1,i)));else g._listeners?E(e,t,g,i,i):g["*"]&&g["*"]._listeners&&E(e,t,g["*"],i,i);return w}function S(e,t,r){var n,i,s=0,a=0,o=this.delimiter,l=o.length;if("string"==typeof e)if(-1!==(n=e.indexOf(o))){i=new Array(5);do{i[s++]=e.slice(a,n),a=n+l}while(-1!==(n=e.indexOf(o,a)));i[s++]=e.slice(a)}else i=[e],s=1;else i=e,s=e.length;if(s>1)for(n=0;n+1<s;n++)if("**"===i[n]&&"**"===i[n+1])return;var c,u=this.listenerTree;for(n=0;n<s;n++)if(u=u[c=i[n]]||(u[c]={}),n===s-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),r?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,h.call(this,u._listeners.length,c))):u._listeners=t,!0;return!0}function x(e,t,r,n){for(var i,s,a,o,c=l(e),u=c.length,h=e._listeners;u-- >0;)i=e[s=c[u]],a="_listeners"===s?r:r?r.concat(s):[s],o=n||"symbol"==typeof s,h&&t.push(o?a:a.join(this.delimiter)),"object"==typeof i&&x.call(this,i,t,a,o);return t}function A(e){for(var t,r,n,i=l(e),s=i.length;s-- >0;)(t=e[r=i[s]])&&(n=!0,"_listeners"===r||A(t)||delete e[r]);return n}function P(e,t,r){this.emitter=e,this.event=t,this.listener=r}function F(e,r,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,c=n.objectify}if(s||l||a){var u=r,h=r._origin||r;if(l&&!i)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===r.constructor.name),r=function(){var e=arguments,t=this,r=this.event;return a?l?Promise.resolve():new Promise((function(e){o(e)})).then((function(){return t.event=r,u.apply(t,e)})):(l?process.nextTick:o)((function(){t.event=r,u.apply(t,e)}))},r._async=!0,r._origin=h}return[r,c?new P(this,e,r):this]}function L(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,u.call(this,e)}P.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},L.EventEmitter2=L,L.prototype.listenTo=function(e,r,i){if("object"!=typeof e)throw TypeError("target musts be an object");var s=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var r,n=i.reducers,a=_.call(s,e);r=-1===a?new p(s,e,i):s._observers[a];for(var o,c=l(t),u=c.length,h="function"==typeof n,d=0;d<u;d++)o=c[d],r.subscribe(o,t[o]||o,h?n:n&&n[o])}return i=g(i,{on:t,off:t,reducers:t},{on:y,off:y,reducers:b}),n(r)?a(f(r)):a("string"==typeof r?f(r.split(/\s+/)):r),this},L.prototype.stopListeningTo=function(e,t){var r=this._observers;if(!r)return!1;var n,i=r.length,s=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;i-- >0;)n=r[i],e&&n._target!==e||(n.unsubscribe(t),s=!0);return s},L.prototype.delimiter=".",L.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},L.prototype.getMaxListeners=function(){return this._maxListeners},L.prototype.event="",L.prototype.once=function(e,t,r){return this._once(e,t,!1,r)},L.prototype.prependOnceListener=function(e,t,r){return this._once(e,t,!0,r)},L.prototype._once=function(e,t,r,n){return this._many(e,1,t,r,n)},L.prototype.many=function(e,t,r,n){return this._many(e,t,r,!1,n)},L.prototype.prependMany=function(e,t,r,n){return this._many(e,t,r,!0,n)},L.prototype._many=function(e,t,r,n,i){var s=this;if("function"!=typeof r)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&s.off(e,a),r.apply(this,arguments)}return a._origin=r,this._on(e,a,n,i)},L.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var e,t,r,n,i,a,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(l&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,s)for(n=0;n<r;n++)if("symbol"==typeof o[n]){a=!0;break}a||(o=o.join(this.delimiter))}var u,h=arguments.length;if(this._all&&this._all.length)for(n=0,r=(u=this._all.slice()).length;n<r;n++)switch(this.event=o,h){case 1:u[n].call(this,o);break;case 2:u[n].call(this,o,arguments[1]);break;case 3:u[n].call(this,o,arguments[1],arguments[2]);break;default:u[n].apply(this,arguments)}if(l)u=[],E.call(this,u,e,this.listenerTree,0,r);else{if("function"==typeof(u=this._events[o])){switch(this.event=o,h){case 1:u.call(this);break;case 2:u.call(this,arguments[1]);break;case 3:u.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(h-1),i=1;i<h;i++)t[i-1]=arguments[i];u.apply(this,t)}return!0}u&&(u=u.slice())}if(u&&u.length){if(h>3)for(t=new Array(h-1),i=1;i<h;i++)t[i-1]=arguments[i];for(n=0,r=u.length;n<r;n++)switch(this.event=o,h){case 1:u[n].call(this);break;case 2:u[n].call(this,arguments[1]);break;case 3:u[n].call(this,arguments[1],arguments[2]);break;default:u[n].apply(this,t)}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},L.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||c.call(this);var e,t,r,n,i,a,o=arguments[0],l=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(l&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,s)for(i=0;i<n;i++)if("symbol"==typeof o[i]){t=!0;break}t||(o=o.join(this.delimiter))}var u,h=[],d=arguments.length;if(this._all)for(i=0,n=this._all.length;i<n;i++)switch(this.event=o,d){case 1:h.push(this._all[i].call(this,o));break;case 2:h.push(this._all[i].call(this,o,arguments[1]));break;case 3:h.push(this._all[i].call(this,o,arguments[1],arguments[2]));break;default:h.push(this._all[i].apply(this,arguments))}if(l?(u=[],E.call(this,u,e,this.listenerTree,0)):u=this._events[o],"function"==typeof u)switch(this.event=o,d){case 1:h.push(u.call(this));break;case 2:h.push(u.call(this,arguments[1]));break;case 3:h.push(u.call(this,arguments[1],arguments[2]));break;default:for(r=new Array(d-1),a=1;a<d;a++)r[a-1]=arguments[a];h.push(u.apply(this,r))}else if(u&&u.length){if(u=u.slice(),d>3)for(r=new Array(d-1),a=1;a<d;a++)r[a-1]=arguments[a];for(i=0,n=u.length;i<n;i++)switch(this.event=o,d){case 1:h.push(u[i].call(this));break;case 2:h.push(u[i].call(this,arguments[1]));break;case 3:h.push(u[i].call(this,arguments[1],arguments[2]));break;default:h.push(u[i].apply(this,r))}}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)},L.prototype.on=function(e,t,r){return this._on(e,t,!1,r)},L.prototype.prependListener=function(e,t,r){return this._on(e,t,!0,r)},L.prototype.onAny=function(e){return this._onAny(e,!1)},L.prototype.prependAny=function(e){return this._onAny(e,!0)},L.prototype.addListener=L.prototype.on,L.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},L.prototype._on=function(e,r,n,i){if("function"==typeof e)return this._onAny(e,r),this;if("function"!=typeof r)throw new Error("on only accepts instances of Function");this._events||c.call(this);var s,a=this;return i!==t&&(r=(s=F.call(this,e,r,i))[0],a=s[1]),this._newListener&&this.emit("newListener",e,r),this.wildcard?(S.call(this,e,r,n),a):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),n?this._events[e].unshift(r):this._events[e].push(r),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,h.call(this,this._events[e].length,e))):this._events[e]=r,a)},L.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var s="string"==typeof e?e.split(this.delimiter):e.slice();if(!(i=E.call(this,null,s,this.listenerTree,0)))return this}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var a=0;a<i.length;a++){var o=i[a];if(r=o._listeners,n(r)){for(var l=-1,c=0,u=r.length;c<u;c++)if(r[c]===t||r[c].listener&&r[c].listener===t||r[c]._origin&&r[c]._origin===t){l=c;break}if(l<0)continue;return this.wildcard?o._listeners.splice(l,1):this._events[e].splice(l,1),0===r.length&&(this.wildcard?delete o._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)&&(this.wildcard?delete o._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&A(this.listenerTree),this},L.prototype.offAny=function(e){var t,r=0,n=0;if(e&&this._all&&this._all.length>0){for(r=0,n=(t=this._all).length;r<n;r++)if(e===t[r])return t.splice(r,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(r=0,n=t.length;r<n;r++)this.emit("removeListenerAny",t[r]);this._all=[]}return this},L.prototype.removeListener=L.prototype.off,L.prototype.removeAllListeners=function(e){if(e===t)return!this._events||c.call(this),this;if(this.wildcard){var r,n=E.call(this,null,e,this.listenerTree,0);if(!n)return this;for(r=0;r<n.length;r++)n[r]._listeners=null;this.listenerTree&&A(this.listenerTree)}else this._events&&(this._events[e]=null);return this},L.prototype.listeners=function(e){var r,n,i,s,a,o=this._events;if(e===t){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!o)return[];for(s=(r=l(o)).length,i=[];s-- >0;)"function"==typeof(n=o[r[s]])?i.push(n):i.push.apply(i,n);return i}if(this.wildcard){if(!(a=this.listenerTree))return[];var c=[],u="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,c,u,a,0),c}return o&&(n=o[e])?"function"==typeof n?[n]:n:[]},L.prototype.eventNames=function(e){var t=this._events;return this.wildcard?x.call(this,this.listenerTree,[],null,e):t?l(t):[]},L.prototype.listenerCount=function(e){return this.listeners(e).length},L.prototype.hasListeners=function(e){if(this.wildcard){var r=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return E.call(this,r,n,this.listenerTree,0),r.length>0}var i=this._events,s=this._all;return!!(s&&s.length||i&&(e===t?l(i).length:i[e]))},L.prototype.listenersAny=function(){return this._all?this._all:[]},L.prototype.waitFor=function(e,r){var n=this,i=typeof r;return"number"===i?r={timeout:r}:"function"===i&&(r={filter:r}),w((r=g(r,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:y,Promise:m})).Promise,(function(t,i,s){function a(){var s=r.filter;if(!s||s.apply(n,arguments))if(n.off(e,a),r.handleError){var o=arguments[0];o?i(o):t(d.apply(null,arguments).slice(1))}else t(d.apply(null,arguments))}s((function(){n.off(e,a)})),n._on(e,a,!1)}),{timeout:r.timeout,overload:r.overload})};var O=L.prototype;Object.defineProperties(L,{defaultMaxListeners:{get:function(){return O._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");O._maxListeners=e},enumerable:!0},once:{value:function(e,t,r){return w((r=g(r,{Promise:Promise,timeout:0,overload:!1},{Promise:m})).Promise,(function(r,n,i){var s;if("function"==typeof e.addEventListener)return s=function(){r(d.apply(null,arguments))},i((function(){e.removeEventListener(t,s)})),void e.addEventListener(t,s,{once:!0});var a,o=function(){a&&e.removeListener("error",a),r(d.apply(null,arguments))};"error"!==t&&(a=function(r){e.removeListener(t,o),n(r)},e.once("error",a)),i((function(){a&&e.removeListener("error",a),e.removeListener(t,o)})),e.once(t,o)}),{timeout:r.timeout,overload:r.overload})},writable:!0,configurable:!0}}),Object.defineProperties(O,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=L}()}(E);var S=E.exports;class x extends a{constructor(e){super(e),this.namespace="infiniteScroll",this.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},this.after_init()}}class A{constructor(e){this.parent=e,this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.endpointsMethods={},this.endpointsHeaders={};var 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(e,t,r=null){let n=this,i=Array.isArray(e),s=i?this.getUrl(...e):this.getUrl(e);e=i?e[0]:e,r=r||this.endpointsMethods[e]||"post";let a=this.endpointsHeaders[e];if("get"===r&&t instanceof FormData){var o={};Array.from(t.entries()).forEach((function(e){o[e[0]]=e[1]})),t={params:o}}a&&"get"===r&&(t=t?Object.assign(t,a):a);let l={namespace:this.namespace,action:e,url:s,payload:t,method:r,headers:a};try{salla.event.document.request(l)}catch(e){return salla.event.document.requestFailed(l),new Promise((()=>{throw e}))}this.webEndpoints.includes(e)?s=salla.url.get(s):"http"!==s.substring(0,4)&&(s=salla.url.api(s));let c="undefined"!=typeof event?event.currentTarget:null,u=!1;return"SALLA-BUTTON"===c?.tagName&&(u=!0),u&&c?.load(),this.parent[r](s,t,{headers:a}).then((e=>(u&&c?.stop(),e.data&&e.request&&(e=e.data),n.handleAfterResponseActions(e),e))).catch((e=>{throw u&&c?.stop(),salla.event.document.requestFailed(l,e),n.handleErrorResponse(e),e}))}request(e,t,r=null){return!this.isFastRequestsAllowed()&&this.debounce.enabled?(this.debounce.request||(this.debounce.request=salla.helpers.debounce(this.normalRequest.bind(this),this.debounce.time)),this.debounce.request(e,t,r)):this.normalRequest(e,t,r)}getUrl(e){let t=this.endpoints[e]||e;const r=/{[^{}]+}/i;for(let e=1;e<arguments.length;e++)t=t.replace(r,arguments[e]);return t}handleAfterResponseActions(e){if(!e)return;let{data:t,googleTags:r=null}=e,n=t&&t.googleTags?t.googleTags:r;dataLayer&&n&&dataLayer.push(n),this.fireEventsForResponse(e),this.renderSections(e),this.showAlert(e),e.data?.token&&salla.event.auth.tokenFetched(e.data.token)}fireEventsForResponse(e){let t=e.events||e.data?.events||e.error?.events;"string"==typeof t&&(t=JSON.parse(t)),t&&Object.keys(t).forEach((e=>salla.event.dispatch(e,t[e])))}renderSections(e){e.sections&&Object.keys(e.sections).forEach((t=>{document.querySelectorAll(t.toSelector()).forEach((function(r){r.innerHTML=e.sections[t]}))}))}handleErrorResponse(e){if(e.response&&e.response.data)return e.response.data.error&&e.response.data.error.fields&&!salla.config.get("sdk.notifier_handler_disabled",!1)?this.handleInvalidFields(e):this.handleAfterResponseActions(e.response.data)}showAlert(e){if(e&&!salla.config.get("sdk.notifier_handler_disabled",!1))return e.case&&e.msg?salla.notify.fire(e.msg,e.case,e):e.hasOwnProperty("success")&&e.data?.message?salla.notify.fire(e.data?.message,e.success?salla.notify.types.success:salla.notify.types.error,e):e.error&&e.error.message&&"FORBIDDEN"!==e.error.message?salla.error(e.error.message,e):void 0}handleInvalidFields(e){let t=e.response.data.error.fields,r=[];Object.keys(t).forEach((e=>{let n=t[e];Array.isArray(n)?n.forEach((e=>r.push(e))):r.push(n)}));let n=(r.length>1?"* ":"")+r.join("\n* ");salla.error(n,e)}event(){return salla.event[this.className]}getPossibleValue(e,t,r=!1){if(!e)return;if("object"!=typeof e)return e;let n;for(let r=0;r<t.length&&!(n=e[t[r]])&&!("undefined"!=typeof FormData&&e instanceof FormData&&(n=e.get(t[r])));r++);return n=n||e,"object"!=typeof n||r?n:void 0}isFastRequestsAllowed(){return salla.config.get("fastRequests")}promise(e,t=!0){return new Promise(((r,n)=>t?r(e):n(e)))}errorPromise(e){return this.promise(e,!1)}successPromise(e){return this.promise(e,!0)}}class P extends A{constructor(e){super(e),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"},this.endpointsMethods={latest:"get",details:"get",status:"get",updateItem:"post",deleteItem:"delete",deleteImage:"delete",deleteCoupon:"put"},this.webEndpoints=["latest"],this.latestCart=null,this.after_init()}async getCurrentCartId(){if(this.latestCart)return this.latestCart.cart.id;let e=await this.latest();return this.latestCart=e.data,this.latestCart.cart.id}async getUploadImageEndpoint(e){return e||(e=await this.getCurrentCartId()),salla.url.api(this.getUrl("uploadImage",e))}latest(){return this.request("latest",{params:{source:""}}).then((e=>(salla.storage.set("cart",e.data.cart),salla.event.cart.latestFetched(e),e))).catch((e=>{throw salla.storage.set("cart",""),salla.event.cart.latestFailed(e),e}))}async details(){let e=await this.getCurrentCartId();return this.request(["details",e]).then((function(e){return salla.cart.event.detailsFetched(e),e})).catch((function(e){throw salla.cart.event.detailsNotFetched(e),e}))}async quickAdd(e){return this.addItem(e)}async addItem(e){let t=this.getCartPayload(e);if(!t.id){let e='There is no product "id"!';return salla.cart.event.itemAddedFailed(e),this.errorPromise(e)}let r=this.getPossibleValue(t.payload,["quantity","donating_amount"])?"addItem":"quickAdd",n=await this.getCurrentCartId();return this.request([r,n,t.id],t.payload).then((function(e){return salla.cart.event.itemAdded(e,t.id),e})).catch((function(e){throw salla.cart.event.itemAddedFailed(e,t.id),e}))}async deleteItem(e){let t=this.getCartPayload(e);if(!t.id){let e='There is no "id"!';return salla.cart.event.itemDeletedFailed(e),this.errorPromise(e)}let r=await this.getCurrentCartId();return this.request(["deleteItem",r,t.id]).then((function(e){return salla.cart.event.itemDeleted(e,t.id),e})).catch((function(e){throw salla.cart.event.itemDeletedFailed(e,t.id),e}))}async updateItem(e){let t=this.getCartPayload(e);if(!t.id){let e='There is no "id"!';return salla.cart.event.itemUpdatedFailed(e),this.errorPromise(e)}let r=await this.getCurrentCartId();return"Object"===t.payload.constructor?.name?t.payload._method="PUT":t.payload.append("_method","PUT"),this.request(["updateItem",r,t.id],t.payload).then((function(e){return salla.cart.event.itemUpdated(e,t.id),e})).catch((function(e){throw salla.cart.event.itemUpdatedFailed(e,t.id),e}))}async deleteImage(e){if(!(e=this.getPossibleValue(e,["id","image_id","photo_id"]))){let e='There is no "id"!';return salla.cart.event.imageNotDeleted(e),this.errorPromise(e)}let t=await this.getCurrentCartId();return this.request(["deleteImage",t,e]).then((function(t){return salla.cart.event.imageDeleted(t,e),t})).catch((function(t){throw salla.cart.event.imageNotDeleted(t,e),t}))}async status(e){return e=e||await this.getCurrentCartId(),this.request(["status",e],{params:{has_apple_pay:!!window.ApplePaySession}})}async submit(){this.status(await this.getCurrentCartId()).then((e=>{let t=e.data.next_step.to;if(!["checkout","refresh","login"].includes(t)){let e="Can't find next_step );";throw salla.cart.event.submitFailed(e),e}if(salla.cart.event.submitted(e),"login"===t)return salla.auth.setCanRedirect(!1),salla.event.dispatch("login::open"),void salla.auth.event.onLoggedIn((e=>{salla.event.dispatch("login::close"),this.submit()}));"checkout"===t?window.location.href=e.data.next_step.url+(window.ApplePaySession?"?has_apple_pay=true":""):window.location.reload()})).catch((function(e){throw salla.cart.event.submitFailed(e),e}))}getCartPayload(e){let t=e?.data||("object"==typeof e?e:void 0);return e=t?this.getPossibleValue(t,["prod_id","product_id","item_id","id"]):e,t="object"==typeof t?t:void 0,{id:e,payload:t}}handleAfterResponseActions(e){if(403===e.status){salla.storage.remove("cart");let e=salla.lang.get("pages.checkout.try_again");throw salla.error(e),e}super.handleAfterResponseActions(e)}reset(){salla.storage.remove("cart"),salla.cart.event.successReset()}async addCoupon(e){if(e=e.data||e,!(e=this.getPossibleValue(e,["coupon"]))){let e=new Error('There is no "Coupon Code"!');return e.name="EmptyCoupon",salla.event.cart.couponAdditionFailed(e),this.errorPromise(e)}let t=await salla.cart.api.getCurrentCartId();return this.request(["addCoupon",t],{coupon:e}).then((function(e){return salla.event.cart.couponAdded(e,t),e})).catch((function(e){throw salla.event.cart.couponAdditionFailed(e,t),e}))}async deleteCoupon(){let e=await salla.cart.api.getCurrentCartId();return this.request(["deleteCoupon",e],{}).then((function(t){return salla.event.cart.couponDeleted(t,e),t})).catch((function(t){throw salla.event.cart.couponDeletionFailed(t,e),t}))}}class F extends A{constructor(e){super(e),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((e=>(salla.loyalty.event.programFetched(e),e))).catch((e=>{throw salla.loyalty.event.programNotFetched(e),e}))}async exchange(e,t=null){if(!(e=this.getPossibleValue(e,["id","loyalty_prize_id","prize_id"]))){let e="Unable to find cart id. Please provide one.";return salla.loyalty.event.exchangeFailed(e),this.errorPromise(e)}if(!(t=t||await salla.cart.getCurrentCartId())){let e="Unable to find cart id. Please provide one.";return salla.loyalty.event.exchangeFailed(e),this.errorPromise(e)}return this.request("exchange",{loyalty_prize_id:e,cart_id:t}).then((function(t){return salla.loyalty.event.exchangeSucceeded(t,e),t})).catch((function(t){throw salla.loyalty.event.exchangeFailed(t,e),t}))}async reset(e=null){if(!(e=e||await salla.cart.getCurrentCartId())){let e="Unable to find cart id. Please provide one.";return salla.loyalty.event.resetFailed(e),this.errorPromise(e)}return this.request("reset",{cart_id:e}).then((e=>(salla.loyalty.event.resetSucceeded(e),e))).catch((e=>{throw salla.loyalty.event.resetFailed(e),e}))}}class L extends A{constructor(e){super(e),this.namespace="auth",this.canRedirect_=!0,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()}setCanRedirect(e){salla.api.auth.canRedirect_=e}canRedirect(){return salla.api.auth.canRedirect_}login(e){e.data&&(e=e.data);let t=this.getPossibleValue(e,["type"]);if(!["email","mobile"].includes(t)){let e="Login type should be in: [email, mobile]";return salla.auth.event.codeNotSent(e),this.errorPromise(e)}return this.request(["login",t],e).then((function(e){return salla.auth.event.codeSent(e,t),e})).catch((function(e){throw salla.auth.event.codeNotSent(e,t),e}))}async verify(e,t=!0){let r=this.getPossibleValue(e,["type"]);if(!r){let e="Failed to know what's login type!";return salla.auth.event.verificationFailed(e),this.errorPromise(e)}t=!1!==this.getPossibleValue(e,["supportWebAuth"])&&t,salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event);let n=await this.request(["verify",r],e);return 200!==n?.status?(salla.auth.event.verificationFailed(n,r),this.errorPromise(n)):(t&&await this.request("auth/jwt"),"authenticated"===n.data?.case&&salla.auth.event.loggedIn(n),salla.auth.event.verified(n,r),this.successPromise(n))}resend(e){let t;return(e=e.data||e).type=e.type||"mobile","mobile"!==e.type||e.phone&&e.country_code?"email"!==e.type||e.email?this.request("resend",e).then((function(t){return salla.auth.event.codeSent(t,e),t})).catch((function(t){throw salla.auth.event.codeNotSent(t,e),t})):(salla.auth.event.codeNotSent(t="There is no email!",e),this.errorPromise(t)):(salla.auth.event.codeNotSent(t="There is no phone or country_code!",e),this.errorPromise(t))}register(e){let t;return e.data&&(t=e.element,e=e.data),salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event),this.request("register",e).then((async function(e){return salla.auth.event.registered.call(t,e),"authenticated"===e.data?.case&&(await salla.auth.api.request("auth/jwt"),salla.auth.event.loggedIn(e)),e})).catch((function(e){throw salla.auth.event.registrationFailed.call(t,e),e}))}logout(){return this.request("logout").then((function(e){return salla.auth.event.loggedOut(e),salla.log("Reloading after 0.1 sec..."),setTimeout((()=>location.reload()),100),e})).catch((function(e){throw salla.auth.event.failedLogout(e),e}))}refresh(){return this.request("refresh").catch((function(e){throw salla.auth.event.refreshFailed(e),e}))}}class O extends A{constructor(e){super(e),this.namespace="order",this.endpoints={cancel:"orders/cancel/{id}",createCartFromOrder:"reorder/{id}",sendInvoice:"orders/send/{id}"},this.endpointsMethods={createCartFromOrder:"get"},this.after_init()}show(e){let t=this.getPossibleValue(e?.data||e,["id","order_id"]);salla.event.dispatch("mobile::order.placed",{order_id:t}),location.href=this.getPossibleValue(e?.data||e,["url"])}cancel(e){return e=e||salla.config.get("page.id"),this.request(["cancel",e],{params:{has_apple_pay:!!window.ApplePaySession}}).then((function(t){return salla.event.order.canceled(t,e),t})).catch((function(t){throw salla.event.order.notCanceled(t,e),t}))}createCartFromOrder(e){return e=e||salla.config.get("page.id"),this.request(["createCartFromOrder",e]).then((function(t){return salla.storage.set("cart",{id:t.data.cart_id,user_id:salla.config.get("user.id")}),salla.event.order.orderCreated(t,e),window.location.href=t.data.url,t})).catch((function(t){throw salla.event.order.orderCreationFailed(t,e),t}))}sendInvoice(e){let t=this.getPossibleValue(e,["id"])||salla.config.get("page.id");if(!t||isNaN(t)){let e="There is no id!";return salla.order.event.invoiceNotSent(e),this.errorPromise(e)}return this.request(["sendInvoice",t],e).then((e=>(salla.event.order.invoiceSent(e,t),e))).catch((e=>{throw salla.event.order.invoiceNotSent(e,t),e}))}}class k extends A{constructor(e){super(e),this.namespace="product",this.previousQuery="",this.endpoints={getPrice:"products/{id}/price",availabilitySubscribe:"products/{id}/availability-notify",search:"products/search",categories:"products/categories/{?id}",purchaseNow:"checkout/quick-purchase/{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={giftDetail:"get"},this.webEndpoints=["purchaseNow"],this.after_init()}getPrice(e){let t=e.data||e,r=this.getPossibleValue(t,["id","prod_id","product_id"]);return this.request(["getPrice",r],"object"==typeof t?t:void 0).then((function(e){return salla.product.event.priceUpdated(e,r),e})).catch((function(e){throw salla.product.event.priceUpdateFailed(e,r),e}))}categories(e){return this.request(["categories",e||""],null,"get").then((function(e){return salla.product.event.categoriesFetched(e),e})).catch((function(e){throw salla.product.event.categoriesFailed(e),e}))}availabilitySubscribe(e){let t=e.data||e;return e=this.getPossibleValue(t,["id","prod_id"]),this.request(["availabilitySubscribe",e],"object"==typeof t?t:void 0).then((function(t){return salla.product.event.availabilitySubscribed(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribedFailed(t,e),t}))}search(e){let t=e.data;if(t||(t={params:"string"==typeof e?{query:e}:e}),!(e=t instanceof FormData?t.get("query"):t.query||t.params?.query)){let e='There is no "query"!';return salla.product.event.searchFailed(e),this.errorPromise(e)}if(e===salla.api.product.previousQuery){let e="Query is same as previous one!";return salla.product.event.searchFailed(e),salla.api.product.previousQuery=null,this.errorPromise(e)}return salla.api.product.previousQuery=e,this.request("search",t,"get").then((function(t){return salla.product.event.searchResults(t,e),t})).catch((function(t){throw salla.product.event.searchFailed(t,e),t}))}offers(e){if(!(e=this.getPossibleValue(e?.data|e,["product_id","id"]))){let e='There is no "product_id"!';return salla.offer.event.fetchDetailsFailed(e),this.errorPromise(e)}return this.request(["offers",e]).then((function(t){return salla.product.event.offersFetched(t,e),t})).catch((function(t){throw salla.product.event.fetchOffersFailed(t,e),t}))}purchaseNow(e){if(salla.config.isGuest())return salla.auth.event.dispatch("login");let t=e.product_data,r=this.getPossibleValue(t,["id","prod_id"]);if(!e.is_applepay)return this.request(["quickPurchase",r],"object"==typeof t?t:void 0).then((function(e){return e})).catch((function(e){throw e}));salla.event.dispatch("payments::apple-pay.start-transaction",{amount:e.total,currency:e.currency,requiredShippingContactFields:e.require_shipping?["postalAddress"]:null,shippingMethods:e.require_shipping?[]:null,supportedNetworks:e.applepay_supported_networks,validateMerchant:{url:baseUrl+"checkout/applepay/validate",onFailed:({response:e})=>{console.log("validateMerchant Failed!")},onSuccess:e=>(console.log("validateMerchant Success"),this.request(["quickPurchase",r],"object"==typeof t?t:void 0))},authorized:{url:baseUrl+"/checkout/{id}/payments/submit",onFailed:e=>{console.log("authorized Failed!"),window.Salla.Payments.ApplePay.onCancel({},e.data.error.message)},onSuccess:e=>{console.log(e),window.location.href=e.redirect.url,console.log("authorized Success:: redirect to thank you page, order placed")}},shippingMethodSelected:e.require_shipping?{url:baseUrl+"/checkout/{id}/shipping/details",onFailed:e=>{console.log("select shipping method failed!")},onSuccess:e=>{console.log("select shipping method success")}}:null,shippingContactSelected:e.require_shipping?{url:baseUrl+"/checkout/{id}/address/add",onFailed:e=>{console.log("created contact failed!")},onSuccess:e=>{console.log("created contact success : ",e.data.address_id)}}:null,recalculateTotal:{url:baseUrl+"/checkout/{id}/payments/recalculate"},onError:function(e){console.log(e),salla.notify.error(e)}})}getSizeGuides(e){return this.request(`products/${e}/size-guides`,null,"get").then((t=>(salla.product.event.sizeGuideFetched(t,e),t))).catch((t=>{throw salla.product.event.sizeGuideFetchFailed(t,e),t}))}getGiftDetails(e){return this.request(["giftDetail",e]).then((t=>(salla.product.event.giftFetched(t,e),t))).catch((t=>{throw salla.product.event.giftFetchFailed(t,e),t}))}addGiftToCart(e,t,r=!1){return this.request(["giftToCart",e],t).then((t=>(salla.product.event.addGiftToCartSucceeded(t,e),r&&(window.location.href=t.redirect),response))).catch((t=>{throw salla.product.event.addGiftToCartFailed(t,e),t}))}uploadGiftImage(e){return this.request("giftImage",e).then((e=>(salla.product.event.giftImageUploadSucceeded(e),e))).catch((e=>{throw salla.product.event.giftImageUploadFailed(e),e}))}}class T extends A{constructor(e){super(e),this.namespace="profile",this.endpoints={info:"auth/user",update:"profile/update",updateContacts:"profile/contacts/update",verify:"profile/verify"},this.after_init()}info(){return this.request("info",null,"get").then((e=>(salla.profile.event.infoFetched(e),e))).catch((e=>{throw salla.profile.event.infoNotFetched(e),e}))}update(e){return this.request("update",e).then((e=>(salla.profile.event.updated(e),e))).catch((e=>{throw salla.event.profile.updateFailed(e),e}))}updateContacts(e){return this.request("updateContacts",e).then((e=>(salla.profile.event.verificationCodeSent(e),e))).catch((e=>{throw salla.event.profile.updateContactsFailed(e),e}))}verify(e){return this.request("verify",e).then((e=>(salla.profile.event.verified(e),e))).catch((e=>{throw salla.event.profile.unVerified(e),e}))}}class j extends A{constructor(e){super(e),this.namespace="comment",this.endpoints={add:"{type}/{id}/comments"},this.after_init()}add(e){e?.data&&(e=e.data);let t,{id:r,type:n,comment:i}=Object.fromEntries(e);return r?n&&["products","pages","product","page"].includes(n)?i?(n+=["product","page"].includes(n)?"s":"",this.request(["add",n,r],{comment:i}).then((function(e){return salla.event.comment.added(e,r),e})).catch((function(e){throw salla.event.comment.additionFailed(e,r),e}))):(salla.event.comment.additionFailed(t="can't find comment content!"),this.errorPromise(t)):(salla.event.comment.additionFailed(t="Failed to get type one of:(products, product, page, pages)!"),this.errorPromise(t)):(salla.event.comment.additionFailed(t="Failed to get id!"),this.errorPromise(t))}}class C extends A{constructor(e){super(e),this.namespace="currency",this.endpoints={change:"/",list:"currencies"},this.endpointsMethods={change:"get",list:"get"},this.webEndpoints=["change"],this.after_init()}change(e){if(!(e=this.getPossibleValue(e.data||e,["currency","code"]))){let e="Can't find currency code!";return salla.currency.event.failed(e),this.errorPromise(e)}return this.request("change",{params:{change_currency:"",currency:e}}).then((function(t){return salla.cookie.set("fresh_summary",1),salla.storage.set("cart",""),salla.currency.event.changed(t,e),t})).catch((function(t){throw salla.currency.event.failed(t,e),t}))}list(){return this.request("list").then((function(e){return salla.currency.event.fetched(e),e})).catch((function(e){throw salla.currency.event.failedToFetch(e),e}))}}class R extends A{constructor(e){super(e),this.namespace="document"}}class I extends A{constructor(e){super(e),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(e){let t="object"==typeof e?e:{},r=this.getPossibleValue(e?.data||e,["order_id","id"]);if(!r){let e='There is no "order_id"!';return salla.event.rating.orderNotFetched(e),this.errorPromise(e)}return this.request(["order",r],t).then((function(e){return salla.event.rating.orderFetched(e,r),e})).catch((function(e){throw salla.event.rating.orderNotFetched(e,r),e}))}store(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.rating.storeFailed(e),this.errorPromise(e)}return this.request("store",e).then((function(t){return salla.event.rating.storeRated(t,e),t})).catch((function(t){throw salla.event.rating.storeFailed(t,e),t}))}products(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.rating.productsFailed(e),this.errorPromise(e)}return this.request("products",e).then((function(t){return salla.event.rating.productsRated(t,e),t})).catch((function(t){throw salla.event.rating.productsFailed(t,e),t}))}shipping(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.rating.shippingFailed(e),this.errorPromise(e)}return this.request("shipping",e).then((function(t){return salla.event.rating.shippingRated(t,e),t})).catch((function(t){throw salla.event.rating.shippingFailed(t,e),t}))}}class q{constructor(e){salla.config.merge(e),e?(e._token&&(salla.api.defaults.headers.common["X-CSRF-TOKEN"]=e._token),this.injectMaintenanceAlert(),this.injectThemePreviewAlert(),this.injectEditAlert(),e?.user?.language_code&&salla.lang.setLocale(e?.user?.language_code),salla.lang.loadStoreTranslations(),salla.twilight.event.initiated(e)):salla.twilight.event.initiated(e)}injectMaintenanceAlert(){salla.config.get("maintenance")&&(document.querySelector(".store-notify")?salla.logger.warn(".store-notify element Existed before!"):salla.lang.onLoaded((()=>{var e=document.createElement("div");e.classList.add("store-notify"),e.style="background-color: #d63031; color: #fff; padding: 10px 15px; text-align: center; font-size: 17px;",e.innerHTML=`<p style="margin:0 !important;">${salla.lang.get("blocks.header.maintenance_alert")}</p>`,document.body.prepend(e)})))}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 e=document.createElement("div");e.id="s-theme_preview_bar",e.setAttribute("style","display: flex; justify-content: space-between; text-align: center; background-color: #232323; color: #fff; padding: 10px; font-size: 0.875rem; line-height: 1.25rem; position: relative;"),e.innerHTML=`\n <div style="display:flex; align-items:center;">\n <img width="32" src="https://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(e)})))}injectEditAlert(){let e=salla.config.get("edit");e&&(document.querySelector("#s-edit-alert")?salla.logger.warn("#s-edit-alert element Existed before!"):salla.lang.onLoaded((()=>{let t=document.createElement("div");t.id="s-edit-alert",t.innerHTML=`\n <a href="${e}" 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(t)})))}handleElementAjaxRequest(e,t){if(!(t instanceof HTMLFormElement||t instanceof HTMLAnchorElement))return salla.logger.warn("trying to call ajax from non Element!!"),!1;e.preventDefault();let r=t.getAjaxFormData(e),n=r.method?r.method.toLowerCase():void 0;salla.api.document.request(r.url,r.formData,n).then((e=>(e.data&&e.request&&(e=e.data),salla.api.document.handleAfterResponseActions(e),this.callAjaxEvent(r.events.success,e,r.formData),e))).catch((e=>{throw salla.api.document.handleErrorResponse(e),this.callAjaxEvent(r.events.fail,e,r.formData),e}))}callAjaxEvent(e,t,r){if(e){if(r instanceof FormData){var n={};Array.from(r.entries()).forEach((function(e){n[e[0]]=e[1]})),r=n}window[e]?window[e](t,r):salla.event.dispatch(e,t,r)}}}class N extends A{constructor(e){super(e),this.namespace="twilight",this.after_init()}init(e){let t=e?.events;return salla.isInitiated||(delete e.events,new q(e),salla.isInitiated=!0),t&&salla.event.dispatchEvents(t),this.successPromise(e)}api(e){let t=e?.events;return t&&salla.event.dispatchEvents(t),this.successPromise(e)}}class D extends A{constructor(e){super(e),this.namespace="wishlist",this.endpoints={add:"products/favorites/{id}",remove:"products/favorites/{id}"},this.endpointsMethods={remove:"delete"},this.after_init()}toggle(e){return salla.storage.get("salla::wishlist",[]).includes(e)?this.remove(e):this.add(e)}add(e){let t;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(t=salla.lang.get("common.messages.must_login")),salla.error(t),this.errorPromise(t)):(e=this.getPossibleValue(e?.data||e,["product_id","id"]))?this.request(["add",e]).then((t=>(this.updateWishlistStorage(e),salla.wishlist.event.added(t,e),t))).catch((function(t){throw salla.wishlist.event.additionFailed(t,e),t})):(salla.wishlist.event.additionFailed(t="Failed to get product id!"),this.errorPromise(t))}remove(e){let t;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(t=salla.lang.get("common.messages.must_login")),salla.error(t),this.errorPromise(t)):(e=this.getPossibleValue(e?.data||e,["product_id","id"]))?this.request(["remove",e]).then((t=>(this.updateWishlistStorage(e,!1),salla.wishlist.event.removed(t,e),t))).catch((function(t){throw salla.wishlist.event.removingFailed(t,e),t})):(salla.wishlist.event.removingFailed(t="Failed to get id!"),this.errorPromise(t))}updateWishlistStorage(e,t=!0){let r=salla.storage.get("salla::wishlist",[]);t?r.push(e):r.splice(r.indexOf(e),1),salla.storage.set("salla::wishlist",r)}}class U extends A{constructor(e){super(e),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((e=>(salla.scope.event.fetched(e),e))).catch((e=>{throw salla.scope.event.notFetched(e),e}))}change(e){return this.request("scopes",e).then((e=>(salla.scope.event.changeSucceeded(e),e))).catch((e=>{throw salla.scope.event.changeFailed(e),e}))}getProductAvailability(e=null){return this.request(`scopes/availability?product_id=${e}`,null,"get").then((t=>(salla.scope.event.productAvailabilityFetched(t,e),t))).catch((e=>{throw salla.scope.event.productAvailabilityNotFetched(e),resp}))}}var M,$={exports:{}},H={exports:{}},z=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},B=z,G=Object.prototype.toString,V=(M=Object.create(null),function(e){var t=G.call(e);return M[t]||(M[t]=t.slice(8,-1).toLowerCase())});function W(e){return e=e.toLowerCase(),function(t){return V(t)===e}}function J(e){return Array.isArray(e)}function Q(e){return void 0===e}var K=W("ArrayBuffer");function Z(e){return null!==e&&"object"==typeof e}function X(e){if("object"!==V(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var Y=W("Date"),ee=W("File"),te=W("Blob"),re=W("FileList");function ne(e){return"[object Function]"===G.call(e)}var ie=W("URLSearchParams");function se(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),J(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var ae,oe=(ae="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return ae&&e instanceof ae}),le={isArray:J,isArrayBuffer:K,isBuffer:function(e){return null!==e&&!Q(e)&&null!==e.constructor&&!Q(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||G.call(e)===t||ne(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&K(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Z,isPlainObject:X,isUndefined:Q,isDate:Y,isFile:ee,isBlob:te,isFunction:ne,isStream:function(e){return Z(e)&&ne(e.pipe)},isURLSearchParams:ie,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:se,merge:function e(){var t={};function r(r,n){X(t[n])&&X(r)?t[n]=e(t[n],r):X(r)?t[n]=e({},r):J(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)se(arguments[n],r);return t},extend:function(e,t,r){return se(t,(function(t,n){e[n]=r&&"function"==typeof t?B(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r){var n,i,s,a={};t=t||{};do{for(i=(n=Object.getOwnPropertyNames(e)).length;i-- >0;)a[s=n[i]]||(t[s]=e[s],a[s]=!0);e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:V,kindOfTest:W,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;var t=e.length;if(Q(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:oe,isFileList:re},ce=le;function ue(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var he=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(ce.isURLSearchParams(t))n=t.toString();else{var i=[];ce.forEach(t,(function(e,t){null!=e&&(ce.isArray(e)?t+="[]":e=[e],ce.forEach(e,(function(e){ce.isDate(e)?e=e.toISOString():ce.isObject(e)&&(e=JSON.stringify(e)),i.push(ue(t)+"="+ue(e))})))})),n=i.join("&")}if(n){var s=e.indexOf("#");-1!==s&&(e=e.slice(0,s)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e},de=le;function fe(){this.handlers=[]}fe.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},fe.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},fe.prototype.forEach=function(e){de.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var pe,ge,me=fe,ve=le;function ye(){if(ge)return pe;ge=1;var e=le;function t(e,t,r,n,i){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}e.inherits(t,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 r=t.prototype,n={};return["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(e){n[e]={value:e}})),Object.defineProperties(t,n),Object.defineProperty(r,"isAxiosError",{value:!0}),t.from=function(n,i,s,a,o,l){var c=Object.create(r);return e.toFlatObject(n,c,(function(e){return e!==Error.prototype})),t.call(c,n.message,i,s,a,o),c.name=n.name,l&&Object.assign(c,l),c},pe=t}var be,we,_e,Ee,Se,xe,Ae={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};function Pe(){if(we)return be;we=1;var e=le;return be=function(t,r){r=r||new FormData;var n=[];function i(t){return null===t?"":e.isDate(t)?t.toISOString():e.isArrayBuffer(t)||e.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(s,a){if(e.isPlainObject(s)||e.isArray(s)){if(-1!==n.indexOf(s))throw Error("Circular reference detected in "+a);n.push(s),e.forEach(s,(function(n,s){if(!e.isUndefined(n)){var o,l=a?a+"."+s:s;if(n&&!a&&"object"==typeof n)if(e.endsWith(s,"{}"))n=JSON.stringify(n);else if(e.endsWith(s,"[]")&&(o=e.toArray(n)))return void o.forEach((function(t){!e.isUndefined(t)&&r.append(l,i(t))}));t(n,l)}})),n.pop()}else r.append(a,i(s))}(t),r},be}function Fe(){if(Ee)return _e;Ee=1;var e=ye();return _e=function(t,r,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?r(new e("Request failed with status code "+n.status,[e.ERR_BAD_REQUEST,e.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}}function Le(){if(xe)return Se;xe=1;var e=le;return Se=e.isStandardBrowserEnv()?{write:function(t,r,n,i,s,a){var o=[];o.push(t+"="+encodeURIComponent(r)),e.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),e.isString(i)&&o.push("path="+i),e.isString(s)&&o.push("domain="+s),!0===a&&o.push("secure"),document.cookie=o.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}}var Oe,ke,Te,je,Ce,Re,Ie,qe,Ne,De,Ue,Me,$e=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},He=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},ze=function(e,t){return e&&!$e(t)?He(e,t):t};function Be(){if(ke)return Oe;ke=1;var e=le,t=["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"];return Oe=function(r){var n,i,s,a={};return r?(e.forEach(r.split("\n"),(function(r){if(s=r.indexOf(":"),n=e.trim(r.substr(0,s)).toLowerCase(),i=e.trim(r.substr(s+1)),n){if(a[n]&&t.indexOf(n)>=0)return;a[n]="set-cookie"===n?(a[n]?a[n]:[]).concat([i]):a[n]?a[n]+", "+i:i}})),a):a}}function Ge(){if(je)return Te;je=1;var e=le;return Te=e.isStandardBrowserEnv()?function(){var t,r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var t=e;return r&&(n.setAttribute("href",t),t=n.href),n.setAttribute("href",t),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(r){var n=e.isString(r)?i(r):r;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},Te}function Ve(){if(Re)return Ce;Re=1;var e=ye();function t(t){e.call(this,null==t?"canceled":t,e.ERR_CANCELED),this.name="CanceledError"}return le.inherits(t,e,{__CANCEL__:!0}),Ce=t}function We(){return qe||(qe=1,Ie=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}),Ie}function Je(){if(De)return Ne;De=1;var e=le,t=Fe(),r=Le(),n=he,i=ze,s=Be(),a=Ge(),o=Ae,l=ye(),c=Ve(),u=We();return Ne=function(h){return new Promise((function(d,f){var p,g=h.data,m=h.headers,v=h.responseType;function y(){h.cancelToken&&h.cancelToken.unsubscribe(p),h.signal&&h.signal.removeEventListener("abort",p)}e.isFormData(g)&&e.isStandardBrowserEnv()&&delete m["Content-Type"];var b=new XMLHttpRequest;if(h.auth){var w=h.auth.username||"",_=h.auth.password?unescape(encodeURIComponent(h.auth.password)):"";m.Authorization="Basic "+btoa(w+":"+_)}var E=i(h.baseURL,h.url);function S(){if(b){var e="getAllResponseHeaders"in b?s(b.getAllResponseHeaders()):null,r={data:v&&"text"!==v&&"json"!==v?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:e,config:h,request:b};t((function(e){d(e),y()}),(function(e){f(e),y()}),r),b=null}}if(b.open(h.method.toUpperCase(),n(E,h.params,h.paramsSerializer),!0),b.timeout=h.timeout,"onloadend"in b?b.onloadend=S:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(S)},b.onabort=function(){b&&(f(new l("Request aborted",l.ECONNABORTED,h,b)),b=null)},b.onerror=function(){f(new l("Network Error",l.ERR_NETWORK,h,b,b)),b=null},b.ontimeout=function(){var e=h.timeout?"timeout of "+h.timeout+"ms exceeded":"timeout exceeded",t=h.transitional||o;h.timeoutErrorMessage&&(e=h.timeoutErrorMessage),f(new l(e,t.clarifyTimeoutError?l.ETIMEDOUT:l.ECONNABORTED,h,b)),b=null},e.isStandardBrowserEnv()){var x=(h.withCredentials||a(E))&&h.xsrfCookieName?r.read(h.xsrfCookieName):void 0;x&&(m[h.xsrfHeaderName]=x)}"setRequestHeader"in b&&e.forEach(m,(function(e,t){void 0===g&&"content-type"===t.toLowerCase()?delete m[t]:b.setRequestHeader(t,e)})),e.isUndefined(h.withCredentials)||(b.withCredentials=!!h.withCredentials),v&&"json"!==v&&(b.responseType=h.responseType),"function"==typeof h.onDownloadProgress&&b.addEventListener("progress",h.onDownloadProgress),"function"==typeof h.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",h.onUploadProgress),(h.cancelToken||h.signal)&&(p=function(e){b&&(f(!e||e&&e.type?new c:e),b.abort(),b=null)},h.cancelToken&&h.cancelToken.subscribe(p),h.signal&&(h.signal.aborted?p():h.signal.addEventListener("abort",p))),g||(g=null);var A=u(E);A&&-1===["http","https","file"].indexOf(A)?f(new l("Unsupported protocol "+A+":",l.ERR_BAD_REQUEST,h)):b.send(g)}))},Ne}var Qe=le,Ke=function(e,t){ve.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},Ze=ye(),Xe=Ae,Ye=Pe(),et={"Content-Type":"application/x-www-form-urlencoded"};function tt(e,t){!Qe.isUndefined(e)&&Qe.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var rt,nt={transitional:Xe,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(rt=Je()),rt),transformRequest:[function(e,t){if(Ke(t,"Accept"),Ke(t,"Content-Type"),Qe.isFormData(e)||Qe.isArrayBuffer(e)||Qe.isBuffer(e)||Qe.isStream(e)||Qe.isFile(e)||Qe.isBlob(e))return e;if(Qe.isArrayBufferView(e))return e.buffer;if(Qe.isURLSearchParams(e))return tt(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var r,n=Qe.isObject(e),i=t&&t["Content-Type"];if((r=Qe.isFileList(e))||n&&"multipart/form-data"===i){var s=this.env&&this.env.FormData;return Ye(r?{"files[]":e}:e,s&&new s)}return n||"application/json"===i?(tt(t,"application/json"),function(e,t,r){if(Qe.isString(e))try{return(t||JSON.parse)(e),Qe.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||nt.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&Qe.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Ze.from(e,Ze.ERR_BAD_RESPONSE,this,null,this.response);throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Me?Ue:(Me=1,Ue=null)},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Qe.forEach(["delete","get","head"],(function(e){nt.headers[e]={}})),Qe.forEach(["post","put","patch"],(function(e){nt.headers[e]=Qe.merge(et)}));var it,st,at=nt,ot=le,lt=at;function ct(){return st?it:(st=1,it=function(e){return!(!e||!e.__CANCEL__)})}var ut=le,ht=function(e,t,r){var n=this||lt;return ot.forEach(r,(function(r){e=r.call(n,e,t)})),e},dt=ct(),ft=at,pt=Ve();function gt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new pt}var mt,vt,yt=le,bt=function(e,t){t=t||{};var r={};function n(e,t){return yt.isPlainObject(e)&&yt.isPlainObject(t)?yt.merge(e,t):yt.isPlainObject(t)?yt.merge({},t):yt.isArray(t)?t.slice():t}function i(r){return yt.isUndefined(t[r])?yt.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function s(e){if(!yt.isUndefined(t[e]))return n(void 0,t[e])}function a(r){return yt.isUndefined(t[r])?yt.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function o(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):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 yt.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=l[e]||i,n=t(e);yt.isUndefined(n)&&t!==o||(r[e]=n)})),r};function wt(){return vt?mt:(vt=1,mt={version:"0.27.2"})}var _t=wt().version,Et=ye(),St={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){St[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var xt={};St.transitional=function(e,t,r){function n(e,t){return"[Axios v"+_t+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,s){if(!1===e)throw new Et(n(i," has been removed"+(t?" in "+t:"")),Et.ERR_DEPRECATED);return t&&!xt[i]&&(xt[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,s)}};var At,Pt,Ft,Lt,Ot,kt,Tt={assertOptions:function(e,t,r){if("object"!=typeof e)throw new Et("options must be an object",Et.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),i=n.length;i-- >0;){var s=n[i],a=t[s];if(a){var o=e[s],l=void 0===o||a(o,s,e);if(!0!==l)throw new Et("option "+s+" must be "+l,Et.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Et("Unknown option "+s,Et.ERR_BAD_OPTION)}},validators:St},jt=le,Ct=he,Rt=me,It=function(e){return gt(e),e.headers=e.headers||{},e.data=ht.call(e,e.data,e.headers,e.transformRequest),e.headers=ut.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ut.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||ft.adapter)(e).then((function(t){return gt(e),t.data=ht.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return dt(t)||(gt(e),t&&t.response&&(t.response.data=ht.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},qt=bt,Nt=ze,Dt=Tt,Ut=Dt.validators;function Mt(e){this.defaults=e,this.interceptors={request:new Rt,response:new Rt}}Mt.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=qt(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&Dt.assertOptions(r,{silentJSONParsing:Ut.transitional(Ut.boolean),forcedJSONParsing:Ut.transitional(Ut.boolean),clarifyTimeoutError:Ut.transitional(Ut.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var s,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!i){var o=[It,void 0];for(Array.prototype.unshift.apply(o,n),o=o.concat(a),s=Promise.resolve(t);o.length;)s=s.then(o.shift(),o.shift());return s}for(var l=t;n.length;){var c=n.shift(),u=n.shift();try{l=c(l)}catch(e){u(e);break}}try{s=It(l)}catch(e){return Promise.reject(e)}for(;a.length;)s=s.then(a.shift(),a.shift());return s},Mt.prototype.getUri=function(e){e=qt(this.defaults,e);var t=Nt(e.baseURL,e.url);return Ct(t,e.params,e.paramsSerializer)},jt.forEach(["delete","get","head","options"],(function(e){Mt.prototype[e]=function(t,r){return this.request(qt(r||{},{method:e,url:t,data:(r||{}).data}))}})),jt.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(qt(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Mt.prototype[e]=t(),Mt.prototype[e+"Form"]=t(!0)}));var $t=le,Ht=z,zt=Mt,Bt=bt;var Gt=function e(t){var r=new zt(t),n=Ht(zt.prototype.request,r);return $t.extend(n,zt.prototype,r),$t.extend(n,r),n.create=function(r){return e(Bt(t,r))},n}(at);Gt.Axios=zt,Gt.CanceledError=Ve(),Gt.CancelToken=function(){if(Pt)return At;Pt=1;var e=Ve();function t(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var r;this.promise=new Promise((function(e){r=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(t){n.reason||(n.reason=new e(t),r(n.reason))}))}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},t.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},t.source=function(){var e;return{token:new t((function(t){e=t})),cancel:e}},At=t}(),Gt.isCancel=ct(),Gt.VERSION=wt().version,Gt.toFormData=Pe(),Gt.AxiosError=ye(),Gt.Cancel=Gt.CanceledError,Gt.all=function(e){return Promise.all(e)},Gt.spread=Lt?Ft:(Lt=1,Ft=function(e){return function(t){return e.apply(null,t)}}),Gt.isAxiosError=function(){if(kt)return Ot;kt=1;var e=le;return Ot=function(t){return e.isObject(t)&&!0===t.isAxiosError}}(),H.exports=Gt,H.exports.default=Gt,function(e){e.exports=H.exports}($);var Vt=_($.exports);function Wt(e){this.message=e}Wt.prototype=new Error,Wt.prototype.name="InvalidCharacterError";var Jt="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Wt("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,n,i=0,s=0,a="";n=t.charAt(s++);~n&&(r=i%4?64*r+n:n,i++%4)?a+=String.fromCharCode(255&r>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return a};function Qt(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Jt(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(t)}catch(e){return Jt(t)}}function Kt(e){this.message=e}Kt.prototype=new Error,Kt.prototype.name="InvalidTokenError";class Zt{constructor(e,t){return this.api=e,this.event=t,new Proxy(this,{get:function(r,n){return"event"===n?t:"api"===n&&"twilight"!==e?.namespace?e:e&&e[n]||r[n]}})}}var Xt,Yt={exports:{}},er={exports:{}},tr={exports:{}};function rr(){return Xt||(Xt=1,function(e){!function(t,r){e.exports?e.exports=r():t.EvEmitter=r()}("undefined"!=typeof window?window:w,(function(){function e(){}let t=e.prototype;return t.on=function(e,t){if(!e||!t)return this;let r=this._events=this._events||{},n=r[e]=r[e]||[];return n.includes(t)||n.push(t),this},t.once=function(e,t){if(!e||!t)return this;this.on(e,t);let r=this._onceEvents=this._onceEvents||{};return(r[e]=r[e]||{})[t]=!0,this},t.off=function(e,t){let r=this._events&&this._events[e];if(!r||!r.length)return this;let n=r.indexOf(t);return-1!=n&&r.splice(n,1),this},t.emitEvent=function(e,t){let r=this._events&&this._events[e];if(!r||!r.length)return this;r=r.slice(0),t=t||[];let n=this._onceEvents&&this._onceEvents[e];for(let i of r){n&&n[i]&&(this.off(e,i),delete n[i]),i.apply(this,t)}return this},t.allOff=function(){return delete this._events,delete this._onceEvents,this},e}))}(tr)),tr.exports}var nr,ir,sr={exports:{}};function ar(){return nr||(nr=1,function(e){!function(t,r){e.exports?e.exports=r(t):t.fizzyUIUtils=r(t)}(w,(function(e){let t={extend:function(e,t){return Object.assign(e,t)},modulo:function(e,t){return(e%t+t)%t},makeArray:function(e){if(Array.isArray(e))return e;if(null==e)return[];return"object"==typeof e&&"number"==typeof e.length?[...e]:[e]},removeFrom:function(e,t){let r=e.indexOf(t);-1!=r&&e.splice(r,1)},getParent:function(e,t){for(;e.parentNode&&e!=document.body;)if((e=e.parentNode).matches(t))return e},getQueryElement:function(e){return"string"==typeof e?document.querySelector(e):e},handleEvent:function(e){let t="on"+e.type;this[t]&&this[t](e)},filterFindElements:function(e,r){return(e=t.makeArray(e)).filter((e=>e instanceof HTMLElement)).reduce(((e,t)=>{if(!r)return e.push(t),e;t.matches(r)&&e.push(t);let n=t.querySelectorAll(r);return e=e.concat(...n)}),[])},debounceMethod:function(e,t,r){r=r||100;let n=e.prototype[t],i=t+"Timeout";e.prototype[t]=function(){clearTimeout(this[i]);let e=arguments;this[i]=setTimeout((()=>{n.apply(this,e),delete this[i]}),r)}},docReady:function(e){let t=document.readyState;"complete"==t||"interactive"==t?setTimeout(e):document.addEventListener("DOMContentLoaded",e)},toDashed:function(e){return e.replace(/(.)([A-Z])/g,(function(e,t,r){return t+"-"+r})).toLowerCase()}},r=e.console;return t.htmlInit=function(n,i){t.docReady((function(){let s="data-"+t.toDashed(i),a=document.querySelectorAll(`[${s}]`),o=e.jQuery;[...a].forEach((e=>{let t,a=e.getAttribute(s);try{t=a&&JSON.parse(a)}catch(t){return void(r&&r.error(`Error parsing ${s} on ${e.className}: ${t}`))}let l=new n(e,t);o&&o.data(e,i,l)}))}))},t}))}(sr)),sr.exports}function or(){return ir||(ir=1,function(e){!function(t,r){e.exports?e.exports=r(t,rr(),ar()):t.InfiniteScroll=r(t,t.EvEmitter,t.fizzyUIUtils)}(window,(function(e,t,r){let n=e.jQuery,i={};function s(e,t){let a=r.getQueryElement(e);if(a){if((e=a).infiniteScrollGUID){let r=i[e.infiniteScrollGUID];return r.option(t),r}this.element=e,this.options={...s.defaults},this.option(t),n&&(this.$element=n(this.element)),this.create()}else console.error("Bad element for InfiniteScroll: "+(a||e))}s.defaults={},s.create={},s.destroy={};let a=s.prototype;Object.assign(a,t.prototype);let o=0;a.create=function(){let e=this.guid=++o;if(this.element.infiniteScrollGUID=e,i[e]=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 e in s.create)s.create[e].call(this)}else console.error("Disabling InfiniteScroll")},a.option=function(e){Object.assign(this.options,e)},a.callOnInit=function(){let e=this.options.onInit;e&&e.call(this,this)},a.dispatchEvent=function(e,t,r){this.log(e,r);let i=t?[t].concat(r):r;if(this.emitEvent(e,i),!n||!this.$element)return;let s=e+=".infiniteScroll";if(t){let r=n.Event(t);r.type=e,s=r}this.$element.trigger(s,r)};let l={initialized:e=>`on ${e}`,request:e=>`URL: ${e}`,load:(e,t)=>`${e.title||""}. URL: ${t}`,error:(e,t)=>`${e}. URL: ${t}`,append:(e,t,r)=>`${r.length} items. URL: ${t}`,last:(e,t)=>`URL: ${t}`,history:(e,t)=>`URL: ${t}`,pageIndex:function(e,t){return`current page determined to be: ${e} from ${t}`}};a.log=function(e,t){if(!this.options.debug)return;let r=`[InfiniteScroll] ${e}`,n=l[e];n&&(r+=". "+n.apply(this,t)),console.log(r)},a.updateMeasurements=function(){this.windowHeight=e.innerHeight;let t=this.element.getBoundingClientRect();this.top=t.top+e.scrollY},a.updateScroller=function(){let t=this.options.elementScroll;if(t){if(this.scroller=!0===t?this.element:r.getQueryElement(t),!this.scroller)throw new Error(`Unable to find elementScroll: ${t}`)}else this.scroller=e},a.updateGetPath=function(){let e=this.options.path;if(!e)return void console.error(`InfiniteScroll path option required. Set as: ${e}`);let t=typeof e;"function"!=t?"string"==t&&e.match("{{#}}")?this.updateGetPathTemplate(e):this.updateGetPathSelector(e):this.getPath=e},a.updateGetPathTemplate=function(e){this.getPath=()=>{let t=this.pageIndex+1;return e.replace("{{#}}",t)};let t=e.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)"),r=new RegExp(t),n=location.href.match(r);n&&(this.pageIndex=parseInt(n[1],10),this.log("pageIndex",[this.pageIndex,"template string"]))};let c=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/],u=s.getPathParts=function(e){if(e)for(let t of c){let r=e.match(t);if(r){let[,e,t,n]=r;return{begin:e,index:t,end:n}}}};a.updateGetPathSelector=function(e){let t=document.querySelector(e);if(!t)return void console.error(`Bad InfiniteScroll path option. Next link not found: ${e}`);let r=t.getAttribute("href"),n=u(r);if(!n)return void console.error(`InfiniteScroll unable to parse next link href: ${r}`);let{begin:i,index:s,end:a}=n;this.isPathSelector=!0,this.getPath=()=>i+(this.pageIndex+1)+a,this.pageIndex=parseInt(s,10)-1,this.log("pageIndex",[this.pageIndex,"next link"])},a.updateGetAbsolutePath=function(){let e=this.getPath();if(e.match(/^http/)||e.match(/^\//))return void(this.getAbsolutePath=this.getPath);let{pathname:t}=location,r=e.match(/^\?/),n=t.substring(0,t.lastIndexOf("/")),i=r?t:n+"/";this.getAbsolutePath=()=>i+this.getPath()},s.create.hideNav=function(){let e=r.getQueryElement(this.options.hideNav);e&&(e.style.display="none",this.nav=e)},s.destroy.hideNav=function(){this.nav&&(this.nav.style.display="")},a.destroy=function(){this.allOff();for(let e in s.destroy)s.destroy[e].call(this);delete this.element.infiniteScrollGUID,delete i[this.guid],n&&this.$element&&n.removeData(this.element,"infiniteScroll")},s.throttle=function(e,t){let r,n;return t=t||200,function(){let i=+new Date,s=arguments,a=()=>{r=i,e.apply(this,s)};r&&i<r+t?(clearTimeout(n),n=setTimeout(a,t)):a()}},s.data=function(e){let t=(e=r.getQueryElement(e))&&e.infiniteScrollGUID;return t&&i[t]},s.setJQuery=function(e){n=e},r.htmlInit(s,"infinite-scroll"),a._init=function(){};let{jQueryBridget:h}=e;return n&&h&&h("infiniteScroll",s,n),s}))}(er)),er.exports}var lr,cr={exports:{}};function ur(){return lr||(lr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or()):r(t,t.InfiniteScroll)}(window,(function(e,t){let r=t.prototype;Object.assign(t.defaults,{loadOnScroll:!0,checkLastPage:!0,responseBody:"text",domParseResponse:!0}),t.create.pageLoad=function(){this.canLoad=!0,this.on("scrollThreshold",this.onScrollThresholdLoad),this.on("load",this.checkLastPage),this.options.outlayer&&this.on("append",this.onAppendOutlayer)},r.onScrollThresholdLoad=function(){this.options.loadOnScroll&&this.loadNextPage()};let n=new DOMParser;function i(e){let t=document.createDocumentFragment();return e&&t.append(...e),t}return r.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:e,domParseResponse:t,fetchOptions:r}=this.options,i=this.getAbsolutePath();this.isLoading=!0,"function"==typeof r&&(r=r());let s=fetch(i,r).then((r=>{if(!r.ok){let e=new Error(r.statusText);return this.onPageError(e,i,r),{response:r}}return r[e]().then((s=>("text"==e&&t&&(s=n.parseFromString(s,"text/html")),204==r.status?(this.lastPageReached(s,i),{body:s,response:r}):this.onPageLoad(s,i,r))))})).catch((e=>{this.onPageError(e,i)}));return this.dispatchEvent("request",null,[i,s]),s},r.onPageLoad=function(e,t,r){return this.options.append||(this.isLoading=!1),this.pageIndex++,this.loadCount++,this.dispatchEvent("load",null,[e,t,r]),this.appendNextPage(e,t,r)},r.appendNextPage=function(e,t,r){let{append:n,responseBody:s,domParseResponse:a}=this.options;if(!("text"==s&&a)||!n)return{body:e,response:r};let o=e.querySelectorAll(n),l={body:e,response:r,items:o};if(!o||!o.length)return this.lastPageReached(e,t),l;let c=i(o),u=()=>(this.appendItems(o,c),this.isLoading=!1,this.dispatchEvent("append",null,[e,t,o,r]),l);return this.options.outlayer?this.appendOutlayerItems(c,u):u()},r.appendItems=function(e,t){e&&e.length&&(function(e){let t=e.querySelectorAll("script");for(let e of t){let t=document.createElement("script"),r=e.attributes;for(let e of r)t.setAttribute(e.name,e.value);t.innerHTML=e.innerHTML,e.parentNode.replaceChild(t,e)}}(t=t||i(e)),this.element.appendChild(t))},r.appendOutlayerItems=function(r,n){let i=t.imagesLoaded||e.imagesLoaded;return i?new Promise((function(e){i(r,(function(){let t=n();e(t)}))})):(console.error("[InfiniteScroll] imagesLoaded required for outlayer option"),void(this.isLoading=!1))},r.onAppendOutlayer=function(e,t,r){this.options.outlayer.appended(r)},r.checkLastPage=function(e,t){let r,{checkLastPage:n,path:i}=this.options;if(n){if("function"==typeof i){if(!this.getPath())return void this.lastPageReached(e,t)}"string"==typeof n?r=n:this.isPathSelector&&(r=i),r&&e.querySelector&&(e.querySelector(r)||this.lastPageReached(e,t))}},r.lastPageReached=function(e,t){this.canLoad=!1,this.dispatchEvent("last",null,[e,t])},r.onPageError=function(e,t,r){return this.isLoading=!1,this.canLoad=!1,this.dispatchEvent("error",null,[e,t,r]),e},t.create.prefill=function(){if(!this.options.prefill)return;let e=this.options.append;e?(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 :${e}`)},r.prefill=function(){let e=this.getPrefillDistance();this.isPrefilling=e>=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},r.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},r.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},t}))}(cr)),cr.exports}var hr,dr={exports:{}};function fr(){return hr||(hr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or(),ar()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;return Object.assign(t.defaults,{scrollThreshold:400}),t.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);let e=this.options.scrollThreshold;(e||0===e)&&this.enableScrollWatch()},t.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(t){let r=t?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.pageScrollHandler),e[r]("resize",this.resizeHandler)},n.onPageScroll=t.throttle((function(){this.getBottomDistance()<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")})),n.getBottomDistance=function(){let t,r;return this.options.elementScroll?(t=this.scroller.scrollHeight,r=this.scroller.scrollTop+this.scroller.clientHeight):(t=this.top+this.element.clientHeight,r=e.scrollY+this.windowHeight),t-r},n.onResize=function(){this.updateMeasurements()},r.debounceMethod(t,"onResize",150),t}))}(dr)),dr.exports}var pr,gr={exports:{}};function mr(){return pr||(pr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or(),ar()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;Object.assign(t.defaults,{history:"replace"});let i=document.createElement("a");return t.create.history=function(){if(!this.options.history)return;i.href=this.getAbsolutePath(),(i.origin||i.protocol+"//"+i.host)==location.origin?this.options.append?this.createHistoryAppend():this.createHistoryPageLoad():console.error(`[InfiniteScroll] cannot set history with different origin: ${i.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(t){let r=t?"addEventListener":"removeEventListener";this.scroller[r]("scroll",this.scrollHistoryHandler),e[r]("unload",this.unloadHandler)},n.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},t.destroy.history=n.destroyHistory=function(){this.options.history&&this.options.append&&this.bindHistoryAppendEvents(!1)},n.onAppendHistory=function(e,t,r){if(!r||!r.length)return;let n=r[0],s=this.getElementScrollY(n);i.href=t,this.scrollPages.push({top:s,path:i.href,title:e.title})},n.getElementScrollY=function(t){if(this.options.elementScroll)return t.offsetTop-this.top;return t.getBoundingClientRect().top+e.scrollY},n.onScrollHistory=function(){let e=this.getClosestScrollPage();e!=this.scrollPage&&(this.scrollPage=e,this.setHistory(e.title,e.path))},r.debounceMethod(t,"onScrollHistory",150),n.getClosestScrollPage=function(){let t,r;t=this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:e.scrollY+this.windowHeight/2;for(let e of this.scrollPages){if(e.top>=t)break;r=e}return r},n.setHistory=function(e,t){let r=this.options.history;r&&history[r+"State"]&&(history[r+"State"](null,e,t),this.options.historyTitle&&(document.title=e),this.dispatchEvent("history",null,[e,t]))},n.onUnload=function(){if(0===this.scrollPage.top)return;let t=e.scrollY-this.scrollPage.top+this.top;this.destroyHistory(),scrollTo(0,t)},n.onPageLoadHistory=function(e,t){this.setHistory(e.title,t)},t}))}(gr)),gr.exports}var vr,yr={exports:{}};function br(){return vr||(vr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or(),ar()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){class n{constructor(e,t){this.element=e,this.infScroll=t,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),t.on("request",this.disable.bind(this)),t.on("load",this.enable.bind(this)),t.on("error",this.hide.bind(this)),t.on("last",this.hide.bind(this))}onClick(e){e.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 t.create.button=function(){let e=r.getQueryElement(this.options.button);e&&(this.button=new n(e,this))},t.destroy.button=function(){this.button&&this.button.destroy()},t.Button=n,t}))}(yr)),yr.exports}var wr,_r={exports:{}};function Er(){return wr||(wr=1,function(e){!function(t,r){e.exports?e.exports=r(t,or(),ar()):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,r){let n=t.prototype;function i(e){a(e,"none")}function s(e){a(e,"block")}function a(e,t){e&&(e.style.display=t)}return t.create.status=function(){let e=r.getQueryElement(this.options.status);e&&(this.statusElement=e,this.statusEventElements={request:e.querySelector(".infinite-scroll-request"),error:e.querySelector(".infinite-scroll-error"),last:e.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},n.bindHideStatus=function(e){let t=this.options.append?"append":"load";this[e](t,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(e){s(this.statusElement),this.hideStatusEventElements(),s(this.statusEventElements[e])},n.hideAllStatus=function(){i(this.statusElement),this.hideStatusEventElements()},n.hideStatusEventElements=function(){for(let e in this.statusEventElements){i(this.statusEventElements[e])}},t}))}(_r)),_r.exports}
|
|
9
9
|
/*!
|
|
10
10
|
* Infinite Scroll v4.0.1
|
|
11
11
|
* Automatically add next page
|