@jolibox/implement 1.1.11-beta.4 → 1.1.11-beta.5

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,12 +4,12 @@
4
4
  "packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
5
5
  "packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
6
6
  "packages/implement/esbuild.config.js": "86f1fd21722a2cb05216751578dcca66326e664a",
7
- "packages/implement/package.json": "10385388506049466cc02691859ed10e9abf4915",
7
+ "packages/implement/package.json": "6ad364b6f98786cecb5d73e650c4f41e520b6e18",
8
8
  "packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
9
9
  "packages/implement/src/common/ads/anti-cheating.test.ts": "433eb603b97fd7609f26af1522f309596a790829",
10
10
  "packages/implement/src/common/ads/anti-cheating.ts": "888c94ef55ca03849a79b3e0425850a097192816",
11
11
  "packages/implement/src/common/ads/channel-policy.ts": "c6d036be5cedf0c5d545fac271c6c8447ca55d8a",
12
- "packages/implement/src/common/ads/index.ts": "5a013d55749d265bf0ff2ac4d75d86d144b7f917",
12
+ "packages/implement/src/common/ads/index.ts": "e3d5b617f7a156583d50905d325c7ed13ecba6fb",
13
13
  "packages/implement/src/common/api-factory/index.ts": "a2b60f027384e37492ddde550dd46f3fb3e14cfe",
14
14
  "packages/implement/src/common/api-factory/validator/__tests__/validate/any.test.ts": "6e225e09fce401b374221ad2e4fe33bc91df4152",
