@jolibox/implement 1.1.10-beta.1 → 1.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  "packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
5
5
  "packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
6
6
  "packages/implement/esbuild.config.js": "86f1fd21722a2cb05216751578dcca66326e664a",
7
- "packages/implement/package.json": "89ff0861a7d25cad6a1456942a2390966e7ce875",
7
+ "packages/implement/package.json": "5c2fc8eed363dfedcf03112bd8eec01834dec51f",
8
8
  "packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
9
9
  "packages/implement/src/common/ads/anti-cheating.ts": "62e1b5d24aa246849a17ac8cde6cfdc66e577cab",
10
10
  "packages/implement/src/common/ads/channel-policy.ts": "c6d036be5cedf0c5d545fac271c6c8447ca55d8a",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var bi=Object.create;var zt=Object.defineProperty,Ei=Object.defineProperties,Ti=Object.getOwnPropertyDescriptor,_i=Object.getOwnPropertyDescriptors,Ii=Object.getOwnPropertyNames,Ye=Object.getOwnPropertySymbols,wi=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var rn=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,M=(e,t)=>{for(var r in t||(t={}))Yt.call(t,r)&&rn(e,r,t[r]);if(Ye)for(var r of Ye(t))nn.call(t,r)&&rn(e,r,t[r]);return e},W=(e,t)=>Ei(e,_i(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 on=(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&&nn.call(e,o)&&(r[o]=e[o]);return r};var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var an=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ai=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ii(t))!Yt.call(e,a)&&a!==r&&zt(e,a,{get:()=>t[a],enumerable:!(o=Ti(t,a))||o.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?bi(wi(e)):{},Ai(t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r,e));var L=(e,t,r)=>new Promise((o,a)=>{var d=p=>{try{h(r.next(p))}catch(_){a(_)}},f=p=>{try{h(r.throw(p))}catch(_){a(_)}},h=p=>p.done?o(p.value):Promise.resolve(p.value).then(d,f);h((r=r.apply(e,t)).next())});function xi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function tr(e){return typeof e=="string"}function fn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function mn(e){return typeof e=="object"&&Array.isArray(e)}function ki(e){return typeof e>"u"}function Ci(e){return ki(e)||e===null}function Pi(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 pn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function o(a,d){for(let f in d)if(Object.prototype.hasOwnProperty.call(d,f)){let h=a[f],p=d[f],_=r(h,p,f,a,d);_!==void 0?a[f]=_:cn(p)&&cn(h)?a[f]=o(M({},h),p):Array.isArray(p)&&Array.isArray(h)?a[f]=[...h,...p]:a[f]=p}return a}return o(e,t)}function cn(e){return e&&typeof e=="object"&&e.constructor===Object}function gn(e,t){if(Array.isArray(e))return e.concat(t)}function Ve(e,t,r={}){let o=null,a,d,f,{leading:h=!1,trailing:p=!0}=r,_=()=>(f=e.apply(d,a),a=void 0,d=void 0,f),I=function(...k){a=k,d=this;let g=h&&!o;if(o&&clearTimeout(o),o=setTimeout(()=>{o=null,p&&!g&&_()},t),g)return _()};return I.cancel=()=>{o&&clearTimeout(o),o=null,a=d=void 0},I.flush=()=>{if(o)return clearTimeout(o),o=null,_()},I}function Fi(e,t){return(...r)=>t(e,...r)}function Tn(e){return t=>Fi(t,function(r,...o){if(typeof r=="function")try{return r.apply(this,o)}catch(a){e(new Oi(`${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,d)=>(a[d]=String(o[d]),a),{})}return e[r]})}function Mi(e){let t=e.location?Ze(e.location,un):null,r=e.target?Ze(e.target,un):null;return Ze(W(M({},e),{location:t,target:r}),Ui)}function ar(e){let t=e.events.map(o=>Mi(o)),r=Ze(e.device,Bi);return[e.protocolVersion,t,r,e.project]}function Yi(e){return new Promise(t=>An(e)(t))}function An(e){return(t,r=null)=>{let o=!1;return e(a=>{if(!o)return o=!0,t.call(r,a)},null)}}function Qi(e,t){return(r=>{let o,a={onWillAddFirstListener(){o=r(d.fire,d)}},d=new $e(a);return d.event})((r,o=null)=>e(a=>t(a)&&r.call(o,a),null))}function Zi(e,t){let r=Math.min(e.length,t.length);for(let o=0;o<r;o++)ea(e[o],t[o])}function ea(e,t){if(tr(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Pi(t)){try{if(e instanceof t)return}catch(r){}if(!Ci(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 ie(){if(globalThis[Xt])return globalThis[Xt];let e=new et,t=new er,r={registerCommand(o,a,d){e.registerCommand({id:o,handler:a,metadata:d})},executeCommand(o,...a){return t.executeCommand(o,...a)},excuteCommandSync(o,...a){return t.executeCommandThowErr(o,...a)}};return globalThis[Xt]=r,r}var ln,Si,Ri,dn,Di,rr,nr,vn,yn,Oi,bn,En,tt,or,se,_n,Ni,ir,je,xe,Li,un,Ui,Bi,$i,Qe,Vi,ji,Ki,In,sr,Gi,Hi,Ji,wn,me,H,Wi,qi,Xe,$e,be,Zt,zi,Qt,Xi,Ke,et,er,Xt,j=G(()=>{"use strict";ln=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,Ri=(e,t)=>{for(var r in t)ln(e,r,{get:t[r],enumerable:!0})},dn=(e,t,r,o)=>{for(var a=o>1?void 0:o?Si(t,r):t,d=e.length-1,f;d>=0;d--)(f=e[d])&&(a=(o?f(t,r,a):f(a))||a);return o&&a&&ln(t,r,a),a};Di=(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))(Di||{}),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"}},vn=class extends rr{constructor(){super(...arguments),this.kind="USER_ERROR"}},yn=class extends vn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Oi=class extends vn{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))}},bn=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"}};se={log:Me("log"),warn:Me("warn"),info:Me("info"),error:Me("error"),debug:Me("debug")};Object.assign(globalThis,{logger:se});_n=Symbol.for("Jolibox.canIUseMap"),Ni={};globalThis[_n]=Ni;ir={get config(){return globalThis[_n]}},je=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(je||{}),xe=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(xe||{}),Li=(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))(Li||{}),un=["name","params"],Ui=["name","type","location","target","extra","timestamp","userId"],Bi=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];$i=()=>"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")},Vi=()=>Qe.isiOS?"iOS":Qe.isAndroid?"Android":Qe.isMac?"Mac":Qe.isFacebook?"Facebook":"PC",ji="device_id",Ki="advertising_id",In=e=>(localStorage.getItem(e)||localStorage.setItem(e,$i()),localStorage.getItem(e)),sr=()=>In(ji),Gi=()=>In(Ki),Hi=e=>e.charAt(0).toUpperCase()+e.slice(1),Ji=()=>{var t;let e=new URLSearchParams(window.location.search);return Hi((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},wn=e=>{let t="JoliboxWebSDK",r=Vi(),o=navigator.language,a=sr(),d=Gi();return`${t} (${Ji()}${r}; UnknownModel; UnknownSystemVersion; ${o}) uuid/${a} adid/${d} version/${e||""}`},H=(me=class{constructor(t){this.element=t,this.next=me.Undefined,this.prev=me.Undefined}},me.Undefined=new me(void 0),me),Wi=class{constructor(){this._first=H.Undefined,this._last=H.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===H.Undefined}clear(){let e=this._first;for(;e!==H.Undefined;){let t=e.next;e.prev=H.Undefined,e.next=H.Undefined,e=t}this._first=H.Undefined,this._last=H.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new H(e);if(this._first===H.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!==H.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==H.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==H.Undefined&&e.next!==H.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===H.Undefined&&e.next===H.Undefined?(this._first=H.Undefined,this._last=H.Undefined):e.next===H.Undefined?(this._last=this._last.prev,this._last.next=H.Undefined):e.prev===H.Undefined&&(this._first=this._first.next,this._first.prev=H.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==H.Undefined;)yield e.element,e=e.next}},qi=0,Xe=class{constructor(e){this.value=e,this.id=qi++}},$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,d,f,h,p,_;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):((d=(a=this.options)==null?void 0:a.onWillAddFirstListener)==null||d.call(a,this),this._listeners=o,(h=(f=this.options)==null?void 0:f.onDidFirstListener)==null||h.call(f,this)),(_=(p=this.options)==null?void 0:p.onDidAddListener)==null||_.call(p,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}},be=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var d;let r=(d=this.listeners.get(e))!=null?d: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(M({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={};Ri(Zt,{None:()=>zi,filter:()=>Qi,once:()=>An,toPromise:()=>Yi});zi=()=>{console.log("[Jolibox SDK] None Event")};Qt=Symbol.for("Jolibox.hostEmitter"),Xi=()=>{let e=new be;return globalThis[Qt]||(globalThis[Qt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Qt]},Ke=Xi();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 Zi(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=dn([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=dn([hn],er);Xt=Symbol.for("Jolibox.commands")});function ce(e,t={}){cr.emit("ERROR_REPORT",{error:e,options:t})}var cr,_e,Ee=G(()=>{"use strict";j();j();cr=new be,_e=new be;ce.debounce=Ve(ce,50,{leading:!0})});var ur,Sn,Rn=G(()=>{"use strict";j();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{}}},Sn=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[d,f,h]=a;return{headerJson:ur(d),payloadJson:ur(f),signature:ur(h)}}else throw"joli_source is missing"}catch(r){return ce(new bn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}}});var ta,rt,xn,lr=G(()=>{"use strict";j();ta="1.1.10-beta.1",rt=()=>ta,xn=()=>{let e=rt();return`${wn(e)}`}});var ra,kn,dr,Cn,Z,na,R,te=G(()=>{"use strict";j();Rn();lr();j();ra={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"},dr=(kn=globalThis.joliboxJSCore)==null?void 0:kn.env,Z=Object.assign({},(Cn=dr==null?void 0:dr())!=null?Cn:ra),na=()=>{var k,g,T,D,C,P,O,K;let{payloadJson:e,headerJson:t}=Z.schema.length?Sn(Z.schema):{},r=`${Z.deviceInfo.did}-${new Date().getTime()}`,a=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,d=(T=(g=(k=a.get("mpId"))!=null?k:a.get("appId"))!=null?g:a.get("gameId"))!=null?T:"",f=(C=(D=e==null?void 0:e.sessionId)!=null?D:a.get("sessionId"))!=null?C:r,h=!!((P=e==null?void 0:e.testAdsMode)!=null?P:a.get("testAdsMode")==="true"),p=(K=(O=e==null?void 0:e.joliboxEnv)!=null?O:a.get("joliboxEnv"))!=null?K:"production",_=p==="staging",I=t==null?void 0:t.channel;return{get testMode(){return _},get testAdsMode(){return h},get joliboxEnv(){return p},get joliSource(){var S;return(S=a.get("joliSource"))!=null?S:null},get mpId(){var S;return(S=d!=null?d:e==null?void 0:e.id)!=null?S:""},get mpVersion(){var S;return(S=t==null?void 0:t.ver)!=null?S:rt()},get mpType(){var S,X;return(X=(S=t==null?void 0:t.__mpType)!=null?S:e==null?void 0:e.__mpType)!=null?X:"game"},get platform(){var S;return(S=Z.platform)!=null?S: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 S,X;return(X=(S=Z.clientSessionId)!=null?S:f)!=null?X:r},get channel(){return I},get webviewId(){var S;return(S=Z.webviewId)!=null?S:-1},onEnvConfigChanged:S=>{pn(Z,S,gn)}}},R=na()});var fr,Dn,oa,ia,Pn,aa,On=G(()=>{"use strict";j();Ee();te();j();fr=!1,Dn=(e,t)=>e==null?!1:t in e,oa=e=>Dn(e,"kind"),ia=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Pn=(e,t={},r)=>{var d,f,h;let o={user_id:(f=(d=R.hostUserInfo)==null?void 0:d.uid)!=null?f:"",device_id:(h=R.deviceInfo.did)!=null?h:"",timestamp:Date.now(),tag:ia(e.name)},a=W(M({},o),{env:t.environment,isFromUser:r});r?_e.emit("GLOBAL_USER_ERROR",e,a):_e.emit("GLOBAL_ERROR",e,a)},aa=e=>Dn(e,"kind")&&e.kind==="USER_ERROR";cr.on("ERROR_REPORT",({error:e,options:t})=>{if(fr)return;fr=!0;let r=oa(e)&&e.raw?e.raw:e;try{let o=aa(e);Pn(e,t,o)}catch(o){let a=o instanceof Error?o.message:String(o),d=new or(`${a}, origin error: ${r.message}`);se.error(d),Pn(new or(d.message),{environment:t.environment},!1)}finally{fr=!1}})});var mr,hr=G(()=>{"use strict";Ee();j();Ee();mr=e=>new yn(e)});function Fn(e,t){let r=(o,a,d)=>{let f=W(M({tag:o},t),{extra:M({},a)});o=="globalJsError"?ce(new En(JSON.stringify(f))):e("systemLog",f,d)};return r.debounce=Ve(r,500,{leading:!0}),r}function Nn(e){let t=(r,o,a)=>{var h;let d=(h=a&&JSON.stringify(a))!=null?h:0,f={speed_value_type:r,total_duration:o};d&&Object.assign(f,{extra:d}),e("joliboxSpeedAnalysis",f)};return t.debounce=Ve(t,500,{leading:!0}),t}var Ln=G(()=>{"use strict";j();j();Ee()});function Un(e,t){let r=Fn(e,t),o=Nn(r);return{track:r,trackPerformance:o}}var Bn=G(()=>{"use strict";Ln()});var pr=G(()=>{"use strict"});var nt,Mn=G(()=>{"use strict";te();j();j();nt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return L(this,null,function*(){let r=`${R.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,d,f,h;let{nativeSDKVersion:t,jssdkVersion:r}=R.sdkInfo;return{platform:1e3,os:R.deviceInfo.platform,appVersion:(o=t!=null?t:r)!=null?o:"1.0.0",appId:(d=(a=R.hostInfo)==null?void 0:a.aid)!=null?d:"1",model:(f=R.deviceInfo.model)!=null?f:"UnknownModel",brand:(h=R.deviceInfo.brand)!=null?h:"UnknownBrand",uuid:R.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(),d=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let h=this.deviceInfo,_={protocolVersion:"1.0.0",events:[W(M({},t),{location:a,target:d,extra:f,timestamp:Date.now(),userId:null})],device:h,project:r};try{o?yield this.doReport(ar(_),o):yield this.doReport(ar(_))}catch(I){se.log("[Jolibox SDK] report API error",I)}})}}});var gr=G(()=>{"use strict";Bn();pr();Mn()});var vr,$n,he,ot,pe,Ge=G(()=>{"use strict";lr();te();vr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};($n=AbortSignal.timeout)!=null||(AbortSignal.timeout=vr);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=xn();this.getJoliSource=()=>R.joliSource;var o;let r=R.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:d}=r!=null?r:{},f=o?new URLSearchParams(o):null,h=f==null?void 0:f.toString(),p=`${this.baseUrl}${t}${h?`?${h}`:""}`,_=this.xua,I=this.getJoliSource();d=Object.assign({},d!=null?d:{},_?{"x-user-agent":_}:{},I?{"x-joli-source":I}:{});let k=yield fetch(p,{method:"GET",headers:d,credentials:"include",signal:vr(a!=null?a:3e4)});return he.getInstance().recordNetworkRequest(!0),yield k.json()}catch(o){throw he.getInstance().recordNetworkRequest(!1),o}})}post(t,r){return L(this,null,function*(){try{let{data:o,query:a,timeout:d}=r!=null?r:{},{headers:f}=r!=null?r:{},h=a?new URLSearchParams(a):null,p=h==null?void 0:h.toString(),_=`${this.baseUrl}${t}${p?`?${p}`:""}`,I=this.xua,k=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},I?{"x-user-agent":I}:{},k?{"x-joli-source":k}:{});let g=yield fetch(_,{method:"POST",headers:f,body:JSON.stringify(o),signal:vr(d!=null?d:3e4),credentials:"include"});he.getInstance().recordNetworkRequest(!0);let T=g.headers.get("content-type");if(T!=null&&T.includes("application/octet-stream"))try{return g.blob()}catch(D){return yield g.arrayBuffer()}if(T!=null&&T.includes("multipart/form-data")||T!=null&&T.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(D){return yield g.text()}if(T!=null&&T.includes("application/json"))try{return yield g.json()}catch(D){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:d}=r!=null?r:{},{headers:f}=r!=null?r:{},h=a?new URLSearchParams(a):null,p=h==null?void 0:h.toString(),_=`${this.baseUrl}${t}${p?`?${p}`:""}`,I=this.xua,k=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},I?{"x-user-agent":I}:{},k?{"x-joli-source":k}:{});let g=yield fetch(_,{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;pe=he.getInstance()});var yr,it,br=G(()=>{"use strict";te();gr();Ge();yr=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=pe.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var o,a;let r=(o=this.hostToApiMap[window.location.host])!=null?o:this.hostToApiMap.default;return(a=R.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 yr});var sa,Vn=G(()=>{"use strict";On();j();hr();j();br();te();sa=(e,t)=>{var a,d,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=(d=R.hostUserInfo)==null?void 0:d.uid)!=null?f:null};it.trackEvent(o,xe.WebSDK)};_e.on("GLOBAL_ERROR",(e,t)=>{sa(t.tag,e)});_e.on("GLOBAL_USER_ERROR",(e,t)=>{se.log("UserError",e,t)})});var at,jn=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,d=!1,f=0,h=()=>{if(!d)return;let T=Date.now(),D=T-r;D>=this.interval&&(this.visible&&(f+=D,t(f)),r=T),o=requestAnimationFrame(h)},p=()=>{I(),r=Date.now(),a=window.setInterval(()=>{if(!d)return;let T=Date.now();T-r>=this.interval&&(r=T)},this.interval)},_=()=>{k(),r=Date.now(),o=requestAnimationFrame(h)},I=()=>{o&&(cancelAnimationFrame(o),o=0)},k=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",T=>{d&&(console.log("visible",T),T?_():p())});let g=this.visible;return{start(){d||(d=!0,g?_():p())},stop(){d=!1,I(),k()}}}}});var st,Kn=G(()=>{"use strict";te();jn();Ge();st=class extends at{constructor(r,o,a){super(o,a);this.httpClient=pe.create();this.gameId=R.mpId,this.sessionId=R.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:M({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,o=null){this.track(r,o)}}});var Gn,ca,le,ua,Er,ue,Ie=G(()=>{"use strict";Vn();j();j();gr();br();Kn();te();pr();Gn=ie(),ca={type:xe.WebSDK,platform:"h5",jssdk_version:R.sdkInfo.jssdkVersion,mp_id:R.mpId,mp_version:R.mpVersion},{track:le,trackPerformance:ua}=Un((...e)=>{var f,h,p,_;let[,t]=e,r=t,o=fn(r.extra)?r.extra:tr(r.extra)?JSON.parse(r.extra):{},a=W(M({},o),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(h=r.mp_version)!=null?h:""}),d={name:t.tag,type:je.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(_=(p=R.hostUserInfo)==null?void 0:p.uid)!=null?_:null};it.trackEvent(d,xe.WebSDK)},ca);Gn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{ua(e,t,r)});Gn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{le(e,t)});Er=new be,ue=new st(le,Er)});function Hn(e){let t=ir.config[e];return t||(t={},ir.config[e]=t),(r,o)=>{if(t[r]){se.warn(`[can i use] ${r} already registered`);return}t[r]=M({},o)}}var Jn=G(()=>{"use strict";j()});function Tr(e){Wn=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 ge(e){return typeof e=="number"}function _r(e){let t=Ir(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Ir(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Wn,z,ut,lt,dt,ft,ke,mt,ht,pt,gt,vt,yt,bt,Et,Tt,_t,It,wt,wr=G(()=>{"use strict";Wn=!1;z=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 ${_r(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 z{validate(t){return this._optional&&t===void 0?!0:ge(t)?ge(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ge(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ge(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},lt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},dt=class extends z{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ge(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ge(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},ft=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends z{validate(t){return!0}},mt=class extends z{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ht=class extends z{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},pt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},gt=class extends z{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(o=>JSON.stringify(o)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${_r(t)}`)}return!0}},vt=class extends z{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ge(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ge(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ge(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let o=this._item;if(!o)return!0;let a=!0;if(r.forEach((d,f)=>{if(o.path=`${this.path}[${f}]`,o.errors=this.errors,d===void 0&&o.hasDefault){r[f]=o.defaultValue;return}o.validate(d)||(o.hasFallback?r[f]=o.fallbackValue:a=!1)}),this._uniqueItems){let d=new Map;for(let f in r)d.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${d.get(r[f])}] and ${this.path}[${f}] are identical)`):d.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 z{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Ir(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,d=this._value;d.errors=this.errors;let f=!0;for(let h in a){let p=a[h];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(h)?d.path=`${this.path}.${h}`:d.path=`${this.path}["${h}"]`,!(p===void 0&&d._optional)){if(p===void 0&&d.hasDefault){a[h]=d.defaultValue;continue}d.validate(p)||(d.hasFallback?a[h]=d.fallbackValue:f=!1)}}return f}},bt=class extends z{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Ir(r)!=="object")return this.fail({expect:"object",actual:r});let o=r,a=!0;for(let d in this._object){let f=o[d],h=this._object[d];if(h.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(d)?h.path=`${this.path}.${d}`:h.path=`${this.path}["${d}"]`,!(h._optional&&f===void 0)){if(f===void 0&&h.hasDefault){o[d]=h.defaultValue;continue}h.validate(f)||(h.hasFallback?o[d]=h.fallbackValue:a=!1)}}return a}},Et=class extends z{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:_r(this.value),actual:r}):!0}},Tt=class extends z{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 d=0;d<a;d++){let f=this._items[d];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!o){o=!0;break}}if(!o){let d=r.join(`
