@salla.sa/twilight 2.0.334 → 2.0.336
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.
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
* @license MIT https://github.com/rmariuzzo/Lang.js/blob/master/LICENSE
|
|
25
25
|
* @site https://github.com/rmariuzzo/Lang.js
|
|
26
26
|
* @author Rubens Mariuzzo <rubens@mariuzzo.com>
|
|
27
|
-
*/!function(e,t){e.exports=function(){function e(){if("undefined"!=typeof document&&document.documentElement)return document.documentElement.lang}function t(e){return"-Inf"===e?-1/0:"+Inf"===e||"Inf"===e||"*"===e?1/0:parseInt(e,10)}var r=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/,i=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/,n={locale:"en"},s=function(t){t=t||{},this.locale=t.locale||e()||n.locale,this.fallback=t.fallback,this.messages=t.messages};return s.prototype.setMessages=function(e){this.messages=e},s.prototype.getLocale=function(){return this.locale||this.fallback},s.prototype.setLocale=function(e){this.locale=e},s.prototype.getFallback=function(){return this.fallback},s.prototype.setFallback=function(e){this.fallback=e},s.prototype.has=function(e,t){return!("string"!=typeof e||!this.messages)&&null!==this._getMessage(e,t)},s.prototype.get=function(e,t,r){if(!this.has(e,r))return e;var i=this._getMessage(e,r);return null===i?e:(t&&(i=this._applyReplacements(i,t)),i)},s.prototype.trans=function(e,t){return this.get(e,t)},s.prototype.choice=function(e,t,r,n){(r=void 0!==r?r:{}).count=t;var s=this.get(e,r,n);if(null==s)return s;for(var a=s.split("|"),o=[],l=0;l<a.length;l++)if(a[l]=a[l].trim(),i.test(a[l])){var c=a[l].split(/\s/);o.push(c.shift()),a[l]=c.join(" ")}if(1===a.length)return s;for(var u=0;u<o.length;u++)if(this._testInterval(t,o[u]))return a[u];return n=n||this._getLocale(e),a[this._getPluralForm(t,n)]},s.prototype.transChoice=function(e,t,r){return this.choice(e,t,r)},s.prototype._parseKey=function(e,t){if("string"!=typeof e||"string"!=typeof t)return null;var r=e.split("."),i=r[0].replace(/\//g,".");return{source:t+"."+i,sourceFallback:this.getFallback()+"."+i,entries:r.slice(1)}},s.prototype._getMessage=function(e,t){if(t=t||this.getLocale(),e=this._parseKey(e,t),void 0===this.messages[e.source]&&void 0===this.messages[e.sourceFallback])return null;var r=this.messages[e.source],i=e.entries.slice(),n=i.join(".");if("string"!=typeof(r=void 0!==r?this._getValueInKey(r,n):void 0)&&this.messages[e.sourceFallback])for(r=this.messages[e.sourceFallback],i=e.entries.slice(),n="";i.length&&void 0!==r;)r[n=n?n.concat(".",i.shift()):i.shift()]&&(r=r[n],n="");return"string"!=typeof r?null:r},s.prototype._getValueInKey=function(e,t){if("string"==typeof e[t])return e[t];for(var r=(t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),i=0,n=r.length;i<n;++i){var s=r.slice(0,i+1).join("."),a=r.slice(i+1,r.length).join(".");if(e[s])return this._getValueInKey(e[s],a)}return e},s.prototype._getLocale=function(e){return e=this._parseKey(e,this.locale),this.messages[e.source]?this.locale:this.messages[e.sourceFallback]?this.fallback:null},s.prototype._findMessageInTree=function(e,t){for(;e.length&&void 0!==t;){var r=e.join(".");if(t[r]){t=t[r];break}t=t[e.shift()]}return t},s.prototype._sortReplacementKeys=function(e,t){return t.length-e.length},s.prototype._applyReplacements=function(e,t){return Object.keys(t).sort(this._sortReplacementKeys).forEach((function(r){e=e.replace(new RegExp(":"+r,"gi"),(function(e){var i=t[r];return e===e.toUpperCase()?i.toUpperCase():e===e.replace(/\w/i,(function(e){return e.toUpperCase()}))?i.charAt(0).toUpperCase()+i.slice(1):i}))})),e},s.prototype._testInterval=function(e,i){if("string"!=typeof i)throw"Invalid interval: should be a string.";var n=(i=i.trim()).match(r);if(!n)throw"Invalid interval: "+i;if(!n[2]){var s=(n=n.filter((function(e){return!!e})))[1],a=t(n[2]);a===1/0&&(a=-1/0);var o=t(n[3]),l=n[4];return("["===s?e>=a:e>a)&&("]"===l?e<=o:e<o)}for(var c=n[2].split(","),u=0;u<c.length;u++)if(parseInt(c[u],10)===e)return!0;return!1},s.prototype._getPluralForm=function(e,t){switch(t){case"az":case"bo":case"dz":case"id":case"ja":case"jv":case"ka":case"km":case"kn":case"ko":case"ms":case"th":case"tr":case"vi":case"zh":default:return 0;case"af":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"ur":case"zu":return 1==e?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"hy":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return 0===e||1===e?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2;case"cs":case"sk":return 1==e?0:e>=2&&e<=4?1:2;case"ga":return 1==e?0:2==e?1:2;case"lt":return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2;case"sl":return e%100==1?0:e%100==2?1:e%100==3||e%100==4?2:3;case"mk":return e%10==1?0:1;case"mt":return 1==e?0:0===e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3;case"lv":return 0===e?0:e%10==1&&e%100!=11?1:2;case"pl":return 1==e?0:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?1:2;case"cy":return 1==e?0:2==e?1:8==e||11==e?2:3;case"ro":return 1==e?0:0===e||e%100>0&&e%100<20?1:2;case"ar":return 0===e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5}},s}()}(lang);var Lang=lang.exports;class SallaLang extends Lang{constructor(e){(e=e||{}).messages=e.messages||window.translations,e.locale=e.locale||(window.locale||navigator.language||navigator.userLanguage||"ar").split("-")[0],e.fallback=e.fallback||e.locale,super(e),this.translationsLoaded=!1}onLoaded(e){if(this.translationsLoaded)return e();salla.event.once("languages::translations.loaded",e)}loadStoreTranslations(){if(this.messages)return void window.addEventListener("load",(e=>{salla.event.dispatch("languages::translations.loaded"),salla.logger.info("The messages of transactions is already loaded")}));if(!salla.url.get(""))return this.messages&&salla.event.dispatch("languages::translations.loaded"),this.translationsLoaded=!0,void salla.logger.warn("There is no `store.url` to auto loading translations from it!");let e=salla.config.get("theme.translations_hash",salla.config.get("store.id","twilight")),t=document.createElement("script");t.src=salla.url.get(`languages/assets/${e}.js`),t.onload=()=>{if(window.translations)return this.setMessages(window.translations),salla.event.dispatch("languages::translations.loaded"),void(this.translationsLoaded=!0);console.warn('You should load Salla Translations Before!\nUse: <script src="{{ link("languages/assets/{theme.translations_hash}.js") }}"><\/script>\nor: salla.lang.setMessages({....}), see https://github.com/rmariuzzo/Lang.js for more informations.')},document.head.appendChild(t)}get(e,t,r){return window.translations&&(e="trans."+e),super.get(e,t,r)}set(e,t){return salla.helpers.setNested(this.messages[this.getLocale()+".trans"],e,t),this}}var assign=make_assign(),create$1=make_create(),trim$1=make_trim(),Global$5="undefined"!=typeof window?window:commonjsGlobal,util$6={assign:assign,create:create$1,trim:trim$1,bind:bind$1,slice:slice$1,each:each$7,map:map,pluck:pluck$1,isList:isList$1,isFunction:isFunction$1,isObject:isObject$1,Global:Global$5};function make_assign(){return Object.assign?Object.assign:function(e,t,r,i){for(var n=1;n<arguments.length;n++)each$7(Object(arguments[n]),(function(t,r){e[r]=t}));return e}}function make_create(){if(Object.create)return function(e,t,r,i){var n=slice$1(arguments,1);return assign.apply(this,[Object.create(e)].concat(n))};{function e(){}return function(t,r,i,n){var s=slice$1(arguments,1);return e.prototype=t,assign.apply(this,[new e].concat(s))}}}function make_trim(){return String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}function bind$1(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}}function slice$1(e,t){return Array.prototype.slice.call(e,t||0)}function each$7(e,t){pluck$1(e,(function(e,r){return t(e,r),!1}))}function map(e,t){var r=isList$1(e)?[]:{};return pluck$1(e,(function(e,i){return r[i]=t(e,i),!1})),r}function pluck$1(e,t){if(isList$1(e)){for(var r=0;r<e.length;r++)if(t(e[r],r))return e[r]}else for(var i in e)if(e.hasOwnProperty(i)&&t(e[i],i))return e[i]}function isList$1(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}function isFunction$1(e){return e&&"[object Function]"==={}.toString.call(e)}function isObject$1(e){return e&&"[object Object]"==={}.toString.call(e)}var util$5=util$6,slice=util$5.slice,pluck=util$5.pluck,each$6=util$5.each,bind=util$5.bind,create=util$5.create,isList=util$5.isList,isFunction=util$5.isFunction,isObject=util$5.isObject,storeEngine={createStore:createStore},storeAPI={version:"2.0.12",enabled:!1,get:function(e,t){var r=this.storage.read(this._namespacePrefix+e);return this._deserialize(r,t)},set:function(e,t){return void 0===t?this.remove(e):(this.storage.write(this._namespacePrefix+e,this._serialize(t)),t)},remove:function(e){this.storage.remove(this._namespacePrefix+e)},each:function(e){var t=this;this.storage.each((function(r,i){e.call(t,t._deserialize(r),(i||"").replace(t._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(e){return this._namespacePrefix=="__storejs_"+e+"_"},createStore:function(){return createStore.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return createStore(this.storage,this.plugins,e)}};function _warn(){var e="undefined"==typeof console?null:console;if(e){var t=e.warn?e.warn:e.log;t.apply(e,arguments)}}function createStore(e,t,r){r||(r=""),e&&!isList(e)&&(e=[e]),t&&!isList(t)&&(t=[t]);var i=r?"__storejs_"+r+"_":"",n=r?new RegExp("^"+i):null;if(!/^[a-zA-Z0-9_\-]*$/.test(r))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var s={_namespacePrefix:i,_namespaceRegexp:n,_testStorage:function(e){try{var t="__storejs__test__";e.write(t,t);var r=e.read(t)===t;return e.remove(t),r}catch(e){return!1}},_assignPluginFnProp:function(e,t){var r=this[t];this[t]=function(){var t=slice(arguments,0),i=this;function n(){if(r)return each$6(arguments,(function(e,r){t[r]=e})),r.apply(i,t)}var s=[n].concat(t);return e.apply(i,s)}},_serialize:function(e){return JSON.stringify(e)},_deserialize:function(e,t){if(!e)return t;var r="";try{r=JSON.parse(e)}catch(t){r=e}return void 0!==r?r:t},_addStorage:function(e){this.enabled||this._testStorage(e)&&(this.storage=e,this.enabled=!0)},_addPlugin:function(e){var t=this;if(isList(e))each$6(e,(function(e){t._addPlugin(e)}));else if(!pluck(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!isFunction(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!isObject(r))throw new Error("Plugins must return an object of function properties");each$6(r,(function(r,i){if(!isFunction(r))throw new Error("Bad plugin property: "+i+" from plugin "+e.name+". Plugins should only return functions.");t._assignPluginFnProp(r,i)}))}},addStorage:function(e){_warn("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(e)}},a=create(s,storeAPI,{plugins:[]});return a.raw={},each$6(a,(function(e,t){isFunction(e)&&(a.raw[t]=bind(a,e))})),each$6(e,(function(e){a._addStorage(e)})),each$6(t,(function(e){a._addPlugin(e)})),a}var util$4=util$6,Global$4=util$4.Global,localStorage_1={name:"localStorage",read:read$5,write:write$5,each:each$5,remove:remove$5,clearAll:clearAll$5};function localStorage(){return Global$4.localStorage}function read$5(e){return localStorage().getItem(e)}function write$5(e,t){return localStorage().setItem(e,t)}function each$5(e){for(var t=localStorage().length-1;t>=0;t--){var r=localStorage().key(t);e(read$5(r),r)}}function remove$5(e){return localStorage().removeItem(e)}function clearAll$5(){return localStorage().clear()}var util$3=util$6,Global$3=util$3.Global,oldFFGlobalStorage={name:"oldFF-globalStorage",read:read$4,write:write$4,each:each$4,remove:remove$4,clearAll:clearAll$4},globalStorage=Global$3.globalStorage;function read$4(e){return globalStorage[e]}function write$4(e,t){globalStorage[e]=t}function each$4(e){for(var t=globalStorage.length-1;t>=0;t--){var r=globalStorage.key(t);e(globalStorage[r],r)}}function remove$4(e){return globalStorage.removeItem(e)}function clearAll$4(){each$4((function(e,t){delete globalStorage[e]}))}var util$2=util$6,Global$2=util$2.Global,oldIEUserDataStorage={name:"oldIE-userDataStorage",write:write$3,read:read$3,each:each$3,remove:remove$3,clearAll:clearAll$3},storageName="storejs",doc$1=Global$2.document,_withStorageEl=_makeIEStorageElFunction(),disable=(Global$2.navigator?Global$2.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function write$3(e,t){if(!disable){var r=fixKey(e);_withStorageEl((function(e){e.setAttribute(r,t),e.save(storageName)}))}}function read$3(e){if(!disable){var t=fixKey(e),r=null;return _withStorageEl((function(e){r=e.getAttribute(t)})),r}}function each$3(e){_withStorageEl((function(t){for(var r=t.XMLDocument.documentElement.attributes,i=r.length-1;i>=0;i--){var n=r[i];e(t.getAttribute(n.name),n.name)}}))}function remove$3(e){var t=fixKey(e);_withStorageEl((function(e){e.removeAttribute(t),e.save(storageName)}))}function clearAll$3(){_withStorageEl((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(storageName);for(var r=t.length-1;r>=0;r--)e.removeAttribute(t[r].name);e.save(storageName)}))}var forbiddenCharsRegex=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function fixKey(e){return e.replace(/^\d/,"___$&").replace(forbiddenCharsRegex,"___")}function _makeIEStorageElFunction(){if(!doc$1||!doc$1.documentElement||!doc$1.documentElement.addBehavior)return null;var e,t,r;try{(t=new ActiveXObject("htmlfile")).open(),t.write('<script>document.w=window<\/script><iframe src="/favicon.ico"></iframe>'),t.close(),e=t.w.frames[0].document,r=e.createElement("div")}catch(t){r=doc$1.createElement("div"),e=doc$1.body}return function(t){var i=[].slice.call(arguments,0);i.unshift(r),e.appendChild(r),r.addBehavior("#default#userData"),r.load(storageName),t.apply(this,i),e.removeChild(r)}}var util$1=util$6,Global$1=util$1.Global,trim=util$1.trim,cookieStorage={name:"cookieStorage",read:read$2,write:write$2,each:each$2,remove:remove$2,clearAll:clearAll$2},doc=Global$1.document;function read$2(e){if(!e||!_has(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(doc.cookie.replace(new RegExp(t),"$1"))}function each$2(e){for(var t=doc.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(trim(t[r])){var i=t[r].split("="),n=unescape(i[0]);e(unescape(i[1]),n)}}function write$2(e,t){e&&(doc.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function remove$2(e){e&&_has(e)&&(doc.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function clearAll$2(){each$2((function(e,t){remove$2(t)}))}function _has(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(doc.cookie)}var util=util$6,Global=util.Global,sessionStorage_1={name:"sessionStorage",read:read$1,write:write$1,each:each$1,remove:remove$1,clearAll:clearAll$1};function sessionStorage(){return Global.sessionStorage}function read$1(e){return sessionStorage().getItem(e)}function write$1(e,t){return sessionStorage().setItem(e,t)}function each$1(e){for(var t=sessionStorage().length-1;t>=0;t--){var r=sessionStorage().key(t);e(read$1(r),r)}}function remove$1(e){return sessionStorage().removeItem(e)}function clearAll$1(){return sessionStorage().clear()}var memoryStorage_1={name:"memoryStorage",read:read,write:write,each:each,remove:remove,clearAll:clearAll},memoryStorage={};function read(e){return memoryStorage[e]}function write(e,t){memoryStorage[e]=t}function each(e){for(var t in memoryStorage)memoryStorage.hasOwnProperty(t)&&e(memoryStorage[t],t)}function remove(e){delete memoryStorage[e]}function clearAll(e){memoryStorage={}}var all=[localStorage_1,oldFFGlobalStorage,oldIEUserDataStorage,cookieStorage,sessionStorage_1,memoryStorage_1],json2$1={},hasRequiredJson2;function requireJson2(){return hasRequiredJson2||(hasRequiredJson2=1,"object"!=typeof JSON&&(JSON={}),function(){var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,(function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function str(e,t){var r,i,n,s,a,o=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(l)){for(s=l.length,r=0;r<s;r+=1)a[r]=str(r,l)||"null";return n=0===a.length?"[]":gap?"[\n"+gap+a.join(",\n"+gap)+"\n"+o+"]":"["+a.join(",")+"]",gap=o,n}if(rep&&"object"==typeof rep)for(s=rep.length,r=0;r<s;r+=1)"string"==typeof rep[r]&&(n=str(i=rep[r],l))&&a.push(quote(i)+(gap?": ":":")+n);else for(i in l)Object.prototype.hasOwnProperty.call(l,i)&&(n=str(i,l))&&a.push(quote(i)+(gap?": ":":")+n);return n=0===a.length?"{}":gap?"{\n"+gap+a.join(",\n"+gap)+"\n"+o+"}":"{"+a.join(",")+"}",gap=o,n}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value),"function"!=typeof JSON.stringify&&(meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,t,r){var i;if(gap="",indent="","number"==typeof r)for(i=0;i<r;i+=1)indent+=" ";else"string"==typeof r&&(indent=r);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){var j;function walk(e,t){var r,i,n=e[t];if(n&&"object"==typeof n)for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(void 0!==(i=walk(n,r))?n[r]=i:delete n[r]);return reviver.call(e,t,n)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,(function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()),json2$1}var json2=json2Plugin;function json2Plugin(){return requireJson2(),{}}var engine=storeEngine,storages=all,plugins=[json2],store_legacy=engine.createStore(storages,plugins);class SallaStorage{constructor(e){e.on("storage::item.remove",(e=>this.remove(e))),e.on("storage::item.set",((e,t)=>this.set(e,t))),this.store=store_legacy}set(e,t){if(e.includes(".")){let r=e.split(".")[0],i={[r]:store_legacy.get(r)};return i=salla.helpers.setNested(i,e,t),store_legacy.set(r,i[r])}return store_legacy.set(e,t)}remove(e){return store_legacy.remove(e)}get(e,t){if(e.includes(".")){let t=e.split(".")[0];return salla.helpers.getNested({[t]:store_legacy.get(t)},e)}return store_legacy.get(e,t)}}let event$1=new sallaEmitter,api=new SallaApi(event$1);window.Salla=window.salla={notify:Notify,api:api,event:event$1,helpers:Helpers,config:new SallaConfig,storage:new SallaStorage(event$1),cookie:new SallaCookie(event$1),lang:new SallaLang,form:new SallaForm,cart:new Action(api.cart,event$1.cart),auth:new Action(api.auth,event$1.auth),gift:new Action(api.gift,event$1.gift),order:new Action(api.order,event$1.order),scope:new Action(api.scope,event$1.scope),rating:new Action(api.rating,event$1.rating),comment:new Action(api.comment,event$1.comment),loyalty:new Action(api.loyalty,event$1.loyalty),product:new Action(api.product,event$1.product),profile:new Action(api.profile,event$1.profile),currency:new Action(api.currency,event$1.currency),document:new Action(api.document,event$1.document),twilight:new Action(api.twilight,event$1.twilight),wishlist:new Action(api.wishlist,event$1.wishlist),logger:Logger,log:Logger.log,success:Notify.success,error:Notify.error,onReady:e=>salla.isInitiated?e():salla.event.once("twilight::initiated",e),isInitiated:!1,AppHelpers:AppHelpers,infiniteScroll:new InfiniteScroll(void 0,event$1.infiniteScroll),money:Helpers.money,url:Helpers.url,init:e=>api.twilight.init(e),call:e=>{let t=salla,r=e.split(".");for(;r.length&&(t=t[r.shift()]););return t},version:require("version")};var salla$1=salla;exports.default=salla$1}));
|
|
27
|
+
*/!function(e,t){e.exports=function(){function e(){if("undefined"!=typeof document&&document.documentElement)return document.documentElement.lang}function t(e){return"-Inf"===e?-1/0:"+Inf"===e||"Inf"===e||"*"===e?1/0:parseInt(e,10)}var r=/^({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])$/,i=/({\s*(\-?\d+(\.\d+)?[\s*,\s*\-?\d+(\.\d+)?]*)\s*})|([\[\]])\s*(-Inf|\*|\-?\d+(\.\d+)?)\s*,\s*(\+?Inf|\*|\-?\d+(\.\d+)?)\s*([\[\]])/,n={locale:"en"},s=function(t){t=t||{},this.locale=t.locale||e()||n.locale,this.fallback=t.fallback,this.messages=t.messages};return s.prototype.setMessages=function(e){this.messages=e},s.prototype.getLocale=function(){return this.locale||this.fallback},s.prototype.setLocale=function(e){this.locale=e},s.prototype.getFallback=function(){return this.fallback},s.prototype.setFallback=function(e){this.fallback=e},s.prototype.has=function(e,t){return!("string"!=typeof e||!this.messages)&&null!==this._getMessage(e,t)},s.prototype.get=function(e,t,r){if(!this.has(e,r))return e;var i=this._getMessage(e,r);return null===i?e:(t&&(i=this._applyReplacements(i,t)),i)},s.prototype.trans=function(e,t){return this.get(e,t)},s.prototype.choice=function(e,t,r,n){(r=void 0!==r?r:{}).count=t;var s=this.get(e,r,n);if(null==s)return s;for(var a=s.split("|"),o=[],l=0;l<a.length;l++)if(a[l]=a[l].trim(),i.test(a[l])){var c=a[l].split(/\s/);o.push(c.shift()),a[l]=c.join(" ")}if(1===a.length)return s;for(var u=0;u<o.length;u++)if(this._testInterval(t,o[u]))return a[u];return n=n||this._getLocale(e),a[this._getPluralForm(t,n)]},s.prototype.transChoice=function(e,t,r){return this.choice(e,t,r)},s.prototype._parseKey=function(e,t){if("string"!=typeof e||"string"!=typeof t)return null;var r=e.split("."),i=r[0].replace(/\//g,".");return{source:t+"."+i,sourceFallback:this.getFallback()+"."+i,entries:r.slice(1)}},s.prototype._getMessage=function(e,t){if(t=t||this.getLocale(),e=this._parseKey(e,t),void 0===this.messages[e.source]&&void 0===this.messages[e.sourceFallback])return null;var r=this.messages[e.source],i=e.entries.slice(),n=i.join(".");if("string"!=typeof(r=void 0!==r?this._getValueInKey(r,n):void 0)&&this.messages[e.sourceFallback])for(r=this.messages[e.sourceFallback],i=e.entries.slice(),n="";i.length&&void 0!==r;)r[n=n?n.concat(".",i.shift()):i.shift()]&&(r=r[n],n="");return"string"!=typeof r?null:r},s.prototype._getValueInKey=function(e,t){if("string"==typeof e[t])return e[t];for(var r=(t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split("."),i=0,n=r.length;i<n;++i){var s=r.slice(0,i+1).join("."),a=r.slice(i+1,r.length).join(".");if(e[s])return this._getValueInKey(e[s],a)}return e},s.prototype._getLocale=function(e){return e=this._parseKey(e,this.locale),this.messages[e.source]?this.locale:this.messages[e.sourceFallback]?this.fallback:null},s.prototype._findMessageInTree=function(e,t){for(;e.length&&void 0!==t;){var r=e.join(".");if(t[r]){t=t[r];break}t=t[e.shift()]}return t},s.prototype._sortReplacementKeys=function(e,t){return t.length-e.length},s.prototype._applyReplacements=function(e,t){return Object.keys(t).sort(this._sortReplacementKeys).forEach((function(r){e=e.replace(new RegExp(":"+r,"gi"),(function(e){var i=t[r];return e===e.toUpperCase()?i.toUpperCase():e===e.replace(/\w/i,(function(e){return e.toUpperCase()}))?i.charAt(0).toUpperCase()+i.slice(1):i}))})),e},s.prototype._testInterval=function(e,i){if("string"!=typeof i)throw"Invalid interval: should be a string.";var n=(i=i.trim()).match(r);if(!n)throw"Invalid interval: "+i;if(!n[2]){var s=(n=n.filter((function(e){return!!e})))[1],a=t(n[2]);a===1/0&&(a=-1/0);var o=t(n[3]),l=n[4];return("["===s?e>=a:e>a)&&("]"===l?e<=o:e<o)}for(var c=n[2].split(","),u=0;u<c.length;u++)if(parseInt(c[u],10)===e)return!0;return!1},s.prototype._getPluralForm=function(e,t){switch(t){case"az":case"bo":case"dz":case"id":case"ja":case"jv":case"ka":case"km":case"kn":case"ko":case"ms":case"th":case"tr":case"vi":case"zh":default:return 0;case"af":case"bn":case"bg":case"ca":case"da":case"de":case"el":case"en":case"eo":case"es":case"et":case"eu":case"fa":case"fi":case"fo":case"fur":case"fy":case"gl":case"gu":case"ha":case"he":case"hu":case"is":case"it":case"ku":case"lb":case"ml":case"mn":case"mr":case"nah":case"nb":case"ne":case"nl":case"nn":case"no":case"om":case"or":case"pa":case"pap":case"ps":case"pt":case"so":case"sq":case"sv":case"sw":case"ta":case"te":case"tk":case"ur":case"zu":return 1==e?0:1;case"am":case"bh":case"fil":case"fr":case"gun":case"hi":case"hy":case"ln":case"mg":case"nso":case"xbr":case"ti":case"wa":return 0===e||1===e?0:1;case"be":case"bs":case"hr":case"ru":case"sr":case"uk":return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2;case"cs":case"sk":return 1==e?0:e>=2&&e<=4?1:2;case"ga":return 1==e?0:2==e?1:2;case"lt":return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2;case"sl":return e%100==1?0:e%100==2?1:e%100==3||e%100==4?2:3;case"mk":return e%10==1?0:1;case"mt":return 1==e?0:0===e||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3;case"lv":return 0===e?0:e%10==1&&e%100!=11?1:2;case"pl":return 1==e?0:e%10>=2&&e%10<=4&&(e%100<12||e%100>14)?1:2;case"cy":return 1==e?0:2==e?1:8==e||11==e?2:3;case"ro":return 1==e?0:0===e||e%100>0&&e%100<20?1:2;case"ar":return 0===e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5}},s}()}(lang);var Lang=lang.exports;class SallaLang extends Lang{constructor(e){(e=e||{}).messages=e.messages||window.translations,e.locale=e.locale||(window.locale||navigator.language||navigator.userLanguage||"ar").split("-")[0],e.fallback=e.fallback||e.locale,super(e),this.translationsLoaded=!1}onLoaded(e){if(this.translationsLoaded)return e();salla.event.once("languages::translations.loaded",e)}loadStoreTranslations(){if(this.messages)return void window.addEventListener("load",(e=>{salla.event.dispatch("languages::translations.loaded"),salla.logger.info("The messages of transactions is already loaded")}));if(!salla.url.get(""))return this.messages&&salla.event.dispatch("languages::translations.loaded"),this.translationsLoaded=!0,void salla.logger.warn("There is no `store.url` to auto loading translations from it!");let e=salla.config.get("theme.translations_hash",salla.config.get("store.id","twilight")),t=document.createElement("script");t.src=salla.url.get(`languages/assets/${e}.js`),t.onload=()=>{if(window.translations)return this.setMessages(window.translations),salla.event.dispatch("languages::translations.loaded"),void(this.translationsLoaded=!0);console.warn('You should load Salla Translations Before!\nUse: <script src="{{ link("languages/assets/{theme.translations_hash}.js") }}"><\/script>\nor: salla.lang.setMessages({....}), see https://github.com/rmariuzzo/Lang.js for more informations.')},document.head.appendChild(t)}get(e,t,r){return window.translations&&(e="trans."+e),super.get(e,t,r)}set(e,t){return salla.helpers.setNested(this.messages[this.getLocale()+".trans"],e,t),this}}var assign=make_assign(),create$1=make_create(),trim$1=make_trim(),Global$5="undefined"!=typeof window?window:commonjsGlobal,util$6={assign:assign,create:create$1,trim:trim$1,bind:bind$1,slice:slice$1,each:each$7,map:map,pluck:pluck$1,isList:isList$1,isFunction:isFunction$1,isObject:isObject$1,Global:Global$5};function make_assign(){return Object.assign?Object.assign:function(e,t,r,i){for(var n=1;n<arguments.length;n++)each$7(Object(arguments[n]),(function(t,r){e[r]=t}));return e}}function make_create(){if(Object.create)return function(e,t,r,i){var n=slice$1(arguments,1);return assign.apply(this,[Object.create(e)].concat(n))};{function e(){}return function(t,r,i,n){var s=slice$1(arguments,1);return e.prototype=t,assign.apply(this,[new e].concat(s))}}}function make_trim(){return String.prototype.trim?function(e){return String.prototype.trim.call(e)}:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}}function bind$1(e,t){return function(){return t.apply(e,Array.prototype.slice.call(arguments,0))}}function slice$1(e,t){return Array.prototype.slice.call(e,t||0)}function each$7(e,t){pluck$1(e,(function(e,r){return t(e,r),!1}))}function map(e,t){var r=isList$1(e)?[]:{};return pluck$1(e,(function(e,i){return r[i]=t(e,i),!1})),r}function pluck$1(e,t){if(isList$1(e)){for(var r=0;r<e.length;r++)if(t(e[r],r))return e[r]}else for(var i in e)if(e.hasOwnProperty(i)&&t(e[i],i))return e[i]}function isList$1(e){return null!=e&&"function"!=typeof e&&"number"==typeof e.length}function isFunction$1(e){return e&&"[object Function]"==={}.toString.call(e)}function isObject$1(e){return e&&"[object Object]"==={}.toString.call(e)}var util$5=util$6,slice=util$5.slice,pluck=util$5.pluck,each$6=util$5.each,bind=util$5.bind,create=util$5.create,isList=util$5.isList,isFunction=util$5.isFunction,isObject=util$5.isObject,storeEngine={createStore:createStore},storeAPI={version:"2.0.12",enabled:!1,get:function(e,t){var r=this.storage.read(this._namespacePrefix+e);return this._deserialize(r,t)},set:function(e,t){return void 0===t?this.remove(e):(this.storage.write(this._namespacePrefix+e,this._serialize(t)),t)},remove:function(e){this.storage.remove(this._namespacePrefix+e)},each:function(e){var t=this;this.storage.each((function(r,i){e.call(t,t._deserialize(r),(i||"").replace(t._namespaceRegexp,""))}))},clearAll:function(){this.storage.clearAll()},hasNamespace:function(e){return this._namespacePrefix=="__storejs_"+e+"_"},createStore:function(){return createStore.apply(this,arguments)},addPlugin:function(e){this._addPlugin(e)},namespace:function(e){return createStore(this.storage,this.plugins,e)}};function _warn(){var e="undefined"==typeof console?null:console;if(e){var t=e.warn?e.warn:e.log;t.apply(e,arguments)}}function createStore(e,t,r){r||(r=""),e&&!isList(e)&&(e=[e]),t&&!isList(t)&&(t=[t]);var i=r?"__storejs_"+r+"_":"",n=r?new RegExp("^"+i):null;if(!/^[a-zA-Z0-9_\-]*$/.test(r))throw new Error("store.js namespaces can only have alphanumerics + underscores and dashes");var s={_namespacePrefix:i,_namespaceRegexp:n,_testStorage:function(e){try{var t="__storejs__test__";e.write(t,t);var r=e.read(t)===t;return e.remove(t),r}catch(e){return!1}},_assignPluginFnProp:function(e,t){var r=this[t];this[t]=function(){var t=slice(arguments,0),i=this;function n(){if(r)return each$6(arguments,(function(e,r){t[r]=e})),r.apply(i,t)}var s=[n].concat(t);return e.apply(i,s)}},_serialize:function(e){return JSON.stringify(e)},_deserialize:function(e,t){if(!e)return t;var r="";try{r=JSON.parse(e)}catch(t){r=e}return void 0!==r?r:t},_addStorage:function(e){this.enabled||this._testStorage(e)&&(this.storage=e,this.enabled=!0)},_addPlugin:function(e){var t=this;if(isList(e))each$6(e,(function(e){t._addPlugin(e)}));else if(!pluck(this.plugins,(function(t){return e===t}))){if(this.plugins.push(e),!isFunction(e))throw new Error("Plugins must be function values that return objects");var r=e.call(this);if(!isObject(r))throw new Error("Plugins must return an object of function properties");each$6(r,(function(r,i){if(!isFunction(r))throw new Error("Bad plugin property: "+i+" from plugin "+e.name+". Plugins should only return functions.");t._assignPluginFnProp(r,i)}))}},addStorage:function(e){_warn("store.addStorage(storage) is deprecated. Use createStore([storages])"),this._addStorage(e)}},a=create(s,storeAPI,{plugins:[]});return a.raw={},each$6(a,(function(e,t){isFunction(e)&&(a.raw[t]=bind(a,e))})),each$6(e,(function(e){a._addStorage(e)})),each$6(t,(function(e){a._addPlugin(e)})),a}var util$4=util$6,Global$4=util$4.Global,localStorage_1={name:"localStorage",read:read$5,write:write$5,each:each$5,remove:remove$5,clearAll:clearAll$5};function localStorage(){return Global$4.localStorage}function read$5(e){return localStorage().getItem(e)}function write$5(e,t){return localStorage().setItem(e,t)}function each$5(e){for(var t=localStorage().length-1;t>=0;t--){var r=localStorage().key(t);e(read$5(r),r)}}function remove$5(e){return localStorage().removeItem(e)}function clearAll$5(){return localStorage().clear()}var util$3=util$6,Global$3=util$3.Global,oldFFGlobalStorage={name:"oldFF-globalStorage",read:read$4,write:write$4,each:each$4,remove:remove$4,clearAll:clearAll$4},globalStorage=Global$3.globalStorage;function read$4(e){return globalStorage[e]}function write$4(e,t){globalStorage[e]=t}function each$4(e){for(var t=globalStorage.length-1;t>=0;t--){var r=globalStorage.key(t);e(globalStorage[r],r)}}function remove$4(e){return globalStorage.removeItem(e)}function clearAll$4(){each$4((function(e,t){delete globalStorage[e]}))}var util$2=util$6,Global$2=util$2.Global,oldIEUserDataStorage={name:"oldIE-userDataStorage",write:write$3,read:read$3,each:each$3,remove:remove$3,clearAll:clearAll$3},storageName="storejs",doc$1=Global$2.document,_withStorageEl=_makeIEStorageElFunction(),disable=(Global$2.navigator?Global$2.navigator.userAgent:"").match(/ (MSIE 8|MSIE 9|MSIE 10)\./);function write$3(e,t){if(!disable){var r=fixKey(e);_withStorageEl((function(e){e.setAttribute(r,t),e.save(storageName)}))}}function read$3(e){if(!disable){var t=fixKey(e),r=null;return _withStorageEl((function(e){r=e.getAttribute(t)})),r}}function each$3(e){_withStorageEl((function(t){for(var r=t.XMLDocument.documentElement.attributes,i=r.length-1;i>=0;i--){var n=r[i];e(t.getAttribute(n.name),n.name)}}))}function remove$3(e){var t=fixKey(e);_withStorageEl((function(e){e.removeAttribute(t),e.save(storageName)}))}function clearAll$3(){_withStorageEl((function(e){var t=e.XMLDocument.documentElement.attributes;e.load(storageName);for(var r=t.length-1;r>=0;r--)e.removeAttribute(t[r].name);e.save(storageName)}))}var forbiddenCharsRegex=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");function fixKey(e){return e.replace(/^\d/,"___$&").replace(forbiddenCharsRegex,"___")}function _makeIEStorageElFunction(){if(!doc$1||!doc$1.documentElement||!doc$1.documentElement.addBehavior)return null;var e,t,r;try{(t=new ActiveXObject("htmlfile")).open(),t.write('<script>document.w=window<\/script><iframe src="/favicon.ico"></iframe>'),t.close(),e=t.w.frames[0].document,r=e.createElement("div")}catch(t){r=doc$1.createElement("div"),e=doc$1.body}return function(t){var i=[].slice.call(arguments,0);i.unshift(r),e.appendChild(r),r.addBehavior("#default#userData"),r.load(storageName),t.apply(this,i),e.removeChild(r)}}var util$1=util$6,Global$1=util$1.Global,trim=util$1.trim,cookieStorage={name:"cookieStorage",read:read$2,write:write$2,each:each$2,remove:remove$2,clearAll:clearAll$2},doc=Global$1.document;function read$2(e){if(!e||!_has(e))return null;var t="(?:^|.*;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*((?:[^;](?!;))*[^;]?).*";return unescape(doc.cookie.replace(new RegExp(t),"$1"))}function each$2(e){for(var t=doc.cookie.split(/; ?/g),r=t.length-1;r>=0;r--)if(trim(t[r])){var i=t[r].split("="),n=unescape(i[0]);e(unescape(i[1]),n)}}function write$2(e,t){e&&(doc.cookie=escape(e)+"="+escape(t)+"; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/")}function remove$2(e){e&&_has(e)&&(doc.cookie=escape(e)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/")}function clearAll$2(){each$2((function(e,t){remove$2(t)}))}function _has(e){return new RegExp("(?:^|;\\s*)"+escape(e).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(doc.cookie)}var util=util$6,Global=util.Global,sessionStorage_1={name:"sessionStorage",read:read$1,write:write$1,each:each$1,remove:remove$1,clearAll:clearAll$1};function sessionStorage(){return Global.sessionStorage}function read$1(e){return sessionStorage().getItem(e)}function write$1(e,t){return sessionStorage().setItem(e,t)}function each$1(e){for(var t=sessionStorage().length-1;t>=0;t--){var r=sessionStorage().key(t);e(read$1(r),r)}}function remove$1(e){return sessionStorage().removeItem(e)}function clearAll$1(){return sessionStorage().clear()}var memoryStorage_1={name:"memoryStorage",read:read,write:write,each:each,remove:remove,clearAll:clearAll},memoryStorage={};function read(e){return memoryStorage[e]}function write(e,t){memoryStorage[e]=t}function each(e){for(var t in memoryStorage)memoryStorage.hasOwnProperty(t)&&e(memoryStorage[t],t)}function remove(e){delete memoryStorage[e]}function clearAll(e){memoryStorage={}}var all=[localStorage_1,oldFFGlobalStorage,oldIEUserDataStorage,cookieStorage,sessionStorage_1,memoryStorage_1],json2$1={},hasRequiredJson2;function requireJson2(){return hasRequiredJson2||(hasRequiredJson2=1,"object"!=typeof JSON&&(JSON={}),function(){var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta,rep;function f(e){return e<10?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,(function(e){var t=meta[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'}function str(e,t){var r,i,n,s,a,o=gap,l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),"function"==typeof rep&&(l=rep.call(t,e,l)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(gap+=indent,a=[],"[object Array]"===Object.prototype.toString.apply(l)){for(s=l.length,r=0;r<s;r+=1)a[r]=str(r,l)||"null";return n=0===a.length?"[]":gap?"[\n"+gap+a.join(",\n"+gap)+"\n"+o+"]":"["+a.join(",")+"]",gap=o,n}if(rep&&"object"==typeof rep)for(s=rep.length,r=0;r<s;r+=1)"string"==typeof rep[r]&&(n=str(i=rep[r],l))&&a.push(quote(i)+(gap?": ":":")+n);else for(i in l)Object.prototype.hasOwnProperty.call(l,i)&&(n=str(i,l))&&a.push(quote(i)+(gap?": ":":")+n);return n=0===a.length?"{}":gap?"{\n"+gap+a.join(",\n"+gap)+"\n"+o+"}":"{"+a.join(",")+"}",gap=o,n}}"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value),"function"!=typeof JSON.stringify&&(meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,t,r){var i;if(gap="",indent="","number"==typeof r)for(i=0;i<r;i+=1)indent+=" ";else"string"==typeof r&&(indent=r);if(rep=t,t&&"function"!=typeof t&&("object"!=typeof t||"number"!=typeof t.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){var j;function walk(e,t){var r,i,n=e[t];if(n&&"object"==typeof n)for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(void 0!==(i=walk(n,r))?n[r]=i:delete n[r]);return reviver.call(e,t,n)}if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,(function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()),json2$1}var json2=json2Plugin;function json2Plugin(){return requireJson2(),{}}var engine=storeEngine,storages=all,plugins=[json2],store_legacy=engine.createStore(storages,plugins);class SallaStorage{constructor(e){e.on("storage::item.remove",(e=>this.remove(e))),e.on("storage::item.set",((e,t)=>this.set(e,t))),this.store=store_legacy}set(e,t){if(e.includes(".")){let r=e.split(".")[0],i={[r]:store_legacy.get(r)};return i=salla.helpers.setNested(i,e,t),store_legacy.set(r,i[r])}return store_legacy.set(e,t)}remove(e){return store_legacy.remove(e)}get(e,t){if(e.includes(".")){let t=e.split(".")[0];return salla.helpers.getNested({[t]:store_legacy.get(t)},e)}return store_legacy.get(e,t)}}let event$1=new sallaEmitter,api=new SallaApi(event$1);window.Salla=window.salla={notify:Notify,api:api,event:event$1,helpers:Helpers,config:new SallaConfig,storage:new SallaStorage(event$1),cookie:new SallaCookie(event$1),lang:new SallaLang,form:new SallaForm,cart:new Action(api.cart,event$1.cart),auth:new Action(api.auth,event$1.auth),gift:new Action(api.gift,event$1.gift),order:new Action(api.order,event$1.order),scope:new Action(api.scope,event$1.scope),rating:new Action(api.rating,event$1.rating),comment:new Action(api.comment,event$1.comment),loyalty:new Action(api.loyalty,event$1.loyalty),product:new Action(api.product,event$1.product),profile:new Action(api.profile,event$1.profile),currency:new Action(api.currency,event$1.currency),document:new Action(api.document,event$1.document),twilight:new Action(api.twilight,event$1.twilight),wishlist:new Action(api.wishlist,event$1.wishlist),logger:Logger,log:Logger.log,success:Notify.success,error:Notify.error,onReady:e=>salla.isInitiated?e():salla.event.once("twilight::initiated",e),isInitiated:!1,AppHelpers:AppHelpers,infiniteScroll:new InfiniteScroll(void 0,event$1.infiniteScroll),money:Helpers.money,url:Helpers.url,init:e=>api.twilight.init(e),call:e=>{let t=salla,r=e.split(".");for(;r.length&&(t=t[r.shift()]););return t},version:require("./version")};var salla$1=salla;exports.default=salla$1}));
|
|
28
28
|
//# sourceMappingURL=twilight.min.js.map
|