15
15
  "packages/implement/src/common/api-factory/validator/__tests__/validate/array.test.ts": "8a9cc32be03e952f1176a970fea033d597c176cb",
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- var _i=Object.create;var zt=Object.defineProperty,Ei=Object.defineProperties,Ii=Object.getOwnPropertyDescriptor,wi=Object.getOwnPropertyDescriptors,Ti=Object.getOwnPropertyNames,Ye=Object.getOwnPropertySymbols,Si=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,on=Object.prototype.propertyIsEnumerable;var nn=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F=(e,t)=>{for(var r in t||(t={}))Yt.call(t,r)&&nn(e,r,t[r]);if(Ye)for(var r of Ye(t))on.call(t,r)&&nn(e,r,t[r]);return e},W=(e,t)=>Ei(e,wi(t));var Be=(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 an=(e,t)=>{var r={};for(var o in e)Yt.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(e!=null&&Ye)for(var o of Ye(e))t.indexOf(o)<0&&on.call(e,o)&&(r[o]=e[o]);return r};var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var sn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ri=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ti(t))!Yt.call(e,a)&&a!==r&&zt(e,a,{get:()=>t[a],enumerable:!(o=Ii(t,a))||o.enumerable});return e};var cn=(e,t,r)=>(r=e!=null?_i(Si(e)):{},Ri(t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r,e));var L=(e,t,r)=>new Promise((o,a)=>{var u=h=>{try{m(r.next(h))}catch(T){a(T)}},f=h=>{try{m(r.throw(h))}catch(T){a(T)}},m=h=>h.done?o(h.value):Promise.resolve(h.value).then(u,f);m((r=r.apply(e,t)).next())});function xi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function tr(e){return typeof e=="string"}function mn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function pn(e){return typeof e=="object"&&Array.isArray(e)}function Ci(e){return typeof e>"u"}function Pi(e){return Ci(e)||e===null}function Di(e){return typeof e=="function"}function hn(e){let t=e,r=null,o=function(...a){return r||(r=new t(...a)),r};return o.prototype=t.prototype,o}function gn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function o(a,u){for(let f in u)if(Object.prototype.hasOwnProperty.call(u,f)){let m=a[f],h=u[f],T=r(m,h,f,a,u);T!==void 0?a[f]=T:un(h)&&un(m)?a[f]=o(F({},m),h):Array.isArray(h)&&Array.isArray(m)?a[f]=[...m,...h]:a[f]=h}return a}return o(e,t)}function un(e){return e&&typeof e=="object"&&e.constructor===Object}function vn(e,t){if(Array.isArray(e))return e.concat(t)}function Ve(e,t,r={}){let o=null,a,u,f,{leading:m=!1,trailing:h=!0}=r,T=()=>(f=e.apply(u,a),a=void 0,u=void 0,f),_=function(...S){a=S,u=this;let g=m&&!o;if(o&&clearTimeout(o),o=setTimeout(()=>{o=null,h&&!g&&T()},t),g)return T()};return _.cancel=()=>{o&&clearTimeout(o),o=null,a=u=void 0},_.flush=()=>{if(o)return clearTimeout(o),o=null,T()},_}function Li(e,t){return(...r)=>t(e,...r)}function In(e){return t=>Li(t,function(r,...o){if(typeof r=="function")try{return r.apply(this,o)}catch(a){e(new Ni(`${a}`))}})}function Me(e){return(...t)=>{var r,o;((o=(r=globalThis.VConsole)==null?void 0:r[e])!=null?o:globalThis.console[e])(...t)}}function Ze(e,t){return t.map(r=>{if(r==="params"&&e[r]){let o=e[r];return Object.keys(o).reduce((a,u)=>(a[u]=String(o[u]),a),{})}return e[r]})}function $i(e){let t=e.location?Ze(e.location,ln):null,r=e.target?Ze(e.target,ln):null;return Ze(W(F({},e),{location:t,target:r}),Bi)}function ar(e){let t=e.events.map(o=>$i(o)),r=Ze(e.device,Mi);return[e.protocolVersion,t,r,e.project]}function Qi(e){return new Promise(t=>Rn(e)(t))}function Rn(e){return(t,r=null)=>{let o=!1;return e(a=>{if(!o)return o=!0,t.call(r,a)},null)}}function Xi(e,t){return(r=>{let o,a={onWillAddFirstListener(){o=r(u.fire,u)}},u=new $e(a);return u.event})((r,o=null)=>e(a=>t(a)&&r.call(o,a),null))}function ea(e,t){let r=Math.min(e.length,t.length);for(let o=0;o<r;o++)ta(e[o],t[o])}function ta(e,t){if(tr(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Di(t)){try{if(e instanceof t)return}catch(r){}if(!Pi(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function ae(){if(globalThis[Xt])return globalThis[Xt];let e=new et,t=new er,r={registerCommand(o,a,u){e.registerCommand({id:o,handler:a,metadata:u})},executeCommand(o,...a){return t.executeCommand(o,...a)},excuteCommandSync(o,...a){return t.executeCommandThowErr(o,...a)}};return globalThis[Xt]=r,r}var dn,Ai,ki,fn,Oi,rr,nr,yn,bn,Ni,_n,En,tt,or,ce,wn,Fi,ir,je,ke,Ui,ln,Bi,Mi,Vi,Qe,ji,Ki,Hi,Tn,sr,Gi,Ji,qi,Sn,pe,J,Wi,zi,Xe,$e,_e,Zt,Yi,Qt,Zi,Ke,et,er,Xt,H=G(()=>{"use strict";dn=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,ki=(e,t)=>{for(var r in t)dn(e,r,{get:t[r],enumerable:!0})},fn=(e,t,r,o)=>{for(var a=o>1?void 0:o?Ai(t,r):t,u=e.length-1,f;u>=0;u--)(f=e[u])&&(a=(o?f(t,r,a):f(a))||a);return o&&a&&dn(t,r,a),a};Oi=(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))(Oi||{}),rr=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}},nr=class extends rr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},yn=class extends rr{constructor(){super(...arguments),this.kind="USER_ERROR"}},bn=class extends yn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Ni=class extends yn{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))}},_n=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},En=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},tt=class extends rr{constructor(e,t,r,o,a){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),o!==void 0&&(this.stack=o),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},or=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:Me("log"),warn:Me("warn"),info:Me("info"),error:Me("error"),debug:Me("debug")};Object.assign(globalThis,{logger:ce});wn=Symbol.for("Jolibox.canIUseMap"),Fi={};globalThis[wn]=Fi;ir={get config(){return globalThis[wn]}},je=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(je||{}),ke=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(ke||{}),Ui=(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))(Ui||{}),ln=["name","params"],Bi=["name","type","location","target","extra","timestamp","userId"],Mi=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Vi=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Qe={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")},ji=()=>Qe.isiOS?"iOS":Qe.isAndroid?"Android":Qe.isMac?"Mac":Qe.isFacebook?"Facebook":"PC",Ki="device_id",Hi="advertising_id",Tn=e=>(localStorage.getItem(e)||localStorage.setItem(e,Vi()),localStorage.getItem(e)),sr=()=>Tn(Ki),Gi=()=>Tn(Hi),Ji=e=>e.charAt(0).toUpperCase()+e.slice(1),qi=()=>{var t;let e=new URLSearchParams(window.location.search);return Ji((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Sn=e=>{let t="JoliboxWebSDK",r=ji(),o=navigator.language,a=sr(),u=Gi();return`${t} (${qi()}${r}; UnknownModel; UnknownSystemVersion; ${o}) uuid/${a} adid/${u} version/${e||""}`},J=(pe=class{constructor(t){this.element=t,this.next=pe.Undefined,this.prev=pe.Undefined}},pe.Undefined=new pe(void 0),pe),Wi=class{constructor(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===J.Undefined}clear(){let e=this._first;for(;e!==J.Undefined;){let t=e.next;e.prev=J.Undefined,e.next=J.Undefined,e=t}this._first=J.Undefined,this._last=J.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new J(e);if(this._first===J.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let o=!1;return()=>{o||(o=!0,this._remove(r))}}shift(){if(this._first!==J.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==J.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==J.Undefined&&e.next!==J.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===J.Undefined&&e.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):e.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):e.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==J.Undefined;)yield e.element,e=e.next}},zi=0,Xe=class{constructor(e){this.value=e,this.id=zi++}},$e=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Xe&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(o=>(o==null?void 0:o.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 a,u,f,m,h,T;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let o=new Xe(t);this._listeners?this._listeners instanceof Xe?this._listeners=[this._listeners,o]:this._listeners.push(o):((u=(a=this.options)==null?void 0:a.onWillAddFirstListener)==null||u.call(a,this),this._listeners=o,(m=(f=this.options)==null?void 0:f.onDidFirstListener)==null||m.call(f,this)),(T=(h=this.options)==null?void 0:h.onDidAddListener)==null||T.call(h,this),this._size++}),this._event}_deliver(e,t){var o;if(!e)return;let r=((o=this.options)==null?void 0:o.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(a){r(a)}}fire(e){this._listeners&&(this._listeners instanceof Xe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},_e=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var u;let r=(u=this.listeners.get(e))!=null?u:new $e,o=f=>t(...f.args);this.listerHandlerMap.set(t,o),r.event(o),this.listeners.set(e,r);let a=this.cachedEventQueue.get(e);if(a)for(;a.size>0;)r.fire(F({event:e},a.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let o=this.listerHandlerMap.get(t);r.dispose(o)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let o=this.cachedEventQueue.get(e);o||(o=new Wi,this.cachedEventQueue.set(e,o)),o.push({args:t})}}},Zt={};ki(Zt,{None:()=>Yi,filter:()=>Xi,once:()=>Rn,toPromise:()=>Qi});Yi=()=>{console.log("[Jolibox SDK] None Event")};Qt=Symbol.for("Jolibox.hostEmitter"),Zi=()=>{let e=new _e;return globalThis[Qt]||(globalThis[Qt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Qt]},Ke=Zi();et=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new $e,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let a of e.metadata.args)r.push(a.constraint);let o=e.handler;e.handler=function(...a){return ea(a,r),o(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};et=fn([hn],et);er=class{constructor(){this._onWillExecuteCommand=new $e,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new $e,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new et,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=xi(3e4)),this._starActivation}executeCommand(e,...t){return L(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Zt.toPromise(Zt.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let o=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),o}_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 o=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(o)}catch(o){return Promise.reject(o)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};er=fn([hn],er);Xt=Symbol.for("Jolibox.commands")});function ue(e,t={}){cr.emit("ERROR_REPORT",{error:e,options:t})}var cr,Ie,Ee=G(()=>{"use strict";H();H();cr=new _e,Ie=new _e;ue.debounce=Ve(ue,50,{leading:!0})});var ur,lr,An,kn,xn=G(()=>{"use strict";H();Ee();ur=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),o=atob(t+r);try{return JSON.parse(o)}catch(a){return{}}},lr=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},An=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[u,f,m]=a;return{headerJson:ur(u),payloadJson:ur(f),signature:ur(m)}}else throw"joli_source is missing"}catch(r){return ue(new _n(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},kn=e=>{let{headerJson:t,payloadJson:r,signature:o}=e,a=lr(t),u=lr(r),f=lr(o);return`${a}.${u}.${f}`}});var ra,rt,Cn,dr=G(()=>{"use strict";H();ra="1.1.11-beta.4",rt=()=>ra,Cn=()=>{let e=rt();return`${Sn(e)}`}});var na,Pn,fr,Dn,Z,oa,A,re=G(()=>{"use strict";H();xn();dr();H();na={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:sr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:rt()},schema:window.location.href,platform:"h5"},fr=(Pn=globalThis.joliboxJSCore)==null?void 0:Pn.env,Z=Object.assign({},(Dn=fr==null?void 0:fr())!=null?Dn:na),oa=()=>{var g,I,P,x,C,D,U,B,ee;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?An(Z.schema):{},o=`${Z.deviceInfo.did}-${new Date().getTime()}`,u=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,f=(P=(I=(g=u.get("mpId"))!=null?g:u.get("appId"))!=null?I:u.get("gameId"))!=null?P:"",m=(D=(C=(x=Z.clientSessionId)!=null?x:e==null?void 0:e.sessionId)!=null?C:u.get("sessionId"))!=null?D:o,h=!!((U=e==null?void 0:e.testAdsMode)!=null?U:u.get("testAdsMode")==="true"),T=(ee=(B=e==null?void 0:e.joliboxEnv)!=null?B:u.get("joliboxEnv"))!=null?ee:"production",_=T==="staging",S=t==null?void 0:t.channel;return{get testMode(){return _},get testAdsMode(){return h},get joliboxEnv(){return T},get joliSource(){var M;return(M=u.get("joliSource"))!=null?M:null},get mpId(){var M;return(M=f!=null?f:e==null?void 0:e.id)!=null?M:""},get mpVersion(){var M;return(M=t==null?void 0:t.ver)!=null?M:rt()},get mpType(){var M,w;return(w=(M=t==null?void 0:t.__mpType)!=null?M:e==null?void 0:e.__mpType)!=null?w:"game"},get platform(){var M;return(M=Z.platform)!=null?M:Z.deviceInfo.platform},get deviceInfo(){return Z.deviceInfo},get sdkInfo(){return Z.sdkInfo},get hostInfo(){return Z.hostInfo},get hostUserInfo(){return Z.hostUserInfo},get sessionId(){var M,w;return(w=(M=Z.clientSessionId)!=null?M:m)!=null?w:o},get channel(){return S},get webviewId(){var M;return(M=Z.webviewId)!=null?M:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:M=>{gn(Z,M,vn)},encodeJoliSourceQuery:M=>{var w;return t&&r?kn({headerJson:t,payloadJson:F(F({},e),M),signature:r}):(w=u.get("joliSource"))!=null?w:""}}},A=oa()});var mr,Nn,ia,aa,On,sa,Ln=G(()=>{"use strict";H();Ee();re();H();mr=!1,Nn=(e,t)=>e==null?!1:t in e,ia=e=>Nn(e,"kind"),aa=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},On=(e,t={},r)=>{var u,f,m;let o={user_id:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:aa(e.name)},a=W(F({},o),{env:t.environment,isFromUser:r});r?Ie.emit("GLOBAL_USER_ERROR",e,a):Ie.emit("GLOBAL_ERROR",e,a)},sa=e=>Nn(e,"kind")&&e.kind==="USER_ERROR";cr.on("ERROR_REPORT",({error:e,options:t})=>{if(mr)return;mr=!0;let r=ia(e)&&e.raw?e.raw:e;try{let o=sa(e);On(e,t,o)}catch(o){let a=o instanceof Error?o.message:String(o),u=new or(`${a}, origin error: ${r.message}`);ce.error(u),On(new or(u.message),{environment:t.environment},!1)}finally{mr=!1}})});var pr,hr=G(()=>{"use strict";Ee();H();Ee();pr=e=>new bn(e)});function Fn(e,t){let r=(o,a,u)=>{let f=W(F({tag:o},t),{extra:F({},a)});o=="globalJsError"?ue(new En(JSON.stringify(f))):e("systemLog",f,u)};return r.debounce=Ve(r,500,{leading:!0}),r}function Un(e){let t=(r,o,a)=>{var m;let u=(m=a&&JSON.stringify(a))!=null?m:0,f={speed_value_type:r,total_duration:o};u&&Object.assign(f,{extra:u}),e("joliboxSpeedAnalysis",f)};return t.debounce=Ve(t,500,{leading:!0}),t}var Bn=G(()=>{"use strict";H();H();Ee()});function Mn(e,t){let r=Fn(e,t),o=Un(r);return{track:r,trackPerformance:o}}var $n=G(()=>{"use strict";Bn()});var gr=G(()=>{"use strict"});var nt,Vn=G(()=>{"use strict";re();H();H();nt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return L(this,null,function*(){let r=`${A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"}/api/fe-configs/js-sdk/samples-config`,o=yield(yield fetch(r)).json();this.samplesConfig=o})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[o,a]of Object.entries(r))if(a.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(o);return!1}getDevice(){var o,a,u,f,m;let{nativeSDKVersion:t,jssdkVersion:r}=A.sdkInfo;return{platform:1e3,os:A.deviceInfo.platform,appVersion:(o=t!=null?t:r)!=null?o:"1.0.0",appId:(u=(a=A.hostInfo)==null?void 0:a.aid)!=null?u:"1",model:(f=A.deviceInfo.model)!=null?f:"UnknownModel",brand:(m=A.deviceInfo.brand)!=null?m:"UnknownBrand",uuid:A.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((o,a)=>{r[a]=o}),{name:"GamePage",params:r}}trackEvent(t,r,o){return L(this,null,function*(){if(this.checkIsSampled(t))return;let a=t.location?t.location:yield this.getLocation(),u=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,T={protocolVersion:"1.0.0",events:[W(F({},t),{location:a,target:u,extra:f,timestamp:Date.now(),userId:null})],device:m,project:r};try{o?yield this.doReport(ar(T),o):yield this.doReport(ar(T))}catch(_){ce.log("[Jolibox SDK] report API error",_)}})}}});var vr=G(()=>{"use strict";$n();gr();Vn()});var yr,jn,he,ot,ge,He=G(()=>{"use strict";dr();re();yr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(jn=AbortSignal.timeout)!=null||(AbortSignal.timeout=yr);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 ot(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(o=>o).length/this.networkRequests.length>=.6}},ot=class{constructor(t){this.xua=Cn();this.getJoliSource=()=>A.joliSource;var o;let r=A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com";this.baseUrl=(o=t==null?void 0:t.baseUrl)!=null?o:r}get(t,r){return L(this,null,function*(){try{let{query:o,timeout:a}=r!=null?r:{},{headers:u}=r!=null?r:{},f=o?new URLSearchParams(o):null,m=f==null?void 0:f.toString(),h=`${this.baseUrl}${t}${m?`?${m}`:""}`,T=this.xua,_=this.getJoliSource();u=Object.assign({},u!=null?u:{},T?{"x-user-agent":T}:{},_?{"x-joli-source":_}:{});let S=yield fetch(h,{method:"GET",headers:u,credentials:"include",signal:yr(a!=null?a:3e4)});return he.getInstance().recordNetworkRequest(!0),yield S.json()}catch(o){throw he.getInstance().recordNetworkRequest(!1),o}})}post(t,r){return L(this,null,function*(){try{let{data:o,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,h=m==null?void 0:m.toString(),T=`${this.baseUrl}${t}${h?`?${h}`:""}`,_=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},S?{"x-joli-source":S}:{});let g=yield fetch(T,{method:"POST",headers:f,body:JSON.stringify(o),signal:yr(u!=null?u:3e4),credentials:"include"});he.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(I!=null&&I.includes("multipart/form-data")||I!=null&&I.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(o){throw he.getInstance().recordNetworkRequest(!1),o}})}put(t,r){return L(this,null,function*(){try{let{data:o,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,h=m==null?void 0:m.toString(),T=`${this.baseUrl}${t}${h?`?${h}`:""}`,_=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},S?{"x-joli-source":S}:{});let g=yield fetch(T,{method:"PUT",headers:f,credentials:"include",body:JSON.stringify(o!=null?o:{})});if(!g.ok)throw he.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${g.status}`);return he.getInstance().recordNetworkRequest(!0),yield g.json()}catch(o){throw console.error("Error:",o),o}})}};window.JoliboxHttpClient=ot;ge=he.getInstance()});var br,it,_r=G(()=>{"use strict";re();vr();He();br=class extends nt{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 o,a;let r=(o=this.hostToApiMap[window.location.host])!=null?o:this.hostToApiMap.default;return(a=A.testMode)!=null&&a?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(o=>{console.info("report error",o)})}},it=new br});var ca,Kn=G(()=>{"use strict";Ln();H();hr();H();_r();re();ca=(e,t)=>{var a,u,f;let r={message:t.message,stack:(a=t.stack)!=null?a:"",errorType:t.name,source:0},o={name:e,type:je.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:null};it.trackEvent(o,ke.WebSDK)};Ie.on("GLOBAL_ERROR",(e,t)=>{ca(t.tag,e)});Ie.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var at,Hn=G(()=>{"use strict";at=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",o=>{this.visible=o})}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(),o,a,u=!1,f=0,m=()=>{if(!u)return;let I=Date.now(),P=I-r;P>=this.interval&&(this.visible&&(f+=P,t(f)),r=I),o=requestAnimationFrame(m)},h=()=>{_(),r=Date.now(),a=window.setInterval(()=>{if(!u)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},T=()=>{S(),r=Date.now(),o=requestAnimationFrame(m)},_=()=>{o&&(cancelAnimationFrame(o),o=0)},S=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",I=>{u&&(console.log("visible",I),I?T():h())});let g=this.visible;return{start(){u||(u=!0,g?T():h())},stop(){u=!1,_(),S()}}}}});var st,Gn=G(()=>{"use strict";re();Hn();He();st=class extends at{constructor(r,o,a){super(o,a);this.httpClient=ge.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return L(this,null,function*(){let{event:o,params:a}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:o,gameInfo:F({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,o=null){this.track(r,o)}}});var Jn,ua,de,la,Er,le,we=G(()=>{"use strict";Kn();H();H();vr();_r();Gn();re();gr();Jn=ae(),ua={type:ke.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:de,trackPerformance:la}=Mn((...e)=>{var f,m,h,T;let[,t]=e,r=t,o=mn(r.extra)?r.extra:tr(r.extra)?JSON.parse(r.extra):{},a=W(F({},o),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(m=r.mp_version)!=null?m:""}),u={name:t.tag,type:je.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(T=(h=A.hostUserInfo)==null?void 0:h.uid)!=null?T:null};it.trackEvent(u,ke.WebSDK)},ua);Jn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{la(e,t,r)});Jn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{de(e,t)});Er=new _e,le=new st(de,Er)});function qn(e){let t=ir.config[e];return t||(t={},ir.config[e]=t),(r,o)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=F({},o)}}var Wn=G(()=>{"use strict";H()});function Ir(e){zn=e}function ct(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>ct(t)):Object.keys(e).reduce((t,r)=>(t[r]=ct(e[r]),t),{})}function ve(e){return typeof e=="number"}function wr(e){let t=Tr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Tr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var zn,Y,ut,lt,dt,ft,xe,mt,pt,ht,gt,vt,yt,bt,_t,Et,It,wt,Tt,Sr=G(()=>{"use strict";zn=!1;Y=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(zn)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${wr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return ct(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:ct(this._default)}optional(){return this._optional=!0,this}};ut=class extends Y{validate(t){return this._optional&&t===void 0?!0:ve(t)?ve(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ve(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ve(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},lt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},dt=class extends Y{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ve(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ve(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},ft=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},xe=class extends Y{validate(t){return!0}},mt=class extends Y{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},pt=class extends Y{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ht=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},gt=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(o=>JSON.stringify(o)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${wr(t)}`)}return!0}},vt=class extends Y{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ve(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ve(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ve(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let o=this._item;if(!o)return!0;let a=!0;if(r.forEach((u,f)=>{if(o.path=`${this.path}[${f}]`,o.errors=this.errors,u===void 0&&o.hasDefault){r[f]=o.defaultValue;return}o.validate(u)||(o.hasFallback?r[f]=o.fallbackValue:a=!1)}),this._uniqueItems){let u=new Map;for(let f in r)u.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${u.get(r[f])}] and ${this.path}[${f}] are identical)`):u.set(r[f],f)}return a}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},yt=class extends Y{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Tr(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,u=this._value;u.errors=this.errors;let f=!0;for(let m in a){let h=a[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?u.path=`${this.path}.${m}`:u.path=`${this.path}["${m}"]`,!(h===void 0&&u._optional)){if(h===void 0&&u.hasDefault){a[m]=u.defaultValue;continue}u.validate(h)||(u.hasFallback?a[m]=u.fallbackValue:f=!1)}}return f}},bt=class extends Y{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Tr(r)!=="object")return this.fail({expect:"object",actual:r});let o=r,a=!0;for(let u in this._object){let f=o[u],m=this._object[u];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(u)?m.path=`${this.path}.${u}`:m.path=`${this.path}["${u}"]`,!(m._optional&&f===void 0)){if(f===void 0&&m.hasDefault){o[u]=m.defaultValue;continue}m.validate(f)||(m.hasFallback?o[u]=m.fallbackValue:a=!1)}}return a}},_t=class extends Y{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:wr(this.value),actual:r}):!0}},Et=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],o=!1,a=this._items.length;for(let u=0;u<a;u++){let f=this._items[u];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!o){o=!0;break}}if(!o){let u=r.join(`
2
- or `);this.errors.push(u)}return o}},It=class extends Y{constructor(...t){super(),this._items=t;let r=0,o=t.length-1;for(;o>=0;o--){let a=t[o];if(a._optional||a.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((o,a)=>{if(o.path=`${this.path}[${a}]`,o.errors=this.errors,t[a]===void 0&&o.hasDefault){t[a]=o.defaultValue;return}o.validate(t[a])||(o.hasFallback?t[a]=o._fallback:r=!1)}),r}},wt=class extends Y{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},Tt=class extends Y{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 Rr(e,t,r="param"){if(e.errors=[],e.path=r,Ir(!0),!e.validate(t)){let o=e.errors.join(`
3
- `);throw e.errors.length=0,Ir(!1),new TypeError(o)}}var k,Ar=G(()=>{"use strict";Sr();Sr();k={object(e){return new bt(e)},array(e){return new vt(e)},tuple(...e){return new It(...e)},literal(e){return new _t(e)},or(...e){return new Et(...e)},symbol(){return new ft},record(e){return new yt(e)},function(){return new ht},boolean(){return new lt},string(){return new dt},number(){return new ut},undefined(){return new mt},null(){return new pt},unknown(){return new xe},any(){return new xe},as(){return new xe},arraybuffer(){return new wt},enum(...e){return new gt(...e)},typedarray(e){return new Tt(e)}}});var St,Yn,Qn=G(()=>{"use strict";H();Ee();Ar();hr();St=1,Yn=e=>{function t(o,a){return(...u)=>{var S,g,I,P;let f=Date.now(),m={method:o,trace_id:St};St+=1;let h="SUCCESS",T=`${o}:ok`,_=0;try{if(a.paramsSchema)try{Rr(a.paramsSchema,u,"params")}catch(U){throw pr(`${o}:fail ${U.message}`)}let x=a.implement(...u),C=x,D=`${o}:ok`;if(x&&"code"in x){let{code:U,data:B,message:ee}=x;h=U,C=B,D=ee}return{code:h,message:D,data:C}}catch(x){let C=x;_=(g=(S=C.code)!=null?S:C.errNo)!=null?g:2e3,h="FAILURE";let D=(P=(I=C.message)!=null?I:C.errMsg)!=null?P:`${x}`;return T=`${o}:${h} ${D.replace(/^\S+:(fail|cancel)\s?/,"")}`,ue(new tt(T,_)),{code:h,message:T}}finally{let x=Date.now()-f;e("apiInvoked",W(F({},m),{duration:x,status:h}))}}}function r(o,a){return(...u)=>L(this,null,function*(){var g,I,P,x;let f=pn(u)?u:[u],m=Date.now(),h={method:o,trace_id:St};St+=1;let T=`${o}:ok`,_="SUCCESS",S={code:_,message:T};try{if(a.paramsSchema)try{Rr(a.paramsSchema,f,"params")}catch(U){throw pr(U.message)}let D=yield a.implement(...f);if(D&&"code"in D){let{code:U,data:B,message:ee}=D;_=U,T=ee,D=B}return Object.assign(S,{code:_,message:T,data:D}),S}catch(C){let D=C,U=(I=(g=D.code)!=null?g:D.errNo)!=null?I:2e3;_="FAILURE";let B=(x=(P=D.message)!=null?P:D.errMsg)!=null?x:`${C}`,ee=`${o}:${_} ${B.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(S,{code:_,message:ee}),ue(new tt(ee,U)),S}finally{let C=Date.now()-m;e("apiInvoked",W(F({},h),{duration:C,status:_}))}})}return{createAPI:r,createSyncAPI:t}}});var se,Te,Q,Ge=G(()=>{"use strict";Wn();we();Qn();Ar();({createAPI:se,createSyncAPI:Te}=Yn(de)),Q=qn("h5")});var to=sn((eo,Pr)=>{(function(e){if(typeof eo=="object"&&typeof Pr!="undefined")Pr.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 o(a,u,f){function m(_,S){if(!u[_]){if(!a[_]){var g=typeof Be=="function"&&Be;if(!S&&g)return g(_,!0);if(h)return h(_,!0);var I=new Error("Cannot find module '"+_+"'");throw I.code="MODULE_NOT_FOUND",I}var P=u[_]={exports:{}};a[_][0].call(P.exports,function(x){var C=a[_][1][x];return m(C||x)},P,P.exports,o,a,u,f)}return u[_].exports}for(var h=typeof Be=="function"&&Be,T=0;T<f.length;T++)m(f[T]);return m}({1:[function(o,a,u){(function(f){"use strict";var m=f.MutationObserver||f.WebKitMutationObserver,h;if(m){var T=0,_=new m(x),S=f.document.createTextNode("");_.observe(S,{characterData:!0}),h=function(){S.data=T=++T%2}}else if(!f.setImmediate&&typeof f.MessageChannel!="undefined"){var g=new f.MessageChannel;g.port1.onmessage=x,h=function(){g.port2.postMessage(0)}}else"document"in f&&"onreadystatechange"in f.document.createElement("script")?h=function(){var D=f.document.createElement("script");D.onreadystatechange=function(){x(),D.onreadystatechange=null,D.parentNode.removeChild(D),D=null},f.document.documentElement.appendChild(D)}:h=function(){setTimeout(x,0)};var I,P=[];function x(){I=!0;for(var D,U,B=P.length;B;){for(U=P,P=[],D=-1;++D<B;)U[D]();B=P.length}I=!1}a.exports=C;function C(D){P.push(D)===1&&!I&&h()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(o,a,u){"use strict";var f=o(1);function m(){}var h={},T=["REJECTED"],_=["FULFILLED"],S=["PENDING"];a.exports=g;function g(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=S,this.queue=[],this.outcome=void 0,w!==m&&C(this,w)}g.prototype.catch=function(w){return this.then(null,w)},g.prototype.then=function(w,$){if(typeof w!="function"&&this.state===_||typeof $!="function"&&this.state===T)return this;var N=new this.constructor(m);if(this.state!==S){var K=this.state===_?w:$;P(N,K,this.outcome)}else this.queue.push(new I(N,w,$));return N};function I(w,$,N){this.promise=w,typeof $=="function"&&(this.onFulfilled=$,this.callFulfilled=this.otherCallFulfilled),typeof N=="function"&&(this.onRejected=N,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(w){h.resolve(this.promise,w)},I.prototype.otherCallFulfilled=function(w){P(this.promise,this.onFulfilled,w)},I.prototype.callRejected=function(w){h.reject(this.promise,w)},I.prototype.otherCallRejected=function(w){P(this.promise,this.onRejected,w)};function P(w,$,N){f(function(){var K;try{K=$(N)}catch(X){return h.reject(w,X)}K===w?h.reject(w,new TypeError("Cannot resolve promise with itself")):h.resolve(w,K)})}h.resolve=function(w,$){var N=D(x,$);if(N.status==="error")return h.reject(w,N.value);var K=N.value;if(K)C(w,K);else{w.state=_,w.outcome=$;for(var X=-1,te=w.queue.length;++X<te;)w.queue[X].callFulfilled($)}return w},h.reject=function(w,$){w.state=T,w.outcome=$;for(var N=-1,K=w.queue.length;++N<K;)w.queue[N].callRejected($);return w};function x(w){var $=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof $=="function")return function(){$.apply(w,arguments)}}function C(w,$){var N=!1;function K(oe){N||(N=!0,h.reject(w,oe))}function X(oe){N||(N=!0,h.resolve(w,oe))}function te(){$(X,K)}var ne=D(te);ne.status==="error"&&K(ne.value)}function D(w,$){var N={};try{N.value=w($),N.status="success"}catch(K){N.status="error",N.value=K}return N}g.resolve=U;function U(w){return w instanceof this?w:h.resolve(new this(m),w)}g.reject=B;function B(w){var $=new this(m);return h.reject($,w)}g.all=ee;function ee(w){var $=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=w.length,K=!1;if(!N)return this.resolve([]);for(var X=new Array(N),te=0,ne=-1,oe=new this(m);++ne<N;)fe(w[ne],ne);return oe;function fe(Le,qe){$.resolve(Le).then(Mt,function(Re){K||(K=!0,h.reject(oe,Re))});function Mt(Re){X[qe]=Re,++te===N&&!K&&(K=!0,h.resolve(oe,X))}}}g.race=M;function M(w){var $=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=w.length,K=!1;if(!N)return this.resolve([]);for(var X=-1,te=new this(m);++X<N;)ne(w[X]);return te;function ne(oe){$.resolve(oe).then(function(fe){K||(K=!0,h.resolve(te,fe))},function(fe){K||(K=!0,h.reject(te,fe))})}}},{1:1}],3:[function(o,a,u){(function(f){"use strict";typeof f.Promise!="function"&&(f.Promise=o(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(o,a,u){"use strict";var f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n};function m(n,s){if(!(n instanceof s))throw new TypeError("Cannot call a class as a function")}function h(){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(n){return}}var T=h();function _(){try{if(!T||!T.open)return!1;var n=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(!n||s)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function S(n,s){n=n||[],s=s||{};try{return new Blob(n,s)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new i,d=0;d<n.length;d+=1)l.append(n[d]);return l.getBlob(s.type)}}typeof Promise=="undefined"&&o(3);var g=Promise;function I(n,s){s&&n.then(function(i){s(null,i)},function(i){s(i)})}function P(n,s,i){typeof s=="function"&&n.then(s),typeof i=="function"&&n.catch(i)}function x(n){return typeof n!="string"&&(console.warn(n+" used as a key, but it is not a string."),n=String(n)),n}function C(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var D="local-forage-detect-blob-support",U=void 0,B={},ee=Object.prototype.toString,M="readonly",w="readwrite";function $(n){for(var s=n.length,i=new ArrayBuffer(s),l=new Uint8Array(i),d=0;d<s;d++)l[d]=n.charCodeAt(d);return i}function N(n){return new g(function(s){var i=n.transaction(D,w),l=S([""]);i.objectStore(D).put(l,"key"),i.onabort=function(d){d.preventDefault(),d.stopPropagation(),s(!1)},i.oncomplete=function(){var d=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);s(c||!d||parseInt(d[1],10)>=43)}}).catch(function(){return!1})}function K(n){return typeof U=="boolean"?g.resolve(U):N(n).then(function(s){return U=s,U})}function X(n){var s=B[n.name],i={};i.promise=new g(function(l,d){i.resolve=l,i.reject=d}),s.deferredOperations.push(i),s.dbReady?s.dbReady=s.dbReady.then(function(){return i.promise}):s.dbReady=i.promise}function te(n){var s=B[n.name],i=s.deferredOperations.pop();if(i)return i.resolve(),i.promise}function ne(n,s){var i=B[n.name],l=i.deferredOperations.pop();if(l)return l.reject(s),l.promise}function oe(n,s){return new g(function(i,l){if(B[n.name]=B[n.name]||Ur(),n.db)if(s)X(n),n.db.close();else return i(n.db);var d=[n.name];s&&d.push(n.version);var c=T.open.apply(T,d);s&&(c.onupgradeneeded=function(p){var v=c.result;try{v.createObjectStore(n.storeName),p.oldVersion<=1&&v.createObjectStore(D)}catch(y){if(y.name==="ConstraintError")console.warn('The database "'+n.name+'" has been upgraded from version '+p.oldVersion+" to version "+p.newVersion+', but the storage "'+n.storeName+'" already exists.');else throw y}}),c.onerror=function(p){p.preventDefault(),l(c.error)},c.onsuccess=function(){var p=c.result;p.onversionchange=function(v){v.target.close()},i(p),te(n)}})}function fe(n){return oe(n,!1)}function Le(n){return oe(n,!0)}function qe(n,s){if(!n.db)return!0;var i=!n.db.objectStoreNames.contains(n.storeName),l=n.version<n.db.version,d=n.version>n.db.version;if(l&&(n.version!==s&&console.warn('The database "'+n.name+`" can't be downgraded from version `+n.db.version+" to version "+n.version+"."),n.version=n.db.version),d||i){if(i){var c=n.db.version+1;c>n.version&&(n.version=c)}return!0}return!1}function Mt(n){return new g(function(s,i){var l=new FileReader;l.onerror=i,l.onloadend=function(d){var c=btoa(d.target.result||"");s({__local_forage_encoded_blob:!0,data:c,type:n.type})},l.readAsBinaryString(n)})}function Re(n){var s=$(atob(n.data));return S([s],{type:n.type})}function Fr(n){return n&&n.__local_forage_encoded_blob}function Eo(n){var s=this,i=s._initReady().then(function(){var l=B[s._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return P(i,n,n),i}function Io(n){X(n);for(var s=B[n.name],i=s.forages,l=0;l<i.length;l++){var d=i[l];d._dbInfo.db&&(d._dbInfo.db.close(),d._dbInfo.db=null)}return n.db=null,fe(n).then(function(c){return n.db=c,qe(n)?Le(n):c}).then(function(c){n.db=s.db=c;for(var p=0;p<i.length;p++)i[p]._dbInfo.db=c}).catch(function(c){throw ne(n,c),c})}function me(n,s,i,l){l===void 0&&(l=1);try{var d=n.db.transaction(n.storeName,s);i(null,d)}catch(c){if(l>0&&(!n.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return g.resolve().then(function(){if(!n.db||c.name==="NotFoundError"&&!n.db.objectStoreNames.contains(n.storeName)&&n.version<=n.db.version)return n.db&&(n.version=n.db.version+1),Le(n)}).then(function(){return Io(n).then(function(){me(n,s,i,l-1)})}).catch(i);i(c)}}function Ur(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function wo(n){var s=this,i={db:null};if(n)for(var l in n)i[l]=n[l];var d=B[i.name];d||(d=Ur(),B[i.name]=d),d.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=Eo);var c=[];function p(){return g.resolve()}for(var v=0;v<d.forages.length;v++){var y=d.forages[v];y!==s&&c.push(y._initReady().catch(p))}var b=d.forages.slice(0);return g.all(c).then(function(){return i.db=d.db,fe(i)}).then(function(E){return i.db=E,qe(i,s._defaultConfig.version)?Le(i):E}).then(function(E){i.db=d.db=E,s._dbInfo=i;for(var R=0;R<b.length;R++){var O=b[R];O!==s&&(O._dbInfo.db=i.db,O._dbInfo.version=i.version)}})}function To(n,s){var i=this;n=x(n);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,M,function(p,v){if(p)return c(p);try{var y=v.objectStore(i._dbInfo.storeName),b=y.get(n);b.onsuccess=function(){var E=b.result;E===void 0&&(E=null),Fr(E)&&(E=Re(E)),d(E)},b.onerror=function(){c(b.error)}}catch(E){c(E)}})}).catch(c)});return I(l,s),l}function So(n,s){var i=this,l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,M,function(p,v){if(p)return c(p);try{var y=v.objectStore(i._dbInfo.storeName),b=y.openCursor(),E=1;b.onsuccess=function(){var R=b.result;if(R){var O=R.value;Fr(O)&&(O=Re(O));var V=n(O,R.key,E++);V!==void 0?d(V):R.continue()}else d()},b.onerror=function(){c(b.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function Ro(n,s,i){var l=this;n=x(n);var d=new g(function(c,p){var v;l.ready().then(function(){return v=l._dbInfo,ee.call(s)==="[object Blob]"?K(v.db).then(function(y){return y?s:Mt(s)}):s}).then(function(y){me(l._dbInfo,w,function(b,E){if(b)return p(b);try{var R=E.objectStore(l._dbInfo.storeName);y===null&&(y=void 0);var O=R.put(y,n);E.oncomplete=function(){y===void 0&&(y=null),c(y)},E.onabort=E.onerror=function(){var V=O.error?O.error:O.transaction.error;p(V)}}catch(V){p(V)}})}).catch(p)});return I(d,i),d}function Ao(n,s){var i=this;n=x(n);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,w,function(p,v){if(p)return c(p);try{var y=v.objectStore(i._dbInfo.storeName),b=y.delete(n);v.oncomplete=function(){d()},v.onerror=function(){c(b.error)},v.onabort=function(){var E=b.error?b.error:b.transaction.error;c(E)}}catch(E){c(E)}})}).catch(c)});return I(l,s),l}function ko(n){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,w,function(c,p){if(c)return d(c);try{var v=p.objectStore(s._dbInfo.storeName),y=v.clear();p.oncomplete=function(){l()},p.onabort=p.onerror=function(){var b=y.error?y.error:y.transaction.error;d(b)}}catch(b){d(b)}})}).catch(d)});return I(i,n),i}function xo(n){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,M,function(c,p){if(c)return d(c);try{var v=p.objectStore(s._dbInfo.storeName),y=v.count();y.onsuccess=function(){l(y.result)},y.onerror=function(){d(y.error)}}catch(b){d(b)}})}).catch(d)});return I(i,n),i}function Co(n,s){var i=this,l=new g(function(d,c){if(n<0){d(null);return}i.ready().then(function(){me(i._dbInfo,M,function(p,v){if(p)return c(p);try{var y=v.objectStore(i._dbInfo.storeName),b=!1,E=y.openKeyCursor();E.onsuccess=function(){var R=E.result;if(!R){d(null);return}n===0||b?d(R.key):(b=!0,R.advance(n))},E.onerror=function(){c(E.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function Po(n){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,M,function(c,p){if(c)return d(c);try{var v=p.objectStore(s._dbInfo.storeName),y=v.openKeyCursor(),b=[];y.onsuccess=function(){var E=y.result;if(!E){l(b);return}b.push(E.key),E.continue()},y.onerror=function(){d(y.error)}}catch(E){d(E)}})}).catch(d)});return I(i,n),i}function Do(n,s){s=C.apply(this,arguments);var i=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||i.name,n.storeName=n.storeName||i.storeName);var l=this,d;if(!n.name)d=g.reject("Invalid arguments");else{var c=n.name===i.name&&l._dbInfo.db,p=c?g.resolve(l._dbInfo.db):fe(n).then(function(v){var y=B[n.name],b=y.forages;y.db=v;for(var E=0;E<b.length;E++)b[E]._dbInfo.db=v;return v});n.storeName?d=p.then(function(v){if(v.objectStoreNames.contains(n.storeName)){var y=v.version+1;X(n);var b=B[n.name],E=b.forages;v.close();for(var R=0;R<E.length;R++){var O=E[R];O._dbInfo.db=null,O._dbInfo.version=y}var V=new g(function(j,z){var q=T.open(n.name,y);q.onerror=function(ie){var Ue=q.result;Ue.close(),z(ie)},q.onupgradeneeded=function(){var ie=q.result;ie.deleteObjectStore(n.storeName)},q.onsuccess=function(){var ie=q.result;ie.close(),j(ie)}});return V.then(function(j){b.db=j;for(var z=0;z<E.length;z++){var q=E[z];q._dbInfo.db=j,te(q._dbInfo)}}).catch(function(j){throw(ne(n,j)||g.resolve()).catch(function(){}),j})}}):d=p.then(function(v){X(n);var y=B[n.name],b=y.forages;v.close();for(var E=0;E<b.length;E++){var R=b[E];R._dbInfo.db=null}var O=new g(function(V,j){var z=T.deleteDatabase(n.name);z.onerror=function(){var q=z.result;q&&q.close(),j(z.error)},z.onblocked=function(){console.warn('dropInstance blocked for database "'+n.name+'" until all open connections are closed')},z.onsuccess=function(){var q=z.result;q&&q.close(),V(q)}});return O.then(function(V){y.db=V;for(var j=0;j<b.length;j++){var z=b[j];te(z._dbInfo)}}).catch(function(V){throw(ne(n,V)||g.resolve()).catch(function(){}),V})})}return I(d,s),d}var Oo={_driver:"asyncStorage",_initStorage:wo,_support:_(),iterate:So,getItem:To,setItem:Ro,removeItem:Ao,clear:ko,length:xo,key:Co,keys:Po,dropInstance:Do};function No(){return typeof openDatabase=="function"}var ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lo="~~local_forage_type~",Br=/^~~local_forage_type~([^~]+)~/,We="__lfsc__:",$t=We.length,Vt="arbf",jt="blob",Mr="si08",$r="ui08",Vr="uic8",jr="si16",Kr="si32",Hr="ur16",Gr="ui32",Jr="fl32",qr="fl64",Wr=$t+Vt.length,zr=Object.prototype.toString;function Yr(n){var s=n.length*.75,i=n.length,l,d=0,c,p,v,y;n[n.length-1]==="="&&(s--,n[n.length-2]==="="&&s--);var b=new ArrayBuffer(s),E=new Uint8Array(b);for(l=0;l<i;l+=4)c=ye.indexOf(n[l]),p=ye.indexOf(n[l+1]),v=ye.indexOf(n[l+2]),y=ye.indexOf(n[l+3]),E[d++]=c<<2|p>>4,E[d++]=(p&15)<<4|v>>2,E[d++]=(v&3)<<6|y&63;return b}function Kt(n){var s=new Uint8Array(n),i="",l;for(l=0;l<s.length;l+=3)i+=ye[s[l]>>2],i+=ye[(s[l]&3)<<4|s[l+1]>>4],i+=ye[(s[l+1]&15)<<2|s[l+2]>>6],i+=ye[s[l+2]&63];return s.length%3===2?i=i.substring(0,i.length-1)+"=":s.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function Fo(n,s){var i="";if(n&&(i=zr.call(n)),n&&(i==="[object ArrayBuffer]"||n.buffer&&zr.call(n.buffer)==="[object ArrayBuffer]")){var l,d=We;n instanceof ArrayBuffer?(l=n,d+=Vt):(l=n.buffer,i==="[object Int8Array]"?d+=Mr:i==="[object Uint8Array]"?d+=$r:i==="[object Uint8ClampedArray]"?d+=Vr:i==="[object Int16Array]"?d+=jr:i==="[object Uint16Array]"?d+=Hr:i==="[object Int32Array]"?d+=Kr:i==="[object Uint32Array]"?d+=Gr:i==="[object Float32Array]"?d+=Jr:i==="[object Float64Array]"?d+=qr:s(new Error("Failed to get type for BinaryArray"))),s(d+Kt(l))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var p=Lo+n.type+"~"+Kt(this.result);s(We+jt+p)},c.readAsArrayBuffer(n)}else try{s(JSON.stringify(n))}catch(p){console.error("Couldn't convert value into a JSON string: ",n),s(null,p)}}function Uo(n){if(n.substring(0,$t)!==We)return JSON.parse(n);var s=n.substring(Wr),i=n.substring($t,Wr),l;if(i===jt&&Br.test(s)){var d=s.match(Br);l=d[1],s=s.substring(d[0].length)}var c=Yr(s);switch(i){case Vt:return c;case jt:return S([c],{type:l});case Mr:return new Int8Array(c);case $r:return new Uint8Array(c);case Vr:return new Uint8ClampedArray(c);case jr:return new Int16Array(c);case Hr:return new Uint16Array(c);case Kr:return new Int32Array(c);case Gr:return new Uint32Array(c);case Jr:return new Float32Array(c);case qr:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var Ht={serialize:Fo,deserialize:Uo,stringToBuffer:Yr,bufferToString:Kt};function Qr(n,s,i,l){n.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function Bo(n){var s=this,i={db:null};if(n)for(var l in n)i[l]=typeof n[l]!="string"?n[l].toString():n[l];var d=new g(function(c,p){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(v){return p(v)}i.db.transaction(function(v){Qr(v,i,function(){s._dbInfo=i,c()},function(y,b){p(b)})},p)});return i.serializer=Ht,d}function be(n,s,i,l,d,c){n.executeSql(i,l,d,function(p,v){v.code===v.SYNTAX_ERR?p.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(y,b){b.rows.length?c(y,v):Qr(y,s,function(){y.executeSql(i,l,d,c)},c)},c):c(p,v)},c)}function Mo(n,s){var i=this;n=x(n);var l=new g(function(d,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(v){be(v,p,"SELECT * FROM "+p.storeName+" WHERE key = ? LIMIT 1",[n],function(y,b){var E=b.rows.length?b.rows.item(0).value:null;E&&(E=p.serializer.deserialize(E)),d(E)},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function $o(n,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(v){be(v,p,"SELECT * FROM "+p.storeName,[],function(y,b){for(var E=b.rows,R=E.length,O=0;O<R;O++){var V=E.item(O),j=V.value;if(j&&(j=p.serializer.deserialize(j)),j=n(j,V.key,O+1),j!==void 0){d(j);return}}d()},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Xr(n,s,i,l){var d=this;n=x(n);var c=new g(function(p,v){d.ready().then(function(){s===void 0&&(s=null);var y=s,b=d._dbInfo;b.serializer.serialize(s,function(E,R){R?v(R):b.db.transaction(function(O){be(O,b,"INSERT OR REPLACE INTO "+b.storeName+" (key, value) VALUES (?, ?)",[n,E],function(){p(y)},function(V,j){v(j)})},function(O){if(O.code===O.QUOTA_ERR){if(l>0){p(Xr.apply(d,[n,y,i,l-1]));return}v(O)}})})}).catch(v)});return I(c,i),c}function Vo(n,s,i){return Xr.apply(this,[n,s,i,1])}function jo(n,s){var i=this;n=x(n);var l=new g(function(d,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(v){be(v,p,"DELETE FROM "+p.storeName+" WHERE key = ?",[n],function(){d()},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Ko(n){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(p){be(p,c,"DELETE FROM "+c.storeName,[],function(){l()},function(v,y){d(y)})})}).catch(d)});return I(i,n),i}function Ho(n){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(p){be(p,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(v,y){var b=y.rows.item(0).c;l(b)},function(v,y){d(y)})})}).catch(d)});return I(i,n),i}function Go(n,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(v){be(v,p,"SELECT key FROM "+p.storeName+" WHERE id = ? LIMIT 1",[n+1],function(y,b){var E=b.rows.length?b.rows.item(0).key:null;d(E)},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Jo(n){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(p){be(p,c,"SELECT key FROM "+c.storeName,[],function(v,y){for(var b=[],E=0;E<y.rows.length;E++)b.push(y.rows.item(E).key);l(b)},function(v,y){d(y)})})}).catch(d)});return I(i,n),i}function qo(n){return new g(function(s,i){n.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(d,c){for(var p=[],v=0;v<c.rows.length;v++)p.push(c.rows.item(v).name);s({db:n,storeNames:p})},function(d,c){i(c)})},function(l){i(l)})})}function Wo(n,s){s=C.apply(this,arguments);var i=this.config();n=typeof n!="function"&&n||{},n.name||(n.name=n.name||i.name,n.storeName=n.storeName||i.storeName);var l=this,d;return n.name?d=new g(function(c){var p;n.name===i.name?p=l._dbInfo.db:p=openDatabase(n.name,"","",0),n.storeName?c({db:p,storeNames:[n.storeName]}):c(qo(p))}).then(function(c){return new g(function(p,v){c.db.transaction(function(y){function b(V){return new g(function(j,z){y.executeSql("DROP TABLE IF EXISTS "+V,[],function(){j()},function(q,ie){z(ie)})})}for(var E=[],R=0,O=c.storeNames.length;R<O;R++)E.push(b(c.storeNames[R]));g.all(E).then(function(){p()}).catch(function(V){v(V)})},function(y){v(y)})})}):d=g.reject("Invalid arguments"),I(d,s),d}var zo={_driver:"webSQLStorage",_initStorage:Bo,_support:No(),iterate:$o,getItem:Mo,setItem:Vo,removeItem:jo,clear:Ko,length:Ho,key:Go,keys:Jo,dropInstance:Wo};function Yo(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(n){return!1}}function Zr(n,s){var i=n.name+"/";return n.storeName!==s.storeName&&(i+=n.storeName+"/"),i}function Qo(){var n="_localforage_support_test";try{return localStorage.setItem(n,!0),localStorage.removeItem(n),!1}catch(s){return!0}}function Xo(){return!Qo()||localStorage.length>0}function Zo(n){var s=this,i={};if(n)for(var l in n)i[l]=n[l];return i.keyPrefix=Zr(n,s._defaultConfig),Xo()?(s._dbInfo=i,i.serializer=Ht,g.resolve()):g.reject()}function ei(n){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo.keyPrefix,d=localStorage.length-1;d>=0;d--){var c=localStorage.key(d);c.indexOf(l)===0&&localStorage.removeItem(c)}});return I(i,n),i}function ti(n,s){var i=this;n=x(n);var l=i.ready().then(function(){var d=i._dbInfo,c=localStorage.getItem(d.keyPrefix+n);return c&&(c=d.serializer.deserialize(c)),c});return I(l,s),l}function ri(n,s){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,c=d.keyPrefix,p=c.length,v=localStorage.length,y=1,b=0;b<v;b++){var E=localStorage.key(b);if(E.indexOf(c)===0){var R=localStorage.getItem(E);if(R&&(R=d.serializer.deserialize(R)),R=n(R,E.substring(p),y++),R!==void 0)return R}}});return I(l,s),l}function ni(n,s){var i=this,l=i.ready().then(function(){var d=i._dbInfo,c;try{c=localStorage.key(n)}catch(p){c=null}return c&&(c=c.substring(d.keyPrefix.length)),c});return I(l,s),l}function oi(n){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo,d=localStorage.length,c=[],p=0;p<d;p++){var v=localStorage.key(p);v.indexOf(l.keyPrefix)===0&&c.push(v.substring(l.keyPrefix.length))}return c});return I(i,n),i}function ii(n){var s=this,i=s.keys().then(function(l){return l.length});return I(i,n),i}function ai(n,s){var i=this;n=x(n);var l=i.ready().then(function(){var d=i._dbInfo;localStorage.removeItem(d.keyPrefix+n)});return I(l,s),l}function si(n,s,i){var l=this;n=x(n);var d=l.ready().then(function(){s===void 0&&(s=null);var c=s;return new g(function(p,v){var y=l._dbInfo;y.serializer.serialize(s,function(b,E){if(E)v(E);else try{localStorage.setItem(y.keyPrefix+n,b),p(c)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&v(R),v(R)}})})});return I(d,i),d}function ci(n,s){if(s=C.apply(this,arguments),n=typeof n!="function"&&n||{},!n.name){var i=this.config();n.name=n.name||i.name,n.storeName=n.storeName||i.storeName}var l=this,d;return n.name?d=new g(function(c){n.storeName?c(Zr(n,l._defaultConfig)):c(n.name+"/")}).then(function(c){for(var p=localStorage.length-1;p>=0;p--){var v=localStorage.key(p);v.indexOf(c)===0&&localStorage.removeItem(v)}}):d=g.reject("Invalid arguments"),I(d,s),d}var ui={_driver:"localStorageWrapper",_initStorage:Zo,_support:Yo(),iterate:ri,getItem:ti,setItem:si,removeItem:ai,clear:ei,length:ii,key:ni,keys:oi,dropInstance:ci},li=function(s,i){return s===i||typeof s=="number"&&typeof i=="number"&&isNaN(s)&&isNaN(i)},di=function(s,i){for(var l=s.length,d=0;d<l;){if(li(s[d],i))return!0;d++}return!1},en=Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},Fe={},tn={},Ae={INDEXEDDB:Oo,WEBSQL:zo,LOCALSTORAGE:ui},fi=[Ae.INDEXEDDB._driver,Ae.WEBSQL._driver,Ae.LOCALSTORAGE._driver],ze=["dropInstance"],Gt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ze),mi={description:"",driver:fi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function pi(n,s){n[s]=function(){var i=arguments;return n.ready().then(function(){return n[s].apply(n,i)})}}function Jt(){for(var n=1;n<arguments.length;n++){var s=arguments[n];if(s)for(var i in s)s.hasOwnProperty(i)&&(en(s[i])?arguments[0][i]=s[i].slice():arguments[0][i]=s[i])}return arguments[0]}var hi=function(){function n(s){m(this,n);for(var i in Ae)if(Ae.hasOwnProperty(i)){var l=Ae[i],d=l._driver;this[i]=d,Fe[d]||this.defineDriver(l)}this._defaultConfig=Jt({},mi),this._config=Jt({},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 n.prototype.config=function(i){if((typeof i=="undefined"?"undefined":f(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},n.prototype.defineDriver=function(i,l,d){var c=new g(function(p,v){try{var y=i._driver,b=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){v(b);return}for(var E=Gt.concat("_initStorage"),R=0,O=E.length;R<O;R++){var V=E[R],j=!di(ze,V);if((j||i[V])&&typeof i[V]!="function"){v(b);return}}var z=function(){for(var Ue=function(yi){return function(){var bi=new Error("Method "+yi+" is not implemented by the current driver"),rn=g.reject(bi);return I(rn,arguments[arguments.length-1]),rn}},qt=0,vi=ze.length;qt<vi;qt++){var Wt=ze[qt];i[Wt]||(i[Wt]=Ue(Wt))}};z();var q=function(Ue){Fe[y]&&console.info("Redefining LocalForage driver: "+y),Fe[y]=i,tn[y]=Ue,p()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(q,v):q(!!i._support):q(!0)}catch(ie){v(ie)}});return P(c,l,d),c},n.prototype.driver=function(){return this._driver||null},n.prototype.getDriver=function(i,l,d){var c=Fe[i]?g.resolve(Fe[i]):g.reject(new Error("Driver not found."));return P(c,l,d),c},n.prototype.getSerializer=function(i){var l=g.resolve(Ht);return P(l,i),l},n.prototype.ready=function(i){var l=this,d=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return P(d,i,i),d},n.prototype.setDriver=function(i,l,d){var c=this;en(i)||(i=[i]);var p=this._getSupportedDrivers(i);function v(){c._config.driver=c.driver()}function y(R){return c._extend(R),v(),c._ready=c._initStorage(c._config),c._ready}function b(R){return function(){var O=0;function V(){for(;O<R.length;){var j=R[O];return O++,c._dbInfo=null,c._ready=null,c.getDriver(j).then(y).catch(V)}v();var z=new Error("No available storage method found.");return c._driverSet=g.reject(z),c._driverSet}return V()}}var E=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=E.then(function(){var R=p[0];return c._dbInfo=null,c._ready=null,c.getDriver(R).then(function(O){c._driver=O._driver,v(),c._wrapLibraryMethodsWithReady(),c._initDriver=b(p)})}).catch(function(){v();var R=new Error("No available storage method found.");return c._driverSet=g.reject(R),c._driverSet}),P(this._driverSet,l,d),this._driverSet},n.prototype.supports=function(i){return!!tn[i]},n.prototype._extend=function(i){Jt(this,i)},n.prototype._getSupportedDrivers=function(i){for(var l=[],d=0,c=i.length;d<c;d++){var p=i[d];this.supports(p)&&l.push(p)}return l},n.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=Gt.length;i<l;i++)pi(this,Gt[i])},n.prototype.createInstance=function(i){return new n(i)},n}(),gi=new hi;a.exports=gi},{3:3}]},{},[4])(4)})});var no=sn(Se=>{"use strict";H();Ge();we();var Ce=ae(),ka=se("levelFinished",{paramsSchema:k.tuple(k.string(),k.object({result:k.boolean(),duration:k.number()})),implement:(e,t)=>L(Se,null,function*(){let{result:r,duration:o}=t;ce.info("onLevelFinished",r,o),yield Promise.all([le.reporter({event:"COMPLETE_GAME_LEVEL"}),le.tracker("LevelFinished",{levelId:e,result:r,duration:o})])})}),xa=se("taskFinished",{paramsSchema:k.tuple(k.string(),k.object({duration:k.number()})),implement:(e,t)=>L(Se,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),Ca=se("levelUpgrade",{paramsSchema:k.tuple(k.string(),k.string()),implement:(e,t)=>L(Se,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),Pa=se("onHistoryUserLevel",{paramsSchema:k.tuple(k.number()),implement:e=>L(Se,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),Da=se("onHistoryUserScore",{paramsSchema:k.tuple(k.number()),implement:e=>L(Se,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),Oa=se("taskEvent",{paramsSchema:k.tuple(k.string(),k.object({tools:k.array(k.object({id:k.string(),name:k.string(),count:k.number(),description:k.string().optional(),price:k.object({amount:k.number(),unit:k.string()}).optional()})).optional(),awards:k.array(k.object({id:k.string(),name:k.string()})).optional()})),implement:(e,t)=>L(Se,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([le.reporter({event:"USE_GAME_ITEM"}),le.tracker("UseGameItem",F({taskId:e},t))]))})});Ce.registerCommand("TaskTrackerSDK.levelFinished",ka);Ce.registerCommand("TaskTrackerSDK.taskFinished",xa);Ce.registerCommand("TaskTrackerSDK.levelUpgrade",Ca);Ce.registerCommand("TaskTrackerSDK.historyUserLevel",Pa);Ce.registerCommand("TaskTrackerSDK.historyUserScore",Da);Ce.registerCommand("TaskTrackerSDK.taskEvent",Oa);Q("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Q("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Q("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Q("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});we();re();Ge();H();var Xn=ae(),fa="env",ma="getSystemInfoSync",pa=()=>{var a,u,f,m;let e={system:A.deviceInfo.system,platform:A.deviceInfo.platform,brand:A.deviceInfo.brand,pixelRatio:A.deviceInfo.pixelRatio,language:A.deviceInfo.lang,version:A.sdkInfo.jssdkVersion,appName:(a=A.hostInfo)==null?void 0:a.appName,SDKVersion:A.sdkInfo.nativeSDKVersion},t=(u=A.hostInfo)==null?void 0:u.version;t&&(e=W(F({},e),{version:t}));let r=(f=A.hostInfo)==null?void 0:f.appName;r&&(e=W(F({},e),{appName:r}));let o=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return o&&(e=W(F({},e),{SDKVersion:o})),e},ha=Te(ma,{implement:pa}),ga=Te(fa,{implement:()=>W(F({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});Xn.registerCommand("API.env",ga);Xn.registerCommand("API.getSystemInfoSync",ha);Q("env",{version:"1.0.0"});Q("getSystemInfoSync",{version:"1.0.0"});H();Ge();Ee();we();var va="onJoliboxShow",ya="onJoliboxHide",ba="onReady",xr=ae(),Cr=In(ue),kr=!0,Je=!0,Rt=0,At=Er;function _a(){let e=Date.now();if(e-Rt<100)return;Rt=e;let t=document.visibilityState==="visible";t!==kr&&(kr=t,At.emit("visible",kr))}function Zn(e){let t=Date.now();t-Rt<100||(Rt=t,e==="focus"&&!Je?Je=!0:e==="blur"&&Je&&(Je=!1),At.emit("visible",Je))}document.addEventListener("visibilitychange",_a);window.addEventListener("focus",()=>Zn("focus"));window.addEventListener("blur",()=>Zn("blur"));var Ea=Te(va,{paramsSchema:k.tuple(k.function()),implement(e){let t=Cr(e);At.on("visible",r=>{r&&t()})}}),Ia=Te(ya,{paramsSchema:k.tuple(k.function()),implement(e){let t=Cr(e);At.on("visible",r=>{!r&&t()})}}),wa=Te(ba,{paramsSchema:k.tuple(k.function()),implement(e){let t=Cr(e);Ke.on("LifecycleEvent.onReady",r=>{t(r)})}});xr.registerCommand("LifecycleSDK.onReady",wa);xr.registerCommand("LifecycleSDK.onJoliboxShow",Ea);xr.registerCommand("LifecycleSDK.onJoliboxHide",Ia);Q("lifeCycle.onReady",{version:"1.0.0"});Q("lifeCycle.onJoliboxShow",{version:"1.0.0"});Q("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ge();H();He();re();var ro=cn(to());var kt=ae(),Dr=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=>L(this,null,function*(){let{code:r,data:o,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),u=o==null?void 0:o.value,f=a;return r!=="SUCCESS"&&(u=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",u),f+="fallback to localstorage"),{code:r,message:f,data:u&&u!=="undefined"?u:null}});this.setItem=(t,r)=>L(this,null,function*(){let o=typeof r=="string"?r:String(r),{code:a,message:u}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:o}});return yield this.gameStore.setItem(t,o),{code:a,message:u}});this.removeItem=t=>L(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:o}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:o}});this.clear=()=>L(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=ro.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},xt=new Dr,Ta=se("getLocalStorage",{paramsSchema:k.tuple(k.string()),implement(e){return L(this,null,function*(){return yield xt.getItem(e)})}});kt.registerCommand("StorageSDK.getItem",Ta);Q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Sa=se("setStorage",{paramsSchema:k.tuple(k.string(),k.or(k.string(),k.boolean(),k.number())),implement(e,t){return L(this,null,function*(){return yield xt.setItem(e,t)})}});kt.registerCommand("StorageSDK.setItem",Sa);Q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ra=se("removeStorage",{paramsSchema:k.tuple(k.string()),implement(e){return L(this,null,function*(){return yield xt.removeItem(e)})}});kt.registerCommand("StorageSDK.removeItem",Ra);Q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Aa=se("clearStorage",{implement(){return L(this,null,function*(){return yield xt.clear()})}});kt.registerCommand("StorageSDK.clear",Aa);Q("storage.clear",{version:"1.0.0"});var Ju=cn(no());var Ct=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};var Pt=class{constructor(t,r,o,a){this.track=t;this.httpClient=r;this.checkNetwork=o;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let o=this.checkShouldBanForSession(t);if(o)return{reason:o};let a=this.checkShouldBanHighFreq(t);if(a)return a;let u=this.checkShouldBanForTime(t);return u?{reason:u}:{reason:"ALLOWED"}};var g,I,P,x,C,D,U;let u=(g=a==null?void 0:a.maxAllowedAdsForTime)!=null?g:8,f=(I=a==null?void 0:a.banForTimeThreshold)!=null?I:6e4,m=(P=a==null?void 0:a.bannedReleaseTime)!=null?P:6e4,h=(x=a==null?void 0:a.maxAllowedAdsForSession)!=null?x:200,T=(C=a==null?void 0:a.banForSessionThreshold)!=null?C:6e5,_=(D=a==null?void 0:a.initialThreshold)!=null?D:2e3,S=(U=a==null?void 0:a.highFreqThreshold)!=null?U:2e3;this.checkShouldBanInitial=Fa(_),this.checkShouldBanHighFreq=Ua(S),this.checkShouldBanForTime=La(u,f,m),this.checkShouldBanForSession=Na(h,T)}report(t,r){let o=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",o),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:o}})}},Na=(e,t)=>{let r=!1,o=[];return u=>{if(r)return"BANNED_FOR_SESSION";let f=Date.now();if(o=o.concat({timestamp:f,type:u}),o.length!==1&&(o.length>e&&(o=o.slice(-e)),o.length===e&&f-o[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},La=(e,t,r)=>{let o=null,a=_=>{o&&(window.clearTimeout(o),o=null),o=window.setTimeout(()=>{h.value=!1,o=null},_)},u="jolibox-sdk-ads-callbreak-timestamps",f="jolibox-sdk-ads-ban-for-time",m={_records:[],init(){var _;try{let S=JSON.parse((_=window.localStorage.getItem(u))!=null?_:"[]");Array.isArray(S)?this._records=S:this._records=[]}catch(S){this._records=[]}},get values(){return this._records},set values(_){try{window.localStorage.setItem(u,JSON.stringify(_))}catch(S){}this._records=_}},h={_record:!1,init(){var _;try{let S=JSON.parse((_=window.localStorage.getItem(f))!=null?_:"false");typeof S=="boolean"&&(this._record=S)}catch(S){this._record=!1}if(this._record){let S=m.values[m.values.length-1],g=S?Date.now()-S.timestamp:r;g<=r&&g>0?a(g):this._record=!1}},get value(){return this._record},set value(_){try{window.localStorage.setItem(f,JSON.stringify(_))}catch(S){}this._record=_}};return m.init(),h.init(),_=>{if(h.value)return"WAITING_BANNED_RELEASE";let S=Date.now();if(m.values=m.values.concat({timestamp:S,type:_}),m.values.length!==1&&(m.values.length>e&&(m.values=m.values.slice(-e)),m.values.length===e&&S-m.values[0].timestamp<=t))return h.value=!0,a(r),"BANNED_FOR_TIME"}},Fa=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Ua=(e=2e3)=>{let t=0,r=null;return a=>{if(a==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}};re();re();var Dt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return L(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,o;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let a=(r=A.channel)!=null?r:"",u=this.configs[a],f=(o=u==null?void 0:u.interstitialRate)!=null?o:1;t=Math.random()<f}return this.firstRun=!1,t}};H();var Pe=new _e,Ot=class{constructor(t,r,o){this.track=t;this.httpClient=r;this.checkNetwork=o;this.configured=!1;this.config={};this.getGameId=()=>A.mpId;this.getTestAdsMode=()=>A.testAdsMode;this.asyncLoad=()=>L(this,null,function*(){var f,m,h,T,_;let t="ca-pub-7171363994453626",r,o,a=window.encodeURIComponent(window.btoa((f=this.getGameId())!=null?f:"")),u=(m=this.getTestAdsMode())!=null?m:!1;try{let S=yield this.httpClient.get("/public/ads",{query:{objectId:a,testAdsMode:`${u}`}});t=(h=S.data)==null?void 0:h.clientId,r=(T=S.data)==null?void 0:T.channelId,o=(_=S.data)==null?void 0:_.unitId}catch(S){console.error("Failed to fetch client info",S)}this.clientId=t,this.channelId=r,this.unitId=o});this.asyncInit=t=>L(this,null,function*(){var a;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",o=(a=this.getTestAdsMode())!=null?a:!1;if(!document.getElementById(r)&&this.clientId){let u=document.createElement("script");u.id=r,u.async=!0,u.crossOrigin="anonymous",u.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,o&&u.setAttribute("data-adbreak-test","on"),this.channelId&&u.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(u),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((o=>o.type==="preroll")(t)){Pe.emit("isAdShowing",!0);let o=t.adBreakDone,a=u=>{Pe.emit("isAdShowing",!1),o&&o(u)};return W(F({},t),{adBreakDone:a})}else{let o=t.beforeAd,a=t.afterAd,u=()=>{var m;Pe.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(m=t.name)!=null?m:""}),o&&o()},f=()=>{var m;Pe.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(m=t.name)!=null?m:""}),a&&a()};return W(F({},t),{beforeAd:u,afterAd:f})}};this.adConfig=t=>{let a=t,{onReady:r}=a,o=an(a,["onReady"]);this.track("CallAdConfig",o),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var T,_,S,g,I,P;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(T=t.adBreakDone)==null||T.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:o}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(_=t.adBreakDone)==null||_.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":(S=t.adBreakDone)==null||S.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(g=t.adBreakDone)==null||g.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),((I=o==null?void 0:o.count)!=null?I:0)===3&&this.antiCheating.report(r,o==null?void 0:o.count);return;default:break}let a=t.type,u=t.adBreakDone,f=x=>{var C;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:x.breakType,breakName:(C=x.breakName)!=null?C:"",breakFormat:x.breakFormat,breakStatus:x.breakStatus}),u&&u(x)};if(t.adBreakDone=f,t.type==="reward"){let x=t.beforeReward,C=U=>()=>{this.track("CallShowAdFn",null),U()},D=U=>{x&&x(C(U))};t.beforeReward=D}let m;switch(a){case"preroll":m={type:a};break;case"start":case"pause":case"next":case"browse":case"reward":m={type:a,name:(P=t.name)!=null?P:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",m);let h=this.wrapAdBreakParams(t);this.push(h),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>L(this,null,function*(){var g,I,P,x;if(this.track("CallAdUnit",{adFormat:(I=(g=t.adFormat)==null?void 0:g.toString())!=null?I:null,fullWidthResponsive:(P=t.fullWidthResponsive)!=null?P:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:o,adFormat:a,fullWidthResponsive:u,style:f}=t,m;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?m=document.querySelector(r):m=r,!m)throw new Error("targeting element not found");let h=o;if(h||(h=this.unitId),!h)throw new Error("slot is required");let T=typeof a=="object"&&Array.isArray(a)?a.join(", "):a,_=document.createElement("ins");if(_.className="adsbygoogle",_.id="jolibox-ads",_.style.display="block",_.setAttribute("data-ad-client",this.clientId),_.setAttribute("data-ad-slot",h),T&&_.setAttribute("data-ad-format",T),u&&_.setAttribute("data-full-width-responsive",u),f&&_.setAttribute("style",f),(x=this.getTestAdsMode())!=null?x:!1){let C=document.createElement("div");C.style.position="absolute",C.style.top="0",C.style.left="0",C.style.width="100%",C.style.height="100%",C.style.display="flex",C.style.justifyContent="center",C.style.alignItems="center",C.style.backgroundColor="rgba(0, 0, 0, 0.5)",C.style.color="white",C.innerHTML="Test Ad",_.style.position="relative",m.appendChild(_),_.appendChild(C)}else m.appendChild(_),new MutationObserver(D=>{D.forEach(U=>{if(U.type==="attributes"&&U.attributeName==="data-ad-status"){let B=_.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:B!=null?B:"null"})}})}).observe(_,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Pt(t,r,o),this.adsActionDetection=new Ct(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))}};we();H();He();var oo=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};var Nt=ae(),Ba=ge.create(),Lt=new Ot(de,Ba,()=>ge.getNetworkStatus());Pe.on("isAdShowing",e=>{oo("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Nt.registerCommand("AdsSDK.init",e=>{Lt.init(e)});Nt.registerCommand("AdsSDK.adConfig",e=>{Lt.adConfig(e)});Nt.registerCommand("AdsSDK.adBreak",e=>{Lt.adBreak(e)});Nt.registerCommand("AdsSDK.adUnit",e=>{Lt.adUnit(e)});H();we();var lo=-1,Ut=function(e){addEventListener("pageshow",function(t){t.persisted&&(lo=t.timeStamp,e(t))},!0)},Nr=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Bt=function(){var e=Nr();return e&&e.activationStart||0},Oe=function(e,t){var r=Nr(),o="navigate";return lo>=0?o="back-forward-cache":r&&(document.prerendering||Bt()>0?o="prerender":document.wasDiscarded?o="restore":r.type&&(o=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:o}},fo=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var o=new PerformanceObserver(function(a){Promise.resolve().then(function(){t(a.getEntries())})});return o.observe(Object.assign({type:e,buffered:!0},r||{})),o}}catch(a){}},Ne=function(e,t,r,o){var a,u;return function(f){t.value>=0&&(f||o)&&((u=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=u,t.rating=function(m,h){return m>h[1]?"poor":m>h[0]?"needs-improvement":"good"}(t.value,r),e(t))}},mo=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},po=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},ho=function(e){var t=!1;return function(){t||(e(),t=!0)}},De=-1,io=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Ft=function(e){document.visibilityState==="hidden"&&De>-1&&(De=e.type==="visibilitychange"?e.timeStamp:0,Ma())},ao=function(){addEventListener("visibilitychange",Ft,!0),addEventListener("prerenderingchange",Ft,!0)},Ma=function(){removeEventListener("visibilitychange",Ft,!0),removeEventListener("prerenderingchange",Ft,!0)},go=function(){return De<0&&(De=io(),ao(),Ut(function(){setTimeout(function(){De=io(),ao()},0)})),{get firstHiddenTime(){return De}}},Lr=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},so=[1800,3e3],vo=function(e,t){t=t||{},Lr(function(){var r,o=go(),a=Oe("FCP"),u=fo("paint",function(f){f.forEach(function(m){m.name==="first-contentful-paint"&&(u.disconnect(),m.startTime<o.firstHiddenTime&&(a.value=Math.max(m.startTime-Bt(),0),a.entries.push(m),r(!0)))})});u&&(r=Ne(e,a,so,t.reportAllChanges),Ut(function(f){a=Oe("FCP"),r=Ne(e,a,so,t.reportAllChanges),mo(function(){a.value=performance.now()-f.timeStamp,r(!0)})}))})};var $a=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=ho(e),document.visibilityState==="hidden"?e():(r=t(e),po(e)),r};var co=[2500,4e3],Or={},yo=function(e,t){t=t||{},Lr(function(){var r,o=go(),a=Oe("LCP"),u=function(h){t.reportAllChanges||(h=h.slice(-1)),h.forEach(function(T){T.startTime<o.firstHiddenTime&&(a.value=Math.max(T.startTime-Bt(),0),a.entries=[T],r())})},f=fo("largest-contentful-paint",u);if(f){r=Ne(e,a,co,t.reportAllChanges);var m=ho(function(){Or[a.id]||(u(f.takeRecords()),f.disconnect(),Or[a.id]=!0,r(!0))});["keydown","click"].forEach(function(h){addEventListener(h,function(){return $a(m)},{once:!0,capture:!0})}),po(m),Ut(function(h){a=Oe("LCP"),r=Ne(e,a,co,t.reportAllChanges),mo(function(){a.value=performance.now()-h.timeStamp,Or[a.id]=!0,r(!0)})})}})},uo=[800,1800],Va=function e(t){document.prerendering?Lr(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},bo=function(e,t){t=t||{};var r=Oe("TTFB"),o=Ne(e,r,uo,t.reportAllChanges);Va(function(){var a=Nr();a&&(r.value=Math.max(a.responseStart-Bt(),0),r.entries=[a],o(!0),Ut(function(){r=Oe("TTFB",0),(o=Ne(e,r,uo,t.reportAllChanges))(!0)}))})};re();function ja(){vo(e=>{de("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),yo(e=>{de("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),bo(e=>{de("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function Ka(){Ke.on("onDocumentReady",e=>{Ke.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function _o(){Ka(),ja()}_o();
1
+ var _i=Object.create;var zt=Object.defineProperty,Ei=Object.defineProperties,Ii=Object.getOwnPropertyDescriptor,wi=Object.getOwnPropertyDescriptors,Ti=Object.getOwnPropertyNames,Ye=Object.getOwnPropertySymbols,Si=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,on=Object.prototype.propertyIsEnumerable;var nn=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F=(e,t)=>{for(var r in t||(t={}))Yt.call(t,r)&&nn(e,r,t[r]);if(Ye)for(var r of Ye(t))on.call(t,r)&&nn(e,r,t[r]);return e},W=(e,t)=>Ei(e,wi(t));var Be=(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 an=(e,t)=>{var r={};for(var n in e)Yt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ye)for(var n of Ye(e))t.indexOf(n)<0&&on.call(e,n)&&(r[n]=e[n]);return r};var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var sn=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ri=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ti(t))!Yt.call(e,a)&&a!==r&&zt(e,a,{get:()=>t[a],enumerable:!(n=Ii(t,a))||n.enumerable});return e};var cn=(e,t,r)=>(r=e!=null?_i(Si(e)):{},Ri(t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r,e));var L=(e,t,r)=>new Promise((n,a)=>{var u=h=>{try{m(r.next(h))}catch(T){a(T)}},f=h=>{try{m(r.throw(h))}catch(T){a(T)}},m=h=>h.done?n(h.value):Promise.resolve(h.value).then(u,f);m((r=r.apply(e,t)).next())});function xi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function tr(e){return typeof e=="string"}function mn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function pn(e){return typeof e=="object"&&Array.isArray(e)}function Ci(e){return typeof e>"u"}function Pi(e){return Ci(e)||e===null}function Di(e){return typeof e=="function"}function hn(e){let t=e,r=null,n=function(...a){return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}function gn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(a,u){for(let f in u)if(Object.prototype.hasOwnProperty.call(u,f)){let m=a[f],h=u[f],T=r(m,h,f,a,u);T!==void 0?a[f]=T:un(h)&&un(m)?a[f]=n(F({},m),h):Array.isArray(h)&&Array.isArray(m)?a[f]=[...m,...h]:a[f]=h}return a}return n(e,t)}function un(e){return e&&typeof e=="object"&&e.constructor===Object}function vn(e,t){if(Array.isArray(e))return e.concat(t)}function Ve(e,t,r={}){let n=null,a,u,f,{leading:m=!1,trailing:h=!0}=r,T=()=>(f=e.apply(u,a),a=void 0,u=void 0,f),_=function(...S){a=S,u=this;let g=m&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,h&&!g&&T()},t),g)return T()};return _.cancel=()=>{n&&clearTimeout(n),n=null,a=u=void 0},_.flush=()=>{if(n)return clearTimeout(n),n=null,T()},_}function Li(e,t){return(...r)=>t(e,...r)}function In(e){return t=>Li(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(a){e(new Ni(`${a}`))}})}function Me(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Ze(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((a,u)=>(a[u]=String(n[u]),a),{})}return e[r]})}function $i(e){let t=e.location?Ze(e.location,ln):null,r=e.target?Ze(e.target,ln):null;return Ze(W(F({},e),{location:t,target:r}),Bi)}function ar(e){let t=e.events.map(n=>$i(n)),r=Ze(e.device,Mi);return[e.protocolVersion,t,r,e.project]}function Qi(e){return new Promise(t=>Rn(e)(t))}function Rn(e){return(t,r=null)=>{let n=!1;return e(a=>{if(!n)return n=!0,t.call(r,a)},null)}}function Xi(e,t){return(r=>{let n,a={onWillAddFirstListener(){n=r(u.fire,u)}},u=new $e(a);return u.event})((r,n=null)=>e(a=>t(a)&&r.call(n,a),null))}function ea(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ta(e[n],t[n])}function ta(e,t){if(tr(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Di(t)){try{if(e instanceof t)return}catch(r){}if(!Pi(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function ae(){if(globalThis[Xt])return globalThis[Xt];let e=new et,t=new er,r={registerCommand(n,a,u){e.registerCommand({id:n,handler:a,metadata:u})},executeCommand(n,...a){return t.executeCommand(n,...a)},excuteCommandSync(n,...a){return t.executeCommandThowErr(n,...a)}};return globalThis[Xt]=r,r}var dn,Ai,ki,fn,Oi,rr,nr,yn,bn,Ni,_n,En,tt,or,ce,wn,Fi,ir,je,ke,Ui,ln,Bi,Mi,Vi,Qe,ji,Ki,Hi,Tn,sr,Gi,Ji,qi,Sn,pe,J,Wi,zi,Xe,$e,_e,Zt,Yi,Qt,Zi,Ke,et,er,Xt,H=G(()=>{"use strict";dn=Object.defineProperty,Ai=Object.getOwnPropertyDescriptor,ki=(e,t)=>{for(var r in t)dn(e,r,{get:t[r],enumerable:!0})},fn=(e,t,r,n)=>{for(var a=n>1?void 0:n?Ai(t,r):t,u=e.length-1,f;u>=0;u--)(f=e[u])&&(a=(n?f(t,r,a):f(a))||a);return n&&a&&dn(t,r,a),a};Oi=(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))(Oi||{}),rr=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}},nr=class extends rr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},yn=class extends rr{constructor(){super(...arguments),this.kind="USER_ERROR"}},bn=class extends yn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Ni=class extends yn{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))}},_n=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},En=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},tt=class extends rr{constructor(e,t,r,n,a){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},or=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:Me("log"),warn:Me("warn"),info:Me("info"),error:Me("error"),debug:Me("debug")};Object.assign(globalThis,{logger:ce});wn=Symbol.for("Jolibox.canIUseMap"),Fi={};globalThis[wn]=Fi;ir={get config(){return globalThis[wn]}},je=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(je||{}),ke=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(ke||{}),Ui=(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))(Ui||{}),ln=["name","params"],Bi=["name","type","location","target","extra","timestamp","userId"],Mi=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Vi=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Qe={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")},ji=()=>Qe.isiOS?"iOS":Qe.isAndroid?"Android":Qe.isMac?"Mac":Qe.isFacebook?"Facebook":"PC",Ki="device_id",Hi="advertising_id",Tn=e=>(localStorage.getItem(e)||localStorage.setItem(e,Vi()),localStorage.getItem(e)),sr=()=>Tn(Ki),Gi=()=>Tn(Hi),Ji=e=>e.charAt(0).toUpperCase()+e.slice(1),qi=()=>{var t;let e=new URLSearchParams(window.location.search);return Ji((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Sn=e=>{let t="JoliboxWebSDK",r=ji(),n=navigator.language,a=sr(),u=Gi();return`${t} (${qi()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${a} adid/${u} version/${e||""}`},J=(pe=class{constructor(t){this.element=t,this.next=pe.Undefined,this.prev=pe.Undefined}},pe.Undefined=new pe(void 0),pe),Wi=class{constructor(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===J.Undefined}clear(){let e=this._first;for(;e!==J.Undefined;){let t=e.next;e.prev=J.Undefined,e.next=J.Undefined,e=t}this._first=J.Undefined,this._last=J.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new J(e);if(this._first===J.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==J.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==J.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==J.Undefined&&e.next!==J.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===J.Undefined&&e.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):e.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):e.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==J.Undefined;)yield e.element,e=e.next}},zi=0,Xe=class{constructor(e){this.value=e,this.id=zi++}},$e=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Xe&&(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 a,u,f,m,h,T;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new Xe(t);this._listeners?this._listeners instanceof Xe?this._listeners=[this._listeners,n]:this._listeners.push(n):((u=(a=this.options)==null?void 0:a.onWillAddFirstListener)==null||u.call(a,this),this._listeners=n,(m=(f=this.options)==null?void 0:f.onDidFirstListener)==null||m.call(f,this)),(T=(h=this.options)==null?void 0:h.onDidAddListener)==null||T.call(h,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(a){r(a)}}fire(e){this._listeners&&(this._listeners instanceof Xe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},_e=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var u;let r=(u=this.listeners.get(e))!=null?u:new $e,n=f=>t(...f.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let a=this.cachedEventQueue.get(e);if(a)for(;a.size>0;)r.fire(F({event:e},a.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new Wi,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},Zt={};ki(Zt,{None:()=>Yi,filter:()=>Xi,once:()=>Rn,toPromise:()=>Qi});Yi=()=>{console.log("[Jolibox SDK] None Event")};Qt=Symbol.for("Jolibox.hostEmitter"),Zi=()=>{let e=new _e;return globalThis[Qt]||(globalThis[Qt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Qt]},Ke=Zi();et=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new $e,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let a of e.metadata.args)r.push(a.constraint);let n=e.handler;e.handler=function(...a){return ea(a,r),n(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};et=fn([hn],et);er=class{constructor(){this._onWillExecuteCommand=new $e,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new $e,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new et,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=xi(3e4)),this._starActivation}executeCommand(e,...t){return L(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Zt.toPromise(Zt.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};er=fn([hn],er);Xt=Symbol.for("Jolibox.commands")});function ue(e,t={}){cr.emit("ERROR_REPORT",{error:e,options:t})}var cr,Ie,Ee=G(()=>{"use strict";H();H();cr=new _e,Ie=new _e;ue.debounce=Ve(ue,50,{leading:!0})});var ur,lr,An,kn,xn=G(()=>{"use strict";H();Ee();ur=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(a){return{}}},lr=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},An=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[u,f,m]=a;return{headerJson:ur(u),payloadJson:ur(f),signature:ur(m)}}else throw"joli_source is missing"}catch(r){return ue(new _n(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},kn=e=>{let{headerJson:t,payloadJson:r,signature:n}=e,a=lr(t),u=lr(r),f=lr(n);return`${a}.${u}.${f}`}});var ra,rt,Cn,dr=G(()=>{"use strict";H();ra="1.1.11-beta.5",rt=()=>ra,Cn=()=>{let e=rt();return`${Sn(e)}`}});var na,Pn,fr,Dn,Z,oa,A,re=G(()=>{"use strict";H();xn();dr();H();na={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:sr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:rt()},schema:window.location.href,platform:"h5"},fr=(Pn=globalThis.joliboxJSCore)==null?void 0:Pn.env,Z=Object.assign({},(Dn=fr==null?void 0:fr())!=null?Dn:na),oa=()=>{var g,I,P,x,C,D,U,B,ee;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?An(Z.schema):{},n=`${Z.deviceInfo.did}-${new Date().getTime()}`,u=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,f=(P=(I=(g=u.get("mpId"))!=null?g:u.get("appId"))!=null?I:u.get("gameId"))!=null?P:"",m=(D=(C=(x=Z.clientSessionId)!=null?x:e==null?void 0:e.sessionId)!=null?C:u.get("sessionId"))!=null?D:n,h=!!((U=e==null?void 0:e.testAdsMode)!=null?U:u.get("testAdsMode")==="true"),T=(ee=(B=e==null?void 0:e.joliboxEnv)!=null?B:u.get("joliboxEnv"))!=null?ee:"production",_=T==="staging",S=t==null?void 0:t.channel;return{get testMode(){return _},get testAdsMode(){return h},get joliboxEnv(){return T},get joliSource(){var M;return(M=u.get("joliSource"))!=null?M:null},get mpId(){var M;return(M=f!=null?f:e==null?void 0:e.id)!=null?M:""},get mpVersion(){var M;return(M=t==null?void 0:t.ver)!=null?M:rt()},get mpType(){var M,w;return(w=(M=t==null?void 0:t.__mpType)!=null?M:e==null?void 0:e.__mpType)!=null?w:"game"},get platform(){var M;return(M=Z.platform)!=null?M:Z.deviceInfo.platform},get deviceInfo(){return Z.deviceInfo},get sdkInfo(){return Z.sdkInfo},get hostInfo(){return Z.hostInfo},get hostUserInfo(){return Z.hostUserInfo},get sessionId(){var M,w;return(w=(M=Z.clientSessionId)!=null?M:m)!=null?w:n},get channel(){return S},get webviewId(){var M;return(M=Z.webviewId)!=null?M:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:M=>{gn(Z,M,vn)},encodeJoliSourceQuery:M=>{var w;return t&&r?kn({headerJson:t,payloadJson:F(F({},e),M),signature:r}):(w=u.get("joliSource"))!=null?w:""}}},A=oa()});var mr,Nn,ia,aa,On,sa,Ln=G(()=>{"use strict";H();Ee();re();H();mr=!1,Nn=(e,t)=>e==null?!1:t in e,ia=e=>Nn(e,"kind"),aa=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},On=(e,t={},r)=>{var u,f,m;let n={user_id:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:aa(e.name)},a=W(F({},n),{env:t.environment,isFromUser:r});r?Ie.emit("GLOBAL_USER_ERROR",e,a):Ie.emit("GLOBAL_ERROR",e,a)},sa=e=>Nn(e,"kind")&&e.kind==="USER_ERROR";cr.on("ERROR_REPORT",({error:e,options:t})=>{if(mr)return;mr=!0;let r=ia(e)&&e.raw?e.raw:e;try{let n=sa(e);On(e,t,n)}catch(n){let a=n instanceof Error?n.message:String(n),u=new or(`${a}, origin error: ${r.message}`);ce.error(u),On(new or(u.message),{environment:t.environment},!1)}finally{mr=!1}})});var pr,hr=G(()=>{"use strict";Ee();H();Ee();pr=e=>new bn(e)});function Fn(e,t){let r=(n,a,u)=>{let f=W(F({tag:n},t),{extra:F({},a)});n=="globalJsError"?ue(new En(JSON.stringify(f))):e("systemLog",f,u)};return r.debounce=Ve(r,500,{leading:!0}),r}function Un(e){let t=(r,n,a)=>{var m;let u=(m=a&&JSON.stringify(a))!=null?m:0,f={speed_value_type:r,total_duration:n};u&&Object.assign(f,{extra:u}),e("joliboxSpeedAnalysis",f)};return t.debounce=Ve(t,500,{leading:!0}),t}var Bn=G(()=>{"use strict";H();H();Ee()});function Mn(e,t){let r=Fn(e,t),n=Un(r);return{track:r,trackPerformance:n}}var $n=G(()=>{"use strict";Bn()});var gr=G(()=>{"use strict"});var nt,Vn=G(()=>{"use strict";re();H();H();nt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return L(this,null,function*(){let r=`${A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,a]of Object.entries(r))if(a.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,a,u,f,m;let{nativeSDKVersion:t,jssdkVersion:r}=A.sdkInfo;return{platform:1e3,os:A.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(u=(a=A.hostInfo)==null?void 0:a.aid)!=null?u:"1",model:(f=A.deviceInfo.model)!=null?f:"UnknownModel",brand:(m=A.deviceInfo.brand)!=null?m:"UnknownBrand",uuid:A.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,a)=>{r[a]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return L(this,null,function*(){if(this.checkIsSampled(t))return;let a=t.location?t.location:yield this.getLocation(),u=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,T={protocolVersion:"1.0.0",events:[W(F({},t),{location:a,target:u,extra:f,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(ar(T),n):yield this.doReport(ar(T))}catch(_){ce.log("[Jolibox SDK] report API error",_)}})}}});var vr=G(()=>{"use strict";$n();gr();Vn()});var yr,jn,he,ot,ge,He=G(()=>{"use strict";dr();re();yr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(jn=AbortSignal.timeout)!=null||(AbortSignal.timeout=yr);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 ot(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}},ot=class{constructor(t){this.xua=Cn();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 L(this,null,function*(){try{let{query:n,timeout:a}=r!=null?r:{},{headers:u}=r!=null?r:{},f=n?new URLSearchParams(n):null,m=f==null?void 0:f.toString(),h=`${this.baseUrl}${t}${m?`?${m}`:""}`,T=this.xua,_=this.getJoliSource();u=Object.assign({},u!=null?u:{},T?{"x-user-agent":T}:{},_?{"x-joli-source":_}:{});let S=yield fetch(h,{method:"GET",headers:u,credentials:"include",signal:yr(a!=null?a:3e4)});return he.getInstance().recordNetworkRequest(!0),yield S.json()}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return L(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,h=m==null?void 0:m.toString(),T=`${this.baseUrl}${t}${h?`?${h}`:""}`,_=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},S?{"x-joli-source":S}:{});let g=yield fetch(T,{method:"POST",headers:f,body:JSON.stringify(n),signal:yr(u!=null?u:3e4),credentials:"include"});he.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(I!=null&&I.includes("multipart/form-data")||I!=null&&I.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(n){throw he.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return L(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,h=m==null?void 0:m.toString(),T=`${this.baseUrl}${t}${h?`?${h}`:""}`,_=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},S?{"x-joli-source":S}:{});let g=yield fetch(T,{method:"PUT",headers:f,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=ot;ge=he.getInstance()});var br,it,_r=G(()=>{"use strict";re();vr();He();br=class extends nt{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,a;let r=(n=this.hostToApiMap[window.location.host])!=null?n:this.hostToApiMap.default;return(a=A.testMode)!=null&&a?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},it=new br});var ca,Kn=G(()=>{"use strict";Ln();H();hr();H();_r();re();ca=(e,t)=>{var a,u,f;let r={message:t.message,stack:(a=t.stack)!=null?a:"",errorType:t.name,source:0},n={name:e,type:je.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:null};it.trackEvent(n,ke.WebSDK)};Ie.on("GLOBAL_ERROR",(e,t)=>{ca(t.tag,e)});Ie.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var at,Hn=G(()=>{"use strict";at=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,a,u=!1,f=0,m=()=>{if(!u)return;let I=Date.now(),P=I-r;P>=this.interval&&(this.visible&&(f+=P,t(f)),r=I),n=requestAnimationFrame(m)},h=()=>{_(),r=Date.now(),a=window.setInterval(()=>{if(!u)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},T=()=>{S(),r=Date.now(),n=requestAnimationFrame(m)},_=()=>{n&&(cancelAnimationFrame(n),n=0)},S=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",I=>{u&&(console.log("visible",I),I?T():h())});let g=this.visible;return{start(){u||(u=!0,g?T():h())},stop(){u=!1,_(),S()}}}}});var st,Gn=G(()=>{"use strict";re();Hn();He();st=class extends at{constructor(r,n,a){super(n,a);this.httpClient=ge.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return L(this,null,function*(){let{event:n,params:a}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:F({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,n=null){this.track(r,n)}}});var Jn,ua,de,la,Er,le,we=G(()=>{"use strict";Kn();H();H();vr();_r();Gn();re();gr();Jn=ae(),ua={type:ke.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:de,trackPerformance:la}=Mn((...e)=>{var f,m,h,T;let[,t]=e,r=t,n=mn(r.extra)?r.extra:tr(r.extra)?JSON.parse(r.extra):{},a=W(F({},n),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(m=r.mp_version)!=null?m:""}),u={name:t.tag,type:je.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(T=(h=A.hostUserInfo)==null?void 0:h.uid)!=null?T:null};it.trackEvent(u,ke.WebSDK)},ua);Jn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{la(e,t,r)});Jn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{de(e,t)});Er=new _e,le=new st(de,Er)});function qn(e){let t=ir.config[e];return t||(t={},ir.config[e]=t),(r,n)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=F({},n)}}var Wn=G(()=>{"use strict";H()});function Ir(e){zn=e}function ct(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>ct(t)):Object.keys(e).reduce((t,r)=>(t[r]=ct(e[r]),t),{})}function ve(e){return typeof e=="number"}function wr(e){let t=Tr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Tr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var zn,Y,ut,lt,dt,ft,xe,mt,pt,ht,gt,vt,yt,bt,_t,Et,It,wt,Tt,Sr=G(()=>{"use strict";zn=!1;Y=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(zn)if(typeof t=="string")this.errors.push(t);else{let r=`${this.path} should be ${t.expect}`;this._optional&&t.expect!=="undefined"?r+=" or undefined, ":r+=", ",r+=`but got ${wr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return ct(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:ct(this._default)}optional(){return this._optional=!0,this}};ut=class extends Y{validate(t){return this._optional&&t===void 0?!0:ve(t)?ve(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ve(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ve(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},lt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},dt=class extends Y{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ve(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ve(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},ft=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},xe=class extends Y{validate(t){return!0}},mt=class extends Y{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},pt=class extends Y{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ht=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},gt=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${wr(t)}`)}return!0}},vt=class extends Y{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ve(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ve(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ve(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let a=!0;if(r.forEach((u,f)=>{if(n.path=`${this.path}[${f}]`,n.errors=this.errors,u===void 0&&n.hasDefault){r[f]=n.defaultValue;return}n.validate(u)||(n.hasFallback?r[f]=n.fallbackValue:a=!1)}),this._uniqueItems){let u=new Map;for(let f in r)u.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${u.get(r[f])}] and ${this.path}[${f}] are identical)`):u.set(r[f],f)}return a}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},yt=class extends Y{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Tr(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,u=this._value;u.errors=this.errors;let f=!0;for(let m in a){let h=a[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?u.path=`${this.path}.${m}`:u.path=`${this.path}["${m}"]`,!(h===void 0&&u._optional)){if(h===void 0&&u.hasDefault){a[m]=u.defaultValue;continue}u.validate(h)||(u.hasFallback?a[m]=u.fallbackValue:f=!1)}}return f}},bt=class extends Y{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Tr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,a=!0;for(let u in this._object){let f=n[u],m=this._object[u];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(u)?m.path=`${this.path}.${u}`:m.path=`${this.path}["${u}"]`,!(m._optional&&f===void 0)){if(f===void 0&&m.hasDefault){n[u]=m.defaultValue;continue}m.validate(f)||(m.hasFallback?n[u]=m.fallbackValue:a=!1)}}return a}},_t=class extends Y{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:wr(this.value),actual:r}):!0}},Et=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,a=this._items.length;for(let u=0;u<a;u++){let f=this._items[u];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!n){n=!0;break}}if(!n){let u=r.join(`
2
+ or `);this.errors.push(u)}return n}},It=class extends Y{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let a=t[n];if(a._optional||a.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,t[a]===void 0&&n.hasDefault){t[a]=n.defaultValue;return}n.validate(t[a])||(n.hasFallback?t[a]=n._fallback:r=!1)}),r}},wt=class extends Y{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},Tt=class extends Y{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 Rr(e,t,r="param"){if(e.errors=[],e.path=r,Ir(!0),!e.validate(t)){let n=e.errors.join(`
3
+ `);throw e.errors.length=0,Ir(!1),new TypeError(n)}}var k,Ar=G(()=>{"use strict";Sr();Sr();k={object(e){return new bt(e)},array(e){return new vt(e)},tuple(...e){return new It(...e)},literal(e){return new _t(e)},or(...e){return new Et(...e)},symbol(){return new ft},record(e){return new yt(e)},function(){return new ht},boolean(){return new lt},string(){return new dt},number(){return new ut},undefined(){return new mt},null(){return new pt},unknown(){return new xe},any(){return new xe},as(){return new xe},arraybuffer(){return new wt},enum(...e){return new gt(...e)},typedarray(e){return new Tt(e)}}});var St,Yn,Qn=G(()=>{"use strict";H();Ee();Ar();hr();St=1,Yn=e=>{function t(n,a){return(...u)=>{var S,g,I,P;let f=Date.now(),m={method:n,trace_id:St};St+=1;let h="SUCCESS",T=`${n}:ok`,_=0;try{if(a.paramsSchema)try{Rr(a.paramsSchema,u,"params")}catch(U){throw pr(`${n}:fail ${U.message}`)}let x=a.implement(...u),C=x,D=`${n}:ok`;if(x&&"code"in x){let{code:U,data:B,message:ee}=x;h=U,C=B,D=ee}return{code:h,message:D,data:C}}catch(x){let C=x;_=(g=(S=C.code)!=null?S:C.errNo)!=null?g:2e3,h="FAILURE";let D=(P=(I=C.message)!=null?I:C.errMsg)!=null?P:`${x}`;return T=`${n}:${h} ${D.replace(/^\S+:(fail|cancel)\s?/,"")}`,ue(new tt(T,_)),{code:h,message:T}}finally{let x=Date.now()-f;e("apiInvoked",W(F({},m),{duration:x,status:h}))}}}function r(n,a){return(...u)=>L(this,null,function*(){var g,I,P,x;let f=pn(u)?u:[u],m=Date.now(),h={method:n,trace_id:St};St+=1;let T=`${n}:ok`,_="SUCCESS",S={code:_,message:T};try{if(a.paramsSchema)try{Rr(a.paramsSchema,f,"params")}catch(U){throw pr(U.message)}let D=yield a.implement(...f);if(D&&"code"in D){let{code:U,data:B,message:ee}=D;_=U,T=ee,D=B}return Object.assign(S,{code:_,message:T,data:D}),S}catch(C){let D=C,U=(I=(g=D.code)!=null?g:D.errNo)!=null?I:2e3;_="FAILURE";let B=(x=(P=D.message)!=null?P:D.errMsg)!=null?x:`${C}`,ee=`${n}:${_} ${B.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(S,{code:_,message:ee}),ue(new tt(ee,U)),S}finally{let C=Date.now()-m;e("apiInvoked",W(F({},h),{duration:C,status:_}))}})}return{createAPI:r,createSyncAPI:t}}});var se,Te,Q,Ge=G(()=>{"use strict";Wn();we();Qn();Ar();({createAPI:se,createSyncAPI:Te}=Yn(de)),Q=qn("h5")});var to=sn((eo,Pr)=>{(function(e){if(typeof eo=="object"&&typeof Pr!="undefined")Pr.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(a,u,f){function m(_,S){if(!u[_]){if(!a[_]){var g=typeof Be=="function"&&Be;if(!S&&g)return g(_,!0);if(h)return h(_,!0);var I=new Error("Cannot find module '"+_+"'");throw I.code="MODULE_NOT_FOUND",I}var P=u[_]={exports:{}};a[_][0].call(P.exports,function(x){var C=a[_][1][x];return m(C||x)},P,P.exports,n,a,u,f)}return u[_].exports}for(var h=typeof Be=="function"&&Be,T=0;T<f.length;T++)m(f[T]);return m}({1:[function(n,a,u){(function(f){"use strict";var m=f.MutationObserver||f.WebKitMutationObserver,h;if(m){var T=0,_=new m(x),S=f.document.createTextNode("");_.observe(S,{characterData:!0}),h=function(){S.data=T=++T%2}}else if(!f.setImmediate&&typeof f.MessageChannel!="undefined"){var g=new f.MessageChannel;g.port1.onmessage=x,h=function(){g.port2.postMessage(0)}}else"document"in f&&"onreadystatechange"in f.document.createElement("script")?h=function(){var D=f.document.createElement("script");D.onreadystatechange=function(){x(),D.onreadystatechange=null,D.parentNode.removeChild(D),D=null},f.document.documentElement.appendChild(D)}:h=function(){setTimeout(x,0)};var I,P=[];function x(){I=!0;for(var D,U,B=P.length;B;){for(U=P,P=[],D=-1;++D<B;)U[D]();B=P.length}I=!1}a.exports=C;function C(D){P.push(D)===1&&!I&&h()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,a,u){"use strict";var f=n(1);function m(){}var h={},T=["REJECTED"],_=["FULFILLED"],S=["PENDING"];a.exports=g;function g(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=S,this.queue=[],this.outcome=void 0,w!==m&&C(this,w)}g.prototype.catch=function(w){return this.then(null,w)},g.prototype.then=function(w,$){if(typeof w!="function"&&this.state===_||typeof $!="function"&&this.state===T)return this;var N=new this.constructor(m);if(this.state!==S){var K=this.state===_?w:$;P(N,K,this.outcome)}else this.queue.push(new I(N,w,$));return N};function I(w,$,N){this.promise=w,typeof $=="function"&&(this.onFulfilled=$,this.callFulfilled=this.otherCallFulfilled),typeof N=="function"&&(this.onRejected=N,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(w){h.resolve(this.promise,w)},I.prototype.otherCallFulfilled=function(w){P(this.promise,this.onFulfilled,w)},I.prototype.callRejected=function(w){h.reject(this.promise,w)},I.prototype.otherCallRejected=function(w){P(this.promise,this.onRejected,w)};function P(w,$,N){f(function(){var K;try{K=$(N)}catch(X){return h.reject(w,X)}K===w?h.reject(w,new TypeError("Cannot resolve promise with itself")):h.resolve(w,K)})}h.resolve=function(w,$){var N=D(x,$);if(N.status==="error")return h.reject(w,N.value);var K=N.value;if(K)C(w,K);else{w.state=_,w.outcome=$;for(var X=-1,te=w.queue.length;++X<te;)w.queue[X].callFulfilled($)}return w},h.reject=function(w,$){w.state=T,w.outcome=$;for(var N=-1,K=w.queue.length;++N<K;)w.queue[N].callRejected($);return w};function x(w){var $=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof $=="function")return function(){$.apply(w,arguments)}}function C(w,$){var N=!1;function K(oe){N||(N=!0,h.reject(w,oe))}function X(oe){N||(N=!0,h.resolve(w,oe))}function te(){$(X,K)}var ne=D(te);ne.status==="error"&&K(ne.value)}function D(w,$){var N={};try{N.value=w($),N.status="success"}catch(K){N.status="error",N.value=K}return N}g.resolve=U;function U(w){return w instanceof this?w:h.resolve(new this(m),w)}g.reject=B;function B(w){var $=new this(m);return h.reject($,w)}g.all=ee;function ee(w){var $=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=w.length,K=!1;if(!N)return this.resolve([]);for(var X=new Array(N),te=0,ne=-1,oe=new this(m);++ne<N;)fe(w[ne],ne);return oe;function fe(Le,qe){$.resolve(Le).then(Mt,function(Re){K||(K=!0,h.reject(oe,Re))});function Mt(Re){X[qe]=Re,++te===N&&!K&&(K=!0,h.resolve(oe,X))}}}g.race=M;function M(w){var $=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=w.length,K=!1;if(!N)return this.resolve([]);for(var X=-1,te=new this(m);++X<N;)ne(w[X]);return te;function ne(oe){$.resolve(oe).then(function(fe){K||(K=!0,h.resolve(te,fe))},function(fe){K||(K=!0,h.reject(te,fe))})}}},{1:1}],3:[function(n,a,u){(function(f){"use strict";typeof f.Promise!="function"&&(f.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,a,u){"use strict";var f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function m(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}function h(){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 T=h();function _(){try{if(!T||!T.open)return!1;var o=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),s=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!o||s)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function S(o,s){o=o||[],s=s||{};try{return new Blob(o,s)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new i,d=0;d<o.length;d+=1)l.append(o[d]);return l.getBlob(s.type)}}typeof Promise=="undefined"&&n(3);var g=Promise;function I(o,s){s&&o.then(function(i){s(null,i)},function(i){s(i)})}function P(o,s,i){typeof s=="function"&&o.then(s),typeof i=="function"&&o.catch(i)}function x(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function C(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var D="local-forage-detect-blob-support",U=void 0,B={},ee=Object.prototype.toString,M="readonly",w="readwrite";function $(o){for(var s=o.length,i=new ArrayBuffer(s),l=new Uint8Array(i),d=0;d<s;d++)l[d]=o.charCodeAt(d);return i}function N(o){return new g(function(s){var i=o.transaction(D,w),l=S([""]);i.objectStore(D).put(l,"key"),i.onabort=function(d){d.preventDefault(),d.stopPropagation(),s(!1)},i.oncomplete=function(){var d=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);s(c||!d||parseInt(d[1],10)>=43)}}).catch(function(){return!1})}function K(o){return typeof U=="boolean"?g.resolve(U):N(o).then(function(s){return U=s,U})}function X(o){var s=B[o.name],i={};i.promise=new g(function(l,d){i.resolve=l,i.reject=d}),s.deferredOperations.push(i),s.dbReady?s.dbReady=s.dbReady.then(function(){return i.promise}):s.dbReady=i.promise}function te(o){var s=B[o.name],i=s.deferredOperations.pop();if(i)return i.resolve(),i.promise}function ne(o,s){var i=B[o.name],l=i.deferredOperations.pop();if(l)return l.reject(s),l.promise}function oe(o,s){return new g(function(i,l){if(B[o.name]=B[o.name]||Ur(),o.db)if(s)X(o),o.db.close();else return i(o.db);var d=[o.name];s&&d.push(o.version);var c=T.open.apply(T,d);s&&(c.onupgradeneeded=function(p){var v=c.result;try{v.createObjectStore(o.storeName),p.oldVersion<=1&&v.createObjectStore(D)}catch(y){if(y.name==="ConstraintError")console.warn('The database "'+o.name+'" has been upgraded from version '+p.oldVersion+" to version "+p.newVersion+', but the storage "'+o.storeName+'" already exists.');else throw y}}),c.onerror=function(p){p.preventDefault(),l(c.error)},c.onsuccess=function(){var p=c.result;p.onversionchange=function(v){v.target.close()},i(p),te(o)}})}function fe(o){return oe(o,!1)}function Le(o){return oe(o,!0)}function qe(o,s){if(!o.db)return!0;var i=!o.db.objectStoreNames.contains(o.storeName),l=o.version<o.db.version,d=o.version>o.db.version;if(l&&(o.version!==s&&console.warn('The database "'+o.name+`" can't be downgraded from version `+o.db.version+" to version "+o.version+"."),o.version=o.db.version),d||i){if(i){var c=o.db.version+1;c>o.version&&(o.version=c)}return!0}return!1}function Mt(o){return new g(function(s,i){var l=new FileReader;l.onerror=i,l.onloadend=function(d){var c=btoa(d.target.result||"");s({__local_forage_encoded_blob:!0,data:c,type:o.type})},l.readAsBinaryString(o)})}function Re(o){var s=$(atob(o.data));return S([s],{type:o.type})}function Fr(o){return o&&o.__local_forage_encoded_blob}function Eo(o){var s=this,i=s._initReady().then(function(){var l=B[s._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return P(i,o,o),i}function Io(o){X(o);for(var s=B[o.name],i=s.forages,l=0;l<i.length;l++){var d=i[l];d._dbInfo.db&&(d._dbInfo.db.close(),d._dbInfo.db=null)}return o.db=null,fe(o).then(function(c){return o.db=c,qe(o)?Le(o):c}).then(function(c){o.db=s.db=c;for(var p=0;p<i.length;p++)i[p]._dbInfo.db=c}).catch(function(c){throw ne(o,c),c})}function me(o,s,i,l){l===void 0&&(l=1);try{var d=o.db.transaction(o.storeName,s);i(null,d)}catch(c){if(l>0&&(!o.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return g.resolve().then(function(){if(!o.db||c.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),Le(o)}).then(function(){return Io(o).then(function(){me(o,s,i,l-1)})}).catch(i);i(c)}}function Ur(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function wo(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=o[l];var d=B[i.name];d||(d=Ur(),B[i.name]=d),d.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=Eo);var c=[];function p(){return g.resolve()}for(var v=0;v<d.forages.length;v++){var y=d.forages[v];y!==s&&c.push(y._initReady().catch(p))}var b=d.forages.slice(0);return g.all(c).then(function(){return i.db=d.db,fe(i)}).then(function(E){return i.db=E,qe(i,s._defaultConfig.version)?Le(i):E}).then(function(E){i.db=d.db=E,s._dbInfo=i;for(var R=0;R<b.length;R++){var O=b[R];O!==s&&(O._dbInfo.db=i.db,O._dbInfo.version=i.version)}})}function To(o,s){var i=this;o=x(o);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,M,function(p,v){if(p)return c(p);try{var y=v.objectStore(i._dbInfo.storeName),b=y.get(o);b.onsuccess=function(){var E=b.result;E===void 0&&(E=null),Fr(E)&&(E=Re(E)),d(E)},b.onerror=function(){c(b.error)}}catch(E){c(E)}})}).catch(c)});return I(l,s),l}function So(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,M,function(p,v){if(p)return c(p);try{var y=v.objectStore(i._dbInfo.storeName),b=y.openCursor(),E=1;b.onsuccess=function(){var R=b.result;if(R){var O=R.value;Fr(O)&&(O=Re(O));var V=o(O,R.key,E++);V!==void 0?d(V):R.continue()}else d()},b.onerror=function(){c(b.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function Ro(o,s,i){var l=this;o=x(o);var d=new g(function(c,p){var v;l.ready().then(function(){return v=l._dbInfo,ee.call(s)==="[object Blob]"?K(v.db).then(function(y){return y?s:Mt(s)}):s}).then(function(y){me(l._dbInfo,w,function(b,E){if(b)return p(b);try{var R=E.objectStore(l._dbInfo.storeName);y===null&&(y=void 0);var O=R.put(y,o);E.oncomplete=function(){y===void 0&&(y=null),c(y)},E.onabort=E.onerror=function(){var V=O.error?O.error:O.transaction.error;p(V)}}catch(V){p(V)}})}).catch(p)});return I(d,i),d}function Ao(o,s){var i=this;o=x(o);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,w,function(p,v){if(p)return c(p);try{var y=v.objectStore(i._dbInfo.storeName),b=y.delete(o);v.oncomplete=function(){d()},v.onerror=function(){c(b.error)},v.onabort=function(){var E=b.error?b.error:b.transaction.error;c(E)}}catch(E){c(E)}})}).catch(c)});return I(l,s),l}function ko(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,w,function(c,p){if(c)return d(c);try{var v=p.objectStore(s._dbInfo.storeName),y=v.clear();p.oncomplete=function(){l()},p.onabort=p.onerror=function(){var b=y.error?y.error:y.transaction.error;d(b)}}catch(b){d(b)}})}).catch(d)});return I(i,o),i}function xo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,M,function(c,p){if(c)return d(c);try{var v=p.objectStore(s._dbInfo.storeName),y=v.count();y.onsuccess=function(){l(y.result)},y.onerror=function(){d(y.error)}}catch(b){d(b)}})}).catch(d)});return I(i,o),i}function Co(o,s){var i=this,l=new g(function(d,c){if(o<0){d(null);return}i.ready().then(function(){me(i._dbInfo,M,function(p,v){if(p)return c(p);try{var y=v.objectStore(i._dbInfo.storeName),b=!1,E=y.openKeyCursor();E.onsuccess=function(){var R=E.result;if(!R){d(null);return}o===0||b?d(R.key):(b=!0,R.advance(o))},E.onerror=function(){c(E.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function Po(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,M,function(c,p){if(c)return d(c);try{var v=p.objectStore(s._dbInfo.storeName),y=v.openKeyCursor(),b=[];y.onsuccess=function(){var E=y.result;if(!E){l(b);return}b.push(E.key),E.continue()},y.onerror=function(){d(y.error)}}catch(E){d(E)}})}).catch(d)});return I(i,o),i}function Do(o,s){s=C.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;if(!o.name)d=g.reject("Invalid arguments");else{var c=o.name===i.name&&l._dbInfo.db,p=c?g.resolve(l._dbInfo.db):fe(o).then(function(v){var y=B[o.name],b=y.forages;y.db=v;for(var E=0;E<b.length;E++)b[E]._dbInfo.db=v;return v});o.storeName?d=p.then(function(v){if(v.objectStoreNames.contains(o.storeName)){var y=v.version+1;X(o);var b=B[o.name],E=b.forages;v.close();for(var R=0;R<E.length;R++){var O=E[R];O._dbInfo.db=null,O._dbInfo.version=y}var V=new g(function(j,z){var q=T.open(o.name,y);q.onerror=function(ie){var Ue=q.result;Ue.close(),z(ie)},q.onupgradeneeded=function(){var ie=q.result;ie.deleteObjectStore(o.storeName)},q.onsuccess=function(){var ie=q.result;ie.close(),j(ie)}});return V.then(function(j){b.db=j;for(var z=0;z<E.length;z++){var q=E[z];q._dbInfo.db=j,te(q._dbInfo)}}).catch(function(j){throw(ne(o,j)||g.resolve()).catch(function(){}),j})}}):d=p.then(function(v){X(o);var y=B[o.name],b=y.forages;v.close();for(var E=0;E<b.length;E++){var R=b[E];R._dbInfo.db=null}var O=new g(function(V,j){var z=T.deleteDatabase(o.name);z.onerror=function(){var q=z.result;q&&q.close(),j(z.error)},z.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},z.onsuccess=function(){var q=z.result;q&&q.close(),V(q)}});return O.then(function(V){y.db=V;for(var j=0;j<b.length;j++){var z=b[j];te(z._dbInfo)}}).catch(function(V){throw(ne(o,V)||g.resolve()).catch(function(){}),V})})}return I(d,s),d}var Oo={_driver:"asyncStorage",_initStorage:wo,_support:_(),iterate:So,getItem:To,setItem:Ro,removeItem:Ao,clear:ko,length:xo,key:Co,keys:Po,dropInstance:Do};function No(){return typeof openDatabase=="function"}var ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Lo="~~local_forage_type~",Br=/^~~local_forage_type~([^~]+)~/,We="__lfsc__:",$t=We.length,Vt="arbf",jt="blob",Mr="si08",$r="ui08",Vr="uic8",jr="si16",Kr="si32",Hr="ur16",Gr="ui32",Jr="fl32",qr="fl64",Wr=$t+Vt.length,zr=Object.prototype.toString;function Yr(o){var s=o.length*.75,i=o.length,l,d=0,c,p,v,y;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var b=new ArrayBuffer(s),E=new Uint8Array(b);for(l=0;l<i;l+=4)c=ye.indexOf(o[l]),p=ye.indexOf(o[l+1]),v=ye.indexOf(o[l+2]),y=ye.indexOf(o[l+3]),E[d++]=c<<2|p>>4,E[d++]=(p&15)<<4|v>>2,E[d++]=(v&3)<<6|y&63;return b}function Kt(o){var s=new Uint8Array(o),i="",l;for(l=0;l<s.length;l+=3)i+=ye[s[l]>>2],i+=ye[(s[l]&3)<<4|s[l+1]>>4],i+=ye[(s[l+1]&15)<<2|s[l+2]>>6],i+=ye[s[l+2]&63];return s.length%3===2?i=i.substring(0,i.length-1)+"=":s.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function Fo(o,s){var i="";if(o&&(i=zr.call(o)),o&&(i==="[object ArrayBuffer]"||o.buffer&&zr.call(o.buffer)==="[object ArrayBuffer]")){var l,d=We;o instanceof ArrayBuffer?(l=o,d+=Vt):(l=o.buffer,i==="[object Int8Array]"?d+=Mr:i==="[object Uint8Array]"?d+=$r:i==="[object Uint8ClampedArray]"?d+=Vr:i==="[object Int16Array]"?d+=jr:i==="[object Uint16Array]"?d+=Hr:i==="[object Int32Array]"?d+=Kr:i==="[object Uint32Array]"?d+=Gr:i==="[object Float32Array]"?d+=Jr:i==="[object Float64Array]"?d+=qr:s(new Error("Failed to get type for BinaryArray"))),s(d+Kt(l))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var p=Lo+o.type+"~"+Kt(this.result);s(We+jt+p)},c.readAsArrayBuffer(o)}else try{s(JSON.stringify(o))}catch(p){console.error("Couldn't convert value into a JSON string: ",o),s(null,p)}}function Uo(o){if(o.substring(0,$t)!==We)return JSON.parse(o);var s=o.substring(Wr),i=o.substring($t,Wr),l;if(i===jt&&Br.test(s)){var d=s.match(Br);l=d[1],s=s.substring(d[0].length)}var c=Yr(s);switch(i){case Vt:return c;case jt:return S([c],{type:l});case Mr:return new Int8Array(c);case $r:return new Uint8Array(c);case Vr:return new Uint8ClampedArray(c);case jr:return new Int16Array(c);case Hr:return new Uint16Array(c);case Kr:return new Int32Array(c);case Gr:return new Uint32Array(c);case Jr:return new Float32Array(c);case qr:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var Ht={serialize:Fo,deserialize:Uo,stringToBuffer:Yr,bufferToString:Kt};function Qr(o,s,i,l){o.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function Bo(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=typeof o[l]!="string"?o[l].toString():o[l];var d=new g(function(c,p){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(v){return p(v)}i.db.transaction(function(v){Qr(v,i,function(){s._dbInfo=i,c()},function(y,b){p(b)})},p)});return i.serializer=Ht,d}function be(o,s,i,l,d,c){o.executeSql(i,l,d,function(p,v){v.code===v.SYNTAX_ERR?p.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(y,b){b.rows.length?c(y,v):Qr(y,s,function(){y.executeSql(i,l,d,c)},c)},c):c(p,v)},c)}function Mo(o,s){var i=this;o=x(o);var l=new g(function(d,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(v){be(v,p,"SELECT * FROM "+p.storeName+" WHERE key = ? LIMIT 1",[o],function(y,b){var E=b.rows.length?b.rows.item(0).value:null;E&&(E=p.serializer.deserialize(E)),d(E)},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function $o(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(v){be(v,p,"SELECT * FROM "+p.storeName,[],function(y,b){for(var E=b.rows,R=E.length,O=0;O<R;O++){var V=E.item(O),j=V.value;if(j&&(j=p.serializer.deserialize(j)),j=o(j,V.key,O+1),j!==void 0){d(j);return}}d()},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Xr(o,s,i,l){var d=this;o=x(o);var c=new g(function(p,v){d.ready().then(function(){s===void 0&&(s=null);var y=s,b=d._dbInfo;b.serializer.serialize(s,function(E,R){R?v(R):b.db.transaction(function(O){be(O,b,"INSERT OR REPLACE INTO "+b.storeName+" (key, value) VALUES (?, ?)",[o,E],function(){p(y)},function(V,j){v(j)})},function(O){if(O.code===O.QUOTA_ERR){if(l>0){p(Xr.apply(d,[o,y,i,l-1]));return}v(O)}})})}).catch(v)});return I(c,i),c}function Vo(o,s,i){return Xr.apply(this,[o,s,i,1])}function jo(o,s){var i=this;o=x(o);var l=new g(function(d,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(v){be(v,p,"DELETE FROM "+p.storeName+" WHERE key = ?",[o],function(){d()},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Ko(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(p){be(p,c,"DELETE FROM "+c.storeName,[],function(){l()},function(v,y){d(y)})})}).catch(d)});return I(i,o),i}function Ho(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(p){be(p,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(v,y){var b=y.rows.item(0).c;l(b)},function(v,y){d(y)})})}).catch(d)});return I(i,o),i}function Go(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var p=i._dbInfo;p.db.transaction(function(v){be(v,p,"SELECT key FROM "+p.storeName+" WHERE id = ? LIMIT 1",[o+1],function(y,b){var E=b.rows.length?b.rows.item(0).key:null;d(E)},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Jo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(p){be(p,c,"SELECT key FROM "+c.storeName,[],function(v,y){for(var b=[],E=0;E<y.rows.length;E++)b.push(y.rows.item(E).key);l(b)},function(v,y){d(y)})})}).catch(d)});return I(i,o),i}function qo(o){return new g(function(s,i){o.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(d,c){for(var p=[],v=0;v<c.rows.length;v++)p.push(c.rows.item(v).name);s({db:o,storeNames:p})},function(d,c){i(c)})},function(l){i(l)})})}function Wo(o,s){s=C.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;return o.name?d=new g(function(c){var p;o.name===i.name?p=l._dbInfo.db:p=openDatabase(o.name,"","",0),o.storeName?c({db:p,storeNames:[o.storeName]}):c(qo(p))}).then(function(c){return new g(function(p,v){c.db.transaction(function(y){function b(V){return new g(function(j,z){y.executeSql("DROP TABLE IF EXISTS "+V,[],function(){j()},function(q,ie){z(ie)})})}for(var E=[],R=0,O=c.storeNames.length;R<O;R++)E.push(b(c.storeNames[R]));g.all(E).then(function(){p()}).catch(function(V){v(V)})},function(y){v(y)})})}):d=g.reject("Invalid arguments"),I(d,s),d}var zo={_driver:"webSQLStorage",_initStorage:Bo,_support:No(),iterate:$o,getItem:Mo,setItem:Vo,removeItem:jo,clear:Ko,length:Ho,key:Go,keys:Jo,dropInstance:Wo};function Yo(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(o){return!1}}function Zr(o,s){var i=o.name+"/";return o.storeName!==s.storeName&&(i+=o.storeName+"/"),i}function Qo(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(s){return!0}}function Xo(){return!Qo()||localStorage.length>0}function Zo(o){var s=this,i={};if(o)for(var l in o)i[l]=o[l];return i.keyPrefix=Zr(o,s._defaultConfig),Xo()?(s._dbInfo=i,i.serializer=Ht,g.resolve()):g.reject()}function ei(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo.keyPrefix,d=localStorage.length-1;d>=0;d--){var c=localStorage.key(d);c.indexOf(l)===0&&localStorage.removeItem(c)}});return I(i,o),i}function ti(o,s){var i=this;o=x(o);var l=i.ready().then(function(){var d=i._dbInfo,c=localStorage.getItem(d.keyPrefix+o);return c&&(c=d.serializer.deserialize(c)),c});return I(l,s),l}function ri(o,s){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,c=d.keyPrefix,p=c.length,v=localStorage.length,y=1,b=0;b<v;b++){var E=localStorage.key(b);if(E.indexOf(c)===0){var R=localStorage.getItem(E);if(R&&(R=d.serializer.deserialize(R)),R=o(R,E.substring(p),y++),R!==void 0)return R}}});return I(l,s),l}function ni(o,s){var i=this,l=i.ready().then(function(){var d=i._dbInfo,c;try{c=localStorage.key(o)}catch(p){c=null}return c&&(c=c.substring(d.keyPrefix.length)),c});return I(l,s),l}function oi(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo,d=localStorage.length,c=[],p=0;p<d;p++){var v=localStorage.key(p);v.indexOf(l.keyPrefix)===0&&c.push(v.substring(l.keyPrefix.length))}return c});return I(i,o),i}function ii(o){var s=this,i=s.keys().then(function(l){return l.length});return I(i,o),i}function ai(o,s){var i=this;o=x(o);var l=i.ready().then(function(){var d=i._dbInfo;localStorage.removeItem(d.keyPrefix+o)});return I(l,s),l}function si(o,s,i){var l=this;o=x(o);var d=l.ready().then(function(){s===void 0&&(s=null);var c=s;return new g(function(p,v){var y=l._dbInfo;y.serializer.serialize(s,function(b,E){if(E)v(E);else try{localStorage.setItem(y.keyPrefix+o,b),p(c)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&v(R),v(R)}})})});return I(d,i),d}function ci(o,s){if(s=C.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var i=this.config();o.name=o.name||i.name,o.storeName=o.storeName||i.storeName}var l=this,d;return o.name?d=new g(function(c){o.storeName?c(Zr(o,l._defaultConfig)):c(o.name+"/")}).then(function(c){for(var p=localStorage.length-1;p>=0;p--){var v=localStorage.key(p);v.indexOf(c)===0&&localStorage.removeItem(v)}}):d=g.reject("Invalid arguments"),I(d,s),d}var ui={_driver:"localStorageWrapper",_initStorage:Zo,_support:Yo(),iterate:ri,getItem:ti,setItem:si,removeItem:ai,clear:ei,length:ii,key:ni,keys:oi,dropInstance:ci},li=function(s,i){return s===i||typeof s=="number"&&typeof i=="number"&&isNaN(s)&&isNaN(i)},di=function(s,i){for(var l=s.length,d=0;d<l;){if(li(s[d],i))return!0;d++}return!1},en=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Fe={},tn={},Ae={INDEXEDDB:Oo,WEBSQL:zo,LOCALSTORAGE:ui},fi=[Ae.INDEXEDDB._driver,Ae.WEBSQL._driver,Ae.LOCALSTORAGE._driver],ze=["dropInstance"],Gt=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ze),mi={description:"",driver:fi.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function pi(o,s){o[s]=function(){var i=arguments;return o.ready().then(function(){return o[s].apply(o,i)})}}function Jt(){for(var o=1;o<arguments.length;o++){var s=arguments[o];if(s)for(var i in s)s.hasOwnProperty(i)&&(en(s[i])?arguments[0][i]=s[i].slice():arguments[0][i]=s[i])}return arguments[0]}var hi=function(){function o(s){m(this,o);for(var i in Ae)if(Ae.hasOwnProperty(i)){var l=Ae[i],d=l._driver;this[i]=d,Fe[d]||this.defineDriver(l)}this._defaultConfig=Jt({},mi),this._config=Jt({},this._defaultConfig,s),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return o.prototype.config=function(i){if((typeof i=="undefined"?"undefined":f(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},o.prototype.defineDriver=function(i,l,d){var c=new g(function(p,v){try{var y=i._driver,b=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){v(b);return}for(var E=Gt.concat("_initStorage"),R=0,O=E.length;R<O;R++){var V=E[R],j=!di(ze,V);if((j||i[V])&&typeof i[V]!="function"){v(b);return}}var z=function(){for(var Ue=function(yi){return function(){var bi=new Error("Method "+yi+" is not implemented by the current driver"),rn=g.reject(bi);return I(rn,arguments[arguments.length-1]),rn}},qt=0,vi=ze.length;qt<vi;qt++){var Wt=ze[qt];i[Wt]||(i[Wt]=Ue(Wt))}};z();var q=function(Ue){Fe[y]&&console.info("Redefining LocalForage driver: "+y),Fe[y]=i,tn[y]=Ue,p()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(q,v):q(!!i._support):q(!0)}catch(ie){v(ie)}});return P(c,l,d),c},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(i,l,d){var c=Fe[i]?g.resolve(Fe[i]):g.reject(new Error("Driver not found."));return P(c,l,d),c},o.prototype.getSerializer=function(i){var l=g.resolve(Ht);return P(l,i),l},o.prototype.ready=function(i){var l=this,d=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return P(d,i,i),d},o.prototype.setDriver=function(i,l,d){var c=this;en(i)||(i=[i]);var p=this._getSupportedDrivers(i);function v(){c._config.driver=c.driver()}function y(R){return c._extend(R),v(),c._ready=c._initStorage(c._config),c._ready}function b(R){return function(){var O=0;function V(){for(;O<R.length;){var j=R[O];return O++,c._dbInfo=null,c._ready=null,c.getDriver(j).then(y).catch(V)}v();var z=new Error("No available storage method found.");return c._driverSet=g.reject(z),c._driverSet}return V()}}var E=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=E.then(function(){var R=p[0];return c._dbInfo=null,c._ready=null,c.getDriver(R).then(function(O){c._driver=O._driver,v(),c._wrapLibraryMethodsWithReady(),c._initDriver=b(p)})}).catch(function(){v();var R=new Error("No available storage method found.");return c._driverSet=g.reject(R),c._driverSet}),P(this._driverSet,l,d),this._driverSet},o.prototype.supports=function(i){return!!tn[i]},o.prototype._extend=function(i){Jt(this,i)},o.prototype._getSupportedDrivers=function(i){for(var l=[],d=0,c=i.length;d<c;d++){var p=i[d];this.supports(p)&&l.push(p)}return l},o.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=Gt.length;i<l;i++)pi(this,Gt[i])},o.prototype.createInstance=function(i){return new o(i)},o}(),gi=new hi;a.exports=gi},{3:3}]},{},[4])(4)})});var no=sn(Se=>{"use strict";H();Ge();we();var Ce=ae(),ka=se("levelFinished",{paramsSchema:k.tuple(k.string(),k.object({result:k.boolean(),duration:k.number()})),implement:(e,t)=>L(Se,null,function*(){let{result:r,duration:n}=t;ce.info("onLevelFinished",r,n),yield Promise.all([le.reporter({event:"COMPLETE_GAME_LEVEL"}),le.tracker("LevelFinished",{levelId:e,result:r,duration:n})])})}),xa=se("taskFinished",{paramsSchema:k.tuple(k.string(),k.object({duration:k.number()})),implement:(e,t)=>L(Se,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),Ca=se("levelUpgrade",{paramsSchema:k.tuple(k.string(),k.string()),implement:(e,t)=>L(Se,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),Pa=se("onHistoryUserLevel",{paramsSchema:k.tuple(k.number()),implement:e=>L(Se,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),Da=se("onHistoryUserScore",{paramsSchema:k.tuple(k.number()),implement:e=>L(Se,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),Oa=se("taskEvent",{paramsSchema:k.tuple(k.string(),k.object({tools:k.array(k.object({id:k.string(),name:k.string(),count:k.number(),description:k.string().optional(),price:k.object({amount:k.number(),unit:k.string()}).optional()})).optional(),awards:k.array(k.object({id:k.string(),name:k.string()})).optional()})),implement:(e,t)=>L(Se,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([le.reporter({event:"USE_GAME_ITEM"}),le.tracker("UseGameItem",F({taskId:e},t))]))})});Ce.registerCommand("TaskTrackerSDK.levelFinished",ka);Ce.registerCommand("TaskTrackerSDK.taskFinished",xa);Ce.registerCommand("TaskTrackerSDK.levelUpgrade",Ca);Ce.registerCommand("TaskTrackerSDK.historyUserLevel",Pa);Ce.registerCommand("TaskTrackerSDK.historyUserScore",Da);Ce.registerCommand("TaskTrackerSDK.taskEvent",Oa);Q("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Q("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Q("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Q("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});we();re();Ge();H();var Xn=ae(),fa="env",ma="getSystemInfoSync",pa=()=>{var a,u,f,m;let e={system:A.deviceInfo.system,platform:A.deviceInfo.platform,brand:A.deviceInfo.brand,pixelRatio:A.deviceInfo.pixelRatio,language:A.deviceInfo.lang,version:A.sdkInfo.jssdkVersion,appName:(a=A.hostInfo)==null?void 0:a.appName,SDKVersion:A.sdkInfo.nativeSDKVersion},t=(u=A.hostInfo)==null?void 0:u.version;t&&(e=W(F({},e),{version:t}));let r=(f=A.hostInfo)==null?void 0:f.appName;r&&(e=W(F({},e),{appName:r}));let n=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return n&&(e=W(F({},e),{SDKVersion:n})),e},ha=Te(ma,{implement:pa}),ga=Te(fa,{implement:()=>W(F({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});Xn.registerCommand("API.env",ga);Xn.registerCommand("API.getSystemInfoSync",ha);Q("env",{version:"1.0.0"});Q("getSystemInfoSync",{version:"1.0.0"});H();Ge();Ee();we();var va="onJoliboxShow",ya="onJoliboxHide",ba="onReady",xr=ae(),Cr=In(ue),kr=!0,Je=!0,Rt=0,At=Er;function _a(){let e=Date.now();if(e-Rt<100)return;Rt=e;let t=document.visibilityState==="visible";t!==kr&&(kr=t,At.emit("visible",kr))}function Zn(e){let t=Date.now();t-Rt<100||(Rt=t,e==="focus"&&!Je?Je=!0:e==="blur"&&Je&&(Je=!1),At.emit("visible",Je))}document.addEventListener("visibilitychange",_a);window.addEventListener("focus",()=>Zn("focus"));window.addEventListener("blur",()=>Zn("blur"));var Ea=Te(va,{paramsSchema:k.tuple(k.function()),implement(e){let t=Cr(e);At.on("visible",r=>{r&&t()})}}),Ia=Te(ya,{paramsSchema:k.tuple(k.function()),implement(e){let t=Cr(e);At.on("visible",r=>{!r&&t()})}}),wa=Te(ba,{paramsSchema:k.tuple(k.function()),implement(e){let t=Cr(e);Ke.on("LifecycleEvent.onReady",r=>{t(r)})}});xr.registerCommand("LifecycleSDK.onReady",wa);xr.registerCommand("LifecycleSDK.onJoliboxShow",Ea);xr.registerCommand("LifecycleSDK.onJoliboxHide",Ia);Q("lifeCycle.onReady",{version:"1.0.0"});Q("lifeCycle.onJoliboxShow",{version:"1.0.0"});Q("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ge();H();He();re();var ro=cn(to());var kt=ae(),Dr=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=>L(this,null,function*(){let{code:r,data:n,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),u=n==null?void 0:n.value,f=a;return r!=="SUCCESS"&&(u=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",u),f+="fallback to localstorage"),{code:r,message:f,data:u&&u!=="undefined"?u:null}});this.setItem=(t,r)=>L(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:a,message:u}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:a,message:u}});this.removeItem=t=>L(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=()=>L(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=ro.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},xt=new Dr,Ta=se("getLocalStorage",{paramsSchema:k.tuple(k.string()),implement(e){return L(this,null,function*(){return yield xt.getItem(e)})}});kt.registerCommand("StorageSDK.getItem",Ta);Q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Sa=se("setStorage",{paramsSchema:k.tuple(k.string(),k.or(k.string(),k.boolean(),k.number())),implement(e,t){return L(this,null,function*(){return yield xt.setItem(e,t)})}});kt.registerCommand("StorageSDK.setItem",Sa);Q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ra=se("removeStorage",{paramsSchema:k.tuple(k.string()),implement(e){return L(this,null,function*(){return yield xt.removeItem(e)})}});kt.registerCommand("StorageSDK.removeItem",Ra);Q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Aa=se("clearStorage",{implement(){return L(this,null,function*(){return yield xt.clear()})}});kt.registerCommand("StorageSDK.clear",Aa);Q("storage.clear",{version:"1.0.0"});var Ju=cn(no());var Ct=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};var Pt=class{constructor(t,r,n,a){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let a=this.checkShouldBanHighFreq(t);if(a)return a;let u=this.checkShouldBanForTime(t);return u?{reason:u}:{reason:"ALLOWED"}};var g,I,P,x,C,D,U;let u=(g=a==null?void 0:a.maxAllowedAdsForTime)!=null?g:8,f=(I=a==null?void 0:a.banForTimeThreshold)!=null?I:6e4,m=(P=a==null?void 0:a.bannedReleaseTime)!=null?P:6e4,h=(x=a==null?void 0:a.maxAllowedAdsForSession)!=null?x:200,T=(C=a==null?void 0:a.banForSessionThreshold)!=null?C:6e5,_=(D=a==null?void 0:a.initialThreshold)!=null?D:2e3,S=(U=a==null?void 0:a.highFreqThreshold)!=null?U:2e3;this.checkShouldBanInitial=Fa(_),this.checkShouldBanHighFreq=Ua(S),this.checkShouldBanForTime=La(u,f,m),this.checkShouldBanForSession=Na(h,T)}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}})}},Na=(e,t)=>{let r=!1,n=[];return u=>{if(r)return"BANNED_FOR_SESSION";let f=Date.now();if(n=n.concat({timestamp:f,type:u}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&f-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},La=(e,t,r)=>{let n=null,a=_=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{h.value=!1,n=null},_)},u="jolibox-sdk-ads-callbreak-timestamps",f="jolibox-sdk-ads-ban-for-time",m={_records:[],init(){var _;try{let S=JSON.parse((_=window.localStorage.getItem(u))!=null?_:"[]");Array.isArray(S)?this._records=S:this._records=[]}catch(S){this._records=[]}},get values(){return this._records},set values(_){try{window.localStorage.setItem(u,JSON.stringify(_))}catch(S){}this._records=_}},h={_record:!1,init(){var _;try{let S=JSON.parse((_=window.localStorage.getItem(f))!=null?_:"false");typeof S=="boolean"&&(this._record=S)}catch(S){this._record=!1}if(this._record){let S=m.values[m.values.length-1],g=S?Date.now()-S.timestamp:r;g<=r&&g>0?a(g):this._record=!1}},get value(){return this._record},set value(_){try{window.localStorage.setItem(f,JSON.stringify(_))}catch(S){}this._record=_}};return m.init(),h.init(),_=>{if(h.value)return"WAITING_BANNED_RELEASE";let S=Date.now();if(m.values=m.values.concat({timestamp:S,type:_}),m.values.length!==1&&(m.values.length>e&&(m.values=m.values.slice(-e)),m.values.length===e&&S-m.values[0].timestamp<=t))return h.value=!0,a(r),"BANNED_FOR_TIME"}},Fa=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Ua=(e=2e3)=>{let t=0,r=null;return a=>{if(a==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}};re();re();var Dt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return L(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let a=(r=A.channel)!=null?r:"",u=this.configs[a],f=(n=u==null?void 0:u.interstitialRate)!=null?n:1;t=Math.random()<f}return this.firstRun=!1,t}};H();var Pe=new _e,Ot=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=()=>L(this,null,function*(){var f,m,h,T,_;let t="ca-pub-7171363994453626",r,n,a=window.encodeURIComponent(window.btoa((f=this.getGameId())!=null?f:"")),u=(m=this.getTestAdsMode())!=null?m:!1;try{let S=yield this.httpClient.get("/public/ads",{query:{objectId:a,testAdsMode:`${u}`}});t=(h=S.data)==null?void 0:h.clientId,r=(T=S.data)==null?void 0:T.channelId,n=(_=S.data)==null?void 0:_.unitId}catch(S){console.error("Failed to fetch client info",S)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>L(this,null,function*(){var a;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(a=this.getTestAdsMode())!=null?a:!1;if(!document.getElementById(r)&&this.clientId){let u=document.createElement("script");u.id=r,u.async=!0,u.crossOrigin="anonymous",u.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&u.setAttribute("data-adbreak-test","on"),this.channelId&&u.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(u),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((n=>n.type==="preroll")(t)){Pe.emit("isAdShowing",!0);let n=t.adBreakDone,a=u=>{Pe.emit("isAdShowing",!1),n&&n(u)};return W(F({},t),{adBreakDone:a})}else{let n=t.beforeAd,a=t.afterAd,u=()=>{var m;Pe.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(m=t.name)!=null?m:""}),n&&n()},f=()=>{var m;Pe.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(m=t.name)!=null?m:""}),a&&a()};return W(F({},t),{beforeAd:u,afterAd:f})}};this.adConfig=t=>{let a=t,{onReady:r}=a,n=an(a,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var T,_,S,g,I,P;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(T=t.adBreakDone)==null||T.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":(_=t.adBreakDone)==null||_.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":(S=t.adBreakDone)==null||S.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(I=t.adBreakDone)==null||I.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((g=n==null?void 0:n.count)!=null?g:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let a=t.type,u=t.adBreakDone,f=x=>{var C;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:x.breakType,breakName:(C=x.breakName)!=null?C:"",breakFormat:x.breakFormat,breakStatus:x.breakStatus}),u&&u(x)};if(t.adBreakDone=f,t.type==="reward"){let x=t.beforeReward,C=U=>()=>{this.track("CallShowAdFn",null),U()},D=U=>{x&&x(C(U))};t.beforeReward=D}let m;switch(a){case"preroll":m={type:a};break;case"start":case"pause":case"next":case"browse":case"reward":m={type:a,name:(P=t.name)!=null?P:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",m);let h=this.wrapAdBreakParams(t);this.push(h),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>L(this,null,function*(){var g,I,P,x;if(this.track("CallAdUnit",{adFormat:(I=(g=t.adFormat)==null?void 0:g.toString())!=null?I:null,fullWidthResponsive:(P=t.fullWidthResponsive)!=null?P:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:a,fullWidthResponsive:u,style:f}=t,m;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?m=document.querySelector(r):m=r,!m)throw new Error("targeting element not found");let h=n;if(h||(h=this.unitId),!h)throw new Error("slot is required");let T=typeof a=="object"&&Array.isArray(a)?a.join(", "):a,_=document.createElement("ins");if(_.className="adsbygoogle",_.id="jolibox-ads",_.style.display="block",_.setAttribute("data-ad-client",this.clientId),_.setAttribute("data-ad-slot",h),T&&_.setAttribute("data-ad-format",T),u&&_.setAttribute("data-full-width-responsive",u),f&&_.setAttribute("style",f),(x=this.getTestAdsMode())!=null?x:!1){let C=document.createElement("div");C.style.position="absolute",C.style.top="0",C.style.left="0",C.style.width="100%",C.style.height="100%",C.style.display="flex",C.style.justifyContent="center",C.style.alignItems="center",C.style.backgroundColor="rgba(0, 0, 0, 0.5)",C.style.color="white",C.innerHTML="Test Ad",_.style.position="relative",m.appendChild(_),_.appendChild(C)}else m.appendChild(_),new MutationObserver(D=>{D.forEach(U=>{if(U.type==="attributes"&&U.attributeName==="data-ad-status"){let B=_.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:B!=null?B:"null"})}})}).observe(_,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Pt(t,r,n),this.adsActionDetection=new Ct(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))}};we();H();He();var oo=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};var Nt=ae(),Ba=ge.create(),Lt=new Ot(de,Ba,()=>ge.getNetworkStatus());Pe.on("isAdShowing",e=>{oo("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Nt.registerCommand("AdsSDK.init",e=>{Lt.init(e)});Nt.registerCommand("AdsSDK.adConfig",e=>{Lt.adConfig(e)});Nt.registerCommand("AdsSDK.adBreak",e=>{Lt.adBreak(e)});Nt.registerCommand("AdsSDK.adUnit",e=>{Lt.adUnit(e)});H();we();var lo=-1,Ut=function(e){addEventListener("pageshow",function(t){t.persisted&&(lo=t.timeStamp,e(t))},!0)},Nr=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Bt=function(){var e=Nr();return e&&e.activationStart||0},Oe=function(e,t){var r=Nr(),n="navigate";return lo>=0?n="back-forward-cache":r&&(document.prerendering||Bt()>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}},fo=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(a){Promise.resolve().then(function(){t(a.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(a){}},Ne=function(e,t,r,n){var a,u;return function(f){t.value>=0&&(f||n)&&((u=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=u,t.rating=function(m,h){return m>h[1]?"poor":m>h[0]?"needs-improvement":"good"}(t.value,r),e(t))}},mo=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},po=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},ho=function(e){var t=!1;return function(){t||(e(),t=!0)}},De=-1,io=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Ft=function(e){document.visibilityState==="hidden"&&De>-1&&(De=e.type==="visibilitychange"?e.timeStamp:0,Ma())},ao=function(){addEventListener("visibilitychange",Ft,!0),addEventListener("prerenderingchange",Ft,!0)},Ma=function(){removeEventListener("visibilitychange",Ft,!0),removeEventListener("prerenderingchange",Ft,!0)},go=function(){return De<0&&(De=io(),ao(),Ut(function(){setTimeout(function(){De=io(),ao()},0)})),{get firstHiddenTime(){return De}}},Lr=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},so=[1800,3e3],vo=function(e,t){t=t||{},Lr(function(){var r,n=go(),a=Oe("FCP"),u=fo("paint",function(f){f.forEach(function(m){m.name==="first-contentful-paint"&&(u.disconnect(),m.startTime<n.firstHiddenTime&&(a.value=Math.max(m.startTime-Bt(),0),a.entries.push(m),r(!0)))})});u&&(r=Ne(e,a,so,t.reportAllChanges),Ut(function(f){a=Oe("FCP"),r=Ne(e,a,so,t.reportAllChanges),mo(function(){a.value=performance.now()-f.timeStamp,r(!0)})}))})};var $a=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=ho(e),document.visibilityState==="hidden"?e():(r=t(e),po(e)),r};var co=[2500,4e3],Or={},yo=function(e,t){t=t||{},Lr(function(){var r,n=go(),a=Oe("LCP"),u=function(h){t.reportAllChanges||(h=h.slice(-1)),h.forEach(function(T){T.startTime<n.firstHiddenTime&&(a.value=Math.max(T.startTime-Bt(),0),a.entries=[T],r())})},f=fo("largest-contentful-paint",u);if(f){r=Ne(e,a,co,t.reportAllChanges);var m=ho(function(){Or[a.id]||(u(f.takeRecords()),f.disconnect(),Or[a.id]=!0,r(!0))});["keydown","click"].forEach(function(h){addEventListener(h,function(){return $a(m)},{once:!0,capture:!0})}),po(m),Ut(function(h){a=Oe("LCP"),r=Ne(e,a,co,t.reportAllChanges),mo(function(){a.value=performance.now()-h.timeStamp,Or[a.id]=!0,r(!0)})})}})},uo=[800,1800],Va=function e(t){document.prerendering?Lr(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},bo=function(e,t){t=t||{};var r=Oe("TTFB"),n=Ne(e,r,uo,t.reportAllChanges);Va(function(){var a=Nr();a&&(r.value=Math.max(a.responseStart-Bt(),0),r.entries=[a],n(!0),Ut(function(){r=Oe("TTFB",0),(n=Ne(e,r,uo,t.reportAllChanges))(!0)}))})};re();function ja(){vo(e=>{de("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),yo(e=>{de("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),bo(e=>{de("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function Ka(){Ke.on("onDocumentReady",e=>{Ke.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function _o(){Ka(),ja()}_o();
4
4
  /*! Bundled license information:
5
5
 
6
6
  localforage/dist/localforage.js:
@@ -1,4 +1,4 @@
1
- var _o=Object.create;var Ne=Object.defineProperty,Io=Object.defineProperties,wo=Object.getOwnPropertyDescriptor,Ro=Object.getOwnPropertyDescriptors,Ao=Object.getOwnPropertyNames,Ce=Object.getOwnPropertySymbols,xo=Object.getPrototypeOf,It=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable;var pr=(e,t,r)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))It.call(t,r)&&pr(e,r,t[r]);if(Ce)for(var r of Ce(t))fr.call(t,r)&&pr(e,r,t[r]);return e},P=(e,t)=>Io(e,Ro(t));var ce=(e,t)=>{var r={};for(var n in e)It.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ce)for(var n of Ce(e))t.indexOf(n)<0&&fr.call(e,n)&&(r[n]=e[n]);return r};var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var hr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gr=(e,t)=>{for(var r in t)Ne(e,r,{get:t[r],enumerable:!0})},Po=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ao(t))!It.call(e,o)&&o!==r&&Ne(e,o,{get:()=>t[o],enumerable:!(n=wo(t,o))||n.enumerable});return e};var yr=(e,t,r)=>(r=e!=null?_o(xo(e)):{},Po(t||!e||!e.__esModule?Ne(r,"default",{value:e,enumerable:!0}):r,e));var v=(e,t,r)=>new Promise((n,o)=>{var s=c=>{try{a(r.next(c))}catch(u){o(u)}},i=c=>{try{a(r.throw(c))}catch(u){o(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,i);a((r=r.apply(e,t)).next())});function Co(e){return!!(e!=null&&e.__nativeBuffers__)}function Ee(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!Co(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let o;n.value?o=n.value:n.base64&&(o=No(n.base64)),typeof o!="undefined"&&o instanceof ArrayBuffer&&(e[n.key]=o)}}return e}function vr(e={},t=!1){let r=e,n=[];for(let[o,s]of Object.entries(r))if(s!==void 0&&s instanceof ArrayBuffer&&s.byteLength!==void 0){let i=t?{value:s,key:o}:{base64:Oo(s),key:o};n.push(i),delete r[o]}return n.length>0&&(r.__nativeBuffers__=n),r}var No,Oo,wt=f(()=>{"use strict";No=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(o);return n.buffer};Oo=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return btoa(t)}});function Uo(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function le(e){return typeof e=="string"}function B(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Er(e){return typeof e=="object"&&Array.isArray(e)}function Ie(e){return e===!0||e===!1}function Mo(e){return typeof e>"u"}function Lo(e){return Mo(e)||e===null}function Sr(e){return typeof e=="function"}function _r(e){return B(e)&&Sr(e.then)}function Ir(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function wr(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(o,s){for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i)){let a=o[i],c=s[i],u=r(a,c,i,o,s);u!==void 0?o[i]=u:br(c)&&br(a)?o[i]=n(h({},a),c):Array.isArray(c)&&Array.isArray(a)?o[i]=[...a,...c]:o[i]=c}return o}return n(e,t)}function br(e){return e&&typeof e=="object"&&e.constructor===Object}function Rr(e,t){if(Array.isArray(e))return e.concat(t)}function we(e,t,r={}){let n=null,o,s,i,{leading:a=!1,trailing:c=!0}=r,u=()=>(i=e.apply(s,o),o=void 0,s=void 0,i),l=function(...m){o=m,s=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,c&&!p&&u()},t),p)return u()};return l.cancel=()=>{n&&clearTimeout(n),n=null,o=s=void 0},l.flush=()=>{if(n)return clearTimeout(n),n=null,u()},l}function jo(e,t){return(...r)=>t(e,...r)}function Me(e){return t=>jo(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(o){e(new Re(`${o}`))}})}function Se(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function es(e){return new Promise(t=>Lr(e)(t))}function Lr(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function ts(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(s.fire,s)}},s=new _e(o);return s.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function ns(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)os(e[n],t[n])}function os(e,t){if(le(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Sr(t)){try{if(e instanceof t)return}catch(r){}if(!Lo(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 O(){if(globalThis[At])return globalThis[At];let e=new Fe,t=new Pt,r={registerCommand(n,o,s){e.registerCommand({id:n,handler:o,metadata:s})},executeCommand(n,...o){return t.executeCommand(n,...o)},excuteCommandSync(n,...o){return t.executeCommandThowErr(n,...o)}};return globalThis[At]=r,r}var kr,Do,Fo,Tr,Q,Bo,Ct,ue,Ar,xr,Re,Pr,Cr,Nr,Or,Dr,Ae,Ue,Nt,$,Fr,Jo,Ot,Ho,Dt,$o,Vo,Oe,Ko,qo,Go,Ur,Ft,zo,Wo,Qo,Mr,te,C,Yo,Xo,De,_e,q,xt,Zo,Rt,rs,re,Fe,Pt,At,S=f(()=>{"use strict";kr=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,Fo=(e,t)=>{for(var r in t)kr(e,r,{get:t[r],enumerable:!0})},Tr=(e,t,r,n)=>{for(var o=n>1?void 0:n?Do(t,r):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&kr(t,r,o),o};Q=class{constructor(){this.state="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.state==="pending"&&(this.state="fulfilled",e(r))},this.reject=r=>{this.state==="pending"&&(this.state="rejected",t(r))}})}};Bo=(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))(Bo||{}),Ct=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}},ue=class extends Ct{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Ar=class extends Ct{constructor(){super(...arguments),this.kind="USER_ERROR"}},xr=class extends Ar{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Re=class extends Ar{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))}},Pr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Cr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Nr=class extends ue{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Or=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Dr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Ae=class extends Ct{constructor(e,t,r,n,o){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),o&&(this.priority=o)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},Ue=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},Nt=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};$={log:Se("log"),warn:Se("warn"),info:Se("info"),error:Se("error"),debug:Se("debug")};Object.assign(globalThis,{logger:$});Fr=Symbol.for("Jolibox.canIUseMap"),Jo={};globalThis[Fr]=Jo;Ot={get config(){return globalThis[Fr]}},Ho=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Ho||{}),Dt=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Dt||{}),$o=(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))($o||{}),Vo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Oe={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")},Ko=()=>Oe.isiOS?"iOS":Oe.isAndroid?"Android":Oe.isMac?"Mac":Oe.isFacebook?"Facebook":"PC",qo="device_id",Go="advertising_id",Ur=e=>(localStorage.getItem(e)||localStorage.setItem(e,Vo()),localStorage.getItem(e)),Ft=()=>Ur(qo),zo=()=>Ur(Go),Wo=e=>e.charAt(0).toUpperCase()+e.slice(1),Qo=()=>{var t;let e=new URLSearchParams(window.location.search);return Wo((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Mr=e=>{let t="JoliboxWebSDK",r=Ko(),n=navigator.language,o=Ft(),s=zo();return`${t} (${Qo()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${o} adid/${s} version/${e||""}`},C=(te=class{constructor(t){this.element=t,this.next=te.Undefined,this.prev=te.Undefined}},te.Undefined=new te(void 0),te),Yo=class{constructor(){this._first=C.Undefined,this._last=C.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===C.Undefined}clear(){let e=this._first;for(;e!==C.Undefined;){let t=e.next;e.prev=C.Undefined,e.next=C.Undefined,e=t}this._first=C.Undefined,this._last=C.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new C(e);if(this._first===C.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==C.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==C.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==C.Undefined&&e.next!==C.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===C.Undefined&&e.next===C.Undefined?(this._first=C.Undefined,this._last=C.Undefined):e.next===C.Undefined?(this._last=this._last.prev,this._last.next=C.Undefined):e.prev===C.Undefined&&(this._first=this._first.next,this._first.prev=C.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==C.Undefined;)yield e.element,e=e.next}},Xo=0,De=class{constructor(e){this.value=e,this.id=Xo++}},_e=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof De&&(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 o,s,i,a,c,u;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new De(t);this._listeners?this._listeners instanceof De?this._listeners=[this._listeners,n]:this._listeners.push(n):((s=(o=this.options)==null?void 0:o.onWillAddFirstListener)==null||s.call(o,this),this._listeners=n,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(u=(c=this.options)==null?void 0:c.onDidAddListener)==null||u.call(c,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(o){r(o)}}fire(e){this._listeners&&(this._listeners instanceof De?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},q=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var s;let r=(s=this.listeners.get(e))!=null?s:new _e,n=i=>t(...i.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let o=this.cachedEventQueue.get(e);if(o)for(;o.size>0;)r.fire(h({event:e},o.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new Yo,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},xt={};Fo(xt,{None:()=>Zo,filter:()=>ts,once:()=>Lr,toPromise:()=>es});Zo=()=>{console.log("[Jolibox SDK] None Event")};Rt=Symbol.for("Jolibox.hostEmitter"),rs=()=>{let e=new q;return globalThis[Rt]||(globalThis[Rt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Rt]},re=rs();Fe=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new _e,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return ns(o,r),n(...o)}}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}};Fe=Tr([Ir],Fe);Pt=class{constructor(){this._onWillExecuteCommand=new _e,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new _e,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Fe,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Uo(3e4)),this._starActivation}executeCommand(e,...t){return v(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),xt.toPromise(xt.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}}};Pt=Tr([Ir],Pt);At=Symbol.for("Jolibox.commands")});function M(e,t={}){Ut.emit("ERROR_REPORT",{error:e,options:t})}var Ut,de,G=f(()=>{"use strict";S();S();Ut=new q,de=new q;M.debounce=we(M,50,{leading:!0})});function Le(e,t){return`[${e}]:${t}`}var me,Mt,se=f(()=>{"use strict";G();S();G();me=(e,t)=>{var r,n;return new Ae((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Mt=e=>new xr(e)});var pe,Br,jr,Jr,Be,je=f(()=>{"use strict";pe="custom_event_",Br=[],jr=[],Jr=["env","createRequestTask","login"],Be="__batch_event__"});function $r(e,t){Hr||(Lt=new fe({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),Bt=new fe({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),jt=new fe({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),t("onJoliboxEnterBackground",()=>{Lt.flush(),Bt.flush(),jt.flush()}),Hr=!0);function r(o){var b,g;let{method:s,args:i,startTime:a,isForeground:c,errMsg:u=`${s}:fail no errMsg`,errNo:l=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=o,{receiveJSInvoke:p,invokeCallback:k}=m,I=(g=(b=u.match(/\S:(\S+)\s?/))==null?void 0:b[1])!=null?g:"fail";Lt.report({status:I,method:n(s,i),errNo:`${l}`,errMsg:u,isForeground:c,duration:Date.now()-a}),a&&p&&k&&(Bt.report({status:I,method:s,isForeground:c,duration:Number((p-a).toFixed(3))}),jt.report({status:I,method:s,isForeground:c,duration:Number((Date.now()-k).toFixed(3))}))}function n(o,s){return(o==="callHostMethod"||o==="callHostMethodSync")&&s!=null&&s.method?`${o}-${s.method}`:o}return r}var ss,fe,Hr,Lt,Bt,jt,Jt=f(()=>{"use strict";S();ss=e=>e==="pv"?e:"default",fe=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:o,tagNameOrder:s,metricName:i,type:a}=t;this.reporter=r,this.interval=n,this.eventName=o,this.tagNameOrder=s,this.metricName=i,this.type=ss(a)}report(t){this.type==="pv"?this.addPVPoint(t):this.addPoint(t),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(t){if(Object.keys(this.cache).length){if(t){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(t){let r=(n,o,s,i)=>{let a=o.shift();if(a){let c=i[a];n[c]||(n[c]={}),r(n[c],o,s,i)}else n[s]||(n[s]=[]),n[s].push(i[s])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(o,s,i,a)=>{let c=s.shift();if(!c&&B(a))throw new Ue(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(c){let u=[];if(B(a))u.push(...Object.keys(a));else if(le(a)){if(s.length>0)throw new Ue(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);u.push(a)}else throw new Ue(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);u.forEach(l=>{o[l]||(o[l]={});let m=B(a)?a[l]:a;r(o[l],[...s],i,m)})}else o[i]?o[i]++:o[i]=1},n={point:t,metricName:this.metricName,tagNameOrder:this.tagNameOrder};r(this.cache,[...this.tagNameOrder],this.metricName,t)}processPoints(t){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:t}}clearPoints(){this.cache={}}},Hr=!1});function Kr(e,t){let r=0,n=!0,o=new Map,s=$r(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Ht.forEach(p=>v(this,[p],function*({method:u,args:l,resolve:m}){let k=yield a(u,l);m(k)})),Ht.length=0});let i=(u,l)=>{let m=o.get(Number(u));if(!m)return;let p=Ee(l);m(p),o.delete(Number(u))},a=(u,l)=>{var U,w;let m=Date.now(),p=`${n}`;r+=1;let k=new Q;if(o.set(r,k.resolve),!n&&jr.includes(u))return new Promise(x=>{Ht.push({method:u,args:l,resolve:x})});let b=P(h({},{method:u,startTime:m,args:l,isForeground:p}),{invokeType:"js-bridge"}),g=!is&&Br.includes(u),T=vr(l,g),R=g?T:JSON.stringify(T),_;if(u.endsWith("Sync")||Jr.includes(u)?_=(U=e.call)==null?void 0:U.call(e,u,T,r):typeof R=="string"?_=e.invoke(u,R,r):_=(w=e.call)==null?void 0:w.call(e,u,R,r),_){try{typeof _=="string"&&(_=JSON.parse(_)),_=Ee(_)}catch(x){$.error(x)}return o.delete(r),_.errorCode&&(_.errorCode=Le(u,_.errorCode)),s(h(h({},b),_)),_}return u.endsWith("Sync")&&o.delete(r),k.promise.then(x=>(x.errorCode&&(x.errorCode=Le(u,x.errorCode)),s(h(h({},b),x)),x))};return{invokeNative:a,applyNative:(u,l)=>{let m=a(u,l);return _r(m)?m.then(p=>Vr(u,p)):Vr(u,m)},invokeHandler:i}}function Vr(e,t){if(!B(t)){$.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:o,errorCode:s}=a,i=ce(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new Nr(r,n,o,s);return i}var Ht,is,qr=f(()=>{"use strict";wt();S();se();je();Jt();Ht=[],is=!1});function Gr(e){let t=new q,r=new q,n=new fe({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(o,s,i){let a=Ee(s),c;if(a.__extra){c=a.params;let{type:u,startTime:l}=a.__extra;n.report({type:u,event:o,duration:Date.now()-l})}else c=a;if(o===Be){c.forEach(l=>{let[m,p]=l;try{r.emit(m.slice(pe.length),p,i)}catch(k){}});return}if(o.startsWith(pe)){r.emit(o.slice(pe.length),c,i);return}t.emit(o,c,i)}}}var zr=f(()=>{"use strict";S();wt();Jt();je()});function Wr(e){let t=new Map,r;return(o,s,i,a)=>{if(a){let u=i?[i]:"*";e.publish(`${pe}${o}`,s,u);return}r||(r=Promise.resolve().then(()=>{t.forEach((u,l)=>{try{let m=l?[l]:"*";e.publish(Be,u,m)}catch(m){}}),r=void 0,t.clear()}));let c=t.get(i);c||(c=[],t.set(i,c)),c.push([`${pe}${o}`,s])}}var Qr=f(()=>{"use strict";je()});function $t(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:s}=Gr(e),{invokeNative:i,invokeHandler:a,applyNative:c}=Kr(e,r),u=Wr(e);return{invokeHandler:a,subscribeHandler:t,applyNative:c,invokeNative:i,onNative:r,offNative:n,publish:u,subscribe:o,unsubscribe:s}}var Yr=f(()=>{"use strict";qr();zr();Qr()});var Xr=f(()=>{"use strict"});var Zr=f(()=>{"use strict";Yr();Xr()});function ge(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Je=f(()=>{"use strict"});var ie,z,en,tn=f(()=>{"use strict";S();Je();G();z={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){z.trigger=e},doExit(e){z.exit=e}},en=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)M(new Cr("native env failed"));else{let{data:t}=JSON.parse(e);return t!=null?t:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(o="")=>{z.trigger(),e.onDocumentReady.postMessage({path:o})};ie={onDocumentReady:t,doExit:o=>v(void 0,null,function*(){let s=yield z.exit();e.doExit.postMessage({uuid:o,shouldInterrupt:s})}),invoke(o,s,i){e.invoke.postMessage({event:o,paramsString:s,callbackId:i})},publish(o,s,i){let a=ge(s,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:o,paramsString:JSON.stringify(a),webviewIds:i}))},call(o,s,i){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(s),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:en};globalThis.joliboxJSCore=h({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(o="")=>{z.trigger(),e.onDocumentReady(JSON.stringify({path:o}))};ie={onDocumentReady:t,invoke(o,s,i){e.invoke(JSON.stringify({event:o,paramsString:s,callbackId:i}))},doExit:o=>v(void 0,null,function*(){let s=yield z.exit();e.doExit(JSON.stringify({uuid:o,shouldInterrupt:s}))}),publish(o,s,i){let a=ge(s,"joliboxJSCore");e.publish({event:o,paramsString:JSON.stringify(a),webviewIds:i})},call(o,s,i){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(s),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:en};globalThis.joliboxJSCore=h({},n)}});function Vt(){globalThis.onmessage=function(e){e.data==="msg:setup"&&([ye]=e.ports,ye.onmessage=function(t){let r=JSON.parse(t.data);r[0]==="publish"?globalThis.ttJSBridge.subscribeHandler(r[1],r[2]):r[0]==="invoke"&&globalThis.ttJSBridge.invokeHandler(r[1],r[2])},ye.publish=function(t,r){let n=ge(r,"messagePort");ye.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},ye.postMessage("msg:setup:ok"))}}var ye,rn=f(()=>{"use strict";Je()});var He=f(()=>{"use strict";tn();rn();Je()});var on,as,sn,nn,V,A,Y,Ha,cs,an,cn,$a,j=f(()=>{"use strict";Zr();He();se();S();He();on=ie;if(!on)throw new Or("No joliboxJScore is found, native bridge not found.");Vt();as=h({},on),sn=$t(as),{invokeHandler:nn}=sn,{applyNative:V,invokeNative:A,onNative:Y,offNative:Ha,subscribeHandler:cs,publish:an,subscribe:cn,unsubscribe:$a}=sn;globalThis.joliboxJSBridge={callHandler:nn,invokeHandler:nn,subscribeHandler:cs}});var Kt,qt,ln,un,dn=f(()=>{"use strict";S();G();Kt=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(o){return{}}},qt=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},ln=e=>{var t;try{let o=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(o!=null&&o.length){let[s,i,a]=o;return{headerJson:Kt(s),payloadJson:Kt(i),signature:Kt(a)}}else throw"joli_source is missing"}catch(r){return M(new Pr(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},un=e=>{let{headerJson:t,payloadJson:r,signature:n}=e,o=qt(t),s=qt(r),i=qt(n);return`${o}.${s}.${i}`}});var ls,$e,mn,Gt=f(()=>{"use strict";S();ls="1.1.11-beta.4",$e=()=>ls,mn=()=>{let e=$e();return`${Mr(e)}`}});var us,pn,zt,fn,L,ds,y,J=f(()=>{"use strict";S();dn();Gt();S();us={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Ft(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:$e()},schema:window.location.href,platform:"h5"},zt=(pn=globalThis.joliboxJSCore)==null?void 0:pn.env,L=Object.assign({},(fn=zt==null?void 0:zt())!=null?fn:us),ds=()=>{var p,k,I,b,g,T,R,_,U;let{payloadJson:e,headerJson:t,signature:r}=L.schema.length?ln(L.schema):{},n=`${L.deviceInfo.did}-${new Date().getTime()}`,s=new URL(L.schema.length?L.schema:window.location.href).searchParams,i=(I=(k=(p=s.get("mpId"))!=null?p:s.get("appId"))!=null?k:s.get("gameId"))!=null?I:"",a=(T=(g=(b=L.clientSessionId)!=null?b:e==null?void 0:e.sessionId)!=null?g:s.get("sessionId"))!=null?T:n,c=!!((R=e==null?void 0:e.testAdsMode)!=null?R:s.get("testAdsMode")==="true"),u=(U=(_=e==null?void 0:e.joliboxEnv)!=null?_:s.get("joliboxEnv"))!=null?U:"production",l=u==="staging",m=t==null?void 0:t.channel;return{get testMode(){return l},get testAdsMode(){return c},get joliboxEnv(){return u},get joliSource(){var w;return(w=s.get("joliSource"))!=null?w:null},get mpId(){var w;return(w=i!=null?i:e==null?void 0:e.id)!=null?w:""},get mpVersion(){var w;return(w=t==null?void 0:t.ver)!=null?w:$e()},get mpType(){var w,x;return(x=(w=t==null?void 0:t.__mpType)!=null?w:e==null?void 0:e.__mpType)!=null?x:"game"},get platform(){var w;return(w=L.platform)!=null?w:L.deviceInfo.platform},get deviceInfo(){return L.deviceInfo},get sdkInfo(){return L.sdkInfo},get hostInfo(){return L.hostInfo},get hostUserInfo(){return L.hostUserInfo},get sessionId(){var w,x;return(x=(w=L.clientSessionId)!=null?w:a)!=null?x:n},get channel(){return m},get webviewId(){var w;return(w=L.webviewId)!=null?w:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:w=>{wr(L,w,Rr)},encodeJoliSourceQuery:w=>{var x;return t&&r?un({headerJson:t,payloadJson:h(h({},e),w),signature:r}):(x=s.get("joliSource"))!=null?x:""}}},y=ds()});var Wt,gn,ms,ps,hn,fs,yn=f(()=>{"use strict";S();G();J();S();Wt=!1,gn=(e,t)=>e==null?!1:t in e,ms=e=>gn(e,"kind"),ps=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},hn=(e,t={},r)=>{var s,i,a;let n={user_id:(i=(s=y.hostUserInfo)==null?void 0:s.uid)!=null?i:"",device_id:(a=y.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:ps(e.name)},o=P(h({},n),{env:t.environment,isFromUser:r});r?de.emit("GLOBAL_USER_ERROR",e,o):de.emit("GLOBAL_ERROR",e,o)},fs=e=>gn(e,"kind")&&e.kind==="USER_ERROR";Ut.on("ERROR_REPORT",({error:e,options:t})=>{if(Wt)return;Wt=!0;let r=ms(e)&&e.raw?e.raw:e;try{let n=fs(e);hn(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),s=new Nt(`${o}, origin error: ${r.message}`);$.error(s),hn(new Nt(s.message),{environment:t.environment},!1)}finally{Wt=!1}})});var vn=f(()=>{"use strict";yn();se();S();j();de.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};A("trackAsync",{event:"reportJsError",data:r})});de.on("GLOBAL_USER_ERROR",(e,t)=>{$.log("UserError",e,t)})});var Qt=f(()=>{"use strict"});function bn(e,t){let r=(n,o,s)=>{let i=P(h({tag:n},t),{extra:h({},o)});n=="globalJsError"?M(new Dr(JSON.stringify(i))):e("systemLog",i,s)};return r.debounce=we(r,500,{leading:!0}),r}function kn(e){let t=(r,n,o)=>{var a;let s=(a=o&&JSON.stringify(o))!=null?a:0,i={speed_value_type:r,total_duration:n};s&&Object.assign(i,{extra:s}),e("joliboxSpeedAnalysis",i)};return t.debounce=we(t,500,{leading:!0}),t}var Tn=f(()=>{"use strict";S();S();G()});function En(e,t){let r=bn(e,t),n=kn(r);return{track:r,trackPerformance:n}}var Sn=f(()=>{"use strict";Tn()});var _n=f(()=>{"use strict";J();S();S()});var In=f(()=>{"use strict";Sn();Qt();_n()});var Ve,wn=f(()=>{"use strict";Ve=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,o,s=!1,i=0,a=()=>{if(!s)return;let k=Date.now(),I=k-r;I>=this.interval&&(this.visible&&(i+=I,t(i)),r=k),n=requestAnimationFrame(a)},c=()=>{l(),r=Date.now(),o=window.setInterval(()=>{if(!s)return;let k=Date.now();k-r>=this.interval&&(r=k)},this.interval)},u=()=>{m(),r=Date.now(),n=requestAnimationFrame(a)},l=()=>{n&&(cancelAnimationFrame(n),n=0)},m=()=>{o&&(clearInterval(o),o=0)};this.eventEmitter.on("visible",k=>{s&&(console.log("visible",k),k?u():c())});let p=this.visible;return{start(){s||(s=!0,p?u():c())},stop(){s=!1,l(),m()}}}}});var Yt=f(()=>{"use strict"});function An(e,t,r){let{response:n,startTime:o,endTime:s,requestFrom:i}=r,{errMsg:a="",profile:c={}}=n,l={duration:s-o,request_type:e,url:t.split("?")[0],result:r.state,error_msg:r.state==="fail"?a:"",socket_reused:c.socketReused?1:0,request_from:i};(i==="public"&&Rn<gs||i==="inner")&&(l.joli_request_number=Rn++,setTimeout(()=>{K("joliboxNetRequestResult",l)},500))}var Rn,gs,xn=f(()=>{"use strict";Yt();ae();Rn=0,gs=10});function Ke(e,t,r){var c,u,l;let n=new Map,o=(c=r==null?void 0:r.baseUrl)!=null?c:"https://api.jolibox.com",s=(u=r==null?void 0:r.type)!=null?u:"public",i=(l=r==null?void 0:r.defaultHeaders)!=null?l:{};return Y("onRequestTaskStateChange",m=>{if(typeof m.requestTaskId!="string")return;let p=n.get(m.requestTaskId);if(p)if(m.state==="success"){let k=m,{requestTaskId:b,state:g}=k,T=ce(k,["requestTaskId","state"]);p.resolve(T),n.delete(b)}else if(m.state==="fail"){let I=m,{requestTaskId:b,state:g}=I,T=ce(I,["requestTaskId","state"]);p.reject(T),n.delete(b)}else $.warn("onRequestTaskStateChange unknown event",m)}),re.on("onLoginComplete",({isLogin:m,token:p})=>{m&&p&&(i["X-JOLI-TOKEN"]=p)}),(k,...I)=>v(this,[k,...I],function*(m,p={}){let b=Date.now(),g=ys(m,P(h({},p),{baseUrl:o})),{method:T="GET",responseType:R="text",dataType:_="json",timeout:U,enableCache:w=!1,appendHostCookie:x=!0}=p,Te=Object.assign({"content-type":"application/json"},i,p.header),oe={url:g,method:T,header:Te,enableCache:w,responseType:R,appendHostCookie:x};if(T=="POST"||T=="PUT"){let W=bs(p.data,Te["content-type"]);oe.data=W}U&&Object.assign(oe,{timeout:U});let{data:{requestTaskId:_t}}=A(e,oe);if(typeof _t!="string")throw me({code:-1,msg:"requestTaskId is not a string"});let mr=(W,ee)=>{An("request",g,{state:W,startTime:b,endTime:Date.now(),params:oe,response:ee,requestId:_t,requestFrom:s=="public"?"public":"inner"})},{resolve:vo,reject:bo,promise:ko}=new Q;n.set(_t,{resolve:vo,reject:bo});try{let W=yield ko;mr("success",W);let{data:ee}=W;return _==="json"&&typeof ee=="string"&&(ee=vs(ee)),{url:g,timeout:U,method:T,response:P(h({},W),{data:ee})}}catch(W){let ee=W;if(B(ee)){let{errMsg:Pe,prefetchDetail:To,isPrefetch:Eo,errNo:So}=ee;le(Pe)&&(mr("fail",{errMsg:Pe,isPrefetch:Eo,prefetchDetail:To}),M(me({code:-1,msg:Pe},{errNo:So,errMsg:Pe})))}throw W}})}function vs(e){try{return JSON.parse(e.trim())}catch(t){return e}}function bs(e,t="application/json"){let r=t.toLowerCase();return e===void 0?"":typeof e=="string"||e instanceof ArrayBuffer?e:r.includes("application/x-www-form-urlencoded")||r.includes("application/json")||typeof e=="object"?JSON.stringify(e):String(e)}var ys,Xt=f(()=>{"use strict";S();xn();Yt();j();G();se();ys=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,o=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${o?`?${o}`:""}`:`${e}${o?`?${o}`:""}`}});var Zt,Pn,X,qe=f(()=>{"use strict";Gt();Xt();J();Zt={"x-user-agent":mn()};(Pn=y.hostUserInfo)!=null&&Pn.token&&(Zt["x-joli-token"]=y.hostUserInfo.token);y.joliSource&&(Zt["x-joli-source"]=y.joliSource);X=Ke("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:y.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Zt})});var Ge,Cn=f(()=>{"use strict";J();wn();qe();j();Ge=class extends Ve{constructor(t,r,n){super(r,n),this.gameId=y.mpId,this.sessionId=y.sessionId,this.track=t}reporter(t){return v(this,null,function*(){let{event:r,params:n}=t,o=[];o.push(X("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:h({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(o)})}reportToNative(t){return v(this,null,function*(){let{event:r,params:n}=t;yield V("userTrackAsync",{event:r,params:h({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var Un={};gr(Un,{nativeTaskEmitter:()=>xe,taskTracker:()=>H,track:()=>K,trackPerformance:()=>Dn});var ks,Nn,On,K,Dn,Fn,xe,H,ae=f(()=>{"use strict";vn();S();Qt();In();J();Cn();j();ks=(e,t,r)=>{var i,a;let n=t,o=B(n.extra)?n.extra:le(n.extra)?JSON.parse(n.extra):{},s=P(h({},o),{mp_id:(i=n.mp_id)!=null?i:"",mp_version:(a=n.mp_version)!=null?a:""});A("trackAsync",{event:e,data:s,webviewId:r})},{track:K,trackPerformance:Dn}=En(ks,{type:Dt.AppSDK,platform:"native",jssdk_version:(On=(Nn=y.sdkInfo)==null?void 0:Nn.jssdkVersion)!=null?On:"1.0.0",mp_id:y.mpId,mp_version:y.mpVersion}),Fn=O();Fn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Dn(e,t,r)});Fn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{K(e,t)});xe=new q,H=new Ge(K,xe)});function Mn(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let s=`
1
+ var _o=Object.create;var Ne=Object.defineProperty,Io=Object.defineProperties,wo=Object.getOwnPropertyDescriptor,Ro=Object.getOwnPropertyDescriptors,Ao=Object.getOwnPropertyNames,Ce=Object.getOwnPropertySymbols,xo=Object.getPrototypeOf,It=Object.prototype.hasOwnProperty,fr=Object.prototype.propertyIsEnumerable;var pr=(e,t,r)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,h=(e,t)=>{for(var r in t||(t={}))It.call(t,r)&&pr(e,r,t[r]);if(Ce)for(var r of Ce(t))fr.call(t,r)&&pr(e,r,t[r]);return e},P=(e,t)=>Io(e,Ro(t));var ce=(e,t)=>{var r={};for(var n in e)It.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ce)for(var n of Ce(e))t.indexOf(n)<0&&fr.call(e,n)&&(r[n]=e[n]);return r};var f=(e,t)=>()=>(e&&(t=e(e=0)),t);var hr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),gr=(e,t)=>{for(var r in t)Ne(e,r,{get:t[r],enumerable:!0})},Po=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ao(t))!It.call(e,o)&&o!==r&&Ne(e,o,{get:()=>t[o],enumerable:!(n=wo(t,o))||n.enumerable});return e};var yr=(e,t,r)=>(r=e!=null?_o(xo(e)):{},Po(t||!e||!e.__esModule?Ne(r,"default",{value:e,enumerable:!0}):r,e));var v=(e,t,r)=>new Promise((n,o)=>{var s=c=>{try{a(r.next(c))}catch(u){o(u)}},i=c=>{try{a(r.throw(c))}catch(u){o(u)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(s,i);a((r=r.apply(e,t)).next())});function Co(e){return!!(e!=null&&e.__nativeBuffers__)}function Ee(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!Co(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let o;n.value?o=n.value:n.base64&&(o=No(n.base64)),typeof o!="undefined"&&o instanceof ArrayBuffer&&(e[n.key]=o)}}return e}function vr(e={},t=!1){let r=e,n=[];for(let[o,s]of Object.entries(r))if(s!==void 0&&s instanceof ArrayBuffer&&s.byteLength!==void 0){let i=t?{value:s,key:o}:{base64:Oo(s),key:o};n.push(i),delete r[o]}return n.length>0&&(r.__nativeBuffers__=n),r}var No,Oo,wt=f(()=>{"use strict";No=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(o);return n.buffer};Oo=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return btoa(t)}});function Uo(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function le(e){return typeof e=="string"}function B(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Er(e){return typeof e=="object"&&Array.isArray(e)}function Ie(e){return e===!0||e===!1}function Mo(e){return typeof e>"u"}function Lo(e){return Mo(e)||e===null}function Sr(e){return typeof e=="function"}function _r(e){return B(e)&&Sr(e.then)}function Ir(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function wr(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(o,s){for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i)){let a=o[i],c=s[i],u=r(a,c,i,o,s);u!==void 0?o[i]=u:br(c)&&br(a)?o[i]=n(h({},a),c):Array.isArray(c)&&Array.isArray(a)?o[i]=[...a,...c]:o[i]=c}return o}return n(e,t)}function br(e){return e&&typeof e=="object"&&e.constructor===Object}function Rr(e,t){if(Array.isArray(e))return e.concat(t)}function we(e,t,r={}){let n=null,o,s,i,{leading:a=!1,trailing:c=!0}=r,u=()=>(i=e.apply(s,o),o=void 0,s=void 0,i),l=function(...m){o=m,s=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,c&&!p&&u()},t),p)return u()};return l.cancel=()=>{n&&clearTimeout(n),n=null,o=s=void 0},l.flush=()=>{if(n)return clearTimeout(n),n=null,u()},l}function jo(e,t){return(...r)=>t(e,...r)}function Me(e){return t=>jo(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(o){e(new Re(`${o}`))}})}function Se(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function es(e){return new Promise(t=>Lr(e)(t))}function Lr(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function ts(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(s.fire,s)}},s=new _e(o);return s.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function ns(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)os(e[n],t[n])}function os(e,t){if(le(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Sr(t)){try{if(e instanceof t)return}catch(r){}if(!Lo(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 O(){if(globalThis[At])return globalThis[At];let e=new Fe,t=new Pt,r={registerCommand(n,o,s){e.registerCommand({id:n,handler:o,metadata:s})},executeCommand(n,...o){return t.executeCommand(n,...o)},excuteCommandSync(n,...o){return t.executeCommandThowErr(n,...o)}};return globalThis[At]=r,r}var kr,Do,Fo,Tr,Q,Bo,Ct,ue,Ar,xr,Re,Pr,Cr,Nr,Or,Dr,Ae,Ue,Nt,$,Fr,Jo,Ot,Ho,Dt,$o,Vo,Oe,Ko,qo,Go,Ur,Ft,zo,Wo,Qo,Mr,te,C,Yo,Xo,De,_e,q,xt,Zo,Rt,rs,re,Fe,Pt,At,S=f(()=>{"use strict";kr=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,Fo=(e,t)=>{for(var r in t)kr(e,r,{get:t[r],enumerable:!0})},Tr=(e,t,r,n)=>{for(var o=n>1?void 0:n?Do(t,r):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&kr(t,r,o),o};Q=class{constructor(){this.state="pending",this.promise=new Promise((e,t)=>{this.resolve=r=>{this.state==="pending"&&(this.state="fulfilled",e(r))},this.reject=r=>{this.state==="pending"&&(this.state="rejected",t(r))}})}};Bo=(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))(Bo||{}),Ct=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}},ue=class extends Ct{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Ar=class extends Ct{constructor(){super(...arguments),this.kind="USER_ERROR"}},xr=class extends Ar{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Re=class extends Ar{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))}},Pr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Cr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Nr=class extends ue{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Or=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Dr=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Ae=class extends Ct{constructor(e,t,r,n,o){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),o&&(this.priority=o)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},Ue=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},Nt=class extends ue{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};$={log:Se("log"),warn:Se("warn"),info:Se("info"),error:Se("error"),debug:Se("debug")};Object.assign(globalThis,{logger:$});Fr=Symbol.for("Jolibox.canIUseMap"),Jo={};globalThis[Fr]=Jo;Ot={get config(){return globalThis[Fr]}},Ho=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(Ho||{}),Dt=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Dt||{}),$o=(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))($o||{}),Vo=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),Oe={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")},Ko=()=>Oe.isiOS?"iOS":Oe.isAndroid?"Android":Oe.isMac?"Mac":Oe.isFacebook?"Facebook":"PC",qo="device_id",Go="advertising_id",Ur=e=>(localStorage.getItem(e)||localStorage.setItem(e,Vo()),localStorage.getItem(e)),Ft=()=>Ur(qo),zo=()=>Ur(Go),Wo=e=>e.charAt(0).toUpperCase()+e.slice(1),Qo=()=>{var t;let e=new URLSearchParams(window.location.search);return Wo((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Mr=e=>{let t="JoliboxWebSDK",r=Ko(),n=navigator.language,o=Ft(),s=zo();return`${t} (${Qo()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${o} adid/${s} version/${e||""}`},C=(te=class{constructor(t){this.element=t,this.next=te.Undefined,this.prev=te.Undefined}},te.Undefined=new te(void 0),te),Yo=class{constructor(){this._first=C.Undefined,this._last=C.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===C.Undefined}clear(){let e=this._first;for(;e!==C.Undefined;){let t=e.next;e.prev=C.Undefined,e.next=C.Undefined,e=t}this._first=C.Undefined,this._last=C.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new C(e);if(this._first===C.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==C.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==C.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==C.Undefined&&e.next!==C.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===C.Undefined&&e.next===C.Undefined?(this._first=C.Undefined,this._last=C.Undefined):e.next===C.Undefined?(this._last=this._last.prev,this._last.next=C.Undefined):e.prev===C.Undefined&&(this._first=this._first.next,this._first.prev=C.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==C.Undefined;)yield e.element,e=e.next}},Xo=0,De=class{constructor(e){this.value=e,this.id=Xo++}},_e=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof De&&(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 o,s,i,a,c,u;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new De(t);this._listeners?this._listeners instanceof De?this._listeners=[this._listeners,n]:this._listeners.push(n):((s=(o=this.options)==null?void 0:o.onWillAddFirstListener)==null||s.call(o,this),this._listeners=n,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(u=(c=this.options)==null?void 0:c.onDidAddListener)==null||u.call(c,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(o){r(o)}}fire(e){this._listeners&&(this._listeners instanceof De?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},q=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var s;let r=(s=this.listeners.get(e))!=null?s:new _e,n=i=>t(...i.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let o=this.cachedEventQueue.get(e);if(o)for(;o.size>0;)r.fire(h({event:e},o.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new Yo,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},xt={};Fo(xt,{None:()=>Zo,filter:()=>ts,once:()=>Lr,toPromise:()=>es});Zo=()=>{console.log("[Jolibox SDK] None Event")};Rt=Symbol.for("Jolibox.hostEmitter"),rs=()=>{let e=new q;return globalThis[Rt]||(globalThis[Rt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Rt]},re=rs();Fe=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new _e,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return ns(o,r),n(...o)}}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}};Fe=Tr([Ir],Fe);Pt=class{constructor(){this._onWillExecuteCommand=new _e,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new _e,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Fe,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Uo(3e4)),this._starActivation}executeCommand(e,...t){return v(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),xt.toPromise(xt.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}}};Pt=Tr([Ir],Pt);At=Symbol.for("Jolibox.commands")});function M(e,t={}){Ut.emit("ERROR_REPORT",{error:e,options:t})}var Ut,de,G=f(()=>{"use strict";S();S();Ut=new q,de=new q;M.debounce=we(M,50,{leading:!0})});function Le(e,t){return`[${e}]:${t}`}var me,Mt,se=f(()=>{"use strict";G();S();G();me=(e,t)=>{var r,n;return new Ae((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Mt=e=>new xr(e)});var pe,Br,jr,Jr,Be,je=f(()=>{"use strict";pe="custom_event_",Br=[],jr=[],Jr=["env","createRequestTask","login"],Be="__batch_event__"});function $r(e,t){Hr||(Lt=new fe({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),Bt=new fe({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),jt=new fe({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),t("onJoliboxEnterBackground",()=>{Lt.flush(),Bt.flush(),jt.flush()}),Hr=!0);function r(o){var b,g;let{method:s,args:i,startTime:a,isForeground:c,errMsg:u=`${s}:fail no errMsg`,errNo:l=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=o,{receiveJSInvoke:p,invokeCallback:k}=m,I=(g=(b=u.match(/\S:(\S+)\s?/))==null?void 0:b[1])!=null?g:"fail";Lt.report({status:I,method:n(s,i),errNo:`${l}`,errMsg:u,isForeground:c,duration:Date.now()-a}),a&&p&&k&&(Bt.report({status:I,method:s,isForeground:c,duration:Number((p-a).toFixed(3))}),jt.report({status:I,method:s,isForeground:c,duration:Number((Date.now()-k).toFixed(3))}))}function n(o,s){return(o==="callHostMethod"||o==="callHostMethodSync")&&s!=null&&s.method?`${o}-${s.method}`:o}return r}var ss,fe,Hr,Lt,Bt,jt,Jt=f(()=>{"use strict";S();ss=e=>e==="pv"?e:"default",fe=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:o,tagNameOrder:s,metricName:i,type:a}=t;this.reporter=r,this.interval=n,this.eventName=o,this.tagNameOrder=s,this.metricName=i,this.type=ss(a)}report(t){this.type==="pv"?this.addPVPoint(t):this.addPoint(t),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(t){if(Object.keys(this.cache).length){if(t){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(t){let r=(n,o,s,i)=>{let a=o.shift();if(a){let c=i[a];n[c]||(n[c]={}),r(n[c],o,s,i)}else n[s]||(n[s]=[]),n[s].push(i[s])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(o,s,i,a)=>{let c=s.shift();if(!c&&B(a))throw new Ue(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(c){let u=[];if(B(a))u.push(...Object.keys(a));else if(le(a)){if(s.length>0)throw new Ue(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);u.push(a)}else throw new Ue(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);u.forEach(l=>{o[l]||(o[l]={});let m=B(a)?a[l]:a;r(o[l],[...s],i,m)})}else o[i]?o[i]++:o[i]=1},n={point:t,metricName:this.metricName,tagNameOrder:this.tagNameOrder};r(this.cache,[...this.tagNameOrder],this.metricName,t)}processPoints(t){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:t}}clearPoints(){this.cache={}}},Hr=!1});function Kr(e,t){let r=0,n=!0,o=new Map,s=$r(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Ht.forEach(p=>v(this,[p],function*({method:u,args:l,resolve:m}){let k=yield a(u,l);m(k)})),Ht.length=0});let i=(u,l)=>{let m=o.get(Number(u));if(!m)return;let p=Ee(l);m(p),o.delete(Number(u))},a=(u,l)=>{var U,w;let m=Date.now(),p=`${n}`;r+=1;let k=new Q;if(o.set(r,k.resolve),!n&&jr.includes(u))return new Promise(x=>{Ht.push({method:u,args:l,resolve:x})});let b=P(h({},{method:u,startTime:m,args:l,isForeground:p}),{invokeType:"js-bridge"}),g=!is&&Br.includes(u),T=vr(l,g),R=g?T:JSON.stringify(T),_;if(u.endsWith("Sync")||Jr.includes(u)?_=(U=e.call)==null?void 0:U.call(e,u,T,r):typeof R=="string"?_=e.invoke(u,R,r):_=(w=e.call)==null?void 0:w.call(e,u,R,r),_){try{typeof _=="string"&&(_=JSON.parse(_)),_=Ee(_)}catch(x){$.error(x)}return o.delete(r),_.errorCode&&(_.errorCode=Le(u,_.errorCode)),s(h(h({},b),_)),_}return u.endsWith("Sync")&&o.delete(r),k.promise.then(x=>(x.errorCode&&(x.errorCode=Le(u,x.errorCode)),s(h(h({},b),x)),x))};return{invokeNative:a,applyNative:(u,l)=>{let m=a(u,l);return _r(m)?m.then(p=>Vr(u,p)):Vr(u,m)},invokeHandler:i}}function Vr(e,t){if(!B(t)){$.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:o,errorCode:s}=a,i=ce(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new Nr(r,n,o,s);return i}var Ht,is,qr=f(()=>{"use strict";wt();S();se();je();Jt();Ht=[],is=!1});function Gr(e){let t=new q,r=new q,n=new fe({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(o,s,i){let a=Ee(s),c;if(a.__extra){c=a.params;let{type:u,startTime:l}=a.__extra;n.report({type:u,event:o,duration:Date.now()-l})}else c=a;if(o===Be){c.forEach(l=>{let[m,p]=l;try{r.emit(m.slice(pe.length),p,i)}catch(k){}});return}if(o.startsWith(pe)){r.emit(o.slice(pe.length),c,i);return}t.emit(o,c,i)}}}var zr=f(()=>{"use strict";S();wt();Jt();je()});function Wr(e){let t=new Map,r;return(o,s,i,a)=>{if(a){let u=i?[i]:"*";e.publish(`${pe}${o}`,s,u);return}r||(r=Promise.resolve().then(()=>{t.forEach((u,l)=>{try{let m=l?[l]:"*";e.publish(Be,u,m)}catch(m){}}),r=void 0,t.clear()}));let c=t.get(i);c||(c=[],t.set(i,c)),c.push([`${pe}${o}`,s])}}var Qr=f(()=>{"use strict";je()});function $t(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:s}=Gr(e),{invokeNative:i,invokeHandler:a,applyNative:c}=Kr(e,r),u=Wr(e);return{invokeHandler:a,subscribeHandler:t,applyNative:c,invokeNative:i,onNative:r,offNative:n,publish:u,subscribe:o,unsubscribe:s}}var Yr=f(()=>{"use strict";qr();zr();Qr()});var Xr=f(()=>{"use strict"});var Zr=f(()=>{"use strict";Yr();Xr()});function ge(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Je=f(()=>{"use strict"});var ie,z,en,tn=f(()=>{"use strict";S();Je();G();z={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){z.trigger=e},doExit(e){z.exit=e}},en=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)M(new Cr("native env failed"));else{let{data:t}=JSON.parse(e);return t!=null?t:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(o="")=>{z.trigger(),e.onDocumentReady.postMessage({path:o})};ie={onDocumentReady:t,doExit:o=>v(void 0,null,function*(){let s=yield z.exit();e.doExit.postMessage({uuid:o,shouldInterrupt:s})}),invoke(o,s,i){e.invoke.postMessage({event:o,paramsString:s,callbackId:i})},publish(o,s,i){let a=ge(s,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:o,paramsString:JSON.stringify(a),webviewIds:i}))},call(o,s,i){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(s),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:en};globalThis.joliboxJSCore=h({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(o="")=>{z.trigger(),e.onDocumentReady(JSON.stringify({path:o}))};ie={onDocumentReady:t,invoke(o,s,i){e.invoke(JSON.stringify({event:o,paramsString:s,callbackId:i}))},doExit:o=>v(void 0,null,function*(){let s=yield z.exit();e.doExit(JSON.stringify({uuid:o,shouldInterrupt:s}))}),publish(o,s,i){let a=ge(s,"joliboxJSCore");e.publish({event:o,paramsString:JSON.stringify(a),webviewIds:i})},call(o,s,i){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(s),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:en};globalThis.joliboxJSCore=h({},n)}});function Vt(){globalThis.onmessage=function(e){e.data==="msg:setup"&&([ye]=e.ports,ye.onmessage=function(t){let r=JSON.parse(t.data);r[0]==="publish"?globalThis.ttJSBridge.subscribeHandler(r[1],r[2]):r[0]==="invoke"&&globalThis.ttJSBridge.invokeHandler(r[1],r[2])},ye.publish=function(t,r){let n=ge(r,"messagePort");ye.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},ye.postMessage("msg:setup:ok"))}}var ye,rn=f(()=>{"use strict";Je()});var He=f(()=>{"use strict";tn();rn();Je()});var on,as,sn,nn,V,A,Y,Ha,cs,an,cn,$a,j=f(()=>{"use strict";Zr();He();se();S();He();on=ie;if(!on)throw new Or("No joliboxJScore is found, native bridge not found.");Vt();as=h({},on),sn=$t(as),{invokeHandler:nn}=sn,{applyNative:V,invokeNative:A,onNative:Y,offNative:Ha,subscribeHandler:cs,publish:an,subscribe:cn,unsubscribe:$a}=sn;globalThis.joliboxJSBridge={callHandler:nn,invokeHandler:nn,subscribeHandler:cs}});var Kt,qt,ln,un,dn=f(()=>{"use strict";S();G();Kt=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(o){return{}}},qt=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},ln=e=>{var t;try{let o=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(o!=null&&o.length){let[s,i,a]=o;return{headerJson:Kt(s),payloadJson:Kt(i),signature:Kt(a)}}else throw"joli_source is missing"}catch(r){return M(new Pr(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},un=e=>{let{headerJson:t,payloadJson:r,signature:n}=e,o=qt(t),s=qt(r),i=qt(n);return`${o}.${s}.${i}`}});var ls,$e,mn,Gt=f(()=>{"use strict";S();ls="1.1.11-beta.5",$e=()=>ls,mn=()=>{let e=$e();return`${Mr(e)}`}});var us,pn,zt,fn,L,ds,y,J=f(()=>{"use strict";S();dn();Gt();S();us={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Ft(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:$e()},schema:window.location.href,platform:"h5"},zt=(pn=globalThis.joliboxJSCore)==null?void 0:pn.env,L=Object.assign({},(fn=zt==null?void 0:zt())!=null?fn:us),ds=()=>{var p,k,I,b,g,T,R,_,U;let{payloadJson:e,headerJson:t,signature:r}=L.schema.length?ln(L.schema):{},n=`${L.deviceInfo.did}-${new Date().getTime()}`,s=new URL(L.schema.length?L.schema:window.location.href).searchParams,i=(I=(k=(p=s.get("mpId"))!=null?p:s.get("appId"))!=null?k:s.get("gameId"))!=null?I:"",a=(T=(g=(b=L.clientSessionId)!=null?b:e==null?void 0:e.sessionId)!=null?g:s.get("sessionId"))!=null?T:n,c=!!((R=e==null?void 0:e.testAdsMode)!=null?R:s.get("testAdsMode")==="true"),u=(U=(_=e==null?void 0:e.joliboxEnv)!=null?_:s.get("joliboxEnv"))!=null?U:"production",l=u==="staging",m=t==null?void 0:t.channel;return{get testMode(){return l},get testAdsMode(){return c},get joliboxEnv(){return u},get joliSource(){var w;return(w=s.get("joliSource"))!=null?w:null},get mpId(){var w;return(w=i!=null?i:e==null?void 0:e.id)!=null?w:""},get mpVersion(){var w;return(w=t==null?void 0:t.ver)!=null?w:$e()},get mpType(){var w,x;return(x=(w=t==null?void 0:t.__mpType)!=null?w:e==null?void 0:e.__mpType)!=null?x:"game"},get platform(){var w;return(w=L.platform)!=null?w:L.deviceInfo.platform},get deviceInfo(){return L.deviceInfo},get sdkInfo(){return L.sdkInfo},get hostInfo(){return L.hostInfo},get hostUserInfo(){return L.hostUserInfo},get sessionId(){var w,x;return(x=(w=L.clientSessionId)!=null?w:a)!=null?x:n},get channel(){return m},get webviewId(){var w;return(w=L.webviewId)!=null?w:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:w=>{wr(L,w,Rr)},encodeJoliSourceQuery:w=>{var x;return t&&r?un({headerJson:t,payloadJson:h(h({},e),w),signature:r}):(x=s.get("joliSource"))!=null?x:""}}},y=ds()});var Wt,gn,ms,ps,hn,fs,yn=f(()=>{"use strict";S();G();J();S();Wt=!1,gn=(e,t)=>e==null?!1:t in e,ms=e=>gn(e,"kind"),ps=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},hn=(e,t={},r)=>{var s,i,a;let n={user_id:(i=(s=y.hostUserInfo)==null?void 0:s.uid)!=null?i:"",device_id:(a=y.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:ps(e.name)},o=P(h({},n),{env:t.environment,isFromUser:r});r?de.emit("GLOBAL_USER_ERROR",e,o):de.emit("GLOBAL_ERROR",e,o)},fs=e=>gn(e,"kind")&&e.kind==="USER_ERROR";Ut.on("ERROR_REPORT",({error:e,options:t})=>{if(Wt)return;Wt=!0;let r=ms(e)&&e.raw?e.raw:e;try{let n=fs(e);hn(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),s=new Nt(`${o}, origin error: ${r.message}`);$.error(s),hn(new Nt(s.message),{environment:t.environment},!1)}finally{Wt=!1}})});var vn=f(()=>{"use strict";yn();se();S();j();de.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};A("trackAsync",{event:"reportJsError",data:r})});de.on("GLOBAL_USER_ERROR",(e,t)=>{$.log("UserError",e,t)})});var Qt=f(()=>{"use strict"});function bn(e,t){let r=(n,o,s)=>{let i=P(h({tag:n},t),{extra:h({},o)});n=="globalJsError"?M(new Dr(JSON.stringify(i))):e("systemLog",i,s)};return r.debounce=we(r,500,{leading:!0}),r}function kn(e){let t=(r,n,o)=>{var a;let s=(a=o&&JSON.stringify(o))!=null?a:0,i={speed_value_type:r,total_duration:n};s&&Object.assign(i,{extra:s}),e("joliboxSpeedAnalysis",i)};return t.debounce=we(t,500,{leading:!0}),t}var Tn=f(()=>{"use strict";S();S();G()});function En(e,t){let r=bn(e,t),n=kn(r);return{track:r,trackPerformance:n}}var Sn=f(()=>{"use strict";Tn()});var _n=f(()=>{"use strict";J();S();S()});var In=f(()=>{"use strict";Sn();Qt();_n()});var Ve,wn=f(()=>{"use strict";Ve=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,o,s=!1,i=0,a=()=>{if(!s)return;let k=Date.now(),I=k-r;I>=this.interval&&(this.visible&&(i+=I,t(i)),r=k),n=requestAnimationFrame(a)},c=()=>{l(),r=Date.now(),o=window.setInterval(()=>{if(!s)return;let k=Date.now();k-r>=this.interval&&(r=k)},this.interval)},u=()=>{m(),r=Date.now(),n=requestAnimationFrame(a)},l=()=>{n&&(cancelAnimationFrame(n),n=0)},m=()=>{o&&(clearInterval(o),o=0)};this.eventEmitter.on("visible",k=>{s&&(console.log("visible",k),k?u():c())});let p=this.visible;return{start(){s||(s=!0,p?u():c())},stop(){s=!1,l(),m()}}}}});var Yt=f(()=>{"use strict"});function An(e,t,r){let{response:n,startTime:o,endTime:s,requestFrom:i}=r,{errMsg:a="",profile:c={}}=n,l={duration:s-o,request_type:e,url:t.split("?")[0],result:r.state,error_msg:r.state==="fail"?a:"",socket_reused:c.socketReused?1:0,request_from:i};(i==="public"&&Rn<gs||i==="inner")&&(l.joli_request_number=Rn++,setTimeout(()=>{K("joliboxNetRequestResult",l)},500))}var Rn,gs,xn=f(()=>{"use strict";Yt();ae();Rn=0,gs=10});function Ke(e,t,r){var c,u,l;let n=new Map,o=(c=r==null?void 0:r.baseUrl)!=null?c:"https://api.jolibox.com",s=(u=r==null?void 0:r.type)!=null?u:"public",i=(l=r==null?void 0:r.defaultHeaders)!=null?l:{};return Y("onRequestTaskStateChange",m=>{if(typeof m.requestTaskId!="string")return;let p=n.get(m.requestTaskId);if(p)if(m.state==="success"){let k=m,{requestTaskId:b,state:g}=k,T=ce(k,["requestTaskId","state"]);p.resolve(T),n.delete(b)}else if(m.state==="fail"){let I=m,{requestTaskId:b,state:g}=I,T=ce(I,["requestTaskId","state"]);p.reject(T),n.delete(b)}else $.warn("onRequestTaskStateChange unknown event",m)}),re.on("onLoginComplete",({isLogin:m,token:p})=>{m&&p&&(i["X-JOLI-TOKEN"]=p)}),(k,...I)=>v(this,[k,...I],function*(m,p={}){let b=Date.now(),g=ys(m,P(h({},p),{baseUrl:o})),{method:T="GET",responseType:R="text",dataType:_="json",timeout:U,enableCache:w=!1,appendHostCookie:x=!0}=p,Te=Object.assign({"content-type":"application/json"},i,p.header),oe={url:g,method:T,header:Te,enableCache:w,responseType:R,appendHostCookie:x};if(T=="POST"||T=="PUT"){let W=bs(p.data,Te["content-type"]);oe.data=W}U&&Object.assign(oe,{timeout:U});let{data:{requestTaskId:_t}}=A(e,oe);if(typeof _t!="string")throw me({code:-1,msg:"requestTaskId is not a string"});let mr=(W,ee)=>{An("request",g,{state:W,startTime:b,endTime:Date.now(),params:oe,response:ee,requestId:_t,requestFrom:s=="public"?"public":"inner"})},{resolve:vo,reject:bo,promise:ko}=new Q;n.set(_t,{resolve:vo,reject:bo});try{let W=yield ko;mr("success",W);let{data:ee}=W;return _==="json"&&typeof ee=="string"&&(ee=vs(ee)),{url:g,timeout:U,method:T,response:P(h({},W),{data:ee})}}catch(W){let ee=W;if(B(ee)){let{errMsg:Pe,prefetchDetail:To,isPrefetch:Eo,errNo:So}=ee;le(Pe)&&(mr("fail",{errMsg:Pe,isPrefetch:Eo,prefetchDetail:To}),M(me({code:-1,msg:Pe},{errNo:So,errMsg:Pe})))}throw W}})}function vs(e){try{return JSON.parse(e.trim())}catch(t){return e}}function bs(e,t="application/json"){let r=t.toLowerCase();return e===void 0?"":typeof e=="string"||e instanceof ArrayBuffer?e:r.includes("application/x-www-form-urlencoded")||r.includes("application/json")||typeof e=="object"?JSON.stringify(e):String(e)}var ys,Xt=f(()=>{"use strict";S();xn();Yt();j();G();se();ys=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,o=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${o?`?${o}`:""}`:`${e}${o?`?${o}`:""}`}});var Zt,Pn,X,qe=f(()=>{"use strict";Gt();Xt();J();Zt={"x-user-agent":mn()};(Pn=y.hostUserInfo)!=null&&Pn.token&&(Zt["x-joli-token"]=y.hostUserInfo.token);y.joliSource&&(Zt["x-joli-source"]=y.joliSource);X=Ke("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:y.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Zt})});var Ge,Cn=f(()=>{"use strict";J();wn();qe();j();Ge=class extends Ve{constructor(t,r,n){super(r,n),this.gameId=y.mpId,this.sessionId=y.sessionId,this.track=t}reporter(t){return v(this,null,function*(){let{event:r,params:n}=t,o=[];o.push(X("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:h({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(o)})}reportToNative(t){return v(this,null,function*(){let{event:r,params:n}=t;yield V("userTrackAsync",{event:r,params:h({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var Un={};gr(Un,{nativeTaskEmitter:()=>xe,taskTracker:()=>H,track:()=>K,trackPerformance:()=>Dn});var ks,Nn,On,K,Dn,Fn,xe,H,ae=f(()=>{"use strict";vn();S();Qt();In();J();Cn();j();ks=(e,t,r)=>{var i,a;let n=t,o=B(n.extra)?n.extra:le(n.extra)?JSON.parse(n.extra):{},s=P(h({},o),{mp_id:(i=n.mp_id)!=null?i:"",mp_version:(a=n.mp_version)!=null?a:""});A("trackAsync",{event:e,data:s,webviewId:r})},{track:K,trackPerformance:Dn}=En(ks,{type:Dt.AppSDK,platform:"native",jssdk_version:(On=(Nn=y.sdkInfo)==null?void 0:Nn.jssdkVersion)!=null?On:"1.0.0",mp_id:y.mpId,mp_version:y.mpVersion}),Fn=O();Fn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Dn(e,t,r)});Fn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{K(e,t)});xe=new q,H=new Ge(K,xe)});function Mn(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let s=`
2
2
  html[data-jolibox-root] {
3
3
  height: 100%;
4
4
  margin: 0;
@@ -16,6 +16,6 @@ var _o=Object.create;var Ne=Object.defineProperty,Io=Object.defineProperties,wo=
16
16
  min-height: 100dvh;
17
17
  }
18
18
  }
19
- `;e.textContent=s;let i=document.head||document.getElementsByTagName("head")[0];i.insertBefore(e,i.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function s(a){return v(this,null,function*(){let c=a instanceof URL?a.href:a,u=new Promise((l,m)=>{let p=new XMLHttpRequest;p.open("GET",c),p.responseType="arraybuffer",p.addEventListener("load",()=>l(p.response)),p.addEventListener("error",m),p.send()});try{let l=yield u;return new Response(l,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(l){throw console.error("Failed to load wasm:",l),l}})}let i=window.fetch;window.fetch=(a,c)=>{let u=a instanceof URL?a.href:a.toString();return u.endsWith(".wasm")?s(u):i(a,c)}},o=()=>{e!=null&&e.parentNode&&(e.parentNode.removeChild(e),e=null),document.documentElement.removeAttribute("data-jolibox-root"),window.fetch=t};return r(),n(),o}var Ln=f(()=>{"use strict"});var ze,Bn=f(()=>{"use strict";ze=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}}});var We,Ts,Es,Ss,_s,jn=f(()=>{"use strict";We=class{constructor(t,r,n,o){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 o=this.checkShouldBanHighFreq(t);if(o)return o;let s=this.checkShouldBanForTime(t);return s?{reason:s}:{reason:"ALLOWED"}};var p,k,I,b,g,T,R;let s=(p=o==null?void 0:o.maxAllowedAdsForTime)!=null?p:8,i=(k=o==null?void 0:o.banForTimeThreshold)!=null?k:6e4,a=(I=o==null?void 0:o.bannedReleaseTime)!=null?I:6e4,c=(b=o==null?void 0:o.maxAllowedAdsForSession)!=null?b:200,u=(g=o==null?void 0:o.banForSessionThreshold)!=null?g:6e5,l=(T=o==null?void 0:o.initialThreshold)!=null?T:2e3,m=(R=o==null?void 0:o.highFreqThreshold)!=null?R:2e3;this.checkShouldBanInitial=Ss(l),this.checkShouldBanHighFreq=_s(m),this.checkShouldBanForTime=Es(s,i,a),this.checkShouldBanForSession=Ts(c,u)}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}})}},Ts=(e,t)=>{let r=!1,n=[];return s=>{if(r)return"BANNED_FOR_SESSION";let i=Date.now();if(n=n.concat({timestamp:i,type:s}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&i-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Es=(e,t,r)=>{let n=null,o=l=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{c.value=!1,n=null},l)},s="jolibox-sdk-ads-callbreak-timestamps",i="jolibox-sdk-ads-ban-for-time",a={_records:[],init(){var l;try{let m=JSON.parse((l=window.localStorage.getItem(s))!=null?l:"[]");Array.isArray(m)?this._records=m:this._records=[]}catch(m){this._records=[]}},get values(){return this._records},set values(l){try{window.localStorage.setItem(s,JSON.stringify(l))}catch(m){}this._records=l}},c={_record:!1,init(){var l;try{let m=JSON.parse((l=window.localStorage.getItem(i))!=null?l:"false");typeof m=="boolean"&&(this._record=m)}catch(m){this._record=!1}if(this._record){let m=a.values[a.values.length-1],p=m?Date.now()-m.timestamp:r;p<=r&&p>0?o(p):this._record=!1}},get value(){return this._record},set value(l){try{window.localStorage.setItem(i,JSON.stringify(l))}catch(m){}this._record=l}};return a.init(),c.init(),l=>{if(c.value)return"WAITING_BANNED_RELEASE";let m=Date.now();if(a.values=a.values.concat({timestamp:m,type:l}),a.values.length!==1&&(a.values.length>e&&(a.values=a.values.slice(-e)),a.values.length===e&&m-a.values[0].timestamp<=t))return c.value=!0,o(r),"BANNED_FOR_TIME"}},Ss=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},_s=(e=2e3)=>{let t=0,r=null;return o=>{if(o==="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)}}}});var Qe,Jn=f(()=>{"use strict";J();Qe=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return v(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 o=(r=y.channel)!=null?r:"",s=this.configs[o],i=(n=s==null?void 0:s.interstitialRate)!=null?n:1;t=Math.random()<i}return this.firstRun=!1,t}}});var ve,Ye,er=f(()=>{"use strict";Bn();jn();J();Jn();S();ve=new q,Ye=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>y.mpId;this.getTestAdsMode=()=>y.testAdsMode;this.asyncLoad=()=>v(this,null,function*(){var i,a,c,u,l;let t="ca-pub-7171363994453626",r,n,o=window.encodeURIComponent(window.btoa((i=this.getGameId())!=null?i:"")),s=(a=this.getTestAdsMode())!=null?a:!1;try{let m=yield this.httpClient.get("/public/ads",{query:{objectId:o,testAdsMode:`${s}`}});t=(c=m.data)==null?void 0:c.clientId,r=(u=m.data)==null?void 0:u.channelId,n=(l=m.data)==null?void 0:l.unitId}catch(m){console.error("Failed to fetch client info",m)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>v(this,null,function*(){var o;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(o=this.getTestAdsMode())!=null?o:!1;if(!document.getElementById(r)&&this.clientId){let s=document.createElement("script");s.id=r,s.async=!0,s.crossOrigin="anonymous",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&s.setAttribute("data-adbreak-test","on"),this.channelId&&s.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(s),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((n=>n.type==="preroll")(t)){ve.emit("isAdShowing",!0);let n=t.adBreakDone,o=s=>{ve.emit("isAdShowing",!1),n&&n(s)};return P(h({},t),{adBreakDone:o})}else{let n=t.beforeAd,o=t.afterAd,s=()=>{var a;ve.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(a=t.name)!=null?a:""}),n&&n()},i=()=>{var a;ve.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(a=t.name)!=null?a:""}),o&&o()};return P(h({},t),{beforeAd:s,afterAd:i})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=ce(o,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var u,l,m,p,k,I;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(u=t.adBreakDone)==null||u.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":(l=t.adBreakDone)==null||l.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":(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),((k=n==null?void 0:n.count)!=null?k:0)===3&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let o=t.type,s=t.adBreakDone,i=b=>{var g;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:b.breakType,breakName:(g=b.breakName)!=null?g:"",breakFormat:b.breakFormat,breakStatus:b.breakStatus}),s&&s(b)};if(t.adBreakDone=i,t.type==="reward"){let b=t.beforeReward,g=R=>()=>{this.track("CallShowAdFn",null),R()},T=R=>{b&&b(g(R))};t.beforeReward=T}let a;switch(o){case"preroll":a={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":a={type:o,name:(I=t.name)!=null?I:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",a);let c=this.wrapAdBreakParams(t);this.push(c),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>v(this,null,function*(){var p,k,I,b;if(this.track("CallAdUnit",{adFormat:(k=(p=t.adFormat)==null?void 0:p.toString())!=null?k:null,fullWidthResponsive:(I=t.fullWidthResponsive)!=null?I:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:o,fullWidthResponsive:s,style:i}=t,a;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?a=document.querySelector(r):a=r,!a)throw new Error("targeting element not found");let c=n;if(c||(c=this.unitId),!c)throw new Error("slot is required");let u=typeof o=="object"&&Array.isArray(o)?o.join(", "):o,l=document.createElement("ins");if(l.className="adsbygoogle",l.id="jolibox-ads",l.style.display="block",l.setAttribute("data-ad-client",this.clientId),l.setAttribute("data-ad-slot",c),u&&l.setAttribute("data-ad-format",u),s&&l.setAttribute("data-full-width-responsive",s),i&&l.setAttribute("style",i),(b=this.getTestAdsMode())!=null?b:!1){let g=document.createElement("div");g.style.position="absolute",g.style.top="0",g.style.left="0",g.style.width="100%",g.style.height="100%",g.style.display="flex",g.style.justifyContent="center",g.style.alignItems="center",g.style.backgroundColor="rgba(0, 0, 0, 0.5)",g.style.color="white",g.innerHTML="Test Ad",l.style.position="relative",a.appendChild(l),l.appendChild(g)}else a.appendChild(l),new MutationObserver(T=>{T.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let _=l.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:_!=null?_:"null"})}})}).observe(l,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new We(t,r,n),this.adsActionDetection=new ze(this.track),this.channelPolicy=new Qe(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});function Hn(){return v(this,null,function*(){let{data:e}=A("envSync"),{orientation:t,webviewId:r}=e,n={__mpType:"miniApp",__transparent:!0,__orientation:t!=null?t:"VERTICAL",__showStatusBar:!1,__shouldInterupt:!1,__showCapsuleButton:!1};r&&(n=P(h({},n),{__from:r}));let o=y.encodeJoliSourceQuery(n),i=`${y.testMode,"https://G32115508989327465281365749294.app.jolibox.com"}/recommended-guide/${y.mpId}?appId=${y.mpId}&joliSource=${o}&navigationStyle=present`,a=new Q;return cn("onRetentionResult",({shouldStay:c})=>{a.resolve(c)}),setTimeout(()=>{A("openSchemaSync",{schema:i})},0),a.promise})}var $n=f(()=>{"use strict";J();j();S()});var Kn={};gr(Kn,{config:()=>As});function Is(){re.on("onDocumentReady",()=>{var e;(e=ie)==null||e.onDocumentReady(window.location.href),K("onDocumentReady",{start_timestamp:et,timestamp:Date.now()})})}function ws(e){y.mpType==="game"&&H.start(e)}function Rs(){Y("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&y.onEnvConfigChanged({hostUserInfo:e}),re.emit("LifecycleEvent.onReady",h({},y.hostUserInfo?y.hostUserInfo:{isLogin:!1})),K("joliboxServiceReady",{start_timestamp:et,timestamp:Date.now()}),ws(t)}),Y("onBeforeExit",({uuid:e})=>{var t;(t=ie)==null||t.doExit(e)})}function As(){et=Date.now(),Rs(),Is(),Xe=Mn()}var Xe,Vn,Ze,et,qn=f(()=>{"use strict";j();He();J();S();ae();Ln();er();$n();z.onReady(()=>{});Vn=()=>{K("onBeforeExit",{timestamp:Date.now()}),Xe==null||Xe(),H.close(Date.now()-et)};z.doExit(()=>v(void 0,null,function*(){return Ze?!0:Ie(y.shouldInterupt)?(y.shouldInterupt||Vn(),y.shouldInterupt):(yield Hn())?!0:(Vn(),!1)}));Ze=!1;ve.on("isAdShowing",e=>{Ze=e,Ie(Ze)&&A("updateContainerConfigSync",{displayCapsuleButton:!Ze,webviewId:y.webviewId})})});function Gn(e){let t=Ot.config[e];return t||(t={},Ot.config[e]=t),(r,n)=>{if(t[r]){$.warn(`[can i use] ${r} already registered`);return}t[r]=h({},n)}}var zn=f(()=>{"use strict";S()});function tr(e){Wn=e}function tt(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>tt(t)):Object.keys(e).reduce((t,r)=>(t[r]=tt(e[r]),t),{})}function ne(e){return typeof e=="number"}function rr(e){let t=nr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function nr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Wn,D,rt,nt,ot,st,be,it,at,ct,lt,ut,dt,mt,pt,ft,ht,gt,yt,or=f(()=>{"use strict";Wn=!1;D=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Wn)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 ${rr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return tt(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:tt(this._default)}optional(){return this._optional=!0,this}};rt=class extends D{validate(t){return this._optional&&t===void 0?!0:ne(t)?ne(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ne(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ne(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}},nt=class extends D{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},ot=class extends D{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ne(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ne(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}},st=class extends D{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},be=class extends D{validate(t){return!0}},it=class extends D{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},at=class extends D{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ct=class extends D{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},lt=class extends D{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 ${rr(t)}`)}return!0}},ut=class extends D{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(ne(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ne(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ne(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 o=!0;if(r.forEach((s,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,s===void 0&&n.hasDefault){r[i]=n.defaultValue;return}n.validate(s)||(n.hasFallback?r[i]=n.fallbackValue:o=!1)}),this._uniqueItems){let s=new Map;for(let i in r)s.has(r[i])?o=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${s.get(r[i])}] and ${this.path}[${i}] are identical)`):s.set(r[i],i)}return o}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}},dt=class extends D{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(nr(r)!=="object")return this.fail({expect:"object",actual:r});let o=r,s=this._value;s.errors=this.errors;let i=!0;for(let a in o){let c=o[a];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(a)?s.path=`${this.path}.${a}`:s.path=`${this.path}["${a}"]`,!(c===void 0&&s._optional)){if(c===void 0&&s.hasDefault){o[a]=s.defaultValue;continue}s.validate(c)||(s.hasFallback?o[a]=s.fallbackValue:i=!1)}}return i}},mt=class extends D{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(nr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,o=!0;for(let s in this._object){let i=n[s],a=this._object[s];if(a.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?a.path=`${this.path}.${s}`:a.path=`${this.path}["${s}"]`,!(a._optional&&i===void 0)){if(i===void 0&&a.hasDefault){n[s]=a.defaultValue;continue}a.validate(i)||(a.hasFallback?n[s]=a.fallbackValue:o=!1)}}return o}},pt=class extends D{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:rr(this.value),actual:r}):!0}},ft=class extends D{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,o=this._items.length;for(let s=0;s<o;s++){let i=this._items[s];if(i.errors=[],i.path=this.path,!i.validate(t))r.push(i.errors.join("; "));else if(!n){n=!0;break}}if(!n){let s=r.join(`
19
+ `;e.textContent=s;let i=document.head||document.getElementsByTagName("head")[0];i.insertBefore(e,i.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function s(a){return v(this,null,function*(){let c=a instanceof URL?a.href:a,u=new Promise((l,m)=>{let p=new XMLHttpRequest;p.open("GET",c),p.responseType="arraybuffer",p.addEventListener("load",()=>l(p.response)),p.addEventListener("error",m),p.send()});try{let l=yield u;return new Response(l,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(l){throw console.error("Failed to load wasm:",l),l}})}let i=window.fetch;window.fetch=(a,c)=>{let u=a instanceof URL?a.href:a.toString();return u.endsWith(".wasm")?s(u):i(a,c)}},o=()=>{e!=null&&e.parentNode&&(e.parentNode.removeChild(e),e=null),document.documentElement.removeAttribute("data-jolibox-root"),window.fetch=t};return r(),n(),o}var Ln=f(()=>{"use strict"});var ze,Bn=f(()=>{"use strict";ze=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}}});var We,Ts,Es,Ss,_s,jn=f(()=>{"use strict";We=class{constructor(t,r,n,o){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 o=this.checkShouldBanHighFreq(t);if(o)return o;let s=this.checkShouldBanForTime(t);return s?{reason:s}:{reason:"ALLOWED"}};var p,k,I,b,g,T,R;let s=(p=o==null?void 0:o.maxAllowedAdsForTime)!=null?p:8,i=(k=o==null?void 0:o.banForTimeThreshold)!=null?k:6e4,a=(I=o==null?void 0:o.bannedReleaseTime)!=null?I:6e4,c=(b=o==null?void 0:o.maxAllowedAdsForSession)!=null?b:200,u=(g=o==null?void 0:o.banForSessionThreshold)!=null?g:6e5,l=(T=o==null?void 0:o.initialThreshold)!=null?T:2e3,m=(R=o==null?void 0:o.highFreqThreshold)!=null?R:2e3;this.checkShouldBanInitial=Ss(l),this.checkShouldBanHighFreq=_s(m),this.checkShouldBanForTime=Es(s,i,a),this.checkShouldBanForSession=Ts(c,u)}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}})}},Ts=(e,t)=>{let r=!1,n=[];return s=>{if(r)return"BANNED_FOR_SESSION";let i=Date.now();if(n=n.concat({timestamp:i,type:s}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&i-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Es=(e,t,r)=>{let n=null,o=l=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{c.value=!1,n=null},l)},s="jolibox-sdk-ads-callbreak-timestamps",i="jolibox-sdk-ads-ban-for-time",a={_records:[],init(){var l;try{let m=JSON.parse((l=window.localStorage.getItem(s))!=null?l:"[]");Array.isArray(m)?this._records=m:this._records=[]}catch(m){this._records=[]}},get values(){return this._records},set values(l){try{window.localStorage.setItem(s,JSON.stringify(l))}catch(m){}this._records=l}},c={_record:!1,init(){var l;try{let m=JSON.parse((l=window.localStorage.getItem(i))!=null?l:"false");typeof m=="boolean"&&(this._record=m)}catch(m){this._record=!1}if(this._record){let m=a.values[a.values.length-1],p=m?Date.now()-m.timestamp:r;p<=r&&p>0?o(p):this._record=!1}},get value(){return this._record},set value(l){try{window.localStorage.setItem(i,JSON.stringify(l))}catch(m){}this._record=l}};return a.init(),c.init(),l=>{if(c.value)return"WAITING_BANNED_RELEASE";let m=Date.now();if(a.values=a.values.concat({timestamp:m,type:l}),a.values.length!==1&&(a.values.length>e&&(a.values=a.values.slice(-e)),a.values.length===e&&m-a.values[0].timestamp<=t))return c.value=!0,o(r),"BANNED_FOR_TIME"}},Ss=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},_s=(e=2e3)=>{let t=0,r=null;return o=>{if(o==="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)}}}});var Qe,Jn=f(()=>{"use strict";J();Qe=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return v(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 o=(r=y.channel)!=null?r:"",s=this.configs[o],i=(n=s==null?void 0:s.interstitialRate)!=null?n:1;t=Math.random()<i}return this.firstRun=!1,t}}});var ve,Ye,er=f(()=>{"use strict";Bn();jn();J();Jn();S();ve=new q,Ye=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>y.mpId;this.getTestAdsMode=()=>y.testAdsMode;this.asyncLoad=()=>v(this,null,function*(){var i,a,c,u,l;let t="ca-pub-7171363994453626",r,n,o=window.encodeURIComponent(window.btoa((i=this.getGameId())!=null?i:"")),s=(a=this.getTestAdsMode())!=null?a:!1;try{let m=yield this.httpClient.get("/public/ads",{query:{objectId:o,testAdsMode:`${s}`}});t=(c=m.data)==null?void 0:c.clientId,r=(u=m.data)==null?void 0:u.channelId,n=(l=m.data)==null?void 0:l.unitId}catch(m){console.error("Failed to fetch client info",m)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>v(this,null,function*(){var o;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(o=this.getTestAdsMode())!=null?o:!1;if(!document.getElementById(r)&&this.clientId){let s=document.createElement("script");s.id=r,s.async=!0,s.crossOrigin="anonymous",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&s.setAttribute("data-adbreak-test","on"),this.channelId&&s.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(s),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((n=>n.type==="preroll")(t)){ve.emit("isAdShowing",!0);let n=t.adBreakDone,o=s=>{ve.emit("isAdShowing",!1),n&&n(s)};return P(h({},t),{adBreakDone:o})}else{let n=t.beforeAd,o=t.afterAd,s=()=>{var a;ve.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(a=t.name)!=null?a:""}),n&&n()},i=()=>{var a;ve.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(a=t.name)!=null?a:""}),o&&o()};return P(h({},t),{beforeAd:s,afterAd:i})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=ce(o,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var u,l,m,p,k,I;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(u=t.adBreakDone)==null||u.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":(l=t.adBreakDone)==null||l.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":(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(k=t.adBreakDone)==null||k.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((p=n==null?void 0:n.count)!=null?p: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 o=t.type,s=t.adBreakDone,i=b=>{var g;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:b.breakType,breakName:(g=b.breakName)!=null?g:"",breakFormat:b.breakFormat,breakStatus:b.breakStatus}),s&&s(b)};if(t.adBreakDone=i,t.type==="reward"){let b=t.beforeReward,g=R=>()=>{this.track("CallShowAdFn",null),R()},T=R=>{b&&b(g(R))};t.beforeReward=T}let a;switch(o){case"preroll":a={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":a={type:o,name:(I=t.name)!=null?I:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",a);let c=this.wrapAdBreakParams(t);this.push(c),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>v(this,null,function*(){var p,k,I,b;if(this.track("CallAdUnit",{adFormat:(k=(p=t.adFormat)==null?void 0:p.toString())!=null?k:null,fullWidthResponsive:(I=t.fullWidthResponsive)!=null?I:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:o,fullWidthResponsive:s,style:i}=t,a;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?a=document.querySelector(r):a=r,!a)throw new Error("targeting element not found");let c=n;if(c||(c=this.unitId),!c)throw new Error("slot is required");let u=typeof o=="object"&&Array.isArray(o)?o.join(", "):o,l=document.createElement("ins");if(l.className="adsbygoogle",l.id="jolibox-ads",l.style.display="block",l.setAttribute("data-ad-client",this.clientId),l.setAttribute("data-ad-slot",c),u&&l.setAttribute("data-ad-format",u),s&&l.setAttribute("data-full-width-responsive",s),i&&l.setAttribute("style",i),(b=this.getTestAdsMode())!=null?b:!1){let g=document.createElement("div");g.style.position="absolute",g.style.top="0",g.style.left="0",g.style.width="100%",g.style.height="100%",g.style.display="flex",g.style.justifyContent="center",g.style.alignItems="center",g.style.backgroundColor="rgba(0, 0, 0, 0.5)",g.style.color="white",g.innerHTML="Test Ad",l.style.position="relative",a.appendChild(l),l.appendChild(g)}else a.appendChild(l),new MutationObserver(T=>{T.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let _=l.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:_!=null?_:"null"})}})}).observe(l,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new We(t,r,n),this.adsActionDetection=new ze(this.track),this.channelPolicy=new Qe(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});function Hn(){return v(this,null,function*(){let{data:e}=A("envSync"),{orientation:t,webviewId:r}=e,n={__mpType:"miniApp",__transparent:!0,__orientation:t!=null?t:"VERTICAL",__showStatusBar:!1,__shouldInterupt:!1,__showCapsuleButton:!1};r&&(n=P(h({},n),{__from:r}));let o=y.encodeJoliSourceQuery(n),i=`${y.testMode,"https://G32115508989327465281365749294.app.jolibox.com"}/recommended-guide/${y.mpId}?appId=${y.mpId}&joliSource=${o}&navigationStyle=present`,a=new Q;return cn("onRetentionResult",({shouldStay:c})=>{a.resolve(c)}),setTimeout(()=>{A("openSchemaSync",{schema:i})},0),a.promise})}var $n=f(()=>{"use strict";J();j();S()});var Kn={};gr(Kn,{config:()=>As});function Is(){re.on("onDocumentReady",()=>{var e;(e=ie)==null||e.onDocumentReady(window.location.href),K("onDocumentReady",{start_timestamp:et,timestamp:Date.now()})})}function ws(e){y.mpType==="game"&&H.start(e)}function Rs(){Y("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&y.onEnvConfigChanged({hostUserInfo:e}),re.emit("LifecycleEvent.onReady",h({},y.hostUserInfo?y.hostUserInfo:{isLogin:!1})),K("joliboxServiceReady",{start_timestamp:et,timestamp:Date.now()}),ws(t)}),Y("onBeforeExit",({uuid:e})=>{var t;(t=ie)==null||t.doExit(e)})}function As(){et=Date.now(),Rs(),Is(),Xe=Mn()}var Xe,Vn,Ze,et,qn=f(()=>{"use strict";j();He();J();S();ae();Ln();er();$n();z.onReady(()=>{});Vn=()=>{K("onBeforeExit",{timestamp:Date.now()}),Xe==null||Xe(),H.close(Date.now()-et)};z.doExit(()=>v(void 0,null,function*(){return Ze?!0:Ie(y.shouldInterupt)?(y.shouldInterupt||Vn(),y.shouldInterupt):(yield Hn())?!0:(Vn(),!1)}));Ze=!1;ve.on("isAdShowing",e=>{Ze=e,Ie(Ze)&&A("updateContainerConfigSync",{displayCapsuleButton:!Ze,webviewId:y.webviewId})})});function Gn(e){let t=Ot.config[e];return t||(t={},Ot.config[e]=t),(r,n)=>{if(t[r]){$.warn(`[can i use] ${r} already registered`);return}t[r]=h({},n)}}var zn=f(()=>{"use strict";S()});function tr(e){Wn=e}function tt(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>tt(t)):Object.keys(e).reduce((t,r)=>(t[r]=tt(e[r]),t),{})}function ne(e){return typeof e=="number"}function rr(e){let t=nr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function nr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Wn,D,rt,nt,ot,st,be,it,at,ct,lt,ut,dt,mt,pt,ft,ht,gt,yt,or=f(()=>{"use strict";Wn=!1;D=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Wn)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 ${rr(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return tt(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:tt(this._default)}optional(){return this._optional=!0,this}};rt=class extends D{validate(t){return this._optional&&t===void 0?!0:ne(t)?ne(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ne(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ne(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}},nt=class extends D{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},ot=class extends D{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ne(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ne(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}},st=class extends D{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},be=class extends D{validate(t){return!0}},it=class extends D{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},at=class extends D{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ct=class extends D{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},lt=class extends D{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 ${rr(t)}`)}return!0}},ut=class extends D{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(ne(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ne(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ne(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 o=!0;if(r.forEach((s,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,s===void 0&&n.hasDefault){r[i]=n.defaultValue;return}n.validate(s)||(n.hasFallback?r[i]=n.fallbackValue:o=!1)}),this._uniqueItems){let s=new Map;for(let i in r)s.has(r[i])?o=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${s.get(r[i])}] and ${this.path}[${i}] are identical)`):s.set(r[i],i)}return o}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}},dt=class extends D{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(nr(r)!=="object")return this.fail({expect:"object",actual:r});let o=r,s=this._value;s.errors=this.errors;let i=!0;for(let a in o){let c=o[a];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(a)?s.path=`${this.path}.${a}`:s.path=`${this.path}["${a}"]`,!(c===void 0&&s._optional)){if(c===void 0&&s.hasDefault){o[a]=s.defaultValue;continue}s.validate(c)||(s.hasFallback?o[a]=s.fallbackValue:i=!1)}}return i}},mt=class extends D{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(nr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,o=!0;for(let s in this._object){let i=n[s],a=this._object[s];if(a.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?a.path=`${this.path}.${s}`:a.path=`${this.path}["${s}"]`,!(a._optional&&i===void 0)){if(i===void 0&&a.hasDefault){n[s]=a.defaultValue;continue}a.validate(i)||(a.hasFallback?n[s]=a.fallbackValue:o=!1)}}return o}},pt=class extends D{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:rr(this.value),actual:r}):!0}},ft=class extends D{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,o=this._items.length;for(let s=0;s<o;s++){let i=this._items[s];if(i.errors=[],i.path=this.path,!i.validate(t))r.push(i.errors.join("; "));else if(!n){n=!0;break}}if(!n){let s=r.join(`
20
20
  or `);this.errors.push(s)}return n}},ht=class extends D{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let o=t[n];if(o._optional||o.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,o)=>{if(n.path=`${this.path}[${o}]`,n.errors=this.errors,t[o]===void 0&&n.hasDefault){t[o]=n.defaultValue;return}n.validate(t[o])||(n.hasFallback?t[o]=n._fallback:r=!1)}),r}},gt=class extends D{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},yt=class extends D{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 sr(e,t,r="param"){if(e.errors=[],e.path=r,tr(!0),!e.validate(t)){let n=e.errors.join(`
21
21
  `);throw e.errors.length=0,tr(!1),new TypeError(n)}}var d,ir=f(()=>{"use strict";or();or();d={object(e){return new mt(e)},array(e){return new ut(e)},tuple(...e){return new ht(...e)},literal(e){return new pt(e)},or(...e){return new ft(...e)},symbol(){return new st},record(e){return new dt(e)},function(){return new ct},boolean(){return new nt},string(){return new ot},number(){return new rt},undefined(){return new it},null(){return new at},unknown(){return new be},any(){return new be},as(){return new be},arraybuffer(){return new gt},enum(...e){return new lt(...e)},typedarray(e){return new yt(e)}}});var vt,Qn,Yn=f(()=>{"use strict";S();G();ir();se();vt=1,Qn=e=>{function t(n,o){return(...s)=>{var m,p,k,I;let i=Date.now(),a={method:n,trace_id:vt};vt+=1;let c="SUCCESS",u=`${n}:ok`,l=0;try{if(o.paramsSchema)try{sr(o.paramsSchema,s,"params")}catch(R){throw Mt(`${n}:fail ${R.message}`)}let b=o.implement(...s),g=b,T=`${n}:ok`;if(b&&"code"in b){let{code:R,data:_,message:U}=b;c=R,g=_,T=U}return{code:c,message:T,data:g}}catch(b){let g=b;l=(p=(m=g.code)!=null?m:g.errNo)!=null?p:2e3,c="FAILURE";let T=(I=(k=g.message)!=null?k:g.errMsg)!=null?I:`${b}`;return u=`${n}:${c} ${T.replace(/^\S+:(fail|cancel)\s?/,"")}`,M(new Ae(u,l)),{code:c,message:u}}finally{let b=Date.now()-i;e("apiInvoked",P(h({},a),{duration:b,status:c}))}}}function r(n,o){return(...s)=>v(this,null,function*(){var p,k,I,b;let i=Er(s)?s:[s],a=Date.now(),c={method:n,trace_id:vt};vt+=1;let u=`${n}:ok`,l="SUCCESS",m={code:l,message:u};try{if(o.paramsSchema)try{sr(o.paramsSchema,i,"params")}catch(R){throw Mt(R.message)}let T=yield o.implement(...i);if(T&&"code"in T){let{code:R,data:_,message:U}=T;l=R,u=U,T=_}return Object.assign(m,{code:l,message:u,data:T}),m}catch(g){let T=g,R=(k=(p=T.code)!=null?p:T.errNo)!=null?k:2e3;l="FAILURE";let _=(b=(I=T.message)!=null?I:T.errMsg)!=null?b:`${g}`,U=`${n}:${l} ${_.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(m,{code:l,message:U}),M(new Ae(U,R)),m}finally{let g=Date.now()-a;e("apiInvoked",P(h({},c),{duration:g,status:l}))}})}return{createAPI:r,createSyncAPI:t}}});var F,N,E,Z=f(()=>{"use strict";zn();ae();Yn();ir();({createAPI:F,createSyncAPI:N}=Qn(K)),E=Gn("native")});var Xn,Ps,Cs,Ns,Os,Zn=f(()=>{"use strict";S();Z();j();Xn=O(),Ps="env",Cs="getSystemInfoSync",Ns=N(Cs,{implement:()=>{var r;let e=A("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform,version:t.sdkInfo.jssdkVersion,pixelRatio:t.deviceInfo.pixelRatio,language:t.deviceInfo.lang,brand:t.deviceInfo.brand,appName:(r=t.hostInfo)==null?void 0:r.appName,SDKVersion:t.sdkInfo.jssdkVersion}}}),Os=N(Ps,{implement:()=>{var t;let e=A("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});Xn.registerCommand("API.getSystemInfoSync",Ns);Xn.registerCommand("API.env",Os);E("env",{version:"1.0.0"});E("getSystemInfoSync",{version:"1.0.0"})});var eo=hr(ar=>{"use strict";S();Z();G();j();ae();J();var Ds="exitGame",Fs="onReady",Us="onJoliboxShow",Ms="onJoliboxHide",bt=O(),kt=Me(M),Ls=F(Ds,{paramsSchema:d.tuple(d.function(),d.boolean().optional().default(!1)),implement:(e,t=!1)=>v(ar,null,function*(){kt(e).call(ar),Ie(y.shouldInterupt)&&!y.shouldInterupt&&y.from&&an("onRetentionResult",{shouldStay:t},y.from,!0),yield V("exitAppAsync")})}),Bs=N(Us,{paramsSchema:d.tuple(d.function()),implement(e){let t=kt(e);Y("onJoliboxEnterForeground",()=>{t.call(this),xe.emit("visible",!0)})}}),js=N(Ms,{paramsSchema:d.tuple(d.function()),implement(e){let t=kt(e);Y("onJoliboxEnterBackground",()=>{t.call(this),xe.emit("visible",!1)})}}),Js=N(Fs,{paramsSchema:d.tuple(d.function()),implement(e){let t=kt(e);re.on("LifecycleEvent.onReady",r=>{t(r)})}});bt.registerCommand("LifecycleSDK.exit",Ls);bt.registerCommand("LifecycleSDK.onReady",Js);bt.registerCommand("LifecycleSDK.onJoliboxShow",Bs);bt.registerCommand("LifecycleSDK.onJoliboxHide",js);E("lifeCycle.exit",{version:"1.0.0"});E("lifeCycle.onReady",{version:"1.0.0"});E("lifeCycle.onJoliboxShow",{version:"1.0.0"});E("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function to(e){let t={};if(!B(e))return t;for(let[r,n]of Object.entries(e)){let o=r.toLocaleLowerCase();n?typeof n=="object"?t[o]=Object.prototype.toString.call(n):t[o]=String(n):t[o]=""}return t}function ro(e="GET"){if(e==="")return"POST";let t=e.toUpperCase();return["GET","OPTIONS","HEAD","POST","PUT","DELETE","TRACE","CONNECT","PATCH"].includes(t)?t:"GET"}function no(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function oo(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!B(r))return e;let[n,o=""]=e.split("?"),s=JSON.stringify(h(h({},JSON.parse(o)),r));return`${n}?${s}`}var so=f(()=>{"use strict";S()});var Hs,$s,cr,lr,io,Vs,Ks,qs,ao=f(()=>{"use strict";se();Xt();Z();so();S();G();Hs=15,$s=Ke("createRequestTaskSync","operateRequestTaskSync",{type:"public"}),cr=0,lr=[],io=Me(M),Vs=(e,t)=>{let r=e.filter(t),n=e.filter(o=>!t(o));return e.length=0,e.push(...n),r},Ks=e=>{let t=new Q,r=()=>{};return F("request",{paramsSchema:d.tuple(d.object({url:d.string(),method:d.string(),header:d.object(),data:d.object().optional(),query:d.object().optional(),dataType:d.string().default("json"),responseType:d.string().default("text"),enableCache:d.boolean().default(!1),appendHostCookie:d.boolean().default(!0),timeout:d.number().default(3e4),success:d.function(),fail:d.function()})),implement(o){let s=()=>v(this,null,function*(){var a,c;let i=io(o.fail);try{if(cr+=1,t.state!=="pending")return;let{data:u,dataType:l,responseType:m,enableCache:p,appendHostCookie:k}=o,I=to(o.header),b=ro(o.method),g=no(o.timeout),T=oo(o.url,b,u),R=io(o.success),_=Object.assign({},o,{method:b,header:I,data:b==="GET"||b==="HEAD"?void 0:u,enableCache:p,query:(a=o.query)!=null?a:{},dataType:l,responseType:m,appendHostCookie:k});g&&(_.timeout=g);let U=$s(T,_);{let{response:w}=yield U,{code:x,data:Te,message:oe}=w;t.resolve({code:x!=null?x:"SUCCESS",data:Te,message:oe!=null?oe:"request:ok"}),R({code:"SUCCESS",message:"request:ok",data:Te})}}catch(u){t.reject(u),i({code:"FAILURE",message:"httpRequst: failed"})}finally{cr-=1,(c=lr.shift())==null||c()}});return cr>=Hs?(r=()=>{Vs(lr,i=>i===s)},lr.push(s)):s(),t.promise}})(e),{abort(){t.reject(me({code:-1,msg:"request:fail abort"})),r()}}},qs=O();qs.registerCommand("HttpSDK.request",Ks);E("request",{version:"1.0.0"})});function Xs(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return Ys.includes(t)?t:""}function Zs(e,t){try{switch(t){case"string":return e;case"object":return JSON.parse(e);case"number":return parseFloat(e);case"boolean":return e==="true";default:return""}}catch(r){return""}}function ei(e,t){try{switch(t){case"string":case"number":case"boolean":return`${e}`;case"object":return JSON.stringify(e);default:return""}}catch(r){return""}}var Tt,Gs,zs,Ws,Qs,Vu,Ku,Ys,co=f(()=>{"use strict";Z();j();S();qe();J();Tt=O(),Gs=F("getLocalStorage",{paramsSchema:d.tuple(d.string()),implement(e){return v(this,null,function*(){let{response:t}=yield X(`/api/games/user-storage/${y.mpId}`,{method:"GET",responseType:"json",appendHostCookie:!0,query:{key:e}}),{data:{code:r,message:n,data:o}}=yield t;if(r==="SUCCESS")return{code:r,message:n,data:o==null?void 0:o.value};try{let{data:{data:s,dataType:i}}=yield V("getLocalStorageAsync",{key:e}),a=Zs(s,i);return{code:r,message:`${n}. fallback to native`,data:a}}catch(s){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});Tt.registerCommand("StorageSDK.getItem",Gs);E("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});zs=F("setStorage",{paramsSchema:d.tuple(d.string(),d.or(d.string(),d.boolean(),d.number())),implement(e,t){return v(this,null,function*(){let r=y.mpId,n=typeof t=="string"?t:String(t),{response:o}=yield X(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:s,message:i}}=o,a=Xs(t),c=ei(t,a);return yield V("setLocalStorageAsync",{key:e,data:c,dataType:a}),s=="SUCCESS"?{code:s,message:i}:{code:s,message:`${i}. fallback to native`}})}});Tt.registerCommand("StorageSDK.setItem",zs);E("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});Ws=F("removeStorage",{paramsSchema:d.tuple(d.string()),implement(e){return v(this,null,function*(){let t=y.mpId,{response:r}=yield X(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:o}}=r;return yield V("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:o}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});Tt.registerCommand("StorageSDK.removeItem",Ws);E("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});Qs=F("clearStorage",{implement(){return v(this,null,function*(){let e=y.mpId,{response:t}=yield X(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});V("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});Tt.registerCommand("StorageSDK.clear",Qs);E("storage.clear",{version:"1.0.0"});Vu=F("getStorageInfo",{implement(){return v(this,null,function*(){let{data:e}=yield V("getStorageInfoAsync");return e})}});E("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});Ku=N("getStorageInfoSync",{implement(){return A("getStorageInfoSync")}}),Ys=["string","number","boolean","object",""]});var ti,ri,ni,ur,lo=f(()=>{"use strict";S();j();Z();ti=N("showKeyboard",{paramsSchema:d.tuple(d.object({defaultValue:d.string().optional().default(""),multiple:d.boolean().optional().default(!1),maxLength:d.unknown().optional().default(1e5)})),implement(e){var n;let t=Math.floor((n=Number(e.maxLength))!=null?n:1e5),{defaultValue:r}=e;r&&t&&(r=r.slice(0,t)),A("showKeyboardSync",P(h({},e),{defaultValue:r,maxLength:t}))}});E("keyboard.showKeyboard",{version:"1.0.0",properties:{params:{defaultValue:"1.0.0",multiple:"1.0.0",confirmHold:"1.0.0",confirmType:"1.0.0",maxLength:"1.0.0"}},success:{errMsg:"1.0.0"}});ri=N("updateKeyboard",{paramsSchema:d.tuple(d.object({value:d.string()})),implement(e){A("updateKeyboardSync",e)}});E("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});ni=N("hideKeyboard",{implement(){A("hideKeyboardSync")}});E("keyboard.hideKeyboard",{version:"1.0.0"});ur=O();ur.registerCommand("KeyboardSDK.showKeyboard",ti);ur.registerCommand("KeyboardSDK.updateKeyboard",ri);ur.registerCommand("KeyboardSDK.hideKeyboard",ni)});var uo=hr(he=>{"use strict";S();Z();ae();var ke=O(),oi=F("levelFinished",{paramsSchema:d.tuple(d.string(),d.object({result:d.boolean(),duration:d.number()})),implement:(e,t)=>v(he,null,function*(){let{result:r,duration:n}=t,o=[];o.push(H.tracker("LevelFinished",{levelId:e,result:r,duration:n})),o.push(H.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(o)})}),si=F("taskFinished",{paramsSchema:d.tuple(d.string(),d.object({duration:d.number()})),implement:(e,t)=>v(he,null,function*(){let{duration:r}=t;return yield H.reportToNative({event:"TaskFinished",params:{duration:r,taskId:e}})})}),ii=F("levelUpgrade",{paramsSchema:d.tuple(d.string(),d.string()),implement:(e,t)=>v(he,null,function*(){let r=[];r.push(H.reportToNative({event:"LevelUpgrade",params:{name:t,levelId:e}})),yield Promise.all(r)})}),ai=F("onHistoryUserLevel",{paramsSchema:d.tuple(d.number()),implement:e=>v(he,null,function*(){return yield H.reportToNative({event:"HistoryUserLevel",params:{level:e}})})}),ci=F("onHistoryUserScore",{paramsSchema:d.tuple(d.number()),implement:e=>v(he,null,function*(){return yield H.reportToNative({event:"HistoryUserScore",params:{score:e}})})}),li=F("taskEvent",{paramsSchema:d.tuple(d.string(),d.object({tools:d.array(d.object({id:d.string(),name:d.string(),count:d.number(),description:d.string().optional(),price:d.object({amount:d.number(),unit:d.string()}).optional()})).optional(),awards:d.array(d.object({id:d.string(),name:d.string()})).optional()})),implement:(e,t)=>v(he,null,function*(){var n,o;let r=[];r.push(H.reportToNative({event:"TaskEvent",params:h({taskId:e},t)})),(o=(n=t.tools)==null?void 0:n.length)!=null&&o&&(r.push(H.reporter({event:"USE_GAME_ITEM"})),r.push(H.reportToNative({event:"UseGameItem",params:h({taskId:e},t)}))),yield Promise.all(r)})});ke.registerCommand("TaskTrackerSDK.levelFinished",oi);ke.registerCommand("TaskTrackerSDK.taskFinished",si);ke.registerCommand("TaskTrackerSDK.levelUpgrade",ii);ke.registerCommand("TaskTrackerSDK.historyUserLevel",ai);ke.registerCommand("TaskTrackerSDK.historyUserScore",ci);ke.registerCommand("TaskTrackerSDK.taskEvent",li);E("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});E("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});E("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});E("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});E("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});E("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"}}}})});var ui,di,mo,po=f(()=>{"use strict";J();j();Z();S();se();E("login",{version:"1.0.0",properties:{force:"1.0.0"},success:{errMsg:"1.0.0",code:"1.0.0",token:"1.0.0",isLogin:"1.0.0"}});E("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0"}});ui=F("login",{implement(){return v(this,null,function*(){var i;let{data:{isLogin:e}}=yield V("checkLoginAsync");if(e)return{isLogin:!0,token:(i=y.hostUserInfo)==null?void 0:i.token};Y("onLoginStateChange",({isLogin:a,token:c,uuid:u})=>{u==r&&o({isLogin:a,token:c})});let t=A("loginSync"),{data:{uuid:r}}=t;if(!r)throw me({code:-1,msg:"login failed"});let{promise:n,resolve:o}=new Q,s=yield n;return y.onEnvConfigChanged({hostUserInfo:s}),re.emit("onLoginComplete",s),s})}}),di=F("checkSession",{implement(){return v(this,null,function*(){let{data:{isLogin:e}}=yield V("checkLoginAsync");return{isLogin:e}})}}),mo=O();mo.registerCommand("API.login",ui);mo.registerCommand("API.checkSession",di)});var Et,mi,St,pi,fi,hi,gi,fo=f(()=>{"use strict";S();Z();er();ae();qe();j();Et=O(),mi=()=>{let{data:e}=A("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},St=new Ye(K,{get:(e,t)=>X(e,h({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data),post:(e,t,r)=>X(e,h({method:"POST",responseType:"json",appendHostCookie:!0},r)).then(n=>n.response.data)},mi),pi=N("adInit",{implement:e=>{St.init(e)}}),fi=N("adConfig",{implement:e=>{St.adConfig(e)}}),hi=N("adBreak",{implement:e=>{St.adBreak(e)}}),gi=N("adUnit",{implement:e=>{St.adUnit(e)}});Et.registerCommand("AdsSDK.init",pi);Et.registerCommand("AdsSDK.adConfig",fi);Et.registerCommand("AdsSDK.adBreak",hi);Et.registerCommand("AdsSDK.adUnit",gi);E("AdsSDK.init",{version:"1.0.0"});E("AdsSDK.adConfig",{version:"1.0.0"});E("AdsSDK.adBreak",{version:"1.0.0"});E("AdsSDK.adUnit",{version:"1.0.0"})});var dr,yi,vi,bi,ho=f(()=>{"use strict";S();j();Z();J();dr=O(),yi=N("openSchemaSync",{paramsSchema:d.tuple(d.string()),implement:e=>{let t=e;e.match(/^https?:\/\//)||(t=`https://${y.mpId}.app.jolibox.com${e.startsWith("/")?"":"/"}${e}`);let r=A("openSchemaSync",{schema:t});if(r.errNo!==0)throw new Re(r.errMsg,r.errNo)}}),vi=N("openPageSync",{paramsSchema:d.tuple(d.string()),implement:e=>{let{errNo:t,errMsg:r,data:n}=A("openPageSync",{url:e});if(t!==0||!n)throw new Re(r,t);return{webviewId:n.webviewId}}}),bi=N("closePageSync",{paramsSchema:d.tuple(d.number()),implement:e=>{let{errNo:t,errMsg:r}=A("closePageSync",{webviewId:e});if(t!==0)throw new Re(r,t)}});dr.registerCommand("RouterSDK.openSchema",yi);dr.registerCommand("RouterSDK.openPage",vi);dr.registerCommand("RouterSDK.closePage",bi);E("router.openSchema",{version:"1.1.10"});E("router.openPage",{version:"1.1.10"});E("router.closePage",{version:"1.1.10"})});var ki={};var Ad,Nd,go=f(()=>{"use strict";Zn();Ad=yr(eo());ao();co();lo();Nd=yr(uo());po();fo();ho()});var yo=Symbol.for("JOLIBOX_IMPLEMENT_INIT");if(window[yo])throw console.info("Jolibox Implement Already Initialized"),new Error("Jolibox Implement Already Initialized");window[yo]=!0;v(void 0,null,function*(){let[{config:e}]=yield Promise.all([Promise.resolve().then(()=>(qn(),Kn)),Promise.resolve().then(()=>(go(),ki)),Promise.resolve().then(()=>(ae(),Un))]);e()});
@@ -1,9 +1,9 @@
1
1
  Invoking: npm run clean && npm run build:esm && tsc
2
2
 
3
- > @jolibox/implement@1.1.11-beta.4 clean
3
+ > @jolibox/implement@1.1.11-beta.5 clean
4
4
  > rimraf ./dist
5
5
 
6
6
 
7
- > @jolibox/implement@1.1.11-beta.4 build:esm
7
+ > @jolibox/implement@1.1.11-beta.5 build:esm
8
8
  > BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
9
9
 
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@jolibox/implement",
3
3
  "description": "This project is Jolibox JS-SDk implement for Native && H5",
4
- "version": "1.1.11-beta.4",
4
+ "version": "1.1.11-beta.5",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "@jolibox/common": "1.1.11-beta.4",
10
- "@jolibox/types": "1.1.11-beta.4",
9
+ "@jolibox/common": "1.1.11-beta.5",
10
+ "@jolibox/types": "1.1.11-beta.5",
11
11
  "localforage": "1.10.0",
12
12
  "web-vitals": "4.2.4"
13
13
  },
@@ -509,12 +509,16 @@ export class JoliboxAdsImpl {
509
509
  this.antiCheating.report(reason);
510
510
  return;
511
511
  case 'HOLDING_HIGH_FREQ':
512
+ // follow google's style to forbid high freq request
512
513
  params.adBreakDone?.({
513
- breakType: params.type,
514
514
  breakFormat: params.type === 'reward' ? 'reward' : 'interstitial',
515
- breakStatus: 'frequencyCapped'
515
+ breakName: '',
516
+ breakStatus: (info?.count ?? 0) > 6 ? 'other' : 'frequencyCapped',
517
+ breakType: params.type
516
518
  });
517
- if ((info?.count ?? 0) === 3) {
519
+ // every 3 hit, report to anti-cheating system
520
+ // if a user click 1 time every 1 second, it will cause 20 reports for 1 minute
521
+ if (info?.count && info.count !== 0 && info.count % 3 === 0) {
518
522
  this.antiCheating.report(reason, info?.count);
519
523
  }
520
524
  return;