1
+ var bi=Object.create;var zt=Object.defineProperty,Ei=Object.defineProperties,Ti=Object.getOwnPropertyDescriptor,_i=Object.getOwnPropertyDescriptors,Ii=Object.getOwnPropertyNames,Ye=Object.getOwnPropertySymbols,wi=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var rn=(e,t,r)=>t in e?zt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,M=(e,t)=>{for(var r in t||(t={}))Yt.call(t,r)&&rn(e,r,t[r]);if(Ye)for(var r of Ye(t))nn.call(t,r)&&rn(e,r,t[r]);return e},W=(e,t)=>Ei(e,_i(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 on=(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&&nn.call(e,o)&&(r[o]=e[o]);return r};var G=(e,t)=>()=>(e&&(t=e(e=0)),t);var an=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ai=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ii(t))!Yt.call(e,a)&&a!==r&&zt(e,a,{get:()=>t[a],enumerable:!(o=Ti(t,a))||o.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?bi(wi(e)):{},Ai(t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r,e));var L=(e,t,r)=>new Promise((o,a)=>{var d=p=>{try{h(r.next(p))}catch(_){a(_)}},f=p=>{try{h(r.throw(p))}catch(_){a(_)}},h=p=>p.done?o(p.value):Promise.resolve(p.value).then(d,f);h((r=r.apply(e,t)).next())});function xi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function tr(e){return typeof e=="string"}function fn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function mn(e){return typeof e=="object"&&Array.isArray(e)}function ki(e){return typeof e>"u"}function Ci(e){return ki(e)||e===null}function Pi(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 pn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function o(a,d){for(let f in d)if(Object.prototype.hasOwnProperty.call(d,f)){let h=a[f],p=d[f],_=r(h,p,f,a,d);_!==void 0?a[f]=_:cn(p)&&cn(h)?a[f]=o(M({},h),p):Array.isArray(p)&&Array.isArray(h)?a[f]=[...h,...p]:a[f]=p}return a}return o(e,t)}function cn(e){return e&&typeof e=="object"&&e.constructor===Object}function gn(e,t){if(Array.isArray(e))return e.concat(t)}function Ve(e,t,r={}){let o=null,a,d,f,{leading:h=!1,trailing:p=!0}=r,_=()=>(f=e.apply(d,a),a=void 0,d=void 0,f),I=function(...k){a=k,d=this;let g=h&&!o;if(o&&clearTimeout(o),o=setTimeout(()=>{o=null,p&&!g&&_()},t),g)return _()};return I.cancel=()=>{o&&clearTimeout(o),o=null,a=d=void 0},I.flush=()=>{if(o)return clearTimeout(o),o=null,_()},I}function Fi(e,t){return(...r)=>t(e,...r)}function Tn(e){return t=>Fi(t,function(r,...o){if(typeof r=="function")try{return r.apply(this,o)}catch(a){e(new Oi(`${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,d)=>(a[d]=String(o[d]),a),{})}return e[r]})}function Mi(e){let t=e.location?Ze(e.location,un):null,r=e.target?Ze(e.target,un):null;return Ze(W(M({},e),{location:t,target:r}),Ui)}function ar(e){let t=e.events.map(o=>Mi(o)),r=Ze(e.device,Bi);return[e.protocolVersion,t,r,e.project]}function Yi(e){return new Promise(t=>An(e)(t))}function An(e){return(t,r=null)=>{let o=!1;return e(a=>{if(!o)return o=!0,t.call(r,a)},null)}}function Qi(e,t){return(r=>{let o,a={onWillAddFirstListener(){o=r(d.fire,d)}},d=new $e(a);return d.event})((r,o=null)=>e(a=>t(a)&&r.call(o,a),null))}function Zi(e,t){let r=Math.min(e.length,t.length);for(let o=0;o<r;o++)ea(e[o],t[o])}function ea(e,t){if(tr(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Pi(t)){try{if(e instanceof t)return}catch(r){}if(!Ci(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 ie(){if(globalThis[Xt])return globalThis[Xt];let e=new et,t=new er,r={registerCommand(o,a,d){e.registerCommand({id:o,handler:a,metadata:d})},executeCommand(o,...a){return t.executeCommand(o,...a)},excuteCommandSync(o,...a){return t.executeCommandThowErr(o,...a)}};return globalThis[Xt]=r,r}var ln,Si,Ri,dn,Di,rr,nr,vn,yn,Oi,bn,En,tt,or,se,_n,Ni,ir,je,xe,Li,un,Ui,Bi,$i,Qe,Vi,ji,Ki,In,sr,Gi,Hi,Ji,wn,me,H,Wi,qi,Xe,$e,be,Zt,zi,Qt,Xi,Ke,et,er,Xt,j=G(()=>{"use strict";ln=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,Ri=(e,t)=>{for(var r in t)ln(e,r,{get:t[r],enumerable:!0})},dn=(e,t,r,o)=>{for(var a=o>1?void 0:o?Si(t,r):t,d=e.length-1,f;d>=0;d--)(f=e[d])&&(a=(o?f(t,r,a):f(a))||a);return o&&a&&ln(t,r,a),a};Di=(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))(Di||{}),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"}},vn=class extends rr{constructor(){super(...arguments),this.kind="USER_ERROR"}},yn=class extends vn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Oi=class extends vn{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))}},bn=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"}};se={log:Me("log"),warn:Me("warn"),info:Me("info"),error:Me("error"),debug:Me("debug")};Object.assign(globalThis,{logger:se});_n=Symbol.for("Jolibox.canIUseMap"),Ni={};globalThis[_n]=Ni;ir={get config(){return globalThis[_n]}},je=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(je||{}),xe=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(xe||{}),Li=(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))(Li||{}),un=["name","params"],Ui=["name","type","location","target","extra","timestamp","userId"],Bi=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];$i=()=>"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")},Vi=()=>Qe.isiOS?"iOS":Qe.isAndroid?"Android":Qe.isMac?"Mac":Qe.isFacebook?"Facebook":"PC",ji="device_id",Ki="advertising_id",In=e=>(localStorage.getItem(e)||localStorage.setItem(e,$i()),localStorage.getItem(e)),sr=()=>In(ji),Gi=()=>In(Ki),Hi=e=>e.charAt(0).toUpperCase()+e.slice(1),Ji=()=>{var t;let e=new URLSearchParams(window.location.search);return Hi((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},wn=e=>{let t="JoliboxWebSDK",r=Vi(),o=navigator.language,a=sr(),d=Gi();return`${t} (${Ji()}${r}; UnknownModel; UnknownSystemVersion; ${o}) uuid/${a} adid/${d} version/${e||""}`},H=(me=class{constructor(t){this.element=t,this.next=me.Undefined,this.prev=me.Undefined}},me.Undefined=new me(void 0),me),Wi=class{constructor(){this._first=H.Undefined,this._last=H.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===H.Undefined}clear(){let e=this._first;for(;e!==H.Undefined;){let t=e.next;e.prev=H.Undefined,e.next=H.Undefined,e=t}this._first=H.Undefined,this._last=H.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new H(e);if(this._first===H.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!==H.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==H.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==H.Undefined&&e.next!==H.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===H.Undefined&&e.next===H.Undefined?(this._first=H.Undefined,this._last=H.Undefined):e.next===H.Undefined?(this._last=this._last.prev,this._last.next=H.Undefined):e.prev===H.Undefined&&(this._first=this._first.next,this._first.prev=H.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==H.Undefined;)yield e.element,e=e.next}},qi=0,Xe=class{constructor(e){this.value=e,this.id=qi++}},$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,d,f,h,p,_;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):((d=(a=this.options)==null?void 0:a.onWillAddFirstListener)==null||d.call(a,this),this._listeners=o,(h=(f=this.options)==null?void 0:f.onDidFirstListener)==null||h.call(f,this)),(_=(p=this.options)==null?void 0:p.onDidAddListener)==null||_.call(p,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}},be=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var d;let r=(d=this.listeners.get(e))!=null?d: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(M({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={};Ri(Zt,{None:()=>zi,filter:()=>Qi,once:()=>An,toPromise:()=>Yi});zi=()=>{console.log("[Jolibox SDK] None Event")};Qt=Symbol.for("Jolibox.hostEmitter"),Xi=()=>{let e=new be;return globalThis[Qt]||(globalThis[Qt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Qt]},Ke=Xi();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 Zi(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=dn([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=dn([hn],er);Xt=Symbol.for("Jolibox.commands")});function ce(e,t={}){cr.emit("ERROR_REPORT",{error:e,options:t})}var cr,_e,Ee=G(()=>{"use strict";j();j();cr=new be,_e=new be;ce.debounce=Ve(ce,50,{leading:!0})});var ur,Sn,Rn=G(()=>{"use strict";j();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{}}},Sn=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[d,f,h]=a;return{headerJson:ur(d),payloadJson:ur(f),signature:ur(h)}}else throw"joli_source is missing"}catch(r){return ce(new bn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}}});var ta,rt,xn,lr=G(()=>{"use strict";j();ta="1.1.10",rt=()=>ta,xn=()=>{let e=rt();return`${wn(e)}`}});var ra,kn,dr,Cn,Z,na,R,te=G(()=>{"use strict";j();Rn();lr();j();ra={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"},dr=(kn=globalThis.joliboxJSCore)==null?void 0:kn.env,Z=Object.assign({},(Cn=dr==null?void 0:dr())!=null?Cn:ra),na=()=>{var k,g,T,D,C,P,O,K;let{payloadJson:e,headerJson:t}=Z.schema.length?Sn(Z.schema):{},r=`${Z.deviceInfo.did}-${new Date().getTime()}`,a=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,d=(T=(g=(k=a.get("mpId"))!=null?k:a.get("appId"))!=null?g:a.get("gameId"))!=null?T:"",f=(C=(D=e==null?void 0:e.sessionId)!=null?D:a.get("sessionId"))!=null?C:r,h=!!((P=e==null?void 0:e.testAdsMode)!=null?P:a.get("testAdsMode")==="true"),p=(K=(O=e==null?void 0:e.joliboxEnv)!=null?O:a.get("joliboxEnv"))!=null?K:"production",_=p==="staging",I=t==null?void 0:t.channel;return{get testMode(){return _},get testAdsMode(){return h},get joliboxEnv(){return p},get joliSource(){var S;return(S=a.get("joliSource"))!=null?S:null},get mpId(){var S;return(S=d!=null?d:e==null?void 0:e.id)!=null?S:""},get mpVersion(){var S;return(S=t==null?void 0:t.ver)!=null?S:rt()},get mpType(){var S,X;return(X=(S=t==null?void 0:t.__mpType)!=null?S:e==null?void 0:e.__mpType)!=null?X:"game"},get platform(){var S;return(S=Z.platform)!=null?S: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 S,X;return(X=(S=Z.clientSessionId)!=null?S:f)!=null?X:r},get channel(){return I},get webviewId(){var S;return(S=Z.webviewId)!=null?S:-1},onEnvConfigChanged:S=>{pn(Z,S,gn)}}},R=na()});var fr,Dn,oa,ia,Pn,aa,On=G(()=>{"use strict";j();Ee();te();j();fr=!1,Dn=(e,t)=>e==null?!1:t in e,oa=e=>Dn(e,"kind"),ia=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Pn=(e,t={},r)=>{var d,f,h;let o={user_id:(f=(d=R.hostUserInfo)==null?void 0:d.uid)!=null?f:"",device_id:(h=R.deviceInfo.did)!=null?h:"",timestamp:Date.now(),tag:ia(e.name)},a=W(M({},o),{env:t.environment,isFromUser:r});r?_e.emit("GLOBAL_USER_ERROR",e,a):_e.emit("GLOBAL_ERROR",e,a)},aa=e=>Dn(e,"kind")&&e.kind==="USER_ERROR";cr.on("ERROR_REPORT",({error:e,options:t})=>{if(fr)return;fr=!0;let r=oa(e)&&e.raw?e.raw:e;try{let o=aa(e);Pn(e,t,o)}catch(o){let a=o instanceof Error?o.message:String(o),d=new or(`${a}, origin error: ${r.message}`);se.error(d),Pn(new or(d.message),{environment:t.environment},!1)}finally{fr=!1}})});var mr,hr=G(()=>{"use strict";Ee();j();Ee();mr=e=>new yn(e)});function Fn(e,t){let r=(o,a,d)=>{let f=W(M({tag:o},t),{extra:M({},a)});o=="globalJsError"?ce(new En(JSON.stringify(f))):e("systemLog",f,d)};return r.debounce=Ve(r,500,{leading:!0}),r}function Nn(e){let t=(r,o,a)=>{var h;let d=(h=a&&JSON.stringify(a))!=null?h:0,f={speed_value_type:r,total_duration:o};d&&Object.assign(f,{extra:d}),e("joliboxSpeedAnalysis",f)};return t.debounce=Ve(t,500,{leading:!0}),t}var Ln=G(()=>{"use strict";j();j();Ee()});function Un(e,t){let r=Fn(e,t),o=Nn(r);return{track:r,trackPerformance:o}}var Bn=G(()=>{"use strict";Ln()});var pr=G(()=>{"use strict"});var nt,Mn=G(()=>{"use strict";te();j();j();nt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return L(this,null,function*(){let r=`${R.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,d,f,h;let{nativeSDKVersion:t,jssdkVersion:r}=R.sdkInfo;return{platform:1e3,os:R.deviceInfo.platform,appVersion:(o=t!=null?t:r)!=null?o:"1.0.0",appId:(d=(a=R.hostInfo)==null?void 0:a.aid)!=null?d:"1",model:(f=R.deviceInfo.model)!=null?f:"UnknownModel",brand:(h=R.deviceInfo.brand)!=null?h:"UnknownBrand",uuid:R.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(),d=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let h=this.deviceInfo,_={protocolVersion:"1.0.0",events:[W(M({},t),{location:a,target:d,extra:f,timestamp:Date.now(),userId:null})],device:h,project:r};try{o?yield this.doReport(ar(_),o):yield this.doReport(ar(_))}catch(I){se.log("[Jolibox SDK] report API error",I)}})}}});var gr=G(()=>{"use strict";Bn();pr();Mn()});var vr,$n,he,ot,pe,Ge=G(()=>{"use strict";lr();te();vr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};($n=AbortSignal.timeout)!=null||(AbortSignal.timeout=vr);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=xn();this.getJoliSource=()=>R.joliSource;var o;let r=R.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:d}=r!=null?r:{},f=o?new URLSearchParams(o):null,h=f==null?void 0:f.toString(),p=`${this.baseUrl}${t}${h?`?${h}`:""}`,_=this.xua,I=this.getJoliSource();d=Object.assign({},d!=null?d:{},_?{"x-user-agent":_}:{},I?{"x-joli-source":I}:{});let k=yield fetch(p,{method:"GET",headers:d,credentials:"include",signal:vr(a!=null?a:3e4)});return he.getInstance().recordNetworkRequest(!0),yield k.json()}catch(o){throw he.getInstance().recordNetworkRequest(!1),o}})}post(t,r){return L(this,null,function*(){try{let{data:o,query:a,timeout:d}=r!=null?r:{},{headers:f}=r!=null?r:{},h=a?new URLSearchParams(a):null,p=h==null?void 0:h.toString(),_=`${this.baseUrl}${t}${p?`?${p}`:""}`,I=this.xua,k=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},I?{"x-user-agent":I}:{},k?{"x-joli-source":k}:{});let g=yield fetch(_,{method:"POST",headers:f,body:JSON.stringify(o),signal:vr(d!=null?d:3e4),credentials:"include"});he.getInstance().recordNetworkRequest(!0);let T=g.headers.get("content-type");if(T!=null&&T.includes("application/octet-stream"))try{return g.blob()}catch(D){return yield g.arrayBuffer()}if(T!=null&&T.includes("multipart/form-data")||T!=null&&T.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(D){return yield g.text()}if(T!=null&&T.includes("application/json"))try{return yield g.json()}catch(D){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:d}=r!=null?r:{},{headers:f}=r!=null?r:{},h=a?new URLSearchParams(a):null,p=h==null?void 0:h.toString(),_=`${this.baseUrl}${t}${p?`?${p}`:""}`,I=this.xua,k=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},I?{"x-user-agent":I}:{},k?{"x-joli-source":k}:{});let g=yield fetch(_,{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;pe=he.getInstance()});var yr,it,br=G(()=>{"use strict";te();gr();Ge();yr=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=pe.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var o,a;let r=(o=this.hostToApiMap[window.location.host])!=null?o:this.hostToApiMap.default;return(a=R.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 yr});var sa,Vn=G(()=>{"use strict";On();j();hr();j();br();te();sa=(e,t)=>{var a,d,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=(d=R.hostUserInfo)==null?void 0:d.uid)!=null?f:null};it.trackEvent(o,xe.WebSDK)};_e.on("GLOBAL_ERROR",(e,t)=>{sa(t.tag,e)});_e.on("GLOBAL_USER_ERROR",(e,t)=>{se.log("UserError",e,t)})});var at,jn=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,d=!1,f=0,h=()=>{if(!d)return;let T=Date.now(),D=T-r;D>=this.interval&&(this.visible&&(f+=D,t(f)),r=T),o=requestAnimationFrame(h)},p=()=>{I(),r=Date.now(),a=window.setInterval(()=>{if(!d)return;let T=Date.now();T-r>=this.interval&&(r=T)},this.interval)},_=()=>{k(),r=Date.now(),o=requestAnimationFrame(h)},I=()=>{o&&(cancelAnimationFrame(o),o=0)},k=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",T=>{d&&(console.log("visible",T),T?_():p())});let g=this.visible;return{start(){d||(d=!0,g?_():p())},stop(){d=!1,I(),k()}}}}});var st,Kn=G(()=>{"use strict";te();jn();Ge();st=class extends at{constructor(r,o,a){super(o,a);this.httpClient=pe.create();this.gameId=R.mpId,this.sessionId=R.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:M({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,o=null){this.track(r,o)}}});var Gn,ca,le,ua,Er,ue,Ie=G(()=>{"use strict";Vn();j();j();gr();br();Kn();te();pr();Gn=ie(),ca={type:xe.WebSDK,platform:"h5",jssdk_version:R.sdkInfo.jssdkVersion,mp_id:R.mpId,mp_version:R.mpVersion},{track:le,trackPerformance:ua}=Un((...e)=>{var f,h,p,_;let[,t]=e,r=t,o=fn(r.extra)?r.extra:tr(r.extra)?JSON.parse(r.extra):{},a=W(M({},o),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(h=r.mp_version)!=null?h:""}),d={name:t.tag,type:je.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(_=(p=R.hostUserInfo)==null?void 0:p.uid)!=null?_:null};it.trackEvent(d,xe.WebSDK)},ca);Gn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{ua(e,t,r)});Gn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{le(e,t)});Er=new be,ue=new st(le,Er)});function Hn(e){let t=ir.config[e];return t||(t={},ir.config[e]=t),(r,o)=>{if(t[r]){se.warn(`[can i use] ${r} already registered`);return}t[r]=M({},o)}}var Jn=G(()=>{"use strict";j()});function Tr(e){Wn=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 ge(e){return typeof e=="number"}function _r(e){let t=Ir(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Ir(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Wn,z,ut,lt,dt,ft,ke,mt,ht,pt,gt,vt,yt,bt,Et,Tt,_t,It,wt,wr=G(()=>{"use strict";Wn=!1;z=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 ${_r(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 z{validate(t){return this._optional&&t===void 0?!0:ge(t)?ge(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ge(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ge(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},lt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},dt=class extends z{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ge(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ge(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},ft=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ke=class extends z{validate(t){return!0}},mt=class extends z{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ht=class extends z{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},pt=class extends z{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},gt=class extends z{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(o=>JSON.stringify(o)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${_r(t)}`)}return!0}},vt=class extends z{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ge(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ge(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ge(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let o=this._item;if(!o)return!0;let a=!0;if(r.forEach((d,f)=>{if(o.path=`${this.path}[${f}]`,o.errors=this.errors,d===void 0&&o.hasDefault){r[f]=o.defaultValue;return}o.validate(d)||(o.hasFallback?r[f]=o.fallbackValue:a=!1)}),this._uniqueItems){let d=new Map;for(let f in r)d.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${d.get(r[f])}] and ${this.path}[${f}] are identical)`):d.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 z{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Ir(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,d=this._value;d.errors=this.errors;let f=!0;for(let h in a){let p=a[h];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(h)?d.path=`${this.path}.${h}`:d.path=`${this.path}["${h}"]`,!(p===void 0&&d._optional)){if(p===void 0&&d.hasDefault){a[h]=d.defaultValue;continue}d.validate(p)||(d.hasFallback?a[h]=d.fallbackValue:f=!1)}}return f}},bt=class extends z{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Ir(r)!=="object")return this.fail({expect:"object",actual:r});let o=r,a=!0;for(let d in this._object){let f=o[d],h=this._object[d];if(h.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(d)?h.path=`${this.path}.${d}`:h.path=`${this.path}["${d}"]`,!(h._optional&&f===void 0)){if(f===void 0&&h.hasDefault){o[d]=h.defaultValue;continue}h.validate(f)||(h.hasFallback?o[d]=h.fallbackValue:a=!1)}}return a}},Et=class extends z{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:_r(this.value),actual:r}):!0}},Tt=class extends z{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 d=0;d<a;d++){let f=this._items[d];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!o){o=!0;break}}if(!o){let d=r.join(`
2
2
  or `);this.errors.push(d)}return o}},_t=class extends z{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}},It=class extends z{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},wt=class extends z{constructor(t){super(),this._ctor=t}validate(t){return t===void 0&&this._optional||t instanceof this._ctor?!0:this.fail({expect:`typedarray of ${this._ctor.name}`,actual:t})}}});function Ar(e,t,r="param"){if(e.errors=[],e.path=r,Tr(!0),!e.validate(t)){let o=e.errors.join(`
