@jolibox/implement 1.1.11-beta.7 → 1.1.11-beta.9
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": "
|
|
7
|
+
"packages/implement/package.json": "483f333c95086e61a3be4dca54219be92c701bea",
|
|
8
8
|
"packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
|
|
9
9
|
"packages/implement/src/common/ads/anti-cheating.test.ts": "433eb603b97fd7609f26af1522f309596a790829",
|
|
10
10
|
"packages/implement/src/common/ads/anti-cheating.ts": "888c94ef55ca03849a79b3e0425850a097192816",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"packages/implement/src/native/types/global.d.ts": "f4711617013586d0f3c7e2d9bec06f44a86bbc5d",
|
|
104
104
|
"packages/implement/src/native/types/native-method-map.d.ts": "0e7d37d4b4d204c7dd5bb50119f20f9bf8e7106f",
|
|
105
105
|
"packages/implement/src/native/types/native-method.d.ts": "e4e22c921a5b54d4e10fe5ca18158d691fbfe3e7",
|
|
106
|
-
"packages/implement/src/native/ui/retention.ts": "
|
|
106
|
+
"packages/implement/src/native/ui/retention.ts": "33c60a320707685c2bc325850c6d3885438833ab",
|
|
107
107
|
"packages/implement/tsconfig.json": "b150f4b2ef4eb9d98f92135d481fe530eb7145b5"
|
|
108
108
|
},
|
|
109
109
|
"arguments": "npm run clean && npm run build:esm && tsc "
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var bi=Object.create;var zt=Object.defineProperty,_i=Object.defineProperties,Ei=Object.getOwnPropertyDescriptor,Ii=Object.getOwnPropertyDescriptors,wi=Object.getOwnPropertyNames,Ye=Object.getOwnPropertySymbols,Ti=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,U=(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)=>_i(e,Ii(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 n in e)Yt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ye)for(var n of Ye(e))t.indexOf(n)<0&&nn.call(e,n)&&(r[n]=e[n]);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 Si=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wi(t))!Yt.call(e,a)&&a!==r&&zt(e,a,{get:()=>t[a],enumerable:!(n=Ei(t,a))||n.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?bi(Ti(e)):{},Si(t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r,e));var L=(e,t,r)=>new Promise((n,a)=>{var u=p=>{try{m(r.next(p))}catch(T){a(T)}},f=p=>{try{m(r.throw(p))}catch(T){a(T)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(u,f);m((r=r.apply(e,t)).next())});function ki(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 xi(e){return typeof e>"u"}function Ci(e){return xi(e)||e===null}function Pi(e){return typeof e=="function"}function hn(e){let t=e,r=null,n=function(...a){return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}function pn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(a,u){for(let f in u)if(Object.prototype.hasOwnProperty.call(u,f)){let m=a[f],p=u[f],T=r(m,p,f,a,u);T!==void 0?a[f]=T:cn(p)&&cn(m)?a[f]=n(U({},m),p):Array.isArray(p)&&Array.isArray(m)?a[f]=[...m,...p]:a[f]=p}return a}return n(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 n=null,a,u,f,{leading:m=!1,trailing:p=!0}=r,T=()=>(f=e.apply(u,a),a=void 0,u=void 0,f),_=function(...S){a=S,u=this;let g=m&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p&&!g&&T()},t),g)return T()};return _.cancel=()=>{n&&clearTimeout(n),n=null,a=u=void 0},_.flush=()=>{if(n)return clearTimeout(n),n=null,T()},_}function Ni(e,t){return(...r)=>t(e,...r)}function En(e){return t=>Ni(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(a){e(new Oi(`${a}`))}})}function Me(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Ze(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((a,u)=>(a[u]=String(n[u]),a),{})}return e[r]})}function Mi(e){let t=e.location?Ze(e.location,un):null,r=e.target?Ze(e.target,un):null;return Ze(W(U({},e),{location:t,target:r}),Ui)}function ar(e){let t=e.events.map(n=>Mi(n)),r=Ze(e.device,Bi);return[e.protocolVersion,t,r,e.project]}function Yi(e){return new Promise(t=>Sn(e)(t))}function Sn(e){return(t,r=null)=>{let n=!1;return e(a=>{if(!n)return n=!0,t.call(r,a)},null)}}function Qi(e,t){return(r=>{let n,a={onWillAddFirstListener(){n=r(u.fire,u)}},u=new $e(a);return u.event})((r,n=null)=>e(a=>t(a)&&r.call(n,a),null))}function Zi(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ea(e[n],t[n])}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 ae(){if(globalThis[Xt])return globalThis[Xt];let e=new et,t=new er,r={registerCommand(n,a,u){e.registerCommand({id:n,handler:a,metadata:u})},executeCommand(n,...a){return t.executeCommand(n,...a)},excuteCommandSync(n,...a){return t.executeCommandThowErr(n,...a)}};return globalThis[Xt]=r,r}var ln,Ri,Ai,dn,Di,rr,nr,vn,yn,Oi,bn,_n,tt,or,ce,In,Li,ir,je,ke,Fi,un,Ui,Bi,$i,Qe,Vi,ji,Ki,wn,sr,Hi,Gi,Ji,Tn,he,J,qi,Wi,Xe,$e,_e,Zt,zi,Qt,Xi,Ke,et,er,Xt,H=G(()=>{"use strict";ln=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,Ai=(e,t)=>{for(var r in t)ln(e,r,{get:t[r],enumerable:!0})},dn=(e,t,r,n)=>{for(var a=n>1?void 0:n?Ri(t,r):t,u=e.length-1,f;u>=0;u--)(f=e[u])&&(a=(n?f(t,r,a):f(a))||a);return n&&a&&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"}},_n=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},tt=class extends rr{constructor(e,t,r,n,a){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},or=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:Me("log"),warn:Me("warn"),info:Me("info"),error:Me("error"),debug:Me("debug")};Object.assign(globalThis,{logger:ce});In=Symbol.for("Jolibox.canIUseMap"),Li={};globalThis[In]=Li;ir={get config(){return globalThis[In]}},je=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(je||{}),ke=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(ke||{}),Fi=(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))(Fi||{}),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",wn=e=>(localStorage.getItem(e)||localStorage.setItem(e,$i()),localStorage.getItem(e)),sr=()=>wn(ji),Hi=()=>wn(Ki),Gi=e=>e.charAt(0).toUpperCase()+e.slice(1),Ji=()=>{var t;let e=new URLSearchParams(window.location.search);return Gi((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Tn=e=>{let t="JoliboxWebSDK",r=Vi(),n=navigator.language,a=sr(),u=Hi();return`${t} (${Ji()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${a} adid/${u} version/${e||""}`},J=(he=class{constructor(t){this.element=t,this.next=he.Undefined,this.prev=he.Undefined}},he.Undefined=new he(void 0),he),qi=class{constructor(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===J.Undefined}clear(){let e=this._first;for(;e!==J.Undefined;){let t=e.next;e.prev=J.Undefined,e.next=J.Undefined,e=t}this._first=J.Undefined,this._last=J.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new J(e);if(this._first===J.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==J.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==J.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==J.Undefined&&e.next!==J.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===J.Undefined&&e.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):e.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):e.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==J.Undefined;)yield e.element,e=e.next}},Wi=0,Xe=class{constructor(e){this.value=e,this.id=Wi++}},$e=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Xe&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var a,u,f,m,p,T;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new Xe(t);this._listeners?this._listeners instanceof Xe?this._listeners=[this._listeners,n]:this._listeners.push(n):((u=(a=this.options)==null?void 0:a.onWillAddFirstListener)==null||u.call(a,this),this._listeners=n,(m=(f=this.options)==null?void 0:f.onDidFirstListener)==null||m.call(f,this)),(T=(p=this.options)==null?void 0:p.onDidAddListener)==null||T.call(p,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(a){r(a)}}fire(e){this._listeners&&(this._listeners instanceof Xe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},_e=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var u;let r=(u=this.listeners.get(e))!=null?u:new $e,n=f=>t(...f.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let a=this.cachedEventQueue.get(e);if(a)for(;a.size>0;)r.fire(U({event:e},a.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new qi,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},Zt={};Ai(Zt,{None:()=>zi,filter:()=>Qi,once:()=>Sn,toPromise:()=>Yi});zi=()=>{console.log("[Jolibox SDK] None Event")};Qt=Symbol.for("Jolibox.hostEmitter"),Xi=()=>{let e=new _e;return globalThis[Qt]||(globalThis[Qt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Qt]},Ke=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 n=e.handler;e.handler=function(...a){return Zi(a,r),n(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};et=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=ki(3e4)),this._starActivation}executeCommand(e,...t){return L(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Zt.toPromise(Zt.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};er=dn([hn],er);Xt=Symbol.for("Jolibox.commands")});function ue(e,t={}){cr.emit("ERROR_REPORT",{error:e,options:t})}var cr,Ie,Ee=G(()=>{"use strict";H();H();cr=new _e,Ie=new _e;ue.debounce=Ve(ue,50,{leading:!0})});var ur,ta,Rn,An,kn=G(()=>{"use strict";H();Ee();ur=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(a){return{}}},ta=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rn=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[u,f,m]=a;return{headerJson:ur(u),payloadJson:ur(f),signature:ur(m)}}else throw"joli_source is missing"}catch(r){return ue(new bn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},An=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],a=ta(e),u=r[2];return`${n}.${a}.${u}`}return t}});var ra,rt,xn,lr=G(()=>{"use strict";H();ra="1.1.11-beta.7",rt=()=>ra,xn=()=>{let e=rt();return`${Tn(e)}`}});var na,Cn,dr,Pn,Z,oa,A,re=G(()=>{"use strict";H();kn();lr();H();na={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:sr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:rt()},schema:window.location.href,platform:"h5"},dr=(Cn=globalThis.joliboxJSCore)==null?void 0:Cn.env,Z=Object.assign({},(Pn=dr==null?void 0:dr())!=null?Pn:na),oa=()=>{var g,I,P,x,C,D,B,M,ee;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?Rn(Z.schema):{},n=`${Z.deviceInfo.did}-${new Date().getTime()}`,u=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,f=(P=(I=(g=u.get("mpId"))!=null?g:u.get("appId"))!=null?I:u.get("gameId"))!=null?P:"",m=(D=(C=(x=Z.clientSessionId)!=null?x:e==null?void 0:e.sessionId)!=null?C:u.get("sessionId"))!=null?D:n,p=!!((B=e==null?void 0:e.testAdsMode)!=null?B:u.get("testAdsMode")==="true"),T=(ee=(M=e==null?void 0:e.joliboxEnv)!=null?M:u.get("joliboxEnv"))!=null?ee:"production",_=T==="staging",S=t==null?void 0:t.channel;return{get testMode(){return _},get testAdsMode(){return p},get joliboxEnv(){return T},get joliSource(){var $;return($=u.get("joliSource"))!=null?$:null},get mpId(){var $;return($=f!=null?f:e==null?void 0:e.id)!=null?$:""},get mpVersion(){var $;return($=t==null?void 0:t.ver)!=null?$:rt()},get mpType(){var $,w;return(w=($=t==null?void 0:t.__mpType)!=null?$:e==null?void 0:e.__mpType)!=null?w:"game"},get platform(){var $;return($=Z.platform)!=null?$: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 $,w;return(w=($=Z.clientSessionId)!=null?$:m)!=null?w:n},get channel(){return S},get webviewId(){var $;return($=Z.webviewId)!=null?$:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:$=>{pn(Z,$,gn)},encodeJoliSourceQuery:$=>{var w,F;return t&&r?An(U(U({},e),$),(w=u.get("joliSource"))!=null?w:""):(F=u.get("joliSource"))!=null?F:""}}},A=oa()});var fr,On,ia,aa,Dn,sa,Nn=G(()=>{"use strict";H();Ee();re();H();fr=!1,On=(e,t)=>e==null?!1:t in e,ia=e=>On(e,"kind"),aa=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Dn=(e,t={},r)=>{var u,f,m;let n={user_id:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:aa(e.name)},a=W(U({},n),{env:t.environment,isFromUser:r});r?Ie.emit("GLOBAL_USER_ERROR",e,a):Ie.emit("GLOBAL_ERROR",e,a)},sa=e=>On(e,"kind")&&e.kind==="USER_ERROR";cr.on("ERROR_REPORT",({error:e,options:t})=>{if(fr)return;fr=!0;let r=ia(e)&&e.raw?e.raw:e;try{let n=sa(e);Dn(e,t,n)}catch(n){let a=n instanceof Error?n.message:String(n),u=new or(`${a}, origin error: ${r.message}`);ce.error(u),Dn(new or(u.message),{environment:t.environment},!1)}finally{fr=!1}})});var mr,hr=G(()=>{"use strict";Ee();H();Ee();mr=e=>new yn(e)});function Ln(e,t){let r=(n,a,u)=>{let f=W(U({tag:n},t),{extra:U({},a)});n=="globalJsError"?ue(new _n(JSON.stringify(f))):e("systemLog",f,u)};return r.debounce=Ve(r,500,{leading:!0}),r}function Fn(e){let t=(r,n,a)=>{var m;let u=(m=a&&JSON.stringify(a))!=null?m:0,f={speed_value_type:r,total_duration:n};u&&Object.assign(f,{extra:u}),e("joliboxSpeedAnalysis",f)};return t.debounce=Ve(t,500,{leading:!0}),t}var Un=G(()=>{"use strict";H();H();Ee()});function Bn(e,t){let r=Ln(e,t),n=Fn(r);return{track:r,trackPerformance:n}}var Mn=G(()=>{"use strict";Un()});var pr=G(()=>{"use strict"});var nt,$n=G(()=>{"use strict";re();H();H();nt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return L(this,null,function*(){let r=`${A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,a]of Object.entries(r))if(a.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,a,u,f,m;let{nativeSDKVersion:t,jssdkVersion:r}=A.sdkInfo;return{platform:1e3,os:A.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(u=(a=A.hostInfo)==null?void 0:a.aid)!=null?u:"1",model:(f=A.deviceInfo.model)!=null?f:"UnknownModel",brand:(m=A.deviceInfo.brand)!=null?m:"UnknownBrand",uuid:A.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,a)=>{r[a]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return L(this,null,function*(){if(this.checkIsSampled(t))return;let a=t.location?t.location:yield this.getLocation(),u=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,T={protocolVersion:"1.0.0",events:[W(U({},t),{location:a,target:u,extra:f,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(ar(T),n):yield this.doReport(ar(T))}catch(_){ce.log("[Jolibox SDK] report API error",_)}})}}});var gr=G(()=>{"use strict";Mn();pr();$n()});var vr,Vn,pe,ot,ge,He=G(()=>{"use strict";lr();re();vr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Vn=AbortSignal.timeout)!=null||(AbortSignal.timeout=vr);pe=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new ot(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}getNetworkStatus(){return this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}},ot=class{constructor(t){this.xua=xn();this.getJoliSource=()=>A.joliSource;var n;let r=A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com";this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return L(this,null,function*(){try{let{query:n,timeout:a}=r!=null?r:{},{headers:u}=r!=null?r:{},f=n?new URLSearchParams(n):null,m=f==null?void 0:f.toString(),p=`${this.baseUrl}${t}${m?`?${m}`:""}`,T=this.xua,_=this.getJoliSource();u=Object.assign({},u!=null?u:{},T?{"x-user-agent":T}:{},_?{"x-joli-source":_}:{});let S=yield fetch(p,{method:"GET",headers:u,credentials:"include",signal:vr(a!=null?a:3e4)});return pe.getInstance().recordNetworkRequest(!0),yield S.json()}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return L(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),T=`${this.baseUrl}${t}${p?`?${p}`:""}`,_=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},S?{"x-joli-source":S}:{});let g=yield fetch(T,{method:"POST",headers:f,body:JSON.stringify(n),signal:vr(u!=null?u:3e4),credentials:"include"});pe.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(I!=null&&I.includes("multipart/form-data")||I!=null&&I.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return L(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),T=`${this.baseUrl}${t}${p?`?${p}`:""}`,_=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},S?{"x-joli-source":S}:{});let g=yield fetch(T,{method:"PUT",headers:f,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!g.ok)throw pe.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${g.status}`);return pe.getInstance().recordNetworkRequest(!0),yield g.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=ot;ge=pe.getInstance()});var yr,it,br=G(()=>{"use strict";re();gr();He();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=ge.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n,a;let r=(n=this.hostToApiMap[window.location.host])!=null?n:this.hostToApiMap.default;return(a=A.testMode)!=null&&a?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},it=new yr});var ca,jn=G(()=>{"use strict";Nn();H();hr();H();br();re();ca=(e,t)=>{var a,u,f;let r={message:t.message,stack:(a=t.stack)!=null?a:"",errorType:t.name,source:0},n={name:e,type:je.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:null};it.trackEvent(n,ke.WebSDK)};Ie.on("GLOBAL_ERROR",(e,t)=>{ca(t.tag,e)});Ie.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var at,Kn=G(()=>{"use strict";at=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,a,u=!1,f=0,m=()=>{if(!u)return;let I=Date.now(),P=I-r;P>=this.interval&&(this.visible&&(f+=P,t(f)),r=I),n=requestAnimationFrame(m)},p=()=>{_(),r=Date.now(),a=window.setInterval(()=>{if(!u)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},T=()=>{S(),r=Date.now(),n=requestAnimationFrame(m)},_=()=>{n&&(cancelAnimationFrame(n),n=0)},S=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",I=>{u&&(console.log("visible",I),I?T():p())});let g=this.visible;return{start(){u||(u=!0,g?T():p())},stop(){u=!1,_(),S()}}}}});var st,Hn=G(()=>{"use strict";re();Kn();He();st=class extends at{constructor(r,n,a){super(n,a);this.httpClient=ge.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return L(this,null,function*(){let{event:n,params:a}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:U({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,n=null){this.track(r,n)}}});var Gn,ua,de,la,_r,le,we=G(()=>{"use strict";jn();H();H();gr();br();Hn();re();pr();Gn=ae(),ua={type:ke.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:de,trackPerformance:la}=Bn((...e)=>{var f,m,p,T;let[,t]=e,r=t,n=fn(r.extra)?r.extra:tr(r.extra)?JSON.parse(r.extra):{},a=W(U({},n),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(m=r.mp_version)!=null?m:""}),u={name:t.tag,type:je.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(T=(p=A.hostUserInfo)==null?void 0:p.uid)!=null?T:null};it.trackEvent(u,ke.WebSDK)},ua);Gn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{la(e,t,r)});Gn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{de(e,t)});_r=new _e,le=new st(de,_r)});function Jn(e){let t=ir.config[e];return t||(t={},ir.config[e]=t),(r,n)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=U({},n)}}var qn=G(()=>{"use strict";H()});function Er(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 ve(e){return typeof e=="number"}function Ir(e){let t=wr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function wr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Wn,Y,ut,lt,dt,ft,xe,mt,ht,pt,gt,vt,yt,bt,_t,Et,It,wt,Tt,Tr=G(()=>{"use strict";Wn=!1;Y=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 ${Ir(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return ct(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:ct(this._default)}optional(){return this._optional=!0,this}};ut=class extends Y{validate(t){return this._optional&&t===void 0?!0:ve(t)?ve(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ve(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ve(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},lt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},dt=class extends Y{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ve(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ve(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},ft=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},xe=class extends Y{validate(t){return!0}},mt=class extends Y{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ht=class extends Y{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},pt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},gt=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Ir(t)}`)}return!0}},vt=class extends Y{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ve(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ve(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ve(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let a=!0;if(r.forEach((u,f)=>{if(n.path=`${this.path}[${f}]`,n.errors=this.errors,u===void 0&&n.hasDefault){r[f]=n.defaultValue;return}n.validate(u)||(n.hasFallback?r[f]=n.fallbackValue:a=!1)}),this._uniqueItems){let u=new Map;for(let f in r)u.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${u.get(r[f])}] and ${this.path}[${f}] are identical)`):u.set(r[f],f)}return a}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},yt=class extends Y{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(wr(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,u=this._value;u.errors=this.errors;let f=!0;for(let m in a){let p=a[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?u.path=`${this.path}.${m}`:u.path=`${this.path}["${m}"]`,!(p===void 0&&u._optional)){if(p===void 0&&u.hasDefault){a[m]=u.defaultValue;continue}u.validate(p)||(u.hasFallback?a[m]=u.fallbackValue:f=!1)}}return f}},bt=class extends Y{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(wr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,a=!0;for(let u in this._object){let f=n[u],m=this._object[u];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(u)?m.path=`${this.path}.${u}`:m.path=`${this.path}["${u}"]`,!(m._optional&&f===void 0)){if(f===void 0&&m.hasDefault){n[u]=m.defaultValue;continue}m.validate(f)||(m.hasFallback?n[u]=m.fallbackValue:a=!1)}}return a}},_t=class extends Y{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Ir(this.value),actual:r}):!0}},Et=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,a=this._items.length;for(let u=0;u<a;u++){let f=this._items[u];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!n){n=!0;break}}if(!n){let u=r.join(`
|
|
1
|
+
var bi=Object.create;var zt=Object.defineProperty,_i=Object.defineProperties,Ei=Object.getOwnPropertyDescriptor,Ii=Object.getOwnPropertyDescriptors,wi=Object.getOwnPropertyNames,Ye=Object.getOwnPropertySymbols,Ti=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,U=(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)=>_i(e,Ii(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 n in e)Yt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ye)for(var n of Ye(e))t.indexOf(n)<0&&nn.call(e,n)&&(r[n]=e[n]);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 Si=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of wi(t))!Yt.call(e,a)&&a!==r&&zt(e,a,{get:()=>t[a],enumerable:!(n=Ei(t,a))||n.enumerable});return e};var sn=(e,t,r)=>(r=e!=null?bi(Ti(e)):{},Si(t||!e||!e.__esModule?zt(r,"default",{value:e,enumerable:!0}):r,e));var L=(e,t,r)=>new Promise((n,a)=>{var u=p=>{try{m(r.next(p))}catch(T){a(T)}},f=p=>{try{m(r.throw(p))}catch(T){a(T)}},m=p=>p.done?n(p.value):Promise.resolve(p.value).then(u,f);m((r=r.apply(e,t)).next())});function ki(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 xi(e){return typeof e>"u"}function Ci(e){return xi(e)||e===null}function Pi(e){return typeof e=="function"}function hn(e){let t=e,r=null,n=function(...a){return r||(r=new t(...a)),r};return n.prototype=t.prototype,n}function pn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(a,u){for(let f in u)if(Object.prototype.hasOwnProperty.call(u,f)){let m=a[f],p=u[f],T=r(m,p,f,a,u);T!==void 0?a[f]=T:cn(p)&&cn(m)?a[f]=n(U({},m),p):Array.isArray(p)&&Array.isArray(m)?a[f]=[...m,...p]:a[f]=p}return a}return n(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 n=null,a,u,f,{leading:m=!1,trailing:p=!0}=r,T=()=>(f=e.apply(u,a),a=void 0,u=void 0,f),_=function(...S){a=S,u=this;let g=m&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,p&&!g&&T()},t),g)return T()};return _.cancel=()=>{n&&clearTimeout(n),n=null,a=u=void 0},_.flush=()=>{if(n)return clearTimeout(n),n=null,T()},_}function Ni(e,t){return(...r)=>t(e,...r)}function En(e){return t=>Ni(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(a){e(new Oi(`${a}`))}})}function Me(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Ze(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((a,u)=>(a[u]=String(n[u]),a),{})}return e[r]})}function Mi(e){let t=e.location?Ze(e.location,un):null,r=e.target?Ze(e.target,un):null;return Ze(W(U({},e),{location:t,target:r}),Ui)}function ar(e){let t=e.events.map(n=>Mi(n)),r=Ze(e.device,Bi);return[e.protocolVersion,t,r,e.project]}function Yi(e){return new Promise(t=>Sn(e)(t))}function Sn(e){return(t,r=null)=>{let n=!1;return e(a=>{if(!n)return n=!0,t.call(r,a)},null)}}function Qi(e,t){return(r=>{let n,a={onWillAddFirstListener(){n=r(u.fire,u)}},u=new $e(a);return u.event})((r,n=null)=>e(a=>t(a)&&r.call(n,a),null))}function Zi(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ea(e[n],t[n])}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 ae(){if(globalThis[Xt])return globalThis[Xt];let e=new et,t=new er,r={registerCommand(n,a,u){e.registerCommand({id:n,handler:a,metadata:u})},executeCommand(n,...a){return t.executeCommand(n,...a)},excuteCommandSync(n,...a){return t.executeCommandThowErr(n,...a)}};return globalThis[Xt]=r,r}var ln,Ri,Ai,dn,Di,rr,nr,vn,yn,Oi,bn,_n,tt,or,ce,In,Li,ir,je,ke,Fi,un,Ui,Bi,$i,Qe,Vi,ji,Ki,wn,sr,Hi,Gi,Ji,Tn,he,J,qi,Wi,Xe,$e,_e,Zt,zi,Qt,Xi,Ke,et,er,Xt,H=G(()=>{"use strict";ln=Object.defineProperty,Ri=Object.getOwnPropertyDescriptor,Ai=(e,t)=>{for(var r in t)ln(e,r,{get:t[r],enumerable:!0})},dn=(e,t,r,n)=>{for(var a=n>1?void 0:n?Ri(t,r):t,u=e.length-1,f;u>=0;u--)(f=e[u])&&(a=(n?f(t,r,a):f(a))||a);return n&&a&&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"}},_n=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},tt=class extends rr{constructor(e,t,r,n,a){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),a&&(this.priority=a)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},or=class extends nr{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};ce={log:Me("log"),warn:Me("warn"),info:Me("info"),error:Me("error"),debug:Me("debug")};Object.assign(globalThis,{logger:ce});In=Symbol.for("Jolibox.canIUseMap"),Li={};globalThis[In]=Li;ir={get config(){return globalThis[In]}},je=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(je||{}),ke=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(ke||{}),Fi=(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))(Fi||{}),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",wn=e=>(localStorage.getItem(e)||localStorage.setItem(e,$i()),localStorage.getItem(e)),sr=()=>wn(ji),Hi=()=>wn(Ki),Gi=e=>e.charAt(0).toUpperCase()+e.slice(1),Ji=()=>{var t;let e=new URLSearchParams(window.location.search);return Gi((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Tn=e=>{let t="JoliboxWebSDK",r=Vi(),n=navigator.language,a=sr(),u=Hi();return`${t} (${Ji()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${a} adid/${u} version/${e||""}`},J=(he=class{constructor(t){this.element=t,this.next=he.Undefined,this.prev=he.Undefined}},he.Undefined=new he(void 0),he),qi=class{constructor(){this._first=J.Undefined,this._last=J.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===J.Undefined}clear(){let e=this._first;for(;e!==J.Undefined;){let t=e.next;e.prev=J.Undefined,e.next=J.Undefined,e=t}this._first=J.Undefined,this._last=J.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new J(e);if(this._first===J.Undefined)this._first=r,this._last=r;else if(t){let a=this._last;this._last=r,r.prev=a,a.next=r}else{let a=this._first;this._first=r,r.next=a,a.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==J.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==J.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==J.Undefined&&e.next!==J.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===J.Undefined&&e.next===J.Undefined?(this._first=J.Undefined,this._last=J.Undefined):e.next===J.Undefined?(this._last=this._last.prev,this._last.next=J.Undefined):e.prev===J.Undefined&&(this._first=this._first.next,this._first.prev=J.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==J.Undefined;)yield e.element,e=e.next}},Wi=0,Xe=class{constructor(e){this.value=e,this.id=Wi++}},$e=class{constructor(e){this.options=e,this._size=0}dispose(e){var t,r;this._disposed||(this._disposed=!0,this._listeners&&(e?(this._listeners instanceof Xe&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var a,u,f,m,p,T;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new Xe(t);this._listeners?this._listeners instanceof Xe?this._listeners=[this._listeners,n]:this._listeners.push(n):((u=(a=this.options)==null?void 0:a.onWillAddFirstListener)==null||u.call(a,this),this._listeners=n,(m=(f=this.options)==null?void 0:f.onDidFirstListener)==null||m.call(f,this)),(T=(p=this.options)==null?void 0:p.onDidAddListener)==null||T.call(p,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(a){r(a)}}fire(e){this._listeners&&(this._listeners instanceof Xe?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},_e=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var u;let r=(u=this.listeners.get(e))!=null?u:new $e,n=f=>t(...f.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let a=this.cachedEventQueue.get(e);if(a)for(;a.size>0;)r.fire(U({event:e},a.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new qi,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},Zt={};Ai(Zt,{None:()=>zi,filter:()=>Qi,once:()=>Sn,toPromise:()=>Yi});zi=()=>{console.log("[Jolibox SDK] None Event")};Qt=Symbol.for("Jolibox.hostEmitter"),Xi=()=>{let e=new _e;return globalThis[Qt]||(globalThis[Qt]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[Qt]},Ke=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 n=e.handler;e.handler=function(...a){return Zi(a,r),n(...a)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};et=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=ki(3e4)),this._starActivation}executeCommand(e,...t){return L(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Zt.toPromise(Zt.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};er=dn([hn],er);Xt=Symbol.for("Jolibox.commands")});function ue(e,t={}){cr.emit("ERROR_REPORT",{error:e,options:t})}var cr,Ie,Ee=G(()=>{"use strict";H();H();cr=new _e,Ie=new _e;ue.debounce=Ve(ue,50,{leading:!0})});var ur,ta,Rn,An,kn=G(()=>{"use strict";H();Ee();ur=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(a){return{}}},ta=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rn=e=>{var t;try{let a=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(a!=null&&a.length){let[u,f,m]=a;return{headerJson:ur(u),payloadJson:ur(f),signature:ur(m)}}else throw"joli_source is missing"}catch(r){return ue(new bn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},An=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],a=ta(e),u=r[2];return`${n}.${a}.${u}`}return t}});var ra,rt,xn,lr=G(()=>{"use strict";H();ra="1.1.11-beta.9",rt=()=>ra,xn=()=>{let e=rt();return`${Tn(e)}`}});var na,Cn,dr,Pn,Z,oa,A,re=G(()=>{"use strict";H();kn();lr();H();na={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:sr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:rt()},schema:window.location.href,platform:"h5"},dr=(Cn=globalThis.joliboxJSCore)==null?void 0:Cn.env,Z=Object.assign({},(Pn=dr==null?void 0:dr())!=null?Pn:na),oa=()=>{var g,I,P,x,C,D,B,M,ee;let{payloadJson:e,headerJson:t,signature:r}=Z.schema.length?Rn(Z.schema):{},n=`${Z.deviceInfo.did}-${new Date().getTime()}`,u=new URL(Z.schema.length?Z.schema:window.location.href).searchParams,f=(P=(I=(g=u.get("mpId"))!=null?g:u.get("appId"))!=null?I:u.get("gameId"))!=null?P:"",m=(D=(C=(x=Z.clientSessionId)!=null?x:e==null?void 0:e.sessionId)!=null?C:u.get("sessionId"))!=null?D:n,p=!!((B=e==null?void 0:e.testAdsMode)!=null?B:u.get("testAdsMode")==="true"),T=(ee=(M=e==null?void 0:e.joliboxEnv)!=null?M:u.get("joliboxEnv"))!=null?ee:"production",_=T==="staging",S=t==null?void 0:t.channel;return{get testMode(){return _},get testAdsMode(){return p},get joliboxEnv(){return T},get joliSource(){var $;return($=u.get("joliSource"))!=null?$:null},get mpId(){var $;return($=f!=null?f:e==null?void 0:e.id)!=null?$:""},get mpVersion(){var $;return($=t==null?void 0:t.ver)!=null?$:rt()},get mpType(){var $,w;return(w=($=t==null?void 0:t.__mpType)!=null?$:e==null?void 0:e.__mpType)!=null?w:"game"},get platform(){var $;return($=Z.platform)!=null?$: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 $,w;return(w=($=Z.clientSessionId)!=null?$:m)!=null?w:n},get channel(){return S},get webviewId(){var $;return($=Z.webviewId)!=null?$:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:$=>{pn(Z,$,gn)},encodeJoliSourceQuery:$=>{var w,F;return t&&r?An(U(U({},e),$),(w=u.get("joliSource"))!=null?w:""):(F=u.get("joliSource"))!=null?F:""}}},A=oa()});var fr,On,ia,aa,Dn,sa,Nn=G(()=>{"use strict";H();Ee();re();H();fr=!1,On=(e,t)=>e==null?!1:t in e,ia=e=>On(e,"kind"),aa=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Dn=(e,t={},r)=>{var u,f,m;let n={user_id:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:"",device_id:(m=A.deviceInfo.did)!=null?m:"",timestamp:Date.now(),tag:aa(e.name)},a=W(U({},n),{env:t.environment,isFromUser:r});r?Ie.emit("GLOBAL_USER_ERROR",e,a):Ie.emit("GLOBAL_ERROR",e,a)},sa=e=>On(e,"kind")&&e.kind==="USER_ERROR";cr.on("ERROR_REPORT",({error:e,options:t})=>{if(fr)return;fr=!0;let r=ia(e)&&e.raw?e.raw:e;try{let n=sa(e);Dn(e,t,n)}catch(n){let a=n instanceof Error?n.message:String(n),u=new or(`${a}, origin error: ${r.message}`);ce.error(u),Dn(new or(u.message),{environment:t.environment},!1)}finally{fr=!1}})});var mr,hr=G(()=>{"use strict";Ee();H();Ee();mr=e=>new yn(e)});function Ln(e,t){let r=(n,a,u)=>{let f=W(U({tag:n},t),{extra:U({},a)});n=="globalJsError"?ue(new _n(JSON.stringify(f))):e("systemLog",f,u)};return r.debounce=Ve(r,500,{leading:!0}),r}function Fn(e){let t=(r,n,a)=>{var m;let u=(m=a&&JSON.stringify(a))!=null?m:0,f={speed_value_type:r,total_duration:n};u&&Object.assign(f,{extra:u}),e("joliboxSpeedAnalysis",f)};return t.debounce=Ve(t,500,{leading:!0}),t}var Un=G(()=>{"use strict";H();H();Ee()});function Bn(e,t){let r=Ln(e,t),n=Fn(r);return{track:r,trackPerformance:n}}var Mn=G(()=>{"use strict";Un()});var pr=G(()=>{"use strict"});var nt,$n=G(()=>{"use strict";re();H();H();nt=class{constructor(){this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return L(this,null,function*(){let r=`${A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,a]of Object.entries(r))if(a.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,a,u,f,m;let{nativeSDKVersion:t,jssdkVersion:r}=A.sdkInfo;return{platform:1e3,os:A.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(u=(a=A.hostInfo)==null?void 0:a.aid)!=null?u:"1",model:(f=A.deviceInfo.model)!=null?f:"UnknownModel",brand:(m=A.deviceInfo.brand)!=null?m:"UnknownBrand",uuid:A.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,a)=>{r[a]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return L(this,null,function*(){if(this.checkIsSampled(t))return;let a=t.location?t.location:yield this.getLocation(),u=t.target||null,f=t.extra||null;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let m=this.deviceInfo,T={protocolVersion:"1.0.0",events:[W(U({},t),{location:a,target:u,extra:f,timestamp:Date.now(),userId:null})],device:m,project:r};try{n?yield this.doReport(ar(T),n):yield this.doReport(ar(T))}catch(_){ce.log("[Jolibox SDK] report API error",_)}})}}});var gr=G(()=>{"use strict";Mn();pr();$n()});var vr,Vn,pe,ot,ge,He=G(()=>{"use strict";lr();re();vr=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(Vn=AbortSignal.timeout)!=null||(AbortSignal.timeout=vr);pe=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new ot(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}getNetworkStatus(){return this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}},ot=class{constructor(t){this.xua=xn();this.getJoliSource=()=>A.joliSource;var n;let r=A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com";this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return L(this,null,function*(){try{let{query:n,timeout:a}=r!=null?r:{},{headers:u}=r!=null?r:{},f=n?new URLSearchParams(n):null,m=f==null?void 0:f.toString(),p=`${this.baseUrl}${t}${m?`?${m}`:""}`,T=this.xua,_=this.getJoliSource();u=Object.assign({},u!=null?u:{},T?{"x-user-agent":T}:{},_?{"x-joli-source":_}:{});let S=yield fetch(p,{method:"GET",headers:u,credentials:"include",signal:vr(a!=null?a:3e4)});return pe.getInstance().recordNetworkRequest(!0),yield S.json()}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return L(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),T=`${this.baseUrl}${t}${p?`?${p}`:""}`,_=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},S?{"x-joli-source":S}:{});let g=yield fetch(T,{method:"POST",headers:f,body:JSON.stringify(n),signal:vr(u!=null?u:3e4),credentials:"include"});pe.getInstance().recordNetworkRequest(!0);let I=g.headers.get("content-type");if(I!=null&&I.includes("application/octet-stream"))try{return g.blob()}catch(P){return yield g.arrayBuffer()}if(I!=null&&I.includes("multipart/form-data")||I!=null&&I.includes("application/x-www-form-urlencoded"))try{return g.formData()}catch(P){return yield g.text()}if(I!=null&&I.includes("application/json"))try{return yield g.json()}catch(P){return yield g.text()}return g}catch(n){throw pe.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return L(this,null,function*(){try{let{data:n,query:a,timeout:u}=r!=null?r:{},{headers:f}=r!=null?r:{},m=a?new URLSearchParams(a):null,p=m==null?void 0:m.toString(),T=`${this.baseUrl}${t}${p?`?${p}`:""}`,_=this.xua,S=this.getJoliSource();f=Object.assign({},f!=null?f:{},{"Content-Type":"application/json"},_?{"x-user-agent":_}:{},S?{"x-joli-source":S}:{});let g=yield fetch(T,{method:"PUT",headers:f,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!g.ok)throw pe.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${g.status}`);return pe.getInstance().recordNetworkRequest(!0),yield g.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=ot;ge=pe.getInstance()});var yr,it,br=G(()=>{"use strict";re();gr();He();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=ge.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var n,a;let r=(n=this.hostToApiMap[window.location.host])!=null?n:this.hostToApiMap.default;return(a=A.testMode)!=null&&a?r.test:r.prod}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},it=new yr});var ca,jn=G(()=>{"use strict";Nn();H();hr();H();br();re();ca=(e,t)=>{var a,u,f;let r={message:t.message,stack:(a=t.stack)!=null?a:"",errorType:t.name,source:0},n={name:e,type:je.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(f=(u=A.hostUserInfo)==null?void 0:u.uid)!=null?f:null};it.trackEvent(n,ke.WebSDK)};Ie.on("GLOBAL_ERROR",(e,t)=>{ca(t.tag,e)});Ie.on("GLOBAL_USER_ERROR",(e,t)=>{ce.log("UserError",e,t)})});var at,Kn=G(()=>{"use strict";at=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,a,u=!1,f=0,m=()=>{if(!u)return;let I=Date.now(),P=I-r;P>=this.interval&&(this.visible&&(f+=P,t(f)),r=I),n=requestAnimationFrame(m)},p=()=>{_(),r=Date.now(),a=window.setInterval(()=>{if(!u)return;let I=Date.now();I-r>=this.interval&&(r=I)},this.interval)},T=()=>{S(),r=Date.now(),n=requestAnimationFrame(m)},_=()=>{n&&(cancelAnimationFrame(n),n=0)},S=()=>{a&&(clearInterval(a),a=0)};this.eventEmitter.on("visible",I=>{u&&(console.log("visible",I),I?T():p())});let g=this.visible;return{start(){u||(u=!0,g?T():p())},stop(){u=!1,_(),S()}}}}});var st,Hn=G(()=>{"use strict";re();Kn();He();st=class extends at{constructor(r,n,a){super(n,a);this.httpClient=ge.create();this.gameId=A.mpId,this.sessionId=A.sessionId,this.track=r}reporter(r){return L(this,null,function*(){let{event:n,params:a}=r;yield this.httpClient.post("/api/base/app-event",{data:{eventType:n,gameInfo:U({gameId:this.gameId,sessionId:this.sessionId},a)}})})}tracker(r,n=null){this.track(r,n)}}});var Gn,ua,de,la,_r,le,we=G(()=>{"use strict";jn();H();H();gr();br();Hn();re();pr();Gn=ae(),ua={type:ke.WebSDK,platform:"h5",jssdk_version:A.sdkInfo.jssdkVersion,mp_id:A.mpId,mp_version:A.mpVersion},{track:de,trackPerformance:la}=Bn((...e)=>{var f,m,p,T;let[,t]=e,r=t,n=fn(r.extra)?r.extra:tr(r.extra)?JSON.parse(r.extra):{},a=W(U({},n),{mp_id:(f=r.mp_id)!=null?f:"",mp_version:(m=r.mp_version)!=null?m:""}),u={name:t.tag,type:je.System,location:null,target:null,extra:a,timestamp:Date.now(),userId:(T=(p=A.hostUserInfo)==null?void 0:p.uid)!=null?T:null};it.trackEvent(u,ke.WebSDK)},ua);Gn.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{la(e,t,r)});Gn.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{de(e,t)});_r=new _e,le=new st(de,_r)});function Jn(e){let t=ir.config[e];return t||(t={},ir.config[e]=t),(r,n)=>{if(t[r]){ce.warn(`[can i use] ${r} already registered`);return}t[r]=U({},n)}}var qn=G(()=>{"use strict";H()});function Er(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 ve(e){return typeof e=="number"}function Ir(e){let t=wr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function wr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Wn,Y,ut,lt,dt,ft,xe,mt,ht,pt,gt,vt,yt,bt,_t,Et,It,wt,Tt,Tr=G(()=>{"use strict";Wn=!1;Y=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 ${Ir(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return ct(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:ct(this._default)}optional(){return this._optional=!0,this}};ut=class extends Y{validate(t){return this._optional&&t===void 0?!0:ve(t)?ve(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):ve(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):ve(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},lt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},dt=class extends Y{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(ve(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(ve(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},ft=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},xe=class extends Y{validate(t){return!0}},mt=class extends Y{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ht=class extends Y{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},pt=class extends Y{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},gt=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${Ir(t)}`)}return!0}},vt=class extends Y{constructor(r){super();this._item=r}validate(r){if(this._optional&&r===void 0)return!0;if(!Array.isArray(r))return this.fail({expect:"array",actual:r});if(ve(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(ve(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(ve(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let a=!0;if(r.forEach((u,f)=>{if(n.path=`${this.path}[${f}]`,n.errors=this.errors,u===void 0&&n.hasDefault){r[f]=n.defaultValue;return}n.validate(u)||(n.hasFallback?r[f]=n.fallbackValue:a=!1)}),this._uniqueItems){let u=new Map;for(let f in r)u.has(r[f])?a=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${u.get(r[f])}] and ${this.path}[${f}] are identical)`):u.set(r[f],f)}return a}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},yt=class extends Y{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(wr(r)!=="object")return this.fail({expect:"object",actual:r});let a=r,u=this._value;u.errors=this.errors;let f=!0;for(let m in a){let p=a[m];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(m)?u.path=`${this.path}.${m}`:u.path=`${this.path}["${m}"]`,!(p===void 0&&u._optional)){if(p===void 0&&u.hasDefault){a[m]=u.defaultValue;continue}u.validate(p)||(u.hasFallback?a[m]=u.fallbackValue:f=!1)}}return f}},bt=class extends Y{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(wr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,a=!0;for(let u in this._object){let f=n[u],m=this._object[u];if(m.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(u)?m.path=`${this.path}.${u}`:m.path=`${this.path}["${u}"]`,!(m._optional&&f===void 0)){if(f===void 0&&m.hasDefault){n[u]=m.defaultValue;continue}m.validate(f)||(m.hasFallback?n[u]=m.fallbackValue:a=!1)}}return a}},_t=class extends Y{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Ir(this.value),actual:r}):!0}},Et=class extends Y{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,a=this._items.length;for(let u=0;u<a;u++){let f=this._items[u];if(f.errors=[],f.path=this.path,!f.validate(t))r.push(f.errors.join("; "));else if(!n){n=!0;break}}if(!n){let u=r.join(`
|
|
2
2
|
or `);this.errors.push(u)}return n}},It=class extends Y{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let a=t[n];if(a._optional||a.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,t[a]===void 0&&n.hasDefault){t[a]=n.defaultValue;return}n.validate(t[a])||(n.hasFallback?t[a]=n._fallback:r=!1)}),r}},wt=class extends Y{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},Tt=class extends Y{constructor(t){super(),this._ctor=t}validate(t){return t===void 0&&this._optional||t instanceof this._ctor?!0:this.fail({expect:`typedarray of ${this._ctor.name}`,actual:t})}}});function Sr(e,t,r="param"){if(e.errors=[],e.path=r,Er(!0),!e.validate(t)){let n=e.errors.join(`
|
|
3
3
|
`);throw e.errors.length=0,Er(!1),new TypeError(n)}}var k,Rr=G(()=>{"use strict";Tr();Tr();k={object(e){return new bt(e)},array(e){return new vt(e)},tuple(...e){return new It(...e)},literal(e){return new _t(e)},or(...e){return new Et(...e)},symbol(){return new ft},record(e){return new yt(e)},function(){return new pt},boolean(){return new lt},string(){return new dt},number(){return new ut},undefined(){return new mt},null(){return new ht},unknown(){return new xe},any(){return new xe},as(){return new xe},arraybuffer(){return new wt},enum(...e){return new gt(...e)},typedarray(e){return new Tt(e)}}});var St,zn,Yn=G(()=>{"use strict";H();Ee();Rr();hr();St=1,zn=e=>{function t(n,a){return(...u)=>{var S,g,I,P;let f=Date.now(),m={method:n,trace_id:St};St+=1;let p="SUCCESS",T=`${n}:ok`,_=0;try{if(a.paramsSchema)try{Sr(a.paramsSchema,u,"params")}catch(B){throw mr(`${n}:fail ${B.message}`)}let x=a.implement(...u),C=x,D=`${n}:ok`;if(x&&"code"in x){let{code:B,data:M,message:ee}=x;p=B,C=M,D=ee}return{code:p,message:D,data:C}}catch(x){let C=x;_=(g=(S=C.code)!=null?S:C.errNo)!=null?g:2e3,p="FAILURE";let D=(P=(I=C.message)!=null?I:C.errMsg)!=null?P:`${x}`;return T=`${n}:${p} ${D.replace(/^\S+:(fail|cancel)\s?/,"")}`,ue(new tt(T,_)),{code:p,message:T}}finally{let x=Date.now()-f;e("apiInvoked",W(U({},m),{duration:x,status:p}))}}}function r(n,a){return(...u)=>L(this,null,function*(){var g,I,P,x;let f=mn(u)?u:[u],m=Date.now(),p={method:n,trace_id:St};St+=1;let T=`${n}:ok`,_="SUCCESS",S={code:_,message:T};try{if(a.paramsSchema)try{Sr(a.paramsSchema,f,"params")}catch(B){throw mr(B.message)}let D=yield a.implement(...f);if(D&&"code"in D){let{code:B,data:M,message:ee}=D;_=B,T=ee,D=M}return Object.assign(S,{code:_,message:T,data:D}),S}catch(C){let D=C,B=(I=(g=D.code)!=null?g:D.errNo)!=null?I:2e3;_="FAILURE";let M=(x=(P=D.message)!=null?P:D.errMsg)!=null?x:`${C}`,ee=`${n}:${_} ${M.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(S,{code:_,message:ee}),ue(new tt(ee,B)),S}finally{let C=Date.now()-m;e("apiInvoked",W(U({},p),{duration:C,status:_}))}})}return{createAPI:r,createSyncAPI:t}}});var se,Te,Q,Ge=G(()=>{"use strict";qn();we();Yn();Rr();({createAPI:se,createSyncAPI:Te}=zn(de)),Q=Jn("h5")});var eo=an((Zn,Cr)=>{(function(e){if(typeof Zn=="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 n(a,u,f){function m(_,S){if(!u[_]){if(!a[_]){var g=typeof Be=="function"&&Be;if(!S&&g)return g(_,!0);if(p)return p(_,!0);var I=new Error("Cannot find module '"+_+"'");throw I.code="MODULE_NOT_FOUND",I}var P=u[_]={exports:{}};a[_][0].call(P.exports,function(x){var C=a[_][1][x];return m(C||x)},P,P.exports,n,a,u,f)}return u[_].exports}for(var p=typeof Be=="function"&&Be,T=0;T<f.length;T++)m(f[T]);return m}({1:[function(n,a,u){(function(f){"use strict";var m=f.MutationObserver||f.WebKitMutationObserver,p;if(m){var T=0,_=new m(x),S=f.document.createTextNode("");_.observe(S,{characterData:!0}),p=function(){S.data=T=++T%2}}else if(!f.setImmediate&&typeof f.MessageChannel!="undefined"){var g=new f.MessageChannel;g.port1.onmessage=x,p=function(){g.port2.postMessage(0)}}else"document"in f&&"onreadystatechange"in f.document.createElement("script")?p=function(){var D=f.document.createElement("script");D.onreadystatechange=function(){x(),D.onreadystatechange=null,D.parentNode.removeChild(D),D=null},f.document.documentElement.appendChild(D)}:p=function(){setTimeout(x,0)};var I,P=[];function x(){I=!0;for(var D,B,M=P.length;M;){for(B=P,P=[],D=-1;++D<M;)B[D]();M=P.length}I=!1}a.exports=C;function C(D){P.push(D)===1&&!I&&p()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,a,u){"use strict";var f=n(1);function m(){}var p={},T=["REJECTED"],_=["FULFILLED"],S=["PENDING"];a.exports=g;function g(w){if(typeof w!="function")throw new TypeError("resolver must be a function");this.state=S,this.queue=[],this.outcome=void 0,w!==m&&C(this,w)}g.prototype.catch=function(w){return this.then(null,w)},g.prototype.then=function(w,F){if(typeof w!="function"&&this.state===_||typeof F!="function"&&this.state===T)return this;var N=new this.constructor(m);if(this.state!==S){var K=this.state===_?w:F;P(N,K,this.outcome)}else this.queue.push(new I(N,w,F));return N};function I(w,F,N){this.promise=w,typeof F=="function"&&(this.onFulfilled=F,this.callFulfilled=this.otherCallFulfilled),typeof N=="function"&&(this.onRejected=N,this.callRejected=this.otherCallRejected)}I.prototype.callFulfilled=function(w){p.resolve(this.promise,w)},I.prototype.otherCallFulfilled=function(w){P(this.promise,this.onFulfilled,w)},I.prototype.callRejected=function(w){p.reject(this.promise,w)},I.prototype.otherCallRejected=function(w){P(this.promise,this.onRejected,w)};function P(w,F,N){f(function(){var K;try{K=F(N)}catch(X){return p.reject(w,X)}K===w?p.reject(w,new TypeError("Cannot resolve promise with itself")):p.resolve(w,K)})}p.resolve=function(w,F){var N=D(x,F);if(N.status==="error")return p.reject(w,N.value);var K=N.value;if(K)C(w,K);else{w.state=_,w.outcome=F;for(var X=-1,te=w.queue.length;++X<te;)w.queue[X].callFulfilled(F)}return w},p.reject=function(w,F){w.state=T,w.outcome=F;for(var N=-1,K=w.queue.length;++N<K;)w.queue[N].callRejected(F);return w};function x(w){var F=w&&w.then;if(w&&(typeof w=="object"||typeof w=="function")&&typeof F=="function")return function(){F.apply(w,arguments)}}function C(w,F){var N=!1;function K(oe){N||(N=!0,p.reject(w,oe))}function X(oe){N||(N=!0,p.resolve(w,oe))}function te(){F(X,K)}var ne=D(te);ne.status==="error"&&K(ne.value)}function D(w,F){var N={};try{N.value=w(F),N.status="success"}catch(K){N.status="error",N.value=K}return N}g.resolve=B;function B(w){return w instanceof this?w:p.resolve(new this(m),w)}g.reject=M;function M(w){var F=new this(m);return p.reject(F,w)}g.all=ee;function ee(w){var F=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=w.length,K=!1;if(!N)return this.resolve([]);for(var X=new Array(N),te=0,ne=-1,oe=new this(m);++ne<N;)fe(w[ne],ne);return oe;function fe(Le,qe){F.resolve(Le).then(Mt,function(Re){K||(K=!0,p.reject(oe,Re))});function Mt(Re){X[qe]=Re,++te===N&&!K&&(K=!0,p.resolve(oe,X))}}}g.race=$;function $(w){var F=this;if(Object.prototype.toString.call(w)!=="[object Array]")return this.reject(new TypeError("must be an array"));var N=w.length,K=!1;if(!N)return this.resolve([]);for(var X=-1,te=new this(m);++X<N;)ne(w[X]);return te;function ne(oe){F.resolve(oe).then(function(fe){K||(K=!0,p.resolve(te,fe))},function(fe){K||(K=!0,p.reject(te,fe))})}}},{1:1}],3:[function(n,a,u){(function(f){"use strict";typeof f.Promise!="function"&&(f.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,a,u){"use strict";var f=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o};function m(o,s){if(!(o instanceof s))throw new TypeError("Cannot call a class as a function")}function p(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(o){return}}var T=p();function _(){try{if(!T||!T.open)return!1;var o=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),s=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!o||s)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(i){return!1}}function S(o,s){o=o||[],s=s||{};try{return new Blob(o,s)}catch(c){if(c.name!=="TypeError")throw c;for(var i=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,l=new i,d=0;d<o.length;d+=1)l.append(o[d]);return l.getBlob(s.type)}}typeof Promise=="undefined"&&n(3);var g=Promise;function I(o,s){s&&o.then(function(i){s(null,i)},function(i){s(i)})}function P(o,s,i){typeof s=="function"&&o.then(s),typeof i=="function"&&o.catch(i)}function x(o){return typeof o!="string"&&(console.warn(o+" used as a key, but it is not a string."),o=String(o)),o}function C(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var D="local-forage-detect-blob-support",B=void 0,M={},ee=Object.prototype.toString,$="readonly",w="readwrite";function F(o){for(var s=o.length,i=new ArrayBuffer(s),l=new Uint8Array(i),d=0;d<s;d++)l[d]=o.charCodeAt(d);return i}function N(o){return new g(function(s){var i=o.transaction(D,w),l=S([""]);i.objectStore(D).put(l,"key"),i.onabort=function(d){d.preventDefault(),d.stopPropagation(),s(!1)},i.oncomplete=function(){var d=navigator.userAgent.match(/Chrome\/(\d+)/),c=navigator.userAgent.match(/Edge\//);s(c||!d||parseInt(d[1],10)>=43)}}).catch(function(){return!1})}function K(o){return typeof B=="boolean"?g.resolve(B):N(o).then(function(s){return B=s,B})}function X(o){var s=M[o.name],i={};i.promise=new g(function(l,d){i.resolve=l,i.reject=d}),s.deferredOperations.push(i),s.dbReady?s.dbReady=s.dbReady.then(function(){return i.promise}):s.dbReady=i.promise}function te(o){var s=M[o.name],i=s.deferredOperations.pop();if(i)return i.resolve(),i.promise}function ne(o,s){var i=M[o.name],l=i.deferredOperations.pop();if(l)return l.reject(s),l.promise}function oe(o,s){return new g(function(i,l){if(M[o.name]=M[o.name]||Fr(),o.db)if(s)X(o),o.db.close();else return i(o.db);var d=[o.name];s&&d.push(o.version);var c=T.open.apply(T,d);s&&(c.onupgradeneeded=function(h){var v=c.result;try{v.createObjectStore(o.storeName),h.oldVersion<=1&&v.createObjectStore(D)}catch(y){if(y.name==="ConstraintError")console.warn('The database "'+o.name+'" has been upgraded from version '+h.oldVersion+" to version "+h.newVersion+', but the storage "'+o.storeName+'" already exists.');else throw y}}),c.onerror=function(h){h.preventDefault(),l(c.error)},c.onsuccess=function(){var h=c.result;h.onversionchange=function(v){v.target.close()},i(h),te(o)}})}function fe(o){return oe(o,!1)}function Le(o){return oe(o,!0)}function qe(o,s){if(!o.db)return!0;var i=!o.db.objectStoreNames.contains(o.storeName),l=o.version<o.db.version,d=o.version>o.db.version;if(l&&(o.version!==s&&console.warn('The database "'+o.name+`" can't be downgraded from version `+o.db.version+" to version "+o.version+"."),o.version=o.db.version),d||i){if(i){var c=o.db.version+1;c>o.version&&(o.version=c)}return!0}return!1}function Mt(o){return new g(function(s,i){var l=new FileReader;l.onerror=i,l.onloadend=function(d){var c=btoa(d.target.result||"");s({__local_forage_encoded_blob:!0,data:c,type:o.type})},l.readAsBinaryString(o)})}function Re(o){var s=F(atob(o.data));return S([s],{type:o.type})}function Lr(o){return o&&o.__local_forage_encoded_blob}function _o(o){var s=this,i=s._initReady().then(function(){var l=M[s._dbInfo.name];if(l&&l.dbReady)return l.dbReady});return P(i,o,o),i}function Eo(o){X(o);for(var s=M[o.name],i=s.forages,l=0;l<i.length;l++){var d=i[l];d._dbInfo.db&&(d._dbInfo.db.close(),d._dbInfo.db=null)}return o.db=null,fe(o).then(function(c){return o.db=c,qe(o)?Le(o):c}).then(function(c){o.db=s.db=c;for(var h=0;h<i.length;h++)i[h]._dbInfo.db=c}).catch(function(c){throw ne(o,c),c})}function me(o,s,i,l){l===void 0&&(l=1);try{var d=o.db.transaction(o.storeName,s);i(null,d)}catch(c){if(l>0&&(!o.db||c.name==="InvalidStateError"||c.name==="NotFoundError"))return g.resolve().then(function(){if(!o.db||c.name==="NotFoundError"&&!o.db.objectStoreNames.contains(o.storeName)&&o.version<=o.db.version)return o.db&&(o.version=o.db.version+1),Le(o)}).then(function(){return Eo(o).then(function(){me(o,s,i,l-1)})}).catch(i);i(c)}}function Fr(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Io(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=o[l];var d=M[i.name];d||(d=Fr(),M[i.name]=d),d.forages.push(s),s._initReady||(s._initReady=s.ready,s.ready=_o);var c=[];function h(){return g.resolve()}for(var v=0;v<d.forages.length;v++){var y=d.forages[v];y!==s&&c.push(y._initReady().catch(h))}var b=d.forages.slice(0);return g.all(c).then(function(){return i.db=d.db,fe(i)}).then(function(E){return i.db=E,qe(i,s._defaultConfig.version)?Le(i):E}).then(function(E){i.db=d.db=E,s._dbInfo=i;for(var R=0;R<b.length;R++){var O=b[R];O!==s&&(O._dbInfo.db=i.db,O._dbInfo.version=i.version)}})}function wo(o,s){var i=this;o=x(o);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,$,function(h,v){if(h)return c(h);try{var y=v.objectStore(i._dbInfo.storeName),b=y.get(o);b.onsuccess=function(){var E=b.result;E===void 0&&(E=null),Lr(E)&&(E=Re(E)),d(E)},b.onerror=function(){c(b.error)}}catch(E){c(E)}})}).catch(c)});return I(l,s),l}function To(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,$,function(h,v){if(h)return c(h);try{var y=v.objectStore(i._dbInfo.storeName),b=y.openCursor(),E=1;b.onsuccess=function(){var R=b.result;if(R){var O=R.value;Lr(O)&&(O=Re(O));var V=o(O,R.key,E++);V!==void 0?d(V):R.continue()}else d()},b.onerror=function(){c(b.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function So(o,s,i){var l=this;o=x(o);var d=new g(function(c,h){var v;l.ready().then(function(){return v=l._dbInfo,ee.call(s)==="[object Blob]"?K(v.db).then(function(y){return y?s:Mt(s)}):s}).then(function(y){me(l._dbInfo,w,function(b,E){if(b)return h(b);try{var R=E.objectStore(l._dbInfo.storeName);y===null&&(y=void 0);var O=R.put(y,o);E.oncomplete=function(){y===void 0&&(y=null),c(y)},E.onabort=E.onerror=function(){var V=O.error?O.error:O.transaction.error;h(V)}}catch(V){h(V)}})}).catch(h)});return I(d,i),d}function Ro(o,s){var i=this;o=x(o);var l=new g(function(d,c){i.ready().then(function(){me(i._dbInfo,w,function(h,v){if(h)return c(h);try{var y=v.objectStore(i._dbInfo.storeName),b=y.delete(o);v.oncomplete=function(){d()},v.onerror=function(){c(b.error)},v.onabort=function(){var E=b.error?b.error:b.transaction.error;c(E)}}catch(E){c(E)}})}).catch(c)});return I(l,s),l}function Ao(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,w,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),y=v.clear();h.oncomplete=function(){l()},h.onabort=h.onerror=function(){var b=y.error?y.error:y.transaction.error;d(b)}}catch(b){d(b)}})}).catch(d)});return I(i,o),i}function ko(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,$,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),y=v.count();y.onsuccess=function(){l(y.result)},y.onerror=function(){d(y.error)}}catch(b){d(b)}})}).catch(d)});return I(i,o),i}function xo(o,s){var i=this,l=new g(function(d,c){if(o<0){d(null);return}i.ready().then(function(){me(i._dbInfo,$,function(h,v){if(h)return c(h);try{var y=v.objectStore(i._dbInfo.storeName),b=!1,E=y.openKeyCursor();E.onsuccess=function(){var R=E.result;if(!R){d(null);return}o===0||b?d(R.key):(b=!0,R.advance(o))},E.onerror=function(){c(E.error)}}catch(R){c(R)}})}).catch(c)});return I(l,s),l}function Co(o){var s=this,i=new g(function(l,d){s.ready().then(function(){me(s._dbInfo,$,function(c,h){if(c)return d(c);try{var v=h.objectStore(s._dbInfo.storeName),y=v.openKeyCursor(),b=[];y.onsuccess=function(){var E=y.result;if(!E){l(b);return}b.push(E.key),E.continue()},y.onerror=function(){d(y.error)}}catch(E){d(E)}})}).catch(d)});return I(i,o),i}function Po(o,s){s=C.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;if(!o.name)d=g.reject("Invalid arguments");else{var c=o.name===i.name&&l._dbInfo.db,h=c?g.resolve(l._dbInfo.db):fe(o).then(function(v){var y=M[o.name],b=y.forages;y.db=v;for(var E=0;E<b.length;E++)b[E]._dbInfo.db=v;return v});o.storeName?d=h.then(function(v){if(v.objectStoreNames.contains(o.storeName)){var y=v.version+1;X(o);var b=M[o.name],E=b.forages;v.close();for(var R=0;R<E.length;R++){var O=E[R];O._dbInfo.db=null,O._dbInfo.version=y}var V=new g(function(j,z){var q=T.open(o.name,y);q.onerror=function(ie){var Ue=q.result;Ue.close(),z(ie)},q.onupgradeneeded=function(){var ie=q.result;ie.deleteObjectStore(o.storeName)},q.onsuccess=function(){var ie=q.result;ie.close(),j(ie)}});return V.then(function(j){b.db=j;for(var z=0;z<E.length;z++){var q=E[z];q._dbInfo.db=j,te(q._dbInfo)}}).catch(function(j){throw(ne(o,j)||g.resolve()).catch(function(){}),j})}}):d=h.then(function(v){X(o);var y=M[o.name],b=y.forages;v.close();for(var E=0;E<b.length;E++){var R=b[E];R._dbInfo.db=null}var O=new g(function(V,j){var z=T.deleteDatabase(o.name);z.onerror=function(){var q=z.result;q&&q.close(),j(z.error)},z.onblocked=function(){console.warn('dropInstance blocked for database "'+o.name+'" until all open connections are closed')},z.onsuccess=function(){var q=z.result;q&&q.close(),V(q)}});return O.then(function(V){y.db=V;for(var j=0;j<b.length;j++){var z=b[j];te(z._dbInfo)}}).catch(function(V){throw(ne(o,V)||g.resolve()).catch(function(){}),V})})}return I(d,s),d}var Do={_driver:"asyncStorage",_initStorage:Io,_support:_(),iterate:To,getItem:wo,setItem:So,removeItem:Ro,clear:Ao,length:ko,key:xo,keys:Co,dropInstance:Po};function Oo(){return typeof openDatabase=="function"}var ye="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",No="~~local_forage_type~",Ur=/^~~local_forage_type~([^~]+)~/,We="__lfsc__:",$t=We.length,Vt="arbf",jt="blob",Br="si08",Mr="ui08",$r="uic8",Vr="si16",jr="si32",Kr="ur16",Hr="ui32",Gr="fl32",Jr="fl64",qr=$t+Vt.length,Wr=Object.prototype.toString;function zr(o){var s=o.length*.75,i=o.length,l,d=0,c,h,v,y;o[o.length-1]==="="&&(s--,o[o.length-2]==="="&&s--);var b=new ArrayBuffer(s),E=new Uint8Array(b);for(l=0;l<i;l+=4)c=ye.indexOf(o[l]),h=ye.indexOf(o[l+1]),v=ye.indexOf(o[l+2]),y=ye.indexOf(o[l+3]),E[d++]=c<<2|h>>4,E[d++]=(h&15)<<4|v>>2,E[d++]=(v&3)<<6|y&63;return b}function Kt(o){var s=new Uint8Array(o),i="",l;for(l=0;l<s.length;l+=3)i+=ye[s[l]>>2],i+=ye[(s[l]&3)<<4|s[l+1]>>4],i+=ye[(s[l+1]&15)<<2|s[l+2]>>6],i+=ye[s[l+2]&63];return s.length%3===2?i=i.substring(0,i.length-1)+"=":s.length%3===1&&(i=i.substring(0,i.length-2)+"=="),i}function Lo(o,s){var i="";if(o&&(i=Wr.call(o)),o&&(i==="[object ArrayBuffer]"||o.buffer&&Wr.call(o.buffer)==="[object ArrayBuffer]")){var l,d=We;o instanceof ArrayBuffer?(l=o,d+=Vt):(l=o.buffer,i==="[object Int8Array]"?d+=Br:i==="[object Uint8Array]"?d+=Mr:i==="[object Uint8ClampedArray]"?d+=$r:i==="[object Int16Array]"?d+=Vr:i==="[object Uint16Array]"?d+=Kr:i==="[object Int32Array]"?d+=jr:i==="[object Uint32Array]"?d+=Hr:i==="[object Float32Array]"?d+=Gr:i==="[object Float64Array]"?d+=Jr:s(new Error("Failed to get type for BinaryArray"))),s(d+Kt(l))}else if(i==="[object Blob]"){var c=new FileReader;c.onload=function(){var h=No+o.type+"~"+Kt(this.result);s(We+jt+h)},c.readAsArrayBuffer(o)}else try{s(JSON.stringify(o))}catch(h){console.error("Couldn't convert value into a JSON string: ",o),s(null,h)}}function Fo(o){if(o.substring(0,$t)!==We)return JSON.parse(o);var s=o.substring(qr),i=o.substring($t,qr),l;if(i===jt&&Ur.test(s)){var d=s.match(Ur);l=d[1],s=s.substring(d[0].length)}var c=zr(s);switch(i){case Vt:return c;case jt:return S([c],{type:l});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 Hr:return new Uint32Array(c);case Gr:return new Float32Array(c);case Jr:return new Float64Array(c);default:throw new Error("Unkown type: "+i)}}var Ht={serialize:Lo,deserialize:Fo,stringToBuffer:zr,bufferToString:Kt};function Yr(o,s,i,l){o.executeSql("CREATE TABLE IF NOT EXISTS "+s.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],i,l)}function Uo(o){var s=this,i={db:null};if(o)for(var l in o)i[l]=typeof o[l]!="string"?o[l].toString():o[l];var d=new g(function(c,h){try{i.db=openDatabase(i.name,String(i.version),i.description,i.size)}catch(v){return h(v)}i.db.transaction(function(v){Yr(v,i,function(){s._dbInfo=i,c()},function(y,b){h(b)})},h)});return i.serializer=Ht,d}function be(o,s,i,l,d,c){o.executeSql(i,l,d,function(h,v){v.code===v.SYNTAX_ERR?h.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[s.storeName],function(y,b){b.rows.length?c(y,v):Yr(y,s,function(){y.executeSql(i,l,d,c)},c)},c):c(h,v)},c)}function Bo(o,s){var i=this;o=x(o);var l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){be(v,h,"SELECT * FROM "+h.storeName+" WHERE key = ? LIMIT 1",[o],function(y,b){var E=b.rows.length?b.rows.item(0).value:null;E&&(E=h.serializer.deserialize(E)),d(E)},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Mo(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){be(v,h,"SELECT * FROM "+h.storeName,[],function(y,b){for(var E=b.rows,R=E.length,O=0;O<R;O++){var V=E.item(O),j=V.value;if(j&&(j=h.serializer.deserialize(j)),j=o(j,V.key,O+1),j!==void 0){d(j);return}}d()},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Qr(o,s,i,l){var d=this;o=x(o);var c=new g(function(h,v){d.ready().then(function(){s===void 0&&(s=null);var y=s,b=d._dbInfo;b.serializer.serialize(s,function(E,R){R?v(R):b.db.transaction(function(O){be(O,b,"INSERT OR REPLACE INTO "+b.storeName+" (key, value) VALUES (?, ?)",[o,E],function(){h(y)},function(V,j){v(j)})},function(O){if(O.code===O.QUOTA_ERR){if(l>0){h(Qr.apply(d,[o,y,i,l-1]));return}v(O)}})})}).catch(v)});return I(c,i),c}function $o(o,s,i){return Qr.apply(this,[o,s,i,1])}function Vo(o,s){var i=this;o=x(o);var l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){be(v,h,"DELETE FROM "+h.storeName+" WHERE key = ?",[o],function(){d()},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function jo(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){be(h,c,"DELETE FROM "+c.storeName,[],function(){l()},function(v,y){d(y)})})}).catch(d)});return I(i,o),i}function Ko(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){be(h,c,"SELECT COUNT(key) as c FROM "+c.storeName,[],function(v,y){var b=y.rows.item(0).c;l(b)},function(v,y){d(y)})})}).catch(d)});return I(i,o),i}function Ho(o,s){var i=this,l=new g(function(d,c){i.ready().then(function(){var h=i._dbInfo;h.db.transaction(function(v){be(v,h,"SELECT key FROM "+h.storeName+" WHERE id = ? LIMIT 1",[o+1],function(y,b){var E=b.rows.length?b.rows.item(0).key:null;d(E)},function(y,b){c(b)})})}).catch(c)});return I(l,s),l}function Go(o){var s=this,i=new g(function(l,d){s.ready().then(function(){var c=s._dbInfo;c.db.transaction(function(h){be(h,c,"SELECT key FROM "+c.storeName,[],function(v,y){for(var b=[],E=0;E<y.rows.length;E++)b.push(y.rows.item(E).key);l(b)},function(v,y){d(y)})})}).catch(d)});return I(i,o),i}function Jo(o){return new g(function(s,i){o.transaction(function(l){l.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(d,c){for(var h=[],v=0;v<c.rows.length;v++)h.push(c.rows.item(v).name);s({db:o,storeNames:h})},function(d,c){i(c)})},function(l){i(l)})})}function qo(o,s){s=C.apply(this,arguments);var i=this.config();o=typeof o!="function"&&o||{},o.name||(o.name=o.name||i.name,o.storeName=o.storeName||i.storeName);var l=this,d;return o.name?d=new g(function(c){var h;o.name===i.name?h=l._dbInfo.db:h=openDatabase(o.name,"","",0),o.storeName?c({db:h,storeNames:[o.storeName]}):c(Jo(h))}).then(function(c){return new g(function(h,v){c.db.transaction(function(y){function b(V){return new g(function(j,z){y.executeSql("DROP TABLE IF EXISTS "+V,[],function(){j()},function(q,ie){z(ie)})})}for(var E=[],R=0,O=c.storeNames.length;R<O;R++)E.push(b(c.storeNames[R]));g.all(E).then(function(){h()}).catch(function(V){v(V)})},function(y){v(y)})})}):d=g.reject("Invalid arguments"),I(d,s),d}var Wo={_driver:"webSQLStorage",_initStorage:Uo,_support:Oo(),iterate:Mo,getItem:Bo,setItem:$o,removeItem:Vo,clear:jo,length:Ko,key:Ho,keys:Go,dropInstance:qo};function zo(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(o){return!1}}function Xr(o,s){var i=o.name+"/";return o.storeName!==s.storeName&&(i+=o.storeName+"/"),i}function Yo(){var o="_localforage_support_test";try{return localStorage.setItem(o,!0),localStorage.removeItem(o),!1}catch(s){return!0}}function Qo(){return!Yo()||localStorage.length>0}function Xo(o){var s=this,i={};if(o)for(var l in o)i[l]=o[l];return i.keyPrefix=Xr(o,s._defaultConfig),Qo()?(s._dbInfo=i,i.serializer=Ht,g.resolve()):g.reject()}function Zo(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo.keyPrefix,d=localStorage.length-1;d>=0;d--){var c=localStorage.key(d);c.indexOf(l)===0&&localStorage.removeItem(c)}});return I(i,o),i}function ei(o,s){var i=this;o=x(o);var l=i.ready().then(function(){var d=i._dbInfo,c=localStorage.getItem(d.keyPrefix+o);return c&&(c=d.serializer.deserialize(c)),c});return I(l,s),l}function ti(o,s){var i=this,l=i.ready().then(function(){for(var d=i._dbInfo,c=d.keyPrefix,h=c.length,v=localStorage.length,y=1,b=0;b<v;b++){var E=localStorage.key(b);if(E.indexOf(c)===0){var R=localStorage.getItem(E);if(R&&(R=d.serializer.deserialize(R)),R=o(R,E.substring(h),y++),R!==void 0)return R}}});return I(l,s),l}function ri(o,s){var i=this,l=i.ready().then(function(){var d=i._dbInfo,c;try{c=localStorage.key(o)}catch(h){c=null}return c&&(c=c.substring(d.keyPrefix.length)),c});return I(l,s),l}function ni(o){var s=this,i=s.ready().then(function(){for(var l=s._dbInfo,d=localStorage.length,c=[],h=0;h<d;h++){var v=localStorage.key(h);v.indexOf(l.keyPrefix)===0&&c.push(v.substring(l.keyPrefix.length))}return c});return I(i,o),i}function oi(o){var s=this,i=s.keys().then(function(l){return l.length});return I(i,o),i}function ii(o,s){var i=this;o=x(o);var l=i.ready().then(function(){var d=i._dbInfo;localStorage.removeItem(d.keyPrefix+o)});return I(l,s),l}function ai(o,s,i){var l=this;o=x(o);var d=l.ready().then(function(){s===void 0&&(s=null);var c=s;return new g(function(h,v){var y=l._dbInfo;y.serializer.serialize(s,function(b,E){if(E)v(E);else try{localStorage.setItem(y.keyPrefix+o,b),h(c)}catch(R){(R.name==="QuotaExceededError"||R.name==="NS_ERROR_DOM_QUOTA_REACHED")&&v(R),v(R)}})})});return I(d,i),d}function si(o,s){if(s=C.apply(this,arguments),o=typeof o!="function"&&o||{},!o.name){var i=this.config();o.name=o.name||i.name,o.storeName=o.storeName||i.storeName}var l=this,d;return o.name?d=new g(function(c){o.storeName?c(Xr(o,l._defaultConfig)):c(o.name+"/")}).then(function(c){for(var h=localStorage.length-1;h>=0;h--){var v=localStorage.key(h);v.indexOf(c)===0&&localStorage.removeItem(v)}}):d=g.reject("Invalid arguments"),I(d,s),d}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 l=s.length,d=0;d<l;){if(ui(s[d],i))return!0;d++}return!1},Zr=Array.isArray||function(o){return Object.prototype.toString.call(o)==="[object Array]"},Fe={},en={},Ae={INDEXEDDB:Do,WEBSQL:Wo,LOCALSTORAGE:ci},di=[Ae.INDEXEDDB._driver,Ae.WEBSQL._driver,Ae.LOCALSTORAGE._driver],ze=["dropInstance"],Gt=["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(o,s){o[s]=function(){var i=arguments;return o.ready().then(function(){return o[s].apply(o,i)})}}function Jt(){for(var o=1;o<arguments.length;o++){var s=arguments[o];if(s)for(var i in s)s.hasOwnProperty(i)&&(Zr(s[i])?arguments[0][i]=s[i].slice():arguments[0][i]=s[i])}return arguments[0]}var hi=function(){function o(s){m(this,o);for(var i in Ae)if(Ae.hasOwnProperty(i)){var l=Ae[i],d=l._driver;this[i]=d,Fe[d]||this.defineDriver(l)}this._defaultConfig=Jt({},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 o.prototype.config=function(i){if((typeof i=="undefined"?"undefined":f(i))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var l in i){if(l==="storeName"&&(i[l]=i[l].replace(/\W/g,"_")),l==="version"&&typeof i[l]!="number")return new Error("Database version must be a number.");this._config[l]=i[l]}return"driver"in i&&i.driver?this.setDriver(this._config.driver):!0}else return typeof i=="string"?this._config[i]:this._config},o.prototype.defineDriver=function(i,l,d){var c=new g(function(h,v){try{var y=i._driver,b=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!i._driver){v(b);return}for(var E=Gt.concat("_initStorage"),R=0,O=E.length;R<O;R++){var V=E[R],j=!li(ze,V);if((j||i[V])&&typeof i[V]!="function"){v(b);return}}var z=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 I(tn,arguments[arguments.length-1]),tn}},qt=0,gi=ze.length;qt<gi;qt++){var Wt=ze[qt];i[Wt]||(i[Wt]=Ue(Wt))}};z();var q=function(Ue){Fe[y]&&console.info("Redefining LocalForage driver: "+y),Fe[y]=i,en[y]=Ue,h()};"_support"in i?i._support&&typeof i._support=="function"?i._support().then(q,v):q(!!i._support):q(!0)}catch(ie){v(ie)}});return P(c,l,d),c},o.prototype.driver=function(){return this._driver||null},o.prototype.getDriver=function(i,l,d){var c=Fe[i]?g.resolve(Fe[i]):g.reject(new Error("Driver not found."));return P(c,l,d),c},o.prototype.getSerializer=function(i){var l=g.resolve(Ht);return P(l,i),l},o.prototype.ready=function(i){var l=this,d=l._driverSet.then(function(){return l._ready===null&&(l._ready=l._initDriver()),l._ready});return P(d,i,i),d},o.prototype.setDriver=function(i,l,d){var c=this;Zr(i)||(i=[i]);var h=this._getSupportedDrivers(i);function v(){c._config.driver=c.driver()}function y(R){return c._extend(R),v(),c._ready=c._initStorage(c._config),c._ready}function b(R){return function(){var O=0;function V(){for(;O<R.length;){var j=R[O];return O++,c._dbInfo=null,c._ready=null,c.getDriver(j).then(y).catch(V)}v();var z=new Error("No available storage method found.");return c._driverSet=g.reject(z),c._driverSet}return V()}}var E=this._driverSet!==null?this._driverSet.catch(function(){return g.resolve()}):g.resolve();return this._driverSet=E.then(function(){var R=h[0];return c._dbInfo=null,c._ready=null,c.getDriver(R).then(function(O){c._driver=O._driver,v(),c._wrapLibraryMethodsWithReady(),c._initDriver=b(h)})}).catch(function(){v();var R=new Error("No available storage method found.");return c._driverSet=g.reject(R),c._driverSet}),P(this._driverSet,l,d),this._driverSet},o.prototype.supports=function(i){return!!en[i]},o.prototype._extend=function(i){Jt(this,i)},o.prototype._getSupportedDrivers=function(i){for(var l=[],d=0,c=i.length;d<c;d++){var h=i[d];this.supports(h)&&l.push(h)}return l},o.prototype._wrapLibraryMethodsWithReady=function(){for(var i=0,l=Gt.length;i<l;i++)mi(this,Gt[i])},o.prototype.createInstance=function(i){return new o(i)},o}(),pi=new hi;a.exports=pi},{3:3}]},{},[4])(4)})});var ro=an(Se=>{"use strict";H();Ge();we();var Ce=ae(),ka=se("levelFinished",{paramsSchema:k.tuple(k.string(),k.object({result:k.boolean(),duration:k.number()})),implement:(e,t)=>L(Se,null,function*(){let{result:r,duration:n}=t;ce.info("onLevelFinished",r,n),yield Promise.all([le.reporter({event:"COMPLETE_GAME_LEVEL"}),le.tracker("LevelFinished",{levelId:e,result:r,duration:n})])})}),xa=se("taskFinished",{paramsSchema:k.tuple(k.string(),k.object({duration:k.number()})),implement:(e,t)=>L(Se,null,function*(){let{duration:r}=t;yield le.tracker("TaskFinished",{duration:r,taskId:e})})}),Ca=se("levelUpgrade",{paramsSchema:k.tuple(k.string(),k.string()),implement:(e,t)=>L(Se,null,function*(){return yield le.tracker("LevelUpgrade",{name:t,levelId:e})})}),Pa=se("onHistoryUserLevel",{paramsSchema:k.tuple(k.number()),implement:e=>L(Se,null,function*(){return yield le.tracker("HistoryUserLevel",{level:e})})}),Da=se("onHistoryUserScore",{paramsSchema:k.tuple(k.number()),implement:e=>L(Se,null,function*(){return yield le.tracker("HistoryUserScore",{score:e})})}),Oa=se("taskEvent",{paramsSchema:k.tuple(k.string(),k.object({tools:k.array(k.object({id:k.string(),name:k.string(),count:k.number(),description:k.string().optional(),price:k.object({amount:k.number(),unit:k.string()}).optional()})).optional(),awards:k.array(k.object({id:k.string(),name:k.string()})).optional()})),implement:(e,t)=>L(Se,null,function*(){var r;(r=t.tools)!=null&&r.length&&(yield Promise.all([le.reporter({event:"USE_GAME_ITEM"}),le.tracker("UseGameItem",U({taskId:e},t))]))})});Ce.registerCommand("TaskTrackerSDK.levelFinished",ka);Ce.registerCommand("TaskTrackerSDK.taskFinished",xa);Ce.registerCommand("TaskTrackerSDK.levelUpgrade",Ca);Ce.registerCommand("TaskTrackerSDK.historyUserLevel",Pa);Ce.registerCommand("TaskTrackerSDK.historyUserScore",Da);Ce.registerCommand("TaskTrackerSDK.taskEvent",Oa);Q("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});Q("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});Q("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});Q("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});Q("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});we();re();Ge();H();var Qn=ae(),fa="env",ma="getSystemInfoSync",ha=()=>{var a,u,f,m;let e={system:A.deviceInfo.system,platform:A.deviceInfo.platform,brand:A.deviceInfo.brand,pixelRatio:A.deviceInfo.pixelRatio,language:A.deviceInfo.lang,version:A.sdkInfo.jssdkVersion,appName:(a=A.hostInfo)==null?void 0:a.appName,SDKVersion:A.sdkInfo.nativeSDKVersion},t=(u=A.hostInfo)==null?void 0:u.version;t&&(e=W(U({},e),{version:t}));let r=(f=A.hostInfo)==null?void 0:f.appName;r&&(e=W(U({},e),{appName:r}));let n=(m=A.sdkInfo)==null?void 0:m.jssdkVersion;return n&&(e=W(U({},e),{SDKVersion:n})),e},pa=Te(ma,{implement:ha}),ga=Te(fa,{implement:()=>W(U({},A.hostInfo),{sdkInfo:A.sdkInfo,platform:A.platform,deviceInfo:A.deviceInfo})});Qn.registerCommand("API.env",ga);Qn.registerCommand("API.getSystemInfoSync",pa);Q("env",{version:"1.0.0"});Q("getSystemInfoSync",{version:"1.0.0"});H();Ge();Ee();we();var va="onJoliboxShow",ya="onJoliboxHide",ba="onReady",kr=ae(),xr=En(ue),Ar=!0,Je=!0,Rt=0,At=_r;function _a(){let e=Date.now();if(e-Rt<100)return;Rt=e;let t=document.visibilityState==="visible";t!==Ar&&(Ar=t,At.emit("visible",Ar))}function Xn(e){let t=Date.now();t-Rt<100||(Rt=t,e==="focus"&&!Je?Je=!0:e==="blur"&&Je&&(Je=!1),At.emit("visible",Je))}document.addEventListener("visibilitychange",_a);window.addEventListener("focus",()=>Xn("focus"));window.addEventListener("blur",()=>Xn("blur"));var Ea=Te(va,{paramsSchema:k.tuple(k.function()),implement(e){let t=xr(e);At.on("visible",r=>{r&&t()})}}),Ia=Te(ya,{paramsSchema:k.tuple(k.function()),implement(e){let t=xr(e);At.on("visible",r=>{!r&&t()})}}),wa=Te(ba,{paramsSchema:k.tuple(k.function()),implement(e){let t=xr(e);Ke.on("LifecycleEvent.onReady",r=>{t(r)})}});kr.registerCommand("LifecycleSDK.onReady",wa);kr.registerCommand("LifecycleSDK.onJoliboxShow",Ea);kr.registerCommand("LifecycleSDK.onJoliboxHide",Ia);Q("lifeCycle.onReady",{version:"1.0.0"});Q("lifeCycle.onJoliboxShow",{version:"1.0.0"});Q("lifeCycle.onJoliboxHide",{version:"1.0.0"});Ge();H();He();re();var to=sn(eo());var kt=ae(),Pr=class{constructor(){this.httpClient=ge.create({baseUrl:A.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com"});this.getGameId=()=>A.mpId;this.getItem=t=>L(this,null,function*(){let{code:r,data:n,message:a}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),u=n==null?void 0:n.value,f=a;return r!=="SUCCESS"&&(u=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",u),f+="fallback to localstorage"),{code:r,message:f,data:u&&u!=="undefined"?u:null}});this.setItem=(t,r)=>L(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:a,message:u}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:a,message:u}});this.removeItem=t=>L(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>L(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=to.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},xt=new Pr,Ta=se("getLocalStorage",{paramsSchema:k.tuple(k.string()),implement(e){return L(this,null,function*(){return yield xt.getItem(e)})}});kt.registerCommand("StorageSDK.getItem",Ta);Q("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Sa=se("setStorage",{paramsSchema:k.tuple(k.string(),k.or(k.string(),k.boolean(),k.number())),implement(e,t){return L(this,null,function*(){return yield xt.setItem(e,t)})}});kt.registerCommand("StorageSDK.setItem",Sa);Q("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Ra=se("removeStorage",{paramsSchema:k.tuple(k.string()),implement(e){return L(this,null,function*(){return yield xt.removeItem(e)})}});kt.registerCommand("StorageSDK.removeItem",Ra);Q("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var Aa=se("clearStorage",{implement(){return L(this,null,function*(){return yield xt.clear()})}});kt.registerCommand("StorageSDK.clear",Aa);Q("storage.clear",{version:"1.0.0"});var Ju=sn(ro());var Ct=class{constructor(t){this.track=t;this.adBreakIsShowing=!1;this.reportPageJumpOut=()=>{this.track("AdBreakJumpOut",{context:"AdsActionDetection"})};this.reportPageHide=()=>{this.track("AdBreakHide",{context:"AdsActionDetection"})};window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};var Pt=class{constructor(t,r,n,a){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let a=this.checkShouldBanHighFreq(t);if(a)return a;let u=this.checkShouldBanForTime(t);return u?{reason:u}:{reason:"ALLOWED"}};var g,I,P,x,C,D,B;let u=(g=a==null?void 0:a.maxAllowedAdsForTime)!=null?g:8,f=(I=a==null?void 0:a.banForTimeThreshold)!=null?I:6e4,m=(P=a==null?void 0:a.bannedReleaseTime)!=null?P:6e4,p=(x=a==null?void 0:a.maxAllowedAdsForSession)!=null?x:200,T=(C=a==null?void 0:a.banForSessionThreshold)!=null?C:6e5,_=(D=a==null?void 0:a.initialThreshold)!=null?D:2e3,S=(B=a==null?void 0:a.highFreqThreshold)!=null?B:2e3;this.checkShouldBanInitial=Fa(_),this.checkShouldBanHighFreq=Ua(S),this.checkShouldBanForTime=La(u,f,m),this.checkShouldBanForSession=Na(p,T)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},Na=(e,t)=>{let r=!1,n=[];return u=>{if(r)return"BANNED_FOR_SESSION";let f=Date.now();if(n=n.concat({timestamp:f,type:u}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&f-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},La=(e,t,r)=>{let n=null,a=_=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{p.value=!1,n=null},_)},u="jolibox-sdk-ads-callbreak-timestamps",f="jolibox-sdk-ads-ban-for-time",m={_records:[],init(){var _;try{let S=JSON.parse((_=window.localStorage.getItem(u))!=null?_:"[]");Array.isArray(S)?this._records=S:this._records=[]}catch(S){this._records=[]}},get values(){return this._records},set values(_){try{window.localStorage.setItem(u,JSON.stringify(_))}catch(S){}this._records=_}},p={_record:!1,init(){var _;try{let S=JSON.parse((_=window.localStorage.getItem(f))!=null?_:"false");typeof S=="boolean"&&(this._record=S)}catch(S){this._record=!1}if(this._record){let S=m.values[m.values.length-1],g=S?Date.now()-S.timestamp:r;g<=r&&g>0?a(g):this._record=!1}},get value(){return this._record},set value(_){try{window.localStorage.setItem(f,JSON.stringify(_))}catch(S){}this._record=_}};return m.init(),p.init(),_=>{if(p.value)return"WAITING_BANNED_RELEASE";let S=Date.now();if(m.values=m.values.concat({timestamp:S,type:_}),m.values.length!==1&&(m.values.length>e&&(m.values=m.values.slice(-e)),m.values.length===e&&S-m.values[0].timestamp<=t))return p.value=!0,a(r),"BANNED_FOR_TIME"}},Fa=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Ua=(e=2e3)=>{let t=0,r=null;return a=>{if(a==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}};re();re();var Dt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return L(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let a=(r=A.channel)!=null?r:"",u=this.configs[a],f=(n=u==null?void 0:u.interstitialRate)!=null?n:1;t=Math.random()<f}return this.firstRun=!1,t}};H();var Pe=new _e,Ot=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>A.mpId;this.getTestAdsMode=()=>A.testAdsMode;this.asyncLoad=()=>L(this,null,function*(){var f,m,p,T,_;let t="ca-pub-7171363994453626",r,n,a=window.encodeURIComponent(window.btoa((f=this.getGameId())!=null?f:"")),u=(m=this.getTestAdsMode())!=null?m:!1;try{let S=yield this.httpClient.get("/public/ads",{query:{objectId:a,testAdsMode:`${u}`}});t=(p=S.data)==null?void 0:p.clientId,r=(T=S.data)==null?void 0:T.channelId,n=(_=S.data)==null?void 0:_.unitId}catch(S){console.error("Failed to fetch client info",S)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>L(this,null,function*(){var a;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(a=this.getTestAdsMode())!=null?a:!1;if(!document.getElementById(r)&&this.clientId){let u=document.createElement("script");u.id=r,u.async=!0,u.crossOrigin="anonymous",u.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&u.setAttribute("data-adbreak-test","on"),this.channelId&&u.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(u),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((n=>n.type==="preroll")(t)){Pe.emit("isAdShowing",!0);let n=t.adBreakDone,a=u=>{Pe.emit("isAdShowing",!1),n&&n(u)};return W(U({},t),{adBreakDone:a})}else{let n=t.beforeAd,a=t.afterAd,u=()=>{var m;Pe.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(m=t.name)!=null?m:""}),n&&n()},f=()=>{var m;Pe.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(m=t.name)!=null?m:""}),a&&a()};return W(U({},t),{beforeAd:u,afterAd:f})}};this.adConfig=t=>{let a=t,{onReady:r}=a,n=on(a,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var T,_,S,g,I,P;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(T=t.adBreakDone)==null||T.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(_=t.adBreakDone)==null||_.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(S=t.adBreakDone)==null||S.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(I=t.adBreakDone)==null||I.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((g=n==null?void 0:n.count)!=null?g:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let a=t.type,u=t.adBreakDone,f=x=>{var C;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:x.breakType,breakName:(C=x.breakName)!=null?C:"",breakFormat:x.breakFormat,breakStatus:x.breakStatus}),u&&u(x)};if(t.adBreakDone=f,t.type==="reward"){let x=t.beforeReward,C=B=>()=>{this.track("CallShowAdFn",null),B()},D=B=>{x&&x(C(B))};t.beforeReward=D}let m;switch(a){case"preroll":m={type:a};break;case"start":case"pause":case"next":case"browse":case"reward":m={type:a,name:(P=t.name)!=null?P:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",m);let p=this.wrapAdBreakParams(t);this.push(p),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>L(this,null,function*(){var g,I,P,x;if(this.track("CallAdUnit",{adFormat:(I=(g=t.adFormat)==null?void 0:g.toString())!=null?I:null,fullWidthResponsive:(P=t.fullWidthResponsive)!=null?P:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:a,fullWidthResponsive:u,style:f}=t,m;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?m=document.querySelector(r):m=r,!m)throw new Error("targeting element not found");let p=n;if(p||(p=this.unitId),!p)throw new Error("slot is required");let T=typeof a=="object"&&Array.isArray(a)?a.join(", "):a,_=document.createElement("ins");if(_.className="adsbygoogle",_.id="jolibox-ads",_.style.display="block",_.setAttribute("data-ad-client",this.clientId),_.setAttribute("data-ad-slot",p),T&&_.setAttribute("data-ad-format",T),u&&_.setAttribute("data-full-width-responsive",u),f&&_.setAttribute("style",f),(x=this.getTestAdsMode())!=null?x:!1){let C=document.createElement("div");C.style.position="absolute",C.style.top="0",C.style.left="0",C.style.width="100%",C.style.height="100%",C.style.display="flex",C.style.justifyContent="center",C.style.alignItems="center",C.style.backgroundColor="rgba(0, 0, 0, 0.5)",C.style.color="white",C.innerHTML="Test Ad",_.style.position="relative",m.appendChild(_),_.appendChild(C)}else m.appendChild(_),new MutationObserver(D=>{D.forEach(B=>{if(B.type==="attributes"&&B.attributeName==="data-ad-status"){let M=_.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:M!=null?M:"null"})}})}).observe(_,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new Pt(t,r,n),this.adsActionDetection=new Ct(this.track),this.channelPolicy=new Dt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}};we();H();He();var no=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")};var Nt=ae(),Ba=ge.create(),Lt=new Ot(de,Ba,()=>ge.getNetworkStatus());Pe.on("isAdShowing",e=>{no("JOLIBOX_ADS_EVENT",{isAdShowing:e})});Nt.registerCommand("AdsSDK.init",e=>{Lt.init(e)});Nt.registerCommand("AdsSDK.adConfig",e=>{Lt.adConfig(e)});Nt.registerCommand("AdsSDK.adBreak",e=>{Lt.adBreak(e)});Nt.registerCommand("AdsSDK.adUnit",e=>{Lt.adUnit(e)});H();we();var 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(),n="navigate";return uo>=0?n="back-forward-cache":r&&(document.prerendering||Bt()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},lo=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(a){Promise.resolve().then(function(){t(a.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(a){}},Ne=function(e,t,r,n){var a,u;return function(f){t.value>=0&&(f||n)&&((u=t.value-(a||0))||a===void 0)&&(a=t.value,t.delta=u,t.rating=function(m,p){return m>p[1]?"poor":m>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},Ft=function(e){document.visibilityState==="hidden"&&De>-1&&(De=e.type==="visibilitychange"?e.timeStamp:0,Ma())},io=function(){addEventListener("visibilitychange",Ft,!0),addEventListener("prerenderingchange",Ft,!0)},Ma=function(){removeEventListener("visibilitychange",Ft,!0),removeEventListener("prerenderingchange",Ft,!0)},po=function(){return De<0&&(De=oo(),io(),Ut(function(){setTimeout(function(){De=oo(),io()},0)})),{get firstHiddenTime(){return De}}},Nr=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},ao=[1800,3e3],go=function(e,t){t=t||{},Nr(function(){var r,n=po(),a=Oe("FCP"),u=lo("paint",function(f){f.forEach(function(m){m.name==="first-contentful-paint"&&(u.disconnect(),m.startTime<n.firstHiddenTime&&(a.value=Math.max(m.startTime-Bt(),0),a.entries.push(m),r(!0)))})});u&&(r=Ne(e,a,ao,t.reportAllChanges),Ut(function(f){a=Oe("FCP"),r=Ne(e,a,ao,t.reportAllChanges),fo(function(){a.value=performance.now()-f.timeStamp,r(!0)})}))})};var $a=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=ho(e),document.visibilityState==="hidden"?e():(r=t(e),mo(e)),r};var so=[2500,4e3],Dr={},vo=function(e,t){t=t||{},Nr(function(){var r,n=po(),a=Oe("LCP"),u=function(p){t.reportAllChanges||(p=p.slice(-1)),p.forEach(function(T){T.startTime<n.firstHiddenTime&&(a.value=Math.max(T.startTime-Bt(),0),a.entries=[T],r())})},f=lo("largest-contentful-paint",u);if(f){r=Ne(e,a,so,t.reportAllChanges);var m=ho(function(){Dr[a.id]||(u(f.takeRecords()),f.disconnect(),Dr[a.id]=!0,r(!0))});["keydown","click"].forEach(function(p){addEventListener(p,function(){return $a(m)},{once:!0,capture:!0})}),mo(m),Ut(function(p){a=Oe("LCP"),r=Ne(e,a,so,t.reportAllChanges),fo(function(){a.value=performance.now()-p.timeStamp,Dr[a.id]=!0,r(!0)})})}})},co=[800,1800],Va=function e(t){document.prerendering?Nr(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"),n=Ne(e,r,co,t.reportAllChanges);Va(function(){var a=Or();a&&(r.value=Math.max(a.responseStart-Bt(),0),r.entries=[a],n(!0),Ut(function(){r=Oe("TTFB",0),(n=Ne(e,r,co,t.reportAllChanges))(!0)}))})};re();function ja(){go(e=>{de("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),vo(e=>{de("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),yo(e=>{de("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function Ka(){Ke.on("onDocumentReady",e=>{Ke.emit("LifecycleEvent.onReady",{isLogin:!1}),A.mpType==="game"&&le.start(Date.now()-e)})}function bo(){Ka(),ja()}bo();
|
|
4
4
|
/*! Bundled license information:
|
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Xi=Object.create;var Ze=Object.defineProperty,Zi=Object.defineProperties,es=Object.getOwnPropertyDescriptor,ts=Object.getOwnPropertyDescriptors,rs=Object.getOwnPropertyNames,Xe=Object.getOwnPropertySymbols,ns=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty,Zr=Object.prototype.propertyIsEnumerable;var Xr=(e,t,r)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t)=>{for(var r in t||(t={}))Zt.call(t,r)&&Xr(e,r,t[r]);if(Xe)for(var r of Xe(t))Zr.call(t,r)&&Xr(e,r,t[r]);return e},P=(e,t)=>Zi(e,ts(t));var W=(e,t)=>{var r={};for(var n in e)Zt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Xe)for(var n of Xe(e))t.indexOf(n)<0&&Zr.call(e,n)&&(r[n]=e[n]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var en=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),tn=(e,t)=>{for(var r in t)Ze(e,r,{get:t[r],enumerable:!0})},os=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of rs(t))!Zt.call(e,o)&&o!==r&&Ze(e,o,{get:()=>t[o],enumerable:!(n=es(t,o))||n.enumerable});return e};var rn=(e,t,r)=>(r=e!=null?Xi(ns(e)):{},os(t||!e||!e.__esModule?Ze(r,"default",{value:e,enumerable:!0}):r,e));var T=(e,t,r)=>new Promise((n,o)=>{var i=l=>{try{a(r.next(l))}catch(u){o(u)}},s=l=>{try{a(r.throw(l))}catch(u){o(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(i,s);a((r=r.apply(e,t)).next())});function is(e){return!!(e!=null&&e.__nativeBuffers__)}function Le(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!is(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let o;n.value?o=n.value:n.base64&&(o=ss(n.base64)),typeof o!="undefined"&&o instanceof ArrayBuffer&&(e[n.key]=o)}}return e}function nn(e={},t=!1){let r=e,n=[];for(let[o,i]of Object.entries(r))if(i!==void 0&&i instanceof ArrayBuffer&&i.byteLength!==void 0){let s=t?{value:i,key:o}:{base64:as(i),key:o};n.push(s),delete r[o]}return n.length>0&&(r.__nativeBuffers__=n),r}var ss,as,er=k(()=>{"use strict";ss=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(o);return n.buffer};as=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return btoa(t)}});function us(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function be(e){return typeof e=="string"}function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function cn(e){return typeof e=="object"&&Array.isArray(e)}function He(e){return e===!0||e===!1}function ds(e){return typeof e>"u"}function ps(e){return ds(e)||e===null}function ln(e){return typeof e=="function"}function un(e){return J(e)&&ln(e.then)}function dn(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function pn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(o,i){for(let s in i)if(Object.prototype.hasOwnProperty.call(i,s)){let a=o[s],l=i[s],u=r(a,l,s,o,i);u!==void 0?o[s]=u:on(l)&&on(a)?o[s]=n(_({},a),l):Array.isArray(l)&&Array.isArray(a)?o[s]=[...a,...l]:o[s]=l}return o}return n(e,t)}function on(e){return e&&typeof e=="object"&&e.constructor===Object}function mn(e,t){if(Array.isArray(e))return e.concat(t)}function $e(e,t,r={}){let n=null,o,i,s,{leading:a=!1,trailing:l=!0}=r,u=()=>(s=e.apply(i,o),o=void 0,i=void 0,s),d=function(...c){o=c,i=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&u()},t),p)return u()};return d.cancel=()=>{n&&clearTimeout(n),n=null,o=i=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,u()},d}function fs(e,t){return(...r)=>t(e,...r)}function ot(e){return t=>fs(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(o){e(new Je(`${o}`))}})}function Be(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Rs(e){return new Promise(t=>Sn(e)(t))}function Sn(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function As(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(i.fire,i)}},i=new je(o);return i.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function Ps(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Ns(e[n],t[n])}function Ns(e,t){if(be(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(ln(t)){try{if(e instanceof t)return}catch(r){}if(!ps(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 M(){if(globalThis[rr])return globalThis[rr];let e=new rt,t=new or,r={registerCommand(n,o,i){e.registerCommand({id:n,handler:o,metadata:i})},executeCommand(n,...o){return t.executeCommand(n,...o)},excuteCommandSync(n,...o){return t.executeCommandThowErr(n,...o)}};return globalThis[rr]=r,r}var sn,cs,ls,an,ie,ms,ir,ke,fn,hn,Je,gn,_n,vn,yn,bn,Ve,nt,sr,z,kn,hs,ar,gs,cr,_s,vs,et,ys,bs,ks,wn,lr,ws,Ts,Ss,Tn,de,D,Es,xs,tt,je,te,nr,Is,tr,Cs,pe,rt,or,rr,A=k(()=>{"use strict";sn=Object.defineProperty,cs=Object.getOwnPropertyDescriptor,ls=(e,t)=>{for(var r in t)sn(e,r,{get:t[r],enumerable:!0})},an=(e,t,r,n)=>{for(var o=n>1?void 0:n?cs(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&sn(t,r,o),o};ie=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))}})}};ms=(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))(ms||{}),ir=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}},ke=class extends ir{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},fn=class extends ir{constructor(){super(...arguments),this.kind="USER_ERROR"}},hn=class extends fn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Je=class extends fn{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))}},gn=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},_n=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},vn=class extends ke{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},yn=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},bn=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Ve=class extends ir{constructor(e,t,r,n,o){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),o&&(this.priority=o)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},nt=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},sr=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};z={log:Be("log"),warn:Be("warn"),info:Be("info"),error:Be("error"),debug:Be("debug")};Object.assign(globalThis,{logger:z});kn=Symbol.for("Jolibox.canIUseMap"),hs={};globalThis[kn]=hs;ar={get config(){return globalThis[kn]}},gs=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(gs||{}),cr=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(cr||{}),_s=(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))(_s||{}),vs=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),et={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")},ys=()=>et.isiOS?"iOS":et.isAndroid?"Android":et.isMac?"Mac":et.isFacebook?"Facebook":"PC",bs="device_id",ks="advertising_id",wn=e=>(localStorage.getItem(e)||localStorage.setItem(e,vs()),localStorage.getItem(e)),lr=()=>wn(bs),ws=()=>wn(ks),Ts=e=>e.charAt(0).toUpperCase()+e.slice(1),Ss=()=>{var t;let e=new URLSearchParams(window.location.search);return Ts((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Tn=e=>{let t="JoliboxWebSDK",r=ys(),n=navigator.language,o=lr(),i=ws();return`${t} (${Ss()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${o} adid/${i} version/${e||""}`},D=(de=class{constructor(t){this.element=t,this.next=de.Undefined,this.prev=de.Undefined}},de.Undefined=new de(void 0),de),Es=class{constructor(){this._first=D.Undefined,this._last=D.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===D.Undefined}clear(){let e=this._first;for(;e!==D.Undefined;){let t=e.next;e.prev=D.Undefined,e.next=D.Undefined,e=t}this._first=D.Undefined,this._last=D.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new D(e);if(this._first===D.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==D.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==D.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==D.Undefined&&e.next!==D.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===D.Undefined&&e.next===D.Undefined?(this._first=D.Undefined,this._last=D.Undefined):e.next===D.Undefined?(this._last=this._last.prev,this._last.next=D.Undefined):e.prev===D.Undefined&&(this._first=this._first.next,this._first.prev=D.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==D.Undefined;)yield e.element,e=e.next}},xs=0,tt=class{constructor(e){this.value=e,this.id=xs++}},je=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 tt&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var o,i,s,a,l,u;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new tt(t);this._listeners?this._listeners instanceof tt?this._listeners=[this._listeners,n]:this._listeners.push(n):((i=(o=this.options)==null?void 0:o.onWillAddFirstListener)==null||i.call(o,this),this._listeners=n,(a=(s=this.options)==null?void 0:s.onDidFirstListener)==null||a.call(s,this)),(u=(l=this.options)==null?void 0:l.onDidAddListener)==null||u.call(l,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(o){r(o)}}fire(e){this._listeners&&(this._listeners instanceof tt?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},te=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var i;let r=(i=this.listeners.get(e))!=null?i:new je,n=s=>t(...s.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let o=this.cachedEventQueue.get(e);if(o)for(;o.size>0;)r.fire(_({event:e},o.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new Es,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},nr={};ls(nr,{None:()=>Is,filter:()=>As,once:()=>Sn,toPromise:()=>Rs});Is=()=>{console.log("[Jolibox SDK] None Event")};tr=Symbol.for("Jolibox.hostEmitter"),Cs=()=>{let e=new te;return globalThis[tr]||(globalThis[tr]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[tr]},pe=Cs();rt=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new je,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return Ps(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};rt=an([dn],rt);or=class{constructor(){this._onWillExecuteCommand=new je,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new je,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new rt,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=us(3e4)),this._starActivation}executeCommand(e,...t){return T(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),nr.toPromise(nr.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};or=an([dn],or);rr=Symbol.for("Jolibox.commands")});function H(e,t={}){ur.emit("ERROR_REPORT",{error:e,options:t})}var ur,we,re=k(()=>{"use strict";A();A();ur=new te,we=new te;H.debounce=$e(H,50,{leading:!0})});function it(e,t){return`[${e}]:${t}`}var Te,dr,ge=k(()=>{"use strict";re();A();re();Te=(e,t)=>{var r,n;return new Ve((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},dr=e=>new hn(e)});var Se,En,xn,In,st,at=k(()=>{"use strict";Se="custom_event_",En=[],xn=[],In=["env","createRequestTask","login"],st="__batch_event__"});function An(e,t){Rn||(pr=new Ee({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),mr=new Ee({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),fr=new Ee({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),t("onJoliboxEnterBackground",()=>{pr.flush(),mr.flush(),fr.flush()}),Rn=!0);function r(o){var v,h;let{method:i,args:s,startTime:a,isForeground:l,errMsg:u=`${i}:fail no errMsg`,errNo:d=0,__timing:c={receiveJSInvoke:0,invokeCallback:0}}=o,{receiveJSInvoke:p,invokeCallback:m}=c,y=(h=(v=u.match(/\S:(\S+)\s?/))==null?void 0:v[1])!=null?h:"fail";pr.report({status:y,method:n(i,s),errNo:`${d}`,errMsg:u,isForeground:l,duration:Date.now()-a}),a&&p&&m&&(mr.report({status:y,method:i,isForeground:l,duration:Number((p-a).toFixed(3))}),fr.report({status:y,method:i,isForeground:l,duration:Number((Date.now()-m).toFixed(3))}))}function n(o,i){return(o==="callHostMethod"||o==="callHostMethodSync")&&i!=null&&i.method?`${o}-${i.method}`:o}return r}var Os,Ee,Rn,pr,mr,fr,hr=k(()=>{"use strict";A();Os=e=>e==="pv"?e:"default",Ee=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:o,tagNameOrder:i,metricName:s,type:a}=t;this.reporter=r,this.interval=n,this.eventName=o,this.tagNameOrder=i,this.metricName=s,this.type=Os(a)}report(t){this.type==="pv"?this.addPVPoint(t):this.addPoint(t),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(t){if(Object.keys(this.cache).length){if(t){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(t){let r=(n,o,i,s)=>{let a=o.shift();if(a){let l=s[a];n[l]||(n[l]={}),r(n[l],o,i,s)}else n[i]||(n[i]=[]),n[i].push(s[i])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(o,i,s,a)=>{let l=i.shift();if(!l&&J(a))throw new nt(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(l){let u=[];if(J(a))u.push(...Object.keys(a));else if(be(a)){if(i.length>0)throw new nt(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);u.push(a)}else throw new nt(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);u.forEach(d=>{o[d]||(o[d]={});let c=J(a)?a[d]:a;r(o[d],[...i],s,c)})}else o[s]?o[s]++:o[s]=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={}}},Rn=!1});function Pn(e,t){let r=0,n=!0,o=new Map,i=An(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,gr.forEach(p=>T(this,[p],function*({method:u,args:d,resolve:c}){let m=yield a(u,d);c(m)})),gr.length=0});let s=(u,d)=>{let c=o.get(Number(u));if(!c)return;let p=Le(d);c(p),o.delete(Number(u))},a=(u,d)=>{var N,R;let c=Date.now(),p=`${n}`;r+=1;let m=new ie;if(o.set(r,m.resolve),!n&&xn.includes(u))return new Promise(S=>{gr.push({method:u,args:d,resolve:S})});let v=P(_({},{method:u,startTime:c,args:d,isForeground:p}),{invokeType:"js-bridge"}),h=!Ds&&En.includes(u),g=nn(d,h),b=h?g:JSON.stringify(g),E;if(u.endsWith("Sync")||In.includes(u)?E=(N=e.call)==null?void 0:N.call(e,u,g,r):typeof b=="string"?E=e.invoke(u,b,r):E=(R=e.call)==null?void 0:R.call(e,u,b,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=Le(E)}catch(S){z.error(S)}return o.delete(r),E.errorCode&&(E.errorCode=it(u,E.errorCode)),i(_(_({},v),E)),E}return u.endsWith("Sync")&&o.delete(r),m.promise.then(S=>(S.errorCode&&(S.errorCode=it(u,S.errorCode)),i(_(_({},v),S)),S))};return{invokeNative:a,applyNative:(u,d)=>{let c=a(u,d);return un(c)?c.then(p=>Cn(u,p)):Cn(u,c)},invokeHandler:s}}function Cn(e,t){if(!J(t)){z.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:o,errorCode:i}=a,s=W(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new vn(r,n,o,i);return s}var gr,Ds,Nn=k(()=>{"use strict";er();A();ge();at();hr();gr=[],Ds=!1});function On(e){let t=new te,r=new te,n=new Ee({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(o,i,s){let a=Le(i),l;if(a.__extra){l=a.params;let{type:u,startTime:d}=a.__extra;n.report({type:u,event:o,duration:Date.now()-d})}else l=a;if(o===st){l.forEach(d=>{let[c,p]=d;try{r.emit(c.slice(Se.length),p,s)}catch(m){}});return}if(o.startsWith(Se)){r.emit(o.slice(Se.length),l,s);return}t.emit(o,l,s)}}}var Dn=k(()=>{"use strict";A();er();hr();at()});function Fn(e){let t=new Map,r;return(o,i,s,a)=>{if(a){let u=s?[s]:"*";e.publish(`${Se}${o}`,i,u);return}r||(r=Promise.resolve().then(()=>{t.forEach((u,d)=>{try{let c=d?[d]:"*";e.publish(st,u,c)}catch(c){}}),r=void 0,t.clear()}));let l=t.get(s);l||(l=[],t.set(s,l)),l.push([`${Se}${o}`,i])}}var Un=k(()=>{"use strict";at()});function _r(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:i}=On(e),{invokeNative:s,invokeHandler:a,applyNative:l}=Pn(e,r),u=Fn(e);return{invokeHandler:a,subscribeHandler:t,applyNative:l,invokeNative:s,onNative:r,offNative:n,publish:u,subscribe:o,unsubscribe:i}}var Mn=k(()=>{"use strict";Nn();Dn();Un()});var Ln=k(()=>{"use strict"});var Bn=k(()=>{"use strict";Mn();Ln()});function Pe(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ct=k(()=>{"use strict"});var _e,ne,jn,Hn=k(()=>{"use strict";A();ct();re();ne={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){ne.trigger=e},doExit(e){ne.exit=e}},jn=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)H(new _n("native env failed"));else{let{data:t}=JSON.parse(e);return t!=null?t:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(o="")=>{ne.trigger(),e.onDocumentReady.postMessage({path:o})};_e={onDocumentReady:t,doExit:o=>T(void 0,null,function*(){let i=yield ne.exit();e.doExit.postMessage({uuid:o,shouldInterrupt:i})}),invoke(o,i,s){e.invoke.postMessage({event:o,paramsString:i,callbackId:s})},publish(o,i,s){let a=Pe(i,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:o,paramsString:JSON.stringify(a),webviewIds:s}))},call(o,i,s){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(i),callbackId:s}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:jn};globalThis.joliboxJSCore=_({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(o="")=>{ne.trigger(),e.onDocumentReady(JSON.stringify({path:o}))};_e={onDocumentReady:t,invoke(o,i,s){e.invoke(JSON.stringify({event:o,paramsString:i,callbackId:s}))},doExit:o=>T(void 0,null,function*(){let i=yield ne.exit();e.doExit(JSON.stringify({uuid:o,shouldInterrupt:i}))}),publish(o,i,s){let a=Pe(i,"joliboxJSCore");e.publish({event:o,paramsString:JSON.stringify(a),webviewIds:s})},call(o,i,s){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(i),callbackId:s}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:jn};globalThis.joliboxJSCore=_({},n)}});function vr(){globalThis.onmessage=function(e){e.data==="msg:setup"&&([Ne]=e.ports,Ne.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])},Ne.publish=function(t,r){let n=Pe(r,"messagePort");Ne.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},Ne.postMessage("msg:setup:ok"))}}var Ne,$n=k(()=>{"use strict";ct()});var lt=k(()=>{"use strict";Hn();$n();ct()});var Vn,Fs,Kn,Jn,Q,O,se,tu,Us,qn,ru,nu,V=k(()=>{"use strict";Bn();lt();ge();A();lt();Vn=_e;if(!Vn)throw new yn("No joliboxJScore is found, native bridge not found.");vr();Fs=_({},Vn),Kn=_r(Fs),{invokeHandler:Jn}=Kn,{applyNative:Q,invokeNative:O,onNative:se,offNative:tu,subscribeHandler:Us,publish:qn,subscribe:ru,unsubscribe:nu}=Kn;globalThis.joliboxJSBridge={callHandler:Jn,invokeHandler:Jn,subscribeHandler:Us}});var yr,Ms,Gn,Wn,zn=k(()=>{"use strict";A();re();yr=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(o){return{}}},Ms=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Gn=e=>{var t;try{let o=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(o!=null&&o.length){let[i,s,a]=o;return{headerJson:yr(i),payloadJson:yr(s),signature:yr(a)}}else throw"joli_source is missing"}catch(r){return H(new gn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Wn=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],o=Ms(e),i=r[2];return`${n}.${o}.${i}`}return t}});var Ls,ut,Qn,br=k(()=>{"use strict";A();Ls="1.1.11-beta.7",ut=()=>Ls,Qn=()=>{let e=ut();return`${Tn(e)}`}});var Bs,Yn,kr,Xn,$,js,w,K=k(()=>{"use strict";A();zn();br();A();Bs={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:lr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ut()},schema:window.location.href,platform:"h5"},kr=(Yn=globalThis.joliboxJSCore)==null?void 0:Yn.env,$=Object.assign({},(Xn=kr==null?void 0:kr())!=null?Xn:Bs),js=()=>{var p,m,y,v,h,g,b,E,N;let{payloadJson:e,headerJson:t,signature:r}=$.schema.length?Gn($.schema):{},n=`${$.deviceInfo.did}-${new Date().getTime()}`,i=new URL($.schema.length?$.schema:window.location.href).searchParams,s=(y=(m=(p=i.get("mpId"))!=null?p:i.get("appId"))!=null?m:i.get("gameId"))!=null?y:"",a=(g=(h=(v=$.clientSessionId)!=null?v:e==null?void 0:e.sessionId)!=null?h:i.get("sessionId"))!=null?g:n,l=!!((b=e==null?void 0:e.testAdsMode)!=null?b:i.get("testAdsMode")==="true"),u=(N=(E=e==null?void 0:e.joliboxEnv)!=null?E:i.get("joliboxEnv"))!=null?N:"production",d=u==="staging",c=t==null?void 0:t.channel;return{get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return u},get joliSource(){var R;return(R=i.get("joliSource"))!=null?R:null},get mpId(){var R;return(R=s!=null?s:e==null?void 0:e.id)!=null?R:""},get mpVersion(){var R;return(R=t==null?void 0:t.ver)!=null?R:ut()},get mpType(){var R,S;return(S=(R=t==null?void 0:t.__mpType)!=null?R:e==null?void 0:e.__mpType)!=null?S:"game"},get platform(){var R;return(R=$.platform)!=null?R:$.deviceInfo.platform},get deviceInfo(){return $.deviceInfo},get sdkInfo(){return $.sdkInfo},get hostInfo(){return $.hostInfo},get hostUserInfo(){return $.hostUserInfo},get sessionId(){var R,S;return(S=(R=$.clientSessionId)!=null?R:a)!=null?S:n},get channel(){return c},get webviewId(){var R;return(R=$.webviewId)!=null?R:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:R=>{pn($,R,mn)},encodeJoliSourceQuery:R=>{var S,ee;return t&&r?Wn(_(_({},e),R),(S=i.get("joliSource"))!=null?S:""):(ee=i.get("joliSource"))!=null?ee:""}}},w=js()});var wr,eo,Hs,$s,Zn,Js,to=k(()=>{"use strict";A();re();K();A();wr=!1,eo=(e,t)=>e==null?!1:t in e,Hs=e=>eo(e,"kind"),$s=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Zn=(e,t={},r)=>{var i,s,a;let n={user_id:(s=(i=w.hostUserInfo)==null?void 0:i.uid)!=null?s:"",device_id:(a=w.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:$s(e.name)},o=P(_({},n),{env:t.environment,isFromUser:r});r?we.emit("GLOBAL_USER_ERROR",e,o):we.emit("GLOBAL_ERROR",e,o)},Js=e=>eo(e,"kind")&&e.kind==="USER_ERROR";ur.on("ERROR_REPORT",({error:e,options:t})=>{if(wr)return;wr=!0;let r=Hs(e)&&e.raw?e.raw:e;try{let n=Js(e);Zn(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),i=new sr(`${o}, origin error: ${r.message}`);z.error(i),Zn(new sr(i.message),{environment:t.environment},!1)}finally{wr=!1}})});var ro=k(()=>{"use strict";to();ge();A();V();we.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};O("trackAsync",{event:"reportJsError",data:r})});we.on("GLOBAL_USER_ERROR",(e,t)=>{z.log("UserError",e,t)})});var Tr=k(()=>{"use strict"});function no(e,t){let r=(n,o,i)=>{let s=P(_({tag:n},t),{extra:_({},o)});n=="globalJsError"?H(new bn(JSON.stringify(s))):e("systemLog",s,i)};return r.debounce=$e(r,500,{leading:!0}),r}function oo(e){let t=(r,n,o)=>{var a;let i=(a=o&&JSON.stringify(o))!=null?a:0,s={speed_value_type:r,total_duration:n};i&&Object.assign(s,{extra:i}),e("joliboxSpeedAnalysis",s)};return t.debounce=$e(t,500,{leading:!0}),t}var io=k(()=>{"use strict";A();A();re()});function so(e,t){let r=no(e,t),n=oo(r);return{track:r,trackPerformance:n}}var ao=k(()=>{"use strict";io()});var co=k(()=>{"use strict";K();A();A()});var lo=k(()=>{"use strict";ao();Tr();co()});var dt,uo=k(()=>{"use strict";dt=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,o,i=!1,s=0,a=()=>{if(!i)return;let m=Date.now(),y=m-r;y>=this.interval&&(this.visible&&(s+=y,t(s)),r=m),n=requestAnimationFrame(a)},l=()=>{d(),r=Date.now(),o=window.setInterval(()=>{if(!i)return;let m=Date.now();m-r>=this.interval&&(r=m)},this.interval)},u=()=>{c(),r=Date.now(),n=requestAnimationFrame(a)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},c=()=>{o&&(clearInterval(o),o=0)};this.eventEmitter.on("visible",m=>{i&&(console.log("visible",m),m?u():l())});let p=this.visible;return{start(){i||(i=!0,p?u():l())},stop(){i=!1,d(),c()}}}}});var Sr=k(()=>{"use strict"});function mo(e,t,r){let{response:n,startTime:o,endTime:i,requestFrom:s}=r,{errMsg:a="",profile:l={}}=n,d={duration:i-o,request_type:e,url:t.split("?")[0],result:r.state,error_msg:r.state==="fail"?a:"",socket_reused:l.socketReused?1:0,request_from:s};(s==="public"&&po<Ks||s==="inner")&&(d.joli_request_number=po++,setTimeout(()=>{Y("joliboxNetRequestResult",d)},500))}var po,Ks,fo=k(()=>{"use strict";Sr();ve();po=0,Ks=10});function pt(e,t,r){var l,u,d;let n=new Map,o=(l=r==null?void 0:r.baseUrl)!=null?l:"https://api.jolibox.com",i=(u=r==null?void 0:r.type)!=null?u:"public",s=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return se("onRequestTaskStateChange",c=>{if(typeof c.requestTaskId!="string")return;let p=n.get(c.requestTaskId);if(p)if(c.state==="success"){let m=c,{requestTaskId:v,state:h}=m,g=W(m,["requestTaskId","state"]);p.resolve(g),n.delete(v)}else if(c.state==="fail"){let y=c,{requestTaskId:v,state:h}=y,g=W(y,["requestTaskId","state"]);p.reject(g),n.delete(v)}else z.warn("onRequestTaskStateChange unknown event",c)}),pe.on("onLoginComplete",({isLogin:c,token:p})=>{c&&p&&(s["X-JOLI-TOKEN"]=p)}),(m,...y)=>T(this,[m,...y],function*(c,p={}){let v=Date.now(),h=qs(c,P(_({},p),{baseUrl:o})),{method:g="GET",responseType:b="text",dataType:E="json",timeout:N,enableCache:R=!1,appendHostCookie:S=!0}=p,ee=Object.assign({"content-type":"application/json"},s,p.header),G={url:h,method:g,header:ee,enableCache:R,responseType:b,appendHostCookie:S};if(g=="POST"||g=="PUT"){let oe=Ws(p.data,ee["content-type"]);G.data=oe}N&&Object.assign(G,{timeout:N});let{data:{requestTaskId:le}}=O(e,G);if(typeof le!="string")throw Te({code:-1,msg:"requestTaskId is not a string"});let Ce=(oe,ue)=>{mo("request",h,{state:oe,startTime:v,endTime:Date.now(),params:G,response:ue,requestId:le,requestFrom:i=="public"?"public":"inner"})},{resolve:X,reject:ye,promise:Wi}=new ie;n.set(le,{resolve:X,reject:ye});try{let oe=yield Wi;Ce("success",oe);let{data:ue}=oe;return E==="json"&&typeof ue=="string"&&(ue=Gs(ue)),{url:h,timeout:N,method:g,response:P(_({},oe),{data:ue})}}catch(oe){let ue=oe;if(J(ue)){let{errMsg:Ye,prefetchDetail:zi,isPrefetch:Qi,errNo:Yi}=ue;be(Ye)&&(Ce("fail",{errMsg:Ye,isPrefetch:Qi,prefetchDetail:zi}),H(Te({code:-1,msg:Ye},{errNo:Yi,errMsg:Ye})))}throw oe}})}function Gs(e){try{return JSON.parse(e.trim())}catch(t){return e}}function Ws(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 qs,Er=k(()=>{"use strict";A();fo();Sr();V();re();ge();qs=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,o=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${o?`?${o}`:""}`:`${e}${o?`?${o}`:""}`}});var xr,ho,Z,Ke=k(()=>{"use strict";br();Er();K();xr={"x-user-agent":Qn()};(ho=w.hostUserInfo)!=null&&ho.token&&(xr["x-joli-token"]=w.hostUserInfo.token);w.joliSource&&(xr["x-joli-source"]=w.joliSource);Z=pt("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:w.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:xr})});var mt,go=k(()=>{"use strict";K();uo();Ke();V();mt=class extends dt{constructor(t,r,n){super(r,n),this.gameId=w.mpId,this.sessionId=w.sessionId,this.track=t}reporter(t){return T(this,null,function*(){let{event:r,params:n}=t,o=[];o.push(Z("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:_({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(o)})}reportToNative(t){return T(this,null,function*(){let{event:r,params:n}=t;yield Q("userTrackAsync",{event:r,params:_({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var ko={};tn(ko,{nativeTaskEmitter:()=>qe,taskTracker:()=>q,track:()=>Y,trackPerformance:()=>yo});var zs,_o,vo,Y,yo,bo,qe,q,ve=k(()=>{"use strict";ro();A();Tr();lo();K();go();V();zs=(e,t,r)=>{var s,a;let n=t,o=J(n.extra)?n.extra:be(n.extra)?JSON.parse(n.extra):{},i=P(_({},o),{mp_id:(s=n.mp_id)!=null?s:"",mp_version:(a=n.mp_version)!=null?a:""});O("trackAsync",{event:e,data:i,webviewId:r})},{track:Y,trackPerformance:yo}=so(zs,{type:cr.AppSDK,platform:"native",jssdk_version:(vo=(_o=w.sdkInfo)==null?void 0:_o.jssdkVersion)!=null?vo:"1.0.0",mp_id:w.mpId,mp_version:w.mpVersion}),bo=M();bo.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{yo(e,t,r)});bo.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Y(e,t)});qe=new te,q=new mt(Y,qe)});function wo(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let i=`
|
|
1
|
+
var Xs=Object.create;var Ze=Object.defineProperty,Zs=Object.defineProperties,ei=Object.getOwnPropertyDescriptor,ti=Object.getOwnPropertyDescriptors,ri=Object.getOwnPropertyNames,Xe=Object.getOwnPropertySymbols,ni=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty,Zr=Object.prototype.propertyIsEnumerable;var Xr=(e,t,r)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_=(e,t)=>{for(var r in t||(t={}))Zt.call(t,r)&&Xr(e,r,t[r]);if(Xe)for(var r of Xe(t))Zr.call(t,r)&&Xr(e,r,t[r]);return e},N=(e,t)=>Zs(e,ti(t));var W=(e,t)=>{var r={};for(var n in e)Zt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Xe)for(var n of Xe(e))t.indexOf(n)<0&&Zr.call(e,n)&&(r[n]=e[n]);return r};var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var en=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),tn=(e,t)=>{for(var r in t)Ze(e,r,{get:t[r],enumerable:!0})},oi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ri(t))!Zt.call(e,o)&&o!==r&&Ze(e,o,{get:()=>t[o],enumerable:!(n=ei(t,o))||n.enumerable});return e};var rn=(e,t,r)=>(r=e!=null?Xs(ni(e)):{},oi(t||!e||!e.__esModule?Ze(r,"default",{value:e,enumerable:!0}):r,e));var T=(e,t,r)=>new Promise((n,o)=>{var s=l=>{try{a(r.next(l))}catch(u){o(u)}},i=l=>{try{a(r.throw(l))}catch(u){o(u)}},a=l=>l.done?n(l.value):Promise.resolve(l.value).then(s,i);a((r=r.apply(e,t)).next())});function si(e){return!!(e!=null&&e.__nativeBuffers__)}function Le(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!si(e))return e;let t=e.__nativeBuffers__;if(delete e.__nativeBuffers__,t)for(let r=0;r<t.length;r++){let n=t[r];if(n){let o;n.value?o=n.value:n.base64&&(o=ii(n.base64)),typeof o!="undefined"&&o instanceof ArrayBuffer&&(e[n.key]=o)}}return e}function nn(e={},t=!1){let r=e,n=[];for(let[o,s]of Object.entries(r))if(s!==void 0&&s instanceof ArrayBuffer&&s.byteLength!==void 0){let i=t?{value:s,key:o}:{base64:ai(s),key:o};n.push(i),delete r[o]}return n.length>0&&(r.__nativeBuffers__=n),r}var ii,ai,er=k(()=>{"use strict";ii=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let o=0;o<r;o++)n[o]=t.charCodeAt(o);return n.buffer};ai=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let o=0;o<n;o++)t+=String.fromCharCode(r[o]);return btoa(t)}});function ui(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function be(e){return typeof e=="string"}function J(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function cn(e){return typeof e=="object"&&Array.isArray(e)}function He(e){return e===!0||e===!1}function di(e){return typeof e>"u"}function pi(e){return di(e)||e===null}function ln(e){return typeof e=="function"}function un(e){return J(e)&&ln(e.then)}function dn(e){let t=e,r=null,n=function(...o){return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function pn(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(o,s){for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i)){let a=o[i],l=s[i],u=r(a,l,i,o,s);u!==void 0?o[i]=u:on(l)&&on(a)?o[i]=n(_({},a),l):Array.isArray(l)&&Array.isArray(a)?o[i]=[...a,...l]:o[i]=l}return o}return n(e,t)}function on(e){return e&&typeof e=="object"&&e.constructor===Object}function mn(e,t){if(Array.isArray(e))return e.concat(t)}function $e(e,t,r={}){let n=null,o,s,i,{leading:a=!1,trailing:l=!0}=r,u=()=>(i=e.apply(s,o),o=void 0,s=void 0,i),d=function(...c){o=c,s=this;let p=a&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&u()},t),p)return u()};return d.cancel=()=>{n&&clearTimeout(n),n=null,o=s=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,u()},d}function fi(e,t){return(...r)=>t(e,...r)}function ot(e){return t=>fi(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(o){e(new Je(`${o}`))}})}function Be(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Ri(e){return new Promise(t=>Sn(e)(t))}function Sn(e){return(t,r=null)=>{let n=!1;return e(o=>{if(!n)return n=!0,t.call(r,o)},null)}}function Ai(e,t){return(r=>{let n,o={onWillAddFirstListener(){n=r(s.fire,s)}},s=new je(o);return s.event})((r,n=null)=>e(o=>t(o)&&r.call(n,o),null))}function Ni(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)Pi(e[n],t[n])}function Pi(e,t){if(be(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(ln(t)){try{if(e instanceof t)return}catch(r){}if(!pi(e)&&e.constructor===t||t.length===1&&t.call(void 0,e)===!0)return;throw new Error("[Jolibox SDK]argument does not match one of these constraints: arg instanceof constraint, arg.constructor === constraint, nor constraint(arg) === true")}}function M(){if(globalThis[rr])return globalThis[rr];let e=new rt,t=new or,r={registerCommand(n,o,s){e.registerCommand({id:n,handler:o,metadata:s})},executeCommand(n,...o){return t.executeCommand(n,...o)},excuteCommandSync(n,...o){return t.executeCommandThowErr(n,...o)}};return globalThis[rr]=r,r}var sn,ci,li,an,se,mi,sr,ke,fn,hn,Je,gn,_n,vn,yn,bn,Ve,nt,ir,z,kn,hi,ar,gi,cr,_i,vi,et,yi,bi,ki,wn,lr,wi,Ti,Si,Tn,de,D,Ei,xi,tt,je,te,nr,Ii,tr,Ci,pe,rt,or,rr,A=k(()=>{"use strict";sn=Object.defineProperty,ci=Object.getOwnPropertyDescriptor,li=(e,t)=>{for(var r in t)sn(e,r,{get:t[r],enumerable:!0})},an=(e,t,r,n)=>{for(var o=n>1?void 0:n?ci(t,r):t,s=e.length-1,i;s>=0;s--)(i=e[s])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&sn(t,r,o),o};se=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))}})}};mi=(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))(mi||{}),sr=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},ke=class extends sr{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},fn=class extends sr{constructor(){super(...arguments),this.kind="USER_ERROR"}},hn=class extends fn{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Je=class extends fn{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))}},gn=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},_n=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},vn=class extends ke{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},yn=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},bn=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Ve=class extends sr{constructor(e,t,r,n,o){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),o&&(this.priority=o)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},nt=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}},ir=class extends ke{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};z={log:Be("log"),warn:Be("warn"),info:Be("info"),error:Be("error"),debug:Be("debug")};Object.assign(globalThis,{logger:z});kn=Symbol.for("Jolibox.canIUseMap"),hi={};globalThis[kn]=hi;ar={get config(){return globalThis[kn]}},gi=(e=>(e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(gi||{}),cr=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(cr||{}),_i=(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))(_i||{}),vi=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)}),et={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")},yi=()=>et.isiOS?"iOS":et.isAndroid?"Android":et.isMac?"Mac":et.isFacebook?"Facebook":"PC",bi="device_id",ki="advertising_id",wn=e=>(localStorage.getItem(e)||localStorage.setItem(e,vi()),localStorage.getItem(e)),lr=()=>wn(bi),wi=()=>wn(ki),Ti=e=>e.charAt(0).toUpperCase()+e.slice(1),Si=()=>{var t;let e=new URLSearchParams(window.location.search);return Ti((t=e.get("utm_source"))!=null?t:"")||"JoliboxSDK"},Tn=e=>{let t="JoliboxWebSDK",r=yi(),n=navigator.language,o=lr(),s=wi();return`${t} (${Si()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${o} adid/${s} version/${e||""}`},D=(de=class{constructor(t){this.element=t,this.next=de.Undefined,this.prev=de.Undefined}},de.Undefined=new de(void 0),de),Ei=class{constructor(){this._first=D.Undefined,this._last=D.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===D.Undefined}clear(){let e=this._first;for(;e!==D.Undefined;){let t=e.next;e.prev=D.Undefined,e.next=D.Undefined,e=t}this._first=D.Undefined,this._last=D.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new D(e);if(this._first===D.Undefined)this._first=r,this._last=r;else if(t){let o=this._last;this._last=r,r.prev=o,o.next=r}else{let o=this._first;this._first=r,r.next=o,o.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==D.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==D.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==D.Undefined&&e.next!==D.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===D.Undefined&&e.next===D.Undefined?(this._first=D.Undefined,this._last=D.Undefined):e.next===D.Undefined?(this._last=this._last.prev,this._last.next=D.Undefined):e.prev===D.Undefined&&(this._first=this._first.next,this._first.prev=D.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==D.Undefined;)yield e.element,e=e.next}},xi=0,tt=class{constructor(e){this.value=e,this.id=xi++}},je=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 tt&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var o,s,i,a,l,u;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let n=new tt(t);this._listeners?this._listeners instanceof tt?this._listeners=[this._listeners,n]:this._listeners.push(n):((s=(o=this.options)==null?void 0:o.onWillAddFirstListener)==null||s.call(o,this),this._listeners=n,(a=(i=this.options)==null?void 0:i.onDidFirstListener)==null||a.call(i,this)),(u=(l=this.options)==null?void 0:l.onDidAddListener)==null||u.call(l,this),this._size++}),this._event}_deliver(e,t){var n;if(!e)return;let r=((n=this.options)==null?void 0:n.onListenerError)||Error.constructor;if(!r){e.value(t);return}try{e.value(t)}catch(o){r(o)}}fire(e){this._listeners&&(this._listeners instanceof tt?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},te=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){var s;let r=(s=this.listeners.get(e))!=null?s:new je,n=i=>t(...i.args);this.listerHandlerMap.set(t,n),r.event(n),this.listeners.set(e,r);let o=this.cachedEventQueue.get(e);if(o)for(;o.size>0;)r.fire(_({event:e},o.shift()))}off(e,t){let r=this.listeners.get(e);if(r){let n=this.listerHandlerMap.get(t);r.dispose(n)}}emit(e,...t){let r=this.listeners.get(e);if(r)r.fire({event:e,args:t});else{let n=this.cachedEventQueue.get(e);n||(n=new Ei,this.cachedEventQueue.set(e,n)),n.push({args:t})}}},nr={};li(nr,{None:()=>Ii,filter:()=>Ai,once:()=>Sn,toPromise:()=>Ri});Ii=()=>{console.log("[Jolibox SDK] None Event")};tr=Symbol.for("Jolibox.hostEmitter"),Ci=()=>{let e=new te;return globalThis[tr]||(globalThis[tr]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e)}),globalThis[tr]},pe=Ci();rt=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new je,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let o of e.metadata.args)r.push(o.constraint);let n=e.handler;e.handler=function(...o){return Ni(o,r),n(...o)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};rt=an([dn],rt);or=class{constructor(){this._onWillExecuteCommand=new je,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new je,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new rt,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=ui(3e4)),this._starActivation}executeCommand(e,...t){return T(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),nr.toPromise(nr.filter(this.registry.onDidRegisterCommand,r=>r===e))])]),this._tryExecuteCommand(e,t))})}executeCommandThowErr(e,...t){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let r=this.registry.getCommand(e);this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),n}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let n=this.invokeFunction(r.handler,...t);return this._onDidExecuteCommand.fire({commandId:e,args:t}),Promise.resolve(n)}catch(n){return Promise.reject(n)}}invokeFunction(e,...t){let r=!1;try{return e(...t)}finally{r=!0}}};or=an([dn],or);rr=Symbol.for("Jolibox.commands")});function H(e,t={}){ur.emit("ERROR_REPORT",{error:e,options:t})}var ur,we,re=k(()=>{"use strict";A();A();ur=new te,we=new te;H.debounce=$e(H,50,{leading:!0})});function st(e,t){return`[${e}]:${t}`}var Te,dr,ge=k(()=>{"use strict";re();A();re();Te=(e,t)=>{var r,n;return new Ve((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},dr=e=>new hn(e)});var Se,En,xn,In,it,at=k(()=>{"use strict";Se="custom_event_",En=[],xn=[],In=["env","createRequestTask","login"],it="__batch_event__"});function An(e,t){Rn||(pr=new Ee({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),mr=new Ee({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),fr=new Ee({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}}),t("onJoliboxEnterBackground",()=>{pr.flush(),mr.flush(),fr.flush()}),Rn=!0);function r(o){var v,h;let{method:s,args:i,startTime:a,isForeground:l,errMsg:u=`${s}:fail no errMsg`,errNo:d=0,__timing:c={receiveJSInvoke:0,invokeCallback:0}}=o,{receiveJSInvoke:p,invokeCallback:m}=c,y=(h=(v=u.match(/\S:(\S+)\s?/))==null?void 0:v[1])!=null?h:"fail";pr.report({status:y,method:n(s,i),errNo:`${d}`,errMsg:u,isForeground:l,duration:Date.now()-a}),a&&p&&m&&(mr.report({status:y,method:s,isForeground:l,duration:Number((p-a).toFixed(3))}),fr.report({status:y,method:s,isForeground:l,duration:Number((Date.now()-m).toFixed(3))}))}function n(o,s){return(o==="callHostMethod"||o==="callHostMethodSync")&&s!=null&&s.method?`${o}-${s.method}`:o}return r}var Oi,Ee,Rn,pr,mr,fr,hr=k(()=>{"use strict";A();Oi=e=>e==="pv"?e:"default",Ee=class{constructor(t){this.interval=30;this.lastReportTime=0;this.cache={};let{reporter:r,interval:n=30,eventName:o,tagNameOrder:s,metricName:i,type:a}=t;this.reporter=r,this.interval=n,this.eventName=o,this.tagNameOrder=s,this.metricName=i,this.type=Oi(a)}report(t){this.type==="pv"?this.addPVPoint(t):this.addPoint(t),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(t){if(Object.keys(this.cache).length){if(t){this.reporter(this.processPoints(this.cache)),this.clearPoints();return}this.lastReportTime=this.lastReportTime||Date.now(),Date.now()-this.lastReportTime>=this.interval*1e3&&(this.reporter(this.processPoints(this.cache)),this.clearPoints(),this.lastReportTime=Date.now())}}addPoint(t){let r=(n,o,s,i)=>{let a=o.shift();if(a){let l=i[a];n[l]||(n[l]={}),r(n[l],o,s,i)}else n[s]||(n[s]=[]),n[s].push(i[s])};r(this.cache,[...this.tagNameOrder],this.metricName,t)}addPVPoint(t){let r=(o,s,i,a)=>{let l=s.shift();if(!l&&J(a))throw new nt(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);if(l){let u=[];if(J(a))u.push(...Object.keys(a));else if(be(a)){if(s.length>0)throw new nt(`report value failed to match tagNameOrder, ${JSON.stringify(n)}`);u.push(a)}else throw new nt(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(n)}`);u.forEach(d=>{o[d]||(o[d]={});let c=J(a)?a[d]:a;r(o[d],[...s],i,c)})}else o[i]?o[i]++:o[i]=1},n={point:t,metricName:this.metricName,tagNameOrder:this.tagNameOrder};r(this.cache,[...this.tagNameOrder],this.metricName,t)}processPoints(t){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:t}}clearPoints(){this.cache={}}},Rn=!1});function Nn(e,t){let r=0,n=!0,o=new Map,s=An(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,gr.forEach(p=>T(this,[p],function*({method:u,args:d,resolve:c}){let m=yield a(u,d);c(m)})),gr.length=0});let i=(u,d)=>{let c=o.get(Number(u));if(!c)return;let p=Le(d);c(p),o.delete(Number(u))},a=(u,d)=>{var P,R;let c=Date.now(),p=`${n}`;r+=1;let m=new se;if(o.set(r,m.resolve),!n&&xn.includes(u))return new Promise(S=>{gr.push({method:u,args:d,resolve:S})});let v=N(_({},{method:u,startTime:c,args:d,isForeground:p}),{invokeType:"js-bridge"}),h=!Di&&En.includes(u),g=nn(d,h),b=h?g:JSON.stringify(g),E;if(u.endsWith("Sync")||In.includes(u)?E=(P=e.call)==null?void 0:P.call(e,u,g,r):typeof b=="string"?E=e.invoke(u,b,r):E=(R=e.call)==null?void 0:R.call(e,u,b,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=Le(E)}catch(S){z.error(S)}return o.delete(r),E.errorCode&&(E.errorCode=st(u,E.errorCode)),s(_(_({},v),E)),E}return u.endsWith("Sync")&&o.delete(r),m.promise.then(S=>(S.errorCode&&(S.errorCode=st(u,S.errorCode)),s(_(_({},v),S)),S))};return{invokeNative:a,applyNative:(u,d)=>{let c=a(u,d);return un(c)?c.then(p=>Cn(u,p)):Cn(u,c)},invokeHandler:i}}function Cn(e,t){if(!J(t)){z.warn(`[Jolibox SDK]${e} no response value`);return}let a=t,{errMsg:r,errNo:n,errorType:o,errorCode:s}=a,i=W(a,["errMsg","errNo","errorType","errorCode"]);if(r&&r!==`${e}:ok`)throw new vn(r,n,o,s);return i}var gr,Di,Pn=k(()=>{"use strict";er();A();ge();at();hr();gr=[],Di=!1});function On(e){let t=new te,r=new te,n=new Ee({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(o){e.invoke("track",JSON.stringify({event:"reportMetrics",data:o}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),{onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(o,s,i){let a=Le(s),l;if(a.__extra){l=a.params;let{type:u,startTime:d}=a.__extra;n.report({type:u,event:o,duration:Date.now()-d})}else l=a;if(o===it){l.forEach(d=>{let[c,p]=d;try{r.emit(c.slice(Se.length),p,i)}catch(m){}});return}if(o.startsWith(Se)){r.emit(o.slice(Se.length),l,i);return}t.emit(o,l,i)}}}var Dn=k(()=>{"use strict";A();er();hr();at()});function Fn(e){let t=new Map,r;return(o,s,i,a)=>{if(a){let u=i?[i]:"*";e.publish(`${Se}${o}`,s,u);return}r||(r=Promise.resolve().then(()=>{t.forEach((u,d)=>{try{let c=d?[d]:"*";e.publish(it,u,c)}catch(c){}}),r=void 0,t.clear()}));let l=t.get(i);l||(l=[],t.set(i,l)),l.push([`${Se}${o}`,s])}}var Un=k(()=>{"use strict";at()});function _r(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:o,unsubscribe:s}=On(e),{invokeNative:i,invokeHandler:a,applyNative:l}=Nn(e,r),u=Fn(e);return{invokeHandler:a,subscribeHandler:t,applyNative:l,invokeNative:i,onNative:r,offNative:n,publish:u,subscribe:o,unsubscribe:s}}var Mn=k(()=>{"use strict";Pn();Dn();Un()});var Ln=k(()=>{"use strict"});var Bn=k(()=>{"use strict";Mn();Ln()});function Ne(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ct=k(()=>{"use strict"});var _e,ne,jn,Hn=k(()=>{"use strict";A();ct();re();ne={trigger(){},exit(){return Promise.resolve(!1)},onReady(e){ne.trigger=e},doExit(e){ne.exit=e}},jn=()=>{let e=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!e)H(new _n("native env failed"));else{let{data:t}=JSON.parse(e);return t!=null?t:void 0}};if(window.webkit){let e=window.webkit.messageHandlers,t=(o="")=>{ne.trigger(),e.onDocumentReady.postMessage({path:o})};_e={onDocumentReady:t,doExit:o=>T(void 0,null,function*(){let s=yield ne.exit();e.doExit.postMessage({uuid:o,shouldInterrupt:s})}),invoke(o,s,i){e.invoke.postMessage({event:o,paramsString:s,callbackId:i})},publish(o,s,i){let a=Ne(s,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:o,paramsString:JSON.stringify(a),webviewIds:i}))},call(o,s,i){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(s),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:jn};globalThis.joliboxJSCore=_({},n)}if(window.JoliAndroidSDKBridge){let e=window.JoliAndroidSDKBridge,t=(o="")=>{ne.trigger(),e.onDocumentReady(JSON.stringify({path:o}))};_e={onDocumentReady:t,invoke(o,s,i){e.invoke(JSON.stringify({event:o,paramsString:s,callbackId:i}))},doExit:o=>T(void 0,null,function*(){let s=yield ne.exit();e.doExit(JSON.stringify({uuid:o,shouldInterrupt:s}))}),publish(o,s,i){let a=Ne(s,"joliboxJSCore");e.publish({event:o,paramsString:JSON.stringify(a),webviewIds:i})},call(o,s,i){let a=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(s),callbackId:i}));if(a)return JSON.parse(a)}};let n={onDocumentReady:t,env:jn};globalThis.joliboxJSCore=_({},n)}});function vr(){globalThis.onmessage=function(e){e.data==="msg:setup"&&([Pe]=e.ports,Pe.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])},Pe.publish=function(t,r){let n=Ne(r,"messagePort");Pe.postMessage(JSON.stringify(["publish",t,JSON.stringify(n)]))},Pe.postMessage("msg:setup:ok"))}}var Pe,$n=k(()=>{"use strict";ct()});var lt=k(()=>{"use strict";Hn();$n();ct()});var Vn,Fi,Kn,Jn,Q,O,ie,tu,Ui,qn,ru,nu,V=k(()=>{"use strict";Bn();lt();ge();A();lt();Vn=_e;if(!Vn)throw new yn("No joliboxJScore is found, native bridge not found.");vr();Fi=_({},Vn),Kn=_r(Fi),{invokeHandler:Jn}=Kn,{applyNative:Q,invokeNative:O,onNative:ie,offNative:tu,subscribeHandler:Ui,publish:qn,subscribe:ru,unsubscribe:nu}=Kn;globalThis.joliboxJSBridge={callHandler:Jn,invokeHandler:Jn,subscribeHandler:Ui}});var yr,Mi,Gn,Wn,zn=k(()=>{"use strict";A();re();yr=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(o){return{}}},Mi=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Gn=e=>{var t;try{let o=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(o!=null&&o.length){let[s,i,a]=o;return{headerJson:yr(s),payloadJson:yr(i),signature:yr(a)}}else throw"joli_source is missing"}catch(r){return H(new gn(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Wn=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],o=Mi(e),s=r[2];return`${n}.${o}.${s}`}return t}});var Li,ut,Qn,br=k(()=>{"use strict";A();Li="1.1.11-beta.9",ut=()=>Li,Qn=()=>{let e=ut();return`${Tn(e)}`}});var Bi,Yn,kr,Xn,$,ji,w,K=k(()=>{"use strict";A();zn();br();A();Bi={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:lr(),pixelRatio:window.devicePixelRatio||1,platform:"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ut()},schema:window.location.href,platform:"h5"},kr=(Yn=globalThis.joliboxJSCore)==null?void 0:Yn.env,$=Object.assign({},(Xn=kr==null?void 0:kr())!=null?Xn:Bi),ji=()=>{var p,m,y,v,h,g,b,E,P;let{payloadJson:e,headerJson:t,signature:r}=$.schema.length?Gn($.schema):{},n=`${$.deviceInfo.did}-${new Date().getTime()}`,s=new URL($.schema.length?$.schema:window.location.href).searchParams,i=(y=(m=(p=s.get("mpId"))!=null?p:s.get("appId"))!=null?m:s.get("gameId"))!=null?y:"",a=(g=(h=(v=$.clientSessionId)!=null?v:e==null?void 0:e.sessionId)!=null?h:s.get("sessionId"))!=null?g:n,l=!!((b=e==null?void 0:e.testAdsMode)!=null?b:s.get("testAdsMode")==="true"),u=(P=(E=e==null?void 0:e.joliboxEnv)!=null?E:s.get("joliboxEnv"))!=null?P:"production",d=u==="staging",c=t==null?void 0:t.channel;return{get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return u},get joliSource(){var R;return(R=s.get("joliSource"))!=null?R:null},get mpId(){var R;return(R=i!=null?i:e==null?void 0:e.id)!=null?R:""},get mpVersion(){var R;return(R=t==null?void 0:t.ver)!=null?R:ut()},get mpType(){var R,S;return(S=(R=t==null?void 0:t.__mpType)!=null?R:e==null?void 0:e.__mpType)!=null?S:"game"},get platform(){var R;return(R=$.platform)!=null?R:$.deviceInfo.platform},get deviceInfo(){return $.deviceInfo},get sdkInfo(){return $.sdkInfo},get hostInfo(){return $.hostInfo},get hostUserInfo(){return $.hostUserInfo},get sessionId(){var R,S;return(S=(R=$.clientSessionId)!=null?R:a)!=null?S:n},get channel(){return c},get webviewId(){var R;return(R=$.webviewId)!=null?R:-1},get shouldInterupt(){return e==null?void 0:e.__shouldInterupt},get from(){return e==null?void 0:e.__from},onEnvConfigChanged:R=>{pn($,R,mn)},encodeJoliSourceQuery:R=>{var S,ee;return t&&r?Wn(_(_({},e),R),(S=s.get("joliSource"))!=null?S:""):(ee=s.get("joliSource"))!=null?ee:""}}},w=ji()});var wr,eo,Hi,$i,Zn,Ji,to=k(()=>{"use strict";A();re();K();A();wr=!1,eo=(e,t)=>e==null?!1:t in e,Hi=e=>eo(e,"kind"),$i=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Zn=(e,t={},r)=>{var s,i,a;let n={user_id:(i=(s=w.hostUserInfo)==null?void 0:s.uid)!=null?i:"",device_id:(a=w.deviceInfo.did)!=null?a:"",timestamp:Date.now(),tag:$i(e.name)},o=N(_({},n),{env:t.environment,isFromUser:r});r?we.emit("GLOBAL_USER_ERROR",e,o):we.emit("GLOBAL_ERROR",e,o)},Ji=e=>eo(e,"kind")&&e.kind==="USER_ERROR";ur.on("ERROR_REPORT",({error:e,options:t})=>{if(wr)return;wr=!0;let r=Hi(e)&&e.raw?e.raw:e;try{let n=Ji(e);Zn(e,t,n)}catch(n){let o=n instanceof Error?n.message:String(n),s=new ir(`${o}, origin error: ${r.message}`);z.error(s),Zn(new ir(s.message),{environment:t.environment},!1)}finally{wr=!1}})});var ro=k(()=>{"use strict";to();ge();A();V();we.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};O("trackAsync",{event:"reportJsError",data:r})});we.on("GLOBAL_USER_ERROR",(e,t)=>{z.log("UserError",e,t)})});var Tr=k(()=>{"use strict"});function no(e,t){let r=(n,o,s)=>{let i=N(_({tag:n},t),{extra:_({},o)});n=="globalJsError"?H(new bn(JSON.stringify(i))):e("systemLog",i,s)};return r.debounce=$e(r,500,{leading:!0}),r}function oo(e){let t=(r,n,o)=>{var a;let s=(a=o&&JSON.stringify(o))!=null?a:0,i={speed_value_type:r,total_duration:n};s&&Object.assign(i,{extra:s}),e("joliboxSpeedAnalysis",i)};return t.debounce=$e(t,500,{leading:!0}),t}var so=k(()=>{"use strict";A();A();re()});function io(e,t){let r=no(e,t),n=oo(r);return{track:r,trackPerformance:n}}var ao=k(()=>{"use strict";so()});var co=k(()=>{"use strict";K();A();A()});var lo=k(()=>{"use strict";ao();Tr();co()});var dt,uo=k(()=>{"use strict";dt=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.timer=this.createRAFTimer(t=>{this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t})});this.interval=r!=null?r:5*1e3,t.on("visible",n=>{this.visible=n})}start(t){this.reporter({event:"OPEN_GAME",params:{timestamp:Date.now(),duration:t!=null?t:0}}),this.tracker("OpenGame",{duration:t!=null?t:0}),this.timer.start()}close(t){this.reporter({event:"CLOSE_GAME",params:{timestamp:Date.now(),duration:t}}),this.tracker("CloseGame",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,o,s=!1,i=0,a=()=>{if(!s)return;let m=Date.now(),y=m-r;y>=this.interval&&(this.visible&&(i+=y,t(i)),r=m),n=requestAnimationFrame(a)},l=()=>{d(),r=Date.now(),o=window.setInterval(()=>{if(!s)return;let m=Date.now();m-r>=this.interval&&(r=m)},this.interval)},u=()=>{c(),r=Date.now(),n=requestAnimationFrame(a)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},c=()=>{o&&(clearInterval(o),o=0)};this.eventEmitter.on("visible",m=>{s&&(console.log("visible",m),m?u():l())});let p=this.visible;return{start(){s||(s=!0,p?u():l())},stop(){s=!1,d(),c()}}}}});var Sr=k(()=>{"use strict"});function mo(e,t,r){let{response:n,startTime:o,endTime:s,requestFrom:i}=r,{errMsg:a="",profile:l={}}=n,d={duration:s-o,request_type:e,url:t.split("?")[0],result:r.state,error_msg:r.state==="fail"?a:"",socket_reused:l.socketReused?1:0,request_from:i};(i==="public"&&po<Ki||i==="inner")&&(d.joli_request_number=po++,setTimeout(()=>{Y("joliboxNetRequestResult",d)},500))}var po,Ki,fo=k(()=>{"use strict";Sr();ve();po=0,Ki=10});function pt(e,t,r){var l,u,d;let n=new Map,o=(l=r==null?void 0:r.baseUrl)!=null?l:"https://api.jolibox.com",s=(u=r==null?void 0:r.type)!=null?u:"public",i=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return ie("onRequestTaskStateChange",c=>{if(typeof c.requestTaskId!="string")return;let p=n.get(c.requestTaskId);if(p)if(c.state==="success"){let m=c,{requestTaskId:v,state:h}=m,g=W(m,["requestTaskId","state"]);p.resolve(g),n.delete(v)}else if(c.state==="fail"){let y=c,{requestTaskId:v,state:h}=y,g=W(y,["requestTaskId","state"]);p.reject(g),n.delete(v)}else z.warn("onRequestTaskStateChange unknown event",c)}),pe.on("onLoginComplete",({isLogin:c,token:p})=>{c&&p&&(i["X-JOLI-TOKEN"]=p)}),(m,...y)=>T(this,[m,...y],function*(c,p={}){let v=Date.now(),h=qi(c,N(_({},p),{baseUrl:o})),{method:g="GET",responseType:b="text",dataType:E="json",timeout:P,enableCache:R=!1,appendHostCookie:S=!0}=p,ee=Object.assign({"content-type":"application/json"},i,p.header),G={url:h,method:g,header:ee,enableCache:R,responseType:b,appendHostCookie:S};if(g=="POST"||g=="PUT"){let oe=Wi(p.data,ee["content-type"]);G.data=oe}P&&Object.assign(G,{timeout:P});let{data:{requestTaskId:le}}=O(e,G);if(typeof le!="string")throw Te({code:-1,msg:"requestTaskId is not a string"});let Ce=(oe,ue)=>{mo("request",h,{state:oe,startTime:v,endTime:Date.now(),params:G,response:ue,requestId:le,requestFrom:s=="public"?"public":"inner"})},{resolve:X,reject:ye,promise:Ws}=new se;n.set(le,{resolve:X,reject:ye});try{let oe=yield Ws;Ce("success",oe);let{data:ue}=oe;return E==="json"&&typeof ue=="string"&&(ue=Gi(ue)),{url:h,timeout:P,method:g,response:N(_({},oe),{data:ue})}}catch(oe){let ue=oe;if(J(ue)){let{errMsg:Ye,prefetchDetail:zs,isPrefetch:Qs,errNo:Ys}=ue;be(Ye)&&(Ce("fail",{errMsg:Ye,isPrefetch:Qs,prefetchDetail:zs}),H(Te({code:-1,msg:Ye},{errNo:Ys,errMsg:Ye})))}throw oe}})}function Gi(e){try{return JSON.parse(e.trim())}catch(t){return e}}function Wi(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 qi,Er=k(()=>{"use strict";A();fo();Sr();V();re();ge();qi=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,o=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${o?`?${o}`:""}`:`${e}${o?`?${o}`:""}`}});var xr,ho,Z,Ke=k(()=>{"use strict";br();Er();K();xr={"x-user-agent":Qn()};(ho=w.hostUserInfo)!=null&&ho.token&&(xr["x-joli-token"]=w.hostUserInfo.token);w.joliSource&&(xr["x-joli-source"]=w.joliSource);Z=pt("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:w.testMode?"https://stg-api.jolibox.com":"https://api.jolibox.com",defaultHeaders:xr})});var mt,go=k(()=>{"use strict";K();uo();Ke();V();mt=class extends dt{constructor(t,r,n){super(r,n),this.gameId=w.mpId,this.sessionId=w.sessionId,this.track=t}reporter(t){return T(this,null,function*(){let{event:r,params:n}=t,o=[];o.push(Z("/api/base/app-event",{method:"POST",data:{eventType:r,gameInfo:_({gameId:this.gameId,sessionId:this.sessionId},n)}})),yield Promise.all(o)})}reportToNative(t){return T(this,null,function*(){let{event:r,params:n}=t;yield Q("userTrackAsync",{event:r,params:_({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}}});var ko={};tn(ko,{nativeTaskEmitter:()=>qe,taskTracker:()=>q,track:()=>Y,trackPerformance:()=>yo});var zi,_o,vo,Y,yo,bo,qe,q,ve=k(()=>{"use strict";ro();A();Tr();lo();K();go();V();zi=(e,t,r)=>{var i,a;let n=t,o=J(n.extra)?n.extra:be(n.extra)?JSON.parse(n.extra):{},s=N(_({},o),{mp_id:(i=n.mp_id)!=null?i:"",mp_version:(a=n.mp_version)!=null?a:""});O("trackAsync",{event:e,data:s,webviewId:r})},{track:Y,trackPerformance:yo}=io(zi,{type:cr.AppSDK,platform:"native",jssdk_version:(vo=(_o=w.sdkInfo)==null?void 0:_o.jssdkVersion)!=null?vo:"1.0.0",mp_id:w.mpId,mp_version:w.mpVersion}),bo=M();bo.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{yo(e,t,r)});bo.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Y(e,t)});qe=new te,q=new mt(Y,qe)});function wo(){let e=null,t=window.fetch,r=()=>{e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let s=`
|
|
2
2
|
html[data-jolibox-root] {
|
|
3
3
|
height: 100%;
|
|
4
4
|
margin: 0;
|
|
@@ -16,7 +16,7 @@ var Xi=Object.create;var Ze=Object.defineProperty,Zi=Object.defineProperties,es=
|
|
|
16
16
|
min-height: 100dvh;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`;e.textContent=i;let s=document.head||document.getElementsByTagName("head")[0];s.insertBefore(e,s.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function i(a){return T(this,null,function*(){let l=a instanceof URL?a.href:a,u=new Promise((d,c)=>{let p=new XMLHttpRequest;p.open("GET",l),p.responseType="arraybuffer",p.addEventListener("load",()=>d(p.response)),p.addEventListener("error",c),p.send()});try{let d=yield u;return new Response(d,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(d){throw console.error("Failed to load wasm:",d),d}})}let s=window.fetch;window.fetch=(a,l)=>{let u=a instanceof URL?a.href:a.toString();return u.endsWith(".wasm")?i(u):s(a,l)}},o=()=>{e!=null&&e.parentNode&&(e.parentNode.removeChild(e),e=null),document.documentElement.removeAttribute("data-jolibox-root"),window.fetch=t};return r(),n(),o}var To=k(()=>{"use strict"});var ft,So=k(()=>{"use strict";ft=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 ht,Qs,Ys,Xs,Zs,Eo=k(()=>{"use strict";ht=class{constructor(t,r,n,o){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let o=this.checkShouldBanHighFreq(t);if(o)return o;let i=this.checkShouldBanForTime(t);return i?{reason:i}:{reason:"ALLOWED"}};var p,m,y,v,h,g,b;let i=(p=o==null?void 0:o.maxAllowedAdsForTime)!=null?p:8,s=(m=o==null?void 0:o.banForTimeThreshold)!=null?m:6e4,a=(y=o==null?void 0:o.bannedReleaseTime)!=null?y:6e4,l=(v=o==null?void 0:o.maxAllowedAdsForSession)!=null?v:200,u=(h=o==null?void 0:o.banForSessionThreshold)!=null?h:6e5,d=(g=o==null?void 0:o.initialThreshold)!=null?g:2e3,c=(b=o==null?void 0:o.highFreqThreshold)!=null?b:2e3;this.checkShouldBanInitial=Xs(d),this.checkShouldBanHighFreq=Zs(c),this.checkShouldBanForTime=Ys(i,s,a),this.checkShouldBanForSession=Qs(l,u)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},Qs=(e,t)=>{let r=!1,n=[];return i=>{if(r)return"BANNED_FOR_SESSION";let s=Date.now();if(n=n.concat({timestamp:s,type:i}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&s-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Ys=(e,t,r)=>{let n=null,o=d=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{l.value=!1,n=null},d)},i="jolibox-sdk-ads-callbreak-timestamps",s="jolibox-sdk-ads-ban-for-time",a={_records:[],init(){var d;try{let c=JSON.parse((d=window.localStorage.getItem(i))!=null?d:"[]");Array.isArray(c)?this._records=c:this._records=[]}catch(c){this._records=[]}},get values(){return this._records},set values(d){try{window.localStorage.setItem(i,JSON.stringify(d))}catch(c){}this._records=d}},l={_record:!1,init(){var d;try{let c=JSON.parse((d=window.localStorage.getItem(s))!=null?d:"false");typeof c=="boolean"&&(this._record=c)}catch(c){this._record=!1}if(this._record){let c=a.values[a.values.length-1],p=c?Date.now()-c.timestamp:r;p<=r&&p>0?o(p):this._record=!1}},get value(){return this._record},set value(d){try{window.localStorage.setItem(s,JSON.stringify(d))}catch(c){}this._record=d}};return a.init(),l.init(),d=>{if(l.value)return"WAITING_BANNED_RELEASE";let c=Date.now();if(a.values=a.values.concat({timestamp:c,type:d}),a.values.length!==1&&(a.values.length>e&&(a.values=a.values.slice(-e)),a.values.length===e&&c-a.values[0].timestamp<=t))return l.value=!0,o(r),"BANNED_FOR_TIME"}},Xs=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Zs=(e=2e3)=>{let t=0,r=null;return o=>{if(o==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}}});var gt,xo=k(()=>{"use strict";K();gt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return T(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let o=(r=w.channel)!=null?r:"",i=this.configs[o],s=(n=i==null?void 0:i.interstitialRate)!=null?n:1;t=Math.random()<s}return this.firstRun=!1,t}}});var Oe,_t,Ir=k(()=>{"use strict";So();Eo();K();xo();A();Oe=new te,_t=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>w.mpId;this.getTestAdsMode=()=>w.testAdsMode;this.asyncLoad=()=>T(this,null,function*(){var s,a,l,u,d;let t="ca-pub-7171363994453626",r,n,o=window.encodeURIComponent(window.btoa((s=this.getGameId())!=null?s:"")),i=(a=this.getTestAdsMode())!=null?a:!1;try{let c=yield this.httpClient.get("/public/ads",{query:{objectId:o,testAdsMode:`${i}`}});t=(l=c.data)==null?void 0:l.clientId,r=(u=c.data)==null?void 0:u.channelId,n=(d=c.data)==null?void 0:d.unitId}catch(c){console.error("Failed to fetch client info",c)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>T(this,null,function*(){var o;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(o=this.getTestAdsMode())!=null?o:!1;if(!document.getElementById(r)&&this.clientId){let i=document.createElement("script");i.id=r,i.async=!0,i.crossOrigin="anonymous",i.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.channelId&&i.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(i),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((n=>n.type==="preroll")(t)){Oe.emit("isAdShowing",!0);let n=t.adBreakDone,o=i=>{Oe.emit("isAdShowing",!1),n&&n(i)};return P(_({},t),{adBreakDone:o})}else{let n=t.beforeAd,o=t.afterAd,i=()=>{var a;Oe.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(a=t.name)!=null?a:""}),n&&n()},s=()=>{var a;Oe.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(a=t.name)!=null?a:""}),o&&o()};return P(_({},t),{beforeAd:i,afterAd:s})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=W(o,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var u,d,c,p,m,y;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(u=t.adBreakDone)==null||u.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(m=t.adBreakDone)==null||m.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((p=n==null?void 0:n.count)!=null?p:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let o=t.type,i=t.adBreakDone,s=v=>{var h;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:v.breakType,breakName:(h=v.breakName)!=null?h:"",breakFormat:v.breakFormat,breakStatus:v.breakStatus}),i&&i(v)};if(t.adBreakDone=s,t.type==="reward"){let v=t.beforeReward,h=b=>()=>{this.track("CallShowAdFn",null),b()},g=b=>{v&&v(h(b))};t.beforeReward=g}let a;switch(o){case"preroll":a={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":a={type:o,name:(y=t.name)!=null?y:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",a);let l=this.wrapAdBreakParams(t);this.push(l),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>T(this,null,function*(){var p,m,y,v;if(this.track("CallAdUnit",{adFormat:(m=(p=t.adFormat)==null?void 0:p.toString())!=null?m:null,fullWidthResponsive:(y=t.fullWidthResponsive)!=null?y:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:o,fullWidthResponsive:i,style:s}=t,a;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?a=document.querySelector(r):a=r,!a)throw new Error("targeting element not found");let l=n;if(l||(l=this.unitId),!l)throw new Error("slot is required");let u=typeof o=="object"&&Array.isArray(o)?o.join(", "):o,d=document.createElement("ins");if(d.className="adsbygoogle",d.id="jolibox-ads",d.style.display="block",d.setAttribute("data-ad-client",this.clientId),d.setAttribute("data-ad-slot",l),u&&d.setAttribute("data-ad-format",u),i&&d.setAttribute("data-full-width-responsive",i),s&&d.setAttribute("style",s),(v=this.getTestAdsMode())!=null?v:!1){let h=document.createElement("div");h.style.position="absolute",h.style.top="0",h.style.left="0",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center",h.style.backgroundColor="rgba(0, 0, 0, 0.5)",h.style.color="white",h.innerHTML="Test Ad",d.style.position="relative",a.appendChild(d),d.appendChild(h)}else a.appendChild(d),new MutationObserver(g=>{g.forEach(b=>{if(b.type==="attributes"&&b.attributeName==="data-ad-status"){let E=d.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:E!=null?E:"null"})}})}).observe(d,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new ht(t,r,n),this.adsActionDetection=new ft(this.track),this.channelPolicy=new gt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});function me(e,t){for(var r in t)e[r]=t[r];return e}function Ur(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ie(e,t,r){var n,o,i,s={};for(i in t)i=="key"?n=t[i]:i=="ref"?o=t[i]:s[i]=t[i];if(arguments.length>2&&(s.children=arguments.length>3?xt.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)s[i]===void 0&&(s[i]=e.defaultProps[i]);return bt(e,s,n,o,null)}function bt(e,t,r,n,o){var i={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o!=null?o:++zo,__i:-1,__u:0};return o==null&&x.vnode!=null&&x.vnode(i),i}function Re(e){return e.children}function fe(e,t){this.props=e,this.context=t}function Fe(e,t){if(t==null)return e.__?Fe(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Fe(e):null}function ei(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return ei(e)}}function Ro(e){(!e.__d&&(e.__d=!0)&&xe.push(e)&&!Tt.__r++||Io!==x.debounceRendering)&&((Io=x.debounceRendering)||Qo)(Tt)}function Tt(){for(var e,t,r,n,o,i,s,a=1;xe.length;)xe.length>a&&xe.sort(Yo),e=xe.shift(),a=xe.length,e.__d&&(r=void 0,o=(n=(t=e).__v).__e,i=[],s=[],t.__P&&((r=me({},n)).__v=n.__v+1,x.vnode&&x.vnode(r),Mr(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[o]:null,i,o!=null?o:Fe(n),!!(32&n.__u),s),r.__v=n.__v,r.__.__k[r.__i]=r,ni(i,r,s),r.__e!=o&&ei(r)));Tt.__r=0}function ti(e,t,r,n,o,i,s,a,l,u,d){var c,p,m,y,v,h,g=n&&n.__k||Zo,b=t.length;for(l=ta(r,t,g,l,b),c=0;c<b;c++)(m=r.__k[c])!=null&&(p=m.__i===-1?Ge:g[m.__i]||Ge,m.__i=c,h=Mr(e,m,p,o,i,s,a,l,u,d),y=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Lr(p.ref,null,m),d.push(m.ref,m.__c||y,m)),v==null&&y!=null&&(v=y),4&m.__u||p.__k===m.__k?l=ri(m,l,e):typeof m.type=="function"&&h!==void 0?l=h:y&&(l=y.nextSibling),m.__u&=-7);return r.__e=v,l}function ta(e,t,r,n,o){var i,s,a,l,u,d=r.length,c=d,p=0;for(e.__k=new Array(o),i=0;i<o;i++)(s=t[i])!=null&&typeof s!="boolean"&&typeof s!="function"?(l=i+p,(s=e.__k[i]=typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?bt(null,s,null,null,null):Qe(s)?bt(Re,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?bt(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=e,s.__b=e.__b+1,a=null,(u=s.__i=ra(s,r,l,c))!==-1&&(c--,(a=r[u])&&(a.__u|=2)),a==null||a.__v===null?(u==-1&&(o>d?p--:o<d&&p++),typeof s.type!="function"&&(s.__u|=4)):u!=l&&(u==l-1?p--:u==l+1?p++:(u>l?p--:p++,s.__u|=4))):e.__k[i]=null;if(c)for(i=0;i<d;i++)(a=r[i])!=null&&!(2&a.__u)&&(a.__e==n&&(n=Fe(a)),ii(a,a));return n}function ri(e,t,r){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=ri(n[o],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=Fe(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function St(e,t){return t=t||[],e==null||typeof e=="boolean"||(Qe(e)?e.some(function(r){St(r,t)}):t.push(e)),t}function ra(e,t,r,n){var o,i,s=e.key,a=e.type,l=t[r];if(l===null&&e.key==null||l&&s==l.key&&a===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(o=r-1,i=r+1;o>=0||i<t.length;){if(o>=0){if((l=t[o])&&!(2&l.__u)&&s==l.key&&a===l.type)return o;o--}if(i<t.length){if((l=t[i])&&!(2&l.__u)&&s==l.key&&a===l.type)return i;i++}}return-1}function Ao(e,t,r){t[0]=="-"?e.setProperty(t,r!=null?r:""):e[t]=r==null?"":typeof r!="number"||ea.test(t)?r:r+"px"}function vt(e,t,r,n,o){var i;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Ao(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Ao(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Xo,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=r,r?n?r.t=n.t:(r.t=Fr,e.addEventListener(t,i?Nr:Pr,i)):e.removeEventListener(t,i?Nr:Pr,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r!=null?r:"";break e}catch(s){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Co(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Fr++;else if(t.u<r.t)return;return r(x.event?x.event(t):t)}}}function Mr(e,t,r,n,o,i,s,a,l,u){var d,c,p,m,y,v,h,g,b,E,N,R,S,ee,G,le,Ce,X=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),i=[a=t.__e=r.__e]),(d=x.__b)&&d(t);e:if(typeof X=="function")try{if(g=t.props,b="prototype"in X&&X.prototype.render,E=(d=X.contextType)&&n[d.__c],N=d?E?E.props.value:d.__:n,r.__c?h=(c=t.__c=r.__c).__=c.__E:(b?t.__c=c=new X(g,N):(t.__c=c=new fe(g,N),c.constructor=X,c.render=oa),E&&E.sub(c),c.props=g,c.state||(c.state={}),c.context=N,c.__n=n,p=c.__d=!0,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&X.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=me({},c.__s)),me(c.__s,X.getDerivedStateFromProps(g,c.__s))),m=c.props,y=c.state,c.__v=t,p)b&&X.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&X.getDerivedStateFromProps==null&&g!==m&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,N),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,N)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(ye){ye&&(ye.__=t)}),R=0;R<c._sb.length;R++)c.__h.push(c._sb[R]);c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,N),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(m,y,v)})}if(c.context=N,c.props=g,c.__P=e,c.__e=!1,S=x.__r,ee=0,b){for(c.state=c.__s,c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),G=0;G<c._sb.length;G++)c.__h.push(c._sb[G]);c._sb=[]}else do c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++ee<25);c.state=c.__s,c.getChildContext!=null&&(n=me(me({},n),c.getChildContext())),b&&!p&&c.getSnapshotBeforeUpdate!=null&&(v=c.getSnapshotBeforeUpdate(m,y)),le=d,d!=null&&d.type===Re&&d.key==null&&(le=oi(d.props.children)),a=ti(e,Qe(le)?le:[le],t,r,n,o,i,s,a,l,u),c.base=t.__e,t.__u&=-161,c.__h.length&&s.push(c),h&&(c.__E=c.__=null)}catch(ye){if(t.__v=null,l||i!=null)if(ye.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;i[i.indexOf(a)]=null,t.__e=a}else for(Ce=i.length;Ce--;)Ur(i[Ce]);else t.__e=r.__e,t.__k=r.__k;x.__e(ye,t,r)}else i==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=na(r.__e,t,r,n,o,i,s,l,u);return(d=x.diffed)&&d(t),128&t.__u?void 0:a}function ni(e,t,r){for(var n=0;n<r.length;n++)Lr(r[n],r[++n],r[++n]);x.__c&&x.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){x.__e(i,o.__v)}})}function oi(e){return typeof e!="object"||e==null?e:Qe(e)?e.map(oi):me({},e)}function na(e,t,r,n,o,i,s,a,l){var u,d,c,p,m,y,v,h=r.props,g=t.props,b=t.type;if(b=="svg"?o="http://www.w3.org/2000/svg":b=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u<i.length;u++)if((m=i[u])&&"setAttribute"in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,i[u]=null;break}}if(e==null){if(b==null)return document.createTextNode(g);e=document.createElementNS(o,b,g.is&&g),a&&(x.__m&&x.__m(t,i),a=!1),i=null}if(b===null)h===g||a&&e.data===g||(e.data=g);else{if(i=i&&xt.call(e.childNodes),h=r.props||Ge,!a&&i!=null)for(h={},u=0;u<e.attributes.length;u++)h[(m=e.attributes[u]).name]=m.value;for(u in h)if(m=h[u],u!="children"){if(u=="dangerouslySetInnerHTML")c=m;else if(!(u in g)){if(u=="value"&&"defaultValue"in g||u=="checked"&&"defaultChecked"in g)continue;vt(e,u,null,m,o)}}for(u in g)m=g[u],u=="children"?p=m:u=="dangerouslySetInnerHTML"?d=m:u=="value"?y=m:u=="checked"?v=m:a&&typeof m!="function"||h[u]===m||vt(e,u,m,h[u],o);if(d)a||c&&(d.__html===c.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),ti(t.type==="template"?e.content:e,Qe(p)?p:[p],t,r,n,b=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,s,i?i[0]:r.__k&&Fe(r,0),a,l),i!=null)for(u=i.length;u--;)Ur(i[u]);a||(u="value",b=="progress"&&y==null?e.removeAttribute("value"):y!==void 0&&(y!==e[u]||b=="progress"&&!y||b=="option"&&y!==h[u])&&vt(e,u,y,h[u],o),u="checked",v!==void 0&&v!==e[u]&&vt(e,u,v,h[u],o))}return e}function Lr(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(o){x.__e(o,r)}}function ii(e,t,r){var n,o;if(x.unmount&&x.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Lr(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(i){x.__e(i,t)}n.base=n.__P=null}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&ii(n[o],t,r||typeof e.type!="function");r||Ur(e.__e),e.__c=e.__=e.__e=void 0}function oa(e,t,r){return this.constructor(e,r)}function Po(e,t,r){var n,o,i,s;t==document&&(t=document.documentElement),x.__&&x.__(e,t),o=(n=!1)?null:t.__k,i=[],s=[],Mr(t,e=t.__k=Ie(Re,null,[e]),o||Ge,Ge,t.namespaceURI,o?null:t.firstChild?xt.call(t.childNodes):null,i,o?o.__e:t.firstChild,n,s),ni(i,e,s)}function Br(e,t){L.__h&&L.__h(U,e,ze||t),ze=0;var r=U.__H||(U.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Bo(e){return ze=1,ia(li,e)}function ia(e,t,r){var n=Br(We++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):li(void 0,t),function(a){var l=n.__N?n.__N[0]:n.__[0],u=n.t(l,a);l!==u&&(n.__N=[u,n.__[1]],n.__c.setState({}))}],n.__c=U,!U.__f)){var o=function(a,l,u){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return!!p.__c});if(d.every(function(p){return!p.__N}))return!i||i.call(this,a,l,u);var c=n.__c.props!==a;return d.forEach(function(p){if(p.__N){var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(c=!0)}}),i&&i.call(this,a,l,u)||c};U.__f=!0;var i=U.shouldComponentUpdate,s=U.componentWillUpdate;U.componentWillUpdate=function(a,l,u){if(this.__e){var d=i;i=void 0,o(a,l,u),i=d}s&&s.call(this,a,l,u)},U.shouldComponentUpdate=o}return n.__N||n.__}function kt(e,t){var r=Br(We++,3);!L.__s&&ci(r.__H,t)&&(r.__=e,r.u=t,U.__H.__h.push(r))}function Et(e){return ze=5,ai(function(){return{current:e}},[])}function ai(e,t){var r=Br(We++,7);return ci(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function ae(e,t){return ze=8,ai(function(){return e},t)}function sa(){for(var e;e=si.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wt),e.__H.__h.forEach(Or),e.__H.__h=[]}catch(t){e.__H.__h=[],L.__e(t,e.__v)}}function aa(e){var t,r=function(){clearTimeout(n),jo&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);jo&&(t=requestAnimationFrame(r))}function wt(e){var t=U,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),U=t}function Or(e){var t=U;e.__c=e.__(),U=t}function ci(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function li(e,t){return typeof t=="function"?t(e):t}function ui(e,t){for(var r in t)e[r]=t[r];return e}function Dr(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function Ho(e,t){this.props=e,this.context=t}function ca(e,t){function r(o){var i=this.props.ref,s=i==o.ref;return!s&&i&&(i.call?i(null):i.current=null),t?!t(this.props,o)||!s:Dr(this.props,o)}function n(o){return this.shouldComponentUpdate=r,Ie(e,o)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}function ua(e){function t(r){var n=ui({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=la,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}function di(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=ui({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return di(n,t,r)})),e}function pi(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return pi(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Ar(){this.__u=0,this.o=null,this.__b=null}function mi(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function yt(){this.i=null,this.l=null}function va(){}function ya(){return this.cancelBubble}function ba(){return this.defaultPrevented}function C(e,t,r,n,o,i){t||(t={});var s,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?s=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wa,__i:-1,__u:0,__source:o,__self:i};if(typeof e=="function"&&(s=e.defaultProps))for(a in s)l[a]===void 0&&(l[a]=s[a]);return x.vnode&&x.vnode(u),u}function Ca(a){var l=a,{elementTag:e="Image",src:t="",children:r,handleExposure:n,className:o,imgStyle:i}=l,s=W(l,["elementTag","src","children","handleExposure","className","imgStyle"]);let u=Aa(()=>{t&&n()});return e==="Image"?C("div",{className:o,style:{borderRadius:"8px"},children:Ie("img",P(_({},s),{ref:u,src:t!=null?t:"",style:_({display:"block",width:"100%",height:"100%",objectFit:"cover",maxWidth:"100%",maxHeight:"100%",borderRadius:"8px"},i||{})}))}):C("div",P(_({},s),{ref:u,className:o,children:r}))}function Pa(e,t){if(!e)return null;let r=Array.isArray(t)?t[0]:t,n=Array.isArray(t)?t[1]:0;return Array.isArray(e)?e.map((o,i)=>o&&typeof o=="object"&&"type"in o?Ie(o.type,P(_({},o.props),{style:P(_({},o.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0}),key:o.key||i})):o):e&&typeof e=="object"&&"type"in e?Ie(e.type,P(_({},e.props),{style:P(_({},e.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0})})):e}var xt,x,zo,xe,Io,Qo,Yo,Xo,Fr,Pr,Nr,Ge,Zo,ea,Qe,We,U,Rr,No,ze,si,L,Oo,Do,Fo,Uo,Mo,Lo,jo,$o,la,da,Jo,Vo,pa,ma,fa,ha,ga,_a,Ko,ka,qo,Go,Wo,wa,Cr,Ta,Sa,Ea,xa,Ia,Ra,Aa,fi,hi,Na,Oa,Da,Fa,De,Ua,gi,_i=k(()=>{"use strict";Ge={},Zo=[],ea=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qe=Array.isArray;xt=Zo.slice,x={__e:function(e,t,r,n){for(var o,i,s;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),s=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),s=o.__d),s)return o.__E=o}catch(a){e=a}throw e}},zo=0,fe.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=me({},this.state),typeof e=="function"&&(e=e(me({},r),this.props)),e&&me(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ro(this))},fe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ro(this))},fe.prototype.render=Re,xe=[],Qo=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yo=function(e,t){return e.__v.__b-t.__v.__b},Tt.__r=0,Xo=/(PointerCapture)$|Capture$/i,Fr=0,Pr=Co(!1),Nr=Co(!0);ze=0,si=[],L=x,Oo=L.__b,Do=L.__r,Fo=L.diffed,Uo=L.__c,Mo=L.unmount,Lo=L.__;L.__b=function(e){U=null,Oo&&Oo(e)},L.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Lo&&Lo(e,t)},L.__r=function(e){Do&&Do(e),We=0;var t=(U=e.__c).__H;t&&(Rr===U?(t.__h=[],U.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(wt),t.__h.forEach(Or),t.__h=[],We=0)),Rr=U},L.diffed=function(e){Fo&&Fo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(si.push(t)!==1&&No===L.requestAnimationFrame||((No=L.requestAnimationFrame)||aa)(sa)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Rr=U=null},L.__c=function(e,t){t.some(function(r){try{r.__h.forEach(wt),r.__h=r.__h.filter(function(n){return!n.__||Or(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],L.__e(n,r.__v)}}),Uo&&Uo(e,t)},L.unmount=function(e){Mo&&Mo(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{wt(n)}catch(o){t=o}}),r.__H=void 0,t&&L.__e(t,r.__v))};jo=typeof requestAnimationFrame=="function";(Ho.prototype=new fe).isPureReactComponent=!0,Ho.prototype.shouldComponentUpdate=function(e,t){return Dr(this.props,e)||Dr(this.state,t)};$o=x.__b;x.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),$o&&$o(e)};la=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;da=x.__e;x.__e=function(e,t,r,n){if(e.then){for(var o,i=t;i=i.__;)if((o=i.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}da(e,t,r,n)};Jo=x.unmount;x.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Jo&&Jo(e)},(Ar.prototype=new fe).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var o=mi(n.__v),i=!1,s=function(){i||(i=!0,r.__R=null,o?o(a):a())};r.__R=s;var a=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=pi(l,l.__c.__P,l.__c.__O)}var u;for(n.setState({__a:n.__b=null});u=n.o.pop();)u.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(s,s)},Ar.prototype.componentWillUnmount=function(){this.o=[]},Ar.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=di(this.__b,r,n.__O=n.__P)}this.__b=null}var o=t.__a&&Ie(Re,null,e.fallback);return o&&(o.__u&=-33),[Ie(Re,null,t.__a?null:e.children),o]};Vo=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(yt.prototype=new fe).__a=function(e){var t=this,r=mi(t.__v),n=t.l.get(e);return n[0]++,function(o){var i=function(){t.props.revealOrder?(n.push(o),Vo(t,e,n)):o()};r?r(i):i()}},yt.prototype.render=function(e){this.i=null,this.l=new Map;var t=St(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},yt.prototype.componentDidUpdate=yt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Vo(e,r,t)})};pa=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ma=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,fa=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ha=/[A-Z0-9]/g,ga=typeof document<"u",_a=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};fe.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(fe.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});Ko=x.event;x.event=function(e){return Ko&&(e=Ko(e)),e.persist=va,e.isPropagationStopped=ya,e.isDefaultPrevented=ba,e.nativeEvent=e};ka={enumerable:!1,configurable:!0,get:function(){return this.class}},qo=x.vnode;x.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,o={},i=n.indexOf("-")===-1;for(var s in r){var a=r[s];if(!(s==="value"&&"defaultValue"in r&&a==null||ga&&s==="children"&&n==="noscript"||s==="class"||s==="className")){var l=s.toLowerCase();s==="defaultValue"&&"value"in r&&r.value==null?s="value":s==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?s="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||_a(r.type)?l==="onfocus"?s="onfocusin":l==="onblur"?s="onfocusout":fa.test(s)&&(s=l):l=s="oninput":i&&ma.test(s)?s=s.replace(ha,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&o[s=l]&&(s="oninputCapture"),o[s]=a}}n=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=St(r.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),n=="select"&&o.defaultValue!=null&&(o.value=St(r.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",ka)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o}(e),e.$$typeof=pa,qo&&qo(e)};Go=x.__r;x.__r=function(e){Go&&Go(e),e.__c};Wo=x.diffed;x.diffed=function(e){Wo&&Wo(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value)};wa=0;Cr={drawerBackdrop:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"flex-end",zIndex:1e3,overflow:"hidden",touchAction:"none"},drawer:{backgroundColor:"white",borderRadius:"16px 16px 0 0",width:"100%",maxWidth:"100%",overflowY:"auto",position:"relative",boxShadow:"0 -2px 10px rgba(0, 0, 0, 0.1)",display:"flex",flexDirection:"column",margin:"0 auto"},drawerContent:{flex:1,width:"100%",height:"100%",overflow:"auto",margin:"0 auto"}},Ta=`
|
|
19
|
+
`;e.textContent=s;let i=document.head||document.getElementsByTagName("head")[0];i.insertBefore(e,i.firstChild),document.documentElement.setAttribute("data-jolibox-root","")},n=()=>{function s(a){return T(this,null,function*(){let l=a instanceof URL?a.href:a,u=new Promise((d,c)=>{let p=new XMLHttpRequest;p.open("GET",l),p.responseType="arraybuffer",p.addEventListener("load",()=>d(p.response)),p.addEventListener("error",c),p.send()});try{let d=yield u;return new Response(d,{headers:new Headers([["Content-Type","application/wasm"]])}).clone()}catch(d){throw console.error("Failed to load wasm:",d),d}})}let i=window.fetch;window.fetch=(a,l)=>{let u=a instanceof URL?a.href:a.toString();return u.endsWith(".wasm")?s(u):i(a,l)}},o=()=>{e!=null&&e.parentNode&&(e.parentNode.removeChild(e),e=null),document.documentElement.removeAttribute("data-jolibox-root"),window.fetch=t};return r(),n(),o}var To=k(()=>{"use strict"});var ft,So=k(()=>{"use strict";ft=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 ht,Qi,Yi,Xi,Zi,Eo=k(()=>{"use strict";ht=class{constructor(t,r,n,o){this.track=t;this.httpClient=r;this.checkNetwork=n;this.checkAdsDisplayPermission=t=>{if(!this.checkNetwork())return{reason:"NETWORK_NOT_OK"};let r=this.checkShouldBanInitial();if(r)return{reason:r};let n=this.checkShouldBanForSession(t);if(n)return{reason:n};let o=this.checkShouldBanHighFreq(t);if(o)return o;let s=this.checkShouldBanForTime(t);return s?{reason:s}:{reason:"ALLOWED"}};var p,m,y,v,h,g,b;let s=(p=o==null?void 0:o.maxAllowedAdsForTime)!=null?p:8,i=(m=o==null?void 0:o.banForTimeThreshold)!=null?m:6e4,a=(y=o==null?void 0:o.bannedReleaseTime)!=null?y:6e4,l=(v=o==null?void 0:o.maxAllowedAdsForSession)!=null?v:200,u=(h=o==null?void 0:o.banForSessionThreshold)!=null?h:6e5,d=(g=o==null?void 0:o.initialThreshold)!=null?g:2e3,c=(b=o==null?void 0:o.highFreqThreshold)!=null?b:2e3;this.checkShouldBanInitial=Xi(d),this.checkShouldBanHighFreq=Zi(c),this.checkShouldBanForTime=Yi(s,i,a),this.checkShouldBanForSession=Qi(l,u)}report(t,r){let n=r?{reason:t,count:r}:{reason:t};this.track("PreventAdsCheating",n),this.httpClient.post("/api/base/app-event",{data:{eventType:"PREVENT_ADS_CHEATING",adsInfo:n}})}},Qi=(e,t)=>{let r=!1,n=[];return s=>{if(r)return"BANNED_FOR_SESSION";let i=Date.now();if(n=n.concat({timestamp:i,type:s}),n.length!==1&&(n.length>e&&(n=n.slice(-e)),n.length===e&&i-n[0].timestamp<=t))return r=!0,"BANNED_FOR_SESSION"}},Yi=(e,t,r)=>{let n=null,o=d=>{n&&(window.clearTimeout(n),n=null),n=window.setTimeout(()=>{l.value=!1,n=null},d)},s="jolibox-sdk-ads-callbreak-timestamps",i="jolibox-sdk-ads-ban-for-time",a={_records:[],init(){var d;try{let c=JSON.parse((d=window.localStorage.getItem(s))!=null?d:"[]");Array.isArray(c)?this._records=c:this._records=[]}catch(c){this._records=[]}},get values(){return this._records},set values(d){try{window.localStorage.setItem(s,JSON.stringify(d))}catch(c){}this._records=d}},l={_record:!1,init(){var d;try{let c=JSON.parse((d=window.localStorage.getItem(i))!=null?d:"false");typeof c=="boolean"&&(this._record=c)}catch(c){this._record=!1}if(this._record){let c=a.values[a.values.length-1],p=c?Date.now()-c.timestamp:r;p<=r&&p>0?o(p):this._record=!1}},get value(){return this._record},set value(d){try{window.localStorage.setItem(i,JSON.stringify(d))}catch(c){}this._record=d}};return a.init(),l.init(),d=>{if(l.value)return"WAITING_BANNED_RELEASE";let c=Date.now();if(a.values=a.values.concat({timestamp:c,type:d}),a.values.length!==1&&(a.values.length>e&&(a.values=a.values.slice(-e)),a.values.length===e&&c-a.values[0].timestamp<=t))return l.value=!0,o(r),"BANNED_FOR_TIME"}},Xi=e=>{let t=Date.now();return()=>{if(Date.now()-t<=e)return"BLOCK_INITIAL"}},Zi=(e=2e3)=>{let t=0,r=null;return o=>{if(o==="reward"){if(r)return t+=1,{reason:"HOLDING_HIGH_FREQ",info:{count:t}};r=window.setTimeout(()=>{r&&(window.clearTimeout(r),r=0,t=0)},e)}}}});var gt,xo=k(()=>{"use strict";K();gt=class{constructor(t){this.httpClient=t;this.configs=null;this.firstRun=!0;this.init()}init(){return T(this,null,function*(){try{this.configs=yield this.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config")}catch(t){}})}shouldBypassCallingInterstitial(){var r,n;let t;if(!this.configs)this.init(),t=!this.firstRun;else{let o=(r=w.channel)!=null?r:"",s=this.configs[o],i=(n=s==null?void 0:s.interstitialRate)!=null?n:1;t=Math.random()<i}return this.firstRun=!1,t}}});var Oe,_t,Ir=k(()=>{"use strict";So();Eo();K();xo();A();Oe=new te,_t=class{constructor(t,r,n){this.track=t;this.httpClient=r;this.checkNetwork=n;this.configured=!1;this.config={};this.getGameId=()=>w.mpId;this.getTestAdsMode=()=>w.testAdsMode;this.asyncLoad=()=>T(this,null,function*(){var i,a,l,u,d;let t="ca-pub-7171363994453626",r,n,o=window.encodeURIComponent(window.btoa((i=this.getGameId())!=null?i:"")),s=(a=this.getTestAdsMode())!=null?a:!1;try{let c=yield this.httpClient.get("/public/ads",{query:{objectId:o,testAdsMode:`${s}`}});t=(l=c.data)==null?void 0:l.clientId,r=(u=c.data)==null?void 0:u.channelId,n=(d=c.data)==null?void 0:d.unitId}catch(c){console.error("Failed to fetch client info",c)}this.clientId=t,this.channelId=r,this.unitId=n});this.asyncInit=t=>T(this,null,function*(){var o;if(typeof window=="undefined")return;yield this.asyncLoad();let r="google-adsense",n=(o=this.getTestAdsMode())!=null?o:!1;if(!document.getElementById(r)&&this.clientId){let s=document.createElement("script");s.id=r,s.async=!0,s.crossOrigin="anonymous",s.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.clientId}`,n&&s.setAttribute("data-adbreak-test","on"),this.channelId&&s.setAttribute("data-ad-channel",this.channelId),document.head.appendChild(s),this.track("LoadAdsenseCompleted",null)}});this.push=(t={})=>{window.adsbygoogle.push(t)};this.wrapAdBreakParams=t=>{if((n=>n.type==="preroll")(t)){Oe.emit("isAdShowing",!0);let n=t.adBreakDone,o=s=>{Oe.emit("isAdShowing",!1),n&&n(s)};return N(_({},t),{adBreakDone:o})}else{let n=t.beforeAd,o=t.afterAd,s=()=>{var a;Oe.emit("isAdShowing",!0),this.track("CallBeforeAd",{type:t.type,name:(a=t.name)!=null?a:""}),n&&n()},i=()=>{var a;Oe.emit("isAdShowing",!1),this.track("CallAfterAd",{type:t.type,name:(a=t.name)!=null?a:""}),o&&o()};return N(_({},t),{beforeAd:s,afterAd:i})}};this.adConfig=t=>{let o=t,{onReady:r}=o,n=W(o,["onReady"]);this.track("CallAdConfig",n),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(t))};this.adBreak=t=>{var u,d,c,p,m,y;if(!this.getGameId()){console.warn("Game ID is not set, skip calling adBreak");return}if(t.type!=="reward"&&!this.channelPolicy.shouldBypassCallingInterstitial()){(u=t.adBreakDone)==null||u.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}let{reason:r,info:n}=this.antiCheating.checkAdsDisplayPermission(t.type==="reward"?"reward":"interstitial");switch(r){case"NETWORK_NOT_OK":case"BANNED_FOR_SESSION":(d=t.adBreakDone)==null||d.call(t,{breakType:t.type,breakName:r,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"}),this.antiCheating.report(r);return;case"BLOCK_INITIAL":case"BANNED_FOR_TIME":case"WAITING_BANNED_RELEASE":(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"}),this.antiCheating.report(r);return;case"HOLDING_HIGH_FREQ":(m=t.adBreakDone)==null||m.call(t,{breakFormat:t.type==="reward"?"reward":"interstitial",breakName:"",breakStatus:((p=n==null?void 0:n.count)!=null?p:0)>6?"other":"frequencyCapped",breakType:t.type}),n!=null&&n.count&&n.count!==0&&n.count%3===0&&this.antiCheating.report(r,n==null?void 0:n.count);return;default:break}let o=t.type,s=t.adBreakDone,i=v=>{var h;this.adsActionDetection.adBreakIsShowing=!1,this.track("CallAdBreakDone",{breakType:v.breakType,breakName:(h=v.breakName)!=null?h:"",breakFormat:v.breakFormat,breakStatus:v.breakStatus}),s&&s(v)};if(t.adBreakDone=i,t.type==="reward"){let v=t.beforeReward,h=b=>()=>{this.track("CallShowAdFn",null),b()},g=b=>{v&&v(h(b))};t.beforeReward=g}let a;switch(o){case"preroll":a={type:o};break;case"start":case"pause":case"next":case"browse":case"reward":a={type:o,name:(y=t.name)!=null?y:""};break}this.adsActionDetection.adBreakIsShowing=!0,this.track("CallAdBreak",a);let l=this.wrapAdBreakParams(t);this.push(l),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")};this.adUnit=t=>T(this,null,function*(){var p,m,y,v;if(this.track("CallAdUnit",{adFormat:(m=(p=t.adFormat)==null?void 0:p.toString())!=null?m:null,fullWidthResponsive:(y=t.fullWidthResponsive)!=null?y:null}),this.clientId||(yield this.asyncLoad()),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:r,slot:n,adFormat:o,fullWidthResponsive:s,style:i}=t,a;if(!r)throw new Error("targeting element is required");if(typeof r=="string"?a=document.querySelector(r):a=r,!a)throw new Error("targeting element not found");let l=n;if(l||(l=this.unitId),!l)throw new Error("slot is required");let u=typeof o=="object"&&Array.isArray(o)?o.join(", "):o,d=document.createElement("ins");if(d.className="adsbygoogle",d.id="jolibox-ads",d.style.display="block",d.setAttribute("data-ad-client",this.clientId),d.setAttribute("data-ad-slot",l),u&&d.setAttribute("data-ad-format",u),s&&d.setAttribute("data-full-width-responsive",s),i&&d.setAttribute("style",i),(v=this.getTestAdsMode())!=null?v:!1){let h=document.createElement("div");h.style.position="absolute",h.style.top="0",h.style.left="0",h.style.width="100%",h.style.height="100%",h.style.display="flex",h.style.justifyContent="center",h.style.alignItems="center",h.style.backgroundColor="rgba(0, 0, 0, 0.5)",h.style.color="white",h.innerHTML="Test Ad",d.style.position="relative",a.appendChild(d),d.appendChild(h)}else a.appendChild(d),new MutationObserver(g=>{g.forEach(b=>{if(b.type==="attributes"&&b.attributeName==="data-ad-status"){let E=d.getAttribute("data-ad-status");this.track("AdSenseUnitStatusChanged",{status:E!=null?E:"null"})}})}).observe(d,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})});this.antiCheating=new ht(t,r,n),this.adsActionDetection=new ft(this.track),this.channelPolicy=new gt(r)}init(t){this.track("CallAdsInit",null),typeof window!="undefined"&&(this.config=t!=null?t:{},window.adsbygoogle=window.adsbygoogle||[],this.asyncInit(t))}}});function me(e,t){for(var r in t)e[r]=t[r];return e}function Ur(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Ie(e,t,r){var n,o,s,i={};for(s in t)s=="key"?n=t[s]:s=="ref"?o=t[s]:i[s]=t[s];if(arguments.length>2&&(i.children=arguments.length>3?xt.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(s in e.defaultProps)i[s]===void 0&&(i[s]=e.defaultProps[s]);return bt(e,i,n,o,null)}function bt(e,t,r,n,o){var s={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o!=null?o:++zo,__i:-1,__u:0};return o==null&&x.vnode!=null&&x.vnode(s),s}function Re(e){return e.children}function fe(e,t){this.props=e,this.context=t}function Fe(e,t){if(t==null)return e.__?Fe(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?Fe(e):null}function es(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return es(e)}}function Ro(e){(!e.__d&&(e.__d=!0)&&xe.push(e)&&!Tt.__r++||Io!==x.debounceRendering)&&((Io=x.debounceRendering)||Qo)(Tt)}function Tt(){for(var e,t,r,n,o,s,i,a=1;xe.length;)xe.length>a&&xe.sort(Yo),e=xe.shift(),a=xe.length,e.__d&&(r=void 0,o=(n=(t=e).__v).__e,s=[],i=[],t.__P&&((r=me({},n)).__v=n.__v+1,x.vnode&&x.vnode(r),Mr(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[o]:null,s,o!=null?o:Fe(n),!!(32&n.__u),i),r.__v=n.__v,r.__.__k[r.__i]=r,ns(s,r,i),r.__e!=o&&es(r)));Tt.__r=0}function ts(e,t,r,n,o,s,i,a,l,u,d){var c,p,m,y,v,h,g=n&&n.__k||Zo,b=t.length;for(l=ta(r,t,g,l,b),c=0;c<b;c++)(m=r.__k[c])!=null&&(p=m.__i===-1?Ge:g[m.__i]||Ge,m.__i=c,h=Mr(e,m,p,o,s,i,a,l,u,d),y=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&Lr(p.ref,null,m),d.push(m.ref,m.__c||y,m)),v==null&&y!=null&&(v=y),4&m.__u||p.__k===m.__k?l=rs(m,l,e):typeof m.type=="function"&&h!==void 0?l=h:y&&(l=y.nextSibling),m.__u&=-7);return r.__e=v,l}function ta(e,t,r,n,o){var s,i,a,l,u,d=r.length,c=d,p=0;for(e.__k=new Array(o),s=0;s<o;s++)(i=t[s])!=null&&typeof i!="boolean"&&typeof i!="function"?(l=s+p,(i=e.__k[s]=typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?bt(null,i,null,null,null):Qe(i)?bt(Re,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?bt(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,a=null,(u=i.__i=ra(i,r,l,c))!==-1&&(c--,(a=r[u])&&(a.__u|=2)),a==null||a.__v===null?(u==-1&&(o>d?p--:o<d&&p++),typeof i.type!="function"&&(i.__u|=4)):u!=l&&(u==l-1?p--:u==l+1?p++:(u>l?p--:p++,i.__u|=4))):e.__k[s]=null;if(c)for(s=0;s<d;s++)(a=r[s])!=null&&!(2&a.__u)&&(a.__e==n&&(n=Fe(a)),ss(a,a));return n}function rs(e,t,r){var n,o;if(typeof e.type=="function"){for(n=e.__k,o=0;n&&o<n.length;o++)n[o]&&(n[o].__=e,t=rs(n[o],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=Fe(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function St(e,t){return t=t||[],e==null||typeof e=="boolean"||(Qe(e)?e.some(function(r){St(r,t)}):t.push(e)),t}function ra(e,t,r,n){var o,s,i=e.key,a=e.type,l=t[r];if(l===null&&e.key==null||l&&i==l.key&&a===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(o=r-1,s=r+1;o>=0||s<t.length;){if(o>=0){if((l=t[o])&&!(2&l.__u)&&i==l.key&&a===l.type)return o;o--}if(s<t.length){if((l=t[s])&&!(2&l.__u)&&i==l.key&&a===l.type)return s;s++}}return-1}function Ao(e,t,r){t[0]=="-"?e.setProperty(t,r!=null?r:""):e[t]=r==null?"":typeof r!="number"||ea.test(t)?r:r+"px"}function vt(e,t,r,n,o){var s;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Ao(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Ao(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")s=t!=(t=t.replace(Xo,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=r,r?n?r.t=n.t:(r.t=Fr,e.addEventListener(t,s?Pr:Nr,s)):e.removeEventListener(t,s?Pr:Nr,s);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r!=null?r:"";break e}catch(i){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Co(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Fr++;else if(t.u<r.t)return;return r(x.event?x.event(t):t)}}}function Mr(e,t,r,n,o,s,i,a,l,u){var d,c,p,m,y,v,h,g,b,E,P,R,S,ee,G,le,Ce,X=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),s=[a=t.__e=r.__e]),(d=x.__b)&&d(t);e:if(typeof X=="function")try{if(g=t.props,b="prototype"in X&&X.prototype.render,E=(d=X.contextType)&&n[d.__c],P=d?E?E.props.value:d.__:n,r.__c?h=(c=t.__c=r.__c).__=c.__E:(b?t.__c=c=new X(g,P):(t.__c=c=new fe(g,P),c.constructor=X,c.render=oa),E&&E.sub(c),c.props=g,c.state||(c.state={}),c.context=P,c.__n=n,p=c.__d=!0,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&X.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=me({},c.__s)),me(c.__s,X.getDerivedStateFromProps(g,c.__s))),m=c.props,y=c.state,c.__v=t,p)b&&X.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&X.getDerivedStateFromProps==null&&g!==m&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,P),!c.__e&&(c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,P)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(ye){ye&&(ye.__=t)}),R=0;R<c._sb.length;R++)c.__h.push(c._sb[R]);c._sb=[],c.__h.length&&i.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,P),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(m,y,v)})}if(c.context=P,c.props=g,c.__P=e,c.__e=!1,S=x.__r,ee=0,b){for(c.state=c.__s,c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),G=0;G<c._sb.length;G++)c.__h.push(c._sb[G]);c._sb=[]}else do c.__d=!1,S&&S(t),d=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++ee<25);c.state=c.__s,c.getChildContext!=null&&(n=me(me({},n),c.getChildContext())),b&&!p&&c.getSnapshotBeforeUpdate!=null&&(v=c.getSnapshotBeforeUpdate(m,y)),le=d,d!=null&&d.type===Re&&d.key==null&&(le=os(d.props.children)),a=ts(e,Qe(le)?le:[le],t,r,n,o,s,i,a,l,u),c.base=t.__e,t.__u&=-161,c.__h.length&&i.push(c),h&&(c.__E=c.__=null)}catch(ye){if(t.__v=null,l||s!=null)if(ye.then){for(t.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;s[s.indexOf(a)]=null,t.__e=a}else for(Ce=s.length;Ce--;)Ur(s[Ce]);else t.__e=r.__e,t.__k=r.__k;x.__e(ye,t,r)}else s==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):a=t.__e=na(r.__e,t,r,n,o,s,i,l,u);return(d=x.diffed)&&d(t),128&t.__u?void 0:a}function ns(e,t,r){for(var n=0;n<r.length;n++)Lr(r[n],r[++n],r[++n]);x.__c&&x.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(s){s.call(o)})}catch(s){x.__e(s,o.__v)}})}function os(e){return typeof e!="object"||e==null?e:Qe(e)?e.map(os):me({},e)}function na(e,t,r,n,o,s,i,a,l){var u,d,c,p,m,y,v,h=r.props,g=t.props,b=t.type;if(b=="svg"?o="http://www.w3.org/2000/svg":b=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),s!=null){for(u=0;u<s.length;u++)if((m=s[u])&&"setAttribute"in m==!!b&&(b?m.localName==b:m.nodeType==3)){e=m,s[u]=null;break}}if(e==null){if(b==null)return document.createTextNode(g);e=document.createElementNS(o,b,g.is&&g),a&&(x.__m&&x.__m(t,s),a=!1),s=null}if(b===null)h===g||a&&e.data===g||(e.data=g);else{if(s=s&&xt.call(e.childNodes),h=r.props||Ge,!a&&s!=null)for(h={},u=0;u<e.attributes.length;u++)h[(m=e.attributes[u]).name]=m.value;for(u in h)if(m=h[u],u!="children"){if(u=="dangerouslySetInnerHTML")c=m;else if(!(u in g)){if(u=="value"&&"defaultValue"in g||u=="checked"&&"defaultChecked"in g)continue;vt(e,u,null,m,o)}}for(u in g)m=g[u],u=="children"?p=m:u=="dangerouslySetInnerHTML"?d=m:u=="value"?y=m:u=="checked"?v=m:a&&typeof m!="function"||h[u]===m||vt(e,u,m,h[u],o);if(d)a||c&&(d.__html===c.__html||d.__html===e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(c&&(e.innerHTML=""),ts(t.type==="template"?e.content:e,Qe(p)?p:[p],t,r,n,b=="foreignObject"?"http://www.w3.org/1999/xhtml":o,s,i,s?s[0]:r.__k&&Fe(r,0),a,l),s!=null)for(u=s.length;u--;)Ur(s[u]);a||(u="value",b=="progress"&&y==null?e.removeAttribute("value"):y!==void 0&&(y!==e[u]||b=="progress"&&!y||b=="option"&&y!==h[u])&&vt(e,u,y,h[u],o),u="checked",v!==void 0&&v!==e[u]&&vt(e,u,v,h[u],o))}return e}function Lr(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(o){x.__e(o,r)}}function ss(e,t,r){var n,o;if(x.unmount&&x.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Lr(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(s){x.__e(s,t)}n.base=n.__P=null}if(n=e.__k)for(o=0;o<n.length;o++)n[o]&&ss(n[o],t,r||typeof e.type!="function");r||Ur(e.__e),e.__c=e.__=e.__e=void 0}function oa(e,t,r){return this.constructor(e,r)}function No(e,t,r){var n,o,s,i;t==document&&(t=document.documentElement),x.__&&x.__(e,t),o=(n=!1)?null:t.__k,s=[],i=[],Mr(t,e=t.__k=Ie(Re,null,[e]),o||Ge,Ge,t.namespaceURI,o?null:t.firstChild?xt.call(t.childNodes):null,s,o?o.__e:t.firstChild,n,i),ns(s,e,i)}function Br(e,t){L.__h&&L.__h(U,e,ze||t),ze=0;var r=U.__H||(U.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Bo(e){return ze=1,sa(ls,e)}function sa(e,t,r){var n=Br(We++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):ls(void 0,t),function(a){var l=n.__N?n.__N[0]:n.__[0],u=n.t(l,a);l!==u&&(n.__N=[u,n.__[1]],n.__c.setState({}))}],n.__c=U,!U.__f)){var o=function(a,l,u){if(!n.__c.__H)return!0;var d=n.__c.__H.__.filter(function(p){return!!p.__c});if(d.every(function(p){return!p.__N}))return!s||s.call(this,a,l,u);var c=n.__c.props!==a;return d.forEach(function(p){if(p.__N){var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(c=!0)}}),s&&s.call(this,a,l,u)||c};U.__f=!0;var s=U.shouldComponentUpdate,i=U.componentWillUpdate;U.componentWillUpdate=function(a,l,u){if(this.__e){var d=s;s=void 0,o(a,l,u),s=d}i&&i.call(this,a,l,u)},U.shouldComponentUpdate=o}return n.__N||n.__}function kt(e,t){var r=Br(We++,3);!L.__s&&cs(r.__H,t)&&(r.__=e,r.u=t,U.__H.__h.push(r))}function Et(e){return ze=5,as(function(){return{current:e}},[])}function as(e,t){var r=Br(We++,7);return cs(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function ae(e,t){return ze=8,as(function(){return e},t)}function ia(){for(var e;e=is.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(wt),e.__H.__h.forEach(Or),e.__H.__h=[]}catch(t){e.__H.__h=[],L.__e(t,e.__v)}}function aa(e){var t,r=function(){clearTimeout(n),jo&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);jo&&(t=requestAnimationFrame(r))}function wt(e){var t=U,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),U=t}function Or(e){var t=U;e.__c=e.__(),U=t}function cs(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function ls(e,t){return typeof t=="function"?t(e):t}function us(e,t){for(var r in t)e[r]=t[r];return e}function Dr(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function Ho(e,t){this.props=e,this.context=t}function ca(e,t){function r(o){var s=this.props.ref,i=s==o.ref;return!i&&s&&(s.call?s(null):s.current=null),t?!t(this.props,o)||!i:Dr(this.props,o)}function n(o){return this.shouldComponentUpdate=r,Ie(e,o)}return n.displayName="Memo("+(e.displayName||e.name)+")",n.prototype.isReactComponent=!0,n.__f=!0,n}function ua(e){function t(r){var n=us({},r);return delete n.ref,e(n,r.ref||null)}return t.$$typeof=la,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}function ds(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=us({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return ds(n,t,r)})),e}function ps(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return ps(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Ar(){this.__u=0,this.o=null,this.__b=null}function ms(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function yt(){this.i=null,this.l=null}function va(){}function ya(){return this.cancelBubble}function ba(){return this.defaultPrevented}function C(e,t,r,n,o,s){t||(t={});var i,a,l=t;if("ref"in l)for(a in l={},t)a=="ref"?i=t[a]:l[a]=t[a];var u={type:e,props:l,key:r,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wa,__i:-1,__u:0,__source:o,__self:s};if(typeof e=="function"&&(i=e.defaultProps))for(a in i)l[a]===void 0&&(l[a]=i[a]);return x.vnode&&x.vnode(u),u}function Ca(a){var l=a,{elementTag:e="Image",src:t="",children:r,handleExposure:n,className:o,imgStyle:s}=l,i=W(l,["elementTag","src","children","handleExposure","className","imgStyle"]);let u=Aa(()=>{t&&n()});return e==="Image"?C("div",{className:o,style:{borderRadius:"8px"},children:Ie("img",N(_({},i),{ref:u,src:t!=null?t:"",style:_({display:"block",width:"100%",height:"auto",objectFit:"contain",maxWidth:"100%",maxHeight:"100%",borderRadius:"8px"},s||{})}))}):C("div",N(_({},i),{ref:u,className:o,children:r}))}function Na(e,t){if(!e)return null;let r=Array.isArray(t)?t[0]:t,n=Array.isArray(t)?t[1]:0;return Array.isArray(e)?e.map((o,s)=>o&&typeof o=="object"&&"type"in o?Ie(o.type,N(_({},o.props),{style:N(_({},o.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0}),key:o.key||s})):o):e&&typeof e=="object"&&"type"in e?Ie(e.type,N(_({},e.props),{style:N(_({},e.props.style||{}),{paddingLeft:r>0?`${r/2}px`:void 0,paddingRight:r>0?`${r/2}px`:void 0,paddingTop:n>0?`${n/2}px`:void 0,paddingBottom:n>0?`${n/2}px`:void 0})})):e}var xt,x,zo,xe,Io,Qo,Yo,Xo,Fr,Nr,Pr,Ge,Zo,ea,Qe,We,U,Rr,Po,ze,is,L,Oo,Do,Fo,Uo,Mo,Lo,jo,$o,la,da,Jo,Vo,pa,ma,fa,ha,ga,_a,Ko,ka,qo,Go,Wo,wa,Cr,Ta,Sa,Ea,xa,Ia,Ra,Aa,fs,hs,Pa,Oa,Da,Fa,De,Ua,gs,_s=k(()=>{"use strict";Ge={},Zo=[],ea=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qe=Array.isArray;xt=Zo.slice,x={__e:function(e,t,r,n){for(var o,s,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((s=o.constructor)&&s.getDerivedStateFromError!=null&&(o.setState(s.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,n||{}),i=o.__d),i)return o.__E=o}catch(a){e=a}throw e}},zo=0,fe.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=me({},this.state),typeof e=="function"&&(e=e(me({},r),this.props)),e&&me(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ro(this))},fe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ro(this))},fe.prototype.render=Re,xe=[],Qo=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yo=function(e,t){return e.__v.__b-t.__v.__b},Tt.__r=0,Xo=/(PointerCapture)$|Capture$/i,Fr=0,Nr=Co(!1),Pr=Co(!0);ze=0,is=[],L=x,Oo=L.__b,Do=L.__r,Fo=L.diffed,Uo=L.__c,Mo=L.unmount,Lo=L.__;L.__b=function(e){U=null,Oo&&Oo(e)},L.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Lo&&Lo(e,t)},L.__r=function(e){Do&&Do(e),We=0;var t=(U=e.__c).__H;t&&(Rr===U?(t.__h=[],U.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(wt),t.__h.forEach(Or),t.__h=[],We=0)),Rr=U},L.diffed=function(e){Fo&&Fo(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(is.push(t)!==1&&Po===L.requestAnimationFrame||((Po=L.requestAnimationFrame)||aa)(ia)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Rr=U=null},L.__c=function(e,t){t.some(function(r){try{r.__h.forEach(wt),r.__h=r.__h.filter(function(n){return!n.__||Or(n)})}catch(n){t.some(function(o){o.__h&&(o.__h=[])}),t=[],L.__e(n,r.__v)}}),Uo&&Uo(e,t)},L.unmount=function(e){Mo&&Mo(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{wt(n)}catch(o){t=o}}),r.__H=void 0,t&&L.__e(t,r.__v))};jo=typeof requestAnimationFrame=="function";(Ho.prototype=new fe).isPureReactComponent=!0,Ho.prototype.shouldComponentUpdate=function(e,t){return Dr(this.props,e)||Dr(this.state,t)};$o=x.__b;x.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),$o&&$o(e)};la=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;da=x.__e;x.__e=function(e,t,r,n){if(e.then){for(var o,s=t;s=s.__;)if((o=s.__c)&&o.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),o.__c(e,t)}da(e,t,r,n)};Jo=x.unmount;x.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Jo&&Jo(e)},(Ar.prototype=new fe).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var o=ms(n.__v),s=!1,i=function(){s||(s=!0,r.__R=null,o?o(a):a())};r.__R=i;var a=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=ps(l,l.__c.__P,l.__c.__O)}var u;for(n.setState({__a:n.__b=null});u=n.o.pop();)u.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(i,i)},Ar.prototype.componentWillUnmount=function(){this.o=[]},Ar.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=ds(this.__b,r,n.__O=n.__P)}this.__b=null}var o=t.__a&&Ie(Re,null,e.fallback);return o&&(o.__u&=-33),[Ie(Re,null,t.__a?null:e.children),o]};Vo=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(yt.prototype=new fe).__a=function(e){var t=this,r=ms(t.__v),n=t.l.get(e);return n[0]++,function(o){var s=function(){t.props.revealOrder?(n.push(o),Vo(t,e,n)):o()};r?r(s):s()}},yt.prototype.render=function(e){this.i=null,this.l=new Map;var t=St(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},yt.prototype.componentDidUpdate=yt.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){Vo(e,r,t)})};pa=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,ma=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,fa=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,ha=/[A-Z0-9]/g,ga=typeof document<"u",_a=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};fe.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(fe.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});Ko=x.event;x.event=function(e){return Ko&&(e=Ko(e)),e.persist=va,e.isPropagationStopped=ya,e.isDefaultPrevented=ba,e.nativeEvent=e};ka={enumerable:!1,configurable:!0,get:function(){return this.class}},qo=x.vnode;x.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,o={},s=n.indexOf("-")===-1;for(var i in r){var a=r[i];if(!(i==="value"&&"defaultValue"in r&&a==null||ga&&i==="children"&&n==="noscript"||i==="class"||i==="className")){var l=i.toLowerCase();i==="defaultValue"&&"value"in r&&r.value==null?i="value":i==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?i="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||_a(r.type)?l==="onfocus"?i="onfocusin":l==="onblur"?i="onfocusout":fa.test(i)&&(i=l):l=i="oninput":s&&ma.test(i)?i=i.replace(ha,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&o[i=l]&&(i="oninputCapture"),o[i]=a}}n=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=St(r.children).forEach(function(u){u.props.selected=o.value.indexOf(u.props.value)!=-1})),n=="select"&&o.defaultValue!=null&&(o.value=St(r.children).forEach(function(u){u.props.selected=o.multiple?o.defaultValue.indexOf(u.props.value)!=-1:o.defaultValue==u.props.value})),r.class&&!r.className?(o.class=r.class,Object.defineProperty(o,"className",ka)):(r.className&&!r.class||r.class&&r.className)&&(o.class=o.className=r.className),t.props=o}(e),e.$$typeof=pa,qo&&qo(e)};Go=x.__r;x.__r=function(e){Go&&Go(e),e.__c};Wo=x.diffed;x.diffed=function(e){Wo&&Wo(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value)};wa=0;Cr={drawerBackdrop:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.5)",display:"flex",justifyContent:"center",alignItems:"flex-end",zIndex:1e3,overflow:"hidden",touchAction:"none"},drawer:{backgroundColor:"white",borderRadius:"16px 16px 0 0",width:"100%",maxWidth:"100%",overflowY:"auto",position:"relative",boxShadow:"0 -2px 10px rgba(0, 0, 0, 0.1)",display:"flex",flexDirection:"column",margin:"0 auto"},drawerContent:{flex:1,width:"100%",height:"100%",overflow:"auto",margin:"0 auto"}},Ta=`
|
|
20
20
|
@keyframes fadeIn {
|
|
21
21
|
from { opacity: 0; }
|
|
22
22
|
to { opacity: 1; }
|
|
@@ -52,6 +52,19 @@ var Xi=Object.create;var Ze=Object.defineProperty,Zi=Object.defineProperties,es=
|
|
|
52
52
|
.drawer-leave {
|
|
53
53
|
animation: slideDown 0.3s ease forwards;
|
|
54
54
|
}
|
|
55
|
-
`,Sa=({children:e,isOpen:t=!1,onClose:r,height:n="50%",className:o="",backdropColor:i},s)=>{let[a,l]=Bo(t),[u,d]=Bo(null),c=Et(null),p=Et(!1);kt(()=>{let S=document.createElement("style");return S.innerHTML=Ta,document.head.appendChild(S),()=>{document.head.removeChild(S)}},[]),kt(()=>{t!==a&&!p.current&&(l(t),d(t?"enter":"leave"))},[t,a]);let m=ae(()=>{u==="leave"&&(d(null),l(!1),p.current=!1)},[u]),y=ae(S=>{S.preventDefault(),S.stopPropagation(),S.target===c.current&&h()},[]),v=ae(()=>{p.current=!1,l(!0),d("enter")},[]),h=ae(()=>{p.current=!0,d("leave"),r&&r()},[r]),g=ae(()=>a&&!p.current,[a]);if(kt(()=>{if(s){let S={show:v,hide:h,isOpen:g};typeof s=="function"?s(S):s&&(s.current=S)}},[v,h,g,s]),!a&&!u)return null;let b=P(_({},Cr.drawer),{height:typeof n=="number"?`${n}px`:n,backgroundColor:i||"rgba(255, 255, 255, 1)"}),E=_({},Cr.drawerBackdrop),N=u?`drawer-${u}`:"",R=u?`backdrop-${u}`:"";return C("div",{ref:c,style:E,className:R,onClick:y,onTouchMove:S=>S.preventDefault(),children:C("div",{style:b,className:`${N} ${o}`,onAnimationEnd:m,onTouchMove:S=>S.stopPropagation(),children:C("div",{style:Cr.drawerContent,children:e})})})},Ea=ua(Sa),xa=({title:e,content:t,noHeader:r,padding:n="16px",footerButtons:o,onClose:i})=>{let s={container:{display:"flex",flexDirection:"column",height:"100%",width:"100%",maxWidth:"440px",margin:"0 auto"},header:{padding:"16px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center"},content:{padding:n,flex:1,overflow:"auto"},footer:{padding:"16px",borderTop:"1px solid #eee",display:"flex",justifyContent:"flex-end",gap:"8px"},closeButton:{background:"none",border:"none",cursor:"pointer",fontSize:"20px"},button:{padding:"8px 16px",borderRadius:"4px",border:"1px solid #ddd",cursor:"pointer"}};return C("div",{style:s.container,children:[!r&&C("div",{style:s.header,children:[C("h3",{children:e}),C("button",{style:s.closeButton,onClick:i,children:"\xD7"})]}),C("div",{style:s.content,children:t}),o&&o.length>0&&C("div",{style:s.footer,children:o.map((a,l)=>C("button",{style:P(_({},s.button),{backgroundColor:a.variant==="primary"?"#1677ff":"#fff",color:a.variant==="primary"?"#fff":"#333"}),onClick:u=>{var d;return(d=a.onClick)==null?void 0:d.call(a,u,{hide:i})},children:a.text},l))})]})},Ia=(()=>{let e=null;return()=>(e||(e=document.createElement("div"),e.id=`jolibox-ui-modal-container-${Math.random().toString(36).substring(2,15)}`,document.body.appendChild(e)),e)})(),Ra=e=>{let t=Ia(),r=null,n=!1,o=!1,i=()=>{o||(n=!1,e.onClose&&e.onClose(),a())},s=()=>window.innerWidth>window.innerHeight,a=()=>{Po(C(Ea,{ref:u=>{r=u},isOpen:n,onClose:i,height:s()?"90vh":"50vh",backdropColor:e.backdropColor,children:C(xa,P(_({},e),{onClose:i}))}),t)},l=()=>{!o&&n&&a()};return window.addEventListener("resize",l),a(),{show:()=>{o||(n=!0,a(),setTimeout(()=>{r&&(r.show(),e.onOpen&&e.onOpen())},0))},hide:()=>{o||r&&r.hide()},isOpen:()=>n,destroy:()=>{o=!0,window.removeEventListener("resize",l),r&&r.hide(),setTimeout(()=>{t.parentNode&&(Po(null,t),t.remove())},300)}}},Aa=(e,t={threshold:.6})=>{let r=Et(null),n=Et(!1),o=ae(i=>{let[s]=i;s.isIntersecting&&!n.current?(n.current=!0,e()):s.isIntersecting||(n.current=!1)},[e]);return kt(()=>{if(r.current){let i=new IntersectionObserver(o,t);return i.observe(r.current),()=>{r.current&&i.unobserve(r.current)}}},[o,t]),r};fi=i=>{var s=i,{children:e,fluid:t=!1,className:r="",style:n={}}=s,o=W(s,["children","fluid","className","style"]);let a=_({width:"100%",marginLeft:"auto",marginRight:"auto",paddingLeft:"15px",paddingRight:"15px",boxSizing:"border-box",maxWidth:t?"100%":void 0},n);return C("div",P(_({className:r,style:a},o),{children:e}))},hi=a=>{var l=a,{children:e,gutter:t=0,justify:r="start",align:n="top",className:o="",style:i={}}=l,s=W(l,["children","gutter","justify","align","className","style"]);let u={start:"flex-start",end:"flex-end",center:"center","space-around":"space-around","space-between":"space-between"},d={top:"flex-start",middle:"center",bottom:"flex-end"},c=_({display:"flex",flexWrap:"wrap",boxSizing:"border-box",justifyContent:u[r],alignItems:d[n]},i);if(t){let m=Array.isArray(t)?t[0]:t,y=Array.isArray(t)?t[1]:0;m>0&&(c.marginLeft=`-${m/2}px`,c.marginRight=`-${m/2}px`),y>0&&(c.marginTop=`-${y/2}px`,c.marginBottom=`-${y/2}px`)}let p=t?Pa(e,t):e;return C("div",P(_({className:o,style:c},s),{children:p}))};Na=c=>{var p=c,{children:e,span:t,offset:r,xs:n,sm:o,md:i,lg:s,xl:a,className:l="",style:u={}}=p,d=W(p,["children","span","offset","xs","sm","md","lg","xl","className","style"]);let m=_({position:"relative",width:"100%",paddingLeft:"15px",paddingRight:"15px",boxSizing:"border-box"},u);if(t!==void 0){let y=t/24*100;m.flex=`0 0 ${y}%`,m.maxWidth=`${y}%`}return r!==void 0&&(m.marginLeft=`${r/24*100}%`),C("div",P(_({className:l,style:m},d),{children:e}))},Oa=({game:e,layerName:t,routeMode:r,onGameClick:n})=>{var s,a;let o=ae(l=>{l.preventDefault(),n==null||n(e)},[n,e]),i=ae(()=>{},[e,t]);return C(Na,{span:8,className:"relative px-[4px] box-border mb-[8px]",style:{marginBottom:"8px"},onClick:o,role:"button",tabIndex:0,onTouchEnd:o,children:[C("div",{className:"relative w-full mb-[2px] ion-no-margin",children:C(Ca,{src:(a=(s=e.logo)!=null?s:e.cover)!=null?a:"",className:"w-full h-full absolute top-0 left-0 aspect-square rounded-[8px] object-cover",style:{display:"block",objectFit:"cover"},handleExposure:i})}),C("div",{className:"block text-white max-w-full text-[15px] leading-[1.2] overflow-hidden whitespace-nowrap text-ellipsis font-normal break-words",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",wordBreak:"break-word",color:"white",maxWidth:"100%",fontSize:"15px",lineHeight:1.2,fontWeight:"normal"},children:e.name})]},e.gameId)},Da=i=>{var s=i,{list:e,routeMode:t,layerName:r,onGameClick:n}=s,o=W(s,["list","routeMode","layerName","onGameClick"]);return C(fi,{className:"w-full max-w-[440px] mx-auto flex-grow overflow-y-auto",children:C(hi,{gutter:8,className:"flex-wrap",children:e==null?void 0:e.map(a=>C(Oa,{game:a,routeMode:t,layerName:r,onGameClick:n},a.gameId))})})},Fa=ca(Da),De=(e=>(e.Dismiss="DISMISS",e.Quit="QUIT",e))(De||{}),Ua=e=>{let{games:t,title:r,buttons:n,onClose:o}=e,i=ae(a=>{o==null||o({type:a.type===De.Quit?"quit":"dismiss"})},[]),s=ae(a=>{o==null||o({type:"navigate",data:{game:a}})},[o]);return t.length?C("div",{className:"recommend-panel",style:{backgroundColor:"#1a1a1a",width:"100%",height:"100%"},children:C("div",{className:"container",style:{height:"100%",display:"flex",flexDirection:"column",position:"relative"},children:[C("p",{className:"text-white text-[18px] leading-[24px] text-center py-[20px] px-[10px]",style:{color:"#ffffff",fontSize:"18px",lineHeight:"24px",textAlign:"center",paddingTop:"20px",paddingBottom:"20px",paddingLeft:"10px",paddingRight:"10px"},children:r}),C("div",{style:{flex:1,overflow:"auto",marginBottom:"88px"},children:C(Fa,{list:t||[],routeMode:"REDIRECT",layerName:"RecommendedGuide",onGameClick:s})}),C("div",{className:"pb-[16px] px-[16px] w-full",style:{position:"fixed",bottom:"32px",left:"0",right:"0",width:"100%",maxWidth:"440px",margin:"0 auto",background:"inherit",paddingTop:"16px"},children:C(fi,{children:C(hi,{gutter:10,children:(n!=null?n:[]).map((a,l)=>C("div",{style:{flex:"0 0 50%",boxSizing:"border-box"},children:C("button",{style:{width:"100%",height:"40px",borderRadius:"21px",whiteSpace:"nowrap",lineHeight:"40px",paddingLeft:"8px",paddingRight:"8px",border:"1px solid",borderColor:a.type===De.Quit?"#ffffff30":"#7817FF",backgroundColor:a.type===De.Quit?"#ffffff2c":"#7817FF",color:(a.type,De.Quit,"#fff"),cursor:"pointer",flex:1,textAlign:"center",fontSize:"14px",fontWeight:"normal",outline:"none",overflow:"hidden",textOverflow:"ellipsis"},className:`h-[40px] rounded-[21px] whitespace-nowrap leading-[40px] px-[8px] border-solid border-[1px] flex-1 bg-[#ffffff2c] ${a.type,De.Quit,"active:border-[#7E41FF] border-[#ffffff30]"}`,onClick:()=>i(a),children:a.text})},l))})})})]})}):C(Re,{})},gi=e=>{let t=Ra({title:e.title,content:C(Ua,{games:e.games,title:e.title,buttons:e.buttons,onClose:e.onClose}),backdropColor:"#1a1a1a",placement:"bottom",noHeader:!0,padding:"0px",onClose:()=>{console.log("onClose")},onOpen:e.onOpen});return t.show(),t}});function vi(){return T(this,null,function*(){if(jr)return jr;let t=`${w.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com"}/api/user-retention/exit-recommendations?objectId=${w.mpId}&from=GAME_DETAIL`,{response:{data:r}}=yield Z(t);return jr=r,r})}function yi(){return T(this,null,function*(){let e=new ie;if(w.mpType!=="game")return e.resolve(!1),e.promise;let t=yield vi();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:o}=t.data,i=gi({games:r.games,title:n,buttons:o,onClose:s=>{var a;switch(s.type){case"quit":e.resolve(!1);break;case"dismiss":e.resolve(!0);break;case"navigate":(a=s.data)!=null&&a.game?Ma(s.data.game):e.resolve(!0),i.hide();break;default:e.resolve(!0);break}}});return e.promise})}var jr,Ma,bi=k(()=>{"use strict";K();V();A();_i();Ke();jr=null;vi();Ma=e=>{var a;let{data:t}=O("envSync"),r=new URL(t.schema),n=r.pathname,o=new URLSearchParams(r.search);o.set("gameId",w.mpId),o.set("joliSource",w.encodeJoliSourceQuery({__mpType:"game",__orientation:(a=e.orientation)!=null?a:"VERTICAL"}));let s=`${`https://${e.gameId}.content.jolibox.com/`}${n}?${o.toString()}`;O("openSchemaSync",{schema:s})}});var wi={};tn(wi,{config:()=>Ha});function La(){pe.on("onDocumentReady",()=>{var e;(e=_e)==null||e.onDocumentReady(window.location.href),Y("onDocumentReady",{start_timestamp:At,timestamp:Date.now()})})}function Ba(e){w.mpType==="game"&&q.start(e)}function ja(){se("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&w.onEnvConfigChanged({hostUserInfo:e}),pe.emit("LifecycleEvent.onReady",_({},w.hostUserInfo?w.hostUserInfo:{isLogin:!1})),Y("joliboxServiceReady",{start_timestamp:At,timestamp:Date.now()}),Ba(t)}),se("onBeforeExit",({uuid:e})=>{var t;(t=_e)==null||t.doExit(e)})}function Ha(){At=Date.now(),ja(),La(),It=wo()}var It,ki,Rt,At,Ti=k(()=>{"use strict";V();lt();K();A();ve();To();Ir();bi();ne.onReady(()=>{});ki=()=>{Y("onBeforeExit",{timestamp:Date.now()}),It==null||It(),q.close(Date.now()-At)};ne.doExit(()=>T(void 0,null,function*(){return Rt?!0:He(w.shouldInterupt)?(w.shouldInterupt||ki(),w.shouldInterupt):(yield yi())?!0:(ki(),!1)}));Rt=!1;Oe.on("isAdShowing",e=>{Rt=e,He(Rt)&&O("updateContainerConfigSync",{displayCapsuleButton:!Rt,webviewId:w.webviewId})})});function Si(e){let t=ar.config[e];return t||(t={},ar.config[e]=t),(r,n)=>{if(t[r]){z.warn(`[can i use] ${r} already registered`);return}t[r]=_({},n)}}var Ei=k(()=>{"use strict";A()});function Hr(e){xi=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 he(e){return typeof e=="number"}function $r(e){let t=Jr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Jr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var xi,B,Pt,Nt,Ot,Dt,Ue,Ft,Ut,Mt,Lt,Bt,jt,Ht,$t,Jt,Vt,Kt,qt,Vr=k(()=>{"use strict";xi=!1;B=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(xi)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}};Pt=class extends B{validate(t){return this._optional&&t===void 0?!0:he(t)?he(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):he(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):he(this._greater)&&t<=this._greater?this.fail(`the value of ${this.path} should be greater than ${this._greater}`):this._isInt&&t!==Math.floor(t)?this.fail(`the value of ${this.path} should be integer but got ${t}`):!0:this.fail({expect:"number",actual:t})}min(t){return this._min=t,this}max(t){return this._max=t,this}isInt(t){return this._isInt=t,this}greater(t){return this._greater=t,this}},Nt=class extends B{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ot=class extends B{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(he(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(he(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},Dt=class extends B{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Ue=class extends B{validate(t){return!0}},Ft=class extends B{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Ut=class extends B{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Mt=class extends B{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Lt=class extends B{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${$r(t)}`)}return!0}},Bt=class extends B{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(he(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(he(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(he(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let o=!0;if(r.forEach((i,s)=>{if(n.path=`${this.path}[${s}]`,n.errors=this.errors,i===void 0&&n.hasDefault){r[s]=n.defaultValue;return}n.validate(i)||(n.hasFallback?r[s]=n.fallbackValue:o=!1)}),this._uniqueItems){let i=new Map;for(let s in r)i.has(r[s])?o=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${i.get(r[s])}] and ${this.path}[${s}] are identical)`):i.set(r[s],s)}return o}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},jt=class extends B{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Jr(r)!=="object")return this.fail({expect:"object",actual:r});let o=r,i=this._value;i.errors=this.errors;let s=!0;for(let a in o){let l=o[a];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(a)?i.path=`${this.path}.${a}`:i.path=`${this.path}["${a}"]`,!(l===void 0&&i._optional)){if(l===void 0&&i.hasDefault){o[a]=i.defaultValue;continue}i.validate(l)||(i.hasFallback?o[a]=i.fallbackValue:s=!1)}}return s}},Ht=class extends B{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Jr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,o=!0;for(let i in this._object){let s=n[i],a=this._object[i];if(a.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(i)?a.path=`${this.path}.${i}`:a.path=`${this.path}["${i}"]`,!(a._optional&&s===void 0)){if(s===void 0&&a.hasDefault){n[i]=a.defaultValue;continue}a.validate(s)||(a.hasFallback?n[i]=a.fallbackValue:o=!1)}}return o}},$t=class extends B{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}},Jt=class extends B{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,o=this._items.length;for(let i=0;i<o;i++){let s=this._items[i];if(s.errors=[],s.path=this.path,!s.validate(t))r.push(s.errors.join("; "));else if(!n){n=!0;break}}if(!n){let i=r.join(`
|
|
56
|
-
|
|
57
|
-
`);throw e.errors.length=0,Hr(!1),new TypeError(n)}}var f,qr=k(()=>{"use strict";Vr();Vr();f={object(e){return new Ht(e)},array(e){return new Bt(e)},tuple(...e){return new Vt(...e)},literal(e){return new $t(e)},or(...e){return new Jt(...e)},symbol(){return new Dt},record(e){return new jt(e)},function(){return new Mt},boolean(){return new Nt},string(){return new Ot},number(){return new Pt},undefined(){return new Ft},null(){return new Ut},unknown(){return new Ue},any(){return new Ue},as(){return new Ue},arraybuffer(){return new Kt},enum(...e){return new Lt(...e)},typedarray(e){return new qt(e)}}});var Gt,Ii,Ri=k(()=>{"use strict";A();re();qr();ge();Gt=1,Ii=e=>{function t(n,o){return(...i)=>{var c,p,m,y;let s=Date.now(),a={method:n,trace_id:Gt};Gt+=1;let l="SUCCESS",u=`${n}:ok`,d=0;try{if(o.paramsSchema)try{Kr(o.paramsSchema,i,"params")}catch(b){throw dr(`${n}:fail ${b.message}`)}let v=o.implement(...i),h=v,g=`${n}:ok`;if(v&&"code"in v){let{code:b,data:E,message:N}=v;l=b,h=E,g=N}return{code:l,message:g,data:h}}catch(v){let h=v;d=(p=(c=h.code)!=null?c:h.errNo)!=null?p:2e3,l="FAILURE";let g=(y=(m=h.message)!=null?m:h.errMsg)!=null?y:`${v}`;return u=`${n}:${l} ${g.replace(/^\S+:(fail|cancel)\s?/,"")}`,H(new Ve(u,d)),{code:l,message:u}}finally{let v=Date.now()-s;e("apiInvoked",P(_({},a),{duration:v,status:l}))}}}function r(n,o){return(...i)=>T(this,null,function*(){var p,m,y,v;let s=cn(i)?i:[i],a=Date.now(),l={method:n,trace_id:Gt};Gt+=1;let u=`${n}:ok`,d="SUCCESS",c={code:d,message:u};try{if(o.paramsSchema)try{Kr(o.paramsSchema,s,"params")}catch(b){throw dr(b.message)}let g=yield o.implement(...s);if(g&&"code"in g){let{code:b,data:E,message:N}=g;d=b,u=N,g=E}return Object.assign(c,{code:d,message:u,data:g}),c}catch(h){let g=h,b=(m=(p=g.code)!=null?p:g.errNo)!=null?m:2e3;d="FAILURE";let E=(v=(y=g.message)!=null?y:g.errMsg)!=null?v:`${h}`,N=`${n}:${d} ${E.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(c,{code:d,message:N}),H(new Ve(N,b)),c}finally{let h=Date.now()-a;e("apiInvoked",P(_({},l),{duration:h,status:d}))}})}return{createAPI:r,createSyncAPI:t}}});var j,F,I,ce=k(()=>{"use strict";Ei();ve();Ri();qr();({createAPI:j,createSyncAPI:F}=Ii(Y)),I=Si("native")});var Ai,Ja,Va,Ka,qa,Ci=k(()=>{"use strict";A();ce();V();Ai=M(),Ja="env",Va="getSystemInfoSync",Ka=F(Va,{implement:()=>{var r;let e=O("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform,version:t.sdkInfo.jssdkVersion,pixelRatio:t.deviceInfo.pixelRatio,language:t.deviceInfo.lang,brand:t.deviceInfo.brand,appName:(r=t.hostInfo)==null?void 0:r.appName,SDKVersion:t.sdkInfo.jssdkVersion}}}),qa=F(Ja,{implement:()=>{var t;let e=O("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});Ai.registerCommand("API.getSystemInfoSync",Ka);Ai.registerCommand("API.env",qa);I("env",{version:"1.0.0"});I("getSystemInfoSync",{version:"1.0.0"})});var Pi=en(Gr=>{"use strict";A();ce();re();V();ve();K();var Ga="exitGame",Wa="onReady",za="onJoliboxShow",Qa="onJoliboxHide",Wt=M(),zt=ot(H),Ya=j(Ga,{paramsSchema:f.tuple(f.function(),f.boolean().optional().default(!1)),implement:(e,t=!1)=>T(Gr,null,function*(){zt(e).call(Gr),He(w.shouldInterupt)&&!w.shouldInterupt&&w.from&&qn("onRetentionResult",{shouldStay:t},w.from,!0),yield Q("exitAppAsync")})}),Xa=F(za,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);se("onJoliboxEnterForeground",()=>{t.call(this),qe.emit("visible",!0)})}}),Za=F(Qa,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);se("onJoliboxEnterBackground",()=>{t.call(this),qe.emit("visible",!1)})}}),ec=F(Wa,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);pe.on("LifecycleEvent.onReady",r=>{t(r)})}});Wt.registerCommand("LifecycleSDK.exit",Ya);Wt.registerCommand("LifecycleSDK.onReady",ec);Wt.registerCommand("LifecycleSDK.onJoliboxShow",Xa);Wt.registerCommand("LifecycleSDK.onJoliboxHide",Za);I("lifeCycle.exit",{version:"1.0.0"});I("lifeCycle.onReady",{version:"1.0.0"});I("lifeCycle.onJoliboxShow",{version:"1.0.0"});I("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function Ni(e){let t={};if(!J(e))return t;for(let[r,n]of Object.entries(e)){let o=r.toLocaleLowerCase();n?typeof n=="object"?t[o]=Object.prototype.toString.call(n):t[o]=String(n):t[o]=""}return t}function Oi(e="GET"){if(e==="")return"POST";let t=e.toUpperCase();return["GET","OPTIONS","HEAD","POST","PUT","DELETE","TRACE","CONNECT","PATCH"].includes(t)?t:"GET"}function Di(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Fi(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!J(r))return e;let[n,o=""]=e.split("?"),i=JSON.stringify(_(_({},JSON.parse(o)),r));return`${n}?${i}`}var Ui=k(()=>{"use strict";A()});var tc,rc,Wr,zr,Mi,nc,oc,ic,Li=k(()=>{"use strict";ge();Er();ce();Ui();A();re();tc=15,rc=pt("createRequestTaskSync","operateRequestTaskSync",{type:"public"}),Wr=0,zr=[],Mi=ot(H),nc=(e,t)=>{let r=e.filter(t),n=e.filter(o=>!t(o));return e.length=0,e.push(...n),r},oc=e=>{let t=new ie,r=()=>{};return j("request",{paramsSchema:f.tuple(f.object({url:f.string(),method:f.string(),header:f.object(),data:f.object().optional(),query:f.object().optional(),dataType:f.string().default("json"),responseType:f.string().default("text"),enableCache:f.boolean().default(!1),appendHostCookie:f.boolean().default(!0),timeout:f.number().default(3e4),success:f.function(),fail:f.function()})),implement(o){let i=()=>T(this,null,function*(){var a,l;let s=Mi(o.fail);try{if(Wr+=1,t.state!=="pending")return;let{data:u,dataType:d,responseType:c,enableCache:p,appendHostCookie:m}=o,y=Ni(o.header),v=Oi(o.method),h=Di(o.timeout),g=Fi(o.url,v,u),b=Mi(o.success),E=Object.assign({},o,{method:v,header:y,data:v==="GET"||v==="HEAD"?void 0:u,enableCache:p,query:(a=o.query)!=null?a:{},dataType:d,responseType:c,appendHostCookie:m});h&&(E.timeout=h);let N=rc(g,E);{let{response:R}=yield N,{code:S,data:ee,message:G}=R;t.resolve({code:S!=null?S:"SUCCESS",data:ee,message:G!=null?G:"request:ok"}),b({code:"SUCCESS",message:"request:ok",data:ee})}}catch(u){t.reject(u),s({code:"FAILURE",message:"httpRequst: failed"})}finally{Wr-=1,(l=zr.shift())==null||l()}});return Wr>=tc?(r=()=>{nc(zr,s=>s===i)},zr.push(i)):i(),t.promise}})(e),{abort(){t.reject(Te({code:-1,msg:"request:fail abort"})),r()}}},ic=M();ic.registerCommand("HttpSDK.request",oc);I("request",{version:"1.0.0"})});function dc(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return uc.includes(t)?t:""}function pc(e,t){try{switch(t){case"string":return e;case"object":return JSON.parse(e);case"number":return parseFloat(e);case"boolean":return e==="true";default:return""}}catch(r){return""}}function mc(e,t){try{switch(t){case"string":case"number":case"boolean":return`${e}`;case"object":return JSON.stringify(e);default:return""}}catch(r){return""}}var Qt,sc,ac,cc,lc,pm,mm,uc,Bi=k(()=>{"use strict";ce();V();A();Ke();K();Qt=M(),sc=j("getLocalStorage",{paramsSchema:f.tuple(f.string()),implement(e){return T(this,null,function*(){let{response:t}=yield Z(`/api/games/user-storage/${w.mpId}`,{method:"GET",responseType:"json",appendHostCookie:!0,query:{key:e}}),{data:{code:r,message:n,data:o}}=yield t;if(r==="SUCCESS")return{code:r,message:n,data:o==null?void 0:o.value};try{let{data:{data:i,dataType:s}}=yield Q("getLocalStorageAsync",{key:e}),a=pc(i,s);return{code:r,message:`${n}. fallback to native`,data:a}}catch(i){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});Qt.registerCommand("StorageSDK.getItem",sc);I("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});ac=j("setStorage",{paramsSchema:f.tuple(f.string(),f.or(f.string(),f.boolean(),f.number())),implement(e,t){return T(this,null,function*(){let r=w.mpId,n=typeof t=="string"?t:String(t),{response:o}=yield Z(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:i,message:s}}=o,a=dc(t),l=mc(t,a);return yield Q("setLocalStorageAsync",{key:e,data:l,dataType:a}),i=="SUCCESS"?{code:i,message:s}:{code:i,message:`${s}. fallback to native`}})}});Qt.registerCommand("StorageSDK.setItem",ac);I("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});cc=j("removeStorage",{paramsSchema:f.tuple(f.string()),implement(e){return T(this,null,function*(){let t=w.mpId,{response:r}=yield Z(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:o}}=r;return yield Q("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:o}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});Qt.registerCommand("StorageSDK.removeItem",cc);I("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});lc=j("clearStorage",{implement(){return T(this,null,function*(){let e=w.mpId,{response:t}=yield Z(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});Q("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});Qt.registerCommand("StorageSDK.clear",lc);I("storage.clear",{version:"1.0.0"});pm=j("getStorageInfo",{implement(){return T(this,null,function*(){let{data:e}=yield Q("getStorageInfoAsync");return e})}});I("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});mm=F("getStorageInfoSync",{implement(){return O("getStorageInfoSync")}}),uc=["string","number","boolean","object",""]});var fc,hc,gc,Qr,ji=k(()=>{"use strict";A();V();ce();fc=F("showKeyboard",{paramsSchema:f.tuple(f.object({defaultValue:f.string().optional().default(""),multiple:f.boolean().optional().default(!1),maxLength:f.unknown().optional().default(1e5)})),implement(e){var n;let t=Math.floor((n=Number(e.maxLength))!=null?n:1e5),{defaultValue:r}=e;r&&t&&(r=r.slice(0,t)),O("showKeyboardSync",P(_({},e),{defaultValue:r,maxLength:t}))}});I("keyboard.showKeyboard",{version:"1.0.0",properties:{params:{defaultValue:"1.0.0",multiple:"1.0.0",confirmHold:"1.0.0",confirmType:"1.0.0",maxLength:"1.0.0"}},success:{errMsg:"1.0.0"}});hc=F("updateKeyboard",{paramsSchema:f.tuple(f.object({value:f.string()})),implement(e){O("updateKeyboardSync",e)}});I("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});gc=F("hideKeyboard",{implement(){O("hideKeyboardSync")}});I("keyboard.hideKeyboard",{version:"1.0.0"});Qr=M();Qr.registerCommand("KeyboardSDK.showKeyboard",fc);Qr.registerCommand("KeyboardSDK.updateKeyboard",hc);Qr.registerCommand("KeyboardSDK.hideKeyboard",gc)});var Hi=en(Ae=>{"use strict";A();ce();ve();var Me=M(),_c=j("levelFinished",{paramsSchema:f.tuple(f.string(),f.object({result:f.boolean(),duration:f.number()})),implement:(e,t)=>T(Ae,null,function*(){let{result:r,duration:n}=t,o=[];o.push(q.tracker("LevelFinished",{levelId:e,result:r,duration:n})),o.push(q.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(o)})}),vc=j("taskFinished",{paramsSchema:f.tuple(f.string(),f.object({duration:f.number()})),implement:(e,t)=>T(Ae,null,function*(){let{duration:r}=t;return yield q.reportToNative({event:"TaskFinished",params:{duration:r,taskId:e}})})}),yc=j("levelUpgrade",{paramsSchema:f.tuple(f.string(),f.string()),implement:(e,t)=>T(Ae,null,function*(){let r=[];r.push(q.reportToNative({event:"LevelUpgrade",params:{name:t,levelId:e}})),yield Promise.all(r)})}),bc=j("onHistoryUserLevel",{paramsSchema:f.tuple(f.number()),implement:e=>T(Ae,null,function*(){return yield q.reportToNative({event:"HistoryUserLevel",params:{level:e}})})}),kc=j("onHistoryUserScore",{paramsSchema:f.tuple(f.number()),implement:e=>T(Ae,null,function*(){return yield q.reportToNative({event:"HistoryUserScore",params:{score:e}})})}),wc=j("taskEvent",{paramsSchema:f.tuple(f.string(),f.object({tools:f.array(f.object({id:f.string(),name:f.string(),count:f.number(),description:f.string().optional(),price:f.object({amount:f.number(),unit:f.string()}).optional()})).optional(),awards:f.array(f.object({id:f.string(),name:f.string()})).optional()})),implement:(e,t)=>T(Ae,null,function*(){var n,o;let r=[];r.push(q.reportToNative({event:"TaskEvent",params:_({taskId:e},t)})),(o=(n=t.tools)==null?void 0:n.length)!=null&&o&&(r.push(q.reporter({event:"USE_GAME_ITEM"})),r.push(q.reportToNative({event:"UseGameItem",params:_({taskId:e},t)}))),yield Promise.all(r)})});Me.registerCommand("TaskTrackerSDK.levelFinished",_c);Me.registerCommand("TaskTrackerSDK.taskFinished",vc);Me.registerCommand("TaskTrackerSDK.levelUpgrade",yc);Me.registerCommand("TaskTrackerSDK.historyUserLevel",bc);Me.registerCommand("TaskTrackerSDK.historyUserScore",kc);Me.registerCommand("TaskTrackerSDK.taskEvent",wc);I("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});I("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});I("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});I("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});I("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});I("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});var Tc,Sc,$i,Ji=k(()=>{"use strict";K();V();ce();A();ge();I("login",{version:"1.0.0",properties:{force:"1.0.0"},success:{errMsg:"1.0.0",code:"1.0.0",token:"1.0.0",isLogin:"1.0.0"}});I("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0"}});Tc=j("login",{implement(){return T(this,null,function*(){var s;let{data:{isLogin:e}}=yield Q("checkLoginAsync");if(e)return{isLogin:!0,token:(s=w.hostUserInfo)==null?void 0:s.token};se("onLoginStateChange",({isLogin:a,token:l,uuid:u})=>{u==r&&o({isLogin:a,token:l})});let t=O("loginSync"),{data:{uuid:r}}=t;if(!r)throw Te({code:-1,msg:"login failed"});let{promise:n,resolve:o}=new ie,i=yield n;return w.onEnvConfigChanged({hostUserInfo:i}),pe.emit("onLoginComplete",i),i})}}),Sc=j("checkSession",{implement(){return T(this,null,function*(){let{data:{isLogin:e}}=yield Q("checkLoginAsync");return{isLogin:e}})}}),$i=M();$i.registerCommand("API.login",Tc);$i.registerCommand("API.checkSession",Sc)});var Yt,Ec,Xt,xc,Ic,Rc,Ac,Vi=k(()=>{"use strict";A();ce();Ir();ve();Ke();V();Yt=M(),Ec=()=>{let{data:e}=O("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},Xt=new _t(Y,{get:(e,t)=>Z(e,_({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data),post:(e,t,r)=>Z(e,_({method:"POST",responseType:"json",appendHostCookie:!0},r)).then(n=>n.response.data)},Ec),xc=F("adInit",{implement:e=>{Xt.init(e)}}),Ic=F("adConfig",{implement:e=>{Xt.adConfig(e)}}),Rc=F("adBreak",{implement:e=>{Xt.adBreak(e)}}),Ac=F("adUnit",{implement:e=>{Xt.adUnit(e)}});Yt.registerCommand("AdsSDK.init",xc);Yt.registerCommand("AdsSDK.adConfig",Ic);Yt.registerCommand("AdsSDK.adBreak",Rc);Yt.registerCommand("AdsSDK.adUnit",Ac);I("AdsSDK.init",{version:"1.0.0"});I("AdsSDK.adConfig",{version:"1.0.0"});I("AdsSDK.adBreak",{version:"1.0.0"});I("AdsSDK.adUnit",{version:"1.0.0"})});var Yr,Cc,Pc,Nc,Ki=k(()=>{"use strict";A();V();ce();K();Yr=M(),Cc=F("openSchemaSync",{paramsSchema:f.tuple(f.string()),implement:e=>{let t=e;e.match(/^https?:\/\//)||(t=`https://${w.mpId}.app.jolibox.com${e.startsWith("/")?"":"/"}${e}`);let r=O("openSchemaSync",{schema:t});if(r.errNo!==0)throw new Je(r.errMsg,r.errNo)}}),Pc=F("openPageSync",{paramsSchema:f.tuple(f.string()),implement:e=>{let{errNo:t,errMsg:r,data:n}=O("openPageSync",{url:e});if(t!==0||!n)throw new Je(r,t);return{webviewId:n.webviewId}}}),Nc=F("closePageSync",{paramsSchema:f.tuple(f.number()),implement:e=>{let{errNo:t,errMsg:r}=O("closePageSync",{webviewId:e});if(t!==0)throw new Je(r,t)}});Yr.registerCommand("RouterSDK.openSchema",Cc);Yr.registerCommand("RouterSDK.openPage",Pc);Yr.registerCommand("RouterSDK.closePage",Nc);I("router.openSchema",{version:"1.1.10"});I("router.openPage",{version:"1.1.10"});I("router.closePage",{version:"1.1.10"})});var Oc={};var Qm,ef,qi=k(()=>{"use strict";Ci();Qm=rn(Pi());Li();Bi();ji();ef=rn(Hi());Ji();Vi();Ki()});var Gi=Symbol.for("JOLIBOX_IMPLEMENT_INIT");if(window[Gi])throw console.info("Jolibox Implement Already Initialized"),new Error("Jolibox Implement Already Initialized");window[Gi]=!0;T(void 0,null,function*(){let[{config:e}]=yield Promise.all([Promise.resolve().then(()=>(Ti(),wi)),Promise.resolve().then(()=>(qi(),Oc)),Promise.resolve().then(()=>(ve(),ko))]);e()});
|
|
55
|
+
`,Sa=({children:e,isOpen:t=!1,onClose:r,height:n="50%",className:o="",backdropColor:s},i)=>{let[a,l]=Bo(t),[u,d]=Bo(null),c=Et(null),p=Et(!1);kt(()=>{let S=document.createElement("style");return S.innerHTML=Ta,document.head.appendChild(S),()=>{document.head.removeChild(S)}},[]),kt(()=>{t!==a&&!p.current&&(l(t),d(t?"enter":"leave"))},[t,a]);let m=ae(()=>{u==="leave"&&(d(null),l(!1),p.current=!1)},[u]),y=ae(S=>{S.preventDefault(),S.stopPropagation(),S.target===c.current&&h()},[]),v=ae(()=>{p.current=!1,l(!0),d("enter")},[]),h=ae(()=>{p.current=!0,d("leave"),r&&r()},[r]),g=ae(()=>a&&!p.current,[a]);if(kt(()=>{if(i){let S={show:v,hide:h,isOpen:g};typeof i=="function"?i(S):i&&(i.current=S)}},[v,h,g,i]),!a&&!u)return null;let b=N(_({},Cr.drawer),{height:typeof n=="number"?`${n}px`:n,backgroundColor:s||"rgba(255, 255, 255, 1)"}),E=_({},Cr.drawerBackdrop),P=u?`drawer-${u}`:"",R=u?`backdrop-${u}`:"";return C("div",{ref:c,style:E,className:R,onClick:y,onTouchMove:S=>S.preventDefault(),children:C("div",{style:b,className:`${P} ${o}`,onAnimationEnd:m,onTouchMove:S=>S.stopPropagation(),children:C("div",{style:Cr.drawerContent,children:e})})})},Ea=ua(Sa),xa=({title:e,content:t,noHeader:r,padding:n="16px",footerButtons:o,onClose:s})=>{let i={container:{display:"flex",flexDirection:"column",height:"100%",width:"100%",maxWidth:"440px",margin:"0 auto"},header:{padding:"16px",borderBottom:"1px solid #eee",display:"flex",justifyContent:"space-between",alignItems:"center"},content:{padding:n,flex:1,overflow:"auto"},footer:{padding:"16px",borderTop:"1px solid #eee",display:"flex",justifyContent:"flex-end",gap:"8px"},closeButton:{background:"none",border:"none",cursor:"pointer",fontSize:"20px"},button:{padding:"8px 16px",borderRadius:"4px",border:"1px solid #ddd",cursor:"pointer"}};return C("div",{style:i.container,children:[!r&&C("div",{style:i.header,children:[C("h3",{children:e}),C("button",{style:i.closeButton,onClick:s,children:"\xD7"})]}),C("div",{style:i.content,children:t}),o&&o.length>0&&C("div",{style:i.footer,children:o.map((a,l)=>C("button",{style:N(_({},i.button),{backgroundColor:a.variant==="primary"?"#1677ff":"#fff",color:a.variant==="primary"?"#fff":"#333"}),onClick:u=>{var d;return(d=a.onClick)==null?void 0:d.call(a,u,{hide:s})},children:a.text},l))})]})},Ia=()=>{let e=document.createElement("div");e.style.position="fixed",e.style.zIndex="9999",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.pointerEvents="none";let t=e.attachShadow({mode:"open"}),r=document.createElement("div");r.style.pointerEvents="auto",t.appendChild(r);let n=document.createElement("style");return n.textContent=`
|
|
56
|
+
:host {
|
|
57
|
+
all: initial;
|
|
58
|
+
}
|
|
59
|
+
* {
|
|
60
|
+
box-sizing: border-box;
|
|
61
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
62
|
+
}
|
|
63
|
+
h3 {
|
|
64
|
+
margin: 0;
|
|
65
|
+
font-size: 18px;
|
|
66
|
+
font-weight: 500;
|
|
67
|
+
}
|
|
68
|
+
`,t.appendChild(n),document.body.appendChild(e),{container:r,host:e,destroy:()=>{e.remove()}}},Ra=e=>{let{container:t,destroy:r}=Ia(),n=null,o=!1,s=!1,i=()=>{s||(o=!1,e.onClose&&e.onClose(),l())},a=()=>window.innerWidth>window.innerHeight,l=()=>{No(C(Ea,{ref:d=>{n=d},isOpen:o,onClose:i,height:a()?"90vh":"50vh",backdropColor:e.backdropColor,children:C(xa,N(_({},e),{onClose:i}))}),t)},u=()=>{!s&&o&&l()};return window.addEventListener("resize",u),l(),{show:()=>{s||(o=!0,l(),setTimeout(()=>{n&&(n.show(),e.onOpen&&e.onOpen())},0))},hide:()=>{s||n&&n.hide()},isOpen:()=>o,destroy:()=>{s=!0,window.removeEventListener("resize",u),n&&n.hide(),setTimeout(()=>{No(null,t),r()},300)}}},Aa=(e,t={threshold:.6})=>{let r=Et(null),n=Et(!1),o=ae(s=>{let[i]=s;i.isIntersecting&&!n.current?(n.current=!0,e()):i.isIntersecting||(n.current=!1)},[e]);return kt(()=>{if(r.current){let s=new IntersectionObserver(o,t);return s.observe(r.current),()=>{r.current&&s.unobserve(r.current)}}},[o,t]),r};fs=s=>{var i=s,{children:e,fluid:t=!1,className:r="",style:n={}}=i,o=W(i,["children","fluid","className","style"]);let a=_({width:"100%",marginLeft:"auto",marginRight:"auto",paddingLeft:"15px",paddingRight:"15px",boxSizing:"border-box",maxWidth:t?"100%":void 0},n);return C("div",N(_({className:r,style:a},o),{children:e}))},hs=a=>{var l=a,{children:e,gutter:t=0,justify:r="start",align:n="top",className:o="",style:s={}}=l,i=W(l,["children","gutter","justify","align","className","style"]);let u={start:"flex-start",end:"flex-end",center:"center","space-around":"space-around","space-between":"space-between"},d={top:"flex-start",middle:"center",bottom:"flex-end"},c=_({display:"flex",flexWrap:"wrap",boxSizing:"border-box",justifyContent:u[r],alignItems:d[n]},s);if(t){let m=Array.isArray(t)?t[0]:t,y=Array.isArray(t)?t[1]:0;m>0&&(c.marginLeft=`-${m/2}px`,c.marginRight=`-${m/2}px`),y>0&&(c.marginTop=`-${y/2}px`,c.marginBottom=`-${y/2}px`)}let p=t?Na(e,t):e;return C("div",N(_({className:o,style:c},i),{children:p}))};Pa=c=>{var p=c,{children:e,span:t,offset:r,xs:n,sm:o,md:s,lg:i,xl:a,className:l="",style:u={}}=p,d=W(p,["children","span","offset","xs","sm","md","lg","xl","className","style"]);let m=_({position:"relative",width:"100%",paddingLeft:"15px",paddingRight:"15px",boxSizing:"border-box"},u);if(t!==void 0){let y=t/24*100;m.flex=`0 0 ${y}%`,m.maxWidth=`${y}%`}return r!==void 0&&(m.marginLeft=`${r/24*100}%`),C("div",N(_({className:l,style:m},d),{children:e}))},Oa=({game:e,layerName:t,routeMode:r,onGameClick:n})=>{var i,a;let o=ae(l=>{l.preventDefault(),n==null||n(e)},[n,e]),s=ae(()=>{},[e,t]);return C(Pa,{span:8,className:"relative px-[4px] box-border mb-[8px]",style:{marginBottom:"8px"},onClick:o,role:"button",tabIndex:0,onTouchEnd:o,children:[C("div",{className:"relative w-full mb-[2px] ion-no-margin",children:C(Ca,{src:(a=(i=e.logo)!=null?i:e.cover)!=null?a:"",className:"w-full h-full absolute top-0 left-0 aspect-square rounded-[8px] object-cover",style:{display:"block",objectFit:"cover"},handleExposure:s})}),C("div",{className:"block text-white max-w-full text-[15px] leading-[1.2] overflow-hidden whitespace-nowrap text-ellipsis font-normal break-words",style:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",wordBreak:"break-word",color:"white",maxWidth:"100%",fontSize:"15px",lineHeight:1.2,fontWeight:"normal"},children:e.name})]},e.gameId)},Da=s=>{var i=s,{list:e,routeMode:t,layerName:r,onGameClick:n}=i,o=W(i,["list","routeMode","layerName","onGameClick"]);return C(fs,{className:"w-full max-w-[440px] mx-auto flex-grow overflow-y-auto",children:C(hs,{gutter:8,className:"flex-wrap",children:e==null?void 0:e.map(a=>C(Oa,{game:a,routeMode:t,layerName:r,onGameClick:n},a.gameId))})})},Fa=ca(Da),De=(e=>(e.Dismiss="DISMISS",e.Quit="QUIT",e))(De||{}),Ua=e=>{let{games:t,title:r,buttons:n,onClose:o}=e,s=ae(a=>{o==null||o({type:a.type===De.Quit?"quit":"dismiss"})},[]),i=ae(a=>{o==null||o({type:"navigate",data:{game:a}})},[o]);return t.length?C("div",{className:"recommend-panel",style:{backgroundColor:"#1a1a1a",width:"100%",height:"100%"},children:C("div",{className:"container",style:{height:"100%",display:"flex",flexDirection:"column",position:"relative"},children:[C("p",{className:"text-white text-[18px] leading-[24px] text-center py-[20px] px-[10px]",style:{color:"#ffffff",fontSize:"18px",lineHeight:"24px",textAlign:"center",paddingTop:"20px",paddingBottom:"20px",paddingLeft:"10px",paddingRight:"10px"},children:r}),C("div",{style:{flex:1,overflow:"auto",marginBottom:"88px"},children:C(Fa,{list:t||[],routeMode:"REDIRECT",layerName:"RecommendedGuide",onGameClick:i})}),C("div",{className:"pb-[16px] px-[16px] w-full",style:{position:"fixed",bottom:"32px",left:"0",right:"0",width:"100%",maxWidth:"440px",margin:"0 auto",background:"inherit",paddingTop:"16px"},children:C(fs,{children:C(hs,{gutter:10,children:(n!=null?n:[]).map((a,l)=>C("div",{style:{flex:"0 0 50%",boxSizing:"border-box"},children:C("button",{style:{width:"100%",height:"40px",borderRadius:"21px",whiteSpace:"nowrap",lineHeight:"40px",paddingLeft:"8px",paddingRight:"8px",border:"1px solid",borderColor:a.type===De.Quit?"#ffffff30":"#7817FF",backgroundColor:a.type===De.Quit?"#ffffff2c":"#7817FF",color:(a.type,De.Quit,"#fff"),cursor:"pointer",flex:1,textAlign:"center",fontSize:"14px",fontWeight:"normal",outline:"none",overflow:"hidden",textOverflow:"ellipsis"},className:`h-[40px] rounded-[21px] whitespace-nowrap leading-[40px] px-[8px] border-solid border-[1px] flex-1 bg-[#ffffff2c] ${a.type,De.Quit,"active:border-[#7E41FF] border-[#ffffff30]"}`,onClick:()=>s(a),children:a.text})},l))})})})]})}):C(Re,{})},gs=e=>{let t=Ra({title:e.title,content:C(Ua,{games:e.games,title:e.title,buttons:e.buttons,onClose:e.onClose}),backdropColor:"#1a1a1a",placement:"bottom",noHeader:!0,padding:"0px",onClose:()=>{console.log("onClose")},onOpen:e.onOpen});return t.show(),t}});function vs(){return T(this,null,function*(){if(jr)return jr;let t=`${w.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com"}/api/user-retention/exit-recommendations?objectId=${w.mpId}&from=GAME_DETAIL`,{response:{data:r}}=yield Z(t);return jr=r,r})}function ys(){return T(this,null,function*(){let e=new se;if(w.mpType!=="game")return e.resolve(!1),e.promise;let t=yield vs();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:o}=t.data,s=gs({games:r.games,title:n,buttons:o,onClose:i=>{var a;switch(i.type){case"quit":e.resolve(!1);break;case"dismiss":e.resolve(!0);break;case"navigate":(a=i.data)!=null&&a.game?Ma(i.data.game):e.resolve(!0),s.hide();break;default:e.resolve(!0);break}}});return e.promise})}var jr,Ma,bs=k(()=>{"use strict";K();V();A();_s();Ke();jr=null;vs();Ma=e=>{var i;let{data:t}=O("envSync"),r=new URL(t.schema),n=new URLSearchParams(r.search);n.set("gameId",e.gameId),n.set("joliSource",w.encodeJoliSourceQuery({__mpType:"game",__orientation:(i=e.orientation)!=null?i:"VERTICAL"}));let s=`${`https://${e.gameId}.content.jolibox.com/`}index.html?${n.toString()}`;O("openSchemaSync",{schema:s})}});var ws={};tn(ws,{config:()=>Ha});function La(){pe.on("onDocumentReady",()=>{var e;(e=_e)==null||e.onDocumentReady(window.location.href),Y("onDocumentReady",{start_timestamp:At,timestamp:Date.now()})})}function Ba(e){w.mpType==="game"&&q.start(e)}function ja(){ie("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&w.onEnvConfigChanged({hostUserInfo:e}),pe.emit("LifecycleEvent.onReady",_({},w.hostUserInfo?w.hostUserInfo:{isLogin:!1})),Y("joliboxServiceReady",{start_timestamp:At,timestamp:Date.now()}),Ba(t)}),ie("onBeforeExit",({uuid:e})=>{var t;(t=_e)==null||t.doExit(e)})}function Ha(){At=Date.now(),ja(),La(),It=wo()}var It,ks,Rt,At,Ts=k(()=>{"use strict";V();lt();K();A();ve();To();Ir();bs();ne.onReady(()=>{});ks=()=>{Y("onBeforeExit",{timestamp:Date.now()}),It==null||It(),q.close(Date.now()-At)};ne.doExit(()=>T(void 0,null,function*(){return Rt?!0:He(w.shouldInterupt)?(w.shouldInterupt||ks(),w.shouldInterupt):(yield ys())?!0:(ks(),!1)}));Rt=!1;Oe.on("isAdShowing",e=>{Rt=e,He(Rt)&&O("updateContainerConfigSync",{displayCapsuleButton:!Rt,webviewId:w.webviewId})})});function Ss(e){let t=ar.config[e];return t||(t={},ar.config[e]=t),(r,n)=>{if(t[r]){z.warn(`[can i use] ${r} already registered`);return}t[r]=_({},n)}}var Es=k(()=>{"use strict";A()});function Hr(e){xs=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 he(e){return typeof e=="number"}function $r(e){let t=Jr(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Jr(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var xs,B,Nt,Pt,Ot,Dt,Ue,Ft,Ut,Mt,Lt,Bt,jt,Ht,$t,Jt,Vt,Kt,qt,Vr=k(()=>{"use strict";xs=!1;B=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(xs)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}};Nt=class extends B{validate(t){return this._optional&&t===void 0?!0:he(t)?he(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):he(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):he(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}},Pt=class extends B{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ot=class extends B{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(he(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(he(this._minLength)&&t.length<this._minLength)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minLength}`);if(typeof this._pattern=="string"){if(!new RegExp(this._pattern).test(t))return this.fail(`${this.path} should match pattern "${this._pattern}"`)}else if(this._pattern&&!this._pattern.test(t))return this.fail(`${this.path} should match pattern "${this._pattern.toString()}"`);return!0}minLength(t){return this._minLength=t,this}maxLength(t){return this._maxLength=t,this}pattern(t){return this._pattern=t,this}},Dt=class extends B{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Ue=class extends B{validate(t){return!0}},Ft=class extends B{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Ut=class extends B{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Mt=class extends B{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Lt=class extends B{constructor(...t){super(),this._items=t}validate(t){if(this._optional&&t===void 0)return!0;if(!this._items.includes(t)){let r=this._items.map(n=>JSON.stringify(n)).join(", ");return this.fail(`expect ${this.path} to be one of ${r}, but got ${$r(t)}`)}return!0}},Bt=class extends B{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(he(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(he(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(he(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let o=!0;if(r.forEach((s,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,s===void 0&&n.hasDefault){r[i]=n.defaultValue;return}n.validate(s)||(n.hasFallback?r[i]=n.fallbackValue:o=!1)}),this._uniqueItems){let s=new Map;for(let i in r)s.has(r[i])?o=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${s.get(r[i])}] and ${this.path}[${i}] are identical)`):s.set(r[i],i)}return o}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},jt=class extends B{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Jr(r)!=="object")return this.fail({expect:"object",actual:r});let o=r,s=this._value;s.errors=this.errors;let i=!0;for(let a in o){let l=o[a];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(a)?s.path=`${this.path}.${a}`:s.path=`${this.path}["${a}"]`,!(l===void 0&&s._optional)){if(l===void 0&&s.hasDefault){o[a]=s.defaultValue;continue}s.validate(l)||(s.hasFallback?o[a]=s.fallbackValue:i=!1)}}return i}},Ht=class extends B{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Jr(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,o=!0;for(let s in this._object){let i=n[s],a=this._object[s];if(a.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?a.path=`${this.path}.${s}`:a.path=`${this.path}["${s}"]`,!(a._optional&&i===void 0)){if(i===void 0&&a.hasDefault){n[s]=a.defaultValue;continue}a.validate(i)||(a.hasFallback?n[s]=a.fallbackValue:o=!1)}}return o}},$t=class extends B{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}},Jt=class extends B{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,o=this._items.length;for(let s=0;s<o;s++){let i=this._items[s];if(i.errors=[],i.path=this.path,!i.validate(t))r.push(i.errors.join("; "));else if(!n){n=!0;break}}if(!n){let s=r.join(`
|
|
69
|
+
or `);this.errors.push(s)}return n}},Vt=class extends B{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let o=t[n];if(o._optional||o.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,o)=>{if(n.path=`${this.path}[${o}]`,n.errors=this.errors,t[o]===void 0&&n.hasDefault){t[o]=n.defaultValue;return}n.validate(t[o])||(n.hasFallback?t[o]=n._fallback:r=!1)}),r}},Kt=class extends B{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},qt=class extends B{constructor(t){super(),this._ctor=t}validate(t){return t===void 0&&this._optional||t instanceof this._ctor?!0:this.fail({expect:`typedarray of ${this._ctor.name}`,actual:t})}}});function Kr(e,t,r="param"){if(e.errors=[],e.path=r,Hr(!0),!e.validate(t)){let n=e.errors.join(`
|
|
70
|
+
`);throw e.errors.length=0,Hr(!1),new TypeError(n)}}var f,qr=k(()=>{"use strict";Vr();Vr();f={object(e){return new Ht(e)},array(e){return new Bt(e)},tuple(...e){return new Vt(...e)},literal(e){return new $t(e)},or(...e){return new Jt(...e)},symbol(){return new Dt},record(e){return new jt(e)},function(){return new Mt},boolean(){return new Pt},string(){return new Ot},number(){return new Nt},undefined(){return new Ft},null(){return new Ut},unknown(){return new Ue},any(){return new Ue},as(){return new Ue},arraybuffer(){return new Kt},enum(...e){return new Lt(...e)},typedarray(e){return new qt(e)}}});var Gt,Is,Rs=k(()=>{"use strict";A();re();qr();ge();Gt=1,Is=e=>{function t(n,o){return(...s)=>{var c,p,m,y;let i=Date.now(),a={method:n,trace_id:Gt};Gt+=1;let l="SUCCESS",u=`${n}:ok`,d=0;try{if(o.paramsSchema)try{Kr(o.paramsSchema,s,"params")}catch(b){throw dr(`${n}:fail ${b.message}`)}let v=o.implement(...s),h=v,g=`${n}:ok`;if(v&&"code"in v){let{code:b,data:E,message:P}=v;l=b,h=E,g=P}return{code:l,message:g,data:h}}catch(v){let h=v;d=(p=(c=h.code)!=null?c:h.errNo)!=null?p:2e3,l="FAILURE";let g=(y=(m=h.message)!=null?m:h.errMsg)!=null?y:`${v}`;return u=`${n}:${l} ${g.replace(/^\S+:(fail|cancel)\s?/,"")}`,H(new Ve(u,d)),{code:l,message:u}}finally{let v=Date.now()-i;e("apiInvoked",N(_({},a),{duration:v,status:l}))}}}function r(n,o){return(...s)=>T(this,null,function*(){var p,m,y,v;let i=cn(s)?s:[s],a=Date.now(),l={method:n,trace_id:Gt};Gt+=1;let u=`${n}:ok`,d="SUCCESS",c={code:d,message:u};try{if(o.paramsSchema)try{Kr(o.paramsSchema,i,"params")}catch(b){throw dr(b.message)}let g=yield o.implement(...i);if(g&&"code"in g){let{code:b,data:E,message:P}=g;d=b,u=P,g=E}return Object.assign(c,{code:d,message:u,data:g}),c}catch(h){let g=h,b=(m=(p=g.code)!=null?p:g.errNo)!=null?m:2e3;d="FAILURE";let E=(v=(y=g.message)!=null?y:g.errMsg)!=null?v:`${h}`,P=`${n}:${d} ${E.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(c,{code:d,message:P}),H(new Ve(P,b)),c}finally{let h=Date.now()-a;e("apiInvoked",N(_({},l),{duration:h,status:d}))}})}return{createAPI:r,createSyncAPI:t}}});var j,F,I,ce=k(()=>{"use strict";Es();ve();Rs();qr();({createAPI:j,createSyncAPI:F}=Is(Y)),I=Ss("native")});var As,Ja,Va,Ka,qa,Cs=k(()=>{"use strict";A();ce();V();As=M(),Ja="env",Va="getSystemInfoSync",Ka=F(Va,{implement:()=>{var r;let e=O("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform,version:t.sdkInfo.jssdkVersion,pixelRatio:t.deviceInfo.pixelRatio,language:t.deviceInfo.lang,brand:t.deviceInfo.brand,appName:(r=t.hostInfo)==null?void 0:r.appName,SDKVersion:t.sdkInfo.jssdkVersion}}}),qa=F(Ja,{implement:()=>{var t;let e=O("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});As.registerCommand("API.getSystemInfoSync",Ka);As.registerCommand("API.env",qa);I("env",{version:"1.0.0"});I("getSystemInfoSync",{version:"1.0.0"})});var Ns=en(Gr=>{"use strict";A();ce();re();V();ve();K();var Ga="exitGame",Wa="onReady",za="onJoliboxShow",Qa="onJoliboxHide",Wt=M(),zt=ot(H),Ya=j(Ga,{paramsSchema:f.tuple(f.function(),f.boolean().optional().default(!1)),implement:(e,t=!1)=>T(Gr,null,function*(){zt(e).call(Gr),He(w.shouldInterupt)&&!w.shouldInterupt&&w.from&&qn("onRetentionResult",{shouldStay:t},w.from,!0),yield Q("exitAppAsync")})}),Xa=F(za,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);ie("onJoliboxEnterForeground",()=>{t.call(this),qe.emit("visible",!0)})}}),Za=F(Qa,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);ie("onJoliboxEnterBackground",()=>{t.call(this),qe.emit("visible",!1)})}}),ec=F(Wa,{paramsSchema:f.tuple(f.function()),implement(e){let t=zt(e);pe.on("LifecycleEvent.onReady",r=>{t(r)})}});Wt.registerCommand("LifecycleSDK.exit",Ya);Wt.registerCommand("LifecycleSDK.onReady",ec);Wt.registerCommand("LifecycleSDK.onJoliboxShow",Xa);Wt.registerCommand("LifecycleSDK.onJoliboxHide",Za);I("lifeCycle.exit",{version:"1.0.0"});I("lifeCycle.onReady",{version:"1.0.0"});I("lifeCycle.onJoliboxShow",{version:"1.0.0"});I("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function Ps(e){let t={};if(!J(e))return t;for(let[r,n]of Object.entries(e)){let o=r.toLocaleLowerCase();n?typeof n=="object"?t[o]=Object.prototype.toString.call(n):t[o]=String(n):t[o]=""}return t}function Os(e="GET"){if(e==="")return"POST";let t=e.toUpperCase();return["GET","OPTIONS","HEAD","POST","PUT","DELETE","TRACE","CONNECT","PATCH"].includes(t)?t:"GET"}function Ds(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Fs(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!J(r))return e;let[n,o=""]=e.split("?"),s=JSON.stringify(_(_({},JSON.parse(o)),r));return`${n}?${s}`}var Us=k(()=>{"use strict";A()});var tc,rc,Wr,zr,Ms,nc,oc,sc,Ls=k(()=>{"use strict";ge();Er();ce();Us();A();re();tc=15,rc=pt("createRequestTaskSync","operateRequestTaskSync",{type:"public"}),Wr=0,zr=[],Ms=ot(H),nc=(e,t)=>{let r=e.filter(t),n=e.filter(o=>!t(o));return e.length=0,e.push(...n),r},oc=e=>{let t=new se,r=()=>{};return j("request",{paramsSchema:f.tuple(f.object({url:f.string(),method:f.string(),header:f.object(),data:f.object().optional(),query:f.object().optional(),dataType:f.string().default("json"),responseType:f.string().default("text"),enableCache:f.boolean().default(!1),appendHostCookie:f.boolean().default(!0),timeout:f.number().default(3e4),success:f.function(),fail:f.function()})),implement(o){let s=()=>T(this,null,function*(){var a,l;let i=Ms(o.fail);try{if(Wr+=1,t.state!=="pending")return;let{data:u,dataType:d,responseType:c,enableCache:p,appendHostCookie:m}=o,y=Ps(o.header),v=Os(o.method),h=Ds(o.timeout),g=Fs(o.url,v,u),b=Ms(o.success),E=Object.assign({},o,{method:v,header:y,data:v==="GET"||v==="HEAD"?void 0:u,enableCache:p,query:(a=o.query)!=null?a:{},dataType:d,responseType:c,appendHostCookie:m});h&&(E.timeout=h);let P=rc(g,E);{let{response:R}=yield P,{code:S,data:ee,message:G}=R;t.resolve({code:S!=null?S:"SUCCESS",data:ee,message:G!=null?G:"request:ok"}),b({code:"SUCCESS",message:"request:ok",data:ee})}}catch(u){t.reject(u),i({code:"FAILURE",message:"httpRequst: failed"})}finally{Wr-=1,(l=zr.shift())==null||l()}});return Wr>=tc?(r=()=>{nc(zr,i=>i===s)},zr.push(s)):s(),t.promise}})(e),{abort(){t.reject(Te({code:-1,msg:"request:fail abort"})),r()}}},sc=M();sc.registerCommand("HttpSDK.request",oc);I("request",{version:"1.0.0"})});function dc(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return uc.includes(t)?t:""}function pc(e,t){try{switch(t){case"string":return e;case"object":return JSON.parse(e);case"number":return parseFloat(e);case"boolean":return e==="true";default:return""}}catch(r){return""}}function mc(e,t){try{switch(t){case"string":case"number":case"boolean":return`${e}`;case"object":return JSON.stringify(e);default:return""}}catch(r){return""}}var Qt,ic,ac,cc,lc,pm,mm,uc,Bs=k(()=>{"use strict";ce();V();A();Ke();K();Qt=M(),ic=j("getLocalStorage",{paramsSchema:f.tuple(f.string()),implement(e){return T(this,null,function*(){let{response:t}=yield Z(`/api/games/user-storage/${w.mpId}`,{method:"GET",responseType:"json",appendHostCookie:!0,query:{key:e}}),{data:{code:r,message:n,data:o}}=yield t;if(r==="SUCCESS")return{code:r,message:n,data:o==null?void 0:o.value};try{let{data:{data:s,dataType:i}}=yield Q("getLocalStorageAsync",{key:e}),a=pc(s,i);return{code:r,message:`${n}. fallback to native`,data:a}}catch(s){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});Qt.registerCommand("StorageSDK.getItem",ic);I("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});ac=j("setStorage",{paramsSchema:f.tuple(f.string(),f.or(f.string(),f.boolean(),f.number())),implement(e,t){return T(this,null,function*(){let r=w.mpId,n=typeof t=="string"?t:String(t),{response:o}=yield Z(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:s,message:i}}=o,a=dc(t),l=mc(t,a);return yield Q("setLocalStorageAsync",{key:e,data:l,dataType:a}),s=="SUCCESS"?{code:s,message:i}:{code:s,message:`${i}. fallback to native`}})}});Qt.registerCommand("StorageSDK.setItem",ac);I("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});cc=j("removeStorage",{paramsSchema:f.tuple(f.string()),implement(e){return T(this,null,function*(){let t=w.mpId,{response:r}=yield Z(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:o}}=r;return yield Q("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:o}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});Qt.registerCommand("StorageSDK.removeItem",cc);I("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});lc=j("clearStorage",{implement(){return T(this,null,function*(){let e=w.mpId,{response:t}=yield Z(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});Q("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});Qt.registerCommand("StorageSDK.clear",lc);I("storage.clear",{version:"1.0.0"});pm=j("getStorageInfo",{implement(){return T(this,null,function*(){let{data:e}=yield Q("getStorageInfoAsync");return e})}});I("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});mm=F("getStorageInfoSync",{implement(){return O("getStorageInfoSync")}}),uc=["string","number","boolean","object",""]});var fc,hc,gc,Qr,js=k(()=>{"use strict";A();V();ce();fc=F("showKeyboard",{paramsSchema:f.tuple(f.object({defaultValue:f.string().optional().default(""),multiple:f.boolean().optional().default(!1),maxLength:f.unknown().optional().default(1e5)})),implement(e){var n;let t=Math.floor((n=Number(e.maxLength))!=null?n:1e5),{defaultValue:r}=e;r&&t&&(r=r.slice(0,t)),O("showKeyboardSync",N(_({},e),{defaultValue:r,maxLength:t}))}});I("keyboard.showKeyboard",{version:"1.0.0",properties:{params:{defaultValue:"1.0.0",multiple:"1.0.0",confirmHold:"1.0.0",confirmType:"1.0.0",maxLength:"1.0.0"}},success:{errMsg:"1.0.0"}});hc=F("updateKeyboard",{paramsSchema:f.tuple(f.object({value:f.string()})),implement(e){O("updateKeyboardSync",e)}});I("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});gc=F("hideKeyboard",{implement(){O("hideKeyboardSync")}});I("keyboard.hideKeyboard",{version:"1.0.0"});Qr=M();Qr.registerCommand("KeyboardSDK.showKeyboard",fc);Qr.registerCommand("KeyboardSDK.updateKeyboard",hc);Qr.registerCommand("KeyboardSDK.hideKeyboard",gc)});var Hs=en(Ae=>{"use strict";A();ce();ve();var Me=M(),_c=j("levelFinished",{paramsSchema:f.tuple(f.string(),f.object({result:f.boolean(),duration:f.number()})),implement:(e,t)=>T(Ae,null,function*(){let{result:r,duration:n}=t,o=[];o.push(q.tracker("LevelFinished",{levelId:e,result:r,duration:n})),o.push(q.reporter({event:"COMPLETE_GAME_LEVEL"})),yield Promise.all(o)})}),vc=j("taskFinished",{paramsSchema:f.tuple(f.string(),f.object({duration:f.number()})),implement:(e,t)=>T(Ae,null,function*(){let{duration:r}=t;return yield q.reportToNative({event:"TaskFinished",params:{duration:r,taskId:e}})})}),yc=j("levelUpgrade",{paramsSchema:f.tuple(f.string(),f.string()),implement:(e,t)=>T(Ae,null,function*(){let r=[];r.push(q.reportToNative({event:"LevelUpgrade",params:{name:t,levelId:e}})),yield Promise.all(r)})}),bc=j("onHistoryUserLevel",{paramsSchema:f.tuple(f.number()),implement:e=>T(Ae,null,function*(){return yield q.reportToNative({event:"HistoryUserLevel",params:{level:e}})})}),kc=j("onHistoryUserScore",{paramsSchema:f.tuple(f.number()),implement:e=>T(Ae,null,function*(){return yield q.reportToNative({event:"HistoryUserScore",params:{score:e}})})}),wc=j("taskEvent",{paramsSchema:f.tuple(f.string(),f.object({tools:f.array(f.object({id:f.string(),name:f.string(),count:f.number(),description:f.string().optional(),price:f.object({amount:f.number(),unit:f.string()}).optional()})).optional(),awards:f.array(f.object({id:f.string(),name:f.string()})).optional()})),implement:(e,t)=>T(Ae,null,function*(){var n,o;let r=[];r.push(q.reportToNative({event:"TaskEvent",params:_({taskId:e},t)})),(o=(n=t.tools)==null?void 0:n.length)!=null&&o&&(r.push(q.reporter({event:"USE_GAME_ITEM"})),r.push(q.reportToNative({event:"UseGameItem",params:_({taskId:e},t)}))),yield Promise.all(r)})});Me.registerCommand("TaskTrackerSDK.levelFinished",_c);Me.registerCommand("TaskTrackerSDK.taskFinished",vc);Me.registerCommand("TaskTrackerSDK.levelUpgrade",yc);Me.registerCommand("TaskTrackerSDK.historyUserLevel",bc);Me.registerCommand("TaskTrackerSDK.historyUserScore",kc);Me.registerCommand("TaskTrackerSDK.taskEvent",wc);I("TaskTrackerSDK.onLevelFinished",{version:"1.0.0",properties:{levelId:"1.0.0",params:{result:"1.0.0",duration:"1.0.0"}}});I("TaskTrackerSDK.onTaskFinished",{version:"1.0.0",properties:{taskId:"1.0.0",duration:"1.0.0"}});I("TaskTrackerSDK.onLevelUpgrade",{version:"1.0.0",properties:{levelId:"1.0.0",name:"1.0.0"}});I("TaskTrackerSDK.onHistoryUserLevel",{version:"1.0.0",properties:{level:"1.0.0"}});I("TaskTrackerSDK.onHistoryUserScore",{version:"1.0.0",properties:{score:"1.0.0"}});I("TaskTrackerSDK.onTaskEvent",{version:"1.0.0",properties:{taskId:"1.0.0",params:{tools:{id:"1.0.0",name:"1.0.0",count:"1.0.0",description:"1.0.0",price:{amount:"1.0.0",unit:"1.0.0"}},awards:{id:"1.0.0",name:"1.0.0"}}}})});var Tc,Sc,$s,Js=k(()=>{"use strict";K();V();ce();A();ge();I("login",{version:"1.0.0",properties:{force:"1.0.0"},success:{errMsg:"1.0.0",code:"1.0.0",token:"1.0.0",isLogin:"1.0.0"}});I("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0"}});Tc=j("login",{implement(){return T(this,null,function*(){var i;let{data:{isLogin:e}}=yield Q("checkLoginAsync");if(e)return{isLogin:!0,token:(i=w.hostUserInfo)==null?void 0:i.token};ie("onLoginStateChange",({isLogin:a,token:l,uuid:u})=>{u==r&&o({isLogin:a,token:l})});let t=O("loginSync"),{data:{uuid:r}}=t;if(!r)throw Te({code:-1,msg:"login failed"});let{promise:n,resolve:o}=new se,s=yield n;return w.onEnvConfigChanged({hostUserInfo:s}),pe.emit("onLoginComplete",s),s})}}),Sc=j("checkSession",{implement(){return T(this,null,function*(){let{data:{isLogin:e}}=yield Q("checkLoginAsync");return{isLogin:e}})}}),$s=M();$s.registerCommand("API.login",Tc);$s.registerCommand("API.checkSession",Sc)});var Yt,Ec,Xt,xc,Ic,Rc,Ac,Vs=k(()=>{"use strict";A();ce();Ir();ve();Ke();V();Yt=M(),Ec=()=>{let{data:e}=O("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},Xt=new _t(Y,{get:(e,t)=>Z(e,_({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data),post:(e,t,r)=>Z(e,_({method:"POST",responseType:"json",appendHostCookie:!0},r)).then(n=>n.response.data)},Ec),xc=F("adInit",{implement:e=>{Xt.init(e)}}),Ic=F("adConfig",{implement:e=>{Xt.adConfig(e)}}),Rc=F("adBreak",{implement:e=>{Xt.adBreak(e)}}),Ac=F("adUnit",{implement:e=>{Xt.adUnit(e)}});Yt.registerCommand("AdsSDK.init",xc);Yt.registerCommand("AdsSDK.adConfig",Ic);Yt.registerCommand("AdsSDK.adBreak",Rc);Yt.registerCommand("AdsSDK.adUnit",Ac);I("AdsSDK.init",{version:"1.0.0"});I("AdsSDK.adConfig",{version:"1.0.0"});I("AdsSDK.adBreak",{version:"1.0.0"});I("AdsSDK.adUnit",{version:"1.0.0"})});var Yr,Cc,Nc,Pc,Ks=k(()=>{"use strict";A();V();ce();K();Yr=M(),Cc=F("openSchemaSync",{paramsSchema:f.tuple(f.string()),implement:e=>{let t=e;e.match(/^https?:\/\//)||(t=`https://${w.mpId}.app.jolibox.com${e.startsWith("/")?"":"/"}${e}`);let r=O("openSchemaSync",{schema:t});if(r.errNo!==0)throw new Je(r.errMsg,r.errNo)}}),Nc=F("openPageSync",{paramsSchema:f.tuple(f.string()),implement:e=>{let{errNo:t,errMsg:r,data:n}=O("openPageSync",{url:e});if(t!==0||!n)throw new Je(r,t);return{webviewId:n.webviewId}}}),Pc=F("closePageSync",{paramsSchema:f.tuple(f.number()),implement:e=>{let{errNo:t,errMsg:r}=O("closePageSync",{webviewId:e});if(t!==0)throw new Je(r,t)}});Yr.registerCommand("RouterSDK.openSchema",Cc);Yr.registerCommand("RouterSDK.openPage",Nc);Yr.registerCommand("RouterSDK.closePage",Pc);I("router.openSchema",{version:"1.1.10"});I("router.openPage",{version:"1.1.10"});I("router.closePage",{version:"1.1.10"})});var Oc={};var Qm,ef,qs=k(()=>{"use strict";Cs();Qm=rn(Ns());Ls();Bs();js();ef=rn(Hs());Js();Vs();Ks()});var Gs=Symbol.for("JOLIBOX_IMPLEMENT_INIT");if(window[Gs])throw console.info("Jolibox Implement Already Initialized"),new Error("Jolibox Implement Already Initialized");window[Gs]=!0;T(void 0,null,function*(){let[{config:e}]=yield Promise.all([Promise.resolve().then(()=>(Ts(),ws)),Promise.resolve().then(()=>(qs(),Oc)),Promise.resolve().then(()=>(ve(),ko))]);e()});
|
package/implement.build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Invoking: npm run clean && npm run build:esm && tsc
|
|
2
2
|
|
|
3
|
-
> @jolibox/implement@1.1.11-beta.
|
|
3
|
+
> @jolibox/implement@1.1.11-beta.9 clean
|
|
4
4
|
> rimraf ./dist
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
> @jolibox/implement@1.1.11-beta.
|
|
7
|
+
> @jolibox/implement@1.1.11-beta.9 build:esm
|
|
8
8
|
> BUILD_VERSION=$(node -p "require('./package.json').version") node esbuild.config.js --format=esm
|
|
9
9
|
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jolibox/implement",
|
|
3
3
|
"description": "This project is Jolibox JS-SDk implement for Native && H5",
|
|
4
|
-
"version": "1.1.11-beta.
|
|
4
|
+
"version": "1.1.11-beta.9",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@jolibox/common": "1.1.11-beta.
|
|
10
|
-
"@jolibox/types": "1.1.11-beta.
|
|
9
|
+
"@jolibox/common": "1.1.11-beta.9",
|
|
10
|
+
"@jolibox/types": "1.1.11-beta.9",
|
|
11
11
|
"localforage": "1.10.0",
|
|
12
12
|
"@jolibox/ui": "1.0.0",
|
|
13
13
|
"web-vitals": "4.2.4"
|
|
@@ -50,11 +50,10 @@ const openGameSchema = (game: IGame) => {
|
|
|
50
50
|
// Parse the original URL to preserve its structure
|
|
51
51
|
|
|
52
52
|
const url = new URL(data.schema);
|
|
53
|
-
const originalPath = url.pathname;
|
|
54
53
|
const originalSearch = new URLSearchParams(url.search);
|
|
55
54
|
|
|
56
55
|
// Set or replace gameId and joliSource parameters
|
|
57
|
-
originalSearch.set('gameId',
|
|
56
|
+
originalSearch.set('gameId', game.gameId);
|
|
58
57
|
originalSearch.set(
|
|
59
58
|
'joliSource',
|
|
60
59
|
context.encodeJoliSourceQuery({
|
|
@@ -65,7 +64,7 @@ const openGameSchema = (game: IGame) => {
|
|
|
65
64
|
|
|
66
65
|
const host = `https://${game.gameId}.content.jolibox.com/`;
|
|
67
66
|
// Construct the final schema URL
|
|
68
|
-
const schema = `${host}
|
|
67
|
+
const schema = `${host}index.html?${originalSearch.toString()}`;
|
|
69
68
|
|
|
70
69
|
invokeNative('openSchemaSync', {
|
|
71
70
|
schema
|