@jolibox/implement 1.1.18 → 1.1.19-beta.1

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.
@@ -4,7 +4,7 @@
4
4
  "packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
5
5
  "packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
6
6
  "packages/implement/esbuild.config.js": "876db4e384d8543b66a0b61d8f7b277a36dfb4e0",
7
- "packages/implement/package.json": "4b24b389dc35dcdcc5081564555d071b5c5bf3bc",
7
+ "packages/implement/package.json": "b2801b75b29d6cc57c23e424fd5420f976ffa7e5",
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
10
  "packages/implement/src/common/ads/anti-cheating.ts": "a3ffb6a78e289e1c0ce45c7f7c0cee000e75e541",
@@ -80,11 +80,11 @@
80
80
  "packages/implement/src/native/api/keyboard.ts": "cb65da6e8cbfb7ef4a21582acd74f450a0e3c894",
81
81
  "packages/implement/src/native/api/lifecycle.ts": "857beae3012fcb89396ac8e485c9d9b3df737db2",
82
82
  "packages/implement/src/native/api/login.ts": "b820416100228e12df434238685a02e4b07a24c1",
83
- "packages/implement/src/native/api/navigate.ts": "ff8b39101a714bed4d5cc287edb384b76b5b6045",
83
+ "packages/implement/src/native/api/navigate.ts": "02959c68d944fdd1478cdca29e8f50dcc70ef6a0",
84
84
  "packages/implement/src/native/api/request.ts": "d2b5fb71eff0dfda5f24ca7ddf11fa4704c35eee",
85
85
  "packages/implement/src/native/api/storage.ts": "4e5886d5cdb4db50ab7fcdc24392569f749f4c93",
86
86
  "packages/implement/src/native/api/task.ts": "26e06a3d6bbeaed34fd704d096e712448296607e",
87
- "packages/implement/src/native/bootstrap/index.ts": "c356b952a8c0d32aeaaa51edbd3f936f8bd2dea6",
87
+ "packages/implement/src/native/bootstrap/index.ts": "1579d52aa8b0e020ee5e2e3cd2b104e22530a4b2",
88
88
  "packages/implement/src/native/bootstrap/init-env.ts": "b7514d5d2db60da990575c1426243777aee57748",
89
89
  "packages/implement/src/native/network/create-fetch.ts": "74cd6f0a58a718764c4d1a15f331b2354bd1ba6e",