3
3
  `);throw e.errors.length=0,Tr(!1),new TypeError(o)}}var x,Sr=G(()=>{"use strict";wr();wr();x={object(e){return new bt(e)},array(e){return new vt(e)},tuple(...e){return new _t(...e)},literal(e){return new Et(e)},or(...e){return new Tt(...e)},symbol(){return new ft},record(e){return new yt(e)},function(){return new pt},boolean(){return new lt},string(){return new dt},number(){return new ut},undefined(){return new mt},null(){return new ht},unknown(){return new ke},any(){return new ke},as(){return new ke},arraybuffer(){return new It},enum(...e){return new gt(...e)},typedarray(e){return new wt(e)}}});var At,qn,zn=G(()=>{"use strict";j();Ee();Sr();hr();At=1,qn=e=>{function t(o,a){return(...d)=>{var k,g,T,D;let f=Date.now(),h={method:o,trace_id:At};At+=1;let p="SUCCESS",_=`${o}:ok`,I=0;try{if(a.paramsSchema)try{Ar(a.paramsSchema,d,"params")}catch(K){throw mr(`${o}:fail ${K.message}`)}let C=a.implement(...d),P=C,O=`${o}:ok`;if(C&&"code"in C){let{code:K,data:S,message:X}=C;p=K,P=S,O=X}return{code:p,message:O,data:P}}catch(C){let P=C;I=(g=(k=P.code)!=null?k:P.errNo)!=null?g:2e3,p="FAILURE";let O=(D=(T=P.message)!=null?T:P.errMsg)!=null?D:`${C}`;return _=`${o}:${p} ${O.replace(/^\S+:(fail|cancel)\s?/,"")}`,ce(new tt(_,I)),{code:p,message:_}}finally{let C=Date.now()-f;e("apiInvoked",W(M({},h),{duration:C,status:p}))}}}function r(o,a){return(...d)=>L(this,null,function*(){var g,T,D,C;let f=mn(d)?d:[d],h=Date.now(),p={method:o,trace_id:At};At+=1;let _=`${o}:ok`,I="SUCCESS",k={code:I,message:_};try{if(a.paramsSchema)try{Ar(a.paramsSchema,f,"params")}catch(K){throw mr(K.message)}let O=yield a.implement(...f);if(O&&"code"in O){let{code:K,data:S,message:X}=O;I=K,_=X,O=S}return Object.assign(k,{code:I,message:_,data:O}),k}catch(P){let O=P,K=(T=(g=O.code)!=null?g:O.errNo)!=null?T:2e3;I="FAILURE";let S=(C=(D=O.message)!=null?D:O.errMsg)!=null?C:`${P}`,X=`${o}:${I} ${S.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(k,{code:I,message:X}),ce(new tt(X,K)),k}finally{let P=Date.now()-h;e("apiInvoked",W(M({},p),{duration:P,status:I}))}})}return{createAPI:r,createSyncAPI:t}}});var ae,we,Y,He=G(()=>{"use strict";Jn();Ie();zn();Sr();({createAPI:ae,createSyncAPI:we}=qn(le)),Y=Hn("h5")});var Zn=an((Xn,Cr)=>{(function(e){if(typeof Xn=="object"&&typeof Cr!="undefined")Cr.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,d,f){function h(I,k){if(!d[I]){if(!a[I]){var g=typeof Be=="function"&&Be;if(!k&&g)return g(I,!0);if(p)return p(I,!0);var T=new Error("Cannot find module '"+I+"'");throw T.code="MODULE_NOT_FOUND",T}var D=d[I]={exports:{}};a[I][0].call(D.exports,function(C){var P=a[I][1][C];return h(P||C)},D,D.exports,o,a,d,f)}return d[I].exports}for(var p=typeof Be=="function"&&Be,_=0;_<f.length;_++)h(f[_]);return h}({1:[function(o,a,d){(function(f){"use strict";var h=f.MutationObserver||f.WebKitMutationObserver,p;if(h){var _=0,I=new h(C),k=f.document.createTextNode("");I.observe(k,{characterData:!0}),p=function(){k.data=_=++_%2}}else if(!f.setImmediate&&typeof f.MessageChannel!="undefined"){var g=new f.MessageChannel;g.port1.onmessage=C,p=function(){g.port2.postMessage(0)}}else"document"in f&&"onreadystatechange"in f.document.createElement("script")?p=function(){var O=f.document.createElement("script");O.onreadystatechange=function(){C(),O.onreadystatechange=null,O.parentNode.removeChild(O),O=null},f.document.documentElement.appendChild(O)}:p=function(){setTimeout(C,0)};var T,D=[];function C(){T=!0;for(var O,K,S=D.length;S;){for(K=D,D=[],O=-1;++O<S;)K[O]();S=D.length}T=!1}a.exports=P;function P(O){D.push(O)===1&&!T&&p()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(o,a,d){"use strict";var f=o(1);function h(){}var p={},_=["REJECTED"],I=["FULFILLED"],k=["PENDING"];a.exports=g;function g(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=k,this.queue=[],this.outcome=void 0,w!==h&&P(this,w)}g.prototype.catch=function(w){return this.then(null,w)},g.prototype.then=function(w,U){if(typeof w!="function"&&this.state===I||typeof U!="function"&&this.state===_)return this;var N=new this.constructor(h);if(this.state!==k){var V=this.state===I?w:U;D(N,V,this.outcome)}else this.queue.push(new T(N,w,U));return N};function T(w,U,N){this.promise=w,typeof U=="function"&&(this.onFulfilled=U,this.callFulfilled=this.otherCallFulfilled),typeof N=="function"&&(this.onRejected=N,this.callRejected=this.otherCallRejected)}T.prototype.callFulfilled=function(w){p.resolve(this.promise,w)},T.prototype.otherCallFulfilled=function(w){D(this.promise,this.onFulfilled,w)},T.prototype.callRejected=function(w){p.reject(this.promise,w)},T.prototype.otherCallRejected=function(w){D(this.promise,this.onRejected,w)};function D(w,U,N){f(function(){var V;try{V=U(N)}catch(Q){return p.reject(w,Q)}V===w?p.reject(w,new TypeError("Cannot resolve promise with itself")):p.resolve(w,V)})}p.resolve=function(w,U){var N=O(C,U);if(N.status==="error")return p.reject(w,N.value);var V=N.value;if(V)P(w,V);else{w.state=I,w.outcome=U;for(var Q=-1,ee=w.queue.length;++Q<ee;)w.queue[Q].callFulfilled(U)}return w},p.reject=function(w,U){w.state=_,w.outcome=U;for(var N=-1,V=w.queue.length;++N<V;)w.queue[N].callRejected(U);return w};function C(w){var U=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof U=="function")return function(){U.apply(w,arguments)}}function P(w,U){var N=!1;function V(ne){N||(N=!0,p.reject(w,ne))}function Q(ne){N||(N=!0,p.resolve(w,ne))}function ee(){U(Q,V)}var re=O(ee);re.status==="error"&&V(re.value)}function O(w,U){var N={};try{N.value=w(U),N.status="success"}catch(V){N.status="error",N.value=V}return N}g.resolve=K;function K(w){return w instanceof this?w:p.resolve(new this(h),w)}g.reject=S;function S(w){var U=new this(h);return p.reject(U,w)}g.all=X;function X(w){var U=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=w.length,V=!1;if(!N)return this.resolve([]);for(var Q=new Array(N),ee=0,re=-1,ne=new this(h);++re<N;)de(w[re],re);return ne;function de(Ne,We){U.resolve(Ne).then(Mt,function(Se){V||(V=!0,p.reject(ne,Se))});function Mt(Se){Q[We]=Se,++ee===N&&!V&&(V=!0,p.resolve(ne,Q))}}}g.race=Te;function Te(w){var U=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=w.length,V=!1;if(!N)return this.resolve([]);for(var Q=-1,ee=new this(h);++Q<N;)re(w[Q]);return ee;function re(ne){U.resolve(ne).then(function(de){V||(V=!0,p.resolve(ee,de))},function(de){V||(V=!0,p.reject(ee,de))})}}},{1:1}],3:[function(o,a,d){(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,d){"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 h(n,s){if(!(n instanceof s))throw new TypeError("Cannot call a class as a function")}function p(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(n){return}}var _=p();function I(){try{if(!_||!_.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 k(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,u=new i,l=0;l<n.length;l+=1)u.append(n[l]);return u.getBlob(s.type)}}typeof Promise=="undefined"&&o(3);var g=Promise;function T(n,s){s&&n.then(function(i){s(null,i)},function(i){s(i)})}function D(n,s,i){typeof s=="function"&&n.then(s),typeof i=="function"&&n.catch(i)}function C(n){return typeof n!="string"&&(console.warn(n+" used as a key, but it is not a string."),n=String(n)),n}function P(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var O="local-forage-detect-blob-support",K=void 0,S={},X=Object.prototype.toString,Te="readonly",w="readwrite";function U(n){for(var s=n.length,i=new ArrayBuffer(s),u=new Uint8Array(i),l=0;l<s;l++)u[l]=n.charCodeAt(l);return i}function N(n){return new g(function(s){var i=n.transaction(O,w),u=k([""]);i.objectStore(O).put(u,"key"),i.onabort=function(l){l.preventDefault(),l.stopPropagation(),s(!1)},i.oncomplete=function(){var l=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);s(c||!l||parseInt(l[1],10)>=43)}}).catch(function(){return!1})}function V(n){return typeof K=="boolean"?g.resolve(K):N(n).then(function(s){return K=s,K})}function Q(n){var s=S[n.name],i={};i.promise=new g(function(u,l){i.resolve=u,i.reject=l}),s.deferredOperations.push(i),s.dbReady?s.dbReady=s.dbReady.then(function(){return i.promise}):s.dbReady=i.promise}function ee(n){var s=S[n.name],i=s.deferredOperations.pop();if(i)return i.resolve(),i.promise}function re(n,s){var i=S[n.name],u=i.deferredOperations.pop();if(u)return u.reject(s),u.promise}function ne(n,s){return new g(function(i,u){if(S[n.name]=S[n.name]||Lr(),n.db)if(s)Q(n),n.db.close();else return i(n.db);var l=[n.name];s&&l.push(n.version);var c=_.open.apply(_,l);s&&(c.onupgradeneeded=function(m){var v=c.result;try{v.createObjectStore(n.storeName),m.oldVersion<=1&&v.createObjectStore(O)}catch(y){if(y.name==="ConstraintError")console.warn('The database "'+n.name+'" has been upgraded from version '+m.oldVersion+" to version "+m.newVersion+', but the storage "'+n.storeName+'" already exists.');else throw y}}),c.onerror=function(m){m.preventDefault(),u(c.error)},c.onsuccess=function(){var m=c.result;m.onversionchange=function(v){v.target.close()},i(m),ee(n)}})}function de(n){return ne(n,!1)}function Ne(n){return ne(n,!0)}function We(n,s){if(!n.db)return!0;var i=!n.db.objectStoreNames.contains(n.storeName),u=n.version<n.db.version,l=n.version>n.db.version;if(u&&(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),l||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 u=new FileReader;u.onerror=i,u.onloadend=function(l){var c=btoa(l.target.result||"");s({__local_forage_encoded_blob:!0,data:c,type:n.type})},u.readAsBinaryString(n)})}function Se(n){var s=U(atob(n.data));return k([s],{type:n.type})}function Nr(n){return n&&n.__local_forage_encoded_blob}function Eo(n){var s=this,i=s._initReady().then(function(){var u=S[s._dbInfo.name];if(u&&u.dbReady)return u.dbReady});return D(i,n,n),i}function To(n){Q(n);for(var s=S[n.name],i=s.forages,u=0;u<i.length;u++){var l=i[u];l._dbInfo.db&&(l._dbInfo.db.close(),l._dbInfo.db=null)}return n.db=null,de(n).then(function(c){return n.db=c,We(n)?Ne(n):c}).then(function(c){n.db=s.db=c;for(var m=0;m<i.length;m++)i[m]._dbInfo.db=c}).catch(function(c){throw re(n,c),c})}function fe(n,s,i,u){u===void 0&&(u=1);try{var l=n.db.transaction(n.storeName,s);i(null,l)}catch(c){if(u>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),Ne(n)}).then(function(){return To(n).then(function(){fe(n,s,i,u-1)})}).catch(i);i(c)}}function Lr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function _o(n){var s=this,i={db:null};if(n)for(var u in n)i[u]=n[u];var l=S[i.name];l||(l=Lr(),S[i.name]=l),l.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=Eo);var c=[];function m(){return g.resolve()}for(var v=0;v<l.forages.length;v++){var y=l.forages[v];y!==s&&c.push(y._initReady().catch(m))}var b=l.forages.slice(0);return g.all(c).then(function(){return i.db=l.db,de(i)}).then(function(E){return i.db=E,We(i,s._defaultConfig.version)?Ne(i):E}).then(function(E){i.db=l.db=E,s._dbInfo=i;for(var A=0;A<b.length;A++){var F=b[A];F!==s&&(F._dbInfo.db=i.db,F._dbInfo.version=i.version)}})}function Io(n,s){var i=this;n=C(n);var u=new g(function(l,c){i.ready().then(function(){fe(i._dbInfo,Te,function(m,v){if(m)return c(m);try{var y=v.objectStore(i._dbInfo.storeName),b=y.get(n);b.onsuccess=function(){var E=b.result;E===void 0&&(E=null),Nr(E)&&(E=Se(E)),l(E)},b.onerror=function(){c(b.error)}}catch(E){c(E)}})}).catch(c)});return T(u,s),u}function wo(n,s){var i=this,u=new g(function(l,c){i.ready().then(function(){fe(i._dbInfo,Te,function(m,v){if(m)return c(m);try{var y=v.objectStore(i._dbInfo.storeName),b=y.openCursor(),E=1;b.onsuccess=function(){var A=b.result;if(A){var F=A.value;Nr(F)&&(F=Se(F));var B=n(F,A.key,E++);B!==void 0?l(B):A.continue()}else l()},b.onerror=function(){c(b.error)}}catch(A){c(A)}})}).catch(c)});return T(u,s),u}function Ao(n,s,i){var u=this;n=C(n);var l=new g(function(c,m){var v;u.ready().then(function(){return v=u._dbInfo,X.call(s)==="[object Blob]"?V(v.db).then(function(y){return y?s:Mt(s)}):s}).then(function(y){fe(u._dbInfo,w,function(b,E){if(b)return m(b);try{var A=E.objectStore(u._dbInfo.storeName);y===null&&(y=void 0);var F=A.put(y,n);E.oncomplete=function(){y===void 0&&(y=null),c(y)},E.onabort=E.onerror=function(){var B=F.error?F.error:F.transaction.error;m(B)}}catch(B){m(B)}})}).catch(m)});return T(l,i),l}function So(n,s){var i=this;n=C(n);var u=new g(function(l,c){i.ready().then(function(){fe(i._dbInfo,w,function(m,v){if(m)return c(m);try{var y=v.objectStore(i._dbInfo.storeName),b=y.delete(n);v.oncomplete=function(){l()},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 T(u,s),u}function Ro(n){var s=this,i=new g(function(u,l){s.ready().then(function(){fe(s._dbInfo,w,function(c,m){if(c)return l(c);try{var v=m.objectStore(s._dbInfo.storeName),y=v.clear();m.oncomplete=function(){u()},m.onabort=m.onerror=function(){var b=y.error?y.error:y.transaction.error;l(b)}}catch(b){l(b)}})}).catch(l)});return T(i,n),i}function xo(n){var s=this,i=new g(function(u,l){s.ready().then(function(){fe(s._dbInfo,Te,function(c,m){if(c)return l(c);try{var v=m.objectStore(s._dbInfo.storeName),y=v.count();y.onsuccess=function(){u(y.result)},y.onerror=function(){l(y.error)}}catch(b){l(b)}})}).catch(l)});return T(i,n),i}function ko(n,s){var i=this,u=new g(function(l,c){if(n<0){l(null);return}i.ready().then(function(){fe(i._dbInfo,Te,function(m,v){if(m)return c(m);try{var y=v.objectStore(i._dbInfo.storeName),b=!1,E=y.openKeyCursor();E.onsuccess=function(){var A=E.result;if(!A){l(null);return}n===0||b?l(A.key):(b=!0,A.advance(n))},E.onerror=function(){c(E.error)}}catch(A){c(A)}})}).catch(c)});return T(u,s),u}function Co(n){var s=this,i=new g(function(u,l){s.ready().then(function(){fe(s._dbInfo,Te,function(c,m){if(c)return l(c);try{var v=m.objectStore(s._dbInfo.storeName),y=v.openKeyCursor(),b=[];y.onsuccess=function(){var E=y.result;if(!E){u(b);return}b.push(E.key),E.continue()},y.onerror=function(){l(y.error)}}catch(E){l(E)}})}).catch(l)});return T(i,n),i}function Po(n,s){s=P.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 u=this,l;if(!n.name)l=g.reject("Invalid arguments");else{var c=n.name===i.name&&u._dbInfo.db,m=c?g.resolve(u._dbInfo.db):de(n).then(function(v){var y=S[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?l=m.then(function(v){if(v.objectStoreNames.contains(n.storeName)){var y=v.version+1;Q(n);var b=S[n.name],E=b.forages;v.close();for(var A=0;A<E.length;A++){var F=E[A];F._dbInfo.db=null,F._dbInfo.version=y}var B=new g(function($,q){var J=_.open(n.name,y);J.onerror=function(oe){var Ue=J.result;Ue.close(),q(oe)},J.onupgradeneeded=function(){var oe=J.result;oe.deleteObjectStore(n.storeName)},J.onsuccess=function(){var oe=J.result;oe.close(),$(oe)}});return B.then(function($){b.db=$;for(var q=0;q<E.length;q++){var J=E[q];J._dbInfo.db=$,ee(J._dbInfo)}}).catch(function($){throw(re(n,$)||g.resolve()).catch(function(){}),$})}}):l=m.then(function(v){Q(n);var y=S[n.name],b=y.forages;v.close();for(var E=0;E<b.length;E++){var A=b[E];A._dbInfo.db=null}var F=new g(function(B,$){var q=_.deleteDatabase(n.name);q.onerror=function(){var J=q.result;J&&J.close(),$(q.error)},q.onblocked=function(){console.warn('dropInstance blocked for database "'+n.name+'" until all open connections are closed')},q.onsuccess=function(){var J=q.result;J&&J.close(),B(J)}});return F.then(function(B){y.db=B;for(var $=0;$<b.length;$++){var q=b[$];ee(q._dbInfo)}}).catch(function(B){throw(re(n,B)||g.resolve()).catch(function(){}),B})})}return T(l,s),l}var Do={_driver:"asyncStorage",_initStorage:_o,_support:I(),iterate:wo,getItem:Io,setItem:Ao,removeItem:So,clear:Ro,length:xo,key:ko,keys:Co,dropInstance:Po};function Oo(){return typeof openDatabase=="function"}var ve="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Fo="~~local_forage_type~",Ur=/^~~local_forage_type~([^~]+)~/,qe="__lfsc__:",$t=qe.length,Vt="arbf",jt="blob",Br="si08",Mr="ui08",$r="uic8",Vr="si16",jr="si32",Kr="ur16",Gr="ui32",Hr="fl32",Jr="fl64",Wr=$t+Vt.length,qr=Object.prototype.toString;function zr(n){var s=n.length*.75,i=n.length,u,l=0,c,m,v,y;n[n.length-1]==="="&&(s--,n[n.length-2]==="="&&s--);var b=new ArrayBuffer(s),E=new Uint8Array(b);for(u=0;u<i;u+=4)c=ve.indexOf(n[u]),m=ve.indexOf(n[u+1]),v=ve.indexOf(n[u+2]),y=ve.indexOf(n[u+3]),E[l++]=c<<2|m>>4,E[l++]=(m&15)<<4|v>>2,E[l++]=(v&3)<<6|y&63;return b}function Kt(n){var s=new Uint8Array(n),i="",u;for(u=0;u<s.length;u+=3)i+=ve[s[u]>>2],i+=ve[(s[u]&3)<<4|s[u+1]>>4],i+=ve[(s[u+1]&15)<<2|s[u+2]>>6],i+=ve[s[u+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 No(n,s){var i="";if(n&&(i=qr.call(n)),n&&(i==="[object ArrayBuffer]"||n.buffer&&qr.call(n.buffer)==="[object ArrayBuffer]")){var u,l=qe;n instanceof ArrayBuffer?(u=n,l+=Vt):(u=n.buffer,i==="[object Int8Array]"?l+=Br:i==="[object Uint8Array]"?l+=Mr:i==="[object Uint8ClampedArray]"?l+=$r:i==="[object Int16Array]"?l+=Vr:i==="[object Uint16Array]"?l+=Kr:i==="[object Int32Array]"?l+=jr:i==="[object Uint32Array]"?l+=Gr:i==="[object Float32Array]"?l+=Hr:i==="[object Float64Array]"?l+=Jr:s(new Error("Failed to get type for BinaryArray"))),s(l+Kt(u))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var m=Fo+n.type+"~"+Kt(this.result);s(qe+jt+m)},c.readAsArrayBuffer(n)}else try{s(JSON.stringify(n))}catch(m){console.error("Couldn't convert value into a JSON string: ",n),s(null,m)}}function Lo(n){if(n.substring(0,$t)!==qe)return JSON.parse(n);var s=n.substring(Wr),i=n.substring($t,Wr),u;if(i===jt&&Ur.test(s)){var l=s.match(Ur);u=l[1],s=s.substring(l[0].length)}var c=zr(s);switch(i){case Vt:return c;case jt:return k([c],{type:u});case Br:return new Int8Array(c);case Mr:return new Uint8Array(c);case $r:return new Uint8ClampedArray(c);case Vr:return new Int16Array(c);case Kr:return new Uint16Array(c);case jr:return new Int32Array(c);case Gr:return new Uint32Array(c);case Hr:return new Float32Array(c);case Jr:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var Gt={serialize:No,deserialize:Lo,stringToBuffer:zr,bufferToString:Kt};function Yr(n,s,i,u){n.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,u)}function Uo(n){var s=this,i={db:null};if(n)for(var u in n)i[u]=typeof n[u]!="string"?n[u].toString():n[u];var l=new g(function(c,m){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(v){return m(v)}i.db.transaction(function(v){Yr(v,i,function(){s._dbInfo=i,c()},function(y,b){m(b)})},m)});return i.serializer=Gt,l}function ye(n,s,i,u,l,c){n.executeSql(i,u,l,function(m,v){v.code===v.SYNTAX_ERR?m.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(y,b){b.rows.length?c(y,v):Yr(y,s,function(){y.executeSql(i,u,l,c)},c)},c):c(m,v)},c)}function Bo(n,s){var i=this;n=C(n);var u=new g(function(l,c){i.ready().then(function(){var m=i._dbInfo;m.db.transaction(function(v){ye(v,m,"SELECT * FROM "+m.storeName+" WHERE key = ? LIMIT 1",[n],function(y,b){var E=b.rows.length?b.rows.item(0).value:null;E&&(E=m.serializer.deserialize(E)),l(E)},function(y,b){c(b)})})}).catch(c)});return T(u,s),u}function Mo(n,s){var i=this,u=new g(function(l,c){i.ready().then(function(){var m=i._dbInfo;m.db.transaction(function(v){ye(v,m,"SELECT * FROM "+m.storeName,[],function(y,b){for(var E=b.rows,A=E.length,F=0;F<A;F++){var B=E.item(F),$=B.value;if($&&($=m.serializer.deserialize($)),$=n($,B.key,F+1),$!==void 0){l($);return}}l()},function(y,b){c(b)})})}).catch(c)});return T(u,s),u}function Qr(n,s,i,u){var l=this;n=C(n);var c=new g(function(m,v){l.ready().then(function(){s===void 0&&(s=null);var y=s,b=l._dbInfo;b.serializer.serialize(s,function(E,A){A?v(A):b.db.transaction(function(F){ye(F,b,"INSERT OR REPLACE INTO "+b.storeName+" (key, value) VALUES (?, ?)",[n,E],function(){m(y)},function(B,$){v($)})},function(F){if(F.code===F.QUOTA_ERR){if(u>0){m(Qr.apply(l,[n,y,i,u-1]));return}v(F)}})})}).catch(v)});return T(c,i),c}function $o(n,s,i){return Qr.apply(this,[n,s,i,1])}function Vo(n,s){var i=this;n=C(n);var u=new g(function(l,c){i.ready().then(function(){var m=i._dbInfo;m.db.transaction(function(v){ye(v,m,"DELETE FROM "+m.storeName+" WHERE key = ?",[n],function(){l()},function(y,b){c(b)})})}).catch(c)});return T(u,s),u}function jo(n){var s=this,i=new g(function(u,l){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(m){ye(m,c,"DELETE FROM "+c.storeName,[],function(){u()},function(v,y){l(y)})})}).catch(l)});return T(i,n),i}function Ko(n){var s=this,i=new g(function(u,l){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(m){ye(m,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(v,y){var b=y.rows.item(0).c;u(b)},function(v,y){l(y)})})}).catch(l)});return T(i,n),i}function Go(n,s){var i=this,u=new g(function(l,c){i.ready().then(function(){var m=i._dbInfo;m.db.transaction(function(v){ye(v,m,"SELECT key FROM "+m.storeName+" WHERE id = ? LIMIT 1",[n+1],function(y,b){var E=b.rows.length?b.rows.item(0).key:null;l(E)},function(y,b){c(b)})})}).catch(c)});return T(u,s),u}function Ho(n){var s=this,i=new g(function(u,l){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(m){ye(m,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);u(b)},function(v,y){l(y)})})}).catch(l)});return T(i,n),i}function Jo(n){return new g(function(s,i){n.transaction(function(u){u.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(l,c){for(var m=[],v=0;v<c.rows.length;v++)m.push(c.rows.item(v).name);s({db:n,storeNames:m})},function(l,c){i(c)})},function(u){i(u)})})}function Wo(n,s){s=P.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 u=this,l;return n.name?l=new g(function(c){var m;n.name===i.name?m=u._dbInfo.db:m=openDatabase(n.name,"","",0),n.storeName?c({db:m,storeNames:[n.storeName]}):c(Jo(m))}).then(function(c){return new g(function(m,v){c.db.transaction(function(y){function b(B){return new g(function($,q){y.executeSql("DROP TABLE IF EXISTS "+B,[],function(){$()},function(J,oe){q(oe)})})}for(var E=[],A=0,F=c.storeNames.length;A<F;A++)E.push(b(c.storeNames[A]));g.all(E).then(function(){m()}).catch(function(B){v(B)})},function(y){v(y)})})}):l=g.reject("Invalid arguments"),T(l,s),l}var qo={_driver:"webSQLStorage",_initStorage:Uo,_support:Oo(),iterate:Mo,getItem:Bo,setItem:$o,removeItem:Vo,clear:jo,length:Ko,key:Go,keys:Ho,dropInstance:Wo};function zo(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(n){return!1}}function Xr(n,s){var i=n.name+"/";return n.storeName!==s.storeName&&(i+=n.storeName+"/"),i}function Yo(){var n="_localforage_support_test";try{return localStorage.setItem(n,!0),localStorage.removeItem(n),!1}catch(s){return!0}}function Qo(){return!Yo()||localStorage.length>0}function Xo(n){var s=this,i={};if(n)for(var u in n)i[u]=n[u];return i.keyPrefix=Xr(n,s._defaultConfig),Qo()?(s._dbInfo=i,i.serializer=Gt,g.resolve()):g.reject()}function Zo(n){var s=this,i=s.ready().then(function(){for(var u=s._dbInfo.keyPrefix,l=localStorage.length-1;l>=0;l--){var c=localStorage.key(l);c.indexOf(u)===0&&localStorage.removeItem(c)}});return T(i,n),i}function ei(n,s){var i=this;n=C(n);var u=i.ready().then(function(){var l=i._dbInfo,c=localStorage.getItem(l.keyPrefix+n);return c&&(c=l.serializer.deserialize(c)),c});return T(u,s),u}function ti(n,s){var i=this,u=i.ready().then(function(){for(var l=i._dbInfo,c=l.keyPrefix,m=c.length,v=localStorage.length,y=1,b=0;b<v;b++){var E=localStorage.key(b);if(E.indexOf(c)===0){var A=localStorage.getItem(E);if(A&&(A=l.serializer.deserialize(A)),A=n(A,E.substring(m),y++),A!==void 0)return A}}});return T(u,s),u}function ri(n,s){var i=this,u=i.ready().then(function(){var l=i._dbInfo,c;try{c=localStorage.key(n)}catch(m){c=null}return c&&(c=c.substring(l.keyPrefix.length)),c});return T(u,s),u}function ni(n){var s=this,i=s.ready().then(function(){for(var u=s._dbInfo,l=localStorage.length,c=[],m=0;m<l;m++){var v=localStorage.key(m);v.indexOf(u.keyPrefix)===0&&c.push(v.substring(u.keyPrefix.length))}return c});return T(i,n),i}function oi(n){var s=this,i=s.keys().then(function(u){return u.length});return T(i,n),i}function ii(n,s){var i=this;n=C(n);var u=i.ready().then(function(){var l=i._dbInfo;localStorage.removeItem(l.keyPrefix+n)});return T(u,s),u}function ai(n,s,i){var u=this;n=C(n);var l=u.ready().then(function(){s===void 0&&(s=null);var c=s;return new g(function(m,v){var y=u._dbInfo;y.serializer.serialize(s,function(b,E){if(E)v(E);else try{localStorage.setItem(y.keyPrefix+n,b),m(c)}catch(A){(A.name==="QuotaExceededError"||A.name==="NS_ERROR_DOM_QUOTA_REACHED")&&v(A),v(A)}})})});return T(l,i),l}function si(n,s){if(s=P.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 u=this,l;return n.name?l=new g(function(c){n.storeName?c(Xr(n,u._defaultConfig)):c(n.name+"/")}).then(function(c){for(var m=localStorage.length-1;m>=0;m--){var v=localStorage.key(m);v.indexOf(c)===0&&localStorage.removeItem(v)}}):l=g.reject("Invalid arguments"),T(l,s),l}var ci={_driver:"localStorageWrapper",_initStorage:Xo,_support:zo(),iterate:ti,getItem:ei,setItem:ai,removeItem:ii,clear:Zo,length:oi,key:ri,keys:ni,dropInstance:si},ui=function(s,i){return s===i||typeof s=="number"&&typeof i=="number"&&isNaN(s)&&isNaN(i)},li=function(s,i){for(var u=s.length,l=0;l<u;){if(ui(s[l],i))return!0;l++}return!1},Zr=Array.isArray||function(n){return Object.prototype.toString.call(n)==="[object Array]"},Le={},en={},Re={INDEXEDDB:Do,WEBSQL:qo,LOCALSTORAGE:ci},di=[Re.INDEXEDDB._driver,Re.WEBSQL._driver,Re.LOCALSTORAGE._driver],ze=["dropInstance"],Ht=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ze),fi={description:"",driver:di.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function mi(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)&&(Zr(s[i])?arguments[0][i]=s[i].slice():arguments[0][i]=s[i])}return arguments[0]}var hi=function(){function n(s){h(this,n);for(var i in Re)if(Re.hasOwnProperty(i)){var u=Re[i],l=u._driver;this[i]=l,Le[l]||this.defineDriver(u)}this._defaultConfig=Jt({},fi),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 u in i){if(u==="storeName"&&(i[u]=i[u].replace(/\W/g,"_")),u==="version"&&typeof i[u]!="number")return new Error("Database version must be a number.");this._config[u]=i[u]}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,u,l){var c=new g(function(m,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=Ht.concat("_initStorage"),A=0,F=E.length;A<F;A++){var B=E[A],$=!li(ze,B);if(($||i[B])&&typeof i[B]!="function"){v(b);return}}var q=function(){for(var Ue=function(vi){return function(){var yi=new Error("Method "+vi+" is not implemented by the current driver"),tn=g.reject(yi);return T(tn,arguments[arguments.length-1]),tn}},Wt=0,gi=ze.length;Wt<gi;Wt++){var qt=ze[Wt];i[qt]||(i[qt]=Ue(qt))}};q();var J=function(Ue){Le[y]&&console.info("Redefining LocalForage driver: "+y),Le[y]=i,en[y]=Ue,m()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(J,v):J(!!i._support):J(!0)}catch(oe){v(oe)}});return D(c,u,l),c},n.prototype.driver=function(){return this._driver||null},n.prototype.getDriver=function(i,u,l){var c=Le[i]?g.resolve(Le[i]):g.reject(new Error("Driver not found."));return D(c,u,l),c},n.prototype.getSerializer=function(i){var u=g.resolve(Gt);return D(u,i),u},n.prototype.ready=function(i){var u=this,l=u._driverSet.then(function(){return u._ready===null&&(u._ready=u._initDriver()),u._ready});return D(l,i,i),l},n.prototype.setDriver=function(i,u,l){var c=this;Zr(i)||(i=[i]);var m=this._getSupportedDrivers(i);function v(){c._config.driver=c.driver()}function y(A){return c._extend(A),v(),c._ready=c._initStorage(c._config),c._ready}function b(A){return function(){var F=0;function B(){for(;F<A.length;){var $=A[F];return F++,c._dbInfo=null,c._ready=null,c.getDriver($).then(y).catch(B)}v();var q=new Error("No available storage method found.");return c._driverSet=g.reject(q),c._driverSet}return B()}}var E=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=E.then(function(){var A=m[0];return c._dbInfo=null,c._ready=null,c.getDriver(A).then(function(F){c._driver=F._driver,v(),c._wrapLibraryMethodsWithReady(),c._initDriver=b(m)})}).catch(function(){v();var A=new Error("No available storage method found.");return c._driverSet=g.reject(A),c._driverSet}),D(this._driverSet,u,l),this._driverSet},n.prototype.supports=function(i){return!!en[i]},n.prototype._extend=function(i){Jt(this,i)},n.prototype._getSupportedDrivers=function(i){for(var u=[],l=0,c=i.length;l<c;l++){var m=i[l];this.supports(m)&&u.push(m)}return u},n.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,u=Ht.length;i<u;i++)mi(this,Ht[i])},n.prototype.createInstance=function(i){return new n(i)},n}(),pi=new hi;a.exports=pi},{3:3}]},{},[4])(4)})});var to=an(Ae=>{"use strict";j();He();Ie();var Ce=ie(),Ra=ae("levelFinished",{paramsSchema:x.tuple(x.string(),x.object({result:x.boolean(),duration:x.number()})),implement:(e,t)=>L(Ae,null,function*(){let{result:r,duration:o}=t;se.info("onLevelFinished",r,o),yield Promise.all([ue.reporter({event:"COMPLETE_GAME_LEVEL"}),ue.tracker("LevelFinished",{levelId:e,result:r,duration:o})])})}),xa=ae("taskFinished",{paramsSchema:x.tuple(x.string(),x.object({duration:x.number()})),implement:(e,t)=>L(Ae,null,function*(){let{duration:r}=t;yield ue.tracker("TaskFinished",{duration:r,taskId:e})})}),ka=ae("levelUpgrade",{paramsSchema:x.tuple(x.string(),x.string()),implement:(e,t)=>L(Ae,null,function*(){return yield ue.tracker("LevelUpgrade",{name:t,levelId:e})})}),Ca=ae("onHistoryUserLevel",{paramsSchema:x.tuple(x.number()),implement:e=>L(Ae,null,function*(){return yield ue.tracker("HistoryUserLevel",{level:e})})}),Pa=ae("onHistoryUserScore",{paramsSchema:x.tuple(x.number()),implement:e=>L(Ae,null,function*(){return yield ue.tracker("HistoryUserScore",{score:e})})}),Da=ae("taskEvent",{paramsSchema:x.tuple(x.string(),x.object({tools:x.array(x.object({id:x.string(),name:x.string(),count:x.number(),description:x.string().optional(),price:x.object({amount:x.number(),unit:x.string()}).optional()})).optional(),awards:x.array(x.object({id:x.string(),name:x.string()})).optional()})),implement:(e,t)=>L(Ae,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([ue.reporter({event:"USE_GAME_ITEM"}),ue.tracker("UseGameItem",M({taskId:e},t))]))})});Ce.registerCommand("TaskTrackerSDK.levelFinished",Ra);Ce.registerCommand("TaskTrackerSDK.taskFinished",xa);Ce.registerCommand("TaskTrackerSDK.levelUpgrade",ka);Ce.registerCommand("TaskTrackerSDK.historyUserLevel",Ca);Ce.registerCommand("TaskTrackerSDK.historyUserScore",Pa);Ce.registerCommand("TaskTrackerSDK.taskEvent",Da);Y("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Y("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Y("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Y("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Y("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Y("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});Ie();te();He();j();var Yn=ie(),da="env",fa="getSystemInfoSync",ma=()=>{var a,d,f,h;let e={system:R.deviceInfo.system,platform:R.deviceInfo.platform,brand:R.deviceInfo.brand,pixelRatio:R.deviceInfo.pixelRatio,language:R.deviceInfo.lang,version:R.sdkInfo.jssdkVersion,appName:(a=R.hostInfo)==null?void 0:a.appName,SDKVersion:R.sdkInfo.nativeSDKVersion},t=(d=R.hostInfo)==null?void 0:d.version;t&&(e=W(M({},e),{version:t}));let r=(f=R.hostInfo)==null?void 0:f.appName;r&&(e=W(M({},e),{appName:r}));let o=(h=R.sdkInfo)==null?void 0:h.jssdkVersion;return o&&(e=W(M({},e),{SDKVersion:o})),e},ha=we(fa,{implement:ma}),pa=we(da,{implement:()=>W(M({},R.hostInfo),{sdkInfo:R.sdkInfo,platform:R.platform,deviceInfo:R.deviceInfo})});Yn.registerCommand("API.env",pa);Yn.registerCommand("API.getSystemInfoSync",ha);Y("env",{version:"1.0.0"});Y("getSystemInfoSync",{version:"1.0.0"});j();He();Ee();Ie();var ga="onJoliboxShow",va="onJoliboxHide",ya="onReady",xr=ie(),kr=Tn(ce),Rr=!0,Je=!0,St=0,Rt=Er;function ba(){let e=Date.now();if(e-St<100)return;St=e;let t=document.visibilityState==="visible";t!==Rr&&(Rr=t,Rt.emit("visible",Rr))}function Qn(e){let t=Date.now();t-St<100||(St=t,e==="focus"&&!Je?Je=!0:e==="blur"&&Je&&(Je=!1),Rt.emit("visible",Je))}document.addEventListener("visibilitychange",ba);window.addEventListener("focus",()=>Qn("focus"));window.addEventListener("blur",()=>Qn("blur"));var Ea=we(ga,{paramsSchema:x.tuple(x.function()),implement(e){let t=kr(e);Rt.on("visible",r=>{r&&t()})}}),Ta=we(va,{paramsSchema:x.tuple(x.function()),implement(e){let t=kr(e);Rt.on("visible",r=>{!r&&t()})}}),_a=we(ya,{paramsSchema:x.tuple(x.function()),implement(e){let t=kr(e);Ke.on("LifecycleEvent.onReady",r=>{t(r)})}});xr.registerCommand("LifecycleSDK.onReady",_a);xr.registerCommand("LifecycleSDK.onJoliboxShow",Ea);xr.registerCommand("LifecycleSDK.onJoliboxHide",Ta);Y("lifeCycle.onReady",{version:"1.0.0"});Y("lifeCycle.onJoliboxShow",{version:"1.0.0"});Y("lifeCycle.onJoliboxHide",{version:"1.0.0"});He();j();Ge();te();var eo=sn(Zn());var xt=ie(),Pr=class{constructor(){this.httpClient=pe.create({baseUrl:R.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"});this.getGameId=()=>R.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}}),d=o==null?void 0:o.value,f=a;return r!=="SUCCESS"&&(d=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",d),f+="fallback to localstorage"),{code:r,message:f,data:d&&d!=="undefined"?d:null}});this.setItem=(t,r)=>L(this,null,function*(){let o=typeof r=="string"?r:String(r),{code:a,message:d}=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:d}});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=eo.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},kt=new Pr,Ia=ae("getLocalStorage",{paramsSchema:x.tuple(x.string()),implement(e){return L(this,null,function*(){return yield kt.getItem(e)})}});xt.registerCommand("StorageSDK.getItem",Ia);Y("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var wa=ae("setStorage",{paramsSchema:x.tuple(x.string(),x.or(x.string(),x.boolean(),x.number())),implement(e,t){return L(this,null,function*(){return yield kt.setItem(e,t)})}});xt.registerCommand("StorageSDK.setItem",wa);Y("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Aa=ae("removeStorage",{paramsSchema:x.tuple(x.string()),implement(e){return L(this,null,function*(){return yield kt.removeItem(e)})}});xt.registerCommand("StorageSDK.removeItem",Aa);Y("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Sa=ae("clearStorage",{implement(){return L(this,null,function*(){return yield kt.clear()})}});xt.registerCommand("StorageSDK.clear",Sa);Y("storage.clear",{version:"1.0.0"});var Mu=sn(to());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 ro="jolibox-sdk-ads-callbreak-timestamps",Pt=class{constructor(t,r){this.checkNetwork=t;this.maxAllowedAdsForTime=8;this.bannedForTimeThreshold=6e4;this.bannedReleaseTime=6e4;this.isBanningForTime=!1;this.releaseBannedForTimeTimeout=null;this.maxAllowedAdsForSession=200;this.bannedForSessionThreshold=6e5;this.isBanningForSession=!1;this.initialThreshold=2e3;this._callAdsTimestampsForTime=[];this.callAdsTimestampsForSession=[];this.initTimestamp=0;this.initCallAdsTimestampsForTime=()=>{var t;try{let r=JSON.parse((t=window.localStorage.getItem(ro))!=null?t:"[]");Array.isArray(r)?this._callAdsTimestampsForTime=r:this._callAdsTimestampsForTime=[]}catch(r){this._callAdsTimestampsForTime=[]}};this.setReleaseBannedForTime=()=>{this.releaseBannedForTimeTimeout&&(window.clearTimeout(this.releaseBannedForTimeTimeout),this.releaseBannedForTimeTimeout=null),this.releaseBannedForTimeTimeout=window.setTimeout(()=>{this.isBanningForTime=!1,this.releaseBannedForTimeTimeout=null},this.bannedReleaseTime)};this.checkShouldBannedInitial=()=>{if(Date.now()-this.initTimestamp<=this.initialThreshold)return"BLOCK_INITIAL"};this.checkShouldBannedForSession=t=>{if(this.isBanningForSession)return"BANNED_FOR_SESSION";let r=Date.now();if(this.callAdsTimestampsForSession=this.callAdsTimestampsForSession.concat({timestamp:r,type:t}),this.callAdsTimestampsForSession.length!==1&&(this.callAdsTimestampsForSession.length>this.maxAllowedAdsForSession&&(this.callAdsTimestampsForSession=this.callAdsTimestampsForSession.slice(-this.maxAllowedAdsForSession)),this.callAdsTimestampsForSession.length===this.maxAllowedAdsForSession&&r-this.callAdsTimestampsForSession[0].timestamp<=this.bannedForSessionThreshold))return this.isBanningForSession=!0,"BANNED_FOR_SESSION"};this.checkShouldBannedForTime=t=>{if(this.isBanningForTime)return"WAITING_BANNED_RELEASE";let r=Date.now();if(this.callAdsTimestampsForTime=this.callAdsTimestampsForTime.concat({timestamp:r,type:t}),this.callAdsTimestampsForTime.length!==1&&(this.callAdsTimestampsForTime.length>this.maxAllowedAdsForTime&&(this.callAdsTimestampsForTime=this.callAdsTimestampsForTime.slice(-this.maxAllowedAdsForTime)),this.callAdsTimestampsForTime.length===this.maxAllowedAdsForTime&&r-this.callAdsTimestampsForTime[0].timestamp<=this.bannedForTimeThreshold))return this.isBanningForTime=!0,this.setReleaseBannedForTime(),"BANNED_FOR_TIME"};this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return"NETWORK_NOT_OK";let r=this.checkShouldBannedInitial();if(r)return r;let o=this.checkShouldBannedForSession(t);if(o)return o;let a=this.checkShouldBannedForTime(t);return a||"ALLOWED"};var o,a,d,f,h,p;if(this.maxAllowedAdsForTime=(o=r==null?void 0:r.maxAllowedAdsForTime)!=null?o:8,this.bannedForTimeThreshold=(a=r==null?void 0:r.bannedForTimeThreshold)!=null?a:6e4,this.bannedReleaseTime=(d=r==null?void 0:r.bannedReleaseTime)!=null?d:6e4,this.maxAllowedAdsForSession=(f=r==null?void 0:r.maxAllowedAdsForSession)!=null?f:200,this.bannedForSessionThreshold=(h=r==null?void 0:r.bannedForSessionThreshold)!=null?h:6e5,this.initialThreshold=(p=r==null?void 0:r.initialThreshold)!=null?p:2e3,this.maxAllowedAdsForTime<=1)throw new Error("maxAllowedAdsForTime must be greater than 1");if(this.bannedForTimeThreshold<0)throw new Error("bannedForTimeThreshold must be greater than or equal to 0");if(this.bannedReleaseTime<this.bannedForTimeThreshold)throw new Error("bannedReleaseTime must be greater than or equal to bannedForTimeThreshold");if(this.initialThreshold<0)throw new Error("initialThreshold must be greater than or equal to 0");this.initCallAdsTimestampsForTime(),this.initTimestamp=Date.now()}get callAdsTimestampsForTime(){return this._callAdsTimestampsForTime}set callAdsTimestampsForTime(t){try{window.localStorage.setItem(ro,JSON.stringify(t))}catch(r){console.error("Failed to save timestamps")}this._callAdsTimestampsForTime=t}};te();te();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=R.channel)!=null?r:"",d=this.configs[a],f=(o=d==null?void 0:d.interstitialRate)!=null?o:1;t=Math.random()<f}return this.firstRun=!1,t}};j();var Pe=new be,Ot=class{constructor(t,r,o){this.track=t;this.httpClient=r;this.checkNetwork=o;this.configured=!1;this.config={};this.getGameId=()=>R.mpId;this.getTestAdsMode=()=>R.testAdsMode;this.asyncLoad=()=>L(this,null,function*(){var f,h,p,_,I;let t="ca-pub-7171363994453626",r,o,a=window.encodeURIComponent(window.btoa((f=this.getGameId())!=null?f:"")),d=(h=this.getTestAdsMode())!=null?h:!1;try{let k=yield this.httpClient.get("/public/ads",{query:{objectId:a,testAdsMode:`${d}`}});t=(p=k.data)==null?void 0:p.clientId,r=(_=k.data)==null?void 0:_.channelId,o=(I=k.data)==null?void 0:I.unitId}catch(k){console.error("Failed to fetch client info",k)}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 d=document.createElement("script");d.id=r,d.async=!0,d.crossOrigin="anonymous",d.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,o&&d.setAttribute("data-adbreak-test","on"),this.channelId&&d.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(d),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=d=>{Pe.emit("isAdShowing",!1),o&&o(d)};return W(M({},t),{adBreakDone:a})}else{let o=t.beforeAd,a=t.afterAd,d=()=>{Pe.emit("isAdShowing",!0),this.track("CallBeforeAd",{}),o&&o()},f=()=>{Pe.emit("isAdShowing",!1),this.track("CallAfterAd",{}),a&&a()};return W(M({},t),{beforeAd:d,afterAd:f})}};this.adConfig=t=>{let a=t,{onReady:r}=a,o=on(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 p,_,I,k;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let r=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":console.warn("Ads not allowed",r),(_=t.adBreakDone)==null||_.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.track("PreventAdsCheating",{reason:r});return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":console.warn("Ads not allowed",r),(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),this.track("PreventAdsCheating",{reason:r});return;default:break}let o=t.type,a=t.adBreakDone,d=g=>{var T;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:g.breakType,breakName:(T=g.breakName)!=null?T:"",breakFormat:g.breakFormat,breakStatus:g.breakStatus}),a&&a(g)};if(t.adBreakDone=d,t.type==="reward"){let g=t.beforeReward,T=C=>()=>{this.track("CallShowAdFn",null),C()},D=C=>{g&&g(T(C))};t.beforeReward=D}let f;switch(o){case"preroll":f={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":f={type:o,name:(k=t.name)!=null?k:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",f);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,T,D,C;if(this.track("CallAdUnit",{adFormat:(T=(g=t.adFormat)==null?void 0:g.toString())!=null?T:null,fullWidthResponsive:(D=t.fullWidthResponsive)!=null?D: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:d,style:f}=t,h;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?h=document.querySelector(r):h=r,!h)throw new Error("targeting element not found");let p=o;if(p||(p=this.unitId),!p)throw new Error("slot is required");let _=typeof a=="object"&&Array.isArray(a)?a.join(", "):a,I=document.createElement("ins");if(I.className="adsbygoogle",I.id="jolibox-ads",I.style.display="block",I.setAttribute("data-ad-client",this.clientId),I.setAttribute("data-ad-slot",p),_&&I.setAttribute("data-ad-format",_),d&&I.setAttribute("data-full-width-responsive",d),f&&I.setAttribute("style",f),(C=this.getTestAdsMode())!=null?C:!1){let P=document.createElement("div");P.style.position="absolute",P.style.top="0",P.style.left="0",P.style.width="100%",P.style.height="100%",P.style.display="flex",P.style.justifyContent="center",P.style.alignItems="center",P.style.backgroundColor="rgba(0, 0, 0, 0.5)",P.style.color="white",P.innerHTML="Test Ad",I.style.position="relative",h.appendChild(I),I.appendChild(P)}else h.appendChild(I),new MutationObserver(O=>{O.forEach(K=>{if(K.type==="attributes"&&K.attributeName==="data-ad-status"){let S=I.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:S!=null?S:"null"})}})}).observe(I,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Pt(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))}};Ie();j();Ge();var no=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};var Ft=ie(),Oa=pe.create(),Nt=new Ot(le,Oa,()=>pe.getNetworkStatus());Pe.on("isAdShowing",e=>{no("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Ft.registerCommand("AdsSDK.init",e=>{Nt.init(e)});Ft.registerCommand("AdsSDK.adConfig",e=>{Nt.adConfig(e)});Ft.registerCommand("AdsSDK.adBreak",e=>{Nt.adBreak(e)});Ft.registerCommand("AdsSDK.adUnit",e=>{Nt.adUnit(e)});j();Ie();var uo=-1,Ut=function(e){addEventListener("pageshow",function(t){t.persisted&&(uo=t.timeStamp,e(t))},!0)},Or=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=Or();return e&&e.activationStart||0},Oe=function(e,t){var r=Or(),o="navigate";return uo>=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}},lo=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){}},Fe=function(e,t,r,o){var a,d;return function(f){t.value>=0&&(f||o)&&((d=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=d,t.rating=function(h,p){return h>p[1]?"poor":h>p[0]?"needs-improvement":"good"}(t.value,r),e(t))}},fo=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},mo=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},ho=function(e){var t=!1;return function(){t||(e(),t=!0)}},De=-1,oo=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Lt=function(e){document.visibilityState==="hidden"&&De>-1&&(De=e.type==="visibilitychange"?e.timeStamp:0,Fa())},io=function(){addEventListener("visibilitychange",Lt,!0),addEventListener("prerenderingchange",Lt,!0)},Fa=function(){removeEventListener("visibilitychange",Lt,!0),removeEventListener("prerenderingchange",Lt,!0)},po=function(){return De<0&&(De=oo(),io(),Ut(function(){setTimeout(function(){De=oo(),io()},0)})),{get firstHiddenTime(){return De}}},Fr=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},ao=[1800,3e3],go=function(e,t){t=t||{},Fr(function(){var r,o=po(),a=Oe("FCP"),d=lo("paint",function(f){f.forEach(function(h){h.name==="first-contentful-paint"&&(d.disconnect(),h.startTime<o.firstHiddenTime&&(a.value=Math.max(h.startTime-Bt(),0),a.entries.push(h),r(!0)))})});d&&(r=Fe(e,a,ao,t.reportAllChanges),Ut(function(f){a=Oe("FCP"),r=Fe(e,a,ao,t.reportAllChanges),fo(function(){a.value=performance.now()-f.timeStamp,r(!0)})}))})};var Na=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=ho(e),document.visibilityState==="hidden"?e():(r=t(e),mo(e)),r};var so=[2500,4e3],Dr={},vo=function(e,t){t=t||{},Fr(function(){var r,o=po(),a=Oe("LCP"),d=function(p){t.reportAllChanges||(p=p.slice(-1)),p.forEach(function(_){_.startTime<o.firstHiddenTime&&(a.value=Math.max(_.startTime-Bt(),0),a.entries=[_],r())})},f=lo("largest-contentful-paint",d);if(f){r=Fe(e,a,so,t.reportAllChanges);var h=ho(function(){Dr[a.id]||(d(f.takeRecords()),f.disconnect(),Dr[a.id]=!0,r(!0))});["keydown","click"].forEach(function(p){addEventListener(p,function(){return Na(h)},{once:!0,capture:!0})}),mo(h),Ut(function(p){a=Oe("LCP"),r=Fe(e,a,so,t.reportAllChanges),fo(function(){a.value=performance.now()-p.timeStamp,Dr[a.id]=!0,r(!0)})})}})},co=[800,1800],La=function e(t){document.prerendering?Fr(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},yo=function(e,t){t=t||{};var r=Oe("TTFB"),o=Fe(e,r,co,t.reportAllChanges);La(function(){var a=Or();a&&(r.value=Math.max(a.responseStart-Bt(),0),r.entries=[a],o(!0),Ut(function(){r=Oe("TTFB",0),(o=Fe(e,r,co,t.reportAllChanges))(!0)}))})};te();function Ua(){go(e=>{le("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),vo(e=>{le("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),yo(e=>{le("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function Ba(){Ke.on("onDocumentReady",e=>{Ke.emit("LifecycleEvent.onReady",{isLogin:!1}),R.mpType==="game"&&ue.start(Date.now()-e)})}function bo(){Ba(),Ua()}bo();
4
4
  /*! Bundled license information:
@@ -1,4 +1,4 @@
1
- var ds=Object.create;var Re=Object.defineProperty,us=Object.defineProperties,ms=Object.getOwnPropertyDescriptor,ps=Object.getOwnPropertyDescriptors,fs=Object.getOwnPropertyNames,_e=Object.getOwnPropertySymbols,hs=Object.getPrototypeOf,yt=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable;var ir=(e,t,r)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t)=>{for(var r in t||(t={}))yt.call(t,r)&&ir(e,r,t[r]);if(_e)for(var r of _e(t))ar.call(t,r)&&ir(e,r,t[r]);return e},x=(e,t)=>us(e,ps(t));var ae=(e,t)=>{var r={};for(var n in e)yt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&_e)for(var n of _e(e))t.indexOf(n)<0&&ar.call(e,n)&&(r[n]=e[n]);return r};var h=(e,t)=>()=>(e&&(t=e(e=0)),t);var cr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lr=(e,t)=>{for(var r in t)Re(e,r,{get:t[r],enumerable:!0})},gs=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of fs(t))!yt.call(e,s)&&s!==r&&Re(e,s,{get:()=>t[s],enumerable:!(n=ms(t,s))||n.enumerable});return e};var dr=(e,t,r)=>(r=e!=null?ds(hs(e)):{},gs(t||!e||!e.__esModule?Re(r,"default",{value:e,enumerable:!0}):r,e));var y=(e,t,r)=>new Promise((n,s)=>{var o=c=>{try{a(r.next(c))}catch(l){s(l)}},i=c=>{try{a(r.throw(c))}catch(l){s(l)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,i);a((r=r.apply(e,t)).next())});function vs(e){return!!(e!=null&&e.__nativeBuffers__)}function Te(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!vs(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 s;n.value?s=n.value:n.base64&&(s=ys(n.base64)),typeof s!="undefined"&&s instanceof ArrayBuffer&&(e[n.key]=s)}}return e}function ur(e={},t=!1){let r=e,n=[];for(let[s,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let i=t?{value:o,key:s}:{base64:bs(o),key:s};n.push(i),delete r[s]}return n.length>0&&(r.__nativeBuffers__=n),r}var ys,bs,bt=h(()=>{"use strict";ys=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let s=0;s<r;s++)n[s]=t.charCodeAt(s);return n.buffer};bs=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let s=0;s<n;s++)t+=String.fromCharCode(r[s]);return btoa(t)}});function Es(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function ce(e){return typeof e=="string"}function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function hr(e){return typeof e=="object"&&Array.isArray(e)}function gr(e){return e===!0||e===!1}function ws(e){return typeof e>"u"}function Ss(e){return ws(e)||e===null}function vr(e){return typeof e=="function"}function yr(e){return M(e)&&vr(e.then)}function br(e){let t=e,r=null,n=function(...s){return r||(r=new t(...s)),r};return n.prototype=t.prototype,n}function Tr(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(s,o){for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i)){let a=s[i],c=o[i],l=r(a,c,i,s,o);l!==void 0?s[i]=l:mr(c)&&mr(a)?s[i]=n(g({},a),c):Array.isArray(c)&&Array.isArray(a)?s[i]=[...a,...c]:s[i]=c}return s}return n(e,t)}function mr(e){return e&&typeof e=="object"&&e.constructor===Object}function kr(e,t){if(Array.isArray(e))return e.concat(t)}function we(e,t,r={}){let n=null,s,o,i,{leading:a=!1,trailing:c=!0}=r,l=()=>(i=e.apply(o,s),s=void 0,o=void 0,i),u=function(...m){s=m,o=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,c&&!p&&l()},t),p)return l()};return u.cancel=()=>{n&&clearTimeout(n),n=null,s=o=void 0},u.flush=()=>{if(n)return clearTimeout(n),n=null,l()},u}function _s(e,t){return(...r)=>t(e,...r)}function Oe(e){return t=>_s(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(s){e(new As(`${s}`))}})}function ke(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Js(e){return new Promise(t=>Nr(e)(t))}function Nr(e){return(t,r=null)=>{let n=!1;return e(s=>{if(!n)return n=!0,t.call(r,s)},null)}}function Hs(e,t){return(r=>{let n,s={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Ee(s);return o.event})((r,n=null)=>e(s=>t(s)&&r.call(n,s),null))}function Vs(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Ks(e[n],t[n])}function Ks(e,t){if(ce(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(vr(t)){try{if(e instanceof t)return}catch(r){}if(!Ss(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[kt])return globalThis[kt];let e=new Ce,t=new wt,r={registerCommand(n,s,o){e.registerCommand({id:n,handler:s,metadata:o})},executeCommand(n,...s){return t.executeCommand(n,...s)},excuteCommandSync(n,...s){return t.executeCommandThowErr(n,...s)}};return globalThis[kt]=r,r}var pr,Ts,ks,fr,ne,Is,St,le,Er,wr,As,Sr,Ir,Ar,_r,Rr,Se,Ne,It,j,xr,Rs,At,xs,_t,Ps,Cs,xe,Ns,Os,Fs,Pr,Rt,Ds,Us,Ms,Cr,Q,_,Ls,Bs,Pe,Ee,z,Et,js,Tt,$s,X,Ce,wt,kt,w=h(()=>{"use strict";pr=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,ks=(e,t)=>{for(var r in t)pr(e,r,{get:t[r],enumerable:!0})},fr=(e,t,r,n)=>{for(var s=n>1?void 0:n?Ts(t,r):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(n?i(t,r,s):i(s))||s);return n&&s&&pr(t,r,s),s};ne=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))}})}};Is=(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))(Is||{}),St=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}},le=class extends St{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Er=class extends St{constructor(){super(...arguments),this.kind="USER_ERROR"}},wr=class extends Er{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},As=class extends Er{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))}},Sr=class extends le{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Ir=class extends le{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Ar=class extends le{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},_r=class extends le{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Rr=class extends le{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Se=class extends St{constructor(e,t,r,n,s){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),s&&(this.priority=s)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},Ne=class extends le{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},It=class extends le{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};j={log:ke("log"),warn:ke("warn"),info:ke("info"),error:ke("error"),debug:ke("debug")};Object.assign(globalThis,{logger:j});xr=Symbol.for("Jolibox.canIUseMap"),Rs={};globalThis[xr]=Rs;At={get config(){return globalThis[xr]}},xs=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(xs||{}),_t=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(_t||{}),Ps=(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))(Ps||{}),Cs=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),xe={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Ns=()=>xe.isiOS?"iOS":xe.isAndroid?"Android":xe.isMac?"Mac":xe.isFacebook?"Facebook":"PC",Os="device_id",Fs="advertising_id",Pr=e=>(localStorage.getItem(e)||localStorage.setItem(e,Cs()),localStorage.getItem(e)),Rt=()=>Pr(Os),Ds=()=>Pr(Fs),Us=e=>e.charAt(0).toUpperCase()+e.slice(1),Ms=()=>{var t;let e=new URLSearchParams(window.location.search);return Us((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Cr=e=>{let t="JoliboxWebSDK",r=Ns(),n=navigator.language,s=Rt(),o=Ds();return`${t} (${Ms()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${s} adid/${o} version/${e||""}`},_=(Q=class{constructor(t){this.element=t,this.next=Q.Undefined,this.prev=Q.Undefined}},Q.Undefined=new Q(void 0),Q),Ls=class{constructor(){this._first=_.Undefined,this._last=_.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===_.Undefined}clear(){let e=this._first;for(;e!==_.Undefined;){let t=e.next;e.prev=_.Undefined,e.next=_.Undefined,e=t}this._first=_.Undefined,this._last=_.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new _(e);if(this._first===_.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==_.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==_.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==_.Undefined&&e.next!==_.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===_.Undefined&&e.next===_.Undefined?(this._first=_.Undefined,this._last=_.Undefined):e.next===_.Undefined?(this._last=this._last.prev,this._last.next=_.Undefined):e.prev===_.Undefined&&(this._first=this._first.next,this._first.prev=_.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==_.Undefined;)yield e.element,e=e.next}},Bs=0,Pe=class{constructor(e){this.value=e,this.id=Bs++}},Ee=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 Pe&&(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 s,o,i,a,c,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new Pe(t);this._listeners?this._listeners instanceof Pe?this._listeners=[this._listeners,n]:this._listeners.push(n):((o=(s=this.options)==null?void 0:s.onWillAddFirstListener)==null||o.call(s,this),this._listeners=n,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(l=(c=this.options)==null?void 0:c.onDidAddListener)==null||l.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(s){r(s)}}fire(e){this._listeners&&(this._listeners instanceof Pe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},z=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var o;let r=(o=this.listeners.get(e))!=null?o:new Ee,n=i=>t(...i.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let s=this.cachedEventQueue.get(e);if(s)for(;s.size>0;)r.fire(g({event:e},s.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 Ls,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},Et={};ks(Et,{None:()=>js,filter:()=>Hs,once:()=>Nr,toPromise:()=>Js});js=()=>{console.log("[Jolibox SDK] None Event")};Tt=Symbol.for("Jolibox.hostEmitter"),$s=()=>{let e=new z;return globalThis[Tt]||(globalThis[Tt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Tt]},X=$s();Ce=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ee,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 s of e.metadata.args)r.push(s.constraint);let n=e.handler;e.handler=function(...s){return Vs(s,r),n(...s)}}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}};Ce=fr([br],Ce);wt=class{constructor(){this._onWillExecuteCommand=new Ee,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ee,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ce,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Es(3e4)),this._starActivation}executeCommand(e,...t){return y(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Et.toPromise(Et.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}}};wt=fr([br],wt);kt=Symbol.for("Jolibox.commands")});function D(e,t={}){xt.emit("ERROR_REPORT",{error:e,options:t})}var xt,de,V=h(()=>{"use strict";w();w();xt=new z,de=new z;D.debounce=we(D,50,{leading:!0})});function Fe(e,t){return`[${e}]:${t}`}var ue,Pt,se=h(()=>{"use strict";V();w();V();ue=(e,t)=>{var r,n;return new Se((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Pt=e=>new wr(e)});var Or,Fr,Dr,Ur=h(()=>{"use strict";Or=[],Fr=[],Dr=["env","createRequestTask","login"]});function Lr(e,t){Mr||(Ct=new me({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),Nt=new me({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),Ot=new me({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),t("onJoliboxEnterBackground",()=>{Ct.flush(),Nt.flush(),Ot.flush()}),Mr=!0);function r(s){var b,v;let{method:o,args:i,startTime:a,isForeground:c,errMsg:l=`${o}:fail no errMsg`,errNo:u=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=s,{receiveJSInvoke:p,invokeCallback:T}=m,I=(v=(b=l.match(/\S:(\S+)\s?/))==null?void 0:b[1])!=null?v:"fail";Ct.report({status:I,method:n(o,i),errNo:`${u}`,errMsg:l,isForeground:c,duration:Date.now()-a}),a&&p&&T&&(Nt.report({status:I,method:o,isForeground:c,duration:Number((p-a).toFixed(3))}),Ot.report({status:I,method:o,isForeground:c,duration:Number((Date.now()-T).toFixed(3))}))}function n(s,o){return(s==="callHostMethod"||s==="callHostMethodSync")&&o!=null&&o.method?`${s}-${o.method}`:s}return r}var qs,me,Mr,Ct,Nt,Ot,Ft=h(()=>{"use strict";w();qs=e=>e==="pv"?e:"default",me=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:s,tagNameOrder:o,metricName:i,type:a}=t;this.reporter=r,this.interval=n,this.eventName=s,this.tagNameOrder=o,this.metricName=i,this.type=qs(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,s,o,i)=>{let a=s.shift();if(a){let c=i[a];n[c]||(n[c]={}),r(n[c],s,o,i)}else n[o]||(n[o]=[]),n[o].push(i[o])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(s,o,i,a)=>{let c=o.shift();if(!c&&M(a))throw new Ne(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(c){let l=[];if(M(a))l.push(...Object.keys(a));else if(ce(a)){if(o.length>0)throw new Ne(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);l.push(a)}else throw new Ne(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);l.forEach(u=>{s[u]||(s[u]={});let m=M(a)?a[u]:a;r(s[u],[...o],i,m)})}else s[i]?s[i]++:s[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={}}},Mr=!1});function jr(e,t){let r=0,n=!0,s=new Map,o=Lr(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Dt.forEach(p=>y(this,[p],function*({method:l,args:u,resolve:m}){let T=yield a(l,u);m(T)})),Dt.length=0});let i=(l,u)=>{let m=s.get(Number(l));if(!m)return;let p=Te(u);m(p),s.delete(Number(l))},a=(l,u)=>{var R,fe;let m=Date.now(),p=`${n}`;r+=1;let T=new ne;if(s.set(r,T.resolve),!n&&Fr.includes(l))return new Promise(U=>{Dt.push({method:l,args:u,resolve:U})});let b=x(g({},{method:l,startTime:m,args:u,isForeground:p}),{invokeType:"js-bridge"}),v=!Gs&&Or.includes(l),E=ur(u,v),A=v?E:JSON.stringify(E),f;if(l.endsWith("Sync")||Dr.includes(l)?f=(R=e.call)==null?void 0:R.call(e,l,E,r):typeof A=="string"?f=e.invoke(l,A,r):f=(fe=e.call)==null?void 0:fe.call(e,l,A,r),f){try{typeof f=="string"&&(f=JSON.parse(f)),f=Te(f)}catch(U){j.error(U)}return s.delete(r),f.errorCode&&(f.errorCode=Fe(l,f.errorCode)),o(g(g({},b),f)),f}return l.endsWith("Sync")&&s.delete(r),T.promise.then(U=>(U.errorCode&&(U.errorCode=Fe(l,U.errorCode)),o(g(g({},b),U)),U))};return{invokeNative:a,applyNative:(l,u)=>{let m=a(l,u);return yr(m)?m.then(p=>Br(l,p)):Br(l,m)},invokeHandler:i}}function Br(e,t){if(!M(t)){j.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:s,errorCode:o}=a,i=ae(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new Ar(r,n,s,o);return i}var Dt,Gs,Jr=h(()=>{"use strict";bt();w();se();Ur();Ft();Dt=[],Gs=!1});function Hr(e){let t=new z,r=new me({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(n){e.invoke("track",JSON.stringify({event:"reportMetrics",data:n}),-1)}});return t.on("onJoliboxEnterBackground",()=>{r.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribeHandler(n,s,o){let i=Te(s),a;if(i.__extra){a=i.params;let{type:c,startTime:l}=i.__extra;r.report({type:c,event:n,duration:Date.now()-l})}else a=i;t.emit(n,a,o)}}}var $r=h(()=>{"use strict";w();bt();Ft()});function Ut(e){let{subscribeHandler:t,onNative:r,offNative:n}=Hr(e),{invokeNative:s,invokeHandler:o,applyNative:i}=jr(e,r);return{invokeHandler:o,subscribeHandler:t,applyNative:i,invokeNative:s,onNative:r,offNative:n}}var Vr=h(()=>{"use strict";Jr();$r()});var Kr=h(()=>{"use strict"});var qr=h(()=>{"use strict";Vr();Kr()});var oe,K,Gr,zr=h(()=>{"use strict";w();V();K={trigger(){},exit(){return!1},onReady(e){K.trigger=e},doExit(e){K.exit=e}},Gr=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)D(new Ir("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=(s="")=>{K.trigger(),e.onDocumentReady.postMessage({path:s})};oe={onDocumentReady:t,doExit:s=>{let o=K.exit();e.doExit.postMessage({uuid:s,shouldInterrupt:o})},invoke(s,o,i){e.invoke.postMessage({event:s,paramsString:o,callbackId:i})},call(s,o,i){let a=window.prompt("invoke",JSON.stringify({event:s,paramsString:JSON.stringify(o),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Gr};globalThis.joliboxJSCore=g({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(s="")=>{K.trigger(),e.onDocumentReady(JSON.stringify({path:s}))};oe={onDocumentReady:t,invoke(s,o,i){e.invoke(JSON.stringify({event:s,paramsString:o,callbackId:i}))},doExit:s=>{let o=K.exit();e.doExit(JSON.stringify({uuid:s,shouldInterrupt:o}))},call(s,o,i){let a=window.prompt("invoke",JSON.stringify({event:s,paramsString:JSON.stringify(o),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Gr};globalThis.joliboxJSCore=g({},n)}});function Mt(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Lt=h(()=>{"use strict"});function Bt(){globalThis.onmessage=function(e){e.data==="msg:setup"&&([he]=e.ports,he.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])},he.publish=function(t,r){let n=Mt(r,"messagePort");he.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},he.postMessage("msg:setup:ok"))}}var he,Wr=h(()=>{"use strict";Lt()});var De=h(()=>{"use strict";zr();Wr();Lt()});var Qr,zs,Xr,Yr,J,P,W,va,Ws,$=h(()=>{"use strict";qr();De();se();w();De();Qr=oe;if(!Qr)throw new _r("No joliboxJScore is found, native bridge not found.");Bt();zs=g({},Qr),Xr=Ut(zs),{invokeHandler:Yr}=Xr,{applyNative:J,invokeNative:P,onNative:W,offNative:va,subscribeHandler:Ws}=Xr;globalThis.joliboxJSBridge={callHandler:Yr,invokeHandler:Yr,subscribeHandler:Ws}});var jt,Zr,en=h(()=>{"use strict";w();V();jt=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(s){return{}}},Zr=e=>{var t;try{let s=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(s!=null&&s.length){let[o,i,a]=s;return{headerJson:jt(o),payloadJson:jt(i),signature:jt(a)}}else throw"joli_source is missing"}catch(r){return D(new Sr(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}}});var Ys,Ue,tn,Jt=h(()=>{"use strict";w();Ys="1.1.10-beta.1",Ue=()=>Ys,tn=()=>{let e=Ue();return`${Cr(e)}`}});var Qs,rn,Ht,nn,L,Xs,k,q=h(()=>{"use strict";w();en();Jt();w();Qs={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Rt(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Ue()},schema:window.location.href,platform:"h5"},Ht=(rn=globalThis.joliboxJSCore)==null?void 0:rn.env,L=Object.assign({},(nn=Ht==null?void 0:Ht())!=null?nn:Qs),Xs=()=>{var m,p,T,I,b,v,E,A;let{payloadJson:e,headerJson:t}=L.schema.length?Zr(L.schema):{},r=`${L.deviceInfo.did}-${new Date().getTime()}`,s=new URL(L.schema.length?L.schema:window.location.href).searchParams,o=(T=(p=(m=s.get("mpId"))!=null?m:s.get("appId"))!=null?p:s.get("gameId"))!=null?T:"",i=(b=(I=e==null?void 0:e.sessionId)!=null?I:s.get("sessionId"))!=null?b:r,a=!!((v=e==null?void 0:e.testAdsMode)!=null?v:s.get("testAdsMode")==="true"),c=(A=(E=e==null?void 0:e.joliboxEnv)!=null?E:s.get("joliboxEnv"))!=null?A:"production",l=c==="staging",u=t==null?void 0:t.channel;return{get testMode(){return l},get testAdsMode(){return a},get joliboxEnv(){return c},get joliSource(){var f;return(f=s.get("joliSource"))!=null?f:null},get mpId(){var f;return(f=o!=null?o:e==null?void 0:e.id)!=null?f:""},get mpVersion(){var f;return(f=t==null?void 0:t.ver)!=null?f:Ue()},get mpType(){var f,R;return(R=(f=t==null?void 0:t.__mpType)!=null?f:e==null?void 0:e.__mpType)!=null?R:"game"},get platform(){var f;return(f=L.platform)!=null?f: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 f,R;return(R=(f=L.clientSessionId)!=null?f:i)!=null?R:r},get channel(){return u},get webviewId(){var f;return(f=L.webviewId)!=null?f:-1},onEnvConfigChanged:f=>{Tr(L,f,kr)}}},k=Xs()});var $t,on,Zs,eo,sn,to,an=h(()=>{"use strict";w();V();q();w();$t=!1,on=(e,t)=>e==null?!1:t in e,Zs=e=>on(e,"kind"),eo=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},sn=(e,t={},r)=>{var o,i,a;let n={user_id:(i=(o=k.hostUserInfo)==null?void 0:o.uid)!=null?i:"",device_id:(a=k.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:eo(e.name)},s=x(g({},n),{env:t.environment,isFromUser:r});r?de.emit("GLOBAL_USER_ERROR",e,s):de.emit("GLOBAL_ERROR",e,s)},to=e=>on(e,"kind")&&e.kind==="USER_ERROR";xt.on("ERROR_REPORT",({error:e,options:t})=>{if($t)return;$t=!0;let r=Zs(e)&&e.raw?e.raw:e;try{let n=to(e);sn(e,t,n)}catch(n){let s=n instanceof Error?n.message:String(n),o=new It(`${s}, origin error: ${r.message}`);j.error(o),sn(new It(o.message),{environment:t.environment},!1)}finally{$t=!1}})});var cn=h(()=>{"use strict";an();se();w();$();de.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};P("trackAsync",{event:"reportJsError",data:r})});de.on("GLOBAL_USER_ERROR",(e,t)=>{j.log("UserError",e,t)})});var Vt=h(()=>{"use strict"});function ln(e,t){let r=(n,s,o)=>{let i=x(g({tag:n},t),{extra:g({},s)});n=="globalJsError"?D(new Rr(JSON.stringify(i))):e("systemLog",i,o)};return r.debounce=we(r,500,{leading:!0}),r}function dn(e){let t=(r,n,s)=>{var a;let o=(a=s&&JSON.stringify(s))!=null?a:0,i={speed_value_type:r,total_duration:n};o&&Object.assign(i,{extra:o}),e("joliboxSpeedAnalysis",i)};return t.debounce=we(t,500,{leading:!0}),t}var un=h(()=>{"use strict";w();w();V()});function mn(e,t){let r=ln(e,t),n=dn(r);return{track:r,trackPerformance:n}}var pn=h(()=>{"use strict";un()});var fn=h(()=>{"use strict";q();w();w()});var hn=h(()=>{"use strict";pn();Vt();fn()});var Me,gn=h(()=>{"use strict";Me=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,s,o=!1,i=0,a=()=>{if(!o)return;let T=Date.now(),I=T-r;I>=this.interval&&(this.visible&&(i+=I,t(i)),r=T),n=requestAnimationFrame(a)},c=()=>{u(),r=Date.now(),s=window.setInterval(()=>{if(!o)return;let T=Date.now();T-r>=this.interval&&(r=T)},this.interval)},l=()=>{m(),r=Date.now(),n=requestAnimationFrame(a)},u=()=>{n&&(cancelAnimationFrame(n),n=0)},m=()=>{s&&(clearInterval(s),s=0)};this.eventEmitter.on("visible",T=>{o&&(console.log("visible",T),T?l():c())});let p=this.visible;return{start(){o||(o=!0,p?l():c())},stop(){o=!1,u(),m()}}}}});var Kt=h(()=>{"use strict"});function yn(e,t,r){let{response:n,startTime:s,endTime:o,requestFrom:i}=r,{errMsg:a="",profile:c={}}=n,u={duration:o-s,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"&&vn<no||i==="inner")&&(u.joli_request_number=vn++,setTimeout(()=>{H("joliboxNetRequestResult",u)},500))}var vn,no,bn=h(()=>{"use strict";Kt();ie();vn=0,no=10});function Le(e,t,r){var c,l,u;let n=new Map,s=(c=r==null?void 0:r.baseUrl)!=null?c:"https://api.jolibox.com",o=(l=r==null?void 0:r.type)!=null?l:"public",i=(u=r==null?void 0:r.defaultHeaders)!=null?u:{};return W("onRequestTaskStateChange",m=>{if(typeof m.requestTaskId!="string")return;let p=n.get(m.requestTaskId);if(p)if(m.state==="success"){let T=m,{requestTaskId:b,state:v}=T,E=ae(T,["requestTaskId","state"]);p.resolve(E),n.delete(b)}else if(m.state==="fail"){let I=m,{requestTaskId:b,state:v}=I,E=ae(I,["requestTaskId","state"]);p.reject(E),n.delete(b)}else j.warn("onRequestTaskStateChange unknown event",m)}),X.on("onLoginComplete",({isLogin:m,token:p})=>{m&&p&&(i["X-JOLI-TOKEN"]=p)}),(T,...I)=>y(this,[T,...I],function*(m,p={}){let b=Date.now(),v=so(m,x(g({},p),{baseUrl:s})),{method:E="GET",responseType:A="text",dataType:f="json",timeout:R,enableCache:fe=!1,appendHostCookie:U=!0}=p,be=Object.assign({"content-type":"application/json"},i,p.header),re={url:v,method:E,header:be,enableCache:fe,responseType:A,appendHostCookie:U};if(E=="POST"||E=="PUT"){let G=io(p.data,be["content-type"]);re.data=G}R&&Object.assign(re,{timeout:R});let{data:{requestTaskId:vt}}=P(e,re);if(typeof vt!="string")throw ue({code:-1,msg:"requestTaskId is not a string"});let or=(G,Y)=>{yn("request",v,{state:G,startTime:b,endTime:Date.now(),params:re,response:Y,requestId:vt,requestFrom:o=="public"?"public":"inner"})},{resolve:ss,reject:os,promise:is}=new ne;n.set(vt,{resolve:ss,reject:os});try{let G=yield is;or("success",G);let{data:Y}=G;return f==="json"&&typeof Y=="string"&&(Y=oo(Y)),{url:v,timeout:R,method:E,response:x(g({},G),{data:Y})}}catch(G){let Y=G;if(M(Y)){let{errMsg:Ae,prefetchDetail:as,isPrefetch:cs,errNo:ls}=Y;ce(Ae)&&(or("fail",{errMsg:Ae,isPrefetch:cs,prefetchDetail:as}),D(ue({code:-1,msg:Ae},{errNo:ls,errMsg:Ae})))}throw G}})}function oo(e){try{return JSON.parse(e.trim())}catch(t){return e}}function io(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 so,qt=h(()=>{"use strict";w();bn();Kt();$();V();se();so=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,s=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${s?`?${s}`:""}`:`${e}${s?`?${s}`:""}`}});var Gt,Tn,Z,Be=h(()=>{"use strict";Jt();qt();q();Gt={"x-user-agent":tn()};(Tn=k.hostUserInfo)!=null&&Tn.token&&(Gt["x-joli-token"]=k.hostUserInfo.token);k.joliSource&&(Gt["x-joli-source"]=k.joliSource);Z=Le("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:k.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Gt})});var je,kn=h(()=>{"use strict";q();gn();Be();$();je=class extends Me{constructor(t,r,n){super(r,n),this.gameId=k.mpId,this.sessionId=k.sessionId,this.track=t}reporter(t){return y(this,null,function*(){let{event:r,params:n}=t,s=[];s.push(Z("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:g({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(s)})}reportToNative(t){return y(this,null,function*(){let{event:r,params:n}=t;yield J("userTrackAsync",{event:r,params:g({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var An={};lr(An,{nativeTaskEmitter:()=>Ie,taskTracker:()=>B,track:()=>H,trackPerformance:()=>Sn});var ao,En,wn,H,Sn,In,Ie,B,ie=h(()=>{"use strict";cn();w();Vt();hn();q();kn();$();ao=(e,t,r)=>{var i,a;let n=t,s=M(n.extra)?n.extra:ce(n.extra)?JSON.parse(n.extra):{},o=x(g({},s),{mp_id:(i=n.mp_id)!=null?i:"",mp_version:(a=n.mp_version)!=null?a:""});P("trackAsync",{event:e,data:o,webviewId:r})},{track:H,trackPerformance:Sn}=mn(ao,{type:_t.AppSDK,platform:"native",jssdk_version:(wn=(En=k.sdkInfo)==null?void 0:En.jssdkVersion)!=null?wn:"1.0.0",mp_id:k.mpId,mp_version:k.mpVersion}),In=O();In.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Sn(e,t,r)});In.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{H(e,t)});Ie=new z,B=new je(H,Ie)});function _n(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let o=`
1
+ var ds=Object.create;var Re=Object.defineProperty,us=Object.defineProperties,ms=Object.getOwnPropertyDescriptor,ps=Object.getOwnPropertyDescriptors,fs=Object.getOwnPropertyNames,_e=Object.getOwnPropertySymbols,hs=Object.getPrototypeOf,yt=Object.prototype.hasOwnProperty,ar=Object.prototype.propertyIsEnumerable;var ir=(e,t,r)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t)=>{for(var r in t||(t={}))yt.call(t,r)&&ir(e,r,t[r]);if(_e)for(var r of _e(t))ar.call(t,r)&&ir(e,r,t[r]);return e},x=(e,t)=>us(e,ps(t));var ae=(e,t)=>{var r={};for(var n in e)yt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&_e)for(var n of _e(e))t.indexOf(n)<0&&ar.call(e,n)&&(r[n]=e[n]);return r};var h=(e,t)=>()=>(e&&(t=e(e=0)),t);var cr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),lr=(e,t)=>{for(var r in t)Re(e,r,{get:t[r],enumerable:!0})},gs=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of fs(t))!yt.call(e,s)&&s!==r&&Re(e,s,{get:()=>t[s],enumerable:!(n=ms(t,s))||n.enumerable});return e};var dr=(e,t,r)=>(r=e!=null?ds(hs(e)):{},gs(t||!e||!e.__esModule?Re(r,"default",{value:e,enumerable:!0}):r,e));var y=(e,t,r)=>new Promise((n,s)=>{var o=c=>{try{a(r.next(c))}catch(l){s(l)}},i=c=>{try{a(r.throw(c))}catch(l){s(l)}},a=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,i);a((r=r.apply(e,t)).next())});function vs(e){return!!(e!=null&&e.__nativeBuffers__)}function Te(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!vs(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 s;n.value?s=n.value:n.base64&&(s=ys(n.base64)),typeof s!="undefined"&&s instanceof ArrayBuffer&&(e[n.key]=s)}}return e}function ur(e={},t=!1){let r=e,n=[];for(let[s,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let i=t?{value:o,key:s}:{base64:bs(o),key:s};n.push(i),delete r[s]}return n.length>0&&(r.__nativeBuffers__=n),r}var ys,bs,bt=h(()=>{"use strict";ys=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let s=0;s<r;s++)n[s]=t.charCodeAt(s);return n.buffer};bs=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let s=0;s<n;s++)t+=String.fromCharCode(r[s]);return btoa(t)}});function Es(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function ce(e){return typeof e=="string"}function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function hr(e){return typeof e=="object"&&Array.isArray(e)}function gr(e){return e===!0||e===!1}function ws(e){return typeof e>"u"}function Ss(e){return ws(e)||e===null}function vr(e){return typeof e=="function"}function yr(e){return M(e)&&vr(e.then)}function br(e){let t=e,r=null,n=function(...s){return r||(r=new t(...s)),r};return n.prototype=t.prototype,n}function Tr(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(s,o){for(let i in o)if(Object.prototype.hasOwnProperty.call(o,i)){let a=s[i],c=o[i],l=r(a,c,i,s,o);l!==void 0?s[i]=l:mr(c)&&mr(a)?s[i]=n(g({},a),c):Array.isArray(c)&&Array.isArray(a)?s[i]=[...a,...c]:s[i]=c}return s}return n(e,t)}function mr(e){return e&&typeof e=="object"&&e.constructor===Object}function kr(e,t){if(Array.isArray(e))return e.concat(t)}function we(e,t,r={}){let n=null,s,o,i,{leading:a=!1,trailing:c=!0}=r,l=()=>(i=e.apply(o,s),s=void 0,o=void 0,i),u=function(...m){s=m,o=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,c&&!p&&l()},t),p)return l()};return u.cancel=()=>{n&&clearTimeout(n),n=null,s=o=void 0},u.flush=()=>{if(n)return clearTimeout(n),n=null,l()},u}function _s(e,t){return(...r)=>t(e,...r)}function Oe(e){return t=>_s(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(s){e(new As(`${s}`))}})}function ke(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Js(e){return new Promise(t=>Nr(e)(t))}function Nr(e){return(t,r=null)=>{let n=!1;return e(s=>{if(!n)return n=!0,t.call(r,s)},null)}}function Hs(e,t){return(r=>{let n,s={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Ee(s);return o.event})((r,n=null)=>e(s=>t(s)&&r.call(n,s),null))}function Vs(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Ks(e[n],t[n])}function Ks(e,t){if(ce(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(vr(t)){try{if(e instanceof t)return}catch(r){}if(!Ss(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[kt])return globalThis[kt];let e=new Ce,t=new wt,r={registerCommand(n,s,o){e.registerCommand({id:n,handler:s,metadata:o})},executeCommand(n,...s){return t.executeCommand(n,...s)},excuteCommandSync(n,...s){return t.executeCommandThowErr(n,...s)}};return globalThis[kt]=r,r}var pr,Ts,ks,fr,ne,Is,St,le,Er,wr,As,Sr,Ir,Ar,_r,Rr,Se,Ne,It,j,xr,Rs,At,xs,_t,Ps,Cs,xe,Ns,Os,Fs,Pr,Rt,Ds,Us,Ms,Cr,Q,_,Ls,Bs,Pe,Ee,z,Et,js,Tt,$s,X,Ce,wt,kt,w=h(()=>{"use strict";pr=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,ks=(e,t)=>{for(var r in t)pr(e,r,{get:t[r],enumerable:!0})},fr=(e,t,r,n)=>{for(var s=n>1?void 0:n?Ts(t,r):t,o=e.length-1,i;o>=0;o--)(i=e[o])&&(s=(n?i(t,r,s):i(s))||s);return n&&s&&pr(t,r,s),s};ne=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))}})}};Is=(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))(Is||{}),St=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}},le=class extends St{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Er=class extends St{constructor(){super(...arguments),this.kind="USER_ERROR"}},wr=class extends Er{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},As=class extends Er{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))}},Sr=class extends le{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Ir=class extends le{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Ar=class extends le{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},_r=class extends le{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Rr=class extends le{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Se=class extends St{constructor(e,t,r,n,s){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),s&&(this.priority=s)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},Ne=class extends le{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},It=class extends le{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};j={log:ke("log"),warn:ke("warn"),info:ke("info"),error:ke("error"),debug:ke("debug")};Object.assign(globalThis,{logger:j});xr=Symbol.for("Jolibox.canIUseMap"),Rs={};globalThis[xr]=Rs;At={get config(){return globalThis[xr]}},xs=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(xs||{}),_t=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(_t||{}),Ps=(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))(Ps||{}),Cs=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),xe={isiOS:navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS"),iosVersion:()=>{let e=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);return[parseInt(e[1],10),parseInt(e[2],10),parseInt(e[3]||"0",10)]},isAndroid:navigator.userAgent.includes("Android"),isMac:navigator.userAgent.includes("Mac"),isFacebook:navigator.userAgent.includes("FB_IAB"),isPC:!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Ns=()=>xe.isiOS?"iOS":xe.isAndroid?"Android":xe.isMac?"Mac":xe.isFacebook?"Facebook":"PC",Os="device_id",Fs="advertising_id",Pr=e=>(localStorage.getItem(e)||localStorage.setItem(e,Cs()),localStorage.getItem(e)),Rt=()=>Pr(Os),Ds=()=>Pr(Fs),Us=e=>e.charAt(0).toUpperCase()+e.slice(1),Ms=()=>{var t;let e=new URLSearchParams(window.location.search);return Us((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Cr=e=>{let t="JoliboxWebSDK",r=Ns(),n=navigator.language,s=Rt(),o=Ds();return`${t} (${Ms()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${s} adid/${o} version/${e||""}`},_=(Q=class{constructor(t){this.element=t,this.next=Q.Undefined,this.prev=Q.Undefined}},Q.Undefined=new Q(void 0),Q),Ls=class{constructor(){this._first=_.Undefined,this._last=_.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===_.Undefined}clear(){let e=this._first;for(;e!==_.Undefined;){let t=e.next;e.prev=_.Undefined,e.next=_.Undefined,e=t}this._first=_.Undefined,this._last=_.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new _(e);if(this._first===_.Undefined)this._first=r,this._last=r;else if(t){let s=this._last;this._last=r,r.prev=s,s.next=r}else{let s=this._first;this._first=r,r.next=s,s.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==_.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==_.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==_.Undefined&&e.next!==_.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===_.Undefined&&e.next===_.Undefined?(this._first=_.Undefined,this._last=_.Undefined):e.next===_.Undefined?(this._last=this._last.prev,this._last.next=_.Undefined):e.prev===_.Undefined&&(this._first=this._first.next,this._first.prev=_.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==_.Undefined;)yield e.element,e=e.next}},Bs=0,Pe=class{constructor(e){this.value=e,this.id=Bs++}},Ee=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 Pe&&(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 s,o,i,a,c,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new Pe(t);this._listeners?this._listeners instanceof Pe?this._listeners=[this._listeners,n]:this._listeners.push(n):((o=(s=this.options)==null?void 0:s.onWillAddFirstListener)==null||o.call(s,this),this._listeners=n,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(l=(c=this.options)==null?void 0:c.onDidAddListener)==null||l.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(s){r(s)}}fire(e){this._listeners&&(this._listeners instanceof Pe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},z=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var o;let r=(o=this.listeners.get(e))!=null?o:new Ee,n=i=>t(...i.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let s=this.cachedEventQueue.get(e);if(s)for(;s.size>0;)r.fire(g({event:e},s.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 Ls,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},Et={};ks(Et,{None:()=>js,filter:()=>Hs,once:()=>Nr,toPromise:()=>Js});js=()=>{console.log("[Jolibox SDK] None Event")};Tt=Symbol.for("Jolibox.hostEmitter"),$s=()=>{let e=new z;return globalThis[Tt]||(globalThis[Tt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Tt]},X=$s();Ce=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ee,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 s of e.metadata.args)r.push(s.constraint);let n=e.handler;e.handler=function(...s){return Vs(s,r),n(...s)}}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}};Ce=fr([br],Ce);wt=class{constructor(){this._onWillExecuteCommand=new Ee,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ee,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ce,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Es(3e4)),this._starActivation}executeCommand(e,...t){return y(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Et.toPromise(Et.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}}};wt=fr([br],wt);kt=Symbol.for("Jolibox.commands")});function D(e,t={}){xt.emit("ERROR_REPORT",{error:e,options:t})}var xt,de,V=h(()=>{"use strict";w();w();xt=new z,de=new z;D.debounce=we(D,50,{leading:!0})});function Fe(e,t){return`[${e}]:${t}`}var ue,Pt,se=h(()=>{"use strict";V();w();V();ue=(e,t)=>{var r,n;return new Se((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Pt=e=>new wr(e)});var Or,Fr,Dr,Ur=h(()=>{"use strict";Or=[],Fr=[],Dr=["env","createRequestTask","login"]});function Lr(e,t){Mr||(Ct=new me({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),Nt=new me({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),Ot=new me({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(s){e.invoke("track",JSON.stringify({event:"reportMetrics",data:s}),-1)}}),t("onJoliboxEnterBackground",()=>{Ct.flush(),Nt.flush(),Ot.flush()}),Mr=!0);function r(s){var b,v;let{method:o,args:i,startTime:a,isForeground:c,errMsg:l=`${o}:fail no errMsg`,errNo:u=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=s,{receiveJSInvoke:p,invokeCallback:T}=m,I=(v=(b=l.match(/\S:(\S+)\s?/))==null?void 0:b[1])!=null?v:"fail";Ct.report({status:I,method:n(o,i),errNo:`${u}`,errMsg:l,isForeground:c,duration:Date.now()-a}),a&&p&&T&&(Nt.report({status:I,method:o,isForeground:c,duration:Number((p-a).toFixed(3))}),Ot.report({status:I,method:o,isForeground:c,duration:Number((Date.now()-T).toFixed(3))}))}function n(s,o){return(s==="callHostMethod"||s==="callHostMethodSync")&&o!=null&&o.method?`${s}-${o.method}`:s}return r}var qs,me,Mr,Ct,Nt,Ot,Ft=h(()=>{"use strict";w();qs=e=>e==="pv"?e:"default",me=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:s,tagNameOrder:o,metricName:i,type:a}=t;this.reporter=r,this.interval=n,this.eventName=s,this.tagNameOrder=o,this.metricName=i,this.type=qs(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,s,o,i)=>{let a=s.shift();if(a){let c=i[a];n[c]||(n[c]={}),r(n[c],s,o,i)}else n[o]||(n[o]=[]),n[o].push(i[o])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(s,o,i,a)=>{let c=o.shift();if(!c&&M(a))throw new Ne(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(c){let l=[];if(M(a))l.push(...Object.keys(a));else if(ce(a)){if(o.length>0)throw new Ne(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);l.push(a)}else throw new Ne(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);l.forEach(u=>{s[u]||(s[u]={});let m=M(a)?a[u]:a;r(s[u],[...o],i,m)})}else s[i]?s[i]++:s[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={}}},Mr=!1});function jr(e,t){let r=0,n=!0,s=new Map,o=Lr(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Dt.forEach(p=>y(this,[p],function*({method:l,args:u,resolve:m}){let T=yield a(l,u);m(T)})),Dt.length=0});let i=(l,u)=>{let m=s.get(Number(l));if(!m)return;let p=Te(u);m(p),s.delete(Number(l))},a=(l,u)=>{var R,fe;let m=Date.now(),p=`${n}`;r+=1;let T=new ne;if(s.set(r,T.resolve),!n&&Fr.includes(l))return new Promise(U=>{Dt.push({method:l,args:u,resolve:U})});let b=x(g({},{method:l,startTime:m,args:u,isForeground:p}),{invokeType:"js-bridge"}),v=!Gs&&Or.includes(l),E=ur(u,v),A=v?E:JSON.stringify(E),f;if(l.endsWith("Sync")||Dr.includes(l)?f=(R=e.call)==null?void 0:R.call(e,l,E,r):typeof A=="string"?f=e.invoke(l,A,r):f=(fe=e.call)==null?void 0:fe.call(e,l,A,r),f){try{typeof f=="string"&&(f=JSON.parse(f)),f=Te(f)}catch(U){j.error(U)}return s.delete(r),f.errorCode&&(f.errorCode=Fe(l,f.errorCode)),o(g(g({},b),f)),f}return l.endsWith("Sync")&&s.delete(r),T.promise.then(U=>(U.errorCode&&(U.errorCode=Fe(l,U.errorCode)),o(g(g({},b),U)),U))};return{invokeNative:a,applyNative:(l,u)=>{let m=a(l,u);return yr(m)?m.then(p=>Br(l,p)):Br(l,m)},invokeHandler:i}}function Br(e,t){if(!M(t)){j.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:s,errorCode:o}=a,i=ae(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new Ar(r,n,s,o);return i}var Dt,Gs,Jr=h(()=>{"use strict";bt();w();se();Ur();Ft();Dt=[],Gs=!1});function Hr(e){let t=new z,r=new me({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(n){e.invoke("track",JSON.stringify({event:"reportMetrics",data:n}),-1)}});return t.on("onJoliboxEnterBackground",()=>{r.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribeHandler(n,s,o){let i=Te(s),a;if(i.__extra){a=i.params;let{type:c,startTime:l}=i.__extra;r.report({type:c,event:n,duration:Date.now()-l})}else a=i;t.emit(n,a,o)}}}var $r=h(()=>{"use strict";w();bt();Ft()});function Ut(e){let{subscribeHandler:t,onNative:r,offNative:n}=Hr(e),{invokeNative:s,invokeHandler:o,applyNative:i}=jr(e,r);return{invokeHandler:o,subscribeHandler:t,applyNative:i,invokeNative:s,onNative:r,offNative:n}}var Vr=h(()=>{"use strict";Jr();$r()});var Kr=h(()=>{"use strict"});var qr=h(()=>{"use strict";Vr();Kr()});var oe,K,Gr,zr=h(()=>{"use strict";w();V();K={trigger(){},exit(){return!1},onReady(e){K.trigger=e},doExit(e){K.exit=e}},Gr=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)D(new Ir("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=(s="")=>{K.trigger(),e.onDocumentReady.postMessage({path:s})};oe={onDocumentReady:t,doExit:s=>{let o=K.exit();e.doExit.postMessage({uuid:s,shouldInterrupt:o})},invoke(s,o,i){e.invoke.postMessage({event:s,paramsString:o,callbackId:i})},call(s,o,i){let a=window.prompt("invoke",JSON.stringify({event:s,paramsString:JSON.stringify(o),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Gr};globalThis.joliboxJSCore=g({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(s="")=>{K.trigger(),e.onDocumentReady(JSON.stringify({path:s}))};oe={onDocumentReady:t,invoke(s,o,i){e.invoke(JSON.stringify({event:s,paramsString:o,callbackId:i}))},doExit:s=>{let o=K.exit();e.doExit(JSON.stringify({uuid:s,shouldInterrupt:o}))},call(s,o,i){let a=window.prompt("invoke",JSON.stringify({event:s,paramsString:JSON.stringify(o),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:Gr};globalThis.joliboxJSCore=g({},n)}});function Mt(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var Lt=h(()=>{"use strict"});function Bt(){globalThis.onmessage=function(e){e.data==="msg:setup"&&([he]=e.ports,he.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])},he.publish=function(t,r){let n=Mt(r,"messagePort");he.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},he.postMessage("msg:setup:ok"))}}var he,Wr=h(()=>{"use strict";Lt()});var De=h(()=>{"use strict";zr();Wr();Lt()});var Qr,zs,Xr,Yr,J,P,W,va,Ws,$=h(()=>{"use strict";qr();De();se();w();De();Qr=oe;if(!Qr)throw new _r("No joliboxJScore is found, native bridge not found.");Bt();zs=g({},Qr),Xr=Ut(zs),{invokeHandler:Yr}=Xr,{applyNative:J,invokeNative:P,onNative:W,offNative:va,subscribeHandler:Ws}=Xr;globalThis.joliboxJSBridge={callHandler:Yr,invokeHandler:Yr,subscribeHandler:Ws}});var jt,Zr,en=h(()=>{"use strict";w();V();jt=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(s){return{}}},Zr=e=>{var t;try{let s=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(s!=null&&s.length){let[o,i,a]=s;return{headerJson:jt(o),payloadJson:jt(i),signature:jt(a)}}else throw"joli_source is missing"}catch(r){return D(new Sr(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}}});var Ys,Ue,tn,Jt=h(()=>{"use strict";w();Ys="1.1.10",Ue=()=>Ys,tn=()=>{let e=Ue();return`${Cr(e)}`}});var Qs,rn,Ht,nn,L,Xs,k,q=h(()=>{"use strict";w();en();Jt();w();Qs={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Rt(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Ue()},schema:window.location.href,platform:"h5"},Ht=(rn=globalThis.joliboxJSCore)==null?void 0:rn.env,L=Object.assign({},(nn=Ht==null?void 0:Ht())!=null?nn:Qs),Xs=()=>{var m,p,T,I,b,v,E,A;let{payloadJson:e,headerJson:t}=L.schema.length?Zr(L.schema):{},r=`${L.deviceInfo.did}-${new Date().getTime()}`,s=new URL(L.schema.length?L.schema:window.location.href).searchParams,o=(T=(p=(m=s.get("mpId"))!=null?m:s.get("appId"))!=null?p:s.get("gameId"))!=null?T:"",i=(b=(I=e==null?void 0:e.sessionId)!=null?I:s.get("sessionId"))!=null?b:r,a=!!((v=e==null?void 0:e.testAdsMode)!=null?v:s.get("testAdsMode")==="true"),c=(A=(E=e==null?void 0:e.joliboxEnv)!=null?E:s.get("joliboxEnv"))!=null?A:"production",l=c==="staging",u=t==null?void 0:t.channel;return{get testMode(){return l},get testAdsMode(){return a},get joliboxEnv(){return c},get joliSource(){var f;return(f=s.get("joliSource"))!=null?f:null},get mpId(){var f;return(f=o!=null?o:e==null?void 0:e.id)!=null?f:""},get mpVersion(){var f;return(f=t==null?void 0:t.ver)!=null?f:Ue()},get mpType(){var f,R;return(R=(f=t==null?void 0:t.__mpType)!=null?f:e==null?void 0:e.__mpType)!=null?R:"game"},get platform(){var f;return(f=L.platform)!=null?f: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 f,R;return(R=(f=L.clientSessionId)!=null?f:i)!=null?R:r},get channel(){return u},get webviewId(){var f;return(f=L.webviewId)!=null?f:-1},onEnvConfigChanged:f=>{Tr(L,f,kr)}}},k=Xs()});var $t,on,Zs,eo,sn,to,an=h(()=>{"use strict";w();V();q();w();$t=!1,on=(e,t)=>e==null?!1:t in e,Zs=e=>on(e,"kind"),eo=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},sn=(e,t={},r)=>{var o,i,a;let n={user_id:(i=(o=k.hostUserInfo)==null?void 0:o.uid)!=null?i:"",device_id:(a=k.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:eo(e.name)},s=x(g({},n),{env:t.environment,isFromUser:r});r?de.emit("GLOBAL_USER_ERROR",e,s):de.emit("GLOBAL_ERROR",e,s)},to=e=>on(e,"kind")&&e.kind==="USER_ERROR";xt.on("ERROR_REPORT",({error:e,options:t})=>{if($t)return;$t=!0;let r=Zs(e)&&e.raw?e.raw:e;try{let n=to(e);sn(e,t,n)}catch(n){let s=n instanceof Error?n.message:String(n),o=new It(`${s}, origin error: ${r.message}`);j.error(o),sn(new It(o.message),{environment:t.environment},!1)}finally{$t=!1}})});var cn=h(()=>{"use strict";an();se();w();$();de.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};P("trackAsync",{event:"reportJsError",data:r})});de.on("GLOBAL_USER_ERROR",(e,t)=>{j.log("UserError",e,t)})});var Vt=h(()=>{"use strict"});function ln(e,t){let r=(n,s,o)=>{let i=x(g({tag:n},t),{extra:g({},s)});n=="globalJsError"?D(new Rr(JSON.stringify(i))):e("systemLog",i,o)};return r.debounce=we(r,500,{leading:!0}),r}function dn(e){let t=(r,n,s)=>{var a;let o=(a=s&&JSON.stringify(s))!=null?a:0,i={speed_value_type:r,total_duration:n};o&&Object.assign(i,{extra:o}),e("joliboxSpeedAnalysis",i)};return t.debounce=we(t,500,{leading:!0}),t}var un=h(()=>{"use strict";w();w();V()});function mn(e,t){let r=ln(e,t),n=dn(r);return{track:r,trackPerformance:n}}var pn=h(()=>{"use strict";un()});var fn=h(()=>{"use strict";q();w();w()});var hn=h(()=>{"use strict";pn();Vt();fn()});var Me,gn=h(()=>{"use strict";Me=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,s,o=!1,i=0,a=()=>{if(!o)return;let T=Date.now(),I=T-r;I>=this.interval&&(this.visible&&(i+=I,t(i)),r=T),n=requestAnimationFrame(a)},c=()=>{u(),r=Date.now(),s=window.setInterval(()=>{if(!o)return;let T=Date.now();T-r>=this.interval&&(r=T)},this.interval)},l=()=>{m(),r=Date.now(),n=requestAnimationFrame(a)},u=()=>{n&&(cancelAnimationFrame(n),n=0)},m=()=>{s&&(clearInterval(s),s=0)};this.eventEmitter.on("visible",T=>{o&&(console.log("visible",T),T?l():c())});let p=this.visible;return{start(){o||(o=!0,p?l():c())},stop(){o=!1,u(),m()}}}}});var Kt=h(()=>{"use strict"});function yn(e,t,r){let{response:n,startTime:s,endTime:o,requestFrom:i}=r,{errMsg:a="",profile:c={}}=n,u={duration:o-s,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"&&vn<no||i==="inner")&&(u.joli_request_number=vn++,setTimeout(()=>{H("joliboxNetRequestResult",u)},500))}var vn,no,bn=h(()=>{"use strict";Kt();ie();vn=0,no=10});function Le(e,t,r){var c,l,u;let n=new Map,s=(c=r==null?void 0:r.baseUrl)!=null?c:"https://api.jolibox.com",o=(l=r==null?void 0:r.type)!=null?l:"public",i=(u=r==null?void 0:r.defaultHeaders)!=null?u:{};return W("onRequestTaskStateChange",m=>{if(typeof m.requestTaskId!="string")return;let p=n.get(m.requestTaskId);if(p)if(m.state==="success"){let T=m,{requestTaskId:b,state:v}=T,E=ae(T,["requestTaskId","state"]);p.resolve(E),n.delete(b)}else if(m.state==="fail"){let I=m,{requestTaskId:b,state:v}=I,E=ae(I,["requestTaskId","state"]);p.reject(E),n.delete(b)}else j.warn("onRequestTaskStateChange unknown event",m)}),X.on("onLoginComplete",({isLogin:m,token:p})=>{m&&p&&(i["X-JOLI-TOKEN"]=p)}),(T,...I)=>y(this,[T,...I],function*(m,p={}){let b=Date.now(),v=so(m,x(g({},p),{baseUrl:s})),{method:E="GET",responseType:A="text",dataType:f="json",timeout:R,enableCache:fe=!1,appendHostCookie:U=!0}=p,be=Object.assign({"content-type":"application/json"},i,p.header),re={url:v,method:E,header:be,enableCache:fe,responseType:A,appendHostCookie:U};if(E=="POST"||E=="PUT"){let G=io(p.data,be["content-type"]);re.data=G}R&&Object.assign(re,{timeout:R});let{data:{requestTaskId:vt}}=P(e,re);if(typeof vt!="string")throw ue({code:-1,msg:"requestTaskId is not a string"});let or=(G,Y)=>{yn("request",v,{state:G,startTime:b,endTime:Date.now(),params:re,response:Y,requestId:vt,requestFrom:o=="public"?"public":"inner"})},{resolve:ss,reject:os,promise:is}=new ne;n.set(vt,{resolve:ss,reject:os});try{let G=yield is;or("success",G);let{data:Y}=G;return f==="json"&&typeof Y=="string"&&(Y=oo(Y)),{url:v,timeout:R,method:E,response:x(g({},G),{data:Y})}}catch(G){let Y=G;if(M(Y)){let{errMsg:Ae,prefetchDetail:as,isPrefetch:cs,errNo:ls}=Y;ce(Ae)&&(or("fail",{errMsg:Ae,isPrefetch:cs,prefetchDetail:as}),D(ue({code:-1,msg:Ae},{errNo:ls,errMsg:Ae})))}throw G}})}function oo(e){try{return JSON.parse(e.trim())}catch(t){return e}}function io(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 so,qt=h(()=>{"use strict";w();bn();Kt();$();V();se();so=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,s=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${s?`?${s}`:""}`:`${e}${s?`?${s}`:""}`}});var Gt,Tn,Z,Be=h(()=>{"use strict";Jt();qt();q();Gt={"x-user-agent":tn()};(Tn=k.hostUserInfo)!=null&&Tn.token&&(Gt["x-joli-token"]=k.hostUserInfo.token);k.joliSource&&(Gt["x-joli-source"]=k.joliSource);Z=Le("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:k.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:Gt})});var je,kn=h(()=>{"use strict";q();gn();Be();$();je=class extends Me{constructor(t,r,n){super(r,n),this.gameId=k.mpId,this.sessionId=k.sessionId,this.track=t}reporter(t){return y(this,null,function*(){let{event:r,params:n}=t,s=[];s.push(Z("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:g({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(s)})}reportToNative(t){return y(this,null,function*(){let{event:r,params:n}=t;yield J("userTrackAsync",{event:r,params:g({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var An={};lr(An,{nativeTaskEmitter:()=>Ie,taskTracker:()=>B,track:()=>H,trackPerformance:()=>Sn});var ao,En,wn,H,Sn,In,Ie,B,ie=h(()=>{"use strict";cn();w();Vt();hn();q();kn();$();ao=(e,t,r)=>{var i,a;let n=t,s=M(n.extra)?n.extra:ce(n.extra)?JSON.parse(n.extra):{},o=x(g({},s),{mp_id:(i=n.mp_id)!=null?i:"",mp_version:(a=n.mp_version)!=null?a:""});P("trackAsync",{event:e,data:o,webviewId:r})},{track:H,trackPerformance:Sn}=mn(ao,{type:_t.AppSDK,platform:"native",jssdk_version:(wn=(En=k.sdkInfo)==null?void 0:En.jssdkVersion)!=null?wn:"1.0.0",mp_id:k.mpId,mp_version:k.mpVersion}),In=O();In.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Sn(e,t,r)});In.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{H(e,t)});Ie=new z,B=new je(H,Ie)});function _n(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let o=`
2
2
  html[data-jolibox-root] {
3
3
  height: 100%;
4
4
  margin: 0;
@@ -1,9 +1,9 @@
1
1
  Invoking: npm run clean && npm run build:esm && tsc
2
2
 
3
- > @jolibox/implement@1.1.10-beta.1 clean
3
+ > @jolibox/implement@1.1.10 clean
4
4
  > rimraf ./dist
5
5
 
6
6
 
7
- > @jolibox/implement@1.1.10-beta.1 build:esm
7
+ > @jolibox/implement@1.1.10 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.10-beta.1",
4
+ "version": "1.1.10",
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.10-beta.1",
10
- "@jolibox/types": "1.1.10-beta.1",
9
+ "@jolibox/common": "1.1.10",
10
+ "@jolibox/types": "1.1.10",
11
11
  "localforage": "1.10.0",
12
12
  "web-vitals": "4.2.4"
13
13
  },