@salla.sa/twilight-components 2.12.2 → 2.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Helper-f14223e6.js → Helper-9f7c98a8.js} +14 -1
- package/dist/cjs/Helper-9f7c98a8.js.map +1 -0
- package/dist/cjs/app-globals-33911fba.js +65 -0
- package/dist/cjs/app-globals-33911fba.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/salla-add-product-button_40.cjs.entry.js +1 -1
- package/dist/cjs/salla-add-product-button_40.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
- package/dist/cjs/salla-filters.cjs.entry.js +6 -0
- package/dist/cjs/salla-filters.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-price-range.cjs.entry.js +3 -0
- package/dist/cjs/salla-price-range.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-products-list.cjs.entry.js +28 -3
- package/dist/cjs/salla-products-list.cjs.entry.js.map +1 -1
- package/dist/cjs/salla-products-slider.cjs.entry.js +1 -1
- package/dist/cjs/twilight.cjs.js +1 -1
- package/dist/collection/Helpers/Helper.js +13 -0
- package/dist/collection/Helpers/Helper.js.map +1 -1
- package/dist/collection/components/salla-add-product-button/salla-add-product-button.js.map +1 -1
- package/dist/collection/components/salla-filters/salla-filters.js +8 -2
- package/dist/collection/components/salla-filters/salla-filters.js.map +1 -1
- package/dist/collection/components/salla-price-range/salla-price-range.js +4 -1
- package/dist/collection/components/salla-price-range/salla-price-range.js.map +1 -1
- package/dist/collection/components/salla-products-list/salla-products-list.js +44 -2
- package/dist/collection/components/salla-products-list/salla-products-list.js.map +1 -1
- package/dist/collection/global/app.js +3 -5
- package/dist/collection/global/app.js.map +1 -1
- package/dist/collection/index.js.map +1 -1
- package/dist/components/Helper.js +13 -0
- package/dist/components/Helper.js.map +1 -1
- package/dist/components/index.js +20 -4170
- package/dist/components/index.js.map +1 -1
- package/dist/components/salla-add-product-button2.js.map +1 -1
- package/dist/components/salla-filters.js +6 -0
- package/dist/components/salla-filters.js.map +1 -1
- package/dist/components/salla-price-range2.js +3 -0
- package/dist/components/salla-price-range2.js.map +1 -1
- package/dist/components/salla-products-list.js +28 -3
- package/dist/components/salla-products-list.js.map +1 -1
- package/dist/esm/{Helper-a7971963.js → Helper-e4611a7c.js} +14 -1
- package/dist/esm/Helper-e4611a7c.js.map +1 -0
- package/dist/esm/app-globals-6b360973.js +63 -0
- package/dist/esm/app-globals-6b360973.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/salla-add-product-button_40.entry.js +1 -1
- package/dist/esm/salla-add-product-button_40.entry.js.map +1 -1
- package/dist/esm/salla-filters-widget.entry.js +1 -1
- package/dist/esm/salla-filters.entry.js +6 -0
- package/dist/esm/salla-filters.entry.js.map +1 -1
- package/dist/esm/salla-price-range.entry.js +3 -0
- package/dist/esm/salla-price-range.entry.js.map +1 -1
- package/dist/esm/salla-products-list.entry.js +29 -4
- package/dist/esm/salla-products-list.entry.js.map +1 -1
- package/dist/esm/salla-products-slider.entry.js +1 -1
- package/dist/esm/twilight.js +1 -1
- package/dist/esm-es5/Helper-e4611a7c.js +5 -0
- package/dist/esm-es5/Helper-e4611a7c.js.map +1 -0
- package/dist/esm-es5/app-globals-6b360973.js +23 -0
- package/dist/esm-es5/app-globals-6b360973.js.map +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/salla-add-product-button_40.entry.js +1 -1
- package/dist/esm-es5/salla-add-product-button_40.entry.js.map +1 -1
- package/dist/esm-es5/salla-filters-widget.entry.js +1 -1
- package/dist/esm-es5/salla-filters.entry.js +1 -1
- package/dist/esm-es5/salla-filters.entry.js.map +1 -1
- package/dist/esm-es5/salla-price-range.entry.js.map +1 -1
- package/dist/esm-es5/salla-products-list.entry.js +1 -1
- package/dist/esm-es5/salla-products-list.entry.js.map +1 -1
- package/dist/esm-es5/salla-products-slider.entry.js +1 -1
- package/dist/esm-es5/twilight.js +1 -1
- package/dist/twilight/{p-a378c3be.entry.js → p-1342a68f.entry.js} +2 -2
- package/dist/twilight/p-15b4fb7a.js +23 -0
- package/dist/twilight/p-15b4fb7a.js.map +1 -0
- package/dist/twilight/{p-0e716419.entry.js → p-23215851.entry.js} +2 -2
- package/dist/twilight/p-23215851.entry.js.map +1 -0
- package/dist/twilight/p-2d334c27.system.js +5 -0
- package/dist/twilight/p-2d334c27.system.js.map +1 -0
- package/dist/twilight/{p-9ab303f5.system.entry.js → p-3671b683.system.entry.js} +2 -2
- package/dist/twilight/{p-5ffffea6.js → p-431fcc73.js} +2 -2
- package/dist/twilight/p-431fcc73.js.map +1 -0
- package/dist/twilight/{p-671591bd.system.js → p-5f400dc8.system.js} +2 -2
- package/dist/twilight/{p-0bab8332.entry.js → p-61d1ce2d.entry.js} +2 -2
- package/dist/twilight/p-61d1ce2d.entry.js.map +1 -0
- package/dist/twilight/p-8891fdc9.system.js +23 -0
- package/dist/twilight/p-8891fdc9.system.js.map +1 -0
- package/dist/twilight/p-8e3f85c5.system.entry.js.map +1 -1
- package/dist/twilight/p-90f60c35.system.entry.js +5 -0
- package/dist/twilight/p-90f60c35.system.entry.js.map +1 -0
- package/dist/twilight/{p-ee9a8735.system.entry.js → p-b4d2ecf1.system.entry.js} +2 -2
- package/dist/twilight/p-b4d2ecf1.system.entry.js.map +1 -0
- package/dist/twilight/p-c0a87009.system.entry.js +5 -0
- package/dist/twilight/p-c0a87009.system.entry.js.map +1 -0
- package/dist/twilight/p-ce042888.entry.js.map +1 -1
- package/dist/twilight/p-e0cb00aa.entry.js +5 -0
- package/dist/twilight/p-e0cb00aa.entry.js.map +1 -0
- package/dist/twilight/{p-3d027624.entry.js → p-ea65d3c9.entry.js} +2 -2
- package/dist/twilight/{p-37264cdf.system.entry.js → p-ffec6e8f.system.entry.js} +2 -2
- package/dist/twilight/twilight.esm.js +1 -1
- package/dist/twilight/twilight.js +1 -1
- package/dist/types/Helpers/Helper.d.ts +1 -0
- package/dist/types/components/salla-filters/salla-filters.d.ts +2 -2
- package/dist/types/components/salla-price-range/salla-price-range.d.ts +3 -0
- package/dist/types/components/salla-products-list/salla-products-list.d.ts +5 -0
- package/dist/types/components.d.ts +12 -1
- package/dist/types/global/app.d.ts +1 -5
- package/dist/types/index.d.ts +1 -0
- package/package.json +3 -3
- package/dist/cjs/Helper-f14223e6.js.map +0 -1
- package/dist/cjs/app-globals-9ad08b7a.js +0 -4215
- package/dist/cjs/app-globals-9ad08b7a.js.map +0 -1
- package/dist/esm/Helper-a7971963.js.map +0 -1
- package/dist/esm/app-globals-d0d32791.js +0 -4213
- package/dist/esm/app-globals-d0d32791.js.map +0 -1
- package/dist/esm-es5/Helper-a7971963.js +0 -5
- package/dist/esm-es5/Helper-a7971963.js.map +0 -1
- package/dist/esm-es5/app-globals-d0d32791.js +0 -25
- package/dist/esm-es5/app-globals-d0d32791.js.map +0 -1
- package/dist/twilight/p-0bab8332.entry.js.map +0 -1
- package/dist/twilight/p-0e716419.entry.js.map +0 -1
- package/dist/twilight/p-2042f370.system.js +0 -5
- package/dist/twilight/p-2042f370.system.js.map +0 -1
- package/dist/twilight/p-5ffffea6.js.map +0 -1
- package/dist/twilight/p-aa8e58b9.js +0 -25
- package/dist/twilight/p-aa8e58b9.js.map +0 -1
- package/dist/twilight/p-bd2b7381.system.js +0 -25
- package/dist/twilight/p-bd2b7381.system.js.map +0 -1
- package/dist/twilight/p-be148f43.system.entry.js +0 -5
- package/dist/twilight/p-be148f43.system.entry.js.map +0 -1
- package/dist/twilight/p-c4a4b584.system.entry.js +0 -5
- package/dist/twilight/p-c4a4b584.system.entry.js.map +0 -1
- package/dist/twilight/p-dd290c58.entry.js +0 -5
- package/dist/twilight/p-dd290c58.entry.js.map +0 -1
- package/dist/twilight/p-ee9a8735.system.entry.js.map +0 -1
- /package/dist/twilight/{p-a378c3be.entry.js.map → p-1342a68f.entry.js.map} +0 -0
- /package/dist/twilight/{p-9ab303f5.system.entry.js.map → p-3671b683.system.entry.js.map} +0 -0
- /package/dist/twilight/{p-671591bd.system.js.map → p-5f400dc8.system.js.map} +0 -0
- /package/dist/twilight/{p-3d027624.entry.js.map → p-ea65d3c9.entry.js.map} +0 -0
- /package/dist/twilight/{p-37264cdf.system.entry.js.map → p-ffec6e8f.system.entry.js.map} +0 -0
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
var __spreadArray=this&&this.__spreadArray||function(e,u,r){if(r||arguments.length===2)for(var t=0,a=u.length,n;t<a;t++){if(n||!(t in u)){if(!n)n=Array.prototype.slice.call(u,0,t);n[t]=u[t]}}return e.concat(n||Array.prototype.slice.call(u))};
|
|
2
|
-
/*!
|
|
3
|
-
* Crafted with ❤ by Salla
|
|
4
|
-
*/System.register([],(function(e){"use strict";return{execute:function(){salla.event.setMaxListeners(100);var u=function(){function e(){}e.prototype.toggleElementClassIf=function(e,u,r,t){var a,n;u=Array.isArray(u)?u:u.split(" ");r=Array.isArray(r)?r:r.split(" ");var s=t(e);e===null||e===void 0?void 0:(a=e.classList).remove.apply(a,s?r:u);e===null||e===void 0?void 0:(n=e.classList).add.apply(n,s?u:r);return this};e.prototype.toggleClassIf=function(e,u,r,t){var a=this;document.querySelectorAll(e).forEach((function(e){return a.toggleElementClassIf(e,u,r,t)}));return this};e.prototype.isValidEmail=function(e){var u=/^(([^<>()[\]\\.,;:\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,}))$/;return u.test(String(e).toLowerCase())};e.prototype.filterEmojies=function(e){var u=/(?:[\u2700-\u27bf]|(?:\ud83c[\udde6-\uddff]){2}|[\ud800-\udbff][\udc00-\udfff]|[\u0023-\u0039]\ufe0f?\u20e3|\u3299|\u3297|\u303d|\u3030|\u24c2|\ud83c[\udd70-\udd71]|\ud83c[\udd7e-\udd7f]|\ud83c\udd8e|\ud83c[\udd91-\udd9a]|\ud83c[\udde6-\uddff]|\ud83c[\ude01-\ude02]|\ud83c\ude1a|\ud83c\ude2f|\ud83c[\ude32-\ude3a]|\ud83c[\ude50-\ude51]|\u203c|\u2049|[\u25aa-\u25ab]|\u25b6|\u25c0|[\u25fb-\u25fe]|\u00a9|\u00ae|\u2122|\u2139|\ud83c\udc04|[\u2600-\u26FF]|\u2b05|\u2b06|\u2b07|\u2b1b|\u2b1c|\u2b50|\u2b55|\u231a|\u231b|\u2328|\u23cf|[\u23e9-\u23f3]|[\u23f8-\u23fa]|\ud83c\udccf|\u2934|\u2935|[\u2190-\u21ff])/g;return e.replace(u,"")};e.prototype.debounce=function(e){var u=[];for(var r=1;r<arguments.length;r++){u[r-1]=arguments[r]}if(!this.debounce_){this.debounce_=salla.helpers.debounce((function(e){var u=[];for(var r=1;r<arguments.length;r++){u[r-1]=arguments[r]}return e.apply(void 0,u)}),500)}return this.debounce_.apply(this,__spreadArray([e],u,false))};e.prototype.getProductsSource=function(e){return{"brands.single":"brands","product.index":"categories","product.index.latest":"latest","product.index.offers":"offers","product.index.search":"search","landing-page":"landing-page","product.index.tag":"tags","product.index.sales":"sales","components.most_sales_products":"sales"}[e||salla.config.get("page.slug")]||e||"latest"};e.prototype.getProductsSourceValue=function(e,u){var r=this.getProductsSource(e);var t=null;if(u){try{t=JSON.parse(u)}catch(e){console.error("Invalid JSON string in sourceValue:",e)}}if(!["search","json","offers","latest","sales","related"].includes(r)){if(Array.isArray(t)&&t.length){return t}if(typeof t==="number"){return[t]}if(!u&&["categories","tags","brands"].includes(e)){return[salla.config.get("page.id")]}}if(t||u){return t||u}if(r==="search"){return new URLSearchParams(window.location.search).get("q")||""}return salla.config.get("page.id")};return e}();var r=e("H",new u)}}}));
|
|
5
|
-
//# sourceMappingURL=p-2042f370.system.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["salla","event","setMaxListeners","Helper","prototype","toggleElementClassIf","element","classes1","classes2","callback","Array","isArray","split","isClasses1","_a","classList","remove","apply","_b","add","this","toggleClassIf","selector","_this","document","querySelectorAll","forEach","isValidEmail","email","re","test","String","toLowerCase","filterEmojies","text","characterFilter","replace","debounce","fn","data","_i","arguments","length","debounce_","helpers","innerData","__spreadArray","getProductsSource","source","config","get","getProductsSourceValue","sourceValue","parsedSource","parsedSourceValue","JSON","parse","error","console","includes","URLSearchParams","window","location","search","Helper$1","exports"],"sources":["src/Helpers/Helper.ts"],"sourcesContent":["//TODO::reduce it to 10\nsalla.event.setMaxListeners(100);\n\nclass Helper {\n private debounce_: Boolean;\n\n toggleElementClassIf(element, classes1, classes2, callback) {\n classes1 = Array.isArray(classes1) ? classes1 : classes1.split(' ');\n classes2 = Array.isArray(classes2) ? classes2 : classes2.split(' ');\n let isClasses1 = callback(element);\n element?.classList.remove(...(isClasses1 ? classes2 : classes1));\n element?.classList.add(...(isClasses1 ? classes1 : classes2));\n return this;\n }\n\n toggleClassIf(selector, classes1, classes2, callback) {\n document.querySelectorAll(selector).forEach(element => this.toggleElementClassIf(element, classes1, classes2, callback));\n return this;\n }\n\n isValidEmail(email) {\n const re = /^(([^<>()[\\]\\\\.,;:\\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,}))$/;\n return re.test(String(email).toLowerCase());\n }\n\n filterEmojies(text) {\n var characterFilter = /(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\u0023-\\u0039]\\ufe0f?\\u20e3|\\u3299|\\u3297|\\u303d|\\u3030|\\u24c2|\\ud83c[\\udd70-\\udd71]|\\ud83c[\\udd7e-\\udd7f]|\\ud83c\\udd8e|\\ud83c[\\udd91-\\udd9a]|\\ud83c[\\udde6-\\uddff]|\\ud83c[\\ude01-\\ude02]|\\ud83c\\ude1a|\\ud83c\\ude2f|\\ud83c[\\ude32-\\ude3a]|\\ud83c[\\ude50-\\ude51]|\\u203c|\\u2049|[\\u25aa-\\u25ab]|\\u25b6|\\u25c0|[\\u25fb-\\u25fe]|\\u00a9|\\u00ae|\\u2122|\\u2139|\\ud83c\\udc04|[\\u2600-\\u26FF]|\\u2b05|\\u2b06|\\u2b07|\\u2b1b|\\u2b1c|\\u2b50|\\u2b55|\\u231a|\\u231b|\\u2328|\\u23cf|[\\u23e9-\\u23f3]|[\\u23f8-\\u23fa]|\\ud83c\\udccf|\\u2934|\\u2935|[\\u2190-\\u21ff])/g;\n return text.replace(characterFilter, \"\");\n }\n\n debounce(fn, ...data) {\n if (!this.debounce_) {\n this.debounce_ = salla.helpers.debounce((callback, ...innerData) => callback(...innerData), 500);\n }\n //@ts-ignore\n return this.debounce_(fn, ...data);\n }\n\n getProductsSource(source) {\n return {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.index.sales': 'sales',\n 'components.most_sales_products': 'sales',//temporary, delete it after two days from now\n }[source || salla.config.get('page.slug')] || source || 'latest';\n }\n\n getProductsSourceValue(source, sourceValue) {\n const parsedSource = this.getProductsSource(source);\n\n // Validate if the source value is a valid JSON string\n let parsedSourceValue: any = null;\n if (sourceValue) {\n try {\n parsedSourceValue = JSON.parse(sourceValue);\n } catch (error) {\n console.error('Invalid JSON string in sourceValue:', error);\n }\n }\n\n // Handle different source types\n if (!['search', 'json', 'offers', 'latest', 'sales', 'related'].includes(parsedSource)) {\n\n if (Array.isArray(parsedSourceValue) && parsedSourceValue.length) {\n return parsedSourceValue;\n }\n\n if (typeof parsedSourceValue === 'number') {\n return [parsedSourceValue];\n }\n\n if (!sourceValue && ['categories', 'tags', 'brands'].includes(source)) {\n return [salla.config.get('page.id')];\n }\n }\n\n // Return sourceValue if it exists and is a valid JSON object/array\n if (parsedSourceValue || sourceValue) {\n return parsedSourceValue || sourceValue;\n }\n\n if (parsedSource === 'search') {\n return new URLSearchParams(window.location.search).get('q') || '';\n }\n\n // Return page id as default value\n return salla.config.get('page.id');\n }\n}\n\nexport default new Helper;\n"],"mappings":";;;0EACAA,MAAMC,MAAMC,gBAAgB,KAE5B,IAAAC,EAAA,oBAAAA,I,CAGEA,EAAAC,UAAAC,qBAAA,SAAqBC,EAASC,EAAUC,EAAUC,G,QAChDF,EAAWG,MAAMC,QAAQJ,GAAYA,EAAWA,EAASK,MAAM,KAC/DJ,EAAWE,MAAMC,QAAQH,GAAYA,EAAWA,EAASI,MAAM,KAC/D,IAAIC,EAAaJ,EAASH,GAC1BA,IAAO,MAAPA,SAAO,UAAPQ,EAAAR,EAASS,WAAUC,OAAMC,MAAAH,EAAKD,EAAaL,EAAWD,GACtDD,IAAO,MAAPA,SAAO,UAAPY,EAAAZ,EAASS,WAAUI,IAAGF,MAAAC,EAAKL,EAAaN,EAAWC,GACnD,OAAOY,I,EAGTjB,EAAAC,UAAAiB,cAAA,SAAcC,EAAUf,EAAUC,EAAUC,GAA5C,IAAAc,EAAAH,KACEI,SAASC,iBAAiBH,GAAUI,SAAQ,SAAApB,GAAW,OAAAiB,EAAKlB,qBAAqBC,EAASC,EAAUC,EAAUC,EAAvD,IACvD,OAAOW,I,EAGTjB,EAAAC,UAAAuB,aAAA,SAAaC,GACX,IAAMC,EAAK,wJACX,OAAOA,EAAGC,KAAKC,OAAOH,GAAOI,c,EAG/B7B,EAAAC,UAAA6B,cAAA,SAAcC,GACZ,IAAIC,EAAkB,imBACtB,OAAOD,EAAKE,QAAQD,EAAiB,G,EAGvChC,EAAAC,UAAAiC,SAAA,SAASC,GAAI,IAAAC,EAAA,G,IAAA,IAAAC,EAAA,EAAAA,EAAAC,UAAAC,OAAAF,IAAO,CAAPD,EAAAC,EAAA,GAAAC,UAAAD,E,CACX,IAAKpB,KAAKuB,UAAW,CACnBvB,KAAKuB,UAAY3C,MAAM4C,QAAQP,UAAS,SAAC5B,GAAU,IAAAoC,EAAA,G,IAAA,IAAAL,EAAA,EAAAA,EAAAC,UAAAC,OAAAF,IAAY,CAAZK,EAAAL,EAAA,GAAAC,UAAAD,E,CAAiB,OAAA/B,EAAQQ,WAAA,EAAI4B,EAAZ,GAAwB,I,CAG9F,OAAOzB,KAAKuB,UAAS1B,MAAdG,KAAI0B,cAAA,CAAWR,GAAOC,EAAI,O,EAGnCpC,EAAAC,UAAA2C,kBAAA,SAAkBC,GAChB,MAAO,CACL,gBAAiB,SACjB,gBAAiB,aACjB,uBAAwB,SACxB,uBAAwB,SACxB,uBAAwB,SACxB,eAAgB,eAChB,oBAAqB,OACrB,sBAAuB,QACvB,iCAAkC,SAClCA,GAAUhD,MAAMiD,OAAOC,IAAI,eAAiBF,GAAU,Q,EAG1D7C,EAAAC,UAAA+C,uBAAA,SAAuBH,EAAQI,GAC7B,IAAMC,EAAejC,KAAK2B,kBAAkBC,GAG1C,IAAIM,EAAyB,KAC7B,GAAIF,EAAa,CACf,IACEE,EAAoBC,KAAKC,MAAMJ,E,CAC/B,MAAOK,GACPC,QAAQD,MAAM,sCAAuCA,E,EAK3D,IAAK,CAAC,SAAU,OAAQ,SAAU,SAAU,QAAS,WAAWE,SAASN,GAAe,CAEtF,GAAI3C,MAAMC,QAAQ2C,IAAsBA,EAAkBZ,OAAQ,CAChE,OAAOY,C,CAGT,UAAWA,IAAsB,SAAU,CACzC,MAAO,CAACA,E,CAGV,IAAKF,GAAe,CAAC,aAAc,OAAQ,UAAUO,SAASX,GAAS,CACrE,MAAO,CAAChD,MAAMiD,OAAOC,IAAI,W,EAK7B,GAAII,GAAqBF,EAAa,CACpC,OAAOE,GAAqBF,C,CAG9B,GAAIC,IAAiB,SAAU,CAC7B,OAAO,IAAIO,gBAAgBC,OAAOC,SAASC,QAAQb,IAAI,MAAQ,E,CAIjE,OAAOlD,MAAMiD,OAAOC,IAAI,U,WAxF5B,GA4FA,IAAAc,EAAAC,EAAA,IAAe,IAAI9D,E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["salla","event","setMaxListeners","Helper","toggleElementClassIf","element","classes1","classes2","callback","Array","isArray","split","isClasses1","classList","remove","add","this","toggleClassIf","selector","document","querySelectorAll","forEach","isValidEmail","email","re","test","String","toLowerCase","filterEmojies","text","characterFilter","replace","debounce","fn","data","debounce_","helpers","innerData","getProductsSource","source","config","get","getProductsSourceValue","sourceValue","parsedSource","parsedSourceValue","JSON","parse","error","console","includes","length","URLSearchParams","window","location","search","Helper$1"],"sources":["./src/Helpers/Helper.ts"],"sourcesContent":["//TODO::reduce it to 10\nsalla.event.setMaxListeners(100);\n\nclass Helper {\n private debounce_: Boolean;\n\n toggleElementClassIf(element, classes1, classes2, callback) {\n classes1 = Array.isArray(classes1) ? classes1 : classes1.split(' ');\n classes2 = Array.isArray(classes2) ? classes2 : classes2.split(' ');\n let isClasses1 = callback(element);\n element?.classList.remove(...(isClasses1 ? classes2 : classes1));\n element?.classList.add(...(isClasses1 ? classes1 : classes2));\n return this;\n }\n\n toggleClassIf(selector, classes1, classes2, callback) {\n document.querySelectorAll(selector).forEach(element => this.toggleElementClassIf(element, classes1, classes2, callback));\n return this;\n }\n\n isValidEmail(email) {\n const re = /^(([^<>()[\\]\\\\.,;:\\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,}))$/;\n return re.test(String(email).toLowerCase());\n }\n\n filterEmojies(text) {\n var characterFilter = /(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\u0023-\\u0039]\\ufe0f?\\u20e3|\\u3299|\\u3297|\\u303d|\\u3030|\\u24c2|\\ud83c[\\udd70-\\udd71]|\\ud83c[\\udd7e-\\udd7f]|\\ud83c\\udd8e|\\ud83c[\\udd91-\\udd9a]|\\ud83c[\\udde6-\\uddff]|\\ud83c[\\ude01-\\ude02]|\\ud83c\\ude1a|\\ud83c\\ude2f|\\ud83c[\\ude32-\\ude3a]|\\ud83c[\\ude50-\\ude51]|\\u203c|\\u2049|[\\u25aa-\\u25ab]|\\u25b6|\\u25c0|[\\u25fb-\\u25fe]|\\u00a9|\\u00ae|\\u2122|\\u2139|\\ud83c\\udc04|[\\u2600-\\u26FF]|\\u2b05|\\u2b06|\\u2b07|\\u2b1b|\\u2b1c|\\u2b50|\\u2b55|\\u231a|\\u231b|\\u2328|\\u23cf|[\\u23e9-\\u23f3]|[\\u23f8-\\u23fa]|\\ud83c\\udccf|\\u2934|\\u2935|[\\u2190-\\u21ff])/g;\n return text.replace(characterFilter, \"\");\n }\n\n debounce(fn, ...data) {\n if (!this.debounce_) {\n this.debounce_ = salla.helpers.debounce((callback, ...innerData) => callback(...innerData), 500);\n }\n //@ts-ignore\n return this.debounce_(fn, ...data);\n }\n\n getProductsSource(source) {\n return {\n 'brands.single': 'brands',\n 'product.index': 'categories',\n 'product.index.latest': 'latest',\n 'product.index.offers': 'offers',\n 'product.index.search': 'search',\n 'landing-page': 'landing-page',\n 'product.index.tag': 'tags',\n 'product.index.sales': 'sales',\n 'components.most_sales_products': 'sales',//temporary, delete it after two days from now\n }[source || salla.config.get('page.slug')] || source || 'latest';\n }\n\n getProductsSourceValue(source, sourceValue) {\n const parsedSource = this.getProductsSource(source);\n\n // Validate if the source value is a valid JSON string\n let parsedSourceValue: any = null;\n if (sourceValue) {\n try {\n parsedSourceValue = JSON.parse(sourceValue);\n } catch (error) {\n console.error('Invalid JSON string in sourceValue:', error);\n }\n }\n\n // Handle different source types\n if (!['search', 'json', 'offers', 'latest', 'sales', 'related'].includes(parsedSource)) {\n\n if (Array.isArray(parsedSourceValue) && parsedSourceValue.length) {\n return parsedSourceValue;\n }\n\n if (typeof parsedSourceValue === 'number') {\n return [parsedSourceValue];\n }\n\n if (!sourceValue && ['categories', 'tags', 'brands'].includes(source)) {\n return [salla.config.get('page.id')];\n }\n }\n\n // Return sourceValue if it exists and is a valid JSON object/array\n if (parsedSourceValue || sourceValue) {\n return parsedSourceValue || sourceValue;\n }\n\n if (parsedSource === 'search') {\n return new URLSearchParams(window.location.search).get('q') || '';\n }\n\n // Return page id as default value\n return salla.config.get('page.id');\n }\n}\n\nexport default new Helper;\n"],"mappings":";;;AACAA,MAAMC,MAAMC,gBAAgB,KAE5B,MAAMC,EAGJC,qBAAqBC,EAASC,EAAUC,EAAUC,GAChDF,EAAWG,MAAMC,QAAQJ,GAAYA,EAAWA,EAASK,MAAM,KAC/DJ,EAAWE,MAAMC,QAAQH,GAAYA,EAAWA,EAASI,MAAM,KAC/D,IAAIC,EAAaJ,EAASH,GAC1BA,IAAO,MAAPA,SAAO,SAAPA,EAASQ,UAAUC,UAAWF,EAAaL,EAAWD,GACtDD,IAAO,MAAPA,SAAO,SAAPA,EAASQ,UAAUE,OAAQH,EAAaN,EAAWC,GACnD,OAAOS,I,CAGTC,cAAcC,EAAUZ,EAAUC,EAAUC,GAC1CW,SAASC,iBAAiBF,GAAUG,SAAQhB,GAAWW,KAAKZ,qBAAqBC,EAASC,EAAUC,EAAUC,KAC9G,OAAOQ,I,CAGTM,aAAaC,GACX,MAAMC,EAAK,wJACX,OAAOA,EAAGC,KAAKC,OAAOH,GAAOI,c,CAG/BC,cAAcC,GACZ,IAAIC,EAAkB,imBACtB,OAAOD,EAAKE,QAAQD,EAAiB,G,CAGvCE,SAASC,KAAOC,GACd,IAAKlB,KAAKmB,UAAW,CACnBnB,KAAKmB,UAAYnC,MAAMoC,QAAQJ,UAAS,CAACxB,KAAa6B,IAAc7B,KAAY6B,IAAY,I,CAG9F,OAAOrB,KAAKmB,UAAUF,KAAOC,E,CAG/BI,kBAAkBC,GAChB,MAAO,CACL,gBAAiB,SACjB,gBAAiB,aACjB,uBAAwB,SACxB,uBAAwB,SACxB,uBAAwB,SACxB,eAAgB,eAChB,oBAAqB,OACrB,sBAAuB,QACvB,iCAAkC,SAClCA,GAAUvC,MAAMwC,OAAOC,IAAI,eAAiBF,GAAU,Q,CAG1DG,uBAAuBH,EAAQI,GAC7B,MAAMC,EAAe5B,KAAKsB,kBAAkBC,GAG1C,IAAIM,EAAyB,KAC7B,GAAIF,EAAa,CACf,IACEE,EAAoBC,KAAKC,MAAMJ,E,CAC/B,MAAOK,GACPC,QAAQD,MAAM,sCAAuCA,E,EAK3D,IAAK,CAAC,SAAU,OAAQ,SAAU,SAAU,QAAS,WAAWE,SAASN,GAAe,CAEtF,GAAInC,MAAMC,QAAQmC,IAAsBA,EAAkBM,OAAQ,CAChE,OAAON,C,CAGT,UAAWA,IAAsB,SAAU,CACzC,MAAO,CAACA,E,CAGV,IAAKF,GAAe,CAAC,aAAc,OAAQ,UAAUO,SAASX,GAAS,CACrE,MAAO,CAACvC,MAAMwC,OAAOC,IAAI,W,EAK7B,GAAII,GAAqBF,EAAa,CACpC,OAAOE,GAAqBF,C,CAG9B,GAAIC,IAAiB,SAAU,CAC7B,OAAO,IAAIQ,gBAAgBC,OAAOC,SAASC,QAAQd,IAAI,MAAQ,E,CAIjE,OAAOzC,MAAMwC,OAAOC,IAAI,U,EAI5B,MAAAe,EAAe,IAAIrD,S"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Crafted with ❤ by Salla
|
|
3
|
-
*/
|
|
4
|
-
import{c as t,a as n}from"./p-eed6da4c.js";var e=t((function(t){(function(n,e){if(t.exports){t.exports=e()}else{n.EvEmitter=e()}})(typeof window!="undefined"?window:n,(function(){function t(){}let n=t.prototype;n.on=function(t,n){if(!t||!n)return this;let e=this._events=this._events||{};let i=e[t]=e[t]||[];if(!i.includes(n)){i.push(n)}return this};n.once=function(t,n){if(!t||!n)return this;this.on(t,n);let e=this._onceEvents=this._onceEvents||{};let i=e[t]=e[t]||{};i[n]=true;return this};n.off=function(t,n){let e=this._events&&this._events[t];if(!e||!e.length)return this;let i=e.indexOf(n);if(i!=-1){e.splice(i,1)}return this};n.emitEvent=function(t,n){let e=this._events&&this._events[t];if(!e||!e.length)return this;e=e.slice(0);n=n||[];let i=this._onceEvents&&this._onceEvents[t];for(let r of e){let e=i&&i[r];if(e){this.off(t,r);delete i[r]}r.apply(this,n)}return this};n.allOff=function(){delete this._events;delete this._onceEvents;return this};return t}))}));var i=t((function(t){(function(n,e){if(t.exports){t.exports=e(n)}else{n.fizzyUIUtils=e(n)}})(n,(function t(n){let e={};e.extend=function(t,n){return Object.assign(t,n)};e.modulo=function(t,n){return(t%n+n)%n};e.makeArray=function(t){if(Array.isArray(t))return t;if(t===null||t===undefined)return[];let n=typeof t=="object"&&typeof t.length=="number";if(n)return[...t];return[t]};e.removeFrom=function(t,n){let e=t.indexOf(n);if(e!=-1){t.splice(e,1)}};e.getParent=function(t,n){while(t.parentNode&&t!=document.body){t=t.parentNode;if(t.matches(n))return t}};e.getQueryElement=function(t){if(typeof t=="string"){return document.querySelector(t)}return t};e.handleEvent=function(t){let n="on"+t.type;if(this[n]){this[n](t)}};e.filterFindElements=function(t,n){t=e.makeArray(t);return t.filter((t=>t instanceof HTMLElement)).reduce(((t,e)=>{if(!n){t.push(e);return t}if(e.matches(n)){t.push(e)}let i=e.querySelectorAll(n);t=t.concat(...i);return t}),[])};e.debounceMethod=function(t,n,e){e=e||100;let i=t.prototype[n];let r=n+"Timeout";t.prototype[n]=function(){clearTimeout(this[r]);let t=arguments;this[r]=setTimeout((()=>{i.apply(this,t);delete this[r]}),e)}};e.docReady=function(t){let n=document.readyState;if(n=="complete"||n=="interactive"){setTimeout(t)}else{document.addEventListener("DOMContentLoaded",t)}};e.toDashed=function(t){return t.replace(/(.)([A-Z])/g,(function(t,n,e){return n+"-"+e})).toLowerCase()};let i=n.console;e.htmlInit=function(t,r){e.docReady((function(){let a=e.toDashed(r);let o="data-"+a;let s=document.querySelectorAll(`[${o}]`);let u=n.jQuery;[...s].forEach((n=>{let e=n.getAttribute(o);let a;try{a=e&&JSON.parse(e)}catch(t){if(i){i.error(`Error parsing ${o} on ${n.className}: ${t}`)}return}let s=new t(n,a);if(u){u.data(n,r,s)}}))}))};return e}))}));var r=t((function(t){(function(n,r){if(t.exports){t.exports=r(n,e,i)}else{n.InfiniteScroll=r(n,n.EvEmitter,n.fizzyUIUtils)}})(window,(function t(n,e,i){let r=n.jQuery;let a={};function o(t,n){let e=i.getQueryElement(t);if(!e){console.error("Bad element for InfiniteScroll: "+(e||t));return}t=e;if(t.infiniteScrollGUID){let e=a[t.infiniteScrollGUID];e.option(n);return e}this.element=t;this.options={...o.defaults};this.option(n);if(r){this.$element=r(this.element)}this.create()}o.defaults={};o.create={};o.destroy={};let s=o.prototype;Object.assign(s,e.prototype);let u=0;s.create=function(){let t=this.guid=++u;this.element.infiniteScrollGUID=t;a[t]=this;this.pageIndex=1;this.loadCount=0;this.updateGetPath();let n=this.getPath&&this.getPath();if(!n){console.error("Disabling InfiniteScroll");return}this.updateGetAbsolutePath();this.log("initialized",[this.element.className]);this.callOnInit();for(let t in o.create){o.create[t].call(this)}};s.option=function(t){Object.assign(this.options,t)};s.callOnInit=function(){let t=this.options.onInit;if(t){t.call(this,this)}};s.dispatchEvent=function(t,n,e){this.log(t,e);let i=n?[n].concat(e):e;this.emitEvent(t,i);if(!r||!this.$element){return}t+=".infiniteScroll";let a=t;if(n){let e=r.Event(n);e.type=t;a=e}this.$element.trigger(a,e)};let l={initialized:t=>`on ${t}`,request:t=>`URL: ${t}`,load:(t,n)=>`${t.title||""}. URL: ${n}`,error:(t,n)=>`${t}. URL: ${n}`,append:(t,n,e)=>`${e.length} items. URL: ${n}`,last:(t,n)=>`URL: ${n}`,history:(t,n)=>`URL: ${n}`,pageIndex:function(t,n){return`current page determined to be: ${t} from ${n}`}};s.log=function(t,n){if(!this.options.debug)return;let e=`[InfiniteScroll] ${t}`;let i=l[t];if(i)e+=". "+i.apply(this,n);console.log(e)};s.updateMeasurements=function(){this.windowHeight=n.innerHeight;let t=this.element.getBoundingClientRect();this.top=t.top+n.scrollY};s.updateScroller=function(){let t=this.options.elementScroll;if(!t){this.scroller=n;return}this.scroller=t===true?this.element:i.getQueryElement(t);if(!this.scroller){throw new Error(`Unable to find elementScroll: ${t}`)}};s.updateGetPath=function(){let t=this.options.path;if(!t){console.error(`InfiniteScroll path option required. Set as: ${t}`);return}let n=typeof t;if(n=="function"){this.getPath=t;return}let e=n=="string"&&t.match("{{#}}");if(e){this.updateGetPathTemplate(t);return}this.updateGetPathSelector(t)};s.updateGetPathTemplate=function(t){this.getPath=()=>{let n=this.pageIndex+1;return t.replace("{{#}}",n)};let n=t.replace(/(\\\?|\?)/,"\\?").replace("{{#}}","(\\d\\d?\\d?)");let e=new RegExp(n);let i=location.href.match(e);if(i){this.pageIndex=parseInt(i[1],10);this.log("pageIndex",[this.pageIndex,"template string"])}};let c=[/^(.*?\/?page\/?)(\d\d?\d?)(.*?$)/,/^(.*?\/?\?page=)(\d\d?\d?)(.*?$)/,/(.*?)(\d\d?\d?)(?!.*\d)(.*?$)/];let f=o.getPathParts=function(t){if(!t)return;for(let n of c){let e=t.match(n);if(e){let[,t,n,i]=e;return{begin:t,index:n,end:i}}}};s.updateGetPathSelector=function(t){let n=document.querySelector(t);if(!n){console.error(`Bad InfiniteScroll path option. Next link not found: ${t}`);return}let e=n.getAttribute("href");let i=f(e);if(!i){console.error(`InfiniteScroll unable to parse next link href: ${e}`);return}let{begin:r,index:a,end:o}=i;this.isPathSelector=true;this.getPath=()=>r+(this.pageIndex+1)+o;this.pageIndex=parseInt(a,10)-1;this.log("pageIndex",[this.pageIndex,"next link"])};s.updateGetAbsolutePath=function(){let t=this.getPath();let n=t.match(/^http/)||t.match(/^\//);if(n){this.getAbsolutePath=this.getPath;return}let{pathname:e}=location;let i=t.match(/^\?/);let r=e.substring(0,e.lastIndexOf("/"));let a=i?e:r+"/";this.getAbsolutePath=()=>a+this.getPath()};o.create.hideNav=function(){let t=i.getQueryElement(this.options.hideNav);if(!t)return;t.style.display="none";this.nav=t};o.destroy.hideNav=function(){if(this.nav)this.nav.style.display=""};s.destroy=function(){this.allOff();for(let t in o.destroy){o.destroy[t].call(this)}delete this.element.infiniteScrollGUID;delete a[this.guid];if(r&&this.$element){r.removeData(this.element,"infiniteScroll")}};o.throttle=function(t,n){n=n||200;let e,i;return function(){let r=+new Date;let a=arguments;let o=()=>{e=r;t.apply(this,a)};if(e&&r<e+n){clearTimeout(i);i=setTimeout(o,n)}else{o()}}};o.data=function(t){t=i.getQueryElement(t);let n=t&&t.infiniteScrollGUID;return n&&a[n]};o.setJQuery=function(t){r=t};i.htmlInit(o,"infinite-scroll");s._init=function(){};let{jQueryBridget:d}=n;if(r&&d){d("infiniteScroll",o,r)}return o}))}));var a=t((function(t){(function(n,e){if(t.exports){t.exports=e(n,r)}else{e(n,n.InfiniteScroll)}})(window,(function t(n,e){let i=e.prototype;Object.assign(e.defaults,{loadOnScroll:true,checkLastPage:true,responseBody:"text",domParseResponse:true});e.create.pageLoad=function(){this.canLoad=true;this.on("scrollThreshold",this.onScrollThresholdLoad);this.on("load",this.checkLastPage);if(this.options.outlayer){this.on("append",this.onAppendOutlayer)}};i.onScrollThresholdLoad=function(){if(this.options.loadOnScroll)this.loadNextPage()};let r=new DOMParser;i.loadNextPage=function(){if(this.isLoading||!this.canLoad)return;let{responseBody:t,domParseResponse:n,fetchOptions:e}=this.options;let i=this.getAbsolutePath();this.isLoading=true;if(typeof e=="function")e=e();let a=fetch(i,e).then((e=>{if(!e.ok){let t=new Error(e.statusText);this.onPageError(t,i,e);return{response:e}}return e[t]().then((a=>{let o=t=="text"&&n;if(o){a=r.parseFromString(a,"text/html")}if(e.status==204){this.lastPageReached(a,i);return{body:a,response:e}}else{return this.onPageLoad(a,i,e)}}))})).catch((t=>{this.onPageError(t,i)}));this.dispatchEvent("request",null,[i,a]);return a};i.onPageLoad=function(t,n,e){if(!this.options.append){this.isLoading=false}this.pageIndex++;this.loadCount++;this.dispatchEvent("load",null,[t,n,e]);return this.appendNextPage(t,n,e)};i.appendNextPage=function(t,n,e){let{append:i,responseBody:r,domParseResponse:o}=this.options;let s=r=="text"&&o;if(!s||!i)return{body:t,response:e};let u=t.querySelectorAll(i);let l={body:t,response:e,items:u};if(!u||!u.length){this.lastPageReached(t,n);return l}let c=a(u);let f=()=>{this.appendItems(u,c);this.isLoading=false;this.dispatchEvent("append",null,[t,n,u,e]);return l};if(this.options.outlayer){return this.appendOutlayerItems(c,f)}else{return f()}};i.appendItems=function(t,n){if(!t||!t.length)return;n=n||a(t);o(n);this.element.appendChild(n)};function a(t){let n=document.createDocumentFragment();if(t)n.append(...t);return n}function o(t){let n=t.querySelectorAll("script");for(let t of n){let n=document.createElement("script");let e=t.attributes;for(let t of e){n.setAttribute(t.name,t.value)}n.innerHTML=t.innerHTML;t.parentNode.replaceChild(n,t)}}i.appendOutlayerItems=function(t,i){let r=e.imagesLoaded||n.imagesLoaded;if(!r){console.error("[InfiniteScroll] imagesLoaded required for outlayer option");this.isLoading=false;return}return new Promise((function(n){r(t,(function(){let t=i();n(t)}))}))};i.onAppendOutlayer=function(t,n,e){this.options.outlayer.appended(e)};i.checkLastPage=function(t,n){let{checkLastPage:e,path:i}=this.options;if(!e)return;if(typeof i=="function"){let e=this.getPath();if(!e){this.lastPageReached(t,n);return}}let r;if(typeof e=="string"){r=e}else if(this.isPathSelector){r=i}if(!r||!t.querySelector)return;let a=t.querySelector(r);if(!a)this.lastPageReached(t,n)};i.lastPageReached=function(t,n){this.canLoad=false;this.dispatchEvent("last",null,[t,n])};i.onPageError=function(t,n,e){this.isLoading=false;this.canLoad=false;this.dispatchEvent("error",null,[t,n,e]);return t};e.create.prefill=function(){if(!this.options.prefill)return;let t=this.options.append;if(!t){console.error(`append option required for prefill. Set as :${t}`);return}this.updateMeasurements();this.updateScroller();this.isPrefilling=true;this.on("append",this.prefill);this.once("error",this.stopPrefill);this.once("last",this.stopPrefill);this.prefill()};i.prefill=function(){let t=this.getPrefillDistance();this.isPrefilling=t>=0;if(this.isPrefilling){this.log("prefill");this.loadNextPage()}else{this.stopPrefill()}};i.getPrefillDistance=function(){if(this.options.elementScroll){return this.scroller.clientHeight-this.scroller.scrollHeight}return this.windowHeight-this.element.clientHeight};i.stopPrefill=function(){this.log("stopPrefill");this.off("append",this.prefill)};return e}))}));var o=t((function(t){(function(n,e){if(t.exports){t.exports=e(n,r,i)}else{e(n,n.InfiniteScroll,n.fizzyUIUtils)}})(window,(function t(n,e,i){let r=e.prototype;Object.assign(e.defaults,{scrollThreshold:400});e.create.scrollWatch=function(){this.pageScrollHandler=this.onPageScroll.bind(this);this.resizeHandler=this.onResize.bind(this);let t=this.options.scrollThreshold;let n=t||t===0;if(n)this.enableScrollWatch()};e.destroy.scrollWatch=function(){this.disableScrollWatch()};r.enableScrollWatch=function(){if(this.isScrollWatching)return;this.isScrollWatching=true;this.updateMeasurements();this.updateScroller();this.on("last",this.disableScrollWatch);this.bindScrollWatchEvents(true)};r.disableScrollWatch=function(){if(!this.isScrollWatching)return;this.bindScrollWatchEvents(false);delete this.isScrollWatching};r.bindScrollWatchEvents=function(t){let e=t?"addEventListener":"removeEventListener";this.scroller[e]("scroll",this.pageScrollHandler);n[e]("resize",this.resizeHandler)};r.onPageScroll=e.throttle((function(){let t=this.getBottomDistance();if(t<=this.options.scrollThreshold){this.dispatchEvent("scrollThreshold")}}));r.getBottomDistance=function(){let t,e;if(this.options.elementScroll){t=this.scroller.scrollHeight;e=this.scroller.scrollTop+this.scroller.clientHeight}else{t=this.top+this.element.clientHeight;e=n.scrollY+this.windowHeight}return t-e};r.onResize=function(){this.updateMeasurements()};i.debounceMethod(e,"onResize",150);return e}))}));var s=t((function(t){(function(n,e){if(t.exports){t.exports=e(n,r,i)}else{e(n,n.InfiniteScroll,n.fizzyUIUtils)}})(window,(function t(n,e,i){let r=e.prototype;Object.assign(e.defaults,{history:"replace"});let a=document.createElement("a");e.create.history=function(){if(!this.options.history)return;a.href=this.getAbsolutePath();let t=a.origin||a.protocol+"//"+a.host;let n=t==location.origin;if(!n){console.error("[InfiniteScroll] cannot set history with different origin: "+`${a.origin} on ${location.origin} . History behavior disabled.`);return}if(this.options.append){this.createHistoryAppend()}else{this.createHistoryPageLoad()}};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(true)};r.bindHistoryAppendEvents=function(t){let e=t?"addEventListener":"removeEventListener";this.scroller[e]("scroll",this.scrollHistoryHandler);n[e]("unload",this.unloadHandler)};r.createHistoryPageLoad=function(){this.on("load",this.onPageLoadHistory)};e.destroy.history=r.destroyHistory=function(){let t=this.options.history&&this.options.append;if(t){this.bindHistoryAppendEvents(false)}};r.onAppendHistory=function(t,n,e){if(!e||!e.length)return;let i=e[0];let r=this.getElementScrollY(i);a.href=n;this.scrollPages.push({top:r,path:a.href,title:t.title})};r.getElementScrollY=function(t){if(this.options.elementScroll){return t.offsetTop-this.top}else{let e=t.getBoundingClientRect();return e.top+n.scrollY}};r.onScrollHistory=function(){let t=this.getClosestScrollPage();if(t!=this.scrollPage){this.scrollPage=t;this.setHistory(t.title,t.path)}};i.debounceMethod(e,"onScrollHistory",150);r.getClosestScrollPage=function(){let t;if(this.options.elementScroll){t=this.scroller.scrollTop+this.scroller.clientHeight/2}else{t=n.scrollY+this.windowHeight/2}let e;for(let n of this.scrollPages){if(n.top>=t)break;e=n}return e};r.setHistory=function(t,n){let e=this.options.history;let i=e&&history[e+"State"];if(!i)return;history[e+"State"](null,t,n);if(this.options.historyTitle)document.title=t;this.dispatchEvent("history",null,[t,n])};r.onUnload=function(){if(this.scrollPage.top===0)return;let t=n.scrollY-this.scrollPage.top+this.top;this.destroyHistory();scrollTo(0,t)};r.onPageLoadHistory=function(t,n){this.setHistory(t.title,n)};return e}))}));var u=t((function(t){(function(n,e){if(t.exports){t.exports=e(n,r,i)}else{e(n,n.InfiniteScroll,n.fizzyUIUtils)}})(window,(function t(n,e,i){class r{constructor(t,n){this.element=t;this.infScroll=n;this.clickHandler=this.onClick.bind(this);this.element.addEventListener("click",this.clickHandler);n.on("request",this.disable.bind(this));n.on("load",this.enable.bind(this));n.on("error",this.hide.bind(this));n.on("last",this.hide.bind(this))}onClick(t){t.preventDefault();this.infScroll.loadNextPage()}enable(){this.element.removeAttribute("disabled")}disable(){this.element.disabled="disabled"}hide(){this.element.style.display="none"}destroy(){this.element.removeEventListener("click",this.clickHandler)}}e.create.button=function(){let t=i.getQueryElement(this.options.button);if(t){this.button=new r(t,this)}};e.destroy.button=function(){if(this.button)this.button.destroy()};e.Button=r;return e}))}));var l=t((function(t){(function(n,e){if(t.exports){t.exports=e(n,r,i)}else{e(n,n.InfiniteScroll,n.fizzyUIUtils)}})(window,(function t(n,e,i){let r=e.prototype;e.create.status=function(){let t=i.getQueryElement(this.options.status);if(!t)return;this.statusElement=t;this.statusEventElements={request:t.querySelector(".infinite-scroll-request"),error:t.querySelector(".infinite-scroll-error"),last:t.querySelector(".infinite-scroll-last")};this.on("request",this.showRequestStatus);this.on("error",this.showErrorStatus);this.on("last",this.showLastStatus);this.bindHideStatus("on")};r.bindHideStatus=function(t){let n=this.options.append?"append":"load";this[t](n,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(t){o(this.statusElement);this.hideStatusEventElements();let n=this.statusEventElements[t];o(n)};r.hideAllStatus=function(){a(this.statusElement);this.hideStatusEventElements()};r.hideStatusEventElements=function(){for(let t in this.statusEventElements){let n=this.statusEventElements[t];a(n)}};function a(t){s(t,"none")}function o(t){s(t,"block")}function s(t,n){if(t){t.style.display=n}}return e}))}));var c=t((function(t){
|
|
5
|
-
/*!
|
|
6
|
-
* Infinite Scroll v4.0.1
|
|
7
|
-
* Automatically add next page
|
|
8
|
-
*
|
|
9
|
-
* Licensed GPLv3 for open source use
|
|
10
|
-
* or Infinite Scroll Commercial License for commercial use
|
|
11
|
-
*
|
|
12
|
-
* https://infinite-scroll.com
|
|
13
|
-
* Copyright 2018-2020 Metafizzy
|
|
14
|
-
*/
|
|
15
|
-
(function(n,e){if(t.exports){t.exports=e(r,a,o,s,u,l)}})(window,(function t(n){return n}))}));var f=t((function(t,e){
|
|
16
|
-
/*!
|
|
17
|
-
* Lang.js for Laravel localization in JavaScript.
|
|
18
|
-
*
|
|
19
|
-
* @version 1.1.12
|
|
20
|
-
* @license MIT https://github.com/rmariuzzo/Lang.js/blob/master/LICENSE
|
|
21
|
-
* @site https://github.com/rmariuzzo/Lang.js
|
|
22
|
-
* @author Rubens Mariuzzo <rubens@mariuzzo.com>
|
|
23
|
-
*/
|
|
24
|
-
(function(n,e){{t.exports=e()}})(n,(function(){function t(){if(typeof document!=="undefined"&&document.documentElement){return document.documentElement.lang}}function n(t){if(t==="-Inf"){return-Infinity}else if(t==="+Inf"||t==="Inf"||t==="*"){return Infinity}return parseInt(t,10)}var e=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/;var i=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/;var r={locale:"en"};var a=function(n){n=n||{};this.locale=n.locale||t()||r.locale;this.fallback=n.fallback;this.messages=n.messages};a.prototype.setMessages=function(t){this.messages=t};a.prototype.getLocale=function(){return this.locale||this.fallback};a.prototype.setLocale=function(t){this.locale=t};a.prototype.getFallback=function(){return this.fallback};a.prototype.setFallback=function(t){this.fallback=t};a.prototype.has=function(t,n){if(typeof t!=="string"||!this.messages){return false}return this._getMessage(t,n)!==null};a.prototype.get=function(t,n,e){if(!this.has(t,e)){return t}var i=this._getMessage(t,e);if(i===null){return t}if(n){i=this._applyReplacements(i,n)}return i};a.prototype.trans=function(t,n){return this.get(t,n)};a.prototype.choice=function(t,n,e,r){e=typeof e!=="undefined"?e:{};e.count=n;var a=this.get(t,e,r);if(a===null||a===undefined){return a}var o=a.split("|");var s=[];for(var u=0;u<o.length;u++){o[u]=o[u].trim();if(i.test(o[u])){var l=o[u].split(/\s/);s.push(l.shift());o[u]=l.join(" ")}}if(o.length===1){return a}for(var c=0;c<s.length;c++){if(this._testInterval(n,s[c])){return o[c]}}r=r||this._getLocale(t);var f=this._getPluralForm(n,r);return o[f]};a.prototype.transChoice=function(t,n,e){return this.choice(t,n,e)};a.prototype._parseKey=function(t,n){if(typeof t!=="string"||typeof n!=="string"){return null}var e=t.split(".");var i=e[0].replace(/\//g,".");return{source:n+"."+i,sourceFallback:this.getFallback()+"."+i,entries:e.slice(1)}};a.prototype._getMessage=function(t,n){n=n||this.getLocale();t=this._parseKey(t,n);if(this.messages[t.source]===undefined&&this.messages[t.sourceFallback]===undefined){return null}var e=this.messages[t.source];var i=t.entries.slice();var r=i.join(".");e=e!==undefined?this._getValueInKey(e,r):undefined;if(typeof e!=="string"&&this.messages[t.sourceFallback]){e=this.messages[t.sourceFallback];i=t.entries.slice();r="";while(i.length&&e!==undefined){var r=!r?i.shift():r.concat(".",i.shift());if(e[r]){e=e[r];r=""}}}if(typeof e!=="string"){return null}return e};a.prototype._getValueInKey=function(t,n){if(typeof t[n]==="string"){return t[n]}n=n.replace(/\[(\w+)\]/g,".$1");n=n.replace(/^\./,"");var e=n.split(".");for(var i=0,r=e.length;i<r;++i){var a=e.slice(0,i+1).join(".");var o=e.slice(i+1,e.length).join(".");if(t[a]){return this._getValueInKey(t[a],o)}}return t};a.prototype._getLocale=function(t){t=this._parseKey(t,this.locale);if(this.messages[t.source]){return this.locale}if(this.messages[t.sourceFallback]){return this.fallback}return null};a.prototype._findMessageInTree=function(t,n){while(t.length&&n!==undefined){var e=t.join(".");if(n[e]){n=n[e];break}n=n[t.shift()]}return n};a.prototype._sortReplacementKeys=function(t,n){return n.length-t.length};a.prototype._applyReplacements=function(t,n){var e=Object.keys(n).sort(this._sortReplacementKeys);e.forEach((function(e){t=t.replace(new RegExp(":"+e,"gi"),(function(t){var i=n[e];var r=t===t.toUpperCase();if(r){return i.toUpperCase()}var a=t===t.replace(/\w/i,(function(t){return t.toUpperCase()}));if(a){return i.charAt(0).toUpperCase()+i.slice(1)}return i}))}));return t};a.prototype._testInterval=function(t,i){if(typeof i!=="string"){throw"Invalid interval: should be a string."}i=i.trim();var r=i.match(e);if(!r){throw"Invalid interval: "+i}if(r[2]){var a=r[2].split(",");for(var o=0;o<a.length;o++){if(parseInt(a[o],10)===t){return true}}}else{r=r.filter((function(t){return!!t}));var s=r[1];var u=n(r[2]);if(u===Infinity){u=-Infinity}var l=n(r[3]);var c=r[4];return(s==="["?t>=u:t>u)&&(c==="]"?t<=l:t<l)}return false};a.prototype._getPluralForm=function(t,n){switch(n){case"az":case"bo":case"dz":case"id":case"ja":case"jv":case"ka":case"km":case"kn":case"ko":case"ms":case"th":case"tr":case"vi":case"zh":return 0;case"af":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"ur":case"zu":return t==1?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"hy":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return t===0||t===1?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2;case"cs":case"sk":return t==1?0:t>=2&&t<=4?1:2;case"ga":return t==1?0:t==2?1:2;case"lt":return t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2;case"sl":return t%100==1?0:t%100==2?1:t%100==3||t%100==4?2:3;case"mk":return t%10==1?0:1;case"mt":return t==1?0:t===0||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3;case"lv":return t===0?0:t%10==1&&t%100!=11?1:2;case"pl":return t==1?0:t%10>=2&&t%10<=4&&(t%100<12||t%100>14)?1:2;case"cy":return t==1?0:t==2?1:t==8||t==11?2:3;case"ro":return t==1?0:t===0||t%100>0&&t%100<20?1:2;case"ar":return t===0?0:t==1?1:t==2?2:t%100>=3&&t%100<=10?3:t%100>=11&&t%100<=99?4:5;default:return 0}};return a}))}));var d=function t(n,e){return function t(){var i=new Array(arguments.length);for(var r=0;r<i.length;r++){i[r]=arguments[r]}return n.apply(e,i)}};var h=Object.prototype.toString;var v=function(t){return function(n){var e=h.call(n);return t[e]||(t[e]=e.slice(8,-1).toLowerCase())}}(Object.create(null));function p(t){t=t.toLowerCase();return function n(e){return v(e)===t}}function g(t){return Array.isArray(t)}function m(t){return typeof t==="undefined"}function w(t){return t!==null&&!m(t)&&t.constructor!==null&&!m(t.constructor)&&typeof t.constructor.isBuffer==="function"&&t.constructor.isBuffer(t)}var y=p("ArrayBuffer");function b(t){var n;if(typeof ArrayBuffer!=="undefined"&&ArrayBuffer.isView){n=ArrayBuffer.isView(t)}else{n=t&&t.buffer&&y(t.buffer)}return n}function S(t){return typeof t==="string"}function _(t){return typeof t==="number"}function F(t){return t!==null&&typeof t==="object"}function k(t){if(v(t)!=="object"){return false}var n=Object.getPrototypeOf(t);return n===null||n===Object.prototype}var O=p("Date");var E=p("File");var I=p("Blob");var j=p("FileList");function A(t){return h.call(t)==="[object Function]"}function x(t){return F(t)&&A(t.pipe)}function T(t){var n="[object FormData]";return t&&(typeof FormData==="function"&&t instanceof FormData||h.call(t)===n||A(t.toString)&&t.toString()===n)}var R=p("URLSearchParams");function C(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function D(){if(typeof navigator!=="undefined"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")){return false}return typeof window!=="undefined"&&typeof document!=="undefined"}function N(t,n){if(t===null||typeof t==="undefined"){return}if(typeof t!=="object"){t=[t]}if(g(t)){for(var e=0,i=t.length;e<i;e++){n.call(null,t[e],e,t)}}else{for(var r in t){if(Object.prototype.hasOwnProperty.call(t,r)){n.call(null,t[r],r,t)}}}}function q(){var t={};function n(n,e){if(k(t[e])&&k(n)){t[e]=q(t[e],n)}else if(k(n)){t[e]=q({},n)}else if(g(n)){t[e]=n.slice()}else{t[e]=n}}for(var e=0,i=arguments.length;e<i;e++){N(arguments[e],n)}return t}function P(t,n,e){N(n,(function n(i,r){if(e&&typeof i==="function"){t[r]=d(i,e)}else{t[r]=i}}));return t}function L(t){if(t.charCodeAt(0)===65279){t=t.slice(1)}return t}function U(t,n,e,i){t.prototype=Object.create(n.prototype,i);t.prototype.constructor=t;e&&Object.assign(t.prototype,e)}function B(t,n,e){var i;var r;var a;var o={};n=n||{};do{i=Object.getOwnPropertyNames(t);r=i.length;while(r-- >0){a=i[r];if(!o[a]){n[a]=t[a];o[a]=true}}t=Object.getPrototypeOf(t)}while(t&&(!e||e(t,n))&&t!==Object.prototype);return n}function z(t,n,e){t=String(t);if(e===undefined||e>t.length){e=t.length}e-=n.length;var i=t.indexOf(n,e);return i!==-1&&i===e}function $(t){if(!t)return null;var n=t.length;if(m(n))return null;var e=new Array(n);while(n-- >0){e[n]=t[n]}return e}var M=function(t){return function(n){return t&&n instanceof t}}(typeof Uint8Array!=="undefined"&&Object.getPrototypeOf(Uint8Array));var J={isArray:g,isArrayBuffer:y,isBuffer:w,isFormData:T,isArrayBufferView:b,isString:S,isNumber:_,isObject:F,isPlainObject:k,isUndefined:m,isDate:O,isFile:E,isBlob:I,isFunction:A,isStream:x,isURLSearchParams:R,isStandardBrowserEnv:D,forEach:N,merge:q,extend:P,trim:C,stripBOM:L,inherits:U,toFlatObject:B,kindOf:v,kindOfTest:p,endsWith:z,toArray:$,isTypedArray:M,isFileList:j};function H(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var G=function t(n,e,i){if(!e){return n}var r;if(i){r=i(e)}else if(J.isURLSearchParams(e)){r=e.toString()}else{var a=[];J.forEach(e,(function t(n,e){if(n===null||typeof n==="undefined"){return}if(J.isArray(n)){e=e+"[]"}else{n=[n]}J.forEach(n,(function t(n){if(J.isDate(n)){n=n.toISOString()}else if(J.isObject(n)){n=JSON.stringify(n)}a.push(H(e)+"="+H(n))}))}));r=a.join("&")}if(r){var o=n.indexOf("#");if(o!==-1){n=n.slice(0,o)}n+=(n.indexOf("?")===-1?"?":"&")+r}return n};function Q(){this.handlers=[]}Q.prototype.use=function t(n,e,i){this.handlers.push({fulfilled:n,rejected:e,synchronous:i?i.synchronous:false,runWhen:i?i.runWhen:null});return this.handlers.length-1};Q.prototype.eject=function t(n){if(this.handlers[n]){this.handlers[n]=null}};Q.prototype.forEach=function t(n){J.forEach(this.handlers,(function t(e){if(e!==null){n(e)}}))};var V=Q;var X=function t(n,e){J.forEach(n,(function t(i,r){if(r!==e&&r.toUpperCase()===e.toUpperCase()){n[e]=i;delete n[r]}}))};function W(t,n,e,i,r){Error.call(this);this.message=t;this.name="AxiosError";n&&(this.code=n);e&&(this.config=e);i&&(this.request=i);r&&(this.response=r)}J.inherits(W,Error,{toJSON:function t(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var K=W.prototype;var Z={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(t){Z[t]={value:t}}));Object.defineProperties(W,Z);Object.defineProperty(K,"isAxiosError",{value:true});W.from=function(t,n,e,i,r,a){var o=Object.create(K);J.toFlatObject(t,o,(function t(n){return n!==Error.prototype}));W.call(o,t.message,n,e,i,r);o.name=t.name;a&&Object.assign(o,a);return o};var Y=W;var tt={silentJSONParsing:true,forcedJSONParsing:true,clarifyTimeoutError:false};function nt(t,n){n=n||new FormData;var e=[];function i(t){if(t===null)return"";if(J.isDate(t)){return t.toISOString()}if(J.isArrayBuffer(t)||J.isTypedArray(t)){return typeof Blob==="function"?new Blob([t]):Buffer.from(t)}return t}function r(t,a){if(J.isPlainObject(t)||J.isArray(t)){if(e.indexOf(t)!==-1){throw Error("Circular reference detected in "+a)}e.push(t);J.forEach(t,(function t(e,o){if(J.isUndefined(e))return;var s=a?a+"."+o:o;var u;if(e&&!a&&typeof e==="object"){if(J.endsWith(o,"{}")){e=JSON.stringify(e)}else if(J.endsWith(o,"[]")&&(u=J.toArray(e))){u.forEach((function(t){!J.isUndefined(t)&&n.append(s,i(t))}));return}}r(e,s)}));e.pop()}else{n.append(a,i(t))}}r(t);return n}var et=nt;var it=function t(n,e,i){var r=i.config.validateStatus;if(!i.status||!r||r(i.status)){n(i)}else{e(new Y("Request failed with status code "+i.status,[Y.ERR_BAD_REQUEST,Y.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i))}};var rt=J.isStandardBrowserEnv()?function t(){return{write:function t(n,e,i,r,a,o){var s=[];s.push(n+"="+encodeURIComponent(e));if(J.isNumber(i)){s.push("expires="+new Date(i).toGMTString())}if(J.isString(r)){s.push("path="+r)}if(J.isString(a)){s.push("domain="+a)}if(o===true){s.push("secure")}document.cookie=s.join("; ")},read:function t(n){var e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function t(n){this.write(n,"",Date.now()-864e5)}}}():function t(){return{write:function t(){},read:function t(){return null},remove:function t(){}}}();var at=function t(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)};var ot=function t(n,e){return e?n.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):n};var st=function t(n,e){if(n&&!at(e)){return ot(n,e)}return e};var ut=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];var lt=function t(n){var e={};var i;var r;var a;if(!n){return e}J.forEach(n.split("\n"),(function t(n){a=n.indexOf(":");i=J.trim(n.substr(0,a)).toLowerCase();r=J.trim(n.substr(a+1));if(i){if(e[i]&&ut.indexOf(i)>=0){return}if(i==="set-cookie"){e[i]=(e[i]?e[i]:[]).concat([r])}else{e[i]=e[i]?e[i]+", "+r:r}}}));return e};var ct=J.isStandardBrowserEnv()?function t(){var n=/(msie|trident)/i.test(navigator.userAgent);var e=document.createElement("a");var i;function r(t){var i=t;if(n){e.setAttribute("href",i);i=e.href}e.setAttribute("href",i);return{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}i=r(window.location.href);return function t(n){var e=J.isString(n)?r(n):n;return e.protocol===i.protocol&&e.host===i.host}}():function t(){return function t(){return true}}();function ft(t){Y.call(this,t==null?"canceled":t,Y.ERR_CANCELED);this.name="CanceledError"}J.inherits(ft,Y,{__CANCEL__:true});var dt=ft;var ht=function t(n){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""};var vt=function t(n){return new Promise((function t(e,i){var r=n.data;var a=n.headers;var o=n.responseType;var s;function u(){if(n.cancelToken){n.cancelToken.unsubscribe(s)}if(n.signal){n.signal.removeEventListener("abort",s)}}if(J.isFormData(r)&&J.isStandardBrowserEnv()){delete a["Content-Type"]}var l=new XMLHttpRequest;if(n.auth){var c=n.auth.username||"";var f=n.auth.password?unescape(encodeURIComponent(n.auth.password)):"";a.Authorization="Basic "+btoa(c+":"+f)}var d=st(n.baseURL,n.url);l.open(n.method.toUpperCase(),G(d,n.params,n.paramsSerializer),true);l.timeout=n.timeout;function h(){if(!l){return}var t="getAllResponseHeaders"in l?lt(l.getAllResponseHeaders()):null;var r=!o||o==="text"||o==="json"?l.responseText:l.response;var a={data:r,status:l.status,statusText:l.statusText,headers:t,config:n,request:l};it((function t(n){e(n);u()}),(function t(n){i(n);u()}),a);l=null}if("onloadend"in l){l.onloadend=h}else{l.onreadystatechange=function t(){if(!l||l.readyState!==4){return}if(l.status===0&&!(l.responseURL&&l.responseURL.indexOf("file:")===0)){return}setTimeout(h)}}l.onabort=function t(){if(!l){return}i(new Y("Request aborted",Y.ECONNABORTED,n,l));l=null};l.onerror=function t(){i(new Y("Network Error",Y.ERR_NETWORK,n,l,l));l=null};l.ontimeout=function t(){var e=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";var r=n.transitional||tt;if(n.timeoutErrorMessage){e=n.timeoutErrorMessage}i(new Y(e,r.clarifyTimeoutError?Y.ETIMEDOUT:Y.ECONNABORTED,n,l));l=null};if(J.isStandardBrowserEnv()){var v=(n.withCredentials||ct(d))&&n.xsrfCookieName?rt.read(n.xsrfCookieName):undefined;if(v){a[n.xsrfHeaderName]=v}}if("setRequestHeader"in l){J.forEach(a,(function t(n,e){if(typeof r==="undefined"&&e.toLowerCase()==="content-type"){delete a[e]}else{l.setRequestHeader(e,n)}}))}if(!J.isUndefined(n.withCredentials)){l.withCredentials=!!n.withCredentials}if(o&&o!=="json"){l.responseType=n.responseType}if(typeof n.onDownloadProgress==="function"){l.addEventListener("progress",n.onDownloadProgress)}if(typeof n.onUploadProgress==="function"&&l.upload){l.upload.addEventListener("progress",n.onUploadProgress)}if(n.cancelToken||n.signal){s=function(t){if(!l){return}i(!t||t&&t.type?new dt:t);l.abort();l=null};n.cancelToken&&n.cancelToken.subscribe(s);if(n.signal){n.signal.aborted?s():n.signal.addEventListener("abort",s)}}if(!r){r=null}var p=ht(d);if(p&&["http","https","file"].indexOf(p)===-1){i(new Y("Unsupported protocol "+p+":",Y.ERR_BAD_REQUEST,n));return}l.send(r)}))};var pt=null;var gt={"Content-Type":"application/x-www-form-urlencoded"};function mt(t,n){if(!J.isUndefined(t)&&J.isUndefined(t["Content-Type"])){t["Content-Type"]=n}}function wt(){var t;if(typeof XMLHttpRequest!=="undefined"){t=vt}else if(typeof process!=="undefined"&&Object.prototype.toString.call(process)==="[object process]"){t=vt}return t}function yt(t,n,e){if(J.isString(t)){try{(n||JSON.parse)(t);return J.trim(t)}catch(t){if(t.name!=="SyntaxError"){throw t}}}return(e||JSON.stringify)(t)}var bt={transitional:tt,adapter:wt(),transformRequest:[function t(n,e){X(e,"Accept");X(e,"Content-Type");if(J.isFormData(n)||J.isArrayBuffer(n)||J.isBuffer(n)||J.isStream(n)||J.isFile(n)||J.isBlob(n)){return n}if(J.isArrayBufferView(n)){return n.buffer}if(J.isURLSearchParams(n)){mt(e,"application/x-www-form-urlencoded;charset=utf-8");return n.toString()}var i=J.isObject(n);var r=e&&e["Content-Type"];var a;if((a=J.isFileList(n))||i&&r==="multipart/form-data"){var o=this.env&&this.env.FormData;return et(a?{"files[]":n}:n,o&&new o)}else if(i||r==="application/json"){mt(e,"application/json");return yt(n)}return n}],transformResponse:[function t(n){var e=this.transitional||bt.transitional;var i=e&&e.silentJSONParsing;var r=e&&e.forcedJSONParsing;var a=!i&&this.responseType==="json";if(a||r&&J.isString(n)&&n.length){try{return JSON.parse(n)}catch(t){if(a){if(t.name==="SyntaxError"){throw Y.from(t,Y.ERR_BAD_RESPONSE,this,null,this.response)}throw t}}}return n}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pt},validateStatus:function t(n){return n>=200&&n<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};J.forEach(["delete","get","head"],(function t(n){bt.headers[n]={}}));J.forEach(["post","put","patch"],(function t(n){bt.headers[n]=J.merge(gt)}));var St=bt;var _t=function t(n,e,i){var r=this||St;J.forEach(i,(function t(i){n=i.call(r,n,e)}));return n};var Ft=function t(n){return!!(n&&n.__CANCEL__)};function kt(t){if(t.cancelToken){t.cancelToken.throwIfRequested()}if(t.signal&&t.signal.aborted){throw new dt}}var Ot=function t(n){kt(n);n.headers=n.headers||{};n.data=_t.call(n,n.data,n.headers,n.transformRequest);n.headers=J.merge(n.headers.common||{},n.headers[n.method]||{},n.headers);J.forEach(["delete","get","head","post","put","patch","common"],(function t(e){delete n.headers[e]}));var e=n.adapter||St.adapter;return e(n).then((function t(e){kt(n);e.data=_t.call(n,e.data,e.headers,n.transformResponse);return e}),(function t(e){if(!Ft(e)){kt(n);if(e&&e.response){e.response.data=_t.call(n,e.response.data,e.response.headers,n.transformResponse)}}return Promise.reject(e)}))};var Et=function t(n,e){e=e||{};var i={};function r(t,n){if(J.isPlainObject(t)&&J.isPlainObject(n)){return J.merge(t,n)}else if(J.isPlainObject(n)){return J.merge({},n)}else if(J.isArray(n)){return n.slice()}return n}function a(t){if(!J.isUndefined(e[t])){return r(n[t],e[t])}else if(!J.isUndefined(n[t])){return r(undefined,n[t])}}function o(t){if(!J.isUndefined(e[t])){return r(undefined,e[t])}}function s(t){if(!J.isUndefined(e[t])){return r(undefined,e[t])}else if(!J.isUndefined(n[t])){return r(undefined,n[t])}}function u(t){if(t in e){return r(n[t],e[t])}else if(t in n){return r(undefined,n[t])}}var l={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:u};J.forEach(Object.keys(n).concat(Object.keys(e)),(function t(n){var e=l[n]||a;var r=e(n);J.isUndefined(r)&&e!==u||(i[n]=r)}));return i};var It={version:"0.27.2"};var jt=It.version;var At={};["object","boolean","number","function","string","symbol"].forEach((function(t,n){At[t]=function e(i){return typeof i===t||"a"+(n<1?"n ":" ")+t}}));var xt={};At.transitional=function t(n,e,i){function r(t,n){return"[Axios v"+jt+"] Transitional option '"+t+"'"+n+(i?". "+i:"")}return function(t,i,a){if(n===false){throw new Y(r(i," has been removed"+(e?" in "+e:"")),Y.ERR_DEPRECATED)}if(e&&!xt[i]){xt[i]=true;console.warn(r(i," has been deprecated since v"+e+" and will be removed in the near future"))}return n?n(t,i,a):true}};function Tt(t,n,e){if(typeof t!=="object"){throw new Y("options must be an object",Y.ERR_BAD_OPTION_VALUE)}var i=Object.keys(t);var r=i.length;while(r-- >0){var a=i[r];var o=n[a];if(o){var s=t[a];var u=s===undefined||o(s,a,t);if(u!==true){throw new Y("option "+a+" must be "+u,Y.ERR_BAD_OPTION_VALUE)}continue}if(e!==true){throw new Y("Unknown option "+a,Y.ERR_BAD_OPTION)}}}var Rt={assertOptions:Tt,validators:At};var Ct=Rt.validators;function Dt(t){this.defaults=t;this.interceptors={request:new V,response:new V}}Dt.prototype.request=function t(n,e){if(typeof n==="string"){e=e||{};e.url=n}else{e=n||{}}e=Et(this.defaults,e);if(e.method){e.method=e.method.toLowerCase()}else if(this.defaults.method){e.method=this.defaults.method.toLowerCase()}else{e.method="get"}var i=e.transitional;if(i!==undefined){Rt.assertOptions(i,{silentJSONParsing:Ct.transitional(Ct.boolean),forcedJSONParsing:Ct.transitional(Ct.boolean),clarifyTimeoutError:Ct.transitional(Ct.boolean)},false)}var r=[];var a=true;this.interceptors.request.forEach((function t(n){if(typeof n.runWhen==="function"&&n.runWhen(e)===false){return}a=a&&n.synchronous;r.unshift(n.fulfilled,n.rejected)}));var o=[];this.interceptors.response.forEach((function t(n){o.push(n.fulfilled,n.rejected)}));var s;if(!a){var u=[Ot,undefined];Array.prototype.unshift.apply(u,r);u=u.concat(o);s=Promise.resolve(e);while(u.length){s=s.then(u.shift(),u.shift())}return s}var l=e;while(r.length){var c=r.shift();var f=r.shift();try{l=c(l)}catch(t){f(t);break}}try{s=Ot(l)}catch(t){return Promise.reject(t)}while(o.length){s=s.then(o.shift(),o.shift())}return s};Dt.prototype.getUri=function t(n){n=Et(this.defaults,n);var e=st(n.baseURL,n.url);return G(e,n.params,n.paramsSerializer)};J.forEach(["delete","get","head","options"],(function t(n){Dt.prototype[n]=function(t,e){return this.request(Et(e||{},{method:n,url:t,data:(e||{}).data}))}}));J.forEach(["post","put","patch"],(function t(n){function e(t){return function e(i,r,a){return this.request(Et(a||{},{method:n,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:r}))}}Dt.prototype[n]=e();Dt.prototype[n+"Form"]=e(true)}));var Nt=Dt;function qt(t){if(typeof t!=="function"){throw new TypeError("executor must be a function.")}var n;this.promise=new Promise((function t(e){n=e}));var e=this;this.promise.then((function(t){if(!e._listeners)return;var n;var i=e._listeners.length;for(n=0;n<i;n++){e._listeners[n](t)}e._listeners=null}));this.promise.then=function(t){var n;var i=new Promise((function(t){e.subscribe(t);n=t})).then(t);i.cancel=function t(){e.unsubscribe(n)};return i};t((function t(i){if(e.reason){return}e.reason=new dt(i);n(e.reason)}))}qt.prototype.throwIfRequested=function t(){if(this.reason){throw this.reason}};qt.prototype.subscribe=function t(n){if(this.reason){n(this.reason);return}if(this._listeners){this._listeners.push(n)}else{this._listeners=[n]}};qt.prototype.unsubscribe=function t(n){if(!this._listeners){return}var e=this._listeners.indexOf(n);if(e!==-1){this._listeners.splice(e,1)}};qt.source=function t(){var n;var e=new qt((function t(e){n=e}));return{token:e,cancel:n}};var Pt=qt;var Lt=function t(n){return function t(e){return n.apply(null,e)}};var Ut=function t(n){return J.isObject(n)&&n.isAxiosError===true};function Bt(t){var n=new Nt(t);var e=d(Nt.prototype.request,n);J.extend(e,Nt.prototype,n);J.extend(e,n);e.create=function n(e){return Bt(Et(t,e))};return e}var zt=Bt(St);zt.Axios=Nt;zt.CanceledError=dt;zt.CancelToken=Pt;zt.isCancel=Ft;zt.VERSION=It.version;zt.toFormData=et;zt.AxiosError=Y;zt.Cancel=zt.CanceledError;zt.all=function t(n){return Promise.all(n)};zt.spread=Lt;zt.isAxiosError=Ut;var $t=zt;var Mt=zt;$t.default=Mt;var Jt=$t;function Ht(t){this.message=t}Ht.prototype=new Error,Ht.prototype.name="InvalidCharacterError";var Gt="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var n=String(t).replace(/=+$/,"");if(n.length%4==1)throw new Ht("'atob' failed: The string to be decoded is not correctly encoded.");for(var e,i,r=0,a=0,o="";i=n.charAt(a++);~i&&(e=r%4?64*e+i:i,r++%4)?o+=String.fromCharCode(255&e>>(-2*r&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return o};function Qt(t){var n=t.replace(/-/g,"+").replace(/_/g,"/");switch(n.length%4){case 0:break;case 2:n+="==";break;case 3:n+="=";break;default:throw"Illegal base64url string!"}try{return function(t){return decodeURIComponent(Gt(t).replace(/(.)/g,(function(t,n){var e=n.charCodeAt(0).toString(16).toUpperCase();return e.length<2&&(e="0"+e),"%"+e})))}(n)}catch(t){return Gt(n)}}function Vt(t){this.message=t}function Xt(t,n){if("string"!=typeof t)throw new Vt("Invalid token specified");var e=!0===(n=n||{}).header?0:1;try{return JSON.parse(Qt(t.split(".")[e]))}catch(t){throw new Vt("Invalid token specified: "+t.message)}}Vt.prototype=new Error,Vt.prototype.name="InvalidTokenError";var Wt=function(t,n,e){return alert(t)},Kt=function(t,n){return Wt(t,Zt.error,n)},Zt={error:"error",success:"success",info:"info"},Yt={fire:function(t,n,e){return Wt(t,n,e)},setNotifier:function(t){Wt=t,salla.event.emit("twilight::notifier.changed")},error:Kt,success:function(t,n){return Wt(t,Zt.success,n)},info:function(t,n){return Wt(t,Zt.info,n)},sallaInitiated:function(){var t=window.location.href.match(/([\?\&]danger=)[^&]+/g);t&&(window.history.replaceState(null,document.title,window.location.pathname),salla.event.once("twilight::notifier.changed",(function(){t.forEach((function(t){Kt(decodeURI(t.replace("?danger=","").replace("&danger=","")),{})}))})))},types:Zt},tn=function(t,n){return this.api=t,this.event=n,new Proxy(this,{get:function(e,i){return"event"===i?n:"api"===i?t:t&&t[i]||e[i]}})},nn=function(t,n){return nn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])},nn(t,n)};function en(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function e(){this.constructor=t}nn(t,n),t.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}var rn=function(){return rn=Object.assign||function(t){for(var n,e=1,i=arguments.length;e<i;e++)for(var r in n=arguments[e])Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return t},rn.apply(this,arguments)};function an(t,n,e,i){return new(e||(e=Promise))((function(r,a){function o(t){try{u(i.next(t))}catch(t){a(t)}}function s(t){try{u(i.throw(t))}catch(t){a(t)}}function u(t){var n;t.done?r(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(o,s)}u((i=i.apply(t,n||[])).next())}))}function on(t,n){var e,i,r,a,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(e)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(e=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(r=o.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){o.label=s[1];break}if(6===s[0]&&o.label<r[1]){o.label=r[1],r=s;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(s);break}r[2]&&o.ops.pop(),o.trys.pop();continue}s=n.call(t,o)}catch(t){s=[6,t],i=0}finally{e=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function sn(t,n,e){if(e||2===arguments.length)for(var i,r=0,a=n.length;r<a;r++)!i&&r in n||(i||(i=Array.prototype.slice.call(n,0,r)),i[r]=n[r]);return t.concat(i||Array.prototype.slice.call(n))}Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector),Element.prototype.closest||(Element.prototype.closest=function(t){for(var n=this;n;){if(n.matches(t))return n;n=n.parentElement}}),Element.prototype.getElementSallaData=function(t){for(var n,e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];if(this.getAttribute){if(this.hasAttribute("data-json"))try{return JSON.parse(this.getAttribute("data-json"))}catch(t){}var r=this.getAttribute("data-function");if(r&&window[r])return"function"==typeof window[r]?this.getFilteredData((n=window[r]).call.apply(n,sn([this],e,!1))):this.getFilteredData(window[r]);var a=this.hasAttribute("data-form-selector")?document.querySelector(this.dataset.formSelector):void 0;if((a="FORM"===this.tagName?this:a||this.closest("form")||this.closest("[salla-form-data]")||this)&&"FORM"===a.tagName)return this.getFilteredData(new FormData(a),null,a);var o=a.querySelectorAll("[name]");if(!o.length)return this.getFilteredData();var s=Object.assign({},this.dataset);return o.forEach((function(t){if(!["checkbox","radio"].includes(t.type)||t.checked)try{var n=Salla.helpers.inputData(t.name,t.value,s);s[n.name]=n.value}catch(n){Salla.log(t.name+" can't be send")}})),this.getFilteredData(s)}},Element.prototype.canEventFireHook=function(t){return!!this.hasAttribute&&this.hasAttribute(Salla.api.hooksPrefix+t.type)},Element.prototype.hasAttributeStartsWith=function(t,n){t=t.toLowerCase();for(var e=0;e<this.attributes.length;e++){var i=this.attributes[e].name.toLowerCase();if(0===i.indexOf(t))return!n||i}return!1},HTMLFormElement.prototype.getAjaxFormData=function(t){var n=this.querySelectorAll('input[type="file"]');n.forEach((function(t){t.files.length||t.setAttribute("disabled","")}));var e=new FormData(this);return n.forEach((function(t){t.files.length||t.removeAttribute("disabled")})),{formData:this.getFilteredData(e,t),url:this.getAttribute("action"),method:this.getAttribute("method")||"post",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}},Element.prototype.getFilteredData=function(t,n,e){var i=this;return void 0===t&&(t=null),void 0===n&&(n=null),void 0===e&&(e=null),t=t||(null==e?void 0:e.dataset)||this.dataset,e&&this.name&&void 0!==this.value&&(t=function(t,n,e){t instanceof FormData?t.append(n,e):t[n]=e;return t}(t,this.name,this.value)),["filterBeforeSubmit","filterBeforeSend"].forEach((function(r){var a=(null==e?void 0:e.dataset[r])||i.dataset[r];if(a){var o=window[a];if("function"==typeof o){if(!o(t,e||i,n)&&t)throw"Data failed to be pass verify function window.".concat(a,"(formData, element, event)!");return o(t,e||i,n)}Salla.log("window."+a+"() not found!")}})),t},HTMLAnchorElement.prototype.getAjaxFormData=function(t){return{formData:this.getFilteredData(null,t),url:this.getAttribute("href"),method:this.dataset.type||"get",events:{success:this.dataset.onSuccess,fail:this.dataset.onFail}}};var un=function(){function t(){this.events={},this.namespace="";var t=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(t&&t.length>1?t[1]:"").toLowerCase()}return t.prototype.after_init=function(){this.createDynamicFunctions()},t.prototype.createDynamicFunctions=function(){var t=this;Object.keys(this.events).forEach((function(n){t.createDynamicEventFuns(n),t.createDynamicListenerFuns(n)}))},t.prototype.createDynamicEventFuns=function(t){if(!this[t]){var n=this;this[t]=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return n.dispatch.apply(n,sn([t],e,!1))}}},t.prototype.createDynamicListenerFuns=function(t){var n="on"+t.charAt(0).toUpperCase()+t.slice(1);if(!this[n]){var e=this;this[n]=function(n){var i=this;return e.on(t,(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return an(i,void 0,void 0,(function(){return on(this,(function(e){return[2,n.apply(void 0,t)]}))}))}))}}},t.prototype.getEventName=function(t){return t=this.events[t]||t,!this.namespace||t.includes("::")?t:this.namespace+Salla.event.delimiter+t},t.prototype.dispatch=function(t){for(var n,e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return(n=Salla.event).emitAsync.apply(n,sn([this.getEventName(t)],e,!1))},t.prototype.on=function(t,n){return Salla.event.addListener(this.getEventName(t),n)},t.prototype.once=function(t,n){return Salla.event.once(this.getEventName(t),n)},t}(),ln=function(t){function n(){var n=t.call(this)||this;return n.namespace="auth",n.events={login:"login",logout:"logout",codeSent:"code.sent",codeNotSent:"code.not-sent",verified:"verified",verificationFailed:"verification.failed",loggedIn:"logged.in",registered:"registered",registrationFailed:"registration.failed",loggedOut:"logged.out",failedLogout:"failed.logout",refreshFailed:"refresh.failed",tokenFetched:"token.fetched"},n.after_init(),n}return en(n,t),n.prototype.login=function(t){return t?(t.type&&this.setTypeActionOnVerified(t.type),this.next_event=t.next_event||null,this.dispatch.apply(this,sn(["login"],arguments,!1))):(this.next_event=null,this.dispatch.apply(this,sn(["login"],arguments,!1)))},n.prototype.loggedIn=function(t){var n=this;return Salla.profile.info().finally((function(){return n.dispatch("loggedIn",t)}))},n.prototype.setTypeActionOnVerified=function(t){this.type_action_on_verified=t},n.prototype.getTypeActionOnVerified=function(){return this.type_action_on_verified||"redirect"},n}(un),cn=function(t){function n(){var n=t.call(this)||this;return n.namespace="cart",n.events={latestFetched:"latest.fetched",latestFailed:"latest.failed",updated:"updated",itemUpdated:"item.updated",itemUpdatedFailed:"item.updated.failed",itemAdded:"item.added",itemAddedFailed:"item.added.failed",itemDeleted:"item.deleted",itemDeletedFailed:"item.deleted.failed",submitted:"submitted",submitFailed:"submit.failed",imageDeleted:"image.deleted",imageNotDeleted:"image.not.deleted",detailsFetched:"details.fetched",detailsNotFetched:"details.not.fetched",successReset:"success.reset",priceQuoteSucceeded:"price-quote.succeeded",priceQuoteFailed:"price-quote.failed",couponAdded:"coupon.added",couponDeleted:"coupon.deleted",couponAdditionFailed:"coupon.addition.failed",couponDeletionFailed:"coupon.deletion.failed",quickOrderSettingFetched:"quick-order.fetched",quickOrderSettingFailed:"quick-order.failed",quickOrderSucceeded:"quick-order.succeeded",quickOrderFailed:"quick-order.failed"},n.after_init(),n}return en(n,t),n.prototype.updated=function(t){var n;return Salla.cookie.set("fresh_summary",1),t&&"object"==typeof t?(t.offer&&salla.product.event.offerExisted(t.offer),t.redirect&&(salla.log("The current cart is purchased!"),salla.cart.api.reset()),t.cart?(salla.storage.set("cart.summary",{total:t.cart.total,sub_total:t.cart.sub_total,discount:t.cart.discount,real_shipping_cost:t.cart.real_shipping_cost,count:t.cart.count,shipping_cost:(null===(n=t.cart.free_shipping_bar)||void 0===n?void 0:n.has_free_shipping)?0:t.cart.real_shipping_cost}),this.dispatch("updated",t.cart)):void salla.log("Failed to get the cart summary!")):(Salla.logger.info("Cart summary not an object!",t),this.dispatch("updated"))},n.prototype.latestFetched=function(t){return this.updated(t.data),this.dispatch("latestFetched",t)},n.prototype.itemAdded=function(t,n){return this.updated(t.data),this.dispatch("itemAdded",t,n)},n.prototype.itemDeleted=function(t,n){return this.updated(t.data),this.dispatch("itemDeleted",t,n)},n.prototype.itemUpdated=function(t,n){return this.updated(t.data),this.dispatch("itemUpdated",t,n)},n.prototype.couponAdded=function(t,n){return this.updated(t.data),this.dispatch("couponAdded",t,n)},n.prototype.couponDeleted=function(t,n){return this.updated(t.data),this.dispatch("couponDeleted",t,n)},n}(un),fn=function(t){function n(){var n=t.call(this)||this;return n.namespace="order",n.events={canceled:"canceled",notCanceled:"not.canceled",orderCreated:"order.created",orderCreationFailed:"order.creation.failed",invoiceSent:"invoice.sent",invoiceNotSent:"invoice.not.sent"},n.after_init(),n}return en(n,t),n}(un),dn=function(t){function n(){var n=t.call(this)||this;return n.namespace="scope",n.events={fetched:"fetched",notFetched:"not.fetched",productAvailabilityFetched:"product-availability.fetched",productAvailabilityNotFetched:"product-availability.not.fetched",changeSucceeded:"changed",changeFailed:"not.changed"},n.after_init(),n}return en(n,t),n}(un),hn=function(t){function n(){var n=t.call(this)||this;return n.namespace="rating",n.events={orderNotFetched:"order.not.fetched",orderFetched:"order.fetched",storeRated:"store.rated",storeFailed:"store.failed",productsRated:"products.rated",productsFailed:"products.failed",shippingRated:"shipping.rated",shippingFailed:"shipping.failed"},n.after_init(),n}return en(n,t),n}(un),vn=function(t){function n(){var n=t.call(this)||this;return n.namespace="comment",n.events={added:"added",additionFailed:"addition.failed",fetched:"fetched",fetchFailed:"fetch.failed"},n.after_init(),n}return en(n,t),n}(un),pn=function(t){function n(){var n=t.call(this)||this;return n.namespace="loyalty",n.events={exchangeSucceeded:"exchange.succeeded",exchangeFailed:"exchange.failed",programFetched:"program.fetched",programNotFetched:"program.not.fetched",resetSucceeded:"exchange-reset.succeeded",resetFailed:"exchange-reset.failed"},n.after_init(),n}return en(n,t),n.prototype.exchangeSucceeded=function(t,n){return salla.cart.event.updated(t.data),this.dispatch("exchangeSucceeded",t,n)},n.prototype.resetSucceeded=function(t){return salla.cart.event.updated(t.data),this.dispatch("resetSucceeded",t)},n}(un),gn=function(t){function n(){var n=t.call(this)||this;return n.namespace="profile",n.events={updated:"updated",updateFailed:"update.failed",verificationCodeSent:"verification.code.sent",updateContactsFailed:"update.contacts.failed",verified:"verified",unverified:"unverified",infoFetched:"info.fetched",infoNotFetched:"info.not.fetched",settingsUpdated:"settings.updated",updateSettingsFailed:"update.settings.failed",deleted:"deleted",notDeleted:"not.deleted"},n.after_init(),n}return en(n,t),n}(un),mn=function(t){function n(){var n=t.call(this)||this;return n.namespace="product",n.events={priceUpdated:"price.updated",priceUpdateFailed:"price.updated.failed",availabilitySubscribed:"availability.subscribed",availabilitySubscribeFailed:"availability.subscribe.failed",categoriesFetched:"categories.fetched",categoriesFailed:"categories.failed",searchFailed:"search.failed",searchResults:"search.results",offerExisted:"offer.existed",fetchOffersFailed:"fetch.offers.failed",offersFetched:"offers.fetched",sizeGuideFetched:"size-guide.fetched",sizeGuideFetchFailed:"size-guide.failed",giftFetched:"gift.fetched",giftFetchFailed:"gift.failed",detailFetched:"detail.fetched",detailFetchFailed:"detail.failed",addGiftToCartSucceeded:"gift.add-to-cart.succeeded",addGiftToCartFailed:"gift.add-to-cart.failed",giftImageUploadSucceeded:"gift.image-upload.succeeded",giftImageUploadFailed:"gift.image-upload.failed",productListFetchSucceeded:"fetch.succeeded",productListFetchFailed:"fetch.failed"},n.after_init(),n}return en(n,t),n}(un),wn=function(t){function n(){var n=t.call(this)||this;return n.namespace="document",n.events={click:"click",change:"change",submit:"submit",keyup:"keyup",leaving:"leaving",request:"request",requestFailed:"request.failed"},n.after_init(),n}return en(n,t),n.prototype.onClick=function(t,n){this.fireCallableFuns("click",t,n)},n.prototype.onChange=function(t,n){this.fireCallableFuns("change",t,n)},n.prototype.onSubmit=function(t,n){this.fireCallableFuns("submit",t,n)},n.prototype.onKeyup=function(t,n){this.fireCallableFuns("keyup",t,n)},n.prototype.fireCallableFuns=function(t,n,e){this.on(t,(function(t){"function"!=typeof n?"function"==typeof e&&t.target.matches(n)&&e(t):n(t)}))},n.prototype.fireEvent=function(t,n){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];return this.fireEventForElements.apply(this,sn([t,n,!1],e,!1))},n.prototype.fireEventForAll=function(t,n){for(var e=[],i=2;i<arguments.length;i++)e[i-2]=arguments[i];return this.fireEventForElements.apply(this,sn([t,n,!0],e,!1))},n.prototype.fireEventForElements=function(t,n,e){for(var i=this,r=[],a=3;a<arguments.length;a++)r[a-3]=arguments[a];if("string"==typeof t){if(e)return document.querySelectorAll(t).forEach((function(t){return i.fireEventForElements.apply(i,sn([t,n,!1],r,!1))}));t=document.querySelector(t)}if(t){var o=new(CustomEvent.bind.apply(CustomEvent,sn([void 0,n],r,!1)));return t.dispatchEvent(o)}salla.log("Failed To get element to fire event: "+n)},n}(un),yn=function(t){function n(){var n=t.call(this)||this;return n.namespace="wishlist",n.events={added:"added",removed:"removed",additionFailed:"addition.failed",removingFailed:"removing.failed"},n.after_init(),n}return en(n,t),n}(un),bn=function(t){function n(){var n=t.call(this)||this;return n.namespace="currency",n.events={changed:"changed",failed:"failed",fetched:"fetched",failedToFetch:"failed.to.fetch"},n.after_init(),n}return en(n,t),n}(un),Sn=function(t){function n(){var n=t.call(this)||this;return n.namespace="infiniteScroll",n.events={scrollThreshold:"scroll.threshold",request:"request",load:"load",append:"append",error:"error",last:"last",history:"history"},n.after_init(),n}return en(n,t),n}(un),_n=function(t){function n(){var n=t.call(this)||this;return n.namespace="booking",n.events={added:"added",additionFailed:"addition.failed"},n.after_init(),n}return en(n,t),n}(un),Fn=function(t){function n(){var n=t.call(this)||this;return n.namespace="landing",n.events={detailsFetched:"order.fetched",getDetailsFailed:"get.details.failed",orderCreated:"order.created",orderCreationFailed:"order.creation.failed"},n.after_init(),n}return en(n,t),n}(un);function kn(t){t&&t.sallaInitiated&&!t.initiated&&(t.sallaInitiated(),t.initiated=!0)}Salla.event.auth=new ln,Salla.event.cart=new cn,Salla.event.order=new fn,Salla.event.scope=new dn,Salla.event.rating=new hn,Salla.event.booking=new _n,Salla.event.comment=new vn,Salla.event.landing=new Fn,Salla.event.loyalty=new pn,Salla.event.product=new mn,Salla.event.profile=new gn,Salla.event.currency=new bn,Salla.event.document=new wn,Salla.event.wishlist=new yn,Salla.event.infiniteScroll=new Sn,Salla.event.on("twilight::initiated",(function(){Object.keys(Salla).forEach((function(t){"object"==typeof(t=Salla[t])&&(kn(t),Object.keys(t).forEach((function(n){kn(t[n])})))}))}));var On=void 0;Salla.config.default_properties={debug:"undefined"!=typeof process&&"development"==="production",token:null,fastRequests:!0,canLeave:!0,store:{api:"https://api.salla.dev/store/v1/"},currencies:{SAR:{code:"SAR",name:"ريال سعودي",symbol:"ر.س",amount:1,country_code:"sa"}}},Salla.config.merge(Salla.config.default_properties),Salla.config.triedToGetCurrencies_=!1,Salla.config.triedToGetLanguages_=!1,Salla.config.isUser=function(){return"user"===Salla.config.get("user.type")},Salla.config.isGuest=function(){return!Salla.config.isUser()},Salla.config.languages=function(){return __awaiter(On,void 0,void 0,(function(){var t,n,e,i;return __generator(this,(function(r){switch(r.label){case 0:return Salla.config.triedToGetLanguages_?[2,Salla.config.get("languages")]:(Salla.config.triedToGetLanguages_=!0,t=!0,n=[],[4,salla.document.api.request("languages",null,"get")]);case 1:return null===(i=null===(e=r.sent())||void 0===e?void 0:e.data)||void 0===i||i.map((function(e){t&&(n=[],t=!1),e.code=e.code||e.iso_code,e.url=salla.url.get(e.code),e.is_rtl=e.is_rtl||e.rtl,n.push(e)})),Salla.config.set("languages",n),[2,n]}}))}))},Salla.config.currencies=function(){return __awaiter(On,void 0,void 0,(function(){var t,n,e,i;return __generator(this,(function(r){switch(r.label){case 0:return Salla.config.triedToGetCurrencies_?[2,Salla.config.get("currencies")]:(Salla.config.triedToGetCurrencies_=!0,t=!0,n={},[4,salla.currency.api.list()]);case 1:return null===(i=null===(e=r.sent())||void 0===e?void 0:e.data)||void 0===i||i.map((function(e){t&&(n={},t=!1),e.country_code=e.code.substr(0,2).toLowerCase(),n[e.code]=e})),Salla.config.set("currencies",n),[2,n]}}))}))};var En=function(t){function n(n,e){var i=t.call(this,n,e)||this;return i.options={path:".infinite-scroll-btn",history:"push",status:".infinite-scroll-status",append:".list-block"},i.fetchOptions={headers:{"S-INFINITE-SCROLL":!0}},i.instances=[],i}return en(n,t),n.prototype.initiate=function(t,n,e,i){void 0===i&&(i=!1),i?((e=e||{}).fetchOptions=rn(rn({},this.fetchOptions),e.fetchOptions||{}),e.responseBody="json"):e=this.getCustomOptions(n,e);var r="string"!=typeof t?t:document.querySelector(t),a=e.path;if(r&&a&&("string"!=typeof a||document.querySelector(a))){var o=new c(r,e);return o.on("scrollThreshold",Salla.infiniteScroll.event.scrollThreshold),o.on("request",Salla.infiniteScroll.event.request),o.on("load",Salla.infiniteScroll.event.load),o.on("append",Salla.infiniteScroll.event.append),o.on("error",Salla.infiniteScroll.event.error),o.on("last",Salla.infiniteScroll.event.last),o.on("history",Salla.infiniteScroll.event.history),this.instances.push(o),o}Salla.logger.warn(r?"Path Option (a link that has next page link) Not Existed!":"Container For InfiniteScroll not Existed!")},n.prototype.getCustomOptions=function(t,n){return(n="object"==typeof t&&t||n||this.options).fetchOptions=this.fetchOptions,n.path=n.path||this.options.path,n.button=n.button||n.path,n.status=n.status||this.options.status,n.hasOwnProperty("history")||(n.history=this.options.history),n.nextPage=n.nextPage||n.next_page,n.append="string"==typeof t&&t||n.append||this.options.append,n},n.prototype.loadNextPage=function(t){("string"!=typeof t?t:document.querySelector(t)).loadNextPage()},n.prototype.destroy=function(t){("string"!=typeof t?t:document.querySelector(t)).destroy()},n}(tn),In=function(){function t(){}return t.prototype.submit=function(t,n){var e,i,r,a;return void 0===n&&(n=null),an(this,void 0,void 0,(function(){var o,s,u;return on(this,(function(l){switch(l.label){case 0:if(o=n,"SubmitEvent"===(null===(e=null==n?void 0:n.constructor)||void 0===e?void 0:e.name)||"submit"===(null==n?void 0:n.type)){if(n.preventDefault(),"FORM"!==(null===(i=n.target)||void 0===i?void 0:i.tagName))return Salla.logger.warn("Failed find the target element for submit action. make sure you submit a form element"),[2,new Promise((function(){throw"Failed find the target element for submit action. make sure you submit a form element"}))];"SALLA-BUTTON"===(null===(a=null===(r=null==n?void 0:n.submitter)||void 0===r?void 0:r.parentElement)||void 0===a?void 0:a.tagName)&&n.submitter.parentElement.load(),o=n.target.getElementSallaData(),salla.log("Data from element",o)}return/^https?:\/\/(?:www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$/gm.test(t)?[2,salla.api.request(t,o,"post").finally((function(){var t;loaderSupported&&(null===(t=null==n?void 0:n.submitter)||void 0===t||t.parentElement.stop())}))]:(s=t.split("."),u=s.splice(-1),[4,salla.call(s.join("."))[u](o).finally((function(){var t,e;return null===(e=null===(t=null==n?void 0:n.submitter)||void 0===t?void 0:t.parentElement)||void 0===e?void 0:e.stop()})).catch((function(t){throw salla.logger.warn(t),t}))]);case 1:return[2,l.sent()]}}))}))},t.prototype.onSubmit=function(t,n){return salla.form.submit(t,n),!1},t.prototype.onChange=function(t,n){var e;return(null==n?void 0:n.currentTarget)?"FORM"!==(null===(e=null==n?void 0:n.currentTarget)||void 0===e?void 0:e.tagName)||n.currentTarget.checkValidity()?(salla.form.submit(t,n.currentTarget.getElementSallaData()),!0):(salla.logger.warn("Trying to trigger '".concat(t,"' without filling required fields!")),!1):(salla.logger.warn("Trying to trigger '".concat(t,"' without event!")),!1)},t.prototype.getPossibleValue=function(t,n,e){if(void 0===e&&(e=!1),t){if("object"!=typeof t)return t;for(var i,r=0;r<n.length&&!(i=t[n[r]])&&!("undefined"!=typeof FormData&&t instanceof FormData&&(i=t.get(n[r])));r++);return"object"!=typeof(i=i||t)||e?i:void 0}},t}(),jn=function(t){function n(n){var e=this;return(n=n||{}).messages=n.messages||window.translations,n.locale=n.locale||(window.locale||navigator.language||navigator.userLanguage||"ar").split("-")[0],n.fallback=n.fallback||n.locale,(e=t.call(this,n)||this).translationsLoaded=!1,e}return en(n,t),n.prototype.onLoaded=function(t){if(this.translationsLoaded)return t();Salla.event.once("languages::translations.loaded",t)},n.prototype.loadStoreTranslations=function(){if(this.hash=salla.config.get("theme.translations_hash",salla.config.get("store.id","twilight")),this.messages||(salla.log("try to load translations from localstorage"),this.messages=salla.storage.get("s_translations.".concat(this.hash)),this.messages&&(this.translationsLoaded=!0)&&t.prototype.setMessages.call(this,this.messages)),this.messages)return salla.event.dispatch("languages::translations.loaded"),void salla.logger.info("The messages of transactions is already loaded");salla.url.get("")?this.loadScript(salla.url.get("languages/assets/".concat(this.hash,".js"))):this.loadScript("https://cdn.salla.network/js/translations.js",!1)},n.prototype.setMessages=function(n){t.prototype.setMessages.call(this,n),salla.event.dispatch("languages::translations.loaded"),this.translationsLoaded=!0},n.prototype.loadScript=function(t,n){var e=this;void 0===n&&(n=!0);var i=document.createElement("script");i.src=t,i.onload=function(){var t;if(window.translations)return salla.storage.remove("s_translations"),salla.storage.set("s_translations",((t={})[e.hash]=window.translations,t)),e.setMessages(window.translations);i.onerror()},i.onerror=function(){if(n)return salla.logger.warn("Failed to load Translations for store, lets try load it from CDN"),e.loadScript("https://cdn.salla.network/js/translations.js",!1);salla.logger.error("Failed to load Translations, check your network logs for more details\nor: salla.lang.setMessages({....}), see https://docs.salla.dev for more information's.")},document.head.appendChild(i)},n.prototype.getWithDefault=function(t,n,e,i){var r=this.get(t,e,i);return r!==t?r:n},n.prototype.get=function(n,e,i){var r=n;(window.translations||this.translationsLoaded)&&(r="trans."+n);var a=t.prototype.get.call(this,r,e,i);return a!==r?a:t.prototype.get.call(this,r,e,"en").replace(r,n)},n.prototype.set=function(t,n){return salla.helpers.setNested(this.messages[this.getLocale()+".trans"],t,n),this},n}(f),An=function(){function t(){this.endpoints={},this.webEndpoints=[],this.namespace="BaseApi",this.endpointsMethods={},this.endpointsHeaders={};var t=/function (.{1,})\(/.exec(this.constructor.toString());this.className=(t&&t.length>1?t[1]:"").toLowerCase(),this.debounce={request:void 0,time:300,enabled:!0,exclude:[]}}return t.prototype.after_init=function(){},t.prototype.normalRequest=function(t,n,e){void 0===n&&(n=void 0),void 0===e&&(e=null);var i=Array.isArray(t),r=i?this.getUrl.apply(this,t):this.getUrl(t);t=i?t[0]:t,e=e||this.endpointsMethods[t]||"post";var a=this.endpointsHeaders[t];if("get"===e&&n instanceof FormData){var o={};Array.from(n.entries()).forEach((function(t){o[t[0]]=t[1]})),n={params:o}}return a&&"get"===e&&(n=n?Object.assign(n,a):a),this.webEndpoints.includes(t)?r=salla.url.get(r):"http"!==r.substring(0,4)&&(r=salla.url.api(r)),Salla.api.request(r,n,e,{headers:a})},t.prototype.request=function(t,n,e){return void 0===n&&(n=void 0),void 0===e&&(e=null),!salla.api.isFastRequestsAllowed()&&this.debounce.enabled?(this.debounce.request||(this.debounce.request=salla.helpers.debounce(this.normalRequest.bind(this),this.debounce.time)),this.debounce.request(t,n,e)):this.normalRequest(t,n,e)},t.prototype.getUrl=function(t){for(var n=this.endpoints[t]||t,e=/{[^{}]+}/i,i=1;i<arguments.length;i++)n=n.replace(e,arguments[i]);return n},t.prototype.event=function(){return salla.event[this.className]},t}(),xn=function(t){function n(){var n=t.call(this)||this;return n.namespace="cart",n.endpoints={latest:"cart/latest",details:"cart/{cart}",quickAdd:"cart/{cart}/item/{product}/quick-add",addItem:"cart/{cart}/item/{product}/add",deleteItem:"cart/{cart}/item/{item}",updateItem:"cart/{cart}/item/{item}",deleteImage:"cart/{cart}/image/{image}",uploadImage:"cart/{cart}/image",status:"cart/{cart}/status",addCoupon:"cart/{id}/coupon",deleteCoupon:"cart/{id}/coupon",getQuickOrderSettings:"checkout/quick-order",createQuickOrder:"checkout/quick-order",priceQuote:"cart/{cartId}/price-quote"},n.endpointsMethods={latest:"get",details:"get",status:"get",updateItem:"post",deleteItem:"delete",deleteImage:"delete",deleteCoupon:"put",getQuickOrderSettings:"get"},n.webEndpoints=["latest"],n.latestCart=null,n.after_init(),salla.event.on("api::initiated",(function(){return n.getCurrentCartId()})),n}return en(n,t),n.prototype.getCurrentCartId=function(){return an(this,void 0,void 0,(function(){var t,n;return on(this,(function(e){switch(e.label){case 0:return salla.cart.api.latestCart?[2,salla.cart.api.latestCart.cart.id]:(t=salla.storage.get("cart.id"))?[2,t]:[4,this.latest()];case 1:return n=e.sent(),salla.cart.api.latestCart=n.data,[2,salla.cart.api.latestCart.cart.id]}}))}))},n.prototype.getUploadImageEndpoint=function(t){return salla.url.api(this.getUrl("uploadImage",t||salla.storage.get("cart.id")))},n.prototype.latest=function(){return this.request("latest",{params:{source:""}}).then((function(t){return salla.storage.set("cart",t.data.cart),salla.event.cart.latestFetched(t),t})).catch((function(t){throw salla.storage.set("cart",""),salla.event.cart.latestFailed(t),t}))},n.prototype.details=function(t,n){return void 0===n&&(n=[]),an(this,void 0,void 0,(function(){var e;return on(this,(function(i){switch(i.label){case 0:return(e=t)?[3,2]:[4,this.getCurrentCartId()];case 1:e=i.sent(),i.label=2;case 2:return t=e,[2,this.request(["details",t],{params:{with:n}}).then((function(t){return salla.cart.event.detailsFetched(t),t})).catch((function(t){throw salla.cart.event.detailsNotFetched(t),t}))]}}))}))},n.prototype.quickAdd=function(t,n){return an(this,void 0,void 0,(function(){return on(this,(function(e){return[2,this.addItem({id:t,quantity:n,endpoint:"quickAdd"})]}))}))},n.prototype.addItem=function(t){return an(this,void 0,void 0,(function(){var n,e,i,r;return on(this,(function(a){switch(a.label){case 0:return(n=this.getCartPayload(t)).id?((i=salla.form.getPossibleValue(n.payload,["endpoint"]))&&["addItem","quickAdd"].includes(i)||(i=salla.form.getPossibleValue(n.payload,["quantity","donating_amount"])?"addItem":"quickAdd"),[4,this.getCurrentCartId()]):(e='There is no product "id"!',salla.cart.event.itemAddedFailed(e),[2,salla.api.errorPromise(e)]);case 1:return r=a.sent(),[2,this.request([i,r,n.id],n.payload).then((function(t){return salla.cart.event.itemAdded(t,n.id),t})).catch((function(t){throw salla.cart.event.itemAddedFailed(t,n.id),t}))]}}))}))},n.prototype.deleteItem=function(t){return an(this,void 0,void 0,(function(){var n,e,i;return on(this,(function(r){switch(r.label){case 0:return(n=this.getCartPayload(t)).id?[4,this.getCurrentCartId()]:(e='There is no "id"!',salla.cart.event.itemDeletedFailed(e),[2,salla.api.errorPromise(e)]);case 1:return i=r.sent(),[2,this.request(["deleteItem",i,n.id]).then((function(t){return salla.cart.event.itemDeleted(t,n.id),t})).catch((function(t){throw salla.cart.event.itemDeletedFailed(t,n.id),t}))]}}))}))},n.prototype.updateItem=function(t){var n;return an(this,void 0,void 0,(function(){var e,i,r;return on(this,(function(a){switch(a.label){case 0:return(e=this.getCartPayload(t)).id?[4,this.getCurrentCartId()]:(i='There is no "id"!',salla.cart.event.itemUpdatedFailed(i),[2,salla.api.errorPromise(i)]);case 1:return r=a.sent(),"Object"===(null===(n=e.payload.constructor)||void 0===n?void 0:n.name)?e.payload._method="PUT":e.payload.append("_method","PUT"),[2,this.request(["updateItem",r,e.id],e.payload).then((function(t){return salla.cart.event.itemUpdated(t,e.id),t})).catch((function(t){throw salla.cart.event.itemUpdatedFailed(t,e.id),t}))]}}))}))},n.prototype.deleteImage=function(t){return an(this,void 0,void 0,(function(){var n,e;return on(this,(function(i){switch(i.label){case 0:return(t=salla.form.getPossibleValue(t,["id","image_id","photo_id"]))?[4,this.getCurrentCartId()]:(n='There is no "id"!',salla.cart.event.imageNotDeleted(n),[2,salla.api.errorPromise(n)]);case 1:return e=i.sent(),[2,this.request(["deleteImage",e,t]).then((function(n){return salla.cart.event.imageDeleted(n,t),n})).catch((function(n){throw salla.cart.event.imageNotDeleted(n,t),n}))]}}))}))},n.prototype.status=function(t){return an(this,void 0,void 0,(function(){var n,e,i;return on(this,(function(r){switch(r.label){case 0:return n=this.request,e=["status"],(i=t)?[3,2]:[4,this.getCurrentCartId()];case 1:i=r.sent(),r.label=2;case 2:return[2,n.apply(this,[e.concat([i]),{params:{has_apple_pay:!!window.ApplePaySession}}])]}}))}))},n.prototype.submit=function(){return an(this,void 0,void 0,(function(){var t,n=this;return on(this,(function(e){switch(e.label){case 0:return t=this.status,[4,this.getCurrentCartId()];case 1:return t.apply(this,[e.sent()]).then((function(t){var e=t.data.next_step.to;if(!["checkout","refresh","login"].includes(e)){var i="Can't find next_step );";throw salla.cart.event.submitFailed(i),i}if(salla.cart.event.submitted(t),"login"===e)return salla.auth.setCanRedirect(!1),salla.event.dispatch("login::open"),void salla.auth.event.onLoggedIn((function(t){salla.event.dispatch("login::close"),n.submit()}));"checkout"===e?window.location.href=t.data.next_step.url+(window.ApplePaySession?"?has_apple_pay=true":""):window.location.reload()})).catch((function(t){throw salla.cart.event.submitFailed(t),t})),[2]}}))}))},n.prototype.getCartPayload=function(t){var n=(null==t?void 0:t.data)||("object"==typeof t?t:void 0);return{id:t=n?salla.form.getPossibleValue(n,["prod_id","product_id","item_id","id"]):t,payload:n="object"==typeof n?n:void 0}},n.prototype.normalRequest=function(n,e,i){return void 0===e&&(e=void 0),void 0===i&&(i=null),t.prototype.normalRequest.call(this,n,e,i).catch((function(t){var n;throw 403===(null===(n=null==t?void 0:t.response)||void 0===n?void 0:n.status)&&(salla.cart.api.reset(),salla.error(salla.lang.get("pages.checkout.try_again"))),t}))},n.prototype.reset=function(){salla.api.cart.latestCart=null,salla.storage.remove("cart"),salla.cart.event.successReset()},n.prototype.addCoupon=function(t){return an(this,void 0,void 0,(function(){var n,e;return on(this,(function(i){switch(i.label){case 0:return t=t.data||t,(t=salla.form.getPossibleValue(t,["coupon"]))?[4,salla.cart.api.getCurrentCartId()]:((n=new Error('There is no "Coupon Code"!')).name="EmptyCoupon",salla.event.cart.couponAdditionFailed(n),[2,salla.api.errorPromise(n)]);case 1:return e=i.sent(),[2,this.request(["addCoupon",e],{coupon:t}).then((function(t){return salla.event.cart.couponAdded(t,e),t})).catch((function(t){throw salla.event.cart.couponAdditionFailed(t,e),t}))]}}))}))},n.prototype.deleteCoupon=function(){return an(this,void 0,void 0,(function(){var t;return on(this,(function(n){switch(n.label){case 0:return[4,salla.cart.api.getCurrentCartId()];case 1:return t=n.sent(),[2,this.request(["deleteCoupon",t],{}).then((function(n){return salla.event.cart.couponDeleted(n,t),n})).catch((function(n){throw salla.event.cart.couponDeletionFailed(n,t),n}))]}}))}))},n.prototype.getQuickOrderSettings=function(){return this.request("getQuickOrderSettings").then((function(t){return salla.event.cart.quickOrderSettingFetched(t),t})).catch((function(t){throw salla.event.cart.quickOrderSettingFailed(t),t}))},n.prototype.createQuickOrder=function(t){return this.request("createQuickOrder",t).then((function(t){return salla.event.cart.quickOrderSucceeded(t),t})).catch((function(t){throw salla.event.cart.quickOrderFailed(t),t}))},n.prototype.priceQuote=function(t){return an(this,void 0,void 0,(function(){var n,e,i;return on(this,(function(r){switch(r.label){case 0:return salla.config.isGuest()?(salla.auth.api.setAfterLoginEvent("cart::priceQuote",t),salla.event.dispatch("login::open"),[2]):(n=this.request,e=["priceQuote"],(i=t)?[3,2]:[4,this.getCurrentCartId()]);case 1:i=r.sent(),r.label=2;case 2:return[2,n.apply(this,[e.concat([i])]).then((function(t){return salla.cart.api.reset(),salla.event.cart.priceQuoteSucceeded(t).then((function(){return setTimeout((function(){return window.location.href=salla.url.get("/")}),1e3),t}))})).catch((function(t){return salla.event.cart.priceQuoteFailed(t).then((function(){var n;throw 404===(null===(n=t.error)||void 0===n?void 0:n.code)&&window.location.reload(),t}))}))]}}))}))},n}(An),Tn=function(t){function n(){var n=t.call(this)||this;return n.namespace="loyalty",n.endpoints={getProgram:"loyalty",exchange:"loyalty/exchange",reset:"loyalty/exchange"},n.endpointsMethods={getProgram:"get",reset:"put"},n.after_init(),n}return en(n,t),n.prototype.getProgram=function(){return this.request("getProgram").then((function(t){return salla.loyalty.event.programFetched(t),t})).catch((function(t){throw salla.loyalty.event.programNotFetched(t),t}))},n.prototype.exchange=function(t,n){return void 0===n&&(n=null),an(this,void 0,void 0,(function(){var e,i;return on(this,(function(r){switch(r.label){case 0:return(t=salla.form.getPossibleValue(t,["id","loyalty_prize_id","prize_id"]))?(e=n)?[3,2]:[4,salla.cart.getCurrentCartId()]:(i="Unable to find cart id. Please provide one.",salla.loyalty.event.exchangeFailed(i),[2,salla.api.errorPromise(i)]);case 1:e=r.sent(),r.label=2;case 2:return(n=e)?[2,this.request("exchange",{loyalty_prize_id:t,cart_id:n}).then((function(n){return salla.loyalty.event.exchangeSucceeded(n,t),n})).catch((function(n){throw salla.loyalty.event.exchangeFailed(n,t),n}))]:(i="Unable to find cart id. Please provide one.",salla.loyalty.event.exchangeFailed(i),[2,salla.api.errorPromise(i)])}}))}))},n.prototype.reset=function(t){return void 0===t&&(t=null),an(this,void 0,void 0,(function(){var n,e;return on(this,(function(i){switch(i.label){case 0:return(n=t)?[3,2]:[4,salla.cart.getCurrentCartId()];case 1:n=i.sent(),i.label=2;case 2:return(t=n)?[2,this.request("reset",{cart_id:t}).then((function(t){return salla.loyalty.event.resetSucceeded(t),t})).catch((function(t){throw salla.loyalty.event.resetFailed(t),t}))]:(e="Unable to find cart id. Please provide one.",salla.loyalty.event.resetFailed(e),[2,salla.api.errorPromise(e)])}}))}))},n}(An),Rn=function(t){function n(){var n=t.call(this)||this;return n.namespace="auth",n.canRedirect_=!0,n.afterLoginEvent={event:null,payload:null},n.endpoints={login:"auth/{type}/send_verification",resend:"auth/resend_verification",verify:"auth/{type}/verify",register:"auth/register",logout:"logout",refresh:"auth/refresh"},n.webEndpoints=["logout","auth/jwt","refresh"],n.endpointsMethods={logout:"get"},n.after_init(),n}return en(n,t),n.prototype.setAfterLoginEvent=function(t,n){salla.api.auth.afterLoginEvent={event:t,payload:n}},n.prototype.setCanRedirect=function(t){salla.api.auth.canRedirect_=t},n.prototype.canRedirect=function(){return salla.api.auth.canRedirect_&&!salla.api.auth.afterLoginEvent.event},n.prototype.login=function(t){(null==t?void 0:t.data)&&(t=t.data);var n=salla.form.getPossibleValue(t,["type"]);if(!["email","mobile"].includes(n)){var e="Login type should be in: [email, mobile]";return salla.auth.event.codeNotSent(e),salla.api.errorPromise(e)}return this.request(["login",n],t).then((function(t){return salla.auth.event.codeSent(t,n),t})).catch((function(t){throw salla.auth.event.codeNotSent(t,n),t}))},n.prototype.verify=function(t,n){var e;return void 0===n&&(n=!0),an(this,void 0,void 0,(function(){var i,r,a,o;return on(this,(function(s){switch(s.label){case 0:return(i=salla.form.getPossibleValue(t,["type"]))?(n=!1!==salla.form.getPossibleValue(t,["supportWebAuth"])&&n,salla.auth.event.next_event&&(t.next_event=salla.auth.event.next_event),[4,salla.auth.api.request(["verify",i],t)]):(r="Failed to know what's login type!",salla.auth.event.verificationFailed(r),[2,salla.api.errorPromise(r)]);case 1:return 200!==(null==(a=s.sent())?void 0:a.status)?(salla.auth.event.verificationFailed(a,i),[2,salla.api.errorPromise(a)]):((o="authenticated"===(null===(e=a.data)||void 0===e?void 0:e.case))&&salla.auth.event.tokenFetched(a.data.token),n?[4,salla.auth.api.request("auth/jwt")]:[3,3]);case 2:s.sent(),s.label=3;case 3:return o&&salla.auth.event.loggedIn(a).then((function(){return salla.auth.api.afterUserLogin()})),salla.auth.event.verified(a,i),[2,salla.api.successPromise(a)]}}))}))},n.prototype.resend=function(t){var n;return(t=t.data||t).type=t.type||"mobile","mobile"!==t.type||t.phone&&t.country_code?"email"!==t.type||t.email?this.request("resend",t).then((function(n){return salla.auth.event.codeSent(n,t),n})).catch((function(n){throw salla.auth.event.codeNotSent(n,t),n})):(salla.auth.event.codeNotSent(n="There is no email!",t),salla.api.errorPromise(n)):(salla.auth.event.codeNotSent(n="There is no phone or country_code!",t),salla.api.errorPromise(n))},n.prototype.register=function(t){var n;return t.data&&(n=t.element,t=t.data),salla.auth.event.next_event&&(t.next_event=salla.auth.event.next_event),this.request("register",t).then((function(t){var e;return an(this,void 0,void 0,(function(){return on(this,(function(i){switch(i.label){case 0:return salla.auth.event.registered.call(n,t),"authenticated"!==(null===(e=t.data)||void 0===e?void 0:e.case)?[3,2]:(salla.auth.event.tokenFetched(t.data.token),[4,salla.auth.request("auth/jwt")]);case 1:i.sent(),salla.auth.event.loggedIn(t),salla.auth.api.afterUserLogin(),i.label=2;case 2:return[2,t]}}))}))})).catch((function(t){throw salla.auth.event.registrationFailed.call(n,t),t}))},n.prototype.logout=function(){return salla.storage.clearAll(),salla.cookie.clearAll(),salla.auth.event.loggedOut().then((function(){var t=salla.url.get("logout");console.log("Going to ".concat(t,", to do any thing before this action use: salla.auth.even.onLoggedOut(()=>{...})"));try{location.href=t}catch(t){salla.log(t)}}))},n.prototype.refresh=function(){return this.request("refresh").then((function(t){return salla.auth.event.tokenFetched(t.data.token),t})).catch((function(t){throw salla.auth.event.refreshFailed(t),t}))},n.prototype.afterUserLogin=function(){this.afterLoginEvent.event&&salla.event.emit(this.afterLoginEvent.event,this.afterLoginEvent.payload)},n}(An),Cn=function(t){function n(){var n=t.call(this)||this;return n.namespace="order",n.endpoints={cancel:"orders/cancel/{id}",createCartFromOrder:"reorder/{id}",sendInvoice:"orders/send/{id}"},n.endpointsMethods={createCartFromOrder:"get"},n.after_init(),n}return en(n,t),n.prototype.show=function(t){var n=salla.form.getPossibleValue((null==t?void 0:t.data)||t,["id","order_id"]);salla.event.dispatch("mobile::order.placed",{order_id:n}),location.href=salla.form.getPossibleValue((null==t?void 0:t.data)||t,["url"])},n.prototype.cancel=function(t){return t=t||Salla.config.get("page.id"),this.request(["cancel",t],{params:{has_apple_pay:!!window.ApplePaySession}}).then((function(n){return salla.event.order.canceled(n,t),n})).catch((function(n){throw salla.event.order.notCanceled(n,t),n}))},n.prototype.createCartFromOrder=function(t){return t=t||salla.config.get("page.id"),this.request(["createCartFromOrder",t]).then((function(n){return salla.cart.reset(),salla.event.order.orderCreated(n,t),window.location.href=n.data.url,n})).catch((function(n){throw salla.event.order.orderCreationFailed(n,t),n}))},n.prototype.sendInvoice=function(t){var n=salla.form.getPossibleValue(t,["id"])||salla.config.get("page.id");if(!n||isNaN(n)){var e="There is no id!";return salla.order.event.invoiceNotSent(e),salla.api.errorPromise(e)}return this.request(["sendInvoice",n],t).then((function(t){return salla.event.order.invoiceSent(t,n),t})).catch((function(t){throw salla.event.order.invoiceNotSent(t,n),t}))},n}(An),Dn=function(t){function n(){var n=t.call(this)||this;return n.namespace="product",n.previousQuery="",n.endpoints={getPrice:"products/{id}/price",availabilitySubscribe:"products/{id}/availability-notify",search:"products/search",details:"products/{product_id}/details",categories:"products/categories/{?id}",offers:"products/{product_id}/specialoffer",getSizeGuides:"products/{prod_id}/size-guides",giftDetail:"products/{product_id}/buy-as-gift",giftToCart:"products/{product_id}/buy-as-gift",giftImage:"products/buy-as-gift/image",buyNow:"products/{product_id}/buy-now",fetch:"products"},n.endpointsMethods={details:"get",giftDetail:"get",fetch:"get"},n.after_init(),n}return en(n,t),n.prototype.getPrice=function(t){var n=t.data||t,e=salla.form.getPossibleValue(n,["id","prod_id","product_id"]);return this.request(["getPrice",e],"object"==typeof n?n:void 0).then((function(t){return salla.product.event.priceUpdated(t,e),t})).catch((function(t){throw salla.product.event.priceUpdateFailed(t,e),t}))},n.prototype.categories=function(t){return this.request(["categories",t||""],null,"get").then((function(t){return salla.product.event.categoriesFetched(t),t})).catch((function(t){throw salla.product.event.categoriesFailed(t),t}))},n.prototype.availabilitySubscribe=function(t){var n=t.data||t;return t=salla.form.getPossibleValue(n,["id","prod_id"]),this.request(["availabilitySubscribe",t],"object"==typeof n?n:void 0).then((function(n){return salla.product.event.availabilitySubscribed(n,t),n})).catch((function(n){throw salla.product.event.availabilitySubscribeFailed(n,t),n}))},n.prototype.search=function(t){var n,e=t.data;if(e||(e={params:"string"==typeof t?{query:t}:t}),!(t=e instanceof FormData?e.get("query"):e.query||(null===(n=e.params)||void 0===n?void 0:n.query))){var i='There is no "query"!';return salla.product.event.searchFailed(i),salla.api.errorPromise(i)}if(t===salla.api.product.previousQuery){i="Query is same as previous one!";return salla.product.event.searchFailed(i),salla.api.product.previousQuery=null,salla.api.errorPromise(i)}return salla.api.product.previousQuery=t,this.request("search",e,"get").then((function(n){return salla.product.event.searchResults(n,t),n})).catch((function(n){throw salla.product.event.searchFailed(n,t),n}))},n.prototype.offers=function(t){if(!(t=salla.form.getPossibleValue((null==t?void 0:t.data)|t,["product_id","id"]))){var n='There is no "product_id"!';return salla.product.event.fetchOffersFailed(n),salla.api.errorPromise(n)}return this.request(["offers",t]).then((function(n){return salla.product.event.offersFetched(n,t),n})).catch((function(n){throw salla.product.event.fetchOffersFailed(n,t),n}))},n.prototype.getSizeGuides=function(t){return this.request("products/".concat(t,"/size-guides"),null,"get").then((function(n){return salla.product.event.sizeGuideFetched(n,t),n})).catch((function(n){throw salla.product.event.sizeGuideFetchFailed(n,t),n}))},n.prototype.getGiftDetails=function(t){return this.request(["giftDetail",t]).then((function(n){return salla.product.event.giftFetched(n,t),n})).catch((function(n){throw salla.product.event.giftFetchFailed(n,t),n}))},n.prototype.getDetails=function(t,n){if(void 0===n&&(n=[]),!Array.isArray(n)){var e="withItems should be array.";return salla.product.event.detailFetchFailed(e),salla.api.errorPromise(e)}if(!t){e="productId is not passed.";return salla.product.event.detailFetchFailed(e),salla.api.errorPromise(e)}return this.request(["details",t],{params:{with:n}}).then((function(n){return salla.product.event.detailFetched(n,t),n})).catch((function(n){throw salla.product.event.availabilitySubscribeFailed(n,t),n}))},n.prototype.addGiftToCart=function(t,n,e){return void 0===e&&(e=!1),this.request(["giftToCart",t],n).then((function(n){return salla.product.event.addGiftToCartSucceeded(n,t),e&&(window.location.href=n.redirect),n})).catch((function(n){throw salla.product.event.addGiftToCartFailed(n,t),n}))},n.prototype.uploadGiftImage=function(t){return this.request("giftImage",t).then((function(t){return salla.product.event.giftImageUploadSucceeded(t),t})).catch((function(t){throw salla.product.event.giftImageUploadFailed(t),t}))},n.prototype.fetch=function(t){if(!t.source){var n="Source can not be empty. Please provide one.";return salla.product.event.productListFetchFailed(n),salla.api.errorPromise(n)}if(["categories","brands","tags","selected"].includes(t.source)&&!Array.isArray(t.source_value)||"search"===t.source&&"string"!=typeof t.source_value||"related"===t.source&&isNaN(t.source_value)){n="SourceValue type error.";return salla.product.event.productListFetchFailed(n),salla.api.errorPromise(n)}return this.request(this.endpoints.fetch,{params:t},"get").then((function(t){return salla.product.event.productListFetchSucceeded(t),t})).catch((function(t){throw salla.product.event.productListFetchFailed(t),t}))},n}(An),Nn=function(t){function n(){var n=t.call(this)||this;return n.namespace="profile",n.endpoints={info:"auth/user",update:"profile/update",updateContacts:"profile/contacts/update",updateSettings:"profile/settings",verify:"profile/verify",delete:"profile"},n.endpointsMethods={delete:"delete"},n.after_init(),n}return en(n,t),n.prototype.info=function(){return this.request("info",null,"get").then((function(t){var n={id:t.data.id,type:"user",email:t.data.email,mobile:t.data.phone.code+t.data.phone.number,country_code:t.data.phone.country,language_code:t.data.language,currency_code:t.data.currency,notifications:t.data.notifications,pending_orders:t.data.pending_orders,avatar:t.data.avatar,first_name:t.data.first_name,last_name:t.data.last_name,fetched_at:Date.now()};return salla.config.set("user",n),salla.storage.set("user",n),salla.profile.event.infoFetched(t),t})).catch((function(t){throw salla.profile.event.infoNotFetched(t),t}))},n.prototype.update=function(t){return this.request("update",t).then((function(t){return salla.profile.event.updated(t),t})).catch((function(t){throw salla.event.profile.updateFailed(t),t}))},n.prototype.updateContacts=function(t){return this.request("updateContacts",t).then((function(t){return salla.profile.event.verificationCodeSent(t),t})).catch((function(t){throw salla.event.profile.updateContactsFailed(t),t}))},n.prototype.verify=function(t){return this.request("verify",t).then((function(t){return salla.profile.event.verified(t),t})).catch((function(t){throw salla.event.profile.unverified(t),t}))},n.prototype.updateSettings=function(t){return this.request("updateSettings",t).then((function(t){return salla.event.profile.settingsUpdated(t),t})).catch((function(t){throw salla.event.profile.updateSettingsFailed(t),t}))},n.prototype.delete=function(){return this.request("delete").then((function(t){return salla.storage.clearAll(),salla.cookie.clearAll(),salla.event.profile.deleted(t),window.location.href=salla.url.get("logout"),t})).catch((function(t){throw salla.event.profile.notDeleted(t),t}))},n}(An),qn=function(t){function n(){var n=t.call(this)||this;return n.namespace="comment",n.endpoints={comments:"{type}/{id}/comments"},n.after_init(),n}return en(n,t),n.prototype.add=function(t){if((null==t?void 0:t.data)&&(t=t.data),"string"==typeof(t=this.getCommentPayload(t)))return salla.event.comment.additionFailed(t),salla.api.errorPromise(t);if(!t.comment){var n="can't find comment content!";return salla.event.comment.additionFailed(n),salla.api.errorPromise(n)}return this.request(["comments",t.type,t.id],{comment:t.comment}).then((function(n){return salla.event.comment.added(n,t.id),n})).catch((function(n){throw salla.event.comment.additionFailed(n,t.id),n}))},n.prototype.getCommentPayload=function(t){var n={};return["id","type","comment","per_page","page"].forEach((function(e){var i=salla.form.getPossibleValue(t,[e]);i&&(n[e]=i)})),n.id?n.type&&["products","pages","product","page"].includes(n.type)?(n.type+=["product","page"].includes(n.type)?"s":"",n):"Failed to get type one of:(products, product, page, pages)!":"Failed to get id!"},n.prototype.fetch=function(t){return"string"==typeof(t=this.getCommentPayload(t))?(salla.event.comment.fetchFailed(t),salla.api.errorPromise(t)):this.request(["comments",t.type,t.id],{params:t},"get").then((function(n){return salla.event.comment.fetched(n,t),n})).catch((function(n){throw salla.event.comment.fetchFailed(n,t),n}))},n.prototype.getPageComments=function(t,n,e){return void 0===n&&(n=1),void 0===e&&(e=10),this.fetch({id:t,type:"pages",page:n,per_page:e})},n.prototype.getProductComments=function(t,n,e){return void 0===n&&(n=1),void 0===e&&(e=10),this.fetch({id:t,type:"products",page:n,per_page:e})},n}(An),Pn=function(t){function n(){var n=t.call(this)||this;return n.namespace="currency",n.endpoints={change:"/",list:"currencies"},n.endpointsMethods={change:"get",list:"get"},n.webEndpoints=["change"],n.after_init(),n}return en(n,t),n.prototype.change=function(t){if(!(t=salla.form.getPossibleValue(t.data||t,["currency","code"]))){var n="Can't find currency code!";return salla.currency.event.failed(n),salla.api.errorPromise(n)}return this.request("change",{params:{change_currency:"",currency:t}}).then((function(n){return salla.cookie.set("fresh_summary",1),salla.storage.set("cart",""),salla.currency.event.changed(n,t),n})).catch((function(n){throw salla.currency.event.failed(n,t),n}))},n.prototype.list=function(){return this.request("list").then((function(t){return salla.currency.event.fetched(t),t})).catch((function(t){throw salla.currency.event.failedToFetch(t),t}))},n}(An),Ln=function(t){function n(){var n=t.call(this)||this;return n.namespace="document",n}return en(n,t),n}(An),Un=function(t){function n(){var n=t.call(this)||this;return n.namespace="rating",n.endpoints={store:"rating/store",products:"rating/products",shipping:"rating/shipping",order:"rating/{order_id}"},n.endpointsMethods={order:"get"},n.after_init(),n}return en(n,t),n.prototype.order=function(t){var n="object"==typeof t?t:{},e=salla.form.getPossibleValue((null==t?void 0:t.data)||t,["order_id","id"]);if(!e){var i='There is no "order_id"!';return salla.event.rating.orderNotFetched(i),salla.api.errorPromise(i)}return this.request(["order",e],n).then((function(t){return salla.event.rating.orderFetched(t,e),t})).catch((function(t){throw salla.event.rating.orderNotFetched(t,e),t}))},n.prototype.store=function(t){if(!(t=(null==t?void 0:t.data)||t)){var n='There is no "data"!';return salla.event.rating.storeFailed(n),salla.api.errorPromise(n)}return this.request("store",t).then((function(n){return salla.event.rating.storeRated(n,t),n})).catch((function(n){throw salla.event.rating.storeFailed(n,t),n}))},n.prototype.products=function(t){if(!(t=(null==t?void 0:t.data)||t)){var n='There is no "data"!';return salla.event.rating.productsFailed(n),salla.api.errorPromise(n)}return this.request("products",t).then((function(n){return salla.event.rating.productsRated(n,t),n})).catch((function(n){throw salla.event.rating.productsFailed(n,t),n}))},n.prototype.shipping=function(t){if(!(t=(null==t?void 0:t.data)||t)){var n='There is no "data"!';return salla.event.rating.shippingFailed(n),salla.api.errorPromise(n)}return this.request("shipping",t).then((function(n){return salla.event.rating.shippingRated(n,t),n})).catch((function(n){throw salla.event.rating.shippingFailed(n,t),n}))},n}(An),Bn=function(t){function n(){var n=t.call(this)||this;return n.namespace="wishlist",n.endpoints={add:"products/favorites/{id}",remove:"products/favorites/{id}"},n.endpointsMethods={remove:"delete"},n.after_init(),n}return en(n,t),n.prototype.toggle=function(t){return salla.storage.get("salla::wishlist",[]).includes(t)?this.remove(t):this.add(t)},n.prototype.add=function(t){var n,e=this;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(n=salla.lang.get("common.messages.must_login")),salla.error(n),salla.api.errorPromise(n)):(t=salla.form.getPossibleValue((null==t?void 0:t.data)||t,["product_id","id"]))?this.request(["add",t]).then((function(n){return e.updateWishlistStorage(t),salla.wishlist.event.added(n,t),n})).catch((function(n){throw salla.wishlist.event.additionFailed(n,t),n})):(salla.wishlist.event.additionFailed(n="Failed to get product id!"),salla.api.errorPromise(n))},n.prototype.remove=function(t){var n,e=this;return salla.config.isGuest()?(salla.wishlist.event.additionFailed(n=salla.lang.get("common.messages.must_login")),salla.error(n),salla.api.errorPromise(n)):(t=salla.form.getPossibleValue((null==t?void 0:t.data)||t,["product_id","id"]))?this.request(["remove",t]).then((function(n){return e.updateWishlistStorage(t,!1),salla.wishlist.event.removed(n,t),n})).catch((function(n){throw salla.wishlist.event.removingFailed(n,t),n})):(salla.wishlist.event.removingFailed(n="Failed to get id!"),salla.api.errorPromise(n))},n.prototype.updateWishlistStorage=function(t,n){void 0===n&&(n=!0);var e=salla.storage.get("salla::wishlist",[]);n?e.push(t):e.splice(e.indexOf(t),1),salla.storage.set("salla::wishlist",e)},n}(An),zn=function(t){function n(){var n=t.call(this)||this;return n.namespace="scopes",n.endpoints={get:"scopes",change:"scopes",getProductAvailability:"scopes/availability?product_id={id}"},n.after_init(),n}return en(n,t),n.prototype.get=function(){return this.request("scopes",null,"get").then((function(t){return salla.scope.event.fetched(t),t})).catch((function(t){throw salla.scope.event.notFetched(t),t}))},n.prototype.change=function(t){return this.request("scopes",t).then((function(t){return salla.scope.event.changeSucceeded(t),t})).catch((function(t){throw salla.scope.event.changeFailed(t),t}))},n.prototype.getProductAvailability=function(t){return void 0===t&&(t=null),this.request("scopes/availability?product_id=".concat(t),null,"get").then((function(n){return salla.scope.event.productAvailabilityFetched(n,t),n})).catch((function(t){throw salla.scope.event.productAvailabilityNotFetched(t),t}))},n}(An),$n=function(t){function n(){var n=t.call(this)||this;return n.namespace="booking",n.endpoints={add:"cart/booking/product/{id}"},n.endpointsMethods={add:"get"},n}return en(n,t),n.prototype.add=function(t,n){return void 0===n&&(n=!0),an(this,void 0,void 0,(function(){var e;return on(this,(function(i){return t?[2,this.request(["add",t]).then((function(t){return salla.booking.event.added(t),n&&"booking"===t.data.redirect.to&&(window.location.href=t.data.redirect.url),t})).catch((function(t){throw salla.booking.event.additionFailed(t),t}))]:(e="Please provide product id.",salla.booking.event.additionFailed(e),[2,salla.api.errorPromise(e)])}))}))},n}(An),Mn=function(t){function n(){var n=t.call(this)||this;return n.namespace="landing",n.endpoints={getDetails:"landing/{landing_page_id}",createCartFromPage:"landing/{landing_page_id}"},n.endpointsMethods={getDetails:"get"},n.after_init(),n}return en(n,t),n.prototype.getDetails=function(t){if(!t){var n="page landing id not passed";return salla.event.landing.getDetailsFailed(n),salla.api.errorPromise(n)}return this.request(["getDetails",t]).then((function(n){return salla.event.landing.detailsFetched(n,t),n})).catch((function(n){throw salla.event.landing.getDetailsFailed(n,t),n}))},n.prototype.createCartFromPage=function(t){if(!t){var n="page landing id not passed";return salla.event.landing.orderCreationFailed(n),salla.api.errorPromise(n)}return salla.config.isGuest()?(salla.auth.api.setAfterLoginEvent("landing::createCartFromPage",t),salla.event.dispatch("login::open"),salla.api.successPromise("")):this.request(["createCartFromPage",t]).then((function(n){return salla.event.landing.orderCreated(n,t).then((function(){return location.href=n.data.url})),n})).catch((function(n){throw salla.event.landing.orderCreationFailed(n,t),n}))},n}(An),Jn=function(){function t(){var t=this;salla.event.on("twilight::before.ready",(function(n){return t.initiateRequest(n)})),salla.event.on("profile::info.fetched",(function(n){return t.setCurrencyAndLanguage(n)})),salla.event.on("auth::token.fetched",(function(n){salla.storage.set("token",n),t.setToken(n),salla.cart.api.reset()})),this.notifier_handler_disabled=!1,this.axios=Jt.create({headers:{common:{"X-Requested-With":"XMLHttpRequest","S-SOURCE":"twilight","S-APP-VERSION":"v2.0.0","S-APP-OS":"browser"}}})}return t.prototype.getHeaders=function(){return this.axios.defaults.headers.common},t.prototype.setHeaders=function(t){var n=this;return Object.entries(t).forEach((function(t){return n.setHeader(t[0],t[1])})),this},t.prototype.setHeader=function(t,n){return salla.infiniteScroll.fetchOptions.headers[t]=this.axios.defaults.headers.common[t]=n,this},t.prototype.withoutNotifier=function(t){return an(this,void 0,void 0,(function(){var n=this;return on(this,(function(e){switch(e.label){case 0:return this.notifier_handler_disabled=!0,[4,t().finally((function(){n.notifier_handler_disabled=!1}))];case 1:return[2,e.sent()]}}))}))},t.prototype.initiateRequest=function(t){var n,e;this.axios.defaults.baseURL=Salla.config.get("store.api",Salla.config.get("store.url")),this.setHeaders({"Store-Identifier":Salla.config.get("store.id"),currency:(null===(n=t.user)||void 0===n?void 0:n.currency_code)||"SAR","accept-language":salla.lang.getLocale(),"s-user-id":null===(e=t.user)||void 0===e?void 0:e.id});var i=salla.storage.get("scope");i&&this.setHeaders({"s-scope-type":i.type,"s-scope-id":i.id}),this.injectTokenToTheRequests(t),salla.storage.get("affiliate_code")&&this.setHeader("s-affiliate-code",salla.storage.get("affiliate_code"))},t.prototype.injectTokenToTheRequests=function(t){var n,e,i,r=salla.storage.get("token"),a="guest"===t.user.type,o=salla.storage.get("cart"),s=null===(n=t.user)||void 0===n?void 0:n.id,u=salla.storage.get("user.id");if(u&&u!==s&&(salla.log("Api:: case1 = >user in localStorage is not same as user in the config"),salla.storage.remove("user")),o&&(o.user_id!==s||o.store_id!==(null===(e=t.store)||void 0===e?void 0:e.id)))return salla.log("cart",{user_id:o.user_id,store_id:o.store_id}),salla.log("current",{user_id:s,store_id:null===(i=t.store)||void 0===i?void 0:i.id}),salla.log("Api:: case2 => The cart is not belong to current "+(o.user_id!==s?"user":"store")+"!"),void salla.cart.api.reset();if(!a||r){if(a&&r)return salla.log("Api:: case4 => there is a token and current user is guest"),salla.log("Auth:: Token without user!"),salla.storage.remove("token"),void salla.cart.api.reset();if(!r)return salla.log("Api:: case5 => current user is logged-in but there is no token"),salla.cart.api.reset(),void salla.auth.api.refresh();var l=Xt(r);if(Date.now()/1e3>l.exp)return salla.log("Api:: case6 => current user is logged-in and there is a token, but it's expired"),salla.storage.remove("token"),salla.cart.api.reset(),void salla.auth.api.refresh();if(l.sub!==s)return salla.log("Api:: case7 => The user id is not match the token details"),salla.storage.remove("token"),salla.cart.api.reset(),void salla.auth.api.refresh();this.setToken(r),salla.log("Api:: case8 => current user is logged-in and there is a token, and it's not expired"),salla.event.emit("api::initiated")}else salla.log("Api:: case3 => current user is a guest and there is no token")},t.prototype.setToken=function(t){return this.setHeader("Authorization","Bearer "+t),salla.event.emit("api::token.injected",t),this.token=t,this},t.prototype.setCurrencyAndLanguage=function(t){return this.setHeaders({currency:t.data.currency,"accept-language":t.data.language})},t.prototype.request=function(t,n,e,i){var r=this;void 0===n&&(n=void 0),void 0===e&&(e="get"),void 0===i&&(i={});var a={endPoint:t,payload:n,method:e,options:i},o="undefined"!=typeof event?event.currentTarget:null,s=!1;return"SALLA-BUTTON"===(null==o?void 0:o.tagName)&&(s=!0),s&&(null==o||o.load()),this.axios[a.method](a.endPoint,a.payload,a.options).then((function(t){return s&&(null==o||o.stop()),t.data&&t.request&&(t=t.data),r.handleAfterResponseActions(t),t})).catch((function(t){throw s&&(null==o||o.stop()),salla.event.document.requestFailed(a,t),r.handleErrorResponse(t),t}))},t.prototype.handleAfterResponseActions=function(t){if(t){var n=t.data,e=t.googleTags,i=void 0===e?null:e,r=n&&n.googleTags?n.googleTags:i;try{window.dataLayer&&r&&window.dataLayer.push(r)}catch(t){salla.logger.error(t.message)}this.fireEventsForResponse(t),this.showAlert(t)}},t.prototype.fireEventsForResponse=function(t){var n,e,i=(null==t?void 0:t.events)||(null===(n=t.data)||void 0===n?void 0:n.events)||(null===(e=t.error)||void 0===e?void 0:e.events);"string"==typeof i&&(i=JSON.parse(i)),i&&Object.keys(i).forEach((function(t){return salla.event.dispatch(t,i[t])}))},t.prototype.handleErrorResponse=function(t){if(t.response&&t.response.data)return t.response.data.error&&t.response.data.error.fields&&!this.notifier_handler_disabled?this.handleInvalidFields(t):this.handleAfterResponseActions(t.response.data)},t.prototype.showAlert=function(t){var n,e;if(t&&!this.notifier_handler_disabled)return t.case&&t.msg?salla.notify.fire(t.msg,t.case,t):t.hasOwnProperty("success")&&(null===(n=t.data)||void 0===n?void 0:n.message)?salla.notify.fire(null===(e=t.data)||void 0===e?void 0:e.message,t.success?salla.notify.types.success:salla.notify.types.error,t):t.error&&t.error.message&&"FORBIDDEN"!==t.error.message?salla.error(t.error.message,t):void 0},t.prototype.handleInvalidFields=function(t){var n=t.response.data.error.fields,e=[];Object.keys(n).forEach((function(t){var i=n[t];Array.isArray(i)?i.forEach((function(t){return e.push(t)})):e.push(i)}));var i=(e.length>1?"* ":"")+e.join("\n* ");salla.error(i,t)},t.prototype.isFastRequestsAllowed=function(){return Salla.config.get("fastRequests")},t.prototype.promise=function(t,n){return void 0===n&&(n=!0),new Promise((function(e,i){return n?e(t):i(t)}))},t.prototype.errorPromise=function(t){return this.promise(t,!1)},t.prototype.successPromise=function(t){return this.promise(t,!0)},t}(),Hn=function(t){function n(){var n=t.call(this)||this;return n.auth=new Rn,n.cart=new xn,n.loyalty=new Tn,n.order=new Cn,n.rating=new Un,n.product=new Dn,n.profile=new Nn,n.comment=new qn,n.currency=new Pn,n.document=new Ln,n.wishlist=new Bn,n.scope=new zn,n.booking=new $n,n.landing=new Mn,n}return en(n,t),n}(Jn),Gn=function(){function t(t){var n,e;"ready"!==Salla.status?t?(Salla.config.merge(t),(null==t?void 0:t.events)&&Salla.event.dispatchEvents(null==t?void 0:t.events),t._token&&salla.api.setHeader("X-CSRF-TOKEN",t._token),this.injectMaintenanceAlert(),this.injectThemePreviewAlert(),this.injectEditAlert(),(null===(n=null==t?void 0:t.user)||void 0===n?void 0:n.language_code)&&salla.lang.setLocale(null===(e=null==t?void 0:t.user)||void 0===e?void 0:e.language_code),salla.lang.loadStoreTranslations(),this.setSallaReady(t)):this.setSallaReady(t):salla.log("Trying to re-initiate Salla, while its status === 'ready'!")}return t.prototype.injectMaintenanceAlert=function(){salla.config.get("maintenance")&&(document.body.classList.add("has-maintenance-bar"),document.querySelector("salla-maintenance-alert")?salla.logger.warn("salla-maintenance-alert element Existed before!"):salla.lang.onLoaded((function(){return document.body.prepend(document.createElement("salla-maintenance-alert"))})))},t.prototype.injectThemePreviewAlert=function(){"preview"===salla.config.get("theme.mode")&&(document.body.classList.add("has-preview-bar"),document.querySelector("#s-theme_preview_bar")?salla.logger.warn("#s-theme_preview_bar element Existed before!"):salla.lang.onLoaded((function(){var t=document.createElement("div");t.id="s-theme_preview_bar",t.setAttribute("style","display: flex; justify-content: space-between; text-align: center; background-color: #232323; color: #fff; padding: 10px; font-size: 0.875rem; line-height: 1.25rem; position: relative;"),t.innerHTML='\n <div style="display:flex; align-items:center;">\n <img width="32" src="https://assets.salla.sa/cp/assets/images/logo-new.png">\n <span style="margin:0 10px;">'.concat(salla.lang.get("blocks.header.preview_mode"),': <span style="background:rgba(255,255,255,0.25);border-radius:15px; padding:2px 15px 4px">').concat(salla.config.get("theme.name"),'</span></span>\n </div>\n <a href="').concat(salla.url.get("preview_theme/cancel/preview"),'" style="line-height:32px; width:32px;"><i class="sicon-cancel"></i></a>\n '),document.body.prepend(t)})))},t.prototype.injectEditAlert=function(){var t=salla.config.get("edit");t&&(document.querySelector("#s-edit-alert")?salla.logger.warn("#s-edit-alert element Existed before!"):salla.lang.onLoaded((function(){var n=document.createElement("div");n.id="s-edit-alert",n.innerHTML='\n <a href="'.concat(t,'" style="display:block; background-color:').concat(salla.config.get("theme.color.primary","#5cd5c4"),"; color:").concat(salla.config.get("theme.color.reverse","#fff"),'; padding: 10px; text-align:center; font-size: 0.875rem; line-height: 1.25rem;">\n <i class="sicon-edit"></i> \n ').concat(salla.lang.get("pages.products.quick_edit"),"\n </a>\n "),document.body.prepend(n)})))},t.prototype.handleElementAjaxRequest=function(t,n){var e=this;if(!(n instanceof HTMLFormElement||n instanceof HTMLAnchorElement))return salla.logger.warn("trying to call ajax from non Element!!"),!1;t.preventDefault();var i=n.getAjaxFormData(t),r=i.method?i.method.toLowerCase():void 0;salla.api.request(i.url,i.formData,r).then((function(t){return t.data&&t.request&&(t=t.data),salla.api.handleAfterResponseActions(t),e.callAjaxEvent(i.events.success,t,i.formData),t})).catch((function(t){throw salla.api.handleErrorResponse(t),e.callAjaxEvent(i.events.fail,t,i.formData),t}))},t.prototype.callAjaxEvent=function(t,n,e){if(t){if(e instanceof FormData){var i={};Array.from(e.entries()).forEach((function(t){i[t[0]]=t[1]})),e=i}window[t]?window[t](n,e):salla.event.dispatch(t,n,e)}},t.prototype.setSallaReady=function(t){Salla.event.dispatch("twilight::before.ready",t),Salla.status="ready",Salla.event.dispatch("twilight::initiated",t),window.dispatchEvent(new CustomEvent("twilight::initiated",{detail:t}))},t}();Salla.status="loading",Salla.notify=Yt,Salla.lang=new jn,Salla.form=new In,Salla.infiniteScroll=new En(void 0,salla.event.infiniteScroll),Salla.api=new Hn,["cart","auth","order","scope","rating","comment","loyalty","product","profile","currency","document","wishlist","booking","landing"].forEach((function(t){return Salla[t]=new tn(Salla.api[t],Salla.event[t])})),Salla.call=function(t){for(var n=Salla,e=t.split(".");e.length&&(n=n[e.shift()]););return n},Salla.init=function(t){return new Gn(t)},salla.event.once("twilight::init",salla.init),salla.event.once("twilight::api",(function(t){var n=null==t?void 0:t.events;n&&salla.event.dispatchEvents(n)})),Salla.success=Salla.notify.success,Salla.error=Salla.notify.error,Salla.versions.twilight="[VI]{version}[/VI]",Salla.onInitiated=function(t){return salla.event.once("twilight::initiated",t)},Salla.onReady=Salla.onReady||function(t){"ready"!==salla.status?Salla.onInitiated(t):t(salla.config.all())},window.dispatchEvent(new CustomEvent("salla::created"));var Qn=t((function(t,e){!function(n,e){t.exports=e()}(n,(function(){function t(){return t=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},t.apply(this,arguments)}var n="undefined"!=typeof window,e=n&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),i=n&&"IntersectionObserver"in window,r=n&&"classList"in document.createElement("p"),a=n&&window.devicePixelRatio>1,o={elements_selector:".lazy",container:e||n?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_bg_hidpi:"bg-hidpi",data_bg_multi:"bg-multi",data_bg_multi_hidpi:"bg-multi-hidpi",data_bg_set:"bg-set",data_poster:"poster",class_applied:"applied",class_loading:"loading",class_loaded:"loaded",class_error:"error",class_entered:"entered",class_exited:"exited",unobserve_completed:!0,unobserve_entered:!1,cancel_on_exit:!0,callback_enter:null,callback_exit:null,callback_applied:null,callback_loading:null,callback_loaded:null,callback_error:null,callback_finish:null,callback_cancel:null,use_native:!1,restore_on_error:!1},s=function(n){return t({},o,n)},u=function(t,n){var e,i="LazyLoad::Initialized",r=new t(n);try{e=new CustomEvent(i,{detail:{instance:r}})}catch(t){(e=document.createEvent("CustomEvent")).initCustomEvent(i,!1,!1,{instance:r})}window.dispatchEvent(e)},l="src",c="srcset",f="sizes",d="poster",h="llOriginalAttrs",v="data",p="loading",g="loaded",m="applied",w="error",y="native",b="data-",S="ll-status",_=function(t,n){return t.getAttribute(b+n)},F=function(t){return _(t,S)},k=function(t,n){return function(t,n,e){var i="data-ll-status";null!==e?t.setAttribute(i,e):t.removeAttribute(i)}(t,0,n)},O=function(t){return k(t,null)},E=function(t){return null===F(t)},I=function(t){return F(t)===y},j=[p,g,m,w],A=function(t,n,e,i){t&&(void 0===i?void 0===e?t(n):t(n,e):t(n,e,i))},x=function(t,n){r?t.classList.add(n):t.className+=(t.className?" ":"")+n},T=function(t,n){r?t.classList.remove(n):t.className=t.className.replace(new RegExp("(^|\\s+)"+n+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},R=function(t){return t.llTempImage},C=function(t,n){if(n){var e=n._observer;e&&e.unobserve(t)}},D=function(t,n){t&&(t.loadingCount+=n)},N=function(t,n){t&&(t.toLoadCount=n)},q=function(t){for(var n,e=[],i=0;n=t.children[i];i+=1)"SOURCE"===n.tagName&&e.push(n);return e},P=function(t,n){var e=t.parentNode;e&&"PICTURE"===e.tagName&&q(e).forEach(n)},L=function(t,n){q(t).forEach(n)},U=[l],B=[l,d],z=[l,c,f],$=[v],M=function(t){return!!t[h]},J=function(t){return t[h]},H=function(t){return delete t[h]},G=function(t,n){if(!M(t)){var e={};n.forEach((function(n){e[n]=t.getAttribute(n)})),t[h]=e}},Q=function(t,n){if(M(t)){var e=J(t);n.forEach((function(n){!function(t,n,e){e?t.setAttribute(n,e):t.removeAttribute(n)}(t,n,e[n])}))}},V=function(t,n,e){x(t,n.class_applied),k(t,m),e&&(n.unobserve_completed&&C(t,n),A(n.callback_applied,t,e))},X=function(t,n,e){x(t,n.class_loading),k(t,p),e&&(D(e,1),A(n.callback_loading,t,e))},W=function(t,n,e){e&&t.setAttribute(n,e)},K=function(t,n){W(t,f,_(t,n.data_sizes)),W(t,c,_(t,n.data_srcset)),W(t,l,_(t,n.data_src))},Z={IMG:function(t,n){P(t,(function(t){G(t,z),K(t,n)})),G(t,z),K(t,n)},IFRAME:function(t,n){G(t,U),W(t,l,_(t,n.data_src))},VIDEO:function(t,n){L(t,(function(t){G(t,U),W(t,l,_(t,n.data_src))})),G(t,B),W(t,d,_(t,n.data_poster)),W(t,l,_(t,n.data_src)),t.load()},OBJECT:function(t,n){G(t,$),W(t,v,_(t,n.data_src))}},Y=["IMG","IFRAME","VIDEO","OBJECT"],tt=function(t,n){!n||function(t){return t.loadingCount>0}(n)||function(t){return t.toLoadCount>0}(n)||A(t.callback_finish,n)},nt=function(t,n,e){t.addEventListener(n,e),t.llEvLisnrs[n]=e},et=function(t,n,e){t.removeEventListener(n,e)},it=function(t){return!!t.llEvLisnrs},rt=function(t){if(it(t)){var n=t.llEvLisnrs;for(var e in n){var i=n[e];et(t,e,i)}delete t.llEvLisnrs}},at=function(t,n,e){!function(t){delete t.llTempImage}(t),D(e,-1),function(t){t&&(t.toLoadCount-=1)}(e),T(t,n.class_loading),n.unobserve_completed&&C(t,e)},ot=function(t,n,e){var i=R(t)||t;it(i)||function(t,n,e){it(t)||(t.llEvLisnrs={});var i="VIDEO"===t.tagName?"loadeddata":"load";nt(t,i,n),nt(t,"error",e)}(i,(function(r){!function(t,n,e,i){var r=I(n);at(n,e,i),x(n,e.class_loaded),k(n,g),A(e.callback_loaded,n,i),r||tt(e,i)}(0,t,n,e),rt(i)}),(function(r){!function(t,n,e,i){var r=I(n);at(n,e,i),x(n,e.class_error),k(n,w),A(e.callback_error,n,i),e.restore_on_error&&Q(n,z),r||tt(e,i)}(0,t,n,e),rt(i)}))},st=function(t,n,e){!function(t){return Y.indexOf(t.tagName)>-1}(t)?function(t,n,e){!function(t){t.llTempImage=document.createElement("IMG")}(t),ot(t,n,e),function(t){M(t)||(t[h]={backgroundImage:t.style.backgroundImage})}(t),function(t,n,e){var i=_(t,n.data_bg),r=_(t,n.data_bg_hidpi),o=a&&r?r:i;o&&(t.style.backgroundImage='url("'.concat(o,'")'),R(t).setAttribute(l,o),X(t,n,e))}(t,n,e),function(t,n,e){var i=_(t,n.data_bg_multi),r=_(t,n.data_bg_multi_hidpi),o=a&&r?r:i;o&&(t.style.backgroundImage=o,V(t,n,e))}(t,n,e),function(t,n,e){var i=_(t,n.data_bg_set);if(i){var r=i.split("|"),a=r.map((function(t){return"image-set(".concat(t,")")}));t.style.backgroundImage=a.join(),""===t.style.backgroundImage&&(a=r.map((function(t){return"-webkit-image-set(".concat(t,")")})),t.style.backgroundImage=a.join()),V(t,n,e)}}(t,n,e)}(t,n,e):function(t,n,e){ot(t,n,e),function(t,n,e){var i=Z[t.tagName];i&&(i(t,n),X(t,n,e))}(t,n,e)}(t,n,e)},ut=function(t){t.removeAttribute(l),t.removeAttribute(c),t.removeAttribute(f)},lt=function(t){P(t,(function(t){Q(t,z)})),Q(t,z)},ct={IMG:lt,IFRAME:function(t){Q(t,U)},VIDEO:function(t){L(t,(function(t){Q(t,U)})),Q(t,B),t.load()},OBJECT:function(t){Q(t,$)}},ft=function(t,n){(function(t){var n=ct[t.tagName];n?n(t):function(t){if(M(t)){var n=J(t);t.style.backgroundImage=n.backgroundImage}}(t)})(t),function(t,n){E(t)||I(t)||(T(t,n.class_entered),T(t,n.class_exited),T(t,n.class_applied),T(t,n.class_loading),T(t,n.class_loaded),T(t,n.class_error))}(t,n),O(t),H(t)},dt=["IMG","IFRAME","VIDEO"],ht=function(t){return t.use_native&&"loading"in HTMLImageElement.prototype},vt=function(t,n,e){t.forEach((function(t){return function(t){return t.isIntersecting||t.intersectionRatio>0}(t)?function(t,n,e,i){var r=function(t){return j.indexOf(F(t))>=0}(t);k(t,"entered"),x(t,e.class_entered),T(t,e.class_exited),function(t,n,e){n.unobserve_entered&&C(t,e)}(t,e,i),A(e.callback_enter,t,n,i),r||st(t,e,i)}(t.target,t,n,e):function(t,n,e,i){E(t)||(x(t,e.class_exited),function(t,n,e,i){e.cancel_on_exit&&function(t){return F(t)===p}(t)&&"IMG"===t.tagName&&(rt(t),function(t){P(t,(function(t){ut(t)})),ut(t)}(t),lt(t),T(t,e.class_loading),D(i,-1),O(t),A(e.callback_cancel,t,n,i))}(t,n,e,i),A(e.callback_exit,t,n,i))}(t.target,t,n,e)}))},pt=function(t){return Array.prototype.slice.call(t)},gt=function(t){return t.container.querySelectorAll(t.elements_selector)},mt=function(t){return function(t){return F(t)===w}(t)},wt=function(t,n){return function(t){return pt(t).filter(E)}(t||gt(n))},yt=function(t,e){var r=s(t);this._settings=r,this.loadingCount=0,function(t,n){i&&!ht(t)&&(n._observer=new IntersectionObserver((function(e){vt(e,t,n)}),function(t){return{root:t.container===document?null:t.container,rootMargin:t.thresholds||t.threshold+"px"}}(t)))}(r,this),function(t,e){n&&(e._onlineHandler=function(){!function(t,n){var e;(e=gt(t),pt(e).filter(mt)).forEach((function(n){T(n,t.class_error),O(n)})),n.update()}(t,e)},window.addEventListener("online",e._onlineHandler))}(r,this),this.update(e)};return yt.prototype={update:function(t){var n,r,a=this._settings,o=wt(t,a);N(this,o.length),!e&&i?ht(a)?function(t,n,e){t.forEach((function(t){-1!==dt.indexOf(t.tagName)&&function(t,n,e){t.setAttribute("loading","lazy"),ot(t,n,e),function(t,n){var e=Z[t.tagName];e&&e(t,n)}(t,n),k(t,y)}(t,n,e)})),N(e,0)}(o,a,this):(r=o,function(t){t.disconnect()}(n=this._observer),function(t,n){n.forEach((function(n){t.observe(n)}))}(n,r)):this.loadAll(o)},destroy:function(){this._observer&&this._observer.disconnect(),n&&window.removeEventListener("online",this._onlineHandler),gt(this._settings).forEach((function(t){H(t)})),delete this._observer,delete this._settings,delete this._onlineHandler,delete this.loadingCount,delete this.toLoadCount},loadAll:function(t){var n=this,e=this._settings;wt(t,e).forEach((function(t){C(t,n),st(t,e,n)}))},restoreAll:function(){var t=this._settings;gt(t).forEach((function(n){ft(n,t)}))}},yt.load=function(t,n){var e=s(n);st(t,e)},yt.resetStatus=function(t){O(t)},n&&function(t,n){if(n)if(n.length)for(var e,i=0;e=n[i];i+=1)u(t,e);else u(t,n)}(yt,window.lazyLoadOptions),yt}))}));function Vn(){if(!document.lazyLoadInstance){document.lazyLoadInstance=new Qn({use_native:true});document.lazyLoadBackgrounds=new Qn({elements_selector:".lazy[data-bg]:not(.loaded)"})}if(document.readyState!=="complete"){document.addEventListener("DOMContentLoaded",(()=>document.lazyLoadInstance.update()));document.addEventListener("DOMContentLoaded",(()=>document.lazyLoadBackgrounds.update()))}salla.infiniteScroll.event.onAppend((()=>{document.lazyLoadInstance.update();document.lazyLoadBackgrounds.update()}))}const Xn=Vn;export{Xn as g};
|
|
25
|
-
//# sourceMappingURL=p-aa8e58b9.js.map
|