@jolibox/sdk 1.0.11-beta.0 → 1.0.11-beta.2

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/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var v=(i,o)=>{for(var t in o)f(i,t,{get:o[t],enumerable:!0})},k=(i,o,t,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of J(o))!L.call(i,e)&&e!==t&&f(i,e,{get:()=>o[e],enumerable:!(a=j(o,e))||a.enumerable});return i};var A=i=>k(f({},"__esModule",{value:!0}),i);var m=(i,o,t)=>new Promise((a,e)=>{var l=r=>{try{n(t.next(r))}catch(d){e(d)}},s=r=>{try{n(t.throw(r))}catch(d){e(d)}},n=r=>r.done?a(r.value):Promise.resolve(r.value).then(l,s);n((t=t.apply(i,o)).next())});var D={};v(D,{JoliboxSDK:()=>p,default:()=>_});module.exports=A(D);var x=i=>{var n,r,d;let o=i.split("-")[1];o&&(i=i.replace(`-${o}`,""));let t=i.split("+")[1];t&&(i=i.replace(`+${t}`,""));let a=i.split(".").slice(0,3),[e,l,s]=[(n=a[0])!=null?n:"0",(r=a[1])!=null?r:"0",(d=a[2])!=null?d:"0"];return{major:e,minor:l,patch:s,prerelease:o,build:t}},w=i=>parseInt(x(i).major,10),I=(i,o)=>{let{major:t,minor:a,patch:e}=x(i),{major:l,minor:s,patch:n}=x(o);return t!==l?t>l?1:-1:a!==s?a>s?1:-1:e!==n?e>n?1:-1:0};var S="jolibox-sdk-loader-metadata",g=class{constructor({loaderMetadata:o}={}){this.computeLoaderMetaData=()=>{var e,l;let o=this.currentVersion,t=null;try{if(t=JSON.parse((e=localStorage.getItem(S))!=null?e:"null"),!t||!t.version)throw new Error("Invalid loader metadata")}catch(s){t=this.defaultMetadata}let a=(l=t==null?void 0:t.version)!=null?l:o;return w(a)!==w(o)?t=this.defaultMetadata:I(a,o)<0&&(t=this.defaultMetadata),t};this.loadScript=()=>{if(this.loaderMetadata.syncScriptUrl){let o=new XMLHttpRequest;o.open("GET",this.loaderMetadata.syncScriptUrl,!1),o.send();let t=document.createElement("script");t.type="text/javascript",t.innerHTML=o.responseText,document.head.appendChild(t)}if(this.loaderMetadata.asyncScriptUrl){let o=document.createElement("script");o.type="text/javascript",o.src=this.loaderMetadata.asyncScriptUrl,o.async=!0,document.head.appendChild(o)}};this.fetchUpdateLoaderMetadata=(...l)=>m(this,[...l],function*(o=this.currentVersion,t=this.loaderMetadata.version,a=(e=>(e=window.JOLIBOX_ENV)!=null?e:"WEB")()){var n,r,d;let s=`${(r=(n=window.joliboxenv)==null?void 0:n.apiBaseURL)!=null?r:"https://api.jolibox.com"}/frontend/js-sdk/loader-metadata`;try{let b=yield(yield fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installedSDKVersion:o,localSDKVersion:t,env:a})})).json();if(b.code!=="SUCCESS")throw new Error(b.message);this.loaderMetadata=(d=b.data)!=null?d:this.defaultMetadata,localStorage.setItem(S,JSON.stringify(this.loaderMetadata))}catch(c){console.warn("Failed to fetch loader metadata: ",c)}});console.log("Loading Jolibox SDK..."),this.loaderMetadata=o!=null?o:this.computeLoaderMetaData(),this.loadScript(),this.fetchUpdateLoaderMetadata(),console.log("Jolibox SDK loaded.")}get currentVersion(){return window.__JOLIBOX_LOCAL_SDK_VERSION__}get defaultMetadata(){let o=this.currentVersion,t=w(o);return{version:o,syncScriptUrl:`https://cdn.jsdelivr.net/npm/@jolibox/web-sync-sdk@${t}/dist/index.iife.js`,asyncScriptUrl:`https://cdn.jsdelivr.net/npm/@jolibox/web-async-sdk@${t}/dist/index.iife.js`}}};window.JoliboxSDKLoader=g;var u=class{constructor(){this.init=o=>{window.joliboxsdk._commandPipe.push({cmd:"ads.init",params:o})};this.adConfig=o=>{window.joliboxsdk._commandPipe.push({cmd:"ads.adConfig",params:o})};this.adBreak=o=>{window.joliboxsdk._commandPipe.push({cmd:"ads.adBreak",params:o})};this.adUnit=o=>m(this,null,function*(){window.joliboxsdk._commandPipe.push({cmd:"ads.adUnit",params:o})})}};window.JoliboxAds=u;var h=class{constructor(){this.trackEvent=(o,t)=>{if(typeof o!="string")throw new Error("eventName must be a string");if(t!==null&&typeof t!="object"&&t!==void 0)throw new Error("extra must be an object or null or undefined");if(t){for(let a in t)if(typeof t[a]=="object")throw new Error("extra must not have nested objects")}window.joliboxsdk._commandPipe.push({cmd:"analytics.trackEvent",params:[o,t]})}}};window.JoliboxAnalytics=h;var y=require("@jolibox/web-sync-sdk");var F=require("@jolibox/web-sync-sdk");window.__JOLIBOX_LOCAL_SDK_VERSION__="1.0.11-beta.0";var p=class{constructor({useRuntimeSDK:o=!0,loaderConfig:t,testMode:a,apiBaseURL:e}={}){this.hostToApiMap={default:{test:"https://stg-api.jolibox.com",prod:"https://api.jolibox.com"},"oss.jolibox.com":{test:"https://stg-api.jolibox.com",prod:"https://api.jolibox.com"},"oss.pico-game.com":{test:"https://stg-api.pico-game.com",prod:"https://api.pico-game.com"}};this.setJoliboxEnv=(o,t)=>{var d;let e=typeof window<"u"?new URLSearchParams(window.location.search):null,l=(e==null?void 0:e.get("testMode"))==="true",s=o!=null?o:l,n=e==null?void 0:e.get("apiBaseURL"),r;if(t)r=t;else if(n)r=n;else{let c=(d=this.hostToApiMap[window.location.host])!=null?d:this.hostToApiMap.default;r=s?c.test:c.prod}window.joliboxenv={testMode:s,apiBaseURL:r}};var l,s,n,r,d;this.setJoliboxEnv(a,e),o&&window.joliboxsdk?(this.loader=(l=window.joliboxsdk.loader)!=null?l:new window.JoliboxSDKLoader(t),this.ads=(s=window.joliboxsdk.ads)!=null?s:new window.JoliboxAds,this.anaytics=(n=window.joliboxsdk.anaytics)!=null?n:new window.JoliboxAnalytics,this.runtime=(r=window.joliboxsdk.runtime)!=null?r:new window.JoliboxRuntime,this.storage=(d=window.joliboxsdk.storage)!=null?d:new window.JoliboxCloudStorage):(window.joliboxsdk||(window.joliboxsdk={_commandPipe:[]}),this.loader=new window.JoliboxSDKLoader(t),this.ads=new window.JoliboxAds,this.anaytics=new window.JoliboxAnalytics,this.runtime=new window.JoliboxRuntime,this.storage=new window.JoliboxCloudStorage,window.joliboxsdk=Object.assign(this,window.joliboxsdk)),window.joliboxsdk._commandPipe||(window.joliboxsdk._commandPipe=[])}};window.JoliboxSDK||(window.JoliboxSDK=p);var _=p;0&&(module.exports={JoliboxSDK});
1
+ "use strict";var f=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var L=Object.prototype.hasOwnProperty;var v=(i,o)=>{for(var t in o)f(i,t,{get:o[t],enumerable:!0})},k=(i,o,t,a)=>{if(o&&typeof o=="object"||typeof o=="function")for(let e of J(o))!L.call(i,e)&&e!==t&&f(i,e,{get:()=>o[e],enumerable:!(a=j(o,e))||a.enumerable});return i};var A=i=>k(f({},"__esModule",{value:!0}),i);var m=(i,o,t)=>new Promise((a,e)=>{var l=r=>{try{n(t.next(r))}catch(d){e(d)}},s=r=>{try{n(t.throw(r))}catch(d){e(d)}},n=r=>r.done?a(r.value):Promise.resolve(r.value).then(l,s);n((t=t.apply(i,o)).next())});var D={};v(D,{JoliboxSDK:()=>p,default:()=>_});module.exports=A(D);var x=i=>{var n,r,d;let o=i.split("-")[1];o&&(i=i.replace(`-${o}`,""));let t=i.split("+")[1];t&&(i=i.replace(`+${t}`,""));let a=i.split(".").slice(0,3),[e,l,s]=[(n=a[0])!=null?n:"0",(r=a[1])!=null?r:"0",(d=a[2])!=null?d:"0"];return{major:e,minor:l,patch:s,prerelease:o,build:t}},w=i=>parseInt(x(i).major,10),I=(i,o)=>{let{major:t,minor:a,patch:e}=x(i),{major:l,minor:s,patch:n}=x(o);return t!==l?t>l?1:-1:a!==s?a>s?1:-1:e!==n?e>n?1:-1:0};var S="jolibox-sdk-loader-metadata",g=class{constructor({loaderMetadata:o}={}){this.computeLoaderMetaData=()=>{var e,l;let o=this.currentVersion,t=null;try{if(t=JSON.parse((e=localStorage.getItem(S))!=null?e:"null"),!t||!t.version)throw new Error("Invalid loader metadata")}catch(s){t=this.defaultMetadata}let a=(l=t==null?void 0:t.version)!=null?l:o;return w(a)!==w(o)?t=this.defaultMetadata:I(a,o)<0&&(t=this.defaultMetadata),t};this.loadScript=()=>{if(this.loaderMetadata.syncScriptUrl){let o=new XMLHttpRequest;o.open("GET",this.loaderMetadata.syncScriptUrl,!1),o.send();let t=document.createElement("script");t.type="text/javascript",t.innerHTML=o.responseText,document.head.appendChild(t)}if(this.loaderMetadata.asyncScriptUrl){let o=document.createElement("script");o.type="text/javascript",o.src=this.loaderMetadata.asyncScriptUrl,o.async=!0,document.head.appendChild(o)}};this.fetchUpdateLoaderMetadata=(...l)=>m(this,[...l],function*(o=this.currentVersion,t=this.loaderMetadata.version,a=(e=>(e=window.JOLIBOX_ENV)!=null?e:"WEB")()){var n,r,d;let s=`${(r=(n=window.joliboxenv)==null?void 0:n.apiBaseURL)!=null?r:"https://api.jolibox.com"}/frontend/js-sdk/loader-metadata`;try{let b=yield(yield fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installedSDKVersion:o,localSDKVersion:t,env:a})})).json();if(b.code!=="SUCCESS")throw new Error(b.message);this.loaderMetadata=(d=b.data)!=null?d:this.defaultMetadata,localStorage.setItem(S,JSON.stringify(this.loaderMetadata))}catch(c){console.warn("Failed to fetch loader metadata: ",c)}});console.log("Loading Jolibox SDK..."),this.loaderMetadata=o!=null?o:this.computeLoaderMetaData(),this.loadScript(),this.fetchUpdateLoaderMetadata(),console.log("Jolibox SDK loaded.")}get currentVersion(){return window.__JOLIBOX_LOCAL_SDK_VERSION__}get defaultMetadata(){let o=this.currentVersion,t=w(o);return{version:o,syncScriptUrl:`https://cdn.jsdelivr.net/npm/@jolibox/web-sync-sdk@${t}/dist/index.iife.js`,asyncScriptUrl:`https://cdn.jsdelivr.net/npm/@jolibox/web-async-sdk@${t}/dist/index.iife.js`}}};window.JoliboxSDKLoader=g;var u=class{constructor(){this.init=o=>{window.joliboxsdk._commandPipe.push({cmd:"ads.init",params:o})};this.adConfig=o=>{window.joliboxsdk._commandPipe.push({cmd:"ads.adConfig",params:o})};this.adBreak=o=>{window.joliboxsdk._commandPipe.push({cmd:"ads.adBreak",params:o})};this.adUnit=o=>m(this,null,function*(){window.joliboxsdk._commandPipe.push({cmd:"ads.adUnit",params:o})})}};window.JoliboxAds=u;var h=class{constructor(){this.trackEvent=(o,t)=>{if(typeof o!="string")throw new Error("eventName must be a string");if(t!==null&&typeof t!="object"&&t!==void 0)throw new Error("extra must be an object or null or undefined");if(t){for(let a in t)if(typeof t[a]=="object")throw new Error("extra must not have nested objects")}window.joliboxsdk._commandPipe.push({cmd:"analytics.trackEvent",params:[o,t]})}}};window.JoliboxAnalytics=h;var y=require("@jolibox/web-sync-sdk");var F=require("@jolibox/web-sync-sdk");window.__JOLIBOX_LOCAL_SDK_VERSION__="1.0.11-beta.2";var p=class{constructor({useRuntimeSDK:o=!0,loaderConfig:t,testMode:a,apiBaseURL:e}={}){this.hostToApiMap={default:{test:"https://stg-api.jolibox.com",prod:"https://api.jolibox.com"},"oss.jolibox.com":{test:"https://stg-api.jolibox.com",prod:"https://api.jolibox.com"},"oss.pico-game.com":{test:"https://stg-api.pico-game.com",prod:"https://api.pico-game.com"}};this.setJoliboxEnv=(o,t)=>{var d;let e=typeof window<"u"?new URLSearchParams(window.location.search):null,l=(e==null?void 0:e.get("testMode"))==="true",s=o!=null?o:l,n=e==null?void 0:e.get("apiBaseURL"),r;if(t)r=t;else if(n)r=n;else{let c=(d=this.hostToApiMap[window.location.host])!=null?d:this.hostToApiMap.default;r=s?c.test:c.prod}window.joliboxenv={testMode:s,apiBaseURL:r}};var l,s,n,r,d;this.setJoliboxEnv(a,e),o&&window.joliboxsdk?(this.loader=(l=window.joliboxsdk.loader)!=null?l:new window.JoliboxSDKLoader(t),this.ads=(s=window.joliboxsdk.ads)!=null?s:new window.JoliboxAds,this.anaytics=(n=window.joliboxsdk.anaytics)!=null?n:new window.JoliboxAnalytics,this.runtime=(r=window.joliboxsdk.runtime)!=null?r:new window.JoliboxRuntime,this.storage=(d=window.joliboxsdk.storage)!=null?d:new window.JoliboxCloudStorage):(window.joliboxsdk||(window.joliboxsdk={_commandPipe:[]}),this.loader=new window.JoliboxSDKLoader(t),this.ads=new window.JoliboxAds,this.anaytics=new window.JoliboxAnalytics,this.runtime=new window.JoliboxRuntime,this.storage=new window.JoliboxCloudStorage,window.joliboxsdk=Object.assign(this,window.joliboxsdk)),window.joliboxsdk._commandPipe||(window.joliboxsdk._commandPipe=[])}};window.JoliboxSDK||(window.JoliboxSDK=p);var _=p;0&&(module.exports={JoliboxSDK});
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1,4 +1,4 @@
1
- "use strict";(()=>{var gr=Object.create;var et=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var br=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,_r=Object.prototype.hasOwnProperty;var ne=(u=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(u,{get:(s,l)=>(typeof require<"u"?require:s)[l]}):u)(function(u){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+u+'" is not supported')});var Sr=(u,s)=>()=>(s||u((s={exports:{}}).exports,s),s.exports);var Ir=(u,s,l,_)=>{if(s&&typeof s=="object"||typeof s=="function")for(let m of br(s))!_r.call(u,m)&&m!==l&&et(u,m,{get:()=>s[m],enumerable:!(_=yr(s,m))||_.enumerable});return u};var xr=(u,s,l)=>(l=u!=null?gr(wr(u)):{},Ir(s||!u||!u.__esModule?et(l,"default",{value:u,enumerable:!0}):l,u));var ue=(u,s,l)=>new Promise((_,m)=>{var x=g=>{try{S(l.next(g))}catch(I){m(I)}},b=g=>{try{S(l.throw(g))}catch(I){m(I)}},S=g=>g.done?_(g.value):Promise.resolve(g.value).then(x,b);S((l=l.apply(u,s)).next())});var ot=Sr((nt,Ae)=>{"use strict";(function(u){if(typeof nt=="object"&&typeof Ae<"u")Ae.exports=u();else if(typeof define=="function"&&define.amd)define([],u);else{var s;typeof window<"u"?s=window:typeof global<"u"?s=global:typeof self<"u"?s=self:s=this,s.localforage=u()}})(function(){var u,s,l;return function _(m,x,b){function S(A,J){if(!x[A]){if(!m[A]){var v=typeof ne=="function"&&ne;if(!J&&v)return v(A,!0);if(g)return g(A,!0);var w=new Error("Cannot find module '"+A+"'");throw w.code="MODULE_NOT_FOUND",w}var N=x[A]={exports:{}};m[A][0].call(N.exports,function(B){var V=m[A][1][B];return S(V||B)},N,N.exports,_,m,x,b)}return x[A].exports}for(var g=typeof ne=="function"&&ne,I=0;I<b.length;I++)S(b[I]);return S}({1:[function(_,m,x){(function(b){"use strict";var S=b.MutationObserver||b.WebKitMutationObserver,g;if(S){var I=0,A=new S(B),J=b.document.createTextNode("");A.observe(J,{characterData:!0}),g=function(){J.data=I=++I%2}}else if(!b.setImmediate&&typeof b.MessageChannel<"u"){var v=new b.MessageChannel;v.port1.onmessage=B,g=function(){v.port2.postMessage(0)}}else"document"in b&&"onreadystatechange"in b.document.createElement("script")?g=function(){var U=b.document.createElement("script");U.onreadystatechange=function(){B(),U.onreadystatechange=null,U.parentNode.removeChild(U),U=null},b.document.documentElement.appendChild(U)}:g=function(){setTimeout(B,0)};var w,N=[];function B(){w=!0;for(var U,W,M=N.length;M;){for(W=N,N=[],U=-1;++U<M;)W[U]();M=N.length}w=!1}m.exports=V;function V(U){N.push(U)===1&&!w&&g()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(_,m,x){"use strict";var b=_(1);function S(){}var g={},I=["REJECTED"],A=["FULFILLED"],J=["PENDING"];m.exports=v;function v(p){if(typeof p!="function")throw new TypeError("resolver must be a function");this.state=J,this.queue=[],this.outcome=void 0,p!==S&&V(this,p)}v.prototype.catch=function(p){return this.then(null,p)},v.prototype.then=function(p,D){if(typeof p!="function"&&this.state===A||typeof D!="function"&&this.state===I)return this;var R=new this.constructor(S);if(this.state!==J){var T=this.state===A?p:D;N(R,T,this.outcome)}else this.queue.push(new w(R,p,D));return R};function w(p,D,R){this.promise=p,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof R=="function"&&(this.onRejected=R,this.callRejected=this.otherCallRejected)}w.prototype.callFulfilled=function(p){g.resolve(this.promise,p)},w.prototype.otherCallFulfilled=function(p){N(this.promise,this.onFulfilled,p)},w.prototype.callRejected=function(p){g.reject(this.promise,p)},w.prototype.otherCallRejected=function(p){N(this.promise,this.onRejected,p)};function N(p,D,R){b(function(){var T;try{T=D(R)}catch(j){return g.reject(p,j)}T===p?g.reject(p,new TypeError("Cannot resolve promise with itself")):g.resolve(p,T)})}g.resolve=function(p,D){var R=U(B,D);if(R.status==="error")return g.reject(p,R.value);var T=R.value;if(T)V(p,T);else{p.state=A,p.outcome=D;for(var j=-1,F=p.queue.length;++j<F;)p.queue[j].callFulfilled(D)}return p},g.reject=function(p,D){p.state=I,p.outcome=D;for(var R=-1,T=p.queue.length;++R<T;)p.queue[R].callRejected(D);return p};function B(p){var D=p&&p.then;if(p&&(typeof p=="object"||typeof p=="function")&&typeof D=="function")return function(){D.apply(p,arguments)}}function V(p,D){var R=!1;function T(k){R||(R=!0,g.reject(p,k))}function j(k){R||(R=!0,g.resolve(p,k))}function F(){D(j,T)}var $=U(F);$.status==="error"&&T($.value)}function U(p,D){var R={};try{R.value=p(D),R.status="success"}catch(T){R.status="error",R.value=T}return R}v.resolve=W;function W(p){return p instanceof this?p:g.resolve(new this(S),p)}v.reject=M;function M(p){var D=new this(S);return g.reject(D,p)}v.all=de;function de(p){var D=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=p.length,T=!1;if(!R)return this.resolve([]);for(var j=new Array(R),F=0,$=-1,k=new this(S);++$<R;)Y(p[$],$);return k;function Y(ee,ae){D.resolve(ee).then(he,function(q){T||(T=!0,g.reject(k,q))});function he(q){j[ae]=q,++F===R&&!T&&(T=!0,g.resolve(k,j))}}}v.race=H;function H(p){var D=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=p.length,T=!1;if(!R)return this.resolve([]);for(var j=-1,F=new this(S);++j<R;)$(p[j]);return F;function $(k){D.resolve(k).then(function(Y){T||(T=!0,g.resolve(F,Y))},function(Y){T||(T=!0,g.reject(F,Y))})}}},{1:1}],3:[function(_,m,x){(function(b){"use strict";typeof b.Promise!="function"&&(b.Promise=_(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(_,m,x){"use strict";var b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function S(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function g(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch(e){return}}var I=g();function A(){try{if(!I||!I.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),r=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!e||r)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch(t){return!1}}function J(e,r){e=e||[],r=r||{};try{return new Blob(e,r)}catch(n){if(n.name!=="TypeError")throw n;for(var t=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,o=new t,a=0;a<e.length;a+=1)o.append(e[a]);return o.getBlob(r.type)}}typeof Promise>"u"&&_(3);var v=Promise;function w(e,r){r&&e.then(function(t){r(null,t)},function(t){r(t)})}function N(e,r,t){typeof r=="function"&&e.then(r),typeof t=="function"&&e.catch(t)}function B(e){return typeof e!="string"&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function V(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var U="local-forage-detect-blob-support",W=void 0,M={},de=Object.prototype.toString,H="readonly",p="readwrite";function D(e){for(var r=e.length,t=new ArrayBuffer(r),o=new Uint8Array(t),a=0;a<r;a++)o[a]=e.charCodeAt(a);return t}function R(e){return new v(function(r){var t=e.transaction(U,p),o=J([""]);t.objectStore(U).put(o,"key"),t.onabort=function(a){a.preventDefault(),a.stopPropagation(),r(!1)},t.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);r(n||!a||parseInt(a[1],10)>=43)}}).catch(function(){return!1})}function T(e){return typeof W=="boolean"?v.resolve(W):R(e).then(function(r){return W=r,W})}function j(e){var r=M[e.name],t={};t.promise=new v(function(o,a){t.resolve=o,t.reject=a}),r.deferredOperations.push(t),r.dbReady?r.dbReady=r.dbReady.then(function(){return t.promise}):r.dbReady=t.promise}function F(e){var r=M[e.name],t=r.deferredOperations.pop();if(t)return t.resolve(),t.promise}function $(e,r){var t=M[e.name],o=t.deferredOperations.pop();if(o)return o.reject(r),o.promise}function k(e,r){return new v(function(t,o){if(M[e.name]=M[e.name]||Ce(),e.db)if(r)j(e),e.db.close();else return t(e.db);var a=[e.name];r&&a.push(e.version);var n=I.open.apply(I,a);r&&(n.onupgradeneeded=function(i){var c=n.result;try{c.createObjectStore(e.storeName),i.oldVersion<=1&&c.createObjectStore(U)}catch(f){if(f.name==="ConstraintError")console.warn('The database "'+e.name+'" has been upgraded from version '+i.oldVersion+" to version "+i.newVersion+', but the storage "'+e.storeName+'" already exists.');else throw f}}),n.onerror=function(i){i.preventDefault(),o(n.error)},n.onsuccess=function(){var i=n.result;i.onversionchange=function(c){c.target.close()},t(i),F(e)}})}function Y(e){return k(e,!1)}function ee(e){return k(e,!0)}function ae(e,r){if(!e.db)return!0;var t=!e.db.objectStoreNames.contains(e.storeName),o=e.version<e.db.version,a=e.version>e.db.version;if(o&&(e.version!==r&&console.warn('The database "'+e.name+`" can't be downgraded from version `+e.db.version+" to version "+e.version+"."),e.version=e.db.version),a||t){if(t){var n=e.db.version+1;n>e.version&&(e.version=n)}return!0}return!1}function he(e){return new v(function(r,t){var o=new FileReader;o.onerror=t,o.onloadend=function(a){var n=btoa(a.target.result||"");r({__local_forage_encoded_blob:!0,data:n,type:e.type})},o.readAsBinaryString(e)})}function q(e){var r=D(atob(e.data));return J([r],{type:e.type})}function Pe(e){return e&&e.__local_forage_encoded_blob}function yt(e){var r=this,t=r._initReady().then(function(){var o=M[r._dbInfo.name];if(o&&o.dbReady)return o.dbReady});return N(t,e,e),t}function bt(e){j(e);for(var r=M[e.name],t=r.forages,o=0;o<t.length;o++){var a=t[o];a._dbInfo.db&&(a._dbInfo.db.close(),a._dbInfo.db=null)}return e.db=null,Y(e).then(function(n){return e.db=n,ae(e)?ee(e):n}).then(function(n){e.db=r.db=n;for(var i=0;i<t.length;i++)t[i]._dbInfo.db=n}).catch(function(n){throw $(e,n),n})}function X(e,r,t,o){o===void 0&&(o=1);try{var a=e.db.transaction(e.storeName,r);t(null,a)}catch(n){if(o>0&&(!e.db||n.name==="InvalidStateError"||n.name==="NotFoundError"))return v.resolve().then(function(){if(!e.db||n.name==="NotFoundError"&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ee(e)}).then(function(){return bt(e).then(function(){X(e,r,t,o-1)})}).catch(t);t(n)}}function Ce(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function wt(e){var r=this,t={db:null};if(e)for(var o in e)t[o]=e[o];var a=M[t.name];a||(a=Ce(),M[t.name]=a),a.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=yt);var n=[];function i(){return v.resolve()}for(var c=0;c<a.forages.length;c++){var f=a.forages[c];f!==r&&n.push(f._initReady().catch(i))}var d=a.forages.slice(0);return v.all(n).then(function(){return t.db=a.db,Y(t)}).then(function(h){return t.db=h,ae(t,r._defaultConfig.version)?ee(t):h}).then(function(h){t.db=a.db=h,r._dbInfo=t;for(var y=0;y<d.length;y++){var E=d[y];E!==r&&(E._dbInfo.db=t.db,E._dbInfo.version=t.version)}})}function _t(e,r){var t=this;e=B(e);var o=new v(function(a,n){t.ready().then(function(){X(t._dbInfo,H,function(i,c){if(i)return n(i);try{var f=c.objectStore(t._dbInfo.storeName),d=f.get(e);d.onsuccess=function(){var h=d.result;h===void 0&&(h=null),Pe(h)&&(h=q(h)),a(h)},d.onerror=function(){n(d.error)}}catch(h){n(h)}})}).catch(n)});return w(o,r),o}function St(e,r){var t=this,o=new v(function(a,n){t.ready().then(function(){X(t._dbInfo,H,function(i,c){if(i)return n(i);try{var f=c.objectStore(t._dbInfo.storeName),d=f.openCursor(),h=1;d.onsuccess=function(){var y=d.result;if(y){var E=y.value;Pe(E)&&(E=q(E));var O=e(E,y.key,h++);O!==void 0?a(O):y.continue()}else a()},d.onerror=function(){n(d.error)}}catch(y){n(y)}})}).catch(n)});return w(o,r),o}function It(e,r,t){var o=this;e=B(e);var a=new v(function(n,i){var c;o.ready().then(function(){return c=o._dbInfo,de.call(r)==="[object Blob]"?T(c.db).then(function(f){return f?r:he(r)}):r}).then(function(f){X(o._dbInfo,p,function(d,h){if(d)return i(d);try{var y=h.objectStore(o._dbInfo.storeName);f===null&&(f=void 0);var E=y.put(f,e);h.oncomplete=function(){f===void 0&&(f=null),n(f)},h.onabort=h.onerror=function(){var O=E.error?E.error:E.transaction.error;i(O)}}catch(O){i(O)}})}).catch(i)});return w(a,t),a}function xt(e,r){var t=this;e=B(e);var o=new v(function(a,n){t.ready().then(function(){X(t._dbInfo,p,function(i,c){if(i)return n(i);try{var f=c.objectStore(t._dbInfo.storeName),d=f.delete(e);c.oncomplete=function(){a()},c.onerror=function(){n(d.error)},c.onabort=function(){var h=d.error?d.error:d.transaction.error;n(h)}}catch(h){n(h)}})}).catch(n)});return w(o,r),o}function Et(e){var r=this,t=new v(function(o,a){r.ready().then(function(){X(r._dbInfo,p,function(n,i){if(n)return a(n);try{var c=i.objectStore(r._dbInfo.storeName),f=c.clear();i.oncomplete=function(){o()},i.onabort=i.onerror=function(){var d=f.error?f.error:f.transaction.error;a(d)}}catch(d){a(d)}})}).catch(a)});return w(t,e),t}function Rt(e){var r=this,t=new v(function(o,a){r.ready().then(function(){X(r._dbInfo,H,function(n,i){if(n)return a(n);try{var c=i.objectStore(r._dbInfo.storeName),f=c.count();f.onsuccess=function(){o(f.result)},f.onerror=function(){a(f.error)}}catch(d){a(d)}})}).catch(a)});return w(t,e),t}function At(e,r){var t=this,o=new v(function(a,n){if(e<0){a(null);return}t.ready().then(function(){X(t._dbInfo,H,function(i,c){if(i)return n(i);try{var f=c.objectStore(t._dbInfo.storeName),d=!1,h=f.openKeyCursor();h.onsuccess=function(){var y=h.result;if(!y){a(null);return}e===0||d?a(y.key):(d=!0,y.advance(e))},h.onerror=function(){n(h.error)}}catch(y){n(y)}})}).catch(n)});return w(o,r),o}function Dt(e){var r=this,t=new v(function(o,a){r.ready().then(function(){X(r._dbInfo,H,function(n,i){if(n)return a(n);try{var c=i.objectStore(r._dbInfo.storeName),f=c.openKeyCursor(),d=[];f.onsuccess=function(){var h=f.result;if(!h){o(d);return}d.push(h.key),h.continue()},f.onerror=function(){a(f.error)}}catch(h){a(h)}})}).catch(a)});return w(t,e),t}function Ot(e,r){r=V.apply(this,arguments);var t=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var o=this,a;if(!e.name)a=v.reject("Invalid arguments");else{var n=e.name===t.name&&o._dbInfo.db,i=n?v.resolve(o._dbInfo.db):Y(e).then(function(c){var f=M[e.name],d=f.forages;f.db=c;for(var h=0;h<d.length;h++)d[h]._dbInfo.db=c;return c});e.storeName?a=i.then(function(c){if(c.objectStoreNames.contains(e.storeName)){var f=c.version+1;j(e);var d=M[e.name],h=d.forages;c.close();for(var y=0;y<h.length;y++){var E=h[y];E._dbInfo.db=null,E._dbInfo.version=f}var O=new v(function(L,C){var P=I.open(e.name,f);P.onerror=function(K){var re=P.result;re.close(),C(K)},P.onupgradeneeded=function(){var K=P.result;K.deleteObjectStore(e.storeName)},P.onsuccess=function(){var K=P.result;K.close(),L(K)}});return O.then(function(L){d.db=L;for(var C=0;C<h.length;C++){var P=h[C];P._dbInfo.db=L,F(P._dbInfo)}}).catch(function(L){throw($(e,L)||v.resolve()).catch(function(){}),L})}}):a=i.then(function(c){j(e);var f=M[e.name],d=f.forages;c.close();for(var h=0;h<d.length;h++){var y=d[h];y._dbInfo.db=null}var E=new v(function(O,L){var C=I.deleteDatabase(e.name);C.onerror=function(){var P=C.result;P&&P.close(),L(C.error)},C.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},C.onsuccess=function(){var P=C.result;P&&P.close(),O(P)}});return E.then(function(O){f.db=O;for(var L=0;L<d.length;L++){var C=d[L];F(C._dbInfo)}}).catch(function(O){throw($(e,O)||v.resolve()).catch(function(){}),O})})}return w(a,r),a}var Lt={_driver:"asyncStorage",_initStorage:wt,_support:A(),iterate:St,getItem:_t,setItem:It,removeItem:xt,clear:Et,length:Rt,key:At,keys:Dt,dropInstance:Ot};function Tt(){return typeof openDatabase=="function"}var z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nt="~~local_forage_type~",Be=/^~~local_forage_type~([^~]+)~/,ie="__lfsc__:",ve=ie.length,me="arbf",pe="blob",Ue="si08",Je="ui08",Me="uic8",je="si16",Fe="si32",$e="ur16",ke="ui32",Ke="fl32",Ve="fl64",We=ve+me.length,Ye=Object.prototype.toString;function Xe(e){var r=e.length*.75,t=e.length,o,a=0,n,i,c,f;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var d=new ArrayBuffer(r),h=new Uint8Array(d);for(o=0;o<t;o+=4)n=z.indexOf(e[o]),i=z.indexOf(e[o+1]),c=z.indexOf(e[o+2]),f=z.indexOf(e[o+3]),h[a++]=n<<2|i>>4,h[a++]=(i&15)<<4|c>>2,h[a++]=(c&3)<<6|f&63;return d}function ge(e){var r=new Uint8Array(e),t="",o;for(o=0;o<r.length;o+=3)t+=z[r[o]>>2],t+=z[(r[o]&3)<<4|r[o+1]>>4],t+=z[(r[o+1]&15)<<2|r[o+2]>>6],t+=z[r[o+2]&63];return r.length%3===2?t=t.substring(0,t.length-1)+"=":r.length%3===1&&(t=t.substring(0,t.length-2)+"=="),t}function Pt(e,r){var t="";if(e&&(t=Ye.call(e)),e&&(t==="[object ArrayBuffer]"||e.buffer&&Ye.call(e.buffer)==="[object ArrayBuffer]")){var o,a=ie;e instanceof ArrayBuffer?(o=e,a+=me):(o=e.buffer,t==="[object Int8Array]"?a+=Ue:t==="[object Uint8Array]"?a+=Je:t==="[object Uint8ClampedArray]"?a+=Me:t==="[object Int16Array]"?a+=je:t==="[object Uint16Array]"?a+=$e:t==="[object Int32Array]"?a+=Fe:t==="[object Uint32Array]"?a+=ke:t==="[object Float32Array]"?a+=Ke:t==="[object Float64Array]"?a+=Ve:r(new Error("Failed to get type for BinaryArray"))),r(a+ge(o))}else if(t==="[object Blob]"){var n=new FileReader;n.onload=function(){var i=Nt+e.type+"~"+ge(this.result);r(ie+pe+i)},n.readAsArrayBuffer(e)}else try{r(JSON.stringify(e))}catch(i){console.error("Couldn't convert value into a JSON string: ",e),r(null,i)}}function Ct(e){if(e.substring(0,ve)!==ie)return JSON.parse(e);var r=e.substring(We),t=e.substring(ve,We),o;if(t===pe&&Be.test(r)){var a=r.match(Be);o=a[1],r=r.substring(a[0].length)}var n=Xe(r);switch(t){case me:return n;case pe:return J([n],{type:o});case Ue:return new Int8Array(n);case Je:return new Uint8Array(n);case Me:return new Uint8ClampedArray(n);case je:return new Int16Array(n);case $e:return new Uint16Array(n);case Fe:return new Int32Array(n);case ke:return new Uint32Array(n);case Ke:return new Float32Array(n);case Ve:return new Float64Array(n);default:throw new Error("Unkown type: "+t)}}var ye={serialize:Pt,deserialize:Ct,stringToBuffer:Xe,bufferToString:ge};function ze(e,r,t,o){e.executeSql("CREATE TABLE IF NOT EXISTS "+r.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],t,o)}function Bt(e){var r=this,t={db:null};if(e)for(var o in e)t[o]=typeof e[o]!="string"?e[o].toString():e[o];var a=new v(function(n,i){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size)}catch(c){return i(c)}t.db.transaction(function(c){ze(c,t,function(){r._dbInfo=t,n()},function(f,d){i(d)})},i)});return t.serializer=ye,a}function G(e,r,t,o,a,n){e.executeSql(t,o,a,function(i,c){c.code===c.SYNTAX_ERR?i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[r.storeName],function(f,d){d.rows.length?n(f,c):ze(f,r,function(){f.executeSql(t,o,a,n)},n)},n):n(i,c)},n)}function Ut(e,r){var t=this;e=B(e);var o=new v(function(a,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(c){G(c,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],function(f,d){var h=d.rows.length?d.rows.item(0).value:null;h&&(h=i.serializer.deserialize(h)),a(h)},function(f,d){n(d)})})}).catch(n)});return w(o,r),o}function Jt(e,r){var t=this,o=new v(function(a,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(c){G(c,i,"SELECT * FROM "+i.storeName,[],function(f,d){for(var h=d.rows,y=h.length,E=0;E<y;E++){var O=h.item(E),L=O.value;if(L&&(L=i.serializer.deserialize(L)),L=e(L,O.key,E+1),L!==void 0){a(L);return}}a()},function(f,d){n(d)})})}).catch(n)});return w(o,r),o}function Ge(e,r,t,o){var a=this;e=B(e);var n=new v(function(i,c){a.ready().then(function(){r===void 0&&(r=null);var f=r,d=a._dbInfo;d.serializer.serialize(r,function(h,y){y?c(y):d.db.transaction(function(E){G(E,d,"INSERT OR REPLACE INTO "+d.storeName+" (key, value) VALUES (?, ?)",[e,h],function(){i(f)},function(O,L){c(L)})},function(E){if(E.code===E.QUOTA_ERR){if(o>0){i(Ge.apply(a,[e,f,t,o-1]));return}c(E)}})})}).catch(c)});return w(n,t),n}function Mt(e,r,t){return Ge.apply(this,[e,r,t,1])}function jt(e,r){var t=this;e=B(e);var o=new v(function(a,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(c){G(c,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],function(){a()},function(f,d){n(d)})})}).catch(n)});return w(o,r),o}function Ft(e){var r=this,t=new v(function(o,a){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(i){G(i,n,"DELETE FROM "+n.storeName,[],function(){o()},function(c,f){a(f)})})}).catch(a)});return w(t,e),t}function $t(e){var r=this,t=new v(function(o,a){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(i){G(i,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(c,f){var d=f.rows.item(0).c;o(d)},function(c,f){a(f)})})}).catch(a)});return w(t,e),t}function kt(e,r){var t=this,o=new v(function(a,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(c){G(c,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],function(f,d){var h=d.rows.length?d.rows.item(0).key:null;a(h)},function(f,d){n(d)})})}).catch(n)});return w(o,r),o}function Kt(e){var r=this,t=new v(function(o,a){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(i){G(i,n,"SELECT key FROM "+n.storeName,[],function(c,f){for(var d=[],h=0;h<f.rows.length;h++)d.push(f.rows.item(h).key);o(d)},function(c,f){a(f)})})}).catch(a)});return w(t,e),t}function Vt(e){return new v(function(r,t){e.transaction(function(o){o.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(a,n){for(var i=[],c=0;c<n.rows.length;c++)i.push(n.rows.item(c).name);r({db:e,storeNames:i})},function(a,n){t(n)})},function(o){t(o)})})}function Wt(e,r){r=V.apply(this,arguments);var t=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var o=this,a;return e.name?a=new v(function(n){var i;e.name===t.name?i=o._dbInfo.db:i=openDatabase(e.name,"","",0),e.storeName?n({db:i,storeNames:[e.storeName]}):n(Vt(i))}).then(function(n){return new v(function(i,c){n.db.transaction(function(f){function d(O){return new v(function(L,C){f.executeSql("DROP TABLE IF EXISTS "+O,[],function(){L()},function(P,K){C(K)})})}for(var h=[],y=0,E=n.storeNames.length;y<E;y++)h.push(d(n.storeNames[y]));v.all(h).then(function(){i()}).catch(function(O){c(O)})},function(f){c(f)})})}):a=v.reject("Invalid arguments"),w(a,r),a}var Yt={_driver:"webSQLStorage",_initStorage:Bt,_support:Tt(),iterate:Jt,getItem:Ut,setItem:Mt,removeItem:jt,clear:Ft,length:$t,key:kt,keys:Kt,dropInstance:Wt};function Xt(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function He(e,r){var t=e.name+"/";return e.storeName!==r.storeName&&(t+=e.storeName+"/"),t}function zt(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(r){return!0}}function Gt(){return!zt()||localStorage.length>0}function Ht(e){var r=this,t={};if(e)for(var o in e)t[o]=e[o];return t.keyPrefix=He(e,r._defaultConfig),Gt()?(r._dbInfo=t,t.serializer=ye,v.resolve()):v.reject()}function Qt(e){var r=this,t=r.ready().then(function(){for(var o=r._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var n=localStorage.key(a);n.indexOf(o)===0&&localStorage.removeItem(n)}});return w(t,e),t}function qt(e,r){var t=this;e=B(e);var o=t.ready().then(function(){var a=t._dbInfo,n=localStorage.getItem(a.keyPrefix+e);return n&&(n=a.serializer.deserialize(n)),n});return w(o,r),o}function Zt(e,r){var t=this,o=t.ready().then(function(){for(var a=t._dbInfo,n=a.keyPrefix,i=n.length,c=localStorage.length,f=1,d=0;d<c;d++){var h=localStorage.key(d);if(h.indexOf(n)===0){var y=localStorage.getItem(h);if(y&&(y=a.serializer.deserialize(y)),y=e(y,h.substring(i),f++),y!==void 0)return y}}});return w(o,r),o}function er(e,r){var t=this,o=t.ready().then(function(){var a=t._dbInfo,n;try{n=localStorage.key(e)}catch(i){n=null}return n&&(n=n.substring(a.keyPrefix.length)),n});return w(o,r),o}function tr(e){var r=this,t=r.ready().then(function(){for(var o=r._dbInfo,a=localStorage.length,n=[],i=0;i<a;i++){var c=localStorage.key(i);c.indexOf(o.keyPrefix)===0&&n.push(c.substring(o.keyPrefix.length))}return n});return w(t,e),t}function rr(e){var r=this,t=r.keys().then(function(o){return o.length});return w(t,e),t}function nr(e,r){var t=this;e=B(e);var o=t.ready().then(function(){var a=t._dbInfo;localStorage.removeItem(a.keyPrefix+e)});return w(o,r),o}function or(e,r,t){var o=this;e=B(e);var a=o.ready().then(function(){r===void 0&&(r=null);var n=r;return new v(function(i,c){var f=o._dbInfo;f.serializer.serialize(r,function(d,h){if(h)c(h);else try{localStorage.setItem(f.keyPrefix+e,d),i(n)}catch(y){(y.name==="QuotaExceededError"||y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&c(y),c(y)}})})});return w(a,t),a}function ar(e,r){if(r=V.apply(this,arguments),e=typeof e!="function"&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName}var o=this,a;return e.name?a=new v(function(n){e.storeName?n(He(e,o._defaultConfig)):n(e.name+"/")}).then(function(n){for(var i=localStorage.length-1;i>=0;i--){var c=localStorage.key(i);c.indexOf(n)===0&&localStorage.removeItem(c)}}):a=v.reject("Invalid arguments"),w(a,r),a}var ir={_driver:"localStorageWrapper",_initStorage:Ht,_support:Xt(),iterate:Zt,getItem:qt,setItem:or,removeItem:nr,clear:Qt,length:rr,key:er,keys:tr,dropInstance:ar},sr=function(r,t){return r===t||typeof r=="number"&&typeof t=="number"&&isNaN(r)&&isNaN(t)},ur=function(r,t){for(var o=r.length,a=0;a<o;){if(sr(r[a],t))return!0;a++}return!1},Qe=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},te={},qe={},Z={INDEXEDDB:Lt,WEBSQL:Yt,LOCALSTORAGE:ir},cr=[Z.INDEXEDDB._driver,Z.WEBSQL._driver,Z.LOCALSTORAGE._driver],se=["dropInstance"],be=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(se),fr={description:"",driver:cr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function lr(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})}}function we(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(Qe(r[t])?arguments[0][t]=r[t].slice():arguments[0][t]=r[t])}return arguments[0]}var dr=function(){function e(r){S(this,e);for(var t in Z)if(Z.hasOwnProperty(t)){var o=Z[t],a=o._driver;this[t]=a,te[a]||this.defineDriver(o)}this._defaultConfig=we({},fr),this._config=we({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(t){if((typeof t>"u"?"undefined":b(t))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var o in t){if(o==="storeName"&&(t[o]=t[o].replace(/\W/g,"_")),o==="version"&&typeof t[o]!="number")return new Error("Database version must be a number.");this._config[o]=t[o]}return"driver"in t&&t.driver?this.setDriver(this._config.driver):!0}else return typeof t=="string"?this._config[t]:this._config},e.prototype.defineDriver=function(t,o,a){var n=new v(function(i,c){try{var f=t._driver,d=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!t._driver){c(d);return}for(var h=be.concat("_initStorage"),y=0,E=h.length;y<E;y++){var O=h[y],L=!ur(se,O);if((L||t[O])&&typeof t[O]!="function"){c(d);return}}var C=function(){for(var re=function(mr){return function(){var pr=new Error("Method "+mr+" is not implemented by the current driver"),Ze=v.reject(pr);return w(Ze,arguments[arguments.length-1]),Ze}},_e=0,vr=se.length;_e<vr;_e++){var Se=se[_e];t[Se]||(t[Se]=re(Se))}};C();var P=function(re){te[f]&&console.info("Redefining LocalForage driver: "+f),te[f]=t,qe[f]=re,i()};"_support"in t?t._support&&typeof t._support=="function"?t._support().then(P,c):P(!!t._support):P(!0)}catch(K){c(K)}});return N(n,o,a),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(t,o,a){var n=te[t]?v.resolve(te[t]):v.reject(new Error("Driver not found."));return N(n,o,a),n},e.prototype.getSerializer=function(t){var o=v.resolve(ye);return N(o,t),o},e.prototype.ready=function(t){var o=this,a=o._driverSet.then(function(){return o._ready===null&&(o._ready=o._initDriver()),o._ready});return N(a,t,t),a},e.prototype.setDriver=function(t,o,a){var n=this;Qe(t)||(t=[t]);var i=this._getSupportedDrivers(t);function c(){n._config.driver=n.driver()}function f(y){return n._extend(y),c(),n._ready=n._initStorage(n._config),n._ready}function d(y){return function(){var E=0;function O(){for(;E<y.length;){var L=y[E];return E++,n._dbInfo=null,n._ready=null,n.getDriver(L).then(f).catch(O)}c();var C=new Error("No available storage method found.");return n._driverSet=v.reject(C),n._driverSet}return O()}}var h=this._driverSet!==null?this._driverSet.catch(function(){return v.resolve()}):v.resolve();return this._driverSet=h.then(function(){var y=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(y).then(function(E){n._driver=E._driver,c(),n._wrapLibraryMethodsWithReady(),n._initDriver=d(i)})}).catch(function(){c();var y=new Error("No available storage method found.");return n._driverSet=v.reject(y),n._driverSet}),N(this._driverSet,o,a),this._driverSet},e.prototype.supports=function(t){return!!qe[t]},e.prototype._extend=function(t){we(this,t)},e.prototype._getSupportedDrivers=function(t){for(var o=[],a=0,n=t.length;a<n;a++){var i=t[a];this.supports(i)&&o.push(i)}return o},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,o=be.length;t<o;t++)lr(this,be[t])},e.prototype.createInstance=function(t){return new e(t)},e}(),hr=new dr;m.exports=hr},{3:3}]},{},[4])(4)})});var Ie=u=>{var S,g,I;let s=u.split("-")[1];s&&(u=u.replace(`-${s}`,""));let l=u.split("+")[1];l&&(u=u.replace(`+${l}`,""));let _=u.split(".").slice(0,3),[m,x,b]=[(S=_[0])!=null?S:"0",(g=_[1])!=null?g:"0",(I=_[2])!=null?I:"0"];return{major:m,minor:x,patch:b,prerelease:s,build:l}},ce=u=>parseInt(Ie(u).major,10),tt=(u,s)=>{let{major:l,minor:_,patch:m}=Ie(u),{major:x,minor:b,patch:S}=Ie(s);return l!==x?l>x?1:-1:_!==b?_>b?1:-1:m!==S?m>S?1:-1:0};var rt="jolibox-sdk-loader-metadata",xe=class{constructor({loaderMetadata:s}={}){this.computeLoaderMetaData=()=>{var m,x;let s=this.currentVersion,l=null;try{if(l=JSON.parse((m=localStorage.getItem(rt))!=null?m:"null"),!l||!l.version)throw new Error("Invalid loader metadata")}catch(b){l=this.defaultMetadata}let _=(x=l==null?void 0:l.version)!=null?x:s;return ce(_)!==ce(s)?l=this.defaultMetadata:tt(_,s)<0&&(l=this.defaultMetadata),l};this.loadScript=()=>{if(this.loaderMetadata.syncScriptUrl){let s=new XMLHttpRequest;s.open("GET",this.loaderMetadata.syncScriptUrl,!1),s.send();let l=document.createElement("script");l.type="text/javascript",l.innerHTML=s.responseText,document.head.appendChild(l)}if(this.loaderMetadata.asyncScriptUrl){let s=document.createElement("script");s.type="text/javascript",s.src=this.loaderMetadata.asyncScriptUrl,s.async=!0,document.head.appendChild(s)}};this.fetchUpdateLoaderMetadata=(...x)=>ue(this,[...x],function*(s=this.currentVersion,l=this.loaderMetadata.version,_=(m=>(m=window.JOLIBOX_ENV)!=null?m:"WEB")()){var S,g,I;let b=`${(g=(S=window.joliboxenv)==null?void 0:S.apiBaseURL)!=null?g:"https://api.jolibox.com"}/frontend/js-sdk/loader-metadata`;try{let J=yield(yield fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installedSDKVersion:s,localSDKVersion:l,env:_})})).json();if(J.code!=="SUCCESS")throw new Error(J.message);this.loaderMetadata=(I=J.data)!=null?I:this.defaultMetadata,localStorage.setItem(rt,JSON.stringify(this.loaderMetadata))}catch(A){console.warn("Failed to fetch loader metadata: ",A)}});console.log("Loading Jolibox SDK..."),this.loaderMetadata=s!=null?s:this.computeLoaderMetaData(),this.loadScript(),this.fetchUpdateLoaderMetadata(),console.log("Jolibox SDK loaded.")}get currentVersion(){return window.__JOLIBOX_LOCAL_SDK_VERSION__}get defaultMetadata(){let s=this.currentVersion,l=ce(s);return{version:s,syncScriptUrl:`https://cdn.jsdelivr.net/npm/@jolibox/web-sync-sdk@${l}/dist/index.iife.js`,asyncScriptUrl:`https://cdn.jsdelivr.net/npm/@jolibox/web-async-sdk@${l}/dist/index.iife.js`}}};window.JoliboxSDKLoader=xe;var Ee=class{constructor(){this.init=s=>{window.joliboxsdk._commandPipe.push({cmd:"ads.init",params:s})};this.adConfig=s=>{window.joliboxsdk._commandPipe.push({cmd:"ads.adConfig",params:s})};this.adBreak=s=>{window.joliboxsdk._commandPipe.push({cmd:"ads.adBreak",params:s})};this.adUnit=s=>ue(this,null,function*(){window.joliboxsdk._commandPipe.push({cmd:"ads.adUnit",params:s})})}};window.JoliboxAds=Ee;var Re=class{constructor(){this.trackEvent=(s,l)=>{if(typeof s!="string")throw new Error("eventName must be a string");if(l!==null&&typeof l!="object"&&l!==void 0)throw new Error("extra must be an object or null or undefined");if(l){for(let _ in l)if(typeof l[_]=="object")throw new Error("extra must not have nested objects")}window.joliboxsdk._commandPipe.push({cmd:"analytics.trackEvent",params:[s,l]})}}};window.JoliboxAnalytics=Re;var gt=xr(ot(),1),Er=Object.defineProperty,Oe=(u,s)=>{for(var l in s)Er(u,l,{get:s[l],enumerable:!0})},Q=(u,s,l)=>new Promise((_,m)=>{var x=g=>{try{S(l.next(g))}catch(I){m(I)}},b=g=>{try{S(l.throw(g))}catch(I){m(I)}},S=g=>g.done?_(g.value):Promise.resolve(g.value).then(x,b);S((l=l.apply(u,s)).next())}),at={};Oe(at,{ADVERTISING_ID:()=>ft,DEVICE_ID:()=>ct,getAdvertisingId:()=>dt,getAppVersion:()=>ut,getDeviceId:()=>lt,getPlatform:()=>st,getStorage:()=>Te,getUtmSource:()=>ht,platform:()=>oe,xUserAgent:()=>vt});var it={};Oe(it,{isValidUUIDV4:()=>Rr,uuidv4:()=>Le});var Le=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,u=>{let s=Math.random()*16|0;return(u==="x"?s:s&3|8).toString(16)}),Rr=u=>/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i.test(u),oe={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let u=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(u[1],10),parseInt(u[2],10),parseInt(u[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},st=()=>oe.isiOS?"iOS":oe.isAndroid?"Android":oe.isMac?"Mac":oe.isFacebook?"Facebook":"PC",ut=()=>window.__JOLIBOX_LOCAL_SDK_VERSION__,ct="device_id",ft="advertising_id",Te=u=>(localStorage.getItem(u)||localStorage.setItem(u,Le()),localStorage.getItem(u)),lt=()=>Te(ct),dt=()=>Te(ft),Ar=u=>u.charAt(0).toUpperCase()+u.slice(1),ht=()=>{var u;let s=new URLSearchParams(window.location.search);return Ar((u=s.get("utm_source"))!=null?u:"")||"JoliboxSDK"},vt=()=>{let u="JoliboxWebSDK",s=st(),l=navigator.language,_=lt(),m=dt(),x=ut();return`${u} (${ht()}${s}; UnknownModel; UnknownSystemVersion; ${l}) uuid/${_} adid/${m} version/${x||""}`},Dr;(Dr=AbortSignal.timeout)!=null||(AbortSignal.timeout=function(u){let s=new AbortController;return setTimeout(()=>s.abort(),u),s.signal});var mt=class{constructor(u){this.xua=vt(),this.getGameId=()=>{var m;return(m=new URLSearchParams(window.location.search).get("gameId"))!=null?m:null},this.getJoliSource=()=>{var m;return(m=new URLSearchParams(window.location.search).get("joliSource"))!=null?m:null};var s,l,_;this.baseUrl=(_=(l=u==null?void 0:u.baseUrl)!=null?l:(s=window.joliboxenv)==null?void 0:s.apiBaseURL)!=null?_:"https://api.jolibox.com"}get(u,s){return Q(this,arguments,function*(l,{query:_,headers:m,timeout:x}){let b=new URLSearchParams(_).toString(),S=`${this.baseUrl}${l}${b?`?${b}`:""}`,g=this.xua,I=this.getJoliSource();return m=Object.assign({},m,g?{"x-user-agent":g}:{},I?{"x-joli-source":I}:{}),yield(yield fetch(S,{method:"GET",headers:m,signal:AbortSignal.timeout(x!=null?x:3e4)})).json()})}post(u,s){return Q(this,arguments,function*(l,{data:_,query:m,headers:x,timeout:b}){let S=new URLSearchParams(m).toString(),g=`${this.baseUrl}${l}${S?`?${S}`:""}`,I=this.getGameId(),A=this.xua,J=this.getJoliSource();x=Object.assign({},x,{"Content-Type":"application/json"},I?{"x-game-id":I}:{},A?{"x-user-agent":A}:{},J?{"x-joli-source":J}:{});let v=yield fetch(g,{method:"POST",headers:x,body:JSON.stringify(_),signal:AbortSignal.timeout(b!=null?b:3e4)}),w=v.headers.get("content-type");if(w!=null&&w.includes("application/octet-stream"))try{return v.blob()}catch(N){return yield v.arrayBuffer()}if(w!=null&&w.includes("multipart/form-data")||w!=null&&w.includes("application/x-www-form-urlencoded"))try{return v.formData()}catch(N){return yield v.text()}if(w!=null&&w.includes("application/json"))try{return yield v.json()}catch(N){return yield v.text()}return v})}put(u,s){return Q(this,arguments,function*(l,{data:_,query:m,headers:x}){try{let b=new URLSearchParams(m).toString(),S=`${this.baseUrl}${l}${b?`?${b}`:""}`,g=this.xua,I=this.getJoliSource();x=Object.assign({},x,{"Content-Type":"application/json"},g?{"x-user-agent":g}:{},I?{"x-joli-source":I}:{});let A=yield fetch(S,{method:"PUT",headers:x,body:JSON.stringify(_!=null?_:{})});if(!A.ok)throw new Error(`HTTP error! status: ${A.status}`);return yield A.json()}catch(b){throw console.error("Error:",b),b}})}};window.JoliboxHttpClient=mt;var pt={};Oe(pt,{getGameSessionId:()=>Or});var Or=()=>{let u=sessionStorage.getItem("gameSessionId");return u||(u=Le(),sessionStorage.setItem("gameSessionId",u)),u},fe=class{};fe.xua=at,fe.session=pt,fe.uuid=it;window.JoliboxUtil=fe;var Lr=(u=>(u.LOAD_START="JOLIBOX_RUNTIME_LOAD_START",u.LOAD_FINISHED="JOLIBOX_RUNTIME_LOAD_FINISHED",u.LOAD_PROGRESS="JOLIBOX_RUNTIME_LOAD_PROGRESS",u))(Lr||{});window.dispatchEvent(new Event("JOLIBOX_RUNTIME_LOAD_START"));var Tr=class{constructor(){this.loadFinished=()=>{let u=new Event("JOLIBOX_RUNTIME_LOAD_FINISHED");window.dispatchEvent(u),window.joliboxsdk._commandPipe.push({cmd:"analytics.trackSystemEvent",params:["CallRuntimeLoadFinished"]})},this.notifyLoadProgress=u=>{let s=Math.ceil(u),l=new CustomEvent("JOLIBOX_RUNTIME_LOAD_PROGRESS",{detail:s});window.dispatchEvent(l)}}};window.JoliboxRuntime=Tr;var De="INTERNAL_ERR",Ne=class{constructor(){this.getGameId=()=>{var u;return(u=new URLSearchParams(window.location.search).get("gameId"))!=null?u:""},this.getItem=u=>Q(this,null,function*(){try{let{code:s,data:l,message:_}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:u}}),m=l==null?void 0:l.value;return s!=="SUCCESS"&&(m=yield this.gameStore.getItem(u),console.info("[SDK] cloud storage getItem failed, read from localstorage",m)),{code:s,message:_,data:m!=null?m:null}}catch(s){let l=`[SDK] cloud storage getItem internal error: ${s}`;return console.error(l),{code:"INTERNAL_ERR",message:l}}}),this.setItem=(u,s)=>Q(this,null,function*(){var l,_;try{if(!this.isPrimitiveType(s))throw{code:"PARAMETER_ERROR",message:"[SDK] cloud storage setItem error: typeof value should be number, string or boolean"};if(u.length>128)throw{code:"PARAMETER_ERROR",message:"[SDK] cloud storage setItem error: length of key should be less than 128"};let m=typeof s=="string"?s:String(s);if(u.length+m.length>1024)throw{code:"PARAMETER_ERROR",message:"[SDK] cloud storage setItem error: length of key and value should be less than 1024"};yield this.gameStore.setItem(u,m);let{code:x,message:b}=yield this.httpClient.post(`api/games/user-storage/${this.gameId}`,{data:{key:u,value:m}});return{code:x,message:b}}catch(m){let x=(l=m.code)!=null?l:De,b=(_=m.message)!=null?_:`${m}`;return console.error(b),{code:x,message:b}}}),this.removeItem=u=>Q(this,null,function*(){try{yield this.gameStore.removeItem(u);let{code:s,message:l}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:u}});return{code:s,message:l}}catch(s){let l=`[SDK] cloud storage removeItem error: ${s}`;return console.error(l),{code:De,message:l}}}),this.clear=()=>Q(this,null,function*(){try{yield this.gameStore.clear();let{code:u,message:s}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:u,message:s}}catch(u){let s=`[SDK] cloud storage clear error: ${u}`;return console.error(s),{code:De,message:s}}}),this.gameId=this.getGameId(),this.httpClient=new mt,this.gameStore=gt.default.createInstance({name:this.gameId.length?this.gameId:"default"})}isPrimitiveType(u){return typeof u=="string"||typeof u=="number"||typeof u=="boolean"}};window.JoliboxCloudStorage=Ne;window.__JOLIBOX_LOCAL_SDK_VERSION__="1.0.11-beta.0";var le=class{constructor({useRuntimeSDK:s=!0,loaderConfig:l,testMode:_,apiBaseURL:m}={}){this.hostToApiMap={default:{test:"https://stg-api.jolibox.com",prod:"https://api.jolibox.com"},"oss.jolibox.com":{test:"https://stg-api.jolibox.com",prod:"https://api.jolibox.com"},"oss.pico-game.com":{test:"https://stg-api.pico-game.com",prod:"https://api.pico-game.com"}};this.setJoliboxEnv=(s,l)=>{var I;let m=typeof window<"u"?new URLSearchParams(window.location.search):null,x=(m==null?void 0:m.get("testMode"))==="true",b=s!=null?s:x,S=m==null?void 0:m.get("apiBaseURL"),g;if(l)g=l;else if(S)g=S;else{let A=(I=this.hostToApiMap[window.location.host])!=null?I:this.hostToApiMap.default;g=b?A.test:A.prod}window.joliboxenv={testMode:b,apiBaseURL:g}};var x,b,S,g,I;this.setJoliboxEnv(_,m),s&&window.joliboxsdk?(this.loader=(x=window.joliboxsdk.loader)!=null?x:new window.JoliboxSDKLoader(l),this.ads=(b=window.joliboxsdk.ads)!=null?b:new window.JoliboxAds,this.anaytics=(S=window.joliboxsdk.anaytics)!=null?S:new window.JoliboxAnalytics,this.runtime=(g=window.joliboxsdk.runtime)!=null?g:new window.JoliboxRuntime,this.storage=(I=window.joliboxsdk.storage)!=null?I:new window.JoliboxCloudStorage):(window.joliboxsdk||(window.joliboxsdk={_commandPipe:[]}),this.loader=new window.JoliboxSDKLoader(l),this.ads=new window.JoliboxAds,this.anaytics=new window.JoliboxAnalytics,this.runtime=new window.JoliboxRuntime,this.storage=new window.JoliboxCloudStorage,window.joliboxsdk=Object.assign(this,window.joliboxsdk)),window.joliboxsdk._commandPipe||(window.joliboxsdk._commandPipe=[])}};window.JoliboxSDK||(window.JoliboxSDK=le);var en=le;})();
1
+ "use strict";(()=>{var gr=Object.create;var et=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var br=Object.getOwnPropertyNames;var wr=Object.getPrototypeOf,_r=Object.prototype.hasOwnProperty;var ne=(u=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(u,{get:(s,l)=>(typeof require<"u"?require:s)[l]}):u)(function(u){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+u+'" is not supported')});var Sr=(u,s)=>()=>(s||u((s={exports:{}}).exports,s),s.exports);var Ir=(u,s,l,w)=>{if(s&&typeof s=="object"||typeof s=="function")for(let m of br(s))!_r.call(u,m)&&m!==l&&et(u,m,{get:()=>s[m],enumerable:!(w=yr(s,m))||w.enumerable});return u};var xr=(u,s,l)=>(l=u!=null?gr(wr(u)):{},Ir(s||!u||!u.__esModule?et(l,"default",{value:u,enumerable:!0}):l,u));var ue=(u,s,l)=>new Promise((w,m)=>{var x=g=>{try{_(l.next(g))}catch(S){m(S)}},b=g=>{try{_(l.throw(g))}catch(S){m(S)}},_=g=>g.done?w(g.value):Promise.resolve(g.value).then(x,b);_((l=l.apply(u,s)).next())});var ot=Sr((nt,Ae)=>{"use strict";(function(u){if(typeof nt=="object"&&typeof Ae<"u")Ae.exports=u();else if(typeof define=="function"&&define.amd)define([],u);else{var s;typeof window<"u"?s=window:typeof global<"u"?s=global:typeof self<"u"?s=self:s=this,s.localforage=u()}})(function(){var u,s,l;return function w(m,x,b){function _(A,N){if(!x[A]){if(!m[A]){var v=typeof ne=="function"&&ne;if(!N&&v)return v(A,!0);if(g)return g(A,!0);var I=new Error("Cannot find module '"+A+"'");throw I.code="MODULE_NOT_FOUND",I}var C=x[A]={exports:{}};m[A][0].call(C.exports,function(U){var V=m[A][1][U];return _(V||U)},C,C.exports,w,m,x,b)}return x[A].exports}for(var g=typeof ne=="function"&&ne,S=0;S<b.length;S++)_(b[S]);return _}({1:[function(w,m,x){(function(b){"use strict";var _=b.MutationObserver||b.WebKitMutationObserver,g;if(_){var S=0,A=new _(U),N=b.document.createTextNode("");A.observe(N,{characterData:!0}),g=function(){N.data=S=++S%2}}else if(!b.setImmediate&&typeof b.MessageChannel<"u"){var v=new b.MessageChannel;v.port1.onmessage=U,g=function(){v.port2.postMessage(0)}}else"document"in b&&"onreadystatechange"in b.document.createElement("script")?g=function(){var J=b.document.createElement("script");J.onreadystatechange=function(){U(),J.onreadystatechange=null,J.parentNode.removeChild(J),J=null},b.document.documentElement.appendChild(J)}:g=function(){setTimeout(U,0)};var I,C=[];function U(){I=!0;for(var J,W,M=C.length;M;){for(W=C,C=[],J=-1;++J<M;)W[J]();M=C.length}I=!1}m.exports=V;function V(J){C.push(J)===1&&!I&&g()}}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{}],2:[function(w,m,x){"use strict";var b=w(1);function _(){}var g={},S=["REJECTED"],A=["FULFILLED"],N=["PENDING"];m.exports=v;function v(p){if(typeof p!="function")throw new TypeError("resolver must be a function");this.state=N,this.queue=[],this.outcome=void 0,p!==_&&V(this,p)}v.prototype.catch=function(p){return this.then(null,p)},v.prototype.then=function(p,D){if(typeof p!="function"&&this.state===A||typeof D!="function"&&this.state===S)return this;var R=new this.constructor(_);if(this.state!==N){var T=this.state===A?p:D;C(R,T,this.outcome)}else this.queue.push(new I(R,p,D));return R};function I(p,D,R){this.promise=p,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof R=="function"&&(this.onRejected=R,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(p){g.resolve(this.promise,p)},I.prototype.otherCallFulfilled=function(p){C(this.promise,this.onFulfilled,p)},I.prototype.callRejected=function(p){g.reject(this.promise,p)},I.prototype.otherCallRejected=function(p){C(this.promise,this.onRejected,p)};function C(p,D,R){b(function(){var T;try{T=D(R)}catch(j){return g.reject(p,j)}T===p?g.reject(p,new TypeError("Cannot resolve promise with itself")):g.resolve(p,T)})}g.resolve=function(p,D){var R=J(U,D);if(R.status==="error")return g.reject(p,R.value);var T=R.value;if(T)V(p,T);else{p.state=A,p.outcome=D;for(var j=-1,F=p.queue.length;++j<F;)p.queue[j].callFulfilled(D)}return p},g.reject=function(p,D){p.state=S,p.outcome=D;for(var R=-1,T=p.queue.length;++R<T;)p.queue[R].callRejected(D);return p};function U(p){var D=p&&p.then;if(p&&(typeof p=="object"||typeof p=="function")&&typeof D=="function")return function(){D.apply(p,arguments)}}function V(p,D){var R=!1;function T(k){R||(R=!0,g.reject(p,k))}function j(k){R||(R=!0,g.resolve(p,k))}function F(){D(j,T)}var $=J(F);$.status==="error"&&T($.value)}function J(p,D){var R={};try{R.value=p(D),R.status="success"}catch(T){R.status="error",R.value=T}return R}v.resolve=W;function W(p){return p instanceof this?p:g.resolve(new this(_),p)}v.reject=M;function M(p){var D=new this(_);return g.reject(D,p)}v.all=de;function de(p){var D=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=p.length,T=!1;if(!R)return this.resolve([]);for(var j=new Array(R),F=0,$=-1,k=new this(_);++$<R;)Y(p[$],$);return k;function Y(ee,ae){D.resolve(ee).then(he,function(q){T||(T=!0,g.reject(k,q))});function he(q){j[ae]=q,++F===R&&!T&&(T=!0,g.resolve(k,j))}}}v.race=H;function H(p){var D=this;if(Object.prototype.toString.call(p)!=="[object Array]")return this.reject(new TypeError("must be an array"));var R=p.length,T=!1;if(!R)return this.resolve([]);for(var j=-1,F=new this(_);++j<R;)$(p[j]);return F;function $(k){D.resolve(k).then(function(Y){T||(T=!0,g.resolve(F,Y))},function(Y){T||(T=!0,g.reject(F,Y))})}}},{1:1}],3:[function(w,m,x){(function(b){"use strict";typeof b.Promise!="function"&&(b.Promise=w(2))}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{2:2}],4:[function(w,m,x){"use strict";var b=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function _(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function g(){try{if(typeof indexedDB<"u")return indexedDB;if(typeof webkitIndexedDB<"u")return webkitIndexedDB;if(typeof mozIndexedDB<"u")return mozIndexedDB;if(typeof OIndexedDB<"u")return OIndexedDB;if(typeof msIndexedDB<"u")return msIndexedDB}catch(e){return}}var S=g();function A(){try{if(!S||!S.open)return!1;var e=typeof openDatabase<"u"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),r=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!e||r)&&typeof indexedDB<"u"&&typeof IDBKeyRange<"u"}catch(t){return!1}}function N(e,r){e=e||[],r=r||{};try{return new Blob(e,r)}catch(n){if(n.name!=="TypeError")throw n;for(var t=typeof BlobBuilder<"u"?BlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:WebKitBlobBuilder,o=new t,a=0;a<e.length;a+=1)o.append(e[a]);return o.getBlob(r.type)}}typeof Promise>"u"&&w(3);var v=Promise;function I(e,r){r&&e.then(function(t){r(null,t)},function(t){r(t)})}function C(e,r,t){typeof r=="function"&&e.then(r),typeof t=="function"&&e.catch(t)}function U(e){return typeof e!="string"&&(console.warn(e+" used as a key, but it is not a string."),e=String(e)),e}function V(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var J="local-forage-detect-blob-support",W=void 0,M={},de=Object.prototype.toString,H="readonly",p="readwrite";function D(e){for(var r=e.length,t=new ArrayBuffer(r),o=new Uint8Array(t),a=0;a<r;a++)o[a]=e.charCodeAt(a);return t}function R(e){return new v(function(r){var t=e.transaction(J,p),o=N([""]);t.objectStore(J).put(o,"key"),t.onabort=function(a){a.preventDefault(),a.stopPropagation(),r(!1)},t.oncomplete=function(){var a=navigator.userAgent.match(/Chrome\/(\d+)/),n=navigator.userAgent.match(/Edge\//);r(n||!a||parseInt(a[1],10)>=43)}}).catch(function(){return!1})}function T(e){return typeof W=="boolean"?v.resolve(W):R(e).then(function(r){return W=r,W})}function j(e){var r=M[e.name],t={};t.promise=new v(function(o,a){t.resolve=o,t.reject=a}),r.deferredOperations.push(t),r.dbReady?r.dbReady=r.dbReady.then(function(){return t.promise}):r.dbReady=t.promise}function F(e){var r=M[e.name],t=r.deferredOperations.pop();if(t)return t.resolve(),t.promise}function $(e,r){var t=M[e.name],o=t.deferredOperations.pop();if(o)return o.reject(r),o.promise}function k(e,r){return new v(function(t,o){if(M[e.name]=M[e.name]||Ce(),e.db)if(r)j(e),e.db.close();else return t(e.db);var a=[e.name];r&&a.push(e.version);var n=S.open.apply(S,a);r&&(n.onupgradeneeded=function(i){var c=n.result;try{c.createObjectStore(e.storeName),i.oldVersion<=1&&c.createObjectStore(J)}catch(f){if(f.name==="ConstraintError")console.warn('The database "'+e.name+'" has been upgraded from version '+i.oldVersion+" to version "+i.newVersion+', but the storage "'+e.storeName+'" already exists.');else throw f}}),n.onerror=function(i){i.preventDefault(),o(n.error)},n.onsuccess=function(){var i=n.result;i.onversionchange=function(c){c.target.close()},t(i),F(e)}})}function Y(e){return k(e,!1)}function ee(e){return k(e,!0)}function ae(e,r){if(!e.db)return!0;var t=!e.db.objectStoreNames.contains(e.storeName),o=e.version<e.db.version,a=e.version>e.db.version;if(o&&(e.version!==r&&console.warn('The database "'+e.name+`" can't be downgraded from version `+e.db.version+" to version "+e.version+"."),e.version=e.db.version),a||t){if(t){var n=e.db.version+1;n>e.version&&(e.version=n)}return!0}return!1}function he(e){return new v(function(r,t){var o=new FileReader;o.onerror=t,o.onloadend=function(a){var n=btoa(a.target.result||"");r({__local_forage_encoded_blob:!0,data:n,type:e.type})},o.readAsBinaryString(e)})}function q(e){var r=D(atob(e.data));return N([r],{type:e.type})}function Pe(e){return e&&e.__local_forage_encoded_blob}function yt(e){var r=this,t=r._initReady().then(function(){var o=M[r._dbInfo.name];if(o&&o.dbReady)return o.dbReady});return C(t,e,e),t}function bt(e){j(e);for(var r=M[e.name],t=r.forages,o=0;o<t.length;o++){var a=t[o];a._dbInfo.db&&(a._dbInfo.db.close(),a._dbInfo.db=null)}return e.db=null,Y(e).then(function(n){return e.db=n,ae(e)?ee(e):n}).then(function(n){e.db=r.db=n;for(var i=0;i<t.length;i++)t[i]._dbInfo.db=n}).catch(function(n){throw $(e,n),n})}function X(e,r,t,o){o===void 0&&(o=1);try{var a=e.db.transaction(e.storeName,r);t(null,a)}catch(n){if(o>0&&(!e.db||n.name==="InvalidStateError"||n.name==="NotFoundError"))return v.resolve().then(function(){if(!e.db||n.name==="NotFoundError"&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),ee(e)}).then(function(){return bt(e).then(function(){X(e,r,t,o-1)})}).catch(t);t(n)}}function Ce(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function wt(e){var r=this,t={db:null};if(e)for(var o in e)t[o]=e[o];var a=M[t.name];a||(a=Ce(),M[t.name]=a),a.forages.push(r),r._initReady||(r._initReady=r.ready,r.ready=yt);var n=[];function i(){return v.resolve()}for(var c=0;c<a.forages.length;c++){var f=a.forages[c];f!==r&&n.push(f._initReady().catch(i))}var d=a.forages.slice(0);return v.all(n).then(function(){return t.db=a.db,Y(t)}).then(function(h){return t.db=h,ae(t,r._defaultConfig.version)?ee(t):h}).then(function(h){t.db=a.db=h,r._dbInfo=t;for(var y=0;y<d.length;y++){var E=d[y];E!==r&&(E._dbInfo.db=t.db,E._dbInfo.version=t.version)}})}function _t(e,r){var t=this;e=U(e);var o=new v(function(a,n){t.ready().then(function(){X(t._dbInfo,H,function(i,c){if(i)return n(i);try{var f=c.objectStore(t._dbInfo.storeName),d=f.get(e);d.onsuccess=function(){var h=d.result;h===void 0&&(h=null),Pe(h)&&(h=q(h)),a(h)},d.onerror=function(){n(d.error)}}catch(h){n(h)}})}).catch(n)});return I(o,r),o}function St(e,r){var t=this,o=new v(function(a,n){t.ready().then(function(){X(t._dbInfo,H,function(i,c){if(i)return n(i);try{var f=c.objectStore(t._dbInfo.storeName),d=f.openCursor(),h=1;d.onsuccess=function(){var y=d.result;if(y){var E=y.value;Pe(E)&&(E=q(E));var O=e(E,y.key,h++);O!==void 0?a(O):y.continue()}else a()},d.onerror=function(){n(d.error)}}catch(y){n(y)}})}).catch(n)});return I(o,r),o}function It(e,r,t){var o=this;e=U(e);var a=new v(function(n,i){var c;o.ready().then(function(){return c=o._dbInfo,de.call(r)==="[object Blob]"?T(c.db).then(function(f){return f?r:he(r)}):r}).then(function(f){X(o._dbInfo,p,function(d,h){if(d)return i(d);try{var y=h.objectStore(o._dbInfo.storeName);f===null&&(f=void 0);var E=y.put(f,e);h.oncomplete=function(){f===void 0&&(f=null),n(f)},h.onabort=h.onerror=function(){var O=E.error?E.error:E.transaction.error;i(O)}}catch(O){i(O)}})}).catch(i)});return I(a,t),a}function xt(e,r){var t=this;e=U(e);var o=new v(function(a,n){t.ready().then(function(){X(t._dbInfo,p,function(i,c){if(i)return n(i);try{var f=c.objectStore(t._dbInfo.storeName),d=f.delete(e);c.oncomplete=function(){a()},c.onerror=function(){n(d.error)},c.onabort=function(){var h=d.error?d.error:d.transaction.error;n(h)}}catch(h){n(h)}})}).catch(n)});return I(o,r),o}function Et(e){var r=this,t=new v(function(o,a){r.ready().then(function(){X(r._dbInfo,p,function(n,i){if(n)return a(n);try{var c=i.objectStore(r._dbInfo.storeName),f=c.clear();i.oncomplete=function(){o()},i.onabort=i.onerror=function(){var d=f.error?f.error:f.transaction.error;a(d)}}catch(d){a(d)}})}).catch(a)});return I(t,e),t}function Rt(e){var r=this,t=new v(function(o,a){r.ready().then(function(){X(r._dbInfo,H,function(n,i){if(n)return a(n);try{var c=i.objectStore(r._dbInfo.storeName),f=c.count();f.onsuccess=function(){o(f.result)},f.onerror=function(){a(f.error)}}catch(d){a(d)}})}).catch(a)});return I(t,e),t}function At(e,r){var t=this,o=new v(function(a,n){if(e<0){a(null);return}t.ready().then(function(){X(t._dbInfo,H,function(i,c){if(i)return n(i);try{var f=c.objectStore(t._dbInfo.storeName),d=!1,h=f.openKeyCursor();h.onsuccess=function(){var y=h.result;if(!y){a(null);return}e===0||d?a(y.key):(d=!0,y.advance(e))},h.onerror=function(){n(h.error)}}catch(y){n(y)}})}).catch(n)});return I(o,r),o}function Dt(e){var r=this,t=new v(function(o,a){r.ready().then(function(){X(r._dbInfo,H,function(n,i){if(n)return a(n);try{var c=i.objectStore(r._dbInfo.storeName),f=c.openKeyCursor(),d=[];f.onsuccess=function(){var h=f.result;if(!h){o(d);return}d.push(h.key),h.continue()},f.onerror=function(){a(f.error)}}catch(h){a(h)}})}).catch(a)});return I(t,e),t}function Ot(e,r){r=V.apply(this,arguments);var t=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var o=this,a;if(!e.name)a=v.reject("Invalid arguments");else{var n=e.name===t.name&&o._dbInfo.db,i=n?v.resolve(o._dbInfo.db):Y(e).then(function(c){var f=M[e.name],d=f.forages;f.db=c;for(var h=0;h<d.length;h++)d[h]._dbInfo.db=c;return c});e.storeName?a=i.then(function(c){if(c.objectStoreNames.contains(e.storeName)){var f=c.version+1;j(e);var d=M[e.name],h=d.forages;c.close();for(var y=0;y<h.length;y++){var E=h[y];E._dbInfo.db=null,E._dbInfo.version=f}var O=new v(function(L,B){var P=S.open(e.name,f);P.onerror=function(K){var re=P.result;re.close(),B(K)},P.onupgradeneeded=function(){var K=P.result;K.deleteObjectStore(e.storeName)},P.onsuccess=function(){var K=P.result;K.close(),L(K)}});return O.then(function(L){d.db=L;for(var B=0;B<h.length;B++){var P=h[B];P._dbInfo.db=L,F(P._dbInfo)}}).catch(function(L){throw($(e,L)||v.resolve()).catch(function(){}),L})}}):a=i.then(function(c){j(e);var f=M[e.name],d=f.forages;c.close();for(var h=0;h<d.length;h++){var y=d[h];y._dbInfo.db=null}var E=new v(function(O,L){var B=S.deleteDatabase(e.name);B.onerror=function(){var P=B.result;P&&P.close(),L(B.error)},B.onblocked=function(){console.warn('dropInstance blocked for database "'+e.name+'" until all open connections are closed')},B.onsuccess=function(){var P=B.result;P&&P.close(),O(P)}});return E.then(function(O){f.db=O;for(var L=0;L<d.length;L++){var B=d[L];F(B._dbInfo)}}).catch(function(O){throw($(e,O)||v.resolve()).catch(function(){}),O})})}return I(a,r),a}var Lt={_driver:"asyncStorage",_initStorage:wt,_support:A(),iterate:St,getItem:_t,setItem:It,removeItem:xt,clear:Et,length:Rt,key:At,keys:Dt,dropInstance:Ot};function Tt(){return typeof openDatabase=="function"}var z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Nt="~~local_forage_type~",Be=/^~~local_forage_type~([^~]+)~/,ie="__lfsc__:",ve=ie.length,me="arbf",pe="blob",Ue="si08",Je="ui08",Me="uic8",je="si16",Fe="si32",$e="ur16",ke="ui32",Ke="fl32",Ve="fl64",We=ve+me.length,Ye=Object.prototype.toString;function Xe(e){var r=e.length*.75,t=e.length,o,a=0,n,i,c,f;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var d=new ArrayBuffer(r),h=new Uint8Array(d);for(o=0;o<t;o+=4)n=z.indexOf(e[o]),i=z.indexOf(e[o+1]),c=z.indexOf(e[o+2]),f=z.indexOf(e[o+3]),h[a++]=n<<2|i>>4,h[a++]=(i&15)<<4|c>>2,h[a++]=(c&3)<<6|f&63;return d}function ge(e){var r=new Uint8Array(e),t="",o;for(o=0;o<r.length;o+=3)t+=z[r[o]>>2],t+=z[(r[o]&3)<<4|r[o+1]>>4],t+=z[(r[o+1]&15)<<2|r[o+2]>>6],t+=z[r[o+2]&63];return r.length%3===2?t=t.substring(0,t.length-1)+"=":r.length%3===1&&(t=t.substring(0,t.length-2)+"=="),t}function Pt(e,r){var t="";if(e&&(t=Ye.call(e)),e&&(t==="[object ArrayBuffer]"||e.buffer&&Ye.call(e.buffer)==="[object ArrayBuffer]")){var o,a=ie;e instanceof ArrayBuffer?(o=e,a+=me):(o=e.buffer,t==="[object Int8Array]"?a+=Ue:t==="[object Uint8Array]"?a+=Je:t==="[object Uint8ClampedArray]"?a+=Me:t==="[object Int16Array]"?a+=je:t==="[object Uint16Array]"?a+=$e:t==="[object Int32Array]"?a+=Fe:t==="[object Uint32Array]"?a+=ke:t==="[object Float32Array]"?a+=Ke:t==="[object Float64Array]"?a+=Ve:r(new Error("Failed to get type for BinaryArray"))),r(a+ge(o))}else if(t==="[object Blob]"){var n=new FileReader;n.onload=function(){var i=Nt+e.type+"~"+ge(this.result);r(ie+pe+i)},n.readAsArrayBuffer(e)}else try{r(JSON.stringify(e))}catch(i){console.error("Couldn't convert value into a JSON string: ",e),r(null,i)}}function Ct(e){if(e.substring(0,ve)!==ie)return JSON.parse(e);var r=e.substring(We),t=e.substring(ve,We),o;if(t===pe&&Be.test(r)){var a=r.match(Be);o=a[1],r=r.substring(a[0].length)}var n=Xe(r);switch(t){case me:return n;case pe:return N([n],{type:o});case Ue:return new Int8Array(n);case Je:return new Uint8Array(n);case Me:return new Uint8ClampedArray(n);case je:return new Int16Array(n);case $e:return new Uint16Array(n);case Fe:return new Int32Array(n);case ke:return new Uint32Array(n);case Ke:return new Float32Array(n);case Ve:return new Float64Array(n);default:throw new Error("Unkown type: "+t)}}var ye={serialize:Pt,deserialize:Ct,stringToBuffer:Xe,bufferToString:ge};function ze(e,r,t,o){e.executeSql("CREATE TABLE IF NOT EXISTS "+r.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],t,o)}function Bt(e){var r=this,t={db:null};if(e)for(var o in e)t[o]=typeof e[o]!="string"?e[o].toString():e[o];var a=new v(function(n,i){try{t.db=openDatabase(t.name,String(t.version),t.description,t.size)}catch(c){return i(c)}t.db.transaction(function(c){ze(c,t,function(){r._dbInfo=t,n()},function(f,d){i(d)})},i)});return t.serializer=ye,a}function G(e,r,t,o,a,n){e.executeSql(t,o,a,function(i,c){c.code===c.SYNTAX_ERR?i.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[r.storeName],function(f,d){d.rows.length?n(f,c):ze(f,r,function(){f.executeSql(t,o,a,n)},n)},n):n(i,c)},n)}function Ut(e,r){var t=this;e=U(e);var o=new v(function(a,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(c){G(c,i,"SELECT * FROM "+i.storeName+" WHERE key = ? LIMIT 1",[e],function(f,d){var h=d.rows.length?d.rows.item(0).value:null;h&&(h=i.serializer.deserialize(h)),a(h)},function(f,d){n(d)})})}).catch(n)});return I(o,r),o}function Jt(e,r){var t=this,o=new v(function(a,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(c){G(c,i,"SELECT * FROM "+i.storeName,[],function(f,d){for(var h=d.rows,y=h.length,E=0;E<y;E++){var O=h.item(E),L=O.value;if(L&&(L=i.serializer.deserialize(L)),L=e(L,O.key,E+1),L!==void 0){a(L);return}}a()},function(f,d){n(d)})})}).catch(n)});return I(o,r),o}function Ge(e,r,t,o){var a=this;e=U(e);var n=new v(function(i,c){a.ready().then(function(){r===void 0&&(r=null);var f=r,d=a._dbInfo;d.serializer.serialize(r,function(h,y){y?c(y):d.db.transaction(function(E){G(E,d,"INSERT OR REPLACE INTO "+d.storeName+" (key, value) VALUES (?, ?)",[e,h],function(){i(f)},function(O,L){c(L)})},function(E){if(E.code===E.QUOTA_ERR){if(o>0){i(Ge.apply(a,[e,f,t,o-1]));return}c(E)}})})}).catch(c)});return I(n,t),n}function Mt(e,r,t){return Ge.apply(this,[e,r,t,1])}function jt(e,r){var t=this;e=U(e);var o=new v(function(a,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(c){G(c,i,"DELETE FROM "+i.storeName+" WHERE key = ?",[e],function(){a()},function(f,d){n(d)})})}).catch(n)});return I(o,r),o}function Ft(e){var r=this,t=new v(function(o,a){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(i){G(i,n,"DELETE FROM "+n.storeName,[],function(){o()},function(c,f){a(f)})})}).catch(a)});return I(t,e),t}function $t(e){var r=this,t=new v(function(o,a){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(i){G(i,n,"SELECT COUNT(key) as c FROM "+n.storeName,[],function(c,f){var d=f.rows.item(0).c;o(d)},function(c,f){a(f)})})}).catch(a)});return I(t,e),t}function kt(e,r){var t=this,o=new v(function(a,n){t.ready().then(function(){var i=t._dbInfo;i.db.transaction(function(c){G(c,i,"SELECT key FROM "+i.storeName+" WHERE id = ? LIMIT 1",[e+1],function(f,d){var h=d.rows.length?d.rows.item(0).key:null;a(h)},function(f,d){n(d)})})}).catch(n)});return I(o,r),o}function Kt(e){var r=this,t=new v(function(o,a){r.ready().then(function(){var n=r._dbInfo;n.db.transaction(function(i){G(i,n,"SELECT key FROM "+n.storeName,[],function(c,f){for(var d=[],h=0;h<f.rows.length;h++)d.push(f.rows.item(h).key);o(d)},function(c,f){a(f)})})}).catch(a)});return I(t,e),t}function Vt(e){return new v(function(r,t){e.transaction(function(o){o.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(a,n){for(var i=[],c=0;c<n.rows.length;c++)i.push(n.rows.item(c).name);r({db:e,storeNames:i})},function(a,n){t(n)})},function(o){t(o)})})}function Wt(e,r){r=V.apply(this,arguments);var t=this.config();e=typeof e!="function"&&e||{},e.name||(e.name=e.name||t.name,e.storeName=e.storeName||t.storeName);var o=this,a;return e.name?a=new v(function(n){var i;e.name===t.name?i=o._dbInfo.db:i=openDatabase(e.name,"","",0),e.storeName?n({db:i,storeNames:[e.storeName]}):n(Vt(i))}).then(function(n){return new v(function(i,c){n.db.transaction(function(f){function d(O){return new v(function(L,B){f.executeSql("DROP TABLE IF EXISTS "+O,[],function(){L()},function(P,K){B(K)})})}for(var h=[],y=0,E=n.storeNames.length;y<E;y++)h.push(d(n.storeNames[y]));v.all(h).then(function(){i()}).catch(function(O){c(O)})},function(f){c(f)})})}):a=v.reject("Invalid arguments"),I(a,r),a}var Yt={_driver:"webSQLStorage",_initStorage:Bt,_support:Tt(),iterate:Jt,getItem:Ut,setItem:Mt,removeItem:jt,clear:Ft,length:$t,key:kt,keys:Kt,dropInstance:Wt};function Xt(){try{return typeof localStorage<"u"&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}function He(e,r){var t=e.name+"/";return e.storeName!==r.storeName&&(t+=e.storeName+"/"),t}function zt(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(r){return!0}}function Gt(){return!zt()||localStorage.length>0}function Ht(e){var r=this,t={};if(e)for(var o in e)t[o]=e[o];return t.keyPrefix=He(e,r._defaultConfig),Gt()?(r._dbInfo=t,t.serializer=ye,v.resolve()):v.reject()}function Qt(e){var r=this,t=r.ready().then(function(){for(var o=r._dbInfo.keyPrefix,a=localStorage.length-1;a>=0;a--){var n=localStorage.key(a);n.indexOf(o)===0&&localStorage.removeItem(n)}});return I(t,e),t}function qt(e,r){var t=this;e=U(e);var o=t.ready().then(function(){var a=t._dbInfo,n=localStorage.getItem(a.keyPrefix+e);return n&&(n=a.serializer.deserialize(n)),n});return I(o,r),o}function Zt(e,r){var t=this,o=t.ready().then(function(){for(var a=t._dbInfo,n=a.keyPrefix,i=n.length,c=localStorage.length,f=1,d=0;d<c;d++){var h=localStorage.key(d);if(h.indexOf(n)===0){var y=localStorage.getItem(h);if(y&&(y=a.serializer.deserialize(y)),y=e(y,h.substring(i),f++),y!==void 0)return y}}});return I(o,r),o}function er(e,r){var t=this,o=t.ready().then(function(){var a=t._dbInfo,n;try{n=localStorage.key(e)}catch(i){n=null}return n&&(n=n.substring(a.keyPrefix.length)),n});return I(o,r),o}function tr(e){var r=this,t=r.ready().then(function(){for(var o=r._dbInfo,a=localStorage.length,n=[],i=0;i<a;i++){var c=localStorage.key(i);c.indexOf(o.keyPrefix)===0&&n.push(c.substring(o.keyPrefix.length))}return n});return I(t,e),t}function rr(e){var r=this,t=r.keys().then(function(o){return o.length});return I(t,e),t}function nr(e,r){var t=this;e=U(e);var o=t.ready().then(function(){var a=t._dbInfo;localStorage.removeItem(a.keyPrefix+e)});return I(o,r),o}function or(e,r,t){var o=this;e=U(e);var a=o.ready().then(function(){r===void 0&&(r=null);var n=r;return new v(function(i,c){var f=o._dbInfo;f.serializer.serialize(r,function(d,h){if(h)c(h);else try{localStorage.setItem(f.keyPrefix+e,d),i(n)}catch(y){(y.name==="QuotaExceededError"||y.name==="NS_ERROR_DOM_QUOTA_REACHED")&&c(y),c(y)}})})});return I(a,t),a}function ar(e,r){if(r=V.apply(this,arguments),e=typeof e!="function"&&e||{},!e.name){var t=this.config();e.name=e.name||t.name,e.storeName=e.storeName||t.storeName}var o=this,a;return e.name?a=new v(function(n){e.storeName?n(He(e,o._defaultConfig)):n(e.name+"/")}).then(function(n){for(var i=localStorage.length-1;i>=0;i--){var c=localStorage.key(i);c.indexOf(n)===0&&localStorage.removeItem(c)}}):a=v.reject("Invalid arguments"),I(a,r),a}var ir={_driver:"localStorageWrapper",_initStorage:Ht,_support:Xt(),iterate:Zt,getItem:qt,setItem:or,removeItem:nr,clear:Qt,length:rr,key:er,keys:tr,dropInstance:ar},sr=function(r,t){return r===t||typeof r=="number"&&typeof t=="number"&&isNaN(r)&&isNaN(t)},ur=function(r,t){for(var o=r.length,a=0;a<o;){if(sr(r[a],t))return!0;a++}return!1},Qe=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},te={},qe={},Z={INDEXEDDB:Lt,WEBSQL:Yt,LOCALSTORAGE:ir},cr=[Z.INDEXEDDB._driver,Z.WEBSQL._driver,Z.LOCALSTORAGE._driver],se=["dropInstance"],be=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(se),fr={description:"",driver:cr.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function lr(e,r){e[r]=function(){var t=arguments;return e.ready().then(function(){return e[r].apply(e,t)})}}function we(){for(var e=1;e<arguments.length;e++){var r=arguments[e];if(r)for(var t in r)r.hasOwnProperty(t)&&(Qe(r[t])?arguments[0][t]=r[t].slice():arguments[0][t]=r[t])}return arguments[0]}var dr=function(){function e(r){_(this,e);for(var t in Z)if(Z.hasOwnProperty(t)){var o=Z[t],a=o._driver;this[t]=a,te[a]||this.defineDriver(o)}this._defaultConfig=we({},fr),this._config=we({},this._defaultConfig,r),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.prototype.config=function(t){if((typeof t>"u"?"undefined":b(t))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var o in t){if(o==="storeName"&&(t[o]=t[o].replace(/\W/g,"_")),o==="version"&&typeof t[o]!="number")return new Error("Database version must be a number.");this._config[o]=t[o]}return"driver"in t&&t.driver?this.setDriver(this._config.driver):!0}else return typeof t=="string"?this._config[t]:this._config},e.prototype.defineDriver=function(t,o,a){var n=new v(function(i,c){try{var f=t._driver,d=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!t._driver){c(d);return}for(var h=be.concat("_initStorage"),y=0,E=h.length;y<E;y++){var O=h[y],L=!ur(se,O);if((L||t[O])&&typeof t[O]!="function"){c(d);return}}var B=function(){for(var re=function(mr){return function(){var pr=new Error("Method "+mr+" is not implemented by the current driver"),Ze=v.reject(pr);return I(Ze,arguments[arguments.length-1]),Ze}},_e=0,vr=se.length;_e<vr;_e++){var Se=se[_e];t[Se]||(t[Se]=re(Se))}};B();var P=function(re){te[f]&&console.info("Redefining LocalForage driver: "+f),te[f]=t,qe[f]=re,i()};"_support"in t?t._support&&typeof t._support=="function"?t._support().then(P,c):P(!!t._support):P(!0)}catch(K){c(K)}});return C(n,o,a),n},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(t,o,a){var n=te[t]?v.resolve(te[t]):v.reject(new Error("Driver not found."));return C(n,o,a),n},e.prototype.getSerializer=function(t){var o=v.resolve(ye);return C(o,t),o},e.prototype.ready=function(t){var o=this,a=o._driverSet.then(function(){return o._ready===null&&(o._ready=o._initDriver()),o._ready});return C(a,t,t),a},e.prototype.setDriver=function(t,o,a){var n=this;Qe(t)||(t=[t]);var i=this._getSupportedDrivers(t);function c(){n._config.driver=n.driver()}function f(y){return n._extend(y),c(),n._ready=n._initStorage(n._config),n._ready}function d(y){return function(){var E=0;function O(){for(;E<y.length;){var L=y[E];return E++,n._dbInfo=null,n._ready=null,n.getDriver(L).then(f).catch(O)}c();var B=new Error("No available storage method found.");return n._driverSet=v.reject(B),n._driverSet}return O()}}var h=this._driverSet!==null?this._driverSet.catch(function(){return v.resolve()}):v.resolve();return this._driverSet=h.then(function(){var y=i[0];return n._dbInfo=null,n._ready=null,n.getDriver(y).then(function(E){n._driver=E._driver,c(),n._wrapLibraryMethodsWithReady(),n._initDriver=d(i)})}).catch(function(){c();var y=new Error("No available storage method found.");return n._driverSet=v.reject(y),n._driverSet}),C(this._driverSet,o,a),this._driverSet},e.prototype.supports=function(t){return!!qe[t]},e.prototype._extend=function(t){we(this,t)},e.prototype._getSupportedDrivers=function(t){for(var o=[],a=0,n=t.length;a<n;a++){var i=t[a];this.supports(i)&&o.push(i)}return o},e.prototype._wrapLibraryMethodsWithReady=function(){for(var t=0,o=be.length;t<o;t++)lr(this,be[t])},e.prototype.createInstance=function(t){return new e(t)},e}(),hr=new dr;m.exports=hr},{3:3}]},{},[4])(4)})});var Ie=u=>{var _,g,S;let s=u.split("-")[1];s&&(u=u.replace(`-${s}`,""));let l=u.split("+")[1];l&&(u=u.replace(`+${l}`,""));let w=u.split(".").slice(0,3),[m,x,b]=[(_=w[0])!=null?_:"0",(g=w[1])!=null?g:"0",(S=w[2])!=null?S:"0"];return{major:m,minor:x,patch:b,prerelease:s,build:l}},ce=u=>parseInt(Ie(u).major,10),tt=(u,s)=>{let{major:l,minor:w,patch:m}=Ie(u),{major:x,minor:b,patch:_}=Ie(s);return l!==x?l>x?1:-1:w!==b?w>b?1:-1:m!==_?m>_?1:-1:0};var rt="jolibox-sdk-loader-metadata",xe=class{constructor({loaderMetadata:s}={}){this.computeLoaderMetaData=()=>{var m,x;let s=this.currentVersion,l=null;try{if(l=JSON.parse((m=localStorage.getItem(rt))!=null?m:"null"),!l||!l.version)throw new Error("Invalid loader metadata")}catch(b){l=this.defaultMetadata}let w=(x=l==null?void 0:l.version)!=null?x:s;return ce(w)!==ce(s)?l=this.defaultMetadata:tt(w,s)<0&&(l=this.defaultMetadata),l};this.loadScript=()=>{if(this.loaderMetadata.syncScriptUrl){let s=new XMLHttpRequest;s.open("GET",this.loaderMetadata.syncScriptUrl,!1),s.send();let l=document.createElement("script");l.type="text/javascript",l.innerHTML=s.responseText,document.head.appendChild(l)}if(this.loaderMetadata.asyncScriptUrl){let s=document.createElement("script");s.type="text/javascript",s.src=this.loaderMetadata.asyncScriptUrl,s.async=!0,document.head.appendChild(s)}};this.fetchUpdateLoaderMetadata=(...x)=>ue(this,[...x],function*(s=this.currentVersion,l=this.loaderMetadata.version,w=(m=>(m=window.JOLIBOX_ENV)!=null?m:"WEB")()){var _,g,S;let b=`${(g=(_=window.joliboxenv)==null?void 0:_.apiBaseURL)!=null?g:"https://api.jolibox.com"}/frontend/js-sdk/loader-metadata`;try{let N=yield(yield fetch(b,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({installedSDKVersion:s,localSDKVersion:l,env:w})})).json();if(N.code!=="SUCCESS")throw new Error(N.message);this.loaderMetadata=(S=N.data)!=null?S:this.defaultMetadata,localStorage.setItem(rt,JSON.stringify(this.loaderMetadata))}catch(A){console.warn("Failed to fetch loader metadata: ",A)}});console.log("Loading Jolibox SDK..."),this.loaderMetadata=s!=null?s:this.computeLoaderMetaData(),this.loadScript(),this.fetchUpdateLoaderMetadata(),console.log("Jolibox SDK loaded.")}get currentVersion(){return window.__JOLIBOX_LOCAL_SDK_VERSION__}get defaultMetadata(){let s=this.currentVersion,l=ce(s);return{version:s,syncScriptUrl:`https://cdn.jsdelivr.net/npm/@jolibox/web-sync-sdk@${l}/dist/index.iife.js`,asyncScriptUrl:`https://cdn.jsdelivr.net/npm/@jolibox/web-async-sdk@${l}/dist/index.iife.js`}}};window.JoliboxSDKLoader=xe;var Ee=class{constructor(){this.init=s=>{window.joliboxsdk._commandPipe.push({cmd:"ads.init",params:s})};this.adConfig=s=>{window.joliboxsdk._commandPipe.push({cmd:"ads.adConfig",params:s})};this.adBreak=s=>{window.joliboxsdk._commandPipe.push({cmd:"ads.adBreak",params:s})};this.adUnit=s=>ue(this,null,function*(){window.joliboxsdk._commandPipe.push({cmd:"ads.adUnit",params:s})})}};window.JoliboxAds=Ee;var Re=class{constructor(){this.trackEvent=(s,l)=>{if(typeof s!="string")throw new Error("eventName must be a string");if(l!==null&&typeof l!="object"&&l!==void 0)throw new Error("extra must be an object or null or undefined");if(l){for(let w in l)if(typeof l[w]=="object")throw new Error("extra must not have nested objects")}window.joliboxsdk._commandPipe.push({cmd:"analytics.trackEvent",params:[s,l]})}}};window.JoliboxAnalytics=Re;var gt=xr(ot(),1),Er=Object.defineProperty,Oe=(u,s)=>{for(var l in s)Er(u,l,{get:s[l],enumerable:!0})},Q=(u,s,l)=>new Promise((w,m)=>{var x=g=>{try{_(l.next(g))}catch(S){m(S)}},b=g=>{try{_(l.throw(g))}catch(S){m(S)}},_=g=>g.done?w(g.value):Promise.resolve(g.value).then(x,b);_((l=l.apply(u,s)).next())}),at={};Oe(at,{ADVERTISING_ID:()=>ft,DEVICE_ID:()=>ct,getAdvertisingId:()=>dt,getAppVersion:()=>ut,getDeviceId:()=>lt,getPlatform:()=>st,getStorage:()=>Te,getUtmSource:()=>ht,platform:()=>oe,xUserAgent:()=>vt});var it={};Oe(it,{isValidUUIDV4:()=>Rr,uuidv4:()=>Le});var Le=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,u=>{let s=Math.random()*16|0;return(u==="x"?s:s&3|8).toString(16)}),Rr=u=>/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i.test(u),oe={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let u=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(u[1],10),parseInt(u[2],10),parseInt(u[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},st=()=>oe.isiOS?"iOS":oe.isAndroid?"Android":oe.isMac?"Mac":oe.isFacebook?"Facebook":"PC",ut=()=>window.__JOLIBOX_LOCAL_SDK_VERSION__,ct="device_id",ft="advertising_id",Te=u=>(localStorage.getItem(u)||localStorage.setItem(u,Le()),localStorage.getItem(u)),lt=()=>Te(ct),dt=()=>Te(ft),Ar=u=>u.charAt(0).toUpperCase()+u.slice(1),ht=()=>{var u;let s=new URLSearchParams(window.location.search);return Ar((u=s.get("utm_source"))!=null?u:"")||"JoliboxSDK"},vt=()=>{let u="JoliboxWebSDK",s=st(),l=navigator.language,w=lt(),m=dt(),x=ut();return`${u} (${ht()}${s}; UnknownModel; UnknownSystemVersion; ${l}) uuid/${w} adid/${m} version/${x||""}`},Dr;(Dr=AbortSignal.timeout)!=null||(AbortSignal.timeout=function(u){let s=new AbortController;return setTimeout(()=>s.abort(),u),s.signal});var mt=class{constructor(u){this.xua=vt(),this.getGameId=()=>{var m;return(m=new URLSearchParams(window.location.search).get("gameId"))!=null?m:null},this.getJoliSource=()=>{var m;return(m=new URLSearchParams(window.location.search).get("joliSource"))!=null?m:null};var s,l,w;this.baseUrl=(w=(l=u==null?void 0:u.baseUrl)!=null?l:(s=window.joliboxenv)==null?void 0:s.apiBaseURL)!=null?w:"https://api.jolibox.com"}get(u,s){return Q(this,arguments,function*(l,{query:w,headers:m,timeout:x}){let b=new URLSearchParams(w).toString(),_=`${this.baseUrl}${l}${b?`?${b}`:""}`,g=this.xua,S=this.getJoliSource();return m=Object.assign({},m,g?{"x-user-agent":g}:{},S?{"x-joli-source":S}:{}),yield(yield fetch(_,{method:"GET",headers:m,signal:AbortSignal.timeout(x!=null?x:3e4)})).json()})}post(u,s){return Q(this,arguments,function*(l,{data:w,query:m,headers:x,timeout:b}){let _=new URLSearchParams(m).toString(),g=`${this.baseUrl}${l}${_?`?${_}`:""}`,S=this.xua,A=this.getJoliSource();x=Object.assign({},x,{"Content-Type":"application/json"},S?{"x-user-agent":S}:{},A?{"x-joli-source":A}:{});let N=yield fetch(g,{method:"POST",headers:x,body:JSON.stringify(w),signal:AbortSignal.timeout(b!=null?b:3e4)}),v=N.headers.get("content-type");if(v!=null&&v.includes("application/octet-stream"))try{return N.blob()}catch(I){return yield N.arrayBuffer()}if(v!=null&&v.includes("multipart/form-data")||v!=null&&v.includes("application/x-www-form-urlencoded"))try{return N.formData()}catch(I){return yield N.text()}if(v!=null&&v.includes("application/json"))try{return yield N.json()}catch(I){return yield N.text()}return N})}put(u,s){return Q(this,arguments,function*(l,{data:w,query:m,headers:x}){try{let b=new URLSearchParams(m).toString(),_=`${this.baseUrl}${l}${b?`?${b}`:""}`,g=this.xua,S=this.getJoliSource();x=Object.assign({},x,{"Content-Type":"application/json"},g?{"x-user-agent":g}:{},S?{"x-joli-source":S}:{});let A=yield fetch(_,{method:"PUT",headers:x,body:JSON.stringify(w!=null?w:{})});if(!A.ok)throw new Error(`HTTP error! status: ${A.status}`);return yield A.json()}catch(b){throw console.error("Error:",b),b}})}};window.JoliboxHttpClient=mt;var pt={};Oe(pt,{getGameSessionId:()=>Or});var Or=()=>{let u=sessionStorage.getItem("gameSessionId");return u||(u=Le(),sessionStorage.setItem("gameSessionId",u)),u},fe=class{};fe.xua=at,fe.session=pt,fe.uuid=it;window.JoliboxUtil=fe;var Lr=(u=>(u.LOAD_START="JOLIBOX_RUNTIME_LOAD_START",u.LOAD_FINISHED="JOLIBOX_RUNTIME_LOAD_FINISHED",u.LOAD_PROGRESS="JOLIBOX_RUNTIME_LOAD_PROGRESS",u))(Lr||{});window.dispatchEvent(new Event("JOLIBOX_RUNTIME_LOAD_START"));var Tr=class{constructor(){this.loadFinished=()=>{let u=new Event("JOLIBOX_RUNTIME_LOAD_FINISHED");window.dispatchEvent(u),window.joliboxsdk._commandPipe.push({cmd:"analytics.trackSystemEvent",params:["CallRuntimeLoadFinished"]})},this.notifyLoadProgress=u=>{let s=Math.ceil(u),l=new CustomEvent("JOLIBOX_RUNTIME_LOAD_PROGRESS",{detail:s});window.dispatchEvent(l)}}};window.JoliboxRuntime=Tr;var De="INTERNAL_ERR",Ne=class{constructor(){this.getGameId=()=>{var u;return(u=new URLSearchParams(window.location.search).get("gameId"))!=null?u:""},this.getItem=u=>Q(this,null,function*(){try{let{code:s,data:l,message:w}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:u}}),m=l==null?void 0:l.value;return s!=="SUCCESS"&&(m=yield this.gameStore.getItem(u),console.info("[SDK] cloud storage getItem failed, read from localstorage",m)),{code:s,message:w,data:m!=null?m:null}}catch(s){let l=`[SDK] cloud storage getItem internal error: ${s}`;return console.error(l),{code:"INTERNAL_ERR",message:l}}}),this.setItem=(u,s)=>Q(this,null,function*(){var l,w;try{if(!this.isPrimitiveType(s))throw{code:"PARAMETER_ERROR",message:"[SDK] cloud storage setItem error: typeof value should be number, string or boolean"};if(u.length>128)throw{code:"PARAMETER_ERROR",message:"[SDK] cloud storage setItem error: length of key should be less than 128"};let m=typeof s=="string"?s:String(s);if(u.length+m.length>1024)throw{code:"PARAMETER_ERROR",message:"[SDK] cloud storage setItem error: length of key and value should be less than 1024"};yield this.gameStore.setItem(u,m);let{code:x,message:b}=yield this.httpClient.post(`api/games/user-storage/${this.gameId}`,{data:{key:u,value:m}});return{code:x,message:b}}catch(m){let x=(l=m.code)!=null?l:De,b=(w=m.message)!=null?w:`${m}`;return console.error(b),{code:x,message:b}}}),this.removeItem=u=>Q(this,null,function*(){try{yield this.gameStore.removeItem(u);let{code:s,message:l}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:u}});return{code:s,message:l}}catch(s){let l=`[SDK] cloud storage removeItem error: ${s}`;return console.error(l),{code:De,message:l}}}),this.clear=()=>Q(this,null,function*(){try{yield this.gameStore.clear();let{code:u,message:s}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:u,message:s}}catch(u){let s=`[SDK] cloud storage clear error: ${u}`;return console.error(s),{code:De,message:s}}}),this.gameId=this.getGameId(),this.httpClient=new mt,this.gameStore=gt.default.createInstance({name:this.gameId.length?this.gameId:"default"})}isPrimitiveType(u){return typeof u=="string"||typeof u=="number"||typeof u=="boolean"}};window.JoliboxCloudStorage=Ne;window.__JOLIBOX_LOCAL_SDK_VERSION__="1.0.11-beta.2";var le=class{constructor({useRuntimeSDK:s=!0,loaderConfig:l,testMode:w,apiBaseURL:m}={}){this.hostToApiMap={default:{test:"https://stg-api.jolibox.com",prod:"https://api.jolibox.com"},"oss.jolibox.com":{test:"https://stg-api.jolibox.com",prod:"https://api.jolibox.com"},"oss.pico-game.com":{test:"https://stg-api.pico-game.com",prod:"https://api.pico-game.com"}};this.setJoliboxEnv=(s,l)=>{var S;let m=typeof window<"u"?new URLSearchParams(window.location.search):null,x=(m==null?void 0:m.get("testMode"))==="true",b=s!=null?s:x,_=m==null?void 0:m.get("apiBaseURL"),g;if(l)g=l;else if(_)g=_;else{let A=(S=this.hostToApiMap[window.location.host])!=null?S:this.hostToApiMap.default;g=b?A.test:A.prod}window.joliboxenv={testMode:b,apiBaseURL:g}};var x,b,_,g,S;this.setJoliboxEnv(w,m),s&&window.joliboxsdk?(this.loader=(x=window.joliboxsdk.loader)!=null?x:new window.JoliboxSDKLoader(l),this.ads=(b=window.joliboxsdk.ads)!=null?b:new window.JoliboxAds,this.anaytics=(_=window.joliboxsdk.anaytics)!=null?_:new window.JoliboxAnalytics,this.runtime=(g=window.joliboxsdk.runtime)!=null?g:new window.JoliboxRuntime,this.storage=(S=window.joliboxsdk.storage)!=null?S:new window.JoliboxCloudStorage):(window.joliboxsdk||(window.joliboxsdk={_commandPipe:[]}),this.loader=new window.JoliboxSDKLoader(l),this.ads=new window.JoliboxAds,this.anaytics=new window.JoliboxAnalytics,this.runtime=new window.JoliboxRuntime,this.storage=new window.JoliboxCloudStorage,window.joliboxsdk=Object.assign(this,window.joliboxsdk)),window.joliboxsdk._commandPipe||(window.joliboxsdk._commandPipe=[])}};window.JoliboxSDK||(window.JoliboxSDK=le);var en=le;})();
2
2
  /*! Bundled license information:
3
3
 
4
4
  localforage/dist/localforage.js: