@salla.sa/twilight-components 2.14.141 → 2.14.142

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.
@@ -21,5 +21,5 @@ var __extends=this&&this.__extends||function(){var e=function(t,n){e=Object.setP
21
21
  * @site https://github.com/rmariuzzo/Lang.js
22
22
  * @author Rubens Mariuzzo <rubens@mariuzzo.com>
23
23
  */
24
- (function(t,n){{e.exports=n()}})(t,(function(){function e(){if(typeof document!=="undefined"&&document.documentElement){return document.documentElement.lang}}function t(e){if(e==="-Inf"){return-Infinity}else if(e==="+Inf"||e==="Inf"||e==="*"){return Infinity}return parseInt(e,10)}var n=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/;var r=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/;var i={locale:"en"};var o=function(t){t=t||{};this.locale=t.locale||e()||i.locale;this.fallback=t.fallback;this.messages=t.messages};o.prototype.setMessages=function(e){this.messages=e};o.prototype.getLocale=function(){return this.locale||this.fallback};o.prototype.setLocale=function(e){this.locale=e};o.prototype.getFallback=function(){return this.fallback};o.prototype.setFallback=function(e){this.fallback=e};o.prototype.has=function(e,t){if(typeof e!=="string"||!this.messages){return false}return this._getMessage(e,t)!==null};o.prototype.get=function(e,t,n){if(!this.has(e,n)){return e}var r=this._getMessage(e,n);if(r===null){return e}if(t){r=this._applyReplacements(r,t)}return r};o.prototype.trans=function(e,t){return this.get(e,t)};o.prototype.choice=function(e,t,n,i){n=typeof n!=="undefined"?n:{};n.count=t;var o=this.get(e,n,i);if(o===null||o===undefined){return o}var a=o.split("|");var s=[];for(var c=0;c<a.length;c++){a[c]=a[c].trim();if(r.test(a[c])){var l=a[c].split(/\s/);s.push(l.shift());a[c]=l.join(" ")}}if(a.length===1){return o}for(var u=0;u<s.length;u++){if(this._testInterval(t,s[u])){return a[u]}}i=i||this._getLocale(e);var d=this._getPluralForm(t,i);return a[d]};o.prototype.transChoice=function(e,t,n){return this.choice(e,t,n)};o.prototype._parseKey=function(e,t){if(typeof e!=="string"||typeof t!=="string"){return null}var n=e.split(".");var r=n[0].replace(/\//g,".");return{source:t+"."+r,sourceFallback:this.getFallback()+"."+r,entries:n.slice(1)}};o.prototype._getMessage=function(e,t){t=t||this.getLocale();e=this._parseKey(e,t);if(this.messages[e.source]===undefined&&this.messages[e.sourceFallback]===undefined){return null}var n=this.messages[e.source];var r=e.entries.slice();var i=r.join(".");n=n!==undefined?this._getValueInKey(n,i):undefined;if(typeof n!=="string"&&this.messages[e.sourceFallback]){n=this.messages[e.sourceFallback];r=e.entries.slice();i="";while(r.length&&n!==undefined){var i=!i?r.shift():i.concat(".",r.shift());if(n[i]){n=n[i];i=""}}}if(typeof n!=="string"){return null}return n};o.prototype._getValueInKey=function(e,t){if(typeof e[t]==="string"){return e[t]}t=t.replace(/\[(\w+)\]/g,".$1");t=t.replace(/^\./,"");var n=t.split(".");for(var r=0,i=n.length;r<i;++r){var o=n.slice(0,r+1).join(".");var a=n.slice(r+1,n.length).join(".");if(e[o]){return this._getValueInKey(e[o],a)}}return e};o.prototype._getLocale=function(e){e=this._parseKey(e,this.locale);if(this.messages[e.source]){return this.locale}if(this.messages[e.sourceFallback]){return this.fallback}return null};o.prototype._findMessageInTree=function(e,t){while(e.length&&t!==undefined){var n=e.join(".");if(t[n]){t=t[n];break}t=t[e.shift()]}return t};o.prototype._sortReplacementKeys=function(e,t){return t.length-e.length};o.prototype._applyReplacements=function(e,t){var n=Object.keys(t).sort(this._sortReplacementKeys);n.forEach((function(n){e=e.replace(new RegExp(":"+n,"gi"),(function(e){var r=t[n];var i=e===e.toUpperCase();if(i){return r.toUpperCase()}var o=e===e.replace(/\w/i,(function(e){return e.toUpperCase()}));if(o){return r.charAt(0).toUpperCase()+r.slice(1)}return r}))}));return e};o.prototype._testInterval=function(e,r){if(typeof r!=="string"){throw"Invalid interval: should be a string."}r=r.trim();var i=r.match(n);if(!i){throw"Invalid interval: "+r}if(i[2]){var o=i[2].split(",");for(var a=0;a<o.length;a++){if(parseInt(o[a],10)===e){return true}}}else{i=i.filter((function(e){return!!e}));var s=i[1];var c=t(i[2]);if(c===Infinity){c=-Infinity}var l=t(i[3]);var u=i[4];return(s==="["?e>=c:e>c)&&(u==="]"?e<=l:e<l)}return false};o.prototype._getPluralForm=function(e,t){switch(t){case"az":case"bo":case"dz":case"id":case"ja":case"jv":case"ka":case"km":case"kn":case"ko":case"ms":case"th":case"tr":case"vi":case"zh":return 0;case"af":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"ur":case"zu":return e==1?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"hy":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return e===0||e===1?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2;case"cs":case"sk":return e==1?0:e>=2&&e<=4?1:2;case"ga":return e==1?0:e==2?1:2;case"lt":return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2;case"sl":return e%100==1?0:e%100==2?1:e%100==3||e%100==4?2:3;case"mk":return e%10==1?0:1;case"mt":return e==1?0:e===0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3;case"lv":return e===0?0:e%10==1&&e%100!=11?1:2;case"pl":return e==1?0:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?1:2;case"cy":return e==1?0:e==2?1:e==8||e==11?2:3;case"ro":return e==1?0:e===0||e%100>0&&e%100<20?1:2;case"ar":return e===0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5;default:return 0}};return o}))}));var Ur=function e(t,n){return function e(){var r=new Array(arguments.length);for(var i=0;i<r.length;i++){r[i]=arguments[i]}return t.apply(n,r)}};var Dr=Object.prototype.toString;var Mr=function(e){return function(t){var n=Dr.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())}}(Object.create(null));function Br(e){e=e.toLowerCase();return function t(n){return Mr(n)===e}}function Hr(e){return Array.isArray(e)}function Gr(e){return typeof e==="undefined"}function Jr(e){return e!==null&&!Gr(e)&&e.constructor!==null&&!Gr(e.constructor)&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)}var Vr=Br("ArrayBuffer");function Wr(e){var t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&Vr(e.buffer)}return t}function $r(e){return typeof e==="string"}function Qr(e){return typeof e==="number"}function Kr(e){return e!==null&&typeof e==="object"}function Xr(e){if(Mr(e)!=="object"){return false}var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var Yr=Br("Date");var Zr=Br("File");var ei=Br("Blob");var ti=Br("FileList");function ni(e){return Dr.call(e)==="[object Function]"}function ri(e){return Kr(e)&&ni(e.pipe)}function ii(e){var t="[object FormData]";return e&&(typeof FormData==="function"&&e instanceof FormData||Dr.call(e)===t||ni(e.toString)&&e.toString()===t)}var oi=Br("URLSearchParams");function ai(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function si(){if(typeof navigator!=="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")){return false}return typeof window!=="undefined"&&typeof document!=="undefined"}function ci(e,t){if(e===null||typeof e==="undefined"){return}if(typeof e!=="object"){e=[e]}if(Hr(e)){for(var n=0,r=e.length;n<r;n++){t.call(null,e[n],n,e)}}else{for(var i in e){if(Object.prototype.hasOwnProperty.call(e,i)){t.call(null,e[i],i,e)}}}}function li(){var e={};function t(t,n){if(Xr(e[n])&&Xr(t)){e[n]=li(e[n],t)}else if(Xr(t)){e[n]=li({},t)}else if(Hr(t)){e[n]=t.slice()}else{e[n]=t}}for(var n=0,r=arguments.length;n<r;n++){ci(arguments[n],t)}return e}function ui(e,t,n){ci(t,(function t(r,i){if(n&&typeof r==="function"){e[i]=Ur(r,n)}else{e[i]=r}}));return e}function di(e){if(e.charCodeAt(0)===65279){e=e.slice(1)}return e}function fi(e,t,n,r){e.prototype=Object.create(t.prototype,r);e.prototype.constructor=e;n&&Object.assign(e.prototype,n)}function pi(e,t,n){var r;var i;var o;var a={};t=t||{};do{r=Object.getOwnPropertyNames(e);i=r.length;while(i-- >0){o=r[i];if(!a[o]){t[o]=e[o];a[o]=true}}e=Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t}function hi(e,t,n){e=String(e);if(n===undefined||n>e.length){n=e.length}n-=t.length;var r=e.indexOf(t,n);return r!==-1&&r===n}function vi(e){if(!e)return null;var t=e.length;if(Gr(t))return null;var n=new Array(t);while(t-- >0){n[t]=e[t]}return n}var gi=function(e){return function(t){return e&&t instanceof e}}(typeof Uint8Array!=="undefined"&&Object.getPrototypeOf(Uint8Array));var mi={isArray:Hr,isArrayBuffer:Vr,isBuffer:Jr,isFormData:ii,isArrayBufferView:Wr,isString:$r,isNumber:Qr,isObject:Kr,isPlainObject:Xr,isUndefined:Gr,isDate:Yr,isFile:Zr,isBlob:ei,isFunction:ni,isStream:ri,isURLSearchParams:oi,isStandardBrowserEnv:si,forEach:ci,merge:li,extend:ui,trim:ai,stripBOM:di,inherits:fi,toFlatObject:pi,kindOf:Mr,kindOfTest:Br,endsWith:hi,toArray:vi,isTypedArray:gi,isFileList:ti};function yi(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var bi=function e(t,n,r){if(!n){return t}var i;if(r){i=r(n)}else if(mi.isURLSearchParams(n)){i=n.toString()}else{var o=[];mi.forEach(n,(function e(t,n){if(t===null||typeof t==="undefined"){return}if(mi.isArray(t)){n=n+"[]"}else{t=[t]}mi.forEach(t,(function e(t){if(mi.isDate(t)){t=t.toISOString()}else if(mi.isObject(t)){t=JSON.stringify(t)}o.push(yi(n)+"="+yi(t))}))}));i=o.join("&")}if(i){var a=t.indexOf("#");if(a!==-1){t=t.slice(0,a)}t+=(t.indexOf("?")===-1?"?":"&")+i}return t};function wi(){this.handlers=[]}wi.prototype.use=function e(t,n,r){this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:false,runWhen:r?r.runWhen:null});return this.handlers.length-1};wi.prototype.eject=function e(t){if(this.handlers[t]){this.handlers[t]=null}};wi.prototype.forEach=function e(t){mi.forEach(this.handlers,(function e(n){if(n!==null){t(n)}}))};var _i=wi;var Si=function e(t,n){mi.forEach(t,(function e(r,i){if(i!==n&&i.toUpperCase()===n.toUpperCase()){t[n]=r;delete t[i]}}))};function ki(e,t,n,r,i){Error.call(this);this.message=e;this.name="AxiosError";t&&(this.code=t);n&&(this.config=n);r&&(this.request=r);i&&(this.response=i)}mi.inherits(ki,Error,{toJSON:function e(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Ei=ki.prototype;var xi={};["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){xi[e]={value:e}}));Object.defineProperties(ki,xi);Object.defineProperty(Ei,"isAxiosError",{value:true});ki.from=function(e,t,n,r,i,o){var a=Object.create(Ei);mi.toFlatObject(e,a,(function e(t){return t!==Error.prototype}));ki.call(a,e.message,t,n,r,i);a.name=e.name;o&&Object.assign(a,o);return a};var Ii=ki;var ji={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};function Pi(e,t){t=t||new FormData;var n=[];function r(e){if(e===null)return"";if(mi.isDate(e)){return e.toISOString()}if(mi.isArrayBuffer(e)||mi.isTypedArray(e)){return typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function i(e,o){if(mi.isPlainObject(e)||mi.isArray(e)){if(n.indexOf(e)!==-1){throw Error("Circular reference detected in "+o)}n.push(e);mi.forEach(e,(function e(n,a){if(mi.isUndefined(n))return;var s=o?o+"."+a:a;var c;if(n&&!o&&typeof n==="object"){if(mi.endsWith(a,"{}")){n=JSON.stringify(n)}else if(mi.endsWith(a,"[]")&&(c=mi.toArray(n))){c.forEach((function(e){!mi.isUndefined(e)&&t.append(s,r(e))}));return}}i(n,s)}));n.pop()}else{t.append(o,r(e))}}i(e);return t}var Oi=Pi;var Ai=function e(t,n,r){var i=r.config.validateStatus;if(!r.status||!i||i(r.status)){t(r)}else{n(new Ii("Request failed with status code "+r.status,[Ii.ERR_BAD_REQUEST,Ii.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}};var Ci=mi.isStandardBrowserEnv()?function e(){return{write:function e(t,n,r,i,o,a){var s=[];s.push(t+"="+encodeURIComponent(n));if(mi.isNumber(r)){s.push("expires="+new Date(r).toGMTString())}if(mi.isString(i)){s.push("path="+i)}if(mi.isString(o)){s.push("domain="+o)}if(a===true){s.push("secure")}document.cookie=s.join("; ")},read:function e(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function e(t){this.write(t,"",Date.now()-864e5)}}}():function e(){return{write:function e(){},read:function e(){return null},remove:function e(){}}}();var Ti=function e(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)};var Fi=function e(t,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t};var Li=function e(t,n){if(t&&!Ti(n)){return Fi(t,n)}return n};var Ri=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];var Ni=function e(t){var n={};var r;var i;var o;if(!t){return n}mi.forEach(t.split("\n"),(function e(t){o=t.indexOf(":");r=mi.trim(t.substr(0,o)).toLowerCase();i=mi.trim(t.substr(o+1));if(r){if(n[r]&&Ri.indexOf(r)>=0){return}if(r==="set-cookie"){n[r]=(n[r]?n[r]:[]).concat([i])}else{n[r]=n[r]?n[r]+", "+i:i}}}));return n};var zi=mi.isStandardBrowserEnv()?function e(){var t=/(msie|trident)/i.test(navigator.userAgent);var n=document.createElement("a");var r;function i(e){var r=e;if(t){n.setAttribute("href",r);r=n.href}n.setAttribute("href",r);return{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}}r=i(window.location.href);return function e(t){var n=mi.isString(t)?i(t):t;return n.protocol===r.protocol&&n.host===r.host}}():function e(){return function e(){return true}}();function qi(e){Ii.call(this,e==null?"canceled":e,Ii.ERR_CANCELED);this.name="CanceledError"}mi.inherits(qi,Ii,{__CANCEL__:true});var Ui=qi;var Di=function e(t){var n=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return n&&n[1]||""};var Mi=function e(t){return new Promise((function e(n,r){var i=t.data;var o=t.headers;var a=t.responseType;var s;function c(){if(t.cancelToken){t.cancelToken.unsubscribe(s)}if(t.signal){t.signal.removeEventListener("abort",s)}}if(mi.isFormData(i)&&mi.isStandardBrowserEnv()){delete o["Content-Type"]}var l=new XMLHttpRequest;if(t.auth){var u=t.auth.username||"";var d=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(u+":"+d)}var f=Li(t.baseURL,t.url);l.open(t.method.toUpperCase(),bi(f,t.params,t.paramsSerializer),true);l.timeout=t.timeout;function p(){if(!l){return}var e="getAllResponseHeaders"in l?Ni(l.getAllResponseHeaders()):null;var i=!a||a==="text"||a==="json"?l.responseText:l.response;var o={data:i,status:l.status,statusText:l.statusText,headers:e,config:t,request:l};Ai((function e(t){n(t);c()}),(function e(t){r(t);c()}),o);l=null}if("onloadend"in l){l.onloadend=p}else{l.onreadystatechange=function e(){if(!l||l.readyState!==4){return}if(l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)){return}setTimeout(p)}}l.onabort=function e(){if(!l){return}r(new Ii("Request aborted",Ii.ECONNABORTED,t,l));l=null};l.onerror=function e(){r(new Ii("Network Error",Ii.ERR_NETWORK,t,l,l));l=null};l.ontimeout=function e(){var n=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";var i=t.transitional||ji;if(t.timeoutErrorMessage){n=t.timeoutErrorMessage}r(new Ii(n,i.clarifyTimeoutError?Ii.ETIMEDOUT:Ii.ECONNABORTED,t,l));l=null};if(mi.isStandardBrowserEnv()){var h=(t.withCredentials||zi(f))&&t.xsrfCookieName?Ci.read(t.xsrfCookieName):undefined;if(h){o[t.xsrfHeaderName]=h}}if("setRequestHeader"in l){mi.forEach(o,(function e(t,n){if(typeof i==="undefined"&&n.toLowerCase()==="content-type"){delete o[n]}else{l.setRequestHeader(n,t)}}))}if(!mi.isUndefined(t.withCredentials)){l.withCredentials=!!t.withCredentials}if(a&&a!=="json"){l.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){l.addEventListener("progress",t.onDownloadProgress)}if(typeof t.onUploadProgress==="function"&&l.upload){l.upload.addEventListener("progress",t.onUploadProgress)}if(t.cancelToken||t.signal){s=function(e){if(!l){return}r(!e||e&&e.type?new Ui:e);l.abort();l=null};t.cancelToken&&t.cancelToken.subscribe(s);if(t.signal){t.signal.aborted?s():t.signal.addEventListener("abort",s)}}if(!i){i=null}var v=Di(f);if(v&&["http","https","file"].indexOf(v)===-1){r(new Ii("Unsupported protocol "+v+":",Ii.ERR_BAD_REQUEST,t));return}l.send(i)}))};var Bi=null;var Hi={"Content-Type":"application/x-www-form-urlencoded"};function Gi(e,t){if(!mi.isUndefined(e)&&mi.isUndefined(e["Content-Type"])){e["Content-Type"]=t}}function Ji(){var e;if(typeof XMLHttpRequest!=="undefined"){e=Mi}else if(typeof process!=="undefined"&&Object.prototype.toString.call(process)==="[object process]"){e=Mi}return e}function Vi(e,t,n){if(mi.isString(e)){try{(t||JSON.parse)(e);return mi.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(n||JSON.stringify)(e)}var Wi={transitional:ji,adapter:Ji(),transformRequest:[function e(t,n){Si(n,"Accept");Si(n,"Content-Type");if(mi.isFormData(t)||mi.isArrayBuffer(t)||mi.isBuffer(t)||mi.isStream(t)||mi.isFile(t)||mi.isBlob(t)){return t}if(mi.isArrayBufferView(t)){return t.buffer}if(mi.isURLSearchParams(t)){Gi(n,"application/x-www-form-urlencoded;charset=utf-8");return t.toString()}var r=mi.isObject(t);var i=n&&n["Content-Type"];var o;if((o=mi.isFileList(t))||r&&i==="multipart/form-data"){var a=this.env&&this.env.FormData;return Oi(o?{"files[]":t}:t,a&&new a)}else if(r||i==="application/json"){Gi(n,"application/json");return Vi(t)}return t}],transformResponse:[function e(t){var n=this.transitional||Wi.transitional;var r=n&&n.silentJSONParsing;var i=n&&n.forcedJSONParsing;var o=!r&&this.responseType==="json";if(o||i&&mi.isString(t)&&t.length){try{return JSON.parse(t)}catch(e){if(o){if(e.name==="SyntaxError"){throw Ii.from(e,Ii.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bi},validateStatus:function e(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};mi.forEach(["delete","get","head"],(function e(t){Wi.headers[t]={}}));mi.forEach(["post","put","patch"],(function e(t){Wi.headers[t]=mi.merge(Hi)}));var $i=Wi;var Qi=function e(t,n,r){var i=this||$i;mi.forEach(r,(function e(r){t=r.call(i,t,n)}));return t};var Ki=function e(t){return!!(t&&t.__CANCEL__)};function Xi(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new Ui}}var Yi=function e(t){Xi(t);t.headers=t.headers||{};t.data=Qi.call(t,t.data,t.headers,t.transformRequest);t.headers=mi.merge(t.headers.common||{},t.headers[t.method]||{},t.headers);mi.forEach(["delete","get","head","post","put","patch","common"],(function e(n){delete t.headers[n]}));var n=t.adapter||$i.adapter;return n(t).then((function e(n){Xi(t);n.data=Qi.call(t,n.data,n.headers,t.transformResponse);return n}),(function e(n){if(!Ki(n)){Xi(t);if(n&&n.response){n.response.data=Qi.call(t,n.response.data,n.response.headers,t.transformResponse)}}return Promise.reject(n)}))};var Zi=function e(t,n){n=n||{};var r={};function i(e,t){if(mi.isPlainObject(e)&&mi.isPlainObject(t)){return mi.merge(e,t)}else if(mi.isPlainObject(t)){return mi.merge({},t)}else if(mi.isArray(t)){return t.slice()}return t}function o(e){if(!mi.isUndefined(n[e])){return i(t[e],n[e])}else if(!mi.isUndefined(t[e])){return i(undefined,t[e])}}function a(e){if(!mi.isUndefined(n[e])){return i(undefined,n[e])}}function s(e){if(!mi.isUndefined(n[e])){return i(undefined,n[e])}else if(!mi.isUndefined(t[e])){return i(undefined,t[e])}}function c(e){if(e in n){return i(t[e],n[e])}else if(e in t){return i(undefined,t[e])}}var l={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c};mi.forEach(Object.keys(t).concat(Object.keys(n)),(function e(t){var n=l[t]||o;var i=n(t);mi.isUndefined(i)&&n!==c||(r[t]=i)}));return r};var eo={version:"0.27.2"};var to=eo.version;var no={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){no[e]=function n(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var ro={};no.transitional=function e(t,n,r){function i(e,t){return"[Axios v"+to+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(e,r,o){if(t===false){throw new Ii(i(r," has been removed"+(n?" in "+n:"")),Ii.ERR_DEPRECATED)}if(n&&!ro[r]){ro[r]=true;console.warn(i(r," has been deprecated since v"+n+" and will be removed in the near future"))}return t?t(e,r,o):true}};function io(e,t,n){if(typeof e!=="object"){throw new Ii("options must be an object",Ii.ERR_BAD_OPTION_VALUE)}var r=Object.keys(e);var i=r.length;while(i-- >0){var o=r[i];var a=t[o];if(a){var s=e[o];var c=s===undefined||a(s,o,e);if(c!==true){throw new Ii("option "+o+" must be "+c,Ii.ERR_BAD_OPTION_VALUE)}continue}if(n!==true){throw new Ii("Unknown option "+o,Ii.ERR_BAD_OPTION)}}}var oo={assertOptions:io,validators:no};var ao=oo.validators;function so(e){this.defaults=e;this.interceptors={request:new _i,response:new _i}}so.prototype.request=function e(t,n){if(typeof t==="string"){n=n||{};n.url=t}else{n=t||{}}n=Zi(this.defaults,n);if(n.method){n.method=n.method.toLowerCase()}else if(this.defaults.method){n.method=this.defaults.method.toLowerCase()}else{n.method="get"}var r=n.transitional;if(r!==undefined){oo.assertOptions(r,{silentJSONParsing:ao.transitional(ao.boolean),forcedJSONParsing:ao.transitional(ao.boolean),clarifyTimeoutError:ao.transitional(ao.boolean)},false)}var i=[];var o=true;this.interceptors.request.forEach((function e(t){if(typeof t.runWhen==="function"&&t.runWhen(n)===false){return}o=o&&t.synchronous;i.unshift(t.fulfilled,t.rejected)}));var a=[];this.interceptors.response.forEach((function e(t){a.push(t.fulfilled,t.rejected)}));var s;if(!o){var c=[Yi,undefined];Array.prototype.unshift.apply(c,i);c=c.concat(a);s=Promise.resolve(n);while(c.length){s=s.then(c.shift(),c.shift())}return s}var l=n;while(i.length){var u=i.shift();var d=i.shift();try{l=u(l)}catch(e){d(e);break}}try{s=Yi(l)}catch(e){return Promise.reject(e)}while(a.length){s=s.then(a.shift(),a.shift())}return s};so.prototype.getUri=function e(t){t=Zi(this.defaults,t);var n=Li(t.baseURL,t.url);return bi(n,t.params,t.paramsSerializer)};mi.forEach(["delete","get","head","options"],(function e(t){so.prototype[t]=function(e,n){return this.request(Zi(n||{},{method:t,url:e,data:(n||{}).data}))}}));mi.forEach(["post","put","patch"],(function e(t){function n(e){return function n(r,i,o){return this.request(Zi(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}so.prototype[t]=n();so.prototype[t+"Form"]=n(true)}));var co=so;function lo(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}var t;this.promise=new Promise((function e(n){t=n}));var n=this;this.promise.then((function(e){if(!n._listeners)return;var t;var r=n._listeners.length;for(t=0;t<r;t++){n._listeners[t](e)}n._listeners=null}));this.promise.then=function(e){var t;var r=new Promise((function(e){n.subscribe(e);t=e})).then(e);r.cancel=function e(){n.unsubscribe(t)};return r};e((function e(r){if(n.reason){return}n.reason=new Ui(r);t(n.reason)}))}lo.prototype.throwIfRequested=function e(){if(this.reason){throw this.reason}};lo.prototype.subscribe=function e(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}};lo.prototype.unsubscribe=function e(t){if(!this._listeners){return}var n=this._listeners.indexOf(t);if(n!==-1){this._listeners.splice(n,1)}};lo.source=function e(){var t;var n=new lo((function e(n){t=n}));return{token:n,cancel:t}};var uo=lo;var fo=function e(t){return function e(n){return t.apply(null,n)}};var po=function e(t){return mi.isObject(t)&&t.isAxiosError===true};function ho(e){var t=new co(e);var n=Ur(co.prototype.request,t);mi.extend(n,co.prototype,t);mi.extend(n,t);n.create=function t(n){return ho(Zi(e,n))};return n}var vo=ho($i);vo.Axios=co;vo.CanceledError=Ui;vo.CancelToken=uo;vo.isCancel=Ki;vo.VERSION=eo.version;vo.toFormData=Oi;vo.AxiosError=Ii;vo.Cancel=vo.CanceledError;vo.all=function e(t){return Promise.all(t)};vo.spread=fo;vo.isAxiosError=po;var go=vo;var mo=vo;go.default=mo;var yo=go;function bo(e){this.message=e}bo.prototype=new Error,bo.prototype.name="InvalidCharacterError";var wo="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new bo("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,o=0,a="";r=t.charAt(o++);~r&&(n=i%4?64*n+r:r,i++%4)?a+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function _o(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(wo(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return wo(t)}}function So(e){this.message=e}function ko(e,t){if("string"!=typeof e)throw new So("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(_o(e.split(".")[n]))}catch(e){throw new So("Invalid token specified: "+e.message)}}So.prototype=new Error,So.prototype.name="InvalidTokenError";function Eo(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:i;return e===i?n:e}var xo="undefined",Io="object",jo="any",Po="*",Oo="__";"undefined"!=typeof process?process:{};var Ao="undefined"!=typeof document;"undefined"!=typeof Deno&&void 0!==Deno.core;Ao&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function Co(e,t){return t.charAt(0)[e]()+t.slice(1)}var To=Co.bind(null,"toUpperCase"),Fo=Co.bind(null,"toLowerCase");function Lo(e){return Mo(e)?To("null"):"object"==typeof e?Vo(e):Object.prototype.toString.call(e).slice(8,-1)}function Ro(e,t){void 0===t&&(t=!0);var n=Lo(e);return t?Fo(n):n}function No(e,t){return typeof t===e}var zo=No.bind(null,"function"),qo=No.bind(null,"string"),Uo=No.bind(null,"undefined");var Do=No.bind(null,"boolean");No.bind(null,"symbol");function Mo(e){return null===e}function Bo(e){return"number"===Ro(e)&&!isNaN(e)}function Ho(e){return"array"===Ro(e)}function Go(e){if(!Jo(e))return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Jo(e){return e&&("object"==typeof e||null!==e)}function Vo(e){return zo(e.constructor)?e.constructor.name:null}function Wo(e){return e instanceof Error||qo(e.message)&&e.constructor&&Bo(e.constructor.stackTraceLimit)}function $o(e,t){if("object"!=typeof t||Mo(t))return!1;if(t instanceof e)return!0;var n=Ro(new e(""));if(Wo(t))for(;t;){if(Ro(t)===n)return!0;t=Object.getPrototypeOf(t)}return!1}$o.bind(null,TypeError);$o.bind(null,SyntaxError);function Qo(e,t){var n=e instanceof Element||e instanceof HTMLDocument;return n&&t?Ko(e,t):n}function Ko(e,t){return void 0===t&&(t=""),e&&e.nodeName===t.toUpperCase()}function Xo(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}Xo(Qo,"form");Xo(Qo,"button");Xo(Qo,"input");Xo(Qo,"select");function Yo(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Zo(e){return function(e){for(var t,n=Object.create(null),r=/([^&=]+)=?([^&]*)/g;t=r.exec(e);){var i=Yo(t[1]),o=Yo(t[2]);"[]"===i.substring(i.length-2)?(n[i=i.substring(0,i.length-2)]||(n[i]=[])).push(o):n[i]=""===o||o}for(var a in n){var s=a.split("[");s.length>1&&(ea(n,s.map((function(e){return e.replace(/[?[\]\\ ]/g,"")})),n[a]),delete n[a])}return n}(function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return Ao&&window.location.search.substring(1)}(e))}function ea(e,t,n){for(var r=t.length-1,i=0;i<r;++i){var o=t[i];if("__proto__"===o||"constructor"===o)break;o in e||(e[o]={}),e=e[o]}e[t[r]]=n}function ta(){for(var e="",t=0,n=4294967295*Math.random()|0;t++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&n;e+="-"==r||"4"==r?r:("x"==r?i:3&i|8).toString(16),n=t%8==0?4294967295*Math.random()|0:n>>4}return e}var na="global",ra=Oo+"global"+Oo,ia=typeof self===Io&&self.self===self&&self||typeof global===Io&&global.global===global&&global||void 0;function oa(e){return ia[ra][e]}function aa(e,t){return ia[ra][e]=t}function sa(e){delete ia[ra][e]}function ca(e,t,n){var r;try{if(ua(e)){var i=window[e];r=i[t].bind(i)}}catch(e){}return r||n}ia[ra]||(ia[ra]={});var la={};function ua(e){if(typeof la[e]!==xo)return la[e];try{var t=window[e];t.setItem(xo,xo),t.removeItem(xo)}catch(t){return la[e]=!1}return la[e]=!0}function da(){return da=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},da.apply(this,arguments)}var fa="function",pa="undefined",ha="@@redux/"+Math.random().toString(36),va=function(){return typeof Symbol===fa&&Symbol.observable||"@@observable"}(),ga=" != "+fa;function ma(e,t,n){var r;if(typeof t===fa&&typeof n===pa&&(n=t,t=void 0),typeof n!==pa){if(typeof n!==fa)throw new Error("enhancer"+ga);return n(ma)(e,t)}if(typeof e!==fa)throw new Error("reducer"+ga);var i=e,o=t,a=[],s=a,c=!1;function l(){s===a&&(s=a.slice())}function u(){return o}function d(e){if(typeof e!==fa)throw new Error("Listener"+ga);var t=!0;return l(),s.push(e),function(){if(t){t=!1,l();var n=s.indexOf(e);s.splice(n,1)}}}function f(e){if(!Go(e))throw new Error("Act != obj");if(typeof e.type===pa)throw new Error("ActType "+pa);if(c)throw new Error("Dispatch in reducer");try{c=!0,o=i(o,e)}finally{c=!1}for(var t=a=s,n=0;n<t.length;n++)(0,t[n])();return e}return f({type:"@@redux/INIT"}),(r={dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if(typeof e!==fa)throw new Error("next reducer"+ga);i=e,f({type:"@@redux/INIT"})}})[va]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e)throw new TypeError("Observer != obj");function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[va]=function(){return this},e},r}function ya(e,t){var n=t&&t.type;return"action "+(n&&n.toString()||"?")+"reducer "+e+" returns "+pa}function ba(){var e=[].slice.call(arguments);return 0===e.length?function(e){return e}:1===e.length?e[0]:e.reduce((function(e,t){return function(){return e(t.apply(void 0,[].slice.call(arguments)))}}))}function wa(){var e=arguments;return function(t){return function(n,r,i){var o,a=t(n,r,i),s=a.dispatch,c={getState:a.getState,dispatch:function(e){return s(e)}};return o=[].slice.call(e).map((function(e){return e(c)})),da({},a,{dispatch:s=ba.apply(void 0,o)(a.dispatch)})}}}var _a=Oo+"anon_id",Sa=Oo+"user_id",ka=Oo+"user_traits",Ea="userId",xa="anonymousId",Ia=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],ja=["name","EVENTS","config","loaded"],Pa=Ia.reduce((function(e,t){return e[t]=t,e}),{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Oa=/^utm_/,Aa=/^an_prop_/,Ca=/^an_trait_/;function Ta(e){var t=e.storage.setItem;return function(n){return function(r){return function(i){if(i.type===Pa.bootstrap){var o=i.params,a=i.user,s=i.persistedUser,c=i.initialUser,l=s.userId===a.userId;s.anonymousId!==a.anonymousId&&t(_a,a.anonymousId),l||t(Sa,a.userId),c.traits&&t(ka,da({},l&&s.traits?s.traits:{},c.traits));var u=Object.keys(i.params);if(u.length){var d=o.an_uid,f=o.an_event,p=u.reduce((function(e,t){if(t.match(Oa)||t.match(/^(d|g)clid/)){var n=t.replace(Oa,"");e.campaign["campaign"===n?"name":n]=o[t]}return t.match(Aa)&&(e.props[t.replace(Aa,"")]=o[t]),t.match(Ca)&&(e.traits[t.replace(Ca,"")]=o[t]),e}),{campaign:{},props:{},traits:{}});n.dispatch(da({type:Pa.params,raw:o},p,d?{userId:d}:{})),d&&setTimeout((function(){return e.identify(d,p.traits)}),0),f&&setTimeout((function(){return e.track(f,p.props)}),0),Object.keys(p.campaign).length&&n.dispatch({type:Pa.campaign,campaign:p.campaign})}}return r(i)}}}}function Fa(e){return function(t,n){if(void 0===t&&(t={}),void 0===n&&(n={}),n.type===Pa.setItemEnd){if(n.key===_a)return da({},t,{anonymousId:n.value});if(n.key===Sa)return da({},t,{userId:n.value})}switch(n.type){case Pa.identify:return Object.assign({},t,{userId:n.userId,traits:da({},t.traits,n.traits)});case Pa.reset:return[Sa,_a,ka].forEach((function(t){e.removeItem(t)})),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function La(e){return{userId:e.getItem(Sa),anonymousId:e.getItem(_a),traits:e.getItem(ka)}}var Ra=function(e){return Oo+"TEMP"+Oo+e};function Na(e){var t=e.storage,n=t.setItem,r=t.removeItem,i=t.getItem;return function(e){return function(t){return function(o){var a=o.userId,s=o.traits,c=o.options;if(o.type===Pa.reset&&([Sa,ka,_a].forEach((function(e){r(e)})),[Ea,xa,"traits"].forEach((function(e){sa(Ra(e))}))),o.type===Pa.identify){i(_a)||n(_a,ta());var l=i(Sa),u=i(ka)||{};l&&l!==a&&e.dispatch({type:Pa.userIdChanged,old:{userId:l,traits:u},new:{userId:a,traits:s},options:c}),a&&n(Sa,a),s&&n(ka,da({},u,s))}return t(o)}}}}var za={};function qa(e,t){za[e]&&zo(za[e])&&(za[e](t),delete za[e])}function Ua(e,t,n){return new Promise((function(r,i){return t()?r(e):n<1?i(da({},e,{queue:!0})):new Promise((function(e){return setTimeout(e,10)})).then((function(o){return Ua(e,t,n-10).then(r,i)}))}))}function Da(e){return{abort:e}}var Ma=function(e){var t=e.data,n=e.action,r=e.instance,i=e.state,o=e.allPlugins,a=e.allMatches,s=e.store,c=e.EVENTS;try{var l=i.plugins,u=i.context,d=n.type,f=d.match(Ba),p=t.exact.map((function(e){return e.pluginName}));f&&(p=a.during.map((function(e){return e.pluginName})));var h=function(e,t){return function(n,r,i){var o=r.config,a=r.name,s=a+"."+n.type;i&&(s=i.event);var c=n.type.match(Ba)?function(e,t,n,r,i){return function(o,a){var s=r?r.name:e,c=a&&Xa(a)?a:n;if(r&&(!(c=a&&Xa(a)?a:[e]).includes(e)||1!==c.length))throw new Error("Method "+t+" can only abort "+e+" plugin. "+JSON.stringify(c)+" input valid");return da({},i,{abort:{reason:o,plugins:c,caller:t,_:s}})}}(a,s,t,i,n):function(e,t){return function(){throw new Error(e.type+" action not cancellable. Remove abort in "+t)}}(n,s);return{payload:es(n),instance:e,config:o||{},abort:c}}}(r,p),v=t.exact.reduce((function(e,t){var n=t.pluginName,r=t.methodName,i=!1;return r.match(/^initialize/)||r.match(/^reset/)||(i=!l[n].loaded),u.offline&&r.match(/^(page|track|identify)/)&&(i=!0),e[""+n]=i,e}),{});return Promise.resolve(t.exact.reduce((function(e,i,a){try{var s=i.pluginName;return Promise.resolve(e).then((function(e){function i(){return Promise.resolve(e)}var a=function(){if(t.namespaced&&t.namespaced[s])return Promise.resolve(t.namespaced[s].reduce((function(e,t,n){try{return Promise.resolve(e).then((function(e){return t.method&&zo(t.method)?(function(e,t){var n=Za(e);if(n&&n.name===t){var r=Za(n.method);throw new Error([t+" plugin is calling method "+e,"Plugins cant call self","Use "+n.method+" "+(r?"or "+r.method:"")+" in "+t+" plugin insteadof "+e].join("\n"))}}(t.methodName,t.pluginName),Promise.resolve(t.method({payload:e,instance:r,abort:(n=e,i=s,a=t.pluginName,function(e,t){return da({},n,{abort:{reason:e,plugins:t||[i],caller:d,from:a||i}})}),config:Va(t.pluginName,l,o),plugins:l})).then((function(t){var n=Go(t)?t:{};return Promise.resolve(da({},e,n))}))):e;var n,i,a}))}catch(e){return Promise.reject(e)}}),Promise.resolve(n))).then((function(t){e[s]=t}));e[s]=n}();return a&&a.then?a.then(i):i()}))}catch(e){return Promise.reject(e)}}),Promise.resolve({}))).then((function(e){return Promise.resolve(t.exact.reduce((function(n,i,a){try{var c=t.exact.length===a+1,u=i.pluginName,p=o[u];return Promise.resolve(n).then((function(t){var n=e[u]?e[u]:{};if(f&&(n=t),Qa(n,u))return Ja({data:n,method:d,instance:r,pluginName:u,store:s}),Promise.resolve(t);if(Qa(t,u))return c&&Ja({data:t,method:d,instance:r,store:s}),Promise.resolve(t);if(v.hasOwnProperty(u)&&!0===v[u])return s.dispatch({type:"queue",plugin:u,payload:n,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(t);var i=h(e[u],o[u]);return Promise.resolve(p[d]({abort:i.abort,payload:n,instance:r,config:Va(u,l,o),plugins:l})).then((function(i){var o=Go(i)?i:{},a=da({},t,o),c=e[u];if(Qa(c,u))Ja({data:c,method:d,instance:r,pluginName:u,store:s});else{var l=d+":"+u;(l.match(/:/g)||[]).length<2&&!d.match(Ha)&&!d.match(Ga)&&r.dispatch(da({},f?a:n,{type:l,_:{called:l,from:"submethod"}}))}return Promise.resolve(a)}))}))}catch(e){return Promise.reject(e)}}),Promise.resolve(n))).then((function(e){if(!(d.match(Ba)||d.match(/^registerPlugin/)||d.match(Ga)||d.match(Ha)||d.match(/^params/)||d.match(/^userIdChanged/))){if(c.plugins.includes(d),e._&&e._.originalAction===d)return e;var n=da({},e,{_:{originalAction:e.type,called:e.type,from:"engineEnd"}});Ka(e,t.exact.length)&&!d.match(/End$/)&&(n=da({},n,{type:e.type+"Aborted"})),s.dispatch(n)}return e}))}))}catch(e){return Promise.reject(e)}},Ba=/Start$/,Ha=/^bootstrap/,Ga=/^ready/;function Ja(e){var t=e.pluginName,n=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(da({},e.data,{type:n,_:{called:n,from:"abort"}}))}function Va(e,t,n){var r=t[e]||n[e];return r&&r.config?r.config:{}}function Wa(e,t){return t.reduce((function(t,n){return n[e]?t.concat({methodName:e,pluginName:n.name,method:n[e]}):t}),[])}function $a(e,t){var n=e.replace(Ba,""),r=t?":"+t:"";return[""+e+r,""+n+r,n+"End"+r]}function Qa(e,t){var n=e.abort;return!!n&&(!0===n||Ya(n,t)||n&&Ya(n.plugins,t))}function Ka(e,t){var n=e.abort;if(!n)return!1;if(!0===n||qo(n))return!0;var r=n.plugins;return Xa(n)&&n.length===t||Xa(r)&&r.length===t}function Xa(e){return Array.isArray(e)}function Ya(e,t){return!(!e||!Xa(e))&&e.includes(t)}function Za(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function es(e){return Object.keys(e).reduce((function(t,n){return"type"===n||(t[n]=Go(e[n])?Object.assign({},e[n]):e[n]),t}),{})}function ts(e,t,n){var r={};return function(i){return function(o){return function(a){try{var s,c=function(e){return s?e:o(d)},l=a.type,u=a.plugins,d=a;if(a.abort)return Promise.resolve(o(a));if(l===Pa.enablePlugin&&i.dispatch({type:Pa.initializeStart,plugins:u,disabled:[],fromEnable:!0,meta:a.meta}),l===Pa.disablePlugin&&setTimeout((function(){return qa(a.meta.rid,{payload:a})}),0),l===Pa.initializeEnd){var f=t(),p=Object.keys(f),h=p.filter((function(e){return u.includes(e)})).map((function(e){return f[e]})),v=[],g=[],m=a.disabled,y=h.map((function(e){var t=e.loaded,n=e.name,o=e.config;return Ua(e,(function(){return t({config:o})}),1e4).then((function(t){return r[n]||(i.dispatch({type:Pa.pluginReadyType(n),name:n,events:Object.keys(e).filter((function(e){return!ja.includes(e)}))}),r[n]=!0),v=v.concat(n),e})).catch((function(e){if(e instanceof Error)throw new Error(e);return g=g.concat(e.name),e}))}));Promise.all(y).then((function(e){var t={plugins:v,failed:g,disabled:m};setTimeout((function(){p.length===y.length+m.length&&i.dispatch(da({},{type:Pa.ready},t))}),0)}))}var b=function(){if(l!==Pa.bootstrap)return/^ready:([^:]*)$/.test(l)&&setTimeout((function(){return function(e,t,n){var r={},i=t(),o=e.getState(),a=o.plugins,s=o.queue,c=o.user;if(!o.context.offline&&s&&s.actions&&s.actions.length){var l=s.actions.reduce((function(e,t,n){return a[t.plugin].loaded?(e.process.push(t),e.processIndex.push(n)):(e.requeue.push(t),e.requeueIndex.push(n)),e}),{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(l.processIndex&&l.processIndex.length){l.processIndex.forEach((function(t){var o=s.actions[t],l=o.plugin,u=o.payload.type,d=i[l][u];if(d&&zo(d)){var f,p=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),[Ea,xa].reduce((function(n,r){return e.hasOwnProperty(r)&&t[r]&&t[r]!==e[r]&&(n[r]=t[r]),n}),e)}(o.payload,c),h=r[p.meta.rid];if(!h&&(f=d({payload:p,config:a[l].config,instance:n,abort:Da}))&&Go(f)&&f.abort)return void(r[p.meta.rid]=!0);if(!h){var v=u+":"+l;e.dispatch(da({},p,{type:v,_:{called:v,from:"queueDrain"}}))}}}));var u=s.actions.filter((function(e,t){return!~l.processIndex.indexOf(t)}));s.actions=u}}}(i,t,e)}),0),Promise.resolve(function(e,t,n,r,i){try{var o=zo(t)?t():t,a=e.type,s=a.replace(Ba,"");if(e._&&e._.called)return Promise.resolve(e);var c=n.getState(),l=(f=o,void 0===(p=c.plugins)&&(p={}),void 0===(h=e.options)&&(h={}),Object.keys(f).filter((function(e){var t=h.plugins||{};return Do(t[e])?t[e]:!1!==t.all&&(!p[e]||!1!==p[e].enabled)})).map((function(e){return f[e]})));a===Pa.initializeStart&&e.fromEnable&&(l=Object.keys(c.plugins).filter((function(t){var n=c.plugins[t];return e.plugins.includes(t)&&!n.initialized})).map((function(e){return o[e]})));var u=l.map((function(e){return e.name})),d=function(e,t,n){var r=$a(e).map((function(e){return Wa(e,t)}));return t.reduce((function(n,r){var i=r.name,o=$a(e,i).map((function(e){return Wa(e,t)})),a=o[0],s=o[1],c=o[2];return a.length&&(n.beforeNS[i]=a),s.length&&(n.duringNS[i]=s),c.length&&(n.afterNS[i]=c),n}),{before:r[0],beforeNS:{},during:r[1],duringNS:{},after:r[2],afterNS:{}})}(a,l);return Promise.resolve(Ma({action:e,data:{exact:d.before,namespaced:d.beforeNS},state:c,allPlugins:o,allMatches:d,instance:n,store:r,EVENTS:i})).then((function(e){function t(){var t=function(){if(a.match(Ba))return Promise.resolve(Ma({action:da({},l,{type:s+"End"}),data:{exact:d.after,namespaced:d.afterNS},state:c,allPlugins:o,allMatches:d,instance:n,store:r,EVENTS:i})).then((function(e){e.meta&&e.meta.hasCallback&&qa(e.meta.rid,{payload:e})}))}();return t&&t.then?t.then((function(){return e})):e}if(Ka(e,u.length))return e;var l,f=function(){if(a!==s)return Promise.resolve(Ma({action:da({},e,{type:s}),data:{exact:d.during,namespaced:d.duringNS},state:c,allPlugins:o,allMatches:d,instance:n,store:r,EVENTS:i})).then((function(e){l=e}));l=e}();return f&&f.then?f.then(t):t()}))}catch(e){return Promise.reject(e)}var f,p,h}(a,t,e,i,n)).then((function(e){return s=1,o(e)}))}();return Promise.resolve(b&&b.then?b.then(c):c(b))}catch(e){return Promise.reject(e)}}}}}function ns(e){return function(t){return function(t){return function(n){var r=n.type,i=n.key,o=n.value,a=n.options;if(r===Pa.setItem||r===Pa.removeItem){if(n.abort)return t(n);r===Pa.setItem?e.setItem(i,o,a):e.removeItem(i,a)}return t(n)}}}}var rs=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(t,n){e[n]=e[n].concat(t)},this.removeMiddleware=function(t,n){var r=e[n].findIndex((function(e){return e===t}));-1!==r&&(e[n]=[].concat(e[n].slice(0,r),e[n].slice(r+1)))},this.dynamicMiddlewares=function(t){return function(n){return function(r){return function(i){var o={getState:n.getState,dispatch:function(e){return n.dispatch(e)}},a=e[t].map((function(e){return e(o)}));return ba.apply(void 0,a)(r)(i)}}}}};function is(e){return function(t,n){void 0===t&&(t={});var r={};if("initialize:aborted"===n.type)return t;if(/^registerPlugin:([^:]*)$/.test(n.type)){var i=os(n.type,"registerPlugin"),o=e()[i];if(!o||!i)return t;var a=n.enabled,s=o.config;return r[i]={enabled:a,initialized:!!a&&Boolean(!o.initialize),loaded:!!a&&Boolean(o.loaded({config:s})),config:s},da({},t,r)}if(/^initialize:([^:]*)$/.test(n.type)){var c=os(n.type,Pa.initialize),l=e()[c];return l&&c?(r[c]=da({},t[c],{initialized:!0,loaded:Boolean(l.loaded({config:l.config}))}),da({},t,r)):t}if(/^ready:([^:]*)$/.test(n.type))return r[n.name]=da({},t[n.name],{loaded:!0}),da({},t,r);switch(n.type){case Pa.disablePlugin:return da({},t,as(n.plugins,!1,t));case Pa.enablePlugin:return da({},t,as(n.plugins,!0,t));default:return t}}}function os(e,t){return e.substring(t.length+1,e.length)}function as(e,t,n){return e.reduce((function(e,r){return e[r]=da({},n[r],{enabled:t}),e}),n)}function ss(e){try{return JSON.parse(JSON.stringify(e))}catch(e){}return e}var cs={last:{},history:[]};function ls(e,t){void 0===e&&(e=cs);var n=t.options,r=t.meta;if(t.type===Pa.track){var i=ss(da({event:t.event,properties:t.properties},Object.keys(n).length&&{options:n},{meta:r}));return da({},e,{last:i,history:e.history.concat(i)})}return e}var us={actions:[]};function ds(e,t){void 0===e&&(e=us);var n=t.payload;switch(t.type){case"queue":var r;return r=n&&n.type&&n.type===Pa.identify?[t].concat(e.actions):e.actions.concat(t),da({},e,{actions:r});case"dequeue":return[];default:return e}}var fs=/#.*$/;function ps(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(fs,""):"")}var hs,vs=function(e){if(void 0===e&&(e={}),!Ao)return e;var t=document,n=t.title,r=t.referrer,i=window,o=i.location,a=i.innerWidth,s=i.innerHeight,c=o.hash,l=o.search,u=function(e){var t=function(){if(Ao)for(var e,t=document.getElementsByTagName("link"),n=0;e=t[n];n++)if("canonical"===e.getAttribute("rel"))return e.getAttribute("href")}();return t?t.match(/\?/)?t:t+e:window.location.href.replace(fs,"")}(l),d={title:n,url:u,path:ps(u),hash:c,search:l,width:a,height:s};return r&&""!==r&&(d.referrer=r),da({},d,e)},gs={last:{},history:[]};function ms(e,t){void 0===e&&(e=gs);var n=t.options;if(t.type===Pa.page){var r=ss(da({properties:t.properties,meta:t.meta},Object.keys(n).length&&{options:n}));return da({},e,{last:r,history:e.history.concat(r)})}return e}hs={};var ys={initialized:!1,sessionId:ta(),app:null,version:null,debug:!1,offline:!!Ao&&!navigator.onLine,os:{name:"na"},userAgent:Ao?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.14"},timezone:void 0,locale:void 0,campaign:{},referrer:hs};function bs(e,t){void 0===e&&(e=ys);var n=e.initialized,r=t.campaign;switch(t.type){case Pa.campaign:return da({},e,{campaign:r});case Pa.offline:return da({},e,{offline:!0});case Pa.online:return da({},e,{offline:!1});default:return n?e:da({},ys,e,{initialized:!0})}}var ws=["plugins","reducers","storage"];function _s(){return aa("analytics",[]),function(e){return function(t,n,r){var i=e(t,n,r),o=i.dispatch;return Object.assign(i,{dispatch:function(e){return ia[ra].analytics.push(e.action||e),o(e)}})}}}function Ss(e){return function(){return ba(ba.apply(null,arguments),_s())}}function ks(e){return e?Ho(e)?e:[e]:[]}function Es(e,t,n){void 0===e&&(e={});var r,i,o=ta();return t&&(za[o]=(r=t,i=function(e){for(var t,n=e||Array.prototype.slice.call(arguments),r=0;r<n.length;r++)if(zo(n[r])){t=n[r];break}return t}(n),function(e){i&&i(e),r(e)})),da({},e,{rid:o,ts:(new Date).getTime()},t?{hasCallback:!0}:{})}function xs(e){void 0===e&&(e={});var t=e.reducers||{},n=e.initialUser||{},r=(e.plugins||[]).reduce((function(e,t){if(zo(t))return e.middlewares=e.middlewares.concat(t),e;if(t.NAMESPACE&&(t.name=t.NAMESPACE),!t.name)throw new Error("https://lytics.dev/errors/1");t.config||(t.config={});var n=t.EVENTS?Object.keys(t.EVENTS).map((function(e){return t.EVENTS[e]})):[];e.pluginEnabled[t.name]=!(!1===t.enabled||!1===t.config.enabled),delete t.enabled,t.methods&&(e.methods[t.name]=Object.keys(t.methods).reduce((function(e,n){var r;return e[n]=(r=t.methods[n],function(){for(var e=Array.prototype.slice.call(arguments),t=new Array(r.length),n=0;n<e.length;n++)t[n]=e[n];return t[t.length]=_,r.apply({instance:_},t)}),e}),{}),delete t.methods);var r=Object.keys(t).concat(n),i=new Set(e.events.concat(r));if(e.events=Array.from(i),e.pluginsArray=e.pluginsArray.concat(t),e.plugins[t.name])throw new Error(t.name+"AlreadyLoaded");return e.plugins[t.name]=t,e.plugins[t.name].loaded||(e.plugins[t.name].loaded=function(){return!0}),e}),{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),i=e.storage?e.storage:{getItem:oa,setItem:aa,removeItem:sa},o=function(e){return function(t,n,r){return n.getState("user")[t]||(r&&Go(r)&&r[t]?r[t]:La(e)[t]||oa(Ra(t))||null)}}(i),a=r.plugins,s=r.events.filter((function(e){return!ja.includes(e)})).sort(),c=new Set(s.concat(Ia).filter((function(e){return!ja.includes(e)}))),l=Array.from(c).sort(),u=function(){return a},d=new rs,f=d.addMiddleware,p=d.removeMiddleware,h=d.dynamicMiddlewares,v=function(){throw new Error("Abort disabled inListener")},g=Zo(),m=La(i),y=da({},m,n,g.an_uid?{userId:g.an_uid}:{},g.an_aid?{anonymousId:g.an_aid}:{});y.anonymousId||(y.anonymousId=ta());var b=da({enable:function(e,t){return new Promise((function(n){C.dispatch({type:Pa.enablePlugin,plugins:ks(e),_:{originalAction:Pa.enablePlugin}},n,[t])}))},disable:function(e,t){return new Promise((function(n){C.dispatch({type:Pa.disablePlugin,plugins:ks(e),_:{originalAction:Pa.disablePlugin}},n,[t])}))}},r.methods),w=!1,_={identify:function(e,t,n,r){try{var i=qo(e)?e:null,a=Go(e)?e:t,s=n||{},c=_.user();aa(Ra(Ea),i);var l=i||a.userId||o(Ea,_,a);return Promise.resolve(new Promise((function(e){C.dispatch(da({type:Pa.identifyStart,userId:l,traits:a||{},options:s,anonymousId:c.anonymousId},c.id&&c.id!==i&&{previousId:c.id}),e,[t,n,r])})))}catch(e){return Promise.reject(e)}},track:function(e,t,n,r){try{var i=Go(e)?e.event:e;if(!i||!qo(i))throw new Error("EventMissing");var a=Go(e)?e:t||{},s=Go(n)?n:{};return Promise.resolve(new Promise((function(e){C.dispatch({type:Pa.trackStart,event:i,properties:a,options:s,userId:o(Ea,_,t),anonymousId:o(xa,_,t)},e,[t,n,r])})))}catch(e){return Promise.reject(e)}},page:function(e,t,n){try{var r=Go(e)?e:{},i=Go(t)?t:{};return Promise.resolve(new Promise((function(a){C.dispatch({type:Pa.pageStart,properties:vs(r),options:i,userId:o(Ea,_,r),anonymousId:o(xa,_,r)},a,[e,t,n])})))}catch(e){return Promise.reject(e)}},user:function(e){if(e===Ea||"id"===e)return o(Ea,_);if(e===xa||"anonId"===e)return o(xa,_);var t=_.getState("user");return e?Eo(t,e):t},reset:function(e){return new Promise((function(t){C.dispatch({type:Pa.resetStart},t,e)}))},ready:function(e){return w&&e({plugins:b,instance:_}),_.on(Pa.ready,(function(t){e(t),w=!0}))},on:function(e,t){if(!e||!zo(t))return!1;if(e===Pa.bootstrap)throw new Error(".on disabled for "+e);var n=/Start$|Start:/;if("*"===e){var r=function(e){return function(e){return function(r){return r.type.match(n)&&t({payload:r,instance:_,plugins:a}),e(r)}}},i=function(e){return function(e){return function(r){return r.type.match(n)||t({payload:r,instance:_,plugins:a}),e(r)}}};return f(r,Is),f(i,js),function(){p(r,Is),p(i,js)}}var o=e.match(n)?Is:js,s=function(n){return function(n){return function(r){return r.type===e&&t({payload:r,instance:_,plugins:a,abort:v}),n(r)}}};return f(s,o),function(){return p(s,o)}},once:function(e,t){if(!e||!zo(t))return!1;if(e===Pa.bootstrap)throw new Error(".once disabled for "+e);var n=_.on(e,(function(e){t({payload:e.payload,instance:_,plugins:a,abort:v}),n()}));return n},getState:function(e){var t=C.getState();return e?Eo(t,e):Object.assign({},t)},dispatch:function(e){var t=qo(e)?{type:e}:e;if(Ia.includes(t.type))throw new Error("reserved action "+t.type);var n=da({},t,{_:da({originalAction:t.type},e._||{})});C.dispatch(n)},enablePlugin:b.enable,disablePlugin:b.disable,plugins:b,storage:{getItem:i.getItem,setItem:function(e,t,n){C.dispatch({type:Pa.setItemStart,key:e,value:t,options:n})},removeItem:function(e,t){C.dispatch({type:Pa.removeItemStart,key:e,options:t})}},setAnonymousId:function(e,t){_.storage.setItem(_a,e,t)},events:{core:Ia,plugins:s}},S=r.middlewares.concat([function(e){return function(e){return function(t){return t.meta||(t.meta=Es()),e(t)}}},h(Is),ts(_,u,{all:l,plugins:s}),ns(i),Ta(_),Na(_),h(js)]),k={context:bs,user:Fa(i),page:ms,track:ls,plugins:is(u),queue:ds},E=ba,x=ba;if(Ao&&e.debug){var I=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;I&&(E=I({trace:!0,traceLimit:25})),x=function(){return 0===arguments.length?_s():Go(typeof arguments[0])?Ss():Ss().apply(null,arguments)}}var j,P=function(e){return Object.keys(e).reduce((function(t,n){return ws.includes(n)||(t[n]=e[n]),t}),{})}(e),O=r.pluginsArray.reduce((function(e,t){var n=t.name,i=t.config,o=t.loaded,a=r.pluginEnabled[n];return e[n]={enabled:a,initialized:!!a&&Boolean(!t.initialize),loaded:Boolean(o({config:i})),config:i},e}),{}),A={context:P,user:y,plugins:O},C=ma(function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var i=t[r];typeof e[i]===fa&&(n[i]=e[i])}var o,a=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(typeof n(void 0,{type:"@@redux/INIT"})===pa||typeof n(void 0,{type:ha})===pa)throw new Error("reducer "+t+" "+pa)}))}(n)}catch(e){o=e}return function(e,t){if(void 0===e&&(e={}),o)throw o;for(var r=!1,i={},s=0;s<a.length;s++){var c=a[s],l=e[c],u=(0,n[c])(l,t);if(typeof u===pa){var d=ya(c,t);throw new Error(d)}i[c]=u,r=r||u!==l}return r?i:e}}(da({},k,t)),A,x(E(wa.apply(void 0,S))));C.dispatch=(j=C.dispatch,function(e,t,n){var r=da({},e,{meta:Es(e.meta,t,ks(n))});return j.apply(null,[r])});var T=Object.keys(a);C.dispatch({type:Pa.bootstrap,plugins:T,config:P,params:g,user:y,initialUser:n,persistedUser:m});var F=T.filter((function(e){return r.pluginEnabled[e]})),L=T.filter((function(e){return!r.pluginEnabled[e]}));return C.dispatch({type:Pa.registerPlugins,plugins:T,enabled:r.pluginEnabled}),r.pluginsArray.map((function(e,t){var n=e.bootstrap,i=e.config,o=e.name;n&&zo(n)&&n({instance:_,config:i,payload:e}),C.dispatch({type:Pa.registerPluginType(o),name:o,enabled:r.pluginEnabled[o],plugin:e}),r.pluginsArray.length===t+1&&C.dispatch({type:Pa.initializeStart,plugins:F,disabled:L})})),_}var Is="before",js="after";var Ps="cookie",Os=Fs(),As=Ls,Cs=Ls;function Ts(e){return Os?Ls(e,"",-1):sa(e)}function Fs(){if(void 0!==Os)return Os;var e="cookiecookie";try{Ls(e,e),Os=-1!==document.cookie.indexOf(e),Ts(e)}catch(e){Os=!1}return Os}function Ls(e,t,n,r,i,o){if("undefined"!=typeof window){var a=arguments.length>1;return!1===Os&&(a?aa(e,t):oa(e)),a?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var Rs="localStorage",Ns=ua.bind(null,"localStorage");ca("localStorage","getItem",oa);ca("localStorage","setItem",aa);ca("localStorage","removeItem",sa);var zs="sessionStorage",qs=ua.bind(null,"sessionStorage");ca("sessionStorage","getItem",oa);ca("sessionStorage","setItem",aa);ca("sessionStorage","removeItem",sa);function Us(e){var t=e;try{if("true"===(t=JSON.parse(e)))return!0;if("false"===t)return!1;if(Go(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch(e){}if(null!==t&&""!==t)return t}var Ds=Ns(),Ms=qs(),Bs=Fs();function Hs(e,t){if(e){var n=Vs(t),r=!Ks(n),i=Ws(n)?Us(localStorage.getItem(e)):void 0;if(r&&!Uo(i))return i;var o=$s(n)?Us(As(e)):void 0;if(r&&o)return o;var a=Qs(n)?Us(sessionStorage.getItem(e)):void 0;if(r&&a)return a;var s=oa(e);return r?s:{localStorage:i,sessionStorage:a,cookie:o,global:s}}}function Gs(e,t,n){if(e&&!Uo(t)){var r={},i=Vs(n),o=JSON.stringify(t),a=!Ks(i);return Ws(i)&&(r[Rs]=Ys(Rs,t,Us(localStorage.getItem(e))),localStorage.setItem(e,o),a)?r[Rs]:$s(i)&&(r[Ps]=Ys(Ps,t,Us(As(e))),Cs(e,o),a)?r[Ps]:Qs(i)&&(r[zs]=Ys(zs,t,Us(sessionStorage.getItem(e))),sessionStorage.setItem(e,o),a)?r[zs]:(r[na]=Ys(na,t,oa(e)),aa(e,t),a?r[na]:r)}}function Js(e,t){if(e){var n=Vs(t),r=Hs(e,Po),i={};return!Uo(r.localStorage)&&Ws(n)&&(localStorage.removeItem(e),i[Rs]=r.localStorage),!Uo(r.cookie)&&$s(n)&&(Ts(e),i[Ps]=r.cookie),!Uo(r.sessionStorage)&&Qs(n)&&(sessionStorage.removeItem(e),i[zs]=r.sessionStorage),!Uo(r.global)&&Xs(n,na)&&(sa(e),i[na]=r.global),i}}function Vs(e){return e?qo(e)?e:e.storage:jo}function Ws(e){return Ds&&Xs(e,Rs)}function $s(e){return Bs&&Xs(e,Ps)}function Qs(e){return Ms&&Xs(e,zs)}function Ks(e){return e===Po||"all"===e}function Xs(e,t){return e===jo||e===t||Ks(e)}function Ys(e,t,n){return{location:e,current:t,previous:n}}var Zs={setItem:Gs,getItem:Hs,removeItem:Js};function ec(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tc(Object(n),!0).forEach((function(t){ec(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rc(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var t={storage:Zs};return xs(nc(nc({},t),e))}function ic(e){var t=Array.prototype.slice.call(window.document.querySelectorAll("script"));return t.find((function(t){return t.src===e}))}function oc(e,t){var n=e;if(!n.startsWith("http")){n="https://".concat((t===null||t===void 0?void 0:t.www)?"www.":"").concat(n)}if(t===null||t===void 0?void 0:t.min){n=n+".min.js"}else if(t===null||t===void 0?void 0:t.js){n=n+".js"}if(t===null||t===void 0?void 0:t.query){n+="?"+t.query}return n}function ac(e,t){var n=ic(e);if(n!==undefined){var r=n===null||n===void 0?void 0:n.getAttribute("status");if(r==="loaded"){return Promise.resolve(n)}if(r==="loading"){return new Promise((function(e,t){n.addEventListener("load",(function(){return e(n)}));n.addEventListener("error",(function(e){return t(e)}))}))}}return new Promise((function(n,r){var i,o;var a=window.document.createElement("script");a.type="text/javascript";a.src=oc(e,t);a.async=true;a.setAttribute("status","loading");for(var s=0,c=Object.entries((i=t===null||t===void 0?void 0:t.attributes)!==null&&i!==void 0?i:{});s<c.length;s++){var l=c[s],u=l[0],d=l[1];a.setAttribute(u,d)}a.onload=function(){a.onerror=a.onload=null;a.setAttribute("status","loaded");n(a)};a.onerror=function(){a.onerror=a.onload=null;a.setAttribute("status","error");r(new Error("Failed to load ".concat(e)))};var f=window.document.getElementsByTagName("script")[0];(o=f.parentElement)===null||o===void 0?void 0:o.insertBefore(a,f)}))}var sc=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var cc={id:"tag",handle:function(e,t){return sc(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!Uc(t,e)){return[2]}lc(e.code,t);return[2]}))}))}};function lc(e,t,n){if(n===void 0){n={}}var r;try{r=JSON.parse(e)}catch(t){r={code:e,lang:"javascript"}}var i=n.debug||false;if(jl()){if(r.lang==="javascript"){pc(r.code,t)}else{var o=document.createElement("span");o.innerHTML=hc(r.code,t);document.body.insertAdjacentElement("beforeend",o);var a=o.querySelectorAll("script");a.forEach((function(e){var t=document.createElement("script");t.type=t.type||"text/javascript";if(e.hasAttribute("src")){t.src=e.src}t.text=e.text;if(i){console.log("[JITSU] Executing script".concat(e.hasAttribute("src")?" ".concat(e.src):""),t.text)}document.head.appendChild(t);document.head.removeChild(t)}))}}else{if(i){console.log("[JITSU] insertTags(): cannot insert tags in non-browser environment")}}}var uc="al";var dc="ve".split("").reverse().join("");var fc=globalThis[dc+uc];function pc(e,t){var n="jitsu_event_".concat(Hl());window[n]=t;var r="(function(){\n const event = ".concat(n,";\n ").concat(e,"\n })()");try{fc(r)}catch(e){console.error("[JITSU] Error executing JS code: ".concat(e.message,". Code: "),r)}finally{delete window[n]}return r}function hc(e,t){return e.replace(/{{\s*event\s*}}/g,JSON.stringify(t))}var vc=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var gc="cdn.lr-ingest.io/";var mc={id:"logrocket",handle:function(e,t){return vc(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){if(!Uc(t,e)){return[2]}Sc(e.appId);n=function(e){if(t.type==="identify"&&t.userId){e.identify(t.userId,t.traits||{})}};wc().push(n);if(yc()==="loaded"){_c(window["LogRocket"])}return[2]}))}))}};function yc(){return window["__jitsuLrState"]||"fresh"}function bc(e){window["__jitsuLrState"]=e}function wc(){return window["__jitsuLrQueue"]||(window["__jitsuLrQueue"]=[])}function _c(e){var t=wc();while(t.length>0){var n=t.shift();try{var r=n(e);if(r){r.catch((function(e){return console.warn("Async LogRocket method failed: ".concat(e.message),e)}))}}catch(e){console.warn("LogRocket method failed: ".concat(e.message),e)}}}function Sc(e){return vc(this,void 0,void 0,(function(){return __generator(this,(function(t){if(yc()!=="fresh"){return[2]}bc("loading");ac("".concat(gc,"LogRocket"),{min:true,attributes:{crossOrigin:"anonymous"}}).then((function(){if(window["LogRocket"]){try{window["LogRocket"].init(e)}catch(t){console.warn("LogRocket (id=".concat(e,") init failed: ").concat(t.message),t);bc("failed")}bc("loaded");_c(window["LogRocket"])}})).catch((function(t){console.warn("LogRocket (id=".concat(e,") init failed: ").concat(t.message),t);bc("failed")}));return[2]}))}))}var kc=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Ec(e){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}return Object.fromEntries(Object.entries(e).filter((function(e){var n=e[0];return!t.includes(n)})))}var xc={id:"gtm",handle:function(e,t){return kc(this,void 0,void 0,(function(){var n,r,i,o,a,s,c,l,u,d,f,p,h,v,g,m,y,b,w,_,S,k,E,x,I,j,P,O;return __generator(this,(function(A){switch(A.label){case 0:g=!!e.debug;if(!Uc(t,e)){return[2]}return[4,Pc(e,t)];case 1:A.sent();m=window[e.dataLayerName||"dataLayer"];y=Object.assign(Object.assign({},(t===null||t===void 0?void 0:t.traits)||{}),((n=t===null||t===void 0?void 0:t.context)===null||n===void 0?void 0:n.traits)||{});b=Ec(y,"id","userId","user_id","anonymousId","userId");if(g){console.debug("GTM plugin will be applied to following payload",t)}w={email_address:y.email};_=Object.assign(Object.assign(Object.assign(Object.assign({},t.userId?{user_id:t.userId,userId:t.userId}:{}),t.anonymousId?{anonymousId:t.anonymousId}:{}),b),{user_data:Object.keys(w).length>0?w:undefined});if(g){console.debug("GTM plugin will set following user-related data layer vars",_)}S=t.properties||{};k={page_location:S.url||((i=(r=t.context)===null||r===void 0?void 0:r.page)===null||i===void 0?void 0:i.url),page_title:S.title||((a=(o=t.context)===null||o===void 0?void 0:o.page)===null||a===void 0?void 0:a.title),page_path:S.path||((c=(s=t.context)===null||s===void 0?void 0:s.page)===null||c===void 0?void 0:c.path),page_hash:S.hash||((u=(l=t.context)===null||l===void 0?void 0:l.page)===null||u===void 0?void 0:u.hash),page_search:S.search||((f=(d=t.context)===null||d===void 0?void 0:d.page)===null||f===void 0?void 0:f.search),page_referrer:(v=(h=(p=t===null||t===void 0?void 0:t.context)===null||p===void 0?void 0:p.page)===null||h===void 0?void 0:h.referrer)!==null&&v!==void 0?v:""};if(g){console.debug("GTM plugin will set following context (page) related data layer vars",_)}E=function(e){m.push(e);if(g){console.debug("GTM plugin will push following data to dataLayer",e)}};switch(t.type){case"page":x=Object.assign(Object.assign({event:"page_view"},k),_);E(x);break;case"track":I=t.properties;j=Object.assign(Object.assign(Object.assign({event:t.event},k),I),_);E(j);break;case"identify":P=t.traits;O=Object.assign(Object.assign(Object.assign({event:"identify"},k),P),_);E(O);break}m.push((function(){this.reset()}));return[2]}}))}))}};function Ic(){return window["__jitsuGtmState"]||"fresh"}function jc(e){window["__jitsuGtmState"]=e}function Pc(e,t){return kc(this,void 0,void 0,(function(){var n,r;return __generator(this,(function(i){if(Ic()!=="fresh"){return[2]}jc("loading");n=e.dataLayerName||"dataLayer";r=e.containerId;(function(e,n,i){e[n]=e[n]||[];e[n].push({user_id:t.userId});e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var o=n!="dataLayer"?"&l="+n:"";var a="googletagmanager.com/gtm";ac(a,{www:true,js:true,query:"id="+i+o}).then((function(){jc("loaded")})).catch((function(e){console.warn("GTM (containerId=".concat(r,") init failed: ").concat(e.message),e);jc("failed")}))})(window,n,r);return[2]}))}))}var Oc=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var Ac=[new Uint8Array([109,111,99,46,114,101,103,97,110,97,109,103,97,116,101,108,103,111,111,103]),new Uint8Array([103,97,116,103]),new Uint8Array([115,106])];function Cc(e){var t=new TextDecoder;return t.decode(e)}function Tc(){return Ac.map((function(e){return e.reverse()})).map(Cc).join("/")}var Fc={id:"ga4-tag",handle:function(e,t){return Oc(this,void 0,void 0,(function(){var n,r,i,o,a,s,c,l,u,d,f,p;return __generator(this,(function(h){switch(h.label){case 0:if(!Uc(t,e)){return[2]}return[4,Nc(e,t)];case 1:h.sent();i=window[e.dataLayerName||"dataLayer"];o=function(){i.push(arguments)};a=Object.assign(Object.assign({},t.userId?{user_id:t.userId,userId:t.userId}:{}),t.anonymousId?{anonymousId:t.anonymousId}:{});if(t.userId){o("set",{user_id:t.userId})}switch(t.type){case"page":if(e.autoPageView){console.log("autoPageView");break}s=t.properties,c=t.context;l=Object.assign({page_location:s.url,page_title:s.title,page_path:s.path,page_hash:s.hash,page_search:s.search,page_referrer:(r=(n=c===null||c===void 0?void 0:c.page)===null||n===void 0?void 0:n.referrer)!==null&&r!==void 0?r:""},a);o("event","page_view",l);break;case"track":u=t.properties;d=Object.assign(Object.assign({},u),a);o("event",t.event,d);break;case"identify":f=t.traits;p=Object.assign(Object.assign({},f),a);o("event","identify",p);break}return[2]}}))}))}};function Lc(){return window["__jitsuGa4State"]||"fresh"}function Rc(e){window["__jitsuGa4State"]=e}function Nc(e,t){return Oc(this,void 0,void 0,(function(){var n,r,i,o;return __generator(this,(function(a){if(Lc()!=="fresh"){return[2]}Rc("loading");n=e.dataLayerName||"dataLayer";r=n!=="dataLayer"?"&l="+n:"";i=e.measurementIds;window[n]=window[n]||[];o=function(){window[n].push(arguments)};o("js",new Date);o("config",i,Object.assign(Object.assign({},t.userId?{user_id:t.userId}:{}),!e.autoPageView?{send_page_view:false}:{}));ac(Tc(),{query:"id=".concat(i).concat(r),www:true}).then((function(){Rc("loaded")})).catch((function(t){console.warn("GA4 (containerId=".concat(e.measurementIds,") init failed: ").concat(t.message),t);Rc("failed")}));return[2]}))}))}function zc(e,t){return e==="*"||e.toLowerCase().trim()===(t||"").trim().toLowerCase()}function qc(e,t){if(e==="*"){return true}t=t||"";if(e.startsWith("*.")){return t.endsWith(e.substring(1))}else{return e===t}}function Uc(e,t){var n=t.hosts,r=n===void 0?"*":n,i=t.events,o=i===void 0?"*":i;try{var a=Array.isArray(o)?o:o.split("\n");var s=Array.isArray(r)?r:r.split("\n");return!!s.find((function(t){var n,r;return qc(t,(r=(n=e.context)===null||n===void 0?void 0:n.page)===null||r===void 0?void 0:r.host)}))&&(!!a.find((function(t){return zc(t,e.type)}))||!!a.find((function(t){return zc(t,e.event)})))}catch(e){console.warn("Failed to apply filters: ".concat(e.message,". Typeof events: ").concat(typeof o,", typeof hosts: ").concat(typeof r,". Values"),o,r);throw new Error("Failed to apply filters: ".concat(e.message,". Typeof events: ").concat(typeof o,", typeof hosts: ").concat(typeof r))}}var Dc=(r={},r[cc.id]=cc,r[xc.id]=xc,r[Fc.id]=Fc,r[mc.id]=mc,r);var Mc="2.0.0";var Bc="@jitsu/js";var Hc="ac,com.ac,edu.ac,gov.ac,net.ac,mil.ac,org.ac,ad,nom.ad,ae,co.ae,net.ae,org.ae,sch.ae,ac.ae,gov.ae,mil.ae,aero,af,gov.af,com.af,org.af,net.af,edu.af,ag,com.ag,org.ag,net.ag,co.ag,nom.ag,ai,off.ai,com.ai,net.ai,org.ai,al,com.al,edu.al,gov.al,mil.al,net.al,org.al,am,co.am,com.am,commune.am,net.am,org.am,ao,ed.ao,gv.ao,og.ao,co.ao,pb.ao,it.ao,aq,ar,bet.ar,com.ar,coop.ar,edu.ar,gob.ar,gov.ar,int.ar,mil.ar,musica.ar,mutual.ar,net.ar,org.ar,senasa.ar,tur.ar,arpa,e164.arpa,in-addr.arpa,ip6.arpa,iris.arpa,uri.arpa,urn.arpa,as,gov.as,asia,at,ac.at,co.at,gv.at,or.at,sth.ac.at,au,com.au,net.au,org.au,edu.au,gov.au,asn.au,id.au,act.au,nsw.au,nt.au,qld.au,sa.au,tas.au,vic.au,wa.au,aw,com.aw,ax,az,com.az,net.az,int.az,gov.az,org.az,edu.az,info.az,pp.az,mil.az,name.az,pro.az,biz.az,ba,com.ba,edu.ba,gov.ba,mil.ba,net.ba,org.ba,bb,biz.bb,co.bb,com.bb,edu.bb,gov.bb,info.bb,net.bb,org.bb,store.bb,tv.bb,bd,be,ac.be,bf,gov.bf,bg,a.bg,b.bg,c.bg,d.bg,e.bg,f.bg,g.bg,h.bg,i.bg,j.bg,k.bg,l.bg,m.bg,n.bg,o.bg,p.bg,q.bg,r.bg,s.bg,t.bg,u.bg,v.bg,w.bg,x.bg,y.bg,z.bg,0.bg,1.bg,2.bg,3.bg,4.bg,5.bg,6.bg,7.bg,8.bg,9.bg,bh,com.bh,edu.bh,net.bh,org.bh,gov.bh,bi,co.bi,com.bi,edu.bi,or.bi,org.bi,biz,bj,africa.bj,agro.bj,architectes.bj,assur.bj,avocats.bj,co.bj,com.bj,eco.bj,econo.bj,edu.bj,info.bj,loisirs.bj,money.bj,net.bj,org.bj,ote.bj,resto.bj,restaurant.bj,tourism.bj,univ.bj,bm,com.bm,edu.bm,gov.bm,net.bm,org.bm,bn,com.bn,edu.bn,gov.bn,net.bn,org.bn,bo,com.bo,edu.bo,gob.bo,int.bo,org.bo,net.bo,mil.bo,tv.bo,web.bo,br,9guacu.br,abc.br,adm.br,adv.br,agr.br,aju.br,am.br,anani.br,aparecida.br,app.br,arq.br,art.br,ato.br,b.br,barueri.br,belem.br,bhz.br,bib.br,bio.br,blog.br,bmd.br,boavista.br,bsb.br,campinagrande.br,campinas.br,caxias.br,cim.br,cng.br,cnt.br,com.br,contagem.br,coop.br,coz.br,cri.br,cuiaba.br,curitiba.br,def.br,des.br,det.br,dev.br,ecn.br,eco.br,edu.br,emp.br,enf.br,eng.br,esp.br,etc.br,eti.br,far.br,feira.br,flog.br,floripa.br,fm.br,fnd.br,fortal.br,fot.br,foz.br,fst.br,g12.br,geo.br,ggf.br,goiania.br,gov.br,gru.br,imb.br,ind.br,inf.br,jab.br,jampa.br,jdf.br,joinville.br,jor.br,jus.br,leg.br,lel.br,log.br,londrina.br,macapa.br,maceio.br,manaus.br,maringa.br,mat.br,med.br,mil.br,morena.br,mp.br,mus.br,natal.br,net.br,niteroi.br,nom.br,not.br,ntr.br,odo.br,ong.br,org.br,osasco.br,palmas.br,poa.br,ppg.br,pro.br,psc.br,psi.br,pvh.br,qsl.br,radio.br,rec.br,recife.br,rep.br,ribeirao.br,rio.br,riobranco.br,riopreto.br,salvador.br,sampa.br,santamaria.br,santoandre.br,saobernardo.br,saogonca.br,seg.br,sjc.br,slg.br,slz.br,sorocaba.br,srv.br,taxi.br,tc.br,tec.br,teo.br,the.br,tmp.br,trd.br,tur.br,tv.br,udi.br,vet.br,vix.br,vlog.br,wiki.br,zlg.br,bs,com.bs,net.bs,org.bs,edu.bs,gov.bs,bt,com.bt,edu.bt,gov.bt,net.bt,org.bt,bv,bw,co.bw,org.bw,by,gov.by,mil.by,com.by,of.by,bz,com.bz,net.bz,org.bz,edu.bz,gov.bz,ca,ab.ca,bc.ca,mb.ca,nb.ca,nf.ca,nl.ca,ns.ca,nt.ca,nu.ca,on.ca,pe.ca,qc.ca,sk.ca,yk.ca,gc.ca,cat,cc,cd,gov.cd,cf,cg,ch,ci,org.ci,or.ci,com.ci,co.ci,edu.ci,ed.ci,ac.ci,net.ci,go.ci,asso.ci,aéroport.ci,int.ci,presse.ci,md.ci,gouv.ci,ck,cl,co.cl,gob.cl,gov.cl,mil.cl,cm,co.cm,com.cm,gov.cm,net.cm,cn,ac.cn,com.cn,edu.cn,gov.cn,net.cn,org.cn,mil.cn,co,arts.co,com.co,edu.co,firm.co,gov.co,info.co,int.co,mil.co,net.co,nom.co,org.co,rec.co,web.co,com,coop,cr,ac.cr,co.cr,ed.cr,fi.cr,go.cr,or.cr,sa.cr,cu,com.cu,edu.cu,org.cu,net.cu,gov.cu,inf.cu,cv,com.cv,edu.cv,int.cv,nome.cv,org.cv,cw,com.cw,edu.cw,net.cw,org.cw,cx,gov.cx,cy,ac.cy,biz.cy,com.cy,ekloges.cy,gov.cy,ltd.cy,mil.cy,net.cy,org.cy,press.cy,pro.cy,tm.cy,cz,de,dj,dk,dm,com.dm,net.dm,org.dm,edu.dm,gov.dm,do,art.do,com.do,edu.do,gob.do,gov.do,mil.do,net.do,org.do,sld.do,web.do,dz,art.dz,asso.dz,com.dz,edu.dz,gov.dz,org.dz,net.dz,pol.dz,soc.dz,tm.dz,ec,com.ec,info.ec,net.ec,fin.ec,k12.ec,med.ec,pro.ec,org.ec,edu.ec,gov.ec,gob.ec,mil.ec,edu,ee,edu.ee,gov.ee,riik.ee,lib.ee,med.ee,com.ee,pri.ee,aip.ee,org.ee,fie.ee,eg,com.eg,edu.eg,eun.eg,gov.eg,mil.eg,name.eg,net.eg,org.eg,sci.eg,er,es,com.es,nom.es,org.es,gob.es,edu.es,et,com.et,gov.et,org.et,edu.et,biz.et,name.et,info.et,net.et,eu,fi,aland.fi,fj,ac.fj,biz.fj,com.fj,gov.fj,info.fj,mil.fj,name.fj,net.fj,org.fj,pro.fj,fk,com.fm,edu.fm,net.fm,org.fm,fm,fo,fr,asso.fr,com.fr,gouv.fr,nom.fr,prd.fr,tm.fr,aeroport.fr,avocat.fr,avoues.fr,cci.fr,chambagri.fr,chirurgiens-dentistes.fr,experts-comptables.fr,geometre-expert.fr,greta.fr,huissier-justice.fr,medecin.fr,notaires.fr,pharmacien.fr,port.fr,veterinaire.fr,ga,gb,edu.gd,gov.gd,gd,ge,com.ge,edu.ge,gov.ge,org.ge,mil.ge,net.ge,pvt.ge,gf,gg,co.gg,net.gg,org.gg,gh,com.gh,edu.gh,gov.gh,org.gh,mil.gh,gi,com.gi,ltd.gi,gov.gi,mod.gi,edu.gi,org.gi,gl,co.gl,com.gl,edu.gl,net.gl,org.gl,gm,gn,ac.gn,com.gn,edu.gn,gov.gn,org.gn,net.gn,gov,gp,com.gp,net.gp,mobi.gp,edu.gp,org.gp,asso.gp,gq,gr,com.gr,edu.gr,net.gr,org.gr,gov.gr,gs,gt,com.gt,edu.gt,gob.gt,ind.gt,mil.gt,net.gt,org.gt,gu,com.gu,edu.gu,gov.gu,guam.gu,info.gu,net.gu,org.gu,web.gu,gw,gy,co.gy,com.gy,edu.gy,gov.gy,net.gy,org.gy,hk,com.hk,edu.hk,gov.hk,idv.hk,net.hk,org.hk,hm,hn,com.hn,edu.hn,org.hn,net.hn,mil.hn,gob.hn,hr,iz.hr,from.hr,name.hr,com.hr,ht,com.ht,shop.ht,firm.ht,info.ht,adult.ht,net.ht,pro.ht,org.ht,med.ht,art.ht,coop.ht,pol.ht,asso.ht,edu.ht,rel.ht,gouv.ht,perso.ht,hu,co.hu,info.hu,org.hu,priv.hu,sport.hu,tm.hu,2000.hu,agrar.hu,bolt.hu,casino.hu,city.hu,erotica.hu,erotika.hu,film.hu,forum.hu,games.hu,hotel.hu,ingatlan.hu,jogasz.hu,konyvelo.hu,lakas.hu,media.hu,news.hu,reklam.hu,sex.hu,shop.hu,suli.hu,szex.hu,tozsde.hu,utazas.hu,video.hu,id,ac.id,biz.id,co.id,desa.id,go.id,mil.id,my.id,net.id,or.id,ponpes.id,sch.id,web.id,ie,gov.ie,il,ac.il,co.il,gov.il,idf.il,k12.il,muni.il,net.il,org.il,im,ac.im,co.im,com.im,ltd.co.im,net.im,org.im,plc.co.im,tt.im,tv.im,in,5g.in,6g.in,ac.in,ai.in,am.in,bihar.in,biz.in,business.in,ca.in,cn.in,co.in,com.in,coop.in,cs.in,delhi.in,dr.in,edu.in,er.in,firm.in,gen.in,gov.in,gujarat.in,ind.in,info.in,int.in,internet.in,io.in,me.in,mil.in,net.in,nic.in,org.in,pg.in,post.in,pro.in,res.in,travel.in,tv.in,uk.in,up.in,us.in,info,int,eu.int,io,com.io,iq,gov.iq,edu.iq,mil.iq,com.iq,org.iq,net.iq,ir,ac.ir,co.ir,gov.ir,id.ir,net.ir,org.ir,sch.ir,is,net.is,com.is,edu.is,gov.is,org.is,int.is,it,gov.it,edu.it,je,co.je,net.je,org.je,jm,jo,com.jo,org.jo,net.jo,edu.jo,sch.jo,gov.jo,mil.jo,name.jo,jobs,jp,ac.jp,ad.jp,co.jp,ed.jp,go.jp,gr.jp,lg.jp,ne.jp,or.jp,ke,ac.ke,co.ke,go.ke,info.ke,me.ke,mobi.ke,ne.ke,or.ke,sc.ke,kg,org.kg,net.kg,com.kg,edu.kg,gov.kg,mil.kg,kh,ki,edu.ki,biz.ki,net.ki,org.ki,gov.ki,info.ki,com.ki,km,org.km,nom.km,gov.km,prd.km,tm.km,edu.km,mil.km,ass.km,com.km,kn,net.kn,org.kn,edu.kn,gov.kn,kp,com.kp,edu.kp,gov.kp,org.kp,rep.kp,tra.kp,kr,ac.kr,co.kr,es.kr,go.kr,hs.kr,kg.kr,mil.kr,ms.kr,ne.kr,or.kr,pe.kr,re.kr,sc.kr,kw,com.kw,edu.kw,emb.kw,gov.kw,ind.kw,net.kw,org.kw,ky,com.ky,edu.ky,net.ky,org.ky,kz,org.kz,edu.kz,net.kz,gov.kz,mil.kz,com.kz,la,int.la,net.la,info.la,edu.la,gov.la,per.la,com.la,org.la,lb,com.lb,edu.lb,gov.lb,net.lb,org.lb,lc,com.lc,net.lc,co.lc,org.lc,edu.lc,gov.lc,li,lk,gov.lk,sch.lk,net.lk,int.lk,com.lk,org.lk,edu.lk,ngo.lk,soc.lk,web.lk,ltd.lk,assn.lk,grp.lk,hotel.lk,ac.lk,lr,com.lr,edu.lr,gov.lr,org.lr,net.lr,ls,ac.ls,biz.ls,co.ls,edu.ls,gov.ls,info.ls,net.ls,org.ls,sc.ls,lt,gov.lt,lu,lv,com.lv,edu.lv,gov.lv,org.lv,mil.lv,id.lv,net.lv,asn.lv,conf.lv,ly,com.ly,net.ly,gov.ly,plc.ly,edu.ly,sch.ly,med.ly,org.ly,id.ly,ma,co.ma,net.ma,gov.ma,org.ma,ac.ma,press.ma,mc,tm.mc,asso.mc,md,me,co.me,net.me,org.me,edu.me,ac.me,gov.me,its.me,priv.me,mg,org.mg,nom.mg,gov.mg,prd.mg,tm.mg,edu.mg,mil.mg,com.mg,co.mg,mh,mil,mk,com.mk,org.mk,net.mk,edu.mk,gov.mk,inf.mk,name.mk,ml,com.ml,edu.ml,gouv.ml,gov.ml,net.ml,org.ml,presse.ml,mm,mn,gov.mn,edu.mn,org.mn,mo,com.mo,net.mo,org.mo,edu.mo,gov.mo,mobi,mp,mq,mr,gov.mr,ms,com.ms,edu.ms,gov.ms,net.ms,org.ms,mt,com.mt,edu.mt,net.mt,org.mt,mu,com.mu,net.mu,org.mu,gov.mu,ac.mu,co.mu,or.mu,museum,mv,aero.mv,biz.mv,com.mv,coop.mv,edu.mv,gov.mv,info.mv,int.mv,mil.mv,museum.mv,name.mv,net.mv,org.mv,pro.mv,mw,ac.mw,biz.mw,co.mw,com.mw,coop.mw,edu.mw,gov.mw,int.mw,museum.mw,net.mw,org.mw,mx,com.mx,org.mx,gob.mx,edu.mx,net.mx,my,biz.my,com.my,edu.my,gov.my,mil.my,name.my,net.my,org.my,mz,ac.mz,adv.mz,co.mz,edu.mz,gov.mz,mil.mz,net.mz,org.mz,na,info.na,pro.na,name.na,school.na,or.na,dr.na,us.na,mx.na,ca.na,in.na,cc.na,tv.na,ws.na,mobi.na,co.na,com.na,org.na,name,nc,asso.nc,nom.nc,ne,net,nf,com.nf,net.nf,per.nf,rec.nf,web.nf,arts.nf,firm.nf,info.nf,other.nf,store.nf,ng,com.ng,edu.ng,gov.ng,i.ng,mil.ng,mobi.ng,name.ng,net.ng,org.ng,sch.ng,ni,ac.ni,biz.ni,co.ni,com.ni,edu.ni,gob.ni,in.ni,info.ni,int.ni,mil.ni,net.ni,nom.ni,org.ni,web.ni,nl,no,fhs.no,vgs.no,fylkesbibl.no,folkebibl.no,museum.no,idrett.no,priv.no,mil.no,stat.no,dep.no,kommune.no,herad.no,np,nr,biz.nr,info.nr,gov.nr,edu.nr,org.nr,net.nr,com.nr,nu,nz,ac.nz,co.nz,cri.nz,geek.nz,gen.nz,govt.nz,health.nz,iwi.nz,kiwi.nz,maori.nz,mil.nz,māori.nz,net.nz,org.nz,parliament.nz,school.nz,om,co.om,com.om,edu.om,gov.om,med.om,museum.om,net.om,org.om,pro.om,onion,org,pa,ac.pa,gob.pa,com.pa,org.pa,sld.pa,edu.pa,net.pa,ing.pa,abo.pa,med.pa,nom.pa,pe,edu.pe,gob.pe,nom.pe,mil.pe,org.pe,com.pe,net.pe,pf,com.pf,org.pf,edu.pf,pg,ph,com.ph,net.ph,org.ph,gov.ph,edu.ph,ngo.ph,mil.ph,i.ph,pk,com.pk,net.pk,edu.pk,org.pk,fam.pk,biz.pk,web.pk,gov.pk,gob.pk,gok.pk,gon.pk,gop.pk,gos.pk,info.pk,pl,com.pl,net.pl,org.pl,aid.pl,agro.pl,atm.pl,auto.pl,biz.pl,edu.pl,gmina.pl,gsm.pl,info.pl,mail.pl,miasta.pl,media.pl,mil.pl,nieruchomosci.pl,nom.pl,pc.pl,powiat.pl,priv.pl,realestate.pl,rel.pl,sex.pl,shop.pl,sklep.pl,sos.pl,szkola.pl,targi.pl,tm.pl,tourism.pl,travel.pl,turystyka.pl,pm,pn,gov.pn,co.pn,org.pn,edu.pn,net.pn,post,pr,com.pr,net.pr,org.pr,gov.pr,edu.pr,isla.pr,pro.pr,biz.pr,info.pr,name.pr,est.pr,prof.pr,ac.pr,pro,aaa.pro,aca.pro,acct.pro,avocat.pro,bar.pro,cpa.pro,eng.pro,jur.pro,law.pro,med.pro,recht.pro,ps,edu.ps,gov.ps,sec.ps,plo.ps,com.ps,org.ps,net.ps,pt,net.pt,gov.pt,org.pt,edu.pt,int.pt,publ.pt,com.pt,nome.pt,pw,co.pw,ne.pw,or.pw,ed.pw,go.pw,belau.pw,py,com.py,coop.py,edu.py,gov.py,mil.py,net.py,org.py,qa,com.qa,edu.qa,gov.qa,mil.qa,name.qa,net.qa,org.qa,sch.qa,re,asso.re,com.re,nom.re,ro,arts.ro,com.ro,firm.ro,info.ro,nom.ro,nt.ro,org.ro,rec.ro,store.ro,tm.ro,www.ro,rs,ac.rs,co.rs,edu.rs,gov.rs,in.rs,org.rs,ru,rw,ac.rw,co.rw,coop.rw,gov.rw,mil.rw,net.rw,org.rw,sa,com.sa,net.sa,org.sa,gov.sa,med.sa,pub.sa,edu.sa,sch.sa,sb,com.sb,edu.sb,gov.sb,net.sb,org.sb,sc,com.sc,gov.sc,net.sc,org.sc,edu.sc,sd,com.sd,net.sd,org.sd,edu.sd,med.sd,tv.sd,gov.sd,info.sd,se,a.se,ac.se,b.se,bd.se,brand.se,c.se,d.se,e.se,f.se,fh.se,fhsk.se,fhv.se,g.se,h.se,i.se,k.se,komforb.se,kommunalforbund.se,komvux.se,l.se,lanbib.se,m.se,n.se,naturbruksgymn.se,o.se,org.se,p.se,parti.se,pp.se,press.se,r.se,s.se,t.se,tm.se,u.se,w.se,x.se,y.se,z.se,sg,com.sg,net.sg,org.sg,gov.sg,edu.sg,per.sg,sh,com.sh,net.sh,gov.sh,org.sh,mil.sh,si,sj,sk,sl,com.sl,net.sl,edu.sl,gov.sl,org.sl,sm,sn,art.sn,com.sn,edu.sn,gouv.sn,org.sn,perso.sn,univ.sn,so,com.so,edu.so,gov.so,me.so,net.so,org.so,sr,ss,biz.ss,com.ss,edu.ss,gov.ss,me.ss,net.ss,org.ss,sch.ss,st,co.st,com.st,consulado.st,edu.st,embaixada.st,mil.st,net.st,org.st,principe.st,saotome.st,store.st,su,sv,com.sv,edu.sv,gob.sv,org.sv,red.sv,sx,gov.sx,sy,edu.sy,gov.sy,net.sy,mil.sy,com.sy,org.sy,sz,co.sz,ac.sz,org.sz,tc,td,tel,tf,tg,th,ac.th,co.th,go.th,in.th,mi.th,net.th,or.th,tj,ac.tj,biz.tj,co.tj,com.tj,edu.tj,go.tj,gov.tj,int.tj,mil.tj,name.tj,net.tj,nic.tj,org.tj,test.tj,web.tj,tk,tl,gov.tl,tm,com.tm,co.tm,org.tm,net.tm,nom.tm,gov.tm,mil.tm,edu.tm,tn,com.tn,ens.tn,fin.tn,gov.tn,ind.tn,info.tn,intl.tn,mincom.tn,nat.tn,net.tn,org.tn,perso.tn,tourism.tn,to,com.to,gov.to,net.to,org.to,edu.to,mil.to,tr,av.tr,bbs.tr,bel.tr,biz.tr,com.tr,dr.tr,edu.tr,gen.tr,gov.tr,info.tr,mil.tr,k12.tr,kep.tr,name.tr,net.tr,org.tr,pol.tr,tel.tr,tsk.tr,tv.tr,web.tr,nc.tr,tt,co.tt,com.tt,org.tt,net.tt,biz.tt,info.tt,pro.tt,int.tt,coop.tt,jobs.tt,mobi.tt,travel.tt,museum.tt,aero.tt,name.tt,gov.tt,edu.tt,tv,tw,edu.tw,gov.tw,mil.tw,com.tw,net.tw,org.tw,idv.tw,game.tw,ebiz.tw,club.tw,tz,ac.tz,co.tz,go.tz,hotel.tz,info.tz,me.tz,mil.tz,mobi.tz,ne.tz,or.tz,sc.tz,tv.tz,ua,com.ua,edu.ua,gov.ua,in.ua,net.ua,org.ua,ug,co.ug,or.ug,ac.ug,sc.ug,go.ug,ne.ug,com.ug,org.ug,uk,ac.uk,co.uk,gov.uk,ltd.uk,me.uk,net.uk,nhs.uk,org.uk,plc.uk,police.uk,us,dni.us,fed.us,isa.us,kids.us,nsn.us,ak.us,al.us,ar.us,as.us,az.us,ca.us,co.us,ct.us,dc.us,de.us,fl.us,ga.us,gu.us,hi.us,ia.us,id.us,il.us,in.us,ks.us,ky.us,la.us,ma.us,md.us,me.us,mi.us,mn.us,mo.us,ms.us,mt.us,nc.us,nd.us,ne.us,nh.us,nj.us,nm.us,nv.us,ny.us,oh.us,ok.us,or.us,pa.us,pr.us,ri.us,sc.us,sd.us,tn.us,tx.us,ut.us,vi.us,vt.us,va.us,wa.us,wi.us,wv.us,wy.us,uy,com.uy,edu.uy,gub.uy,mil.uy,net.uy,org.uy,uz,co.uz,com.uz,net.uz,org.uz,va,vc,com.vc,net.vc,org.vc,gov.vc,mil.vc,edu.vc,ve,arts.ve,bib.ve,co.ve,com.ve,e12.ve,edu.ve,firm.ve,gob.ve,gov.ve,info.ve,int.ve,mil.ve,net.ve,nom.ve,org.ve,rar.ve,rec.ve,store.ve,tec.ve,web.ve,vg,vi,co.vi,com.vi,k12.vi,net.vi,org.vi,vn,ac.vn,ai.vn,biz.vn,com.vn,edu.vn,gov.vn,health.vn,id.vn,info.vn,int.vn,io.vn,name.vn,net.vn,org.vn,pro.vn,vu,com.vu,edu.vu,net.vu,org.vu,wf,ws,com.ws,net.ws,org.ws,gov.ws,edu.ws,yt,ye,com.ye,edu.ye,gov.ye,net.ye,mil.ye,org.ye,ac.za,agric.za,alt.za,co.za,edu.za,gov.za,grondar.za,law.za,mil.za,net.za,ngo.za,nic.za,nis.za,nom.za,org.za,school.za,tm.za,web.za,zm,ac.zm,biz.zm,co.zm,com.zm,edu.zm,gov.zm,info.zm,mil.zm,net.zm,org.zm,sch.zm,zw,ac.zw,co.zw,gov.zw,mil.zw,org.zw".split(",");var Gc={};Hc.forEach((function(e){Gc[e]=true}));var Jc=Gc;function Vc(e){var t=e.split(":")[0];var n=t.split(".");if(n[n.length-1]==="localhost"||n.length<2){return n[n.length-1]}else{var r=n[n.length-2]+"."+n[n.length-1];if(n.length>2&&Jc[r]){return n[n.length-3]+"."+r}else{return r}}}var Wc=function(){function e(e){this.selfOptions=e||{};this.pipes={}}e.prototype.options=function(e){if(e){this.selfOptions=e}return this.selfOptions};e.prototype.pipe=function(e,t){var n=t;if(typeof e==="string"){if(typeof n==="undefined"){return this.pipes[e]}else{this.pipes[e]=n}}if(e&&e.name){n=e;if(n.processor===this){return n}this.pipes[n.name]=n}n.processor=this;return n};e.prototype.process=function(e,t){var n=e;n.options=this.options();var r=t||e.pipe||"default";var i;while(r){if(typeof n.nextAfterChildren!=="undefined"){n.next=n.nextAfterChildren;n.nextAfterChildren=null}if(typeof r==="string"){r=this.pipe(r)}r.process(n);i=r;r=null;if(n){if(n.next){n=n.next;r=n.pipe||i}}}return n.hasResult?n.result:undefined};return e}();var $c=function(){function e(e){this.name=e;this.filters=[]}e.prototype.process=function(e){if(!this.processor){throw new Error("add this pipe to a processor before using it")}var t=this.debug;var n=this.filters.length;var r=e;for(var i=0;i<n;i++){var o=this.filters[i];if(t){this.log("filter: ".concat(o.filterName))}o(r);if(typeof r==="object"&&r.exiting){r.exiting=false;break}}if(!r.next&&this.resultCheck){this.resultCheck(r)}};e.prototype.log=function(e){console.log("[jsondiffpatch] ".concat(this.name," pipe, ").concat(e))};e.prototype.append=function(){var e;var t=[];for(var n=0;n<arguments.length;n++){t[n]=arguments[n]}(e=this.filters).push.apply(e,t);return this};e.prototype.prepend=function(){var e;var t=[];for(var n=0;n<arguments.length;n++){t[n]=arguments[n]}(e=this.filters).unshift.apply(e,t);return this};e.prototype.indexOf=function(e){if(!e){throw new Error("a filter name is required")}for(var t=0;t<this.filters.length;t++){var n=this.filters[t];if(n.filterName===e){return t}}throw new Error("filter not found: ".concat(e))};e.prototype.list=function(){return this.filters.map((function(e){return e.filterName}))};e.prototype.after=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i+1,0],n,false));return this};e.prototype.before=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i,0],n,false));return this};e.prototype.replace=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i,1],n,false));return this};e.prototype.remove=function(e){var t=this.indexOf(e);this.filters.splice(t,1);return this};e.prototype.clear=function(){this.filters.length=0;return this};e.prototype.shouldHaveResult=function(e){var t=this;if(e===false){this.resultCheck=null;return}if(this.resultCheck){return}this.resultCheck=function(e){if(!e.hasResult){console.log(e);var n=new Error("".concat(t.name," failed"));n.noResult=true;throw n}};return this};return e}();var Qc=function(){function e(){}e.prototype.setResult=function(e){this.result=e;this.hasResult=true;return this};e.prototype.exit=function(){this.exiting=true;return this};e.prototype.push=function(e,t){e.parent=this;if(typeof t!=="undefined"){e.childName=t}e.root=this.root||this;e.options=e.options||this.options;if(!this.children){this.children=[e];this.nextAfterChildren=this.next||null;this.next=e}else{this.children[this.children.length-1].next=e;this.children.push(e)}e.next=this;return this};return e}();var Kc=function(e){__extends(t,e);function t(t,n){var r=e.call(this)||this;r.left=t;r.right=n;r.pipe="diff";return r}t.prototype.setResult=function(t){return e.prototype.setResult.call(this,t)};return t}(Qc);var Xc=function(e){__extends(t,e);function t(t,n){var r=e.call(this)||this;r.left=t;r.delta=n;r.pipe="patch";return r}return t}(Qc);function Yc(e,t){if(e.length!==t.length){return false}for(var n=0;n<e.length;n++){if(e[n]!==t[n]){return false}}return true}var Zc=function e(t){if(t.left===t.right){t.setResult(undefined).exit();return}if(typeof t.left==="undefined"){if(typeof t.right==="function"){throw new Error("functions are not supported")}t.setResult([t.right]).exit();return}if(typeof t.right==="undefined"){t.setResult([t.left,0,0]).exit();return}if(typeof t.left==="function"||typeof t.right==="function"){throw new Error("functions are not supported")}t.leftType=t.left===null?"null":typeof t.left;t.rightType=t.right===null?"null":typeof t.right;if(t.leftType!==t.rightType){t.setResult([t.left,t.right]).exit();return}if(t.leftType==="boolean"||t.leftType==="number"||t.leftType==="string"){t.setResult([t.left,t.right]).exit();return}if(t.leftType==="object"){t.leftIsArray=Array.isArray(t.left)}if(t.rightType==="object"){t.rightIsArray=Array.isArray(t.right)}if(t.leftIsArray!==t.rightIsArray){t.setResult([t.left,t.right]).exit();return}if(t.leftIsArray&&t.rightIsArray){if(Yc(t.left,t.right)){t.setResult(undefined).exit();return}else{t.setResult([t.left,t.right]).exit();return}}if(t.left instanceof RegExp){if(t.right instanceof RegExp){t.setResult([t.left.toString(),t.right.toString()]).exit()}else{t.setResult([t.left,t.right]).exit()}}};Zc.filterName="trivial";var el=function e(t){if(typeof t.delta==="undefined"){t.setResult(t.left).exit();return}t.nested=!Array.isArray(t.delta);if(t.nested){return}var n=t.delta;if(n.length===1){t.setResult(n[0]).exit();return}if(n.length===2){if(t.left instanceof RegExp){var r=/^\/(.*)\/([gimyu]+)$/.exec(n[1]);if(r){t.setResult(new RegExp(r[1],r[2])).exit();return}}t.setResult(n[1]).exit();return}if(n.length===3&&n[2]===0){t.setResult(undefined).exit()}};el.filterName="trivial";var tl=function(e){if(!e||!e.children){return}var t=e.children.length;var n;var r=e.result;for(var i=0;i<t;i++){n=e.children[i];if(typeof n.result==="undefined"){continue}r=r||{};r[n.childName]=n.result}if(r&&e.leftIsArray){r._t="a"}e.setResult(r).exit()};tl.filterName="collectChildren";var nl=function(e){if(e.leftIsArray||e.leftType!=="object"){return}var t=e.left;var n=e.right;var r;var i;var o=e.options.propertyFilter;for(r in t){if(!Object.prototype.hasOwnProperty.call(t,r)){continue}if(o&&!o(r,e)){continue}i=new Kc(t[r],n[r]);e.push(i,r)}for(r in n){if(!Object.prototype.hasOwnProperty.call(n,r)){continue}if(o&&!o(r,e)){continue}if(typeof t[r]==="undefined"){i=new Kc(undefined,n[r]);e.push(i,r)}}if(!e.children||e.children.length===0){e.setResult(undefined).exit();return}e.exit()};nl.filterName="objects";var rl=function e(t){if(!t.nested){return}var n=t.delta;if(n._t){return}var r=n;var i;var o;for(i in r){o=new Xc(t.left[i],r[i]);t.push(o,i)}t.exit()};rl.filterName="objects";var il=function e(t){if(!t||!t.children){return}var n=t.delta;if(n._t){return}var r=t.left;var i=t.children.length;var o;for(var a=0;a<i;a++){o=t.children[a];var s=o.childName;if(Object.prototype.hasOwnProperty.call(t.left,s)&&o.result===undefined){delete r[s]}else if(r[s]!==o.result){r[s]=o.result}}t.setResult(r).exit()};il.filterName="collectChildren";var ol=function e(t){if(t.left instanceof Date){if(t.right instanceof Date){if(t.left.getTime()!==t.right.getTime()){t.setResult([t.left,t.right])}else{t.setResult(undefined)}}else{t.setResult([t.left,t.right])}t.exit()}else if(t.right instanceof Date){t.setResult([t.left,t.right]).exit()}};ol.filterName="dates";var al=function(){function e(e){this.processor=new Wc(e);this.processor.pipe(new $c("diff").append(tl,Zc,ol,nl).shouldHaveResult());this.processor.pipe(new $c("patch").append(il,el,rl).shouldHaveResult())}e.prototype.options=function(e){return this.processor.options(e)};e.prototype.diff=function(e,t){return this.processor.process(new Kc(e,t))};e.prototype.patch=function(e,t){return this.processor.process(new Xc(e,t))};return e}();function sl(e){return new al(e)}var cl=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var ll=sl();var ul={writeKey:null,host:null,debug:false,fetch:null,echoEvents:false,cookieDomain:undefined,cookieCapture:{},runtime:undefined,fetchTimeoutMs:undefined,s2s:undefined,idEndpoint:undefined,errorPolicy:"log",defaultPayloadContext:{},privacy:{dontSend:false,disableUserIds:false,ipPolicy:"keep",consentCategories:undefined}};var dl=function(e,t){for(var n=0,r=Object.keys(ul);n<r.length;n++){var i=r[n];var o=t[i];if(i==="privacy"){if(typeof o==="object"){e.privacy=Object.assign(Object.assign(Object.assign({},ul.privacy),e.privacy),o)}else if(t.hasOwnProperty("privacy")&&typeof o==="undefined"){e.privacy=Object.assign({},ul.privacy)}}else if(typeof o==="undefined"){if(t.hasOwnProperty(i)||!e.hasOwnProperty(i)){e[i]=ul[i]}}else{e[i]=o}}};var fl=function(e){if(!e){return{}}var t=e.length>0&&e.charAt(0)==="?"?e.substring(1):e;var n={};var r=(t[0]==="?"?t.substr(1):t).split("&");for(var i=0;i<r.length;i++){var o=r[i].split("=");n[decodeURIComponent(o[0])]=decodeURIComponent(o[1]||"")}return n};function pl(e){var t=e.substring("utm_".length);return t==="campaign"?"name":t}function hl(e){return Object.entries(e).filter((function(e){var t=e[0];return t.indexOf("utm_")===0})).reduce((function(e,t){var n;var r=t[0],i=t[1];return Object.assign(Object.assign({},e),(n={},n[pl(r)]=i,n))}),{})}function vl(e,t){try{return e()}catch(e){return t}}function gl(e){var t=e.getItem("__user_traits");if(typeof t==="string"){t=vl((function(){return JSON.parse(t)}),{})}if(typeof t!=="object"||t===null||Array.isArray(t)){t={}}var n=e.getItem("__group_traits");if(typeof n==="string"){n=vl((function(){return JSON.parse(n)}),{})}if(typeof n!=="object"||n===null||Array.isArray(n)){n={}}return Object.assign(Object.assign({},n||{}),t||{})}function ml(e){var t="; ".concat(document.cookie);var n=t.split("; ".concat(e,"="));return n.length===2?n.pop().split(";").shift():undefined}function yl(e,t){var n=Object.assign({fbc:"_fbc",fbp:"_fbp"},t);var r=Object.entries(n).reduce((function(t,n){var r=n[0],i=n[1];t[r]=e.getCookie(i);return t}),{});return Object.assign(Object.assign({},r),bl(e))}function bl(e){var t;var n=e.getCookies();var r=(t=n["_ga"])===null||t===void 0?void 0:t.split(".").slice(-2).join(".");var i=Object.entries(n).filter((function(e){var t=e[0];return t.startsWith("_ga_")}));var o=i.length>0?Object.fromEntries(i.map((function(e){var t=e[0],n=e[1];if(typeof n!=="string"){return null}var r=n.split(".");if(r.length<3){return null}return[t.substring("_ga_".length),r[2]]})).filter((function(e){return e!==null}))):undefined;if(r||o){return{ga4:{clientId:r,sessionIds:o}}}else{return undefined}}function wl(e,t){var n=t.domain,r=t.secure;document.cookie=e+"=;domain="+n+";path=/"+";expires=Thu, 01 Jan 1970 00:00:01 GMT;SameSite="+(r?"None":"Lax")+(r?";secure":"")}function _l(e,t,n){var r=n.domain,i=n.secure;document.cookie=e+"="+t+";domain="+r+";path=/"+";expires="+new Date((new Date).getTime()+1e3*60*60*24*365*5).toUTCString()+";SameSite="+(i?"None":"Lax")+(i?";secure":"")}var Sl={__anon_id:"__eventn_id",__user_traits:"__eventn_id_usr",__user_id:"__eventn_uid",__group_id:"__group_id",__group_traits:"__group_traits"};var kl=function(e,t){return{setItem:function(n,r){if(typeof r==="undefined"){wl(t[n]||n,{domain:e,secure:window.location.protocol==="https:"});return}var i=typeof r==="object"&&r!==null?encodeURIComponent(JSON.stringify(r)):r;var o=t[n]||n;_l(o,i,{domain:e,secure:window.location.protocol==="https:"})},getItem:function(e){var n=t[e]||e;var r=ml(n);if(e==="__anon_id"){return r}if(typeof r==="undefined"&&e==="__user_id"){var i=Wl(ml("__eventn_id_usr"))||{};return i.internal_id||i.user_id||i.id||i.userId}return Wl(r)},removeItem:function(n){wl(t[n]||n,{domain:e,secure:window.location.protocol==="https:"})},reset:function(){for(var n=0,r=Object.values(t);n<r.length;n++){var i=r[n];wl(i,{domain:e,secure:window.location.protocol==="https:"})}}}};function El(e){return{getCookie:function(e){var t="; ".concat(document.cookie);var n=t.split("; ".concat(e,"="));return n.length===2?n.pop().split(";").shift():undefined},getCookies:function(){var e="; ".concat(document.cookie);var t={};var n=e.matchAll(/(\w+)=([^;]+)/g);for(var r=0,i=n;r<i.length;r++){var o=i[r];t[o[1]]=o[2]}return t},documentEncoding:function(){return window.document.characterSet},timezoneOffset:function(){return(new Date).getTimezoneOffset()},store:function(){return kl(e.cookieDomain||Vc(window.location.hostname),Sl)},language:function(){return window.navigator.language},pageTitle:function(){return window.document.title},pageUrl:function(){return window.location.href},referrer:function(){return window.document.referrer},screen:function(){return{width:window.screen.width,height:window.screen.height,innerWidth:window.innerWidth,innerHeight:window.innerHeight,density:Math.floor(window.devicePixelRatio)}},userAgent:function(){return window.navigator.userAgent}}}var xl=function(e){return{documentEncoding:function(){return undefined},timezoneOffset:function(){return undefined},getCookie:function(e){return undefined},getCookies:function(){return{}},store:function(){var t={};return{reset:function(){Object.keys(t).forEach((function(e){return delete t[e]}))},setItem:function(n,r){if(e.debug){console.log("[JITSU EMPTY RUNTIME] Set storage item ".concat(n,"=").concat(JSON.stringify(r)))}if(typeof r==="undefined"){delete t[n]}else{t[n]=r}},getItem:function(n){var r=t[n];if(e.debug){console.log("[JITSU EMPTY RUNTIME] Get storage item ".concat(n,"=").concat(JSON.stringify(r)))}return r},removeItem:function(n){if(e.debug){console.log("[JITSU EMPTY RUNTIME] Get storage item ".concat(n,"=").concat(t[n]))}delete t[n]}}},language:function(){return undefined},pageTitle:function(){return undefined},pageUrl:function(){return undefined},referrer:function(){return undefined},screen:function(){return undefined},userAgent:function(){return undefined}}};function Il(e,t){if(typeof t!=="object"||t===null){return t}if(typeof e!=="object"||e===null){return t}return Object.entries(t).reduce((function(t,n){var r=n[0],i=n[1];t[r]=Il(e[r],i);return t}),e)}function jl(){return typeof document!=="undefined"&&typeof window!=="undefined"}function Pl(e){if(e.indexOf("//")===0&&e.lastIndexOf("/")===1){return"/"}return e}var Ol=/#.*$/;function Al(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g;var n=t.exec(e);var r=n&&n[3]?n[3].split("?")[0].replace(Ol,""):"";return"/"+r}function Cl(e,t,n,r){var i,o,a,s,c,l;var u=t.runtime||(jl()?El(t):xl(t));var d=u.pageUrl();var f=vl((function(){return new URL(d)}),undefined);var p=f?fl(f.search):{};var h=e.properties||{};if(e.type==="page"&&(h.url||d)){var v=h.url||d;h.url=v.replace(Ol,"");h.path=Pl(Al(v))}var g=Il(t.defaultPayloadContext,((i=e.properties)===null||i===void 0?void 0:i.context)||((o=e.options)===null||o===void 0?void 0:o.context)||{});(a=e.properties)===null||a===void 0?true:delete a.context;var m=u.referrer();var y={library:{name:Bc,version:Mc,env:jl()?"browser":"node"},consent:((s=t.privacy)===null||s===void 0?void 0:s.consentCategories)?{categoryPreferences:t.privacy.consentCategories}:undefined,userAgent:u.userAgent(),locale:u.language(),screen:u.screen(),traits:e.type!="identify"&&e.type!="group"?Object.assign({},gl(n)||{}):undefined,page:{path:h.path||f&&f.pathname,referrer:m,referring_domain:vl((function(){return m&&new URL(m).hostname})),host:f&&f.host,search:h.search||f&&f.search,title:h.title||u.pageTitle(),url:h.url||d,encoding:h.encoding||u.documentEncoding()},clientIds:!((c=t.privacy)===null||c===void 0?void 0:c.disableUserIds)?yl(u,t.cookieCapture):undefined,campaign:hl(p)};var b=Object.assign(Object.assign({},e),{timestamp:(new Date).toISOString(),sentAt:(new Date).toISOString(),messageId:Hl(h.path||f&&f.pathname),writeKey:Nl(t.writeKey),groupId:n.getItem("__group_id"),context:Il(y,g)});delete b.meta;delete b.options;if((l=t.privacy)===null||l===void 0?void 0:l.disableUserIds){delete b.userId;delete b.anonymousId;delete b.context.traits;delete b.groupId}return b}function Tl(e){var t=Object.keys(e);return t.length===1&&t[0]==="__diff"}function Fl(e,t,n,r,i){return cl(this,void 0,void 0,(function(){var o,a,s,c,l,u,d,f,p,h,d,v,g,m,h;return __generator(this,(function(y){switch(y.label){case 0:o=[];a=0,s=e;y.label=1;case 1:if(!(a<s.length))return[3,5];c=s[a];l=[n];if(c.newEvents){try{l=c.newEvents.map((function(e){return e==="same"?n:Tl(e)?ll.patch(n,e.__diff):e}))}catch(e){console.error("[JITSU] Error applying '".concat(c.id,"' changes to event: ").concat(e===null||e===void 0?void 0:e.message),e)}}u=Object.assign(Object.assign({},c.credentials),c.options);if(!(c.deviceOptions.type==="internal-plugin"))return[3,2];d=Dc[c.deviceOptions.name];if(d){for(f=0,p=l;f<p.length;f++){h=p[f];try{o.push(d.handle(Object.assign(Object.assign({},u),{debug:r}),h))}catch(e){console.warn("[JITSU] Error processing event with internal plugin '".concat(c.deviceOptions.name,"': ").concat(e===null||e===void 0?void 0:e.message),e)}}}else{console.warn("[JITSU] Unknown internal plugin '".concat(c.deviceOptions.name,"' for destination '").concat(c.id,"'"))}return[3,4];case 2:if(!(c.deviceOptions.type==="analytics-plugin"))return[3,4];return[4,ac(c.deviceOptions.packageCdn)];case 3:y.sent();d=window[c.deviceOptions.moduleVarName];if(!d){console.warn("[JITSU] Broken plugin '".concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"' - it doesn't export '").concat(c.deviceOptions.moduleVarName,"' variable"))}else{v=void 0;try{v=(typeof d==="function"?d:d.init)(u)}catch(e){console.warn("[JITSU] Error creating plugin '".concat(c.deviceOptions.moduleVarName,"@").concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"': ").concat(e===null||e===void 0?void 0:e.message),e)}try{if(r){console.log("[JITSU] Plugin '".concat(c.deviceOptions.moduleVarName,"@").concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"' initialized with config:"),v.config)}v.initialize({config:v.config,instance:i})}catch(e){console.warn("[JITSU] Error initializing plugin '".concat(c.deviceOptions.moduleVarName,"@").concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"': ").concat(e===null||e===void 0?void 0:e.message,". Config: ").concat(JSON.stringify(v.config)),e);return[3,4]}if(v[t]){for(g=0,m=l;g<m.length;g++){h=m[g];try{v[t]({payload:h,config:v.config,instance:i})}catch(e){console.warn("[JITSU] Error processing ".concat(t,"() with plugin '").concat(c.deviceOptions.moduleVarName,"@").concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"': ").concat(e===null||e===void 0?void 0:e.message),e)}}}}y.label=4;case 4:a++;return[3,1];case 5:return[2]}}))}))}function Ll(e){return e.length===25&&e.charAt(0)==="c"}function Rl(e){if(e){var t=e.split(":",2),n=t[1];if(!n&&!Ll(e)){throw new Error("Legacy write key detected - ".concat(e,"! This format doesn't work anymore, it should be 'key:secret'. Please download a new key from Jitsu UI"))}}return e}function Nl(e){if(e){var t=e.split(":",2),n=t[0],r=t[1];if(r){return"".concat(n,":***")}else{return"***"}}return e}function zl(e){var t=e.errorPolicy||"log";if(typeof t==="function"){return t}else if(t==="rethrow"){return function(e){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}throw new Error(e)}}else{return function(e){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}console.error.apply(console,__spreadArray([e],t,false))}}}function ql(e,t,n,r,i){return cl(this,void 0,void 0,(function(){var o,a,s,c,l,u,d,f,p,h,v,g,m,y,b,w;return __generator(this,(function(_){switch(_.label){case 0:if(n.echoEvents){console.log("[JITSU DEBUG] sending '".concat(e,"' event:"),t);return[2]}s=!!n.s2s;c=s?"".concat(n.host,"/api/s/s2s/").concat(e):"".concat(n.host,"/api/s/").concat(e);l=n.fetch||globalThis.fetch;if(!l){throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope")}u=n.debug?{"X-Enable-Debug":"true"}:{};d=Cl(t,n,i);f=n.fetchTimeoutMs?new AbortController:undefined;p=n.fetchTimeoutMs?setTimeout((function(){f.abort()}),n.fetchTimeoutMs):undefined;h=n.writeKey?{"X-Write-Key":n.writeKey}:{};v=typeof((o=n.privacy)===null||o===void 0?void 0:o.ipPolicy)==="undefined"||((a=n.privacy)===null||a===void 0?void 0:a.ipPolicy)==="keep"?{}:{"X-IP-Policy":n.privacy.ipPolicy};_.label=1;case 1:_.trys.push([1,3,,4]);return[4,l(c,{method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},h),u),v),body:JSON.stringify(d),signal:f===null||f===void 0?void 0:f.signal})];case 2:g=_.sent();if(p){clearTimeout(p)}return[3,4];case 3:m=_.sent();zl(n)("Call to ".concat(c," failed with error ").concat(m.message));return[2,Promise.resolve()];case 4:_.trys.push([4,6,,7]);return[4,g.text()];case 5:y=_.sent();return[3,7];case 6:b=_.sent();console.warn("Can't read response text from ".concat(c," (status - ").concat(g.status," ").concat(g.statusText,"): ").concat(b===null||b===void 0?void 0:b.message));return[3,7];case 7:if(n.debug){console.log("[JITSU DEBUG] ".concat(c," replied ").concat(g.status,": ").concat(y,". Original payload:\n").concat(JSON.stringify(d,null,2)))}if(!g.ok){zl(n)("Call to ".concat(c," failed with error: ").concat(g.status," - ").concat(g.statusText,": ").concat(y));return[2,Promise.resolve()]}try{w=JSON.parse(y)}catch(e){zl(n)("Can't parse JSON: ".concat(y,": ").concat(e===null||e===void 0?void 0:e.message));return[2,Promise.resolve()]}if(w.destinations&&w.destinations.length>0){if(n.s2s){console.warn("[JITSU] ".concat(t.type," responded with list of ").concat(w.destinations.length," destinations. However, this code is running in server-to-server mode, so destinations will be ignored"),n.debug?JSON.stringify(w.destinations,null,2):undefined)}else{if(jl()){if(n.debug){console.log("[JITSU] Processing device destinations: ",JSON.stringify(w.destinations,null,2))}return[2,Fl(w.destinations,e,d,!!n.debug,r)]}}}return[2,d]}}))}))}var Ul=["$doNotSend"];function Dl(e){var t=Object.assign({},e);for(var n=0,r=Ul;n<r.length;n++){var i=r[n];delete t[i]}return t}var Ml=function(e,t){if(e===void 0){e={}}dl(e,e);return{name:"jitsu",config:e,initialize:function(e){return cl(void 0,void 0,void 0,(function(){var t,n,r,i,o,a;return __generator(this,(function(s){switch(s.label){case 0:t=e.config;if(t.debug){console.debug("[JITSU DEBUG] Initializing Jitsu plugin with config: ",JSON.stringify(t,null,2))}if(!t.host&&!t.echoEvents){throw new Error("Please specify host variable in jitsu plugin initialization, or set echoEvents to true")}Rl(t.writeKey);if(!t.idEndpoint)return[3,4];if(!jl()){console.error("[JITSU] 'idEndpoint' option can be used only in browser environment");return[2]}s.label=1;case 1:s.trys.push([1,3,,4]);n=t.fetch||globalThis.fetch;r=new AbortController;setTimeout((function(){return r.abort()}),1e3);i=t.cookieDomain||Vc(window.location.hostname);return[4,n(t.idEndpoint+"?domain="+encodeURIComponent(i),{credentials:"include",signal:r.signal})];case 2:o=s.sent();if(!o.ok){console.error("[JITSU] Can't fetch idEndpoint: ".concat(o.status," - ").concat(o.statusText))}else if(t.debug){console.log("[JITSU DEBUG] Fetch idEndpoint: ".concat(o.status))}return[3,4];case 3:a=s.sent();console.error("[JITSU] Can't fetch idEndpoint: ".concat(a.message));return[3,4];case 4:return[2]}}))}))},page:function(e){var n;var r=e.payload,i=e.config,o=e.instance;if((n=i.privacy)===null||n===void 0?void 0:n.dontSend){return}return ql("page",r,i,o,t)},track:function(e){var n;var r=e.payload,i=e.config,o=e.instance;if((n=i.privacy)===null||n===void 0?void 0:n.dontSend){return}return ql("track",r,i,o,t)},identify:function(e){var n,r,i;var o=e.payload,a=e.config,s=e.instance;if(((n=a.privacy)===null||n===void 0?void 0:n.dontSend)||((r=a.privacy)===null||r===void 0?void 0:r.disableUserIds)){return}t.setItem("__user_id",o.userId);var c=(i=o.traits)===null||i===void 0?void 0:i.$doNotSend;if(o.traits&&typeof o.traits==="object"){o.traits=Dl(o.traits);t.setItem("__user_traits",o.traits)}if(c){return Promise.resolve()}return ql("identify",o,a,s,t)},reset:function(e){var n=e.config,r=e.instance;t.reset();if(n.debug){console.log("[JITSU DEBUG] Resetting Jitsu plugin storage")}},methods:{configure:function(n){var r,i,o,a;var s=((r=e.privacy)===null||r===void 0?void 0:r.disableUserIds)||((i=e.privacy)===null||i===void 0?void 0:i.dontSend);dl(e,n);var c=((o=e.privacy)===null||o===void 0?void 0:o.disableUserIds)||((a=e.privacy)===null||a===void 0?void 0:a.dontSend);if(!c&&s){if(e.debug){console.log("[JITSU] Enabling Anonymous ID. Generating new Id.")}var l=this.instance;var u=Gl();var d=l.user();if(d){d.anonymousId=u}t.setItem("__anon_id",u);l.setAnonymousId(u)}},group:function(n,r,i,o){var a,s;if(((a=e.privacy)===null||a===void 0?void 0:a.dontSend)||((s=e.privacy)===null||s===void 0?void 0:s.disableUserIds)){return}if(typeof n==="number"){n=n+""}var c=this.instance;var l=c.user();var u=(i===null||i===void 0?void 0:i.userId)||(l===null||l===void 0?void 0:l.userId);var d=(i===null||i===void 0?void 0:i.anonymousId)||(l===null||l===void 0?void 0:l.anonymousId)||t.getItem("__anon_id");t.setItem("__group_id",n);var f=r===null||r===void 0?void 0:r.$doNotSend;if(r&&typeof r==="object"){r=Dl(r);t.setItem("__group_traits",r)}if(f){return Promise.resolve()}return ql("group",Object.assign(Object.assign({type:"group",groupId:n,traits:r},d?{anonymousId:d}:{}),u?{userId:u}:{}),e,c,t)}}}};function Bl(){var e;var t=Date.now()%2147483647;return jl()?((e=window===null||window===void 0?void 0:window.performance)===null||e===void 0?void 0:e.now())||t:t}function Hl(e){if(e===void 0){e=""}var t=Date.now();return(Math.random()*t*Jl(e!==null&&e!==void 0?e:"",Bl())%Number.MAX_SAFE_INTEGER).toString(36)+(Math.random()*t*Jl(e!==null&&e!==void 0?e:"",Bl())%Number.MAX_SAFE_INTEGER).toString(36)}function Gl(){var e="",t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n=0,r=Math.random()*4294967295|0;while(n++<36){var i=t[n-1],o=r&15,a=i=="x"?o:o&3|8;e+=i=="-"||i=="4"?i:a.toString(16);r=n%8==0?Math.random()*4294967295|0:r>>4}return e}function Jl(e,t){if(t===void 0){t=0}var n=3735928559^t,r=1103547991^t;for(var i=0,o=void 0;i<e.length;i++){o=e.charCodeAt(i);n=Math.imul(n^o,2654435761);r=Math.imul(r^o,1597334677)}n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909);r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909);return 4294967296*(2097151&r)+(n>>>0)}var Vl=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Wl(e){var t=e;if((e===null||e===void 0?void 0:e.indexOf("%7B%22"))===0){t=decodeURIComponent(e)}try{t=JSON.parse(t);if(t==="true")return true;if(t==="false")return false;if(typeof t==="object")return t;if(parseFloat(t)===t){t=parseFloat(t)}}catch(e){}if(t===null||t===""){return}return t}function $l(e,t,n){if(n===void 0){n=[]}var r,i;var o={};var a=function(t){return{setItem:function(n,r){var i,a;if(((i=e.privacy)===null||i===void 0?void 0:i.dontSend)||((a=e.privacy)===null||a===void 0?void 0:a.disableUserIds)){return}if(e.debug){console.log("[JITSU DEBUG] Caching storage setItem: ".concat(n,"=").concat(r))}o[n]=r;t.setItem(n,r)},getItem:function(n){var r,i;if(((r=e.privacy)===null||r===void 0?void 0:r.dontSend)||((i=e.privacy)===null||i===void 0?void 0:i.disableUserIds)){return}var a=o[n]||t.getItem(n);if(e.debug){console.log("[JITSU DEBUG] Caching storage getItem: ".concat(n,"=").concat(a,". Evicted from cache: ").concat(!o[n]))}return a},reset:function(){for(var e=0,n=__spreadArray([],Object.keys(o),true);e<n.length;e++){var r=n[e];delete o[r]}t.reset()},removeItem:function(n){if(e.debug){console.log("[JITSU DEBUG] Caching storage removeItem: ".concat(n))}delete o[n];t.removeItem(n)}}};var s=a(t.store());var c=rc({debug:!!e.debug,storage:s,plugins:__spreadArray([Ml(e,s)],n,true)});var l=Object.assign(Object.assign({},c),{page:function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e.length===2&&typeof e[0]==="string"&&typeof e[1]==="object"){return c.page(Object.assign({name:e[0]},e[1]))}else{return c.page.apply(c,e)}},identify:function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e[0]&&typeof e[0]!=="object"&&typeof e[0]!=="string"){e[0]=e[0]+""}var n=c.storage;var r=a(n);if(typeof e[0]==="string"){r.setItem("__user_id",e[0])}else if(typeof e[0]==="object"){r.setItem("__user_traits",e[0])}if(e.length===2&&typeof e[1]==="object"){r.setItem("__user_traits",e[1])}return c.identify.apply(c,e)},setAnonymousId:function(t){if(e.debug){console.log("[JITSU DEBUG] Setting anonymous id to "+t)}s.setItem("__anon_id",t);var n=c.user();if(n){n.anonymousId=t}c.setAnonymousId(t)},reset:function(){return Vl(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(e.debug){console.log("[JITSU DEBUG] Called reset(). Storage state",JSON.stringify(c.user()))}s.reset();return[4,c.reset()];case 1:t.sent();this.setAnonymousId(Gl());if(e.debug){console.log("[JITSU DEBUG] User state after reset",JSON.stringify(c.user()))}return[2]}}))}))},configure:function(t){return Vl(this,void 0,void 0,(function(){var n,r,i,o,a;return __generator(this,(function(l){if(e.debug){console.log("[JITSU DEBUG] Update Jitsu config with",JSON.stringify(t))}if(((n=t.privacy)===null||n===void 0?void 0:n.disableUserIds)||((r=t.privacy)===null||r===void 0?void 0:r.dontSend)){s.reset()}for(i=0,o=Object.values(c.plugins);i<o.length;i++){a=o[i];if(typeof a["configure"]==="function"){a["configure"](t)}}return[2]}))}))},group:function(e,t,n,r){return Vl(this,void 0,void 0,(function(){var i,o,a,s,l,u;return __generator(this,(function(d){switch(d.label){case 0:i=[];o=0,a=Object.values(c.plugins);d.label=1;case 1:if(!(o<a.length))return[3,4];s=a[o];if(!s["group"])return[3,3];u=(l=i).push;return[4,s["group"](e,t,n,r)];case 2:u.apply(l,[d.sent()]);d.label=3;case 3:o++;return[3,1];case 4:return[2,i[0]]}}))}))}});if(((r=e.privacy)===null||r===void 0?void 0:r.disableUserIds)||((i=e.privacy)===null||i===void 0?void 0:i.dontSend)){s.reset()}return l}function Ql(e){var t,n;return Object.assign(Object.assign({},e),{host:((t=e.host)!==null&&t!==void 0?t:"").indexOf("https://")!==0&&((n=e.host)!==null&&n!==void 0?n:"").indexOf("http://")!==0?"https://".concat(e.host):e.host})}function Kl(e){var t=Ql(e);var n=jl();var r=t.runtime||(n?El(t):xl(t));return $l(t,r)}var Xl=function(e,t,n){return alert(e)},Yl=function(e,t){return Xl(e,Zl.error,t)},Zl={error:"error",success:"success",info:"info"};var eu={fire:function(e,t,n){return Xl(e,t,n)},setNotifier:function(e){Xl=e,salla.event.emit("twilight::notifier.changed")},error:Yl,success:function(e,t){return Xl(e,Zl.success,t)},info:function(e,t){return Xl(e,Zl.info,t)},sallaInitiated:function(){var e=window.location.href.match(/([\?\&]danger=)[^&]+/g);e&&(window.history.replaceState(null,document.title,window.location.pathname),salla.event.once("twilight::notifier.changed",(function(){e.forEach((function(e){e=decodeURI(e.replace("?danger=","").replace("&danger=",""));var t=document.createElement("div");t.innerText=e,Yl(t.innerHTML),salla.event.emit("twilight::error",e)}))})))},types:Zl};var tu=function(){function e(e,t){return this.api=e,this.event=t,new Proxy(this,{get:function(n,r){return"event"===r?t:"api"===r?e:e&&e[r]||n[r]}})}return e}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){for(var t=this;t;){if(t.matches(e))return t;t=t.parentElement}}),Element.prototype.getElementSallaData=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}if(!this.getAttribute)return;if(this.hasAttribute("data-json"))try{return JSON.parse(this.getAttribute("data-json"))}catch(e){}var i=this.getAttribute("data-function");if(i&&window[i])return"function"==typeof window[i]?this.getFilteredData((t=window[i]).call.apply(t,__spreadArray([this],n,false))):this.getFilteredData(window[i]);var o=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if(o="FORM"===this.tagName?this:o||this.closest("form")||this.closest("[salla-form-data]")||this,o&&"FORM"===o.tagName)return this.getFilteredData(new FormData(o),null,o);var a=o.querySelectorAll("[name]");if(!a.length)return this.getFilteredData();var s=Object.assign({},this.dataset);return a.forEach((function(e){if(!["checkbox","radio"].includes(e.type)||e.checked)try{var t=Salla.helpers.inputData(e.name,e.value,s);s[t.name]=t.value}catch(t){Salla.log(e.name+" can't be send")}})),this.getFilteredData(s)},Element.prototype.canEventFireHook=function(e){return!!this.hasAttribute&&this.hasAttribute(Salla.api.hooksPrefix+e.type)},Element.prototype.hasAttributeStartsWith=function(e,t){e=e.toLowerCase();for(var n=0;n<this.attributes.length;n++){var r=this.attributes[n].name.toLowerCase();if(0===r.indexOf(e))return!t||r}return!1},HTMLFormElement.prototype.getAjaxFormData=function(e){var t=this.querySelectorAll('input[type="file"]');t.forEach((function(e){e.files.length||e.setAttribute("disabled","")}));var n=new FormData(this);return t.forEach((function(e){e.files.length||e.removeAttribute("disabled")})),{formData:this.getFilteredData(n,e),url:this.getAttribute("action"),method:this.getAttribute("method")||"post",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}},Element.prototype.getFilteredData=function(e,t,n){var r=this;if(e===void 0){e=null}if(t===void 0){t=null}if(n===void 0){n=null}return e=e||(n===null||n===void 0?void 0:n.dataset)||this.dataset,n&&this.name&&void 0!==this.value&&(e=function(e,t,n){e instanceof FormData?e.append(t,n):e[t]=n;return e}(e,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((function(i){var o=(n===null||n===void 0?void 0:n.dataset[i])||r.dataset[i];if(o){var a=window[o];if("function"==typeof a){if(!a(e,n||r,t)&&e)throw"Data failed to be pass verify function window.".concat(o,"(formData, element, event)!");return a(e,n||r,t)}Salla.log("window."+o+"() not found!")}})),e},HTMLAnchorElement.prototype.getAjaxFormData=function(e){return{formData:this.getFilteredData(null,e),url:this.getAttribute("href"),method:this.dataset.type||"get",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}};var nu=function(){function e(){this.events={},this.namespace="";var e=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(e&&e.length>1?e[1]:"").toLowerCase()}e.prototype.after_init=function(){this.createDynamicFunctions()};e.prototype.createDynamicFunctions=function(){var e=this;Object.keys(this.events).forEach((function(t){e.createDynamicEventFuns(t),e.createDynamicListenerFuns(t)}))};e.prototype.createDynamicEventFuns=function(e){if(this[e])return;var t=this;this[e]=function(){var n=[];for(var r=0;r<arguments.length;r++){n[r]=arguments[r]}return t.dispatch.apply(t,__spreadArray([e],n,false))}};e.prototype.createDynamicListenerFuns=function(e){var t="on"+e.charAt(0).toUpperCase()+e.slice(1);if(this[t])return;var n=this;this[t]=function(t){var r=this;return n.on(e,(function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return Vl(r,void 0,void 0,(function(){return __generator(this,(function(n){return[2,t.apply(void 0,e)]}))}))}))}};e.prototype.getEventName=function(e){return e=this.events[e]||e,!this.namespace||e.includes("::")?e:this.namespace+Salla.event.delimiter+e};e.prototype.dispatch=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}return(t=Salla.event).emitAsync.apply(t,__spreadArray([this.getEventName(e)],n,false))};e.prototype.on=function(e,t,n){if(n===void 0){n={}}return Salla.event.addListener(this.getEventName(e),t,n)};e.prototype.once=function(e,t){return Salla.event.once(this.getEventName(e),t)};return e}();function ru(e){e&&e.sallaInitiated&&!e.initiated&&(e.sallaInitiated(),e.initiated=!0)}Salla.event.auth=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="auth",t.events={login:"login",logout:"logout",codeSent:"code.sent",codeNotSent:"code.not-sent",verified:"verified",verificationFailed:"verification.failed",loggedIn:"logged.in",registered:"registered",registrationFailed:"registration.failed",loggedOut:"logged.out",failedLogout:"failed.logout",refreshFailed:"refresh.failed",tokenFetched:"token.fetched",tokenInvalid:"token.invalid"},t.after_init();return t}t.prototype.login=function(e){return e?(e.type&&this.setTypeActionOnVerified(e.type),this.next_event=e.next_event||null,this.dispatch.apply(this,__spreadArray(["login"],arguments,false))):(this.next_event=null,this.dispatch.apply(this,__spreadArray(["login"],arguments,false)))};t.prototype.loggedIn=function(e){return Vl(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){return[2,Salla.profile.info().finally((function(){return t.dispatch("loggedIn",e)}))]}))}))};t.prototype.setTypeActionOnVerified=function(e){this.type_action_on_verified=e};t.prototype.getTypeActionOnVerified=function(){return this.type_action_on_verified||"redirect"};return t}(nu)),Salla.event.cart=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="cart",t.events={latestFetched:"latest.fetched",latestFailed:"latest.failed",updated:"updated",itemUpdated:"item.updated",itemUpdatedFailed:"item.updated.failed",itemAdded:"item.added",itemAddedFailed:"item.added.failed",itemDeleted:"item.deleted",itemDeletedFailed:"item.deleted.failed",submitted:"submitted",submitFailed:"submit.failed",imageDeleted:"image.deleted",imageNotDeleted:"image.not.deleted",detailsFetched:"details.fetched",detailsNotFetched:"details.not.fetched",successReset:"success.reset",priceQuoteSucceeded:"price-quote.succeeded",priceQuoteFailed:"price-quote.failed",offersFetched:"offers.fetched",offersFailed:"offers.failed",couponAdded:"coupon.added",couponDeleted:"coupon.deleted",couponAdditionFailed:"coupon.addition.failed",couponDeletionFailed:"coupon.deletion.failed",quickOrderSettingFetched:"quick-order.fetched",quickOrderSettingFailed:"quick-order.failed",quickOrderSucceeded:"quick-order.succeeded",quickOrderFailed:"quick-order.failed",submitting:"submitting"},t.after_init();return t}t.prototype.updated=function(e){var t;return Salla.cookie.set("fresh_summary",1),e&&"object"==typeof e?(e.offer&&salla.product.event.offerExisted(e.offer),e.redirect&&(salla.log("The current cart is purchased!"),salla.cart.api.reset()),e.cart?(salla.storage.set("cart.summary",{total:e.cart.total,sub_total:e.cart.sub_total,discount:e.cart.discount,tax_amount:e.cart.tax_amount,total_discount:e.cart.total_discount,real_shipping_cost:e.cart.real_shipping_cost,count:e.cart.count,shipping_cost:((t=e.cart.free_shipping_bar)===null||t===void 0?void 0:t.has_free_shipping)?0:e.cart.real_shipping_cost}),this.dispatch("updated",e.cart)):void salla.log("Failed to get the cart summary!")):(Salla.logger.info("Cart summary not an object!",e),this.dispatch("updated"))};t.prototype.latestFetched=function(e){return this.updated(e.data),this.dispatch("latestFetched",e)};t.prototype.itemAdded=function(e,t){return this.updated(e.data),this.dispatch("itemAdded",e,t)};t.prototype.itemDeleted=function(e,t){return this.updated(e.data),this.dispatch("itemDeleted",e,t)};t.prototype.itemUpdated=function(e,t){return this.updated(e.data),this.dispatch("itemUpdated",e,t)};t.prototype.couponAdded=function(e,t){return this.updated(e.data),this.dispatch("couponAdded",e,t)};t.prototype.couponDeleted=function(e,t){return this.updated(e.data),this.dispatch("couponDeleted",e,t)};return t}(nu)),Salla.event.order=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="order",t.events={canceled:"canceled",notCanceled:"not.canceled",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",invoiceSent:"invoice.sent",invoiceNotSent:"invoice.not.sent",ordersFetched:"order.fetched",ordersNotFetched:"order.not.fetched"},t.after_init();return t}return t}(nu)),Salla.event.scope=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="scope",t.events={fetched:"fetched",notFetched:"not.fetched",productAvailabilityFetched:"product-availability.fetched",productAvailabilityNotFetched:"product-availability.not.fetched",changeSucceeded:"changed",changeFailed:"not.changed"},t.after_init();return t}return t}(nu)),Salla.event.rating=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="rating",t.events={orderNotFetched:"order.not.fetched",orderFetched:"order.fetched",storeRated:"store.rated",storeFailed:"store.failed",productsRated:"products.rated",productsFailed:"products.failed",shippingRated:"shipping.rated",shippingFailed:"shipping.failed"},t.after_init();return t}return t}(nu)),Salla.event.booking=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.events={added:"added",additionFailed:"addition.failed"},t.after_init();return t}return t}(nu)),Salla.event.comment=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="comment",t.events={added:"added",additionFailed:"addition.failed",fetched:"fetched",fetchFailed:"fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.landing=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="landing",t.events={detailsFetched:"order.fetched",getDetailsFailed:"get.details.failed",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",breadcrumbFetched:"breadcrumb.fetched",breadcrumbFetchFailed:"breadcrumb.fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.loyalty=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="loyalty",t.events={exchangeSucceeded:"exchange.succeeded",exchangeFailed:"exchange.failed",programFetched:"program.fetched",programNotFetched:"program.not.fetched",resetSucceeded:"exchange-reset.succeeded",resetFailed:"exchange-reset.failed"},t.after_init();return t}t.prototype.exchangeSucceeded=function(e,t){return salla.cart.event.updated(e.data),this.dispatch("exchangeSucceeded",e,t)};t.prototype.resetSucceeded=function(e){return salla.cart.event.updated(e.data),this.dispatch("resetSucceeded",e)};return t}(nu)),Salla.event.product=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="product",t.events={priceUpdated:"price.updated",priceUpdateFailed:"price.updated.failed",availabilitySubscribed:"availability.subscribed",availabilitySubscribeFailed:"availability.subscribe.failed",categoriesFetched:"categories.fetched",categoriesFailed:"categories.failed",searchFailed:"search.failed",searchResults:"search.results",offerExisted:"offer.existed",fetchOffersFailed:"fetch.offers.failed",offersFetched:"offers.fetched",sizeGuideFetched:"size-guide.fetched",sizeGuideFetchFailed:"size-guide.failed",giftFetched:"gift.fetched",giftFetchFailed:"gift.failed",detailFetched:"detail.fetched",detailFetchFailed:"detail.failed",addGiftToCartSucceeded:"gift.add-to-cart.succeeded",addGiftToCartFailed:"gift.add-to-cart.failed",giftImageUploadSucceeded:"gift.image-upload.succeeded",giftImageUploadFailed:"gift.image-upload.failed",productListFetchSucceeded:"fetch.succeeded",productListFetchFailed:"fetch.failed",productOptionsFetched:"options.fetched",productOptionsNotFetched:"options.not.fetched"},t.after_init();return t}return t}(nu)),Salla.event.profile=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="profile",t.events={updated:"updated",updateFailed:"update.failed",verificationCodeSent:"verification.code.sent",updateContactsFailed:"update.contacts.failed",verified:"verified",unverified:"unverified",infoFetched:"info.fetched",infoNotFetched:"info.not.fetched",settingsUpdated:"settings.updated",updateSettingsFailed:"update.settings.failed",deleted:"deleted",notDeleted:"not.deleted"},t.after_init();return t}return t}(nu)),Salla.event.currency=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="currency",t.events={changed:"changed",failed:"failed",fetched:"fetched",failedToFetch:"failed.to.fetch"},t.after_init();return t}return t}(nu)),Salla.event.document=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="document",t.events={click:"click",change:"change",submit:"submit",keyup:"keyup",leaving:"leaving",request:"request",requestFailed:"request.failed"},t.after_init();return t}t.prototype.onClick=function(e,t){this.fireCallableFuns("click",e,t)};t.prototype.onChange=function(e,t){this.fireCallableFuns("change",e,t)};t.prototype.onSubmit=function(e,t){this.fireCallableFuns("submit",e,t)};t.prototype.onKeyup=function(e,t){this.fireCallableFuns("keyup",e,t)};t.prototype.fireCallableFuns=function(e,t,n){this.on(e,(function(e){"function"!=typeof t?"function"==typeof n&&e.target.matches(t)&&n(e):t(e)}))};t.prototype.fireEvent=function(e,t){var n=[];for(var r=2;r<arguments.length;r++){n[r-2]=arguments[r]}return this.fireEventForElements.apply(this,__spreadArray([e,t,!1],n,false))};t.prototype.fireEventForAll=function(e,t){var n=[];for(var r=2;r<arguments.length;r++){n[r-2]=arguments[r]}return this.fireEventForElements.apply(this,__spreadArray([e,t,!0],n,false))};t.prototype.fireEventForElements=function(e,t,n){var r=this;var i=[];for(var o=3;o<arguments.length;o++){i[o-3]=arguments[o]}if("string"==typeof e){if(n)return document.querySelectorAll(e).forEach((function(e){return r.fireEventForElements.apply(r,__spreadArray([e,t,!1],i,false))}));e=document.querySelector(e)}if(!e)return void salla.log("Failed To get element to fire event: "+t);var a=new(CustomEvent.bind.apply(CustomEvent,__spreadArray([void 0,t],i,false)));return e.dispatchEvent(a)};return t}(nu)),Salla.event.wishlist=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="wishlist",t.events={added:"added",removed:"removed",additionFailed:"addition.failed",removingFailed:"removing.failed"},t.after_init();return t}return t}(nu)),Salla.event.infiniteScroll=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="infiniteScroll",t.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},t.after_init();return t}return t}(nu)),Salla.event.notifications=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="notifications",t.events={fetched:"fetched",fetchFailed:"fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.component=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="component",t.events={menuFetched:"menus.fetched",menuFetchFailed:"menus.fetch.failed",reviewsFetched:"reviews.fetched",reviewsFetchFailed:"reviews.fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.advertisement=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="advertisement",t.events={fetched:"advertisement.fetched",fetchFailed:"advertisement.not.fetched"},t.after_init();return t}return t}(nu)),Salla.event.navigation=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="navigation",t.events={breadcrumbFetched:"breadcrumb.fetched",breadcrumbFetchFailed:"breadcrumb.fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.metadata=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="metadata",t.events={valueFetched:"value.fetched",valueNotFetch:"value.not.fetched"},t.after_init();return t}return t}(nu)),Salla.event.on("twilight::initiated",(function(){Object.keys(Salla).forEach((function(e){"object"==typeof(e=Salla[e])&&(ru(e),Object.keys(e).forEach((function(t){ru(e[t])})))}))})),Salla.config.default_properties={debug:"undefined"!=typeof process&&"development"==="production",token:null,fastRequests:!0,canLeave:!0,store:{api:["group","test"].includes(window.location.hostname.split(".").pop())?window.location.origin+"/api/v1/":"https://api.salla.dev/store/v1/"},currencies:{SAR:{code:"SAR",name:"ريال سعودي",symbol:"ر.س",amount:1,country_code:"sa"}}},Salla.config.merge(Salla.config.default_properties),Salla.config.triedToGetCurrencies_=!1,Salla.config.triedToGetLanguages_=!1,Salla.config.isUser=function(){return"user"===Salla.config.get("user.type")},Salla.config.isGuest=function(){return!Salla.config.isUser()},Salla.config.languages=function(){return Vl(i,void 0,void 0,(function(){var e,t;var n,r;return __generator(this,(function(i){switch(i.label){case 0:if(Salla.config.triedToGetLanguages_)return[2,Salla.config.get("languages")];Salla.config.triedToGetLanguages_=!0;e=!0,t=[];return[4,salla.document.api.request("languages",null,"get")];case 1:return[2,((r=(n=i.sent())===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.map((function(n){e&&(t=[],e=!1),n.code=n.code||n.iso_code,n.url=salla.url.get(n.code),n.is_rtl=n.is_rtl||n.rtl,t.push(n)})),Salla.config.set("languages",t),t)]}}))}))},Salla.config.currencies=function(){return Vl(i,void 0,void 0,(function(){var e,t;var n,r;return __generator(this,(function(i){switch(i.label){case 0:if(Salla.config.triedToGetCurrencies_)return[2,Salla.config.get("currencies")];Salla.config.triedToGetCurrencies_=!0;e=!0,t={};return[4,salla.currency.api.list()];case 1:return[2,((r=(n=i.sent())===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.map((function(n){e&&(t={},e=!1),n.country_code=n.code.substr(0,2).toLowerCase(),t[n.code]=n})),Salla.config.set("currencies",t),t)]}}))}))};var iu=function(){function e(){this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.endpointsMethods={},this.endpointsHeaders={};var e=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(e&&e.length>1?e[1]:"").toLowerCase(),this.debounce={request:void 0,time:300,enabled:!0,exclude:[]}}e.prototype.after_init=function(){};e.prototype.normalRequest=function(e,t,n){if(t===void 0){t=void 0}if(n===void 0){n=null}var r=Array.isArray(e),i=r?this.getUrl.apply(this,e):this.getUrl(e);e=r?e[0]:e,n=n||this.endpointsMethods[e]||"post";var o=this.endpointsHeaders[e];if("get"===n&&t instanceof FormData){var a={};Array.from(t.entries()).forEach((function(e){a[e[0]]=e[1]})),t={params:a}}return o&&"get"===n&&(t=t?Object.assign(t,o):o),this.webEndpoints.includes(e)?i=salla.url.get(i):"http"!==i.substring(0,4)&&(i=salla.url.api(i)),Salla.api.request(i,t,n,{headers:o})};e.prototype.request=function(e,t,n){if(t===void 0){t=void 0}if(n===void 0){n=null}return!salla.api.isFastRequestsAllowed()&&this.debounce.enabled?(this.debounce.request||(this.debounce.request=salla.helpers.debounce(this.normalRequest.bind(this),this.debounce.time)),this.debounce.request(e,t,n)):this.normalRequest(e,t,n)};e.prototype.getUrl=function(e){var t=this.endpoints[e]||e;var n=/{[^{}]+}/i;for(var r=1;r<arguments.length;r++)t=t.replace(n,arguments[r]);return t};e.prototype.event=function(){return salla.event[this.className]};return e}();var ou=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.addToCartTries=0,t.namespace="cart",t._pendingCartIdRequest=null,t.endpoints={latest:"cart/latest",latestApi:"cart/latest",details:"cart/{cart}",quickAdd:"cart/{cart}/item/{product}/quick-add",addItem:"cart/{cart}/item/{product}/add",deleteItem:"cart/{cart}/item/{item}",updateItem:"cart/{cart}/item/{item}",deleteImage:"cart/{cart}/image/{image}",uploadImage:"cart/{cart}/image",status:"cart/{cart}/status",addCoupon:"cart/{id}/coupon",deleteCoupon:"cart/{id}/coupon",getQuickOrderSettings:"checkout/quick-order",createQuickOrder:"checkout/quick-order",priceQuote:"cart/{cartId}/price-quote",offers:"offers/cart/{cartId}",giftCartDetails:"cart/{cartId}/buy-as-gift",cartGiftToCart:"cart/{cart_id}/buy-as-gift"},t.endpointsMethods={latest:"get",details:"get",status:"get",updateItem:"post",deleteItem:"delete",deleteImage:"delete",deleteCoupon:"put",getQuickOrderSettings:"get",offers:"get",giftCartDetails:"get"},t.webEndpoints=["latest"],t.latestCart=null,t.after_init(),salla.event.on("api::initiated",(function(){return salla.api.cart.getCurrentCartId(!1,"api::initiated")})),salla.event.on("auth::token.fetched",t._checkCurrentCart),salla.event.on("auth::token.invalid",t._checkCurrentCart),salla.event.on("auth::verified",(function(){return salla.api.cart.getCurrentCartId(!0,"auth::verified")}),{async:!0}),salla.event.on("twilight::initiated",(function(){return salla.api.cart.syncGuestCart()})),salla.event.on("profile::info.fetched",t._checkCurrentCart),salla.event.on("twilight::error",(function(e){return(e.includes("Cart not available")||e.includes("السلة غير متاحة"))&&salla.cart.api.reset()}));return t}t.prototype._checkCurrentCart=function(){var e,t;var n=salla.storage.get("cart"),r=(e=salla.config.get("user"))===null||e===void 0?void 0:e.id,i=(t=salla.config.get("store"))===null||t===void 0?void 0:t.id;n&&n.id&&(n.user_id===r&&n.store_id===i||(salla.log("cart",{user_id:n.user_id,store_id:n.store_id}),salla.log("current",{user_id:r,store_id:i}),salla.log("Api:: case2 => The cart is not belong to current "+(n.user_id!==r?"user":"store")+"!"),salla.cart.api.reset()),salla.url.is_page("cart")&&n.id!==salla.config.get("page.id")&&(salla.log("cart",{user_id:n.user_id,store_id:n.store_id}),salla.log("current",{user_id:r,store_id:i}),salla.log("Api:: case2 => The cart is different between storage:".concat(n.id," & session:").concat(salla.config.get("page.id")," !")),salla.cart.api.reset()))};t.prototype.getCurrentCartId=function(e,t){if(e===void 0){e=!1}if(t===void 0){t="getCurrentCartId"}return Vl(this,void 0,void 0,(function(){var n;var r=this;return __generator(this,(function(i){if(Salla.cart.api._pendingCartIdRequest)return[2,Salla.cart.api._pendingCartIdRequest];Salla.cart.api._pendingCartIdRequest=function(){return Vl(r,void 0,void 0,(function(){var n,r;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,,2,3]);if(!e){if(Salla.cart.api.latestCart)return[2,Salla.cart.api.latestCart.cart.id];n=Salla.storage.get("cart.id");if(n)return[2,n]}return[4,Salla.cart.api.latest(t)];case 1:r=i.sent();return[2,(Salla.cart.api.latestCart=r.data,Salla.cart.api.latestCart.cart.id)];case 2:Salla.cart.api._pendingCartIdRequest=null;return[7];case 3:return[2]}}))}))}();n=Salla.cart.api._pendingCartIdRequest;return[2,(Salla.cart.api._pendingCartIdRequest=null,n)]}))}))};t.prototype.getUploadImageEndpoint=function(e){return salla.url.api(this.getUrl("uploadImage",e||salla.storage.get("cart.id")))};t.prototype.latest=function(e){if(e===void 0){e="direct"}return this.request(salla.auth.api.isSessionless()?"latestApi":"latest",{params:{source:"",callerName:e}}).then((function(e){return salla.api.cart.set(e.data.cart),salla.event.cart.latestFetched(e),e})).catch((function(e){throw salla.api.cart.reset(),salla.event.cart.latestFailed(e),e}))};t.prototype.details=function(e,t){if(t===void 0){t=[]}return Vl(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){switch(r.label){case 0:n=e;if(n)return[3,2];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.details")];case 1:n=r.sent();r.label=2;case 2:return[2,(e=n,this.request(["details",e],{params:{with:t}}).then((function(e){return salla.cart.event.detailsFetched(e),e})).catch((function(e){throw salla.cart.event.detailsNotFetched(e),e})))]}}))}))};t.prototype.quickAdd=function(e,t,n){return Vl(this,void 0,void 0,(function(){return __generator(this,(function(r){return[2,this.addItem({id:e,quantity:t,offerType:n,endpoint:"quickAdd"})]}))}))};t.prototype.addItem=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r,i;return __generator(this,(function(o){switch(o.label){case 0:t=this.getCartPayload(e);if(!t.id){n='There is no product "id"!';return[2,(salla.cart.event.itemAddedFailed(n),salla.api.errorPromise(n))]}r=salla.form.getPossibleValue(t.payload,["endpoint"]);r&&["addItem","quickAdd"].includes(r)||(r=salla.form.getPossibleValue(t.payload,["quantity","donating_amount"])?"addItem":"quickAdd");return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.addItem")];case 1:i=o.sent();return[2,this.request([r,i,t.id],t.payload).then((function(e){return salla.cart.api.addToCartTries=0,salla.cart.event.itemAdded(e,t.id),e})).catch((function(n){if(!salla.cart.api.addToCartTries)return salla.cart.api.addToCartTries++,salla.cart.reset(),salla.cart.api.addItem(e);throw salla.cart.event.itemAddedFailed(n,t.id),n}))]}}))}))};t.prototype.deleteItem=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){switch(i.label){case 0:t=this.getCartPayload(e);if(!t.id){n='There is no "id"!';return[2,(salla.cart.event.itemDeletedFailed(n),salla.api.errorPromise(n))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.deleteItem")];case 1:r=i.sent();return[2,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}))]}}))}))};t.prototype.updateItem=function(e){var t;return Vl(this,void 0,void 0,(function(){var n,r,i;return __generator(this,(function(o){switch(o.label){case 0:n=this.getCartPayload(e);if(!n.id){r='There is no "id"!';return[2,(salla.cart.event.itemUpdatedFailed(r),salla.api.errorPromise(r))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.updateItem")];case 1:i=o.sent();return[2,("Object"===((t=n.payload.constructor)===null||t===void 0?void 0:t.name)?n.payload._method="PUT":n.payload.append("_method","PUT"),this.request(["updateItem",i,n.id],n.payload).then((function(e){return salla.cart.event.itemUpdated(e,n.id),e})).catch((function(e){throw salla.cart.event.itemUpdatedFailed(e,n.id),e})))]}}))}))};t.prototype.deleteImage=function(e){return Vl(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(r){switch(r.label){case 0:if(!(e=salla.form.getPossibleValue(e,["id","image_id","photo_id"]))){t='There is no "id"!';return[2,(salla.cart.event.imageNotDeleted(t),salla.api.errorPromise(t))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.deleteImage")];case 1:n=r.sent();return[2,this.request(["deleteImage",n,e]).then((function(t){return salla.cart.event.imageDeleted(t,e),t})).catch((function(t){throw salla.cart.event.imageNotDeleted(t,e),t}))]}}))}))};t.prototype.status=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){switch(i.label){case 0:t=e;if(t)return[3,2];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.status")];case 1:t=i.sent();i.label=2;case 2:e=t;n=salla.helpers.hasApplePay();i.label=3;case 3:i.trys.push([3,5,,6]);return[4,salla.cart.event.submitting()];case 4:i.sent();return[3,6];case 5:r=i.sent();salla.log("Error on: salla.cart.event.submitting()");return[3,6];case 6:return[2,this.request(["status",e],{params:{has_apple_pay:n}})]}}))}))};t.prototype.submit=function(){return Vl(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:if(salla.config.isGuest())return[2,(salla.log("it looks that the current user is not logged-in, lets login then submit"),salla.cart.loginOnCartPage())];e=this.status;return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.submit")];case 1:e.apply(this,[t.sent()]).then((function(e){var t;var n=(t=e.data.next_step)===null||t===void 0?void 0:t.to;if(n||(window.history.pushState({},"",salla.url.addParamToUrl("reload","empty_next_step")),window.history.pushState({},"",salla.url.addParamToUrl("acitve",!1===e.data.active?"false":"true_or_undfined")),salla.cart.reset(),window.location.reload()),!["checkout","refresh","login"].includes(n)){var r="Can't find next_step );";throw salla.cart.reset(),salla.cart.event.submitFailed(r),r}return salla.cart.event.submitted(e),"login"===n?salla.cart.loginOnCartPage():"checkout"===n?window.location.href=e.data.next_step.url+(salla.helpers.hasApplePay()?"?has_apple_pay=true":""):(window.history.pushState({},"",salla.url.addParamToUrl("reload","refresh")),void window.location.reload())})).catch((function(e){var t,n;salla.cart.api.tries=salla.cart.api.tries||0,salla.cart.reset();var r=404===((n=(t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.data)===null||n===void 0?void 0:n.status);if(r&&0===salla.cart.api.tries)return salla.cart.api.tries++,salla.log("we recived that the current cart is not found, we will try to re-submit one more time"),salla.cart.submit();throw r&&salla.error(salla.lang.get("pages.checkout.try_again")),salla.cart.event.submitFailed(e),e}));return[2]}}))}))};t.prototype.getCartPayload=function(e){var t=(e===null||e===void 0?void 0:e.data)||("object"==typeof e?e:void 0);return e=t?salla.form.getPossibleValue(t,["prod_id","product_id","item_id","id"]):e,t="object"==typeof t?t:void 0,{id:e,payload:t}};t.prototype.normalRequest=function(t,n,r){var i=this;if(n===void 0){n=void 0}if(r===void 0){r=null}return e.prototype.normalRequest.call(this,t,n,r).catch((function(e){return Vl(i,void 0,void 0,(function(){var t;return __generator(this,(function(n){throw 403===((t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.status)&&(this.reset(),salla.error(salla.lang.get("pages.checkout.try_again"))),e}))}))}))};t.prototype.reset=function(){salla.api.cart.latestCart=null,salla.storage.remove("cart"),salla.cookie.clearCookieByPrefix(salla.api.cart.getCartCookiePrefix()),salla.cart.event.successReset()};t.prototype.addCoupon=function(e){return Vl(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(r){switch(r.label){case 0:if(e=e.data||e,!(e=salla.form.getPossibleValue(e,["coupon"]))){t=new Error('There is no "Coupon Code"!');return[2,(t.name="EmptyCoupon",salla.event.cart.couponAdditionFailed(t),salla.api.errorPromise(t))]}return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.addCoupon")];case 1:n=r.sent();return[2,this.request(["addCoupon",n],{coupon:e}).then((function(e){return salla.event.cart.couponAdded(e,n),e})).catch((function(e){throw salla.event.cart.couponAdditionFailed(e,n),e}))]}}))}))};t.prototype.deleteCoupon=function(){return Vl(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.deleteCoupon")];case 1:e=t.sent();return[2,this.request(["deleteCoupon",e],{}).then((function(t){return salla.event.cart.couponDeleted(t,e),t})).catch((function(t){throw salla.event.cart.couponDeletionFailed(t,e),t}))]}}))}))};t.prototype.getQuickOrderSettings=function(){return this.request("getQuickOrderSettings").then((function(e){return salla.event.cart.quickOrderSettingFetched(e),e})).catch((function(e){throw salla.event.cart.quickOrderSettingFailed(e),e}))};t.prototype.createQuickOrder=function(e){return this.request("createQuickOrder",e).then((function(e){return salla.event.cart.quickOrderSucceeded(e),e})).catch((function(e){throw salla.event.cart.quickOrderFailed(e),e}))};t.prototype.priceQuote=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r,i;return __generator(this,(function(o){switch(o.label){case 0:if(!salla.config.isGuest())return[3,1];t=(salla.auth.api.setAfterLoginEvent("cart::priceQuote",e),void salla.event.dispatch("login::open"));return[3,4];case 1:n=this.request;r=["priceQuote"];i=e;if(i)return[3,3];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.priceQuote")];case 2:i=o.sent();o.label=3;case 3:t=n.apply(this,[r.concat([i])]).then((function(e){return salla.cart.api.reset(),salla.event.cart.priceQuoteSucceeded(e).then((function(){return setTimeout((function(){return window.location.href=salla.url.get("/")}),1e3),e}))})).catch((function(e){return salla.event.cart.priceQuoteFailed(e).then((function(){var t;throw 404===((t=e.error)===null||t===void 0?void 0:t.code)&&window.location.reload(),e}))}));o.label=4;case 4:return[2,t]}}))}))};t.prototype.loginOnCartPage=function(){salla.auth.setCanRedirect(!1),salla.event.dispatch("login::open",{withoutReload:!0}),salla.auth.event.onLoggedIn((function(){salla.event.dispatch("login::close"),salla.cart.submit()}))};t.prototype.set=function(e){salla.storage.set("cart",e),salla.api.cart.syncGuestCart()};t.prototype.offers=function(){return Vl(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.offers")];case 1:e=t.sent();return[2,this.request(["offers",e]).then((function(e){return salla.event.cart.offersFetched(e),e})).catch((function(e){throw salla.event.cart.offersFailed(e),e}))]}}))}))};t.prototype.getGiftCartDetails=function(){return Vl(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.getGiftCartDetails")];case 1:e=t.sent();return[2,this.request(["giftCartDetails",e]).then((function(t){return salla.product.event.giftFetched(t,e),t})).catch((function(t){throw salla.product.event.giftFetchFailed(t,e),t}))]}}))}))};t.prototype.addCartGiftToCart=function(e,t){if(t===void 0){t=!1}return Vl(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){switch(r.label){case 0:return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.addCartGiftToCart")];case 1:n=r.sent();return[2,this.request(["cartGiftToCart",n],e).then((function(e){return salla.product.event.addGiftToCartSucceeded(e,n),t&&(window.location.href=e.redirect),e})).catch((function(e){throw salla.product.event.addGiftToCartFailed(e,n),e}))]}}))}))};t.prototype.syncGuestCart=function(){var e,t;return Vl(this,void 0,void 0,(function(){var n,r,i,o,a,s;return __generator(this,(function(c){switch(c.label){case 0:if(!salla.config.isGuest())return[2];n=salla.api.cart.getCartCookiePrefix(),r=salla.cookie.getCookieByPrefix(n),i=salla.storage.get("cart.id");if(!(!i&&r.length))return[3,4];c.label=1;case 1:c.trys.push([1,3,,4]);return[4,salla.api.cart.latest()];case 2:o=c.sent(),a=(t=(e=o.data)===null||e===void 0?void 0:e.cart)===null||t===void 0?void 0:t.id;a&&salla.api.cart.setCartCookie(n,a);return[3,4];case 3:s=c.sent();salla.log("Failed to fetch latest cart:",s);return[3,4];case 4:salla.cookie.clearCookieByPrefix(n),i&&(salla.config.set("headers.s-cart-id",i),salla.api.cart.setCartCookie(n,i));return[2]}}))}))};t.prototype.setCartCookie=function(e,t){salla.cookie.set("".concat(e,"-").concat(t),t,1)};t.prototype.getCartCookiePrefix=function(){return"cart-id-"+salla.config.get("store.id")};return t}(iu);var au=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="loyalty",t.endpoints={getProgram:"loyalty",exchange:"loyalty/exchange",reset:"loyalty/exchange"},t.endpointsMethods={getProgram:"get",reset:"put"},t.after_init();return t}t.prototype.getProgram=function(){return this.request("getProgram").then((function(e){return salla.loyalty.event.programFetched(e),e})).catch((function(e){throw salla.loyalty.event.programNotFetched(e),e}))};t.prototype.exchange=function(e,t){if(t===void 0){t=null}return Vl(this,void 0,void 0,(function(){var n,r,i;return __generator(this,(function(o){switch(o.label){case 0:if(!(e=salla.form.getPossibleValue(e,["id","loyalty_prize_id","prize_id"]))){n="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.exchangeFailed(n),salla.api.errorPromise(n))]}r=t;if(r)return[3,2];return[4,salla.cart.getCurrentCartId(!1,"salla.api.loyalty.exchange")];case 1:r=o.sent();o.label=2;case 2:if(!(t=r)){i="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.exchangeFailed(i),salla.api.errorPromise(i))]}return[2,this.request("exchange",{loyalty_prize_id:e,cart_id:t}).then((function(t){return salla.loyalty.event.exchangeSucceeded(t,e),t})).catch((function(t){throw salla.loyalty.event.exchangeFailed(t,e),t}))]}}))}))};t.prototype.reset=function(e){if(e===void 0){e=null}return Vl(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(r){switch(r.label){case 0:t=e;if(t)return[3,2];return[4,salla.cart.getCurrentCartId(!1,"salla.api.loyalty.reset")];case 1:t=r.sent();r.label=2;case 2:if(!(e=t)){n="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.resetFailed(n),salla.api.errorPromise(n))]}return[2,this.request("reset",{cart_id:e}).then((function(e){return salla.loyalty.event.resetSucceeded(e),e})).catch((function(e){throw salla.loyalty.event.resetFailed(e),e}))]}}))}))};return t}(iu);var su=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="auth",t.canRedirect_=!0,t.afterLoginEvent={event:null,payload:null},t.endpoints={login:"auth/{type}/send_verification",resend:"auth/resend_verification",verify:"auth/{type}/verify",register:"auth/register",logout:"logout",refresh:"auth/refresh"},t.webEndpoints=["logout","auth/jwt","refresh"],t.endpointsMethods={logout:"get"},t.inIframe=salla.helpers.isIframe(),t.after_init();return t}t.prototype.setAfterLoginEvent=function(e,t){salla.api.auth.afterLoginEvent={event:e,payload:t}};t.prototype.setCanRedirect=function(e){salla.api.auth.canRedirect_=e};t.prototype.canRedirect=function(){return salla.api.auth.canRedirect_&&!salla.api.auth.afterLoginEvent.event};t.prototype.login=function(e){(e===null||e===void 0?void 0:e.data)&&(e=e.data);var t=salla.form.getPossibleValue(e,["type"]);if(!["email","mobile"].includes(t)){var n="Login type should be in: [email, mobile]";return salla.auth.event.codeNotSent(n),salla.api.errorPromise(n)}return this.request(["login",t],e).then((function(e){return salla.auth.event.codeSent(e,t),e})).catch((function(e){throw salla.auth.event.codeNotSent(e,t),salla.auth.api.trackBlockedError(e,"login"),e}))};t.prototype.verify=function(e,t){if(t===void 0){t=!0}return Vl(this,void 0,void 0,(function(){var n,r,i;return __generator(this,(function(o){switch(o.label){case 0:n=salla.form.getPossibleValue(e,["type"]);if(!n){r="Failed to know what's login type!";return[2,(salla.auth.event.verificationFailed(r),salla.api.errorPromise(r))]}t=!1!==salla.form.getPossibleValue(e,["supportWebAuth"])&&t,salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event);return[4,salla.auth.api.request(["verify",n],e)];case 1:i=o.sent();return[2,200!==(i===null||i===void 0?void 0:i.status)?(salla.auth.event.verificationFailed(i,n),salla.api.errorPromise(i)):salla.auth.api.handlAfterAuthenticatedResponse(i,t)]}}))}))};t.prototype.handlAfterAuthenticatedResponse=function(e,t){var n;return Vl(this,void 0,void 0,(function(){var r,i,o;return __generator(this,(function(a){switch(a.label){case 0:e.data||(e={data:e});r="authenticated"===((n=e.data)===null||n===void 0?void 0:n.case);r&&salla.auth.event.tokenFetched(e.data.token);i=t&&!this.inIframe&&!this.isSessionless();if(!i)return[3,2];return[4,salla.auth.api.request("auth/jwt",{callerName:"salla.auth.api.handlAfterAuthenticatedResponse"})];case 1:i=a.sent();a.label=2;case 2:i;o=r;if(!o)return[3,4];return[4,salla.auth.event.loggedIn(e).then((function(){return salla.auth.api.afterUserLogin()}))];case 3:o=a.sent();a.label=4;case 4:o;return[4,salla.auth.event.verified(e,e.data.verification.type)];case 5:return[2,(a.sent(),salla.api.successPromise(e))]}}))}))};t.prototype.resend=function(e){var t;return(e=e.data||e).type=e.type||"mobile","mobile"!==e.type||e.phone&&e.country_code?"email"!==e.type||e.email?this.request("resend",e).then((function(t){return salla.auth.event.codeSent(t,e),t})).catch((function(t){throw salla.auth.event.codeNotSent(t,e),salla.auth.api.trackBlockedError(t,"resend"),t})):(salla.auth.event.codeNotSent(t="There is no email!",e),salla.api.errorPromise(t)):(salla.auth.event.codeNotSent(t="There is no phone or country_code!",e),salla.api.errorPromise(t))};t.prototype.register=function(e){var t=this;var n;return e.data&&(n=e.element,e=e.data),salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event),this.request("register",e).then((function(e){return Vl(t,void 0,void 0,(function(){var t,r;var i;return __generator(this,(function(o){switch(o.label){case 0:salla.auth.event.registered.call(n,e);t="authenticated"===((i=e.data)===null||i===void 0?void 0:i.case);if(!t)return[3,3];salla.auth.event.tokenFetched(e.data.token);r=!this.inIframe&&!this.isSessionless();if(!r)return[3,2];return[4,salla.auth.request("auth/jwt",{callerName:"salla.auth.api.register"})];case 1:r=o.sent();o.label=2;case 2:t=(r,salla.auth.event.loggedIn(e),salla.auth.api.afterUserLogin());o.label=3;case 3:return[2,(t,e)]}}))}))})).catch((function(e){throw salla.auth.event.registrationFailed.call(n,e),salla.auth.api.trackBlockedError(e,"register"),e}))};t.prototype.handleIframeReadyAction=function(e,t){var n;(n=e.contentWindow)===null||n===void 0?void 0:n.postMessage({source:"logout",type:"init",data:{id:salla.config.get("store.id"),lang:"ar",appUrl:t,apiUrl:salla.config.get("store.api").replace(/\/+$/,""),settings:salla.config.all(),storage:{}}},"*")};t.prototype.appendIframeAndLogout=function(){var e=this;return new Promise((function(t){var n=salla.config.get("login.url","https://accounts.salla.com");var r=document.createElement("iframe");r.style.display="none",r.src="".concat(n,"/logout");var i=function(o){if("login"!==o.data.source)return;var a=o.data.type.replace("iframe::","");if(salla.log("iframe::logout-iframe message received",o.data),["logged-out","ready"].includes(a)){if("ready"===a)return e.handleIframeReadyAction(r,n);window.removeEventListener("message",i),r.remove(),t()}};window.addEventListener("message",i),document.body.appendChild(r)}))};t.prototype.logout=function(e){var t=this;if(e===void 0){e="twilight"}return salla.storage.clearAll(),salla.cookie.clearAll(),e=encodeURI(e),salla.auth.event.loggedOut().then((function(){return t.appendIframeAndLogout()})).then((function(){var t=salla.url.get("logout?from=".concat(e));console.log("Going to ".concat(t,", to do any thing before this action use: salla.auth.even.onLoggedOut(()=>{...})"));try{location.href=t}catch(e){salla.log(e)}})).catch((function(e){return console.error("Error during logout:",e)}))};t.prototype.refresh=function(){return this.request("refresh").then((function(e){return salla.auth.event.tokenFetched(e.data.token),e})).catch((function(e){throw salla.auth.event.refreshFailed(e),e}))};t.prototype.afterUserLogin=function(){this.afterLoginEvent.event&&salla.event.emit(this.afterLoginEvent.event,this.afterLoginEvent.payload)};t.prototype.isSessionless=function(){return"sessionless"===salla.config.get("auth.mode")};t.prototype.trackBlockedError=function(e,t){var n,r;blockedByProxy=void 0===((r=(n=e===null||e===void 0?void 0:e.response)===null||n===void 0?void 0:n.headers)===null||r===void 0?void 0:r["s-ray"]),blockedByProxy&&salla.analytics.track("BlockedByProxy",{class:"auth",function:t,reason:"non-server-request",message:e.message})};return t}(iu);var cu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="order",t.endpoints={cancel:"orders/cancel/{id}",createCartFromOrder:"reorder/{id}",sendInvoice:"orders/send/{id}",fetch:"orders"},t.endpointsMethods={createCartFromOrder:"get",fetch:"get"},t.after_init();return t}t.prototype.show=function(e){var t=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["id","order_id"]);salla.event.dispatch("mobile::order.placed",{order_id:t}),location.href=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["url"])};t.prototype.cancel=function(e){return e=e||Salla.config.get("page.id"),this.request(["cancel",e],{params:{has_apple_pay:salla.helpers.hasApplePay()}}).then((function(t){return salla.event.order.canceled(t,e),t})).catch((function(t){throw salla.event.order.notCanceled(t,e),t}))};t.prototype.createCartFromOrder=function(e){return e=e||salla.config.get("page.id"),this.request(["createCartFromOrder",e]).then((function(t){return salla.cart.reset(),salla.event.order.orderCreated(t,e),window.location.href=t.data.url,t})).catch((function(t){throw salla.event.order.orderCreationFailed(t,e),t}))};t.prototype.sendInvoice=function(e){var t=salla.form.getPossibleValue(e,["id"])||salla.config.get("page.id");if(!t||isNaN(t)){var n="There is no id!";return salla.order.event.invoiceNotSent(n),salla.api.errorPromise(n)}return this.request(["sendInvoice",t],e).then((function(e){return salla.event.order.invoiceSent(e,t),e})).catch((function(e){throw salla.event.order.invoiceNotSent(e,t),e}))};t.prototype.fetch=function(e){return this.request(["fetch"],{params:e}).then((function(e){return salla.event.order.ordersFetched(e),e})).catch((function(e){throw salla.event.order.ordersNotFetched(e),e}))};return t}(iu);var lu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="product",t.previousQuery="",t.endpoints={getPrice:"products/{id}/price",availabilitySubscribe:"products/{id}/availability-notify",search:"products/search",details:"products/{product_id}/details",categories:"products/categories/{?id}",offers:"products/{product_id}/specialoffer",getSizeGuides:"products/{prod_id}/size-guides",giftProductDetails:"products/{product_id}/buy-as-gift",productGiftToCart:"products/{product_id}/buy-as-gift",giftImage:"products/buy-as-gift/image",buyNow:"products/{product_id}/buy-now",fetch:"products",fetchOptions:"products/options"},t.endpointsMethods={details:"get",giftProductDetails:"get",fetch:"get",offers:"get",fetchOptions:"get"},t.after_init();return t}t.prototype.getPrice=function(e){var t=e.data||e,n=salla.form.getPossibleValue(t,["id","prod_id","product_id"]);return this.request(["getPrice",n],"object"==typeof t?t:void 0).then((function(e){return salla.product.event.priceUpdated(e,n),e})).catch((function(e){throw salla.product.event.priceUpdateFailed(e,n),e}))};t.prototype.categories=function(e){return this.request(["categories",e||""],null,"get").then((function(e){return salla.product.event.categoriesFetched(e),e})).catch((function(e){throw salla.product.event.categoriesFailed(e),e}))};t.prototype.availabilitySubscribe=function(e){var t=e.data||e;return e=salla.form.getPossibleValue(t,["id","prod_id"]),this.request(["availabilitySubscribe",e],"object"==typeof t?t:void 0).then((function(t){return salla.product.event.availabilitySubscribed(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribeFailed(t,e),t}))};t.prototype.search=function(e){var t;var n=e.data;if(n||(n={params:"string"==typeof e?{query:e}:e}),!(e=n instanceof FormData?n.get("query"):n.query||((t=n.params)===null||t===void 0?void 0:t.query))){var r='There is no "query"!';return salla.product.event.searchFailed(r),salla.api.errorPromise(r)}if(e===salla.api.product.previousQuery){var i="Query is same as previous one!";return salla.product.event.searchFailed(i),salla.api.product.previousQuery=null,salla.api.errorPromise(i)}return salla.api.product.previousQuery=e,this.request("search",n,"get").then((function(t){return salla.product.event.searchResults(t,e),t})).catch((function(t){throw salla.product.event.searchFailed(t,e),t}))};t.prototype.offers=function(e){if(!(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)|e,["product_id","id"]))){var t='There is no "product_id"!';return salla.product.event.fetchOffersFailed(t),salla.api.errorPromise(t)}return this.request(["offers",e]).then((function(t){return salla.product.event.offersFetched(t,e),t})).catch((function(t){throw salla.product.event.fetchOffersFailed(t,e),t}))};t.prototype.getSizeGuides=function(e){return this.request("products/".concat(e,"/size-guides"),null,"get").then((function(t){return salla.product.event.sizeGuideFetched(t,e),t})).catch((function(t){throw salla.product.event.sizeGuideFetchFailed(t,e),t}))};t.prototype.getGiftProductDetails=function(e){return this.request(["giftProductDetails",e]).then((function(t){return salla.product.event.giftFetched(t,e),t})).catch((function(t){throw salla.product.event.giftFetchFailed(t,e),t}))};t.prototype.getDetails=function(e,t){if(t===void 0){t=[]}if(!Array.isArray(t)){var n="withItems should be array.";return salla.product.event.detailFetchFailed(n),salla.api.errorPromise(n)}if(!e){var r="productId is not passed.";return salla.product.event.detailFetchFailed(r),salla.api.errorPromise(r)}return this.request(["details",e],{params:{with:t}}).then((function(t){return salla.product.event.detailFetched(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribeFailed(t,e),t}))};t.prototype.addProductGiftToCart=function(e,t,n){if(n===void 0){n=!1}return this.request(["productGiftToCart",e],t).then((function(t){return salla.product.event.addGiftToCartSucceeded(t,e),n&&(window.location.href=t.redirect),t})).catch((function(t){throw salla.product.event.addGiftToCartFailed(t,e),t}))};t.prototype.uploadGiftImage=function(e){return this.request("giftImage",e).then((function(e){return salla.product.event.giftImageUploadSucceeded(e),e})).catch((function(e){throw salla.product.event.giftImageUploadFailed(e),e}))};t.prototype.fetch=function(e){var t=this;if(!e.source){var n="Source cannot be empty. Please provide one.";return salla.product.event.productListFetchFailed(n),salla.api.errorPromise(n)}var r=!e.source_value,i="string"==typeof e.source_value&&"[]"===e.source_value,o=Array.isArray(e.source_value)&&!e.source_value.length;if((r||i||o)&&!["offers","latest","sales","wishlist","top-rated"].includes(e.source)){var a="Source value cannot be empty. Please provide one.";return salla.product.event.productListFetchFailed(a),salla.api.errorPromise(a)}if(["categories","brands","tags","selected"].includes(e.source)&&!Array.isArray(e.source_value)){var s="SourceValue type error. Expected an array.";return salla.product.event.productListFetchFailed(s),salla.api.errorPromise(s)}if("search"===e.source&&"string"!=typeof e.source_value){var c="SourceValue type error. Expected a string.";return salla.product.event.productListFetchFailed(c),salla.api.errorPromise(c)}if("related"===e.source&&isNaN(e.source_value)){var l="SourceValue type error. Expected a number.";return salla.product.event.productListFetchFailed(l),salla.api.errorPromise(l)}return this.request(this.endpoints.fetch,{params:e},"get").then((function(e){return Vl(t,void 0,void 0,(function(){return __generator(this,(function(t){return[2,(salla.product.event.productListFetchSucceeded(e),e)]}))}))})).catch((function(e){throw salla.product.event.productListFetchFailed(e),e}))};t.prototype.fetchOptions=function(e,t){if(t===void 0){t={}}if(!e||0===e.length){var n="At least one product ID is required. Please provide a valid list of product IDs.";return salla.product.event.productOptionsNotFetched(n),salla.api.errorPromise(n)}var r=t.with,i=r===void 0?[]:r,o={selected:e};return i.length>0&&(o.with=i),this.request(this.endpoints.fetchOptions,{params:o},"get").then((function(e){return salla.product.event.productOptionsFetched(e),e})).catch((function(e){throw salla.product.event.productOptionsNotFetched(e),e}))};return t}(iu);var uu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="profile",t.endpoints={info:"auth/user",update:"profile/update",updateContacts:"profile/contacts/update",updateSettings:"profile/settings",verify:"profile/verify",delete:"profile"},t.endpointsMethods={delete:"delete"},t.after_init();return t}t.prototype.info=function(){return this.request("info",null,"get").then((function(e){var t={id:e.data.id,type:"user",email:e.data.email,mobile:e.data.phone.code+e.data.phone.number,country_code:e.data.phone.country,language_code:e.data.language,currency_code:e.data.currency,notifications:e.data.notifications,pending_orders:e.data.pending_orders,avatar:e.data.avatar,first_name:e.data.first_name,last_name:e.data.last_name,is_hidden_name:e.data.is_hidden_name,is_notifiable:e.data.is_notifiable,can_comment:salla.config.get("user.can_comment"),fetched_at:Date.now()};return salla.config.set("user",t),salla.storage.set("user",t),salla.profile.event.infoFetched(e),e})).catch((function(e){throw salla.profile.event.infoNotFetched(e),e}))};t.prototype.update=function(e){if(Salla.config.get("store.features").includes("sso-login")){var t="SSO login is enabled. You cannot update your profile.";return Salla.error(t),Promise.reject(new Error(t))}return this.request("update",e).then((function(e){return salla.profile.event.updated(e),e})).catch((function(e){throw salla.event.profile.updateFailed(e),e}))};t.prototype.updateContacts=function(e){return this.request("updateContacts",e).then((function(e){return salla.profile.event.verificationCodeSent(e),e})).catch((function(e){throw salla.event.profile.updateContactsFailed(e),e}))};t.prototype.verify=function(e){return this.request("verify",e).then((function(e){return salla.profile.event.verified(e),e})).catch((function(e){throw salla.event.profile.unverified(e),e}))};t.prototype.updateSettings=function(e){return this.request("updateSettings",e).then((function(e){return salla.event.profile.settingsUpdated(e),e})).catch((function(e){throw salla.event.profile.updateSettingsFailed(e),e}))};t.prototype.delete=function(){return this.request("delete").then((function(e){return salla.storage.clearAll(),salla.cookie.clearAll(),salla.auth.api.appendIframeAndLogout().then((function(){salla.event.profile.deleted(e),window.location.href=salla.url.get("logout")})),e})).catch((function(e){throw salla.event.profile.notDeleted(e),e}))};return t}(iu);var du=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="comment",t.endpoints={addComment:"{type}/{id}/comments",comments:"/comments"},t.after_init();return t}t.prototype.add=function(e){if((e===null||e===void 0?void 0:e.data)&&(e=e.data),"string"==typeof(e=this.getCommentPayload(e,!0)))return salla.event.comment.additionFailed(e),salla.api.errorPromise(e);if(!e.comment){var t="can't find comment content!";return salla.event.comment.additionFailed(t),salla.api.errorPromise(t)}return this.request(["addComment","blog"==e.type?"blogs":e.type,e.id],{comment:e.comment}).then((function(t){return salla.event.comment.added(t,e.id),t})).catch((function(t){throw salla.event.comment.additionFailed(t,e.id),t}))};t.prototype.getCommentPayload=function(e,t){if(t===void 0){t=!1}var n={};if(["id","type","comment","per_page","page","sort"].forEach((function(t){var r=salla.form.getPossibleValue(e,[t]);r&&(n[t]=r)})),!t){var r=e.ids;if(r&&(n.ids=Array.isArray(r)?r:[r]),!n.ids||!n.ids.length)return"Failed to get ids!"}return n.type&&["products","pages","product","page","blogs","blog"].includes(n.type)?(n.type+=["product","page"].includes(n.type)?"s":"",n):"Failed to get type one of:(products, product, page, pages, blog, blogs)!"};t.prototype.fetchComments=function(e){if("string"==typeof(e=this.getCommentPayload(e)))return salla.event.comment.fetchFailed(e),salla.api.errorPromise(e);var t={per_page:e.per_page||5,page:e.page||1,type:e.type,ids:e.ids};return e.sort&&(t.sort=e.sort),this.request(["comments"],{params:t},"get").then((function(t){return salla.event.comment.fetched(t,e),t})).catch((function(t){throw salla.event.comment.fetchFailed(t,e),t}))};t.prototype.getComments=function(e,t,n,r,i){if(n===void 0){n=1}if(r===void 0){r=5}var o=Array.isArray(t)?t:[t];return this.fetchComments({ids:o,type:"".concat(e,"s"),page:n,per_page:r,sort:i})};return t}(iu);var fu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="currency",t.endpoints={change:"/",list:"currencies"},t.endpointsMethods={change:"get",list:"get"},t.webEndpoints=["change"],t.after_init();return t}t.prototype.change=function(e){if(!(e=salla.form.getPossibleValue(e.data||e,["currency","code"]))){var t="Can't find currency code!";return salla.currency.event.failed(t),salla.api.errorPromise(t)}return this.request("change",{params:{change_currency:"",currency:e}}).then((function(t){return salla.cookie.set("fresh_summary",1),salla.storage.set("cart",""),salla.currency.event.changed(t,e),t})).catch((function(t){throw salla.currency.event.failed(t,e),t}))};t.prototype.list=function(){return this.request("list").then((function(e){return salla.currency.event.fetched(e),e})).catch((function(e){throw salla.currency.event.failedToFetch(e),e}))};return t}(iu);var pu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="document";return t}t.prototype.reload=function(){window.location.reload()};return t}(iu);var hu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="rating",t.endpoints={store:"rating/store",products:"rating/products",shipping:"rating/shipping",order:"rating/{order_id}"},t.endpointsMethods={order:"get"},t.after_init();return t}t.prototype.order=function(e){var t="object"==typeof e?e:{},n=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["order_id","id"]);if(!n){var r='There is no "order_id"!';return salla.event.rating.orderNotFetched(r),salla.api.errorPromise(r)}return this.request(["order",n],t).then((function(e){return salla.event.rating.orderFetched(e,n),e})).catch((function(e){throw salla.event.rating.orderNotFetched(e,n),e}))};t.prototype.store=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.storeFailed(t),salla.api.errorPromise(t)}return this.request("store",e).then((function(t){return salla.event.rating.storeRated(t,e),t})).catch((function(t){throw salla.event.rating.storeFailed(t,e),t}))};t.prototype.products=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.productsFailed(t),salla.api.errorPromise(t)}return this.request("products",e).then((function(t){return salla.event.rating.productsRated(t,e),t})).catch((function(t){throw salla.event.rating.productsFailed(t,e),t}))};t.prototype.shipping=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.shippingFailed(t),salla.api.errorPromise(t)}return this.request("shipping",e).then((function(t){return salla.event.rating.shippingRated(t,e),t})).catch((function(t){throw salla.event.rating.shippingFailed(t,e),t}))};return t}(iu);var vu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="wishlist",t.endpoints={add:"products/favorites/{id}",remove:"products/favorites/{id}"},t.endpointsMethods={remove:"delete"},t.after_init();return t}t.prototype.toggle=function(e){return salla.storage.get("salla::wishlist",[]).includes(e)?this.remove(e):this.add(e)};t.prototype.add=function(e){var t=this;var n;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(n=salla.lang.get("common.messages.must_login")),salla.error(n),salla.api.errorPromise(n)):(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["product_id","id"]))?this.request(["add",e]).then((function(n){return t.updateWishlistStorage(e),salla.wishlist.event.added(n,e),n})).catch((function(t){throw salla.wishlist.event.additionFailed(t,e),t})):(salla.wishlist.event.additionFailed(n="Failed to get product id!"),salla.api.errorPromise(n))};t.prototype.remove=function(e){var t=this;var n;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(n=salla.lang.get("common.messages.must_login")),salla.error(n),salla.api.errorPromise(n)):(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["product_id","id"]))?this.request(["remove",e]).then((function(n){return t.updateWishlistStorage(e,!1),salla.wishlist.event.removed(n,e),n})).catch((function(t){throw salla.wishlist.event.removingFailed(t,e),t})):(salla.wishlist.event.removingFailed(n="Failed to get id!"),salla.api.errorPromise(n))};t.prototype.updateWishlistStorage=function(e,t){if(t===void 0){t=!0}var n=salla.storage.get("salla::wishlist",[]);t?n.push(e):n.splice(n.indexOf(e),1),salla.storage.set("salla::wishlist",n)};return t}(iu);var gu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="scopes",t.endpoints={get:"scopes",change:"scopes",getProductAvailability:"scopes/availability?product_id={id}"},t.after_init();return t}t.prototype.get=function(){return this.request("scopes",null,"get").then((function(e){return salla.scope.event.fetched(e),e})).catch((function(e){throw salla.scope.event.notFetched(e),e}))};t.prototype.change=function(e){return this.request("scopes",e).then((function(e){return salla.scope.event.changeSucceeded(e),e})).catch((function(e){throw salla.scope.event.changeFailed(e),e}))};t.prototype.getProductAvailability=function(e){if(e===void 0){e=null}return this.request("scopes/availability?product_id=".concat(e),null,"get").then((function(t){return salla.scope.event.productAvailabilityFetched(t,e),t})).catch((function(e){throw salla.scope.event.productAvailabilityNotFetched(e),e}))};return t}(iu);var mu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.endpoints={add:"cart/booking/product/{id}"},t.endpointsMethods={add:"get"};return t}t.prototype.add=function(e,t){if(t===void 0){t=!0}return Vl(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){if(!e){n="Please provide product id.";return[2,(salla.booking.event.additionFailed(n),salla.api.errorPromise(n))]}return[2,this.request(["add",e]).then((function(e){return salla.booking.event.added(e),t&&"booking"===e.data.redirect.to&&(window.location.href=e.data.redirect.url),e})).catch((function(e){throw salla.booking.event.additionFailed(e),e}))]}))}))};return t}(iu);var yu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="landing",t.endpoints={getDetails:"landing/{landing_page_id}",createCartFromPage:"landing/{landing_page_id}",breadcrumbs:"breadcrumbs"},t.endpointsMethods={getDetails:"get",breadcrumbs:"get"},t.after_init();return t}t.prototype.getDetails=function(e){if(!e){var t="page landing id not passed";return salla.event.landing.getDetailsFailed(t),salla.api.errorPromise(t)}return this.request(["getDetails",e]).then((function(t){return salla.event.landing.detailsFetched(t,e),t})).catch((function(t){throw salla.event.landing.getDetailsFailed(t,e),t}))};t.prototype.createCartFromPage=function(e){if(!e){var t="page landing id not passed";return salla.event.landing.orderCreationFailed(t),salla.api.errorPromise(t)}return salla.config.isGuest()?(salla.auth.api.setAfterLoginEvent("landing::createCartFromPage",e),salla.event.dispatch("login::open"),salla.api.successPromise("")):this.request(["createCartFromPage",e]).then((function(t){return salla.event.landing.orderCreated(t,e).then((function(){return location.href=t.data.url})),t})).catch((function(t){throw salla.event.landing.orderCreationFailed(t,e),t}))};t.prototype.fetchBreadcrumbs=function(e){if(!e.page){var t="The 'page' parameter is required for the Breadcrumb API. Please provide a valid 'page' parameter.";return salla.event.landing.breadcrumbFetchFailed(t),salla.api.errorPromise(t)}if("product.single"===e.page&&!e.id&&!e.parent_id){var n="The 'id' and 'parent_id' parameters are required when the 'page' parameter is set to 'product.single'. Please provide valid values for both parameters.";return salla.event.landing.breadcrumbFetchFailed(n),salla.api.errorPromise(n)}if(["product.index","customer.orders.single","product.index.tag","page-single","landing-page","brands.single","blog.single","blog.index.author","blog.index.category","blog.index.tag"].includes(e.page)&&!e.id){var r="The 'id' parameter is required when the 'page' parameter is set to ".concat(e.page,". Please provide valid value for the 'ID' parameter.");return salla.event.landing.breadcrumbFetchFailed(r),salla.api.errorPromise(r)}return this.request("breadcrumbs",{params:e}).then((function(e){return salla.event.landing.breadcrumbFetched(e),e})).catch((function(e){throw salla.event.landing.breadcrumbFetchFailed(e),e}))};return t}(iu);var bu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="notifications",t.endpoints={fetch:"notifications"},t.endpointsMethods={fetch:"get"},t.after_init();return t}t.prototype.fetch=function(e){return this.request(["fetch"],{params:e}).then((function(e){return salla.event.notifications.fetched(e),e})).catch((function(e){throw salla.event.notifications.fetchFailed(e),e}))};return t}(iu);var wu=function(){function e(){var e=this;this.inIframe=salla.helpers.isIframe(),salla.event.on("twilight::before.ready",(function(t){return Vl(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.initiateRequest(t)];case 1:return[2,e.sent()]}}))}))})),salla.event.on("profile::info.fetched",(function(t){return e.setCurrencyAndLanguage(t)})),salla.event.on("auth::token.fetched",(function(t){salla.storage.set("token",t),e.inIframe&&salla.log("token fetched iframe"),e.inIframe&&salla.cookie.set("s-token",t,60),e.setToken(t)})),salla.event.on("auth::token.invalid",(function(){salla.storage.remove("user"),salla.storage.remove("token")})),this.notifier_handler_disabled=!1,this.axios=yo.create({baseURL:Salla.config.get("store.api",Salla.config.get("store.url")),headers:{common:{"X-Requested-With":"XMLHttpRequest","S-SOURCE":"twilight","S-APP-VERSION":"v2.0.0","S-APP-OS":"browser","cache-control":"no-cache"}}}),Salla.onReady((function(){Salla.helpers.url.is_page("cart")&&Salla.config.set("store.settings.use_sar_symbol",!1)})),this.axios.interceptors.request.use((function(e){return"preview"===Salla.config.get("theme.mode")&&(e.url=Salla.url.addParamToUrl("use_username_url",1,e.url)),["coupon","price","item"].some((function(t){return e.url.includes(t)}))&&!e.url.includes("add")&&Salla.config.set("store.settings.use_sar_symbol",!1),e}),(function(e){return Promise.reject(e)}))}e.prototype.getHeaders=function(){return this.axios.defaults.headers.common};e.prototype.getHeader=function(e){var t;return(t=Object.entries(this.getHeaders()).filter((function(t){var n=t[0],r=t[1];return n.toLowerCase()===e.toLowerCase()}))[0])===null||t===void 0?void 0:t[1]};e.prototype.setHeaders=function(e){var t=this;return Object.entries(e).forEach((function(e){return t.setHeader(e[0],e[1])})),this};e.prototype.setHeader=function(e,t){return salla.infiniteScroll.fetchOptions.headers[e]=this.axios.defaults.headers.common[e]=t,this};e.prototype.withoutNotifier=function(e){return Vl(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){switch(n.label){case 0:this.notifier_handler_disabled=!0;return[4,e().finally((function(){t.notifier_handler_disabled=!1}))];case 1:return[2,n.sent()]}}))}))};e.prototype.initiateRequest=function(e){var t,n,r;return Vl(this,void 0,void 0,(function(){var i,o;return __generator(this,(function(a){switch(a.label){case 0:this.axios.defaults.baseURL=Salla.config.get("store.api",Salla.config.get("store.url")),this.setHeaders(__assign({"Store-Identifier":Salla.config.get("store.id"),currency:((t=e.user)===null||t===void 0?void 0:t.currency_code)||"SAR","accept-language":salla.lang.getLocale(),"s-user-id":(n=e.user)===null||n===void 0?void 0:n.id,"s-country":(r=e.user)===null||r===void 0?void 0:r.country_code},e.headers||{}));i=Salla.storage.get("scope",Salla.config.get("store.scope"));i&&this.setHeaders({"s-scope-type":i.type,"s-scope-id":i.id});o=Salla.storage.session.get("s-utms");o&&this.setHeaders(o);return[4,this.injectTokenToTheRequests(e)];case 1:a.sent(),salla.storage.get("affiliate_code")&&this.setHeader("s-affiliate-code",salla.storage.get("affiliate_code"));return[2]}}))}))};e.prototype.injectTokenToTheRequests=function(e){var t,n;return Vl(this,void 0,void 0,(function(){var r,i,o,a,s,c,l,u,d,f,p;var h=this;return __generator(this,(function(v){switch(v.label){case 0:r=salla.storage.get("token"),i="guest"===((t=e.user)===null||t===void 0?void 0:t.type),o=parseInt(((n=e.user)===null||n===void 0?void 0:n.id)||0),a=parseInt(salla.storage.get("user.id")||0),s=salla.auth.api.isSessionless(),c=function(e){h.setToken(e),salla.event.emit("api::initiated")},l=function(){return Vl(h,void 0,void 0,(function(){var e;var t=this;return __generator(this,(function(n){switch(n.label){case 0:if(!(i||s||!o))return[3,1];e=salla.auth.event.tokenInvalid();return[3,3];case 1:salla.log("Api:: case 1 => current is is guest & web session available");return[4,salla.auth.api.refresh().then((function(){return Vl(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,salla.profile.info()];case 1:e.sent();return[2]}}))}))})).catch((function(){return salla.auth.event.tokenInvalid()}))];case 2:e=n.sent();n.label=3;case 3:e;return[2]}}))}))};if(!!r)return[3,2];salla.log("Api:: case 1 => current is is guest");return[4,l()];case 1:return[2,void v.sent()];case 2:d=ko(r);if(!(Date.now()/1e3>d.exp))return[3,4];salla.log("Api:: case 2 => current user is logged-in and there is a token, but it's expired");return[4,l()];case 3:f=void v.sent();return[3,8];case 4:u=s?parseInt(d.sub)!==a:!a||!o||a!==o||parseInt(d.sub)!==o;if(!u)return[3,6];salla.log("Api:: case 3 => there is a token and user in session/local missing or mismatch"),salla.log("sub:".concat(d.sub," userIdInWeb:").concat(o," userIdInStorage:").concat(a,", isSessionless:").concat(s),d.sub,o,a),this.setHeader("Authorization","Bearer "+r);return[4,salla.profile.info().then((function(e){return Vl(h,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=!this.inIframe&&!s;if(!e)return[3,2];return[4,salla.auth.api.request("auth/jwt",{callerName:"salla.auth.request.injectTokenToTheRequests"})];case 1:e=t.sent();t.label=2;case 2:e,c(r);return[2]}}))}))})).catch((function(){salla.log("Api:: case 3 => failed get fresh profile"),h.setHeader("Authorization",null),salla.auth.event.tokenInvalid()}))];case 5:p=void v.sent();return[3,7];case 6:p=(salla.log("Api:: case 4 => current user is logged-in and there is a token, and it's not expired"),void c(r));v.label=7;case 7:f=p;v.label=8;case 8:return[2,f]}}))}))};e.prototype.setToken=function(e){return this.setHeader("Authorization","Bearer "+e),salla.event.emit("api::token.injected",e),this.token=e,this};e.prototype.setCurrencyAndLanguage=function(e){return this.setHeaders({currency:e.data.currency,"accept-language":e.data.language})};e.prototype.request=function(e,t,n,r){var i=this;if(t===void 0){t=void 0}if(n===void 0){n="get"}if(r===void 0){r={}}var o={endPoint:e,payload:t,method:n,options:r},a="undefined"!=typeof event?event.currentTarget:null,s=!1;return"SALLA-BUTTON"===(a===null||a===void 0?void 0:a.tagName)&&(s=!0),s&&(a===null||a===void 0?void 0:a.load()),this.axios[o.method](o.endPoint,o.payload,o.options).then((function(e){return s&&(a===null||a===void 0?void 0:a.stop()),e.data&&e.request&&(e=e.data),i.handleAfterResponseActions(e),e})).catch((function(e){throw s&&(a===null||a===void 0?void 0:a.stop()),salla.event.document.requestFailed(o,e),i.handleErrorResponse(e),e}))};e.prototype.handleAfterResponseActions=function(e){if(!e)return;var t=e.data,n=e.googleTags,r=n===void 0?null:n,i=t&&t.googleTags?t.googleTags:r;try{dataLayer&&i&&dataLayer.push(i)}catch(e){salla.logger.error(e.message)}this.fireEventsForResponse(e),this.showAlert(e)};e.prototype.fireEventsForResponse=function(e){var t,n;var r=(e===null||e===void 0?void 0:e.events)||((t=e.data)===null||t===void 0?void 0:t.events)||((n=e.error)===null||n===void 0?void 0:n.events);"string"==typeof r&&(r=JSON.parse(r)),r&&Object.keys(r).forEach((function(e){return salla.event.dispatch(e,r[e])}))};e.prototype.handleErrorResponse=function(e){if(e.response&&e.response.data)return e.response.data.error&&e.response.data.error.fields&&!this.notifier_handler_disabled?this.handleInvalidFields(e):this.handleAfterResponseActions(e.response.data)};e.prototype.showAlert=function(e){var t,n;if(e&&!this.notifier_handler_disabled)return e.case&&e.msg?salla.notify.fire(e.msg,e.case,e):e.hasOwnProperty("success")&&((t=e.data)===null||t===void 0?void 0:t.message)?salla.notify.fire((n=e.data)===null||n===void 0?void 0:n.message,e.success?salla.notify.types.success:salla.notify.types.error,e):e.error&&e.error.message&&"FORBIDDEN"!==e.error.message?salla.error(e.error.message,e):void 0};e.prototype.handleInvalidFields=function(e){var t=e.response.data.error.fields,n=[];Object.keys(t).forEach((function(e){var r=t[e];Array.isArray(r)?r.forEach((function(e){return n.push(e)})):n.push(r)}));var r=(n.length>1?"* ":"")+n.join("\n* ");salla.error(r,e)};e.prototype.isFastRequestsAllowed=function(){return Salla.config.get("fastRequests")};e.prototype.promise=function(e,t){if(t===void 0){t=!0}return new Promise((function(n,r){return t?n(e):r(e)}))};e.prototype.errorPromise=function(e){return this.promise(e,!1)};e.prototype.successPromise=function(e){return this.promise(e,!0)};return e}();var _u=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="component",t.endpoints={getMenus:"menus/{headOrFoot}?store_id={store}&lang={lang}",reviews:"reviews"},t.endpointsMethods={getMenus:"get",reviews:"get"};return t}t.prototype.getMenus=function(e){if(e===void 0){e="header"}return Vl(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.request(["getMenus",e,salla.config.get("store.id"),salla.lang.getLocale()]).then((function(e){return salla.event.component.menuFetched(e),e})).catch((function(e){throw salla.event.component.menuFetchFailed(e),e}))]}))}))};t.prototype.getReviews=function(e){var t=e.per_page,n=t===void 0?5:t,r=e.type,i=r===void 0?"all":r,o=e.items;return Vl(this,void 0,void 0,(function(){var e,t,r,a,s;return __generator(this,(function(c){if(!i){e="Review type cannot be empty. Please provide one.";return[2,(salla.event.component.reviewsFetchFailed(e),salla.api.errorPromise(e))]}t=!o||"string"==typeof o&&"[]"===o||Array.isArray(o)&&!o.length;if(!new Set(["all","store","categories","products","json"]).has(i)){r="Invalid review type. Please provide a valid type.";return[2,(salla.event.component.reviewsFetchFailed(r),salla.api.errorPromise(r))]}if("all"!==i&&"store"!==i&&t){a="Items cannot be empty. Please provide one.";return[2,(salla.event.component.reviewsFetchFailed(a),salla.api.errorPromise(a))]}if(new Set(["products","categories"]).has(i)&&!Array.isArray(o)){s="Items value must be an array of ".concat(i," id for review type of ").concat(i,".");return[2,(salla.event.component.reviewsFetchFailed(s),salla.api.errorPromise(s))]}return[2,this.request(["reviews"],{params:{per_page:n,type:i,items:o}},"get").then((function(e){return salla.event.component.reviewsFetched(e),e})).catch((function(e){throw salla.event.component.reviewsFetchFailed(e),e}))]}))}))};return t}(iu);var Su=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.endpoints={fetch:"advertisements"},t.endpointsMethods={fetch:"get"};return t}t.prototype.fetch=function(e){if(e===void 0){e=null}return Vl(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){t=e?{page:e}:{};return[2,this.request(["fetch"],{params:t}).then((function(e){return salla.event.advertisement.fetched(e),e})).catch((function(e){throw salla.event.advertisement.fetchFailed(e),e}))]}))}))};return t}(iu);var ku=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="navigation",t.endpoints={breadcrumbs:"breadcrumbs"},t.endpointsMethods={breadcrumbs:"get"},t.after_init();return t}t.prototype.fetchBreadcrumbs=function(e){if(!e.page){var t="The 'page' parameter is required for the Breadcrumb API. Please provide a valid 'page' parameter.";return salla.event.navigation.breadcrumbFetchFailed(t),salla.api.errorPromise(t)}if(["product.single","product.index","customer.orders.single","product.index.tag","page-single","landing-page","brands.single","blog.single","blog.index.author","blog.index.category","blog.index.tag"].includes(e.page)&&!e.id){var n="The 'id' parameter is required when the 'page' parameter is set to ".concat(e.page,". Please provide valid value for the 'ID' parameter.");return salla.event.navigation.breadcrumbFetchFailed(n),salla.api.errorPromise(n)}return this.request("breadcrumbs",{params:e}).then((function(e){return salla.event.navigation.breadcrumbFetched(e),e})).catch((function(e){throw salla.event.navigation.breadcrumbFetchFailed(e),e}))};return t}(iu);var Eu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="metadata",t.endpoints={fetchValues:"https://api.salla.dev/store/v1/metadata/values"},t.endpointsMethods={fetchValues:"get"};return t}t.prototype.fetchValues=function(e,t){return Vl(this,void 0,void 0,(function(){var n,r;return __generator(this,(function(i){if(!e||!t){n="Please provide entity type and entity ids.";return[2,(salla.metadata.event.valueNotFetch(n),salla.api.errorPromise(n))]}r={type:e,entities:Array.isArray(t)?t:[t]};return[2,this.request(this.endpoints.fetchValues,{params:r},"get").then((function(e){return salla.metadata.event.valueFetched(e),e})).catch((function(e){throw salla.metadata.event.valueNotFetch(e),e}))]}))}))};return t}(iu);var xu=function(){function e(e){var t,n,r;"ready"!==Pr.status?e?(Pr.config.merge(e),["salla.sa","salla.group"].includes(location.hostname)&&!((t=Pr.config.get("store.url"))===null||t===void 0?void 0:t.includes(location.hostname))&&Pr.config.get("store.username")&&Pr.config.set("store.url",window.location.origin+"/"+Pr.config.get("store.username")),(e===null||e===void 0?void 0:e.events)&&Pr.event.dispatchEvents(e===null||e===void 0?void 0:e.events),e._token&&salla.api.setHeader("X-CSRF-TOKEN",e._token),this.injectMaintenanceAlert(),this.injectTemplateStoreAlert(),this.injectThemePreviewAlert(),this.injectAppInstallAlert(),this.applyContentCopyright(),this.injectEditAlert(),((n=e===null||e===void 0?void 0:e.user)===null||n===void 0?void 0:n.language_code)&&salla.lang.setLocale((r=e===null||e===void 0?void 0:e.user)===null||r===void 0?void 0:r.language_code),salla.lang.loadStoreTranslations(),this.setSallaReady(e)):this.setSallaReady(e):salla.log("Trying to re-initiate Salla, while its status === 'ready'!")}e.prototype.applyContentCopyright=function(){if(!salla.config.get("store.settings.content_copyright"))return;["contextmenu","selectstart","copy"].forEach((function(e){document.addEventListener(e,(function(e){return e.preventDefault()}))})),document.addEventListener("keydown",(function(e){var t=e.key.toLowerCase();("f12"===t||e.ctrlKey&&e.shiftKey&&["i","j","c"].includes(t)||e.ctrlKey&&"u"===t)&&(e.preventDefault(),e.stopPropagation())}));var e=document.createElement("style");e.textContent="\n body {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n img {\n pointer-events: none;\n -webkit-user-drag: none;\n }\n ",document.head.appendChild(e)};e.prototype.injectMaintenanceAlert=function(){salla.config.get("maintenance")&&(document.body.classList.add("has-maintenance-bar"),document.querySelector("salla-maintenance-alert")?salla.logger.warn("salla-maintenance-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.prepend(document.createElement("salla-maintenance-alert"))})))};e.prototype.injectTemplateStoreAlert=function(){salla.config.get("store.template")&&(document.body.classList.add("has-bottom-alert"),document.querySelector("salla-bottom-alert")?salla.logger.warn("salla-bottom-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.append(document.createElement("salla-bottom-alert"))})))};e.prototype.injectAppInstallAlert=function(){salla.config.get("store.app_install_prompt")&&salla.config.get("store.apps")&&!salla.storage.get("app_install_prompt_disabled")&&(document.body.classList.add("has-app-install-alert"),document.querySelector("salla-app-install-alert")?salla.logger.warn("salla-app-install-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.append(document.createElement("salla-app-install-alert"))})))};e.prototype.injectThemePreviewAlert=function(){"preview"===salla.config.get("theme.mode")&&(document.body.classList.add("has-preview-bar"),document.querySelector("#s-theme_preview_bar")?salla.logger.warn("#s-theme_preview_bar element Existed before!"):salla.lang.onLoaded((function(){var e=document.createElement("div");e.id="s-theme_preview_bar",e.setAttribute("style","display: flex; justify-content: space-between; text-align: center; background-color: #232323; color: #fff; padding: 10px; font-size: 0.875rem; line-height: 1.25rem; position: relative;"),e.innerHTML='\n <div style="display:flex; align-items:center;">\n <img width="32" src="https://cdn.salla.network/images/logo/logo-light.svg">\n <span style="margin:0 10px;">'.concat(salla.lang.get("blocks.header.preview_mode"),': <span style="background:rgba(255,255,255,0.25);border-radius:15px; padding:2px 15px 4px">').concat(salla.config.get("theme.name"),'</span></span>\n </div>\n <a href="').concat(salla.url.get("preview_theme/cancel/preview"),'" style="line-height:32px; width:32px;"><i class="sicon-cancel"></i></a>\n '),document.body.prepend(e)})))};e.prototype.injectEditAlert=function(){var e=salla.config.get("edit");e&&(document.querySelector("#s-edit-alert")?salla.logger.warn("#s-edit-alert element Existed before!"):salla.lang.onLoaded((function(){var t=document.createElement("div");t.id="s-edit-alert",t.innerHTML='\n <a href="'.concat(e,'" style="display:block; background-color:').concat(salla.config.get("theme.color.primary","#5cd5c4"),"; color:").concat(salla.config.get("theme.color.reverse","#fff"),'; padding: 10px; text-align:center; font-size: 0.875rem; line-height: 1.25rem;">\n <i class="sicon-edit"></i> \n ').concat(salla.lang.get("pages.products.quick_edit"),"\n </a>\n "),document.body.prepend(t)})))};e.prototype.handleElementAjaxRequest=function(e,t){var n=this;if(!(t instanceof HTMLFormElement||t instanceof HTMLAnchorElement))return salla.logger.warn("trying to call ajax from non Element!!"),!1;e.preventDefault();var r=t.getAjaxFormData(e),i=r.method?r.method.toLowerCase():void 0;salla.api.request(r.url,r.formData,i).then((function(e){return e.data&&e.request&&(e=e.data),salla.api.handleAfterResponseActions(e),n.callAjaxEvent(r.events.success,e,r.formData),e})).catch((function(e){throw salla.api.handleErrorResponse(e),n.callAjaxEvent(r.events.fail,e,r.formData),e}))};e.prototype.callAjaxEvent=function(e,t,n){if(e){if(n instanceof FormData){var r={};Array.from(n.entries()).forEach((function(e){r[e[0]]=e[1]})),n=r}window[e]?window[e](t,n):salla.event.dispatch(e,t,n)}};e.prototype.setSallaReady=function(e){this.storeUTMs(),Pr.event.emitAsync("twilight::before.ready",e),Pr.status="ready",Pr.event.dispatch("twilight::initiated",e),window.dispatchEvent(new CustomEvent("twilight::initiated",{detail:e}))};e.prototype.storeUTMs=function(){var e={fbclid:"facebook",gad_source:"google",ttclid:"tiktok",twclid:"twitter",scid:"snapchat"},t=["fbclid","gad_source","ttclid","twclid","scid"],n=__spreadArray(["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],t,true),r={},i={};window.location.search.replace("?","").split("&").map((function(e){return e.split("=")})).filter((function(e){var t=e[0];return n.includes(t.toLowerCase())})).forEach((function(e){var t=e[0],n=e[1];return r[t.toLowerCase()]=n}));var o=t.find((function(e){return r[e]}));!r.utm_source&&o&&(r.utm_source=e[o],r.utm_campaign=r.utm_campaign||"Using the CLICKID ".concat(o," provided by ").concat(r.utm_source),r.utm_term=r.utm_term||"".concat(o,": ").concat(r[o])),r.utm_source&&(Object.entries(r).filter((function(e){var n=e[0];return!t.includes(n)})).forEach((function(e){var t=e[0],n=e[1];return i["s-".concat(t.replace("_","-"))]=n})),i["s-utm-referrer"]=document.referrer,salla.storage.session.set("s-utms",i),this.logUTMVisitData(i))};e.prototype.logUTMVisitData=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){t=e["s-utm-source"],n=e["s-utm-medium"],r=e["s-utm-campaign"];e&&"affiliate"===t&&n&&r&&fetch(salla.config.get("affiliate.utm_url"),{method:"POST",mode:"cors",headers:{"Content-Type":"application/json","s-utm-source":t,"s-utm-medium":n,"s-utm-campaign":r}}).then((function(e){if(e.ok){var t=new URL(window.location.href),n=window.history.state;t.searchParams.delete("utm_source"),t.searchParams.delete("utm_medium"),t.searchParams.delete("utm_campaign"),window.history.replaceState(n,"",t)}}));return[2]}))}))};return e}();var Iu=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){return{event:"Product Added",properties:{cart_id:this.item.cart_id,product_id:this.item.id,category:this.item.category,name:this.item.name,brand:this.item.brand,variant:this.item.variant,price:this.item.price,quantity:this.item.quantity,sku:this.item.sku,coupon:this.item.coupon,position:this.item.position,url:this.item.url,image_url:this.item.image_url}}};e.shouldSend=function(){return"customer.wishlist"!==salla.config.get("page.slug")};return e}();var ju=function(){function e(e){this.product=e[0]}e.prototype.toSegment=function(){return{event:"Product Viewed",properties:{product_id:this.product.id,category:this.product.category,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:this.product.quantity,currency:this.product.currency,coupon:this.product.coupon,position:this.product.position,value:this.product.value,sku:this.product.sku,url:this.product.url,image_url:this.product.image_url}}};return e}();var Pu=function(){function e(e){this.cart=e[0]}e.prototype.toSegment=function(){var e;return{event:"Cart Viewed",properties:{cart_id:(e=this.cart.cart_id)===null||e===void 0?void 0:e.toString(),products:this.cart.products.map((function(e){var t;return{product_id:(t=e.id)===null||t===void 0?void 0:t.toString(),name:e.name,price:e.price,category:e.category,sku:e.sku,position:e.position,url:e.url,image_url:e.image_url}}))}}};return e}();var Ou=function(){function e(e){var t=e===null||e===void 0?void 0:e.nextPage;if(this.listId=null,"index"===salla.config.get("page.slug"))this.listId="home_page";else if(t){var n=new URL(t),r=n.searchParams.get("source"),i=n.searchParams.getAll("source_value[]");this.listId="".concat(r,"_").concat(i.join("_"))}this.products=e===null||e===void 0?void 0:e.data}e.prototype.toSegment=function(){return{event:"Product List Viewed",properties:{list_id:this.listId,category:salla.config.get("page.title"),products:this.products.map((function(e){var t,n,r;return{product_id:e.id,category:(t=e.category)===null||t===void 0?void 0:t.name,name:e.name,brand:(n=e.brand)===null||n===void 0?void 0:n.name,variant:e.variant,price:e.price,quantity:Number(e.quantity),sku:e.sku,position:0,url:e.url,image_url:(r=e.image)===null||r===void 0?void 0:r.url}}))}}};e.shouldSend=function(){return!["index","customer.wishlist"].includes(salla.config.get("page.slug"))};return e}();var Au=function(){function e(e){this.query=e}e.prototype.toSegment=function(){return{event:"Products Searched",properties:{query:this.query}}};return e}();var Cu=function(){function e(e){}e.prototype.toSegment=function(){return{event:"Signed Up",properties:{}}};return e}();var Tu=function(){function e(e){}e.prototype.toSegment=function(){return{event:"Signed In",properties:{context:{traits:salla.config.get("user")}}}};e.shouldSend=function(){return"guest"!==salla.config.get("user.type")};return e}();var Fu=function(){function e(e){}e.prototype.toSegment=function(){return{event:"Signed Out",properties:{}}};return e}();var Lu=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){var e,t,n,r,i,o,a,s,c,l,u,d,f;return{event:"Product Removed",properties:{cart_id:(e=this.item)===null||e===void 0?void 0:e.cart_id,product_id:(t=this.item)===null||t===void 0?void 0:t.product_id,category:(n=this.item)===null||n===void 0?void 0:n.category,name:(r=this.item)===null||r===void 0?void 0:r.name,brand:(i=this.item)===null||i===void 0?void 0:i.brand,variant:(o=this.item)===null||o===void 0?void 0:o.variant,price:(a=this.item)===null||a===void 0?void 0:a.price,quantity:(s=this.item)===null||s===void 0?void 0:s.quantity,sku:(c=this.item)===null||c===void 0?void 0:c.sku,coupon:(l=this.item)===null||l===void 0?void 0:l.coupon,position:(u=this.item)===null||u===void 0?void 0:u.position,url:(d=this.item)===null||d===void 0?void 0:d.url,image_url:(f=this.item)===null||f===void 0?void 0:f.image_url}}};return e}();var Ru=function(){function e(e){this.product=e.product}e.prototype.toSegment=function(){var e,t;return{event:"Product Added to Wishlist",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),product_id:this.product.id,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:Math.max(1,Number(this.product.quantity)),sku:this.product.sku,coupon:this.product.coupon,position:Number(this.product.position),url:this.product.url,image_url:(t=(e=this.product)===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}}};return e}();var Nu=function(){function e(e){this.product=e.product}e.prototype.toSegment=function(){var e,t;return{event:"Product Removed from Wishlist",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),product_id:this.product.id,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:Math.max(1,Number(this.product.quantity)),sku:this.product.sku,coupon:this.product.coupon,position:Number(this.product.position),url:this.product.url,image_url:(t=(e=this.product)===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}}};return e}();var zu=function(){function e(e){this.details=e[0]}e.prototype.toSegment=function(){return{event:"Order Completed",properties:this.details}};return e}();var qu=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){return{event:"Wishlist Product Added to Cart",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),cart_id:this.item.cart_id,product_id:this.item.id,category:this.item.category,name:this.item.name,brand:this.item.brand,variant:this.item.variant,price:this.item.price,quantity:this.item.quantity,sku:this.item.sku,coupon:this.item.coupon,position:this.item.position,url:this.item.url,image_url:this.item.image_url}}};e.shouldSend=function(){return"customer.wishlist"===salla.config.get("page.slug")};return e}();var Uu=function(){function e(e){this.data=e}e.prototype.toSegment=function(){var e,t,n,r,i,o,a,s,c,l;return{event:"Product Shared",properties:{product_id:((e=this.data.product)===null||e===void 0?void 0:e.id)||salla.config.get("page.id"),sku:(t=this.data.product)===null||t===void 0?void 0:t.sku,category:(r=(n=this.data.product)===null||n===void 0?void 0:n.category)===null||r===void 0?void 0:r.name,name:(i=this.data.product)===null||i===void 0?void 0:i.name,brand:(o=this.data.product)===null||o===void 0?void 0:o.brand,variant:(a=this.data.product)===null||a===void 0?void 0:a.variant,price:(s=this.data.product)===null||s===void 0?void 0:s.price,url:(c=this.data.product)===null||c===void 0?void 0:c.url,image_url:(l=this.data.product)===null||l===void 0?void 0:l.image_url,share_via:this.data.share_via,recipient:this.data.recipient}}};e.shouldSend=function(){return"product.single"===salla.config.get("page.slug")};return e}();var Du=function(){function e(e){this.details=e}e.prototype.toSegment=function(){return{event:"Product Reviewed",properties:{product_id:this.details.product_id,review_id:this.details.order_id,review_body:this.details.comment,rating:this.details.rating}}};e.registerEvents=function(){salla.event.rating.onProductsRated((function(e,t){var n=t.products,r=t.order_id;Object.values(n).forEach((function(e){Salla.event.emit("Product Reviewed",{product_id:e.product_id,review_id:r,review_body:e.comment,rating:e.rating})}))}))};return e}();var Mu=function(){function e(){}e.registerEvents=function(){Du.registerEvents()};e.transform=function(e,t){try{var n=this.events[e]||[];for(var r=0,i=n;r<i.length;r++){var o=i[r];if(!o||"function"==typeof o.shouldSend&&!o.shouldSend())continue;var a=new o(t).toSegment();return{event:a.event,properties:a.properties}}return null}catch(e){return console.error("Failed to transform event:",e),null}};e.events={"Order Completed":[zu],"Product Added":[Iu,qu],"Product Removed":[Lu],"Product Viewed":[ju],"Product Added to Wishlist":[Ru],"Product Removed from Wishlist":[Nu],"Cart Viewed":[Pu],"Products Searched":[Au],"Product List Viewed":[Ou],"Signed Up":[Cu],"Signed In":[Tu],"Signed Out":[Fu],"Product Reviewed":[Du],"Product Shared":[Uu]};return e}();Pr.onReady=Pr.onReady||function(e){return new Promise((function(t){return"ready"===salla.status?t(e?e(salla.config.all()):salla.config.all()):Pr.onInitiated((function(n){return t(e?e(n):n)}))}))},Pr.status="loading",Pr.notify=eu,Pr.lang=new(function(e){__extends(t,e);function t(t){var n=this;(t=t||{}).messages=t.messages||window.translations,t.locale=t.locale||(window.locale||navigator.language||navigator.userLanguage||"ar").split("-")[0],t.fallback=t.fallback||t.locale,n=e.call(this,t)||this,n.translationsLoaded=!1;return n}t.prototype.onLoaded=function(e){var t=this;return new Promise((function(n){if(t.translationsLoaded)return n(e?e():null);Salla.event.once("languages::translations.loaded",(function(){return n(e?e():null)}))}))};t.prototype.loadStoreTranslations=function(){if(this.hash=salla.config.get("theme.translations_hash",salla.config.get("store.id","twilight")),this.message||(salla.log("try to load translations from localstorage"),this.messages=salla.storage.get("s_translations.".concat(this.hash)),this.messages&&(this.translationsLoaded=!0)&&e.prototype.setMessages.call(this,this.messages)),this.messages)return salla.event.dispatch("languages::translations.loaded"),void salla.logger.info("The messages of transactions is already loaded");salla.url.get("")?this.loadScript(salla.url.get("languages/assets/".concat(this.hash,".js"))):this.loadScript("https://cdn.salla.network/js/translations.js",!1)};t.prototype.setMessages=function(t){e.prototype.setMessages.call(this,t),salla.event.dispatch("languages::translations.loaded"),this.translationsLoaded=!0};t.prototype.loadScript=function(e,t){var n=this;if(t===void 0){t=!0}var r=document.createElement("script");r.src=e,r.onload=function(){var e;if(window.translations)return salla.storage.remove("s_translations"),salla.storage.set("s_translations",(e={},e[n.hash]=window.translations,e)),n.setMessages(window.translations);r.onerror()},r.onerror=function(){if(t)return salla.logger.warn("Failed to load Translations for store, lets try load it from CDN"),n.loadScript("https://cdn.salla.network/js/translations.js",!1);salla.logger.error("Failed to load Translations, check your network logs for more details\nor: salla.lang.setMessages({....}), see https://docs.salla.dev for more information's.")},document.head.appendChild(r)};t.prototype.getWithDefault=function(e,t,n,r){var i=this.get(e,n,r);return i!==e?i:t};t.prototype.get=function(t,n,r){var i=t;(window.translations||this.translationsLoaded)&&(i="trans."+t);var o=e.prototype.get.call(this,i,n,r);return o!==i?o:e.prototype.get.call(this,i,n,"en").replace(i,t)};t.prototype.set=function(e,t){return salla.helpers.setNested(this.messages["".concat(this.getLocale(),".trans")],e,t),this};t.prototype.add=function(e,t){var n=this;return Object.entries(t).forEach((function(t){return salla.helpers.setNested(n.messages[t[0]+".trans"],e,t[1])})),this};t.prototype.addBulk=function(e){var t=this;return Object.entries(e).forEach((function(e){var n=e[0],r=e[1];t.add(n,r)})),this};return t}(qr)),Pr.form=new(function(){function e(){}e.prototype.submit=function(e,t){var n,r,i,o;if(t===void 0){t=null}return Vl(this,void 0,void 0,(function(){var a,s,c;return __generator(this,(function(l){switch(l.label){case 0:a=t;if("SubmitEvent"===((n=t===null||t===void 0?void 0:t.constructor)===null||n===void 0?void 0:n.name)||"submit"===(t===null||t===void 0?void 0:t.type)){if(t.preventDefault(),"FORM"!==((r=t.target)===null||r===void 0?void 0:r.tagName))return[2,(Salla.logger.warn("Failed find the target element for submit action. make sure you submit a form element"),new Promise((function(){throw"Failed find the target element for submit action. make sure you submit a form element"})))];"SALLA-BUTTON"===((o=(i=t===null||t===void 0?void 0:t.submitter)===null||i===void 0?void 0:i.parentElement)===null||o===void 0?void 0:o.tagName)&&t.submitter.parentElement.load(),a=t.target.getElementSallaData(),salla.log("Data from element",a)}if(/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/gm.test(e))return[2,salla.api.request(e,a,"post").finally((function(){var e;loaderSupported&&((e=t===null||t===void 0?void 0:t.submitter)===null||e===void 0?void 0:e.parentElement.stop())}))];s=e.split("."),c=s.splice(-1);return[4,salla.call(s.join("."))[c](a).finally((function(){var e,n;return(n=(e=t===null||t===void 0?void 0:t.submitter)===null||e===void 0?void 0:e.parentElement)===null||n===void 0?void 0:n.stop()})).catch((function(e){throw salla.logger.warn(e),e}))];case 1:return[2,l.sent()]}}))}))};e.prototype.onSubmit=function(e,t){return salla.form.submit(e,t),!1};e.prototype.onChange=function(e,t){var n;return(t===null||t===void 0?void 0:t.currentTarget)?"FORM"!==((n=t===null||t===void 0?void 0:t.currentTarget)===null||n===void 0?void 0:n.tagName)||t.currentTarget.checkValidity()?(salla.form.submit(e,t.currentTarget.getElementSallaData()),!0):(salla.logger.warn("Trying to trigger '".concat(e,"' without filling required fields!")),!1):(salla.logger.warn("Trying to trigger '".concat(e,"' without event!")),!1)};e.prototype.getPossibleValue=function(e,t,n){if(n===void 0){n=!1}if(!e)return;if("object"!=typeof e)return e;var r;for(var i=0;i<t.length&&!(r=e[t[i]])&&!("undefined"!=typeof FormData&&e instanceof FormData&&(r=e.get(t[i])));i++);return r=r||e,"object"!=typeof r||n?r:void 0};return e}()),Pr.infiniteScroll=new(function(e){__extends(t,e);function t(t,n){var r=this;r=e.call(this,t,n)||this,r.options={path:".infinite-scroll-btn",history:"push",status:".infinite-scroll-status",append:".list-block"},r.fetchOptions={headers:{"S-INFINITE-SCROLL":!0,"S-Source":"twilight","cache-control":"no-cache",pragma:"no-cache"}},r.instances=[];return r}t.prototype.initiate=function(e,t,n,r){if(r===void 0){r=!1}r?((n=n||{}).fetchOptions=__assign(__assign({},this.fetchOptions),n.fetchOptions||{}),n.responseBody="json"):n=this.getCustomOptions(t,n);var i="string"!=typeof e?e:document.querySelector(e),o=n.path;if(!i||!o||"string"==typeof o&&!document.querySelector(o))return void Salla.logger.warn(i?"Path Option (a link that has next page link) Not Existed!":"Container For InfiniteScroll not Existed!");var a=new zr(i,n);return a.on("scrollThreshold",Salla.infiniteScroll.event.scrollThreshold),a.on("request",Salla.infiniteScroll.event.request),a.on("load",Salla.infiniteScroll.event.load),a.on("append",Salla.infiniteScroll.event.append),a.on("error",Salla.infiniteScroll.event.error),a.on("last",Salla.infiniteScroll.event.last),a.on("history",Salla.infiniteScroll.event.history),this.instances.push(a),a};t.prototype.getCustomOptions=function(e,t){return(t="object"==typeof e&&e||t||this.options).fetchOptions=this.fetchOptions,t.path=t.path||this.options.path,t.button=t.button||t.path,t.status=t.status||this.options.status,t.hasOwnProperty("history")||(t.history=this.options.history),t.nextPage=t.nextPage||t.next_page,t.append="string"==typeof e&&e||t.append||this.options.append,t};t.prototype.loadNextPage=function(e){("string"!=typeof e?e:document.querySelector(e)).loadNextPage()};t.prototype.destroy=function(e){("string"!=typeof e?e:document.querySelector(e)).destroy()};return t}(tu))(void 0,salla.event.infiniteScroll),Pr.api=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.auth=new su,t.cart=new ou,t.loyalty=new au,t.order=new cu,t.rating=new hu,t.product=new lu,t.profile=new uu,t.comment=new du,t.currency=new fu,t.document=new pu,t.wishlist=new vu,t.scope=new gu,t.booking=new mu,t.landing=new yu,t.notifications=new bu,t.component=new _u,t.advertisement=new Su,t.navigation=new ku,t.metadata=new Eu;return t}return t}(wu)),Pr.sso=new(function(){function e(){var e=this;Salla.onReady((function(){return e.init()}))}e.prototype.init=function(){var e;if(salla.config.get("store.features").includes("sso-login")){if(window.location.hostname.includes("salla"))return salla.log("SSO is not supported yet for stores without custom domain.");salla.auth.event.onLoggedOut((function(){return new Promise((function(e){var t=document.createElement("iframe");t.style.display="none",t.src=salla.url.get("sso/logout"),document.body.appendChild(t),t.onload=function(){document.body.removeChild(t),e()}}))})),(e=document.querySelector("salla-login-modal"))===null||e===void 0?void 0:e.remove(),Salla.event.removeAllListeners("login::open"),Salla.event.prependListener("login::open",(function(){var e=window.location.pathname+window.location.search,t="".concat(window.location.origin,"/sso/login?intended_to=").concat(encodeURIComponent(e));return console.log("Redirecting to:",t),window.location.href=t,!0}))}};return e}()),Pr.intend=new(function(){function e(){var e=this;Salla.onReady((function(){return e.init()}))}e.prototype.init=function(){if(Salla.config.isUser())return;var e=new URLSearchParams(window.location.search);if(e.has("intended_to"))try{var t=new URL(e.get("intended_to"));if(t.hostname!==window.location.hostname)return;return this.handleAfterLoginEvent(t)}catch(e){return void console.warn("Invalid URL provided in intended_to parameter")}};e.prototype.handleAfterLoginEvent=function(e){var t="intend::user.logged.in";Salla.event.on(t,(function(){return window.location=e})),Salla.api.auth.setAfterLoginEvent(t),Salla.api.auth.setCanRedirect(!1),Salla.event.on("salla-login::ready",(function(){return Salla.event.emit("login::open",{withoutReload:!0})}))};return e}()),["cart","auth","order","scope","rating","comment","loyalty","product","profile","currency","document","wishlist","booking","landing","metadata"].forEach((function(e){return Pr[e]=new tu(Pr.api[e],Pr.event[e])})),Pr.call=function(e){var t=Pr,n=e.split(".");for(;n.length&&(t=t[n.shift()]););return t},Pr.analytics=new(function(){function e(){var e=this;this.history=[],this.customTrackers=[],this.mappedEvents={"wishlist::added":"Product Added to Wishlist","wishlist::removed":"Product Removed from Wishlist","salla-products-list::products.fetched":"Product List Viewed","auth::registered":"Signed Up","auth::logged.in":"Signed In","auth::logged.out":"Signed Out","share-element":"Product Shared"},salla.event.onAny((function(t,n){try{if(Object.keys(e.mappedEvents).includes(t)){var r=e.mappedEvents[t];return void salla.event.emit(r,n)}if(!salla.config.get("jitsu.events",[]).includes(t))return;var i=Mu.transform(t,n);i&&e.track(i.event,i.properties)}catch(t){salla.log("Error in analytics event handling:",t)}})),salla.event.on("twilight::init",(function(t){var n,r,i;var o=(t===null||t===void 0?void 0:t.jitsu)||{},a=o.host,s=o.key;e.analytics=null,a&&s?(Mu.registerEvents(),e.analytics=Kl({host:a,writeKey:s}),"user"===((n=t===null||t===void 0?void 0:t.user)===null||n===void 0?void 0:n.type)&&e.analytics.identify(t===null||t===void 0?void 0:t.user),e.page({context:{store_id:(r=t===null||t===void 0?void 0:t.store)===null||r===void 0?void 0:r.id,version:(i=t===null||t===void 0?void 0:t.jitsu)===null||i===void 0?void 0:i.version}})):salla.log("Jitsu configuration is missing. Analytics will not be tracked.")}))}e.prototype.track=function(e,t){var n=this;if(t===void 0){t={}}return this.analytics?(t=this.finalPayload(t),this.analytics.track(e,t).then((function(r){return n.pushEventToCustomTrackers("track",e,t),r})).then((function(){n.history.push({action:"track",eventName:e,payload:t})})).catch((function(e){return salla.log("Error tracking event:",e),Promise.reject(e)}))):(salla.log("Jitsu configuration is missing. Analytics will not be tracked."),Promise.resolve())};e.prototype.page=function(e){var t=this;if(e===void 0){e={}}return this.analytics?(e=this.finalPayload(e),this.analytics.page(e).then((function(n){return t.pushEventToCustomTrackers("page",e),n})).then((function(){t.history.push({action:"page",payload:e})})).catch((function(e){return salla.log("Error tracking page event:",e),Promise.reject(e)}))):(salla.log("Jitsu configuration is missing. Analytics will not be tracked."),Promise.resolve())};e.prototype.finalPayload=function(e){if(e===void 0){e={}}var t={context:{version:salla.config.get("jitsu.version",1),store_id:salla.config.get("store.id")}};var n=salla.storage.session.get("s-utms");if(n){var r=n["s-utm-campaign"],i=n["s-utm-source"],o=n["s-utm-medium"],a=n["s-utm-term"],s=n["s-utm-content"],c=n["s-utm-referrer"];t.context.campaign={name:r,source:i,medium:o,term:a,content:s,referrer:c}}return __assign(__assign({},t),e)};e.prototype.registerTracker=function(e){"object"==typeof e?"string"==typeof e.name&&e.name?"function"==typeof e.track?"function"==typeof e.page?this.customTrackers.find((function(t){return t.name===e.name}))?salla.log("tracker with the same name already exists!"):(this.customTrackers.push(e),this.history.forEach((function(t){return"track"===t.action?e.track(t.eventName,t.payload):"page"===t.action?e.page(t.payload):void 0}))):salla.log("tracker.page most be a function!"):salla.log("tracker.track most be a function!"):salla.log("tracker.name most be a string!"):salla.log('tracker most be an object {name:"tracker name", track: callback, page: callback}!')};e.prototype.pushEventToCustomTrackers=function(e,t,n){if(n===void 0){n={}}this.customTrackers.forEach((function(r){return r[e](t,n)}))};return e}()),Pr.init=function(e){return new xu(e)},salla.event.once("twilight::init",salla.init),salla.event.on("twilight::api",(function(e){var t=e===null||e===void 0?void 0:e.events;t&&salla.event.dispatchEvents(t)})),Pr.success=Pr.notify.success,Pr.error=Pr.notify.error,Pr.versions.twilight="[VI]{version}[/VI]",Pr.onInitiated=function(e){return salla.event.once("twilight::initiated",e)},window.dispatchEvent(new CustomEvent("salla::created"));var Bu=n((function(e,n){!function(t,n){e.exports=n()}(t,(function(){function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.apply(this,arguments)}var t="undefined"!=typeof window,n=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),r=t&&"IntersectionObserver"in window,i=t&&"classList"in document.createElement("p"),o=t&&window.devicePixelRatio>1,a={elements_selector:".lazy",container:n||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},s=function(t){return e({},a,t)},c=function(e,t){var n,r="LazyLoad::Initialized",i=new e(t);try{n=new CustomEvent(r,{detail:{instance:i}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent(r,!1,!1,{instance:i})}window.dispatchEvent(n)},l="src",u="srcset",d="sizes",f="poster",p="llOriginalAttrs",h="data",v="loading",g="loaded",m="applied",y="error",b="native",w="data-",_="ll-status",S=function(e,t){return e.getAttribute(w+t)},k=function(e){return S(e,_)},E=function(e,t){return function(e,t,n){var r="data-ll-status";null!==n?e.setAttribute(r,n):e.removeAttribute(r)}(e,0,t)},x=function(e){return E(e,null)},I=function(e){return null===k(e)},j=function(e){return k(e)===b},P=[v,g,m,y],O=function(e,t,n,r){e&&(void 0===r?void 0===n?e(t):e(t,n):e(t,n,r))},A=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},C=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},T=function(e){return e.llTempImage},F=function(e,t){if(t){var n=t._observer;n&&n.unobserve(e)}},L=function(e,t){e&&(e.loadingCount+=t)},R=function(e,t){e&&(e.toLoadCount=t)},N=function(e){for(var t,n=[],r=0;t=e.children[r];r+=1)"SOURCE"===t.tagName&&n.push(t);return n},z=function(e,t){var n=e.parentNode;n&&"PICTURE"===n.tagName&&N(n).forEach(t)},q=function(e,t){N(e).forEach(t)},U=[l],D=[l,f],M=[l,u,d],B=[h],H=function(e){return!!e[p]},G=function(e){return e[p]},J=function(e){return delete e[p]},V=function(e,t){if(!H(e)){var n={};t.forEach((function(t){n[t]=e.getAttribute(t)})),e[p]=n}},W=function(e,t){if(H(e)){var n=G(e);t.forEach((function(t){!function(e,t,n){n?e.setAttribute(t,n):e.removeAttribute(t)}(e,t,n[t])}))}},$=function(e,t,n){A(e,t.class_applied),E(e,m),n&&(t.unobserve_completed&&F(e,t),O(t.callback_applied,e,n))},Q=function(e,t,n){A(e,t.class_loading),E(e,v),n&&(L(n,1),O(t.callback_loading,e,n))},K=function(e,t,n){n&&e.setAttribute(t,n)},X=function(e,t){K(e,d,S(e,t.data_sizes)),K(e,u,S(e,t.data_srcset)),K(e,l,S(e,t.data_src))},Y={IMG:function(e,t){z(e,(function(e){V(e,M),X(e,t)})),V(e,M),X(e,t)},IFRAME:function(e,t){V(e,U),K(e,l,S(e,t.data_src))},VIDEO:function(e,t){q(e,(function(e){V(e,U),K(e,l,S(e,t.data_src))})),V(e,D),K(e,f,S(e,t.data_poster)),K(e,l,S(e,t.data_src)),e.load()},OBJECT:function(e,t){V(e,B),K(e,h,S(e,t.data_src))}},Z=["IMG","IFRAME","VIDEO","OBJECT"],ee=function(e,t){!t||function(e){return e.loadingCount>0}(t)||function(e){return e.toLoadCount>0}(t)||O(e.callback_finish,t)},te=function(e,t,n){e.addEventListener(t,n),e.llEvLisnrs[t]=n},ne=function(e,t,n){e.removeEventListener(t,n)},re=function(e){return!!e.llEvLisnrs},ie=function(e){if(re(e)){var t=e.llEvLisnrs;for(var n in t){var r=t[n];ne(e,n,r)}delete e.llEvLisnrs}},oe=function(e,t,n){!function(e){delete e.llTempImage}(e),L(n,-1),function(e){e&&(e.toLoadCount-=1)}(n),C(e,t.class_loading),t.unobserve_completed&&F(e,n)},ae=function(e,t,n){var r=T(e)||e;re(r)||function(e,t,n){re(e)||(e.llEvLisnrs={});var r="VIDEO"===e.tagName?"loadeddata":"load";te(e,r,t),te(e,"error",n)}(r,(function(i){!function(e,t,n,r){var i=j(t);oe(t,n,r),A(t,n.class_loaded),E(t,g),O(n.callback_loaded,t,r),i||ee(n,r)}(0,e,t,n),ie(r)}),(function(i){!function(e,t,n,r){var i=j(t);oe(t,n,r),A(t,n.class_error),E(t,y),O(n.callback_error,t,r),n.restore_on_error&&W(t,M),i||ee(n,r)}(0,e,t,n),ie(r)}))},se=function(e,t,n){!function(e){return Z.indexOf(e.tagName)>-1}(e)?function(e,t,n){!function(e){e.llTempImage=document.createElement("IMG")}(e),ae(e,t,n),function(e){H(e)||(e[p]={backgroundImage:e.style.backgroundImage})}(e),function(e,t,n){var r=S(e,t.data_bg),i=S(e,t.data_bg_hidpi),a=o&&i?i:r;a&&(e.style.backgroundImage='url("'.concat(a,'")'),T(e).setAttribute(l,a),Q(e,t,n))}(e,t,n),function(e,t,n){var r=S(e,t.data_bg_multi),i=S(e,t.data_bg_multi_hidpi),a=o&&i?i:r;a&&(e.style.backgroundImage=a,$(e,t,n))}(e,t,n),function(e,t,n){var r=S(e,t.data_bg_set);if(r){var i=r.split("|"),o=i.map((function(e){return"image-set(".concat(e,")")}));e.style.backgroundImage=o.join(),""===e.style.backgroundImage&&(o=i.map((function(e){return"-webkit-image-set(".concat(e,")")})),e.style.backgroundImage=o.join()),$(e,t,n)}}(e,t,n)}(e,t,n):function(e,t,n){ae(e,t,n),function(e,t,n){var r=Y[e.tagName];r&&(r(e,t),Q(e,t,n))}(e,t,n)}(e,t,n)},ce=function(e){e.removeAttribute(l),e.removeAttribute(u),e.removeAttribute(d)},le=function(e){z(e,(function(e){W(e,M)})),W(e,M)},ue={IMG:le,IFRAME:function(e){W(e,U)},VIDEO:function(e){q(e,(function(e){W(e,U)})),W(e,D),e.load()},OBJECT:function(e){W(e,B)}},de=function(e,t){(function(e){var t=ue[e.tagName];t?t(e):function(e){if(H(e)){var t=G(e);e.style.backgroundImage=t.backgroundImage}}(e)})(e),function(e,t){I(e)||j(e)||(C(e,t.class_entered),C(e,t.class_exited),C(e,t.class_applied),C(e,t.class_loading),C(e,t.class_loaded),C(e,t.class_error))}(e,t),x(e),J(e)},fe=["IMG","IFRAME","VIDEO"],pe=function(e){return e.use_native&&"loading"in HTMLImageElement.prototype},he=function(e,t,n){e.forEach((function(e){return function(e){return e.isIntersecting||e.intersectionRatio>0}(e)?function(e,t,n,r){var i=function(e){return P.indexOf(k(e))>=0}(e);E(e,"entered"),A(e,n.class_entered),C(e,n.class_exited),function(e,t,n){t.unobserve_entered&&F(e,n)}(e,n,r),O(n.callback_enter,e,t,r),i||se(e,n,r)}(e.target,e,t,n):function(e,t,n,r){I(e)||(A(e,n.class_exited),function(e,t,n,r){n.cancel_on_exit&&function(e){return k(e)===v}(e)&&"IMG"===e.tagName&&(ie(e),function(e){z(e,(function(e){ce(e)})),ce(e)}(e),le(e),C(e,n.class_loading),L(r,-1),x(e),O(n.callback_cancel,e,t,r))}(e,t,n,r),O(n.callback_exit,e,t,r))}(e.target,e,t,n)}))},ve=function(e){return Array.prototype.slice.call(e)},ge=function(e){return e.container.querySelectorAll(e.elements_selector)},me=function(e){return function(e){return k(e)===y}(e)},ye=function(e,t){return function(e){return ve(e).filter(I)}(e||ge(t))},be=function(e,n){var i=s(e);this._settings=i,this.loadingCount=0,function(e,t){r&&!pe(e)&&(t._observer=new IntersectionObserver((function(n){he(n,e,t)}),function(e){return{root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}}(e)))}(i,this),function(e,n){t&&(n._onlineHandler=function(){!function(e,t){var n;(n=ge(e),ve(n).filter(me)).forEach((function(t){C(t,e.class_error),x(t)})),t.update()}(e,n)},window.addEventListener("online",n._onlineHandler))}(i,this),this.update(n)};return be.prototype={update:function(e){var t,i,o=this._settings,a=ye(e,o);R(this,a.length),!n&&r?pe(o)?function(e,t,n){e.forEach((function(e){-1!==fe.indexOf(e.tagName)&&function(e,t,n){e.setAttribute("loading","lazy"),ae(e,t,n),function(e,t){var n=Y[e.tagName];n&&n(e,t)}(e,t),E(e,b)}(e,t,n)})),R(n,0)}(a,o,this):(i=a,function(e){e.disconnect()}(t=this._observer),function(e,t){t.forEach((function(t){e.observe(t)}))}(t,i)):this.loadAll(a)},destroy:function(){this._observer&&this._observer.disconnect(),t&&window.removeEventListener("online",this._onlineHandler),ge(this._settings).forEach((function(e){J(e)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){var t=this,n=this._settings;ye(e,n).forEach((function(e){F(e,t),se(e,n,t)}))},restoreAll:function(){var e=this._settings;ge(e).forEach((function(t){de(t,e)}))}},be.load=function(e,t){var n=s(t);se(e,n)},be.resetStatus=function(e){x(e)},t&&function(e,t){if(t)if(t.length)for(var n,r=0;n=t[r];r+=1)c(e,n);else c(e,t)}(be,window.lazyLoadOptions),be}))}));function Hu(){if(!document.lazyLoadInstance){document.lazyLoadInstance=new Bu({use_native:true});document.lazyLoadBackgrounds=new Bu({elements_selector:".lazy[data-bg]:not(.loaded)"})}if(document.readyState!=="complete"){document.addEventListener("DOMContentLoaded",(function(){return document.lazyLoadInstance.update()}));document.addEventListener("DOMContentLoaded",(function(){return document.lazyLoadBackgrounds.update()}))}salla.infiniteScroll.event.onAppend((function(){document.lazyLoadInstance.update();document.lazyLoadBackgrounds.update()}))}var Gu=e("g",Hu)}}}));
25
- //# sourceMappingURL=p-eb07cc3c.system.js.map
24
+ (function(t,n){{e.exports=n()}})(t,(function(){function e(){if(typeof document!=="undefined"&&document.documentElement){return document.documentElement.lang}}function t(e){if(e==="-Inf"){return-Infinity}else if(e==="+Inf"||e==="Inf"||e==="*"){return Infinity}return parseInt(e,10)}var n=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/;var r=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/;var i={locale:"en"};var o=function(t){t=t||{};this.locale=t.locale||e()||i.locale;this.fallback=t.fallback;this.messages=t.messages};o.prototype.setMessages=function(e){this.messages=e};o.prototype.getLocale=function(){return this.locale||this.fallback};o.prototype.setLocale=function(e){this.locale=e};o.prototype.getFallback=function(){return this.fallback};o.prototype.setFallback=function(e){this.fallback=e};o.prototype.has=function(e,t){if(typeof e!=="string"||!this.messages){return false}return this._getMessage(e,t)!==null};o.prototype.get=function(e,t,n){if(!this.has(e,n)){return e}var r=this._getMessage(e,n);if(r===null){return e}if(t){r=this._applyReplacements(r,t)}return r};o.prototype.trans=function(e,t){return this.get(e,t)};o.prototype.choice=function(e,t,n,i){n=typeof n!=="undefined"?n:{};n.count=t;var o=this.get(e,n,i);if(o===null||o===undefined){return o}var a=o.split("|");var s=[];for(var c=0;c<a.length;c++){a[c]=a[c].trim();if(r.test(a[c])){var l=a[c].split(/\s/);s.push(l.shift());a[c]=l.join(" ")}}if(a.length===1){return o}for(var u=0;u<s.length;u++){if(this._testInterval(t,s[u])){return a[u]}}i=i||this._getLocale(e);var d=this._getPluralForm(t,i);return a[d]};o.prototype.transChoice=function(e,t,n){return this.choice(e,t,n)};o.prototype._parseKey=function(e,t){if(typeof e!=="string"||typeof t!=="string"){return null}var n=e.split(".");var r=n[0].replace(/\//g,".");return{source:t+"."+r,sourceFallback:this.getFallback()+"."+r,entries:n.slice(1)}};o.prototype._getMessage=function(e,t){t=t||this.getLocale();e=this._parseKey(e,t);if(this.messages[e.source]===undefined&&this.messages[e.sourceFallback]===undefined){return null}var n=this.messages[e.source];var r=e.entries.slice();var i=r.join(".");n=n!==undefined?this._getValueInKey(n,i):undefined;if(typeof n!=="string"&&this.messages[e.sourceFallback]){n=this.messages[e.sourceFallback];r=e.entries.slice();i="";while(r.length&&n!==undefined){var i=!i?r.shift():i.concat(".",r.shift());if(n[i]){n=n[i];i=""}}}if(typeof n!=="string"){return null}return n};o.prototype._getValueInKey=function(e,t){if(typeof e[t]==="string"){return e[t]}t=t.replace(/\[(\w+)\]/g,".$1");t=t.replace(/^\./,"");var n=t.split(".");for(var r=0,i=n.length;r<i;++r){var o=n.slice(0,r+1).join(".");var a=n.slice(r+1,n.length).join(".");if(e[o]){return this._getValueInKey(e[o],a)}}return e};o.prototype._getLocale=function(e){e=this._parseKey(e,this.locale);if(this.messages[e.source]){return this.locale}if(this.messages[e.sourceFallback]){return this.fallback}return null};o.prototype._findMessageInTree=function(e,t){while(e.length&&t!==undefined){var n=e.join(".");if(t[n]){t=t[n];break}t=t[e.shift()]}return t};o.prototype._sortReplacementKeys=function(e,t){return t.length-e.length};o.prototype._applyReplacements=function(e,t){var n=Object.keys(t).sort(this._sortReplacementKeys);n.forEach((function(n){e=e.replace(new RegExp(":"+n,"gi"),(function(e){var r=t[n];var i=e===e.toUpperCase();if(i){return r.toUpperCase()}var o=e===e.replace(/\w/i,(function(e){return e.toUpperCase()}));if(o){return r.charAt(0).toUpperCase()+r.slice(1)}return r}))}));return e};o.prototype._testInterval=function(e,r){if(typeof r!=="string"){throw"Invalid interval: should be a string."}r=r.trim();var i=r.match(n);if(!i){throw"Invalid interval: "+r}if(i[2]){var o=i[2].split(",");for(var a=0;a<o.length;a++){if(parseInt(o[a],10)===e){return true}}}else{i=i.filter((function(e){return!!e}));var s=i[1];var c=t(i[2]);if(c===Infinity){c=-Infinity}var l=t(i[3]);var u=i[4];return(s==="["?e>=c:e>c)&&(u==="]"?e<=l:e<l)}return false};o.prototype._getPluralForm=function(e,t){switch(t){case"az":case"bo":case"dz":case"id":case"ja":case"jv":case"ka":case"km":case"kn":case"ko":case"ms":case"th":case"tr":case"vi":case"zh":return 0;case"af":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"ur":case"zu":return e==1?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"hy":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return e===0||e===1?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2;case"cs":case"sk":return e==1?0:e>=2&&e<=4?1:2;case"ga":return e==1?0:e==2?1:2;case"lt":return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2;case"sl":return e%100==1?0:e%100==2?1:e%100==3||e%100==4?2:3;case"mk":return e%10==1?0:1;case"mt":return e==1?0:e===0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3;case"lv":return e===0?0:e%10==1&&e%100!=11?1:2;case"pl":return e==1?0:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?1:2;case"cy":return e==1?0:e==2?1:e==8||e==11?2:3;case"ro":return e==1?0:e===0||e%100>0&&e%100<20?1:2;case"ar":return e===0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5;default:return 0}};return o}))}));var Ur=function e(t,n){return function e(){var r=new Array(arguments.length);for(var i=0;i<r.length;i++){r[i]=arguments[i]}return t.apply(n,r)}};var Dr=Object.prototype.toString;var Mr=function(e){return function(t){var n=Dr.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())}}(Object.create(null));function Br(e){e=e.toLowerCase();return function t(n){return Mr(n)===e}}function Hr(e){return Array.isArray(e)}function Gr(e){return typeof e==="undefined"}function Jr(e){return e!==null&&!Gr(e)&&e.constructor!==null&&!Gr(e.constructor)&&typeof e.constructor.isBuffer==="function"&&e.constructor.isBuffer(e)}var Vr=Br("ArrayBuffer");function Wr(e){var t;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){t=ArrayBuffer.isView(e)}else{t=e&&e.buffer&&Vr(e.buffer)}return t}function $r(e){return typeof e==="string"}function Qr(e){return typeof e==="number"}function Kr(e){return e!==null&&typeof e==="object"}function Xr(e){if(Mr(e)!=="object"){return false}var t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}var Yr=Br("Date");var Zr=Br("File");var ei=Br("Blob");var ti=Br("FileList");function ni(e){return Dr.call(e)==="[object Function]"}function ri(e){return Kr(e)&&ni(e.pipe)}function ii(e){var t="[object FormData]";return e&&(typeof FormData==="function"&&e instanceof FormData||Dr.call(e)===t||ni(e.toString)&&e.toString()===t)}var oi=Br("URLSearchParams");function ai(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function si(){if(typeof navigator!=="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")){return false}return typeof window!=="undefined"&&typeof document!=="undefined"}function ci(e,t){if(e===null||typeof e==="undefined"){return}if(typeof e!=="object"){e=[e]}if(Hr(e)){for(var n=0,r=e.length;n<r;n++){t.call(null,e[n],n,e)}}else{for(var i in e){if(Object.prototype.hasOwnProperty.call(e,i)){t.call(null,e[i],i,e)}}}}function li(){var e={};function t(t,n){if(Xr(e[n])&&Xr(t)){e[n]=li(e[n],t)}else if(Xr(t)){e[n]=li({},t)}else if(Hr(t)){e[n]=t.slice()}else{e[n]=t}}for(var n=0,r=arguments.length;n<r;n++){ci(arguments[n],t)}return e}function ui(e,t,n){ci(t,(function t(r,i){if(n&&typeof r==="function"){e[i]=Ur(r,n)}else{e[i]=r}}));return e}function di(e){if(e.charCodeAt(0)===65279){e=e.slice(1)}return e}function fi(e,t,n,r){e.prototype=Object.create(t.prototype,r);e.prototype.constructor=e;n&&Object.assign(e.prototype,n)}function pi(e,t,n){var r;var i;var o;var a={};t=t||{};do{r=Object.getOwnPropertyNames(e);i=r.length;while(i-- >0){o=r[i];if(!a[o]){t[o]=e[o];a[o]=true}}e=Object.getPrototypeOf(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t}function hi(e,t,n){e=String(e);if(n===undefined||n>e.length){n=e.length}n-=t.length;var r=e.indexOf(t,n);return r!==-1&&r===n}function vi(e){if(!e)return null;var t=e.length;if(Gr(t))return null;var n=new Array(t);while(t-- >0){n[t]=e[t]}return n}var gi=function(e){return function(t){return e&&t instanceof e}}(typeof Uint8Array!=="undefined"&&Object.getPrototypeOf(Uint8Array));var mi={isArray:Hr,isArrayBuffer:Vr,isBuffer:Jr,isFormData:ii,isArrayBufferView:Wr,isString:$r,isNumber:Qr,isObject:Kr,isPlainObject:Xr,isUndefined:Gr,isDate:Yr,isFile:Zr,isBlob:ei,isFunction:ni,isStream:ri,isURLSearchParams:oi,isStandardBrowserEnv:si,forEach:ci,merge:li,extend:ui,trim:ai,stripBOM:di,inherits:fi,toFlatObject:pi,kindOf:Mr,kindOfTest:Br,endsWith:hi,toArray:vi,isTypedArray:gi,isFileList:ti};function yi(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var bi=function e(t,n,r){if(!n){return t}var i;if(r){i=r(n)}else if(mi.isURLSearchParams(n)){i=n.toString()}else{var o=[];mi.forEach(n,(function e(t,n){if(t===null||typeof t==="undefined"){return}if(mi.isArray(t)){n=n+"[]"}else{t=[t]}mi.forEach(t,(function e(t){if(mi.isDate(t)){t=t.toISOString()}else if(mi.isObject(t)){t=JSON.stringify(t)}o.push(yi(n)+"="+yi(t))}))}));i=o.join("&")}if(i){var a=t.indexOf("#");if(a!==-1){t=t.slice(0,a)}t+=(t.indexOf("?")===-1?"?":"&")+i}return t};function wi(){this.handlers=[]}wi.prototype.use=function e(t,n,r){this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:false,runWhen:r?r.runWhen:null});return this.handlers.length-1};wi.prototype.eject=function e(t){if(this.handlers[t]){this.handlers[t]=null}};wi.prototype.forEach=function e(t){mi.forEach(this.handlers,(function e(n){if(n!==null){t(n)}}))};var _i=wi;var Si=function e(t,n){mi.forEach(t,(function e(r,i){if(i!==n&&i.toUpperCase()===n.toUpperCase()){t[n]=r;delete t[i]}}))};function ki(e,t,n,r,i){Error.call(this);this.message=e;this.name="AxiosError";t&&(this.code=t);n&&(this.config=n);r&&(this.request=r);i&&(this.response=i)}mi.inherits(ki,Error,{toJSON:function e(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var Ei=ki.prototype;var xi={};["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){xi[e]={value:e}}));Object.defineProperties(ki,xi);Object.defineProperty(Ei,"isAxiosError",{value:true});ki.from=function(e,t,n,r,i,o){var a=Object.create(Ei);mi.toFlatObject(e,a,(function e(t){return t!==Error.prototype}));ki.call(a,e.message,t,n,r,i);a.name=e.name;o&&Object.assign(a,o);return a};var Ii=ki;var ji={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};function Pi(e,t){t=t||new FormData;var n=[];function r(e){if(e===null)return"";if(mi.isDate(e)){return e.toISOString()}if(mi.isArrayBuffer(e)||mi.isTypedArray(e)){return typeof Blob==="function"?new Blob([e]):Buffer.from(e)}return e}function i(e,o){if(mi.isPlainObject(e)||mi.isArray(e)){if(n.indexOf(e)!==-1){throw Error("Circular reference detected in "+o)}n.push(e);mi.forEach(e,(function e(n,a){if(mi.isUndefined(n))return;var s=o?o+"."+a:a;var c;if(n&&!o&&typeof n==="object"){if(mi.endsWith(a,"{}")){n=JSON.stringify(n)}else if(mi.endsWith(a,"[]")&&(c=mi.toArray(n))){c.forEach((function(e){!mi.isUndefined(e)&&t.append(s,r(e))}));return}}i(n,s)}));n.pop()}else{t.append(o,r(e))}}i(e);return t}var Oi=Pi;var Ai=function e(t,n,r){var i=r.config.validateStatus;if(!r.status||!i||i(r.status)){t(r)}else{n(new Ii("Request failed with status code "+r.status,[Ii.ERR_BAD_REQUEST,Ii.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}};var Ci=mi.isStandardBrowserEnv()?function e(){return{write:function e(t,n,r,i,o,a){var s=[];s.push(t+"="+encodeURIComponent(n));if(mi.isNumber(r)){s.push("expires="+new Date(r).toGMTString())}if(mi.isString(i)){s.push("path="+i)}if(mi.isString(o)){s.push("domain="+o)}if(a===true){s.push("secure")}document.cookie=s.join("; ")},read:function e(t){var n=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function e(t){this.write(t,"",Date.now()-864e5)}}}():function e(){return{write:function e(){},read:function e(){return null},remove:function e(){}}}();var Ti=function e(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)};var Fi=function e(t,n){return n?t.replace(/\/+$/,"")+"/"+n.replace(/^\/+/,""):t};var Li=function e(t,n){if(t&&!Ti(n)){return Fi(t,n)}return n};var Ri=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];var Ni=function e(t){var n={};var r;var i;var o;if(!t){return n}mi.forEach(t.split("\n"),(function e(t){o=t.indexOf(":");r=mi.trim(t.substr(0,o)).toLowerCase();i=mi.trim(t.substr(o+1));if(r){if(n[r]&&Ri.indexOf(r)>=0){return}if(r==="set-cookie"){n[r]=(n[r]?n[r]:[]).concat([i])}else{n[r]=n[r]?n[r]+", "+i:i}}}));return n};var zi=mi.isStandardBrowserEnv()?function e(){var t=/(msie|trident)/i.test(navigator.userAgent);var n=document.createElement("a");var r;function i(e){var r=e;if(t){n.setAttribute("href",r);r=n.href}n.setAttribute("href",r);return{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}}r=i(window.location.href);return function e(t){var n=mi.isString(t)?i(t):t;return n.protocol===r.protocol&&n.host===r.host}}():function e(){return function e(){return true}}();function qi(e){Ii.call(this,e==null?"canceled":e,Ii.ERR_CANCELED);this.name="CanceledError"}mi.inherits(qi,Ii,{__CANCEL__:true});var Ui=qi;var Di=function e(t){var n=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return n&&n[1]||""};var Mi=function e(t){return new Promise((function e(n,r){var i=t.data;var o=t.headers;var a=t.responseType;var s;function c(){if(t.cancelToken){t.cancelToken.unsubscribe(s)}if(t.signal){t.signal.removeEventListener("abort",s)}}if(mi.isFormData(i)&&mi.isStandardBrowserEnv()){delete o["Content-Type"]}var l=new XMLHttpRequest;if(t.auth){var u=t.auth.username||"";var d=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";o.Authorization="Basic "+btoa(u+":"+d)}var f=Li(t.baseURL,t.url);l.open(t.method.toUpperCase(),bi(f,t.params,t.paramsSerializer),true);l.timeout=t.timeout;function p(){if(!l){return}var e="getAllResponseHeaders"in l?Ni(l.getAllResponseHeaders()):null;var i=!a||a==="text"||a==="json"?l.responseText:l.response;var o={data:i,status:l.status,statusText:l.statusText,headers:e,config:t,request:l};Ai((function e(t){n(t);c()}),(function e(t){r(t);c()}),o);l=null}if("onloadend"in l){l.onloadend=p}else{l.onreadystatechange=function e(){if(!l||l.readyState!==4){return}if(l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)){return}setTimeout(p)}}l.onabort=function e(){if(!l){return}r(new Ii("Request aborted",Ii.ECONNABORTED,t,l));l=null};l.onerror=function e(){r(new Ii("Network Error",Ii.ERR_NETWORK,t,l,l));l=null};l.ontimeout=function e(){var n=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";var i=t.transitional||ji;if(t.timeoutErrorMessage){n=t.timeoutErrorMessage}r(new Ii(n,i.clarifyTimeoutError?Ii.ETIMEDOUT:Ii.ECONNABORTED,t,l));l=null};if(mi.isStandardBrowserEnv()){var h=(t.withCredentials||zi(f))&&t.xsrfCookieName?Ci.read(t.xsrfCookieName):undefined;if(h){o[t.xsrfHeaderName]=h}}if("setRequestHeader"in l){mi.forEach(o,(function e(t,n){if(typeof i==="undefined"&&n.toLowerCase()==="content-type"){delete o[n]}else{l.setRequestHeader(n,t)}}))}if(!mi.isUndefined(t.withCredentials)){l.withCredentials=!!t.withCredentials}if(a&&a!=="json"){l.responseType=t.responseType}if(typeof t.onDownloadProgress==="function"){l.addEventListener("progress",t.onDownloadProgress)}if(typeof t.onUploadProgress==="function"&&l.upload){l.upload.addEventListener("progress",t.onUploadProgress)}if(t.cancelToken||t.signal){s=function(e){if(!l){return}r(!e||e&&e.type?new Ui:e);l.abort();l=null};t.cancelToken&&t.cancelToken.subscribe(s);if(t.signal){t.signal.aborted?s():t.signal.addEventListener("abort",s)}}if(!i){i=null}var v=Di(f);if(v&&["http","https","file"].indexOf(v)===-1){r(new Ii("Unsupported protocol "+v+":",Ii.ERR_BAD_REQUEST,t));return}l.send(i)}))};var Bi=null;var Hi={"Content-Type":"application/x-www-form-urlencoded"};function Gi(e,t){if(!mi.isUndefined(e)&&mi.isUndefined(e["Content-Type"])){e["Content-Type"]=t}}function Ji(){var e;if(typeof XMLHttpRequest!=="undefined"){e=Mi}else if(typeof process!=="undefined"&&Object.prototype.toString.call(process)==="[object process]"){e=Mi}return e}function Vi(e,t,n){if(mi.isString(e)){try{(t||JSON.parse)(e);return mi.trim(e)}catch(e){if(e.name!=="SyntaxError"){throw e}}}return(n||JSON.stringify)(e)}var Wi={transitional:ji,adapter:Ji(),transformRequest:[function e(t,n){Si(n,"Accept");Si(n,"Content-Type");if(mi.isFormData(t)||mi.isArrayBuffer(t)||mi.isBuffer(t)||mi.isStream(t)||mi.isFile(t)||mi.isBlob(t)){return t}if(mi.isArrayBufferView(t)){return t.buffer}if(mi.isURLSearchParams(t)){Gi(n,"application/x-www-form-urlencoded;charset=utf-8");return t.toString()}var r=mi.isObject(t);var i=n&&n["Content-Type"];var o;if((o=mi.isFileList(t))||r&&i==="multipart/form-data"){var a=this.env&&this.env.FormData;return Oi(o?{"files[]":t}:t,a&&new a)}else if(r||i==="application/json"){Gi(n,"application/json");return Vi(t)}return t}],transformResponse:[function e(t){var n=this.transitional||Wi.transitional;var r=n&&n.silentJSONParsing;var i=n&&n.forcedJSONParsing;var o=!r&&this.responseType==="json";if(o||i&&mi.isString(t)&&t.length){try{return JSON.parse(t)}catch(e){if(o){if(e.name==="SyntaxError"){throw Ii.from(e,Ii.ERR_BAD_RESPONSE,this,null,this.response)}throw e}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Bi},validateStatus:function e(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};mi.forEach(["delete","get","head"],(function e(t){Wi.headers[t]={}}));mi.forEach(["post","put","patch"],(function e(t){Wi.headers[t]=mi.merge(Hi)}));var $i=Wi;var Qi=function e(t,n,r){var i=this||$i;mi.forEach(r,(function e(r){t=r.call(i,t,n)}));return t};var Ki=function e(t){return!!(t&&t.__CANCEL__)};function Xi(e){if(e.cancelToken){e.cancelToken.throwIfRequested()}if(e.signal&&e.signal.aborted){throw new Ui}}var Yi=function e(t){Xi(t);t.headers=t.headers||{};t.data=Qi.call(t,t.data,t.headers,t.transformRequest);t.headers=mi.merge(t.headers.common||{},t.headers[t.method]||{},t.headers);mi.forEach(["delete","get","head","post","put","patch","common"],(function e(n){delete t.headers[n]}));var n=t.adapter||$i.adapter;return n(t).then((function e(n){Xi(t);n.data=Qi.call(t,n.data,n.headers,t.transformResponse);return n}),(function e(n){if(!Ki(n)){Xi(t);if(n&&n.response){n.response.data=Qi.call(t,n.response.data,n.response.headers,t.transformResponse)}}return Promise.reject(n)}))};var Zi=function e(t,n){n=n||{};var r={};function i(e,t){if(mi.isPlainObject(e)&&mi.isPlainObject(t)){return mi.merge(e,t)}else if(mi.isPlainObject(t)){return mi.merge({},t)}else if(mi.isArray(t)){return t.slice()}return t}function o(e){if(!mi.isUndefined(n[e])){return i(t[e],n[e])}else if(!mi.isUndefined(t[e])){return i(undefined,t[e])}}function a(e){if(!mi.isUndefined(n[e])){return i(undefined,n[e])}}function s(e){if(!mi.isUndefined(n[e])){return i(undefined,n[e])}else if(!mi.isUndefined(t[e])){return i(undefined,t[e])}}function c(e){if(e in n){return i(t[e],n[e])}else if(e in t){return i(undefined,t[e])}}var l={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:c};mi.forEach(Object.keys(t).concat(Object.keys(n)),(function e(t){var n=l[t]||o;var i=n(t);mi.isUndefined(i)&&n!==c||(r[t]=i)}));return r};var eo={version:"0.27.2"};var to=eo.version;var no={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){no[e]=function n(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var ro={};no.transitional=function e(t,n,r){function i(e,t){return"[Axios v"+to+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(e,r,o){if(t===false){throw new Ii(i(r," has been removed"+(n?" in "+n:"")),Ii.ERR_DEPRECATED)}if(n&&!ro[r]){ro[r]=true;console.warn(i(r," has been deprecated since v"+n+" and will be removed in the near future"))}return t?t(e,r,o):true}};function io(e,t,n){if(typeof e!=="object"){throw new Ii("options must be an object",Ii.ERR_BAD_OPTION_VALUE)}var r=Object.keys(e);var i=r.length;while(i-- >0){var o=r[i];var a=t[o];if(a){var s=e[o];var c=s===undefined||a(s,o,e);if(c!==true){throw new Ii("option "+o+" must be "+c,Ii.ERR_BAD_OPTION_VALUE)}continue}if(n!==true){throw new Ii("Unknown option "+o,Ii.ERR_BAD_OPTION)}}}var oo={assertOptions:io,validators:no};var ao=oo.validators;function so(e){this.defaults=e;this.interceptors={request:new _i,response:new _i}}so.prototype.request=function e(t,n){if(typeof t==="string"){n=n||{};n.url=t}else{n=t||{}}n=Zi(this.defaults,n);if(n.method){n.method=n.method.toLowerCase()}else if(this.defaults.method){n.method=this.defaults.method.toLowerCase()}else{n.method="get"}var r=n.transitional;if(r!==undefined){oo.assertOptions(r,{silentJSONParsing:ao.transitional(ao.boolean),forcedJSONParsing:ao.transitional(ao.boolean),clarifyTimeoutError:ao.transitional(ao.boolean)},false)}var i=[];var o=true;this.interceptors.request.forEach((function e(t){if(typeof t.runWhen==="function"&&t.runWhen(n)===false){return}o=o&&t.synchronous;i.unshift(t.fulfilled,t.rejected)}));var a=[];this.interceptors.response.forEach((function e(t){a.push(t.fulfilled,t.rejected)}));var s;if(!o){var c=[Yi,undefined];Array.prototype.unshift.apply(c,i);c=c.concat(a);s=Promise.resolve(n);while(c.length){s=s.then(c.shift(),c.shift())}return s}var l=n;while(i.length){var u=i.shift();var d=i.shift();try{l=u(l)}catch(e){d(e);break}}try{s=Yi(l)}catch(e){return Promise.reject(e)}while(a.length){s=s.then(a.shift(),a.shift())}return s};so.prototype.getUri=function e(t){t=Zi(this.defaults,t);var n=Li(t.baseURL,t.url);return bi(n,t.params,t.paramsSerializer)};mi.forEach(["delete","get","head","options"],(function e(t){so.prototype[t]=function(e,n){return this.request(Zi(n||{},{method:t,url:e,data:(n||{}).data}))}}));mi.forEach(["post","put","patch"],(function e(t){function n(e){return function n(r,i,o){return this.request(Zi(o||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}so.prototype[t]=n();so.prototype[t+"Form"]=n(true)}));var co=so;function lo(e){if(typeof e!=="function"){throw new TypeError("executor must be a function.")}var t;this.promise=new Promise((function e(n){t=n}));var n=this;this.promise.then((function(e){if(!n._listeners)return;var t;var r=n._listeners.length;for(t=0;t<r;t++){n._listeners[t](e)}n._listeners=null}));this.promise.then=function(e){var t;var r=new Promise((function(e){n.subscribe(e);t=e})).then(e);r.cancel=function e(){n.unsubscribe(t)};return r};e((function e(r){if(n.reason){return}n.reason=new Ui(r);t(n.reason)}))}lo.prototype.throwIfRequested=function e(){if(this.reason){throw this.reason}};lo.prototype.subscribe=function e(t){if(this.reason){t(this.reason);return}if(this._listeners){this._listeners.push(t)}else{this._listeners=[t]}};lo.prototype.unsubscribe=function e(t){if(!this._listeners){return}var n=this._listeners.indexOf(t);if(n!==-1){this._listeners.splice(n,1)}};lo.source=function e(){var t;var n=new lo((function e(n){t=n}));return{token:n,cancel:t}};var uo=lo;var fo=function e(t){return function e(n){return t.apply(null,n)}};var po=function e(t){return mi.isObject(t)&&t.isAxiosError===true};function ho(e){var t=new co(e);var n=Ur(co.prototype.request,t);mi.extend(n,co.prototype,t);mi.extend(n,t);n.create=function t(n){return ho(Zi(e,n))};return n}var vo=ho($i);vo.Axios=co;vo.CanceledError=Ui;vo.CancelToken=uo;vo.isCancel=Ki;vo.VERSION=eo.version;vo.toFormData=Oi;vo.AxiosError=Ii;vo.Cancel=vo.CanceledError;vo.all=function e(t){return Promise.all(t)};vo.spread=fo;vo.isAxiosError=po;var go=vo;var mo=vo;go.default=mo;var yo=go;function bo(e){this.message=e}bo.prototype=new Error,bo.prototype.name="InvalidCharacterError";var wo="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new bo("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,o=0,a="";r=t.charAt(o++);~r&&(n=i%4?64*n+r:r,i++%4)?a+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function _o(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(wo(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return wo(t)}}function So(e){this.message=e}function ko(e,t){if("string"!=typeof e)throw new So("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(_o(e.split(".")[n]))}catch(e){throw new So("Invalid token specified: "+e.message)}}So.prototype=new Error,So.prototype.name="InvalidTokenError";function Eo(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;r<t.length;r++)e=e?e[t[r]]:i;return e===i?n:e}var xo="undefined",Io="object",jo="any",Po="*",Oo="__";"undefined"!=typeof process?process:{};var Ao="undefined"!=typeof document;"undefined"!=typeof Deno&&void 0!==Deno.core;Ao&&"nodejs"===window.name||"undefined"!=typeof navigator&&void 0!==navigator.userAgent&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom"));function Co(e,t){return t.charAt(0)[e]()+t.slice(1)}var To=Co.bind(null,"toUpperCase"),Fo=Co.bind(null,"toLowerCase");function Lo(e){return Mo(e)?To("null"):"object"==typeof e?Vo(e):Object.prototype.toString.call(e).slice(8,-1)}function Ro(e,t){void 0===t&&(t=!0);var n=Lo(e);return t?Fo(n):n}function No(e,t){return typeof t===e}var zo=No.bind(null,"function"),qo=No.bind(null,"string"),Uo=No.bind(null,"undefined");var Do=No.bind(null,"boolean");No.bind(null,"symbol");function Mo(e){return null===e}function Bo(e){return"number"===Ro(e)&&!isNaN(e)}function Ho(e){return"array"===Ro(e)}function Go(e){if(!Jo(e))return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function Jo(e){return e&&("object"==typeof e||null!==e)}function Vo(e){return zo(e.constructor)?e.constructor.name:null}function Wo(e){return e instanceof Error||qo(e.message)&&e.constructor&&Bo(e.constructor.stackTraceLimit)}function $o(e,t){if("object"!=typeof t||Mo(t))return!1;if(t instanceof e)return!0;var n=Ro(new e(""));if(Wo(t))for(;t;){if(Ro(t)===n)return!0;t=Object.getPrototypeOf(t)}return!1}$o.bind(null,TypeError);$o.bind(null,SyntaxError);function Qo(e,t){var n=e instanceof Element||e instanceof HTMLDocument;return n&&t?Ko(e,t):n}function Ko(e,t){return void 0===t&&(t=""),e&&e.nodeName===t.toUpperCase()}function Xo(e){var t=[].slice.call(arguments,1);return function(){return e.apply(void 0,[].slice.call(arguments).concat(t))}}Xo(Qo,"form");Xo(Qo,"button");Xo(Qo,"input");Xo(Qo,"select");function Yo(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch(e){return null}}function Zo(e){return function(e){for(var t,n=Object.create(null),r=/([^&=]+)=?([^&]*)/g;t=r.exec(e);){var i=Yo(t[1]),o=Yo(t[2]);"[]"===i.substring(i.length-2)?(n[i=i.substring(0,i.length-2)]||(n[i]=[])).push(o):n[i]=""===o||o}for(var a in n){var s=a.split("[");s.length>1&&(ea(n,s.map((function(e){return e.replace(/[?[\]\\ ]/g,"")})),n[a]),delete n[a])}return n}(function(e){if(e){var t=e.match(/\?(.*)/);return t&&t[1]?t[1].split("#")[0]:""}return Ao&&window.location.search.substring(1)}(e))}function ea(e,t,n){for(var r=t.length-1,i=0;i<r;++i){var o=t[i];if("__proto__"===o||"constructor"===o)break;o in e||(e[o]={}),e=e[o]}e[t[r]]=n}function ta(){for(var e="",t=0,n=4294967295*Math.random()|0;t++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t-1],i=15&n;e+="-"==r||"4"==r?r:("x"==r?i:3&i|8).toString(16),n=t%8==0?4294967295*Math.random()|0:n>>4}return e}var na="global",ra=Oo+"global"+Oo,ia=typeof self===Io&&self.self===self&&self||typeof global===Io&&global.global===global&&global||void 0;function oa(e){return ia[ra][e]}function aa(e,t){return ia[ra][e]=t}function sa(e){delete ia[ra][e]}function ca(e,t,n){var r;try{if(ua(e)){var i=window[e];r=i[t].bind(i)}}catch(e){}return r||n}ia[ra]||(ia[ra]={});var la={};function ua(e){if(typeof la[e]!==xo)return la[e];try{var t=window[e];t.setItem(xo,xo),t.removeItem(xo)}catch(t){return la[e]=!1}return la[e]=!0}function da(){return da=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},da.apply(this,arguments)}var fa="function",pa="undefined",ha="@@redux/"+Math.random().toString(36),va=function(){return typeof Symbol===fa&&Symbol.observable||"@@observable"}(),ga=" != "+fa;function ma(e,t,n){var r;if(typeof t===fa&&typeof n===pa&&(n=t,t=void 0),typeof n!==pa){if(typeof n!==fa)throw new Error("enhancer"+ga);return n(ma)(e,t)}if(typeof e!==fa)throw new Error("reducer"+ga);var i=e,o=t,a=[],s=a,c=!1;function l(){s===a&&(s=a.slice())}function u(){return o}function d(e){if(typeof e!==fa)throw new Error("Listener"+ga);var t=!0;return l(),s.push(e),function(){if(t){t=!1,l();var n=s.indexOf(e);s.splice(n,1)}}}function f(e){if(!Go(e))throw new Error("Act != obj");if(typeof e.type===pa)throw new Error("ActType "+pa);if(c)throw new Error("Dispatch in reducer");try{c=!0,o=i(o,e)}finally{c=!1}for(var t=a=s,n=0;n<t.length;n++)(0,t[n])();return e}return f({type:"@@redux/INIT"}),(r={dispatch:f,subscribe:d,getState:u,replaceReducer:function(e){if(typeof e!==fa)throw new Error("next reducer"+ga);i=e,f({type:"@@redux/INIT"})}})[va]=function(){var e,t=d;return(e={subscribe:function(e){if("object"!=typeof e)throw new TypeError("Observer != obj");function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[va]=function(){return this},e},r}function ya(e,t){var n=t&&t.type;return"action "+(n&&n.toString()||"?")+"reducer "+e+" returns "+pa}function ba(){var e=[].slice.call(arguments);return 0===e.length?function(e){return e}:1===e.length?e[0]:e.reduce((function(e,t){return function(){return e(t.apply(void 0,[].slice.call(arguments)))}}))}function wa(){var e=arguments;return function(t){return function(n,r,i){var o,a=t(n,r,i),s=a.dispatch,c={getState:a.getState,dispatch:function(e){return s(e)}};return o=[].slice.call(e).map((function(e){return e(c)})),da({},a,{dispatch:s=ba.apply(void 0,o)(a.dispatch)})}}}var _a=Oo+"anon_id",Sa=Oo+"user_id",ka=Oo+"user_traits",Ea="userId",xa="anonymousId",Ia=["bootstrap","params","campaign","initializeStart","initialize","initializeEnd","ready","resetStart","reset","resetEnd","pageStart","page","pageEnd","pageAborted","trackStart","track","trackEnd","trackAborted","identifyStart","identify","identifyEnd","identifyAborted","userIdChanged","registerPlugins","enablePlugin","disablePlugin","online","offline","setItemStart","setItem","setItemEnd","setItemAborted","removeItemStart","removeItem","removeItemEnd","removeItemAborted"],ja=["name","EVENTS","config","loaded"],Pa=Ia.reduce((function(e,t){return e[t]=t,e}),{registerPluginType:function(e){return"registerPlugin:"+e},pluginReadyType:function(e){return"ready:"+e}}),Oa=/^utm_/,Aa=/^an_prop_/,Ca=/^an_trait_/;function Ta(e){var t=e.storage.setItem;return function(n){return function(r){return function(i){if(i.type===Pa.bootstrap){var o=i.params,a=i.user,s=i.persistedUser,c=i.initialUser,l=s.userId===a.userId;s.anonymousId!==a.anonymousId&&t(_a,a.anonymousId),l||t(Sa,a.userId),c.traits&&t(ka,da({},l&&s.traits?s.traits:{},c.traits));var u=Object.keys(i.params);if(u.length){var d=o.an_uid,f=o.an_event,p=u.reduce((function(e,t){if(t.match(Oa)||t.match(/^(d|g)clid/)){var n=t.replace(Oa,"");e.campaign["campaign"===n?"name":n]=o[t]}return t.match(Aa)&&(e.props[t.replace(Aa,"")]=o[t]),t.match(Ca)&&(e.traits[t.replace(Ca,"")]=o[t]),e}),{campaign:{},props:{},traits:{}});n.dispatch(da({type:Pa.params,raw:o},p,d?{userId:d}:{})),d&&setTimeout((function(){return e.identify(d,p.traits)}),0),f&&setTimeout((function(){return e.track(f,p.props)}),0),Object.keys(p.campaign).length&&n.dispatch({type:Pa.campaign,campaign:p.campaign})}}return r(i)}}}}function Fa(e){return function(t,n){if(void 0===t&&(t={}),void 0===n&&(n={}),n.type===Pa.setItemEnd){if(n.key===_a)return da({},t,{anonymousId:n.value});if(n.key===Sa)return da({},t,{userId:n.value})}switch(n.type){case Pa.identify:return Object.assign({},t,{userId:n.userId,traits:da({},t.traits,n.traits)});case Pa.reset:return[Sa,_a,ka].forEach((function(t){e.removeItem(t)})),Object.assign({},t,{userId:null,anonymousId:null,traits:{}});default:return t}}}function La(e){return{userId:e.getItem(Sa),anonymousId:e.getItem(_a),traits:e.getItem(ka)}}var Ra=function(e){return Oo+"TEMP"+Oo+e};function Na(e){var t=e.storage,n=t.setItem,r=t.removeItem,i=t.getItem;return function(e){return function(t){return function(o){var a=o.userId,s=o.traits,c=o.options;if(o.type===Pa.reset&&([Sa,ka,_a].forEach((function(e){r(e)})),[Ea,xa,"traits"].forEach((function(e){sa(Ra(e))}))),o.type===Pa.identify){i(_a)||n(_a,ta());var l=i(Sa),u=i(ka)||{};l&&l!==a&&e.dispatch({type:Pa.userIdChanged,old:{userId:l,traits:u},new:{userId:a,traits:s},options:c}),a&&n(Sa,a),s&&n(ka,da({},u,s))}return t(o)}}}}var za={};function qa(e,t){za[e]&&zo(za[e])&&(za[e](t),delete za[e])}function Ua(e,t,n){return new Promise((function(r,i){return t()?r(e):n<1?i(da({},e,{queue:!0})):new Promise((function(e){return setTimeout(e,10)})).then((function(o){return Ua(e,t,n-10).then(r,i)}))}))}function Da(e){return{abort:e}}var Ma=function(e){var t=e.data,n=e.action,r=e.instance,i=e.state,o=e.allPlugins,a=e.allMatches,s=e.store,c=e.EVENTS;try{var l=i.plugins,u=i.context,d=n.type,f=d.match(Ba),p=t.exact.map((function(e){return e.pluginName}));f&&(p=a.during.map((function(e){return e.pluginName})));var h=function(e,t){return function(n,r,i){var o=r.config,a=r.name,s=a+"."+n.type;i&&(s=i.event);var c=n.type.match(Ba)?function(e,t,n,r,i){return function(o,a){var s=r?r.name:e,c=a&&Xa(a)?a:n;if(r&&(!(c=a&&Xa(a)?a:[e]).includes(e)||1!==c.length))throw new Error("Method "+t+" can only abort "+e+" plugin. "+JSON.stringify(c)+" input valid");return da({},i,{abort:{reason:o,plugins:c,caller:t,_:s}})}}(a,s,t,i,n):function(e,t){return function(){throw new Error(e.type+" action not cancellable. Remove abort in "+t)}}(n,s);return{payload:es(n),instance:e,config:o||{},abort:c}}}(r,p),v=t.exact.reduce((function(e,t){var n=t.pluginName,r=t.methodName,i=!1;return r.match(/^initialize/)||r.match(/^reset/)||(i=!l[n].loaded),u.offline&&r.match(/^(page|track|identify)/)&&(i=!0),e[""+n]=i,e}),{});return Promise.resolve(t.exact.reduce((function(e,i,a){try{var s=i.pluginName;return Promise.resolve(e).then((function(e){function i(){return Promise.resolve(e)}var a=function(){if(t.namespaced&&t.namespaced[s])return Promise.resolve(t.namespaced[s].reduce((function(e,t,n){try{return Promise.resolve(e).then((function(e){return t.method&&zo(t.method)?(function(e,t){var n=Za(e);if(n&&n.name===t){var r=Za(n.method);throw new Error([t+" plugin is calling method "+e,"Plugins cant call self","Use "+n.method+" "+(r?"or "+r.method:"")+" in "+t+" plugin insteadof "+e].join("\n"))}}(t.methodName,t.pluginName),Promise.resolve(t.method({payload:e,instance:r,abort:(n=e,i=s,a=t.pluginName,function(e,t){return da({},n,{abort:{reason:e,plugins:t||[i],caller:d,from:a||i}})}),config:Va(t.pluginName,l,o),plugins:l})).then((function(t){var n=Go(t)?t:{};return Promise.resolve(da({},e,n))}))):e;var n,i,a}))}catch(e){return Promise.reject(e)}}),Promise.resolve(n))).then((function(t){e[s]=t}));e[s]=n}();return a&&a.then?a.then(i):i()}))}catch(e){return Promise.reject(e)}}),Promise.resolve({}))).then((function(e){return Promise.resolve(t.exact.reduce((function(n,i,a){try{var c=t.exact.length===a+1,u=i.pluginName,p=o[u];return Promise.resolve(n).then((function(t){var n=e[u]?e[u]:{};if(f&&(n=t),Qa(n,u))return Ja({data:n,method:d,instance:r,pluginName:u,store:s}),Promise.resolve(t);if(Qa(t,u))return c&&Ja({data:t,method:d,instance:r,store:s}),Promise.resolve(t);if(v.hasOwnProperty(u)&&!0===v[u])return s.dispatch({type:"queue",plugin:u,payload:n,_:{called:"queue",from:"queueMechanism"}}),Promise.resolve(t);var i=h(e[u],o[u]);return Promise.resolve(p[d]({abort:i.abort,payload:n,instance:r,config:Va(u,l,o),plugins:l})).then((function(i){var o=Go(i)?i:{},a=da({},t,o),c=e[u];if(Qa(c,u))Ja({data:c,method:d,instance:r,pluginName:u,store:s});else{var l=d+":"+u;(l.match(/:/g)||[]).length<2&&!d.match(Ha)&&!d.match(Ga)&&r.dispatch(da({},f?a:n,{type:l,_:{called:l,from:"submethod"}}))}return Promise.resolve(a)}))}))}catch(e){return Promise.reject(e)}}),Promise.resolve(n))).then((function(e){if(!(d.match(Ba)||d.match(/^registerPlugin/)||d.match(Ga)||d.match(Ha)||d.match(/^params/)||d.match(/^userIdChanged/))){if(c.plugins.includes(d),e._&&e._.originalAction===d)return e;var n=da({},e,{_:{originalAction:e.type,called:e.type,from:"engineEnd"}});Ka(e,t.exact.length)&&!d.match(/End$/)&&(n=da({},n,{type:e.type+"Aborted"})),s.dispatch(n)}return e}))}))}catch(e){return Promise.reject(e)}},Ba=/Start$/,Ha=/^bootstrap/,Ga=/^ready/;function Ja(e){var t=e.pluginName,n=e.method+"Aborted"+(t?":"+t:"");e.store.dispatch(da({},e.data,{type:n,_:{called:n,from:"abort"}}))}function Va(e,t,n){var r=t[e]||n[e];return r&&r.config?r.config:{}}function Wa(e,t){return t.reduce((function(t,n){return n[e]?t.concat({methodName:e,pluginName:n.name,method:n[e]}):t}),[])}function $a(e,t){var n=e.replace(Ba,""),r=t?":"+t:"";return[""+e+r,""+n+r,n+"End"+r]}function Qa(e,t){var n=e.abort;return!!n&&(!0===n||Ya(n,t)||n&&Ya(n.plugins,t))}function Ka(e,t){var n=e.abort;if(!n)return!1;if(!0===n||qo(n))return!0;var r=n.plugins;return Xa(n)&&n.length===t||Xa(r)&&r.length===t}function Xa(e){return Array.isArray(e)}function Ya(e,t){return!(!e||!Xa(e))&&e.includes(t)}function Za(e){var t=e.match(/(.*):(.*)/);return!!t&&{method:t[1],name:t[2]}}function es(e){return Object.keys(e).reduce((function(t,n){return"type"===n||(t[n]=Go(e[n])?Object.assign({},e[n]):e[n]),t}),{})}function ts(e,t,n){var r={};return function(i){return function(o){return function(a){try{var s,c=function(e){return s?e:o(d)},l=a.type,u=a.plugins,d=a;if(a.abort)return Promise.resolve(o(a));if(l===Pa.enablePlugin&&i.dispatch({type:Pa.initializeStart,plugins:u,disabled:[],fromEnable:!0,meta:a.meta}),l===Pa.disablePlugin&&setTimeout((function(){return qa(a.meta.rid,{payload:a})}),0),l===Pa.initializeEnd){var f=t(),p=Object.keys(f),h=p.filter((function(e){return u.includes(e)})).map((function(e){return f[e]})),v=[],g=[],m=a.disabled,y=h.map((function(e){var t=e.loaded,n=e.name,o=e.config;return Ua(e,(function(){return t({config:o})}),1e4).then((function(t){return r[n]||(i.dispatch({type:Pa.pluginReadyType(n),name:n,events:Object.keys(e).filter((function(e){return!ja.includes(e)}))}),r[n]=!0),v=v.concat(n),e})).catch((function(e){if(e instanceof Error)throw new Error(e);return g=g.concat(e.name),e}))}));Promise.all(y).then((function(e){var t={plugins:v,failed:g,disabled:m};setTimeout((function(){p.length===y.length+m.length&&i.dispatch(da({},{type:Pa.ready},t))}),0)}))}var b=function(){if(l!==Pa.bootstrap)return/^ready:([^:]*)$/.test(l)&&setTimeout((function(){return function(e,t,n){var r={},i=t(),o=e.getState(),a=o.plugins,s=o.queue,c=o.user;if(!o.context.offline&&s&&s.actions&&s.actions.length){var l=s.actions.reduce((function(e,t,n){return a[t.plugin].loaded?(e.process.push(t),e.processIndex.push(n)):(e.requeue.push(t),e.requeueIndex.push(n)),e}),{processIndex:[],process:[],requeue:[],requeueIndex:[]});if(l.processIndex&&l.processIndex.length){l.processIndex.forEach((function(t){var o=s.actions[t],l=o.plugin,u=o.payload.type,d=i[l][u];if(d&&zo(d)){var f,p=function(e,t){return void 0===e&&(e={}),void 0===t&&(t={}),[Ea,xa].reduce((function(n,r){return e.hasOwnProperty(r)&&t[r]&&t[r]!==e[r]&&(n[r]=t[r]),n}),e)}(o.payload,c),h=r[p.meta.rid];if(!h&&(f=d({payload:p,config:a[l].config,instance:n,abort:Da}))&&Go(f)&&f.abort)return void(r[p.meta.rid]=!0);if(!h){var v=u+":"+l;e.dispatch(da({},p,{type:v,_:{called:v,from:"queueDrain"}}))}}}));var u=s.actions.filter((function(e,t){return!~l.processIndex.indexOf(t)}));s.actions=u}}}(i,t,e)}),0),Promise.resolve(function(e,t,n,r,i){try{var o=zo(t)?t():t,a=e.type,s=a.replace(Ba,"");if(e._&&e._.called)return Promise.resolve(e);var c=n.getState(),l=(f=o,void 0===(p=c.plugins)&&(p={}),void 0===(h=e.options)&&(h={}),Object.keys(f).filter((function(e){var t=h.plugins||{};return Do(t[e])?t[e]:!1!==t.all&&(!p[e]||!1!==p[e].enabled)})).map((function(e){return f[e]})));a===Pa.initializeStart&&e.fromEnable&&(l=Object.keys(c.plugins).filter((function(t){var n=c.plugins[t];return e.plugins.includes(t)&&!n.initialized})).map((function(e){return o[e]})));var u=l.map((function(e){return e.name})),d=function(e,t,n){var r=$a(e).map((function(e){return Wa(e,t)}));return t.reduce((function(n,r){var i=r.name,o=$a(e,i).map((function(e){return Wa(e,t)})),a=o[0],s=o[1],c=o[2];return a.length&&(n.beforeNS[i]=a),s.length&&(n.duringNS[i]=s),c.length&&(n.afterNS[i]=c),n}),{before:r[0],beforeNS:{},during:r[1],duringNS:{},after:r[2],afterNS:{}})}(a,l);return Promise.resolve(Ma({action:e,data:{exact:d.before,namespaced:d.beforeNS},state:c,allPlugins:o,allMatches:d,instance:n,store:r,EVENTS:i})).then((function(e){function t(){var t=function(){if(a.match(Ba))return Promise.resolve(Ma({action:da({},l,{type:s+"End"}),data:{exact:d.after,namespaced:d.afterNS},state:c,allPlugins:o,allMatches:d,instance:n,store:r,EVENTS:i})).then((function(e){e.meta&&e.meta.hasCallback&&qa(e.meta.rid,{payload:e})}))}();return t&&t.then?t.then((function(){return e})):e}if(Ka(e,u.length))return e;var l,f=function(){if(a!==s)return Promise.resolve(Ma({action:da({},e,{type:s}),data:{exact:d.during,namespaced:d.duringNS},state:c,allPlugins:o,allMatches:d,instance:n,store:r,EVENTS:i})).then((function(e){l=e}));l=e}();return f&&f.then?f.then(t):t()}))}catch(e){return Promise.reject(e)}var f,p,h}(a,t,e,i,n)).then((function(e){return s=1,o(e)}))}();return Promise.resolve(b&&b.then?b.then(c):c(b))}catch(e){return Promise.reject(e)}}}}}function ns(e){return function(t){return function(t){return function(n){var r=n.type,i=n.key,o=n.value,a=n.options;if(r===Pa.setItem||r===Pa.removeItem){if(n.abort)return t(n);r===Pa.setItem?e.setItem(i,o,a):e.removeItem(i,a)}return t(n)}}}}var rs=function(){var e=this;this.before=[],this.after=[],this.addMiddleware=function(t,n){e[n]=e[n].concat(t)},this.removeMiddleware=function(t,n){var r=e[n].findIndex((function(e){return e===t}));-1!==r&&(e[n]=[].concat(e[n].slice(0,r),e[n].slice(r+1)))},this.dynamicMiddlewares=function(t){return function(n){return function(r){return function(i){var o={getState:n.getState,dispatch:function(e){return n.dispatch(e)}},a=e[t].map((function(e){return e(o)}));return ba.apply(void 0,a)(r)(i)}}}}};function is(e){return function(t,n){void 0===t&&(t={});var r={};if("initialize:aborted"===n.type)return t;if(/^registerPlugin:([^:]*)$/.test(n.type)){var i=os(n.type,"registerPlugin"),o=e()[i];if(!o||!i)return t;var a=n.enabled,s=o.config;return r[i]={enabled:a,initialized:!!a&&Boolean(!o.initialize),loaded:!!a&&Boolean(o.loaded({config:s})),config:s},da({},t,r)}if(/^initialize:([^:]*)$/.test(n.type)){var c=os(n.type,Pa.initialize),l=e()[c];return l&&c?(r[c]=da({},t[c],{initialized:!0,loaded:Boolean(l.loaded({config:l.config}))}),da({},t,r)):t}if(/^ready:([^:]*)$/.test(n.type))return r[n.name]=da({},t[n.name],{loaded:!0}),da({},t,r);switch(n.type){case Pa.disablePlugin:return da({},t,as(n.plugins,!1,t));case Pa.enablePlugin:return da({},t,as(n.plugins,!0,t));default:return t}}}function os(e,t){return e.substring(t.length+1,e.length)}function as(e,t,n){return e.reduce((function(e,r){return e[r]=da({},n[r],{enabled:t}),e}),n)}function ss(e){try{return JSON.parse(JSON.stringify(e))}catch(e){}return e}var cs={last:{},history:[]};function ls(e,t){void 0===e&&(e=cs);var n=t.options,r=t.meta;if(t.type===Pa.track){var i=ss(da({event:t.event,properties:t.properties},Object.keys(n).length&&{options:n},{meta:r}));return da({},e,{last:i,history:e.history.concat(i)})}return e}var us={actions:[]};function ds(e,t){void 0===e&&(e=us);var n=t.payload;switch(t.type){case"queue":var r;return r=n&&n.type&&n.type===Pa.identify?[t].concat(e.actions):e.actions.concat(t),da({},e,{actions:r});case"dequeue":return[];default:return e}}var fs=/#.*$/;function ps(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);return"/"+(t&&t[3]?t[3].split("?")[0].replace(fs,""):"")}var hs,vs=function(e){if(void 0===e&&(e={}),!Ao)return e;var t=document,n=t.title,r=t.referrer,i=window,o=i.location,a=i.innerWidth,s=i.innerHeight,c=o.hash,l=o.search,u=function(e){var t=function(){if(Ao)for(var e,t=document.getElementsByTagName("link"),n=0;e=t[n];n++)if("canonical"===e.getAttribute("rel"))return e.getAttribute("href")}();return t?t.match(/\?/)?t:t+e:window.location.href.replace(fs,"")}(l),d={title:n,url:u,path:ps(u),hash:c,search:l,width:a,height:s};return r&&""!==r&&(d.referrer=r),da({},d,e)},gs={last:{},history:[]};function ms(e,t){void 0===e&&(e=gs);var n=t.options;if(t.type===Pa.page){var r=ss(da({properties:t.properties,meta:t.meta},Object.keys(n).length&&{options:n}));return da({},e,{last:r,history:e.history.concat(r)})}return e}hs={};var ys={initialized:!1,sessionId:ta(),app:null,version:null,debug:!1,offline:!!Ao&&!navigator.onLine,os:{name:"na"},userAgent:Ao?navigator.userAgent:"node",library:{name:"analytics",version:"0.12.14"},timezone:void 0,locale:void 0,campaign:{},referrer:hs};function bs(e,t){void 0===e&&(e=ys);var n=e.initialized,r=t.campaign;switch(t.type){case Pa.campaign:return da({},e,{campaign:r});case Pa.offline:return da({},e,{offline:!0});case Pa.online:return da({},e,{offline:!1});default:return n?e:da({},ys,e,{initialized:!0})}}var ws=["plugins","reducers","storage"];function _s(){return aa("analytics",[]),function(e){return function(t,n,r){var i=e(t,n,r),o=i.dispatch;return Object.assign(i,{dispatch:function(e){return ia[ra].analytics.push(e.action||e),o(e)}})}}}function Ss(e){return function(){return ba(ba.apply(null,arguments),_s())}}function ks(e){return e?Ho(e)?e:[e]:[]}function Es(e,t,n){void 0===e&&(e={});var r,i,o=ta();return t&&(za[o]=(r=t,i=function(e){for(var t,n=e||Array.prototype.slice.call(arguments),r=0;r<n.length;r++)if(zo(n[r])){t=n[r];break}return t}(n),function(e){i&&i(e),r(e)})),da({},e,{rid:o,ts:(new Date).getTime()},t?{hasCallback:!0}:{})}function xs(e){void 0===e&&(e={});var t=e.reducers||{},n=e.initialUser||{},r=(e.plugins||[]).reduce((function(e,t){if(zo(t))return e.middlewares=e.middlewares.concat(t),e;if(t.NAMESPACE&&(t.name=t.NAMESPACE),!t.name)throw new Error("https://lytics.dev/errors/1");t.config||(t.config={});var n=t.EVENTS?Object.keys(t.EVENTS).map((function(e){return t.EVENTS[e]})):[];e.pluginEnabled[t.name]=!(!1===t.enabled||!1===t.config.enabled),delete t.enabled,t.methods&&(e.methods[t.name]=Object.keys(t.methods).reduce((function(e,n){var r;return e[n]=(r=t.methods[n],function(){for(var e=Array.prototype.slice.call(arguments),t=new Array(r.length),n=0;n<e.length;n++)t[n]=e[n];return t[t.length]=_,r.apply({instance:_},t)}),e}),{}),delete t.methods);var r=Object.keys(t).concat(n),i=new Set(e.events.concat(r));if(e.events=Array.from(i),e.pluginsArray=e.pluginsArray.concat(t),e.plugins[t.name])throw new Error(t.name+"AlreadyLoaded");return e.plugins[t.name]=t,e.plugins[t.name].loaded||(e.plugins[t.name].loaded=function(){return!0}),e}),{plugins:{},pluginEnabled:{},methods:{},pluginsArray:[],middlewares:[],events:[]}),i=e.storage?e.storage:{getItem:oa,setItem:aa,removeItem:sa},o=function(e){return function(t,n,r){return n.getState("user")[t]||(r&&Go(r)&&r[t]?r[t]:La(e)[t]||oa(Ra(t))||null)}}(i),a=r.plugins,s=r.events.filter((function(e){return!ja.includes(e)})).sort(),c=new Set(s.concat(Ia).filter((function(e){return!ja.includes(e)}))),l=Array.from(c).sort(),u=function(){return a},d=new rs,f=d.addMiddleware,p=d.removeMiddleware,h=d.dynamicMiddlewares,v=function(){throw new Error("Abort disabled inListener")},g=Zo(),m=La(i),y=da({},m,n,g.an_uid?{userId:g.an_uid}:{},g.an_aid?{anonymousId:g.an_aid}:{});y.anonymousId||(y.anonymousId=ta());var b=da({enable:function(e,t){return new Promise((function(n){C.dispatch({type:Pa.enablePlugin,plugins:ks(e),_:{originalAction:Pa.enablePlugin}},n,[t])}))},disable:function(e,t){return new Promise((function(n){C.dispatch({type:Pa.disablePlugin,plugins:ks(e),_:{originalAction:Pa.disablePlugin}},n,[t])}))}},r.methods),w=!1,_={identify:function(e,t,n,r){try{var i=qo(e)?e:null,a=Go(e)?e:t,s=n||{},c=_.user();aa(Ra(Ea),i);var l=i||a.userId||o(Ea,_,a);return Promise.resolve(new Promise((function(e){C.dispatch(da({type:Pa.identifyStart,userId:l,traits:a||{},options:s,anonymousId:c.anonymousId},c.id&&c.id!==i&&{previousId:c.id}),e,[t,n,r])})))}catch(e){return Promise.reject(e)}},track:function(e,t,n,r){try{var i=Go(e)?e.event:e;if(!i||!qo(i))throw new Error("EventMissing");var a=Go(e)?e:t||{},s=Go(n)?n:{};return Promise.resolve(new Promise((function(e){C.dispatch({type:Pa.trackStart,event:i,properties:a,options:s,userId:o(Ea,_,t),anonymousId:o(xa,_,t)},e,[t,n,r])})))}catch(e){return Promise.reject(e)}},page:function(e,t,n){try{var r=Go(e)?e:{},i=Go(t)?t:{};return Promise.resolve(new Promise((function(a){C.dispatch({type:Pa.pageStart,properties:vs(r),options:i,userId:o(Ea,_,r),anonymousId:o(xa,_,r)},a,[e,t,n])})))}catch(e){return Promise.reject(e)}},user:function(e){if(e===Ea||"id"===e)return o(Ea,_);if(e===xa||"anonId"===e)return o(xa,_);var t=_.getState("user");return e?Eo(t,e):t},reset:function(e){return new Promise((function(t){C.dispatch({type:Pa.resetStart},t,e)}))},ready:function(e){return w&&e({plugins:b,instance:_}),_.on(Pa.ready,(function(t){e(t),w=!0}))},on:function(e,t){if(!e||!zo(t))return!1;if(e===Pa.bootstrap)throw new Error(".on disabled for "+e);var n=/Start$|Start:/;if("*"===e){var r=function(e){return function(e){return function(r){return r.type.match(n)&&t({payload:r,instance:_,plugins:a}),e(r)}}},i=function(e){return function(e){return function(r){return r.type.match(n)||t({payload:r,instance:_,plugins:a}),e(r)}}};return f(r,Is),f(i,js),function(){p(r,Is),p(i,js)}}var o=e.match(n)?Is:js,s=function(n){return function(n){return function(r){return r.type===e&&t({payload:r,instance:_,plugins:a,abort:v}),n(r)}}};return f(s,o),function(){return p(s,o)}},once:function(e,t){if(!e||!zo(t))return!1;if(e===Pa.bootstrap)throw new Error(".once disabled for "+e);var n=_.on(e,(function(e){t({payload:e.payload,instance:_,plugins:a,abort:v}),n()}));return n},getState:function(e){var t=C.getState();return e?Eo(t,e):Object.assign({},t)},dispatch:function(e){var t=qo(e)?{type:e}:e;if(Ia.includes(t.type))throw new Error("reserved action "+t.type);var n=da({},t,{_:da({originalAction:t.type},e._||{})});C.dispatch(n)},enablePlugin:b.enable,disablePlugin:b.disable,plugins:b,storage:{getItem:i.getItem,setItem:function(e,t,n){C.dispatch({type:Pa.setItemStart,key:e,value:t,options:n})},removeItem:function(e,t){C.dispatch({type:Pa.removeItemStart,key:e,options:t})}},setAnonymousId:function(e,t){_.storage.setItem(_a,e,t)},events:{core:Ia,plugins:s}},S=r.middlewares.concat([function(e){return function(e){return function(t){return t.meta||(t.meta=Es()),e(t)}}},h(Is),ts(_,u,{all:l,plugins:s}),ns(i),Ta(_),Na(_),h(js)]),k={context:bs,user:Fa(i),page:ms,track:ls,plugins:is(u),queue:ds},E=ba,x=ba;if(Ao&&e.debug){var I=window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;I&&(E=I({trace:!0,traceLimit:25})),x=function(){return 0===arguments.length?_s():Go(typeof arguments[0])?Ss():Ss().apply(null,arguments)}}var j,P=function(e){return Object.keys(e).reduce((function(t,n){return ws.includes(n)||(t[n]=e[n]),t}),{})}(e),O=r.pluginsArray.reduce((function(e,t){var n=t.name,i=t.config,o=t.loaded,a=r.pluginEnabled[n];return e[n]={enabled:a,initialized:!!a&&Boolean(!t.initialize),loaded:Boolean(o({config:i})),config:i},e}),{}),A={context:P,user:y,plugins:O},C=ma(function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++){var i=t[r];typeof e[i]===fa&&(n[i]=e[i])}var o,a=Object.keys(n);try{!function(e){Object.keys(e).forEach((function(t){var n=e[t];if(typeof n(void 0,{type:"@@redux/INIT"})===pa||typeof n(void 0,{type:ha})===pa)throw new Error("reducer "+t+" "+pa)}))}(n)}catch(e){o=e}return function(e,t){if(void 0===e&&(e={}),o)throw o;for(var r=!1,i={},s=0;s<a.length;s++){var c=a[s],l=e[c],u=(0,n[c])(l,t);if(typeof u===pa){var d=ya(c,t);throw new Error(d)}i[c]=u,r=r||u!==l}return r?i:e}}(da({},k,t)),A,x(E(wa.apply(void 0,S))));C.dispatch=(j=C.dispatch,function(e,t,n){var r=da({},e,{meta:Es(e.meta,t,ks(n))});return j.apply(null,[r])});var T=Object.keys(a);C.dispatch({type:Pa.bootstrap,plugins:T,config:P,params:g,user:y,initialUser:n,persistedUser:m});var F=T.filter((function(e){return r.pluginEnabled[e]})),L=T.filter((function(e){return!r.pluginEnabled[e]}));return C.dispatch({type:Pa.registerPlugins,plugins:T,enabled:r.pluginEnabled}),r.pluginsArray.map((function(e,t){var n=e.bootstrap,i=e.config,o=e.name;n&&zo(n)&&n({instance:_,config:i,payload:e}),C.dispatch({type:Pa.registerPluginType(o),name:o,enabled:r.pluginEnabled[o],plugin:e}),r.pluginsArray.length===t+1&&C.dispatch({type:Pa.initializeStart,plugins:F,disabled:L})})),_}var Is="before",js="after";var Ps="cookie",Os=Fs(),As=Ls,Cs=Ls;function Ts(e){return Os?Ls(e,"",-1):sa(e)}function Fs(){if(void 0!==Os)return Os;var e="cookiecookie";try{Ls(e,e),Os=-1!==document.cookie.indexOf(e),Ts(e)}catch(e){Os=!1}return Os}function Ls(e,t,n,r,i,o){if("undefined"!=typeof window){var a=arguments.length>1;return!1===Os&&(a?aa(e,t):oa(e)),a?document.cookie=e+"="+encodeURIComponent(t)+(n?"; expires="+new Date(+new Date+1e3*n).toUTCString()+(r?"; path="+r:"")+(i?"; domain="+i:"")+(o?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var Rs="localStorage",Ns=ua.bind(null,"localStorage");ca("localStorage","getItem",oa);ca("localStorage","setItem",aa);ca("localStorage","removeItem",sa);var zs="sessionStorage",qs=ua.bind(null,"sessionStorage");ca("sessionStorage","getItem",oa);ca("sessionStorage","setItem",aa);ca("sessionStorage","removeItem",sa);function Us(e){var t=e;try{if("true"===(t=JSON.parse(e)))return!0;if("false"===t)return!1;if(Go(t))return t;parseFloat(t)===t&&(t=parseFloat(t))}catch(e){}if(null!==t&&""!==t)return t}var Ds=Ns(),Ms=qs(),Bs=Fs();function Hs(e,t){if(e){var n=Vs(t),r=!Ks(n),i=Ws(n)?Us(localStorage.getItem(e)):void 0;if(r&&!Uo(i))return i;var o=$s(n)?Us(As(e)):void 0;if(r&&o)return o;var a=Qs(n)?Us(sessionStorage.getItem(e)):void 0;if(r&&a)return a;var s=oa(e);return r?s:{localStorage:i,sessionStorage:a,cookie:o,global:s}}}function Gs(e,t,n){if(e&&!Uo(t)){var r={},i=Vs(n),o=JSON.stringify(t),a=!Ks(i);return Ws(i)&&(r[Rs]=Ys(Rs,t,Us(localStorage.getItem(e))),localStorage.setItem(e,o),a)?r[Rs]:$s(i)&&(r[Ps]=Ys(Ps,t,Us(As(e))),Cs(e,o),a)?r[Ps]:Qs(i)&&(r[zs]=Ys(zs,t,Us(sessionStorage.getItem(e))),sessionStorage.setItem(e,o),a)?r[zs]:(r[na]=Ys(na,t,oa(e)),aa(e,t),a?r[na]:r)}}function Js(e,t){if(e){var n=Vs(t),r=Hs(e,Po),i={};return!Uo(r.localStorage)&&Ws(n)&&(localStorage.removeItem(e),i[Rs]=r.localStorage),!Uo(r.cookie)&&$s(n)&&(Ts(e),i[Ps]=r.cookie),!Uo(r.sessionStorage)&&Qs(n)&&(sessionStorage.removeItem(e),i[zs]=r.sessionStorage),!Uo(r.global)&&Xs(n,na)&&(sa(e),i[na]=r.global),i}}function Vs(e){return e?qo(e)?e:e.storage:jo}function Ws(e){return Ds&&Xs(e,Rs)}function $s(e){return Bs&&Xs(e,Ps)}function Qs(e){return Ms&&Xs(e,zs)}function Ks(e){return e===Po||"all"===e}function Xs(e,t){return e===jo||e===t||Ks(e)}function Ys(e,t,n){return{location:e,current:t,previous:n}}var Zs={setItem:Gs,getItem:Hs,removeItem:Js};function ec(e,t,n){if(t in e){Object.defineProperty(e,t,{value:n,enumerable:true,configurable:true,writable:true})}else{e[t]=n}return e}function tc(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function nc(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?tc(Object(n),!0).forEach((function(t){ec(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):tc(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function rc(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var t={storage:Zs};return xs(nc(nc({},t),e))}function ic(e){var t=Array.prototype.slice.call(window.document.querySelectorAll("script"));return t.find((function(t){return t.src===e}))}function oc(e,t){var n=e;if(!n.startsWith("http")){n="https://".concat((t===null||t===void 0?void 0:t.www)?"www.":"").concat(n)}if(t===null||t===void 0?void 0:t.min){n=n+".min.js"}else if(t===null||t===void 0?void 0:t.js){n=n+".js"}if(t===null||t===void 0?void 0:t.query){n+="?"+t.query}return n}function ac(e,t){var n=ic(e);if(n!==undefined){var r=n===null||n===void 0?void 0:n.getAttribute("status");if(r==="loaded"){return Promise.resolve(n)}if(r==="loading"){return new Promise((function(e,t){n.addEventListener("load",(function(){return e(n)}));n.addEventListener("error",(function(e){return t(e)}))}))}}return new Promise((function(n,r){var i,o;var a=window.document.createElement("script");a.type="text/javascript";a.src=oc(e,t);a.async=true;a.setAttribute("status","loading");for(var s=0,c=Object.entries((i=t===null||t===void 0?void 0:t.attributes)!==null&&i!==void 0?i:{});s<c.length;s++){var l=c[s],u=l[0],d=l[1];a.setAttribute(u,d)}a.onload=function(){a.onerror=a.onload=null;a.setAttribute("status","loaded");n(a)};a.onerror=function(){a.onerror=a.onload=null;a.setAttribute("status","error");r(new Error("Failed to load ".concat(e)))};var f=window.document.getElementsByTagName("script")[0];(o=f.parentElement)===null||o===void 0?void 0:o.insertBefore(a,f)}))}var sc=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var cc={id:"tag",handle:function(e,t){return sc(this,void 0,void 0,(function(){return __generator(this,(function(n){if(!Uc(t,e)){return[2]}lc(e.code,t);return[2]}))}))}};function lc(e,t,n){if(n===void 0){n={}}var r;try{r=JSON.parse(e)}catch(t){r={code:e,lang:"javascript"}}var i=n.debug||false;if(jl()){if(r.lang==="javascript"){pc(r.code,t)}else{var o=document.createElement("span");o.innerHTML=hc(r.code,t);document.body.insertAdjacentElement("beforeend",o);var a=o.querySelectorAll("script");a.forEach((function(e){var t=document.createElement("script");t.type=t.type||"text/javascript";if(e.hasAttribute("src")){t.src=e.src}t.text=e.text;if(i){console.log("[JITSU] Executing script".concat(e.hasAttribute("src")?" ".concat(e.src):""),t.text)}document.head.appendChild(t);document.head.removeChild(t)}))}}else{if(i){console.log("[JITSU] insertTags(): cannot insert tags in non-browser environment")}}}var uc="al";var dc="ve".split("").reverse().join("");var fc=globalThis[dc+uc];function pc(e,t){var n="jitsu_event_".concat(Hl());window[n]=t;var r="(function(){\n const event = ".concat(n,";\n ").concat(e,"\n })()");try{fc(r)}catch(e){console.error("[JITSU] Error executing JS code: ".concat(e.message,". Code: "),r)}finally{delete window[n]}return r}function hc(e,t){return e.replace(/{{\s*event\s*}}/g,JSON.stringify(t))}var vc=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var gc="cdn.lr-ingest.io/";var mc={id:"logrocket",handle:function(e,t){return vc(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){if(!Uc(t,e)){return[2]}Sc(e.appId);n=function(e){if(t.type==="identify"&&t.userId){e.identify(t.userId,t.traits||{})}};wc().push(n);if(yc()==="loaded"){_c(window["LogRocket"])}return[2]}))}))}};function yc(){return window["__jitsuLrState"]||"fresh"}function bc(e){window["__jitsuLrState"]=e}function wc(){return window["__jitsuLrQueue"]||(window["__jitsuLrQueue"]=[])}function _c(e){var t=wc();while(t.length>0){var n=t.shift();try{var r=n(e);if(r){r.catch((function(e){return console.warn("Async LogRocket method failed: ".concat(e.message),e)}))}}catch(e){console.warn("LogRocket method failed: ".concat(e.message),e)}}}function Sc(e){return vc(this,void 0,void 0,(function(){return __generator(this,(function(t){if(yc()!=="fresh"){return[2]}bc("loading");ac("".concat(gc,"LogRocket"),{min:true,attributes:{crossOrigin:"anonymous"}}).then((function(){if(window["LogRocket"]){try{window["LogRocket"].init(e)}catch(t){console.warn("LogRocket (id=".concat(e,") init failed: ").concat(t.message),t);bc("failed")}bc("loaded");_c(window["LogRocket"])}})).catch((function(t){console.warn("LogRocket (id=".concat(e,") init failed: ").concat(t.message),t);bc("failed")}));return[2]}))}))}var kc=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Ec(e){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}return Object.fromEntries(Object.entries(e).filter((function(e){var n=e[0];return!t.includes(n)})))}var xc={id:"gtm",handle:function(e,t){return kc(this,void 0,void 0,(function(){var n,r,i,o,a,s,c,l,u,d,f,p,h,v,g,m,y,b,w,_,S,k,E,x,I,j,P,O;return __generator(this,(function(A){switch(A.label){case 0:g=!!e.debug;if(!Uc(t,e)){return[2]}return[4,Pc(e,t)];case 1:A.sent();m=window[e.dataLayerName||"dataLayer"];y=Object.assign(Object.assign({},(t===null||t===void 0?void 0:t.traits)||{}),((n=t===null||t===void 0?void 0:t.context)===null||n===void 0?void 0:n.traits)||{});b=Ec(y,"id","userId","user_id","anonymousId","userId");if(g){console.debug("GTM plugin will be applied to following payload",t)}w={email_address:y.email};_=Object.assign(Object.assign(Object.assign(Object.assign({},t.userId?{user_id:t.userId,userId:t.userId}:{}),t.anonymousId?{anonymousId:t.anonymousId}:{}),b),{user_data:Object.keys(w).length>0?w:undefined});if(g){console.debug("GTM plugin will set following user-related data layer vars",_)}S=t.properties||{};k={page_location:S.url||((i=(r=t.context)===null||r===void 0?void 0:r.page)===null||i===void 0?void 0:i.url),page_title:S.title||((a=(o=t.context)===null||o===void 0?void 0:o.page)===null||a===void 0?void 0:a.title),page_path:S.path||((c=(s=t.context)===null||s===void 0?void 0:s.page)===null||c===void 0?void 0:c.path),page_hash:S.hash||((u=(l=t.context)===null||l===void 0?void 0:l.page)===null||u===void 0?void 0:u.hash),page_search:S.search||((f=(d=t.context)===null||d===void 0?void 0:d.page)===null||f===void 0?void 0:f.search),page_referrer:(v=(h=(p=t===null||t===void 0?void 0:t.context)===null||p===void 0?void 0:p.page)===null||h===void 0?void 0:h.referrer)!==null&&v!==void 0?v:""};if(g){console.debug("GTM plugin will set following context (page) related data layer vars",_)}E=function(e){m.push(e);if(g){console.debug("GTM plugin will push following data to dataLayer",e)}};switch(t.type){case"page":x=Object.assign(Object.assign({event:"page_view"},k),_);E(x);break;case"track":I=t.properties;j=Object.assign(Object.assign(Object.assign({event:t.event},k),I),_);E(j);break;case"identify":P=t.traits;O=Object.assign(Object.assign(Object.assign({event:"identify"},k),P),_);E(O);break}m.push((function(){this.reset()}));return[2]}}))}))}};function Ic(){return window["__jitsuGtmState"]||"fresh"}function jc(e){window["__jitsuGtmState"]=e}function Pc(e,t){return kc(this,void 0,void 0,(function(){var n,r;return __generator(this,(function(i){if(Ic()!=="fresh"){return[2]}jc("loading");n=e.dataLayerName||"dataLayer";r=e.containerId;(function(e,n,i){e[n]=e[n]||[];e[n].push({user_id:t.userId});e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var o=n!="dataLayer"?"&l="+n:"";var a="googletagmanager.com/gtm";ac(a,{www:true,js:true,query:"id="+i+o}).then((function(){jc("loaded")})).catch((function(e){console.warn("GTM (containerId=".concat(r,") init failed: ").concat(e.message),e);jc("failed")}))})(window,n,r);return[2]}))}))}var Oc=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var Ac=[new Uint8Array([109,111,99,46,114,101,103,97,110,97,109,103,97,116,101,108,103,111,111,103]),new Uint8Array([103,97,116,103]),new Uint8Array([115,106])];function Cc(e){var t=new TextDecoder;return t.decode(e)}function Tc(){return Ac.map((function(e){return e.reverse()})).map(Cc).join("/")}var Fc={id:"ga4-tag",handle:function(e,t){return Oc(this,void 0,void 0,(function(){var n,r,i,o,a,s,c,l,u,d,f,p;return __generator(this,(function(h){switch(h.label){case 0:if(!Uc(t,e)){return[2]}return[4,Nc(e,t)];case 1:h.sent();i=window[e.dataLayerName||"dataLayer"];o=function(){i.push(arguments)};a=Object.assign(Object.assign({},t.userId?{user_id:t.userId,userId:t.userId}:{}),t.anonymousId?{anonymousId:t.anonymousId}:{});if(t.userId){o("set",{user_id:t.userId})}switch(t.type){case"page":if(e.autoPageView){console.log("autoPageView");break}s=t.properties,c=t.context;l=Object.assign({page_location:s.url,page_title:s.title,page_path:s.path,page_hash:s.hash,page_search:s.search,page_referrer:(r=(n=c===null||c===void 0?void 0:c.page)===null||n===void 0?void 0:n.referrer)!==null&&r!==void 0?r:""},a);o("event","page_view",l);break;case"track":u=t.properties;d=Object.assign(Object.assign({},u),a);o("event",t.event,d);break;case"identify":f=t.traits;p=Object.assign(Object.assign({},f),a);o("event","identify",p);break}return[2]}}))}))}};function Lc(){return window["__jitsuGa4State"]||"fresh"}function Rc(e){window["__jitsuGa4State"]=e}function Nc(e,t){return Oc(this,void 0,void 0,(function(){var n,r,i,o;return __generator(this,(function(a){if(Lc()!=="fresh"){return[2]}Rc("loading");n=e.dataLayerName||"dataLayer";r=n!=="dataLayer"?"&l="+n:"";i=e.measurementIds;window[n]=window[n]||[];o=function(){window[n].push(arguments)};o("js",new Date);o("config",i,Object.assign(Object.assign({},t.userId?{user_id:t.userId}:{}),!e.autoPageView?{send_page_view:false}:{}));ac(Tc(),{query:"id=".concat(i).concat(r),www:true}).then((function(){Rc("loaded")})).catch((function(t){console.warn("GA4 (containerId=".concat(e.measurementIds,") init failed: ").concat(t.message),t);Rc("failed")}));return[2]}))}))}function zc(e,t){return e==="*"||e.toLowerCase().trim()===(t||"").trim().toLowerCase()}function qc(e,t){if(e==="*"){return true}t=t||"";if(e.startsWith("*.")){return t.endsWith(e.substring(1))}else{return e===t}}function Uc(e,t){var n=t.hosts,r=n===void 0?"*":n,i=t.events,o=i===void 0?"*":i;try{var a=Array.isArray(o)?o:o.split("\n");var s=Array.isArray(r)?r:r.split("\n");return!!s.find((function(t){var n,r;return qc(t,(r=(n=e.context)===null||n===void 0?void 0:n.page)===null||r===void 0?void 0:r.host)}))&&(!!a.find((function(t){return zc(t,e.type)}))||!!a.find((function(t){return zc(t,e.event)})))}catch(e){console.warn("Failed to apply filters: ".concat(e.message,". Typeof events: ").concat(typeof o,", typeof hosts: ").concat(typeof r,". Values"),o,r);throw new Error("Failed to apply filters: ".concat(e.message,". Typeof events: ").concat(typeof o,", typeof hosts: ").concat(typeof r))}}var Dc=(r={},r[cc.id]=cc,r[xc.id]=xc,r[Fc.id]=Fc,r[mc.id]=mc,r);var Mc="2.0.0";var Bc="@jitsu/js";var Hc="ac,com.ac,edu.ac,gov.ac,net.ac,mil.ac,org.ac,ad,nom.ad,ae,co.ae,net.ae,org.ae,sch.ae,ac.ae,gov.ae,mil.ae,aero,af,gov.af,com.af,org.af,net.af,edu.af,ag,com.ag,org.ag,net.ag,co.ag,nom.ag,ai,off.ai,com.ai,net.ai,org.ai,al,com.al,edu.al,gov.al,mil.al,net.al,org.al,am,co.am,com.am,commune.am,net.am,org.am,ao,ed.ao,gv.ao,og.ao,co.ao,pb.ao,it.ao,aq,ar,bet.ar,com.ar,coop.ar,edu.ar,gob.ar,gov.ar,int.ar,mil.ar,musica.ar,mutual.ar,net.ar,org.ar,senasa.ar,tur.ar,arpa,e164.arpa,in-addr.arpa,ip6.arpa,iris.arpa,uri.arpa,urn.arpa,as,gov.as,asia,at,ac.at,co.at,gv.at,or.at,sth.ac.at,au,com.au,net.au,org.au,edu.au,gov.au,asn.au,id.au,act.au,nsw.au,nt.au,qld.au,sa.au,tas.au,vic.au,wa.au,aw,com.aw,ax,az,com.az,net.az,int.az,gov.az,org.az,edu.az,info.az,pp.az,mil.az,name.az,pro.az,biz.az,ba,com.ba,edu.ba,gov.ba,mil.ba,net.ba,org.ba,bb,biz.bb,co.bb,com.bb,edu.bb,gov.bb,info.bb,net.bb,org.bb,store.bb,tv.bb,bd,be,ac.be,bf,gov.bf,bg,a.bg,b.bg,c.bg,d.bg,e.bg,f.bg,g.bg,h.bg,i.bg,j.bg,k.bg,l.bg,m.bg,n.bg,o.bg,p.bg,q.bg,r.bg,s.bg,t.bg,u.bg,v.bg,w.bg,x.bg,y.bg,z.bg,0.bg,1.bg,2.bg,3.bg,4.bg,5.bg,6.bg,7.bg,8.bg,9.bg,bh,com.bh,edu.bh,net.bh,org.bh,gov.bh,bi,co.bi,com.bi,edu.bi,or.bi,org.bi,biz,bj,africa.bj,agro.bj,architectes.bj,assur.bj,avocats.bj,co.bj,com.bj,eco.bj,econo.bj,edu.bj,info.bj,loisirs.bj,money.bj,net.bj,org.bj,ote.bj,resto.bj,restaurant.bj,tourism.bj,univ.bj,bm,com.bm,edu.bm,gov.bm,net.bm,org.bm,bn,com.bn,edu.bn,gov.bn,net.bn,org.bn,bo,com.bo,edu.bo,gob.bo,int.bo,org.bo,net.bo,mil.bo,tv.bo,web.bo,br,9guacu.br,abc.br,adm.br,adv.br,agr.br,aju.br,am.br,anani.br,aparecida.br,app.br,arq.br,art.br,ato.br,b.br,barueri.br,belem.br,bhz.br,bib.br,bio.br,blog.br,bmd.br,boavista.br,bsb.br,campinagrande.br,campinas.br,caxias.br,cim.br,cng.br,cnt.br,com.br,contagem.br,coop.br,coz.br,cri.br,cuiaba.br,curitiba.br,def.br,des.br,det.br,dev.br,ecn.br,eco.br,edu.br,emp.br,enf.br,eng.br,esp.br,etc.br,eti.br,far.br,feira.br,flog.br,floripa.br,fm.br,fnd.br,fortal.br,fot.br,foz.br,fst.br,g12.br,geo.br,ggf.br,goiania.br,gov.br,gru.br,imb.br,ind.br,inf.br,jab.br,jampa.br,jdf.br,joinville.br,jor.br,jus.br,leg.br,lel.br,log.br,londrina.br,macapa.br,maceio.br,manaus.br,maringa.br,mat.br,med.br,mil.br,morena.br,mp.br,mus.br,natal.br,net.br,niteroi.br,nom.br,not.br,ntr.br,odo.br,ong.br,org.br,osasco.br,palmas.br,poa.br,ppg.br,pro.br,psc.br,psi.br,pvh.br,qsl.br,radio.br,rec.br,recife.br,rep.br,ribeirao.br,rio.br,riobranco.br,riopreto.br,salvador.br,sampa.br,santamaria.br,santoandre.br,saobernardo.br,saogonca.br,seg.br,sjc.br,slg.br,slz.br,sorocaba.br,srv.br,taxi.br,tc.br,tec.br,teo.br,the.br,tmp.br,trd.br,tur.br,tv.br,udi.br,vet.br,vix.br,vlog.br,wiki.br,zlg.br,bs,com.bs,net.bs,org.bs,edu.bs,gov.bs,bt,com.bt,edu.bt,gov.bt,net.bt,org.bt,bv,bw,co.bw,org.bw,by,gov.by,mil.by,com.by,of.by,bz,com.bz,net.bz,org.bz,edu.bz,gov.bz,ca,ab.ca,bc.ca,mb.ca,nb.ca,nf.ca,nl.ca,ns.ca,nt.ca,nu.ca,on.ca,pe.ca,qc.ca,sk.ca,yk.ca,gc.ca,cat,cc,cd,gov.cd,cf,cg,ch,ci,org.ci,or.ci,com.ci,co.ci,edu.ci,ed.ci,ac.ci,net.ci,go.ci,asso.ci,aéroport.ci,int.ci,presse.ci,md.ci,gouv.ci,ck,cl,co.cl,gob.cl,gov.cl,mil.cl,cm,co.cm,com.cm,gov.cm,net.cm,cn,ac.cn,com.cn,edu.cn,gov.cn,net.cn,org.cn,mil.cn,co,arts.co,com.co,edu.co,firm.co,gov.co,info.co,int.co,mil.co,net.co,nom.co,org.co,rec.co,web.co,com,coop,cr,ac.cr,co.cr,ed.cr,fi.cr,go.cr,or.cr,sa.cr,cu,com.cu,edu.cu,org.cu,net.cu,gov.cu,inf.cu,cv,com.cv,edu.cv,int.cv,nome.cv,org.cv,cw,com.cw,edu.cw,net.cw,org.cw,cx,gov.cx,cy,ac.cy,biz.cy,com.cy,ekloges.cy,gov.cy,ltd.cy,mil.cy,net.cy,org.cy,press.cy,pro.cy,tm.cy,cz,de,dj,dk,dm,com.dm,net.dm,org.dm,edu.dm,gov.dm,do,art.do,com.do,edu.do,gob.do,gov.do,mil.do,net.do,org.do,sld.do,web.do,dz,art.dz,asso.dz,com.dz,edu.dz,gov.dz,org.dz,net.dz,pol.dz,soc.dz,tm.dz,ec,com.ec,info.ec,net.ec,fin.ec,k12.ec,med.ec,pro.ec,org.ec,edu.ec,gov.ec,gob.ec,mil.ec,edu,ee,edu.ee,gov.ee,riik.ee,lib.ee,med.ee,com.ee,pri.ee,aip.ee,org.ee,fie.ee,eg,com.eg,edu.eg,eun.eg,gov.eg,mil.eg,name.eg,net.eg,org.eg,sci.eg,er,es,com.es,nom.es,org.es,gob.es,edu.es,et,com.et,gov.et,org.et,edu.et,biz.et,name.et,info.et,net.et,eu,fi,aland.fi,fj,ac.fj,biz.fj,com.fj,gov.fj,info.fj,mil.fj,name.fj,net.fj,org.fj,pro.fj,fk,com.fm,edu.fm,net.fm,org.fm,fm,fo,fr,asso.fr,com.fr,gouv.fr,nom.fr,prd.fr,tm.fr,aeroport.fr,avocat.fr,avoues.fr,cci.fr,chambagri.fr,chirurgiens-dentistes.fr,experts-comptables.fr,geometre-expert.fr,greta.fr,huissier-justice.fr,medecin.fr,notaires.fr,pharmacien.fr,port.fr,veterinaire.fr,ga,gb,edu.gd,gov.gd,gd,ge,com.ge,edu.ge,gov.ge,org.ge,mil.ge,net.ge,pvt.ge,gf,gg,co.gg,net.gg,org.gg,gh,com.gh,edu.gh,gov.gh,org.gh,mil.gh,gi,com.gi,ltd.gi,gov.gi,mod.gi,edu.gi,org.gi,gl,co.gl,com.gl,edu.gl,net.gl,org.gl,gm,gn,ac.gn,com.gn,edu.gn,gov.gn,org.gn,net.gn,gov,gp,com.gp,net.gp,mobi.gp,edu.gp,org.gp,asso.gp,gq,gr,com.gr,edu.gr,net.gr,org.gr,gov.gr,gs,gt,com.gt,edu.gt,gob.gt,ind.gt,mil.gt,net.gt,org.gt,gu,com.gu,edu.gu,gov.gu,guam.gu,info.gu,net.gu,org.gu,web.gu,gw,gy,co.gy,com.gy,edu.gy,gov.gy,net.gy,org.gy,hk,com.hk,edu.hk,gov.hk,idv.hk,net.hk,org.hk,hm,hn,com.hn,edu.hn,org.hn,net.hn,mil.hn,gob.hn,hr,iz.hr,from.hr,name.hr,com.hr,ht,com.ht,shop.ht,firm.ht,info.ht,adult.ht,net.ht,pro.ht,org.ht,med.ht,art.ht,coop.ht,pol.ht,asso.ht,edu.ht,rel.ht,gouv.ht,perso.ht,hu,co.hu,info.hu,org.hu,priv.hu,sport.hu,tm.hu,2000.hu,agrar.hu,bolt.hu,casino.hu,city.hu,erotica.hu,erotika.hu,film.hu,forum.hu,games.hu,hotel.hu,ingatlan.hu,jogasz.hu,konyvelo.hu,lakas.hu,media.hu,news.hu,reklam.hu,sex.hu,shop.hu,suli.hu,szex.hu,tozsde.hu,utazas.hu,video.hu,id,ac.id,biz.id,co.id,desa.id,go.id,mil.id,my.id,net.id,or.id,ponpes.id,sch.id,web.id,ie,gov.ie,il,ac.il,co.il,gov.il,idf.il,k12.il,muni.il,net.il,org.il,im,ac.im,co.im,com.im,ltd.co.im,net.im,org.im,plc.co.im,tt.im,tv.im,in,5g.in,6g.in,ac.in,ai.in,am.in,bihar.in,biz.in,business.in,ca.in,cn.in,co.in,com.in,coop.in,cs.in,delhi.in,dr.in,edu.in,er.in,firm.in,gen.in,gov.in,gujarat.in,ind.in,info.in,int.in,internet.in,io.in,me.in,mil.in,net.in,nic.in,org.in,pg.in,post.in,pro.in,res.in,travel.in,tv.in,uk.in,up.in,us.in,info,int,eu.int,io,com.io,iq,gov.iq,edu.iq,mil.iq,com.iq,org.iq,net.iq,ir,ac.ir,co.ir,gov.ir,id.ir,net.ir,org.ir,sch.ir,is,net.is,com.is,edu.is,gov.is,org.is,int.is,it,gov.it,edu.it,je,co.je,net.je,org.je,jm,jo,com.jo,org.jo,net.jo,edu.jo,sch.jo,gov.jo,mil.jo,name.jo,jobs,jp,ac.jp,ad.jp,co.jp,ed.jp,go.jp,gr.jp,lg.jp,ne.jp,or.jp,ke,ac.ke,co.ke,go.ke,info.ke,me.ke,mobi.ke,ne.ke,or.ke,sc.ke,kg,org.kg,net.kg,com.kg,edu.kg,gov.kg,mil.kg,kh,ki,edu.ki,biz.ki,net.ki,org.ki,gov.ki,info.ki,com.ki,km,org.km,nom.km,gov.km,prd.km,tm.km,edu.km,mil.km,ass.km,com.km,kn,net.kn,org.kn,edu.kn,gov.kn,kp,com.kp,edu.kp,gov.kp,org.kp,rep.kp,tra.kp,kr,ac.kr,co.kr,es.kr,go.kr,hs.kr,kg.kr,mil.kr,ms.kr,ne.kr,or.kr,pe.kr,re.kr,sc.kr,kw,com.kw,edu.kw,emb.kw,gov.kw,ind.kw,net.kw,org.kw,ky,com.ky,edu.ky,net.ky,org.ky,kz,org.kz,edu.kz,net.kz,gov.kz,mil.kz,com.kz,la,int.la,net.la,info.la,edu.la,gov.la,per.la,com.la,org.la,lb,com.lb,edu.lb,gov.lb,net.lb,org.lb,lc,com.lc,net.lc,co.lc,org.lc,edu.lc,gov.lc,li,lk,gov.lk,sch.lk,net.lk,int.lk,com.lk,org.lk,edu.lk,ngo.lk,soc.lk,web.lk,ltd.lk,assn.lk,grp.lk,hotel.lk,ac.lk,lr,com.lr,edu.lr,gov.lr,org.lr,net.lr,ls,ac.ls,biz.ls,co.ls,edu.ls,gov.ls,info.ls,net.ls,org.ls,sc.ls,lt,gov.lt,lu,lv,com.lv,edu.lv,gov.lv,org.lv,mil.lv,id.lv,net.lv,asn.lv,conf.lv,ly,com.ly,net.ly,gov.ly,plc.ly,edu.ly,sch.ly,med.ly,org.ly,id.ly,ma,co.ma,net.ma,gov.ma,org.ma,ac.ma,press.ma,mc,tm.mc,asso.mc,md,me,co.me,net.me,org.me,edu.me,ac.me,gov.me,its.me,priv.me,mg,org.mg,nom.mg,gov.mg,prd.mg,tm.mg,edu.mg,mil.mg,com.mg,co.mg,mh,mil,mk,com.mk,org.mk,net.mk,edu.mk,gov.mk,inf.mk,name.mk,ml,com.ml,edu.ml,gouv.ml,gov.ml,net.ml,org.ml,presse.ml,mm,mn,gov.mn,edu.mn,org.mn,mo,com.mo,net.mo,org.mo,edu.mo,gov.mo,mobi,mp,mq,mr,gov.mr,ms,com.ms,edu.ms,gov.ms,net.ms,org.ms,mt,com.mt,edu.mt,net.mt,org.mt,mu,com.mu,net.mu,org.mu,gov.mu,ac.mu,co.mu,or.mu,museum,mv,aero.mv,biz.mv,com.mv,coop.mv,edu.mv,gov.mv,info.mv,int.mv,mil.mv,museum.mv,name.mv,net.mv,org.mv,pro.mv,mw,ac.mw,biz.mw,co.mw,com.mw,coop.mw,edu.mw,gov.mw,int.mw,museum.mw,net.mw,org.mw,mx,com.mx,org.mx,gob.mx,edu.mx,net.mx,my,biz.my,com.my,edu.my,gov.my,mil.my,name.my,net.my,org.my,mz,ac.mz,adv.mz,co.mz,edu.mz,gov.mz,mil.mz,net.mz,org.mz,na,info.na,pro.na,name.na,school.na,or.na,dr.na,us.na,mx.na,ca.na,in.na,cc.na,tv.na,ws.na,mobi.na,co.na,com.na,org.na,name,nc,asso.nc,nom.nc,ne,net,nf,com.nf,net.nf,per.nf,rec.nf,web.nf,arts.nf,firm.nf,info.nf,other.nf,store.nf,ng,com.ng,edu.ng,gov.ng,i.ng,mil.ng,mobi.ng,name.ng,net.ng,org.ng,sch.ng,ni,ac.ni,biz.ni,co.ni,com.ni,edu.ni,gob.ni,in.ni,info.ni,int.ni,mil.ni,net.ni,nom.ni,org.ni,web.ni,nl,no,fhs.no,vgs.no,fylkesbibl.no,folkebibl.no,museum.no,idrett.no,priv.no,mil.no,stat.no,dep.no,kommune.no,herad.no,np,nr,biz.nr,info.nr,gov.nr,edu.nr,org.nr,net.nr,com.nr,nu,nz,ac.nz,co.nz,cri.nz,geek.nz,gen.nz,govt.nz,health.nz,iwi.nz,kiwi.nz,maori.nz,mil.nz,māori.nz,net.nz,org.nz,parliament.nz,school.nz,om,co.om,com.om,edu.om,gov.om,med.om,museum.om,net.om,org.om,pro.om,onion,org,pa,ac.pa,gob.pa,com.pa,org.pa,sld.pa,edu.pa,net.pa,ing.pa,abo.pa,med.pa,nom.pa,pe,edu.pe,gob.pe,nom.pe,mil.pe,org.pe,com.pe,net.pe,pf,com.pf,org.pf,edu.pf,pg,ph,com.ph,net.ph,org.ph,gov.ph,edu.ph,ngo.ph,mil.ph,i.ph,pk,com.pk,net.pk,edu.pk,org.pk,fam.pk,biz.pk,web.pk,gov.pk,gob.pk,gok.pk,gon.pk,gop.pk,gos.pk,info.pk,pl,com.pl,net.pl,org.pl,aid.pl,agro.pl,atm.pl,auto.pl,biz.pl,edu.pl,gmina.pl,gsm.pl,info.pl,mail.pl,miasta.pl,media.pl,mil.pl,nieruchomosci.pl,nom.pl,pc.pl,powiat.pl,priv.pl,realestate.pl,rel.pl,sex.pl,shop.pl,sklep.pl,sos.pl,szkola.pl,targi.pl,tm.pl,tourism.pl,travel.pl,turystyka.pl,pm,pn,gov.pn,co.pn,org.pn,edu.pn,net.pn,post,pr,com.pr,net.pr,org.pr,gov.pr,edu.pr,isla.pr,pro.pr,biz.pr,info.pr,name.pr,est.pr,prof.pr,ac.pr,pro,aaa.pro,aca.pro,acct.pro,avocat.pro,bar.pro,cpa.pro,eng.pro,jur.pro,law.pro,med.pro,recht.pro,ps,edu.ps,gov.ps,sec.ps,plo.ps,com.ps,org.ps,net.ps,pt,net.pt,gov.pt,org.pt,edu.pt,int.pt,publ.pt,com.pt,nome.pt,pw,co.pw,ne.pw,or.pw,ed.pw,go.pw,belau.pw,py,com.py,coop.py,edu.py,gov.py,mil.py,net.py,org.py,qa,com.qa,edu.qa,gov.qa,mil.qa,name.qa,net.qa,org.qa,sch.qa,re,asso.re,com.re,nom.re,ro,arts.ro,com.ro,firm.ro,info.ro,nom.ro,nt.ro,org.ro,rec.ro,store.ro,tm.ro,www.ro,rs,ac.rs,co.rs,edu.rs,gov.rs,in.rs,org.rs,ru,rw,ac.rw,co.rw,coop.rw,gov.rw,mil.rw,net.rw,org.rw,sa,com.sa,net.sa,org.sa,gov.sa,med.sa,pub.sa,edu.sa,sch.sa,sb,com.sb,edu.sb,gov.sb,net.sb,org.sb,sc,com.sc,gov.sc,net.sc,org.sc,edu.sc,sd,com.sd,net.sd,org.sd,edu.sd,med.sd,tv.sd,gov.sd,info.sd,se,a.se,ac.se,b.se,bd.se,brand.se,c.se,d.se,e.se,f.se,fh.se,fhsk.se,fhv.se,g.se,h.se,i.se,k.se,komforb.se,kommunalforbund.se,komvux.se,l.se,lanbib.se,m.se,n.se,naturbruksgymn.se,o.se,org.se,p.se,parti.se,pp.se,press.se,r.se,s.se,t.se,tm.se,u.se,w.se,x.se,y.se,z.se,sg,com.sg,net.sg,org.sg,gov.sg,edu.sg,per.sg,sh,com.sh,net.sh,gov.sh,org.sh,mil.sh,si,sj,sk,sl,com.sl,net.sl,edu.sl,gov.sl,org.sl,sm,sn,art.sn,com.sn,edu.sn,gouv.sn,org.sn,perso.sn,univ.sn,so,com.so,edu.so,gov.so,me.so,net.so,org.so,sr,ss,biz.ss,com.ss,edu.ss,gov.ss,me.ss,net.ss,org.ss,sch.ss,st,co.st,com.st,consulado.st,edu.st,embaixada.st,mil.st,net.st,org.st,principe.st,saotome.st,store.st,su,sv,com.sv,edu.sv,gob.sv,org.sv,red.sv,sx,gov.sx,sy,edu.sy,gov.sy,net.sy,mil.sy,com.sy,org.sy,sz,co.sz,ac.sz,org.sz,tc,td,tel,tf,tg,th,ac.th,co.th,go.th,in.th,mi.th,net.th,or.th,tj,ac.tj,biz.tj,co.tj,com.tj,edu.tj,go.tj,gov.tj,int.tj,mil.tj,name.tj,net.tj,nic.tj,org.tj,test.tj,web.tj,tk,tl,gov.tl,tm,com.tm,co.tm,org.tm,net.tm,nom.tm,gov.tm,mil.tm,edu.tm,tn,com.tn,ens.tn,fin.tn,gov.tn,ind.tn,info.tn,intl.tn,mincom.tn,nat.tn,net.tn,org.tn,perso.tn,tourism.tn,to,com.to,gov.to,net.to,org.to,edu.to,mil.to,tr,av.tr,bbs.tr,bel.tr,biz.tr,com.tr,dr.tr,edu.tr,gen.tr,gov.tr,info.tr,mil.tr,k12.tr,kep.tr,name.tr,net.tr,org.tr,pol.tr,tel.tr,tsk.tr,tv.tr,web.tr,nc.tr,tt,co.tt,com.tt,org.tt,net.tt,biz.tt,info.tt,pro.tt,int.tt,coop.tt,jobs.tt,mobi.tt,travel.tt,museum.tt,aero.tt,name.tt,gov.tt,edu.tt,tv,tw,edu.tw,gov.tw,mil.tw,com.tw,net.tw,org.tw,idv.tw,game.tw,ebiz.tw,club.tw,tz,ac.tz,co.tz,go.tz,hotel.tz,info.tz,me.tz,mil.tz,mobi.tz,ne.tz,or.tz,sc.tz,tv.tz,ua,com.ua,edu.ua,gov.ua,in.ua,net.ua,org.ua,ug,co.ug,or.ug,ac.ug,sc.ug,go.ug,ne.ug,com.ug,org.ug,uk,ac.uk,co.uk,gov.uk,ltd.uk,me.uk,net.uk,nhs.uk,org.uk,plc.uk,police.uk,us,dni.us,fed.us,isa.us,kids.us,nsn.us,ak.us,al.us,ar.us,as.us,az.us,ca.us,co.us,ct.us,dc.us,de.us,fl.us,ga.us,gu.us,hi.us,ia.us,id.us,il.us,in.us,ks.us,ky.us,la.us,ma.us,md.us,me.us,mi.us,mn.us,mo.us,ms.us,mt.us,nc.us,nd.us,ne.us,nh.us,nj.us,nm.us,nv.us,ny.us,oh.us,ok.us,or.us,pa.us,pr.us,ri.us,sc.us,sd.us,tn.us,tx.us,ut.us,vi.us,vt.us,va.us,wa.us,wi.us,wv.us,wy.us,uy,com.uy,edu.uy,gub.uy,mil.uy,net.uy,org.uy,uz,co.uz,com.uz,net.uz,org.uz,va,vc,com.vc,net.vc,org.vc,gov.vc,mil.vc,edu.vc,ve,arts.ve,bib.ve,co.ve,com.ve,e12.ve,edu.ve,firm.ve,gob.ve,gov.ve,info.ve,int.ve,mil.ve,net.ve,nom.ve,org.ve,rar.ve,rec.ve,store.ve,tec.ve,web.ve,vg,vi,co.vi,com.vi,k12.vi,net.vi,org.vi,vn,ac.vn,ai.vn,biz.vn,com.vn,edu.vn,gov.vn,health.vn,id.vn,info.vn,int.vn,io.vn,name.vn,net.vn,org.vn,pro.vn,vu,com.vu,edu.vu,net.vu,org.vu,wf,ws,com.ws,net.ws,org.ws,gov.ws,edu.ws,yt,ye,com.ye,edu.ye,gov.ye,net.ye,mil.ye,org.ye,ac.za,agric.za,alt.za,co.za,edu.za,gov.za,grondar.za,law.za,mil.za,net.za,ngo.za,nic.za,nis.za,nom.za,org.za,school.za,tm.za,web.za,zm,ac.zm,biz.zm,co.zm,com.zm,edu.zm,gov.zm,info.zm,mil.zm,net.zm,org.zm,sch.zm,zw,ac.zw,co.zw,gov.zw,mil.zw,org.zw".split(",");var Gc={};Hc.forEach((function(e){Gc[e]=true}));var Jc=Gc;function Vc(e){var t=e.split(":")[0];var n=t.split(".");if(n[n.length-1]==="localhost"||n.length<2){return n[n.length-1]}else{var r=n[n.length-2]+"."+n[n.length-1];if(n.length>2&&Jc[r]){return n[n.length-3]+"."+r}else{return r}}}var Wc=function(){function e(e){this.selfOptions=e||{};this.pipes={}}e.prototype.options=function(e){if(e){this.selfOptions=e}return this.selfOptions};e.prototype.pipe=function(e,t){var n=t;if(typeof e==="string"){if(typeof n==="undefined"){return this.pipes[e]}else{this.pipes[e]=n}}if(e&&e.name){n=e;if(n.processor===this){return n}this.pipes[n.name]=n}n.processor=this;return n};e.prototype.process=function(e,t){var n=e;n.options=this.options();var r=t||e.pipe||"default";var i;while(r){if(typeof n.nextAfterChildren!=="undefined"){n.next=n.nextAfterChildren;n.nextAfterChildren=null}if(typeof r==="string"){r=this.pipe(r)}r.process(n);i=r;r=null;if(n){if(n.next){n=n.next;r=n.pipe||i}}}return n.hasResult?n.result:undefined};return e}();var $c=function(){function e(e){this.name=e;this.filters=[]}e.prototype.process=function(e){if(!this.processor){throw new Error("add this pipe to a processor before using it")}var t=this.debug;var n=this.filters.length;var r=e;for(var i=0;i<n;i++){var o=this.filters[i];if(t){this.log("filter: ".concat(o.filterName))}o(r);if(typeof r==="object"&&r.exiting){r.exiting=false;break}}if(!r.next&&this.resultCheck){this.resultCheck(r)}};e.prototype.log=function(e){console.log("[jsondiffpatch] ".concat(this.name," pipe, ").concat(e))};e.prototype.append=function(){var e;var t=[];for(var n=0;n<arguments.length;n++){t[n]=arguments[n]}(e=this.filters).push.apply(e,t);return this};e.prototype.prepend=function(){var e;var t=[];for(var n=0;n<arguments.length;n++){t[n]=arguments[n]}(e=this.filters).unshift.apply(e,t);return this};e.prototype.indexOf=function(e){if(!e){throw new Error("a filter name is required")}for(var t=0;t<this.filters.length;t++){var n=this.filters[t];if(n.filterName===e){return t}}throw new Error("filter not found: ".concat(e))};e.prototype.list=function(){return this.filters.map((function(e){return e.filterName}))};e.prototype.after=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i+1,0],n,false));return this};e.prototype.before=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i,0],n,false));return this};e.prototype.replace=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}var i=this.indexOf(e);(t=this.filters).splice.apply(t,__spreadArray([i,1],n,false));return this};e.prototype.remove=function(e){var t=this.indexOf(e);this.filters.splice(t,1);return this};e.prototype.clear=function(){this.filters.length=0;return this};e.prototype.shouldHaveResult=function(e){var t=this;if(e===false){this.resultCheck=null;return}if(this.resultCheck){return}this.resultCheck=function(e){if(!e.hasResult){console.log(e);var n=new Error("".concat(t.name," failed"));n.noResult=true;throw n}};return this};return e}();var Qc=function(){function e(){}e.prototype.setResult=function(e){this.result=e;this.hasResult=true;return this};e.prototype.exit=function(){this.exiting=true;return this};e.prototype.push=function(e,t){e.parent=this;if(typeof t!=="undefined"){e.childName=t}e.root=this.root||this;e.options=e.options||this.options;if(!this.children){this.children=[e];this.nextAfterChildren=this.next||null;this.next=e}else{this.children[this.children.length-1].next=e;this.children.push(e)}e.next=this;return this};return e}();var Kc=function(e){__extends(t,e);function t(t,n){var r=e.call(this)||this;r.left=t;r.right=n;r.pipe="diff";return r}t.prototype.setResult=function(t){return e.prototype.setResult.call(this,t)};return t}(Qc);var Xc=function(e){__extends(t,e);function t(t,n){var r=e.call(this)||this;r.left=t;r.delta=n;r.pipe="patch";return r}return t}(Qc);function Yc(e,t){if(e.length!==t.length){return false}for(var n=0;n<e.length;n++){if(e[n]!==t[n]){return false}}return true}var Zc=function e(t){if(t.left===t.right){t.setResult(undefined).exit();return}if(typeof t.left==="undefined"){if(typeof t.right==="function"){throw new Error("functions are not supported")}t.setResult([t.right]).exit();return}if(typeof t.right==="undefined"){t.setResult([t.left,0,0]).exit();return}if(typeof t.left==="function"||typeof t.right==="function"){throw new Error("functions are not supported")}t.leftType=t.left===null?"null":typeof t.left;t.rightType=t.right===null?"null":typeof t.right;if(t.leftType!==t.rightType){t.setResult([t.left,t.right]).exit();return}if(t.leftType==="boolean"||t.leftType==="number"||t.leftType==="string"){t.setResult([t.left,t.right]).exit();return}if(t.leftType==="object"){t.leftIsArray=Array.isArray(t.left)}if(t.rightType==="object"){t.rightIsArray=Array.isArray(t.right)}if(t.leftIsArray!==t.rightIsArray){t.setResult([t.left,t.right]).exit();return}if(t.leftIsArray&&t.rightIsArray){if(Yc(t.left,t.right)){t.setResult(undefined).exit();return}else{t.setResult([t.left,t.right]).exit();return}}if(t.left instanceof RegExp){if(t.right instanceof RegExp){t.setResult([t.left.toString(),t.right.toString()]).exit()}else{t.setResult([t.left,t.right]).exit()}}};Zc.filterName="trivial";var el=function e(t){if(typeof t.delta==="undefined"){t.setResult(t.left).exit();return}t.nested=!Array.isArray(t.delta);if(t.nested){return}var n=t.delta;if(n.length===1){t.setResult(n[0]).exit();return}if(n.length===2){if(t.left instanceof RegExp){var r=/^\/(.*)\/([gimyu]+)$/.exec(n[1]);if(r){t.setResult(new RegExp(r[1],r[2])).exit();return}}t.setResult(n[1]).exit();return}if(n.length===3&&n[2]===0){t.setResult(undefined).exit()}};el.filterName="trivial";var tl=function(e){if(!e||!e.children){return}var t=e.children.length;var n;var r=e.result;for(var i=0;i<t;i++){n=e.children[i];if(typeof n.result==="undefined"){continue}r=r||{};r[n.childName]=n.result}if(r&&e.leftIsArray){r._t="a"}e.setResult(r).exit()};tl.filterName="collectChildren";var nl=function(e){if(e.leftIsArray||e.leftType!=="object"){return}var t=e.left;var n=e.right;var r;var i;var o=e.options.propertyFilter;for(r in t){if(!Object.prototype.hasOwnProperty.call(t,r)){continue}if(o&&!o(r,e)){continue}i=new Kc(t[r],n[r]);e.push(i,r)}for(r in n){if(!Object.prototype.hasOwnProperty.call(n,r)){continue}if(o&&!o(r,e)){continue}if(typeof t[r]==="undefined"){i=new Kc(undefined,n[r]);e.push(i,r)}}if(!e.children||e.children.length===0){e.setResult(undefined).exit();return}e.exit()};nl.filterName="objects";var rl=function e(t){if(!t.nested){return}var n=t.delta;if(n._t){return}var r=n;var i;var o;for(i in r){o=new Xc(t.left[i],r[i]);t.push(o,i)}t.exit()};rl.filterName="objects";var il=function e(t){if(!t||!t.children){return}var n=t.delta;if(n._t){return}var r=t.left;var i=t.children.length;var o;for(var a=0;a<i;a++){o=t.children[a];var s=o.childName;if(Object.prototype.hasOwnProperty.call(t.left,s)&&o.result===undefined){delete r[s]}else if(r[s]!==o.result){r[s]=o.result}}t.setResult(r).exit()};il.filterName="collectChildren";var ol=function e(t){if(t.left instanceof Date){if(t.right instanceof Date){if(t.left.getTime()!==t.right.getTime()){t.setResult([t.left,t.right])}else{t.setResult(undefined)}}else{t.setResult([t.left,t.right])}t.exit()}else if(t.right instanceof Date){t.setResult([t.left,t.right]).exit()}};ol.filterName="dates";var al=function(){function e(e){this.processor=new Wc(e);this.processor.pipe(new $c("diff").append(tl,Zc,ol,nl).shouldHaveResult());this.processor.pipe(new $c("patch").append(il,el,rl).shouldHaveResult())}e.prototype.options=function(e){return this.processor.options(e)};e.prototype.diff=function(e,t){return this.processor.process(new Kc(e,t))};e.prototype.patch=function(e,t){return this.processor.process(new Xc(e,t))};return e}();function sl(e){return new al(e)}var cl=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};var ll=sl();var ul={writeKey:null,host:null,debug:false,fetch:null,echoEvents:false,cookieDomain:undefined,cookieCapture:{},runtime:undefined,fetchTimeoutMs:undefined,s2s:undefined,idEndpoint:undefined,errorPolicy:"log",defaultPayloadContext:{},privacy:{dontSend:false,disableUserIds:false,ipPolicy:"keep",consentCategories:undefined}};var dl=function(e,t){for(var n=0,r=Object.keys(ul);n<r.length;n++){var i=r[n];var o=t[i];if(i==="privacy"){if(typeof o==="object"){e.privacy=Object.assign(Object.assign(Object.assign({},ul.privacy),e.privacy),o)}else if(t.hasOwnProperty("privacy")&&typeof o==="undefined"){e.privacy=Object.assign({},ul.privacy)}}else if(typeof o==="undefined"){if(t.hasOwnProperty(i)||!e.hasOwnProperty(i)){e[i]=ul[i]}}else{e[i]=o}}};var fl=function(e){if(!e){return{}}var t=e.length>0&&e.charAt(0)==="?"?e.substring(1):e;var n={};var r=(t[0]==="?"?t.substr(1):t).split("&");for(var i=0;i<r.length;i++){var o=r[i].split("=");n[decodeURIComponent(o[0])]=decodeURIComponent(o[1]||"")}return n};function pl(e){var t=e.substring("utm_".length);return t==="campaign"?"name":t}function hl(e){return Object.entries(e).filter((function(e){var t=e[0];return t.indexOf("utm_")===0})).reduce((function(e,t){var n;var r=t[0],i=t[1];return Object.assign(Object.assign({},e),(n={},n[pl(r)]=i,n))}),{})}function vl(e,t){try{return e()}catch(e){return t}}function gl(e){var t=e.getItem("__user_traits");if(typeof t==="string"){t=vl((function(){return JSON.parse(t)}),{})}if(typeof t!=="object"||t===null||Array.isArray(t)){t={}}var n=e.getItem("__group_traits");if(typeof n==="string"){n=vl((function(){return JSON.parse(n)}),{})}if(typeof n!=="object"||n===null||Array.isArray(n)){n={}}return Object.assign(Object.assign({},n||{}),t||{})}function ml(e){var t="; ".concat(document.cookie);var n=t.split("; ".concat(e,"="));return n.length===2?n.pop().split(";").shift():undefined}function yl(e,t){var n=Object.assign({fbc:"_fbc",fbp:"_fbp"},t);var r=Object.entries(n).reduce((function(t,n){var r=n[0],i=n[1];t[r]=e.getCookie(i);return t}),{});return Object.assign(Object.assign({},r),bl(e))}function bl(e){var t;var n=e.getCookies();var r=(t=n["_ga"])===null||t===void 0?void 0:t.split(".").slice(-2).join(".");var i=Object.entries(n).filter((function(e){var t=e[0];return t.startsWith("_ga_")}));var o=i.length>0?Object.fromEntries(i.map((function(e){var t=e[0],n=e[1];if(typeof n!=="string"){return null}var r=n.split(".");if(r.length<3){return null}return[t.substring("_ga_".length),r[2]]})).filter((function(e){return e!==null}))):undefined;if(r||o){return{ga4:{clientId:r,sessionIds:o}}}else{return undefined}}function wl(e,t){var n=t.domain,r=t.secure;document.cookie=e+"=;domain="+n+";path=/"+";expires=Thu, 01 Jan 1970 00:00:01 GMT;SameSite="+(r?"None":"Lax")+(r?";secure":"")}function _l(e,t,n){var r=n.domain,i=n.secure;document.cookie=e+"="+t+";domain="+r+";path=/"+";expires="+new Date((new Date).getTime()+1e3*60*60*24*365*5).toUTCString()+";SameSite="+(i?"None":"Lax")+(i?";secure":"")}var Sl={__anon_id:"__eventn_id",__user_traits:"__eventn_id_usr",__user_id:"__eventn_uid",__group_id:"__group_id",__group_traits:"__group_traits"};var kl=function(e,t){return{setItem:function(n,r){if(typeof r==="undefined"){wl(t[n]||n,{domain:e,secure:window.location.protocol==="https:"});return}var i=typeof r==="object"&&r!==null?encodeURIComponent(JSON.stringify(r)):r;var o=t[n]||n;_l(o,i,{domain:e,secure:window.location.protocol==="https:"})},getItem:function(e){var n=t[e]||e;var r=ml(n);if(e==="__anon_id"){return r}if(typeof r==="undefined"&&e==="__user_id"){var i=Wl(ml("__eventn_id_usr"))||{};return i.internal_id||i.user_id||i.id||i.userId}return Wl(r)},removeItem:function(n){wl(t[n]||n,{domain:e,secure:window.location.protocol==="https:"})},reset:function(){for(var n=0,r=Object.values(t);n<r.length;n++){var i=r[n];wl(i,{domain:e,secure:window.location.protocol==="https:"})}}}};function El(e){return{getCookie:function(e){var t="; ".concat(document.cookie);var n=t.split("; ".concat(e,"="));return n.length===2?n.pop().split(";").shift():undefined},getCookies:function(){var e="; ".concat(document.cookie);var t={};var n=e.matchAll(/(\w+)=([^;]+)/g);for(var r=0,i=n;r<i.length;r++){var o=i[r];t[o[1]]=o[2]}return t},documentEncoding:function(){return window.document.characterSet},timezoneOffset:function(){return(new Date).getTimezoneOffset()},store:function(){return kl(e.cookieDomain||Vc(window.location.hostname),Sl)},language:function(){return window.navigator.language},pageTitle:function(){return window.document.title},pageUrl:function(){return window.location.href},referrer:function(){return window.document.referrer},screen:function(){return{width:window.screen.width,height:window.screen.height,innerWidth:window.innerWidth,innerHeight:window.innerHeight,density:Math.floor(window.devicePixelRatio)}},userAgent:function(){return window.navigator.userAgent}}}var xl=function(e){return{documentEncoding:function(){return undefined},timezoneOffset:function(){return undefined},getCookie:function(e){return undefined},getCookies:function(){return{}},store:function(){var t={};return{reset:function(){Object.keys(t).forEach((function(e){return delete t[e]}))},setItem:function(n,r){if(e.debug){console.log("[JITSU EMPTY RUNTIME] Set storage item ".concat(n,"=").concat(JSON.stringify(r)))}if(typeof r==="undefined"){delete t[n]}else{t[n]=r}},getItem:function(n){var r=t[n];if(e.debug){console.log("[JITSU EMPTY RUNTIME] Get storage item ".concat(n,"=").concat(JSON.stringify(r)))}return r},removeItem:function(n){if(e.debug){console.log("[JITSU EMPTY RUNTIME] Get storage item ".concat(n,"=").concat(t[n]))}delete t[n]}}},language:function(){return undefined},pageTitle:function(){return undefined},pageUrl:function(){return undefined},referrer:function(){return undefined},screen:function(){return undefined},userAgent:function(){return undefined}}};function Il(e,t){if(typeof t!=="object"||t===null){return t}if(typeof e!=="object"||e===null){return t}return Object.entries(t).reduce((function(t,n){var r=n[0],i=n[1];t[r]=Il(e[r],i);return t}),e)}function jl(){return typeof document!=="undefined"&&typeof window!=="undefined"}function Pl(e){if(e.indexOf("//")===0&&e.lastIndexOf("/")===1){return"/"}return e}var Ol=/#.*$/;function Al(e){var t=/(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g;var n=t.exec(e);var r=n&&n[3]?n[3].split("?")[0].replace(Ol,""):"";return"/"+r}function Cl(e,t,n,r){var i,o,a,s,c,l;var u=t.runtime||(jl()?El(t):xl(t));var d=u.pageUrl();var f=vl((function(){return new URL(d)}),undefined);var p=f?fl(f.search):{};var h=e.properties||{};if(e.type==="page"&&(h.url||d)){var v=h.url||d;h.url=v.replace(Ol,"");h.path=Pl(Al(v))}var g=Il(t.defaultPayloadContext,((i=e.properties)===null||i===void 0?void 0:i.context)||((o=e.options)===null||o===void 0?void 0:o.context)||{});(a=e.properties)===null||a===void 0?true:delete a.context;var m=u.referrer();var y={library:{name:Bc,version:Mc,env:jl()?"browser":"node"},consent:((s=t.privacy)===null||s===void 0?void 0:s.consentCategories)?{categoryPreferences:t.privacy.consentCategories}:undefined,userAgent:u.userAgent(),locale:u.language(),screen:u.screen(),traits:e.type!="identify"&&e.type!="group"?Object.assign({},gl(n)||{}):undefined,page:{path:h.path||f&&f.pathname,referrer:m,referring_domain:vl((function(){return m&&new URL(m).hostname})),host:f&&f.host,search:h.search||f&&f.search,title:h.title||u.pageTitle(),url:h.url||d,encoding:h.encoding||u.documentEncoding()},clientIds:!((c=t.privacy)===null||c===void 0?void 0:c.disableUserIds)?yl(u,t.cookieCapture):undefined,campaign:hl(p)};var b=Object.assign(Object.assign({},e),{timestamp:(new Date).toISOString(),sentAt:(new Date).toISOString(),messageId:Hl(h.path||f&&f.pathname),writeKey:Nl(t.writeKey),groupId:n.getItem("__group_id"),context:Il(y,g)});delete b.meta;delete b.options;if((l=t.privacy)===null||l===void 0?void 0:l.disableUserIds){delete b.userId;delete b.anonymousId;delete b.context.traits;delete b.groupId}return b}function Tl(e){var t=Object.keys(e);return t.length===1&&t[0]==="__diff"}function Fl(e,t,n,r,i){return cl(this,void 0,void 0,(function(){var o,a,s,c,l,u,d,f,p,h,d,v,g,m,h;return __generator(this,(function(y){switch(y.label){case 0:o=[];a=0,s=e;y.label=1;case 1:if(!(a<s.length))return[3,5];c=s[a];l=[n];if(c.newEvents){try{l=c.newEvents.map((function(e){return e==="same"?n:Tl(e)?ll.patch(n,e.__diff):e}))}catch(e){console.error("[JITSU] Error applying '".concat(c.id,"' changes to event: ").concat(e===null||e===void 0?void 0:e.message),e)}}u=Object.assign(Object.assign({},c.credentials),c.options);if(!(c.deviceOptions.type==="internal-plugin"))return[3,2];d=Dc[c.deviceOptions.name];if(d){for(f=0,p=l;f<p.length;f++){h=p[f];try{o.push(d.handle(Object.assign(Object.assign({},u),{debug:r}),h))}catch(e){console.warn("[JITSU] Error processing event with internal plugin '".concat(c.deviceOptions.name,"': ").concat(e===null||e===void 0?void 0:e.message),e)}}}else{console.warn("[JITSU] Unknown internal plugin '".concat(c.deviceOptions.name,"' for destination '").concat(c.id,"'"))}return[3,4];case 2:if(!(c.deviceOptions.type==="analytics-plugin"))return[3,4];return[4,ac(c.deviceOptions.packageCdn)];case 3:y.sent();d=window[c.deviceOptions.moduleVarName];if(!d){console.warn("[JITSU] Broken plugin '".concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"' - it doesn't export '").concat(c.deviceOptions.moduleVarName,"' variable"))}else{v=void 0;try{v=(typeof d==="function"?d:d.init)(u)}catch(e){console.warn("[JITSU] Error creating plugin '".concat(c.deviceOptions.moduleVarName,"@").concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"': ").concat(e===null||e===void 0?void 0:e.message),e)}try{if(r){console.log("[JITSU] Plugin '".concat(c.deviceOptions.moduleVarName,"@").concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"' initialized with config:"),v.config)}v.initialize({config:v.config,instance:i})}catch(e){console.warn("[JITSU] Error initializing plugin '".concat(c.deviceOptions.moduleVarName,"@").concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"': ").concat(e===null||e===void 0?void 0:e.message,". Config: ").concat(JSON.stringify(v.config)),e);return[3,4]}if(v[t]){for(g=0,m=l;g<m.length;g++){h=m[g];try{v[t]({payload:h,config:v.config,instance:i})}catch(e){console.warn("[JITSU] Error processing ".concat(t,"() with plugin '").concat(c.deviceOptions.moduleVarName,"@").concat(c.deviceOptions.packageCdn,"' for destination '").concat(c.id,"': ").concat(e===null||e===void 0?void 0:e.message),e)}}}}y.label=4;case 4:a++;return[3,1];case 5:return[2]}}))}))}function Ll(e){return e.length===25&&e.charAt(0)==="c"}function Rl(e){if(e){var t=e.split(":",2),n=t[1];if(!n&&!Ll(e)){throw new Error("Legacy write key detected - ".concat(e,"! This format doesn't work anymore, it should be 'key:secret'. Please download a new key from Jitsu UI"))}}return e}function Nl(e){if(e){var t=e.split(":",2),n=t[0],r=t[1];if(r){return"".concat(n,":***")}else{return"***"}}return e}function zl(e){var t=e.errorPolicy||"log";if(typeof t==="function"){return t}else if(t==="rethrow"){return function(e){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}throw new Error(e)}}else{return function(e){var t=[];for(var n=1;n<arguments.length;n++){t[n-1]=arguments[n]}console.error.apply(console,__spreadArray([e],t,false))}}}function ql(e,t,n,r,i){return cl(this,void 0,void 0,(function(){var o,a,s,c,l,u,d,f,p,h,v,g,m,y,b,w;return __generator(this,(function(_){switch(_.label){case 0:if(n.echoEvents){console.log("[JITSU DEBUG] sending '".concat(e,"' event:"),t);return[2]}s=!!n.s2s;c=s?"".concat(n.host,"/api/s/s2s/").concat(e):"".concat(n.host,"/api/s/").concat(e);l=n.fetch||globalThis.fetch;if(!l){throw new Error("Please specify fetch function in jitsu plugin initialization, fetch isn't available in global scope")}u=n.debug?{"X-Enable-Debug":"true"}:{};d=Cl(t,n,i);f=n.fetchTimeoutMs?new AbortController:undefined;p=n.fetchTimeoutMs?setTimeout((function(){f.abort()}),n.fetchTimeoutMs):undefined;h=n.writeKey?{"X-Write-Key":n.writeKey}:{};v=typeof((o=n.privacy)===null||o===void 0?void 0:o.ipPolicy)==="undefined"||((a=n.privacy)===null||a===void 0?void 0:a.ipPolicy)==="keep"?{}:{"X-IP-Policy":n.privacy.ipPolicy};_.label=1;case 1:_.trys.push([1,3,,4]);return[4,l(c,{method:"POST",headers:Object.assign(Object.assign(Object.assign({"Content-Type":"application/json"},h),u),v),body:JSON.stringify(d),signal:f===null||f===void 0?void 0:f.signal})];case 2:g=_.sent();if(p){clearTimeout(p)}return[3,4];case 3:m=_.sent();zl(n)("Call to ".concat(c," failed with error ").concat(m.message));return[2,Promise.resolve()];case 4:_.trys.push([4,6,,7]);return[4,g.text()];case 5:y=_.sent();return[3,7];case 6:b=_.sent();console.warn("Can't read response text from ".concat(c," (status - ").concat(g.status," ").concat(g.statusText,"): ").concat(b===null||b===void 0?void 0:b.message));return[3,7];case 7:if(n.debug){console.log("[JITSU DEBUG] ".concat(c," replied ").concat(g.status,": ").concat(y,". Original payload:\n").concat(JSON.stringify(d,null,2)))}if(!g.ok){zl(n)("Call to ".concat(c," failed with error: ").concat(g.status," - ").concat(g.statusText,": ").concat(y));return[2,Promise.resolve()]}try{w=JSON.parse(y)}catch(e){zl(n)("Can't parse JSON: ".concat(y,": ").concat(e===null||e===void 0?void 0:e.message));return[2,Promise.resolve()]}if(w.destinations&&w.destinations.length>0){if(n.s2s){console.warn("[JITSU] ".concat(t.type," responded with list of ").concat(w.destinations.length," destinations. However, this code is running in server-to-server mode, so destinations will be ignored"),n.debug?JSON.stringify(w.destinations,null,2):undefined)}else{if(jl()){if(n.debug){console.log("[JITSU] Processing device destinations: ",JSON.stringify(w.destinations,null,2))}return[2,Fl(w.destinations,e,d,!!n.debug,r)]}}}return[2,d]}}))}))}var Ul=["$doNotSend"];function Dl(e){var t=Object.assign({},e);for(var n=0,r=Ul;n<r.length;n++){var i=r[n];delete t[i]}return t}var Ml=function(e,t){if(e===void 0){e={}}dl(e,e);return{name:"jitsu",config:e,initialize:function(e){return cl(void 0,void 0,void 0,(function(){var t,n,r,i,o,a;return __generator(this,(function(s){switch(s.label){case 0:t=e.config;if(t.debug){console.debug("[JITSU DEBUG] Initializing Jitsu plugin with config: ",JSON.stringify(t,null,2))}if(!t.host&&!t.echoEvents){throw new Error("Please specify host variable in jitsu plugin initialization, or set echoEvents to true")}Rl(t.writeKey);if(!t.idEndpoint)return[3,4];if(!jl()){console.error("[JITSU] 'idEndpoint' option can be used only in browser environment");return[2]}s.label=1;case 1:s.trys.push([1,3,,4]);n=t.fetch||globalThis.fetch;r=new AbortController;setTimeout((function(){return r.abort()}),1e3);i=t.cookieDomain||Vc(window.location.hostname);return[4,n(t.idEndpoint+"?domain="+encodeURIComponent(i),{credentials:"include",signal:r.signal})];case 2:o=s.sent();if(!o.ok){console.error("[JITSU] Can't fetch idEndpoint: ".concat(o.status," - ").concat(o.statusText))}else if(t.debug){console.log("[JITSU DEBUG] Fetch idEndpoint: ".concat(o.status))}return[3,4];case 3:a=s.sent();console.error("[JITSU] Can't fetch idEndpoint: ".concat(a.message));return[3,4];case 4:return[2]}}))}))},page:function(e){var n;var r=e.payload,i=e.config,o=e.instance;if((n=i.privacy)===null||n===void 0?void 0:n.dontSend){return}return ql("page",r,i,o,t)},track:function(e){var n;var r=e.payload,i=e.config,o=e.instance;if((n=i.privacy)===null||n===void 0?void 0:n.dontSend){return}return ql("track",r,i,o,t)},identify:function(e){var n,r,i;var o=e.payload,a=e.config,s=e.instance;if(((n=a.privacy)===null||n===void 0?void 0:n.dontSend)||((r=a.privacy)===null||r===void 0?void 0:r.disableUserIds)){return}t.setItem("__user_id",o.userId);var c=(i=o.traits)===null||i===void 0?void 0:i.$doNotSend;if(o.traits&&typeof o.traits==="object"){o.traits=Dl(o.traits);t.setItem("__user_traits",o.traits)}if(c){return Promise.resolve()}return ql("identify",o,a,s,t)},reset:function(e){var n=e.config,r=e.instance;t.reset();if(n.debug){console.log("[JITSU DEBUG] Resetting Jitsu plugin storage")}},methods:{configure:function(n){var r,i,o,a;var s=((r=e.privacy)===null||r===void 0?void 0:r.disableUserIds)||((i=e.privacy)===null||i===void 0?void 0:i.dontSend);dl(e,n);var c=((o=e.privacy)===null||o===void 0?void 0:o.disableUserIds)||((a=e.privacy)===null||a===void 0?void 0:a.dontSend);if(!c&&s){if(e.debug){console.log("[JITSU] Enabling Anonymous ID. Generating new Id.")}var l=this.instance;var u=Gl();var d=l.user();if(d){d.anonymousId=u}t.setItem("__anon_id",u);l.setAnonymousId(u)}},group:function(n,r,i,o){var a,s;if(((a=e.privacy)===null||a===void 0?void 0:a.dontSend)||((s=e.privacy)===null||s===void 0?void 0:s.disableUserIds)){return}if(typeof n==="number"){n=n+""}var c=this.instance;var l=c.user();var u=(i===null||i===void 0?void 0:i.userId)||(l===null||l===void 0?void 0:l.userId);var d=(i===null||i===void 0?void 0:i.anonymousId)||(l===null||l===void 0?void 0:l.anonymousId)||t.getItem("__anon_id");t.setItem("__group_id",n);var f=r===null||r===void 0?void 0:r.$doNotSend;if(r&&typeof r==="object"){r=Dl(r);t.setItem("__group_traits",r)}if(f){return Promise.resolve()}return ql("group",Object.assign(Object.assign({type:"group",groupId:n,traits:r},d?{anonymousId:d}:{}),u?{userId:u}:{}),e,c,t)}}}};function Bl(){var e;var t=Date.now()%2147483647;return jl()?((e=window===null||window===void 0?void 0:window.performance)===null||e===void 0?void 0:e.now())||t:t}function Hl(e){if(e===void 0){e=""}var t=Date.now();return(Math.random()*t*Jl(e!==null&&e!==void 0?e:"",Bl())%Number.MAX_SAFE_INTEGER).toString(36)+(Math.random()*t*Jl(e!==null&&e!==void 0?e:"",Bl())%Number.MAX_SAFE_INTEGER).toString(36)}function Gl(){var e="",t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",n=0,r=Math.random()*4294967295|0;while(n++<36){var i=t[n-1],o=r&15,a=i=="x"?o:o&3|8;e+=i=="-"||i=="4"?i:a.toString(16);r=n%8==0?Math.random()*4294967295|0:r>>4}return e}function Jl(e,t){if(t===void 0){t=0}var n=3735928559^t,r=1103547991^t;for(var i=0,o=void 0;i<e.length;i++){o=e.charCodeAt(i);n=Math.imul(n^o,2654435761);r=Math.imul(r^o,1597334677)}n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909);r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909);return 4294967296*(2097151&r)+(n>>>0)}var Vl=function(e,t,n,r){function i(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r["throw"](e))}catch(e){o(e)}}function c(e){e.done?n(e.value):i(e.value).then(a,s)}c((r=r.apply(e,t||[])).next())}))};function Wl(e){var t=e;if((e===null||e===void 0?void 0:e.indexOf("%7B%22"))===0){t=decodeURIComponent(e)}try{t=JSON.parse(t);if(t==="true")return true;if(t==="false")return false;if(typeof t==="object")return t;if(parseFloat(t)===t){t=parseFloat(t)}}catch(e){}if(t===null||t===""){return}return t}function $l(e,t,n){if(n===void 0){n=[]}var r,i;var o={};var a=function(t){return{setItem:function(n,r){var i,a;if(((i=e.privacy)===null||i===void 0?void 0:i.dontSend)||((a=e.privacy)===null||a===void 0?void 0:a.disableUserIds)){return}if(e.debug){console.log("[JITSU DEBUG] Caching storage setItem: ".concat(n,"=").concat(r))}o[n]=r;t.setItem(n,r)},getItem:function(n){var r,i;if(((r=e.privacy)===null||r===void 0?void 0:r.dontSend)||((i=e.privacy)===null||i===void 0?void 0:i.disableUserIds)){return}var a=o[n]||t.getItem(n);if(e.debug){console.log("[JITSU DEBUG] Caching storage getItem: ".concat(n,"=").concat(a,". Evicted from cache: ").concat(!o[n]))}return a},reset:function(){for(var e=0,n=__spreadArray([],Object.keys(o),true);e<n.length;e++){var r=n[e];delete o[r]}t.reset()},removeItem:function(n){if(e.debug){console.log("[JITSU DEBUG] Caching storage removeItem: ".concat(n))}delete o[n];t.removeItem(n)}}};var s=a(t.store());var c=rc({debug:!!e.debug,storage:s,plugins:__spreadArray([Ml(e,s)],n,true)});var l=Object.assign(Object.assign({},c),{page:function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e.length===2&&typeof e[0]==="string"&&typeof e[1]==="object"){return c.page(Object.assign({name:e[0]},e[1]))}else{return c.page.apply(c,e)}},identify:function(){var e=[];for(var t=0;t<arguments.length;t++){e[t]=arguments[t]}if(e[0]&&typeof e[0]!=="object"&&typeof e[0]!=="string"){e[0]=e[0]+""}var n=c.storage;var r=a(n);if(typeof e[0]==="string"){r.setItem("__user_id",e[0])}else if(typeof e[0]==="object"){r.setItem("__user_traits",e[0])}if(e.length===2&&typeof e[1]==="object"){r.setItem("__user_traits",e[1])}return c.identify.apply(c,e)},setAnonymousId:function(t){if(e.debug){console.log("[JITSU DEBUG] Setting anonymous id to "+t)}s.setItem("__anon_id",t);var n=c.user();if(n){n.anonymousId=t}c.setAnonymousId(t)},reset:function(){return Vl(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:if(e.debug){console.log("[JITSU DEBUG] Called reset(). Storage state",JSON.stringify(c.user()))}s.reset();return[4,c.reset()];case 1:t.sent();this.setAnonymousId(Gl());if(e.debug){console.log("[JITSU DEBUG] User state after reset",JSON.stringify(c.user()))}return[2]}}))}))},configure:function(t){return Vl(this,void 0,void 0,(function(){var n,r,i,o,a;return __generator(this,(function(l){if(e.debug){console.log("[JITSU DEBUG] Update Jitsu config with",JSON.stringify(t))}if(((n=t.privacy)===null||n===void 0?void 0:n.disableUserIds)||((r=t.privacy)===null||r===void 0?void 0:r.dontSend)){s.reset()}for(i=0,o=Object.values(c.plugins);i<o.length;i++){a=o[i];if(typeof a["configure"]==="function"){a["configure"](t)}}return[2]}))}))},group:function(e,t,n,r){return Vl(this,void 0,void 0,(function(){var i,o,a,s,l,u;return __generator(this,(function(d){switch(d.label){case 0:i=[];o=0,a=Object.values(c.plugins);d.label=1;case 1:if(!(o<a.length))return[3,4];s=a[o];if(!s["group"])return[3,3];u=(l=i).push;return[4,s["group"](e,t,n,r)];case 2:u.apply(l,[d.sent()]);d.label=3;case 3:o++;return[3,1];case 4:return[2,i[0]]}}))}))}});if(((r=e.privacy)===null||r===void 0?void 0:r.disableUserIds)||((i=e.privacy)===null||i===void 0?void 0:i.dontSend)){s.reset()}return l}function Ql(e){var t,n;return Object.assign(Object.assign({},e),{host:((t=e.host)!==null&&t!==void 0?t:"").indexOf("https://")!==0&&((n=e.host)!==null&&n!==void 0?n:"").indexOf("http://")!==0?"https://".concat(e.host):e.host})}function Kl(e){var t=Ql(e);var n=jl();var r=t.runtime||(n?El(t):xl(t));return $l(t,r)}var Xl=function(e,t,n){return alert(e)},Yl=function(e,t){return Xl(e,Zl.error,t)},Zl={error:"error",success:"success",info:"info"};var eu={fire:function(e,t,n){return Xl(e,t,n)},setNotifier:function(e){Xl=e,salla.event.emit("twilight::notifier.changed")},error:Yl,success:function(e,t){return Xl(e,Zl.success,t)},info:function(e,t){return Xl(e,Zl.info,t)},sallaInitiated:function(){var e=window.location.href.match(/([\?\&]danger=)[^&]+/g);e&&(window.history.replaceState(null,document.title,window.location.pathname),salla.event.once("twilight::notifier.changed",(function(){e.forEach((function(e){e=decodeURI(e.replace("?danger=","").replace("&danger=",""));var t=document.createElement("div");t.innerText=e,Yl(t.innerHTML),salla.event.emit("twilight::error",e)}))})))},types:Zl};var tu=function(){function e(e,t){return this.api=e,this.event=t,new Proxy(this,{get:function(n,r){return"event"===r?t:"api"===r?e:e&&e[r]||n[r]}})}return e}();Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(e){for(var t=this;t;){if(t.matches(e))return t;t=t.parentElement}}),Element.prototype.getElementSallaData=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}if(!this.getAttribute)return;if(this.hasAttribute("data-json"))try{return JSON.parse(this.getAttribute("data-json"))}catch(e){}var i=this.getAttribute("data-function");if(i&&window[i])return"function"==typeof window[i]?this.getFilteredData((t=window[i]).call.apply(t,__spreadArray([this],n,false))):this.getFilteredData(window[i]);var o=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if(o="FORM"===this.tagName?this:o||this.closest("form")||this.closest("[salla-form-data]")||this,o&&"FORM"===o.tagName)return this.getFilteredData(new FormData(o),null,o);var a=o.querySelectorAll("[name]");if(!a.length)return this.getFilteredData();var s=Object.assign({},this.dataset);return a.forEach((function(e){if(!["checkbox","radio"].includes(e.type)||e.checked)try{var t=Salla.helpers.inputData(e.name,e.value,s);s[t.name]=t.value}catch(t){Salla.log(e.name+" can't be send")}})),this.getFilteredData(s)},Element.prototype.canEventFireHook=function(e){return!!this.hasAttribute&&this.hasAttribute(Salla.api.hooksPrefix+e.type)},Element.prototype.hasAttributeStartsWith=function(e,t){e=e.toLowerCase();for(var n=0;n<this.attributes.length;n++){var r=this.attributes[n].name.toLowerCase();if(0===r.indexOf(e))return!t||r}return!1},HTMLFormElement.prototype.getAjaxFormData=function(e){var t=this.querySelectorAll('input[type="file"]');t.forEach((function(e){e.files.length||e.setAttribute("disabled","")}));var n=new FormData(this);return t.forEach((function(e){e.files.length||e.removeAttribute("disabled")})),{formData:this.getFilteredData(n,e),url:this.getAttribute("action"),method:this.getAttribute("method")||"post",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}},Element.prototype.getFilteredData=function(e,t,n){var r=this;if(e===void 0){e=null}if(t===void 0){t=null}if(n===void 0){n=null}return e=e||(n===null||n===void 0?void 0:n.dataset)||this.dataset,n&&this.name&&void 0!==this.value&&(e=function(e,t,n){e instanceof FormData?e.append(t,n):e[t]=n;return e}(e,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((function(i){var o=(n===null||n===void 0?void 0:n.dataset[i])||r.dataset[i];if(o){var a=window[o];if("function"==typeof a){if(!a(e,n||r,t)&&e)throw"Data failed to be pass verify function window.".concat(o,"(formData, element, event)!");return a(e,n||r,t)}Salla.log("window."+o+"() not found!")}})),e},HTMLAnchorElement.prototype.getAjaxFormData=function(e){return{formData:this.getFilteredData(null,e),url:this.getAttribute("href"),method:this.dataset.type||"get",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}};var nu=function(){function e(){this.events={},this.namespace="";var e=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(e&&e.length>1?e[1]:"").toLowerCase()}e.prototype.after_init=function(){this.createDynamicFunctions()};e.prototype.createDynamicFunctions=function(){var e=this;Object.keys(this.events).forEach((function(t){e.createDynamicEventFuns(t),e.createDynamicListenerFuns(t)}))};e.prototype.createDynamicEventFuns=function(e){if(this[e])return;var t=this;this[e]=function(){var n=[];for(var r=0;r<arguments.length;r++){n[r]=arguments[r]}return t.dispatch.apply(t,__spreadArray([e],n,false))}};e.prototype.createDynamicListenerFuns=function(e){var t="on"+e.charAt(0).toUpperCase()+e.slice(1);if(this[t])return;var n=this;this[t]=function(t){var r=this;return n.on(e,(function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}return Vl(r,void 0,void 0,(function(){return __generator(this,(function(n){return[2,t.apply(void 0,e)]}))}))}))}};e.prototype.getEventName=function(e){return e=this.events[e]||e,!this.namespace||e.includes("::")?e:this.namespace+Salla.event.delimiter+e};e.prototype.dispatch=function(e){var t;var n=[];for(var r=1;r<arguments.length;r++){n[r-1]=arguments[r]}return(t=Salla.event).emitAsync.apply(t,__spreadArray([this.getEventName(e)],n,false))};e.prototype.on=function(e,t,n){if(n===void 0){n={}}return Salla.event.addListener(this.getEventName(e),t,n)};e.prototype.once=function(e,t){return Salla.event.once(this.getEventName(e),t)};return e}();function ru(e){e&&e.sallaInitiated&&!e.initiated&&(e.sallaInitiated(),e.initiated=!0)}Salla.event.auth=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="auth",t.events={login:"login",logout:"logout",codeSent:"code.sent",codeNotSent:"code.not-sent",verified:"verified",verificationFailed:"verification.failed",loggedIn:"logged.in",registered:"registered",registrationFailed:"registration.failed",loggedOut:"logged.out",failedLogout:"failed.logout",refreshFailed:"refresh.failed",tokenFetched:"token.fetched",tokenInvalid:"token.invalid"},t.after_init();return t}t.prototype.login=function(e){return e?(e.type&&this.setTypeActionOnVerified(e.type),this.next_event=e.next_event||null,this.dispatch.apply(this,__spreadArray(["login"],arguments,false))):(this.next_event=null,this.dispatch.apply(this,__spreadArray(["login"],arguments,false)))};t.prototype.loggedIn=function(e){return Vl(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){return[2,Salla.profile.info().finally((function(){return t.dispatch("loggedIn",e)}))]}))}))};t.prototype.setTypeActionOnVerified=function(e){this.type_action_on_verified=e};t.prototype.getTypeActionOnVerified=function(){return this.type_action_on_verified||"redirect"};return t}(nu)),Salla.event.cart=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="cart",t.events={latestFetched:"latest.fetched",latestFailed:"latest.failed",updated:"updated",itemUpdated:"item.updated",itemUpdatedFailed:"item.updated.failed",itemAdded:"item.added",itemAddedFailed:"item.added.failed",itemDeleted:"item.deleted",itemDeletedFailed:"item.deleted.failed",submitted:"submitted",submitFailed:"submit.failed",imageDeleted:"image.deleted",imageNotDeleted:"image.not.deleted",detailsFetched:"details.fetched",detailsNotFetched:"details.not.fetched",successReset:"success.reset",priceQuoteSucceeded:"price-quote.succeeded",priceQuoteFailed:"price-quote.failed",offersFetched:"offers.fetched",offersFailed:"offers.failed",couponAdded:"coupon.added",couponDeleted:"coupon.deleted",couponAdditionFailed:"coupon.addition.failed",couponDeletionFailed:"coupon.deletion.failed",quickOrderSettingFetched:"quick-order.fetched",quickOrderSettingFailed:"quick-order.failed",quickOrderSucceeded:"quick-order.succeeded",quickOrderFailed:"quick-order.failed",submitting:"submitting"},t.after_init();return t}t.prototype.updated=function(e){var t;return Salla.cookie.set("fresh_summary",1),e&&"object"==typeof e?(e.offer&&salla.product.event.offerExisted(e.offer),e.redirect&&(salla.log("The current cart is purchased!"),salla.cart.api.reset()),e.cart?(salla.storage.set("cart.summary",{total:e.cart.total,sub_total:e.cart.sub_total,discount:e.cart.discount,tax_amount:e.cart.tax_amount,total_discount:e.cart.total_discount,real_shipping_cost:e.cart.real_shipping_cost,count:e.cart.count,shipping_cost:((t=e.cart.free_shipping_bar)===null||t===void 0?void 0:t.has_free_shipping)?0:e.cart.real_shipping_cost}),this.dispatch("updated",e.cart)):void salla.log("Failed to get the cart summary!")):(Salla.logger.info("Cart summary not an object!",e),this.dispatch("updated"))};t.prototype.latestFetched=function(e){return this.updated(e.data),this.dispatch("latestFetched",e)};t.prototype.itemAdded=function(e,t){return this.updated(e.data),this.dispatch("itemAdded",e,t)};t.prototype.itemDeleted=function(e,t){return this.updated(e.data),this.dispatch("itemDeleted",e,t)};t.prototype.itemUpdated=function(e,t){return this.updated(e.data),this.dispatch("itemUpdated",e,t)};t.prototype.couponAdded=function(e,t){return this.updated(e.data),this.dispatch("couponAdded",e,t)};t.prototype.couponDeleted=function(e,t){return this.updated(e.data),this.dispatch("couponDeleted",e,t)};return t}(nu)),Salla.event.order=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="order",t.events={canceled:"canceled",notCanceled:"not.canceled",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",invoiceSent:"invoice.sent",invoiceNotSent:"invoice.not.sent",ordersFetched:"order.fetched",ordersNotFetched:"order.not.fetched"},t.after_init();return t}return t}(nu)),Salla.event.scope=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="scope",t.events={fetched:"fetched",notFetched:"not.fetched",productAvailabilityFetched:"product-availability.fetched",productAvailabilityNotFetched:"product-availability.not.fetched",changeSucceeded:"changed",changeFailed:"not.changed"},t.after_init();return t}return t}(nu)),Salla.event.rating=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="rating",t.events={orderNotFetched:"order.not.fetched",orderFetched:"order.fetched",storeRated:"store.rated",storeFailed:"store.failed",productsRated:"products.rated",productsFailed:"products.failed",shippingRated:"shipping.rated",shippingFailed:"shipping.failed"},t.after_init();return t}return t}(nu)),Salla.event.booking=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.events={added:"added",additionFailed:"addition.failed"},t.after_init();return t}return t}(nu)),Salla.event.comment=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="comment",t.events={added:"added",additionFailed:"addition.failed",fetched:"fetched",fetchFailed:"fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.landing=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="landing",t.events={detailsFetched:"order.fetched",getDetailsFailed:"get.details.failed",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",breadcrumbFetched:"breadcrumb.fetched",breadcrumbFetchFailed:"breadcrumb.fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.loyalty=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="loyalty",t.events={exchangeSucceeded:"exchange.succeeded",exchangeFailed:"exchange.failed",programFetched:"program.fetched",programNotFetched:"program.not.fetched",resetSucceeded:"exchange-reset.succeeded",resetFailed:"exchange-reset.failed"},t.after_init();return t}t.prototype.exchangeSucceeded=function(e,t){return salla.cart.event.updated(e.data),this.dispatch("exchangeSucceeded",e,t)};t.prototype.resetSucceeded=function(e){return salla.cart.event.updated(e.data),this.dispatch("resetSucceeded",e)};return t}(nu)),Salla.event.product=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="product",t.events={priceUpdated:"price.updated",priceUpdateFailed:"price.updated.failed",availabilitySubscribed:"availability.subscribed",availabilitySubscribeFailed:"availability.subscribe.failed",categoriesFetched:"categories.fetched",categoriesFailed:"categories.failed",searchFailed:"search.failed",searchResults:"search.results",offerExisted:"offer.existed",fetchOffersFailed:"fetch.offers.failed",offersFetched:"offers.fetched",sizeGuideFetched:"size-guide.fetched",sizeGuideFetchFailed:"size-guide.failed",giftFetched:"gift.fetched",giftFetchFailed:"gift.failed",detailFetched:"detail.fetched",detailFetchFailed:"detail.failed",addGiftToCartSucceeded:"gift.add-to-cart.succeeded",addGiftToCartFailed:"gift.add-to-cart.failed",giftImageUploadSucceeded:"gift.image-upload.succeeded",giftImageUploadFailed:"gift.image-upload.failed",productListFetchSucceeded:"fetch.succeeded",productListFetchFailed:"fetch.failed",productOptionsFetched:"options.fetched",productOptionsNotFetched:"options.not.fetched"},t.after_init();return t}return t}(nu)),Salla.event.profile=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="profile",t.events={updated:"updated",updateFailed:"update.failed",verificationCodeSent:"verification.code.sent",updateContactsFailed:"update.contacts.failed",verified:"verified",unverified:"unverified",infoFetched:"info.fetched",infoNotFetched:"info.not.fetched",settingsUpdated:"settings.updated",updateSettingsFailed:"update.settings.failed",deleted:"deleted",notDeleted:"not.deleted"},t.after_init();return t}return t}(nu)),Salla.event.currency=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="currency",t.events={changed:"changed",failed:"failed",fetched:"fetched",failedToFetch:"failed.to.fetch"},t.after_init();return t}return t}(nu)),Salla.event.document=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="document",t.events={click:"click",change:"change",submit:"submit",keyup:"keyup",leaving:"leaving",request:"request",requestFailed:"request.failed"},t.after_init();return t}t.prototype.onClick=function(e,t){this.fireCallableFuns("click",e,t)};t.prototype.onChange=function(e,t){this.fireCallableFuns("change",e,t)};t.prototype.onSubmit=function(e,t){this.fireCallableFuns("submit",e,t)};t.prototype.onKeyup=function(e,t){this.fireCallableFuns("keyup",e,t)};t.prototype.fireCallableFuns=function(e,t,n){this.on(e,(function(e){"function"!=typeof t?"function"==typeof n&&e.target.matches(t)&&n(e):t(e)}))};t.prototype.fireEvent=function(e,t){var n=[];for(var r=2;r<arguments.length;r++){n[r-2]=arguments[r]}return this.fireEventForElements.apply(this,__spreadArray([e,t,!1],n,false))};t.prototype.fireEventForAll=function(e,t){var n=[];for(var r=2;r<arguments.length;r++){n[r-2]=arguments[r]}return this.fireEventForElements.apply(this,__spreadArray([e,t,!0],n,false))};t.prototype.fireEventForElements=function(e,t,n){var r=this;var i=[];for(var o=3;o<arguments.length;o++){i[o-3]=arguments[o]}if("string"==typeof e){if(n)return document.querySelectorAll(e).forEach((function(e){return r.fireEventForElements.apply(r,__spreadArray([e,t,!1],i,false))}));e=document.querySelector(e)}if(!e)return void salla.log("Failed To get element to fire event: "+t);var a=new(CustomEvent.bind.apply(CustomEvent,__spreadArray([void 0,t],i,false)));return e.dispatchEvent(a)};return t}(nu)),Salla.event.wishlist=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="wishlist",t.events={added:"added",removed:"removed",additionFailed:"addition.failed",removingFailed:"removing.failed"},t.after_init();return t}return t}(nu)),Salla.event.infiniteScroll=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="infiniteScroll",t.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},t.after_init();return t}return t}(nu)),Salla.event.notifications=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="notifications",t.events={fetched:"fetched",fetchFailed:"fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.component=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="component",t.events={menuFetched:"menus.fetched",menuFetchFailed:"menus.fetch.failed",reviewsFetched:"reviews.fetched",reviewsFetchFailed:"reviews.fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.advertisement=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="advertisement",t.events={fetched:"advertisement.fetched",fetchFailed:"advertisement.not.fetched"},t.after_init();return t}return t}(nu)),Salla.event.navigation=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="navigation",t.events={breadcrumbFetched:"breadcrumb.fetched",breadcrumbFetchFailed:"breadcrumb.fetch.failed"},t.after_init();return t}return t}(nu)),Salla.event.metadata=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="metadata",t.events={valueFetched:"value.fetched",valueNotFetch:"value.not.fetched"},t.after_init();return t}return t}(nu)),Salla.event.on("twilight::initiated",(function(){Object.keys(Salla).forEach((function(e){"object"==typeof(e=Salla[e])&&(ru(e),Object.keys(e).forEach((function(t){ru(e[t])})))}))})),Salla.config.default_properties={debug:"undefined"!=typeof process&&"development"==="production",token:null,fastRequests:!0,canLeave:!0,store:{api:["group","test"].includes(window.location.hostname.split(".").pop())?window.location.origin+"/api/v1/":"https://api.salla.dev/store/v1/"},currencies:{SAR:{code:"SAR",name:"ريال سعودي",symbol:"ر.س",amount:1,country_code:"sa"}}},Salla.config.merge(Salla.config.default_properties),Salla.config.triedToGetCurrencies_=!1,Salla.config.triedToGetLanguages_=!1,Salla.config.isUser=function(){return"user"===Salla.config.get("user.type")},Salla.config.isGuest=function(){return!Salla.config.isUser()},Salla.config.languages=function(){return Vl(i,void 0,void 0,(function(){var e,t;var n,r;return __generator(this,(function(i){switch(i.label){case 0:if(Salla.config.triedToGetLanguages_)return[2,Salla.config.get("languages")];Salla.config.triedToGetLanguages_=!0;e=!0,t=[];return[4,salla.document.api.request("languages",null,"get")];case 1:return[2,((r=(n=i.sent())===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.map((function(n){e&&(t=[],e=!1),n.code=n.code||n.iso_code,n.url=salla.url.get(n.code),n.is_rtl=n.is_rtl||n.rtl,t.push(n)})),Salla.config.set("languages",t),t)]}}))}))},Salla.config.currencies=function(){return Vl(i,void 0,void 0,(function(){var e,t;var n,r;return __generator(this,(function(i){switch(i.label){case 0:if(Salla.config.triedToGetCurrencies_)return[2,Salla.config.get("currencies")];Salla.config.triedToGetCurrencies_=!0;e=!0,t={};return[4,salla.currency.api.list()];case 1:return[2,((r=(n=i.sent())===null||n===void 0?void 0:n.data)===null||r===void 0?void 0:r.map((function(n){e&&(t={},e=!1),n.country_code=n.code.substr(0,2).toLowerCase(),t[n.code]=n})),Salla.config.set("currencies",t),t)]}}))}))};var iu=function(){function e(){this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.endpointsMethods={},this.endpointsHeaders={};var e=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(e&&e.length>1?e[1]:"").toLowerCase(),this.debounce={request:void 0,time:300,enabled:!0,exclude:[]}}e.prototype.after_init=function(){};e.prototype.normalRequest=function(e,t,n){if(t===void 0){t=void 0}if(n===void 0){n=null}var r=Array.isArray(e),i=r?this.getUrl.apply(this,e):this.getUrl(e);e=r?e[0]:e,n=n||this.endpointsMethods[e]||"post";var o=this.endpointsHeaders[e];if("get"===n&&t instanceof FormData){var a={};Array.from(t.entries()).forEach((function(e){a[e[0]]=e[1]})),t={params:a}}return o&&"get"===n&&(t=t?Object.assign(t,o):o),this.webEndpoints.includes(e)?i=salla.url.get(i):"http"!==i.substring(0,4)&&(i=salla.url.api(i)),Salla.api.request(i,t,n,{headers:o})};e.prototype.request=function(e,t,n){if(t===void 0){t=void 0}if(n===void 0){n=null}return!salla.api.isFastRequestsAllowed()&&this.debounce.enabled?(this.debounce.request||(this.debounce.request=salla.helpers.debounce(this.normalRequest.bind(this),this.debounce.time)),this.debounce.request(e,t,n)):this.normalRequest(e,t,n)};e.prototype.getUrl=function(e){var t=this.endpoints[e]||e;var n=/{[^{}]+}/i;for(var r=1;r<arguments.length;r++)t=t.replace(n,arguments[r]);return t};e.prototype.event=function(){return salla.event[this.className]};return e}();var ou=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.addToCartTries=0,t.namespace="cart",t._pendingCartIdRequest=null,t.endpoints={latest:"cart/latest",latestApi:"cart/latest",details:"cart/{cart}",quickAdd:"cart/{cart}/item/{product}/quick-add",addItem:"cart/{cart}/item/{product}/add",deleteItem:"cart/{cart}/item/{item}",updateItem:"cart/{cart}/item/{item}",deleteImage:"cart/{cart}/image/{image}",uploadImage:"cart/{cart}/image",status:"cart/{cart}/status",addCoupon:"cart/{id}/coupon",deleteCoupon:"cart/{id}/coupon",getQuickOrderSettings:"checkout/quick-order",createQuickOrder:"checkout/quick-order",priceQuote:"cart/{cartId}/price-quote",offers:"offers/cart/{cartId}",giftCartDetails:"cart/{cartId}/buy-as-gift",cartGiftToCart:"cart/{cart_id}/buy-as-gift"},t.endpointsMethods={latest:"get",details:"get",status:"get",updateItem:"post",deleteItem:"delete",deleteImage:"delete",deleteCoupon:"put",getQuickOrderSettings:"get",offers:"get",giftCartDetails:"get"},t.webEndpoints=["latest"],t.latestCart=null,t.after_init(),salla.event.on("api::initiated",(function(){return salla.api.cart.getCurrentCartId(!1,"api::initiated")})),salla.event.on("auth::token.fetched",t._checkCurrentCart),salla.event.on("auth::token.invalid",t._checkCurrentCart),salla.event.on("auth::verified",(function(){return salla.api.cart.getCurrentCartId(!0,"auth::verified")}),{async:!0}),salla.event.on("twilight::initiated",(function(){return salla.api.cart.syncGuestCart()})),salla.event.on("profile::info.fetched",t._checkCurrentCart),salla.event.on("twilight::error",(function(e){return(e.includes("Cart not available")||e.includes("السلة غير متاحة"))&&salla.cart.api.reset()}));return t}t.prototype._checkCurrentCart=function(){var e,t;var n=salla.storage.get("cart"),r=(e=salla.config.get("user"))===null||e===void 0?void 0:e.id,i=(t=salla.config.get("store"))===null||t===void 0?void 0:t.id;n&&n.id&&(n.user_id===r&&n.store_id===i||(salla.log("cart",{user_id:n.user_id,store_id:n.store_id}),salla.log("current",{user_id:r,store_id:i}),salla.log("Api:: case2 => The cart is not belong to current "+(n.user_id!==r?"user":"store")+"!"),salla.cart.api.reset()),salla.url.is_page("cart")&&n.id!==salla.config.get("page.id")&&(salla.log("cart",{user_id:n.user_id,store_id:n.store_id}),salla.log("current",{user_id:r,store_id:i}),salla.log("Api:: case2 => The cart is different between storage:".concat(n.id," & session:").concat(salla.config.get("page.id")," !")),salla.cart.api.reset()))};t.prototype.getCurrentCartId=function(e,t){if(e===void 0){e=!1}if(t===void 0){t="getCurrentCartId"}return Vl(this,void 0,void 0,(function(){var n;var r=this;return __generator(this,(function(i){if(Salla.cart.api._pendingCartIdRequest)return[2,Salla.cart.api._pendingCartIdRequest];Salla.cart.api._pendingCartIdRequest=function(){return Vl(r,void 0,void 0,(function(){var n,r;return __generator(this,(function(i){switch(i.label){case 0:i.trys.push([0,,2,3]);if(!e){if(Salla.cart.api.latestCart)return[2,Salla.cart.api.latestCart.cart.id];n=Salla.storage.get("cart.id");if(n)return[2,n]}return[4,Salla.cart.api.latest(t)];case 1:r=i.sent();return[2,(Salla.cart.api.latestCart=r.data,Salla.cart.api.latestCart.cart.id)];case 2:Salla.cart.api._pendingCartIdRequest=null;return[7];case 3:return[2]}}))}))}();n=Salla.cart.api._pendingCartIdRequest;return[2,(Salla.cart.api._pendingCartIdRequest=null,n)]}))}))};t.prototype.getUploadImageEndpoint=function(e){return salla.url.api(this.getUrl("uploadImage",e||salla.storage.get("cart.id")))};t.prototype.latest=function(e){if(e===void 0){e="direct"}return this.request(salla.auth.api.isSessionless()?"latestApi":"latest",{params:{source:"",callerName:e}}).then((function(e){return salla.api.cart.set(e.data.cart),salla.event.cart.latestFetched(e),e})).catch((function(e){throw salla.api.cart.reset(),salla.event.cart.latestFailed(e),e}))};t.prototype.details=function(e,t){if(t===void 0){t=[]}return Vl(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){switch(r.label){case 0:n=e;if(n)return[3,2];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.details")];case 1:n=r.sent();r.label=2;case 2:return[2,(e=n,this.request(["details",e],{params:{with:t}}).then((function(e){return salla.cart.event.detailsFetched(e),e})).catch((function(e){throw salla.cart.event.detailsNotFetched(e),e})))]}}))}))};t.prototype.quickAdd=function(e,t,n){return Vl(this,void 0,void 0,(function(){return __generator(this,(function(r){return[2,this.addItem({id:e,quantity:t,offerType:n,endpoint:"quickAdd"})]}))}))};t.prototype.addItem=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r,i;return __generator(this,(function(o){switch(o.label){case 0:t=this.getCartPayload(e);if(!t.id){n='There is no product "id"!';return[2,(salla.cart.event.itemAddedFailed(n),salla.api.errorPromise(n))]}r=salla.form.getPossibleValue(t.payload,["endpoint"]);r&&["addItem","quickAdd"].includes(r)||(r=salla.form.getPossibleValue(t.payload,["quantity","donating_amount"])?"addItem":"quickAdd");return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.addItem")];case 1:i=o.sent();return[2,this.request([r,i,t.id],t.payload).then((function(e){return salla.cart.api.addToCartTries=0,salla.cart.event.itemAdded(e,t.id),e})).catch((function(n){if(!salla.cart.api.addToCartTries)return salla.cart.api.addToCartTries++,salla.cart.reset(),salla.cart.api.addItem(e);throw salla.cart.event.itemAddedFailed(n,t.id),n}))]}}))}))};t.prototype.deleteItem=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){switch(i.label){case 0:t=this.getCartPayload(e);if(!t.id){n='There is no "id"!';return[2,(salla.cart.event.itemDeletedFailed(n),salla.api.errorPromise(n))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.deleteItem")];case 1:r=i.sent();return[2,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}))]}}))}))};t.prototype.updateItem=function(e){var t;return Vl(this,void 0,void 0,(function(){var n,r,i;return __generator(this,(function(o){switch(o.label){case 0:n=this.getCartPayload(e);if(!n.id){r='There is no "id"!';return[2,(salla.cart.event.itemUpdatedFailed(r),salla.api.errorPromise(r))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.updateItem")];case 1:i=o.sent();return[2,("Object"===((t=n.payload.constructor)===null||t===void 0?void 0:t.name)?n.payload._method="PUT":n.payload.append("_method","PUT"),this.request(["updateItem",i,n.id],n.payload).then((function(e){return salla.cart.event.itemUpdated(e,n.id),e})).catch((function(e){throw salla.cart.event.itemUpdatedFailed(e,n.id),e})))]}}))}))};t.prototype.deleteImage=function(e){return Vl(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(r){switch(r.label){case 0:if(!(e=salla.form.getPossibleValue(e,["id","image_id","photo_id"]))){t='There is no "id"!';return[2,(salla.cart.event.imageNotDeleted(t),salla.api.errorPromise(t))]}return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.deleteImage")];case 1:n=r.sent();return[2,this.request(["deleteImage",n,e]).then((function(t){return salla.cart.event.imageDeleted(t,e),t})).catch((function(t){throw salla.cart.event.imageNotDeleted(t,e),t}))]}}))}))};t.prototype.status=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){switch(i.label){case 0:t=e;if(t)return[3,2];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.status")];case 1:t=i.sent();i.label=2;case 2:e=t;n=salla.helpers.hasApplePay();i.label=3;case 3:i.trys.push([3,5,,6]);return[4,salla.cart.event.submitting()];case 4:i.sent();return[3,6];case 5:r=i.sent();salla.log("Error on: salla.cart.event.submitting()");return[3,6];case 6:return[2,this.request(["status",e],{params:{has_apple_pay:n}})]}}))}))};t.prototype.submit=function(){return Vl(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:if(salla.config.isGuest())return[2,(salla.log("it looks that the current user is not logged-in, lets login then submit"),salla.cart.loginOnCartPage())];e=this.status;return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.submit")];case 1:e.apply(this,[t.sent()]).then((function(e){var t;var n=(t=e.data.next_step)===null||t===void 0?void 0:t.to;if(n||(window.history.pushState({},"",salla.url.addParamToUrl("reload","empty_next_step")),window.history.pushState({},"",salla.url.addParamToUrl("acitve",!1===e.data.active?"false":"true_or_undfined")),salla.cart.reset(),window.location.reload()),!["checkout","refresh","login"].includes(n)){var r="Can't find next_step );";throw salla.cart.reset(),salla.cart.event.submitFailed(r),r}return salla.cart.event.submitted(e),"login"===n?salla.cart.loginOnCartPage():"checkout"===n?window.location.href=e.data.next_step.url+(salla.helpers.hasApplePay()?"?has_apple_pay=true":""):(window.history.pushState({},"",salla.url.addParamToUrl("reload","refresh")),void window.location.reload())})).catch((function(e){var t,n;salla.cart.api.tries=salla.cart.api.tries||0,salla.cart.reset();var r=404===((n=(t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.data)===null||n===void 0?void 0:n.status);if(r&&0===salla.cart.api.tries)return salla.cart.api.tries++,salla.log("we recived that the current cart is not found, we will try to re-submit one more time"),salla.cart.submit();throw r&&salla.error(salla.lang.get("pages.checkout.try_again")),salla.cart.event.submitFailed(e),e}));return[2]}}))}))};t.prototype.getCartPayload=function(e){var t=(e===null||e===void 0?void 0:e.data)||("object"==typeof e?e:void 0);return e=t?salla.form.getPossibleValue(t,["prod_id","product_id","item_id","id"]):e,t="object"==typeof t?t:void 0,{id:e,payload:t}};t.prototype.normalRequest=function(t,n,r){var i=this;if(n===void 0){n=void 0}if(r===void 0){r=null}return e.prototype.normalRequest.call(this,t,n,r).catch((function(e){return Vl(i,void 0,void 0,(function(){var t;return __generator(this,(function(n){throw 403===((t=e===null||e===void 0?void 0:e.response)===null||t===void 0?void 0:t.status)&&(this.reset(),salla.error(salla.lang.get("pages.checkout.try_again"))),e}))}))}))};t.prototype.reset=function(){salla.api.cart.latestCart=null,salla.storage.remove("cart"),salla.cookie.clearCookieByPrefix(salla.api.cart.getCartCookiePrefix()),salla.cart.event.successReset()};t.prototype.addCoupon=function(e){return Vl(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(r){switch(r.label){case 0:if(e=e.data||e,!(e=salla.form.getPossibleValue(e,["coupon"]))){t=new Error('There is no "Coupon Code"!');return[2,(t.name="EmptyCoupon",salla.event.cart.couponAdditionFailed(t),salla.api.errorPromise(t))]}return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.addCoupon")];case 1:n=r.sent();return[2,this.request(["addCoupon",n],{coupon:e}).then((function(e){return salla.event.cart.couponAdded(e,n),e})).catch((function(e){throw salla.event.cart.couponAdditionFailed(e,n),e}))]}}))}))};t.prototype.deleteCoupon=function(){return Vl(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.deleteCoupon")];case 1:e=t.sent();return[2,this.request(["deleteCoupon",e],{}).then((function(t){return salla.event.cart.couponDeleted(t,e),t})).catch((function(t){throw salla.event.cart.couponDeletionFailed(t,e),t}))]}}))}))};t.prototype.getQuickOrderSettings=function(){return this.request("getQuickOrderSettings").then((function(e){return salla.event.cart.quickOrderSettingFetched(e),e})).catch((function(e){throw salla.event.cart.quickOrderSettingFailed(e),e}))};t.prototype.createQuickOrder=function(e){return this.request("createQuickOrder",e).then((function(e){return salla.event.cart.quickOrderSucceeded(e),e})).catch((function(e){throw salla.event.cart.quickOrderFailed(e),e}))};t.prototype.priceQuote=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r,i;return __generator(this,(function(o){switch(o.label){case 0:if(!salla.config.isGuest())return[3,1];t=(salla.auth.api.setAfterLoginEvent("cart::priceQuote",e),void salla.event.dispatch("login::open"));return[3,4];case 1:n=this.request;r=["priceQuote"];i=e;if(i)return[3,3];return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.priceQuote")];case 2:i=o.sent();o.label=3;case 3:t=n.apply(this,[r.concat([i])]).then((function(e){return salla.cart.api.reset(),salla.event.cart.priceQuoteSucceeded(e).then((function(){return setTimeout((function(){return window.location.href=salla.url.get("/")}),1e3),e}))})).catch((function(e){return salla.event.cart.priceQuoteFailed(e).then((function(){var t;throw 404===((t=e.error)===null||t===void 0?void 0:t.code)&&window.location.reload(),e}))}));o.label=4;case 4:return[2,t]}}))}))};t.prototype.loginOnCartPage=function(){salla.auth.setCanRedirect(!1),salla.event.dispatch("login::open",{withoutReload:!0}),salla.auth.event.onLoggedIn((function(){salla.event.dispatch("login::close"),salla.cart.submit()}))};t.prototype.set=function(e){salla.storage.set("cart",e),salla.api.cart.syncGuestCart()};t.prototype.offers=function(){return Vl(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.cart.api.getCurrentCartId(!1,"salla.api.cart.offers")];case 1:e=t.sent();return[2,this.request(["offers",e]).then((function(e){return salla.event.cart.offersFetched(e),e})).catch((function(e){throw salla.event.cart.offersFailed(e),e}))]}}))}))};t.prototype.getGiftCartDetails=function(){return Vl(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.getGiftCartDetails")];case 1:e=t.sent();return[2,this.request(["giftCartDetails",e]).then((function(t){return salla.product.event.giftFetched(t,e),t})).catch((function(t){throw salla.product.event.giftFetchFailed(t,e),t}))]}}))}))};t.prototype.addCartGiftToCart=function(e,t){if(t===void 0){t=!1}return Vl(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){switch(r.label){case 0:return[4,salla.api.cart.getCurrentCartId(!1,"salla.api.cart.addCartGiftToCart")];case 1:n=r.sent();return[2,this.request(["cartGiftToCart",n],e).then((function(e){return salla.product.event.addGiftToCartSucceeded(e,n),t&&(window.location.href=e.redirect),e})).catch((function(e){throw salla.product.event.addGiftToCartFailed(e,n),e}))]}}))}))};t.prototype.syncGuestCart=function(){var e,t;return Vl(this,void 0,void 0,(function(){var n,r,i,o,a,s;return __generator(this,(function(c){switch(c.label){case 0:if(!salla.config.isGuest())return[2];n=salla.api.cart.getCartCookiePrefix(),r=salla.cookie.getCookieByPrefix(n),i=salla.storage.get("cart.id");if(!(!i&&r.length))return[3,4];c.label=1;case 1:c.trys.push([1,3,,4]);return[4,salla.api.cart.latest()];case 2:o=c.sent(),a=(t=(e=o.data)===null||e===void 0?void 0:e.cart)===null||t===void 0?void 0:t.id;a&&salla.api.cart.setCartCookie(n,a);return[3,4];case 3:s=c.sent();salla.log("Failed to fetch latest cart:",s);return[3,4];case 4:salla.cookie.clearCookieByPrefix(n),i&&(salla.config.set("headers.s-cart-id",i),salla.api.cart.setCartCookie(n,i));return[2]}}))}))};t.prototype.setCartCookie=function(e,t){salla.cookie.set("".concat(e,"-").concat(t),t,1)};t.prototype.getCartCookiePrefix=function(){return"cart-id-"+salla.config.get("store.id")};return t}(iu);var au=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="loyalty",t.endpoints={getProgram:"loyalty",exchange:"loyalty/exchange",reset:"loyalty/exchange"},t.endpointsMethods={getProgram:"get",reset:"put"},t.after_init();return t}t.prototype.getProgram=function(){return this.request("getProgram").then((function(e){return salla.loyalty.event.programFetched(e),e})).catch((function(e){throw salla.loyalty.event.programNotFetched(e),e}))};t.prototype.exchange=function(e,t){if(t===void 0){t=null}return Vl(this,void 0,void 0,(function(){var n,r,i;return __generator(this,(function(o){switch(o.label){case 0:if(!(e=salla.form.getPossibleValue(e,["id","loyalty_prize_id","prize_id"]))){n="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.exchangeFailed(n),salla.api.errorPromise(n))]}r=t;if(r)return[3,2];return[4,salla.cart.getCurrentCartId(!1,"salla.api.loyalty.exchange")];case 1:r=o.sent();o.label=2;case 2:if(!(t=r)){i="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.exchangeFailed(i),salla.api.errorPromise(i))]}return[2,this.request("exchange",{loyalty_prize_id:e,cart_id:t}).then((function(t){return salla.loyalty.event.exchangeSucceeded(t,e),t})).catch((function(t){throw salla.loyalty.event.exchangeFailed(t,e),t}))]}}))}))};t.prototype.reset=function(e){if(e===void 0){e=null}return Vl(this,void 0,void 0,(function(){var t,n;return __generator(this,(function(r){switch(r.label){case 0:t=e;if(t)return[3,2];return[4,salla.cart.getCurrentCartId(!1,"salla.api.loyalty.reset")];case 1:t=r.sent();r.label=2;case 2:if(!(e=t)){n="Unable to find cart id. Please provide one.";return[2,(salla.loyalty.event.resetFailed(n),salla.api.errorPromise(n))]}return[2,this.request("reset",{cart_id:e}).then((function(e){return salla.loyalty.event.resetSucceeded(e),e})).catch((function(e){throw salla.loyalty.event.resetFailed(e),e}))]}}))}))};return t}(iu);var su=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="auth",t.canRedirect_=!0,t.afterLoginEvent={event:null,payload:null},t.endpoints={login:"auth/{type}/send_verification",resend:"auth/resend_verification",verify:"auth/{type}/verify",register:"auth/register",logout:"logout",refresh:"auth/refresh"},t.webEndpoints=["logout","auth/jwt","refresh"],t.endpointsMethods={logout:"get"},t.inIframe=salla.helpers.isIframe(),t.after_init();return t}t.prototype.setAfterLoginEvent=function(e,t){salla.api.auth.afterLoginEvent={event:e,payload:t}};t.prototype.setCanRedirect=function(e){salla.api.auth.canRedirect_=e};t.prototype.canRedirect=function(){return salla.api.auth.canRedirect_&&!salla.api.auth.afterLoginEvent.event};t.prototype.login=function(e){(e===null||e===void 0?void 0:e.data)&&(e=e.data);var t=salla.form.getPossibleValue(e,["type"]);if(!["email","mobile"].includes(t)){var n="Login type should be in: [email, mobile]";return salla.auth.event.codeNotSent(n),salla.api.errorPromise(n)}return this.request(["login",t],e).then((function(e){return salla.auth.event.codeSent(e,t),e})).catch((function(e){throw salla.auth.event.codeNotSent(e,t),salla.auth.api.trackBlockedError(e,"login"),e}))};t.prototype.verify=function(e,t){if(t===void 0){t=!0}return Vl(this,void 0,void 0,(function(){var n,r,i;return __generator(this,(function(o){switch(o.label){case 0:n=salla.form.getPossibleValue(e,["type"]);if(!n){r="Failed to know what's login type!";return[2,(salla.auth.event.verificationFailed(r),salla.api.errorPromise(r))]}t=!1!==salla.form.getPossibleValue(e,["supportWebAuth"])&&t,salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event);return[4,salla.auth.api.request(["verify",n],e)];case 1:i=o.sent();return[2,200!==(i===null||i===void 0?void 0:i.status)?(salla.auth.event.verificationFailed(i,n),salla.api.errorPromise(i)):salla.auth.api.handlAfterAuthenticatedResponse(i,t)]}}))}))};t.prototype.handlAfterAuthenticatedResponse=function(e,t){var n;return Vl(this,void 0,void 0,(function(){var r,i,o;return __generator(this,(function(a){switch(a.label){case 0:e.data||(e={data:e});r="authenticated"===((n=e.data)===null||n===void 0?void 0:n.case);r&&salla.auth.event.tokenFetched(e.data.token);i=t&&!this.inIframe&&!this.isSessionless();if(!i)return[3,2];return[4,salla.auth.api.request("auth/jwt",{callerName:"salla.auth.api.handlAfterAuthenticatedResponse"})];case 1:i=a.sent();a.label=2;case 2:i;o=r;if(!o)return[3,4];return[4,salla.auth.event.loggedIn(e).then((function(){return salla.auth.api.afterUserLogin()}))];case 3:o=a.sent();a.label=4;case 4:o;return[4,salla.auth.event.verified(e,e.data.verification.type)];case 5:return[2,(a.sent(),salla.api.successPromise(e))]}}))}))};t.prototype.resend=function(e){var t;return(e=e.data||e).type=e.type||"mobile","mobile"!==e.type||e.phone&&e.country_code?"email"!==e.type||e.email?this.request("resend",e).then((function(t){return salla.auth.event.codeSent(t,e),t})).catch((function(t){throw salla.auth.event.codeNotSent(t,e),salla.auth.api.trackBlockedError(t,"resend"),t})):(salla.auth.event.codeNotSent(t="There is no email!",e),salla.api.errorPromise(t)):(salla.auth.event.codeNotSent(t="There is no phone or country_code!",e),salla.api.errorPromise(t))};t.prototype.register=function(e){var t=this;var n;return e.data&&(n=e.element,e=e.data),salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event),this.request("register",e).then((function(e){return Vl(t,void 0,void 0,(function(){var t,r;var i;return __generator(this,(function(o){switch(o.label){case 0:salla.auth.event.registered.call(n,e);t="authenticated"===((i=e.data)===null||i===void 0?void 0:i.case);if(!t)return[3,3];salla.auth.event.tokenFetched(e.data.token);r=!this.inIframe&&!this.isSessionless();if(!r)return[3,2];return[4,salla.auth.request("auth/jwt",{callerName:"salla.auth.api.register"})];case 1:r=o.sent();o.label=2;case 2:t=(r,salla.auth.event.loggedIn(e),salla.auth.api.afterUserLogin());o.label=3;case 3:return[2,(t,e)]}}))}))})).catch((function(e){throw salla.auth.event.registrationFailed.call(n,e),salla.auth.api.trackBlockedError(e,"register"),e}))};t.prototype.handleIframeReadyAction=function(e,t){var n;(n=e.contentWindow)===null||n===void 0?void 0:n.postMessage({source:"logout",type:"init",data:{id:salla.config.get("store.id"),lang:"ar",appUrl:t,apiUrl:salla.config.get("store.api").replace(/\/+$/,""),settings:salla.config.all(),storage:{}}},"*")};t.prototype.appendIframeAndLogout=function(){var e=this;return new Promise((function(t){var n=salla.config.get("login.url","https://accounts.salla.com");var r=document.createElement("iframe");r.style.display="none",r.src="".concat(n,"/logout");var i=function(o){if("login"!==o.data.source)return;var a=o.data.type.replace("iframe::","");if(salla.log("iframe::logout-iframe message received",o.data),["logged-out","ready"].includes(a)){if("ready"===a)return e.handleIframeReadyAction(r,n);window.removeEventListener("message",i),r.remove(),t()}};window.addEventListener("message",i),document.body.appendChild(r)}))};t.prototype.logout=function(e){var t=this;if(e===void 0){e="twilight"}return salla.storage.clearAll(),salla.cookie.clearAll(),e=encodeURI(e),salla.auth.event.loggedOut().then((function(){return t.appendIframeAndLogout()})).then((function(){var t=salla.url.get("logout?from=".concat(e));console.log("Going to ".concat(t,", to do any thing before this action use: salla.auth.even.onLoggedOut(()=>{...})"));try{location.href=t}catch(e){salla.log(e)}})).catch((function(e){return console.error("Error during logout:",e)}))};t.prototype.refresh=function(){return this.request("refresh").then((function(e){return salla.auth.event.tokenFetched(e.data.token),e})).catch((function(e){throw salla.auth.event.refreshFailed(e),e}))};t.prototype.afterUserLogin=function(){this.afterLoginEvent.event&&salla.event.emit(this.afterLoginEvent.event,this.afterLoginEvent.payload)};t.prototype.isSessionless=function(){return"sessionless"===salla.config.get("auth.mode")};t.prototype.trackBlockedError=function(e,t){var n,r;blockedByProxy=void 0===((r=(n=e===null||e===void 0?void 0:e.response)===null||n===void 0?void 0:n.headers)===null||r===void 0?void 0:r["s-ray"]),blockedByProxy&&salla.analytics.track("BlockedByProxy",{class:"auth",function:t,reason:"non-server-request",message:e.message})};return t}(iu);var cu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="order",t.endpoints={cancel:"orders/cancel/{id}",createCartFromOrder:"reorder/{id}",sendInvoice:"orders/send/{id}",fetch:"orders"},t.endpointsMethods={createCartFromOrder:"get",fetch:"get"},t.after_init();return t}t.prototype.show=function(e){var t=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["id","order_id"]);salla.event.dispatch("mobile::order.placed",{order_id:t}),location.href=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["url"])};t.prototype.cancel=function(e){return e=e||Salla.config.get("page.id"),this.request(["cancel",e],{params:{has_apple_pay:salla.helpers.hasApplePay()}}).then((function(t){return salla.event.order.canceled(t,e),t})).catch((function(t){throw salla.event.order.notCanceled(t,e),t}))};t.prototype.createCartFromOrder=function(e){return e=e||salla.config.get("page.id"),this.request(["createCartFromOrder",e]).then((function(t){return salla.cart.reset(),salla.event.order.orderCreated(t,e),window.location.href=t.data.url,t})).catch((function(t){throw salla.event.order.orderCreationFailed(t,e),t}))};t.prototype.sendInvoice=function(e){var t=salla.form.getPossibleValue(e,["id"])||salla.config.get("page.id");if(!t||isNaN(t)){var n="There is no id!";return salla.order.event.invoiceNotSent(n),salla.api.errorPromise(n)}return this.request(["sendInvoice",t],e).then((function(e){return salla.event.order.invoiceSent(e,t),e})).catch((function(e){throw salla.event.order.invoiceNotSent(e,t),e}))};t.prototype.fetch=function(e){return this.request(["fetch"],{params:e}).then((function(e){return salla.event.order.ordersFetched(e),e})).catch((function(e){throw salla.event.order.ordersNotFetched(e),e}))};return t}(iu);var lu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="product",t.previousQuery="",t.endpoints={getPrice:"products/{id}/price",availabilitySubscribe:"products/{id}/availability-notify",search:"products/search",details:"products/{product_id}/details",categories:"products/categories/{?id}",offers:"products/{product_id}/specialoffer",getSizeGuides:"products/{prod_id}/size-guides",giftProductDetails:"products/{product_id}/buy-as-gift",productGiftToCart:"products/{product_id}/buy-as-gift",giftImage:"products/buy-as-gift/image",buyNow:"products/{product_id}/buy-now",fetch:"products",fetchOptions:"products/options"},t.endpointsMethods={details:"get",giftProductDetails:"get",fetch:"get",offers:"get",fetchOptions:"get"},t.after_init();return t}t.prototype.getPrice=function(e){var t=e.data||e,n=salla.form.getPossibleValue(t,["id","prod_id","product_id"]);return this.request(["getPrice",n],"object"==typeof t?t:void 0).then((function(e){return salla.product.event.priceUpdated(e,n),e})).catch((function(e){throw salla.product.event.priceUpdateFailed(e,n),e}))};t.prototype.categories=function(e){return this.request(["categories",e||""],null,"get").then((function(e){return salla.product.event.categoriesFetched(e),e})).catch((function(e){throw salla.product.event.categoriesFailed(e),e}))};t.prototype.availabilitySubscribe=function(e){var t=e.data||e;return e=salla.form.getPossibleValue(t,["id","prod_id"]),this.request(["availabilitySubscribe",e],"object"==typeof t?t:void 0).then((function(t){return salla.product.event.availabilitySubscribed(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribeFailed(t,e),t}))};t.prototype.search=function(e){var t;var n=e.data;if(n||(n={params:"string"==typeof e?{query:e}:e}),!(e=n instanceof FormData?n.get("query"):n.query||((t=n.params)===null||t===void 0?void 0:t.query))){var r='There is no "query"!';return salla.product.event.searchFailed(r),salla.api.errorPromise(r)}if(e===salla.api.product.previousQuery){var i="Query is same as previous one!";return salla.product.event.searchFailed(i),salla.api.product.previousQuery=null,salla.api.errorPromise(i)}return salla.api.product.previousQuery=e,this.request("search",n,"get").then((function(t){return salla.product.event.searchResults(t,e),t})).catch((function(t){throw salla.product.event.searchFailed(t,e),t}))};t.prototype.offers=function(e){if(!(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)|e,["product_id","id"]))){var t='There is no "product_id"!';return salla.product.event.fetchOffersFailed(t),salla.api.errorPromise(t)}return this.request(["offers",e]).then((function(t){return salla.product.event.offersFetched(t,e),t})).catch((function(t){throw salla.product.event.fetchOffersFailed(t,e),t}))};t.prototype.getSizeGuides=function(e){return this.request("products/".concat(e,"/size-guides"),null,"get").then((function(t){return salla.product.event.sizeGuideFetched(t,e),t})).catch((function(t){throw salla.product.event.sizeGuideFetchFailed(t,e),t}))};t.prototype.getGiftProductDetails=function(e){return this.request(["giftProductDetails",e]).then((function(t){return salla.product.event.giftFetched(t,e),t})).catch((function(t){throw salla.product.event.giftFetchFailed(t,e),t}))};t.prototype.getDetails=function(e,t){if(t===void 0){t=[]}if(!Array.isArray(t)){var n="withItems should be array.";return salla.product.event.detailFetchFailed(n),salla.api.errorPromise(n)}if(!e){var r="productId is not passed.";return salla.product.event.detailFetchFailed(r),salla.api.errorPromise(r)}return this.request(["details",e],{params:{with:t}}).then((function(t){return salla.product.event.detailFetched(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribeFailed(t,e),t}))};t.prototype.addProductGiftToCart=function(e,t,n){if(n===void 0){n=!1}return this.request(["productGiftToCart",e],t).then((function(t){return salla.product.event.addGiftToCartSucceeded(t,e),n&&(window.location.href=t.redirect),t})).catch((function(t){throw salla.product.event.addGiftToCartFailed(t,e),t}))};t.prototype.uploadGiftImage=function(e){return this.request("giftImage",e).then((function(e){return salla.product.event.giftImageUploadSucceeded(e),e})).catch((function(e){throw salla.product.event.giftImageUploadFailed(e),e}))};t.prototype.fetch=function(e){var t=this;if(!e.source){var n="Source cannot be empty. Please provide one.";return salla.product.event.productListFetchFailed(n),salla.api.errorPromise(n)}var r=!e.source_value,i="string"==typeof e.source_value&&"[]"===e.source_value,o=Array.isArray(e.source_value)&&!e.source_value.length;if((r||i||o)&&!["offers","latest","sales","wishlist","top-rated"].includes(e.source)){var a="Source value cannot be empty. Please provide one.";return salla.product.event.productListFetchFailed(a),salla.api.errorPromise(a)}if(["categories","brands","tags","selected"].includes(e.source)&&!Array.isArray(e.source_value)){var s="SourceValue type error. Expected an array.";return salla.product.event.productListFetchFailed(s),salla.api.errorPromise(s)}if("search"===e.source&&"string"!=typeof e.source_value){var c="SourceValue type error. Expected a string.";return salla.product.event.productListFetchFailed(c),salla.api.errorPromise(c)}if("related"===e.source&&isNaN(e.source_value)){var l="SourceValue type error. Expected a number.";return salla.product.event.productListFetchFailed(l),salla.api.errorPromise(l)}return this.request(this.endpoints.fetch,{params:e},"get").then((function(e){return Vl(t,void 0,void 0,(function(){return __generator(this,(function(t){return[2,(salla.product.event.productListFetchSucceeded(e),e)]}))}))})).catch((function(e){throw salla.product.event.productListFetchFailed(e),e}))};t.prototype.fetchOptions=function(e,t){if(t===void 0){t={}}if(!e||0===e.length){var n="At least one product ID is required. Please provide a valid list of product IDs.";return salla.product.event.productOptionsNotFetched(n),salla.api.errorPromise(n)}var r=t.with,i=r===void 0?[]:r,o={selected:e};return i.length>0&&(o.with=i),this.request(this.endpoints.fetchOptions,{params:o},"get").then((function(e){return salla.product.event.productOptionsFetched(e),e})).catch((function(e){throw salla.product.event.productOptionsNotFetched(e),e}))};return t}(iu);var uu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="profile",t.endpoints={info:"auth/user",update:"profile/update",updateContacts:"profile/contacts/update",updateSettings:"profile/settings",verify:"profile/verify",delete:"profile"},t.endpointsMethods={delete:"delete"},t.after_init();return t}t.prototype.info=function(){return this.request("info",null,"get").then((function(e){var t={id:e.data.id,type:"user",email:e.data.email,mobile:e.data.phone.code+e.data.phone.number,country_code:e.data.phone.country,language_code:e.data.language,currency_code:e.data.currency,notifications:e.data.notifications,pending_orders:e.data.pending_orders,avatar:e.data.avatar,first_name:e.data.first_name,last_name:e.data.last_name,is_hidden_name:e.data.is_hidden_name,is_notifiable:e.data.is_notifiable,can_comment:salla.config.get("user.can_comment"),fetched_at:Date.now()};return salla.config.set("user",t),salla.storage.set("user",t),salla.profile.event.infoFetched(e),e})).catch((function(e){throw salla.profile.event.infoNotFetched(e),e}))};t.prototype.update=function(e){if(Salla.config.get("store.features").includes("sso-login")){var t="SSO login is enabled. You cannot update your profile.";return Salla.error(t),Promise.reject(new Error(t))}return this.request("update",e).then((function(e){return salla.profile.event.updated(e),e})).catch((function(e){throw salla.event.profile.updateFailed(e),e}))};t.prototype.updateContacts=function(e){return this.request("updateContacts",e).then((function(e){return salla.profile.event.verificationCodeSent(e),e})).catch((function(e){throw salla.event.profile.updateContactsFailed(e),e}))};t.prototype.verify=function(e){return this.request("verify",e).then((function(e){return salla.profile.event.verified(e),e})).catch((function(e){throw salla.event.profile.unverified(e),e}))};t.prototype.updateSettings=function(e){return this.request("updateSettings",e).then((function(e){return salla.event.profile.settingsUpdated(e),e})).catch((function(e){throw salla.event.profile.updateSettingsFailed(e),e}))};t.prototype.delete=function(){return this.request("delete").then((function(e){return salla.storage.clearAll(),salla.cookie.clearAll(),salla.auth.api.appendIframeAndLogout().then((function(){salla.event.profile.deleted(e),window.location.href=salla.url.get("logout")})),e})).catch((function(e){throw salla.event.profile.notDeleted(e),e}))};return t}(iu);var du=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="comment",t.endpoints={addComment:"{type}/{id}/comments",comments:"/comments"},t.after_init();return t}t.prototype.add=function(e){if((e===null||e===void 0?void 0:e.data)&&(e=e.data),"string"==typeof(e=this.getCommentPayload(e,!0)))return salla.event.comment.additionFailed(e),salla.api.errorPromise(e);if(!e.comment){var t="can't find comment content!";return salla.event.comment.additionFailed(t),salla.api.errorPromise(t)}return this.request(["addComment","blog"==e.type?"blogs":e.type,e.id],{comment:e.comment}).then((function(t){return salla.event.comment.added(t,e.id),t})).catch((function(t){throw salla.event.comment.additionFailed(t,e.id),t}))};t.prototype.getCommentPayload=function(e,t){if(t===void 0){t=!1}var n={};if(["id","type","comment","per_page","page","sort"].forEach((function(t){var r=salla.form.getPossibleValue(e,[t]);r&&(n[t]=r)})),!t){var r=e.ids;if(r&&(n.ids=Array.isArray(r)?r:[r]),!n.ids||!n.ids.length)return"Failed to get ids!"}return n.type&&["products","pages","product","page","blogs","blog"].includes(n.type)?(n.type+=["product","page"].includes(n.type)?"s":"",n):"Failed to get type one of:(products, product, page, pages, blog, blogs)!"};t.prototype.fetchComments=function(e){if("string"==typeof(e=this.getCommentPayload(e)))return salla.event.comment.fetchFailed(e),salla.api.errorPromise(e);var t={per_page:e.per_page||5,page:e.page||1,type:e.type,ids:e.ids};return e.sort&&(t.sort=e.sort),this.request(["comments"],{params:t},"get").then((function(t){return salla.event.comment.fetched(t,e),t})).catch((function(t){throw salla.event.comment.fetchFailed(t,e),t}))};t.prototype.getComments=function(e,t,n,r,i){if(n===void 0){n=1}if(r===void 0){r=5}var o=Array.isArray(t)?t:[t];return this.fetchComments({ids:o,type:"".concat(e,"s"),page:n,per_page:r,sort:i})};return t}(iu);var fu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="currency",t.endpoints={change:"/",list:"currencies"},t.endpointsMethods={change:"get",list:"get"},t.webEndpoints=["change"],t.after_init();return t}t.prototype.change=function(e){if(!(e=salla.form.getPossibleValue(e.data||e,["currency","code"]))){var t="Can't find currency code!";return salla.currency.event.failed(t),salla.api.errorPromise(t)}return this.request("change",{params:{change_currency:"",currency:e}}).then((function(t){return salla.cookie.set("fresh_summary",1),salla.storage.set("cart",""),salla.currency.event.changed(t,e),t})).catch((function(t){throw salla.currency.event.failed(t,e),t}))};t.prototype.list=function(){return this.request("list").then((function(e){return salla.currency.event.fetched(e),e})).catch((function(e){throw salla.currency.event.failedToFetch(e),e}))};return t}(iu);var pu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="document";return t}t.prototype.reload=function(){window.location.reload()};return t}(iu);var hu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="rating",t.endpoints={store:"rating/store",products:"rating/products",shipping:"rating/shipping",order:"rating/{order_id}"},t.endpointsMethods={order:"get"},t.after_init();return t}t.prototype.order=function(e){var t="object"==typeof e?e:{},n=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["order_id","id"]);if(!n){var r='There is no "order_id"!';return salla.event.rating.orderNotFetched(r),salla.api.errorPromise(r)}return this.request(["order",n],t).then((function(e){return salla.event.rating.orderFetched(e,n),e})).catch((function(e){throw salla.event.rating.orderNotFetched(e,n),e}))};t.prototype.store=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.storeFailed(t),salla.api.errorPromise(t)}return this.request("store",e).then((function(t){return salla.event.rating.storeRated(t,e),t})).catch((function(t){throw salla.event.rating.storeFailed(t,e),t}))};t.prototype.products=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.productsFailed(t),salla.api.errorPromise(t)}return this.request("products",e).then((function(t){return salla.event.rating.productsRated(t,e),t})).catch((function(t){throw salla.event.rating.productsFailed(t,e),t}))};t.prototype.shipping=function(e){if(!(e=(e===null||e===void 0?void 0:e.data)||e)){var t='There is no "data"!';return salla.event.rating.shippingFailed(t),salla.api.errorPromise(t)}return this.request("shipping",e).then((function(t){return salla.event.rating.shippingRated(t,e),t})).catch((function(t){throw salla.event.rating.shippingFailed(t,e),t}))};return t}(iu);var vu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="wishlist",t.endpoints={add:"products/favorites/{id}",remove:"products/favorites/{id}"},t.endpointsMethods={remove:"delete"},t.after_init();return t}t.prototype.toggle=function(e){return salla.storage.get("salla::wishlist",[]).includes(e)?this.remove(e):this.add(e)};t.prototype.add=function(e){var t=this;var n;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(n=salla.lang.get("common.messages.must_login")),salla.error(n),salla.api.errorPromise(n)):(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["product_id","id"]))?this.request(["add",e]).then((function(n){return t.updateWishlistStorage(e),salla.wishlist.event.added(n,e),n})).catch((function(t){throw salla.wishlist.event.additionFailed(t,e),t})):(salla.wishlist.event.additionFailed(n="Failed to get product id!"),salla.api.errorPromise(n))};t.prototype.remove=function(e){var t=this;var n;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(n=salla.lang.get("common.messages.must_login")),salla.error(n),salla.api.errorPromise(n)):(e=salla.form.getPossibleValue((e===null||e===void 0?void 0:e.data)||e,["product_id","id"]))?this.request(["remove",e]).then((function(n){return t.updateWishlistStorage(e,!1),salla.wishlist.event.removed(n,e),n})).catch((function(t){throw salla.wishlist.event.removingFailed(t,e),t})):(salla.wishlist.event.removingFailed(n="Failed to get id!"),salla.api.errorPromise(n))};t.prototype.updateWishlistStorage=function(e,t){if(t===void 0){t=!0}var n=salla.storage.get("salla::wishlist",[]);t?n.push(e):n.splice(n.indexOf(e),1),salla.storage.set("salla::wishlist",n)};return t}(iu);var gu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="scopes",t.endpoints={get:"scopes",change:"scopes",getProductAvailability:"scopes/availability?product_id={id}"},t.after_init();return t}t.prototype.get=function(){return this.request("scopes",null,"get").then((function(e){return salla.scope.event.fetched(e),e})).catch((function(e){throw salla.scope.event.notFetched(e),e}))};t.prototype.change=function(e){return this.request("scopes",e).then((function(e){return salla.scope.event.changeSucceeded(e),e})).catch((function(e){throw salla.scope.event.changeFailed(e),e}))};t.prototype.getProductAvailability=function(e){if(e===void 0){e=null}return this.request("scopes/availability?product_id=".concat(e),null,"get").then((function(t){return salla.scope.event.productAvailabilityFetched(t,e),t})).catch((function(e){throw salla.scope.event.productAvailabilityNotFetched(e),e}))};return t}(iu);var mu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.endpoints={add:"cart/booking/product/{id}"},t.endpointsMethods={add:"get"};return t}t.prototype.add=function(e,t){if(t===void 0){t=!0}return Vl(this,void 0,void 0,(function(){var n;return __generator(this,(function(r){if(!e){n="Please provide product id.";return[2,(salla.booking.event.additionFailed(n),salla.api.errorPromise(n))]}return[2,this.request(["add",e]).then((function(e){return salla.booking.event.added(e),t&&"booking"===e.data.redirect.to&&(window.location.href=e.data.redirect.url),e})).catch((function(e){throw salla.booking.event.additionFailed(e),e}))]}))}))};return t}(iu);var yu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="landing",t.endpoints={getDetails:"landing/{landing_page_id}",createCartFromPage:"landing/{landing_page_id}",breadcrumbs:"breadcrumbs"},t.endpointsMethods={getDetails:"get",breadcrumbs:"get"},t.after_init();return t}t.prototype.getDetails=function(e){if(!e){var t="page landing id not passed";return salla.event.landing.getDetailsFailed(t),salla.api.errorPromise(t)}return this.request(["getDetails",e]).then((function(t){return salla.event.landing.detailsFetched(t,e),t})).catch((function(t){throw salla.event.landing.getDetailsFailed(t,e),t}))};t.prototype.createCartFromPage=function(e){if(!e){var t="page landing id not passed";return salla.event.landing.orderCreationFailed(t),salla.api.errorPromise(t)}return salla.config.isGuest()?(salla.auth.api.setAfterLoginEvent("landing::createCartFromPage",e),salla.event.dispatch("login::open"),salla.api.successPromise("")):this.request(["createCartFromPage",e]).then((function(t){return salla.event.landing.orderCreated(t,e).then((function(){return location.href=t.data.url})),t})).catch((function(t){throw salla.event.landing.orderCreationFailed(t,e),t}))};t.prototype.fetchBreadcrumbs=function(e){if(!e.page){var t="The 'page' parameter is required for the Breadcrumb API. Please provide a valid 'page' parameter.";return salla.event.landing.breadcrumbFetchFailed(t),salla.api.errorPromise(t)}if("product.single"===e.page&&!e.id&&!e.parent_id){var n="The 'id' and 'parent_id' parameters are required when the 'page' parameter is set to 'product.single'. Please provide valid values for both parameters.";return salla.event.landing.breadcrumbFetchFailed(n),salla.api.errorPromise(n)}if(["product.index","customer.orders.single","product.index.tag","page-single","landing-page","brands.single","blog.single","blog.index.author","blog.index.category","blog.index.tag"].includes(e.page)&&!e.id){var r="The 'id' parameter is required when the 'page' parameter is set to ".concat(e.page,". Please provide valid value for the 'ID' parameter.");return salla.event.landing.breadcrumbFetchFailed(r),salla.api.errorPromise(r)}return this.request("breadcrumbs",{params:e}).then((function(e){return salla.event.landing.breadcrumbFetched(e),e})).catch((function(e){throw salla.event.landing.breadcrumbFetchFailed(e),e}))};return t}(iu);var bu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="notifications",t.endpoints={fetch:"notifications"},t.endpointsMethods={fetch:"get"},t.after_init();return t}t.prototype.fetch=function(e){return this.request(["fetch"],{params:e}).then((function(e){return salla.event.notifications.fetched(e),e})).catch((function(e){throw salla.event.notifications.fetchFailed(e),e}))};return t}(iu);var wu=function(){function e(){var e=this;this.inIframe=salla.helpers.isIframe(),salla.event.on("twilight::before.ready",(function(t){return Vl(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.initiateRequest(t)];case 1:return[2,e.sent()]}}))}))})),salla.event.on("profile::info.fetched",(function(t){return e.setCurrencyAndLanguage(t)})),salla.event.on("auth::token.fetched",(function(t){salla.storage.set("token",t),e.inIframe&&salla.log("token fetched iframe"),e.inIframe&&salla.cookie.set("s-token",t,60),e.setToken(t)})),salla.event.on("auth::token.invalid",(function(){salla.storage.remove("user"),salla.storage.remove("token")})),this.notifier_handler_disabled=!1,this.axios=yo.create({baseURL:Salla.config.get("store.api",Salla.config.get("store.url")),headers:{common:{"X-Requested-With":"XMLHttpRequest","S-SOURCE":"twilight","S-APP-VERSION":"v2.0.0","S-APP-OS":"browser","cache-control":"no-cache"}}}),Salla.onReady((function(){Salla.helpers.url.is_page("cart")&&Salla.config.set("store.settings.use_sar_symbol",!1)})),this.axios.interceptors.request.use((function(e){return"preview"===Salla.config.get("theme.mode")&&(e.url=Salla.url.addParamToUrl("use_username_url",1,e.url)),["coupon","price","item"].some((function(t){return e.url.includes(t)}))&&!e.url.includes("add")&&Salla.config.set("store.settings.use_sar_symbol",!1),e}),(function(e){return Promise.reject(e)}))}e.prototype.getHeaders=function(){return this.axios.defaults.headers.common};e.prototype.getHeader=function(e){var t;return(t=Object.entries(this.getHeaders()).filter((function(t){var n=t[0],r=t[1];return n.toLowerCase()===e.toLowerCase()}))[0])===null||t===void 0?void 0:t[1]};e.prototype.setHeaders=function(e){var t=this;return Object.entries(e).forEach((function(e){return t.setHeader(e[0],e[1])})),this};e.prototype.setHeader=function(e,t){return salla.infiniteScroll.fetchOptions.headers[e]=this.axios.defaults.headers.common[e]=t,this};e.prototype.withoutNotifier=function(e){return Vl(this,void 0,void 0,(function(){var t=this;return __generator(this,(function(n){switch(n.label){case 0:this.notifier_handler_disabled=!0;return[4,e().finally((function(){t.notifier_handler_disabled=!1}))];case 1:return[2,n.sent()]}}))}))};e.prototype.initiateRequest=function(e){var t,n,r;return Vl(this,void 0,void 0,(function(){var i,o;return __generator(this,(function(a){switch(a.label){case 0:this.axios.defaults.baseURL=Salla.config.get("store.api",Salla.config.get("store.url")),this.setHeaders(__assign({"Store-Identifier":Salla.config.get("store.id"),currency:((t=e.user)===null||t===void 0?void 0:t.currency_code)||"SAR","accept-language":salla.lang.getLocale(),"s-user-id":(n=e.user)===null||n===void 0?void 0:n.id,"s-country":(r=e.user)===null||r===void 0?void 0:r.country_code},e.headers||{}));i=Salla.storage.get("scope",Salla.config.get("store.scope"));i&&this.setHeaders({"s-scope-type":i.type,"s-scope-id":i.id});o=Salla.storage.session.get("s-utms");o&&this.setHeaders(o);return[4,this.injectTokenToTheRequests(e)];case 1:a.sent(),salla.storage.get("affiliate_code")&&this.setHeader("s-affiliate-code",salla.storage.get("affiliate_code"));return[2]}}))}))};e.prototype.injectTokenToTheRequests=function(e){var t,n;return Vl(this,void 0,void 0,(function(){var r,i,o,a,s,c,l,u,d,f,p;var h=this;return __generator(this,(function(v){switch(v.label){case 0:r=salla.storage.get("token"),i="guest"===((t=e.user)===null||t===void 0?void 0:t.type),o=parseInt(((n=e.user)===null||n===void 0?void 0:n.id)||0),a=parseInt(salla.storage.get("user.id")||0),s=salla.auth.api.isSessionless(),c=function(e){h.setToken(e),salla.event.emit("api::initiated")},l=function(){return Vl(h,void 0,void 0,(function(){var e;var t=this;return __generator(this,(function(n){switch(n.label){case 0:if(!(i||s||!o))return[3,1];e=salla.auth.event.tokenInvalid();return[3,3];case 1:salla.log("Api:: case 1 => current is is guest & web session available");return[4,salla.auth.api.refresh().then((function(){return Vl(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,salla.profile.info()];case 1:e.sent();return[2]}}))}))})).catch((function(){return salla.auth.event.tokenInvalid()}))];case 2:e=n.sent();n.label=3;case 3:e;return[2]}}))}))};if(!!r)return[3,2];salla.log("Api:: case 1 => current is is guest");return[4,l()];case 1:return[2,void v.sent()];case 2:d=ko(r);if(!(Date.now()/1e3>d.exp))return[3,4];salla.log("Api:: case 2 => current user is logged-in and there is a token, but it's expired");return[4,l()];case 3:f=void v.sent();return[3,8];case 4:u=s?parseInt(d.sub)!==a:!a||!o||a!==o||parseInt(d.sub)!==o;if(!u)return[3,6];salla.log("Api:: case 3 => there is a token and user in session/local missing or mismatch"),salla.log("sub:".concat(d.sub," userIdInWeb:").concat(o," userIdInStorage:").concat(a,", isSessionless:").concat(s),d.sub,o,a),this.setHeader("Authorization","Bearer "+r);return[4,salla.profile.info().then((function(e){return Vl(h,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:e=!this.inIframe&&!s;if(!e)return[3,2];return[4,salla.auth.api.request("auth/jwt",{callerName:"salla.auth.request.injectTokenToTheRequests"})];case 1:e=t.sent();t.label=2;case 2:e,c(r);return[2]}}))}))})).catch((function(){salla.log("Api:: case 3 => failed get fresh profile"),h.setHeader("Authorization",null),salla.auth.event.tokenInvalid()}))];case 5:p=void v.sent();return[3,7];case 6:p=(salla.log("Api:: case 4 => current user is logged-in and there is a token, and it's not expired"),void c(r));v.label=7;case 7:f=p;v.label=8;case 8:return[2,f]}}))}))};e.prototype.setToken=function(e){return this.setHeader("Authorization","Bearer "+e),salla.event.emit("api::token.injected",e),this.token=e,this};e.prototype.setCurrencyAndLanguage=function(e){return this.setHeaders({currency:e.data.currency,"accept-language":e.data.language})};e.prototype.request=function(e,t,n,r){var i=this;if(t===void 0){t=void 0}if(n===void 0){n="get"}if(r===void 0){r={}}var o={endPoint:e,payload:t,method:n,options:r},a="undefined"!=typeof event?event.currentTarget:null,s=!1;return"SALLA-BUTTON"===(a===null||a===void 0?void 0:a.tagName)&&(s=!0),s&&(a===null||a===void 0?void 0:a.load()),this.axios[o.method](o.endPoint,o.payload,o.options).then((function(e){return s&&(a===null||a===void 0?void 0:a.stop()),e.data&&e.request&&(e=e.data),i.handleAfterResponseActions(e),e})).catch((function(e){throw s&&(a===null||a===void 0?void 0:a.stop()),salla.event.document.requestFailed(o,e),i.handleErrorResponse(e),e}))};e.prototype.handleAfterResponseActions=function(e){if(!e)return;var t=e.data,n=e.googleTags,r=n===void 0?null:n,i=t&&t.googleTags?t.googleTags:r;try{dataLayer&&i&&dataLayer.push(i)}catch(e){salla.logger.error(e.message)}this.fireEventsForResponse(e),this.showAlert(e)};e.prototype.fireEventsForResponse=function(e){var t,n;var r=(e===null||e===void 0?void 0:e.events)||((t=e.data)===null||t===void 0?void 0:t.events)||((n=e.error)===null||n===void 0?void 0:n.events);"string"==typeof r&&(r=JSON.parse(r)),r&&Object.keys(r).forEach((function(e){return salla.event.dispatch(e,r[e])}))};e.prototype.handleErrorResponse=function(e){if(e.response&&e.response.data)return e.response.data.error&&e.response.data.error.fields&&!this.notifier_handler_disabled?this.handleInvalidFields(e):this.handleAfterResponseActions(e.response.data)};e.prototype.showAlert=function(e){var t,n;if(e&&!this.notifier_handler_disabled)return e.case&&e.msg?salla.notify.fire(e.msg,e.case,e):e.hasOwnProperty("success")&&((t=e.data)===null||t===void 0?void 0:t.message)?salla.notify.fire((n=e.data)===null||n===void 0?void 0:n.message,e.success?salla.notify.types.success:salla.notify.types.error,e):e.error&&e.error.message&&"FORBIDDEN"!==e.error.message?salla.error(e.error.message,e):void 0};e.prototype.handleInvalidFields=function(e){var t=e.response.data.error.fields,n=[];Object.keys(t).forEach((function(e){var r=t[e];Array.isArray(r)?r.forEach((function(e){return n.push(e)})):n.push(r)}));var r=(n.length>1?"* ":"")+n.join("\n* ");salla.error(r,e)};e.prototype.isFastRequestsAllowed=function(){return Salla.config.get("fastRequests")};e.prototype.promise=function(e,t){if(t===void 0){t=!0}return new Promise((function(n,r){return t?n(e):r(e)}))};e.prototype.errorPromise=function(e){return this.promise(e,!1)};e.prototype.successPromise=function(e){return this.promise(e,!0)};return e}();var _u=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="component",t.endpoints={getMenus:"menus/{headOrFoot}?store_id={store}&lang={lang}",reviews:"reviews"},t.endpointsMethods={getMenus:"get",reviews:"get"};return t}t.prototype.getMenus=function(e){if(e===void 0){e="header"}return Vl(this,void 0,void 0,(function(){return __generator(this,(function(t){return[2,this.request(["getMenus",e,salla.config.get("store.id"),salla.lang.getLocale()]).then((function(e){return salla.event.component.menuFetched(e),e})).catch((function(e){throw salla.event.component.menuFetchFailed(e),e}))]}))}))};t.prototype.getReviews=function(e){var t=e.per_page,n=t===void 0?5:t,r=e.type,i=r===void 0?"all":r,o=e.items;return Vl(this,void 0,void 0,(function(){var e,t,r,a,s;return __generator(this,(function(c){if(!i){e="Review type cannot be empty. Please provide one.";return[2,(salla.event.component.reviewsFetchFailed(e),salla.api.errorPromise(e))]}t=!o||"string"==typeof o&&"[]"===o||Array.isArray(o)&&!o.length;if(!new Set(["all","store","categories","products","json"]).has(i)){r="Invalid review type. Please provide a valid type.";return[2,(salla.event.component.reviewsFetchFailed(r),salla.api.errorPromise(r))]}if("all"!==i&&"store"!==i&&t){a="Items cannot be empty. Please provide one.";return[2,(salla.event.component.reviewsFetchFailed(a),salla.api.errorPromise(a))]}if(new Set(["products","categories"]).has(i)&&!Array.isArray(o)){s="Items value must be an array of ".concat(i," id for review type of ").concat(i,".");return[2,(salla.event.component.reviewsFetchFailed(s),salla.api.errorPromise(s))]}return[2,this.request(["reviews"],{params:{per_page:n,type:i,items:o}},"get").then((function(e){return salla.event.component.reviewsFetched(e),e})).catch((function(e){throw salla.event.component.reviewsFetchFailed(e),e}))]}))}))};return t}(iu);var Su=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="booking",t.endpoints={fetch:"advertisements"},t.endpointsMethods={fetch:"get"};return t}t.prototype.fetch=function(e){if(e===void 0){e=null}return Vl(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){t=e?{page:e}:{};return[2,this.request(["fetch"],{params:t}).then((function(e){return salla.event.advertisement.fetched(e),e})).catch((function(e){throw salla.event.advertisement.fetchFailed(e),e}))]}))}))};return t}(iu);var ku=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="navigation",t.endpoints={breadcrumbs:"breadcrumbs"},t.endpointsMethods={breadcrumbs:"get"},t.after_init();return t}t.prototype.fetchBreadcrumbs=function(e){if(!e.page){var t="The 'page' parameter is required for the Breadcrumb API. Please provide a valid 'page' parameter.";return salla.event.navigation.breadcrumbFetchFailed(t),salla.api.errorPromise(t)}if(["product.single","product.index","customer.orders.single","product.index.tag","page-single","landing-page","brands.single","blog.single","blog.index.author","blog.index.category","blog.index.tag"].includes(e.page)&&!e.id){var n="The 'id' parameter is required when the 'page' parameter is set to ".concat(e.page,". Please provide valid value for the 'ID' parameter.");return salla.event.navigation.breadcrumbFetchFailed(n),salla.api.errorPromise(n)}return this.request("breadcrumbs",{params:e}).then((function(e){return salla.event.navigation.breadcrumbFetched(e),e})).catch((function(e){throw salla.event.navigation.breadcrumbFetchFailed(e),e}))};return t}(iu);var Eu=function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.namespace="metadata",t.endpoints={fetchValues:"https://api.salla.dev/store/v1/metadata/values"},t.endpointsMethods={fetchValues:"get"};return t}t.prototype.fetchValues=function(e,t){return Vl(this,void 0,void 0,(function(){var n,r;return __generator(this,(function(i){if(!e||!t){n="Please provide entity type and entity ids.";return[2,(salla.metadata.event.valueNotFetch(n),salla.api.errorPromise(n))]}r={type:e,entities:Array.isArray(t)?t:[t]};return[2,this.request(this.endpoints.fetchValues,{params:r},"get").then((function(e){return salla.metadata.event.valueFetched(e),e})).catch((function(e){throw salla.metadata.event.valueNotFetch(e),e}))]}))}))};return t}(iu);var xu=function(){function e(e){var t,n,r;"ready"!==Pr.status?e?(Pr.config.merge(e),["salla.sa","salla.group"].includes(location.hostname)&&!((t=Pr.config.get("store.url"))===null||t===void 0?void 0:t.includes(location.hostname))&&Pr.config.get("store.username")&&Pr.config.set("store.url",window.location.origin+"/"+Pr.config.get("store.username")),(e===null||e===void 0?void 0:e.events)&&Pr.event.dispatchEvents(e===null||e===void 0?void 0:e.events),e._token&&salla.api.setHeader("X-CSRF-TOKEN",e._token),this.injectMaintenanceAlert(),this.injectTemplateStoreAlert(),this.injectThemePreviewAlert(),this.injectAppInstallAlert(),this.applyContentCopyright(),this.injectEditAlert(),((n=e===null||e===void 0?void 0:e.user)===null||n===void 0?void 0:n.language_code)&&salla.lang.setLocale((r=e===null||e===void 0?void 0:e.user)===null||r===void 0?void 0:r.language_code),salla.lang.loadStoreTranslations(),this.setSallaReady(e)):this.setSallaReady(e):salla.log("Trying to re-initiate Salla, while its status === 'ready'!")}e.prototype.applyContentCopyright=function(){if(!salla.config.get("store.settings.content_copyright"))return;["contextmenu","selectstart","copy"].forEach((function(e){document.addEventListener(e,(function(e){return e.preventDefault()}))})),document.addEventListener("keydown",(function(e){var t=e.key.toLowerCase();("f12"===t||e.ctrlKey&&e.shiftKey&&["i","j","c"].includes(t)||e.ctrlKey&&"u"===t)&&(e.preventDefault(),e.stopPropagation())}));var e=document.createElement("style");e.textContent="\n body {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n -khtml-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n }\n img {\n pointer-events: none;\n -webkit-user-drag: none;\n }\n ",document.head.appendChild(e)};e.prototype.injectMaintenanceAlert=function(){salla.config.get("maintenance")&&(document.body.classList.add("has-maintenance-bar"),document.querySelector("salla-maintenance-alert")?salla.logger.warn("salla-maintenance-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.prepend(document.createElement("salla-maintenance-alert"))})))};e.prototype.injectTemplateStoreAlert=function(){salla.config.get("store.template")&&(document.body.classList.add("has-bottom-alert"),document.querySelector("salla-bottom-alert")?salla.logger.warn("salla-bottom-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.append(document.createElement("salla-bottom-alert"))})))};e.prototype.injectAppInstallAlert=function(){salla.config.get("store.app_install_prompt")&&salla.config.get("store.apps")&&!salla.storage.get("app_install_prompt_disabled")&&(document.body.classList.add("has-app-install-alert"),document.querySelector("salla-app-install-alert")?salla.logger.warn("salla-app-install-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.append(document.createElement("salla-app-install-alert"))})))};e.prototype.injectThemePreviewAlert=function(){"preview"===salla.config.get("theme.mode")&&(document.body.classList.add("has-preview-bar"),document.querySelector("#s-theme_preview_bar")?salla.logger.warn("#s-theme_preview_bar element Existed before!"):salla.lang.onLoaded((function(){var e=document.createElement("div");e.id="s-theme_preview_bar",e.setAttribute("style","display: flex; justify-content: space-between; text-align: center; background-color: #232323; color: #fff; padding: 10px; font-size: 0.875rem; line-height: 1.25rem; position: relative;"),e.innerHTML='\n <div style="display:flex; align-items:center;">\n <img width="32" src="https://cdn.salla.network/images/logo/logo-light.svg">\n <span style="margin:0 10px;">'.concat(salla.lang.get("blocks.header.preview_mode"),': <span style="background:rgba(255,255,255,0.25);border-radius:15px; padding:2px 15px 4px">').concat(salla.config.get("theme.name"),'</span></span>\n </div>\n <a href="').concat(salla.url.get("preview_theme/cancel/preview"),'" style="line-height:32px; width:32px;"><i class="sicon-cancel"></i></a>\n '),document.body.prepend(e)})))};e.prototype.injectEditAlert=function(){var e=salla.config.get("edit");e&&(document.querySelector("#s-edit-alert")?salla.logger.warn("#s-edit-alert element Existed before!"):salla.lang.onLoaded((function(){var t=document.createElement("div");t.id="s-edit-alert",t.innerHTML='\n <a href="'.concat(e,'" style="display:block; background-color:').concat(salla.config.get("theme.color.primary","#5cd5c4"),"; color:").concat(salla.config.get("theme.color.reverse","#fff"),'; padding: 10px; text-align:center; font-size: 0.875rem; line-height: 1.25rem;">\n <i class="sicon-edit"></i> \n ').concat(salla.lang.get("pages.products.quick_edit"),"\n </a>\n "),document.body.prepend(t)})))};e.prototype.handleElementAjaxRequest=function(e,t){var n=this;if(!(t instanceof HTMLFormElement||t instanceof HTMLAnchorElement))return salla.logger.warn("trying to call ajax from non Element!!"),!1;e.preventDefault();var r=t.getAjaxFormData(e),i=r.method?r.method.toLowerCase():void 0;salla.api.request(r.url,r.formData,i).then((function(e){return e.data&&e.request&&(e=e.data),salla.api.handleAfterResponseActions(e),n.callAjaxEvent(r.events.success,e,r.formData),e})).catch((function(e){throw salla.api.handleErrorResponse(e),n.callAjaxEvent(r.events.fail,e,r.formData),e}))};e.prototype.callAjaxEvent=function(e,t,n){if(e){if(n instanceof FormData){var r={};Array.from(n.entries()).forEach((function(e){r[e[0]]=e[1]})),n=r}window[e]?window[e](t,n):salla.event.dispatch(e,t,n)}};e.prototype.setSallaReady=function(e){this.storeUTMs(),Pr.event.emitAsync("twilight::before.ready",e),Pr.status="ready",Pr.event.dispatch("twilight::initiated",e),window.dispatchEvent(new CustomEvent("twilight::initiated",{detail:e}))};e.prototype.storeUTMs=function(){var e={fbclid:"facebook",gad_source:"google",ttclid:"tiktok",twclid:"twitter",scid:"snapchat"},t=["fbclid","gad_source","ttclid","twclid","scid"],n=__spreadArray(["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],t,true),r={},i={};window.location.search.replace("?","").split("&").map((function(e){return e.split("=")})).filter((function(e){var t=e[0];return n.includes(t.toLowerCase())})).forEach((function(e){var t=e[0],n=e[1];return r[t.toLowerCase()]=n}));var o=t.find((function(e){return r[e]}));!r.utm_source&&o&&(r.utm_source=e[o],r.utm_campaign=r.utm_campaign||"Using the CLICKID ".concat(o," provided by ").concat(r.utm_source),r.utm_term=r.utm_term||"".concat(o,": ").concat(r[o])),r.utm_source&&(Object.entries(r).filter((function(e){var n=e[0];return!t.includes(n)})).forEach((function(e){var t=e[0],n=e[1];return i["s-".concat(t.replace("_","-"))]=n})),i["s-utm-referrer"]=document.referrer,salla.storage.session.set("s-utms",i),this.logUTMVisitData(i))};e.prototype.logUTMVisitData=function(e){return Vl(this,void 0,void 0,(function(){var t,n,r;return __generator(this,(function(i){t=e["s-utm-source"],n=e["s-utm-medium"],r=e["s-utm-campaign"];e&&"affiliate"===t&&n&&r&&fetch(salla.config.get("affiliate.utm_url"),{method:"POST",mode:"cors",headers:{"Content-Type":"application/json","s-utm-source":t,"s-utm-medium":n,"s-utm-campaign":r}}).then((function(e){if(e.ok){var t=new URL(window.location.href),n=window.history.state;t.searchParams.delete("utm_source"),t.searchParams.delete("utm_medium"),t.searchParams.delete("utm_campaign"),window.history.replaceState(n,"",t)}}));return[2]}))}))};return e}();var Iu=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){return{event:"Product Added",properties:{cart_id:this.item.cart_id,product_id:this.item.id,category:this.item.category,name:this.item.name,brand:this.item.brand,variant:this.item.variant,price:this.item.price,quantity:this.item.quantity,sku:this.item.sku,coupon:this.item.coupon,position:this.item.position,url:this.item.url,image_url:this.item.image_url}}};e.shouldSend=function(){return"customer.wishlist"!==salla.config.get("page.slug")};return e}();var ju=function(){function e(e){this.product=e[0]}e.prototype.toSegment=function(){return{event:"Product Viewed",properties:{product_id:this.product.id,category:this.product.category,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:this.product.quantity,currency:this.product.currency,coupon:this.product.coupon,position:this.product.position,value:this.product.value,sku:this.product.sku,url:this.product.url,image_url:this.product.image_url}}};return e}();var Pu=function(){function e(e){this.cart=e[0]}e.prototype.toSegment=function(){var e;return{event:"Cart Viewed",properties:{cart_id:(e=this.cart.cart_id)===null||e===void 0?void 0:e.toString(),products:this.cart.products.map((function(e){var t;return{product_id:(t=e.id)===null||t===void 0?void 0:t.toString(),name:e.name,price:e.price,category:e.category,sku:e.sku,position:e.position,url:e.url,image_url:e.image_url}}))}}};return e}();var Ou=function(){function e(e){var t=e===null||e===void 0?void 0:e.nextPage;if(this.listId=null,"index"===salla.config.get("page.slug"))this.listId="home_page";else if(t){var n=new URL(t),r=n.searchParams.get("source"),i=n.searchParams.getAll("source_value[]");this.listId="".concat(r,"_").concat(i.join("_"))}this.products=e===null||e===void 0?void 0:e.data}e.prototype.toSegment=function(){return{event:"Product List Viewed",properties:{list_id:this.listId,category:salla.config.get("page.title"),products:this.products.map((function(e){var t,n,r;return{product_id:e.id,category:(t=e.category)===null||t===void 0?void 0:t.name,name:e.name,brand:(n=e.brand)===null||n===void 0?void 0:n.name,variant:e.variant,price:e.price,quantity:Number(e.quantity),sku:e.sku,position:0,url:e.url,image_url:(r=e.image)===null||r===void 0?void 0:r.url}}))}}};e.shouldSend=function(){return!["index","customer.wishlist"].includes(salla.config.get("page.slug"))};return e}();var Au=function(){function e(e){this.query=e}e.prototype.toSegment=function(){return{event:"Products Searched",properties:{query:this.query}}};return e}();var Cu=function(){function e(){}e.prototype.toSegment=function(){return{event:"Signed Up",properties:{context:{traits:Salla.config.get("user")}}}};e.shouldSend=function(){return"user"===Salla.config.get("user.type")||(Salla.profile.event.onInfoFetched((function(){return Salla.event.emit("Signed Up")})),!1)};return e}();var Tu=function(){function e(){}e.prototype.toSegment=function(){return{event:"Signed In",properties:{context:{traits:Salla.config.get("user")}}}};e.shouldSend=function(){return"user"===Salla.config.get("user.type")||(Salla.profile.event.onInfoFetched((function(){return Salla.event.emit("Signed In")})),!1)};return e}();var Fu=function(){function e(e){}e.prototype.toSegment=function(){return{event:"Signed Out",properties:{}}};return e}();var Lu=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){var e,t,n,r,i,o,a,s,c,l,u,d,f;return{event:"Product Removed",properties:{cart_id:(e=this.item)===null||e===void 0?void 0:e.cart_id,product_id:(t=this.item)===null||t===void 0?void 0:t.product_id,category:(n=this.item)===null||n===void 0?void 0:n.category,name:(r=this.item)===null||r===void 0?void 0:r.name,brand:(i=this.item)===null||i===void 0?void 0:i.brand,variant:(o=this.item)===null||o===void 0?void 0:o.variant,price:(a=this.item)===null||a===void 0?void 0:a.price,quantity:(s=this.item)===null||s===void 0?void 0:s.quantity,sku:(c=this.item)===null||c===void 0?void 0:c.sku,coupon:(l=this.item)===null||l===void 0?void 0:l.coupon,position:(u=this.item)===null||u===void 0?void 0:u.position,url:(d=this.item)===null||d===void 0?void 0:d.url,image_url:(f=this.item)===null||f===void 0?void 0:f.image_url}}};return e}();var Ru=function(){function e(e){this.product=e.product}e.prototype.toSegment=function(){var e,t;return{event:"Product Added to Wishlist",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),product_id:this.product.id,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:Math.max(1,Number(this.product.quantity)),sku:this.product.sku,coupon:this.product.coupon,position:Number(this.product.position),url:this.product.url,image_url:(t=(e=this.product)===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}}};return e}();var Nu=function(){function e(e){this.product=e.product}e.prototype.toSegment=function(){var e,t;return{event:"Product Removed from Wishlist",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),product_id:this.product.id,name:this.product.name,brand:this.product.brand,variant:this.product.variant,price:this.product.price,quantity:Math.max(1,Number(this.product.quantity)),sku:this.product.sku,coupon:this.product.coupon,position:Number(this.product.position),url:this.product.url,image_url:(t=(e=this.product)===null||e===void 0?void 0:e.image)===null||t===void 0?void 0:t.url}}};return e}();var zu=function(){function e(e){this.details=e[0]}e.prototype.toSegment=function(){return{event:"Order Completed",properties:this.details}};return e}();var qu=function(){function e(e){this.item=e[0]}e.prototype.toSegment=function(){return{event:"Wishlist Product Added to Cart",properties:{wishlist_id:salla.config.get("store.id")+"_"+salla.config.get("user.id"),wishlist_name:salla.config.get("store.name"),cart_id:this.item.cart_id,product_id:this.item.id,category:this.item.category,name:this.item.name,brand:this.item.brand,variant:this.item.variant,price:this.item.price,quantity:this.item.quantity,sku:this.item.sku,coupon:this.item.coupon,position:this.item.position,url:this.item.url,image_url:this.item.image_url}}};e.shouldSend=function(){return"customer.wishlist"===salla.config.get("page.slug")};return e}();var Uu=function(){function e(e){this.data=e}e.prototype.toSegment=function(){var e,t,n,r,i,o,a,s,c,l;return{event:"Product Shared",properties:{product_id:((e=this.data.product)===null||e===void 0?void 0:e.id)||salla.config.get("page.id"),sku:(t=this.data.product)===null||t===void 0?void 0:t.sku,category:(r=(n=this.data.product)===null||n===void 0?void 0:n.category)===null||r===void 0?void 0:r.name,name:(i=this.data.product)===null||i===void 0?void 0:i.name,brand:(o=this.data.product)===null||o===void 0?void 0:o.brand,variant:(a=this.data.product)===null||a===void 0?void 0:a.variant,price:(s=this.data.product)===null||s===void 0?void 0:s.price,url:(c=this.data.product)===null||c===void 0?void 0:c.url,image_url:(l=this.data.product)===null||l===void 0?void 0:l.image_url,share_via:this.data.share_via,recipient:this.data.recipient}}};e.shouldSend=function(){return"product.single"===salla.config.get("page.slug")};return e}();var Du=function(){function e(e){this.details=e}e.prototype.toSegment=function(){return{event:"Product Reviewed",properties:{product_id:this.details.product_id,review_id:this.details.order_id,review_body:this.details.comment,rating:this.details.rating}}};e.registerEvents=function(){salla.event.rating.onProductsRated((function(e,t){var n=t.products,r=t.order_id;Object.values(n).forEach((function(e){Salla.event.emit("Product Reviewed",{product_id:e.product_id,review_id:r,review_body:e.comment,rating:e.rating})}))}))};return e}();var Mu=function(){function e(){}e.registerEvents=function(){Du.registerEvents()};e.transform=function(e,t){try{var n=this.events[e]||[];for(var r=0,i=n;r<i.length;r++){var o=i[r];if(!o||"function"==typeof o.shouldSend&&!o.shouldSend())continue;var a=new o(t).toSegment();return{event:a.event,properties:a.properties}}return null}catch(e){return console.error("Failed to transform event:",e),null}};e.events={"Order Completed":[zu],"Product Added":[Iu,qu],"Product Removed":[Lu],"Product Viewed":[ju],"Product Added to Wishlist":[Ru],"Product Removed from Wishlist":[Nu],"Cart Viewed":[Pu],"Products Searched":[Au],"Product List Viewed":[Ou],"Signed Up":[Cu],"Signed In":[Tu],"Signed Out":[Fu],"Product Reviewed":[Du],"Product Shared":[Uu]};return e}();Pr.onReady=Pr.onReady||function(e){return new Promise((function(t){return"ready"===salla.status?t(e?e(salla.config.all()):salla.config.all()):Pr.onInitiated((function(n){return t(e?e(n):n)}))}))},Pr.status="loading",Pr.notify=eu,Pr.lang=new(function(e){__extends(t,e);function t(t){var n=this;(t=t||{}).messages=t.messages||window.translations,t.locale=t.locale||(window.locale||navigator.language||navigator.userLanguage||"ar").split("-")[0],t.fallback=t.fallback||t.locale,n=e.call(this,t)||this,n.translationsLoaded=!1;return n}t.prototype.onLoaded=function(e){var t=this;return new Promise((function(n){if(t.translationsLoaded)return n(e?e():null);Salla.event.once("languages::translations.loaded",(function(){return n(e?e():null)}))}))};t.prototype.loadStoreTranslations=function(){if(this.hash=salla.config.get("theme.translations_hash",salla.config.get("store.id","twilight")),this.message||(salla.log("try to load translations from localstorage"),this.messages=salla.storage.get("s_translations.".concat(this.hash)),this.messages&&(this.translationsLoaded=!0)&&e.prototype.setMessages.call(this,this.messages)),this.messages)return salla.event.dispatch("languages::translations.loaded"),void salla.logger.info("The messages of transactions is already loaded");salla.url.get("")?this.loadScript(salla.url.get("languages/assets/".concat(this.hash,".js"))):this.loadScript("https://cdn.salla.network/js/translations.js",!1)};t.prototype.setMessages=function(t){e.prototype.setMessages.call(this,t),salla.event.dispatch("languages::translations.loaded"),this.translationsLoaded=!0};t.prototype.loadScript=function(e,t){var n=this;if(t===void 0){t=!0}var r=document.createElement("script");r.src=e,r.onload=function(){var e;if(window.translations)return salla.storage.remove("s_translations"),salla.storage.set("s_translations",(e={},e[n.hash]=window.translations,e)),n.setMessages(window.translations);r.onerror()},r.onerror=function(){if(t)return salla.logger.warn("Failed to load Translations for store, lets try load it from CDN"),n.loadScript("https://cdn.salla.network/js/translations.js",!1);salla.logger.error("Failed to load Translations, check your network logs for more details\nor: salla.lang.setMessages({....}), see https://docs.salla.dev for more information's.")},document.head.appendChild(r)};t.prototype.getWithDefault=function(e,t,n,r){var i=this.get(e,n,r);return i!==e?i:t};t.prototype.get=function(t,n,r){var i=t;(window.translations||this.translationsLoaded)&&(i="trans."+t);var o=e.prototype.get.call(this,i,n,r);return o!==i?o:e.prototype.get.call(this,i,n,"en").replace(i,t)};t.prototype.set=function(e,t){return salla.helpers.setNested(this.messages["".concat(this.getLocale(),".trans")],e,t),this};t.prototype.add=function(e,t){var n=this;return Object.entries(t).forEach((function(t){return salla.helpers.setNested(n.messages[t[0]+".trans"],e,t[1])})),this};t.prototype.addBulk=function(e){var t=this;return Object.entries(e).forEach((function(e){var n=e[0],r=e[1];t.add(n,r)})),this};return t}(qr)),Pr.form=new(function(){function e(){}e.prototype.submit=function(e,t){var n,r,i,o;if(t===void 0){t=null}return Vl(this,void 0,void 0,(function(){var a,s,c;return __generator(this,(function(l){switch(l.label){case 0:a=t;if("SubmitEvent"===((n=t===null||t===void 0?void 0:t.constructor)===null||n===void 0?void 0:n.name)||"submit"===(t===null||t===void 0?void 0:t.type)){if(t.preventDefault(),"FORM"!==((r=t.target)===null||r===void 0?void 0:r.tagName))return[2,(Salla.logger.warn("Failed find the target element for submit action. make sure you submit a form element"),new Promise((function(){throw"Failed find the target element for submit action. make sure you submit a form element"})))];"SALLA-BUTTON"===((o=(i=t===null||t===void 0?void 0:t.submitter)===null||i===void 0?void 0:i.parentElement)===null||o===void 0?void 0:o.tagName)&&t.submitter.parentElement.load(),a=t.target.getElementSallaData(),salla.log("Data from element",a)}if(/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/gm.test(e))return[2,salla.api.request(e,a,"post").finally((function(){var e;loaderSupported&&((e=t===null||t===void 0?void 0:t.submitter)===null||e===void 0?void 0:e.parentElement.stop())}))];s=e.split("."),c=s.splice(-1);return[4,salla.call(s.join("."))[c](a).finally((function(){var e,n;return(n=(e=t===null||t===void 0?void 0:t.submitter)===null||e===void 0?void 0:e.parentElement)===null||n===void 0?void 0:n.stop()})).catch((function(e){throw salla.logger.warn(e),e}))];case 1:return[2,l.sent()]}}))}))};e.prototype.onSubmit=function(e,t){return salla.form.submit(e,t),!1};e.prototype.onChange=function(e,t){var n;return(t===null||t===void 0?void 0:t.currentTarget)?"FORM"!==((n=t===null||t===void 0?void 0:t.currentTarget)===null||n===void 0?void 0:n.tagName)||t.currentTarget.checkValidity()?(salla.form.submit(e,t.currentTarget.getElementSallaData()),!0):(salla.logger.warn("Trying to trigger '".concat(e,"' without filling required fields!")),!1):(salla.logger.warn("Trying to trigger '".concat(e,"' without event!")),!1)};e.prototype.getPossibleValue=function(e,t,n){if(n===void 0){n=!1}if(!e)return;if("object"!=typeof e)return e;var r;for(var i=0;i<t.length&&!(r=e[t[i]])&&!("undefined"!=typeof FormData&&e instanceof FormData&&(r=e.get(t[i])));i++);return r=r||e,"object"!=typeof r||n?r:void 0};return e}()),Pr.infiniteScroll=new(function(e){__extends(t,e);function t(t,n){var r=this;r=e.call(this,t,n)||this,r.options={path:".infinite-scroll-btn",history:"push",status:".infinite-scroll-status",append:".list-block"},r.fetchOptions={headers:{"S-INFINITE-SCROLL":!0,"S-Source":"twilight","cache-control":"no-cache",pragma:"no-cache"}},r.instances=[];return r}t.prototype.initiate=function(e,t,n,r){if(r===void 0){r=!1}r?((n=n||{}).fetchOptions=__assign(__assign({},this.fetchOptions),n.fetchOptions||{}),n.responseBody="json"):n=this.getCustomOptions(t,n);var i="string"!=typeof e?e:document.querySelector(e),o=n.path;if(!i||!o||"string"==typeof o&&!document.querySelector(o))return void Salla.logger.warn(i?"Path Option (a link that has next page link) Not Existed!":"Container For InfiniteScroll not Existed!");var a=new zr(i,n);return a.on("scrollThreshold",Salla.infiniteScroll.event.scrollThreshold),a.on("request",Salla.infiniteScroll.event.request),a.on("load",Salla.infiniteScroll.event.load),a.on("append",Salla.infiniteScroll.event.append),a.on("error",Salla.infiniteScroll.event.error),a.on("last",Salla.infiniteScroll.event.last),a.on("history",Salla.infiniteScroll.event.history),this.instances.push(a),a};t.prototype.getCustomOptions=function(e,t){return(t="object"==typeof e&&e||t||this.options).fetchOptions=this.fetchOptions,t.path=t.path||this.options.path,t.button=t.button||t.path,t.status=t.status||this.options.status,t.hasOwnProperty("history")||(t.history=this.options.history),t.nextPage=t.nextPage||t.next_page,t.append="string"==typeof e&&e||t.append||this.options.append,t};t.prototype.loadNextPage=function(e){("string"!=typeof e?e:document.querySelector(e)).loadNextPage()};t.prototype.destroy=function(e){("string"!=typeof e?e:document.querySelector(e)).destroy()};return t}(tu))(void 0,salla.event.infiniteScroll),Pr.api=new(function(e){__extends(t,e);function t(){var t=this;t=e.call(this)||this,t.auth=new su,t.cart=new ou,t.loyalty=new au,t.order=new cu,t.rating=new hu,t.product=new lu,t.profile=new uu,t.comment=new du,t.currency=new fu,t.document=new pu,t.wishlist=new vu,t.scope=new gu,t.booking=new mu,t.landing=new yu,t.notifications=new bu,t.component=new _u,t.advertisement=new Su,t.navigation=new ku,t.metadata=new Eu;return t}return t}(wu)),Pr.sso=new(function(){function e(){var e=this;Salla.onReady((function(){return e.init()}))}e.prototype.init=function(){var e;if(salla.config.get("store.features").includes("sso-login")){if(window.location.hostname.includes("salla"))return salla.log("SSO is not supported yet for stores without custom domain.");salla.auth.event.onLoggedOut((function(){return new Promise((function(e){var t=document.createElement("iframe");t.style.display="none",t.src=salla.url.get("sso/logout"),document.body.appendChild(t),t.onload=function(){document.body.removeChild(t),e()}}))})),(e=document.querySelector("salla-login-modal"))===null||e===void 0?void 0:e.remove(),Salla.event.removeAllListeners("login::open"),Salla.event.prependListener("login::open",(function(){var e=window.location.pathname+window.location.search,t="".concat(window.location.origin,"/sso/login?intended_to=").concat(encodeURIComponent(e));return console.log("Redirecting to:",t),window.location.href=t,!0}))}};return e}()),Pr.intend=new(function(){function e(){var e=this;Salla.onReady((function(){return e.init()}))}e.prototype.init=function(){if(Salla.config.isUser())return;var e=new URLSearchParams(window.location.search);if(e.has("intended_to"))try{var t=new URL(e.get("intended_to"));if(t.hostname!==window.location.hostname)return;return this.handleAfterLoginEvent(t)}catch(e){return void console.warn("Invalid URL provided in intended_to parameter")}};e.prototype.handleAfterLoginEvent=function(e){var t="intend::user.logged.in";Salla.event.on(t,(function(){return window.location=e})),Salla.api.auth.setAfterLoginEvent(t),Salla.api.auth.setCanRedirect(!1),Salla.event.on("salla-login::ready",(function(){return Salla.event.emit("login::open",{withoutReload:!0})}))};return e}()),["cart","auth","order","scope","rating","comment","loyalty","product","profile","currency","document","wishlist","booking","landing","metadata"].forEach((function(e){return Pr[e]=new tu(Pr.api[e],Pr.event[e])})),Pr.call=function(e){var t=Pr,n=e.split(".");for(;n.length&&(t=t[n.shift()]););return t},Pr.analytics=new(function(){function e(){var e=this;this.history=[],this.customTrackers=[],this.mappedEvents={"wishlist::added":"Product Added to Wishlist","wishlist::removed":"Product Removed from Wishlist","salla-products-list::products.fetched":"Product List Viewed","auth::registered":"Signed Up","auth::logged.in":"Signed In","auth::logged.out":"Signed Out","share-element":"Product Shared"},salla.event.onAny((function(t,n){try{if(Object.keys(e.mappedEvents).includes(t)){var r=e.mappedEvents[t];return void salla.event.emit(r,n)}if(!salla.config.get("jitsu.events",[]).includes(t))return;var i=Mu.transform(t,n);i&&e.track(i.event,i.properties)}catch(t){salla.log("Error in analytics event handling:",t)}})),salla.event.on("twilight::init",(function(t){var n,r,i;var o=(t===null||t===void 0?void 0:t.jitsu)||{},a=o.host,s=o.key;e.analytics=null,a&&s?(Mu.registerEvents(),e.analytics=Kl({host:a,writeKey:s}),"user"===((n=t===null||t===void 0?void 0:t.user)===null||n===void 0?void 0:n.type)&&e.analytics.identify(t===null||t===void 0?void 0:t.user),e.page({context:{store_id:(r=t===null||t===void 0?void 0:t.store)===null||r===void 0?void 0:r.id,version:(i=t===null||t===void 0?void 0:t.jitsu)===null||i===void 0?void 0:i.version}})):salla.log("Jitsu configuration is missing. Analytics will not be tracked.")}))}e.prototype.track=function(e,t){var n=this;if(t===void 0){t={}}return this.analytics?(t=this.finalPayload(t),this.analytics.track(e,t).then((function(r){return n.pushEventToCustomTrackers("track",e,t),r})).then((function(){n.history.push({action:"track",eventName:e,payload:t})})).catch((function(e){return salla.log("Error tracking event:",e),Promise.reject(e)}))):(salla.log("Jitsu configuration is missing. Analytics will not be tracked."),Promise.resolve())};e.prototype.page=function(e){var t=this;if(e===void 0){e={}}return this.analytics?(e=this.finalPayload(e),this.analytics.page(e).then((function(n){return t.pushEventToCustomTrackers("page",e),n})).then((function(){t.history.push({action:"page",payload:e})})).catch((function(e){return salla.log("Error tracking page event:",e),Promise.reject(e)}))):(salla.log("Jitsu configuration is missing. Analytics will not be tracked."),Promise.resolve())};e.prototype.finalPayload=function(e){if(e===void 0){e={}}var t={context:{version:salla.config.get("jitsu.version",1),store_id:salla.config.get("store.id")}};var n=salla.storage.session.get("s-utms");if(n){var r=n["s-utm-campaign"],i=n["s-utm-source"],o=n["s-utm-medium"],a=n["s-utm-term"],s=n["s-utm-content"],c=n["s-utm-referrer"];t.context.campaign={name:r,source:i,medium:o,term:a,content:s,referrer:c}}return __assign(__assign({},t),e)};e.prototype.registerTracker=function(e){"object"==typeof e?"string"==typeof e.name&&e.name?"function"==typeof e.track?"function"==typeof e.page?this.customTrackers.find((function(t){return t.name===e.name}))?salla.log("tracker with the same name already exists!"):(this.customTrackers.push(e),this.history.forEach((function(t){return"track"===t.action?e.track(t.eventName,t.payload):"page"===t.action?e.page(t.payload):void 0}))):salla.log("tracker.page most be a function!"):salla.log("tracker.track most be a function!"):salla.log("tracker.name most be a string!"):salla.log('tracker most be an object {name:"tracker name", track: callback, page: callback}!')};e.prototype.pushEventToCustomTrackers=function(e,t,n){if(n===void 0){n={}}this.customTrackers.forEach((function(r){return r[e](t,n)}))};return e}()),Pr.init=function(e){return new xu(e)},salla.event.once("twilight::init",salla.init),salla.event.on("twilight::api",(function(e){var t=e===null||e===void 0?void 0:e.events;t&&salla.event.dispatchEvents(t)})),Pr.success=Pr.notify.success,Pr.error=Pr.notify.error,Pr.versions.twilight="[VI]{version}[/VI]",Pr.onInitiated=function(e){return salla.event.once("twilight::initiated",e)},window.dispatchEvent(new CustomEvent("salla::created"));var Bu=n((function(e,n){!function(t,n){e.exports=n()}(t,(function(){function e(){return e=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.apply(this,arguments)}var t="undefined"!=typeof window,n=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),r=t&&"IntersectionObserver"in window,i=t&&"classList"in document.createElement("p"),o=t&&window.devicePixelRatio>1,a={elements_selector:".lazy",container:n||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},s=function(t){return e({},a,t)},c=function(e,t){var n,r="LazyLoad::Initialized",i=new e(t);try{n=new CustomEvent(r,{detail:{instance:i}})}catch(e){(n=document.createEvent("CustomEvent")).initCustomEvent(r,!1,!1,{instance:i})}window.dispatchEvent(n)},l="src",u="srcset",d="sizes",f="poster",p="llOriginalAttrs",h="data",v="loading",g="loaded",m="applied",y="error",b="native",w="data-",_="ll-status",S=function(e,t){return e.getAttribute(w+t)},k=function(e){return S(e,_)},E=function(e,t){return function(e,t,n){var r="data-ll-status";null!==n?e.setAttribute(r,n):e.removeAttribute(r)}(e,0,t)},x=function(e){return E(e,null)},I=function(e){return null===k(e)},j=function(e){return k(e)===b},P=[v,g,m,y],O=function(e,t,n,r){e&&(void 0===r?void 0===n?e(t):e(t,n):e(t,n,r))},A=function(e,t){i?e.classList.add(t):e.className+=(e.className?" ":"")+t},C=function(e,t){i?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\s+)"+t+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},T=function(e){return e.llTempImage},F=function(e,t){if(t){var n=t._observer;n&&n.unobserve(e)}},L=function(e,t){e&&(e.loadingCount+=t)},R=function(e,t){e&&(e.toLoadCount=t)},N=function(e){for(var t,n=[],r=0;t=e.children[r];r+=1)"SOURCE"===t.tagName&&n.push(t);return n},z=function(e,t){var n=e.parentNode;n&&"PICTURE"===n.tagName&&N(n).forEach(t)},q=function(e,t){N(e).forEach(t)},U=[l],D=[l,f],M=[l,u,d],B=[h],H=function(e){return!!e[p]},G=function(e){return e[p]},J=function(e){return delete e[p]},V=function(e,t){if(!H(e)){var n={};t.forEach((function(t){n[t]=e.getAttribute(t)})),e[p]=n}},W=function(e,t){if(H(e)){var n=G(e);t.forEach((function(t){!function(e,t,n){n?e.setAttribute(t,n):e.removeAttribute(t)}(e,t,n[t])}))}},$=function(e,t,n){A(e,t.class_applied),E(e,m),n&&(t.unobserve_completed&&F(e,t),O(t.callback_applied,e,n))},Q=function(e,t,n){A(e,t.class_loading),E(e,v),n&&(L(n,1),O(t.callback_loading,e,n))},K=function(e,t,n){n&&e.setAttribute(t,n)},X=function(e,t){K(e,d,S(e,t.data_sizes)),K(e,u,S(e,t.data_srcset)),K(e,l,S(e,t.data_src))},Y={IMG:function(e,t){z(e,(function(e){V(e,M),X(e,t)})),V(e,M),X(e,t)},IFRAME:function(e,t){V(e,U),K(e,l,S(e,t.data_src))},VIDEO:function(e,t){q(e,(function(e){V(e,U),K(e,l,S(e,t.data_src))})),V(e,D),K(e,f,S(e,t.data_poster)),K(e,l,S(e,t.data_src)),e.load()},OBJECT:function(e,t){V(e,B),K(e,h,S(e,t.data_src))}},Z=["IMG","IFRAME","VIDEO","OBJECT"],ee=function(e,t){!t||function(e){return e.loadingCount>0}(t)||function(e){return e.toLoadCount>0}(t)||O(e.callback_finish,t)},te=function(e,t,n){e.addEventListener(t,n),e.llEvLisnrs[t]=n},ne=function(e,t,n){e.removeEventListener(t,n)},re=function(e){return!!e.llEvLisnrs},ie=function(e){if(re(e)){var t=e.llEvLisnrs;for(var n in t){var r=t[n];ne(e,n,r)}delete e.llEvLisnrs}},oe=function(e,t,n){!function(e){delete e.llTempImage}(e),L(n,-1),function(e){e&&(e.toLoadCount-=1)}(n),C(e,t.class_loading),t.unobserve_completed&&F(e,n)},ae=function(e,t,n){var r=T(e)||e;re(r)||function(e,t,n){re(e)||(e.llEvLisnrs={});var r="VIDEO"===e.tagName?"loadeddata":"load";te(e,r,t),te(e,"error",n)}(r,(function(i){!function(e,t,n,r){var i=j(t);oe(t,n,r),A(t,n.class_loaded),E(t,g),O(n.callback_loaded,t,r),i||ee(n,r)}(0,e,t,n),ie(r)}),(function(i){!function(e,t,n,r){var i=j(t);oe(t,n,r),A(t,n.class_error),E(t,y),O(n.callback_error,t,r),n.restore_on_error&&W(t,M),i||ee(n,r)}(0,e,t,n),ie(r)}))},se=function(e,t,n){!function(e){return Z.indexOf(e.tagName)>-1}(e)?function(e,t,n){!function(e){e.llTempImage=document.createElement("IMG")}(e),ae(e,t,n),function(e){H(e)||(e[p]={backgroundImage:e.style.backgroundImage})}(e),function(e,t,n){var r=S(e,t.data_bg),i=S(e,t.data_bg_hidpi),a=o&&i?i:r;a&&(e.style.backgroundImage='url("'.concat(a,'")'),T(e).setAttribute(l,a),Q(e,t,n))}(e,t,n),function(e,t,n){var r=S(e,t.data_bg_multi),i=S(e,t.data_bg_multi_hidpi),a=o&&i?i:r;a&&(e.style.backgroundImage=a,$(e,t,n))}(e,t,n),function(e,t,n){var r=S(e,t.data_bg_set);if(r){var i=r.split("|"),o=i.map((function(e){return"image-set(".concat(e,")")}));e.style.backgroundImage=o.join(),""===e.style.backgroundImage&&(o=i.map((function(e){return"-webkit-image-set(".concat(e,")")})),e.style.backgroundImage=o.join()),$(e,t,n)}}(e,t,n)}(e,t,n):function(e,t,n){ae(e,t,n),function(e,t,n){var r=Y[e.tagName];r&&(r(e,t),Q(e,t,n))}(e,t,n)}(e,t,n)},ce=function(e){e.removeAttribute(l),e.removeAttribute(u),e.removeAttribute(d)},le=function(e){z(e,(function(e){W(e,M)})),W(e,M)},ue={IMG:le,IFRAME:function(e){W(e,U)},VIDEO:function(e){q(e,(function(e){W(e,U)})),W(e,D),e.load()},OBJECT:function(e){W(e,B)}},de=function(e,t){(function(e){var t=ue[e.tagName];t?t(e):function(e){if(H(e)){var t=G(e);e.style.backgroundImage=t.backgroundImage}}(e)})(e),function(e,t){I(e)||j(e)||(C(e,t.class_entered),C(e,t.class_exited),C(e,t.class_applied),C(e,t.class_loading),C(e,t.class_loaded),C(e,t.class_error))}(e,t),x(e),J(e)},fe=["IMG","IFRAME","VIDEO"],pe=function(e){return e.use_native&&"loading"in HTMLImageElement.prototype},he=function(e,t,n){e.forEach((function(e){return function(e){return e.isIntersecting||e.intersectionRatio>0}(e)?function(e,t,n,r){var i=function(e){return P.indexOf(k(e))>=0}(e);E(e,"entered"),A(e,n.class_entered),C(e,n.class_exited),function(e,t,n){t.unobserve_entered&&F(e,n)}(e,n,r),O(n.callback_enter,e,t,r),i||se(e,n,r)}(e.target,e,t,n):function(e,t,n,r){I(e)||(A(e,n.class_exited),function(e,t,n,r){n.cancel_on_exit&&function(e){return k(e)===v}(e)&&"IMG"===e.tagName&&(ie(e),function(e){z(e,(function(e){ce(e)})),ce(e)}(e),le(e),C(e,n.class_loading),L(r,-1),x(e),O(n.callback_cancel,e,t,r))}(e,t,n,r),O(n.callback_exit,e,t,r))}(e.target,e,t,n)}))},ve=function(e){return Array.prototype.slice.call(e)},ge=function(e){return e.container.querySelectorAll(e.elements_selector)},me=function(e){return function(e){return k(e)===y}(e)},ye=function(e,t){return function(e){return ve(e).filter(I)}(e||ge(t))},be=function(e,n){var i=s(e);this._settings=i,this.loadingCount=0,function(e,t){r&&!pe(e)&&(t._observer=new IntersectionObserver((function(n){he(n,e,t)}),function(e){return{root:e.container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}}(e)))}(i,this),function(e,n){t&&(n._onlineHandler=function(){!function(e,t){var n;(n=ge(e),ve(n).filter(me)).forEach((function(t){C(t,e.class_error),x(t)})),t.update()}(e,n)},window.addEventListener("online",n._onlineHandler))}(i,this),this.update(n)};return be.prototype={update:function(e){var t,i,o=this._settings,a=ye(e,o);R(this,a.length),!n&&r?pe(o)?function(e,t,n){e.forEach((function(e){-1!==fe.indexOf(e.tagName)&&function(e,t,n){e.setAttribute("loading","lazy"),ae(e,t,n),function(e,t){var n=Y[e.tagName];n&&n(e,t)}(e,t),E(e,b)}(e,t,n)})),R(n,0)}(a,o,this):(i=a,function(e){e.disconnect()}(t=this._observer),function(e,t){t.forEach((function(t){e.observe(t)}))}(t,i)):this.loadAll(a)},destroy:function(){this._observer&&this._observer.disconnect(),t&&window.removeEventListener("online",this._onlineHandler),ge(this._settings).forEach((function(e){J(e)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(e){var t=this,n=this._settings;ye(e,n).forEach((function(e){F(e,t),se(e,n,t)}))},restoreAll:function(){var e=this._settings;ge(e).forEach((function(t){de(t,e)}))}},be.load=function(e,t){var n=s(t);se(e,n)},be.resetStatus=function(e){x(e)},t&&function(e,t){if(t)if(t.length)for(var n,r=0;n=t[r];r+=1)c(e,n);else c(e,t)}(be,window.lazyLoadOptions),be}))}));function Hu(){if(!document.lazyLoadInstance){document.lazyLoadInstance=new Bu({use_native:true});document.lazyLoadBackgrounds=new Bu({elements_selector:".lazy[data-bg]:not(.loaded)"})}if(document.readyState!=="complete"){document.addEventListener("DOMContentLoaded",(function(){return document.lazyLoadInstance.update()}));document.addEventListener("DOMContentLoaded",(function(){return document.lazyLoadBackgrounds.update()}))}salla.infiniteScroll.event.onAppend((function(){document.lazyLoadInstance.update();document.lazyLoadBackgrounds.update()}))}var Gu=e("g",Hu)}}}));
25
+ //# sourceMappingURL=p-9ee15eac.system.js.map