90
90
  "packages/implement/src/native/network/index.ts": "be552ee13a2dbc253c0c3e46b28e01ccbeee6723",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Li=Object.create;var Qt=Object.defineProperty,Ni=Object.defineProperties,Ui=Object.getOwnPropertyDescriptor,Fi=Object.getOwnPropertyDescriptors,Bi=Object.getOwnPropertyNames,Xe=Object.getOwnPropertySymbols,Mi=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,V=(e,t)=>{for(var r in t||(t={}))Xt.call(t,r)&&dn(e,r,t[r]);if(Xe)for(var r of Xe(t))fn.call(t,r)&&dn(e,r,t[r]);return e},z=(e,t)=>Ni(e,Fi(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&&Xe)for(var n of Xe(e))t.indexOf(n)<0&&fn.call(e,n)&&(r[n]=e[n]);return r};var J=(e,t)=>()=>(e&&(t=e(e=0)),t);var pn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ji=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Bi(t))!Xt.call(e,i)&&i!==r&&Qt(e,i,{get:()=>t[i],enumerable:!(n=Ui(t,i))||n.enumerable});return e};var hn=(e,t,r)=>(r=e!=null?Li(Mi(e)):{},ji(t||!e||!e.__esModule?Qt(r,"default",{value:e,enumerable:!0}):r,e));var D=(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 zi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function ar(e){return typeof e=="string"}function En(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function In(e){return typeof e=="object"&&Array.isArray(e)}function Yi(e){return typeof e=="undefined"}function Qi(e){return Yi(e)||e===null}function Xi(e){return typeof e=="function"}function Tn(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Sn(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(_n({},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 Rn(e,t){if(Array.isArray(e))return e.concat(t)}function He(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(...T){i=T,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 ta(e,t){return(...r)=>t(e,...r)}function Pn(e){return t=>ta(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new ea(`${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 aa(e){let t=e.location?et(e.location,bn):null,r=e.target?et(e.target,bn):null;return et(Gi(_n({},e),{location:t,target:r}),oa)}function dr(e){let t=e.events.map(n=>aa(n)),r=et(e.device,ia);return[e.protocolVersion,t,r,e.project]}function mr(){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 va(e){return new Promise(t=>Ln(e)(t))}function Ln(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function ya(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(c.fire,c)}},c=new Ve(i);return c.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function _a(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)wa(e[n],t[n])}function wa(e,t){if(ar(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Xi(t)){try{if(e instanceof t)return}catch(r){}if(!Qi(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 Ea(){return typeof globalThis!="undefined"?globalThis[Nn]:void 0}function Ia(e){typeof globalThis!="undefined"&&(globalThis[Nn]=e)}function ie(){let e=Ea();if(e)return e;let t=new tt,r=new or,n={registerCommand(i,c,d){t.registerCommand({id:i,handler:c,metadata:d})},executeCommand(i,...c){return r.executeCommand(i,...c)},excuteCommandSync(i,...c){return r.executeCommandThowErr(i,...c)}};return Ia(n),n}var ir,$i,Vi,Hi,gn,Ji,Ki,vn,_n,Gi,qi,wn,Wi,Zi,sr,cr,An,xn,ea,kn,Cn,rt,lr,se,er,ra,ur,Je,xe,na,bn,oa,ia,fr,sa,Ze,ca,la,ua,On,pr,da,fa,ma,Dn,tr,K,pa,ha,$e,Ve,de,nr,ga,Zt,ba,Ke,tt,or,Nn,j=J(()=>{"use strict";ir=Object.defineProperty,$i=Object.defineProperties,Vi=Object.getOwnPropertyDescriptor,Hi=Object.getOwnPropertyDescriptors,gn=Object.getOwnPropertySymbols,Ji=Object.prototype.hasOwnProperty,Ki=Object.prototype.propertyIsEnumerable,vn=(e,t,r)=>t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_n=(e,t)=>{for(var r in t||(t={}))Ji.call(t,r)&&vn(e,r,t[r]);if(gn)for(var r of gn(t))Ki.call(t,r)&&vn(e,r,t[r]);return e},Gi=(e,t)=>$i(e,Hi(t)),qi=(e,t)=>{for(var r in t)ir(e,r,{get:t[r],enumerable:!0})},wn=(e,t,r,n)=>{for(var i=n>1?void 0:n?Vi(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},Wi=(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}Zi=(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))(Zi||{}),sr=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}},cr=class extends sr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},An=class extends sr{constructor(){super(...arguments),this.kind="USER_ERROR"}},xn=class extends An{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},ea=class extends An{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))}},kn=class extends cr{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Cn=class extends cr{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},rt=class extends sr{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 cr{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};se={log:je("log"),warn:je("warn"),info:je("info"),error:je("error"),debug:je("debug")};Object.assign(globalThis,{logger:se});er=Symbol.for("Jolibox.canIUseMap"),ra={};globalThis[er]||(globalThis[er]=ra);ur={get config(){return globalThis[er]}},Je=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Je||{}),xe=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(xe||{}),na=(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))(na||{}),bn=["name","params"],oa=["name","type","location","target","extra","timestamp","userId"],ia=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];fr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});mr();sa=()=>!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Ze={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")},ca=()=>Ze.isiOS?"iOS":Ze.isAndroid?"Android":Ze.isMac?"Mac":Ze.isFacebook?"Facebook":"PC",la="device_id",ua="advertising_id",On=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,fr()),window.__joliboxLocalStorage__.getItem(e)),pr=()=>new URLSearchParams(window.location.search).get("deviceId")||On(la),da=()=>On(ua),fa=e=>e.charAt(0).toUpperCase()+e.slice(1),ma=()=>{var e;let t=new URLSearchParams(window.location.search);return fa((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Dn=e=>{if(sa())return window.navigator.userAgent;let t="JoliboxWebSDK",r=ca(),n=navigator.language,i=pr(),c=da();return`${t} (${ma()}${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);K=tr,pa=class{constructor(){this._first=K.Undefined,this._last=K.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===K.Undefined}clear(){let e=this._first;for(;e!==K.Undefined;){let t=e.next;e.prev=K.Undefined,e.next=K.Undefined,e=t}this._first=K.Undefined,this._last=K.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new K(e);if(this._first===K.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!==K.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==K.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==K.Undefined&&e.next!==K.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===K.Undefined&&e.next===K.Undefined?(this._first=K.Undefined,this._last=K.Undefined):e.next===K.Undefined?(this._last=this._last.prev,this._last.next=K.Undefined):e.prev===K.Undefined&&(this._first=this._first.next,this._first.prev=K.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==K.Undefined;)yield e.element,e=e.next}},ha=0,$e=class{constructor(e){this.value=e,this.id=ha++}},Ve=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 $e&&(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 $e(t);return this._listeners?this._listeners instanceof $e?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++,()=>{var v,T,g,E;if(!this._disposed){if(this._listeners instanceof $e)this._listeners.id===b.id&&(this._listeners=void 0,this._size=0,(T=(v=this.options)==null?void 0:v.onDidRemoveLastListener)==null||T.call(v));else if(this._listeners){let P=this._listeners.indexOf(b);P>=0&&(this._listeners.splice(P,1),this._size--,this._size===0&&((E=(g=this.options)==null?void 0:g.onDidRemoveLastListener)==null||E.call(g)))}}}}),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 $e?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 Ve,i=m=>t(...m.args),c=n.event(i);this.listerHandlerMap.set(t,{handler:i,dispose:c}),this.listeners.set(e,n);let d=this.cachedEventQueue.get(e);if(d)for(let m of d)t(...m.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new pa,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}},nr={};qi(nr,{None:()=>ga,filter:()=>ya,once:()=>Ln,toPromise:()=>va});ga=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Zt=Symbol.for("Jolibox.hostEmitter"),ba=()=>{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]},Ke=ba();tt=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ve,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 _a(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=wn([Tn],tt);or=class{constructor(){this._onWillExecuteCommand=new Ve,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ve,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new tt,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=zi(3e4)),this._starActivation}executeCommand(e,...t){return Wi(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=wn([Tn],or);Nn=Symbol.for("Jolibox.commands")});function ce(e,t={}){hr.emit("ERROR_REPORT",{error:e,options:t})}var hr,we,_e=J(()=>{"use strict";j();j();hr=new de,we=new de;ce.debounce=He(ce,50,{leading:!0})});var gr,Ta,Un,Fn,Bn=J(()=>{"use strict";j();_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{}}},Ta=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Un=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 ce(new kn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Fn=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=Ta(e),c=r[2];return`${n}.${i}.${c}`}return t}});var Sa,nt,Mn,vr=J(()=>{"use strict";j();Sa="1.1.18",nt=()=>Sa,Mn=()=>{let e=nt();return`${Dn(e)}`}});var Ra,jn,yr,$n,X,Aa,A,Z=J(()=>{"use strict";j();Bn();vr();j();Ra={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=(jn=globalThis.joliboxJSCore)==null?void 0:jn.env,X=Object.assign({},($n=yr==null?void 0:yr())!=null?$n:Ra),Aa=()=>{var g,E,P,N,O,L,H,F,ee,ue,S;let{payloadJson:e,headerJson:t,signature:r}=X.schema.length?Un(X.schema):{},n=`${X.deviceInfo.did}-${new Date().getTime()}`,c=new URL(X.schema.length?X.schema:window.location.href).searchParams,d=(P=(E=(g=c.get("mpId"))!=null?g:c.get("appId"))!=null?E:c.get("gameId"))!=null?P:"",m=(L=(O=(N=X.clientSessionId)!=null?N:e==null?void 0:e.sessionId)!=null?O:c.get("sessionId"))!=null?L:n,p=!!((F=(H=e==null?void 0:e.testAdsMode)!=null?H:e==null?void 0:e.__testAdsMode)!=null?F:c.get("testAdsMode")==="true"),b=(S=(ue=(ee=e==null?void 0:e.joliboxEnv)!=null?ee:e==null?void 0:e.__joliboxEnv)!=null?ue:c.get("joliboxEnv"))!=null?S:"production",v=b==="staging",T=t==null?void 0:t.channel;return{get testMode(){return v},get testAdsMode(){return p},get joliboxEnv(){return b},get joliSource(){var x;return(x=c.get("joliSource"))!=null?x:null},get mpId(){var x;return(x=d!=null?d:e==null?void 0:e.id)!=null?x:""},get mpVersion(){var x;return(x=t==null?void 0:t.ver)!=null?x:nt()},get mpType(){var x,C;return(C=(x=t==null?void 0:t.__mpType)!=null?x:e==null?void 0:e.__mpType)!=null?C:"game"},get platform(){var x;return((x=X.platform)!=null?x:X.deviceInfo.platform).toLowerCase()},get deviceInfo(){return X.deviceInfo},get sdkInfo(){return X.sdkInfo},get hostInfo(){return X.hostInfo},get hostUserInfo(){return X.hostUserInfo},get sessionId(){var x,C;return(C=(x=X.clientSessionId)!=null?x:m)!=null?C:n},get channel(){return T},get webviewId(){var x;return(x=X.webviewId)!=null?x:-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:x=>{Sn(X,x,Rn)},encodeJoliSourceQuery:x=>{var C,B;return t&&r?Fn(V(V({},e),x),(C=c.get("joliSource"))!=null?C:""):(B=c.get("joliSource"))!=null?B:""}}},A=Aa()});var br,Hn,xa,ka,Vn,Ca,Jn=J(()=>{"use strict";j();_e();Z();j();br=!1,Hn=(e,t)=>e==null?!1:t in e,xa=e=>Hn(e,"kind"),ka=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Vn=(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:ka(e.name)},i=z(V({},n),{env:t.environment,isFromUser:r});r?we.emit("GLOBAL_USER_ERROR",e,i):we.emit("GLOBAL_ERROR",e,i)},Ca=e=>Hn(e,"kind")&&e.kind==="USER_ERROR";hr.on("ERROR_REPORT",({error:e,options:t})=>{if(br)return;br=!0;let r=xa(e)&&e.raw?e.raw:e;try{let n=Ca(e);Vn(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),c=new lr(`${i}, origin error: ${r.message}`);se.error(c),Vn(new lr(c.message),{environment:t.environment},!1)}finally{br=!1}})});var _r,wr=J(()=>{"use strict";_e();j();_e();_r=e=>new xn(e)});function Kn(e,t){let r=(n,i,c)=>{let d=z(V({tag:n},t),{extra:V({},i)});n=="globalJsError"?ce(new Cn(JSON.stringify(d))):e("systemLog",d,c)};return r.debounce=He(r,500,{leading:!0}),r}function Gn(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=He(t,500,{leading:!0}),t}var qn=J(()=>{"use strict";j();j();_e()});function Wn(e,t){let r=Kn(e,t),n=Gn(r);return{track:r,trackPerformance:n}}var zn=J(()=>{"use strict";qn()});var Er=J(()=>{"use strict"});var ot,Yn=J(()=>{"use strict";Z();j();j();ot=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return D(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 D(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(V({},t),{location:i,target:c,extra:d,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(dr(b),n):yield this.doReport(dr(b))}catch(v){se.log("[Jolibox SDK] report API error",v)}})}}});var Ir=J(()=>{"use strict";zn();Er();Yn()});var Tr,Qn,he,it,ge,Ge=J(()=>{"use strict";vr();Z();Tr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Qn=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=Mn();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 D(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 T=yield fetch(p,{method:"GET",headers:c,credentials:"include",signal:Tr(i!=null?i:3e4)});return he.getInstance().recordNetworkRequest(!0),yield T.json()}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return D(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,T=this.getJoliSource();d=Object.assign({},d!=null?d:{},{"Content-Type":"application/json"},v?{"x-user-agent":v}:{},T?{"x-joli-source":T}:{});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 E=g.headers.get("content-type");if(E!=null&&E.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(E!=null&&E.includes("multipart/form-data")||E!=null&&E.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(E!=null&&E.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return D(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,T=this.getJoliSource();d=Object.assign({},d!=null?d:{},{"Content-Type":"application/json"},v?{"x-user-agent":v}:{},T?{"x-joli-source":T}:{});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=J(()=>{"use strict";Z();Ir();Ge();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 Pa,Xn=J(()=>{"use strict";Jn();j();wr();j();Rr();Z();Pa=(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:Je.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)=>{Pa(t.tag,e)});we.on("GLOBAL_USER_ERROR",(e,t)=>{se.log("UserError",e,t)})});var st,Zn=J(()=>{"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 E=Date.now(),P=E-r;P>=this.interval&&(this.visible&&(d+=P,t(d)),r=E),n=requestAnimationFrame(m)},p=()=>{v(),r=Date.now(),i=window.setInterval(()=>{if(!c)return;let E=Date.now();E-r>=this.interval&&(r=E)},this.interval)},b=()=>{T(),r=Date.now(),n=requestAnimationFrame(m)},v=()=>{n&&(cancelAnimationFrame(n),n=0)},T=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",E=>{c&&(console.log("visible",E),E?b():p())});let g=this.visible;return{start(){c||(c=!0,g?b():p())},stop(){c=!1,v(),T()}}}}});var ct,eo=J(()=>{"use strict";Z();Zn();Ge();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 D(this,null,function*(){let{event:n,params:i}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:V({gameId:this.gameId,sessionId:this.sessionId},i)}})})}tracker(r,n=null){this.track(r,n)}}});var to,Oa,fe,Da,Ar,le,Ee=J(()=>{"use strict";Xn();j();j();Ir();Rr();eo();Z();Er();to=ie(),Oa={type:xe.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:fe,trackPerformance:Da}=Wn((...e)=>{var d,m,p,b;let[,t]=e,r=t,n=En(r.extra)?r.extra:ar(r.extra)?JSON.parse(r.extra):{},i=z(V({},n),{mp_id:(d=r.mp_id)!=null?d:"",mp_version:(m=r.mp_version)!=null?m:""}),c={name:t.tag,type:Je.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)},Oa);to.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Da(e,t,r)});to.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{fe(e,t)});Ar=new de,le=new ct(fe,Ar)});function ro(e){let t=ur.config[e];return t||(t={},ur.config[e]=t),(r,n)=>{if(t[r]){se.warn(`[can i use] ${r} already registered`);return}t[r]=V({},n)}}var no=J(()=>{"use strict";j()});function xr(e){oo=e}function lt(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>lt(t)):Object.keys(e).reduce((t,r)=>(t[r]=lt(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 oo,W,ut,dt,ft,mt,ke,pt,ht,gt,vt,yt,bt,_t,wt,Et,It,Tt,St,Pr=J(()=>{"use strict";oo=!1;W=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(oo)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 lt(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:lt(this._default)}optional(){return this._optional=!0,this}};ut=class extends W{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 W{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},ft=class extends W{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 W{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends W{validate(t){return!0}},pt=class extends W{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ht=class extends W{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},gt=class extends W{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},vt=class extends W{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 W{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 W{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 W{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 W{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 W{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(`
1
+ var Li=Object.create;var Qt=Object.defineProperty,Ni=Object.defineProperties,Ui=Object.getOwnPropertyDescriptor,Fi=Object.getOwnPropertyDescriptors,Bi=Object.getOwnPropertyNames,Xe=Object.getOwnPropertySymbols,Mi=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,V=(e,t)=>{for(var r in t||(t={}))Xt.call(t,r)&&dn(e,r,t[r]);if(Xe)for(var r of Xe(t))fn.call(t,r)&&dn(e,r,t[r]);return e},z=(e,t)=>Ni(e,Fi(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&&Xe)for(var n of Xe(e))t.indexOf(n)<0&&fn.call(e,n)&&(r[n]=e[n]);return r};var J=(e,t)=>()=>(e&&(t=e(e=0)),t);var pn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ji=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Bi(t))!Xt.call(e,i)&&i!==r&&Qt(e,i,{get:()=>t[i],enumerable:!(n=Ui(t,i))||n.enumerable});return e};var hn=(e,t,r)=>(r=e!=null?Li(Mi(e)):{},ji(t||!e||!e.__esModule?Qt(r,"default",{value:e,enumerable:!0}):r,e));var D=(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 zi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function ar(e){return typeof e=="string"}function En(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function In(e){return typeof e=="object"&&Array.isArray(e)}function Yi(e){return typeof e=="undefined"}function Qi(e){return Yi(e)||e===null}function Xi(e){return typeof e=="function"}function Tn(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Sn(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(_n({},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 Rn(e,t){if(Array.isArray(e))return e.concat(t)}function He(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(...T){i=T,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 ta(e,t){return(...r)=>t(e,...r)}function Pn(e){return t=>ta(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new ea(`${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 aa(e){let t=e.location?et(e.location,bn):null,r=e.target?et(e.target,bn):null;return et(Gi(_n({},e),{location:t,target:r}),oa)}function dr(e){let t=e.events.map(n=>aa(n)),r=et(e.device,ia);return[e.protocolVersion,t,r,e.project]}function mr(){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 va(e){return new Promise(t=>Ln(e)(t))}function Ln(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function ya(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(c.fire,c)}},c=new Ve(i);return c.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function _a(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)wa(e[n],t[n])}function wa(e,t){if(ar(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Xi(t)){try{if(e instanceof t)return}catch(r){}if(!Qi(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 Ea(){return typeof globalThis!="undefined"?globalThis[Nn]:void 0}function Ia(e){typeof globalThis!="undefined"&&(globalThis[Nn]=e)}function ie(){let e=Ea();if(e)return e;let t=new tt,r=new or,n={registerCommand(i,c,d){t.registerCommand({id:i,handler:c,metadata:d})},executeCommand(i,...c){return r.executeCommand(i,...c)},excuteCommandSync(i,...c){return r.executeCommandThowErr(i,...c)}};return Ia(n),n}var ir,$i,Vi,Hi,gn,Ji,Ki,vn,_n,Gi,qi,wn,Wi,Zi,sr,cr,An,xn,ea,kn,Cn,rt,lr,se,er,ra,ur,Je,xe,na,bn,oa,ia,fr,sa,Ze,ca,la,ua,On,pr,da,fa,ma,Dn,tr,K,pa,ha,$e,Ve,de,nr,ga,Zt,ba,Ke,tt,or,Nn,j=J(()=>{"use strict";ir=Object.defineProperty,$i=Object.defineProperties,Vi=Object.getOwnPropertyDescriptor,Hi=Object.getOwnPropertyDescriptors,gn=Object.getOwnPropertySymbols,Ji=Object.prototype.hasOwnProperty,Ki=Object.prototype.propertyIsEnumerable,vn=(e,t,r)=>t in e?ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_n=(e,t)=>{for(var r in t||(t={}))Ji.call(t,r)&&vn(e,r,t[r]);if(gn)for(var r of gn(t))Ki.call(t,r)&&vn(e,r,t[r]);return e},Gi=(e,t)=>$i(e,Hi(t)),qi=(e,t)=>{for(var r in t)ir(e,r,{get:t[r],enumerable:!0})},wn=(e,t,r,n)=>{for(var i=n>1?void 0:n?Vi(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},Wi=(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}Zi=(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))(Zi||{}),sr=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}},cr=class extends sr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},An=class extends sr{constructor(){super(...arguments),this.kind="USER_ERROR"}},xn=class extends An{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},ea=class extends An{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))}},kn=class extends cr{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Cn=class extends cr{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},rt=class extends sr{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 cr{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};se={log:je("log"),warn:je("warn"),info:je("info"),error:je("error"),debug:je("debug")};Object.assign(globalThis,{logger:se});er=Symbol.for("Jolibox.canIUseMap"),ra={};globalThis[er]||(globalThis[er]=ra);ur={get config(){return globalThis[er]}},Je=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Je||{}),xe=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(xe||{}),na=(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))(na||{}),bn=["name","params"],oa=["name","type","location","target","extra","timestamp","userId"],ia=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];fr=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});mr();sa=()=>!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Ze={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")},ca=()=>Ze.isiOS?"iOS":Ze.isAndroid?"Android":Ze.isMac?"Mac":Ze.isFacebook?"Facebook":"PC",la="device_id",ua="advertising_id",On=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,fr()),window.__joliboxLocalStorage__.getItem(e)),pr=()=>new URLSearchParams(window.location.search).get("deviceId")||On(la),da=()=>On(ua),fa=e=>e.charAt(0).toUpperCase()+e.slice(1),ma=()=>{var e;let t=new URLSearchParams(window.location.search);return fa((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Dn=e=>{if(sa())return window.navigator.userAgent;let t="JoliboxWebSDK",r=ca(),n=navigator.language,i=pr(),c=da();return`${t} (${ma()}${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);K=tr,pa=class{constructor(){this._first=K.Undefined,this._last=K.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===K.Undefined}clear(){let e=this._first;for(;e!==K.Undefined;){let t=e.next;e.prev=K.Undefined,e.next=K.Undefined,e=t}this._first=K.Undefined,this._last=K.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new K(e);if(this._first===K.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!==K.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==K.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==K.Undefined&&e.next!==K.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===K.Undefined&&e.next===K.Undefined?(this._first=K.Undefined,this._last=K.Undefined):e.next===K.Undefined?(this._last=this._last.prev,this._last.next=K.Undefined):e.prev===K.Undefined&&(this._first=this._first.next,this._first.prev=K.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==K.Undefined;)yield e.element,e=e.next}},ha=0,$e=class{constructor(e){this.value=e,this.id=ha++}},Ve=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 $e&&(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 $e(t);return this._listeners?this._listeners instanceof $e?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++,()=>{var v,T,g,E;if(!this._disposed){if(this._listeners instanceof $e)this._listeners.id===b.id&&(this._listeners=void 0,this._size=0,(T=(v=this.options)==null?void 0:v.onDidRemoveLastListener)==null||T.call(v));else if(this._listeners){let P=this._listeners.indexOf(b);P>=0&&(this._listeners.splice(P,1),this._size--,this._size===0&&((E=(g=this.options)==null?void 0:g.onDidRemoveLastListener)==null||E.call(g)))}}}}),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 $e?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 Ve,i=m=>t(...m.args),c=n.event(i);this.listerHandlerMap.set(t,{handler:i,dispose:c}),this.listeners.set(e,n);let d=this.cachedEventQueue.get(e);if(d)for(let m of d)t(...m.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new pa,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}},nr={};qi(nr,{None:()=>ga,filter:()=>ya,once:()=>Ln,toPromise:()=>va});ga=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Zt=Symbol.for("Jolibox.hostEmitter"),ba=()=>{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]},Ke=ba();tt=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ve,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 _a(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=wn([Tn],tt);or=class{constructor(){this._onWillExecuteCommand=new Ve,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ve,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new tt,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=zi(3e4)),this._starActivation}executeCommand(e,...t){return Wi(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=wn([Tn],or);Nn=Symbol.for("Jolibox.commands")});function ce(e,t={}){hr.emit("ERROR_REPORT",{error:e,options:t})}var hr,we,_e=J(()=>{"use strict";j();j();hr=new de,we=new de;ce.debounce=He(ce,50,{leading:!0})});var gr,Ta,Un,Fn,Bn=J(()=>{"use strict";j();_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{}}},Ta=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Un=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 ce(new kn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Fn=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=Ta(e),c=r[2];return`${n}.${i}.${c}`}return t}});var Sa,nt,Mn,vr=J(()=>{"use strict";j();Sa="1.1.19-beta.1",nt=()=>Sa,Mn=()=>{let e=nt();return`${Dn(e)}`}});var Ra,jn,yr,$n,X,Aa,A,Z=J(()=>{"use strict";j();Bn();vr();j();Ra={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=(jn=globalThis.joliboxJSCore)==null?void 0:jn.env,X=Object.assign({},($n=yr==null?void 0:yr())!=null?$n:Ra),Aa=()=>{var g,E,P,N,O,L,H,F,ee,ue,S;let{payloadJson:e,headerJson:t,signature:r}=X.schema.length?Un(X.schema):{},n=`${X.deviceInfo.did}-${new Date().getTime()}`,c=new URL(X.schema.length?X.schema:window.location.href).searchParams,d=(P=(E=(g=c.get("mpId"))!=null?g:c.get("appId"))!=null?E:c.get("gameId"))!=null?P:"",m=(L=(O=(N=X.clientSessionId)!=null?N:e==null?void 0:e.sessionId)!=null?O:c.get("sessionId"))!=null?L:n,p=!!((F=(H=e==null?void 0:e.testAdsMode)!=null?H:e==null?void 0:e.__testAdsMode)!=null?F:c.get("testAdsMode")==="true"),b=(S=(ue=(ee=e==null?void 0:e.joliboxEnv)!=null?ee:e==null?void 0:e.__joliboxEnv)!=null?ue:c.get("joliboxEnv"))!=null?S:"production",v=b==="staging",T=t==null?void 0:t.channel;return{get testMode(){return v},get testAdsMode(){return p},get joliboxEnv(){return b},get joliSource(){var x;return(x=c.get("joliSource"))!=null?x:null},get mpId(){var x;return(x=d!=null?d:e==null?void 0:e.id)!=null?x:""},get mpVersion(){var x;return(x=t==null?void 0:t.ver)!=null?x:nt()},get mpType(){var x,C;return(C=(x=t==null?void 0:t.__mpType)!=null?x:e==null?void 0:e.__mpType)!=null?C:"game"},get platform(){var x;return((x=X.platform)!=null?x:X.deviceInfo.platform).toLowerCase()},get deviceInfo(){return X.deviceInfo},get sdkInfo(){return X.sdkInfo},get hostInfo(){return X.hostInfo},get hostUserInfo(){return X.hostUserInfo},get sessionId(){var x,C;return(C=(x=X.clientSessionId)!=null?x:m)!=null?C:n},get channel(){return T},get webviewId(){var x;return(x=X.webviewId)!=null?x:-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:x=>{Sn(X,x,Rn)},encodeJoliSourceQuery:x=>{var C,B;return t&&r?Fn(V(V({},e),x),(C=c.get("joliSource"))!=null?C:""):(B=c.get("joliSource"))!=null?B:""}}},A=Aa()});var br,Hn,xa,ka,Vn,Ca,Jn=J(()=>{"use strict";j();_e();Z();j();br=!1,Hn=(e,t)=>e==null?!1:t in e,xa=e=>Hn(e,"kind"),ka=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Vn=(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:ka(e.name)},i=z(V({},n),{env:t.environment,isFromUser:r});r?we.emit("GLOBAL_USER_ERROR",e,i):we.emit("GLOBAL_ERROR",e,i)},Ca=e=>Hn(e,"kind")&&e.kind==="USER_ERROR";hr.on("ERROR_REPORT",({error:e,options:t})=>{if(br)return;br=!0;let r=xa(e)&&e.raw?e.raw:e;try{let n=Ca(e);Vn(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),c=new lr(`${i}, origin error: ${r.message}`);se.error(c),Vn(new lr(c.message),{environment:t.environment},!1)}finally{br=!1}})});var _r,wr=J(()=>{"use strict";_e();j();_e();_r=e=>new xn(e)});function Kn(e,t){let r=(n,i,c)=>{let d=z(V({tag:n},t),{extra:V({},i)});n=="globalJsError"?ce(new Cn(JSON.stringify(d))):e("systemLog",d,c)};return r.debounce=He(r,500,{leading:!0}),r}function Gn(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=He(t,500,{leading:!0}),t}var qn=J(()=>{"use strict";j();j();_e()});function Wn(e,t){let r=Kn(e,t),n=Gn(r);return{track:r,trackPerformance:n}}var zn=J(()=>{"use strict";qn()});var Er=J(()=>{"use strict"});var ot,Yn=J(()=>{"use strict";Z();j();j();ot=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return D(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 D(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(V({},t),{location:i,target:c,extra:d,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(dr(b),n):yield this.doReport(dr(b))}catch(v){se.log("[Jolibox SDK] report API error",v)}})}}});var Ir=J(()=>{"use strict";zn();Er();Yn()});var Tr,Qn,he,it,ge,Ge=J(()=>{"use strict";vr();Z();Tr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Qn=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=Mn();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 D(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 T=yield fetch(p,{method:"GET",headers:c,credentials:"include",signal:Tr(i!=null?i:3e4)});return he.getInstance().recordNetworkRequest(!0),yield T.json()}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return D(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,T=this.getJoliSource();d=Object.assign({},d!=null?d:{},{"Content-Type":"application/json"},v?{"x-user-agent":v}:{},T?{"x-joli-source":T}:{});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 E=g.headers.get("content-type");if(E!=null&&E.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(E!=null&&E.includes("multipart/form-data")||E!=null&&E.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(E!=null&&E.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return D(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,T=this.getJoliSource();d=Object.assign({},d!=null?d:{},{"Content-Type":"application/json"},v?{"x-user-agent":v}:{},T?{"x-joli-source":T}:{});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=J(()=>{"use strict";Z();Ir();Ge();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 Pa,Xn=J(()=>{"use strict";Jn();j();wr();j();Rr();Z();Pa=(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:Je.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)=>{Pa(t.tag,e)});we.on("GLOBAL_USER_ERROR",(e,t)=>{se.log("UserError",e,t)})});var st,Zn=J(()=>{"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 E=Date.now(),P=E-r;P>=this.interval&&(this.visible&&(d+=P,t(d)),r=E),n=requestAnimationFrame(m)},p=()=>{v(),r=Date.now(),i=window.setInterval(()=>{if(!c)return;let E=Date.now();E-r>=this.interval&&(r=E)},this.interval)},b=()=>{T(),r=Date.now(),n=requestAnimationFrame(m)},v=()=>{n&&(cancelAnimationFrame(n),n=0)},T=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",E=>{c&&(console.log("visible",E),E?b():p())});let g=this.visible;return{start(){c||(c=!0,g?b():p())},stop(){c=!1,v(),T()}}}}});var ct,eo=J(()=>{"use strict";Z();Zn();Ge();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 D(this,null,function*(){let{event:n,params:i}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:V({gameId:this.gameId,sessionId:this.sessionId},i)}})})}tracker(r,n=null){this.track(r,n)}}});var to,Oa,fe,Da,Ar,le,Ee=J(()=>{"use strict";Xn();j();j();Ir();Rr();eo();Z();Er();to=ie(),Oa={type:xe.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:fe,trackPerformance:Da}=Wn((...e)=>{var d,m,p,b;let[,t]=e,r=t,n=En(r.extra)?r.extra:ar(r.extra)?JSON.parse(r.extra):{},i=z(V({},n),{mp_id:(d=r.mp_id)!=null?d:"",mp_version:(m=r.mp_version)!=null?m:""}),c={name:t.tag,type:Je.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)},Oa);to.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Da(e,t,r)});to.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{fe(e,t)});Ar=new de,le=new ct(fe,Ar)});function ro(e){let t=ur.config[e];return t||(t={},ur.config[e]=t),(r,n)=>{if(t[r]){se.warn(`[can i use] ${r} already registered`);return}t[r]=V({},n)}}var no=J(()=>{"use strict";j()});function xr(e){oo=e}function lt(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>lt(t)):Object.keys(e).reduce((t,r)=>(t[r]=lt(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 oo,W,ut,dt,ft,mt,ke,pt,ht,gt,vt,yt,bt,_t,wt,Et,It,Tt,St,Pr=J(()=>{"use strict";oo=!1;W=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(oo)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 lt(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:lt(this._default)}optional(){return this._optional=!0,this}};ut=class extends W{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 W{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},ft=class extends W{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 W{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends W{validate(t){return!0}},pt=class extends W{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ht=class extends W{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},gt=class extends W{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},vt=class extends W{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 W{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 W{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 W{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 W{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 W{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
2
  or `);this.errors.push(c)}return n}},It=class extends W{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let i=t[n];if(i._optional||i.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,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,t[i]===void 0&&n.hasDefault){t[i]=n.defaultValue;return}n.validate(t[i])||(n.hasFallback?t[i]=n._fallback:r=!1)}),r}},Tt=class extends W{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},St=class extends W{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 Or(e,t,r="param"){if(e.errors=[],e.path=r,xr(!0),!e.validate(t)){let n=e.errors.join(`
3
3
  `);throw e.errors.length=0,xr(!1),new TypeError(n)}}var k,Dr=J(()=>{"use strict";Pr();Pr();k={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 ut},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,io,ao=J(()=>{"use strict";j();_e();Dr();wr();Rt=1,io=e=>{function t(n,i){return(...c)=>{var T,g,E,P;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 N=i.implement(...c),O=N,L=`${n}:ok`;if(N&&"code"in N){let{code:H,data:F,message:ee}=N;p=H,O=F,L=ee}return{code:p,message:L,data:O}}catch(N){let O=N;v=(g=(T=O.code)!=null?T:O.errNo)!=null?g:2e3,p="FAILURE";let L=(P=(E=O.message)!=null?E:O.errMsg)!=null?P:`${N}`;return b=`${n}:${p} ${L.replace(/^\S+:(fail|cancel)\s?/,"")}`,ce(new rt(b,v)),{code:p,message:b}}finally{let N=Date.now()-d;e("apiInvoked",z(V({},m),{duration:N,status:p}))}}}function r(n,i){return(...c)=>D(this,null,function*(){var g,E,P,N;let d=In(c)?c:[c],m=Date.now(),p={method:n,trace_id:Rt};Rt+=1;let b=`${n}:ok`,v="SUCCESS",T={code:v,message:b};try{if(i.paramsSchema)try{Or(i.paramsSchema,d,"params")}catch(H){throw _r(H.message)}let L=yield i.implement(...d);if(L&&"code"in L){let{code:H,data:F,message:ee}=L;v=H,b=ee,L=F}return Object.assign(T,{code:v,message:b,data:L}),T}catch(O){let L=O,H=(E=(g=L.code)!=null?g:L.errNo)!=null?E:2e3;v="FAILURE";let F=(N=(P=L.message)!=null?P:L.errMsg)!=null?N:`${O}`,ee=`${n}:${v} ${F.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(T,{code:v,message:ee}),ce(new rt(ee,H)),T}finally{let O=Date.now()-m;e("apiInvoked",z(V({},p),{duration:O,status:v}))}})}return{createAPI:r,createSyncAPI:t}}});var ae,Ie,Y,qe=J(()=>{"use strict";no();Ee();ao();Dr();({createAPI:ae,createSyncAPI:Ie}=io(fe)),Y=ro("h5")});var uo=pn((lo,Fr)=>{(function(e){if(typeof lo=="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,T){if(!c[v]){if(!i[v]){var g=typeof Me=="function"&&Me;if(!T&&g)return g(v,!0);if(p)return p(v,!0);var E=new Error("Cannot find module '"+v+"'");throw E.code="MODULE_NOT_FOUND",E}var P=c[v]={exports:{}};i[v][0].call(P.exports,function(N){var O=i[v][1][N];return m(O||N)},P,P.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(N),T=d.document.createTextNode("");v.observe(T,{characterData:!0}),p=function(){T.data=b=++b%2}}else if(!d.setImmediate&&typeof d.MessageChannel!="undefined"){var g=new d.MessageChannel;g.port1.onmessage=N,p=function(){g.port2.postMessage(0)}}else"document"in d&&"onreadystatechange"in d.document.createElement("script")?p=function(){var L=d.document.createElement("script");L.onreadystatechange=function(){N(),L.onreadystatechange=null,L.parentNode.removeChild(L),L=null},d.document.documentElement.appendChild(L)}:p=function(){setTimeout(N,0)};var E,P=[];function N(){E=!0;for(var L,H,F=P.length;F;){for(H=P,P=[],L=-1;++L<F;)H[L]();F=P.length}E=!1}i.exports=O;function O(L){P.push(L)===1&&!E&&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"],T=["PENDING"];i.exports=g;function g(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=T,this.queue=[],this.outcome=void 0,S!==m&&O(this,S)}g.prototype.catch=function(S){return this.then(null,S)},g.prototype.then=function(S,x){if(typeof S!="function"&&this.state===v||typeof x!="function"&&this.state===b)return this;var C=new this.constructor(m);if(this.state!==T){var B=this.state===v?S:x;P(C,B,this.outcome)}else this.queue.push(new E(C,S,x));return C};function E(S,x,C){this.promise=S,typeof x=="function"&&(this.onFulfilled=x,this.callFulfilled=this.otherCallFulfilled),typeof C=="function"&&(this.onRejected=C,this.callRejected=this.otherCallRejected)}E.prototype.callFulfilled=function(S){p.resolve(this.promise,S)},E.prototype.otherCallFulfilled=function(S){P(this.promise,this.onFulfilled,S)},E.prototype.callRejected=function(S){p.reject(this.promise,S)},E.prototype.otherCallRejected=function(S){P(this.promise,this.onRejected,S)};function P(S,x,C){d(function(){var B;try{B=x(C)}catch(Q){return p.reject(S,Q)}B===S?p.reject(S,new TypeError("Cannot resolve promise with itself")):p.resolve(S,B)})}p.resolve=function(S,x){var C=L(N,x);if(C.status==="error")return p.reject(S,C.value);var B=C.value;if(B)O(S,B);else{S.state=v,S.outcome=x;for(var Q=-1,te=S.queue.length;++Q<te;)S.queue[Q].callFulfilled(x)}return S},p.reject=function(S,x){S.state=b,S.outcome=x;for(var C=-1,B=S.queue.length;++C<B;)S.queue[C].callRejected(x);return S};function N(S){var x=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof x=="function")return function(){x.apply(S,arguments)}}function O(S,x){var C=!1;function B(ne){C||(C=!0,p.reject(S,ne))}function Q(ne){C||(C=!0,p.resolve(S,ne))}function te(){x(Q,B)}var re=L(te);re.status==="error"&&B(re.value)}function L(S,x){var C={};try{C.value=S(x),C.status="success"}catch(B){C.status="error",C.value=B}return C}g.resolve=H;function H(S){return S instanceof this?S:p.resolve(new this(m),S)}g.reject=F;function F(S){var x=new this(m);return p.reject(x,S)}g.all=ee;function ee(S){var x=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=S.length,B=!1;if(!C)return this.resolve([]);for(var Q=new Array(C),te=0,re=-1,ne=new this(m);++re<C;)me(S[re],re);return ne;function me(Ue,ze){x.resolve(Ue).then($t,function(Re){B||(B=!0,p.reject(ne,Re))});function $t(Re){Q[ze]=Re,++te===C&&!B&&(B=!0,p.resolve(ne,Q))}}}g.race=ue;function ue(S){var x=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var C=S.length,B=!1;if(!C)return this.resolve([]);for(var Q=-1,te=new this(m);++Q<C;)re(S[Q]);return te;function re(ne){x.resolve(ne).then(function(me){B||(B=!0,p.resolve(te,me))},function(me){B||(B=!0,p.reject(te,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 T(o,s){o=o||[],s=s||{};try{return new Blob(o,s)}catch(l){if(l.name!=="TypeError")throw l;for(var a=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,u=new a,f=0;f<o.length;f+=1)u.append(o[f]);return u.getBlob(s.type)}}typeof Promise=="undefined"&&n(3);var g=Promise;function E(o,s){s&&o.then(function(a){s(null,a)},function(a){s(a)})}function P(o,s,a){typeof s=="function"&&o.then(s),typeof a=="function"&&o.catch(a)}function N(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function O(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var L="local-forage-detect-blob-support",H=void 0,F={},ee=Object.prototype.toString,ue="readonly",S="readwrite";function x(o){for(var s=o.length,a=new ArrayBuffer(s),u=new Uint8Array(a),f=0;f<s;f++)u[f]=o.charCodeAt(f);return a}function C(o){return new g(function(s){var a=o.transaction(L,S),u=T([""]);a.objectStore(L).put(u,"key"),a.onabort=function(f){f.preventDefault(),f.stopPropagation(),s(!1)},a.oncomplete=function(){var f=navigator.userAgent.match(/Chrome\/(\d+)/),l=navigator.userAgent.match(/Edge\//);s(l||!f||parseInt(f[1],10)>=43)}}).catch(function(){return!1})}function B(o){return typeof H=="boolean"?g.resolve(H):C(o).then(function(s){return H=s,H})}function Q(o){var s=F[o.name],a={};a.promise=new g(function(u,f){a.resolve=u,a.reject=f}),s.deferredOperations.push(a),s.dbReady?s.dbReady=s.dbReady.then(function(){return a.promise}):s.dbReady=a.promise}function te(o){var s=F[o.name],a=s.deferredOperations.pop();if(a)return a.resolve(),a.promise}function re(o,s){var a=F[o.name],u=a.deferredOperations.pop();if(u)return u.reject(s),u.promise}function ne(o,s){return new g(function(a,u){if(F[o.name]=F[o.name]||Jr(),o.db)if(s)Q(o),o.db.close();else return a(o.db);var f=[o.name];s&&f.push(o.version);var l=b.open.apply(b,f);s&&(l.onupgradeneeded=function(h){var y=l.result;try{y.createObjectStore(o.storeName),h.oldVersion<=1&&y.createObjectStore(L)}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 _}}),l.onerror=function(h){h.preventDefault(),u(l.error)},l.onsuccess=function(){var h=l.result;h.onversionchange=function(y){y.target.close()},a(h),te(o)}})}function me(o){return ne(o,!1)}function Ue(o){return ne(o,!0)}function ze(o,s){if(!o.db)return!0;var a=!o.db.objectStoreNames.contains(o.storeName),u=o.version<o.db.version,f=o.version>o.db.version;if(u&&(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 l=o.db.version+1;l>o.version&&(o.version=l)}return!0}return!1}function $t(o){return new g(function(s,a){var u=new FileReader;u.onerror=a,u.onloadend=function(f){var l=btoa(f.target.result||"");s({__local_forage_encoded_blob:!0,data:l,type:o.type})},u.readAsBinaryString(o)})}function Re(o){var s=x(atob(o.data));return T([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 u=F[s._dbInfo.name];if(u&&u.dbReady)return u.dbReady});return P(a,o,o),a}function Uo(o){Q(o);for(var s=F[o.name],a=s.forages,u=0;u<a.length;u++){var f=a[u];f._dbInfo.db&&(f._dbInfo.db.close(),f._dbInfo.db=null)}return o.db=null,me(o).then(function(l){return o.db=l,ze(o)?Ue(o):l}).then(function(l){o.db=s.db=l;for(var h=0;h<a.length;h++)a[h]._dbInfo.db=l}).catch(function(l){throw re(o,l),l})}function pe(o,s,a,u){u===void 0&&(u=1);try{var f=o.db.transaction(o.storeName,s);a(null,f)}catch(l){if(u>0&&(!o.db||l.name==="InvalidStateError"||l.name==="NotFoundError"))return g.resolve().then(function(){if(!o.db||l.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 Uo(o).then(function(){pe(o,s,a,u-1)})}).catch(a);a(l)}}function Jr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Fo(o){var s=this,a={db:null};if(o)for(var u in o)a[u]=o[u];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 l=[];function h(){return g.resolve()}for(var y=0;y<f.forages.length;y++){var _=f.forages[y];_!==s&&l.push(_._initReady().catch(h))}var w=f.forages.slice(0);return g.all(l).then(function(){return a.db=f.db,me(a)}).then(function(I){return a.db=I,ze(a,s._defaultConfig.version)?Ue(a):I}).then(function(I){a.db=f.db=I,s._dbInfo=a;for(var R=0;R<w.length;R++){var U=w[R];U!==s&&(U._dbInfo.db=a.db,U._dbInfo.version=a.version)}})}function Bo(o,s){var a=this;o=N(o);var u=new g(function(f,l){a.ready().then(function(){pe(a._dbInfo,ue,function(h,y){if(h)return l(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.get(o);w.onsuccess=function(){var I=w.result;I===void 0&&(I=null),Hr(I)&&(I=Re(I)),f(I)},w.onerror=function(){l(w.error)}}catch(I){l(I)}})}).catch(l)});return E(u,s),u}function Mo(o,s){var a=this,u=new g(function(f,l){a.ready().then(function(){pe(a._dbInfo,ue,function(h,y){if(h)return l(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.openCursor(),I=1;w.onsuccess=function(){var R=w.result;if(R){var U=R.value;Hr(U)&&(U=Re(U));var M=o(U,R.key,I++);M!==void 0?f(M):R.continue()}else f()},w.onerror=function(){l(w.error)}}catch(R){l(R)}})}).catch(l)});return E(u,s),u}function jo(o,s,a){var u=this;o=N(o);var f=new g(function(l,h){var y;u.ready().then(function(){return y=u._dbInfo,ee.call(s)==="[object Blob]"?B(y.db).then(function(_){return _?s:$t(s)}):s}).then(function(_){pe(u._dbInfo,S,function(w,I){if(w)return h(w);try{var R=I.objectStore(u._dbInfo.storeName);_===null&&(_=void 0);var U=R.put(_,o);I.oncomplete=function(){_===void 0&&(_=null),l(_)},I.onabort=I.onerror=function(){var M=U.error?U.error:U.transaction.error;h(M)}}catch(M){h(M)}})}).catch(h)});return E(f,a),f}function $o(o,s){var a=this;o=N(o);var u=new g(function(f,l){a.ready().then(function(){pe(a._dbInfo,S,function(h,y){if(h)return l(h);try{var _=y.objectStore(a._dbInfo.storeName),w=_.delete(o);y.oncomplete=function(){f()},y.onerror=function(){l(w.error)},y.onabort=function(){var I=w.error?w.error:w.transaction.error;l(I)}}catch(I){l(I)}})}).catch(l)});return E(u,s),u}function Vo(o){var s=this,a=new g(function(u,f){s.ready().then(function(){pe(s._dbInfo,S,function(l,h){if(l)return f(l);try{var y=h.objectStore(s._dbInfo.storeName),_=y.clear();h.oncomplete=function(){u()},h.onabort=h.onerror=function(){var w=_.error?_.error:_.transaction.error;f(w)}}catch(w){f(w)}})}).catch(f)});return E(a,o),a}function Ho(o){var s=this,a=new g(function(u,f){s.ready().then(function(){pe(s._dbInfo,ue,function(l,h){if(l)return f(l);try{var y=h.objectStore(s._dbInfo.storeName),_=y.count();_.onsuccess=function(){u(_.result)},_.onerror=function(){f(_.error)}}catch(w){f(w)}})}).catch(f)});return E(a,o),a}function Jo(o,s){var a=this,u=new g(function(f,l){if(o<0){f(null);return}a.ready().then(function(){pe(a._dbInfo,ue,function(h,y){if(h)return l(h);try{var _=y.objectStore(a._dbInfo.storeName),w=!1,I=_.openKeyCursor();I.onsuccess=function(){var R=I.result;if(!R){f(null);return}o===0||w?f(R.key):(w=!0,R.advance(o))},I.onerror=function(){l(I.error)}}catch(R){l(R)}})}).catch(l)});return E(u,s),u}function Ko(o){var s=this,a=new g(function(u,f){s.ready().then(function(){pe(s._dbInfo,ue,function(l,h){if(l)return f(l);try{var y=h.objectStore(s._dbInfo.storeName),_=y.openKeyCursor(),w=[];_.onsuccess=function(){var I=_.result;if(!I){u(w);return}w.push(I.key),I.continue()},_.onerror=function(){f(_.error)}}catch(I){f(I)}})}).catch(f)});return E(a,o),a}function Go(o,s){s=O.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 u=this,f;if(!o.name)f=g.reject("Invalid arguments");else{var l=o.name===a.name&&u._dbInfo.db,h=l?g.resolve(u._dbInfo.db):me(o).then(function(y){var _=F[o.name],w=_.forages;_.db=y;for(var I=0;I<w.length;I++)w[I]._dbInfo.db=y;return y});o.storeName?f=h.then(function(y){if(y.objectStoreNames.contains(o.storeName)){var _=y.version+1;Q(o);var w=F[o.name],I=w.forages;y.close();for(var R=0;R<I.length;R++){var U=I[R];U._dbInfo.db=null,U._dbInfo.version=_}var M=new g(function($,q){var G=b.open(o.name,_);G.onerror=function(oe){var Be=G.result;Be.close(),q(oe)},G.onupgradeneeded=function(){var oe=G.result;oe.deleteObjectStore(o.storeName)},G.onsuccess=function(){var oe=G.result;oe.close(),$(oe)}});return M.then(function($){w.db=$;for(var q=0;q<I.length;q++){var G=I[q];G._dbInfo.db=$,te(G._dbInfo)}}).catch(function($){throw(re(o,$)||g.resolve()).catch(function(){}),$})}}):f=h.then(function(y){Q(o);var _=F[o.name],w=_.forages;y.close();for(var I=0;I<w.length;I++){var R=w[I];R._dbInfo.db=null}var U=new g(function(M,$){var q=b.deleteDatabase(o.name);q.onerror=function(){var G=q.result;G&&G.close(),$(q.error)},q.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},q.onsuccess=function(){var G=q.result;G&&G.close(),M(G)}});return U.then(function(M){_.db=M;for(var $=0;$<w.length;$++){var q=w[$];te(q._dbInfo)}}).catch(function(M){throw(re(o,M)||g.resolve()).catch(function(){}),M})})}return E(f,s),f}var qo={_driver:"asyncStorage",_initStorage:Fo,_support:v(),iterate:Mo,getItem:Bo,setItem:jo,removeItem:$o,clear:Vo,length:Ho,key:Jo,keys:Ko,dropInstance:Go};function Wo(){return typeof openDatabase=="function"}var ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zo="~~local_forage_type~",Kr=/^~~local_forage_type~([^~]+)~/,Ye="__lfsc__:",Vt=Ye.length,Ht="arbf",Jt="blob",Gr="si08",qr="ui08",Wr="uic8",zr="si16",Yr="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,u,f=0,l,h,y,_;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var w=new ArrayBuffer(s),I=new Uint8Array(w);for(u=0;u<a;u+=4)l=ye.indexOf(o[u]),h=ye.indexOf(o[u+1]),y=ye.indexOf(o[u+2]),_=ye.indexOf(o[u+3]),I[f++]=l<<2|h>>4,I[f++]=(h&15)<<4|y>>2,I[f++]=(y&3)<<6|_&63;return w}function Kt(o){var s=new Uint8Array(o),a="",u;for(u=0;u<s.length;u+=3)a+=ye[s[u]>>2],a+=ye[(s[u]&3)<<4|s[u+1]>>4],a+=ye[(s[u+1]&15)<<2|s[u+2]>>6],a+=ye[s[u+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 u,f=Ye;o instanceof ArrayBuffer?(u=o,f+=Ht):(u=o.buffer,a==="[object Int8Array]"?f+=Gr:a==="[object Uint8Array]"?f+=qr:a==="[object Uint8ClampedArray]"?f+=Wr:a==="[object Int16Array]"?f+=zr:a==="[object Uint16Array]"?f+=Qr:a==="[object Int32Array]"?f+=Yr: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(u))}else if(a==="[object Blob]"){var l=new FileReader;l.onload=function(){var h=zo+o.type+"~"+Kt(this.result);s(Ye+Jt+h)},l.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 Qo(o){if(o.substring(0,Vt)!==Ye)return JSON.parse(o);var s=o.substring(tn),a=o.substring(Vt,tn),u;if(a===Jt&&Kr.test(s)){var f=s.match(Kr);u=f[1],s=s.substring(f[0].length)}var l=nn(s);switch(a){case Ht:return l;case Jt:return T([l],{type:u});case Gr:return new Int8Array(l);case qr:return new Uint8Array(l);case Wr:return new Uint8ClampedArray(l);case zr:return new Int16Array(l);case Qr:return new Uint16Array(l);case Yr:return new Int32Array(l);case Xr:return new Uint32Array(l);case Zr:return new Float32Array(l);case en:return new Float64Array(l);default:throw new Error("Unkown type: "+a)}}var Gt={serialize:Yo,deserialize:Qo,stringToBuffer:nn,bufferToString:Kt};function on(o,s,a,u){o.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],a,u)}function Xo(o){var s=this,a={db:null};if(o)for(var u in o)a[u]=typeof o[u]!="string"?o[u].toString():o[u];var f=new g(function(l,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,l()},function(_,w){h(w)})},h)});return a.serializer=Gt,f}function be(o,s,a,u,f,l){o.executeSql(a,u,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?l(_,y):on(_,s,function(){_.executeSql(a,u,f,l)},l)},l):l(h,y)},l)}function Zo(o,s){var a=this;o=N(o);var u=new g(function(f,l){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 I=w.rows.length?w.rows.item(0).value:null;I&&(I=h.serializer.deserialize(I)),f(I)},function(_,w){l(w)})})}).catch(l)});return E(u,s),u}function ei(o,s){var a=this,u=new g(function(f,l){a.ready().then(function(){var h=a._dbInfo;h.db.transaction(function(y){be(y,h,"SELECT * FROM "+h.storeName,[],function(_,w){for(var I=w.rows,R=I.length,U=0;U<R;U++){var M=I.item(U),$=M.value;if($&&($=h.serializer.deserialize($)),$=o($,M.key,U+1),$!==void 0){f($);return}}f()},function(_,w){l(w)})})}).catch(l)});return E(u,s),u}function an(o,s,a,u){var f=this;o=N(o);var l=new g(function(h,y){f.ready().then(function(){s===void 0&&(s=null);var _=s,w=f._dbInfo;w.serializer.serialize(s,function(I,R){R?y(R):w.db.transaction(function(U){be(U,w,"INSERT OR REPLACE INTO "+w.storeName+" (key, value) VALUES (?, ?)",[o,I],function(){h(_)},function(M,$){y($)})},function(U){if(U.code===U.QUOTA_ERR){if(u>0){h(an.apply(f,[o,_,a,u-1]));return}y(U)}})})}).catch(y)});return E(l,a),l}function ti(o,s,a){return an.apply(this,[o,s,a,1])}function ri(o,s){var a=this;o=N(o);var u=new g(function(f,l){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){l(w)})})}).catch(l)});return E(u,s),u}function ni(o){var s=this,a=new g(function(u,f){s.ready().then(function(){var l=s._dbInfo;l.db.transaction(function(h){be(h,l,"DELETE FROM "+l.storeName,[],function(){u()},function(y,_){f(_)})})}).catch(f)});return E(a,o),a}function oi(o){var s=this,a=new g(function(u,f){s.ready().then(function(){var l=s._dbInfo;l.db.transaction(function(h){be(h,l,"SELECT COUNT(key) as c FROM "+l.storeName,[],function(y,_){var w=_.rows.item(0).c;u(w)},function(y,_){f(_)})})}).catch(f)});return E(a,o),a}function ii(o,s){var a=this,u=new g(function(f,l){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 I=w.rows.length?w.rows.item(0).key:null;f(I)},function(_,w){l(w)})})}).catch(l)});return E(u,s),u}function ai(o){var s=this,a=new g(function(u,f){s.ready().then(function(){var l=s._dbInfo;l.db.transaction(function(h){be(h,l,"SELECT key FROM "+l.storeName,[],function(y,_){for(var w=[],I=0;I<_.rows.length;I++)w.push(_.rows.item(I).key);u(w)},function(y,_){f(_)})})}).catch(f)});return E(a,o),a}function si(o){return new g(function(s,a){o.transaction(function(u){u.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(f,l){for(var h=[],y=0;y<l.rows.length;y++)h.push(l.rows.item(y).name);s({db:o,storeNames:h})},function(f,l){a(l)})},function(u){a(u)})})}function ci(o,s){s=O.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 u=this,f;return o.name?f=new g(function(l){var h;o.name===a.name?h=u._dbInfo.db:h=openDatabase(o.name,"","",0),o.storeName?l({db:h,storeNames:[o.storeName]}):l(si(h))}).then(function(l){return new g(function(h,y){l.db.transaction(function(_){function w(M){return new g(function($,q){_.executeSql("DROP TABLE IF EXISTS "+M,[],function(){$()},function(G,oe){q(oe)})})}for(var I=[],R=0,U=l.storeNames.length;R<U;R++)I.push(w(l.storeNames[R]));g.all(I).then(function(){h()}).catch(function(M){y(M)})},function(_){y(_)})})}):f=g.reject("Invalid arguments"),E(f,s),f}var li={_driver:"webSQLStorage",_initStorage:Xo,_support:Wo(),iterate:ei,getItem:Zo,setItem:ti,removeItem:ri,clear:ni,length:oi,key:ii,keys:ai,dropInstance:ci};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 di(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(s){return!0}}function fi(){return!di()||localStorage.length>0}function mi(o){var s=this,a={};if(o)for(var u in o)a[u]=o[u];return a.keyPrefix=sn(o,s._defaultConfig),fi()?(s._dbInfo=a,a.serializer=Gt,g.resolve()):g.reject()}function pi(o){var s=this,a=s.ready().then(function(){for(var u=s._dbInfo.keyPrefix,f=localStorage.length-1;f>=0;f--){var l=localStorage.key(f);l.indexOf(u)===0&&localStorage.removeItem(l)}});return E(a,o),a}function hi(o,s){var a=this;o=N(o);var u=a.ready().then(function(){var f=a._dbInfo,l=localStorage.getItem(f.keyPrefix+o);return l&&(l=f.serializer.deserialize(l)),l});return E(u,s),u}function gi(o,s){var a=this,u=a.ready().then(function(){for(var f=a._dbInfo,l=f.keyPrefix,h=l.length,y=localStorage.length,_=1,w=0;w<y;w++){var I=localStorage.key(w);if(I.indexOf(l)===0){var R=localStorage.getItem(I);if(R&&(R=f.serializer.deserialize(R)),R=o(R,I.substring(h),_++),R!==void 0)return R}}});return E(u,s),u}function vi(o,s){var a=this,u=a.ready().then(function(){var f=a._dbInfo,l;try{l=localStorage.key(o)}catch(h){l=null}return l&&(l=l.substring(f.keyPrefix.length)),l});return E(u,s),u}function yi(o){var s=this,a=s.ready().then(function(){for(var u=s._dbInfo,f=localStorage.length,l=[],h=0;h<f;h++){var y=localStorage.key(h);y.indexOf(u.keyPrefix)===0&&l.push(y.substring(u.keyPrefix.length))}return l});return E(a,o),a}function bi(o){var s=this,a=s.keys().then(function(u){return u.length});return E(a,o),a}function _i(o,s){var a=this;o=N(o);var u=a.ready().then(function(){var f=a._dbInfo;localStorage.removeItem(f.keyPrefix+o)});return E(u,s),u}function wi(o,s,a){var u=this;o=N(o);var f=u.ready().then(function(){s===void 0&&(s=null);var l=s;return new g(function(h,y){var _=u._dbInfo;_.serializer.serialize(s,function(w,I){if(I)y(I);else try{localStorage.setItem(_.keyPrefix+o,w),h(l)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&y(R),y(R)}})})});return E(f,a),f}function Ei(o,s){if(s=O.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 u=this,f;return o.name?f=new g(function(l){o.storeName?l(sn(o,u._defaultConfig)):l(o.name+"/")}).then(function(l){for(var h=localStorage.length-1;h>=0;h--){var y=localStorage.key(h);y.indexOf(l)===0&&localStorage.removeItem(y)}}):f=g.reject("Invalid arguments"),E(f,s),f}var Ii={_driver:"localStorageWrapper",_initStorage:mi,_support:ui(),iterate:gi,getItem:hi,setItem:wi,removeItem:_i,clear:pi,length:bi,key:vi,keys:yi,dropInstance:Ei},Ti=function(s,a){return s===a||typeof s=="number"&&typeof a=="number"&&isNaN(s)&&isNaN(a)},Si=function(s,a){for(var u=s.length,f=0;f<u;){if(Ti(s[f],a))return!0;f++}return!1},cn=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Fe={},ln={},Ae={INDEXEDDB:qo,WEBSQL:li,LOCALSTORAGE:Ii},Ri=[Ae.INDEXEDDB._driver,Ae.WEBSQL._driver,Ae.LOCALSTORAGE._driver],Qe=["dropInstance"],qt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(Qe),Ai={description:"",driver:Ri.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function xi(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 ki=function(){function o(s){m(this,o);for(var a in Ae)if(Ae.hasOwnProperty(a)){var u=Ae[a],f=u._driver;this[a]=f,Fe[f]||this.defineDriver(u)}this._defaultConfig=Wt({},Ai),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 u in a){if(u==="storeName"&&(a[u]=a[u].replace(/\W/g,"_")),u==="version"&&typeof a[u]!="number")return new Error("Database version must be a number.");this._config[u]=a[u]}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,u,f){var l=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 I=qt.concat("_initStorage"),R=0,U=I.length;R<U;R++){var M=I[R],$=!Si(Qe,M);if(($||a[M])&&typeof a[M]!="function"){y(w);return}}var q=function(){for(var Be=function(Oi){return function(){var Di=new Error("Method "+Oi+" is not implemented by the current driver"),un=g.reject(Di);return E(un,arguments[arguments.length-1]),un}},zt=0,Pi=Qe.length;zt<Pi;zt++){var Yt=Qe[zt];a[Yt]||(a[Yt]=Be(Yt))}};q();var G=function(Be){Fe[_]&&console.info("Redefining LocalForage driver: "+_),Fe[_]=a,ln[_]=Be,h()};"_support"in a?a._support&&typeof a._support=="function"?a._support().then(G,y):G(!!a._support):G(!0)}catch(oe){y(oe)}});return P(l,u,f),l},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(a,u,f){var l=Fe[a]?g.resolve(Fe[a]):g.reject(new Error("Driver not found."));return P(l,u,f),l},o.prototype.getSerializer=function(a){var u=g.resolve(Gt);return P(u,a),u},o.prototype.ready=function(a){var u=this,f=u._driverSet.then(function(){return u._ready===null&&(u._ready=u._initDriver()),u._ready});return P(f,a,a),f},o.prototype.setDriver=function(a,u,f){var l=this;cn(a)||(a=[a]);var h=this._getSupportedDrivers(a);function y(){l._config.driver=l.driver()}function _(R){return l._extend(R),y(),l._ready=l._initStorage(l._config),l._ready}function w(R){return function(){var U=0;function M(){for(;U<R.length;){var $=R[U];return U++,l._dbInfo=null,l._ready=null,l.getDriver($).then(_).catch(M)}y();var q=new Error("No available storage method found.");return l._driverSet=g.reject(q),l._driverSet}return M()}}var I=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=I.then(function(){var R=h[0];return l._dbInfo=null,l._ready=null,l.getDriver(R).then(function(U){l._driver=U._driver,y(),l._wrapLibraryMethodsWithReady(),l._initDriver=w(h)})}).catch(function(){y();var R=new Error("No available storage method found.");return l._driverSet=g.reject(R),l._driverSet}),P(this._driverSet,u,f),this._driverSet},o.prototype.supports=function(a){return!!ln[a]},o.prototype._extend=function(a){Wt(this,a)},o.prototype._getSupportedDrivers=function(a){for(var u=[],f=0,l=a.length;f<l;f++){var h=a[f];this.supports(h)&&u.push(h)}return u},o.prototype._wrapLibraryMethodsWithReady=function(){for(var a=0,u=qt.length;a<u;a++)xi(this,qt[a])},o.prototype.createInstance=function(a){return new o(a)},o}(),Ci=new ki;i.exports=Ci},{3:3}]},{},[4])(4)})});var mo=pn(Te=>{"use strict";j();qe();Ee();var Ce=ie(),Qa=ae("levelFinished",{paramsSchema:k.tuple(k.string(),k.object({result:k.boolean(),duration:k.number()})),implement:(e,t)=>D(Te,null,function*(){let{result:r,duration:n}=t;se.info("onLevelFinished",r,n),yield Promise.all([le.reporter({event:"COMPLETE_GAME_LEVEL"}),le.tracker("LevelFinished",{levelId:e,result:r,duration:n})])})}),Xa=ae("taskFinished",{paramsSchema:k.tuple(k.string(),k.object({duration:k.number()})),implement:(e,t)=>D(Te,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),Za=ae("levelUpgrade",{paramsSchema:k.tuple(k.string(),k.string()),implement:(e,t)=>D(Te,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),es=ae("onHistoryUserLevel",{paramsSchema:k.tuple(k.number()),implement:e=>D(Te,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),ts=ae("onHistoryUserScore",{paramsSchema:k.tuple(k.number()),implement:e=>D(Te,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),rs=ae("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)=>D(Te,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([le.reporter({event:"USE_GAME_ITEM"}),le.tracker("UseGameItem",V({taskId:e},t))]))})});Ce.registerCommand("TaskTrackerSDK.levelFinished",Qa);Ce.registerCommand("TaskTrackerSDK.taskFinished",Xa);Ce.registerCommand("TaskTrackerSDK.levelUpgrade",Za);Ce.registerCommand("TaskTrackerSDK.historyUserLevel",es);Ce.registerCommand("TaskTrackerSDK.historyUserScore",ts);Ce.registerCommand("TaskTrackerSDK.taskEvent",rs);Y("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Y("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Y("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Y("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Y("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Y("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();Z();qe();j();var so=ie(),Na="env",Ua="getSystemInfoSync",Fa=()=>{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(V({},e),{version:t}));let r=(d=A.hostInfo)==null?void 0:d.appName;r&&(e=z(V({},e),{appName:r}));let n=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return n&&(e=z(V({},e),{SDKVersion:n})),e},Ba=Ie(Ua,{implement:Fa}),Ma=Ie(Na,{implement:()=>z(V({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});so.registerCommand("API.env",Ma);so.registerCommand("API.getSystemInfoSync",Ba);Y("env",{version:"1.0.0"});Y("getSystemInfoSync",{version:"1.0.0"});j();qe();_e();Ee();var ja="onJoliboxShow",$a="onJoliboxHide",Va="onReady",Nr=ie(),Ur=Pn(ce),Lr=!0,We=!0,At=0,xt=Ar;function Ha(){let e=Date.now();if(e-At<100)return;At=e;let t=document.visibilityState==="visible";t!==Lr&&(Lr=t,xt.emit("visible",Lr))}function co(e){let t=Date.now();t-At<100||(At=t,e==="focus"&&!We?We=!0:e==="blur"&&We&&(We=!1),xt.emit("visible",We))}document.addEventListener("visibilitychange",Ha);window.addEventListener("focus",()=>co("focus"));window.addEventListener("blur",()=>co("blur"));var Ja=Ie(ja,{paramsSchema:k.tuple(k.function()),implement(e){let t=Ur(e);xt.on("visible",r=>{r&&t()})}}),Ka=Ie($a,{paramsSchema:k.tuple(k.function()),implement(e){let t=Ur(e);xt.on("visible",r=>{!r&&t()})}}),Ga=Ie(Va,{paramsSchema:k.tuple(k.function()),implement(e){let t=Ur(e);Ke.on("LifecycleEvent.onReady",r=>{t(r)})}});Nr.registerCommand("LifecycleSDK.onReady",Ga);Nr.registerCommand("LifecycleSDK.onJoliboxShow",Ja);Nr.registerCommand("LifecycleSDK.onJoliboxHide",Ka);Y("lifeCycle.onReady",{version:"1.0.0"});Y("lifeCycle.onJoliboxShow",{version:"1.0.0"});Y("lifeCycle.onJoliboxHide",{version:"1.0.0"});qe();j();Ge();Z();var fo=hn(uo());var kt=ie(),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=>D(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)=>D(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=>D(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=()=>D(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=fo.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},Ct=new Br,qa=ae("getLocalStorage",{paramsSchema:k.tuple(k.string()),implement(e){return D(this,null,function*(){return yield Ct.getItem(e)})}});kt.registerCommand("StorageSDK.getItem",qa);Y("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Wa=ae("setStorage",{paramsSchema:k.tuple(k.string(),k.or(k.string(),k.boolean(),k.number())),implement(e,t){return D(this,null,function*(){return yield Ct.setItem(e,t)})}});kt.registerCommand("StorageSDK.setItem",Wa);Y("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var za=ae("removeStorage",{paramsSchema:k.tuple(k.string()),implement(e){return D(this,null,function*(){return yield Ct.removeItem(e)})}});kt.registerCommand("StorageSDK.removeItem",za);Y("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Ya=ae("clearStorage",{implement(){return D(this,null,function*(){return yield Ct.clear()})}});kt.registerCommand("StorageSDK.clear",Ya);Y("storage.clear",{version:"1.0.0"});var Mu=hn(mo());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()})}};j();mr();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,E,P,N,O,L,H;let c=(g=i==null?void 0:i.maxAllowedAdsForTime)!=null?g:8,d=(E=i==null?void 0:i.banForTimeThreshold)!=null?E:6e4,m=(P=i==null?void 0:i.bannedReleaseTime)!=null?P:6e4,p=(N=i==null?void 0:i.maxAllowedAdsForSession)!=null?N:200,b=(O=i==null?void 0:i.banForSessionThreshold)!=null?O:6e5,v=(L=i==null?void 0:i.initialThreshold)!=null?L:2e3,T=(H=i==null?void 0:i.highFreqThreshold)!=null?H:2e3;this.checkShouldBanInitial=is(v),this.checkShouldBanHighFreq=as(T),this.checkShouldBanForTime=os(c,d,m),this.checkShouldBanForSession=ns(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}})}},ns=(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"}},os=(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 T=JSON.parse((v=window.__joliboxLocalStorage__.getItem(c))!=null?v:"[]");Array.isArray(T)?this._records=T:this._records=[]}catch(T){this._records=[]}},get values(){return this._records},set values(v){try{window.__joliboxLocalStorage__.setItem(c,JSON.stringify(v))}catch(T){}this._records=v}},p={_record:!1,init(){var v;try{let T=JSON.parse((v=window.__joliboxLocalStorage__.getItem(d))!=null?v:"false");typeof T=="boolean"&&(this._record=T)}catch(T){this._record=!1}if(this._record){let T=m.values[m.values.length-1],g=T?Date.now()-T.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(T){}this._record=v}};return m.init(),p.init(),v=>{if(p.value)return"WAITING_BANNED_RELEASE";let T=Date.now();if(m.values=m.values.concat({timestamp:T,type:v}),m.values.length!==1&&(m.values.length>e&&(m.values=m.values.slice(-e)),m.values.length===e&&T-m.values[0].timestamp<=t))return p.value=!0,i(r),"BANNED_FOR_TIME"}},is=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},as=(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)}}};Z();Z();var Dt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return D(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}};j();var Pe=new de,Lt=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=()=>D(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 T=yield this.httpClient.get("/public/ads",{query:{objectId:i,testAdsMode:`${c}`}});t=(p=T.data)==null?void 0:p.clientId,r=(b=T.data)==null?void 0:b.channelId,n=(v=T.data)==null?void 0:v.unitId}catch(T){console.error("Failed to fetch client info",T)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>D(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(V({},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(V({},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,T,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":(T=t.adBreakDone)==null||T.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=>D(this,null,function*(){var g,E,P,N;if(this.track("CallAdUnit",{adFormat:(E=(g=t.adFormat)==null?void 0:g.toString())!=null?E: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: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),(N=this.getTestAdsMode())!=null?N:!1){let O=document.createElement("div");O.style.position="absolute",O.style.top="0",O.style.left="0",O.style.width="100%",O.style.height="100%",O.style.display="flex",O.style.justifyContent="center",O.style.alignItems="center",O.style.backgroundColor="rgba(0, 0, 0, 0.5)",O.style.color="white",O.innerHTML="Test Ad",v.style.position="relative",m.appendChild(v),v.appendChild(O)}else m.appendChild(v),new MutationObserver(L=>{L.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();j();Ge();var Mr=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};Z();var po=A.testMode;function ho(){let e=new Map,t;return{registerRewardHandler(n,i){e.set(n,i)},handleReward(n,...i){return D(this,null,function*(){return yield n.reduce((d,m)=>D(this,null,function*(){let p=yield d;if(p===!0)return!0;po&&console.log(`handleReward ${m}`);let b=e.get(m),v=b?yield b(...i):p;return po&&console.log(`handleReward ${m} ${v}`),v}),Promise.resolve(!1))})},registerRewardsFetcher(n){return D(this,null,function*(){t=(...i)=>D(this,null,function*(){try{return yield n(...i)}catch(c){return console.error("getRewardOptions error:",c),["ADS"]}})})},getRewardsTypes(...n){return D(this,null,function*(){return t?yield t(...n):["ADS"]})}}}var ss=()=>(e,t)=>e==="JOLI_COIN"&&t==="ADS"?-1:e==="ADS"&&t==="JOLI_COIN"?1:0,go=e=>{e.registerRewardsFetcher(t=>D(void 0,null,function*(){var n,i,c,d;let r=["ADS"];try{let m=yield t.post("/api/games/unlock-options",{});return m.code!=="SUCCESS"?r:(Ut.emit(Nt,{options:((n=m.data)==null?void 0:n.unlockOptions)||[],userJoliCoin:((i=m.extra)==null?void 0:i.joliCoin)||{balance:0,enableAutoDeduct:!1}}),(((d=(c=m.data)==null?void 0:c.unlockOptions)==null?void 0:d.map(b=>b.type))||Array.from(r)).sort(ss()))}catch(m){return console.error("getRewardOptions error:",m),r}}))};j();var vo=e=>t=>D(void 0,null,function*(){return e.adBreak(t),!0});Z();j();var yo=(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 bo=(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(Nt,m=>{c=m,i&&(i(m),i=null)}),m=>D(void 0,null,function*(){var p,b,v;try{n||d();let T=yield n;if(!yo((T==null?void 0:T.options)||[],T==null?void 0:T.userJoliCoin))return r==null||r(),!1;let g=yield e.post("/api/joli-coin/unlock",{data:{type:"GAME_REWARD",reqId:`${fr()}-${A.mpType}-${Date.now()}`,gameInfo:{gameId:A.mpId}}});return g.code=="SUCCESS"?((b=m.adBreakDone)==null||b.call(m,{breakType:m.type,breakName:"name"in m&&(p=m.name)!=null?p:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in m&&((v=m.adViewed)==null||v.call(m)),t==null||t({quantity:g.data.quantity,balance:g.data.balance}),!0):(r==null||r(),!1)}catch(T){return console.error("JolicoinRewardHandler error:",T),r==null||r(),!1}})};var Oe=ho();go(Oe);var Nt="UNLOCK_OPTIONS_CHANGED",Ut=new de;var Ft=ie(),cs=ge.create(),Se=new Lt(fe,cs,()=>ge.getNetworkStatus());Oe.registerRewardHandler("ADS",vo(Se));Oe.registerRewardHandler("JOLI_COIN",bo(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)});j();Ee();var So=-1,Mt=function(e){addEventListener("pageshow",function(t){t.persisted&&(So=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},Le=function(e,t){var r=$r(),n="navigate";return So>=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}},Ro=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){}},Ne=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))}},Ao=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},xo=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},ko=function(e){var t=!1;return function(){t||(e(),t=!0)}},De=-1,_o=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,ls())},wo=function(){addEventListener("visibilitychange",Bt,!0),addEventListener("prerenderingchange",Bt,!0)},ls=function(){removeEventListener("visibilitychange",Bt,!0),removeEventListener("prerenderingchange",Bt,!0)},Co=function(){return De<0&&(De=_o(),wo(),Mt(function(){setTimeout(function(){De=_o(),wo()},0)})),{get firstHiddenTime(){return De}}},Vr=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},Eo=[1800,3e3],Po=function(e,t){t=t||{},Vr(function(){var r,n=Co(),i=Le("FCP"),c=Ro("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=Ne(e,i,Eo,t.reportAllChanges),Mt(function(d){i=Le("FCP"),r=Ne(e,i,Eo,t.reportAllChanges),Ao(function(){i.value=performance.now()-d.timeStamp,r(!0)})}))})};var us=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=ko(e),document.visibilityState==="hidden"?e():(r=t(e),xo(e)),r};var Io=[2500,4e3],jr={},Oo=function(e,t){t=t||{},Vr(function(){var r,n=Co(),i=Le("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=Ro("largest-contentful-paint",c);if(d){r=Ne(e,i,Io,t.reportAllChanges);var m=ko(function(){jr[i.id]||(c(d.takeRecords()),d.disconnect(),jr[i.id]=!0,r(!0))});["keydown","click"].forEach(function(p){addEventListener(p,function(){return us(m)},{once:!0,capture:!0})}),xo(m),Mt(function(p){i=Le("LCP"),r=Ne(e,i,Io,t.reportAllChanges),Ao(function(){i.value=performance.now()-p.timeStamp,jr[i.id]=!0,r(!0)})})}})},To=[800,1800],ds=function e(t){document.prerendering?Vr(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},Do=function(e,t){t=t||{};var r=Le("TTFB"),n=Ne(e,r,To,t.reportAllChanges);ds(function(){var i=$r();i&&(r.value=Math.max(i.responseStart-jt(),0),r.entries=[i],n(!0),Mt(function(){r=Le("TTFB",0),(n=Ne(e,r,To,t.reportAllChanges))(!0)}))})};Z();function fs(){Po(e=>{fe("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Oo(e=>{fe("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Do(e=>{fe("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function ms(){Ke.on("onDocumentReady",e=>{Ke.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function Lo(){ms(),fs()}Lo();
4
4
  /*! Bundled license information: