@salla.sa/twilight-components 1.0.32 → 1.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/cjs/index.cjs.js +1 -1
  2. package/dist/cjs/salla-button_7.cjs.entry.js +6 -5
  3. package/dist/cjs/salla-rating.cjs.entry.js +29 -7
  4. package/dist/cjs/{salla-search-94d97bc0.js → salla-search-62921989.js} +1 -1
  5. package/dist/collection/components/salla-localization/salla-localization.js +2 -1
  6. package/dist/collection/components/salla-login/salla-login.js +1 -1
  7. package/dist/collection/components/salla-modal/salla-modal.js +3 -3
  8. package/dist/collection/components/salla-rating/salla-rating.js +34 -12
  9. package/dist/collection/plugins/tailwind-theme/index.js +1 -0
  10. package/dist/esm/index.js +1 -1
  11. package/dist/esm/salla-button_7.entry.js +6 -5
  12. package/dist/esm/salla-rating.entry.js +29 -7
  13. package/dist/esm/{salla-search-c72c4eb6.js → salla-search-96520d15.js} +1 -1
  14. package/dist/twilight-components/index.esm.js +1 -1
  15. package/dist/twilight-components/p-352ce785.js +1 -0
  16. package/dist/twilight-components/p-a841c013.entry.js +1 -0
  17. package/dist/twilight-components/p-fbfd14a6.entry.js +1 -0
  18. package/dist/twilight-components/twilight-components.esm.js +1 -1
  19. package/dist/types/components/salla-rating/salla-rating.d.ts +10 -0
  20. package/example/.DS_Store +0 -0
  21. package/example/assets/tailwind.css +1 -0
  22. package/example/auth/email/send_verification +0 -0
  23. package/example/auth/email/verify +11 -0
  24. package/example/auth/mobile/send_verification +0 -0
  25. package/example/auth/mobile/verify +9 -0
  26. package/example/dist/demo.js +69 -0
  27. package/example/dist/flags.png +0 -0
  28. package/example/dist/flags@2x.png +0 -0
  29. package/example/dist/intlTelInput.min.css +1 -0
  30. package/example/dist/tailwind.css +5 -0
  31. package/example/dist/translations.js +1 -0
  32. package/example/dist/twilight.js +2 -0
  33. package/example/index.html +63 -72
  34. package/example/rating/products +0 -0
  35. package/example/rating/rating.json +1 -0
  36. package/example/rating/shipping +0 -0
  37. package/example/rating/store +0 -0
  38. package/package.json +1 -1
  39. package/dist/twilight-components/p-622cae84.js +0 -1
  40. package/dist/twilight-components/p-744b4c0c.entry.js +0 -1
  41. package/dist/twilight-components/p-b6f8a19a.entry.js +0 -1
@@ -0,0 +1,2 @@
1
+ /*! For license information please see twilight.js.LICENSE.txt */
2
+ (()=>{var __webpack_modules__={4559:(e,t,n)=>{e.exports=n(9335)},1786:(e,t,n)=>{"use strict";var r=n(8266),s=n(5608),i=n(159),o=n(9568),a=n(3943),l=n(8201),c=n(1745),u=n(7979),h=n(9046),d=n(9760);e.exports=function(e){return new Promise((function(t,n){var f,p=e.data,m=e.headers,g=e.responseType;function y(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}r.isFormData(p)&&delete m["Content-Type"];var v=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",_=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";m.Authorization="Basic "+btoa(b+":"+_)}var w=a(e.baseURL,e.url);function S(){if(v){var r="getAllResponseHeaders"in v?l(v.getAllResponseHeaders()):null,i={data:g&&"text"!==g&&"json"!==g?v.response:v.responseText,status:v.status,statusText:v.statusText,headers:r,config:e,request:v};s((function(e){t(e),y()}),(function(e){n(e),y()}),i),v=null}}if(v.open(e.method.toUpperCase(),o(w,e.params,e.paramsSerializer),!0),v.timeout=e.timeout,"onloadend"in v?v.onloadend=S:v.onreadystatechange=function(){v&&4===v.readyState&&(0!==v.status||v.responseURL&&0===v.responseURL.indexOf("file:"))&&setTimeout(S)},v.onabort=function(){v&&(n(u("Request aborted",e,"ECONNABORTED",v)),v=null)},v.onerror=function(){n(u("Network Error",e,null,v)),v=null},v.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",r=e.transitional||h.transitional;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(u(t,e,r.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",v)),v=null},r.isStandardBrowserEnv()){var x=(e.withCredentials||c(w))&&e.xsrfCookieName?i.read(e.xsrfCookieName):void 0;x&&(m[e.xsrfHeaderName]=x)}"setRequestHeader"in v&&r.forEach(m,(function(e,t){void 0===p&&"content-type"===t.toLowerCase()?delete m[t]:v.setRequestHeader(t,e)})),r.isUndefined(e.withCredentials)||(v.withCredentials=!!e.withCredentials),g&&"json"!==g&&(v.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&v.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&v.upload&&v.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(f=function(e){v&&(n(!e||e&&e.type?new d("canceled"):e),v.abort(),v=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f))),p||(p=null),v.send(p)}))}},9335:(e,t,n)=>{"use strict";var r=n(8266),s=n(4345),i=n(7929),o=n(650),a=function e(t){var n=new i(t),a=s(i.prototype.request,n);return r.extend(a,i.prototype,n),r.extend(a,n),a.create=function(n){return e(o(t,n))},a}(n(9046));a.Axios=i,a.Cancel=n(9760),a.CancelToken=n(7510),a.isCancel=n(8825),a.VERSION=n(992).version,a.all=function(e){return Promise.all(e)},a.spread=n(4346),a.isAxiosError=n(3276),e.exports=a,e.exports.default=a},9760:e=>{"use strict";function t(e){this.message=e}t.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},t.prototype.__CANCEL__=!0,e.exports=t},7510:(e,t,n)=>{"use strict";var r=n(9760);function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},e((function(e){n.reason||(n.reason=new r(e),t(n.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},s.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},8825:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},7929:(e,t,n)=>{"use strict";var r=n(8266),s=n(9568),i=n(6252),o=n(6029),a=n(650),l=n(123),c=l.validators;function u(e){this.defaults=e,this.interceptors={request:new i,response:new i}}u.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=e.transitional;void 0!==t&&l.assertOptions(t,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var n=[],r=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(r=r&&t.synchronous,n.unshift(t.fulfilled,t.rejected))}));var s,i=[];if(this.interceptors.response.forEach((function(e){i.push(e.fulfilled,e.rejected)})),!r){var u=[o,void 0];for(Array.prototype.unshift.apply(u,n),u=u.concat(i),s=Promise.resolve(e);u.length;)s=s.then(u.shift(),u.shift());return s}for(var h=e;n.length;){var d=n.shift(),f=n.shift();try{h=d(h)}catch(e){f(e);break}}try{s=o(h)}catch(e){return Promise.reject(e)}for(;i.length;)s=s.then(i.shift(),i.shift());return s},u.prototype.getUri=function(e){return e=a(this.defaults,e),s(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],(function(e){u.prototype[e]=function(t,n){return this.request(a(n||{},{method:e,url:t,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(e){u.prototype[e]=function(t,n,r){return this.request(a(r||{},{method:e,url:t,data:n}))}})),e.exports=u},6252:(e,t,n)=>{"use strict";var r=n(8266);function s(){this.handlers=[]}s.prototype.use=function(e,t,n){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},s.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},s.prototype.forEach=function(e){r.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=s},3943:(e,t,n)=>{"use strict";var r=n(406),s=n(5027);e.exports=function(e,t){return e&&!r(t)?s(e,t):t}},7979:(e,t,n)=>{"use strict";var r=n(2050);e.exports=function(e,t,n,s,i){var o=new Error(e);return r(o,t,n,s,i)}},6029:(e,t,n)=>{"use strict";var r=n(8266),s=n(2661),i=n(8825),o=n(9046),a=n(9760);function l(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a("canceled")}e.exports=function(e){return l(e),e.headers=e.headers||{},e.data=s.call(e,e.data,e.headers,e.transformRequest),e.headers=r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return l(e),t.data=s.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return i(t)||(l(e),t&&t.response&&(t.response.data=s.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},2050:e=>{"use strict";e.exports=function(e,t,n,r,s){return e.config=t,n&&(e.code=n),e.request=r,e.response=s,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e}},650:(e,t,n)=>{"use strict";var r=n(8266);e.exports=function(e,t){t=t||{};var n={};function s(e,t){return r.isPlainObject(e)&&r.isPlainObject(t)?r.merge(e,t):r.isPlainObject(t)?r.merge({},t):r.isArray(t)?t.slice():t}function i(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:s(void 0,e[n]):s(e[n],t[n])}function o(e){if(!r.isUndefined(t[e]))return s(void 0,t[e])}function a(n){return r.isUndefined(t[n])?r.isUndefined(e[n])?void 0:s(void 0,e[n]):s(void 0,t[n])}function l(n){return n in t?s(e[n],t[n]):n in e?s(void 0,e[n]):void 0}var c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l};return r.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||i,s=t(e);r.isUndefined(s)&&t!==l||(n[e]=s)})),n}},5608:(e,t,n)=>{"use strict";var r=n(7979);e.exports=function(e,t,n){var s=n.config.validateStatus;n.status&&s&&!s(n.status)?t(r("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}},2661:(e,t,n)=>{"use strict";var r=n(8266),s=n(9046);e.exports=function(e,t,n){var i=this||s;return r.forEach(n,(function(n){e=n.call(i,e,t)})),e}},9046:(e,t,n)=>{"use strict";var r=n(8266),s=n(1490),i=n(2050),o={"Content-Type":"application/x-www-form-urlencoded"};function a(e,t){!r.isUndefined(e)&&r.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,c={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(l=n(1786)),l),transformRequest:[function(e,t){return s(t,"Accept"),s(t,"Content-Type"),r.isFormData(e)||r.isArrayBuffer(e)||r.isBuffer(e)||r.isStream(e)||r.isFile(e)||r.isBlob(e)?e:r.isArrayBufferView(e)?e.buffer:r.isURLSearchParams(e)?(a(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):r.isObject(e)||t&&"application/json"===t["Content-Type"]?(a(t,"application/json"),function(e,t,n){if(r.isString(e))try{return(0,JSON.parse)(e),r.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,n=t&&t.silentJSONParsing,s=t&&t.forcedJSONParsing,o=!n&&"json"===this.responseType;if(o||s&&r.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw i(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};r.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),r.forEach(["post","put","patch"],(function(e){c.headers[e]=r.merge(o)})),e.exports=c},992:e=>{e.exports={version:"0.23.0"}},4345:e=>{"use strict";e.exports=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}}},9568:(e,t,n)=>{"use strict";var r=n(8266);function s(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,n){if(!t)return e;var i;if(n)i=n(t);else if(r.isURLSearchParams(t))i=t.toString();else{var o=[];r.forEach(t,(function(e,t){null!=e&&(r.isArray(e)?t+="[]":e=[e],r.forEach(e,(function(e){r.isDate(e)?e=e.toISOString():r.isObject(e)&&(e=JSON.stringify(e)),o.push(s(t)+"="+s(e))})))})),i=o.join("&")}if(i){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e}},5027:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},159:(e,t,n)=>{"use strict";var r=n(8266);e.exports=r.isStandardBrowserEnv()?{write:function(e,t,n,s,i,o){var a=[];a.push(e+"="+encodeURIComponent(t)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(s)&&a.push("path="+s),r.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},406:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)}},3276:e=>{"use strict";e.exports=function(e){return"object"==typeof e&&!0===e.isAxiosError}},1745:(e,t,n)=>{"use strict";var r=n(8266);e.exports=r.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function s(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=s(window.location.href),function(t){var n=r.isString(t)?s(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0}},1490:(e,t,n)=>{"use strict";var r=n(8266);e.exports=function(e,t){r.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))}},8201:(e,t,n)=>{"use strict";var r=n(8266),s=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,n,i,o={};return e?(r.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=r.trim(e.substr(0,i)).toLowerCase(),n=r.trim(e.substr(i+1)),t){if(o[t]&&s.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([n]):o[t]?o[t]+", "+n:n}})),o):o}},4346:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},123:(e,t,n)=>{"use strict";var r=n(992).version,s={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){s[e]=function(n){return typeof n===e||"a"+(t<1?"n ":" ")+e}}));var i={};s.transitional=function(e,t,n){function s(e,t){return"[Axios v"+r+"] Transitional option '"+e+"'"+t+(n?". "+n:"")}return function(n,r,o){if(!1===e)throw new Error(s(r," has been removed"+(t?" in "+t:"")));return t&&!i[r]&&(i[r]=!0,console.warn(s(r," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(n,r,o)}},e.exports={assertOptions:function(e,t,n){if("object"!=typeof e)throw new TypeError("options must be an object");for(var r=Object.keys(e),s=r.length;s-- >0;){var i=r[s],o=t[i];if(o){var a=e[i],l=void 0===a||o(a,i,e);if(!0!==l)throw new TypeError("option "+i+" must be "+l)}else if(!0!==n)throw Error("Unknown option "+i)}},validators:s}},8266:(e,t,n)=>{"use strict";var r=n(4345),s=Object.prototype.toString;function i(e){return"[object Array]"===s.call(e)}function o(e){return void 0===e}function a(e){return null!==e&&"object"==typeof e}function l(e){if("[object Object]"!==s.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function c(e){return"[object Function]"===s.call(e)}function u(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&t.call(null,e[s],s,e)}e.exports={isArray:i,isArrayBuffer:function(e){return"[object ArrayBuffer]"===s.call(e)},isBuffer:function(e){return null!==e&&!o(e)&&null!==e.constructor&&!o(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:a,isPlainObject:l,isUndefined:o,isDate:function(e){return"[object Date]"===s.call(e)},isFile:function(e){return"[object File]"===s.call(e)},isBlob:function(e){return"[object Blob]"===s.call(e)},isFunction:c,isStream:function(e){return a(e)&&c(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:u,merge:function e(){var t={};function n(n,r){l(t[r])&&l(n)?t[r]=e(t[r],n):l(n)?t[r]=e({},n):i(n)?t[r]=n.slice():t[r]=n}for(var r=0,s=arguments.length;r<s;r++)u(arguments[r],n);return t},extend:function(e,t,n){return u(t,(function(t,s){e[s]=n&&"function"==typeof t?r(t,n):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}}},7138:function(e){var t,n;t="undefined"!=typeof window?window:this,n=function(){function e(){}let t=e.prototype;return t.on=function(e,t){if(!e||!t)return this;let n=this._events=this._events||{},r=n[e]=n[e]||[];return r.includes(t)||r.push(t),this},t.once=function(e,t){if(!e||!t)return this;this.on(e,t);let n=this._onceEvents=this._onceEvents||{};return(n[e]=n[e]||{})[t]=!0,this},t.off=function(e,t){let n=this._events&&this._events[e];if(!n||!n.length)return this;let r=n.indexOf(t);return-1!=r&&n.splice(r,1),this},t.emitEvent=function(e,t){let n=this._events&&this._events[e];if(!n||!n.length)return this;n=n.slice(0),t=t||[];let r=this._onceEvents&&this._onceEvents[e];for(let s of n)r&&r[s]&&(this.off(e,s),delete r[s]),s.apply(this,t);return this},t.allOff=function(){return delete this._events,delete this._onceEvents,this},e},e.exports?e.exports=n():t.EvEmitter=n()},35:(e,t,n)=>{var r;!function(s){var i=Object.hasOwnProperty,o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},a="object"==typeof process&&"function"==typeof process.nextTick,l="function"==typeof Symbol,c="object"==typeof Reflect,u="function"==typeof setImmediate?setImmediate:setTimeout,h=l?c&&"function"==typeof Reflect.ownKeys?Reflect.ownKeys:function(e){var t=Object.getOwnPropertyNames(e);return t.push.apply(t,Object.getOwnPropertySymbols(e)),t}:Object.keys;function d(){this._events={},this._conf&&f.call(this,this._conf)}function f(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners!==s&&(this._maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this._newListener=e.newListener),e.removeListener&&(this._removeListener=e.removeListener),e.verboseMemoryLeak&&(this.verboseMemoryLeak=e.verboseMemoryLeak),e.ignoreErrors&&(this.ignoreErrors=e.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function p(e,t){var n="(node) warning: possible EventEmitter memory leak detected. "+e+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(n+=" Event name: "+t+"."),"undefined"!=typeof process&&process.emitWarning){var r=new Error(n);r.name="MaxListenersExceededWarning",r.emitter=this,r.count=e,process.emitWarning(r)}else console.error(n),console.trace&&console.trace()}var m=function(e,t,n){var r=arguments.length;switch(r){case 0:return[];case 1:return[e];case 2:return[e,t];case 3:return[e,t,n];default:for(var s=new Array(r);r--;)s[r]=arguments[r];return s}};function g(e,t){for(var n={},r=e.length,i=t?value.length:0,o=0;o<r;o++)n[e[o]]=o<i?t[o]:s;return n}function y(e,t,n){var r,s;if(this._emitter=e,this._target=t,this._listeners={},this._listenersCount=0,(n.on||n.off)&&(r=n.on,s=n.off),t.addEventListener?(r=t.addEventListener,s=t.removeEventListener):t.addListener?(r=t.addListener,s=t.removeListener):t.on&&(r=t.on,s=t.off),!r&&!s)throw Error("target does not implement any known event API");if("function"!=typeof r)throw TypeError("on method must be a function");if("function"!=typeof s)throw TypeError("off method must be a function");this._on=r,this._off=s;var i=e._observers;i?i.push(this):e._observers=[this]}function v(e,t,n,r){var o=Object.assign({},t);if(!e)return o;if("object"!=typeof e)throw TypeError("options must be an object");var a,l,c,u=Object.keys(e),h=u.length;function d(e){throw Error('Invalid "'+a+'" option value'+(e?". Reason: "+e:""))}for(var f=0;f<h;f++){if(a=u[f],!r&&!i.call(t,a))throw Error('Unknown "'+a+'" option');(l=e[a])!==s&&(c=n[a],o[a]=c?c(l,d):l)}return o}function b(e,t){return"function"==typeof e&&e.hasOwnProperty("prototype")||t("value must be a constructor"),e}function _(e){var t="value must be type of "+e.join("|"),n=e.length,r=e[0],s=e[1];return 1===n?function(e,n){if(typeof e===r)return e;n(t)}:2===n?function(e,n){var i=typeof e;if(i===r||i===s)return e;n(t)}:function(r,s){for(var i=typeof r,o=n;o-- >0;)if(i===e[o])return r;s(t)}}Object.assign(y.prototype,{subscribe:function(e,t,n){var r=this,s=this._target,i=this._emitter,o=this._listeners,a=function(){var r=m.apply(null,arguments),o={data:r,name:t,original:e};if(n){var a=n.call(s,o);!1!==a&&i.emit.apply(i,[o.name].concat(r))}else i.emit.apply(i,[t].concat(r))};if(o[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,i._newListener&&i._removeListener&&!r._onNewListener?(this._onNewListener=function(n){n===t&&null===o[e]&&(o[e]=a,r._on.call(s,e,a))},i.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!i.hasListeners(n)&&o[e]&&(o[e]=null,r._off.call(s,e,a))},o[e]=null,i.on("removeListener",this._onRemoveListener)):(o[e]=a,r._on.call(s,e,a))},unsubscribe:function(e){var t,n,r,s=this,i=this._listeners,o=this._emitter,a=this._off,l=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function c(){s._onNewListener&&(o.off("newListener",s._onNewListener),o.off("removeListener",s._onRemoveListener),s._onNewListener=null,s._onRemoveListener=null);var e=E.call(o,s);o._observers.splice(e,1)}if(e){if(!(t=i[e]))return;a.call(l,e,t),delete i[e],--this._listenersCount||c()}else{for(r=(n=h(i)).length;r-- >0;)e=n[r],a.call(l,e,i[e]);this._listeners={},this._listenersCount=0,c()}}});var w=_(["function"]),S=_(["object","function"]);function x(e,t,n){var r,s,i,o=0,a=new e((function(l,c,u){function h(){s&&(s=null),o&&(clearTimeout(o),o=0)}n=v(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),r=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof u;var d=function(e){h(),l(e)},f=function(e){h(),c(e)};r?t(d,f,u):(s=[function(e){f(e||Error("canceled"))}],t(d,f,(function(e){if(i)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");s.push(e)})),i=!0),n.timeout>0&&(o=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",o=0,a.cancel(e),c(e)}),n.timeout))}));return r||(a.cancel=function(e){if(s){for(var t=s.length,n=1;n<t;n++)s[n](e);s[0](e),s=null}}),a}function E(e){var t=this._observers;if(!t)return-1;for(var n=t.length,r=0;r<n;r++)if(t[r]._target===e)return r;return-1}function k(e,t,n,r,s){if(!n)return null;if(0===r){var i=typeof t;if("string"===i){var o,a,l=0,c=0,u=this.delimiter,d=u.length;if(-1!==(a=t.indexOf(u))){o=new Array(5);do{o[l++]=t.slice(c,a),c=a+d}while(-1!==(a=t.indexOf(u,c)));o[l++]=t.slice(c),t=o,s=l}else t=[t],s=1}else"object"===i?s=t.length:(t=[t],s=1)}var f,p,m,g,y,v,b,_=null,w=t[r],S=t[r+1];if(r===s)n._listeners&&("function"==typeof n._listeners?(e&&e.push(n._listeners),_=[n]):(e&&e.push.apply(e,n._listeners),_=[n]));else{if("*"===w){for(a=(v=h(n)).length;a-- >0;)"_listeners"!==(f=v[a])&&(b=k(e,t,n[f],r+1,s))&&(_?_.push.apply(_,b):_=b);return _}if("**"===w){for((y=r+1===s||r+2===s&&"*"===S)&&n._listeners&&(_=k(e,t,n,s,s)),a=(v=h(n)).length;a-- >0;)"_listeners"!==(f=v[a])&&("*"===f||"**"===f?(n[f]._listeners&&!y&&(b=k(e,t,n[f],s,s))&&(_?_.push.apply(_,b):_=b),b=k(e,t,n[f],r,s)):b=k(e,t,n[f],f===S?r+2:r,s),b&&(_?_.push.apply(_,b):_=b));return _}n[w]&&(_=k(e,t,n[w],r+1,s))}if((p=n["*"])&&k(e,t,p,r+1,s),m=n["**"])if(r<s)for(m._listeners&&k(e,t,m,s,s),a=(v=h(m)).length;a-- >0;)"_listeners"!==(f=v[a])&&(f===S?k(e,t,m[f],r+2,s):f===w?k(e,t,m[f],r+1,s):((g={})[f]=m[f],k(e,t,{"**":g},r+1,s)));else m._listeners?k(e,t,m,s,s):m["*"]&&m["*"]._listeners&&k(e,t,m["*"],s,s);return _}function L(e,t,n){var r,s,i=0,o=0,a=this.delimiter,l=a.length;if("string"==typeof e)if(-1!==(r=e.indexOf(a))){s=new Array(5);do{s[i++]=e.slice(o,r),o=r+l}while(-1!==(r=e.indexOf(a,o)));s[i++]=e.slice(o)}else s=[e],i=1;else s=e,i=e.length;if(i>1)for(r=0;r+1<i;r++)if("**"===s[r]&&"**"===s[r+1])return;var c,u=this.listenerTree;for(r=0;r<i;r++)if(u=u[c=s[r]]||(u[c]={}),r===i-1)return u._listeners?("function"==typeof u._listeners&&(u._listeners=[u._listeners]),n?u._listeners.unshift(t):u._listeners.push(t),!u._listeners.warned&&this._maxListeners>0&&u._listeners.length>this._maxListeners&&(u._listeners.warned=!0,p.call(this,u._listeners.length,c))):u._listeners=t,!0;return!0}function A(e,t,n,r){for(var s,i,o,a,l=h(e),c=l.length,u=e._listeners;c-- >0;)s=e[i=l[c]],o="_listeners"===i?n:n?n.concat(i):[i],a=r||"symbol"==typeof i,u&&t.push(a?o:o.join(this.delimiter)),"object"==typeof s&&A.call(this,s,t,o,a);return t}function P(e){for(var t,n,r,s=h(e),i=s.length;i-- >0;)(t=e[n=s[i]])&&(r=!0,"_listeners"===n||P(t)||delete e[n]);return r}function F(e,t,n){this.emitter=e,this.event=t,this.listener=n}function j(e,t,n){if(!0===n)i=!0;else if(!1===n)r=!0;else{if(!n||"object"!=typeof n)throw TypeError("options should be an object or true");var r=n.async,i=n.promisify,o=n.nextTick,l=n.objectify}if(r||o||i){var c=t,h=t._origin||t;if(o&&!a)throw Error("process.nextTick is not supported");i===s&&(i="AsyncFunction"===t.constructor.name),t=function(){var e=arguments,t=this,n=this.event;return i?o?Promise.resolve():new Promise((function(e){u(e)})).then((function(){return t.event=n,c.apply(t,e)})):(o?process.nextTick:u)((function(){t.event=n,c.apply(t,e)}))},t._async=!0,t._origin=h}return[t,l?new F(this,e,t):this]}function O(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,f.call(this,e)}F.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},O.EventEmitter2=O,O.prototype.listenTo=function(e,t,n){if("object"!=typeof e)throw TypeError("target musts be an object");var r=this;function i(t){if("object"!=typeof t)throw TypeError("events must be an object");var s,i=n.reducers,o=E.call(r,e);s=-1===o?new y(r,e,n):r._observers[o];for(var a,l=h(t),c=l.length,u="function"==typeof i,d=0;d<c;d++)a=l[d],s.subscribe(a,t[a]||a,u?i:i&&i[a])}return n=v(n,{on:s,off:s,reducers:s},{on:w,off:w,reducers:S}),o(t)?i(g(t)):i("string"==typeof t?g(t.split(/\s+/)):t),this},O.prototype.stopListeningTo=function(e,t){var n=this._observers;if(!n)return!1;var r,s=n.length,i=!1;if(e&&"object"!=typeof e)throw TypeError("target should be an object");for(;s-- >0;)r=n[s],e&&r._target!==e||(r.unsubscribe(t),i=!0);return i},O.prototype.delimiter=".",O.prototype.setMaxListeners=function(e){e!==s&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},O.prototype.getMaxListeners=function(){return this._maxListeners},O.prototype.event="",O.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},O.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},O.prototype._once=function(e,t,n,r){return this._many(e,1,t,n,r)},O.prototype.many=function(e,t,n,r){return this._many(e,t,n,!1,r)},O.prototype.prependMany=function(e,t,n,r){return this._many(e,t,n,!0,r)},O.prototype._many=function(e,t,n,r,s){var i=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function o(){return 0==--t&&i.off(e,o),n.apply(this,arguments)}return o._origin=n,this._on(e,o,r,s)},O.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||d.call(this);var e,t,n,r,s,i,o=arguments[0],a=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return!1;if(a&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(n=o.length,l)for(r=0;r<n;r++)if("symbol"==typeof o[r]){i=!0;break}i||(o=o.join(this.delimiter))}var c,u=arguments.length;if(this._all&&this._all.length)for(r=0,n=(c=this._all.slice()).length;r<n;r++)switch(this.event=o,u){case 1:c[r].call(this,o);break;case 2:c[r].call(this,o,arguments[1]);break;case 3:c[r].call(this,o,arguments[1],arguments[2]);break;default:c[r].apply(this,arguments)}if(a)c=[],k.call(this,c,e,this.listenerTree,0,n);else{if("function"==typeof(c=this._events[o])){switch(this.event=o,u){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:for(t=new Array(u-1),s=1;s<u;s++)t[s-1]=arguments[s];c.apply(this,t)}return!0}c&&(c=c.slice())}if(c&&c.length){if(u>3)for(t=new Array(u-1),s=1;s<u;s++)t[s-1]=arguments[s];for(r=0,n=c.length;r<n;r++)switch(this.event=o,u){case 1:c[r].call(this);break;case 2:c[r].call(this,arguments[1]);break;case 3:c[r].call(this,arguments[1],arguments[2]);break;default:c[r].apply(this,t)}return!0}if(!this.ignoreErrors&&!this._all&&"error"===o)throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");return!!this._all},O.prototype.emitAsync=function(){if(!this._events&&!this._all)return!1;this._events||d.call(this);var e,t,n,r,s,i,o=arguments[0],a=this.wildcard;if("newListener"===o&&!this._newListener&&!this._events.newListener)return Promise.resolve([!1]);if(a&&(e=o,"newListener"!==o&&"removeListener"!==o&&"object"==typeof o)){if(r=o.length,l)for(s=0;s<r;s++)if("symbol"==typeof o[s]){t=!0;break}t||(o=o.join(this.delimiter))}var c,u=[],h=arguments.length;if(this._all)for(s=0,r=this._all.length;s<r;s++)switch(this.event=o,h){case 1:u.push(this._all[s].call(this,o));break;case 2:u.push(this._all[s].call(this,o,arguments[1]));break;case 3:u.push(this._all[s].call(this,o,arguments[1],arguments[2]));break;default:u.push(this._all[s].apply(this,arguments))}if(a?(c=[],k.call(this,c,e,this.listenerTree,0)):c=this._events[o],"function"==typeof c)switch(this.event=o,h){case 1:u.push(c.call(this));break;case 2:u.push(c.call(this,arguments[1]));break;case 3:u.push(c.call(this,arguments[1],arguments[2]));break;default:for(n=new Array(h-1),i=1;i<h;i++)n[i-1]=arguments[i];u.push(c.apply(this,n))}else if(c&&c.length){if(c=c.slice(),h>3)for(n=new Array(h-1),i=1;i<h;i++)n[i-1]=arguments[i];for(s=0,r=c.length;s<r;s++)switch(this.event=o,h){case 1:u.push(c[s].call(this));break;case 2:u.push(c[s].call(this,arguments[1]));break;case 3:u.push(c[s].call(this,arguments[1],arguments[2]));break;default:u.push(c[s].apply(this,n))}}else if(!this.ignoreErrors&&!this._all&&"error"===o)return arguments[1]instanceof Error?Promise.reject(arguments[1]):Promise.reject("Uncaught, unspecified 'error' event.");return Promise.all(u)},O.prototype.on=function(e,t,n){return this._on(e,t,!1,n)},O.prototype.prependListener=function(e,t,n){return this._on(e,t,!0,n)},O.prototype.onAny=function(e){return this._onAny(e,!1)},O.prototype.prependAny=function(e){return this._onAny(e,!0)},O.prototype.addListener=O.prototype.on,O.prototype._onAny=function(e,t){if("function"!=typeof e)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),t?this._all.unshift(e):this._all.push(e),this},O.prototype._on=function(e,t,n,r){if("function"==typeof e)return this._onAny(e,t),this;if("function"!=typeof t)throw new Error("on only accepts instances of Function");this._events||d.call(this);var i,o=this;return r!==s&&(t=(i=j.call(this,e,t,r))[0],o=i[1]),this._newListener&&this.emit("newListener",e,t),this.wildcard?(L.call(this,e,t,n),o):(this._events[e]?("function"==typeof this._events[e]&&(this._events[e]=[this._events[e]]),n?this._events[e].unshift(t):this._events[e].push(t),!this._events[e].warned&&this._maxListeners>0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,p.call(this,this._events[e].length,e))):this._events[e]=t,o)},O.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var s="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=k.call(this,null,s,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var i=0;i<r.length;i++){var a=r[i];if(n=a._listeners,o(n)){for(var l=-1,c=0,u=n.length;c<u;c++)if(n[c]===t||n[c].listener&&n[c].listener===t||n[c]._origin&&n[c]._origin===t){l=c;break}if(l<0)continue;return this.wildcard?a._listeners.splice(l,1):this._events[e].splice(l,1),0===n.length&&(this.wildcard?delete a._listeners:delete this._events[e]),this._removeListener&&this.emit("removeListener",e,t),this}(n===t||n.listener&&n.listener===t||n._origin&&n._origin===t)&&(this.wildcard?delete a._listeners:delete this._events[e],this._removeListener&&this.emit("removeListener",e,t))}return this.listenerTree&&P(this.listenerTree),this},O.prototype.offAny=function(e){var t,n=0,r=0;if(e&&this._all&&this._all.length>0){for(n=0,r=(t=this._all).length;n<r;n++)if(e===t[n])return t.splice(n,1),this._removeListener&&this.emit("removeListenerAny",e),this}else{if(t=this._all,this._removeListener)for(n=0,r=t.length;n<r;n++)this.emit("removeListenerAny",t[n]);this._all=[]}return this},O.prototype.removeListener=O.prototype.off,O.prototype.removeAllListeners=function(e){if(e===s)return!this._events||d.call(this),this;if(this.wildcard){var t,n=k.call(this,null,e,this.listenerTree,0);if(!n)return this;for(t=0;t<n.length;t++)n[t]._listeners=null;this.listenerTree&&P(this.listenerTree)}else this._events&&(this._events[e]=null);return this},O.prototype.listeners=function(e){var t,n,r,i,o,a=this._events;if(e===s){if(this.wildcard)throw Error("event name required for wildcard emitter");if(!a)return[];for(i=(t=h(a)).length,r=[];i-- >0;)"function"==typeof(n=a[t[i]])?r.push(n):r.push.apply(r,n);return r}if(this.wildcard){if(!(o=this.listenerTree))return[];var l=[],c="string"==typeof e?e.split(this.delimiter):e.slice();return k.call(this,l,c,o,0),l}return a&&(n=a[e])?"function"==typeof n?[n]:n:[]},O.prototype.eventNames=function(e){var t=this._events;return this.wildcard?A.call(this,this.listenerTree,[],null,e):t?h(t):[]},O.prototype.listenerCount=function(e){return this.listeners(e).length},O.prototype.hasListeners=function(e){if(this.wildcard){var t=[],n="string"==typeof e?e.split(this.delimiter):e.slice();return k.call(this,t,n,this.listenerTree,0),t.length>0}var r=this._events,i=this._all;return!!(i&&i.length||r&&(e===s?h(r).length:r[e]))},O.prototype.listenersAny=function(){return this._all?this._all:[]},O.prototype.waitFor=function(e,t){var n=this,r=typeof t;return"number"===r?t={timeout:t}:"function"===r&&(t={filter:t}),x((t=v(t,{timeout:0,filter:s,handleError:!1,Promise,overload:!1},{filter:w,Promise:b})).Promise,(function(r,s,i){function o(){var i=t.filter;if(!i||i.apply(n,arguments))if(n.off(e,o),t.handleError){var a=arguments[0];a?s(a):r(m.apply(null,arguments).slice(1))}else r(m.apply(null,arguments))}i((function(){n.off(e,o)})),n._on(e,o,!1)}),{timeout:t.timeout,overload:t.overload})};var q=O.prototype;Object.defineProperties(O,{defaultMaxListeners:{get:function(){return q._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");q._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return x((n=v(n,{Promise,timeout:0,overload:!1},{Promise:b})).Promise,(function(n,r,s){var i;if("function"==typeof e.addEventListener)return i=function(){n(m.apply(null,arguments))},s((function(){e.removeEventListener(t,i)})),void e.addEventListener(t,i,{once:!0});var o,a=function(){o&&e.removeListener("error",o),n(m.apply(null,arguments))};"error"!==t&&(o=function(n){e.removeListener(t,a),r(n)},e.once("error",o)),s((function(){o&&e.removeListener("error",o),e.removeListener(t,a)})),e.once(t,a)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(q,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),(r=function(){return O}.call(t,n,t,e))===s||(e.exports=r)}()},3709:function(e){var t,n;t=this,n=function(e){let t={extend:function(e,t){return Object.assign(e,t)},modulo:function(e,t){return(e%t+t)%t},makeArray:function(e){return Array.isArray(e)?e:null==e?[]:"object"==typeof e&&"number"==typeof e.length?[...e]:[e]},removeFrom:function(e,t){let n=e.indexOf(t);-1!=n&&e.splice(n,1)},getParent:function(e,t){for(;e.parentNode&&e!=document.body;)if((e=e.parentNode).matches(t))return e},getQueryElement:function(e){return"string"==typeof e?document.querySelector(e):e},handleEvent:function(e){let t="on"+e.type;this[t]&&this[t](e)},filterFindElements:function(e,n){return(e=t.makeArray(e)).filter((e=>e instanceof HTMLElement)).reduce(((e,t)=>{if(!n)return e.push(t),e;t.matches(n)&&e.push(t);let r=t.querySelectorAll(n);return e.concat(...r)}),[])},debounceMethod:function(e,t,n){n=n||100;let r=e.prototype[t],s=t+"Timeout";e.prototype[t]=function(){clearTimeout(this[s]);let e=arguments;this[s]=setTimeout((()=>{r.apply(this,e),delete this[s]}),n)}},docReady:function(e){let t=document.readyState;"complete"==t||"interactive"==t?setTimeout(e):document.addEventListener("DOMContentLoaded",e)},toDashed:function(e){return e.replace(/(.)([A-Z])/g,(function(e,t,n){return t+"-"+n})).toLowerCase()}},n=e.console;return t.htmlInit=function(r,s){t.docReady((function(){let i="data-"+t.toDashed(s),o=document.querySelectorAll(`[${i}]`),a=e.jQuery;[...o].forEach((e=>{let t,o=e.getAttribute(i);try{t=o&&JSON.parse(o)}catch(t){return void(n&&n.error(`Error parsing ${i} on ${e.className}: ${t}`))}let l=new r(e,t);a&&a.data(e,s,l)}))}))},t},e.exports?e.exports=n(t):t.fizzyUIUtils=n(t)},2345:(e,t,n)=>{!function(t,r){e.exports?e.exports=r(0,n(7192),n(3709)):r(0,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,n){class r{constructor(e,t){this.element=e,this.infScroll=t,this.clickHandler=this.onClick.bind(this),this.element.addEventListener("click",this.clickHandler),t.on("request",this.disable.bind(this)),t.on("load",this.enable.bind(this)),t.on("error",this.hide.bind(this)),t.on("last",this.hide.bind(this))}onClick(e){e.preventDefault(),this.infScroll.loadNextPage()}enable(){this.element.removeAttribute("disabled")}disable(){this.element.disabled="disabled"}hide(){this.element.style.display="none"}destroy(){this.element.removeEventListener("click",this.clickHandler)}}return t.create.button=function(){let e=n.getQueryElement(this.options.button);e&&(this.button=new r(e,this))},t.destroy.button=function(){this.button&&this.button.destroy()},t.Button=r,t}))},7192:(e,t,n)=>{!function(t,r){e.exports?e.exports=r(t,n(7138),n(3709)):t.InfiniteScroll=r(t,t.EvEmitter,t.fizzyUIUtils)}(window,(function(e,t,n){let r=e.jQuery,s={};function i(e,t){let o=n.getQueryElement(e);if(o){if((e=o).infiniteScrollGUID){let n=s[e.infiniteScrollGUID];return n.option(t),n}this.element=e,this.options={...i.defaults},this.option(t),r&&(this.$element=r(this.element)),this.create()}else console.error("Bad element for InfiniteScroll: "+(o||e))}i.defaults={},i.create={},i.destroy={};let o=i.prototype;Object.assign(o,t.prototype);let a=0;o.create=function(){let e=this.guid=++a;if(this.element.infiniteScrollGUID=e,s[e]=this,this.pageIndex=1,this.loadCount=0,this.updateGetPath(),this.getPath&&this.getPath()){this.updateGetAbsolutePath(),this.log("initialized",[this.element.className]),this.callOnInit();for(let e in i.create)i.create[e].call(this)}else console.error("Disabling InfiniteScroll")},o.option=function(e){Object.assign(this.options,e)},o.callOnInit=function(){let e=this.options.onInit;e&&e.call(this,this)},o.dispatchEvent=function(e,t,n){this.log(e,n);let s=t?[t].concat(n):n;if(this.emitEvent(e,s),!r||!this.$element)return;let i=e+=".infiniteScroll";if(t){let n=r.Event(t);n.type=e,i=n}this.$element.trigger(i,n)};let l={initialized:e=>`on ${e}`,request:e=>`URL: ${e}`,load:(e,t)=>`${e.title||""}. URL: ${t}`,error:(e,t)=>`${e}. URL: ${t}`,append:(e,t,n)=>`${n.length} items. URL: ${t}`,last:(e,t)=>`URL: ${t}`,history:(e,t)=>`URL: ${t}`,pageIndex:function(e,t){return`current page determined to be: ${e} from ${t}`}};o.log=function(e,t){if(!this.options.debug)return;let n=`[InfiniteScroll] ${e}`,r=l[e];r&&(n+=". "+r.apply(this,t)),console.log(n)},o.updateMeasurements=function(){this.windowHeight=e.innerHeight;let t=this.element.getBoundingClientRect();this.top=t.top+e.scrollY},o.updateScroller=function(){let t=this.options.elementScroll;if(t){if(this.scroller=!0===t?this.element:n.getQueryElement(t),!this.scroller)throw new Error(`Unable to find elementScroll: ${t}`)}else this.scroller=e},o.updateGetPath=function(){let e=this.options.path;if(!e)return void console.error(`InfiniteScroll path option required. Set as: ${e}`);let t=typeof e;"function"!=t?"string"==t&&e.match("{{#}}")?this.updateGetPathTemplate(e):this.updateGetPathSelector(e):this.getPath=e},o.updateGetPathTemplate=function(e){this.getPath=()=>{let t=this.pageIndex+1;return e.replace("{{#}}",t)};let t=e.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)"),n=new RegExp(t),r=location.href.match(n);r&&(this.pageIndex=parseInt(r[1],10),this.log("pageIndex",[this.pageIndex,"template string"]))};let c=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/],u=i.getPathParts=function(e){if(e)for(let t of c){let n=e.match(t);if(n){let[,e,t,r]=n;return{begin:e,index:t,end:r}}}};o.updateGetPathSelector=function(e){let t=document.querySelector(e);if(!t)return void console.error(`Bad InfiniteScroll path option. Next link not found: ${e}`);let n=t.getAttribute("href"),r=u(n);if(!r)return void console.error(`InfiniteScroll unable to parse next link href: ${n}`);let{begin:s,index:i,end:o}=r;this.isPathSelector=!0,this.getPath=()=>s+(this.pageIndex+1)+o,this.pageIndex=parseInt(i,10)-1,this.log("pageIndex",[this.pageIndex,"next link"])},o.updateGetAbsolutePath=function(){let e=this.getPath();if(e.match(/^http/)||e.match(/^\//))return void(this.getAbsolutePath=this.getPath);let{pathname:t}=location,n=e.match(/^\?/),r=t.substring(0,t.lastIndexOf("/")),s=n?t:r+"/";this.getAbsolutePath=()=>s+this.getPath()},i.create.hideNav=function(){let e=n.getQueryElement(this.options.hideNav);e&&(e.style.display="none",this.nav=e)},i.destroy.hideNav=function(){this.nav&&(this.nav.style.display="")},o.destroy=function(){this.allOff();for(let e in i.destroy)i.destroy[e].call(this);delete this.element.infiniteScrollGUID,delete s[this.guid],r&&this.$element&&r.removeData(this.element,"infiniteScroll")},i.throttle=function(e,t){let n,r;return t=t||200,function(){let s=+new Date,i=arguments,o=()=>{n=s,e.apply(this,i)};n&&s<n+t?(clearTimeout(r),r=setTimeout(o,t)):o()}},i.data=function(e){let t=(e=n.getQueryElement(e))&&e.infiniteScrollGUID;return t&&s[t]},i.setJQuery=function(e){r=e},n.htmlInit(i,"infinite-scroll"),o._init=function(){};let{jQueryBridget:h}=e;return r&&h&&h("infiniteScroll",i,r),i}))},7944:(e,t,n)=>{!function(t,r){e.exports?e.exports=r(t,n(7192),n(3709)):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,n){let r=t.prototype;Object.assign(t.defaults,{history:"replace"});let s=document.createElement("a");return t.create.history=function(){this.options.history&&(s.href=this.getAbsolutePath(),(s.origin||s.protocol+"//"+s.host)==location.origin?this.options.append?this.createHistoryAppend():this.createHistoryPageLoad():console.error(`[InfiniteScroll] cannot set history with different origin: ${s.origin} on ${location.origin} . History behavior disabled.`))},r.createHistoryAppend=function(){this.updateMeasurements(),this.updateScroller(),this.scrollPages=[{top:0,path:location.href,title:document.title}],this.scrollPage=this.scrollPages[0],this.scrollHistoryHandler=this.onScrollHistory.bind(this),this.unloadHandler=this.onUnload.bind(this),this.scroller.addEventListener("scroll",this.scrollHistoryHandler),this.on("append",this.onAppendHistory),this.bindHistoryAppendEvents(!0)},r.bindHistoryAppendEvents=function(t){let n=t?"addEventListener":"removeEventListener";this.scroller[n]("scroll",this.scrollHistoryHandler),e[n]("unload",this.unloadHandler)},r.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)},t.destroy.history=r.destroyHistory=function(){this.options.history&&this.options.append&&this.bindHistoryAppendEvents(!1)},r.onAppendHistory=function(e,t,n){if(!n||!n.length)return;let r=n[0],i=this.getElementScrollY(r);s.href=t,this.scrollPages.push({top:i,path:s.href,title:e.title})},r.getElementScrollY=function(t){return this.options.elementScroll?t.offsetTop-this.top:t.getBoundingClientRect().top+e.scrollY},r.onScrollHistory=function(){let e=this.getClosestScrollPage();e!=this.scrollPage&&(this.scrollPage=e,this.setHistory(e.title,e.path))},n.debounceMethod(t,"onScrollHistory",150),r.getClosestScrollPage=function(){let t,n;t=this.options.elementScroll?this.scroller.scrollTop+this.scroller.clientHeight/2:e.scrollY+this.windowHeight/2;for(let e of this.scrollPages){if(e.top>=t)break;n=e}return n},r.setHistory=function(e,t){let n=this.options.history;n&&history[n+"State"]&&(history[n+"State"](null,e,t),this.options.historyTitle&&(document.title=e),this.dispatchEvent("history",null,[e,t]))},r.onUnload=function(){if(0===this.scrollPage.top)return;let t=e.scrollY-this.scrollPage.top+this.top;this.destroyHistory(),scrollTo(0,t)},r.onPageLoadHistory=function(e,t){this.setHistory(e.title,t)},t}))},9280:(e,t,n)=>{var r;window,e.exports&&(e.exports=(r=n(7192),n(8130),n(9801),n(7944),n(2345),n(3080),r))},8130:(e,t,n)=>{!function(t,r){e.exports?e.exports=r(t,n(7192)):r(t,t.InfiniteScroll)}(window,(function(e,t){let n=t.prototype;Object.assign(t.defaults,{loadOnScroll:!0,checkLastPage:!0,responseBody:"text",domParseResponse:!0}),t.create.pageLoad=function(){this.canLoad=!0,this.on("scrollThreshold",this.onScrollThresholdLoad),this.on("load",this.checkLastPage),this.options.outlayer&&this.on("append",this.onAppendOutlayer)},n.onScrollThresholdLoad=function(){this.options.loadOnScroll&&this.loadNextPage()};let r=new DOMParser;function s(e){let t=document.createDocumentFragment();return e&&t.append(...e),t}return n.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:e,domParseResponse:t,fetchOptions:n}=this.options,s=this.getAbsolutePath();this.isLoading=!0,"function"==typeof n&&(n=n());let i=fetch(s,n).then((n=>{if(!n.ok){let e=new Error(n.statusText);return this.onPageError(e,s,n),{response:n}}return n[e]().then((i=>("text"==e&&t&&(i=r.parseFromString(i,"text/html")),204==n.status?(this.lastPageReached(i,s),{body:i,response:n}):this.onPageLoad(i,s,n))))})).catch((e=>{this.onPageError(e,s)}));return this.dispatchEvent("request",null,[s,i]),i},n.onPageLoad=function(e,t,n){return this.options.append||(this.isLoading=!1),this.pageIndex++,this.loadCount++,this.dispatchEvent("load",null,[e,t,n]),this.appendNextPage(e,t,n)},n.appendNextPage=function(e,t,n){let{append:r,responseBody:i,domParseResponse:o}=this.options;if("text"!=i||!o||!r)return{body:e,response:n};let a=e.querySelectorAll(r),l={body:e,response:n,items:a};if(!a||!a.length)return this.lastPageReached(e,t),l;let c=s(a),u=()=>(this.appendItems(a,c),this.isLoading=!1,this.dispatchEvent("append",null,[e,t,a,n]),l);return this.options.outlayer?this.appendOutlayerItems(c,u):u()},n.appendItems=function(e,t){e&&e.length&&(function(e){let t=e.querySelectorAll("script");for(let e of t){let t=document.createElement("script"),n=e.attributes;for(let e of n)t.setAttribute(e.name,e.value);t.innerHTML=e.innerHTML,e.parentNode.replaceChild(t,e)}}(t=t||s(e)),this.element.appendChild(t))},n.appendOutlayerItems=function(n,r){let s=t.imagesLoaded||e.imagesLoaded;return s?new Promise((function(e){s(n,(function(){let t=r();e(t)}))})):(console.error("[InfiniteScroll] imagesLoaded required for outlayer option"),void(this.isLoading=!1))},n.onAppendOutlayer=function(e,t,n){this.options.outlayer.appended(n)},n.checkLastPage=function(e,t){let n,{checkLastPage:r,path:s}=this.options;if(r){if("function"==typeof s&&!this.getPath())return void this.lastPageReached(e,t);"string"==typeof r?n=r:this.isPathSelector&&(n=s),n&&e.querySelector&&(e.querySelector(n)||this.lastPageReached(e,t))}},n.lastPageReached=function(e,t){this.canLoad=!1,this.dispatchEvent("last",null,[e,t])},n.onPageError=function(e,t,n){return this.isLoading=!1,this.canLoad=!1,this.dispatchEvent("error",null,[e,t,n]),e},t.create.prefill=function(){if(!this.options.prefill)return;let e=this.options.append;e?(this.updateMeasurements(),this.updateScroller(),this.isPrefilling=!0,this.on("append",this.prefill),this.once("error",this.stopPrefill),this.once("last",this.stopPrefill),this.prefill()):console.error(`append option required for prefill. Set as :${e}`)},n.prefill=function(){let e=this.getPrefillDistance();this.isPrefilling=e>=0,this.isPrefilling?(this.log("prefill"),this.loadNextPage()):this.stopPrefill()},n.getPrefillDistance=function(){return this.options.elementScroll?this.scroller.clientHeight-this.scroller.scrollHeight:this.windowHeight-this.element.clientHeight},n.stopPrefill=function(){this.log("stopPrefill"),this.off("append",this.prefill)},t}))},9801:(e,t,n)=>{!function(t,r){e.exports?e.exports=r(t,n(7192),n(3709)):r(t,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,n){let r=t.prototype;return Object.assign(t.defaults,{scrollThreshold:400}),t.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this),this.resizeHandler=this.onResize.bind(this);let e=this.options.scrollThreshold;(e||0===e)&&this.enableScrollWatch()},t.destroy.scrollWatch=function(){this.disableScrollWatch()},r.enableScrollWatch=function(){this.isScrollWatching||(this.isScrollWatching=!0,this.updateMeasurements(),this.updateScroller(),this.on("last",this.disableScrollWatch),this.bindScrollWatchEvents(!0))},r.disableScrollWatch=function(){this.isScrollWatching&&(this.bindScrollWatchEvents(!1),delete this.isScrollWatching)},r.bindScrollWatchEvents=function(t){let n=t?"addEventListener":"removeEventListener";this.scroller[n]("scroll",this.pageScrollHandler),e[n]("resize",this.resizeHandler)},r.onPageScroll=t.throttle((function(){this.getBottomDistance()<=this.options.scrollThreshold&&this.dispatchEvent("scrollThreshold")})),r.getBottomDistance=function(){let t,n;return this.options.elementScroll?(t=this.scroller.scrollHeight,n=this.scroller.scrollTop+this.scroller.clientHeight):(t=this.top+this.element.clientHeight,n=e.scrollY+this.windowHeight),t-n},r.onResize=function(){this.updateMeasurements()},n.debounceMethod(t,"onResize",150),t}))},3080:(e,t,n)=>{!function(t,r){e.exports?e.exports=r(0,n(7192),n(3709)):r(0,t.InfiniteScroll,t.fizzyUIUtils)}(window,(function(e,t,n){let r=t.prototype;function s(e){o(e,"none")}function i(e){o(e,"block")}function o(e,t){e&&(e.style.display=t)}return t.create.status=function(){let e=n.getQueryElement(this.options.status);e&&(this.statusElement=e,this.statusEventElements={request:e.querySelector(".infinite-scroll-request"),error:e.querySelector(".infinite-scroll-error"),last:e.querySelector(".infinite-scroll-last")},this.on("request",this.showRequestStatus),this.on("error",this.showErrorStatus),this.on("last",this.showLastStatus),this.bindHideStatus("on"))},r.bindHideStatus=function(e){let t=this.options.append?"append":"load";this[e](t,this.hideAllStatus)},r.showRequestStatus=function(){this.showStatus("request")},r.showErrorStatus=function(){this.showStatus("error")},r.showLastStatus=function(){this.showStatus("last"),this.bindHideStatus("off")},r.showStatus=function(e){i(this.statusElement),this.hideStatusEventElements(),i(this.statusEventElements[e])},r.hideAllStatus=function(){s(this.statusElement),this.hideStatusEventElements()},r.hideStatusEventElements=function(){for(let e in this.statusEventElements)s(this.statusEventElements[e])},t}))},2257:function(e,t){var n,r,s;!function(i,o){"use strict";r=[],void 0===(s="function"==typeof(n=function(){function e(e){return"-Inf"===e?-1/0:"+Inf"===e||"Inf"===e||"*"===e?1/0:parseInt(e,10)}var t=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/,n=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/,r="en",s=function(e){e=e||{},this.locale=e.locale||function(){if("undefined"!=typeof document&&document.documentElement)return document.documentElement.lang}()||r,this.fallback=e.fallback,this.messages=e.messages};return s.prototype.setMessages=function(e){this.messages=e},s.prototype.getLocale=function(){return this.locale||this.fallback},s.prototype.setLocale=function(e){this.locale=e},s.prototype.getFallback=function(){return this.fallback},s.prototype.setFallback=function(e){this.fallback=e},s.prototype.has=function(e,t){return!("string"!=typeof e||!this.messages)&&null!==this._getMessage(e,t)},s.prototype.get=function(e,t,n){if(!this.has(e,n))return e;var r=this._getMessage(e,n);return null===r?e:(t&&(r=this._applyReplacements(r,t)),r)},s.prototype.trans=function(e,t){return this.get(e,t)},s.prototype.choice=function(e,t,r,s){(r=void 0!==r?r:{}).count=t;var i=this.get(e,r,s);if(null==i)return i;for(var o=i.split("|"),a=[],l=0;l<o.length;l++)if(o[l]=o[l].trim(),n.test(o[l])){var c=o[l].split(/\s/);a.push(c.shift()),o[l]=c.join(" ")}if(1===o.length)return i;for(var u=0;u<a.length;u++)if(this._testInterval(t,a[u]))return o[u];return s=s||this._getLocale(e),o[this._getPluralForm(t,s)]},s.prototype.transChoice=function(e,t,n){return this.choice(e,t,n)},s.prototype._parseKey=function(e,t){if("string"!=typeof e||"string"!=typeof t)return null;var n=e.split("."),r=n[0].replace(/\//g,".");return{source:t+"."+r,sourceFallback:this.getFallback()+"."+r,entries:n.slice(1)}},s.prototype._getMessage=function(e,t){if(t=t||this.getLocale(),e=this._parseKey(e,t),void 0===this.messages[e.source]&&void 0===this.messages[e.sourceFallback])return null;var n=this.messages[e.source],r=e.entries.slice(),s=r.join(".");if("string"!=typeof(n=void 0!==n?this._getValueInKey(n,s):void 0)&&this.messages[e.sourceFallback])for(n=this.messages[e.sourceFallback],r=e.entries.slice(),s="";r.length&&void 0!==n;)n[s=s?s.concat(".",r.shift()):r.shift()]&&(n=n[s],s="");return"string"!=typeof n?null:n},s.prototype._getValueInKey=function(e,t){if("string"==typeof e[t])return e[t];for(var n=(t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),r=0,s=n.length;r<s;++r){var i=n.slice(0,r+1).join("."),o=n.slice(r+1,n.length).join(".");if(e[i])return this._getValueInKey(e[i],o)}return e},s.prototype._getLocale=function(e){return e=this._parseKey(e,this.locale),this.messages[e.source]?this.locale:this.messages[e.sourceFallback]?this.fallback:null},s.prototype._findMessageInTree=function(e,t){for(;e.length&&void 0!==t;){var n=e.join(".");if(t[n]){t=t[n];break}t=t[e.shift()]}return t},s.prototype._sortReplacementKeys=function(e,t){return t.length-e.length},s.prototype._applyReplacements=function(e,t){return Object.keys(t).sort(this._sortReplacementKeys).forEach((function(n){e=e.replace(new RegExp(":"+n,"gi"),(function(e){var r=t[n];return e===e.toUpperCase()?r.toUpperCase():e===e.replace(/\w/i,(function(e){return e.toUpperCase()}))?r.charAt(0).toUpperCase()+r.slice(1):r}))})),e},s.prototype._testInterval=function(n,r){if("string"!=typeof r)throw"Invalid interval: should be a string.";var s=(r=r.trim()).match(t);if(!s)throw"Invalid interval: "+r;if(!s[2]){var i=(s=s.filter((function(e){return!!e})))[1],o=e(s[2]);o===1/0&&(o=-1/0);var a=e(s[3]),l=s[4];return("["===i?n>=o:n>o)&&("]"===l?n<=a:n<a)}for(var c=s[2].split(","),u=0;u<c.length;u++)if(parseInt(c[u],10)===n)return!0;return!1},s.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":default:return 0;case"af":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"ur":case"zu":return 1==e?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"hy":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return 0===e||1===e?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 1==e?0:e>=2&&e<=4?1:2;case"ga":return 1==e?0:2==e?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 1==e?0:0===e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3;case"lv":return 0===e?0:e%10==1&&e%100!=11?1:2;case"pl":return 1==e?0:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?1:2;case"cy":return 1==e?0:2==e?1:8==e||11==e?2:3;case"ro":return 1==e?0:0===e||e%100>0&&e%100<20?1:2;case"ar":return 0===e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5}},s})?n.apply(t,r):n)||(e.exports=s)}()},3230:(e,t,n)=>{var r=n(5173),s=n(2046),i=[n(2807)];e.exports=r.createStore(s,i)},2807:(e,t,n)=>{e.exports=function(){return n(4233),{}}},4233:()=>{"object"!=typeof JSON&&(JSON={}),function(){"use strict";var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,(function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function str(e,t){var n,r,s,i,o,a=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(gap+=indent,o=[],"[object Array]"===Object.prototype.toString.apply(l)){for(i=l.length,n=0;n<i;n+=1)o[n]=str(n,l)||"null";return s=0===o.length?"[]":gap?"[\n"+gap+o.join(",\n"+gap)+"\n"+a+"]":"["+o.join(",")+"]",gap=a,s}if(rep&&"object"==typeof rep)for(i=rep.length,n=0;n<i;n+=1)"string"==typeof rep[n]&&(s=str(r=rep[n],l))&&o.push(quote(r)+(gap?": ":":")+s);else for(r in l)Object.prototype.hasOwnProperty.call(l,r)&&(s=str(r,l))&&o.push(quote(r)+(gap?": ":":")+s);return s=0===o.length?"{}":gap?"{\n"+gap+o.join(",\n"+gap)+"\n"+a+"}":"{"+o.join(",")+"}",gap=a,s}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value),"function"!=typeof JSON.stringify&&(meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,t,n){var r;if(gap="",indent="","number"==typeof n)for(r=0;r<n;r+=1)indent+=" ";else"string"==typeof n&&(indent=n);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){var j;function walk(e,t){var n,r,s=e[t];if(s&&"object"==typeof s)for(n in s)Object.prototype.hasOwnProperty.call(s,n)&&(void 0!==(r=walk(s,n))?s[n]=r:delete s[n]);return reviver.call(e,t,s)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,(function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()},5173:(e,t,n)=>{var r=n(2476),s=r.slice,i=r.pluck,o=r.each,a=r.bind,l=r.create,c=r.isList,u=r.isFunction,h=r.isObject;e.exports={createStore:f};var d={version:"2.0.12",enabled:!1,get:function(e,t){var n=this.storage.read(this._namespacePrefix+e);return this._deserialize(n,t)},set:function(e,t){return void 0===t?this.remove(e):(this.storage.write(this._namespacePrefix+e,this._serialize(t)),t)},remove:function(e){this.storage.remove(this._namespacePrefix+e)},each:function(e){var t=this;this.storage.each((function(n,r){e.call(t,t._deserialize(n),(r||"").replace(t._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(e){return this._namespacePrefix=="__storejs_"+e+"_"},createStore:function(){return f.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return f(this.storage,this.plugins,e)}};function f(e,t,n){n||(n=""),e&&!c(e)&&(e=[e]),t&&!c(t)&&(t=[t]);var r=n?"__storejs_"+n+"_":"",f=n?new RegExp("^"+r):null;if(!/^[a-zA-Z0-9_\-]*$/.test(n))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var p={_namespacePrefix:r,_namespaceRegexp:f,_testStorage:function(e){try{var t="__storejs__test__";e.write(t,t);var n=e.read(t)===t;return e.remove(t),n}catch(e){return!1}},_assignPluginFnProp:function(e,t){var n=this[t];this[t]=function(){var t=s(arguments,0),r=this;function i(){if(n)return o(arguments,(function(e,n){t[n]=e})),n.apply(r,t)}var a=[i].concat(t);return e.apply(r,a)}},_serialize:function(e){return JSON.stringify(e)},_deserialize:function(e,t){if(!e)return t;var n="";try{n=JSON.parse(e)}catch(t){n=e}return void 0!==n?n:t},_addStorage:function(e){this.enabled||this._testStorage(e)&&(this.storage=e,this.enabled=!0)},_addPlugin:function(e){var t=this;if(c(e))o(e,(function(e){t._addPlugin(e)}));else if(!i(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!u(e))throw new Error("Plugins must be function values that return objects");var n=e.call(this);if(!h(n))throw new Error("Plugins must return an object of function properties");o(n,(function(n,r){if(!u(n))throw new Error("Bad plugin property: "+r+" from plugin "+e.name+". Plugins should only return functions.");t._assignPluginFnProp(n,r)}))}},addStorage:function(e){!function(){var e="undefined"==typeof console?null:console;e&&(e.warn?e.warn:e.log).apply(e,arguments)}("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(e)}},m=l(p,d,{plugins:[]});return m.raw={},o(m,(function(e,t){u(e)&&(m.raw[t]=a(m,e))})),o(e,(function(e){m._addStorage(e)})),o(t,(function(e){m._addPlugin(e)})),m}},2476:(e,t,n)=>{var r=Object.assign?Object.assign:function(e,t,n,r){for(var s=1;s<arguments.length;s++)l(Object(arguments[s]),(function(t,n){e[n]=t}));return e},s=function(){if(Object.create)return function(e,t,n,s){var i=a(arguments,1);return r.apply(this,[Object.create(e)].concat(i))};{function e(){}return function(t,n,s,i){var o=a(arguments,1);return e.prototype=t,r.apply(this,[new e].concat(o))}}}(),i=String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},o="undefined"!=typeof window?window:n.g;function a(e,t){return Array.prototype.slice.call(e,t||0)}function l(e,t){c(e,(function(e,n){return t(e,n),!1}))}function c(e,t){if(u(e)){for(var n=0;n<e.length;n++)if(t(e[n],n))return e[n]}else for(var r in e)if(e.hasOwnProperty(r)&&t(e[r],r))return e[r]}function u(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}e.exports={assign:r,create:s,trim:i,bind:function(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}},slice:a,each:l,map:function(e,t){var n=u(e)?[]:{};return c(e,(function(e,r){return n[r]=t(e,r),!1})),n},pluck:c,isList:u,isFunction:function(e){return e&&"[object Function]"==={}.toString.call(e)},isObject:function(e){return e&&"[object Object]"==={}.toString.call(e)},Global:o}},2046:(e,t,n)=>{e.exports=[n(4290),n(1468),n(8540),n(1236),n(2842),n(6126)]},1236:(e,t,n)=>{var r=n(2476),s=r.Global,i=r.trim;e.exports={name:"cookieStorage",read:function(e){if(!e||!c(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(o.cookie.replace(new RegExp(t),"$1"))},write:function(e,t){e&&(o.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")},each:a,remove:l,clearAll:function(){a((function(e,t){l(t)}))}};var o=s.document;function a(e){for(var t=o.cookie.split(/; ?/g),n=t.length-1;n>=0;n--)if(i(t[n])){var r=t[n].split("="),s=unescape(r[0]);e(unescape(r[1]),s)}}function l(e){e&&c(e)&&(o.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function c(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(o.cookie)}},4290:(e,t,n)=>{var r=n(2476).Global;function s(){return r.localStorage}function i(e){return s().getItem(e)}e.exports={name:"localStorage",read:i,write:function(e,t){return s().setItem(e,t)},each:function(e){for(var t=s().length-1;t>=0;t--){var n=s().key(t);e(i(n),n)}},remove:function(e){return s().removeItem(e)},clearAll:function(){return s().clear()}}},6126:e=>{e.exports={name:"memoryStorage",read:function(e){return t[e]},write:function(e,n){t[e]=n},each:function(e){for(var n in t)t.hasOwnProperty(n)&&e(t[n],n)},remove:function(e){delete t[e]},clearAll:function(e){t={}}};var t={}},1468:(e,t,n)=>{var r=n(2476).Global;e.exports={name:"oldFF-globalStorage",read:function(e){return s[e]},write:function(e,t){s[e]=t},each:i,remove:function(e){return s.removeItem(e)},clearAll:function(){i((function(e,t){delete s[e]}))}};var s=r.globalStorage;function i(e){for(var t=s.length-1;t>=0;t--){var n=s.key(t);e(s[n],n)}}},8540:(e,t,n)=>{var r=n(2476).Global;e.exports={name:"oldIE-userDataStorage",write:function(e,t){if(!a){var n=c(e);o((function(e){e.setAttribute(n,t),e.save(s)}))}},read:function(e){if(!a){var t=c(e),n=null;return o((function(e){n=e.getAttribute(t)})),n}},each:function(e){o((function(t){for(var n=t.XMLDocument.documentElement.attributes,r=n.length-1;r>=0;r--){var s=n[r];e(t.getAttribute(s.name),s.name)}}))},remove:function(e){var t=c(e);o((function(e){e.removeAttribute(t),e.save(s)}))},clearAll:function(){o((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(s);for(var n=t.length-1;n>=0;n--)e.removeAttribute(t[n].name);e.save(s)}))}};var s="storejs",i=r.document,o=function(){if(!i||!i.documentElement||!i.documentElement.addBehavior)return null;var e,t,n;try{(t=new ActiveXObject("htmlfile")).open(),t.write('<script>document.w=window<\/script><iframe src="/favicon.ico"></iframe>'),t.close(),e=t.w.frames[0].document,n=e.createElement("div")}catch(t){n=i.createElement("div"),e=i.body}return function(t){var r=[].slice.call(arguments,0);r.unshift(n),e.appendChild(n),n.addBehavior("#default#userData"),n.load(s),t.apply(this,r),e.removeChild(n)}}(),a=(r.navigator?r.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./),l=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function c(e){return e.replace(/^\d/,"___$&").replace(l,"___")}},2842:(e,t,n)=>{var r=n(2476).Global;function s(){return r.sessionStorage}function i(e){return s().getItem(e)}e.exports={name:"sessionStorage",read:i,write:function(e,t){return s().setItem(e,t)},each:function(e){for(var t=s().length-1;t>=0;t--){var n=s().key(t);e(i(n),n)}},remove:function(e){return s().removeItem(e)},clearAll:function(){return s().clear()}}},9415:(__unused_webpack_module,__webpack_exports__,__webpack_require__)=>{"use strict";__webpack_require__.d(__webpack_exports__,{Z:()=>__WEBPACK_DEFAULT_EXPORT__});class BaseApi{constructor(e){this.parent=e,this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.hooksSelectores={},this.endpointsMethods={},this.endpointsHeaders={};var t=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(t&&t.length>1?t[1]:"").toLowerCase(),this.debounce={request:void 0,time:300,enabled:!0,exclude:[]}}after_init(){}normalRequest(e,t,n=null){let r=this,s=Array.isArray(e),i=s?this.getUrl(...e):this.getUrl(e);e=s?e[0]:e,n=n||this.endpointsMethods[e]||"post";let 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}}o&&"get"===n&&(t=t?Object.assign(t,o):o);let l={namespace:this.namespace,action:e,hook:this.hooksSelectores[e]||e,url:i,payload:t,method:n,headers:o};try{salla.event.document.request(l)}catch(e){return salla.event.document.requestFailed(l),new Promise((()=>{throw e}))}return this.webEndpoints.includes(e)||"http"===i.substring(0,4)||(i=salla.config.get("store.api")+i),this.parent[n](i,t,{headers:o}).then((function(e){return e.data&&e.request&&(e=e.data),r.handleAfterResponseActions(e),e})).catch((function(e){throw salla.event.document.requestFailed(l,e),r.handleErrorResponse(e),e}))}request(e,t,n=null){return!this.isFastRequestsAllowed()&&this.debounce.enabled?(this.debounce.request||(this.debounce.request=salla.helpers.debounce(this.normalRequest.bind(this),this.debounce.time)),this.debounce.request(e,t,n)):this.normalRequest(e,t,n)}getUrl(e){let t=this.endpoints[e]||e;const n=/{[^{}]+}/i;for(let e=1;e<arguments.length;e++)t=t.replace(n,arguments[e]);return t}withInjectData(e,t){return{element:e,data:e.getElementSallaData(t)}}handleAfterResponseActions(response){if(!response)return;let{data,googleTags=null}=response,withGoogleTags=data&&data.googleTags?data.googleTags:googleTags;if(dataLayer&&withGoogleTags&&(dataLayer.push(withGoogleTags),dataLayer.push(withGoogleTags)),this.renderSections(response),response.events||response.error&&response.error.events){let e=response.events||response.error.events;e=JSON.parse(e),Object.keys(e).forEach((function(t){salla.event.dispatch(t,e[t])}))}if(this.showAlert(response),response.runJavascript)try{eval(response.runJavascript)}catch(e){salla.log(e)}response.token&&salla.localData.set("token",response.token)}renderSections(e){e.sections&&Object.keys(e.sections).forEach((t=>{document.querySelectorAll(t.toSelector()).forEach((function(n){n.innerHTML=e.sections[t]}))}))}handleErrorResponse(e){if(e.response&&e.response.data)return e.response.data.error&&e.response.data.error.fields?this.handleInvalidFields(e):this.handleAfterResponseActions(e.response.data)}showAlert(e){if(e)return e.case&&e.msg?salla.notify.fire(e.msg,e.case,e):e.message&&e.hasOwnProperty("success")?salla.notify.fire(e.message,e.success?salla.notify.types.success:salla.notify.types.error,e):e.error&&e.error.message&&"FORBIDDEN"!==e.error.message?salla.error(e.error.message,e):void 0}handleInvalidFields(e){let t=e.response.data.error.fields,n=[];Object.keys(t).forEach((e=>{let r=t[e];Array.isArray(r)?r.forEach((e=>n.push(e))):n.push(r)}));let r=(n.length>1?"* ":"")+n.join("\n* ");salla.error(r,e)}event(){return salla.event[this.className]}getPossibleValue(e,t,n=!1){if(!e)return;if("object"!=typeof e)return e;let r;for(let n=0;n<t.length&&!(r=e[t[n]])&&!(e instanceof FormData&&(r=e.get(t[n])));n++);return r=r||e,"object"!=typeof r||n?r:void 0}isFastRequestsAllowed(){return salla.config.get("fastRequests")}promise(e,t=!0){return new Promise(((n,r)=>t?n(e):r(e)))}errorPromise(e){return this.promise(e,!1)}successPromise(e){return this.promise(e,!1)}}const __WEBPACK_DEFAULT_EXPORT__=BaseApi},714:()=>{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,...t){if(!this.getAttribute)return;if(this.hasAttribute("data-json"))try{return JSON.parse(this.getAttribute("data-json"))}catch(e){}let n=this.getAttribute("data-function");if(n&&window[n])return"function"==typeof window[n]?this.getFilteredData(window[n].call(this,...t)):this.getFilteredData(window[n]);let r=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if(r=r||this.closest("form")||this.closest("[salla-form-data]")||this,"FORM"===r.tagName)return this.getFilteredData(new FormData(r),null,r);let s=r.querySelectorAll("[name]");if(!s.length)return this.getFilteredData();let i=Object.assign({},this.dataset);return s.forEach((e=>{if(!["checkbox","radio"].includes(e.type)||e.checked)try{let t=salla.helpers.inputData(e.name,e.value,i);i[t.name]=t.value}catch(t){salla.log(e.name+" can't be send")}})),this.getFilteredData(i)},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++){let 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((e=>{e.files.length||e.setAttribute("disabled","")}));var n=new FormData(this);return t.forEach((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=null,t=null,n=null){return e=e||n?.dataset||this.dataset,n&&this.name&&void 0!==this.value&&(e=function(e,t,n){return e instanceof FormData?e.append(t,n):e[t]=n,e}(e,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((r=>{let s=n?.dataset[r]||this.dataset[r];if(s){var i=window[s];if("function"==typeof i){if(!i(e,n||this,t)&&e)throw`Data failed to be pass verify function window.${s}(formData, element, event)!`;return i(e,n||this,t)}salla.log("window."+s+"() 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}}}},5009:()=>{String.prototype.toStudlyCase=function(){return this.trim().replace(/([^a-zA-Z\d].)/g,(function(e){return e.toUpperCase().replace(/[^a-zA-Z\d]/g,"")}))},String.prototype.toDatasetName=function(){return this.startsWith("data-")?this.substr(5).toStudlyCase():this.toStudlyCase()},String.prototype.toSelector=function(){return this.trim().startsWith(".")||this.trim().startsWith("#")?this:"#"+this},String.prototype.replaceArray=function(e,t){for(var n,r=this,s=0;s<e.length;s++)n=new RegExp(e[s],"g"),r=r.replace(n,t[s]);return r},String.prototype.toArabicDigits=function(){return this.replaceArray(["٠","١","٢","٣","٤","٥","٦","٧","٨","٩"," ","-","/","|","~"],["0","1","2","3","4","5","6","7","8","9","","","","",""])},String.prototype.rtrim=function(e){return void 0===e&&(e="\\s"),this.replace(new RegExp("["+e+"]*$"),"")},String.prototype.ltrim=function(e){return void 0===e&&(e="\\s"),this.replace(new RegExp("^["+e+"]*"),"")}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(n.exports,n,n.exports,__webpack_require__),n.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var n in t)__webpack_require__.o(t,n)&&!__webpack_require__.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={};(()=>{"use strict";let e=function(e,t,n){return alert(e,t,n)},t=function(t,n){return e(t,r.error,n)},n=function(...e){return console.log(...e)};var r={error:"error",success:"success",info:"info"};const s={fire:function(t,n,r){return e(t,n,r)},setNotifier:function(t){e=t},log:function(...e){return n(...e)},setLogger:function(e){n=e},error:t,success:function(t,n){return e(t,r.success,n)},info:function(t,n){return e(t,r.info,n)},sallaInitiated:function(){var e=window.location.href.match(/([\?\&]danger=)[^&]+/g);e&&e.forEach((e=>{t(decodeURI(e.replace("?danger=","").replace("&danger=","")))}))},types:r},i=class{constructor(e){this.parent=e,this.events={},this.namespace="";var t=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(t&&t.length>1?t[1]:"").toLowerCase()}after_init(){this.createDynamicFunctions()}createDynamicFunctions(){Object.keys(this.events).forEach((e=>{this.createDynamicEventFuns(e),this.createDynamicListenerFuns(e)}))}createDynamicEventFuns(e){if(this[e])return;let t=this;this[e]=function(...n){return t.dispatch(e,...n)}}createDynamicListenerFuns(e){let t="on"+e.charAt(0).toUpperCase()+e.slice(1);if(this[t])return;let n=this;this[t]=function(t){return n.on(e,t)}}getEventName(e){return e=this.events[e]||e,!this.namespace||e.includes("::")?e:this.namespace+this.parent.delimiter+e}dispatch(e,...t){return this.parent.dispatch(this.getEventName(e),...t)}on(e,t){this.parent.addListener(this.getEventName(e),t)}register(e,t){this.on(e,t)}registerEventTemporary(e,t,n){n||(n=1),emitter.many(e,n,t)}},o=class extends i{constructor(e){super(e),this.namespace="cart",this.events={latestFetched:"latest.fetched",latestFailed:"latest.failed",updated:"updated",itemUpdated:"item.updated",itemUpdatedFailed:"item.updated.failed",itemAdded:"item.added",itemAddedFailed:"item.added.failed",itemDeleted:"item.deleted",itemDeletedFailed:"item.deleted.failed",submitted:"submitted",submitFailed:"submit.failed",imageDeleted:"image.deleted",imageNotDeleted:"image.not.deleted",summaryFetched:"summary.fetched",summaryNotFetched:"summary.not.fetched",detailsFetched:"details.fetched",detailsNotFetched:"details.not.fetched"},this.after_init()}getCartResults(e){return e?e.data?this.getCartResults(e.data):"object"==typeof e.cart?e.cart:e:e}updated(e){let t=this.getCartResults(e);if("object"==typeof t){(e.data&&e.data.has_offer||e.has_offer)&&salla.offer.event.existed(e.data||e);try{salla.localData.set("cart_widget_summary",t)}catch(e){salla.notify.log(e)}}else salla.log("Cart Results Not Object!",t);this.dispatch("updated",salla.localData.get("cart_widget_summary"),e)}itemAdded(e,t){return this.updated(e),this.dispatch("itemAdded",e,t)}itemDeleted(e,t){return this.updated(e),this.dispatch("itemDeleted",e,t)}itemUpdated(e,t){return this.updated(e),this.dispatch("itemUpdated",e,t)}summaryFetched(e){this.updated(e)}fullSummaryFetched(e){this.updated(e)}clearCartSummary(){let e=salla.localData.get("cart_widget_summary");e&&(e.count||e.items||e.items_count)&&salla.cart.api.summary()}},a=class extends i{constructor(e){super(e),this.namespace="gift",this.events={buyingSucceeded:"buying.succeeded",buyingFailed:"buying.failed"},this.after_init()}},l=class extends i{constructor(e){super(e),this.namespace="loyalty",this.events={exchangeSucceeded:"exchange.succeeded",exchangeFailed:"exchange.failed"},this.after_init()}},c=class extends i{constructor(e){super(e),this.namespace="auth",this.events={login:"login",logout:"logout",codeSent:"code.sent",codeNotSent:"code.not-sent",codeReSent:"code.re-sent",codeNotReSent:"code.not.re-sent",verified:"verified",verificationFailed:"verification.failed",loggedIn:"logged.in",registered:"registered",registrationFailed:"registration.failed",loggedOut:"logged.out",failedLogout:"failed.logout"},this.after_init()}login(e){return e?(e.type&&this.setTypeActionOnVerified(e.type),this.next_event=e.next_event||null,this.dispatch("login",...arguments)):(this.next_event=null,this.dispatch("login",...arguments))}verified(e){return dataLayer&&(dataLayer[0].customer=e.customer),this.dispatch("verified",...arguments)}setTypeActionOnVerified(e){this.type_action_on_verified=e}getTypeActionOnVerified(){return this.type_action_on_verified||"redirect"}},u=class extends i{constructor(e){super(e),this.namespace="search",this.events={finished:"finished",failed:"failed"},this.after_init()}},h=class extends i{constructor(e){super(e),this.namespace="wishlist",this.events={added:"added",removed:"removed",additionFailed:"addition.failed",removingFailed:"removing.failed"},this.after_init()}},d=class extends i{constructor(e){super(e),this.namespace="comment",this.events={added:"added",additionFailed:"addition.failed"},this.after_init()}},f=class extends i{constructor(e){super(e),this.namespace="order",this.events={canceled:"canceled",notCanceled:"not.canceled",reOrdered:"re.ordered",reOrderFailed:"re.order.failed"},this.after_init()}},p=class extends i{constructor(e){super(e),this.namespace="infiniteScroll",this.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},this.after_init()}},m=class extends i{constructor(e){super(e),this.namespace="document",this.events={click:"click",change:"change",submit:"submit",keyup:"keyup",leaving:"leaving",request:"request",requestFailed:"request.failed"},this.after_init()}onClick(e,t){this.fireCallableFuns("click",e,t)}onChange(e,t){this.fireCallableFuns("change",e,t)}onSubmit(e,t){this.fireCallableFuns("submit",e,t)}onKeyup(e,t){this.fireCallableFuns("keyup",e,t)}fireCallableFuns(e,t,n){this.on(e,(e=>{"function"!=typeof t?"function"==typeof n&&e.target.matches(t)&&n(e):t(e)}))}fireEvent(e,t,...n){return this.fireEventForElements(e,t,!1,...n)}fireEventForAll(e,t,...n){return this.fireEventForElements(e,t,!0,...n)}fireEventForElements(e,t,n,...r){if("string"==typeof e){if(n)return document.querySelectorAll(e).forEach((e=>this.fireEventForElements(e,t,!1,...r)));e=document.querySelector(e)}if(!e)return void salla.log("Faild To get element to fire event: "+t);const s=new CustomEvent(t,...r);return e.dispatchEvent(s)}},g=class extends i{constructor(e){super(e),this.namespace="product",this.events={priceUpdated:"price.updated",priceUpdateFailed:"price.updated.failed",availabilitySubscribed:"availability.subscribed",availabilitySubscribeFailed:"availability.subscribe.failed"},this.after_init()}},y=class extends i{constructor(e){super(e),this.namespace="offer",this.events={existed:"existed",increased:"increase",increaseFailed:"increase.failed",fetchDetailsFailed:"fetch.details.failed",detailsFetched:"details.fetched"},this.after_init()}},v=class extends i{constructor(e){super(e),this.namespace="coupon",this.events={added:"added",removed:"removed",addedFailed:"added.failed",removedFailed:"removed.failed"},this.after_init()}},b=class extends i{constructor(e){super(e),this.namespace="feedback",this.events={orderNotFetched:"order.not.fetched",orderFetched:"order.fetched",storeRated:"store.rated",storeFailed:"store.failed",productRated:"product.rated",productFailed:"product.failed",shippingRated:"shipping.rated",shippingFailed:"shipping.failed"},this.after_init()}},_=class extends i{constructor(e){super(e),this.namespace="currency",this.events={changed:"changed",failed:"failed"},this.after_init()}changed(...e){return salla.cart.api.summary().then((()=>this.dispatch("changed",...e)))}},w=class extends i{constructor(e){super(e),this.namespace="twilight",this.events={initiated:"initiated"},this.after_init()}};var S=__webpack_require__(35),x=__webpack_require__.n(S);class E extends(x()){constructor(){super({wildcard:!0,delimiter:"::",newListener:!1,removeListener:!1,maxListeners:10,verboseMemoryLeak:!1,ignoreErrors:!1}),this.globalListners={},this.delimiter="::",this.cart=new o(this),this.gift=new a(this),this.loyalty=new l(this),this.auth=new c(this),this.search=new u(this),this.wishlist=new h(this),this.comment=new d(this),this.order=new f(this),this.infiniteScroll=new p(this),this.document=new m(this),this.product=new g(this),this.offer=new y(this),this.coupon=new v(this),this.feedback=new b(this),this.currency=new _(this),this.twilight=new w(this),this.body=document.querySelector("body"),this.logableEvents=["cart::item.added.failed","cart::item.deleted.failed"],this.ingoreLogEvents=["document::click","document::keyup","document::change"],this.on("twilight::initiated",this.initiateSallaInAllClasses)}initiateSallaInAllClasses(){let e=this;Object.keys(salla).forEach((t=>{"object"==typeof(t=salla[t])&&(e.callSallaInitiate(t),Object.keys(t).forEach((n=>{e.callSallaInitiate(t[n])})))}))}callSallaInitiate(e){e&&e.sallaInitiated&&!e.initiated&&(e.sallaInitiated(),e.initiated=!0)}createAndDispatch(e,...t){this.dispatch(e,...t)}dispatch(e,...t){let n=e.split("::")[0],r=salla.api.apis[n];r&&Object.keys(r.hooksSelectores).forEach((n=>{r.hooksSelectores[n]===e&&r[n].call(r,...t)})),this.emit(e,...t),window.dataLayer=window.dataLayer||[],window.dataLayer.push(Object.assign({event:e},...t.values())),this.ingoreLogEvents.includes(e)||!salla.config.get("debug")&&!this.logableEvents.includes(e)||salla.notify.log(e,...t);let s=this;Object.keys(this.globalListners).forEach((function(n){s.globalListners[n](e,...t)})),this.dispatchMobileEvent(e,{...t.values()})}dispatchEvents(e){if(e&&"object"==typeof e)for(const[t,n]of Object.entries(e))this.dispatch(t,n);else salla.log("No Events To Dispatch!",e)}addListener(e,t){this.on(e,t)}addEventListener(e,t){this.addListener(e,t)}listen(e,t){this.addListener(e,t)}registerGlobalListener(e,t){this.globalListners[e]=t}dispatchMobileEvent(e,t={}){if(!(window.dataLayer&&dataLayer[0]&&dataLayer[0].page&&dataLayer[0].page.mobileApp))return"";if(window.webkit)try{window.webkit.messageHandlers.callbackHandler.postMessage(JSON.stringify({event:e,details:t}))}catch(e){console.log(e),console.log("The native context does not exist yet")}else if(Android)try{Android.customEventWithData(e,JSON.stringify({details:t}))}catch(e){console.log(e),console.log("The native context does not exist yet")}}}var k=__webpack_require__(9415);class L extends k.Z{constructor(e){super(e),this.namespace="cart",this.endpoints={latest:"cart/latest",details:"cart/{cart}",summary:"cart/{cart}/summary",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}",status:"cart/{cart}/status"},this.endpointsMethods={latest:"get",details:"get",summary:"get",status:"get",updateItem:"put",deleteItem:"delete",deleteImage:"delete"},this.hooksSelectores={addItem:"cart::add.item",quickAdd:"cart::quick.add",deleteItem:"cart::delete.item",updateItem:"cart::update.item",submit:"cart::submit",deleteImage:"cart::delete.file"},this.after_init()}async getCurrentCartId(){return salla.localData.get("cart_id")||(await this.latest()).data.cart_id}latest(){return this.request("latest",{params:{source:""}}).then((e=>(salla.localData.set("cart_id",e.data.cart_id),salla.event.cart.latestFetched(e),e))).catch((e=>{throw salla.localData.get("cart_id",""),salla.event.cart.latestFailed(e),e}))}async details(){let e=await this.getCurrentCartId();return this.request(["details",e]).then((function(e){return salla.cart.event.detailsFetched(e),e})).catch((function(e){throw salla.cart.event.detailsNotFetched(e),e}))}async summary(){let e=await this.getCurrentCartId();return this.request(["summary",e]).then((function(e){return salla.cart.event.summaryFetched(e),e})).catch((function(e){throw salla.cart.event.summaryNotFetched(e),e}))}quickAdd(e){return this.addItem(e)}async addItem(e){let t=this.getCartRequestData(e);if(!t.id)return salla.cart.event.itemAddedFailed('There is no "id"!'),!1;let n=this.getPossibleValue(t.formData,["quantity","donating_amount"])?"addItem":"quickAdd",r=await this.getCurrentCartId();return this.request([n,r,t.id],t.formData).then((function(e){return salla.cart.event.itemAdded(e,t.id),e})).catch((function(e){throw salla.cart.event.itemAddedFailed(e,t.id),e}))}async deleteItem(e){let t=this.getCartRequestData(e);if(!t.id)return salla.cart.event.itemDeletedFailed('There is no "id"!'),!1;let n=await this.getCurrentCartId();return this.request(["deleteItem",n,t.id]).then((function(e){return salla.cart.event.itemDeleted(e,t.id),e})).catch((function(e){throw salla.cart.event.itemDeletedFailed(e,t.id),e}))}async updateItem(e){let t=this.getCartRequestData(e);if(!t.id)return salla.cart.event.itemUpdatedFailed('There is no "id"!'),!1;let n=await this.getCurrentCartId();return this.request(["updateItem",n,t.id],t.formData).then((function(e){return salla.cart.event.itemUpdated(e,t.id),e})).catch((function(e){throw salla.cart.event.itemUpdatedFailed(e,t.id),e}))}async deleteImage(e){if(!(e=this.getPossibleValue(e,["id","image_id","photo_id"])))return salla.cart.event.imageNotDeleted('There is no "id"!'),!1;let t=await this.getCurrentCartId();return this.request(["deleteImage",t,e]).then((function(t){return salla.cart.event.imageDeleted(t,e),t})).catch((function(t){throw salla.cart.event.imageNotDeleted(t,e),t}))}async status(e){return this.request(["status",e||await this.getCurrentCartId()])}async submit({data:e}){let t=await this.getCurrentCartId();this.status(t).then((e=>{if("checkout"===e.data.next_step.to)return window.location.href=e.data.next_step.url+(window.ApplePaySession?"?has_apple_pay=true":"");if("refresh"===e.data.next_step.to)return window.location.reload();if("login"===e.data.next_step.to)return salla.event.dispatch("login::show");throw"Can't find next_step );"})).catch((function(e){throw salla.cart.event.submitFailed(e),e}))}getCartRequestData(e){let t=e.data||("object"==typeof e?e:void 0);return e=t?this.getPossibleValue(t,["prod_id","item_id","id"]):e,t="object"==typeof t?t:void 0,{id:e,formData:t}}handleAfterResponseActions(e){if(403===e.status){salla.localData.remove("cart_id");let e=salla.lang.get("pages.checkout.try_again");throw salla.error(e),e}super.handleAfterResponseActions(e)}}const A=L;class P extends k.Z{constructor(e){super(e),this.namespace="gift",this.endpoints={buy:"{id}/buy-as-gift"},this.webEndpoints=["buy"],this.hooksSelectores={buy:"gift::buy"},this.after_init()}buy(e){let t=this.getGiftRequestData(e);return t.id?this.request(["buy",t.id],t.formData).then((function(e){return salla.gift.event.buyingSucceeded(e,t.id),e})).catch((function(e){throw salla.gift.event.buyingFailed(e,t.id),e})):(salla.gift.event.buyingFailed('There is no "id"!'),!1)}getGiftRequestData(e){let t=e.data||("object"==typeof e?e:void 0);return e=t?this.getPossibleValue(t,["prod_id","item_id","id"]):e,t="object"==typeof t?t:void 0,{id:e,formData:t}}}const F=P;class j extends k.Z{constructor(e){super(e),this.namespace="loyalty",this.endpoints={exchange:"cart/prize/exchange_loyalty_point"},this.webEndpoints=["exchange"],this.hooksSelectores={exchange:"loyalty::exchange"},this.after_init()}exchange(e){let t=e.data||{id:e};return t.id?(t.loyalty_prize_id=t.id,this.request("exchange",t).then((function(e){return salla.loyalty.event.exchangeSucceeded(e,t.id),e})).catch((function(e){throw salla.loyalty.event.exchangeFailed(e,t.id),e}))):(salla.loyalty.event.exchangeFailed('There is no "id"!'),!1)}}const O=j;class q extends k.Z{constructor(e){super(e),this.namespace="auth",this.endpoints={login:"auth/{type}/send_verification",resend:"auth/resend_verification",verify:"auth/{type}/verify",register:"auth/register",logout:"logout"},this.webEndpoints=["login","resend","verify","register","logout","profile/verify-mobile"],this.endpointsMethods={logout:"get"},this.hooksSelectores={login:"auth::login",resend:"auth::resend",verify:"auth::verify",register:"auth::register",logout:"auth::logout"},this.after_init()}login(e,t){let n;return e.data&&(n=e.element,t=e.data,e=this.getPossibleValue(t,["type"])),t||"object"!=typeof e||(t=e),(e=this.getPossibleValue(e,["type"]))?this.request(["login",e],t).then((function(t){return salla.auth.event.codeSent.call(n,t,e),t})).catch((function(t){throw salla.auth.event.codeNotSent.call(n,t,e),t})):(salla.auth.event.codeNotSent("Failed to know what's login type!"),!1)}verify(e,t){return e.data&&(t=e.data,e=this.getPossibleValue(t,["type"])),e?(salla.auth.event.next_event&&(t.next_event=salla.auth.event.next_event),this.request(["verify",e],t).then((function(t){return salla.auth.event.verified(t,e),t})).catch((function(t){throw salla.auth.event.verificationFailed(t,e),t}))):(salla.auth.event.verificationFailed("Failed to know what's login type!"),!1)}resend(e){return(e=e.data||e).phone?e.country_code?(e.resend_by=e.resend_by||"sms",this.request("resend",e).then((function(t){return salla.auth.event.codeReSent(t,e),t})).catch((function(t){throw salla.auth.event.codeNotReSent(t,e),t}))):(salla.auth.event.codeNotReSent("Failed to know what's country_code!",e),!1):(salla.auth.event.codeNotReSent("Failed to know what's phone!",e),!1)}register(e){let t;return e.data&&(t=e.element,e=e.data),salla.auth.event.next_event&&(e.next_event=salla.auth.event.next_event),this.request("register",e).then((function(e){return salla.auth.event.registered.call(t,e),e})).catch((function(e){throw salla.auth.event.registrationFailed.call(t,e),e}))}logout(){return this.request("logout").then((function(e){return salla.auth.event.loggedOut(e),e})).catch((function(e){throw salla.auth.event.failedLogout(e),e}))}}const T=q;class C extends k.Z{constructor(e){super(e),this.namespace="order",this.endpoints={cancel:"orders/cancel/{id}",reOrder:"reorder/{id}"},this.endpointsMethods={reOrder:"get"},this.hooksSelectores={cancel:"order::cancel",reOrder:"order::re.order"},this.after_init()}cancel(e){return this.request(["cancel",e],{params:{has_apple_pay:!!window.ApplePaySession}}).then((function(t){return salla.event.order.canceled(t,e),t})).catch((function(t){throw salla.event.order.notCanceled(t,e),t}))}reOrder(e){return this.request(["reOrder",e]).then((function(t){return salla.localData.set("cart_id",t.data.cart_id),salla.event.order.reOrdered(t,e),window.location.href=t.data.url,t})).catch((function(t){throw salla.event.order.reOrderFailed(t,e),t}))}}const I=C;class R extends k.Z{constructor(e){super(e),this.namespace="offer",this.endpoints={popup:"products/special-offer-popup/{product_id}",increase:"products/special-offer-popup/{product_id}/increase",details:"products/{product_id}/specialoffer"},this.webEndpoints=["popup","increase"],this.endpointsMethods={increase:"get"},this.endpointsHeaders={popup:{"s-ajax-view":!0}},this.hooksSelectores={popup:"offer::popup",increase:"offer::increase",details:"offer::details"},this.after_init()}details(e){let t=e.data|e;return(e=this.getPossibleValue(t,["product_id"]))?this.request(["details",e],t).then((function(e){return salla.offer.event.detailsFetched(e,t),e})).catch((function(e){throw salla.offer.event.fetchDetailsFailed(e,t),e})):(salla.offer.event.fetchDetailsFailed('There is no "prodId"!'),!1)}increase(e){let t;return e.data&&(t=e.data,e=this.getPossibleValue(t,["id","product_id"])),e?this.request(["increase",e],t).then((function(e){return salla.offer.event.increased(e,t),e})).catch((function(e){throw salla.offer.event.increaseFailed(e,t),e})):(salla.offer.event.increaseFailed('There is no "prodId"!'),!1)}}const D=R;class N extends k.Z{constructor(e){super(e),this.namespace="search",this.endpoints={search:"products/search"},this.endpointsMethods={search:"get"},this.hooksSelectores={search:"search::products"},this.after_init()}search(e){let t=e.data||{params:{query:e}};if(!(e=t instanceof FormData?t.get("query"):t.query||t.params.query)){let e='There is no "query"!';return salla.search.event.failed(e),this.errorPromise(e)}if(e===this.previousQuery){let e="Query Same As Previous!";return salla.search.event.failed(e),this.errorPromise(e)}return this.previousQuery=e,this.request("search",t).then((function(t){return salla.search.event.finished(t,e),t})).catch((function(t){throw salla.search.event.failed(t,e),t}))}}const U=N;class M extends k.Z{constructor(e){super(e),this.namespace="coupon",this.endpoints={add:"cart/{id}/coupon",remove:"cart/{id}/coupon"},this.endpointsMethods={remove:"put"},this.hooksSelectores={add:"coupon::add",remove:"coupon::remove"},this.after_init()}async add(e){if(e=e.data||e,!this.getPossibleValue(e,["coupon"])){let e=new Error('There is no "Coupon Code"!');return e.name="EmptyCoupon",salla.event.coupon.addedFailed(e),this.errorPromise(e)}let t=await salla.cart.api.getCurrentCartId();return this.request(["add",t],e).then((function(e){return salla.event.coupon.added(e,t),e})).catch((function(e){throw salla.event.coupon.addedFailed(e,t),e}))}async remove(){let e=await salla.cart.api.getCurrentCartId();return this.request(["remove",e],{}).then((function(t){return salla.event.coupon.removed(t,e),t})).catch((function(t){throw salla.event.coupon.removedFailed(t,e),t}))}}const H=M;class B extends k.Z{constructor(e){super(e),this.namespace="product",this.endpoints={getPrice:"product-price/{id}",availabilitySubscribe:"products/{id}/availability-notify",purchaseNow:"checkout/quick-purchase/{id}"},this.webEndpoints=["getPrice","purchaseNow"],this.hooksSelectores={getPrice:"product::get.price",availabilitySubscribe:"product::availability.subscribe",purchaseNow:"product::purchase.now"},this.after_init()}getPrice(e){let t=e.data||e;return e=this.getPossibleValue(t,["id","prod_id"]),this.request(["getPrice",e],"object"==typeof t?t:void 0).then((function(t){return salla.product.event.priceUpdated(t,e),t})).catch((function(t){throw salla.product.event.priceUpdateFailed(t,e),t}))}availabilitySubscribe(e){let t=e.data||e;return e=this.getPossibleValue(t,["id","prod_id"]),this.request(["availabilitySubscribe",e],"object"==typeof t?t:void 0).then((function(t){return salla.product.event.availabilitySubscribed(t,e),t})).catch((function(t){throw salla.product.event.availabilitySubscribedFailed(t,e),t}))}purchaseNow(e){if(salla.auth.isGuest())return salla.auth.event.dispatch("login");let t=e.product_data,n=this.getPossibleValue(t,["id","prod_id"]);if(!e.is_applepay)return this.request(["quickPurchase",n],"object"==typeof t?t:void 0).then((function(e){return e})).catch((function(e){throw e}));salla.event.dispatch("payments::apple-pay.start-transaction",{amount:e.total,currency:e.currency,requiredShippingContactFields:e.require_shipping?["postalAddress"]:null,shippingMethods:e.require_shipping?[]:null,supportedNetworks:e.applepay_supported_networks,validateMerchant:{url:baseUrl+"checkout/applepay/validate",onFailed:({response:e})=>{console.log("validateMerchant Failed!")},onSuccess:e=>(console.log("validateMerchant Success"),this.request(["quickPurchase",n],"object"==typeof t?t:void 0))},authorized:{url:baseUrl+"/checkout/{id}/payments/submit",onFailed:e=>{console.log("authorized Failed!"),window.Salla.Payments.ApplePay.onCancel({},e.data.error.message)},onSuccess:e=>{console.log(e),window.location.href=e.redirect.url,console.log("authorized Success:: redirect to thank you page, order placed")}},shippingMethodSelected:e.require_shipping?{url:baseUrl+"/checkout/{id}/shipping/details",onFailed:e=>{console.log("select shipping method failed!")},onSuccess:e=>{console.log("select shipping method success")}}:null,shippingContactSelected:e.require_shipping?{url:baseUrl+"/checkout/{id}/address/add",onFailed:e=>{console.log("created contact failed!")},onSuccess:e=>{console.log("created contact success : ",e.data.address_id)}}:null,recalculateTotal:{url:baseUrl+"/checkout/{id}/payments/recalculate"},onError:function(e){console.log(e),salla.notify.error(e)}})}}const $=B;class z extends k.Z{constructor(e){super(e),this.namespace="comment",this.endpoints={send:"{type}/{id}/comments"},this.hooksSelectores={send:"comment::send"},this.after_init()}send(e){let t;e.data&&(t=e.element,e=e.data);let n,{id:r,type:s,comment:i}=e;return r?s&&["products","pages","product","page"].includes(s)?i?(s+=["product","page"].includes(s)?"s":"",this.request(["send",s,r],{comment:i}).then((function(e){return salla.event.comment.added.call(t,e,r),e})).catch((function(e){throw salla.event.comment.additionFailed.call(t,e,r),e}))):(salla.event.comment.additionFailed(n="can't find comment `data.comment`!"),this.errorPromise(n)):(salla.event.comment.additionFailed(n="Failed to get type one of:(products, product, page, pages)!"),this.errorPromise(n)):(salla.event.comment.additionFailed(n="Failed to get id!"),this.errorPromise(n))}}const J=z;class G extends k.Z{constructor(e){super(e),this.namespace="currency",this.endpoints={change:"/"},this.endpointsMethods={change:"get"},this.webEndpoints=["change"],this.hooksSelectores={change:"currency::change"},this.after_init()}change(e){if(!(e=this.getPossibleValue(e.data||e,["currency","code"]))){let e="Can't find currency code!";return salla.currency.event.failed(e),this.errorPromise(e)}return this.request("change",{params:{change_currency:"",currency:e}}).then((function(t){return salla.currency.event.changed(t,e),t})).catch((function(t){throw salla.currency.event.failed(t,e),t}))}}const W=G;class V extends k.Z{constructor(e){super(e),this.namespace="document"}}const Z=V;class K extends k.Z{constructor(e){super(e),this.namespace="feedback",this.endpoints={store:"rating/store",product:"rating/products",shipping:"rating/shipping",order:"rating/{order_id}"},this.hooksSelectores={store:"feedback::store",product:"feedback::product",shipping:"feedback::shipping",order:"feedback::order"},this.endpointsMethods={order:"get"},this.after_init()}order(e){let t="object"==typeof e?e:{};if(!(e=this.getPossibleValue(e,["order_id","id"]))){let e='There is no "order_id"!';return salla.event.feedback.orderNotFetched(e),this.errorPromise(e)}return this.request(["order",e],t).then((function(t){return salla.event.feedback.orderFetched(t,e),t})).catch((function(t){throw salla.event.feedback.orderNotFetched(t,e),t}))}store(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.feedback.storeFailed(e),this.errorPromise(e)}return this.request("store",e).then((function(t){return salla.event.feedback.storeRated(t,e),t})).catch((function(t){throw salla.event.feedback.storeFailed(t,e),t}))}products(){return this.product(...arguments)}product(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.feedback.productFailed(e),this.errorPromise(e)}return this.request("product",e).then((function(t){return salla.event.feedback.productRated(t,e),t})).catch((function(t){throw salla.event.feedback.productFailed(t,e),t}))}shipping(e){if(!(e=e.data||e)){let e='There is no "data"!';return salla.event.feedback.shippingFailed(e),this.errorPromise(e)}return this.request("shipping",e).then((function(t){return salla.event.feedback.shippingRated(t,e),t})).catch((function(t){throw salla.event.feedback.shippingFailed(t,e),t}))}}const Q=K;class X extends k.Z{constructor(e){super(e),this.initiated=!1,this.namespace="twilight",this.hooksSelectores={init:"twilight::init"},this.after_init()}init({config:e}){if(this.initiated)return;if(salla.config.merge(e),this.connectHooksWithElements(),this.initiated=!0,!e)return void salla.twilight.event.initiated(e);e._token&&(salla.api.defaults.headers.common["X-CSRF-TOKEN"]=e._token),e.maintenance&&this.injectMaintenanceAlert(),salla.api.defaults.baseURL=salla.config.get("store.url",window.baseUrl),salla.api.defaults.headers.common["Store-Identifier"]=salla.config.get("store.id"),salla.lang.loadStoreTranslations(),salla.config.isGuest()&&salla.localData.remove("token");let t=salla.localData.get("token");t&&(salla.api.defaults.headers.common.Authorization="Bearer "+t),salla.twilight.event.initiated(e),"preview"===salla.config.get("theme.mode")&&this.injectThemePreviewAlert()}injectMaintenanceAlert(){if(document.querySelector(".store-notify"))salla.log("store-notify Existed before!");else{var e=document.createElement("div");e.classList.add("store-notify"),e.style="background-color: #d63031; color: #fff; padding: 10px 15px; text-align: center; font-size: 17px;",e.innerHTML=`<p style="margin:0 !important;">${salla.lang.get("blocks.header.maintenance_alert")}</p>`,document.body.prepend(e)}}injectThemePreviewAlert(){if(document.querySelector("#s-theme_preview_bar"))salla.log("s-theme_preview_bar Existed before!");else{var e=document.createElement("div");e.classList.add("s-theme-preview-bar","bg-red-400","text-white","py-2.5"),e.id="s-theme_preview_bar",e.innerHTML=`<div class="container flex justify-between items-center">\n<h2 class="font-bold text-sm"> ${salla.lang.get("blocks.header.preview_mode")}: <span>${salla.config.get("theme.name")}</span></h2>\n <a href="${salla.config.get("theme.cancel_url")}" class="px-1"><i class="sicon-cancel"></i></a>\n</div>`,document.body.prepend(e)}}connectHooksWithElements(e){let t=["click","change","submit","keyup"],n=salla.api.hooksPrefix,r=this;for(let e=0;e<4;e++)document.addEventListener(t[e],(function(s){let i=t[e];if(salla.event.document[i](s),s.target.matches(".ajax")&&("click"==i&&s.target instanceof HTMLAnchorElement||"submit"==i&&s.target instanceof HTMLFormElement))return void r.handleElementAjaxRequest(s,s.target);let o=!0;for(let{target:e}=s;e&&e!==this&&o;e=e.parentNode){let t=n+i,r=e.getAttribute(t);if(!r)continue;if(e.hasAttribute("data-auth-required")&&salla.auth.isGuest())return salla.auth.event.login({type:"none",next_event:r});let a=r.split("::")[0],l=salla.api.apis[a];if(!l){salla.event.dispatch(r,e);continue}let c=!1;Object.keys(l.hooksSelectores).forEach((t=>{if(l.hooksSelectores[t]!==r)return;let n;c=!0,e.hasAttribute("data-allow-default")||s.preventDefault();try{n=l.withInjectData(e,r)}catch(e){return o=!1,void salla.log(`Error to execute "${r}"!`,e.message||e)}l[t].call(l,n)||s.stopPropagation(),o=!1})),c||salla.event.dispatch(r,e)}}))}handleElementAjaxRequest(e,t){if(!(t instanceof HTMLFormElement||t instanceof HTMLAnchorElement))return salla.log("trying to call ajax from non Element!!"),!1;e.preventDefault();let n=t.getAjaxFormData(e),r=n.method?n.method.toLowerCase():void 0;salla.api.document.request(n.url,n.formData,r).then((e=>(e.data&&e.request&&(e=e.data),salla.api.document.handleAfterResponseActions(e),this.callAjaxEvent(n.events.success,e,n.formData),e))).catch((e=>{throw salla.api.document.handleErrorResponse(e),this.callAjaxEvent(n.events.fail,e,n.formData),e}))}callAjaxEvent(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)}}}const Y=X;class ee extends k.Z{constructor(e){super(e),this.namespace="wishlist",this.endpoints={add:"products/favorites/{id}",remove:"products/favorites/{id}"},this.endpointsMethods={remove:"delete"},this.hooksSelectores={add:"wishlist::add",remove:"wishlist::remove"},this.after_init()}add(e){let t;return e.data&&(t=e.element,e=this.getPossibleValue(e.data,["id","prod_id"])),e?this.request(["add",e]).then((function(n){return salla.wishlist.event.added.call(t,n,e),n})).catch((function(n){throw salla.wishlist.event.additionFailed.call(t,n,e),n})):(salla.wishlist.event.additionFailed("Failed to get id!"),!1)}remove(e){let t;return e.data&&(t=e.element,e=this.getPossibleValue(e.data,["id","prod_id"])),e?this.request(["remove",e]).then((function(n){return salla.wishlist.event.removed.call(t,n,e),n})).catch((function(n){throw salla.wishlist.event.removingFailed.call(t,n,e),n})):(salla.wishlist.event.removingFailed("Failed to get id!"),!1)}}const te=ee;var ne=__webpack_require__(4559),re=__webpack_require__.n(ne);const se=class{constructor(e,t){this.api=e,this.event=t}};var ie=__webpack_require__(9280),oe=__webpack_require__.n(ie);function ae(e){let t=(e.match(/\./g)||[]).length;return t&&1!==t?ae(e.replace(/\.(.+)\./g,".$1")):e}function le(e,t,n){let r=e[0];return n&&0==e.length?Array.isArray(n)?(n.push(t),n):[n,t]:Array.isArray(n)?(n.push(t),n):"string"==typeof n?[n,t]:n?(n[r]=le(e.slice(1),t,n[r]),n):r?{[r]:le(e.slice(1),t)}:""===r?[t]:t}__webpack_require__(5009),__webpack_require__(714),window.onbeforeunload=function(e){if(salla.document.event.leaving(e),!salla.config.get("canLeave"))return e.preventDefault(),!1};const ce={digitsOnly:function e(t,n){if("string"==typeof t)return document.querySelectorAll(t).forEach((t=>e(t,n)));if(!t)return void salla.log("Can't find Object With Id: "+t);let r=t.value.toArabicDigits().replace(/[^0-9.]/g,"").replace("..",".");return t.min&&r<t.min?t.value=t.min:t.max&&r>t.max?t.value=t.max:t.maxLength>=1&&r.toString().length>t.maxLength?t.value=r.toString().substring(0,t.maxLength):t.value=n||t.dataset.hasOwnProperty("digitsWithDecimal")?ae(r):r.replace(/\D/g,"")},debounce:function(e,t){t=t||100;let n,r=[];return function(...s){return clearTimeout(n),n=setTimeout((()=>{let t=e(...s);r.forEach((e=>e(t))),r=[]}),t),new Promise((e=>r.push(e)))}},inputData:function(e,t,n={}){if(e.includes("[")){let r=e.split("]").join("").split("[");return{name:r[0],value:le(r.slice(1),t,n[r[0]])}}return{name:e,value:t}},setNested:function(e,t,n){let r=e,s=t.split("."),i=s.length;for(let e=0;e<i-1;e++){let t=s[e];r[t]||(r[t]={}),r=r[t]}return r[s[i-1]]=n,e},money:function(e){return"object"!=typeof e?e+" "+salla.config.get("currencies."+salla.config.get("user.currency")+".symbol"):e.amount+" "+salla.config.get("currencies."+e.currency+".symbol")}};var ue=__webpack_require__(3230),he=__webpack_require__.n(ue),de=__webpack_require__(2257),fe=__webpack_require__.n(de);class pe extends(fe()){constructor(e){(e=e||{}).messages=e.messages||window.translations,e.locale=e.locale||window.locale||"en",e.fallback=e.fallback||"en",super(e)}loadStoreTranslations(){let e=salla.config.get("store.url")?.rtrim("/");if(!e)return salla.lang.messages&&salla.event.dispatch("languages::translations.loaded"),void salla.log("There is no `store.url` to auto loading translations from it!");let t=salla.config.get("theme.translations_hash",salla.config.get("store.id","twilight")),n=document.createElement("script");n.src=`${e}/languages/assets/${t}.js`,n.onload=()=>{if(window.translations)return this.setMessages(window.translations),void salla.event.dispatch("languages::translations.loaded");console.warn('You should load Salla Translations Before!\nUse: <script src="{{ link("languages/assets/{theme.translations_hash}.js") }}"><\/script>\nor: salla.lang.setMessages({....}), see https://github.com/rmariuzzo/Lang.js for more informations.')},document.head.appendChild(n)}get(e,t,n){return window.translations&&(e="trans."+e),super.get(e,t,n)}set(e,t){return salla.helpers.setNested(this.messages[this.getLocale()+".trans"],e,t),this}}let me=new E,ge=new class extends class{constructor(){return re().create({baseURL:window.baseUrl,headers:{common:{"X-Requested-With":"XMLHttpRequest"},"S-SOURCE":"twilight"}})}}{constructor(){super(),this.apis={auth:new T(this),cart:new A(this),gift:new F(this),loyalty:new O(this),order:new I(this),offer:new D(this),search:new U(this),coupon:new H(this),product:new $(this),comment:new J(this),currency:new W(this),document:new Z(this),feedback:new Q(this),twilight:new Y(this),wishlist:new te(this)},this.hooksPrefix="data-on-",this.hooksSelectores=[],Object.assign(this,this.apis)}};window.Salla=window.salla={notify:s,api:ge,event:me,infiniteScroll:new class extends se{constructor(e,t){super(e,t),this.options={path:".infinite-scroll-btn",history:"push",status:".infinite-scroll-status",append:".list-block"},this.fetchOptions={headers:{"S-INFINITE-SCROLL":!0}},this.instances=[]}initiate(e,t,n){n=this.getCustomOptions(t,n);let r="string"!=typeof e?e:document.querySelector(e),s=n.path;if(!r||!s||"string"==typeof s&&!document.querySelector(s))return void salla.log(r?"Path Option (a link that has next page link) Not Existed!":"Container For InfiniteScroll not Existed!");let i=new(oe())(r,n);return i.on("scrollThreshold",salla.infiniteScroll.event.scrollThreshold),i.on("request",salla.infiniteScroll.event.request),i.on("load",salla.infiniteScroll.event.load),i.on("append",salla.infiniteScroll.event.append),i.on("error",salla.infiniteScroll.event.error),i.on("last",salla.infiniteScroll.event.last),i.on("history",salla.infiniteScroll.event.history),this.instances.push(i),i}getCustomOptions(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}}(void 0,me.infiniteScroll),helpers:ce,config:new class{properties={};defaults={debug:!1,token:null,fastRequests:!0,canLeave:!0,currencies:{SAR:{code:"SAR",name:"ريال سعودي",symbol:"ر.س",amount:1,country_code:"sa"}}};constructor(e){this.properties=e||this.defaults}merge(e){return Object.assign(this.properties,e),this}set(e,t){return e.includes(".")?this.setByKeyPath(e,t):(this.properties[e]=t,this)}setByKeyPath(e,t){return salla.helpers.setNested(this.properties,e,t),this}get(e,t=null){return e.includes(".")?this.getByKeyPath(e,t):this.properties.hasOwnProperty(e)?this.properties[e]:t||void 0}getByKeyPath(e,t=null){let n=this.properties,r=e.split(".");for(let e of r)if(n=n.hasOwnProperty(e)?n[e]:t||void 0,!n)return n;return n}isRTL(){return this.get(`languages.${this.get("user.language")}.is_rtl`)}isUser(){return"user"===this.get("user.type")}isGuest(){return!this.isUser()}},localData:new class{constructor(){return he()}},cookie:new class{get(e){return document.cookie.split("; ").find((t=>t.startsWith(e+"=")))?.split("=")[1]}set(e,t="",n=10){let r="";if(n){let e=new Date;e.setTime(e.getTime()+24*n*60*60*1e3),r="; expires="+e.toUTCString()}return document.cookie=e+"="+t+r+"; path=/; secure; SameSite=Lax",this}},lang:new pe,cart:new class extends se{constructor(e,t){super(e,t),this.total=this.getElement("total"),this.badge=this.getElement("badge")}getElement(e){return document.querySelector("[data-cart-"+e+"]")}}(ge.cart,me.cart),auth:new class extends se{isUser(){try{return!1===window.dataLayer[0].customer.isGuest}catch(e){return salla.log("Error::isUser",e),!1}}isGuest(){return!this.isGuest()}}(ge.auth,me.auth),gift:new class extends se{}(ge.gift,me.gift),order:new class extends se{}(ge.order,me.order),offer:new class extends se{}(ge.offer,me.offer),search:new class extends se{}(ge.search,me.search),coupon:new class extends se{}(ge.coupon,me.coupon),comment:new class extends se{}(ge.comment,me.comment),loyalty:new class extends se{}(ge.loyalty,me.loyalty),product:new class extends se{}(ge.product,me.product),currency:new class extends se{}(ge.currency,me.currency),document:new class extends se{}(ge.document,me.document),feedback:new class extends se{}(ge.feedback,me.feedback),twilight:new class extends se{}(ge.twilight,me.twilight),wishlist:new class extends se{}(ge.wishlist,me.wishlist),init:e=>ge.twilight.init({config:e}),log:s.log,success:s.success,error:s.error,onReady:e=>document.addEventListener("DOMContentLoaded",e),AppHelpers:class{copyToClipboard(e){let t=document.querySelector(".copy-icon");var n=document.createElement("input");n.setAttribute("value",document.getElementById(e).innerHTML),document.body.appendChild(n),n.select(),document.execCommand("copy"),document.body.removeChild(n),this.toggleElement(t,"sicon-swap-stroke","sicon-check",(()=>!1)),setTimeout((()=>this.toggleElement(t,"sicon-swap-stroke","sicon-check",(()=>!0))),1e3)}toggle(e,t,n,r){return document.querySelectorAll(e).forEach((e=>this.toggleElement(e,t,n,r))),this}toggleElement(e,t,n,r){t=Array.isArray(t)?t:t.split(" "),n=Array.isArray(n)?n:n.split(" ");let s=r(e);return e?.classList.remove(...s?n:t),e?.classList.add(...s?t:n),this}isValidEmail(e){return/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(String(e).toLowerCase())}element(e){return"object"==typeof e?e:document.querySelector(e)}watchElement(e,t){return this[e]=this.element(t),this}watchElements(e){return Object.entries(e).forEach((e=>this.watchElement(e[0],e[1]))),this}on(e,t,n,r={}){return"object"==typeof t?(this.element(t).addEventListener(e,n,r),this):(document.querySelectorAll(t).forEach((t=>t.addEventListener(e,n,r))),this)}onClick(e,t){return this.on("click",e,t)}onKeyUp(e,t){return this.on("keyup",e,t)}onEnter(e,t){return this.onKeyUp(e,(e=>13===e.keyCode&&t(e))),this}all(e,t){return document.querySelectorAll(e).forEach(t),this}hideElement(e){return this.element(e).style.display="none",this}showElement(e,t="block"){return this.element(e).style.display=t,this}removeClass(e,t){return this.element(e).classList.remove(...Array.from(arguments).slice(1)),this}addClass(e,t){return this.element(e).classList.add(...Array.from(arguments).slice(1)),this}debounce(e){return this.debounce_||(this.debounce_=salla.helpers.debounce(((e,...t)=>e(...t)),500)),this.debounce_(e,...Array.from(arguments).slice(1))}},money:ce.money},salla})()})();
@@ -5,58 +5,59 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1"/>
6
6
 
7
7
  <title>Salla Web Component Starter</title>
8
- <script src="https://my_store.test/themes/one/dist/twilight.js"></script>
8
+ <script src="dist/translations.js"></script>
9
+ <script src="dist/twilight.js"></script>
9
10
  <script>
11
+ let url = window.location.href.split('/').slice(0, -1).join('/') + '/';
10
12
  salla.init({
11
- debug: true,
12
- store: {url: 'https://my_store.test/'},
13
- languages:{
13
+ debug : true,
14
+ store : {api: url},
15
+ languages : {
14
16
  "ar": {
15
- "name": "العربية",
16
- "code": "ar",
17
- "url": "https://my_store.test/ar/test/c198982531",
18
- "is_rtl": true,
17
+ "name" : "العربية",
18
+ "code" : "ar",
19
+ "url" : url + "?lang=ar",
20
+ "is_rtl" : true,
19
21
  "country_code": "sa"
20
22
  },
21
23
  "en": {
22
- "name": "English",
23
- "code": "en",
24
- "url": "https://my_store.test/en/test/c198982531",
25
- "is_rtl": false,
24
+ "name" : "English",
25
+ "code" : "en",
26
+ "url" : url + "?lang=ev",
27
+ "is_rtl" : false,
26
28
  "country_code": "gb"
27
29
  }
28
30
  },
29
- currencies:{
31
+ currencies: {
30
32
  "SAR": {
31
- "code": "SAR",
32
- "name": "ريال سعودي",
33
- "symbol": "ر.س",
34
- "amount": 1,
33
+ "code" : "SAR",
34
+ "name" : "ريال سعودي",
35
+ "symbol" : "ر.س",
36
+ "amount" : 1,
35
37
  "country_code": "sa"
36
38
  },
37
39
  "EUR": {
38
- "code": "EUR",
39
- "name": "يورو",
40
- "symbol": "€",
41
- "amount": 0.22,
40
+ "code" : "EUR",
41
+ "name" : "يورو",
42
+ "symbol" : "€",
43
+ "amount" : 0.22,
42
44
  "country_code": "eu"
43
45
  },
44
46
  "USD": {
45
- "code": "USD",
46
- "name": "دولار أمريكي",
47
- "symbol": "$",
48
- "amount": 0.27,
47
+ "code" : "USD",
48
+ "name" : "دولار أمريكي",
49
+ "symbol" : "$",
50
+ "amount" : 0.27,
49
51
  "country_code": "us"
50
52
  }
51
53
  }
52
54
  });
53
55
  </script>
54
56
  <script type="module" src="../dist/twilight-components/twilight-components.esm.js"></script>
55
-
56
- <!-- <script src="https://cdn.tailwindcss.com"></script>-->
57
57
  <link href="https://assets.salla.sa/cp/assets/css/icons/sallaicons/style.css?v0.twilight" type="text/css"
58
58
  rel="stylesheet">
59
59
  <link href="dist/tailwind.css" type="text/css" rel="stylesheet">
60
+ <link href="dist/intlTelInput.min.css" type="text/css" rel="stylesheet">
60
61
  <style>
61
62
  :root {
62
63
  --font-main: 'DINNextLTArabic-Regular';
@@ -67,8 +68,17 @@
67
68
  .container {
68
69
  margin: 0 auto;
69
70
  }
70
- </style>
71
71
 
72
+ .iti__flag {
73
+ background-image: url("dist/flags.png");
74
+ }
75
+
76
+ @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
77
+ .iti__flag {
78
+ background-image: url("dist/flags@2x.png");
79
+ }
80
+ }
81
+ </style>
72
82
  </head>
73
83
 
74
84
  <body dir="ltr" class="page-show salla-one color-mode-dark ltr font-dubai bg-gray-50">
@@ -103,8 +113,8 @@
103
113
  <salla-button loading loader-position="end">end</salla-button>
104
114
  </div>
105
115
  <div class="flex flex-wrap gap-4">
106
- <salla-button wide>Wide</salla-button>
107
- <salla-button wide disabled>Wide Disabled</salla-button>
116
+ <salla-button wide>Wide</salla-button>
117
+ <salla-button wide disabled>Wide Disabled</salla-button>
108
118
  </div>
109
119
  </div>
110
120
 
@@ -117,7 +127,7 @@
117
127
  <salla-button data-target="modal4" data-on-click="modal::open">Small</salla-button>
118
128
  <salla-button btn-style="outline-primary" data-target="modal5" data-on-click="modal::open">Full</salla-button>
119
129
  <salla-button data-target="modal6" data-on-click="modal::open">With footer</salla-button>
120
- <salla-button btn-style="outline" data-target="modal7" data-on-click="modal::open">No Padding</salla-button>
130
+ <salla-button btn-style="outline" data-target="modal7" data-on-click="modal::open">No Padding</salla-button>
121
131
  <salla-modal id="modal1">Your Awesome Content</salla-modal>
122
132
  <salla-modal id="modal2" title="Error!" sub-title="Whoops! Error happened" error></salla-modal>
123
133
  <salla-modal id="modal3" title="Congratulations" sub-title="Good, You are awesome!" success></salla-modal>
@@ -136,7 +146,7 @@
136
146
  <h1 class="text-primary border-b border-dashed mb-4">Login</h1>
137
147
  <p class="my-4">Description</p>
138
148
  <salla-button wide data-on-click="login::show">Login Component</salla-button>
139
- <salla-login></salla-login>
149
+ <salla-login is-email-allowed is-mobile-allowed is-email-required></salla-login>
140
150
  </div>
141
151
 
142
152
  <div class=" p-3 rounded-md bg-white shadow-sm">
@@ -174,55 +184,36 @@
174
184
  <salla-product-availability channels="sms,email"></salla-product-availability>
175
185
  </div>
176
186
 
187
+ <div class="p-3 rounded-md bg-white shadow-sm">
188
+ <h1 class="text-primary border-b border-dashed mb-4">Mobile Input</h1>
189
+ <p class="my-4">
190
+ Using: <a class="text-primary" href="https://github.com/jackocnr/intl-tel-input" target="_blank">International
191
+ Telephone Input</a>
192
+ </p>
193
+ <salla-tel-input></salla-tel-input>
194
+ </div>
195
+
196
+ <div class="p-3 rounded-md bg-white shadow-sm">
197
+ <h1 class="text-primary border-b border-dashed mb-4">Rating</h1>
198
+ <p class="my-4">Description</p>
199
+ <salla-button wide btn-style="outline-primary" data-on-click="rating::show">Rating</salla-button>
200
+ <salla-rating></salla-rating>
201
+ </div>
202
+
177
203
  <div class="p-3 rounded-md bg-white shadow-sm col-span-2">
178
204
  <h1 class="text-primary border-b border-dashed mb-4">Infinite Scroll</h1>
179
205
  <p class="my-4">
206
+ Using: <a class="text-primary" href="https://infinite-scroll.com/" target="_blank">Infinite Scroll</a>
207
+ <br/>
180
208
  You can pass <code>autoload</code> attribute for autoload result when scrolling.<br/>
181
- <code>&#x3C;salla-infinite-scroll next-page=&#x22;***&#x22; autoload&#x3E;&#x3C;/salla-infinite-scroll&#x3E;</code>
209
+ <code>&#x3C;salla-infinite-scroll next-page=&#x22;***&#x22;
210
+ autoload&#x3E;&#x3C;/salla-infinite-scroll&#x3E;</code>
182
211
  </p>
183
212
  <salla-infinite-scroll class="grid grid-cols-4 grid-flow-row gap-6 " next-page="infinit-scroll.html?page=2"
184
213
  item=".i-item">
185
214
  </salla-infinite-scroll>
186
215
  </div>
187
-
188
-
189
216
  </div>
190
- <script>
191
- let counter = 1;
192
- salla.infiniteScroll.event.onAppend((doc, url, nodes) => nodes.forEach(node => node.innerText = counter++));
193
-
194
- function showOffer() {
195
- document.querySelector('salla-offer').showOffer({
196
- "name" : "عرض جديد",
197
- "message" : "اشتري قطعة واحصل على قطعة واحدة مجاناً من المنتجات التالية",
198
- "expiry_date" : "2022-12-31",
199
- "formatted_date": "31 ديسمبر 2022",
200
- "get" : {
201
- "products": [
202
- {
203
- "id" : 1196968987,
204
- "is_available" : true,
205
- "name" : "ديتول - المطّهر السائل أوريجينال 500 مل ديتول",
206
- "price" : {"amount": 100, "currency": "SAR"},
207
- "url" : "#",
208
- "thumbnail" : "https://s3-eu-central-1.amazonaws.com/salla-dev/gUJQnj4dOie4zFFeCamrzhge1b9yEIWCVKt1PwTZ.jpeg",
209
- "has_special_price": false,
210
- "regular_price" : {"amount": 100, "currency": "SAR"},
211
- },
212
- {
213
- "id" : 2051852144,
214
- "is_available" : true,
215
- "name" : "تيشرت",
216
- "price" : {"amount": 103.5, "currency": "SAR"},
217
- "url" : "#",
218
- "thumbnail" : "https://cdn.salla.sa/brmY/qKCbx4BAxd2fZHmoJnbEXmtftvkXs11ynHHgJ49I.jpg",
219
- "has_special_price": true,
220
- "regular_price" : {"amount": 115, "currency": "SAR"},
221
- }
222
- ],
223
- }
224
- });
225
- }
226
- </script>
217
+ <script src="dist/demo.js"></script>
227
218
  </body>
228
219
  </html>
File without changes
@@ -0,0 +1 @@
1
+ {}
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-components",
3
- "version": "1.0.32",
3
+ "version": "1.0.33",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "twilight",
@@ -1 +0,0 @@
1
- import{r as s,h as i,g as t}from"./p-6a5be894.js";import{H as a}from"./p-ed1c00c5.js";const l=class{constructor(i){s(this,i),this.regType="phone",this.title=salla.lang.get("blocks.header.login"),this.loginTypeTitle=salla.lang.get("blocks.header.select_login_way"),this.loginText=salla.lang.get("blocks.header.login"),this.smsLabel=salla.lang.get("blocks.header.sms"),this.mobileLabel=salla.lang.get("common.elements.mobile"),this.emailLabel=salla.lang.get("common.elements.email"),this.enterText=salla.lang.get("blocks.header.enter"),this.bySMSText=salla.lang.get("blocks.header.login_by_sms"),this.byEmailText=salla.lang.get("blocks.header.login_by_email"),this.emailErrorMsg=salla.lang.get("common.elements.email_is_valid"),this.firstNameLabel=salla.lang.get("blocks.header.your_name"),this.lastNameLabel=salla.lang.get("pages.profile.last_name"),this.firstNameErrorMsg=salla.lang.get("common.errors.field_required",{attribute:this.firstNameLabel}),this.lastNameErrorMsg=salla.lang.get("common.errors.field_required",{attribute:this.lastNameLabel}),this.typing=(s,i)=>{const t=s.target.nextElementSibling;s.target.classList.remove("s-has-error"),(null==t?void 0:t.classList.contains("s-login-error-message"))&&(t.innerText=""),"Enter"==s.key&&i()},this.loginBySMS=async()=>{const{mobile:s,countryCode:i}=await this.loginTelInput.getValues();await this.loginTelInput.isValid()&&this.smsBtn.load().then((()=>this.smsBtn.disable())).then((()=>salla.auth.api.login({type:"mobile",phone:s,country_code:i}))).then((()=>this.smsBtn.stop()&&this.smsBtn.enable())).then((()=>this.showTab(this.verifyTab))).then((()=>(this.verifyTab.by="sms")&&(this.verifyTab.url="auth/mobile/verify"))).then((()=>this.verifyTab.show({phone:s,country_code:i})))},this.loginByEmail=()=>{a.isValidEmail(this.loginEmail.value)?this.emailBtn.load().then((()=>this.emailBtn.disable())).then((()=>salla.auth.api.login({type:"email",email:this.loginEmail.value}))).then((()=>this.emailBtn.stop()&&this.emailBtn.enable())).then((()=>this.showTab(this.verifyTab))).then((()=>this.verifyTab.by="email")).then((()=>this.verifyTab.show({email:this.loginEmail.value}))):this.validateField(this.loginEmail,this.emailErrorMsg)},this.newUser=async()=>{var s;const{mobile:i,countryCode:t,countryKey:a}=await this.regTelInput.getValues(),l=this.regEmail.value||(null===(s=this.loginEmail)||void 0===s?void 0:s.value);await this.newUserValidation(),await this.regBtn.load(),await this.regBtn.disable();let e={first_name:this.firstName.value,last_name:this.lastName.value,phone:i||this.loginTelInput.mobile,country_code:t,country_key:a,verified_by:this.regType};l&&(e=Object.assign(Object.assign({},e),{email:l})),this.verifyTab.getCode().then((s=>salla.auth.api.register(Object.assign(Object.assign({},e),{code:s})))).then((()=>window.location.reload())).catch((()=>this.regBtn.stop()&&this.regBtn.enable()))},this.title=this.host.title||salla.lang.get("blocks.header.login"),this.host.removeAttribute("title"),salla.event.on("languages::translations.loaded",(()=>{var s;this.title=salla.lang.get("blocks.header.login"),this.loginTypeTitle=salla.lang.get("blocks.header.select_login_way"),this.loginText=salla.lang.get("blocks.header.login"),this.smsLabel=salla.lang.get("blocks.header.sms"),this.mobileLabel=salla.lang.get("common.elements.mobile"),this.emailLabel=salla.lang.get("common.elements.email"),this.enterText=salla.lang.get("blocks.header.enter"),this.bySMSText=salla.lang.get("blocks.header.login_by_sms"),this.byEmailText=salla.lang.get("blocks.header.login_by_email"),this.emailErrorMsg=salla.lang.get("common.elements.email_is_valid"),this.firstNameLabel=salla.lang.get("blocks.header.your_name"),this.lastNameLabel=salla.lang.get("pages.profile.last_name"),this.firstNameErrorMsg=salla.lang.get("common.errors.field_required",{attribute:this.firstNameLabel}),this.lastNameErrorMsg=salla.lang.get("common.errors.field_required",{attribute:this.lastNameLabel}),null===(s=this.modal)||void 0===s||s.setTitle(this.title)})),salla.auth.event.onVerificationFailed((()=>{})),salla.event.on("login::show",(()=>this.show()))}onVerified(s){if(s.detail.case){if("new_customer"===s.detail.case)return this.showTab(this.registrationTab);if("redirect"===salla.auth.event.getTypeActionOnVerified())return s.redirect_url?window.location.href=s.redirect_url:void window.location.reload()}else console.log("verified but without case!")}onbackClicked(){this.showTab("phone"==this.regType?this.mobileTab:this.emailTab)}async show(){return this.isEmailAllowed&&this.isMobileAllowed?this.showTab(this.homeTab):this.isEmailAllowed?this.showTab(this.emailTab):this.isMobileAllowed&&this.showTab(this.mobileTab),this.modal.show()}showTab(s,i){var t,l;null==i||i.preventDefault(),[this.homeTab,this.mobileTab,this.emailTab,this.verifyTab,this.registrationTab].map((i=>a.toggleElement(i,"visible","hidden",(()=>i==s)))),setTimeout((()=>{[this.homeTab,this.mobileTab,this.emailTab,this.verifyTab,this.registrationTab].map((i=>a.toggleElement(i,"s-login-active","s-login-unactive",(()=>i==s))))}),200),setTimeout((()=>{this.host.querySelector(".s-login-wrapper").setAttribute("style","height:"+(null==s?void 0:s.scrollHeight)+"px")})),[this.mobileTab,this.emailTab].includes(s)&&(this.regType=s===this.mobileTab?"phone":"email");let e=s==this.registrationTab;return e&&(null===(t=this.firstName)||void 0===t||t.focus()),null===(l=this.modal)||void 0===l||l.setTitle(e?salla.lang.get("common.titles.registration"):this.title),e||a.toggleElement(this.regMobileBlock,"s-hidden","s-block",(()=>"phone"===this.regType)).toggleElement(this.regEmailBlock,"s-hidden","s-block",(()=>"email"===this.regType)),this}async newUserValidation(){const s="phone"==this.regType,i=this.regEmail.value||"email"==this.regType&&this.loginEmail.value,t=a.isValidEmail(i),l=this.firstName.value.length>0,e=this.lastName.value.length>0,h=await this.regTelInput.isValid()||s&&await this.loginTelInput.isValid();if(!((i&&t||!i&&!this.isEmailRequired)&&h&&l&&e))throw!t&&this.validateField(this.regEmail,this.emailErrorMsg),!l&&this.validateField(this.firstName,this.firstNameErrorMsg),!e&&this.validateField(this.lastName,this.lastNameErrorMsg),"Please insert required fields"}validateField(s,i){s.classList.add("s-has-error"),s.nextElementSibling.innerText="* "+i}render(){return i("salla-modal",{id:"salla-login",icon:"sicon-user",title:this.title,ref:s=>this.modal=s,width:"xs"},i("div",{class:"s-login-wrapper"},this.isEmailAllowed&&this.isMobileAllowed?i("div",{class:"s-login-tab",ref:s=>this.homeTab=s},i("p",{class:"s-login-sub-title"},this.loginTypeTitle),i("a",{href:"#",class:"s-login-main-btn",onClick:s=>this.showTab(this.mobileTab,s)},i("i",{class:"s-login-main-btn-icon sicon-phone"}),i("span",{class:"s-login-main-btn-text"},this.smsLabel),i("i",{class:"main-btn-arrow sicon-keyboard_arrow_left"})),i("a",{href:"#",class:"s-login-main-btn",onClick:s=>this.showTab(this.emailTab,s)},i("i",{class:"s-login-main-btn-icon sicon-mail"}),i("span",{class:"s-login-main-btn-text"},this.emailLabel),i("i",{class:"main-btn-arrow sicon-keyboard_arrow_left"}))):"",this.isMobileAllowed?i("div",{class:"s-login-tab",ref:s=>this.mobileTab=s},i("label",{class:"s-login-label"},this.mobileLabel),i("salla-tel-input",{ref:s=>this.loginTelInput=s,onKeyDown:s=>this.typing(s,this.loginBySMS)}),i("salla-button",{"loader-position":"center",wide:!0,onClick:()=>this.loginBySMS(),ref:s=>this.smsBtn=s},this.enterText),this.isEmailAllowed?i("a",{href:"#",onClick:()=>this.showTab(this.emailTab),class:"s-login-link"},this.byEmailText):""):"",this.isEmailAllowed?i("div",{class:"s-login-tab",ref:s=>this.emailTab=s},i("label",{class:"s-login-label"},this.emailLabel),i("input",{type:"email",ref:s=>this.loginEmail=s,onKeyDown:s=>this.typing(s,this.loginByEmail),placeholder:"your@email.com",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"}),i("salla-button",{"loader-position":"center",wide:!0,onClick:()=>this.loginByEmail(),ref:s=>this.emailBtn=s},this.enterText),this.isMobileAllowed?i("a",{href:"#",onClick:()=>this.showTab(this.mobileTab),class:"s-login-link"},this.bySMSText):""):"",i("salla-verify",{"without-modal":!0,ref:s=>this.verifyTab=s,autoReload:!1,"is-show-back":!0}),i("div",{ref:s=>this.registrationTab=s},i("label",{class:"s-login-label"},this.firstNameLabel),i("input",{type:"text",class:"s-login-input",ref:s=>this.firstName=s,onKeyDown:s=>this.typing(s,this.newUser),placeholder:salla.lang.get("pages.profile.first_name")}),i("span",{class:"s-login-error-message"}),i("label",{class:"s-login-label"},this.lastNameLabel),i("input",{type:"text",class:"s-login-input",ref:s=>this.lastName=s,onKeyDown:s=>this.typing(s,this.newUser),placeholder:salla.lang.get("pages.profile.last_name")}),i("span",{class:"s-login-error-message"}),i("div",{ref:s=>this.regMobileBlock=s,class:"mb-1.5"},i("label",{class:"s-login-label"},this.mobileLabel),i("salla-tel-input",{ref:s=>this.regTelInput=s,onKeyDown:s=>this.typing(s,this.newUser)})),i("div",{ref:s=>this.regEmailBlock=s,class:"mb-1.5"},i("label",{class:"s-login-label"},this.emailLabel),i("input",{type:"email",ref:s=>this.regEmail=s,onKeyDown:s=>this.typing(s,this.newUser),placeholder:"your@email.com",class:"s-login-input s-ltr"}),i("span",{class:"s-login-error-message"})),i("salla-button",{"loader-position":"center",wide:!0,onClick:()=>this.newUser(),ref:s=>this.regBtn=s},salla.lang.get("blocks.header.register")))))}get host(){return t(this)}};l.style="salla-verify{display:block}#salla-login .s-modal-body{overflow:inherit}";const e=class{constructor(i){var t;s(this,i),a.setHost(this.host),this.productSlot=(null===(t=a.getElement('[slot="product"]'))||void 0===t?void 0:t.innerHTML)||this.getDefaultProductSlot(),salla.event.on("search::show",(()=>this.modal.show())),salla.event.on("languages::translations.loaded",(()=>{this.placeholder=salla.lang.get("blocks.header.search_placeholder"),this.noResultsText=salla.lang.get("common.elements.no_options")}))}onModalOpen(){this.modal.querySelector(".s-search-input").focus()}onModalClose(){this.modal.querySelector(".s-search-input").value="",this.results=void 0,this.afterSearching()}getDefaultProductSlot(){return'<div class="s-search-product-image-container"> <img class="s-search-product-image" src="{image}" alt="{name}"/></div><div class="s-search-product-details"> <div class="s-search-product-name">{name}</div> <div class="s-search-product-price">{price}</div></div>'}search(s){if(a.hideElement(this.noResults),0===s.target.value.length)return this.results=void 0,void this.afterSearching();s.target.value.length<=2||(a.toggleElement(this.searchIcon,"s-search-spinner-loader","sicon-search",(()=>!0)),salla.search.api.search(s.target.value).then((s=>this.results=s)).catch((s=>"Query Same As Previous!"!==s?this.results=void 0:null)).finally((()=>this.afterSearching(!1))))}afterSearching(s=!0){var i;this.noResults.style.display=s||(null===(i=this.results)||void 0===i?void 0:i.data.length)>0?"none":"block",a.toggleElement(this.container,"s-search-container-open","no-results",(()=>{var s;return null===(s=this.results)||void 0===s?void 0:s.data.length})).toggleElement(this.searchIcon,"s-search-spinner-loader","sicon-search",(()=>!1)),salla.search.api.previousQuery=""}render(){var s;return i("salla-modal",{position:"top",id:"s-search-modal",ref:s=>this.modal=s},i("div",{class:"s-search-container",ref:s=>this.container=s},i("input",{class:"s-search-input",type:"text",placeholder:this.placeholder,onInput:s=>this.search(s)}),i("span",{class:"s-search-icon"},i("i",{class:"sicon-search",ref:s=>this.searchIcon=s})),i("div",{class:"s-search-results"},null===(s=this.results)||void 0===s?void 0:s.data.map((s=>i("a",{href:s.url,class:"s-search-product",innerHTML:this.productSlot.replace(/\{name\}/g,s.name).replace(/\{price\}/g,s.price).replace(/\{image\}/g,s.image_url)}))),i("p",{ref:s=>this.noResults=s,class:"s-search-no-results"},this.noResultsText))))}componentDidLoad(){this.afterSearching()}get host(){return t(this)}};e.style="#s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}#s-search-modal .s-modal-spacer{display:inline}#s-search-modal .s-modal-body{padding:0;max-width:90%;margin-top:3.2rem;border-radius:0.5rem}#s-search-modal .s-modal-close{top:1rem}";export{l as S,e as a}
@@ -1 +0,0 @@
1
- import{r as s,h as t,H as a,g as i}from"./p-6a5be894.js";import{H as r}from"./p-ed1c00c5.js";const e=class{constructor(t){s(this,t),this.stepsCount=0,this.currentIndex=0,this.submitted=[],r.setHost(this.host),salla.event.on("rating::show",(()=>this.show()))}async show(){return this.modal.show().then((()=>salla.feedback.api.order(salla.config.get("page.id")))).then((s=>this.order=s.data)).then((()=>this.modal.setTitle(salla.lang.get("pages.rating.rate_order")+' <span class="unicode">(#'+this.order.id+")</span>"))).then((()=>this.modal.stopLoading())).then((()=>this.stepsCount=[this.order.testimonials_enabled,this.order.products_enabled,this.order.shipping_enabled].filter((s=>s)).length)).then((()=>setTimeout((()=>this.initiateRating()),100)))}async hide(){return this.modal.hide()}initiateRating(){this.handleWizard(),this.highlightSelectedStars(),salla.document.event.onSubmit(".s-rating-stars-element",(function(s){s.preventDefault();let t=s.target.querySelectorAll(".s-rating-btn-star.hovered"),a=t[t.length-1];if(!a)return;let i=parseInt(a.dataset.star,10);s.target.querySelector(".rating_hidden_input").value=i,s.target.querySelectorAll(".s-rating-btn-star").forEach(((s,t)=>r.toggleElement(s,"selected","un-selected",(()=>t<i)))),s.target.querySelectorAll('.s-rating-btn-star[aria-pressed="true"]').forEach((s=>s.removeAttribute("aria-pressed"))),a.setAttribute("aria-pressed","")}))}handleWizard(){this.steps=this.host.querySelectorAll(".s-rating-step"),this.dots=this.host.querySelectorAll(".s-rating-step-dot"),this.showActiveStep()}showActiveStep(s=null){var t;this.currentTab=s||this.steps[this.currentIndex],r.toggle(".s-rating-step-dot","s-rating-bg-gray","s-rating-bg-primary",(s=>s!=this.dots[this.currentIndex])).toggle(".s-rating-step","s-rating-active","s-rating-hidden",(s=>s==this.currentTab)),0!=this.currentIndex&&(r.toggleElement(this.currentTab,"s-rating-unactive","s-rating-hidden",(()=>!0)),setTimeout((()=>r.toggleElement(this.currentTab,"s-rating-active","s-rating-unactive",(()=>!0))),300));let a=null===(t=this.steps[this.currentIndex+1])||void 0===t?void 0:t.dataset.type;this.nextBtn.querySelector(".s-button-text").innerHTML=a?salla.lang.get("pages.rating.rate")+" "+salla.lang.get("pages.rating."+a):salla.lang.get("pages.rating.send_ratings"),setTimeout((()=>{var s;return this.body.setAttribute("style","height:"+(null===(s=this.currentTab)||void 0===s?void 0:s.scrollHeight)+"px")}))}highlightSelectedStars(){let s=["hovered"];r.all(".s-rating-stars-element",(t=>{let a=t.querySelectorAll(".s-rating-btn-star");t.addEventListener("mouseout",(()=>a.forEach((t=>t.classList.remove(...s))))),a.forEach(((t,i)=>{t.addEventListener("mouseover",(()=>{if(t.classList.add(...s),i<=1)"BUTTON"===t.previousElementSibling.tagName&&t.previousElementSibling.classList.add(...s);else for(let t=0;t<i;t++)a[t].classList.add(...s)})),t.addEventListener("mouseout",(()=>t.classList.remove(...s)))}))}))}previousTab(){this.currentIndex>0&&this.currentIndex--,r.toggleElement(this.backBtn,"s-rating-unvisiable","block",(()=>0==this.currentIndex)),this.showActiveStep()}submit(){this.submittedBefore()||this.validate(),salla.config.canLeave=!1,this.nextBtn.load().then((()=>this.submittedBefore()||this.sendFeedback())).then((()=>this.currentTab.querySelectorAll("[name],.s-rating-btn-star").forEach((s=>s.setAttribute("disabled",""))))).then((()=>this.currentIndex<this.stepsCount&&this.currentIndex++)).then((()=>this.showActiveStep())).then((()=>r.toggle("#prev-btn","block","s-rating-unvisiable",(()=>!0)))).finally((()=>{this.nextBtn.stop(),salla.config.canLeave=!0,this.currentIndex==this.stepsCount&&this.showThankYou(),this.modal.isClosable=!1}))}submittedBefore(){return this.submitted.includes(this.currentIndex)}validate(s=null,t=null){if(!s&&"products"==this.currentTab.dataset.type)return this.currentTab.querySelectorAll(".rating-outer-form").forEach((s=>this.validate(s,"product")));let a=(s=s||this.currentTab).querySelector(".rating_hidden_input").value,i=s.querySelector(".s-rating-comment"),e=s.querySelector(".s-rating-validation-msg");if(a&&i.value&&i.value.length>3)return i.classList.remove("s-rating-has-error"),void(e.innerHTML="");throw t=t||s.dataset.type,r.toggleElement(i,"save","s-rating-has-error",(s=>s.value.length>3)),e.innerHTML=a?salla.lang.get("common.errors.not_less_than_chars",{chars:4})+" "+i.getAttribute("placeholder"):salla.lang.get(`pages.rating.rate_${t}_stars`).replace(" (:item)","")}sendFeedback(){let s={};if(this.currentTab.querySelectorAll("[name]").forEach((t=>{let a=salla.helpers.inputData(t.name,t.value,s);s[a.name]=a.value})),0!=Object.keys(s).length)return s.order_id=salla.config.get("page.id"),s.type=this.currentTab.dataset.type,this.submitted.push(this.currentIndex),salla.feedback.api[this.currentTab.dataset.type](s)}showThankYou(){let s=10,t=setInterval((()=>{this.thanksTime.innerHTML="00:0"+s--,s>0||(clearInterval(t),this.thanksTime.remove(),this.hide().then((()=>window.location.reload())))}),1e3);this.host.querySelector(".s-rating-footer").classList.add("s-rating-unvisiable"),this.showActiveStep(this.thanksTab)}renderRatingStars(s,a="rating"){return t("form",{class:"s-rating-stars-element"},t("input",{type:"hidden",class:"rating_hidden_input",name:a,value:""}),[1,2,3,4,5].map((a=>t("button",{type:"submit",class:"s-rating-btn-star s-rating-btn-star-"+s,"data-star":a},t("i",{class:"sicon-star2"})))))}render(){return t(a,null,t("salla-modal",{isLoading:!0,width:"md",ref:s=>this.modal=s},this.order?[t("div",{class:"s-rating-wrapper",ref:s=>this.body=s},this.order.testimonials_enabled?t("div",{class:"rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden","data-type":"store"},t("div",{class:"s-rating-rounded-icon"},t("img",{src:salla.config.get("store.logo"),alt:"store name",class:"s-rating-store-logo"})),t("h2",{class:"s-rating-title"},salla.lang.get("pages.rating.rate_the_store")),t("div",{class:"s-rating-stars-company"}," ",this.renderRatingStars("large")),t("textarea",{id:"storeReview",name:"comment",class:"s-rating-comment",placeholder:salla.lang.get("pages.rating.write_store_rate")}),t("small",{class:"s-rating-validation-msg"})):"",this.order.products_enabled?t("section",{class:"s-rating-step s-rating-hidden","data-type":"products"},this.order.products.map(((s,a)=>t("div",{class:"rating-outer-form s-rating-product","data-stars-error":salla.lang.get("pages.rating.rate_product_stars")},t("img",{src:s.product.thumbnail,alt:s.product.name,class:"s-rating-product-img"}),t("div",{class:"s-rating-product-details"},t("h3",{class:"s-rating-product-title"}," ",s.product.name),t("div",{class:"s-rating-stars-product"}," ",this.renderRatingStars("small",`products[${a}][rating]`)),t("input",{type:"hidden",name:`products[${a}][product_id]`,value:s.product.id}),t("textarea",{placeholder:salla.lang.get("pages.rating.write_product_rate"),name:`products[${a}][comment]`,class:"s-rating-comment"}),t("small",{class:"s-rating-validation-msg"})))))):"",this.order.shipping_enabled?t("div",{class:"rating-outer-form s-rating-step-wrap s-rating-step s-rating-hidden","data-type":"shipping"},t("input",{type:"hidden",name:"shipping_company_id",value:this.order.shipping.company.id}),this.order.shipping.company.logo?t("div",{class:"s-rating-rounded-icon"},t("img",{src:this.order.shipping.company.logo,class:"s-rating-shipping-logo",alt:this.order.shipping.company.name})):t("span",{class:"s-rating-icon sicon-shipping-fast"}),t("div",{class:"s-rating-title"}," ",salla.lang.get("pages.rating.rate_shipping")+" "+this.order.shipping.company.name),t("div",{class:"s-rating-stars-company"},this.renderRatingStars("large")),t("textarea",{name:"comment",class:"s-rating-comment",placeholder:salla.lang.get("pages.rating.write_shipping_rate")}),t("small",{class:"s-rating-validation-msg"})):"",t("div",{class:"s-rating-thanks s-rating-hidden",ref:s=>this.thanksTab=s},t("span",{class:"s-rating-icon sicon-check-circle2"}),t("h3",{class:"s-rating-thanks-title"},salla.lang.get("pages.rating.thanks")),t("div",{class:"s-rating-thanks-msg",innerHTML:this.order.thanks_message}),t("time",{class:"s-rating-thanks-time",ref:s=>this.thanksTime=s}))),t("div",{class:"s-rating-footer"},t("button",{ref:s=>this.backBtn=s,onClick:()=>this.previousTab(),class:"s-rating-btn s-rating-unvisiable"},salla.lang.get("common.elements.back")),this.stepsCount>1?t("ul",{class:"s-rating-dots"},[0,1,2].slice(0,this.stepsCount).map((()=>t("li",{class:"s-rating-bg-gray s-rating-step-dot"})))):"",t("salla-button",{"loader-position":"center",ref:s=>this.nextBtn=s,onClick:()=>this.submit()},salla.lang.get("common.elements.next")))]:""))}componentDidRender(){this.modal.querySelectorAll("[hidden]").forEach((s=>s.removeAttribute("hidden")))}get host(){return i(this)}};e.style=":host{display:block}.unicode{unicode-bidi:plaintext}";export{e as salla_rating}