@jolibox/implement 1.1.13-beta.8 → 1.1.13
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/.rush/temp/package-deps_build.json +7 -15
- package/dist/common/utils/index.d.ts +0 -7
- package/dist/index.js +3 -3
- package/dist/index.native.js +6 -6
- package/implement.build.log +2 -2
- package/package.json +4 -4
- package/src/common/ads/anti-cheating.ts +2 -0
- package/src/common/utils/index.ts +0 -7
- package/src/h5/api/ads.ts +1 -20
- package/src/native/api/ads.ts +1 -29
- package/src/native/network/create-fetch.ts +1 -5
- package/src/native/ui/retention.ts +2 -3
- package/dist/common/rewards/__tests__/can-use-jolicoin.test.d.ts +0 -1
- package/dist/common/rewards/fetch-reward.d.ts +0 -2
- package/dist/common/rewards/index.d.ts +0 -18
- package/dist/common/rewards/registers/use-ads.d.ts +0 -3
- package/dist/common/rewards/registers/use-jolicoin.d.ts +0 -9
- package/dist/common/rewards/registers/utils/index.d.ts +0 -2
- package/dist/common/rewards/reward-helper.d.ts +0 -14
- package/dist/common/rewards/type.d.ts +0 -23
- package/src/common/rewards/__tests__/can-use-jolicoin.test.ts +0 -94
- package/src/common/rewards/fetch-reward.ts +0 -33
- package/src/common/rewards/index.ts +0 -20
- package/src/common/rewards/registers/use-ads.ts +0 -9
- package/src/common/rewards/registers/use-jolicoin.ts +0 -89
- package/src/common/rewards/registers/utils/index.ts +0 -11
- package/src/common/rewards/reward-helper.ts +0 -56
- package/src/common/rewards/type.ts +0 -25
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
"packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
|
|
5
5
|
"packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
|
|
6
6
|
"packages/implement/esbuild.config.js": "86f1fd21722a2cb05216751578dcca66326e664a",
|
|
7
|
-
"packages/implement/package.json": "
|
|
7
|
+
"packages/implement/package.json": "215efa8efb03592e6b92655f98be9f0d6264b4ea",
|
|
8
8
|
"packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
|
|
9
9
|
"packages/implement/src/common/ads/anti-cheating.test.ts": "e2ff3dc6760cfd28d0f8c15703d7fb20d43df583",
|
|
10
|
-
"packages/implement/src/common/ads/anti-cheating.ts": "
|
|
10
|
+
"packages/implement/src/common/ads/anti-cheating.ts": "a3ffb6a78e289e1c0ce45c7f7c0cee000e75e541",
|
|
11
11
|
"packages/implement/src/common/ads/channel-policy.ts": "c6d036be5cedf0c5d545fac271c6c8447ca55d8a",
|
|
12
12
|
"packages/implement/src/common/ads/index.ts": "e5d6d4b5754b6735f54b6cad377320ac980efb29",
|
|
13
13
|
"packages/implement/src/common/api-factory/index.ts": "a2b60f027384e37492ddde550dd46f3fb3e14cfe",
|
|
@@ -46,16 +46,8 @@
|
|
|
46
46
|
"packages/implement/src/common/report/task-track/index.ts": "056d4ce9121648e94aa177e8e6b261adb455d244",
|
|
47
47
|
"packages/implement/src/common/report/track.ts": "1c71050f8caadfe7065f0db5a4a0708c264c21b4",
|
|
48
48
|
"packages/implement/src/common/report/types.ts": "fd127bfd31586f1d712152ef60a4e9175f8bfe8f",
|
|
49
|
-
"packages/implement/src/common/
|
|
50
|
-
"packages/implement/src/
|
|
51
|
-
"packages/implement/src/common/rewards/index.ts": "f6160318ce7393684ebf229729b3168beb0c2d99",
|
|
52
|
-
"packages/implement/src/common/rewards/registers/use-ads.ts": "e6eb324d5ac39d0a5df478760fdf0ee75fded1b5",
|
|
53
|
-
"packages/implement/src/common/rewards/registers/use-jolicoin.ts": "ee28989dea8aca243439cb1508d3fac55a689ae1",
|
|
54
|
-
"packages/implement/src/common/rewards/registers/utils/index.ts": "a297dfc50b091368fba6e12e67663693f14ac1b8",
|
|
55
|
-
"packages/implement/src/common/rewards/reward-helper.ts": "2113cbd370da5be4beaf88bed865f1846e43d472",
|
|
56
|
-
"packages/implement/src/common/rewards/type.ts": "75c8444405686dbee1628f6d67c4a6b803e0623e",
|
|
57
|
-
"packages/implement/src/common/utils/index.ts": "6e2af1b721d5a9caf8fa40fd22fc73a2fdd5c4c0",
|
|
58
|
-
"packages/implement/src/h5/api/ads.ts": "35f3efdc7b7ca6399ba589d97691e2e6a811b4c2",
|
|
49
|
+
"packages/implement/src/common/utils/index.ts": "a704a0628b1cf83ac917e265021b95d96ed42526",
|
|
50
|
+
"packages/implement/src/h5/api/ads.ts": "e62a492f0ff6e3bb1be91b83439975151d9a89d8",
|
|
59
51
|
"packages/implement/src/h5/api/base.ts": "ead2c3cdcbe174b0e725c31a3885c7985bd8f667",
|
|
60
52
|
"packages/implement/src/h5/api/get-system-info.ts": "158d66156c720446457318b7eaa9112452114dbb",
|
|
61
53
|
"packages/implement/src/h5/api/index.ts": "81b815f5ac8e1bd3e3f019f94c28bd5522a36193",
|
|
@@ -73,7 +65,7 @@
|
|
|
73
65
|
"packages/implement/src/h5/report/task-tracker.ts": "9b55e81e5c20d459ff851f70689e9280e89c0e63",
|
|
74
66
|
"packages/implement/src/index.native.ts": "96cc46c8919ba2333600e9c3ee100f47c511a79a",
|
|
75
67
|
"packages/implement/src/index.ts": "d0ca7b5312b0a258ae8887e725440c70190442f7",
|
|
76
|
-
"packages/implement/src/native/api/ads.ts": "
|
|
68
|
+
"packages/implement/src/native/api/ads.ts": "e438b619761cfe22b6e87f8aa9978350fbc57274",
|
|
77
69
|
"packages/implement/src/native/api/base.ts": "c4c4d04519cdbc3a08226c620f6314ee3b151435",
|
|
78
70
|
"packages/implement/src/native/api/get-system-info.ts": "187333a4eca5304e896360d1496744cb7535ab49",
|
|
79
71
|
"packages/implement/src/native/api/index.ts": "39c85b6c6d93f91d9ecc4a96a38a39a425d5487a",
|
|
@@ -86,7 +78,7 @@
|
|
|
86
78
|
"packages/implement/src/native/api/task.ts": "26e06a3d6bbeaed34fd704d096e712448296607e",
|
|
87
79
|
"packages/implement/src/native/bootstrap/index.ts": "12b491efeb62cc19c41fc613f725314cce38e969",
|
|
88
80
|
"packages/implement/src/native/bootstrap/init-env.ts": "b7514d5d2db60da990575c1426243777aee57748",
|
|
89
|
-
"packages/implement/src/native/network/create-fetch.ts": "
|
|
81
|
+
"packages/implement/src/native/network/create-fetch.ts": "66291029aa8ba86101127773d7967427234ea40b",
|
|
90
82
|
"packages/implement/src/native/network/index.ts": "f57653dfa388545cbe7fb0a3f1eb9603c6208f45",
|
|
91
83
|
"packages/implement/src/native/network/report.ts": "705e9614faeb0611c9c57ced998885bdc3a02d11",
|
|
92
84
|
"packages/implement/src/native/network/types.ts": "4e8eb72bf0b0b26a5298ce42d96855d27769be51",
|
|
@@ -94,7 +86,7 @@
|
|
|
94
86
|
"packages/implement/src/native/report/errors/index.ts": "40e60ee03e0b91cdb0a143a2bea07f5d1e5d6dd7",
|
|
95
87
|
"packages/implement/src/native/report/index.ts": "2df4598a1004c3f7764ac7a90528e44772b41943",
|
|
96
88
|
"packages/implement/src/native/report/task-tracker.ts": "8905391993830700027cc78c80a76c0750ab0d43",
|
|
97
|
-
"packages/implement/src/native/ui/retention.ts": "
|
|
89
|
+
"packages/implement/src/native/ui/retention.ts": "70f238f775d633a48f95feddc094466835b9845a",
|
|
98
90
|
"packages/implement/tsconfig.json": "b150f4b2ef4eb9d98f92135d481fe530eb7145b5"
|
|
99
91
|
},
|
|
100
92
|
"arguments": "npm run clean && npm run build:esm && tsc "
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
declare const JOLIBOX_CUSTOM_ADS_EVENT_TYPE = "JOLIBOX_ADS_EVENT";
|
|
2
|
-
declare const JOLIBOX_CUSTOM_REWARDS_EVENT_TYPE = "JOLIBOX_CUSTOM_REWARDS_EVENT";
|
|
3
2
|
interface JoliboxCustomEvent {
|
|
4
3
|
[JOLIBOX_CUSTOM_ADS_EVENT_TYPE]: {
|
|
5
4
|
isAdShowing: boolean;
|
|
6
5
|
};
|
|
7
|
-
[JOLIBOX_CUSTOM_REWARDS_EVENT_TYPE]: {
|
|
8
|
-
['JOLI_COIN']?: {
|
|
9
|
-
quantity: number;
|
|
10
|
-
balance: number;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
6
|
}
|
|
14
7
|
export declare const notifyCustomEvent: <T extends keyof JoliboxCustomEvent>(eventName: T, data: JoliboxCustomEvent[T]) => void;
|
|
15
8
|
export {};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var Di=Object.create;var Qt=Object.defineProperty,Ni=Object.defineProperties,Li=Object.getOwnPropertyDescriptor,Ui=Object.getOwnPropertyDescriptors,Fi=Object.getOwnPropertyNames,Qe=Object.getOwnPropertySymbols,Bi=Object.getPrototypeOf,Xt=Object.prototype.hasOwnProperty,fn=Object.prototype.propertyIsEnumerable;var dn=(e,t,r)=>t in e?Qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t)=>{for(var r in t||(t={}))Xt.call(t,r)&&dn(e,r,t[r]);if(Qe)for(var r of Qe(t))fn.call(t,r)&&dn(e,r,t[r]);return e},z=(e,t)=>Ni(e,Ui(t));var Me=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var mn=(e,t)=>{var r={};for(var n in e)Xt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Qe)for(var n of Qe(e))t.indexOf(n)<0&&fn.call(e,n)&&(r[n]=e[n]);return r};var K=(e,t)=>()=>(e&&(t=e(e=0)),t);var pn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Mi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Fi(t))!Xt.call(e,i)&&i!==r&&Qt(e,i,{get:()=>t[i],enumerable:!(n=Li(t,i))||n.enumerable});return e};var hn=(e,t,r)=>(r=e!=null?Di(Bi(e)):{},Mi(t||!e||!e.__esModule?Qt(r,"default",{value:e,enumerable:!0}):r,e));var C=(e,t,r)=>new Promise((n,i)=>{var c=p=>{try{m(r.next(p))}catch(b){i(b)}},d=p=>{try{m(r.throw(p))}catch(b){i(b)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(c,d);m((r=r.apply(e,t)).next())});function Wi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function sr(e){return typeof e=="string"}function wn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function En(e){return typeof e=="object"&&Array.isArray(e)}function Yi(e){return typeof e=="undefined"}function zi(e){return Yi(e)||e===null}function Qi(e){return typeof e=="function"}function In(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Tn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,c){for(let d in c)if(Object.prototype.hasOwnProperty.call(c,d)){let m=i[d],p=c[d],b=r(m,p,d,i,c);b!==void 0?i[d]=b:yn(p)&&yn(m)?i[d]=n(ar({},m),p):Array.isArray(p)&&Array.isArray(m)?i[d]=[...m,...p]:i[d]=p}return i}return n(e,t)}function yn(e){return e&&typeof e=="object"&&e.constructor===Object}function Sn(e,t){if(Array.isArray(e))return e.concat(t)}function Ve(e,t,r={}){let n=null,i,c,d,{leading:m=!1,trailing:p=!0}=r,b=()=>(d=e.apply(c,i),i=void 0,c=void 0,d),v=function(...S){i=S,c=this;let g=m&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p&&!g&&b()},t),g)return b()};return v.cancel=()=>{n&&clearTimeout(n),n=null,i=c=void 0},v.flush=()=>{if(n)return clearTimeout(n),n=null,b()},v}function ea(e,t){return(...r)=>t(e,...r)}function Cn(e){return t=>ea(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Zi(`${i}`))}})}function je(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function et(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,c)=>(i[c]=String(n[c]),i),{})}return e[r]})}function ia(e){let t=e.location?et(e.location,bn):null,r=e.target?et(e.target,bn):null;return et(Ki(ar({},e),{location:t,target:r}),na)}function fr(e){let t=e.events.map(n=>ia(n)),r=et(e.device,oa);return[e.protocolVersion,t,r,e.project]}function ha(e){return new Promise(t=>Nn(e)(t))}function Nn(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function ga(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(c.fire,c)}},c=new $e(i);return c.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function ya(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ba(e[n],t[n])}function ba(e,t){if(sr(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Qi(t)){try{if(e instanceof t)return}catch(r){}if(!zi(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function ae(){if(globalThis[er])return globalThis[er];let e=new tt,t=new or,r={registerCommand(n,i,c){e.registerCommand({id:n,handler:i,metadata:c})},executeCommand(n,...i){return t.executeCommand(n,...i)},excuteCommandSync(n,...i){return t.executeCommandThowErr(n,...i)}};return globalThis[er]=r,r}var ir,ji,$i,Vi,gn,Hi,Ji,vn,ar,Ki,Gi,_n,qi,Xi,cr,ur,Rn,An,Zi,xn,kn,rt,lr,ce,Pn,ta,dr,He,xe,ra,bn,na,oa,mr,Xe,aa,sa,ca,On,pr,ua,la,da,Dn,tr,G,fa,ma,Ze,$e,de,nr,pa,Zt,va,Je,tt,or,er,V=K(()=>{"use strict";ir=Object.defineProperty,ji=Object.defineProperties,$i=Object.getOwnPropertyDescriptor,Vi=Object.getOwnPropertyDescriptors,gn=Object.getOwnPropertySymbols,Hi=Object.prototype.hasOwnProperty,Ji=Object.prototype.propertyIsEnumerable,vn=(e,t,r)=>t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ar=(e,t)=>{for(var r in t||(t={}))Hi.call(t,r)&&vn(e,r,t[r]);if(gn)for(var r of gn(t))Ji.call(t,r)&&vn(e,r,t[r]);return e},Ki=(e,t)=>ji(e,Vi(t)),Gi=(e,t)=>{for(var r in t)ir(e,r,{get:t[r],enumerable:!0})},_n=(e,t,r,n)=>{for(var i=n>1?void 0:n?$i(t,r):t,c=e.length-1,d;c>=0;c--)(d=e[c])&&(i=(n?d(t,r,i):d(i))||i);return n&&i&&ir(t,r,i),i},qi=(e,t,r)=>new Promise((n,i)=>{var c=p=>{try{m(r.next(p))}catch(b){i(b)}},d=p=>{try{m(r.throw(p))}catch(b){i(b)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(c,d);m((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Xi=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(Xi||{}),cr=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},ur=class extends cr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Rn=class extends cr{constructor(){super(...arguments),this.kind="USER_ERROR"}},An=class extends Rn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Zi=class extends Rn{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},xn=class extends ur{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},kn=class extends ur{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},rt=class extends cr{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},lr=class extends ur{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:je("log"),warn:je("warn"),info:je("info"),error:je("error"),debug:je("debug")};Object.assign(globalThis,{logger:ce});Pn=Symbol.for("Jolibox.canIUseMap"),ta={};globalThis[Pn]=ta;dr={get config(){return globalThis[Pn]}},He=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(He||{}),xe=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(xe||{}),ra=(e=>(e[e.App=0]="App",e[e.H5=1]="H5",e[e.Weapp=2]="Weapp",e[e.Alipay=3]="Alipay",e[e.Gcash=4]="Gcash",e[e.Dana=5]="Dana",e[e.Umma=6]="Umma",e[e.WebSDK=1e3]="WebSDK",e[e.AppSDK=1001]="AppSDK",e[e.Other=9999]="Other",e))(ra||{}),bn=["name","params"],na=["name","type","location","target","extra","timestamp","userId"],oa=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];mr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Xe={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[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")},aa=()=>Xe.isiOS?"iOS":Xe.isAndroid?"Android":Xe.isMac?"Mac":Xe.isFacebook?"Facebook":"PC",sa="device_id",ca="advertising_id",On=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,mr()),window.__joliboxLocalStorage__.getItem(e)),pr=()=>On(sa),ua=()=>On(ca),la=e=>e.charAt(0).toUpperCase()+e.slice(1),da=()=>{var e;let t=new URLSearchParams(window.location.search);return la((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Dn=e=>{let t="JoliboxWebSDK",r=aa(),n=navigator.language,i=pr(),c=ua();return`${t} (${da()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${c} version/${e||""}`},tr=class rr{constructor(t){this.element=t,this.next=rr.Undefined,this.prev=rr.Undefined}};tr.Undefined=new tr(void 0);G=tr,fa=class{constructor(){this._first=G.Undefined,this._last=G.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===G.Undefined}clear(){let e=this._first;for(;e!==G.Undefined;){let t=e.next;e.prev=G.Undefined,e.next=G.Undefined,e=t}this._first=G.Undefined,this._last=G.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new G(e);if(this._first===G.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==G.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==G.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==G.Undefined&&e.next!==G.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===G.Undefined&&e.next===G.Undefined?(this._first=G.Undefined,this._last=G.Undefined):e.next===G.Undefined?(this._last=this._last.prev,this._last.next=G.Undefined):e.prev===G.Undefined&&(this._first=this._first.next,this._first.prev=G.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==G.Undefined;)yield e.element,e=e.next}},ma=0,Ze=class{constructor(e){this.value=e,this.id=ma++}},$e=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Ze&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,c,d,m,p;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let b=new Ze(t);this._listeners?this._listeners instanceof Ze?this._listeners=[this._listeners,b]:this._listeners.push(b):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=b,(d=(c=this.options)==null?void 0:c.onDidFirstListener)==null||d.call(c,this)),(p=(m=this.options)==null?void 0:m.onDidAddListener)==null||p.call(m,this),this._size++}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Ze?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},de=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var r;let n=(r=this.listeners.get(e))!=null?r:new $e,i=d=>t(...d.args);this.listerHandlerMap.set(t,i),n.event(i),this.listeners.set(e,n);let c=this.cachedEventQueue.get(e);if(c)for(;c.size>0;)n.fire(ar({event:e},c.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new fa,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},nr={};Gi(nr,{None:()=>pa,filter:()=>ga,once:()=>Nn,toPromise:()=>ha});pa=()=>{console.log("[Jolibox SDK] None Event")};Zt=Symbol.for("Jolibox.hostEmitter"),va=()=>{let e=new de;return globalThis[Zt]||(globalThis[Zt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Zt]},Je=va();tt=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new $e,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return ya(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};tt=_n([In],tt);or=class{constructor(){this._onWillExecuteCommand=new $e,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new $e,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new tt,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Wi(3e4)),this._starActivation}executeCommand(e,...t){return qi(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),nr.toPromise(nr.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};or=_n([In],or);er=Symbol.for("Jolibox.commands")});function ue(e,t={}){hr.emit("ERROR_REPORT",{error:e,options:t})}var hr,we,_e=K(()=>{"use strict";V();V();hr=new de,we=new de;ue.debounce=Ve(ue,50,{leading:!0})});var gr,_a,Ln,Un,Fn=K(()=>{"use strict";V();_e();gr=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},_a=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Ln=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[c,d,m]=i;return{headerJson:gr(c),payloadJson:gr(d),signature:gr(m)}}else throw"joli_source is missing"}catch(r){return ue(new xn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Un=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=_a(e),c=r[2];return`${n}.${i}.${c}`}return t}});var wa,nt,Bn,vr=K(()=>{"use strict";V();wa="1.1.13-beta.8",nt=()=>wa,Bn=()=>{let e=nt();return`${Dn(e)}`}});var Ea,Mn,yr,jn,Z,Ia,A,ee=K(()=>{"use strict";V();Fn();vr();V();Ea={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:pr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:nt()},schema:window.location.href,platform:"h5"},yr=(Mn=globalThis.joliboxJSCore)==null?void 0:Mn.env,Z=Object.assign({},(jn=yr==null?void 0:yr())!=null?jn:Ea),Ia=()=>{var g,I,O,D,k,P,H,F,te;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?Ln(Z.schema):{},n=`${Z.deviceInfo.did}-${new Date().getTime()}`,c=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,d=(O=(I=(g=c.get("mpId"))!=null?g:c.get("appId"))!=null?I:c.get("gameId"))!=null?O:"",m=(P=(k=(D=Z.clientSessionId)!=null?D:e==null?void 0:e.sessionId)!=null?k:c.get("sessionId"))!=null?P:n,p=!!((H=e==null?void 0:e.testAdsMode)!=null?H:c.get("testAdsMode")==="true"),b=(te=(F=e==null?void 0:e.joliboxEnv)!=null?F:c.get("joliboxEnv"))!=null?te:"production",v=b==="staging",S=t==null?void 0:t.channel;return{get testMode(){return v},get testAdsMode(){return p},get joliboxEnv(){return b},get joliSource(){var B;return(B=c.get("joliSource"))!=null?B:null},get mpId(){var B;return(B=d!=null?d:e==null?void 0:e.id)!=null?B:""},get mpVersion(){var B;return(B=t==null?void 0:t.ver)!=null?B:nt()},get mpType(){var B,T;return(T=(B=t==null?void 0:t.__mpType)!=null?B:e==null?void 0:e.__mpType)!=null?T:"game"},get platform(){var B;return(B=Z.platform)!=null?B:Z.deviceInfo.platform},get deviceInfo(){return Z.deviceInfo},get sdkInfo(){return Z.sdkInfo},get hostInfo(){return Z.hostInfo},get hostUserInfo(){return Z.hostUserInfo},get sessionId(){var B,T;return(T=(B=Z.clientSessionId)!=null?B:m)!=null?T:n},get channel(){return S},get webviewId(){var B;return(B=Z.webviewId)!=null?B:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},get baseApiHost(){return v?"https://stg-api.jolibox.com":"https://api.jolibox.com"},onEnvConfigChanged:B=>{Tn(Z,B,Sn)},encodeJoliSourceQuery:B=>{var T,U;return t&&r?Un($($({},e),B),(T=c.get("joliSource"))!=null?T:""):(U=c.get("joliSource"))!=null?U:""}}},A=Ia()});var br,Vn,Ta,Sa,$n,Ra,Hn=K(()=>{"use strict";V();_e();ee();V();br=!1,Vn=(e,t)=>e==null?!1:t in e,Ta=e=>Vn(e,"kind"),Sa=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},$n=(e,t={},r)=>{var c,d,m;let n={user_id:(d=(c=A.hostUserInfo)==null?void 0:c.uid)!=null?d:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:Sa(e.name)},i=z($({},n),{env:t.environment,isFromUser:r});r?we.emit("GLOBAL_USER_ERROR",e,i):we.emit("GLOBAL_ERROR",e,i)},Ra=e=>Vn(e,"kind")&&e.kind==="USER_ERROR";hr.on("ERROR_REPORT",({error:e,options:t})=>{if(br)return;br=!0;let r=Ta(e)&&e.raw?e.raw:e;try{let n=Ra(e);$n(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),c=new lr(`${i}, origin error: ${r.message}`);ce.error(c),$n(new lr(c.message),{environment:t.environment},!1)}finally{br=!1}})});var _r,wr=K(()=>{"use strict";_e();V();_e();_r=e=>new An(e)});function Jn(e,t){let r=(n,i,c)=>{let d=z($({tag:n},t),{extra:$({},i)});n=="globalJsError"?ue(new kn(JSON.stringify(d))):e("systemLog",d,c)};return r.debounce=Ve(r,500,{leading:!0}),r}function Kn(e){let t=(r,n,i)=>{var m;let c=(m=i&&JSON.stringify(i))!=null?m:0,d={speed_value_type:r,total_duration:n};c&&Object.assign(d,{extra:c}),e("joliboxSpeedAnalysis",d)};return t.debounce=Ve(t,500,{leading:!0}),t}var Gn=K(()=>{"use strict";V();V();_e()});function qn(e,t){let r=Jn(e,t),n=Kn(r);return{track:r,trackPerformance:n}}var Wn=K(()=>{"use strict";Gn()});var Er=K(()=>{"use strict"});var ot,Yn=K(()=>{"use strict";ee();V();V();ot=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return C(this,null,function*(){let r=`${A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,c,d,m;let{nativeSDKVersion:t,jssdkVersion:r}=A.sdkInfo;return{platform:1e3,os:A.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(c=(i=A.hostInfo)==null?void 0:i.aid)!=null?c:"1",model:(d=A.deviceInfo.model)!=null?d:"UnknownModel",brand:(m=A.deviceInfo.brand)!=null?m:"UnknownBrand",uuid:A.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return C(this,null,function*(){if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),c=t.target||null,d=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,b={protocolVersion:"1.0.0",events:[z($({},t),{location:i,target:c,extra:d,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(fr(b),n):yield this.doReport(fr(b))}catch(v){ce.log("[Jolibox SDK] report API error",v)}})}}});var Ir=K(()=>{"use strict";Wn();Er();Yn()});var Tr,zn,he,it,ge,Ke=K(()=>{"use strict";vr();ee();Tr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(zn=AbortSignal.timeout)!=null||(AbortSignal.timeout=Tr);he=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new it(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}getNetworkStatus(){return this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}},it=class{constructor(t){this.xua=Bn();this.getJoliSource=()=>A.joliSource;var n;let r=A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com";this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return C(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:c}=r!=null?r:{},d=n?new URLSearchParams(n):null,m=d==null?void 0:d.toString(),p=`${this.baseUrl}${t}${m?`?${m}`:""}`,b=this.xua,v=this.getJoliSource();c=Object.assign({},c!=null?c:{},b?{"x-user-agent":b}:{},v?{"x-joli-source":v}:{});let S=yield fetch(p,{method:"GET",headers:c,credentials:"include",signal:Tr(i!=null?i:3e4)});return he.getInstance().recordNetworkRequest(!0),yield S.json()}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return C(this,null,function*(){try{let{data:n,query:i,timeout:c}=r!=null?r:{},{headers:d}=r!=null?r:{},m=i?new URLSearchParams(i):null,p=m==null?void 0:m.toString(),b=`${this.baseUrl}${t}${p?`?${p}`:""}`,v=this.xua,S=this.getJoliSource();d=Object.assign({},d!=null?d:{},{"Content-Type":"application/json"},v?{"x-user-agent":v}:{},S?{"x-joli-source":S}:{});let g=yield fetch(b,{method:"POST",headers:d,body:JSON.stringify(n),signal:Tr(c!=null?c:3e4),credentials:"include"});he.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(O){return yield g.arrayBuffer()}if(I!=null&&I.includes("multipart/form-data")||I!=null&&I.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(O){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(O){return yield g.text()}return g}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return C(this,null,function*(){try{let{data:n,query:i,timeout:c}=r!=null?r:{},{headers:d}=r!=null?r:{},m=i?new URLSearchParams(i):null,p=m==null?void 0:m.toString(),b=`${this.baseUrl}${t}${p?`?${p}`:""}`,v=this.xua,S=this.getJoliSource();d=Object.assign({},d!=null?d:{},{"Content-Type":"application/json"},v?{"x-user-agent":v}:{},S?{"x-joli-source":S}:{});let g=yield fetch(b,{method:"PUT",headers:d,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!g.ok)throw he.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${g.status}`);return he.getInstance().recordNetworkRequest(!0),yield g.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=it;ge=he.getInstance()});var Sr,at,Rr=K(()=>{"use strict";ee();Ir();Ke();Sr=class extends ot{constructor(){super(...arguments);this.hostToApiMap={default:{test:"https://stg-collect.jolibox.com",prod:"https://collect.jolibox.com"},"oss.jolibox.com":{test:"https://stg-collect.jolibox.com",prod:"https://collect.jolibox.com"},"oss.pico-game.com":{test:"https://stg-collect.pico-game.com",prod:"https://collect.pico-game.com"}};this.httpClient=ge.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n,i;let r=(n=this.hostToApiMap[window.location.host])!=null?n:this.hostToApiMap.default;return(i=A.testMode)!=null&&i?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},at=new Sr});var Aa,Qn=K(()=>{"use strict";Hn();V();wr();V();Rr();ee();Aa=(e,t)=>{var i,c,d;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:He.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(d=(c=A.hostUserInfo)==null?void 0:c.uid)!=null?d:null};at.trackEvent(n,xe.WebSDK)};we.on("GLOBAL_ERROR",(e,t)=>{Aa(t.tag,e)});we.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var st,Xn=K(()=>{"use strict";st=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,c=!1,d=0,m=()=>{if(!c)return;let I=Date.now(),O=I-r;O>=this.interval&&(this.visible&&(d+=O,t(d)),r=I),n=requestAnimationFrame(m)},p=()=>{v(),r=Date.now(),i=window.setInterval(()=>{if(!c)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},b=()=>{S(),r=Date.now(),n=requestAnimationFrame(m)},v=()=>{n&&(cancelAnimationFrame(n),n=0)},S=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",I=>{c&&(console.log("visible",I),I?b():p())});let g=this.visible;return{start(){c||(c=!0,g?b():p())},stop(){c=!1,v(),S()}}}}});var ct,Zn=K(()=>{"use strict";ee();Xn();Ke();ct=class extends st{constructor(r,n,i){super(n,i);this.httpClient=ge.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return C(this,null,function*(){let{event:n,params:i}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:$({gameId:this.gameId,sessionId:this.sessionId},i)}})})}tracker(r,n=null){this.track(r,n)}}});var eo,xa,fe,ka,Ar,le,Ee=K(()=>{"use strict";Qn();V();V();Ir();Rr();Zn();ee();Er();eo=ae(),xa={type:xe.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:fe,trackPerformance:ka}=qn((...e)=>{var d,m,p,b;let[,t]=e,r=t,n=wn(r.extra)?r.extra:sr(r.extra)?JSON.parse(r.extra):{},i=z($({},n),{mp_id:(d=r.mp_id)!=null?d:"",mp_version:(m=r.mp_version)!=null?m:""}),c={name:t.tag,type:He.System,location:null,target:null,extra:i,timestamp:Date.now(),userId:(b=(p=A.hostUserInfo)==null?void 0:p.uid)!=null?b:null};at.trackEvent(c,xe.WebSDK)},xa);eo.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{ka(e,t,r)});eo.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{fe(e,t)});Ar=new de,le=new ct(fe,Ar)});function to(e){let t=dr.config[e];return t||(t={},dr.config[e]=t),(r,n)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=$({},n)}}var ro=K(()=>{"use strict";V()});function xr(e){no=e}function ut(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>ut(t)):Object.keys(e).reduce((t,r)=>(t[r]=ut(e[r]),t),{})}function ve(e){return typeof e=="number"}function kr(e){let t=Cr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Cr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var no,Y,lt,dt,ft,mt,ke,pt,ht,gt,vt,yt,bt,_t,wt,Et,It,Tt,St,Pr=K(()=>{"use strict";no=!1;Y=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(no)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${kr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return ut(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:ut(this._default)}optional(){return this._optional=!0,this}};lt=class extends Y{validate(t){return this._optional&&t===void 0?!0:ve(t)?ve(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ve(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ve(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},dt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},ft=class extends Y{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ve(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ve(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},mt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends Y{validate(t){return!0}},pt=class extends Y{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ht=class extends Y{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},gt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},vt=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${kr(t)}`)}return!0}},yt=class extends Y{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ve(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ve(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ve(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let i=!0;if(r.forEach((c,d)=>{if(n.path=`${this.path}[${d}]`,n.errors=this.errors,c===void 0&&n.hasDefault){r[d]=n.defaultValue;return}n.validate(c)||(n.hasFallback?r[d]=n.fallbackValue:i=!1)}),this._uniqueItems){let c=new Map;for(let d in r)c.has(r[d])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${c.get(r[d])}] and ${this.path}[${d}] are identical)`):c.set(r[d],d)}return i}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},bt=class extends Y{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Cr(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,c=this._value;c.errors=this.errors;let d=!0;for(let m in i){let p=i[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?c.path=`${this.path}.${m}`:c.path=`${this.path}["${m}"]`,!(p===void 0&&c._optional)){if(p===void 0&&c.hasDefault){i[m]=c.defaultValue;continue}c.validate(p)||(c.hasFallback?i[m]=c.fallbackValue:d=!1)}}return d}},_t=class extends Y{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Cr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let c in this._object){let d=n[c],m=this._object[c];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(c)?m.path=`${this.path}.${c}`:m.path=`${this.path}["${c}"]`,!(m._optional&&d===void 0)){if(d===void 0&&m.hasDefault){n[c]=m.defaultValue;continue}m.validate(d)||(m.hasFallback?n[c]=m.fallbackValue:i=!1)}}return i}},wt=class extends Y{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:kr(this.value),actual:r}):!0}},Et=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,i=this._items.length;for(let c=0;c<i;c++){let d=this._items[c];if(d.errors=[],d.path=this.path,!d.validate(t))r.push(d.errors.join("; "));else if(!n){n=!0;break}}if(!n){let c=r.join(`
|
|
2
|
-
or `);this.errors.push(c)}return n}},
|
|
3
|
-
`);throw e.errors.length=0,xr(!1),new TypeError(n)}}var x,Dr=K(()=>{"use strict";Pr();Pr();x={object(e){return new _t(e)},array(e){return new yt(e)},tuple(...e){return new It(...e)},literal(e){return new wt(e)},or(...e){return new Et(...e)},symbol(){return new mt},record(e){return new bt(e)},function(){return new gt},boolean(){return new dt},string(){return new ft},number(){return new lt},undefined(){return new pt},null(){return new ht},unknown(){return new ke},any(){return new ke},as(){return new ke},arraybuffer(){return new Tt},enum(...e){return new vt(...e)},typedarray(e){return new St(e)}}});var Rt,oo,io=K(()=>{"use strict";V();_e();Dr();wr();Rt=1,oo=e=>{function t(n,i){return(...c)=>{var S,g,I,O;let d=Date.now(),m={method:n,trace_id:Rt};Rt+=1;let p="SUCCESS",b=`${n}:ok`,v=0;try{if(i.paramsSchema)try{Or(i.paramsSchema,c,"params")}catch(H){throw _r(`${n}:fail ${H.message}`)}let D=i.implement(...c),k=D,P=`${n}:ok`;if(D&&"code"in D){let{code:H,data:F,message:te}=D;p=H,k=F,P=te}return{code:p,message:P,data:k}}catch(D){let k=D;v=(g=(S=k.code)!=null?S:k.errNo)!=null?g:2e3,p="FAILURE";let P=(O=(I=k.message)!=null?I:k.errMsg)!=null?O:`${D}`;return b=`${n}:${p} ${P.replace(/^\S+:(fail|cancel)\s?/,"")}`,ue(new rt(b,v)),{code:p,message:b}}finally{let D=Date.now()-d;e("apiInvoked",z($({},m),{duration:D,status:p}))}}}function r(n,i){return(...c)=>C(this,null,function*(){var g,I,O,D;let d=En(c)?c:[c],m=Date.now(),p={method:n,trace_id:Rt};Rt+=1;let b=`${n}:ok`,v="SUCCESS",S={code:v,message:b};try{if(i.paramsSchema)try{Or(i.paramsSchema,d,"params")}catch(H){throw _r(H.message)}let P=yield i.implement(...d);if(P&&"code"in P){let{code:H,data:F,message:te}=P;v=H,b=te,P=F}return Object.assign(S,{code:v,message:b,data:P}),S}catch(k){let P=k,H=(I=(g=P.code)!=null?g:P.errNo)!=null?I:2e3;v="FAILURE";let F=(D=(O=P.message)!=null?O:P.errMsg)!=null?D:`${k}`,te=`${n}:${v} ${F.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(S,{code:v,message:te}),ue(new rt(te,H)),S}finally{let k=Date.now()-m;e("apiInvoked",z($({},p),{duration:k,status:v}))}})}return{createAPI:r,createSyncAPI:t}}});var se,Ie,Q,Ge=K(()=>{"use strict";ro();Ee();io();Dr();({createAPI:se,createSyncAPI:Ie}=oo(fe)),Q=to("h5")});var uo=pn((co,Fr)=>{(function(e){if(typeof co=="object"&&typeof Fr!="undefined")Fr.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(i,c,d){function m(v,S){if(!c[v]){if(!i[v]){var g=typeof Me=="function"&&Me;if(!S&&g)return g(v,!0);if(p)return p(v,!0);var I=new Error("Cannot find module '"+v+"'");throw I.code="MODULE_NOT_FOUND",I}var O=c[v]={exports:{}};i[v][0].call(O.exports,function(D){var k=i[v][1][D];return m(k||D)},O,O.exports,n,i,c,d)}return c[v].exports}for(var p=typeof Me=="function"&&Me,b=0;b<d.length;b++)m(d[b]);return m}({1:[function(n,i,c){(function(d){"use strict";var m=d.MutationObserver||d.WebKitMutationObserver,p;if(m){var b=0,v=new m(D),S=d.document.createTextNode("");v.observe(S,{characterData:!0}),p=function(){S.data=b=++b%2}}else if(!d.setImmediate&&typeof d.MessageChannel!="undefined"){var g=new d.MessageChannel;g.port1.onmessage=D,p=function(){g.port2.postMessage(0)}}else"document"in d&&"onreadystatechange"in d.document.createElement("script")?p=function(){var P=d.document.createElement("script");P.onreadystatechange=function(){D(),P.onreadystatechange=null,P.parentNode.removeChild(P),P=null},d.document.documentElement.appendChild(P)}:p=function(){setTimeout(D,0)};var I,O=[];function D(){I=!0;for(var P,H,F=O.length;F;){for(H=O,O=[],P=-1;++P<F;)H[P]();F=O.length}I=!1}i.exports=k;function k(P){O.push(P)===1&&!I&&p()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,c){"use strict";var d=n(1);function m(){}var p={},b=["REJECTED"],v=["FULFILLED"],S=["PENDING"];i.exports=g;function g(T){if(typeof T!="function")throw new TypeError("resolver must be a function");this.state=S,this.queue=[],this.outcome=void 0,T!==m&&k(this,T)}g.prototype.catch=function(T){return this.then(null,T)},g.prototype.then=function(T,U){if(typeof T!="function"&&this.state===v||typeof U!="function"&&this.state===b)return this;var L=new this.constructor(m);if(this.state!==S){var J=this.state===v?T:U;O(L,J,this.outcome)}else this.queue.push(new I(L,T,U));return L};function I(T,U,L){this.promise=T,typeof U=="function"&&(this.onFulfilled=U,this.callFulfilled=this.otherCallFulfilled),typeof L=="function"&&(this.onRejected=L,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(T){p.resolve(this.promise,T)},I.prototype.otherCallFulfilled=function(T){O(this.promise,this.onFulfilled,T)},I.prototype.callRejected=function(T){p.reject(this.promise,T)},I.prototype.otherCallRejected=function(T){O(this.promise,this.onRejected,T)};function O(T,U,L){d(function(){var J;try{J=U(L)}catch(X){return p.reject(T,X)}J===T?p.reject(T,new TypeError("Cannot resolve promise with itself")):p.resolve(T,J)})}p.resolve=function(T,U){var L=P(D,U);if(L.status==="error")return p.reject(T,L.value);var J=L.value;if(J)k(T,J);else{T.state=v,T.outcome=U;for(var X=-1,re=T.queue.length;++X<re;)T.queue[X].callFulfilled(U)}return T},p.reject=function(T,U){T.state=b,T.outcome=U;for(var L=-1,J=T.queue.length;++L<J;)T.queue[L].callRejected(U);return T};function D(T){var U=T&&T.then;if(T&&(typeof T=="object"||typeof T=="function")&&typeof U=="function")return function(){U.apply(T,arguments)}}function k(T,U){var L=!1;function J(oe){L||(L=!0,p.reject(T,oe))}function X(oe){L||(L=!0,p.resolve(T,oe))}function re(){U(X,J)}var ne=P(re);ne.status==="error"&&J(ne.value)}function P(T,U){var L={};try{L.value=T(U),L.status="success"}catch(J){L.status="error",L.value=J}return L}g.resolve=H;function H(T){return T instanceof this?T:p.resolve(new this(m),T)}g.reject=F;function F(T){var U=new this(m);return p.reject(U,T)}g.all=te;function te(T){var U=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,J=!1;if(!L)return this.resolve([]);for(var X=new Array(L),re=0,ne=-1,oe=new this(m);++ne<L;)me(T[ne],ne);return oe;function me(Ue,We){U.resolve(Ue).then($t,function(Re){J||(J=!0,p.reject(oe,Re))});function $t(Re){X[We]=Re,++re===L&&!J&&(J=!0,p.resolve(oe,X))}}}g.race=B;function B(T){var U=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,J=!1;if(!L)return this.resolve([]);for(var X=-1,re=new this(m);++X<L;)ne(T[X]);return re;function ne(oe){U.resolve(oe).then(function(me){J||(J=!0,p.resolve(re,me))},function(me){J||(J=!0,p.reject(re,me))})}}},{1:1}],3:[function(n,i,c){(function(d){"use strict";typeof d.Promise!="function"&&(d.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,i,c){"use strict";var d=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function m(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}function p(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(o){return}}var b=p();function v(){try{if(!b||!b.open)return!1;var o=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),s=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!o||s)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(a){return!1}}function S(o,s){o=o||[],s=s||{};try{return new Blob(o,s)}catch(u){if(u.name!=="TypeError")throw u;for(var a=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new a,f=0;f<o.length;f+=1)l.append(o[f]);return l.getBlob(s.type)}}typeof Promise=="undefined"&&n(3);var g=Promise;function I(o,s){s&&o.then(function(a){s(null,a)},function(a){s(a)})}function O(o,s,a){typeof s=="function"&&o.then(s),typeof a=="function"&&o.catch(a)}function D(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function k(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var P="local-forage-detect-blob-support",H=void 0,F={},te=Object.prototype.toString,B="readonly",T="readwrite";function U(o){for(var s=o.length,a=new ArrayBuffer(s),l=new Uint8Array(a),f=0;f<s;f++)l[f]=o.charCodeAt(f);return a}function L(o){return new g(function(s){var a=o.transaction(P,T),l=S([""]);a.objectStore(P).put(l,"key"),a.onabort=function(f){f.preventDefault(),f.stopPropagation(),s(!1)},a.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),u=navigator.userAgent.match(/Edge\//);s(u||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function J(o){return typeof H=="boolean"?g.resolve(H):L(o).then(function(s){return H=s,H})}function X(o){var s=F[o.name],a={};a.promise=new g(function(l,f){a.resolve=l,a.reject=f}),s.deferredOperations.push(a),s.dbReady?s.dbReady=s.dbReady.then(function(){return a.promise}):s.dbReady=a.promise}function re(o){var s=F[o.name],a=s.deferredOperations.pop();if(a)return a.resolve(),a.promise}function ne(o,s){var a=F[o.name],l=a.deferredOperations.pop();if(l)return l.reject(s),l.promise}function oe(o,s){return new g(function(a,l){if(F[o.name]=F[o.name]||Jr(),o.db)if(s)X(o),o.db.close();else return a(o.db);var f=[o.name];s&&f.push(o.version);var u=b.open.apply(b,f);s&&(u.onupgradeneeded=function(h){var y=u.result;try{y.createObjectStore(o.storeName),h.oldVersion<=1&&y.createObjectStore(P)}catch(_){if(_.name==="ConstraintError")console.warn('The database "'+o.name+'" has been upgraded from version '+h.oldVersion+" to version "+h.newVersion+', but the storage "'+o.storeName+'" already exists.');else throw _}}),u.onerror=function(h){h.preventDefault(),l(u.error)},u.onsuccess=function(){var h=u.result;h.onversionchange=function(y){y.target.close()},a(h),re(o)}})}function me(o){return oe(o,!1)}function Ue(o){return oe(o,!0)}function We(o,s){if(!o.db)return!0;var a=!o.db.objectStoreNames.contains(o.storeName),l=o.version<o.db.version,f=o.version>o.db.version;if(l&&(o.version!==s&&console.warn('The database "'+o.name+`" can't be downgraded from version `+o.db.version+" to version "+o.version+"."),o.version=o.db.version),f||a){if(a){var u=o.db.version+1;u>o.version&&(o.version=u)}return!0}return!1}function $t(o){return new g(function(s,a){var l=new FileReader;l.onerror=a,l.onloadend=function(f){var u=btoa(f.target.result||"");s({__local_forage_encoded_blob:!0,data:u,type:o.type})},l.readAsBinaryString(o)})}function Re(o){var s=U(atob(o.data));return S([s],{type:o.type})}function Hr(o){return o&&o.__local_forage_encoded_blob}function No(o){var s=this,a=s._initReady().then(function(){var l=F[s._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return O(a,o,o),a}function Lo(o){X(o);for(var s=F[o.name],a=s.forages,l=0;l<a.length;l++){var f=a[l];f._dbInfo.db&&(f._dbInfo.db.close(),f._dbInfo.db=null)}return o.db=null,me(o).then(function(u){return o.db=u,We(o)?Ue(o):u}).then(function(u){o.db=s.db=u;for(var h=0;h<a.length;h++)a[h]._dbInfo.db=u}).catch(function(u){throw ne(o,u),u})}function pe(o,s,a,l){l===void 0&&(l=1);try{var f=o.db.transaction(o.storeName,s);a(null,f)}catch(u){if(l>0&&(!o.db||u.name==="InvalidStateError"||u.name==="NotFoundError"))return g.resolve().then(function(){if(!o.db||u.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),Ue(o)}).then(function(){return Lo(o).then(function(){pe(o,s,a,l-1)})}).catch(a);a(u)}}function Jr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Uo(o){var s=this,a={db:null};if(o)for(var l in o)a[l]=o[l];var f=F[a.name];f||(f=Jr(),F[a.name]=f),f.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=No);var u=[];function h(){return g.resolve()}for(var y=0;y<f.forages.length;y++){var _=f.forages[y];_!==s&&u.push(_._initReady().catch(h))}var w=f.forages.slice(0);return g.all(u).then(function(){return a.db=f.db,me(a)}).then(function(E){return a.db=E,We(a,s._defaultConfig.version)?Ue(a):E}).then(function(E){a.db=f.db=E,s._dbInfo=a;for(var R=0;R<w.length;R++){var N=w[R];N!==s&&(N._dbInfo.db=a.db,N._dbInfo.version=a.version)}})}function Fo(o,s){var a=this;o=D(o);var l=new g(function(f,u){a.ready().then(function(){pe(a._dbInfo,B,function(h,y){if(h)return u(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.get(o);w.onsuccess=function(){var E=w.result;E===void 0&&(E=null),Hr(E)&&(E=Re(E)),f(E)},w.onerror=function(){u(w.error)}}catch(E){u(E)}})}).catch(u)});return I(l,s),l}function Bo(o,s){var a=this,l=new g(function(f,u){a.ready().then(function(){pe(a._dbInfo,B,function(h,y){if(h)return u(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.openCursor(),E=1;w.onsuccess=function(){var R=w.result;if(R){var N=R.value;Hr(N)&&(N=Re(N));var M=o(N,R.key,E++);M!==void 0?f(M):R.continue()}else f()},w.onerror=function(){u(w.error)}}catch(R){u(R)}})}).catch(u)});return I(l,s),l}function Mo(o,s,a){var l=this;o=D(o);var f=new g(function(u,h){var y;l.ready().then(function(){return y=l._dbInfo,te.call(s)==="[object Blob]"?J(y.db).then(function(_){return _?s:$t(s)}):s}).then(function(_){pe(l._dbInfo,T,function(w,E){if(w)return h(w);try{var R=E.objectStore(l._dbInfo.storeName);_===null&&(_=void 0);var N=R.put(_,o);E.oncomplete=function(){_===void 0&&(_=null),u(_)},E.onabort=E.onerror=function(){var M=N.error?N.error:N.transaction.error;h(M)}}catch(M){h(M)}})}).catch(h)});return I(f,a),f}function jo(o,s){var a=this;o=D(o);var l=new g(function(f,u){a.ready().then(function(){pe(a._dbInfo,T,function(h,y){if(h)return u(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.delete(o);y.oncomplete=function(){f()},y.onerror=function(){u(w.error)},y.onabort=function(){var E=w.error?w.error:w.transaction.error;u(E)}}catch(E){u(E)}})}).catch(u)});return I(l,s),l}function $o(o){var s=this,a=new g(function(l,f){s.ready().then(function(){pe(s._dbInfo,T,function(u,h){if(u)return f(u);try{var y=h.objectStore(s._dbInfo.storeName),_=y.clear();h.oncomplete=function(){l()},h.onabort=h.onerror=function(){var w=_.error?_.error:_.transaction.error;f(w)}}catch(w){f(w)}})}).catch(f)});return I(a,o),a}function Vo(o){var s=this,a=new g(function(l,f){s.ready().then(function(){pe(s._dbInfo,B,function(u,h){if(u)return f(u);try{var y=h.objectStore(s._dbInfo.storeName),_=y.count();_.onsuccess=function(){l(_.result)},_.onerror=function(){f(_.error)}}catch(w){f(w)}})}).catch(f)});return I(a,o),a}function Ho(o,s){var a=this,l=new g(function(f,u){if(o<0){f(null);return}a.ready().then(function(){pe(a._dbInfo,B,function(h,y){if(h)return u(h);try{var _=y.objectStore(a._dbInfo.storeName),w=!1,E=_.openKeyCursor();E.onsuccess=function(){var R=E.result;if(!R){f(null);return}o===0||w?f(R.key):(w=!0,R.advance(o))},E.onerror=function(){u(E.error)}}catch(R){u(R)}})}).catch(u)});return I(l,s),l}function Jo(o){var s=this,a=new g(function(l,f){s.ready().then(function(){pe(s._dbInfo,B,function(u,h){if(u)return f(u);try{var y=h.objectStore(s._dbInfo.storeName),_=y.openKeyCursor(),w=[];_.onsuccess=function(){var E=_.result;if(!E){l(w);return}w.push(E.key),E.continue()},_.onerror=function(){f(_.error)}}catch(E){f(E)}})}).catch(f)});return I(a,o),a}function Ko(o,s){s=k.apply(this,arguments);var a=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||a.name,o.storeName=o.storeName||a.storeName);var l=this,f;if(!o.name)f=g.reject("Invalid arguments");else{var u=o.name===a.name&&l._dbInfo.db,h=u?g.resolve(l._dbInfo.db):me(o).then(function(y){var _=F[o.name],w=_.forages;_.db=y;for(var E=0;E<w.length;E++)w[E]._dbInfo.db=y;return y});o.storeName?f=h.then(function(y){if(y.objectStoreNames.contains(o.storeName)){var _=y.version+1;X(o);var w=F[o.name],E=w.forages;y.close();for(var R=0;R<E.length;R++){var N=E[R];N._dbInfo.db=null,N._dbInfo.version=_}var M=new g(function(j,W){var q=b.open(o.name,_);q.onerror=function(ie){var Be=q.result;Be.close(),W(ie)},q.onupgradeneeded=function(){var ie=q.result;ie.deleteObjectStore(o.storeName)},q.onsuccess=function(){var ie=q.result;ie.close(),j(ie)}});return M.then(function(j){w.db=j;for(var W=0;W<E.length;W++){var q=E[W];q._dbInfo.db=j,re(q._dbInfo)}}).catch(function(j){throw(ne(o,j)||g.resolve()).catch(function(){}),j})}}):f=h.then(function(y){X(o);var _=F[o.name],w=_.forages;y.close();for(var E=0;E<w.length;E++){var R=w[E];R._dbInfo.db=null}var N=new g(function(M,j){var W=b.deleteDatabase(o.name);W.onerror=function(){var q=W.result;q&&q.close(),j(W.error)},W.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},W.onsuccess=function(){var q=W.result;q&&q.close(),M(q)}});return N.then(function(M){_.db=M;for(var j=0;j<w.length;j++){var W=w[j];re(W._dbInfo)}}).catch(function(M){throw(ne(o,M)||g.resolve()).catch(function(){}),M})})}return I(f,s),f}var Go={_driver:"asyncStorage",_initStorage:Uo,_support:v(),iterate:Bo,getItem:Fo,setItem:Mo,removeItem:jo,clear:$o,length:Vo,key:Ho,keys:Jo,dropInstance:Ko};function qo(){return typeof openDatabase=="function"}var ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wo="~~local_forage_type~",Kr=/^~~local_forage_type~([^~]+)~/,Ye="__lfsc__:",Vt=Ye.length,Ht="arbf",Jt="blob",Gr="si08",qr="ui08",Wr="uic8",Yr="si16",zr="si32",Qr="ur16",Xr="ui32",Zr="fl32",en="fl64",tn=Vt+Ht.length,rn=Object.prototype.toString;function nn(o){var s=o.length*.75,a=o.length,l,f=0,u,h,y,_;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var w=new ArrayBuffer(s),E=new Uint8Array(w);for(l=0;l<a;l+=4)u=ye.indexOf(o[l]),h=ye.indexOf(o[l+1]),y=ye.indexOf(o[l+2]),_=ye.indexOf(o[l+3]),E[f++]=u<<2|h>>4,E[f++]=(h&15)<<4|y>>2,E[f++]=(y&3)<<6|_&63;return w}function Kt(o){var s=new Uint8Array(o),a="",l;for(l=0;l<s.length;l+=3)a+=ye[s[l]>>2],a+=ye[(s[l]&3)<<4|s[l+1]>>4],a+=ye[(s[l+1]&15)<<2|s[l+2]>>6],a+=ye[s[l+2]&63];return s.length%3===2?a=a.substring(0,a.length-1)+"=":s.length%3===1&&(a=a.substring(0,a.length-2)+"=="),a}function Yo(o,s){var a="";if(o&&(a=rn.call(o)),o&&(a==="[object ArrayBuffer]"||o.buffer&&rn.call(o.buffer)==="[object ArrayBuffer]")){var l,f=Ye;o instanceof ArrayBuffer?(l=o,f+=Ht):(l=o.buffer,a==="[object Int8Array]"?f+=Gr:a==="[object Uint8Array]"?f+=qr:a==="[object Uint8ClampedArray]"?f+=Wr:a==="[object Int16Array]"?f+=Yr:a==="[object Uint16Array]"?f+=Qr:a==="[object Int32Array]"?f+=zr:a==="[object Uint32Array]"?f+=Xr:a==="[object Float32Array]"?f+=Zr:a==="[object Float64Array]"?f+=en:s(new Error("Failed to get type for BinaryArray"))),s(f+Kt(l))}else if(a==="[object Blob]"){var u=new FileReader;u.onload=function(){var h=Wo+o.type+"~"+Kt(this.result);s(Ye+Jt+h)},u.readAsArrayBuffer(o)}else try{s(JSON.stringify(o))}catch(h){console.error("Couldn't convert value into a JSON string: ",o),s(null,h)}}function zo(o){if(o.substring(0,Vt)!==Ye)return JSON.parse(o);var s=o.substring(tn),a=o.substring(Vt,tn),l;if(a===Jt&&Kr.test(s)){var f=s.match(Kr);l=f[1],s=s.substring(f[0].length)}var u=nn(s);switch(a){case Ht:return u;case Jt:return S([u],{type:l});case Gr:return new Int8Array(u);case qr:return new Uint8Array(u);case Wr:return new Uint8ClampedArray(u);case Yr:return new Int16Array(u);case Qr:return new Uint16Array(u);case zr:return new Int32Array(u);case Xr:return new Uint32Array(u);case Zr:return new Float32Array(u);case en:return new Float64Array(u);default:throw new Error("Unkown type: "+a)}}var Gt={serialize:Yo,deserialize:zo,stringToBuffer:nn,bufferToString:Kt};function on(o,s,a,l){o.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],a,l)}function Qo(o){var s=this,a={db:null};if(o)for(var l in o)a[l]=typeof o[l]!="string"?o[l].toString():o[l];var f=new g(function(u,h){try{a.db=openDatabase(a.name,String(a.version),a.description,a.size)}catch(y){return h(y)}a.db.transaction(function(y){on(y,a,function(){s._dbInfo=a,u()},function(_,w){h(w)})},h)});return a.serializer=Gt,f}function be(o,s,a,l,f,u){o.executeSql(a,l,f,function(h,y){y.code===y.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(_,w){w.rows.length?u(_,y):on(_,s,function(){_.executeSql(a,l,f,u)},u)},u):u(h,y)},u)}function Xo(o,s){var a=this;o=D(o);var l=new g(function(f,u){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[o],function(_,w){var E=w.rows.length?w.rows.item(0).value:null;E&&(E=h.serializer.deserialize(E)),f(E)},function(_,w){u(w)})})}).catch(u)});return I(l,s),l}function Zo(o,s){var a=this,l=new g(function(f,u){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"SELECT * FROM "+h.storeName,[],function(_,w){for(var E=w.rows,R=E.length,N=0;N<R;N++){var M=E.item(N),j=M.value;if(j&&(j=h.serializer.deserialize(j)),j=o(j,M.key,N+1),j!==void 0){f(j);return}}f()},function(_,w){u(w)})})}).catch(u)});return I(l,s),l}function an(o,s,a,l){var f=this;o=D(o);var u=new g(function(h,y){f.ready().then(function(){s===void 0&&(s=null);var _=s,w=f._dbInfo;w.serializer.serialize(s,function(E,R){R?y(R):w.db.transaction(function(N){be(N,w,"INSERT OR REPLACE INTO "+w.storeName+" (key, value) VALUES (?, ?)",[o,E],function(){h(_)},function(M,j){y(j)})},function(N){if(N.code===N.QUOTA_ERR){if(l>0){h(an.apply(f,[o,_,a,l-1]));return}y(N)}})})}).catch(y)});return I(u,a),u}function ei(o,s,a){return an.apply(this,[o,s,a,1])}function ti(o,s){var a=this;o=D(o);var l=new g(function(f,u){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[o],function(){f()},function(_,w){u(w)})})}).catch(u)});return I(l,s),l}function ri(o){var s=this,a=new g(function(l,f){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){be(h,u,"DELETE FROM "+u.storeName,[],function(){l()},function(y,_){f(_)})})}).catch(f)});return I(a,o),a}function ni(o){var s=this,a=new g(function(l,f){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){be(h,u,"SELECT COUNT(key) as c FROM "+u.storeName,[],function(y,_){var w=_.rows.item(0).c;l(w)},function(y,_){f(_)})})}).catch(f)});return I(a,o),a}function oi(o,s){var a=this,l=new g(function(f,u){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[o+1],function(_,w){var E=w.rows.length?w.rows.item(0).key:null;f(E)},function(_,w){u(w)})})}).catch(u)});return I(l,s),l}function ii(o){var s=this,a=new g(function(l,f){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){be(h,u,"SELECT key FROM "+u.storeName,[],function(y,_){for(var w=[],E=0;E<_.rows.length;E++)w.push(_.rows.item(E).key);l(w)},function(y,_){f(_)})})}).catch(f)});return I(a,o),a}function ai(o){return new g(function(s,a){o.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,u){for(var h=[],y=0;y<u.rows.length;y++)h.push(u.rows.item(y).name);s({db:o,storeNames:h})},function(f,u){a(u)})},function(l){a(l)})})}function si(o,s){s=k.apply(this,arguments);var a=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||a.name,o.storeName=o.storeName||a.storeName);var l=this,f;return o.name?f=new g(function(u){var h;o.name===a.name?h=l._dbInfo.db:h=openDatabase(o.name,"","",0),o.storeName?u({db:h,storeNames:[o.storeName]}):u(ai(h))}).then(function(u){return new g(function(h,y){u.db.transaction(function(_){function w(M){return new g(function(j,W){_.executeSql("DROP TABLE IF EXISTS "+M,[],function(){j()},function(q,ie){W(ie)})})}for(var E=[],R=0,N=u.storeNames.length;R<N;R++)E.push(w(u.storeNames[R]));g.all(E).then(function(){h()}).catch(function(M){y(M)})},function(_){y(_)})})}):f=g.reject("Invalid arguments"),I(f,s),f}var ci={_driver:"webSQLStorage",_initStorage:Qo,_support:qo(),iterate:Zo,getItem:Xo,setItem:ei,removeItem:ti,clear:ri,length:ni,key:oi,keys:ii,dropInstance:si};function ui(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(o){return!1}}function sn(o,s){var a=o.name+"/";return o.storeName!==s.storeName&&(a+=o.storeName+"/"),a}function li(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(s){return!0}}function di(){return!li()||localStorage.length>0}function fi(o){var s=this,a={};if(o)for(var l in o)a[l]=o[l];return a.keyPrefix=sn(o,s._defaultConfig),di()?(s._dbInfo=a,a.serializer=Gt,g.resolve()):g.reject()}function mi(o){var s=this,a=s.ready().then(function(){for(var l=s._dbInfo.keyPrefix,f=localStorage.length-1;f>=0;f--){var u=localStorage.key(f);u.indexOf(l)===0&&localStorage.removeItem(u)}});return I(a,o),a}function pi(o,s){var a=this;o=D(o);var l=a.ready().then(function(){var f=a._dbInfo,u=localStorage.getItem(f.keyPrefix+o);return u&&(u=f.serializer.deserialize(u)),u});return I(l,s),l}function hi(o,s){var a=this,l=a.ready().then(function(){for(var f=a._dbInfo,u=f.keyPrefix,h=u.length,y=localStorage.length,_=1,w=0;w<y;w++){var E=localStorage.key(w);if(E.indexOf(u)===0){var R=localStorage.getItem(E);if(R&&(R=f.serializer.deserialize(R)),R=o(R,E.substring(h),_++),R!==void 0)return R}}});return I(l,s),l}function gi(o,s){var a=this,l=a.ready().then(function(){var f=a._dbInfo,u;try{u=localStorage.key(o)}catch(h){u=null}return u&&(u=u.substring(f.keyPrefix.length)),u});return I(l,s),l}function vi(o){var s=this,a=s.ready().then(function(){for(var l=s._dbInfo,f=localStorage.length,u=[],h=0;h<f;h++){var y=localStorage.key(h);y.indexOf(l.keyPrefix)===0&&u.push(y.substring(l.keyPrefix.length))}return u});return I(a,o),a}function yi(o){var s=this,a=s.keys().then(function(l){return l.length});return I(a,o),a}function bi(o,s){var a=this;o=D(o);var l=a.ready().then(function(){var f=a._dbInfo;localStorage.removeItem(f.keyPrefix+o)});return I(l,s),l}function _i(o,s,a){var l=this;o=D(o);var f=l.ready().then(function(){s===void 0&&(s=null);var u=s;return new g(function(h,y){var _=l._dbInfo;_.serializer.serialize(s,function(w,E){if(E)y(E);else try{localStorage.setItem(_.keyPrefix+o,w),h(u)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&y(R),y(R)}})})});return I(f,a),f}function wi(o,s){if(s=k.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var a=this.config();o.name=o.name||a.name,o.storeName=o.storeName||a.storeName}var l=this,f;return o.name?f=new g(function(u){o.storeName?u(sn(o,l._defaultConfig)):u(o.name+"/")}).then(function(u){for(var h=localStorage.length-1;h>=0;h--){var y=localStorage.key(h);y.indexOf(u)===0&&localStorage.removeItem(y)}}):f=g.reject("Invalid arguments"),I(f,s),f}var Ei={_driver:"localStorageWrapper",_initStorage:fi,_support:ui(),iterate:hi,getItem:pi,setItem:_i,removeItem:bi,clear:mi,length:yi,key:gi,keys:vi,dropInstance:wi},Ii=function(s,a){return s===a||typeof s=="number"&&typeof a=="number"&&isNaN(s)&&isNaN(a)},Ti=function(s,a){for(var l=s.length,f=0;f<l;){if(Ii(s[f],a))return!0;f++}return!1},cn=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Fe={},un={},Ae={INDEXEDDB:Go,WEBSQL:ci,LOCALSTORAGE:Ei},Si=[Ae.INDEXEDDB._driver,Ae.WEBSQL._driver,Ae.LOCALSTORAGE._driver],ze=["dropInstance"],qt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ze),Ri={description:"",driver:Si.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function Ai(o,s){o[s]=function(){var a=arguments;return o.ready().then(function(){return o[s].apply(o,a)})}}function Wt(){for(var o=1;o<arguments.length;o++){var s=arguments[o];if(s)for(var a in s)s.hasOwnProperty(a)&&(cn(s[a])?arguments[0][a]=s[a].slice():arguments[0][a]=s[a])}return arguments[0]}var xi=function(){function o(s){m(this,o);for(var a in Ae)if(Ae.hasOwnProperty(a)){var l=Ae[a],f=l._driver;this[a]=f,Fe[f]||this.defineDriver(l)}this._defaultConfig=Wt({},Ri),this._config=Wt({},this._defaultConfig,s),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return o.prototype.config=function(a){if((typeof a=="undefined"?"undefined":d(a))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in a){if(l==="storeName"&&(a[l]=a[l].replace(/\W/g,"_")),l==="version"&&typeof a[l]!="number")return new Error("Database version must be a number.");this._config[l]=a[l]}return"driver"in a&&a.driver?this.setDriver(this._config.driver):!0}else return typeof a=="string"?this._config[a]:this._config},o.prototype.defineDriver=function(a,l,f){var u=new g(function(h,y){try{var _=a._driver,w=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!a._driver){y(w);return}for(var E=qt.concat("_initStorage"),R=0,N=E.length;R<N;R++){var M=E[R],j=!Ti(ze,M);if((j||a[M])&&typeof a[M]!="function"){y(w);return}}var W=function(){for(var Be=function(Pi){return function(){var Oi=new Error("Method "+Pi+" is not implemented by the current driver"),ln=g.reject(Oi);return I(ln,arguments[arguments.length-1]),ln}},Yt=0,Ci=ze.length;Yt<Ci;Yt++){var zt=ze[Yt];a[zt]||(a[zt]=Be(zt))}};W();var q=function(Be){Fe[_]&&console.info("Redefining LocalForage driver: "+_),Fe[_]=a,un[_]=Be,h()};"_support"in a?a._support&&typeof a._support=="function"?a._support().then(q,y):q(!!a._support):q(!0)}catch(ie){y(ie)}});return O(u,l,f),u},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(a,l,f){var u=Fe[a]?g.resolve(Fe[a]):g.reject(new Error("Driver not found."));return O(u,l,f),u},o.prototype.getSerializer=function(a){var l=g.resolve(Gt);return O(l,a),l},o.prototype.ready=function(a){var l=this,f=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return O(f,a,a),f},o.prototype.setDriver=function(a,l,f){var u=this;cn(a)||(a=[a]);var h=this._getSupportedDrivers(a);function y(){u._config.driver=u.driver()}function _(R){return u._extend(R),y(),u._ready=u._initStorage(u._config),u._ready}function w(R){return function(){var N=0;function M(){for(;N<R.length;){var j=R[N];return N++,u._dbInfo=null,u._ready=null,u.getDriver(j).then(_).catch(M)}y();var W=new Error("No available storage method found.");return u._driverSet=g.reject(W),u._driverSet}return M()}}var E=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=E.then(function(){var R=h[0];return u._dbInfo=null,u._ready=null,u.getDriver(R).then(function(N){u._driver=N._driver,y(),u._wrapLibraryMethodsWithReady(),u._initDriver=w(h)})}).catch(function(){y();var R=new Error("No available storage method found.");return u._driverSet=g.reject(R),u._driverSet}),O(this._driverSet,l,f),this._driverSet},o.prototype.supports=function(a){return!!un[a]},o.prototype._extend=function(a){Wt(this,a)},o.prototype._getSupportedDrivers=function(a){for(var l=[],f=0,u=a.length;f<u;f++){var h=a[f];this.supports(h)&&l.push(h)}return l},o.prototype._wrapLibraryMethodsWithReady=function(){for(var a=0,l=qt.length;a<l;a++)Ai(this,qt[a])},o.prototype.createInstance=function(a){return new o(a)},o}(),ki=new xi;i.exports=ki},{3:3}]},{},[4])(4)})});var fo=pn(Te=>{"use strict";V();Ge();Ee();var Ce=ae(),qa=se("levelFinished",{paramsSchema:x.tuple(x.string(),x.object({result:x.boolean(),duration:x.number()})),implement:(e,t)=>C(Te,null,function*(){let{result:r,duration:n}=t;ce.info("onLevelFinished",r,n),yield Promise.all([le.reporter({event:"COMPLETE_GAME_LEVEL"}),le.tracker("LevelFinished",{levelId:e,result:r,duration:n})])})}),Wa=se("taskFinished",{paramsSchema:x.tuple(x.string(),x.object({duration:x.number()})),implement:(e,t)=>C(Te,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),Ya=se("levelUpgrade",{paramsSchema:x.tuple(x.string(),x.string()),implement:(e,t)=>C(Te,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),za=se("onHistoryUserLevel",{paramsSchema:x.tuple(x.number()),implement:e=>C(Te,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),Qa=se("onHistoryUserScore",{paramsSchema:x.tuple(x.number()),implement:e=>C(Te,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),Xa=se("taskEvent",{paramsSchema:x.tuple(x.string(),x.object({tools:x.array(x.object({id:x.string(),name:x.string(),count:x.number(),description:x.string().optional(),price:x.object({amount:x.number(),unit:x.string()}).optional()})).optional(),awards:x.array(x.object({id:x.string(),name:x.string()})).optional()})),implement:(e,t)=>C(Te,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([le.reporter({event:"USE_GAME_ITEM"}),le.tracker("UseGameItem",$({taskId:e},t))]))})});Ce.registerCommand("TaskTrackerSDK.levelFinished",qa);Ce.registerCommand("TaskTrackerSDK.taskFinished",Wa);Ce.registerCommand("TaskTrackerSDK.levelUpgrade",Ya);Ce.registerCommand("TaskTrackerSDK.historyUserLevel",za);Ce.registerCommand("TaskTrackerSDK.historyUserScore",Qa);Ce.registerCommand("TaskTrackerSDK.taskEvent",Xa);Q("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Q("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Q("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Q("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});Ee();ee();Ge();V();var ao=ae(),Pa="env",Oa="getSystemInfoSync",Da=()=>{var i,c,d,m;let e={system:A.deviceInfo.system,platform:A.deviceInfo.platform.toLowerCase(),brand:A.deviceInfo.brand,pixelRatio:A.deviceInfo.pixelRatio,language:A.deviceInfo.lang,version:A.sdkInfo.jssdkVersion,appName:(i=A.hostInfo)==null?void 0:i.appName,SDKVersion:A.sdkInfo.nativeSDKVersion},t=(c=A.hostInfo)==null?void 0:c.version;t&&(e=z($({},e),{version:t}));let r=(d=A.hostInfo)==null?void 0:d.appName;r&&(e=z($({},e),{appName:r}));let n=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return n&&(e=z($({},e),{SDKVersion:n})),e},Na=Ie(Oa,{implement:Da}),La=Ie(Pa,{implement:()=>z($({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});ao.registerCommand("API.env",La);ao.registerCommand("API.getSystemInfoSync",Na);Q("env",{version:"1.0.0"});Q("getSystemInfoSync",{version:"1.0.0"});V();Ge();_e();Ee();var Ua="onJoliboxShow",Fa="onJoliboxHide",Ba="onReady",Lr=ae(),Ur=Cn(ue),Nr=!0,qe=!0,At=0,xt=Ar;function Ma(){let e=Date.now();if(e-At<100)return;At=e;let t=document.visibilityState==="visible";t!==Nr&&(Nr=t,xt.emit("visible",Nr))}function so(e){let t=Date.now();t-At<100||(At=t,e==="focus"&&!qe?qe=!0:e==="blur"&&qe&&(qe=!1),xt.emit("visible",qe))}document.addEventListener("visibilitychange",Ma);window.addEventListener("focus",()=>so("focus"));window.addEventListener("blur",()=>so("blur"));var ja=Ie(Ua,{paramsSchema:x.tuple(x.function()),implement(e){let t=Ur(e);xt.on("visible",r=>{r&&t()})}}),$a=Ie(Fa,{paramsSchema:x.tuple(x.function()),implement(e){let t=Ur(e);xt.on("visible",r=>{!r&&t()})}}),Va=Ie(Ba,{paramsSchema:x.tuple(x.function()),implement(e){let t=Ur(e);Je.on("LifecycleEvent.onReady",r=>{t(r)})}});Lr.registerCommand("LifecycleSDK.onReady",Va);Lr.registerCommand("LifecycleSDK.onJoliboxShow",ja);Lr.registerCommand("LifecycleSDK.onJoliboxHide",$a);Q("lifeCycle.onReady",{version:"1.0.0"});Q("lifeCycle.onJoliboxShow",{version:"1.0.0"});Q("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ge();V();Ke();ee();var lo=hn(uo());var kt=ae(),Br=class{constructor(){this.httpClient=ge.create({baseUrl:A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"});this.getGameId=()=>A.mpId;this.getItem=t=>C(this,null,function*(){let{code:r,data:n,message:i}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),c=n==null?void 0:n.value,d=i;return r!=="SUCCESS"&&(c=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",c),d+="fallback to localstorage"),{code:r,message:d,data:c&&c!=="undefined"?c:null}});this.setItem=(t,r)=>C(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:i,message:c}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:i,message:c}});this.removeItem=t=>C(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>C(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=lo.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},Ct=new Br,Ha=se("getLocalStorage",{paramsSchema:x.tuple(x.string()),implement(e){return C(this,null,function*(){return yield Ct.getItem(e)})}});kt.registerCommand("StorageSDK.getItem",Ha);Q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ja=se("setStorage",{paramsSchema:x.tuple(x.string(),x.or(x.string(),x.boolean(),x.number())),implement(e,t){return C(this,null,function*(){return yield Ct.setItem(e,t)})}});kt.registerCommand("StorageSDK.setItem",Ja);Q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ka=se("removeStorage",{paramsSchema:x.tuple(x.string()),implement(e){return C(this,null,function*(){return yield Ct.removeItem(e)})}});kt.registerCommand("StorageSDK.removeItem",Ka);Q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Ga=se("clearStorage",{implement(){return C(this,null,function*(){return yield Ct.clear()})}});kt.registerCommand("StorageSDK.clear",Ga);Q("storage.clear",{version:"1.0.0"});var Nl=hn(fo());var Pt=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};var Ot=class{constructor(t,r,n,i){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let i=this.checkShouldBanHighFreq(t);if(i)return i;let c=this.checkShouldBanForTime(t);return c?{reason:c}:{reason:"ALLOWED"}};var g,I,O,D,k,P,H;let c=(g=i==null?void 0:i.maxAllowedAdsForTime)!=null?g:8,d=(I=i==null?void 0:i.banForTimeThreshold)!=null?I:6e4,m=(O=i==null?void 0:i.bannedReleaseTime)!=null?O:6e4,p=(D=i==null?void 0:i.maxAllowedAdsForSession)!=null?D:200,b=(k=i==null?void 0:i.banForSessionThreshold)!=null?k:6e5,v=(P=i==null?void 0:i.initialThreshold)!=null?P:2e3,S=(H=i==null?void 0:i.highFreqThreshold)!=null?H:2e3;this.checkShouldBanInitial=ts(v),this.checkShouldBanHighFreq=rs(S),this.checkShouldBanForTime=es(c,d,m),this.checkShouldBanForSession=Za(p,b)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},Za=(e,t)=>{let r=!1,n=[];return c=>{if(r)return"BANNED_FOR_SESSION";let d=Date.now();if(n=n.concat({timestamp:d,type:c}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&d-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},es=(e,t,r)=>{let n=null,i=v=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{p.value=!1,n=null},v)},c="jolibox-sdk-ads-callbreak-timestamps",d="jolibox-sdk-ads-ban-for-time",m={_records:[],init(){var v;try{let S=JSON.parse((v=window.__joliboxLocalStorage__.getItem(c))!=null?v:"[]");Array.isArray(S)?this._records=S:this._records=[]}catch(S){this._records=[]}},get values(){return this._records},set values(v){try{window.__joliboxLocalStorage__.setItem(c,JSON.stringify(v))}catch(S){}this._records=v}},p={_record:!1,init(){var v;try{let S=JSON.parse((v=window.__joliboxLocalStorage__.getItem(d))!=null?v:"false");typeof S=="boolean"&&(this._record=S)}catch(S){this._record=!1}if(this._record){let S=m.values[m.values.length-1],g=S?Date.now()-S.timestamp:r;g<=r&&g>0?i(g):this._record=!1}},get value(){return this._record},set value(v){try{window.__joliboxLocalStorage__.setItem(d,JSON.stringify(v))}catch(S){}this._record=v}};return m.init(),p.init(),v=>{if(p.value)return"WAITING_BANNED_RELEASE";let S=Date.now();if(m.values=m.values.concat({timestamp:S,type:v}),m.values.length!==1&&(m.values.length>e&&(m.values=m.values.slice(-e)),m.values.length===e&&S-m.values[0].timestamp<=t))return p.value=!0,i(r),"BANNED_FOR_TIME"}},ts=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},rs=(e=2e3)=>{let t=0,r=null;return i=>{if(i==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}};ee();ee();var Dt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return C(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let i=(r=A.channel)!=null?r:"",c=this.configs[i],d=(n=c==null?void 0:c.interstitialRate)!=null?n:1;t=Math.random()<d}return this.firstRun=!1,t}};V();var Pe=new de,Nt=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>A.mpId;this.getTestAdsMode=()=>A.testAdsMode;this.asyncLoad=()=>C(this,null,function*(){var d,m,p,b,v;let t="ca-pub-7171363994453626",r,n,i=window.encodeURIComponent(window.btoa((d=this.getGameId())!=null?d:"")),c=(m=this.getTestAdsMode())!=null?m:!1;try{let S=yield this.httpClient.get("/public/ads",{query:{objectId:i,testAdsMode:`${c}`}});t=(p=S.data)==null?void 0:p.clientId,r=(b=S.data)==null?void 0:b.channelId,n=(v=S.data)==null?void 0:v.unitId}catch(S){console.error("Failed to fetch client info",S)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>C(this,null,function*(){var i;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(i=this.getTestAdsMode())!=null?i:!1;if(!document.getElementById(r)&&this.clientId){let c=document.createElement("script");c.id=r,c.async=!0,c.crossOrigin="anonymous",c.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&c.setAttribute("data-adbreak-test","on"),this.channelId&&c.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(c),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{let r=!1,n=t.adBreakDone,i=d=>{var m;r=!0,this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:d.breakType,breakName:(m=d.breakName)!=null?m:"",breakFormat:d.breakFormat,breakStatus:d.breakStatus}),n&&n(d)};if(t.adBreakDone=i,t.type==="reward"){let d=t.beforeReward,m=b=>()=>{this.track("CallShowAdFn",null),b()},p=b=>{r=!0,d&&d(m(b))};t.beforeReward=p,window.setTimeout(()=>{var b,v;r||(this.track("CallAdBreakTimeout",{type:t.type}),(v=t.adBreakDone)==null||v.call(t,{breakType:t.type,breakName:(b=t.name)!=null?b:"",breakFormat:"reward",breakStatus:"timeout"}))},5e3)}if((d=>d.type==="preroll")(t)){Pe.emit("isAdShowing",!0);let d=t.adBreakDone,m=p=>{Pe.emit("isAdShowing",!1),d&&d(p)};return z($({},t),{adBreakDone:m})}else{let d=t.beforeAd,m=t.afterAd,p=()=>{var v;r=!0,Pe.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(v=t.name)!=null?v:""}),d&&d()},b=()=>{var v;r=!0,Pe.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(v=t.name)!=null?v:""}),m&&m()};return z($({},t),{beforeAd:p,afterAd:b})}};this.adConfig=t=>{let i=t,{onReady:r}=i,n=mn(i,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var m,p,b,v,S,g;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(S=t.adBreakDone)==null||S.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((v=n==null?void 0:n.count)!=null?v:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let i=t.type,c;switch(i){case"preroll":c={type:i};break;case"start":case"pause":case"next":case"browse":case"reward":c={type:i,name:(g=t.name)!=null?g:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",c);let d=this.wrapAdBreakParams(t);this.push(d),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>C(this,null,function*(){var g,I,O,D;if(this.track("CallAdUnit",{adFormat:(I=(g=t.adFormat)==null?void 0:g.toString())!=null?I:null,fullWidthResponsive:(O=t.fullWidthResponsive)!=null?O:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:i,fullWidthResponsive:c,style:d}=t,m;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?m=document.querySelector(r):m=r,!m)throw new Error("targeting element not found");let p=n;if(p||(p=this.unitId),!p)throw new Error("slot is required");let b=typeof i=="object"&&Array.isArray(i)?i.join(", "):i,v=document.createElement("ins");if(v.className="adsbygoogle",v.id="jolibox-ads",v.style.display="block",v.setAttribute("data-ad-client",this.clientId),v.setAttribute("data-ad-slot",p),b&&v.setAttribute("data-ad-format",b),c&&v.setAttribute("data-full-width-responsive",c),d&&v.setAttribute("style",d),(D=this.getTestAdsMode())!=null?D:!1){let k=document.createElement("div");k.style.position="absolute",k.style.top="0",k.style.left="0",k.style.width="100%",k.style.height="100%",k.style.display="flex",k.style.justifyContent="center",k.style.alignItems="center",k.style.backgroundColor="rgba(0, 0, 0, 0.5)",k.style.color="white",k.innerHTML="Test Ad",v.style.position="relative",m.appendChild(v),v.appendChild(k)}else m.appendChild(v),new MutationObserver(P=>{P.forEach(H=>{if(H.type==="attributes"&&H.attributeName==="data-ad-status"){let F=v.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:F!=null?F:"null"})}})}).observe(v,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Ot(t,r,n),this.adsActionDetection=new Pt(this.track),this.channelPolicy=new Dt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}};Ee();V();Ke();var Mr=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};ee();var mo=A.testMode;function po(){let e=new Map,t;return{registerRewardHandler(n,i){e.set(n,i)},handleReward(n,...i){return C(this,null,function*(){return yield n.reduce((d,m)=>C(this,null,function*(){let p=yield d;if(p===!0)return!0;mo&&console.log(`handleReward ${m}`);let b=e.get(m),v=b?yield b(...i):p;return mo&&console.log(`handleReward ${m} ${v}`),v}),Promise.resolve(!1))})},registerRewardsFetcher(n){return C(this,null,function*(){t=(...i)=>C(this,null,function*(){try{return yield n(...i)}catch(c){return console.error("getRewardOptions error:",c),["ADS"]}})})},getRewardsTypes(...n){return C(this,null,function*(){return t?yield t(...n):["ADS"]})}}}var ns=()=>(e,t)=>e==="JOLI_COIN"&&t==="ADS"?-1:e==="ADS"&&t==="JOLI_COIN"?1:0,ho=e=>{e.registerRewardsFetcher(t=>C(void 0,null,function*(){var c,d,m,p;let r=[],n=yield t.post("/api/games/unlock-options",{});return n.code!=="SUCCESS"?r:(Ut.emit(Lt,{options:((c=n.data)==null?void 0:c.unlockOptions)||[],userJoliCoin:((d=n.extra)==null?void 0:d.joliCoin)||{balance:0,enableAutoDeduct:!1}}),(((p=(m=n.data)==null?void 0:m.unlockOptions)==null?void 0:p.map(b=>b.type))||Array.from(r)).sort(ns()))}))};V();var go=e=>t=>C(void 0,null,function*(){return e.adBreak(t),!0});ee();V();var vo=(e,t)=>e.some(r=>r.type==="JOLI_COIN"&&r.joliCoinChoices.some(n=>{var i;return n.joliCoinQuantity<=((i=t==null?void 0:t.balance)!=null?i:0)&&!!(t!=null&&t.enableAutoDeduct)}));var yo=(e,{onUnlockSuccess:t,onUnlockFailed:r})=>{let n=null,i=null,c=null,d=()=>{if(c){n=Promise.resolve(c);return}n=new Promise(m=>{i=m})};return d(),Ut.on(Lt,m=>{c=m,i&&(i(m),i=null)}),()=>C(void 0,null,function*(){try{n||d();let m=yield n;if(!vo((m==null?void 0:m.options)||[],m==null?void 0:m.userJoliCoin))return r==null||r(),!1;let p=yield e.post("/api/joli-coin/unlock",{data:{type:"GAME_REWARD",reqId:`${mr()}-${A.mpType}-${Date.now()}`,gameInfo:{gameId:A.mpId}}});return p.code=="SUCCESS"?(t==null||t({quantity:p.data.quantity,balance:p.data.balance}),!0):(r==null||r(),!1)}catch(m){return console.error("JolicoinRewardHandler error:",m),r==null||r(),!1}})};var Oe=po();ho(Oe);var Lt="UNLOCK_OPTIONS_CHANGED",Ut=new de;var Ft=ae(),os=ge.create(),Se=new Nt(fe,os,()=>ge.getNetworkStatus());Oe.registerRewardHandler("ADS",go(Se));Oe.registerRewardHandler("JOLI_COIN",yo(Se.httpClient,{onUnlockSuccess:e=>{Mr("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e})}}));Pe.on("isAdShowing",e=>{Mr("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Ft.registerCommand("AdsSDK.init",e=>{Se.init(e)});Ft.registerCommand("AdsSDK.adConfig",e=>{Se.adConfig(e)});Ft.registerCommand("AdsSDK.adBreak",e=>{e.type==="reward"?Oe.getRewardsTypes(Se.httpClient).then(t=>{Oe.handleReward(t,e)}):Se.adBreak(e)});Ft.registerCommand("AdsSDK.adUnit",e=>{Se.adUnit(e)});V();Ee();var To=-1,Mt=function(e){addEventListener("pageshow",function(t){t.persisted&&(To=t.timeStamp,e(t))},!0)},$r=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},jt=function(){var e=$r();return e&&e.activationStart||0},Ne=function(e,t){var r=$r(),n="navigate";return To>=0?n="back-forward-cache":r&&(document.prerendering||jt()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},So=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){t(i.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},Le=function(e,t,r,n){var i,c;return function(d){t.value>=0&&(d||n)&&((c=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=c,t.rating=function(m,p){return m>p[1]?"poor":m>p[0]?"needs-improvement":"good"}(t.value,r),e(t))}},Ro=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},Ao=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},xo=function(e){var t=!1;return function(){t||(e(),t=!0)}},De=-1,bo=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Bt=function(e){document.visibilityState==="hidden"&&De>-1&&(De=e.type==="visibilitychange"?e.timeStamp:0,is())},_o=function(){addEventListener("visibilitychange",Bt,!0),addEventListener("prerenderingchange",Bt,!0)},is=function(){removeEventListener("visibilitychange",Bt,!0),removeEventListener("prerenderingchange",Bt,!0)},ko=function(){return De<0&&(De=bo(),_o(),Mt(function(){setTimeout(function(){De=bo(),_o()},0)})),{get firstHiddenTime(){return De}}},Vr=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},wo=[1800,3e3],Co=function(e,t){t=t||{},Vr(function(){var r,n=ko(),i=Ne("FCP"),c=So("paint",function(d){d.forEach(function(m){m.name==="first-contentful-paint"&&(c.disconnect(),m.startTime<n.firstHiddenTime&&(i.value=Math.max(m.startTime-jt(),0),i.entries.push(m),r(!0)))})});c&&(r=Le(e,i,wo,t.reportAllChanges),Mt(function(d){i=Ne("FCP"),r=Le(e,i,wo,t.reportAllChanges),Ro(function(){i.value=performance.now()-d.timeStamp,r(!0)})}))})};var as=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=xo(e),document.visibilityState==="hidden"?e():(r=t(e),Ao(e)),r};var Eo=[2500,4e3],jr={},Po=function(e,t){t=t||{},Vr(function(){var r,n=ko(),i=Ne("LCP"),c=function(p){t.reportAllChanges||(p=p.slice(-1)),p.forEach(function(b){b.startTime<n.firstHiddenTime&&(i.value=Math.max(b.startTime-jt(),0),i.entries=[b],r())})},d=So("largest-contentful-paint",c);if(d){r=Le(e,i,Eo,t.reportAllChanges);var m=xo(function(){jr[i.id]||(c(d.takeRecords()),d.disconnect(),jr[i.id]=!0,r(!0))});["keydown","click"].forEach(function(p){addEventListener(p,function(){return as(m)},{once:!0,capture:!0})}),Ao(m),Mt(function(p){i=Ne("LCP"),r=Le(e,i,Eo,t.reportAllChanges),Ro(function(){i.value=performance.now()-p.timeStamp,jr[i.id]=!0,r(!0)})})}})},Io=[800,1800],ss=function e(t){document.prerendering?Vr(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},Oo=function(e,t){t=t||{};var r=Ne("TTFB"),n=Le(e,r,Io,t.reportAllChanges);ss(function(){var i=$r();i&&(r.value=Math.max(i.responseStart-jt(),0),r.entries=[i],n(!0),Mt(function(){r=Ne("TTFB",0),(n=Le(e,r,Io,t.reportAllChanges))(!0)}))})};ee();function cs(){Co(e=>{fe("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Po(e=>{fe("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Oo(e=>{fe("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function us(){Je.on("onDocumentReady",e=>{Je.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function Do(){us(),cs()}Do();
|
|
1
|
+
var Ti=Object.create;var Wt=Object.defineProperty,Si=Object.defineProperties,Ri=Object.getOwnPropertyDescriptor,Ai=Object.getOwnPropertyDescriptors,ki=Object.getOwnPropertyNames,ze=Object.getOwnPropertySymbols,xi=Object.getPrototypeOf,zt=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable;var an=(e,t,r)=>t in e?Wt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$=(e,t)=>{for(var r in t||(t={}))zt.call(t,r)&&an(e,r,t[r]);if(ze)for(var r of ze(t))sn.call(t,r)&&an(e,r,t[r]);return e},Y=(e,t)=>Si(e,Ai(t));var Ue=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var cn=(e,t)=>{var r={};for(var n in e)zt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ze)for(var n of ze(e))t.indexOf(n)<0&&sn.call(e,n)&&(r[n]=e[n]);return r};var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var un=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ci=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of ki(t))!zt.call(e,a)&&a!==r&&Wt(e,a,{get:()=>t[a],enumerable:!(n=Ri(t,a))||n.enumerable});return e};var ln=(e,t,r)=>(r=e!=null?Ti(xi(e)):{},Ci(t||!e||!e.__esModule?Wt(r,"default",{value:e,enumerable:!0}):r,e));var F=(e,t,r)=>new Promise((n,a)=>{var c=p=>{try{m(r.next(p))}catch(E){a(E)}},f=p=>{try{m(r.throw(p))}catch(E){a(E)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(c,f);m((r=r.apply(e,t)).next())});function Mi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function nr(e){return typeof e=="string"}function gn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function vn(e){return typeof e=="object"&&Array.isArray(e)}function ji(e){return typeof e=="undefined"}function $i(e){return ji(e)||e===null}function Vi(e){return typeof e=="function"}function yn(e){let t=e,r=null,n=function(...a){return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}function bn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(a,c){for(let f in c)if(Object.prototype.hasOwnProperty.call(c,f)){let m=a[f],p=c[f],E=r(m,p,f,a,c);E!==void 0?a[f]=E:mn(p)&&mn(m)?a[f]=n(rr({},m),p):Array.isArray(p)&&Array.isArray(m)?a[f]=[...m,...p]:a[f]=p}return a}return n(e,t)}function mn(e){return e&&typeof e=="object"&&e.constructor===Object}function _n(e,t){if(Array.isArray(e))return e.concat(t)}function je(e,t,r={}){let n=null,a,c,f,{leading:m=!1,trailing:p=!0}=r,E=()=>(f=e.apply(c,a),a=void 0,c=void 0,f),y=function(...S){a=S,c=this;let g=m&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p&&!g&&E()},t),g)return E()};return y.cancel=()=>{n&&clearTimeout(n),n=null,a=c=void 0},y.flush=()=>{if(n)return clearTimeout(n),n=null,E()},y}function Gi(e,t){return(...r)=>t(e,...r)}function Sn(e){return t=>Gi(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(a){e(new Ki(`${a}`))}})}function Be(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Xe(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((a,c)=>(a[c]=String(n[c]),a),{})}return e[r]})}function Yi(e){let t=e.location?Xe(e.location,pn):null,r=e.target?Xe(e.target,pn):null;return Xe(Fi(rr({},e),{location:t,target:r}),Wi)}function cr(e){let t=e.events.map(n=>Yi(n)),r=Xe(e.device,zi);return[e.protocolVersion,t,r,e.project]}function ur(){try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function sa(e){return new Promise(t=>xn(e)(t))}function xn(e){return(t,r=null)=>{let n=!1;return e(a=>{if(!n)return n=!0,t.call(r,a)},null)}}function ca(e,t){return(r=>{let n,a={onWillAddFirstListener(){n=r(c.fire,c)}},c=new Me(a);return c.event})((r,n=null)=>e(a=>t(a)&&r.call(n,a),null))}function la(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)da(e[n],t[n])}function da(e,t){if(nr(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Vi(t)){try{if(e instanceof t)return}catch(r){}if(!$i(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function fa(){return typeof globalThis!="undefined"?globalThis[Cn]:void 0}function ma(e){typeof globalThis!="undefined"&&(globalThis[Cn]=e)}function ae(){let e=fa();if(e)return e;let t=new Ze,r=new er,n={registerCommand(a,c,f){t.registerCommand({id:a,handler:c,metadata:f})},executeCommand(a,...c){return r.executeCommand(a,...c)},excuteCommandSync(a,...c){return r.executeCommandThowErr(a,...c)}};return ma(n),n}var tr,Pi,Di,Oi,dn,Li,Ni,fn,rr,Fi,Ui,hn,Bi,Hi,or,ir,En,wn,Ki,In,Tn,et,ar,ce,Rn,Ji,sr,$e,Ae,qi,pn,Wi,zi,Qi,Ye,Xi,Zi,ea,An,lr,ta,ra,na,kn,Qt,J,oa,ia,Qe,Me,be,Zt,aa,Yt,ua,Ve,Ze,er,Cn,H=G(()=>{"use strict";tr=Object.defineProperty,Pi=Object.defineProperties,Di=Object.getOwnPropertyDescriptor,Oi=Object.getOwnPropertyDescriptors,dn=Object.getOwnPropertySymbols,Li=Object.prototype.hasOwnProperty,Ni=Object.prototype.propertyIsEnumerable,fn=(e,t,r)=>t in e?tr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rr=(e,t)=>{for(var r in t||(t={}))Li.call(t,r)&&fn(e,r,t[r]);if(dn)for(var r of dn(t))Ni.call(t,r)&&fn(e,r,t[r]);return e},Fi=(e,t)=>Pi(e,Oi(t)),Ui=(e,t)=>{for(var r in t)tr(e,r,{get:t[r],enumerable:!0})},hn=(e,t,r,n)=>{for(var a=n>1?void 0:n?Di(t,r):t,c=e.length-1,f;c>=0;c--)(f=e[c])&&(a=(n?f(t,r,a):f(a))||a);return n&&a&&tr(t,r,a),a},Bi=(e,t,r)=>new Promise((n,a)=>{var c=p=>{try{m(r.next(p))}catch(E){a(E)}},f=p=>{try{m(r.throw(p))}catch(E){a(E)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(c,f);m((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let a=this._eventListeners[r].indexOf(n);a!==-1&&this._eventListeners[r].splice(a,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Hi=(e=>(e[e.DEVELOPER_FILE_NOT_FOUND=0]="DEVELOPER_FILE_NOT_FOUND",e[e.INTERNAL_IOS_CAN_NOT_FOUND_PKG=1]="INTERNAL_IOS_CAN_NOT_FOUND_PKG",e[e.USER_IOS_LOAD_TIMEOUT=2]="USER_IOS_LOAD_TIMEOUT",e[e.INTERNAL_IOS_PKG_LOAD_ERROR=3]="INTERNAL_IOS_PKG_LOAD_ERROR",e[e.INTERNAL_IOS_PKG_PARSE_FAIL=4]="INTERNAL_IOS_PKG_PARSE_FAIL",e[e.USER_IOS_GET_EMPTY_DATA=5]="USER_IOS_GET_EMPTY_DATA",e[e.USER_ANDROID_GET_PKG_FAIL=6]="USER_ANDROID_GET_PKG_FAIL",e[e.DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE=7]="DEVELOPER_ANDROID_PACKAGE_FILE_UNEXPECTED_REQUIRE",e))(Hi||{}),or=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},ir=class extends or{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},En=class extends or{constructor(){super(...arguments),this.kind="USER_ERROR"}},wn=class extends En{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Ki=class extends En{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},In=class extends ir{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Tn=class extends ir{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},et=class extends or{constructor(e,t,r,n,a){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},ar=class extends ir{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:Be("log"),warn:Be("warn"),info:Be("info"),error:Be("error"),debug:Be("debug")};Object.assign(globalThis,{logger:ce});Rn=Symbol.for("Jolibox.canIUseMap"),Ji={};globalThis[Rn]=Ji;sr={get config(){return globalThis[Rn]}},$e=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))($e||{}),Ae=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Ae||{}),qi=(e=>(e[e.App=0]="App",e[e.H5=1]="H5",e[e.Weapp=2]="Weapp",e[e.Alipay=3]="Alipay",e[e.Gcash=4]="Gcash",e[e.Dana=5]="Dana",e[e.Umma=6]="Umma",e[e.WebSDK=1e3]="WebSDK",e[e.AppSDK=1001]="AppSDK",e[e.Other=9999]="Other",e))(qi||{}),pn=["name","params"],Wi=["name","type","location","target","extra","timestamp","userId"],zi=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Qi=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});ur();Ye={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[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")},Xi=()=>Ye.isiOS?"iOS":Ye.isAndroid?"Android":Ye.isMac?"Mac":Ye.isFacebook?"Facebook":"PC",Zi="device_id",ea="advertising_id",An=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Qi()),window.__joliboxLocalStorage__.getItem(e)),lr=()=>An(Zi),ta=()=>An(ea),ra=e=>e.charAt(0).toUpperCase()+e.slice(1),na=()=>{var e;let t=new URLSearchParams(window.location.search);return ra((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},kn=e=>{let t="JoliboxWebSDK",r=Xi(),n=navigator.language,a=lr(),c=ta();return`${t} (${na()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${a} adid/${c} version/${e||""}`},Qt=class Xt{constructor(t){this.element=t,this.next=Xt.Undefined,this.prev=Xt.Undefined}};Qt.Undefined=new Qt(void 0);J=Qt,oa=class{constructor(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===J.Undefined}clear(){let e=this._first;for(;e!==J.Undefined;){let t=e.next;e.prev=J.Undefined,e.next=J.Undefined,e=t}this._first=J.Undefined,this._last=J.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new J(e);if(this._first===J.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==J.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==J.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==J.Undefined&&e.next!==J.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===J.Undefined&&e.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):e.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):e.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==J.Undefined;)yield e.element,e=e.next}},ia=0,Qe=class{constructor(e){this.value=e,this.id=ia++}},Me=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Qe&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,a,c,f,m,p;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let E=new Qe(t);this._listeners?this._listeners instanceof Qe?this._listeners=[this._listeners,E]:this._listeners.push(E):((a=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||a.call(n,this),this._listeners=E,(f=(c=this.options)==null?void 0:c.onDidFirstListener)==null||f.call(c,this)),(p=(m=this.options)==null?void 0:m.onDidAddListener)==null||p.call(m,this),this._size++}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(a){n(a)}}fire(e){this._listeners&&(this._listeners instanceof Qe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},be=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var r;let n=(r=this.listeners.get(e))!=null?r:new Me,a=f=>t(...f.args);this.listerHandlerMap.set(t,a),n.event(a),this.listeners.set(e,n);let c=this.cachedEventQueue.get(e);if(c)for(;c.size>0;)n.fire(rr({event:e},c.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new oa,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},Zt={};Ui(Zt,{None:()=>aa,filter:()=>ca,once:()=>xn,toPromise:()=>sa});aa=()=>{console.log("[Jolibox SDK] None Event")};Yt=Symbol.for("Jolibox.hostEmitter"),ua=()=>{let e=new be;return globalThis[Yt]||(globalThis[Yt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Yt]},Ve=ua();Ze=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Me,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let a of e.metadata.args)r.push(a.constraint);let n=e.handler;e.handler=function(...a){return la(a,r),n(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};Ze=hn([yn],Ze);er=class{constructor(){this._onWillExecuteCommand=new Me,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Me,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ze,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Mi(3e4)),this._starActivation}executeCommand(e,...t){return Bi(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Zt.toPromise(Zt.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};er=hn([yn],er);Cn=Symbol.for("Jolibox.commands")});function ue(e,t={}){dr.emit("ERROR_REPORT",{error:e,options:t})}var dr,Ee,_e=G(()=>{"use strict";H();H();dr=new be,Ee=new be;ue.debounce=je(ue,50,{leading:!0})});var fr,pa,Pn,Dn,On=G(()=>{"use strict";H();_e();fr=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(a){return{}}},pa=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Pn=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[c,f,m]=a;return{headerJson:fr(c),payloadJson:fr(f),signature:fr(m)}}else throw"joli_source is missing"}catch(r){return ue(new In(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Dn=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],a=pa(e),c=r[2];return`${n}.${a}.${c}`}return t}});var ha,tt,Ln,mr=G(()=>{"use strict";H();ha="1.1.13",tt=()=>ha,Ln=()=>{let e=tt();return`${kn(e)}`}});var ga,Nn,pr,Fn,Z,va,A,re=G(()=>{"use strict";H();On();mr();H();ga={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:lr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:tt()},schema:window.location.href,platform:"h5"},pr=(Nn=globalThis.joliboxJSCore)==null?void 0:Nn.env,Z=Object.assign({},(Fn=pr==null?void 0:pr())!=null?Fn:ga),va=()=>{var g,I,P,D,x,C,V,U,ee;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?Pn(Z.schema):{},n=`${Z.deviceInfo.did}-${new Date().getTime()}`,c=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,f=(P=(I=(g=c.get("mpId"))!=null?g:c.get("appId"))!=null?I:c.get("gameId"))!=null?P:"",m=(C=(x=(D=Z.clientSessionId)!=null?D:e==null?void 0:e.sessionId)!=null?x:c.get("sessionId"))!=null?C:n,p=!!((V=e==null?void 0:e.testAdsMode)!=null?V:c.get("testAdsMode")==="true"),E=(ee=(U=e==null?void 0:e.joliboxEnv)!=null?U:c.get("joliboxEnv"))!=null?ee:"production",y=E==="staging",S=t==null?void 0:t.channel;return{get testMode(){return y},get testAdsMode(){return p},get joliboxEnv(){return E},get joliSource(){var B;return(B=c.get("joliSource"))!=null?B:null},get mpId(){var B;return(B=f!=null?f:e==null?void 0:e.id)!=null?B:""},get mpVersion(){var B;return(B=t==null?void 0:t.ver)!=null?B:tt()},get mpType(){var B,T;return(T=(B=t==null?void 0:t.__mpType)!=null?B:e==null?void 0:e.__mpType)!=null?T:"game"},get platform(){var B;return(B=Z.platform)!=null?B:Z.deviceInfo.platform},get deviceInfo(){return Z.deviceInfo},get sdkInfo(){return Z.sdkInfo},get hostInfo(){return Z.hostInfo},get hostUserInfo(){return Z.hostUserInfo},get sessionId(){var B,T;return(T=(B=Z.clientSessionId)!=null?B:m)!=null?T:n},get channel(){return S},get webviewId(){var B;return(B=Z.webviewId)!=null?B:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},get baseApiHost(){return y?"https://stg-api.jolibox.com":"https://api.jolibox.com"},onEnvConfigChanged:B=>{bn(Z,B,_n)},encodeJoliSourceQuery:B=>{var T,N;return t&&r?Dn($($({},e),B),(T=c.get("joliSource"))!=null?T:""):(N=c.get("joliSource"))!=null?N:""}}},A=va()});var hr,Bn,ya,ba,Un,_a,Mn=G(()=>{"use strict";H();_e();re();H();hr=!1,Bn=(e,t)=>e==null?!1:t in e,ya=e=>Bn(e,"kind"),ba=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Un=(e,t={},r)=>{var c,f,m;let n={user_id:(f=(c=A.hostUserInfo)==null?void 0:c.uid)!=null?f:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:ba(e.name)},a=Y($({},n),{env:t.environment,isFromUser:r});r?Ee.emit("GLOBAL_USER_ERROR",e,a):Ee.emit("GLOBAL_ERROR",e,a)},_a=e=>Bn(e,"kind")&&e.kind==="USER_ERROR";dr.on("ERROR_REPORT",({error:e,options:t})=>{if(hr)return;hr=!0;let r=ya(e)&&e.raw?e.raw:e;try{let n=_a(e);Un(e,t,n)}catch(n){let a=n instanceof Error?n.message:String(n),c=new ar(`${a}, origin error: ${r.message}`);ce.error(c),Un(new ar(c.message),{environment:t.environment},!1)}finally{hr=!1}})});var gr,vr=G(()=>{"use strict";_e();H();_e();gr=e=>new wn(e)});function jn(e,t){let r=(n,a,c)=>{let f=Y($({tag:n},t),{extra:$({},a)});n=="globalJsError"?ue(new Tn(JSON.stringify(f))):e("systemLog",f,c)};return r.debounce=je(r,500,{leading:!0}),r}function $n(e){let t=(r,n,a)=>{var m;let c=(m=a&&JSON.stringify(a))!=null?m:0,f={speed_value_type:r,total_duration:n};c&&Object.assign(f,{extra:c}),e("joliboxSpeedAnalysis",f)};return t.debounce=je(t,500,{leading:!0}),t}var Vn=G(()=>{"use strict";H();H();_e()});function Hn(e,t){let r=jn(e,t),n=$n(r);return{track:r,trackPerformance:n}}var Kn=G(()=>{"use strict";Vn()});var yr=G(()=>{"use strict"});var rt,Gn=G(()=>{"use strict";re();H();H();rt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return F(this,null,function*(){let r=`${A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,a]of Object.entries(r))if(a.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,a,c,f,m;let{nativeSDKVersion:t,jssdkVersion:r}=A.sdkInfo;return{platform:1e3,os:A.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(c=(a=A.hostInfo)==null?void 0:a.aid)!=null?c:"1",model:(f=A.deviceInfo.model)!=null?f:"UnknownModel",brand:(m=A.deviceInfo.brand)!=null?m:"UnknownBrand",uuid:A.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,a)=>{r[a]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return F(this,null,function*(){if(this.checkIsSampled(t))return;let a=t.location?t.location:yield this.getLocation(),c=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,E={protocolVersion:"1.0.0",events:[Y($({},t),{location:a,target:c,extra:f,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(cr(E),n):yield this.doReport(cr(E))}catch(y){ce.log("[Jolibox SDK] report API error",y)}})}}});var br=G(()=>{"use strict";Kn();yr();Gn()});var _r,Jn,pe,nt,he,He=G(()=>{"use strict";mr();re();_r=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Jn=AbortSignal.timeout)!=null||(AbortSignal.timeout=_r);pe=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new nt(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}getNetworkStatus(){return this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}},nt=class{constructor(t){this.xua=Ln();this.getJoliSource=()=>A.joliSource;var n;let r=A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com";this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return F(this,null,function*(){try{let{query:n,timeout:a}=r!=null?r:{},{headers:c}=r!=null?r:{},f=n?new URLSearchParams(n):null,m=f==null?void 0:f.toString(),p=`${this.baseUrl}${t}${m?`?${m}`:""}`,E=this.xua,y=this.getJoliSource();c=Object.assign({},c!=null?c:{},E?{"x-user-agent":E}:{},y?{"x-joli-source":y}:{});let S=yield fetch(p,{method:"GET",headers:c,credentials:"include",signal:_r(a!=null?a:3e4)});return pe.getInstance().recordNetworkRequest(!0),yield S.json()}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return F(this,null,function*(){try{let{data:n,query:a,timeout:c}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),E=`${this.baseUrl}${t}${p?`?${p}`:""}`,y=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},y?{"x-user-agent":y}:{},S?{"x-joli-source":S}:{});let g=yield fetch(E,{method:"POST",headers:f,body:JSON.stringify(n),signal:_r(c!=null?c:3e4),credentials:"include"});pe.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(I!=null&&I.includes("multipart/form-data")||I!=null&&I.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return F(this,null,function*(){try{let{data:n,query:a,timeout:c}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),E=`${this.baseUrl}${t}${p?`?${p}`:""}`,y=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},y?{"x-user-agent":y}:{},S?{"x-joli-source":S}:{});let g=yield fetch(E,{method:"PUT",headers:f,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!g.ok)throw pe.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${g.status}`);return pe.getInstance().recordNetworkRequest(!0),yield g.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=nt;he=pe.getInstance()});var Er,ot,wr=G(()=>{"use strict";re();br();He();Er=class extends rt{constructor(){super(...arguments);this.hostToApiMap={default:{test:"https://stg-collect.jolibox.com",prod:"https://collect.jolibox.com"},"oss.jolibox.com":{test:"https://stg-collect.jolibox.com",prod:"https://collect.jolibox.com"},"oss.pico-game.com":{test:"https://stg-collect.pico-game.com",prod:"https://collect.pico-game.com"}};this.httpClient=he.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n,a;let r=(n=this.hostToApiMap[window.location.host])!=null?n:this.hostToApiMap.default;return(a=A.testMode)!=null&&a?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},ot=new Er});var Ea,qn=G(()=>{"use strict";Mn();H();vr();H();wr();re();Ea=(e,t)=>{var a,c,f;let r={message:t.message,stack:(a=t.stack)!=null?a:"",errorType:t.name,source:0},n={name:e,type:$e.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(f=(c=A.hostUserInfo)==null?void 0:c.uid)!=null?f:null};ot.trackEvent(n,Ae.WebSDK)};Ee.on("GLOBAL_ERROR",(e,t)=>{Ea(t.tag,e)});Ee.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var it,Wn=G(()=>{"use strict";it=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,a,c=!1,f=0,m=()=>{if(!c)return;let I=Date.now(),P=I-r;P>=this.interval&&(this.visible&&(f+=P,t(f)),r=I),n=requestAnimationFrame(m)},p=()=>{y(),r=Date.now(),a=window.setInterval(()=>{if(!c)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},E=()=>{S(),r=Date.now(),n=requestAnimationFrame(m)},y=()=>{n&&(cancelAnimationFrame(n),n=0)},S=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",I=>{c&&(console.log("visible",I),I?E():p())});let g=this.visible;return{start(){c||(c=!0,g?E():p())},stop(){c=!1,y(),S()}}}}});var at,zn=G(()=>{"use strict";re();Wn();He();at=class extends it{constructor(r,n,a){super(n,a);this.httpClient=he.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return F(this,null,function*(){let{event:n,params:a}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:$({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,n=null){this.track(r,n)}}});var Yn,wa,de,Ia,Ir,le,we=G(()=>{"use strict";qn();H();H();br();wr();zn();re();yr();Yn=ae(),wa={type:Ae.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:de,trackPerformance:Ia}=Hn((...e)=>{var f,m,p,E;let[,t]=e,r=t,n=gn(r.extra)?r.extra:nr(r.extra)?JSON.parse(r.extra):{},a=Y($({},n),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(m=r.mp_version)!=null?m:""}),c={name:t.tag,type:$e.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(E=(p=A.hostUserInfo)==null?void 0:p.uid)!=null?E:null};ot.trackEvent(c,Ae.WebSDK)},wa);Yn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Ia(e,t,r)});Yn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{de(e,t)});Ir=new be,le=new at(de,Ir)});function Qn(e){let t=sr.config[e];return t||(t={},sr.config[e]=t),(r,n)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=$({},n)}}var Xn=G(()=>{"use strict";H()});function Tr(e){Zn=e}function st(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>st(t)):Object.keys(e).reduce((t,r)=>(t[r]=st(e[r]),t),{})}function ge(e){return typeof e=="number"}function Sr(e){let t=Rr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Rr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Zn,z,ct,ut,lt,dt,ke,ft,mt,pt,ht,gt,vt,yt,bt,_t,Et,wt,It,Ar=G(()=>{"use strict";Zn=!1;z=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Zn)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${Sr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return st(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:st(this._default)}optional(){return this._optional=!0,this}};ct=class extends z{validate(t){return this._optional&&t===void 0?!0:ge(t)?ge(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ge(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ge(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},ut=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},lt=class extends z{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ge(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ge(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},dt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends z{validate(t){return!0}},ft=class extends z{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},mt=class extends z{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},pt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},ht=class extends z{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Sr(t)}`)}return!0}},gt=class extends z{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ge(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ge(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ge(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let a=!0;if(r.forEach((c,f)=>{if(n.path=`${this.path}[${f}]`,n.errors=this.errors,c===void 0&&n.hasDefault){r[f]=n.defaultValue;return}n.validate(c)||(n.hasFallback?r[f]=n.fallbackValue:a=!1)}),this._uniqueItems){let c=new Map;for(let f in r)c.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${c.get(r[f])}] and ${this.path}[${f}] are identical)`):c.set(r[f],f)}return a}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},vt=class extends z{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Rr(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,c=this._value;c.errors=this.errors;let f=!0;for(let m in a){let p=a[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?c.path=`${this.path}.${m}`:c.path=`${this.path}["${m}"]`,!(p===void 0&&c._optional)){if(p===void 0&&c.hasDefault){a[m]=c.defaultValue;continue}c.validate(p)||(c.hasFallback?a[m]=c.fallbackValue:f=!1)}}return f}},yt=class extends z{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Rr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,a=!0;for(let c in this._object){let f=n[c],m=this._object[c];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(c)?m.path=`${this.path}.${c}`:m.path=`${this.path}["${c}"]`,!(m._optional&&f===void 0)){if(f===void 0&&m.hasDefault){n[c]=m.defaultValue;continue}m.validate(f)||(m.hasFallback?n[c]=m.fallbackValue:a=!1)}}return a}},bt=class extends z{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Sr(this.value),actual:r}):!0}},_t=class extends z{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,a=this._items.length;for(let c=0;c<a;c++){let f=this._items[c];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!n){n=!0;break}}if(!n){let c=r.join(`
|
|
2
|
+
or `);this.errors.push(c)}return n}},Et=class extends z{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let a=t[n];if(a._optional||a.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,t[a]===void 0&&n.hasDefault){t[a]=n.defaultValue;return}n.validate(t[a])||(n.hasFallback?t[a]=n._fallback:r=!1)}),r}},wt=class extends z{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},It=class extends z{constructor(t){super(),this._ctor=t}validate(t){return t===void 0&&this._optional||t instanceof this._ctor?!0:this.fail({expect:`typedarray of ${this._ctor.name}`,actual:t})}}});function kr(e,t,r="param"){if(e.errors=[],e.path=r,Tr(!0),!e.validate(t)){let n=e.errors.join(`
|
|
3
|
+
`);throw e.errors.length=0,Tr(!1),new TypeError(n)}}var k,xr=G(()=>{"use strict";Ar();Ar();k={object(e){return new yt(e)},array(e){return new gt(e)},tuple(...e){return new Et(...e)},literal(e){return new bt(e)},or(...e){return new _t(...e)},symbol(){return new dt},record(e){return new vt(e)},function(){return new pt},boolean(){return new ut},string(){return new lt},number(){return new ct},undefined(){return new ft},null(){return new mt},unknown(){return new ke},any(){return new ke},as(){return new ke},arraybuffer(){return new wt},enum(...e){return new ht(...e)},typedarray(e){return new It(e)}}});var Tt,eo,to=G(()=>{"use strict";H();_e();xr();vr();Tt=1,eo=e=>{function t(n,a){return(...c)=>{var S,g,I,P;let f=Date.now(),m={method:n,trace_id:Tt};Tt+=1;let p="SUCCESS",E=`${n}:ok`,y=0;try{if(a.paramsSchema)try{kr(a.paramsSchema,c,"params")}catch(V){throw gr(`${n}:fail ${V.message}`)}let D=a.implement(...c),x=D,C=`${n}:ok`;if(D&&"code"in D){let{code:V,data:U,message:ee}=D;p=V,x=U,C=ee}return{code:p,message:C,data:x}}catch(D){let x=D;y=(g=(S=x.code)!=null?S:x.errNo)!=null?g:2e3,p="FAILURE";let C=(P=(I=x.message)!=null?I:x.errMsg)!=null?P:`${D}`;return E=`${n}:${p} ${C.replace(/^\S+:(fail|cancel)\s?/,"")}`,ue(new et(E,y)),{code:p,message:E}}finally{let D=Date.now()-f;e("apiInvoked",Y($({},m),{duration:D,status:p}))}}}function r(n,a){return(...c)=>F(this,null,function*(){var g,I,P,D;let f=vn(c)?c:[c],m=Date.now(),p={method:n,trace_id:Tt};Tt+=1;let E=`${n}:ok`,y="SUCCESS",S={code:y,message:E};try{if(a.paramsSchema)try{kr(a.paramsSchema,f,"params")}catch(V){throw gr(V.message)}let C=yield a.implement(...f);if(C&&"code"in C){let{code:V,data:U,message:ee}=C;y=V,E=ee,C=U}return Object.assign(S,{code:y,message:E,data:C}),S}catch(x){let C=x,V=(I=(g=C.code)!=null?g:C.errNo)!=null?I:2e3;y="FAILURE";let U=(D=(P=C.message)!=null?P:C.errMsg)!=null?D:`${x}`,ee=`${n}:${y} ${U.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(S,{code:y,message:ee}),ue(new et(ee,V)),S}finally{let x=Date.now()-m;e("apiInvoked",Y($({},p),{duration:x,status:y}))}})}return{createAPI:r,createSyncAPI:t}}});var se,Ie,Q,Ke=G(()=>{"use strict";Xn();we();to();xr();({createAPI:se,createSyncAPI:Ie}=eo(de)),Q=Qn("h5")});var io=un((oo,Or)=>{(function(e){if(typeof oo=="object"&&typeof Or!="undefined")Or.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(a,c,f){function m(y,S){if(!c[y]){if(!a[y]){var g=typeof Ue=="function"&&Ue;if(!S&&g)return g(y,!0);if(p)return p(y,!0);var I=new Error("Cannot find module '"+y+"'");throw I.code="MODULE_NOT_FOUND",I}var P=c[y]={exports:{}};a[y][0].call(P.exports,function(D){var x=a[y][1][D];return m(x||D)},P,P.exports,n,a,c,f)}return c[y].exports}for(var p=typeof Ue=="function"&&Ue,E=0;E<f.length;E++)m(f[E]);return m}({1:[function(n,a,c){(function(f){"use strict";var m=f.MutationObserver||f.WebKitMutationObserver,p;if(m){var E=0,y=new m(D),S=f.document.createTextNode("");y.observe(S,{characterData:!0}),p=function(){S.data=E=++E%2}}else if(!f.setImmediate&&typeof f.MessageChannel!="undefined"){var g=new f.MessageChannel;g.port1.onmessage=D,p=function(){g.port2.postMessage(0)}}else"document"in f&&"onreadystatechange"in f.document.createElement("script")?p=function(){var C=f.document.createElement("script");C.onreadystatechange=function(){D(),C.onreadystatechange=null,C.parentNode.removeChild(C),C=null},f.document.documentElement.appendChild(C)}:p=function(){setTimeout(D,0)};var I,P=[];function D(){I=!0;for(var C,V,U=P.length;U;){for(V=P,P=[],C=-1;++C<U;)V[C]();U=P.length}I=!1}a.exports=x;function x(C){P.push(C)===1&&!I&&p()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,a,c){"use strict";var f=n(1);function m(){}var p={},E=["REJECTED"],y=["FULFILLED"],S=["PENDING"];a.exports=g;function g(T){if(typeof T!="function")throw new TypeError("resolver must be a function");this.state=S,this.queue=[],this.outcome=void 0,T!==m&&x(this,T)}g.prototype.catch=function(T){return this.then(null,T)},g.prototype.then=function(T,N){if(typeof T!="function"&&this.state===y||typeof N!="function"&&this.state===E)return this;var L=new this.constructor(m);if(this.state!==S){var K=this.state===y?T:N;P(L,K,this.outcome)}else this.queue.push(new I(L,T,N));return L};function I(T,N,L){this.promise=T,typeof N=="function"&&(this.onFulfilled=N,this.callFulfilled=this.otherCallFulfilled),typeof L=="function"&&(this.onRejected=L,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(T){p.resolve(this.promise,T)},I.prototype.otherCallFulfilled=function(T){P(this.promise,this.onFulfilled,T)},I.prototype.callRejected=function(T){p.reject(this.promise,T)},I.prototype.otherCallRejected=function(T){P(this.promise,this.onRejected,T)};function P(T,N,L){f(function(){var K;try{K=N(L)}catch(X){return p.reject(T,X)}K===T?p.reject(T,new TypeError("Cannot resolve promise with itself")):p.resolve(T,K)})}p.resolve=function(T,N){var L=C(D,N);if(L.status==="error")return p.reject(T,L.value);var K=L.value;if(K)x(T,K);else{T.state=y,T.outcome=N;for(var X=-1,te=T.queue.length;++X<te;)T.queue[X].callFulfilled(N)}return T},p.reject=function(T,N){T.state=E,T.outcome=N;for(var L=-1,K=T.queue.length;++L<K;)T.queue[L].callRejected(N);return T};function D(T){var N=T&&T.then;if(T&&(typeof T=="object"||typeof T=="function")&&typeof N=="function")return function(){N.apply(T,arguments)}}function x(T,N){var L=!1;function K(oe){L||(L=!0,p.reject(T,oe))}function X(oe){L||(L=!0,p.resolve(T,oe))}function te(){N(X,K)}var ne=C(te);ne.status==="error"&&K(ne.value)}function C(T,N){var L={};try{L.value=T(N),L.status="success"}catch(K){L.status="error",L.value=K}return L}g.resolve=V;function V(T){return T instanceof this?T:p.resolve(new this(m),T)}g.reject=U;function U(T){var N=new this(m);return p.reject(N,T)}g.all=ee;function ee(T){var N=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,K=!1;if(!L)return this.resolve([]);for(var X=new Array(L),te=0,ne=-1,oe=new this(m);++ne<L;)fe(T[ne],ne);return oe;function fe(Le,Je){N.resolve(Le).then(Bt,function(Se){K||(K=!0,p.reject(oe,Se))});function Bt(Se){X[Je]=Se,++te===L&&!K&&(K=!0,p.resolve(oe,X))}}}g.race=B;function B(T){var N=this;if(Object.prototype.toString.call(T)!=="[object Array]")return this.reject(new TypeError("must be an array"));var L=T.length,K=!1;if(!L)return this.resolve([]);for(var X=-1,te=new this(m);++X<L;)ne(T[X]);return te;function ne(oe){N.resolve(oe).then(function(fe){K||(K=!0,p.resolve(te,fe))},function(fe){K||(K=!0,p.reject(te,fe))})}}},{1:1}],3:[function(n,a,c){(function(f){"use strict";typeof f.Promise!="function"&&(f.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,a,c){"use strict";var f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function m(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}function p(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(o){return}}var E=p();function y(){try{if(!E||!E.open)return!1;var o=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),s=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!o||s)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function S(o,s){o=o||[],s=s||{};try{return new Blob(o,s)}catch(u){if(u.name!=="TypeError")throw u;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new i,d=0;d<o.length;d+=1)l.append(o[d]);return l.getBlob(s.type)}}typeof Promise=="undefined"&&n(3);var g=Promise;function I(o,s){s&&o.then(function(i){s(null,i)},function(i){s(i)})}function P(o,s,i){typeof s=="function"&&o.then(s),typeof i=="function"&&o.catch(i)}function D(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function x(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var C="local-forage-detect-blob-support",V=void 0,U={},ee=Object.prototype.toString,B="readonly",T="readwrite";function N(o){for(var s=o.length,i=new ArrayBuffer(s),l=new Uint8Array(i),d=0;d<s;d++)l[d]=o.charCodeAt(d);return i}function L(o){return new g(function(s){var i=o.transaction(C,T),l=S([""]);i.objectStore(C).put(l,"key"),i.onabort=function(d){d.preventDefault(),d.stopPropagation(),s(!1)},i.oncomplete=function(){var d=navigator.userAgent.match(/Chrome\/(\d+)/),u=navigator.userAgent.match(/Edge\//);s(u||!d||parseInt(d[1],10)>=43)}}).catch(function(){return!1})}function K(o){return typeof V=="boolean"?g.resolve(V):L(o).then(function(s){return V=s,V})}function X(o){var s=U[o.name],i={};i.promise=new g(function(l,d){i.resolve=l,i.reject=d}),s.deferredOperations.push(i),s.dbReady?s.dbReady=s.dbReady.then(function(){return i.promise}):s.dbReady=i.promise}function te(o){var s=U[o.name],i=s.deferredOperations.pop();if(i)return i.resolve(),i.promise}function ne(o,s){var i=U[o.name],l=i.deferredOperations.pop();if(l)return l.reject(s),l.promise}function oe(o,s){return new g(function(i,l){if(U[o.name]=U[o.name]||Mr(),o.db)if(s)X(o),o.db.close();else return i(o.db);var d=[o.name];s&&d.push(o.version);var u=E.open.apply(E,d);s&&(u.onupgradeneeded=function(h){var v=u.result;try{v.createObjectStore(o.storeName),h.oldVersion<=1&&v.createObjectStore(C)}catch(b){if(b.name==="ConstraintError")console.warn('The database "'+o.name+'" has been upgraded from version '+h.oldVersion+" to version "+h.newVersion+', but the storage "'+o.storeName+'" already exists.');else throw b}}),u.onerror=function(h){h.preventDefault(),l(u.error)},u.onsuccess=function(){var h=u.result;h.onversionchange=function(v){v.target.close()},i(h),te(o)}})}function fe(o){return oe(o,!1)}function Le(o){return oe(o,!0)}function Je(o,s){if(!o.db)return!0;var i=!o.db.objectStoreNames.contains(o.storeName),l=o.version<o.db.version,d=o.version>o.db.version;if(l&&(o.version!==s&&console.warn('The database "'+o.name+`" can't be downgraded from version `+o.db.version+" to version "+o.version+"."),o.version=o.db.version),d||i){if(i){var u=o.db.version+1;u>o.version&&(o.version=u)}return!0}return!1}function Bt(o){return new g(function(s,i){var l=new FileReader;l.onerror=i,l.onloadend=function(d){var u=btoa(d.target.result||"");s({__local_forage_encoded_blob:!0,data:u,type:o.type})},l.readAsBinaryString(o)})}function Se(o){var s=N(atob(o.data));return S([s],{type:o.type})}function Br(o){return o&&o.__local_forage_encoded_blob}function So(o){var s=this,i=s._initReady().then(function(){var l=U[s._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return P(i,o,o),i}function Ro(o){X(o);for(var s=U[o.name],i=s.forages,l=0;l<i.length;l++){var d=i[l];d._dbInfo.db&&(d._dbInfo.db.close(),d._dbInfo.db=null)}return o.db=null,fe(o).then(function(u){return o.db=u,Je(o)?Le(o):u}).then(function(u){o.db=s.db=u;for(var h=0;h<i.length;h++)i[h]._dbInfo.db=u}).catch(function(u){throw ne(o,u),u})}function me(o,s,i,l){l===void 0&&(l=1);try{var d=o.db.transaction(o.storeName,s);i(null,d)}catch(u){if(l>0&&(!o.db||u.name==="InvalidStateError"||u.name==="NotFoundError"))return g.resolve().then(function(){if(!o.db||u.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),Le(o)}).then(function(){return Ro(o).then(function(){me(o,s,i,l-1)})}).catch(i);i(u)}}function Mr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Ao(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=o[l];var d=U[i.name];d||(d=Mr(),U[i.name]=d),d.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=So);var u=[];function h(){return g.resolve()}for(var v=0;v<d.forages.length;v++){var b=d.forages[v];b!==s&&u.push(b._initReady().catch(h))}var _=d.forages.slice(0);return g.all(u).then(function(){return i.db=d.db,fe(i)}).then(function(w){return i.db=w,Je(i,s._defaultConfig.version)?Le(i):w}).then(function(w){i.db=d.db=w,s._dbInfo=i;for(var R=0;R<_.length;R++){var O=_[R];O!==s&&(O._dbInfo.db=i.db,O._dbInfo.version=i.version)}})}function ko(o,s){var i=this;o=D(o);var l=new g(function(d,u){i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return u(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.get(o);_.onsuccess=function(){var w=_.result;w===void 0&&(w=null),Br(w)&&(w=Se(w)),d(w)},_.onerror=function(){u(_.error)}}catch(w){u(w)}})}).catch(u)});return I(l,s),l}function xo(o,s){var i=this,l=new g(function(d,u){i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return u(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.openCursor(),w=1;_.onsuccess=function(){var R=_.result;if(R){var O=R.value;Br(O)&&(O=Se(O));var M=o(O,R.key,w++);M!==void 0?d(M):R.continue()}else d()},_.onerror=function(){u(_.error)}}catch(R){u(R)}})}).catch(u)});return I(l,s),l}function Co(o,s,i){var l=this;o=D(o);var d=new g(function(u,h){var v;l.ready().then(function(){return v=l._dbInfo,ee.call(s)==="[object Blob]"?K(v.db).then(function(b){return b?s:Bt(s)}):s}).then(function(b){me(l._dbInfo,T,function(_,w){if(_)return h(_);try{var R=w.objectStore(l._dbInfo.storeName);b===null&&(b=void 0);var O=R.put(b,o);w.oncomplete=function(){b===void 0&&(b=null),u(b)},w.onabort=w.onerror=function(){var M=O.error?O.error:O.transaction.error;h(M)}}catch(M){h(M)}})}).catch(h)});return I(d,i),d}function Po(o,s){var i=this;o=D(o);var l=new g(function(d,u){i.ready().then(function(){me(i._dbInfo,T,function(h,v){if(h)return u(h);try{var b=v.objectStore(i._dbInfo.storeName),_=b.delete(o);v.oncomplete=function(){d()},v.onerror=function(){u(_.error)},v.onabort=function(){var w=_.error?_.error:_.transaction.error;u(w)}}catch(w){u(w)}})}).catch(u)});return I(l,s),l}function Do(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,T,function(u,h){if(u)return d(u);try{var v=h.objectStore(s._dbInfo.storeName),b=v.clear();h.oncomplete=function(){l()},h.onabort=h.onerror=function(){var _=b.error?b.error:b.transaction.error;d(_)}}catch(_){d(_)}})}).catch(d)});return I(i,o),i}function Oo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,B,function(u,h){if(u)return d(u);try{var v=h.objectStore(s._dbInfo.storeName),b=v.count();b.onsuccess=function(){l(b.result)},b.onerror=function(){d(b.error)}}catch(_){d(_)}})}).catch(d)});return I(i,o),i}function Lo(o,s){var i=this,l=new g(function(d,u){if(o<0){d(null);return}i.ready().then(function(){me(i._dbInfo,B,function(h,v){if(h)return u(h);try{var b=v.objectStore(i._dbInfo.storeName),_=!1,w=b.openKeyCursor();w.onsuccess=function(){var R=w.result;if(!R){d(null);return}o===0||_?d(R.key):(_=!0,R.advance(o))},w.onerror=function(){u(w.error)}}catch(R){u(R)}})}).catch(u)});return I(l,s),l}function No(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,B,function(u,h){if(u)return d(u);try{var v=h.objectStore(s._dbInfo.storeName),b=v.openKeyCursor(),_=[];b.onsuccess=function(){var w=b.result;if(!w){l(_);return}_.push(w.key),w.continue()},b.onerror=function(){d(b.error)}}catch(w){d(w)}})}).catch(d)});return I(i,o),i}function Fo(o,s){s=x.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;if(!o.name)d=g.reject("Invalid arguments");else{var u=o.name===i.name&&l._dbInfo.db,h=u?g.resolve(l._dbInfo.db):fe(o).then(function(v){var b=U[o.name],_=b.forages;b.db=v;for(var w=0;w<_.length;w++)_[w]._dbInfo.db=v;return v});o.storeName?d=h.then(function(v){if(v.objectStoreNames.contains(o.storeName)){var b=v.version+1;X(o);var _=U[o.name],w=_.forages;v.close();for(var R=0;R<w.length;R++){var O=w[R];O._dbInfo.db=null,O._dbInfo.version=b}var M=new g(function(j,W){var q=E.open(o.name,b);q.onerror=function(ie){var Fe=q.result;Fe.close(),W(ie)},q.onupgradeneeded=function(){var ie=q.result;ie.deleteObjectStore(o.storeName)},q.onsuccess=function(){var ie=q.result;ie.close(),j(ie)}});return M.then(function(j){_.db=j;for(var W=0;W<w.length;W++){var q=w[W];q._dbInfo.db=j,te(q._dbInfo)}}).catch(function(j){throw(ne(o,j)||g.resolve()).catch(function(){}),j})}}):d=h.then(function(v){X(o);var b=U[o.name],_=b.forages;v.close();for(var w=0;w<_.length;w++){var R=_[w];R._dbInfo.db=null}var O=new g(function(M,j){var W=E.deleteDatabase(o.name);W.onerror=function(){var q=W.result;q&&q.close(),j(W.error)},W.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},W.onsuccess=function(){var q=W.result;q&&q.close(),M(q)}});return O.then(function(M){b.db=M;for(var j=0;j<_.length;j++){var W=_[j];te(W._dbInfo)}}).catch(function(M){throw(ne(o,M)||g.resolve()).catch(function(){}),M})})}return I(d,s),d}var Uo={_driver:"asyncStorage",_initStorage:Ao,_support:y(),iterate:xo,getItem:ko,setItem:Co,removeItem:Po,clear:Do,length:Oo,key:Lo,keys:No,dropInstance:Fo};function Bo(){return typeof openDatabase=="function"}var ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Mo="~~local_forage_type~",jr=/^~~local_forage_type~([^~]+)~/,qe="__lfsc__:",Mt=qe.length,jt="arbf",$t="blob",$r="si08",Vr="ui08",Hr="uic8",Kr="si16",Gr="si32",Jr="ur16",qr="ui32",Wr="fl32",zr="fl64",Yr=Mt+jt.length,Qr=Object.prototype.toString;function Xr(o){var s=o.length*.75,i=o.length,l,d=0,u,h,v,b;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var _=new ArrayBuffer(s),w=new Uint8Array(_);for(l=0;l<i;l+=4)u=ve.indexOf(o[l]),h=ve.indexOf(o[l+1]),v=ve.indexOf(o[l+2]),b=ve.indexOf(o[l+3]),w[d++]=u<<2|h>>4,w[d++]=(h&15)<<4|v>>2,w[d++]=(v&3)<<6|b&63;return _}function Vt(o){var s=new Uint8Array(o),i="",l;for(l=0;l<s.length;l+=3)i+=ve[s[l]>>2],i+=ve[(s[l]&3)<<4|s[l+1]>>4],i+=ve[(s[l+1]&15)<<2|s[l+2]>>6],i+=ve[s[l+2]&63];return s.length%3===2?i=i.substring(0,i.length-1)+"=":s.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function jo(o,s){var i="";if(o&&(i=Qr.call(o)),o&&(i==="[object ArrayBuffer]"||o.buffer&&Qr.call(o.buffer)==="[object ArrayBuffer]")){var l,d=qe;o instanceof ArrayBuffer?(l=o,d+=jt):(l=o.buffer,i==="[object Int8Array]"?d+=$r:i==="[object Uint8Array]"?d+=Vr:i==="[object Uint8ClampedArray]"?d+=Hr:i==="[object Int16Array]"?d+=Kr:i==="[object Uint16Array]"?d+=Jr:i==="[object Int32Array]"?d+=Gr:i==="[object Uint32Array]"?d+=qr:i==="[object Float32Array]"?d+=Wr:i==="[object Float64Array]"?d+=zr:s(new Error("Failed to get type for BinaryArray"))),s(d+Vt(l))}else if(i==="[object Blob]"){var u=new FileReader;u.onload=function(){var h=Mo+o.type+"~"+Vt(this.result);s(qe+$t+h)},u.readAsArrayBuffer(o)}else try{s(JSON.stringify(o))}catch(h){console.error("Couldn't convert value into a JSON string: ",o),s(null,h)}}function $o(o){if(o.substring(0,Mt)!==qe)return JSON.parse(o);var s=o.substring(Yr),i=o.substring(Mt,Yr),l;if(i===$t&&jr.test(s)){var d=s.match(jr);l=d[1],s=s.substring(d[0].length)}var u=Xr(s);switch(i){case jt:return u;case $t:return S([u],{type:l});case $r:return new Int8Array(u);case Vr:return new Uint8Array(u);case Hr:return new Uint8ClampedArray(u);case Kr:return new Int16Array(u);case Jr:return new Uint16Array(u);case Gr:return new Int32Array(u);case qr:return new Uint32Array(u);case Wr:return new Float32Array(u);case zr:return new Float64Array(u);default:throw new Error("Unkown type: "+i)}}var Ht={serialize:jo,deserialize:$o,stringToBuffer:Xr,bufferToString:Vt};function Zr(o,s,i,l){o.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function Vo(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=typeof o[l]!="string"?o[l].toString():o[l];var d=new g(function(u,h){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(v){return h(v)}i.db.transaction(function(v){Zr(v,i,function(){s._dbInfo=i,u()},function(b,_){h(_)})},h)});return i.serializer=Ht,d}function ye(o,s,i,l,d,u){o.executeSql(i,l,d,function(h,v){v.code===v.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(b,_){_.rows.length?u(b,v):Zr(b,s,function(){b.executeSql(i,l,d,u)},u)},u):u(h,v)},u)}function Ho(o,s){var i=this;o=D(o);var l=new g(function(d,u){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[o],function(b,_){var w=_.rows.length?_.rows.item(0).value:null;w&&(w=h.serializer.deserialize(w)),d(w)},function(b,_){u(_)})})}).catch(u)});return I(l,s),l}function Ko(o,s){var i=this,l=new g(function(d,u){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT * FROM "+h.storeName,[],function(b,_){for(var w=_.rows,R=w.length,O=0;O<R;O++){var M=w.item(O),j=M.value;if(j&&(j=h.serializer.deserialize(j)),j=o(j,M.key,O+1),j!==void 0){d(j);return}}d()},function(b,_){u(_)})})}).catch(u)});return I(l,s),l}function en(o,s,i,l){var d=this;o=D(o);var u=new g(function(h,v){d.ready().then(function(){s===void 0&&(s=null);var b=s,_=d._dbInfo;_.serializer.serialize(s,function(w,R){R?v(R):_.db.transaction(function(O){ye(O,_,"INSERT OR REPLACE INTO "+_.storeName+" (key, value) VALUES (?, ?)",[o,w],function(){h(b)},function(M,j){v(j)})},function(O){if(O.code===O.QUOTA_ERR){if(l>0){h(en.apply(d,[o,b,i,l-1]));return}v(O)}})})}).catch(v)});return I(u,i),u}function Go(o,s,i){return en.apply(this,[o,s,i,1])}function Jo(o,s){var i=this;o=D(o);var l=new g(function(d,u){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[o],function(){d()},function(b,_){u(_)})})}).catch(u)});return I(l,s),l}function qo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){ye(h,u,"DELETE FROM "+u.storeName,[],function(){l()},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function Wo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){ye(h,u,"SELECT COUNT(key) as c FROM "+u.storeName,[],function(v,b){var _=b.rows.item(0).c;l(_)},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function zo(o,s){var i=this,l=new g(function(d,u){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){ye(v,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[o+1],function(b,_){var w=_.rows.length?_.rows.item(0).key:null;d(w)},function(b,_){u(_)})})}).catch(u)});return I(l,s),l}function Yo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var u=s._dbInfo;u.db.transaction(function(h){ye(h,u,"SELECT key FROM "+u.storeName,[],function(v,b){for(var _=[],w=0;w<b.rows.length;w++)_.push(b.rows.item(w).key);l(_)},function(v,b){d(b)})})}).catch(d)});return I(i,o),i}function Qo(o){return new g(function(s,i){o.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(d,u){for(var h=[],v=0;v<u.rows.length;v++)h.push(u.rows.item(v).name);s({db:o,storeNames:h})},function(d,u){i(u)})},function(l){i(l)})})}function Xo(o,s){s=x.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;return o.name?d=new g(function(u){var h;o.name===i.name?h=l._dbInfo.db:h=openDatabase(o.name,"","",0),o.storeName?u({db:h,storeNames:[o.storeName]}):u(Qo(h))}).then(function(u){return new g(function(h,v){u.db.transaction(function(b){function _(M){return new g(function(j,W){b.executeSql("DROP TABLE IF EXISTS "+M,[],function(){j()},function(q,ie){W(ie)})})}for(var w=[],R=0,O=u.storeNames.length;R<O;R++)w.push(_(u.storeNames[R]));g.all(w).then(function(){h()}).catch(function(M){v(M)})},function(b){v(b)})})}):d=g.reject("Invalid arguments"),I(d,s),d}var Zo={_driver:"webSQLStorage",_initStorage:Vo,_support:Bo(),iterate:Ko,getItem:Ho,setItem:Go,removeItem:Jo,clear:qo,length:Wo,key:zo,keys:Yo,dropInstance:Xo};function ei(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(o){return!1}}function tn(o,s){var i=o.name+"/";return o.storeName!==s.storeName&&(i+=o.storeName+"/"),i}function ti(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(s){return!0}}function ri(){return!ti()||localStorage.length>0}function ni(o){var s=this,i={};if(o)for(var l in o)i[l]=o[l];return i.keyPrefix=tn(o,s._defaultConfig),ri()?(s._dbInfo=i,i.serializer=Ht,g.resolve()):g.reject()}function oi(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo.keyPrefix,d=localStorage.length-1;d>=0;d--){var u=localStorage.key(d);u.indexOf(l)===0&&localStorage.removeItem(u)}});return I(i,o),i}function ii(o,s){var i=this;o=D(o);var l=i.ready().then(function(){var d=i._dbInfo,u=localStorage.getItem(d.keyPrefix+o);return u&&(u=d.serializer.deserialize(u)),u});return I(l,s),l}function ai(o,s){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,u=d.keyPrefix,h=u.length,v=localStorage.length,b=1,_=0;_<v;_++){var w=localStorage.key(_);if(w.indexOf(u)===0){var R=localStorage.getItem(w);if(R&&(R=d.serializer.deserialize(R)),R=o(R,w.substring(h),b++),R!==void 0)return R}}});return I(l,s),l}function si(o,s){var i=this,l=i.ready().then(function(){var d=i._dbInfo,u;try{u=localStorage.key(o)}catch(h){u=null}return u&&(u=u.substring(d.keyPrefix.length)),u});return I(l,s),l}function ci(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo,d=localStorage.length,u=[],h=0;h<d;h++){var v=localStorage.key(h);v.indexOf(l.keyPrefix)===0&&u.push(v.substring(l.keyPrefix.length))}return u});return I(i,o),i}function ui(o){var s=this,i=s.keys().then(function(l){return l.length});return I(i,o),i}function li(o,s){var i=this;o=D(o);var l=i.ready().then(function(){var d=i._dbInfo;localStorage.removeItem(d.keyPrefix+o)});return I(l,s),l}function di(o,s,i){var l=this;o=D(o);var d=l.ready().then(function(){s===void 0&&(s=null);var u=s;return new g(function(h,v){var b=l._dbInfo;b.serializer.serialize(s,function(_,w){if(w)v(w);else try{localStorage.setItem(b.keyPrefix+o,_),h(u)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&v(R),v(R)}})})});return I(d,i),d}function fi(o,s){if(s=x.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var i=this.config();o.name=o.name||i.name,o.storeName=o.storeName||i.storeName}var l=this,d;return o.name?d=new g(function(u){o.storeName?u(tn(o,l._defaultConfig)):u(o.name+"/")}).then(function(u){for(var h=localStorage.length-1;h>=0;h--){var v=localStorage.key(h);v.indexOf(u)===0&&localStorage.removeItem(v)}}):d=g.reject("Invalid arguments"),I(d,s),d}var mi={_driver:"localStorageWrapper",_initStorage:ni,_support:ei(),iterate:ai,getItem:ii,setItem:di,removeItem:li,clear:oi,length:ui,key:si,keys:ci,dropInstance:fi},pi=function(s,i){return s===i||typeof s=="number"&&typeof i=="number"&&isNaN(s)&&isNaN(i)},hi=function(s,i){for(var l=s.length,d=0;d<l;){if(pi(s[d],i))return!0;d++}return!1},rn=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Ne={},nn={},Re={INDEXEDDB:Uo,WEBSQL:Zo,LOCALSTORAGE:mi},gi=[Re.INDEXEDDB._driver,Re.WEBSQL._driver,Re.LOCALSTORAGE._driver],We=["dropInstance"],Kt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(We),vi={description:"",driver:gi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function yi(o,s){o[s]=function(){var i=arguments;return o.ready().then(function(){return o[s].apply(o,i)})}}function Gt(){for(var o=1;o<arguments.length;o++){var s=arguments[o];if(s)for(var i in s)s.hasOwnProperty(i)&&(rn(s[i])?arguments[0][i]=s[i].slice():arguments[0][i]=s[i])}return arguments[0]}var bi=function(){function o(s){m(this,o);for(var i in Re)if(Re.hasOwnProperty(i)){var l=Re[i],d=l._driver;this[i]=d,Ne[d]||this.defineDriver(l)}this._defaultConfig=Gt({},vi),this._config=Gt({},this._defaultConfig,s),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return o.prototype.config=function(i){if((typeof i=="undefined"?"undefined":f(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},o.prototype.defineDriver=function(i,l,d){var u=new g(function(h,v){try{var b=i._driver,_=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){v(_);return}for(var w=Kt.concat("_initStorage"),R=0,O=w.length;R<O;R++){var M=w[R],j=!hi(We,M);if((j||i[M])&&typeof i[M]!="function"){v(_);return}}var W=function(){for(var Fe=function(wi){return function(){var Ii=new Error("Method "+wi+" is not implemented by the current driver"),on=g.reject(Ii);return I(on,arguments[arguments.length-1]),on}},Jt=0,Ei=We.length;Jt<Ei;Jt++){var qt=We[Jt];i[qt]||(i[qt]=Fe(qt))}};W();var q=function(Fe){Ne[b]&&console.info("Redefining LocalForage driver: "+b),Ne[b]=i,nn[b]=Fe,h()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(q,v):q(!!i._support):q(!0)}catch(ie){v(ie)}});return P(u,l,d),u},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(i,l,d){var u=Ne[i]?g.resolve(Ne[i]):g.reject(new Error("Driver not found."));return P(u,l,d),u},o.prototype.getSerializer=function(i){var l=g.resolve(Ht);return P(l,i),l},o.prototype.ready=function(i){var l=this,d=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return P(d,i,i),d},o.prototype.setDriver=function(i,l,d){var u=this;rn(i)||(i=[i]);var h=this._getSupportedDrivers(i);function v(){u._config.driver=u.driver()}function b(R){return u._extend(R),v(),u._ready=u._initStorage(u._config),u._ready}function _(R){return function(){var O=0;function M(){for(;O<R.length;){var j=R[O];return O++,u._dbInfo=null,u._ready=null,u.getDriver(j).then(b).catch(M)}v();var W=new Error("No available storage method found.");return u._driverSet=g.reject(W),u._driverSet}return M()}}var w=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=w.then(function(){var R=h[0];return u._dbInfo=null,u._ready=null,u.getDriver(R).then(function(O){u._driver=O._driver,v(),u._wrapLibraryMethodsWithReady(),u._initDriver=_(h)})}).catch(function(){v();var R=new Error("No available storage method found.");return u._driverSet=g.reject(R),u._driverSet}),P(this._driverSet,l,d),this._driverSet},o.prototype.supports=function(i){return!!nn[i]},o.prototype._extend=function(i){Gt(this,i)},o.prototype._getSupportedDrivers=function(i){for(var l=[],d=0,u=i.length;d<u;d++){var h=i[d];this.supports(h)&&l.push(h)}return l},o.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=Kt.length;i<l;i++)yi(this,Kt[i])},o.prototype.createInstance=function(i){return new o(i)},o}(),_i=new bi;a.exports=_i},{3:3}]},{},[4])(4)})});var so=un(Te=>{"use strict";H();Ke();we();var xe=ae(),$a=se("levelFinished",{paramsSchema:k.tuple(k.string(),k.object({result:k.boolean(),duration:k.number()})),implement:(e,t)=>F(Te,null,function*(){let{result:r,duration:n}=t;ce.info("onLevelFinished",r,n),yield Promise.all([le.reporter({event:"COMPLETE_GAME_LEVEL"}),le.tracker("LevelFinished",{levelId:e,result:r,duration:n})])})}),Va=se("taskFinished",{paramsSchema:k.tuple(k.string(),k.object({duration:k.number()})),implement:(e,t)=>F(Te,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),Ha=se("levelUpgrade",{paramsSchema:k.tuple(k.string(),k.string()),implement:(e,t)=>F(Te,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),Ka=se("onHistoryUserLevel",{paramsSchema:k.tuple(k.number()),implement:e=>F(Te,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),Ga=se("onHistoryUserScore",{paramsSchema:k.tuple(k.number()),implement:e=>F(Te,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),Ja=se("taskEvent",{paramsSchema:k.tuple(k.string(),k.object({tools:k.array(k.object({id:k.string(),name:k.string(),count:k.number(),description:k.string().optional(),price:k.object({amount:k.number(),unit:k.string()}).optional()})).optional(),awards:k.array(k.object({id:k.string(),name:k.string()})).optional()})),implement:(e,t)=>F(Te,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([le.reporter({event:"USE_GAME_ITEM"}),le.tracker("UseGameItem",$({taskId:e},t))]))})});xe.registerCommand("TaskTrackerSDK.levelFinished",$a);xe.registerCommand("TaskTrackerSDK.taskFinished",Va);xe.registerCommand("TaskTrackerSDK.levelUpgrade",Ha);xe.registerCommand("TaskTrackerSDK.historyUserLevel",Ka);xe.registerCommand("TaskTrackerSDK.historyUserScore",Ga);xe.registerCommand("TaskTrackerSDK.taskEvent",Ja);Q("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Q("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Q("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Q("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});we();re();Ke();H();var ro=ae(),Sa="env",Ra="getSystemInfoSync",Aa=()=>{var a,c,f,m;let e={system:A.deviceInfo.system,platform:A.deviceInfo.platform.toLowerCase(),brand:A.deviceInfo.brand,pixelRatio:A.deviceInfo.pixelRatio,language:A.deviceInfo.lang,version:A.sdkInfo.jssdkVersion,appName:(a=A.hostInfo)==null?void 0:a.appName,SDKVersion:A.sdkInfo.nativeSDKVersion},t=(c=A.hostInfo)==null?void 0:c.version;t&&(e=Y($({},e),{version:t}));let r=(f=A.hostInfo)==null?void 0:f.appName;r&&(e=Y($({},e),{appName:r}));let n=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return n&&(e=Y($({},e),{SDKVersion:n})),e},ka=Ie(Ra,{implement:Aa}),xa=Ie(Sa,{implement:()=>Y($({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});ro.registerCommand("API.env",xa);ro.registerCommand("API.getSystemInfoSync",ka);Q("env",{version:"1.0.0"});Q("getSystemInfoSync",{version:"1.0.0"});H();Ke();_e();we();var Ca="onJoliboxShow",Pa="onJoliboxHide",Da="onReady",Pr=ae(),Dr=Sn(ue),Cr=!0,Ge=!0,St=0,Rt=Ir;function Oa(){let e=Date.now();if(e-St<100)return;St=e;let t=document.visibilityState==="visible";t!==Cr&&(Cr=t,Rt.emit("visible",Cr))}function no(e){let t=Date.now();t-St<100||(St=t,e==="focus"&&!Ge?Ge=!0:e==="blur"&&Ge&&(Ge=!1),Rt.emit("visible",Ge))}document.addEventListener("visibilitychange",Oa);window.addEventListener("focus",()=>no("focus"));window.addEventListener("blur",()=>no("blur"));var La=Ie(Ca,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Rt.on("visible",r=>{r&&t()})}}),Na=Ie(Pa,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Rt.on("visible",r=>{!r&&t()})}}),Fa=Ie(Da,{paramsSchema:k.tuple(k.function()),implement(e){let t=Dr(e);Ve.on("LifecycleEvent.onReady",r=>{t(r)})}});Pr.registerCommand("LifecycleSDK.onReady",Fa);Pr.registerCommand("LifecycleSDK.onJoliboxShow",La);Pr.registerCommand("LifecycleSDK.onJoliboxHide",Na);Q("lifeCycle.onReady",{version:"1.0.0"});Q("lifeCycle.onJoliboxShow",{version:"1.0.0"});Q("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ke();H();He();re();var ao=ln(io());var At=ae(),Lr=class{constructor(){this.httpClient=he.create({baseUrl:A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"});this.getGameId=()=>A.mpId;this.getItem=t=>F(this,null,function*(){let{code:r,data:n,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),c=n==null?void 0:n.value,f=a;return r!=="SUCCESS"&&(c=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",c),f+="fallback to localstorage"),{code:r,message:f,data:c&&c!=="undefined"?c:null}});this.setItem=(t,r)=>F(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:a,message:c}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:a,message:c}});this.removeItem=t=>F(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>F(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=ao.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},kt=new Lr,Ua=se("getLocalStorage",{paramsSchema:k.tuple(k.string()),implement(e){return F(this,null,function*(){return yield kt.getItem(e)})}});At.registerCommand("StorageSDK.getItem",Ua);Q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ba=se("setStorage",{paramsSchema:k.tuple(k.string(),k.or(k.string(),k.boolean(),k.number())),implement(e,t){return F(this,null,function*(){return yield kt.setItem(e,t)})}});At.registerCommand("StorageSDK.setItem",Ba);Q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ma=se("removeStorage",{paramsSchema:k.tuple(k.string()),implement(e){return F(this,null,function*(){return yield kt.removeItem(e)})}});At.registerCommand("StorageSDK.removeItem",Ma);Q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var ja=se("clearStorage",{implement(){return F(this,null,function*(){return yield kt.clear()})}});At.registerCommand("StorageSDK.clear",ja);Q("storage.clear",{version:"1.0.0"});var il=ln(so());var xt=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};H();ur();var Ct=class{constructor(t,r,n,a){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let a=this.checkShouldBanHighFreq(t);if(a)return a;let c=this.checkShouldBanForTime(t);return c?{reason:c}:{reason:"ALLOWED"}};var g,I,P,D,x,C,V;let c=(g=a==null?void 0:a.maxAllowedAdsForTime)!=null?g:8,f=(I=a==null?void 0:a.banForTimeThreshold)!=null?I:6e4,m=(P=a==null?void 0:a.bannedReleaseTime)!=null?P:6e4,p=(D=a==null?void 0:a.maxAllowedAdsForSession)!=null?D:200,E=(x=a==null?void 0:a.banForSessionThreshold)!=null?x:6e5,y=(C=a==null?void 0:a.initialThreshold)!=null?C:2e3,S=(V=a==null?void 0:a.highFreqThreshold)!=null?V:2e3;this.checkShouldBanInitial=za(y),this.checkShouldBanHighFreq=Ya(S),this.checkShouldBanForTime=Wa(c,f,m),this.checkShouldBanForSession=qa(p,E)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},qa=(e,t)=>{let r=!1,n=[];return c=>{if(r)return"BANNED_FOR_SESSION";let f=Date.now();if(n=n.concat({timestamp:f,type:c}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&f-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Wa=(e,t,r)=>{let n=null,a=y=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{p.value=!1,n=null},y)},c="jolibox-sdk-ads-callbreak-timestamps",f="jolibox-sdk-ads-ban-for-time",m={_records:[],init(){var y;try{let S=JSON.parse((y=window.__joliboxLocalStorage__.getItem(c))!=null?y:"[]");Array.isArray(S)?this._records=S:this._records=[]}catch(S){this._records=[]}},get values(){return this._records},set values(y){try{window.__joliboxLocalStorage__.setItem(c,JSON.stringify(y))}catch(S){}this._records=y}},p={_record:!1,init(){var y;try{let S=JSON.parse((y=window.__joliboxLocalStorage__.getItem(f))!=null?y:"false");typeof S=="boolean"&&(this._record=S)}catch(S){this._record=!1}if(this._record){let S=m.values[m.values.length-1],g=S?Date.now()-S.timestamp:r;g<=r&&g>0?a(g):this._record=!1}},get value(){return this._record},set value(y){try{window.__joliboxLocalStorage__.setItem(f,JSON.stringify(y))}catch(S){}this._record=y}};return m.init(),p.init(),y=>{if(p.value)return"WAITING_BANNED_RELEASE";let S=Date.now();if(m.values=m.values.concat({timestamp:S,type:y}),m.values.length!==1&&(m.values.length>e&&(m.values=m.values.slice(-e)),m.values.length===e&&S-m.values[0].timestamp<=t))return p.value=!0,a(r),"BANNED_FOR_TIME"}},za=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Ya=(e=2e3)=>{let t=0,r=null;return a=>{if(a==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}};re();re();var Pt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return F(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let a=(r=A.channel)!=null?r:"",c=this.configs[a],f=(n=c==null?void 0:c.interstitialRate)!=null?n:1;t=Math.random()<f}return this.firstRun=!1,t}};H();var Ce=new be,Dt=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>A.mpId;this.getTestAdsMode=()=>A.testAdsMode;this.asyncLoad=()=>F(this,null,function*(){var f,m,p,E,y;let t="ca-pub-7171363994453626",r,n,a=window.encodeURIComponent(window.btoa((f=this.getGameId())!=null?f:"")),c=(m=this.getTestAdsMode())!=null?m:!1;try{let S=yield this.httpClient.get("/public/ads",{query:{objectId:a,testAdsMode:`${c}`}});t=(p=S.data)==null?void 0:p.clientId,r=(E=S.data)==null?void 0:E.channelId,n=(y=S.data)==null?void 0:y.unitId}catch(S){console.error("Failed to fetch client info",S)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>F(this,null,function*(){var a;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(a=this.getTestAdsMode())!=null?a:!1;if(!document.getElementById(r)&&this.clientId){let c=document.createElement("script");c.id=r,c.async=!0,c.crossOrigin="anonymous",c.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&c.setAttribute("data-adbreak-test","on"),this.channelId&&c.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(c),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{let r=!1,n=t.adBreakDone,a=f=>{var m;r=!0,this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:f.breakType,breakName:(m=f.breakName)!=null?m:"",breakFormat:f.breakFormat,breakStatus:f.breakStatus}),n&&n(f)};if(t.adBreakDone=a,t.type==="reward"){let f=t.beforeReward,m=E=>()=>{this.track("CallShowAdFn",null),E()},p=E=>{r=!0,f&&f(m(E))};t.beforeReward=p,window.setTimeout(()=>{var E,y;r||(this.track("CallAdBreakTimeout",{type:t.type}),(y=t.adBreakDone)==null||y.call(t,{breakType:t.type,breakName:(E=t.name)!=null?E:"",breakFormat:"reward",breakStatus:"timeout"}))},5e3)}if((f=>f.type==="preroll")(t)){Ce.emit("isAdShowing",!0);let f=t.adBreakDone,m=p=>{Ce.emit("isAdShowing",!1),f&&f(p)};return Y($({},t),{adBreakDone:m})}else{let f=t.beforeAd,m=t.afterAd,p=()=>{var y;r=!0,Ce.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(y=t.name)!=null?y:""}),f&&f()},E=()=>{var y;r=!0,Ce.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(y=t.name)!=null?y:""}),m&&m()};return Y($({},t),{beforeAd:p,afterAd:E})}};this.adConfig=t=>{let a=t,{onReady:r}=a,n=cn(a,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var m,p,E,y,S,g;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(E=t.adBreakDone)==null||E.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(S=t.adBreakDone)==null||S.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((y=n==null?void 0:n.count)!=null?y:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let a=t.type,c;switch(a){case"preroll":c={type:a};break;case"start":case"pause":case"next":case"browse":case"reward":c={type:a,name:(g=t.name)!=null?g:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",c);let f=this.wrapAdBreakParams(t);this.push(f),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>F(this,null,function*(){var g,I,P,D;if(this.track("CallAdUnit",{adFormat:(I=(g=t.adFormat)==null?void 0:g.toString())!=null?I:null,fullWidthResponsive:(P=t.fullWidthResponsive)!=null?P:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:a,fullWidthResponsive:c,style:f}=t,m;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?m=document.querySelector(r):m=r,!m)throw new Error("targeting element not found");let p=n;if(p||(p=this.unitId),!p)throw new Error("slot is required");let E=typeof a=="object"&&Array.isArray(a)?a.join(", "):a,y=document.createElement("ins");if(y.className="adsbygoogle",y.id="jolibox-ads",y.style.display="block",y.setAttribute("data-ad-client",this.clientId),y.setAttribute("data-ad-slot",p),E&&y.setAttribute("data-ad-format",E),c&&y.setAttribute("data-full-width-responsive",c),f&&y.setAttribute("style",f),(D=this.getTestAdsMode())!=null?D:!1){let x=document.createElement("div");x.style.position="absolute",x.style.top="0",x.style.left="0",x.style.width="100%",x.style.height="100%",x.style.display="flex",x.style.justifyContent="center",x.style.alignItems="center",x.style.backgroundColor="rgba(0, 0, 0, 0.5)",x.style.color="white",x.innerHTML="Test Ad",y.style.position="relative",m.appendChild(y),y.appendChild(x)}else m.appendChild(y),new MutationObserver(C=>{C.forEach(V=>{if(V.type==="attributes"&&V.attributeName==="data-ad-status"){let U=y.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:U!=null?U:"null"})}})}).observe(y,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Ct(t,r,n),this.adsActionDetection=new xt(this.track),this.channelPolicy=new Pt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}};we();H();He();var co=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};var Ot=ae(),Qa=he.create(),Lt=new Dt(de,Qa,()=>he.getNetworkStatus());Ce.on("isAdShowing",e=>{co("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Ot.registerCommand("AdsSDK.init",e=>{Lt.init(e)});Ot.registerCommand("AdsSDK.adConfig",e=>{Lt.adConfig(e)});Ot.registerCommand("AdsSDK.adBreak",e=>{Lt.adBreak(e)});Ot.registerCommand("AdsSDK.adUnit",e=>{Lt.adUnit(e)});H();we();var ho=-1,Ft=function(e){addEventListener("pageshow",function(t){t.persisted&&(ho=t.timeStamp,e(t))},!0)},Fr=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Ut=function(){var e=Fr();return e&&e.activationStart||0},De=function(e,t){var r=Fr(),n="navigate";return ho>=0?n="back-forward-cache":r&&(document.prerendering||Ut()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},go=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(a){Promise.resolve().then(function(){t(a.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(a){}},Oe=function(e,t,r,n){var a,c;return function(f){t.value>=0&&(f||n)&&((c=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=c,t.rating=function(m,p){return m>p[1]?"poor":m>p[0]?"needs-improvement":"good"}(t.value,r),e(t))}},vo=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},yo=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},bo=function(e){var t=!1;return function(){t||(e(),t=!0)}},Pe=-1,uo=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Nt=function(e){document.visibilityState==="hidden"&&Pe>-1&&(Pe=e.type==="visibilitychange"?e.timeStamp:0,Xa())},lo=function(){addEventListener("visibilitychange",Nt,!0),addEventListener("prerenderingchange",Nt,!0)},Xa=function(){removeEventListener("visibilitychange",Nt,!0),removeEventListener("prerenderingchange",Nt,!0)},_o=function(){return Pe<0&&(Pe=uo(),lo(),Ft(function(){setTimeout(function(){Pe=uo(),lo()},0)})),{get firstHiddenTime(){return Pe}}},Ur=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},fo=[1800,3e3],Eo=function(e,t){t=t||{},Ur(function(){var r,n=_o(),a=De("FCP"),c=go("paint",function(f){f.forEach(function(m){m.name==="first-contentful-paint"&&(c.disconnect(),m.startTime<n.firstHiddenTime&&(a.value=Math.max(m.startTime-Ut(),0),a.entries.push(m),r(!0)))})});c&&(r=Oe(e,a,fo,t.reportAllChanges),Ft(function(f){a=De("FCP"),r=Oe(e,a,fo,t.reportAllChanges),vo(function(){a.value=performance.now()-f.timeStamp,r(!0)})}))})};var Za=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=bo(e),document.visibilityState==="hidden"?e():(r=t(e),yo(e)),r};var mo=[2500,4e3],Nr={},wo=function(e,t){t=t||{},Ur(function(){var r,n=_o(),a=De("LCP"),c=function(p){t.reportAllChanges||(p=p.slice(-1)),p.forEach(function(E){E.startTime<n.firstHiddenTime&&(a.value=Math.max(E.startTime-Ut(),0),a.entries=[E],r())})},f=go("largest-contentful-paint",c);if(f){r=Oe(e,a,mo,t.reportAllChanges);var m=bo(function(){Nr[a.id]||(c(f.takeRecords()),f.disconnect(),Nr[a.id]=!0,r(!0))});["keydown","click"].forEach(function(p){addEventListener(p,function(){return Za(m)},{once:!0,capture:!0})}),yo(m),Ft(function(p){a=De("LCP"),r=Oe(e,a,mo,t.reportAllChanges),vo(function(){a.value=performance.now()-p.timeStamp,Nr[a.id]=!0,r(!0)})})}})},po=[800,1800],es=function e(t){document.prerendering?Ur(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},Io=function(e,t){t=t||{};var r=De("TTFB"),n=Oe(e,r,po,t.reportAllChanges);es(function(){var a=Fr();a&&(r.value=Math.max(a.responseStart-Ut(),0),r.entries=[a],n(!0),Ft(function(){r=De("TTFB",0),(n=Oe(e,r,po,t.reportAllChanges))(!0)}))})};re();function ts(){Eo(e=>{de("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),wo(e=>{de("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Io(e=>{de("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function rs(){Ve.on("onDocumentReady",e=>{Ve.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function To(){rs(),ts()}To();
|
|
4
4
|
/*! Bundled license information:
|
|
5
5
|
|
|
6
6
|
localforage/dist/localforage.js:
|