@jolibox/implement 1.3.5 → 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +8 -8
- package/dist/common/utils/index.d.ts +1 -0
- package/dist/h5/bootstrap/auth/sub.d.ts +4 -1
- package/dist/index.js +7 -7
- package/dist/index.native.js +2 -2
- package/implement.build.log +2 -2
- package/package.json +7 -7
- package/src/common/report/base-tracker.ts +2 -1
- package/src/common/utils/index.ts +1 -0
- package/src/h5/bootstrap/auth/__tests__/auth.test.ts +22 -16
- package/src/h5/bootstrap/auth/sub.ts +7 -3
- package/src/h5/bootstrap/index.ts +5 -2
- package/src/native/rewards/ui/subscription-modal.ts +1 -1
- package/src/native/subscription/registers/sub-app.ts +7 -2
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var MR=Object.create;var ka=Object.defineProperty,FR=Object.defineProperties,jR=Object.getOwnPropertyDescriptor,BR=Object.getOwnPropertyDescriptors,GR=Object.getOwnPropertyNames,Ca=Object.getOwnPropertySymbols,JR=Object.getPrototypeOf,Jc=Object.prototype.hasOwnProperty,Gm=Object.prototype.propertyIsEnumerable;var Bm=(e,t,r)=>t in e?ka(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))Jc.call(t,r)&&Bm(e,r,t[r]);if(Ca)for(var r of Ca(t))Gm.call(t,r)&&Bm(e,r,t[r]);return e},B=(e,t)=>FR(e,BR(t));var Xe=(e,t)=>{var r={};for(var n in e)Jc.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ca)for(var n of Ca(e))t.indexOf(n)<0&&Gm.call(e,n)&&(r[n]=e[n]);return r};var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Jm=(e,t)=>{for(var r in t)ka(e,r,{get:t[r],enumerable:!0})},HR=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GR(t))!Jc.call(e,i)&&i!==r&&ka(e,i,{get:()=>t[i],enumerable:!(n=jR(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?MR(JR(e)):{},HR(t||!e||!e.__esModule?ka(r,"default",{value:e,enumerable:!0}):r,e));var v=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function YR(e){return!!(e!=null&&e.__nativeBuffers__)}function Yc(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!YR(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 i;n.value?i=n.value:n.base64&&(i=QR(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function ZR(e={},t=!1){let r=e,n=[];for(let[i,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let a=t?{value:o,key:i}:{base64:XR(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function nO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function rg(e){return typeof e=="string"}function jn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function $m(e){return typeof e=="number"&&!isNaN(e)}function oO(e){return typeof e=="undefined"}function aO(e){return oO(e)||e===null}function ng(e){return typeof e=="function"}function sO(e){return jn(e)&&ng(e.then)}function ig(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Ji(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function hO(e,t,r){let n=e;for(let i of t)if(n&&typeof n=="object")n=n[i];else return r;return n===void 0?r:n}function bO(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function EO(e){return new Promise(t=>og(e)(t))}function og(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function AO(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Vi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function kO(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)xO(e[n],t[n])}function xO(e,t){if(rg(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(ng(t)){try{if(e instanceof t)return}catch(r){}if(!aO(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 Rt(e,t){if(Xc.config[e]){Na.warn(`[can i use] ${e} already registered`);return}Xc.config[e]=pr({},t)}function zm(e,t){return`[${e}]:${t}`}function LO(e,t){Km||(Vc=new Ta({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Wc=new Ta({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),zc=new Ta({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Vc.flush(),Wc.flush(),zc.flush()}),Km=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:h,invokeCallback:g}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Vc.report({status:b,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&h&&g&&(Wc.report({status:b,method:s,isForeground:d,duration:Number((h-c).toFixed(3))}),zc.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-g).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function FO(e,t){let r=0,n=!0,i=MO.resolveMap,o=LO(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Kc.forEach(l=>Ra(this,[l],function*({method:c,args:d,resolve:u}){let p=yield s(c,d);u(p)})),Kc.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=Yc(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let h=new iO;if(i.set(r,h.resolve),!n&&RO.includes(l))return new Promise(E=>{Kc.push({method:l,args:c,resolve:E})});let g=zR(pr({},{method:l,startTime:p,args:c,isForeground:f}),{invokeType:"js-bridge"}),b=!qO&&PO.includes(l),y=ZR(c,b),_=b?y:JSON.stringify(y),I;if(l.endsWith("Sync")||OO.includes(l)?I=(d=e.call)==null?void 0:d.call(e,l,y,r):typeof _=="string"?I=e.invoke(l,_,r):I=(u=e.call)==null?void 0:u.call(e,l,_,r),I){try{typeof I=="string"&&(I=JSON.parse(I)),I=Yc(I)}catch(E){Na.error(E)}return i.delete(r),I.errorCode&&(I.errorCode=zm(l,I.errorCode)),o(pr(pr({},g),I)),I}return l.endsWith("Sync")&&i.delete(r),h.promise.then(E=>(E.errorCode&&(E.errorCode=zm(l,E.errorCode)),o(pr(pr({},g),E)),E))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return sO(d)?d.then(u=>Ym(l,u)):Ym(l,d)},invokeHandler:a}}function Ym(e,t){if(!jn(t)){Na.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=KR(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new dO(n,i,o,a);return s}function jO(e){if(globalThis[xa])return globalThis[xa];let t=new tu,r=new tu,n=new Ta({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),globalThis[xa]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,o,a){let s=Yc(o),l;if(s.__extra){l=s.params;let{type:c,startTime:d}=s.__extra;n.report({type:c,event:i,duration:Date.now()-d})}else l=s;if(i===sg){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice($i.length),u,a)}catch(p){}});return}if(i.startsWith($i)){r.emit(i.slice($i.length),l,a);return}t.emit(i,l,a)}},globalThis[xa]}function BO(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${$i}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(sg,d,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${$i}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(NO,d,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function GO(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=jO(e),{invokeNative:a,invokeHandler:s,applyNative:l}=FO(e,r),{publish:c,emitNative:d}=BO(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:c,subscribe:i,unsubscribe:o}}function lg(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var $R,VR,WR,Pa,Xm,Zm,Hm,pr,zR,KR,Ra,QR,XR,eg,eO,tO,tg,rO,iO,lO,cO,Oa,uO,dO,pO,Hc,Na,Vm,fO,Qc,mO,Xc,gO,vO,yO,Fn,_O,s6,Zc,fe,wO,SO,Hi,Vi,tu,ru,IO,$c,CO,l6,nu,Wm,c6,ag,TO,$i,PO,RO,OO,sg,NO,DO,Ta,Km,Vc,Wc,zc,Kc,qO,iu,UO,MO,xa,ou,Pt,cg,ug,JO,dg,Qm,he,F,De,u6,HO,pg,au,d6,p6,ue=x(()=>{"use strict";$R=Object.defineProperty,VR=Object.defineProperties,WR=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertySymbols,Xm=Object.prototype.hasOwnProperty,Zm=Object.prototype.propertyIsEnumerable,Hm=(e,t,r)=>t in e?$R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pr=(e,t)=>{for(var r in t||(t={}))Xm.call(t,r)&&Hm(e,r,t[r]);if(Pa)for(var r of Pa(t))Zm.call(t,r)&&Hm(e,r,t[r]);return e},zR=(e,t)=>VR(e,WR(t)),KR=(e,t)=>{var r={};for(var n in e)Xm.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pa)for(var n of Pa(e))t.indexOf(n)<0&&Zm.call(e,n)&&(r[n]=e[n]);return r},Ra=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});QR=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=t.charCodeAt(i);return n.buffer};XR=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return btoa(t)};eg=Object.defineProperty,eO=Object.getOwnPropertyDescriptor,tO=(e,t)=>{for(var r in t)eg(e,r,{get:t[r],enumerable:!0})},tg=(e,t,r,n)=>{for(var i=n>1?void 0:n?eO(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&eg(t,r,i),i},rO=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}iO=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))}})}};lO=(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))(lO||{}),cO=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}},Oa=class extends cO{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},uO=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},dO=class extends Oa{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},pO=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Hc=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Na={log:Ji("log"),warn:Ji("warn"),info:Ji("info"),error:Ji("error"),debug:Ji("debug")};Object.assign(globalThis,{logger:Na});Vm=Symbol.for("Jolibox.canIUseMap"),fO={};globalThis[Vm]||(globalThis[Vm]=fO);Qc=Symbol.for("Jolibox.canIUseMap.native"),mO={};globalThis[Qc]||(globalThis[Qc]=mO);Xc={get config(){return globalThis[Qc]}},gO=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(gO||{}),vO=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(vO||{}),yO=(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))(yO||{});bO();Fn=typeof window=="undefined",_O=()=>!Fn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),s6={isiOS:!Fn&&(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:!Fn&&navigator.userAgent.includes("Android"),isMac:!Fn&&navigator.userAgent.includes("Mac"),isFacebook:!Fn&&navigator.userAgent.includes("FB_IAB"),isPC:!Fn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Zc=class eu{constructor(t){this.element=t,this.next=eu.Undefined,this.prev=eu.Undefined}};Zc.Undefined=new Zc(void 0);fe=Zc,wO=class{constructor(){this._first=fe.Undefined,this._last=fe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===fe.Undefined}clear(){let e=this._first;for(;e!==fe.Undefined;){let t=e.next;e.prev=fe.Undefined,e.next=fe.Undefined,e=t}this._first=fe.Undefined,this._last=fe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new fe(e);if(this._first===fe.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==fe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==fe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==fe.Undefined&&e.next!==fe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===fe.Undefined&&e.next===fe.Undefined?(this._first=fe.Undefined,this._last=fe.Undefined):e.next===fe.Undefined?(this._last=this._last.prev,this._last.next=fe.Undefined):e.prev===fe.Undefined&&(this._first=this._first.next,this._first.prev=fe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==fe.Undefined;)yield e.element,e=e.next}},SO=0,Hi=class{constructor(e){this.value=e,this.id=SO++}},Vi=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 Hi&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Hi(t);return this._listeners?this._listeners instanceof Hi?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Hi)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let h=this._listeners.indexOf(c);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Hi?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},tu=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new Vi,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new wO,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},ru={};tO(ru,{None:()=>IO,filter:()=>AO,once:()=>og,toPromise:()=>EO});IO=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});$c=Symbol.for("Jolibox.hostEmitter"),CO=()=>{let e=new tu;return globalThis[$c]||(globalThis[$c]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[$c]},l6=CO();nu=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Vi,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return kO(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};nu=tg([ig],nu);Wm=class{constructor(){this._onWillExecuteCommand=new Vi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Vi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new nu,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=nO(3e4)),this._starActivation}executeCommand(e,...t){return rO(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ru.toPromise(ru.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}}};Wm=tg([ig],Wm);c6=Symbol.for("Jolibox.commands");Rt("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Rt("requestProductDetailsAsync",{version:102e4});Rt("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Rt("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Rt("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Rt("userTrackAsync",{version:1e6});Rt("openMiniapp",{version:1050100});Rt("requestCoinDetailsSync",{version:1070100});Rt("requestCoinDetailsAsync",{version:1070100});Rt("sendServerEventAsync",{version:1070100});Rt("loadAdsAsync",{version:1070200});Rt("showAdAsync",{version:1070200});ag=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Xc.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",d=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(d=p)}if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=hO(i,o);if(!s)return!1;if(jn(s)){let l=s.version;return $m(l)?typeof a=="number"&&a>=l:!0}return $m(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};TO=()=>_O(),$i="custom_event_",PO=[],RO=[],OO=["env","createRequestTask","login"],sg="__batch_event__",NO="__native_batch_event__",DO=e=>e==="pv"?e:"default",Ta=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:o,type:a}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=o,this.type=DO(a)}report(e){this.type==="pv"?this.addPVPoint(e):this.addPoint(e),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(e){if(Object.keys(this.cache).length){if(e){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(e){let t=(r,n,i,o)=>{let a=n.shift();if(a){let s=o[a];r[s]||(r[s]={}),t(r[s],n,i,o)}else r[i]||(r[i]=[]),r[i].push(o[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,o,a)=>{let s=i.shift();if(!s&&jn(a))throw new Hc(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(jn(a))l.push(...Object.keys(a));else if(rg(a)){if(i.length>0)throw new Hc(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new Hc(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let d=jn(a)?a[c]:a;t(n[c],[...i],o,d)})}else n[o]?n[o]++:n[o]=1},r={point:e,metricName:this.metricName,tagNameOrder:this.tagNameOrder};t(this.cache,[...this.tagNameOrder],this.metricName,e)}processPoints(e){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:e}}clearPoints(){this.cache={}}},Km=!1;Kc=[],qO=!1,iu=Symbol.for("Jolibox.invokeResolverInstance"),UO=new Map;globalThis[iu]||(globalThis[iu]=UO);MO={get resolveMap(){return globalThis[iu]}};xa=Symbol.for("Jolibox.subscribeInstance");Pt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Pt.trigger=e},onDoExit(e){Pt.exit=e},onDoBackPress(e){Pt.backPress=e}},cg=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new uO("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(typeof window!="undefined"&&window.webkit){let e=window.webkit.messageHandlers,t=(i="")=>{Pt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ra(void 0,null,function*(){let o=yield Pt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});ou={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=lg(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:cg,doExit:r};globalThis.joliboxJSCore=pr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Pt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ra(void 0,null,function*(){let a=yield Pt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});ou={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=lg(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Ra(this,null,function*(){let a=yield Pt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:cg,doExit:n};globalThis.joliboxJSCore=pr({},i)}ug=ou;if(!ug&&TO())throw new pO("No joliboxJScore is found, native bridge not found.");JO=pr({},ug),dg=GO(JO),{invokeHandler:Qm}=dg,{applyNative:he,invokeNative:F,onNative:De,offNative:u6,subscribeHandler:HO,publish:pg,emitNative:au,subscribe:d6,unsubscribe:p6}=dg;globalThis.joliboxJSBridge={callHandler:Qm,invokeHandler:Qm,subscribeHandler:HO}});function KO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function La(e){return new Promise(t=>setTimeout(t,e))}function Qi(e){return typeof e=="string"}function cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function bg(e){return typeof e=="object"&&Array.isArray(e)}function qa(e){return typeof e=="number"&&!isNaN(e)}function Fr(e){return e===!0||e===!1}function _g(e){return typeof e=="undefined"}function Xi(e){return _g(e)||e===null}function YO(e){return typeof e=="function"}function wg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Sg(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,o){for(let a in o)if(Object.prototype.hasOwnProperty.call(o,a)){let s=i[a],l=o[a],c=r(s,l,a,i,o);c!==void 0?i[a]=c:mg(l)&&mg(s)?i[a]=n(vg({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function mg(e){return e&&typeof e=="object"&&e.constructor===Object}function Ig(e,t){if(Array.isArray(e))return e.concat(t)}function Zi(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:l=!0}=r,c=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),d=function(...u){i=u,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return d.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,c()},d}function XO(e,t){return(...r)=>t(e,...r)}function Bn(e){return t=>XO(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Wt(`${i}`))}})}function Wi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function xg(e,t,r){let n=0;if(e!==t){let i=e.split("."),o=t.split("."),a=Math.max(i.length,o.length);for(let s=0;s<a;s++){let l=parseInt(i[s],10)||0,c=parseInt(o[s],10)||0;if(l>c){n=1;break}else if(l<c){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}function bu(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function i1(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com"||a==="mporia.com"||a==="pingplus.ai")return`${o}.${a}`}return`${o}.jolibox.com`}function _u(e){return i1("app","stg-app",e)}function Jn(e){return`https://${_u(e)}`}function l1(e){return new Promise(t=>Og(e)(t))}function Og(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function c1(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Yi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function d1(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)p1(e[n],t[n])}function p1(e,t){if(Qi(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(YO(t)){try{if(e instanceof t)return}catch(r){}if(!Xi(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 f1(){return typeof globalThis!="undefined"?globalThis[Ng]:void 0}function h1(e){typeof globalThis!="undefined"&&(globalThis[Ng]=e)}function W(e=!1){let t=f1();if(!e&&t)return t;let r=new Da,n=new pu,i={registerCommand(o,a,s){r.registerCommand({id:o,handler:a,metadata:s})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return h1(i),i}var fu,$O,fg,VO,WO,hg,vg,zO,yg,ln,ut,QO,hu,eo,mu,Eg,Wt,Ua,Ag,Ma,Cg,kg,to,gu,zt,lu,ZO,vu,gg,e1,V,yu,t1,Gn,zi,ro,r1,n1,Tg,Pg,Rg,Ft,cu,me,o1,a1,Ki,Yi,Kt,du,s1,su,u1,_e,Da,pu,Ng,O=x(()=>{"use strict";fu=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,fg=Object.getOwnPropertySymbols,VO=Object.prototype.hasOwnProperty,WO=Object.prototype.propertyIsEnumerable,hg=(e,t,r)=>t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vg=(e,t)=>{for(var r in t||(t={}))VO.call(t,r)&&hg(e,r,t[r]);if(fg)for(var r of fg(t))WO.call(t,r)&&hg(e,r,t[r]);return e},zO=(e,t)=>{for(var r in t)fu(e,r,{get:t[r],enumerable:!0})},yg=(e,t,r,n)=>{for(var i=n>1?void 0:n?$O(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&fu(t,r,i),i},ln=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}ut=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))}})}};QO=(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))(QO||{}),hu=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}},eo=class extends hu{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},mu=class extends hu{constructor(){super(...arguments),this.kind="USER_ERROR"}},Eg=class extends mu{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Wt=class extends mu{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))}},Ua=class extends mu{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_PAYMENT_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Ag=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Ma=class extends eo{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="INTERNAL_PAYMENT_ERROR",this.priority="P0",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Cg=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},kg=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},to=class extends hu{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},gu=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};zt={log:Wi("log"),warn:Wi("warn"),info:Wi("info"),error:Wi("error"),debug:Wi("debug")};Object.assign(globalThis,{logger:zt});lu=Symbol.for("Jolibox.canIUseMap"),ZO={};globalThis[lu]||(globalThis[lu]=ZO);vu={get config(){return globalThis[lu]}},gg=Symbol.for("Jolibox.canIUseMap.native"),e1={};globalThis[gg]||(globalThis[gg]=e1);V=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(V||{}),yu=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(yu||{}),t1=(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))(t1||{}),Gn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});bu();zi=typeof window=="undefined",ro={isiOS:!zi&&(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:!zi&&navigator.userAgent.includes("Android"),isMac:!zi&&navigator.userAgent.includes("Mac"),isFacebook:!zi&&navigator.userAgent.includes("FB_IAB"),isPC:!zi&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},r1="device_id",n1="advertising_id",Tg=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Gn()),window.__joliboxLocalStorage__.getItem(e)),Pg=()=>new URLSearchParams(window.location.search).get("deviceId")||Tg(r1),Rg=()=>new URLSearchParams(window.location.search).get("advertisingId")||Tg(n1);Ft=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=vg({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return ln(this,null,function*(){let r=this.config.keyGenerator(e,t),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),n;let i=this.requestInternal(e,t),o=this.createTimeoutPromise(),a=Promise.race([i,o]).catch(s=>ln(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,a),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield a}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return ln(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),p=this.requestAdapter.extractRealTimeData(u),f=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return f&&!this.config.consistencyChecker(l,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,f,s),u):this.requestAdapter.mergeData(l,p)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),d=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return d&&this.setCachedDataWithSequence(a,d,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:o,expiresAt:o+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return ln(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return ln(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),o=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${o})`);let a=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,a);return s&&(this.setCachedDataWithSequence(i,s,o),console.log(`[RequestCacheService] Force updated cache for ${e}`)),a})}warmupCache(e,t){return ln(this,null,function*(){let r=this.config.keyGenerator(e,t);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${e}`),yield this.forceRequest(e,t)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,n)}})}clearCache(e){e?(this.cache.delete(e),this.cacheSequences.delete(e),this.pendingRequests.delete(e),console.log(`[RequestCacheService] Cleared cache for ${e}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let e=Date.now();for(let[t,r]of this.cache)e>r.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,r=0;for(let n of this.cache.values())e>n.expiresAt?r++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let t=this.cache.get(e);return t?Date.now()<=t.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}},cu=class uu{constructor(t){this.element=t,this.next=uu.Undefined,this.prev=uu.Undefined}};cu.Undefined=new cu(void 0);me=cu,o1=class{constructor(){this._first=me.Undefined,this._last=me.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===me.Undefined}clear(){let e=this._first;for(;e!==me.Undefined;){let t=e.next;e.prev=me.Undefined,e.next=me.Undefined,e=t}this._first=me.Undefined,this._last=me.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new me(e);if(this._first===me.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==me.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==me.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==me.Undefined&&e.next!==me.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===me.Undefined&&e.next===me.Undefined?(this._first=me.Undefined,this._last=me.Undefined):e.next===me.Undefined?(this._last=this._last.prev,this._last.next=me.Undefined):e.prev===me.Undefined&&(this._first=this._first.next,this._first.prev=me.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==me.Undefined;)yield e.element,e=e.next}},a1=0,Ki=class{constructor(e){this.value=e,this.id=a1++}},Yi=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 Ki&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Ki(t);return this._listeners?this._listeners instanceof Ki?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Ki)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let h=this._listeners.indexOf(c);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Ki?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Kt=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new Yi,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new o1,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},du={};zO(du,{None:()=>s1,filter:()=>c1,once:()=>Og,toPromise:()=>l1});s1=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});su=Symbol.for("Jolibox.hostEmitter"),u1=()=>{let e=new Kt;return globalThis[su]||(globalThis[su]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[su]},_e=u1();Da=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Yi,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return d1(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};Da=yg([wg],Da);pu=class{constructor(){this._onWillExecuteCommand=new Yi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Yi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Da,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=KO(3e4)),this._starActivation}executeCommand(e,...t){return ln(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),du.toPromise(du.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}}};pu=yg([wg],pu);Ng=Symbol.for("Jolibox.commands")});function Ee(e,t={}){wu.emit("ERROR_REPORT",{error:e,options:t})}var wu,un,yt=x(()=>{"use strict";O();O();wu=new Kt,un=new Kt;Ee.debounce=Zi(Ee,50,{leading:!0})});var Su,m1,Dg,Lg,qg=x(()=>{"use strict";O();yt();Su=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},m1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Dg=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[o,a,s]=i;return{headerJson:Su(o),payloadJson:Su(a),signature:Su(s)}}else throw"joli_source is missing"}catch(r){return Ee(new Ag(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Lg=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=m1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var g1,Iu,Ug=x(()=>{"use strict";O();g1="1.3.5",Iu=()=>g1});function Au(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var v1,Mg,Eu,Fg,ge,y1,S,H=x(()=>{"use strict";O();qg();Ug();O();v1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Pg(),adId:Rg(),pixelRatio:window.devicePixelRatio||1,platform:ro.isAndroid?"android":ro.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Iu()},schema:window.location.href,platform:ro.isAndroid?"android":ro.isiOS?"ios":"h5"},Eu=(Mg=globalThis.joliboxJSCore)==null?void 0:Mg.env,ge=Object.assign({},(Fg=Eu==null?void 0:Eu())!=null?Fg:v1);y1=()=>{var g,b,y,_,I,E,T,k,C,G,ce;let{payloadJson:e,headerJson:t,signature:r}=ge.schema.length?Dg(ge.schema):{},n=`${ge.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ge.schema.length?ge.schema:window.location.href).searchParams,a=(y=(b=(g=o.get("mpId"))!=null?g:o.get("appId"))!=null?b:o.get("gameId"))!=null?y:"",s=(E=(I=(_=ge.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?I:o.get("sessionId"))!=null?E:n,l=!!((k=(T=e==null?void 0:e.testAdsMode)!=null?T:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),c=(ce=(G=(C=e==null?void 0:e.joliboxEnv)!=null?C:e==null?void 0:e.__joliboxEnv)!=null?G:o.get("joliboxEnv"))!=null?ce:"production",d=c==="staging",u=t==null?void 0:t.channel,f=new URL(window.location.href).searchParams,h=e==null?void 0:e.__shouldInterupt;return{get startTime(){var N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var N,R;return(R=(N=f.get("joliSource"))!=null?N:o.get("joliSource"))!=null?R:null},get mpId(){var N;return(N=a!=null?a:e==null?void 0:e.id)!=null?N:""},get mpVersion(){var N;return(N=t==null?void 0:t.ver)!=null?N:Iu()},get mpType(){var N,R;return(R=(N=t==null?void 0:t.__mpType)!=null?N:e==null?void 0:e.__mpType)!=null?R:"game"},get platform(){var N;return((N=ge.platform)!=null?N:ge.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ge.deviceInfo},get sdkInfo(){return ge.sdkInfo},get hostInfo(){return ge.hostInfo},get hostUserInfo(){return ge.hostUserInfo},get sessionId(){var N,R;return(R=(N=ge.clientSessionId)!=null?N:s)!=null?R:n},get channel(){return u},get webviewId(){var N;return(N=ge.webviewId)!=null?N:-1},get shouldInterupt(){return h},get from(){return e==null?void 0:e.__from},get baseApiHost(){return _u(d)},get adId(){var N;return(N=ge.deviceInfo.adId)!=null?N:ge.deviceInfo.did},get language(){return ge.deviceInfo.lang},get sdkEnvironment(){return Au("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Au("gamedistribution","jolibox")?"gamedistribution":Au("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var J,re,Mt;let N=(J=ge.deviceInfo.pixelRatio)!=null?J:1,R=(re=ge.deviceInfo.statusBarHeight)!=null?re:e==null?void 0:e.__androidStatusBarHeight,D=(Mt=ge.deviceInfo.navigationBarHeight)!=null?Mt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:R!==void 0?R/N:20,navigationBarHeight:D!==void 0?D/N:10}},get abTests(){var N,R;return(R=(N=ge.abValues)==null?void 0:N.split(","))!=null?R:[]},get mpInfo(){var N;return(N=ge.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{Sg(ge,N,Ig)},encodeJoliSourceQuery:N=>{var R,D;return t&&r?Lg(P(P({},e),N),(R=o.get("joliSource"))!=null?R:""):(D=o.get("joliSource"))!=null?D:""},setDoExitDirectly:()=>{h=!1}}},S=y1()});var Cu,Bg,b1,_1,jg,w1,Gg=x(()=>{"use strict";O();yt();H();O();Cu=!1,Bg=(e,t)=>e==null?!1:t in e,b1=e=>Bg(e,"kind"),_1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},jg=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=S.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=S.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_1(e.name)},i=B(P({},n),{env:t.environment,isFromUser:r});r?un.emit("GLOBAL_USER_ERROR",e,i):un.emit("GLOBAL_ERROR",e,i)},w1=e=>Bg(e,"kind")&&e.kind==="USER_ERROR";wu.on("ERROR_REPORT",({error:e,options:t})=>{if(Cu)return;Cu=!0;let r=b1(e)&&e.raw?e.raw:e;try{let n=w1(e);jg(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new gu(`${i}, origin error: ${r.message}`);zt.error(o),jg(new gu(o.message),{environment:t.environment},!1)}finally{Cu=!1}})});var Je,ku,jr=x(()=>{"use strict";yt();O();yt();Je=(e,t)=>{var r,n;return new to((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},ku=e=>new Eg(e)});var Jg=x(()=>{"use strict";Gg();jr();O();ue();un.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};F("trackAsync",{event:"reportJsError",data:r})});un.on("GLOBAL_USER_ERROR",(e,t)=>{zt.log("UserError",e,t)})});var xu=x(()=>{"use strict"});function Hg(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=Xe(c,["eventType"]),l=B(P({tag:n,eventType:o!=null?o:a!=null?a:V.Other},t),{extra:P({},s)});n=="globalJsError"?Ee(new kg(JSON.stringify(l))):e("systemLog",l,S.webviewId)};return r.debounce=Zi(r,500,{leading:!0}),r}function $g(e){let t=(r,n,i)=>{var s;let o=(s=i&&JSON.stringify(i))!=null?s:0,a={speed_value_type:r,total_duration:n};o&&Object.assign(a,{extra:o}),e("joliboxSpeedAnalysis",a)};return t.debounce=Zi(t,500,{leading:!0}),t}var Vg=x(()=>{"use strict";O();O();yt();H()});function Wg(e,t){let r=Hg(e,t),n=$g(r);return{track:r,trackPerformance:n}}var zg=x(()=>{"use strict";Vg()});var Kg=x(()=>{"use strict";H();O();O()});var Yg=x(()=>{"use strict";zg();xu();Kg()});var Fa,Qg=x(()=>{"use strict";Fa=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(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.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{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.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,o=!1,a=0,s=()=>{if(!o)return;let f=Date.now(),h=f-r;h>=this.interval&&(this.visible&&(a+=Math.min(h,this.interval+1e3),t(a)),r=f),n=requestAnimationFrame(s)},l=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let f=Date.now();f-r>=this.interval&&(r=f)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",f=>{o&&(console.log("visible",f),f?c():l())});let p=this.visible;return{start(){o||(o=!0,p?c():l())},stop(){o=!1,d(),u()}}}}});function ja(e,t,r){var l,c,d;let n=new Map,i=(l=r==null?void 0:r.baseUrl)!=null?l:Jn(S.testMode),o=(c=r==null?void 0:r.type)!=null?c:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return De("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:g,state:b}=f,y=Xe(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(y):p.reject(y),n.delete(g)}else if(u.state==="fail"){let h=u,{requestTaskId:g,state:b}=h,y=Xe(h,["requestTaskId","state"]);p.reject(y),n.delete(g)}else zt.warn("onRequestTaskStateChange unknown event",u)}),_e.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...h)=>v(this,[f,...h],function*(u,p={}){let g=Date.now(),b=S1(u,B(P({},p),{baseUrl:i})),{method:y="GET",responseType:_="text",dataType:I="json",timeout:E,enableCache:T=!1,appendHostCookie:k=!0}=p,C=Object.assign({"content-type":"application/json"},a,p.header),G={url:b,method:y,header:C,enableCache:T,responseType:_,appendHostCookie:k};if(y=="POST"||y=="PUT"){let J=E1(p.data,C["content-type"]);G.data=J}E&&Object.assign(G,{timeout:E});let{data:{requestTaskId:ce}}=F(e,G);if(typeof ce!="string")throw Je({code:-1,msg:"requestTaskId is not a string"});let{resolve:N,reject:R,promise:D}=new ut;n.set(ce,{resolve:N,reject:R});try{let J=yield D,{data:re}=J;return I==="json"&&typeof re=="string"&&(re=I1(re)),{url:b,timeout:E,method:y,response:B(P({},J),{data:re})}}catch(J){let re=J;if(cn(re)){let{errMsg:Mt,prefetchDetail:Bc,isPrefetch:Gc,errNo:UR}=re;Qi(Mt)&&Ee(Je({code:-1,msg:Mt},{errNo:UR,errMsg:Mt}))}throw J}})}function I1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function E1(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 S1,Tu=x(()=>{"use strict";O();ue();yt();jr();H();S1=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,i=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${i?`?${i}`:""}`:`${e}${i?`?${i}`:""}`}});var Pu,Xg,z,dt=x(()=>{"use strict";Tu();H();O();Pu={};(Xg=S.hostUserInfo)!=null&&Xg.token&&(Pu["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(Pu["x-joli-source"]=S.joliSource);z=ja("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Jn(S.testMode),defaultHeaders:Pu})});function Zg(e){let t=vu.config[e];return t||(t={},vu.config[e]=t),(r,n)=>{if(t[r]){zt.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var ev=x(()=>{"use strict";O()});function Ru(e){tv=e}function Ba(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>Ba(t)):Object.keys(e).reduce((t,r)=>(t[r]=Ba(e[r]),t),{})}function fr(e){return typeof e=="number"}function Ou(e){let t=Nu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Nu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var tv,ke,Ga,Ja,Ha,$a,Hn,Va,Wa,za,Ka,Ya,Qa,Xa,Za,es,ts,rs,ns,Du=x(()=>{"use strict";tv=!1;ke=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(tv)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 ${Ou(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Ba(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Ba(this._default)}optional(){return this._optional=!0,this}};Ga=class extends ke{validate(t){return this._optional&&t===void 0?!0:fr(t)?fr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):fr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):fr(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}},Ja=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ha=class extends ke{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(fr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(fr(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}},$a=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Hn=class extends ke{validate(t){return!0}},Va=class extends ke{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Wa=class extends ke{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},za=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Ka=class extends ke{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 ${Ou(t)}`)}return!0}},Ya=class extends ke{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(fr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(fr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(fr(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let i=!0;if(r.forEach((o,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,o===void 0&&n.hasDefault){r[a]=n.defaultValue;return}n.validate(o)||(n.hasFallback?r[a]=n.fallbackValue:i=!1)}),this._uniqueItems){let o=new Map;for(let a in r)o.has(r[a])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${o.get(r[a])}] and ${this.path}[${a}] are identical)`):o.set(r[a],a)}return i}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},Qa=class extends ke{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Nu(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,o=this._value;o.errors=this.errors;let a=!0;for(let s in i){let l=i[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?o.path=`${this.path}.${s}`:o.path=`${this.path}["${s}"]`,!(l===void 0&&o._optional)){if(l===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(l)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Xa=class extends ke{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Nu(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let o in this._object){let a=n[o],s=this._object[o];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(o)?s.path=`${this.path}.${o}`:s.path=`${this.path}["${o}"]`,!(s._optional&&a===void 0)){if(a===void 0&&s.hasDefault){n[o]=s.defaultValue;continue}s.validate(a)||(s.hasFallback?n[o]=s.fallbackValue:i=!1)}}return i}},Za=class extends ke{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Ou(this.value),actual:r}):!0}},es=class extends ke{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,i=this._items.length;for(let o=0;o<i;o++){let a=this._items[o];if(a.errors=[],a.path=this.path,!a.validate(t))r.push(a.errors.join("; "));else if(!n){n=!0;break}}if(!n){let o=r.join(`
|
|
1
|
+
var MR=Object.create;var ka=Object.defineProperty,FR=Object.defineProperties,jR=Object.getOwnPropertyDescriptor,BR=Object.getOwnPropertyDescriptors,GR=Object.getOwnPropertyNames,Ca=Object.getOwnPropertySymbols,JR=Object.getPrototypeOf,Jc=Object.prototype.hasOwnProperty,Gm=Object.prototype.propertyIsEnumerable;var Bm=(e,t,r)=>t in e?ka(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))Jc.call(t,r)&&Bm(e,r,t[r]);if(Ca)for(var r of Ca(t))Gm.call(t,r)&&Bm(e,r,t[r]);return e},B=(e,t)=>FR(e,BR(t));var Xe=(e,t)=>{var r={};for(var n in e)Jc.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ca)for(var n of Ca(e))t.indexOf(n)<0&&Gm.call(e,n)&&(r[n]=e[n]);return r};var x=(e,t)=>()=>(e&&(t=e(e=0)),t);var m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Jm=(e,t)=>{for(var r in t)ka(e,r,{get:t[r],enumerable:!0})},HR=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of GR(t))!Jc.call(e,i)&&i!==r&&ka(e,i,{get:()=>t[i],enumerable:!(n=jR(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?MR(JR(e)):{},HR(t||!e||!e.__esModule?ka(r,"default",{value:e,enumerable:!0}):r,e));var v=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function YR(e){return!!(e!=null&&e.__nativeBuffers__)}function Yc(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!YR(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 i;n.value?i=n.value:n.base64&&(i=QR(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function ZR(e={},t=!1){let r=e,n=[];for(let[i,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let a=t?{value:o,key:i}:{base64:XR(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function nO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function rg(e){return typeof e=="string"}function jn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function $m(e){return typeof e=="number"&&!isNaN(e)}function oO(e){return typeof e=="undefined"}function aO(e){return oO(e)||e===null}function ng(e){return typeof e=="function"}function sO(e){return jn(e)&&ng(e.then)}function ig(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Ji(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function hO(e,t,r){let n=e;for(let i of t)if(n&&typeof n=="object")n=n[i];else return r;return n===void 0?r:n}function bO(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function EO(e){return new Promise(t=>og(e)(t))}function og(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function AO(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Vi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function kO(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)xO(e[n],t[n])}function xO(e,t){if(rg(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(ng(t)){try{if(e instanceof t)return}catch(r){}if(!aO(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 Rt(e,t){if(Xc.config[e]){Na.warn(`[can i use] ${e} already registered`);return}Xc.config[e]=pr({},t)}function zm(e,t){return`[${e}]:${t}`}function LO(e,t){Km||(Vc=new Ta({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Wc=new Ta({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),zc=new Ta({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Vc.flush(),Wc.flush(),zc.flush()}),Km=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:h,invokeCallback:g}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Vc.report({status:b,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&h&&g&&(Wc.report({status:b,method:s,isForeground:d,duration:Number((h-c).toFixed(3))}),zc.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-g).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function FO(e,t){let r=0,n=!0,i=MO.resolveMap,o=LO(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Kc.forEach(l=>Ra(this,[l],function*({method:c,args:d,resolve:u}){let p=yield s(c,d);u(p)})),Kc.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=Yc(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let h=new iO;if(i.set(r,h.resolve),!n&&RO.includes(l))return new Promise(E=>{Kc.push({method:l,args:c,resolve:E})});let g=zR(pr({},{method:l,startTime:p,args:c,isForeground:f}),{invokeType:"js-bridge"}),b=!qO&&PO.includes(l),y=ZR(c,b),_=b?y:JSON.stringify(y),I;if(l.endsWith("Sync")||OO.includes(l)?I=(d=e.call)==null?void 0:d.call(e,l,y,r):typeof _=="string"?I=e.invoke(l,_,r):I=(u=e.call)==null?void 0:u.call(e,l,_,r),I){try{typeof I=="string"&&(I=JSON.parse(I)),I=Yc(I)}catch(E){Na.error(E)}return i.delete(r),I.errorCode&&(I.errorCode=zm(l,I.errorCode)),o(pr(pr({},g),I)),I}return l.endsWith("Sync")&&i.delete(r),h.promise.then(E=>(E.errorCode&&(E.errorCode=zm(l,E.errorCode)),o(pr(pr({},g),E)),E))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return sO(d)?d.then(u=>Ym(l,u)):Ym(l,d)},invokeHandler:a}}function Ym(e,t){if(!jn(t)){Na.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=KR(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new dO(n,i,o,a);return s}function jO(e){if(globalThis[xa])return globalThis[xa];let t=new tu,r=new tu,n=new Ta({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),globalThis[xa]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,o,a){let s=Yc(o),l;if(s.__extra){l=s.params;let{type:c,startTime:d}=s.__extra;n.report({type:c,event:i,duration:Date.now()-d})}else l=s;if(i===sg){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice($i.length),u,a)}catch(p){}});return}if(i.startsWith($i)){r.emit(i.slice($i.length),l,a);return}t.emit(i,l,a)}},globalThis[xa]}function BO(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${$i}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(sg,d,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${$i}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(NO,d,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function GO(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=jO(e),{invokeNative:a,invokeHandler:s,applyNative:l}=FO(e,r),{publish:c,emitNative:d}=BO(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:c,subscribe:i,unsubscribe:o}}function lg(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var $R,VR,WR,Pa,Xm,Zm,Hm,pr,zR,KR,Ra,QR,XR,eg,eO,tO,tg,rO,iO,lO,cO,Oa,uO,dO,pO,Hc,Na,Vm,fO,Qc,mO,Xc,gO,vO,yO,Fn,_O,s6,Zc,fe,wO,SO,Hi,Vi,tu,ru,IO,$c,CO,l6,nu,Wm,c6,ag,TO,$i,PO,RO,OO,sg,NO,DO,Ta,Km,Vc,Wc,zc,Kc,qO,iu,UO,MO,xa,ou,Pt,cg,ug,JO,dg,Qm,he,F,De,u6,HO,pg,au,d6,p6,ue=x(()=>{"use strict";$R=Object.defineProperty,VR=Object.defineProperties,WR=Object.getOwnPropertyDescriptors,Pa=Object.getOwnPropertySymbols,Xm=Object.prototype.hasOwnProperty,Zm=Object.prototype.propertyIsEnumerable,Hm=(e,t,r)=>t in e?$R(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,pr=(e,t)=>{for(var r in t||(t={}))Xm.call(t,r)&&Hm(e,r,t[r]);if(Pa)for(var r of Pa(t))Zm.call(t,r)&&Hm(e,r,t[r]);return e},zR=(e,t)=>VR(e,WR(t)),KR=(e,t)=>{var r={};for(var n in e)Xm.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Pa)for(var n of Pa(e))t.indexOf(n)<0&&Zm.call(e,n)&&(r[n]=e[n]);return r},Ra=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});QR=e=>{let t=atob(e),r=t.length,n=new Uint8Array(r);for(let i=0;i<r;i++)n[i]=t.charCodeAt(i);return n.buffer};XR=e=>{let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return btoa(t)};eg=Object.defineProperty,eO=Object.getOwnPropertyDescriptor,tO=(e,t)=>{for(var r in t)eg(e,r,{get:t[r],enumerable:!0})},tg=(e,t,r,n)=>{for(var i=n>1?void 0:n?eO(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&eg(t,r,i),i},rO=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}iO=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))}})}};lO=(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))(lO||{}),cO=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}},Oa=class extends cO{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},uO=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},dO=class extends Oa{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},pO=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Hc=class extends Oa{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Na={log:Ji("log"),warn:Ji("warn"),info:Ji("info"),error:Ji("error"),debug:Ji("debug")};Object.assign(globalThis,{logger:Na});Vm=Symbol.for("Jolibox.canIUseMap"),fO={};globalThis[Vm]||(globalThis[Vm]=fO);Qc=Symbol.for("Jolibox.canIUseMap.native"),mO={};globalThis[Qc]||(globalThis[Qc]=mO);Xc={get config(){return globalThis[Qc]}},gO=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(gO||{}),vO=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(vO||{}),yO=(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))(yO||{});bO();Fn=typeof window=="undefined",_O=()=>!Fn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),s6={isiOS:!Fn&&(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:!Fn&&navigator.userAgent.includes("Android"),isMac:!Fn&&navigator.userAgent.includes("Mac"),isFacebook:!Fn&&navigator.userAgent.includes("FB_IAB"),isPC:!Fn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Zc=class eu{constructor(t){this.element=t,this.next=eu.Undefined,this.prev=eu.Undefined}};Zc.Undefined=new Zc(void 0);fe=Zc,wO=class{constructor(){this._first=fe.Undefined,this._last=fe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===fe.Undefined}clear(){let e=this._first;for(;e!==fe.Undefined;){let t=e.next;e.prev=fe.Undefined,e.next=fe.Undefined,e=t}this._first=fe.Undefined,this._last=fe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new fe(e);if(this._first===fe.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==fe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==fe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==fe.Undefined&&e.next!==fe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===fe.Undefined&&e.next===fe.Undefined?(this._first=fe.Undefined,this._last=fe.Undefined):e.next===fe.Undefined?(this._last=this._last.prev,this._last.next=fe.Undefined):e.prev===fe.Undefined&&(this._first=this._first.next,this._first.prev=fe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==fe.Undefined;)yield e.element,e=e.next}},SO=0,Hi=class{constructor(e){this.value=e,this.id=SO++}},Vi=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 Hi&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Hi(t);return this._listeners?this._listeners instanceof Hi?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Hi)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let h=this._listeners.indexOf(c);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Hi?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},tu=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new Vi,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new wO,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},ru={};tO(ru,{None:()=>IO,filter:()=>AO,once:()=>og,toPromise:()=>EO});IO=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});$c=Symbol.for("Jolibox.hostEmitter"),CO=()=>{let e=new tu;return globalThis[$c]||(globalThis[$c]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[$c]},l6=CO();nu=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Vi,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return kO(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};nu=tg([ig],nu);Wm=class{constructor(){this._onWillExecuteCommand=new Vi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Vi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new nu,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=nO(3e4)),this._starActivation}executeCommand(e,...t){return rO(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),ru.toPromise(ru.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}}};Wm=tg([ig],Wm);c6=Symbol.for("Jolibox.commands");Rt("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Rt("requestProductDetailsAsync",{version:102e4});Rt("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Rt("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Rt("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Rt("userTrackAsync",{version:1e6});Rt("openMiniapp",{version:1050100});Rt("requestCoinDetailsSync",{version:1070100});Rt("requestCoinDetailsAsync",{version:1070100});Rt("sendServerEventAsync",{version:1070100});Rt("loadAdsAsync",{version:1070200});Rt("showAdAsync",{version:1070200});ag=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Xc.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",d=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(d=p)}if(typeof d!="number")return!1;let u=e();return typeof u!="number"||u<d?!1:s.length===0?!0:n(l,s,u)||n(l.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=hO(i,o);if(!s)return!1;if(jn(s)){let l=s.version;return $m(l)?typeof a=="number"&&a>=l:!0}return $m(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};TO=()=>_O(),$i="custom_event_",PO=[],RO=[],OO=["env","createRequestTask","login"],sg="__batch_event__",NO="__native_batch_event__",DO=e=>e==="pv"?e:"default",Ta=class{constructor(e){this.interval=30,this.lastReportTime=0,this.cache={};let{reporter:t,interval:r=30,eventName:n,tagNameOrder:i,metricName:o,type:a}=e;this.reporter=t,this.interval=r,this.eventName=n,this.tagNameOrder=i,this.metricName=o,this.type=DO(a)}report(e){this.type==="pv"?this.addPVPoint(e):this.addPoint(e),this.tryReport(!1)}flush(){this.tryReport(!0)}tryReport(e){if(Object.keys(this.cache).length){if(e){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(e){let t=(r,n,i,o)=>{let a=n.shift();if(a){let s=o[a];r[s]||(r[s]={}),t(r[s],n,i,o)}else r[i]||(r[i]=[]),r[i].push(o[i])};t(this.cache,[...this.tagNameOrder],this.metricName,e)}addPVPoint(e){let t=(n,i,o,a)=>{let s=i.shift();if(!s&&jn(a))throw new Hc(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(jn(a))l.push(...Object.keys(a));else if(rg(a)){if(i.length>0)throw new Hc(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new Hc(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let d=jn(a)?a[c]:a;t(n[c],[...i],o,d)})}else n[o]?n[o]++:n[o]=1},r={point:e,metricName:this.metricName,tagNameOrder:this.tagNameOrder};t(this.cache,[...this.tagNameOrder],this.metricName,e)}processPoints(e){return{eventName:this.eventName,tagNameOrder:this.tagNameOrder,metricName:this.metricName,metricAggregateType:this.type==="pv"?"itoa":"arr",data:e}}clearPoints(){this.cache={}}},Km=!1;Kc=[],qO=!1,iu=Symbol.for("Jolibox.invokeResolverInstance"),UO=new Map;globalThis[iu]||(globalThis[iu]=UO);MO={get resolveMap(){return globalThis[iu]}};xa=Symbol.for("Jolibox.subscribeInstance");Pt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Pt.trigger=e},onDoExit(e){Pt.exit=e},onDoBackPress(e){Pt.backPress=e}},cg=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new uO("native env failed"));else{let{data:r}=JSON.parse(t);return r!=null?r:void 0}};if(typeof window!="undefined"&&window.webkit){let e=window.webkit.messageHandlers,t=(i="")=>{Pt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ra(void 0,null,function*(){let o=yield Pt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});ou={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=lg(o,"joliboxJSCore");window.prompt("publish",JSON.stringify({event:i,paramsString:JSON.stringify(s),webviewIds:a}))},call(i,o,a){let s=window.prompt("invoke",JSON.stringify({event:i,paramsString:JSON.stringify(o),callbackId:a}));if(s)return JSON.parse(s)}};let n={onDocumentReady:t,env:cg,doExit:r};globalThis.joliboxJSCore=pr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Pt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ra(void 0,null,function*(){let a=yield Pt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});ou={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=lg(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Ra(this,null,function*(){let a=yield Pt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:cg,doExit:n};globalThis.joliboxJSCore=pr({},i)}ug=ou;if(!ug&&TO())throw new pO("No joliboxJScore is found, native bridge not found.");JO=pr({},ug),dg=GO(JO),{invokeHandler:Qm}=dg,{applyNative:he,invokeNative:F,onNative:De,offNative:u6,subscribeHandler:HO,publish:pg,emitNative:au,subscribe:d6,unsubscribe:p6}=dg;globalThis.joliboxJSBridge={callHandler:Qm,invokeHandler:Qm,subscribeHandler:HO}});function KO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function La(e){return new Promise(t=>setTimeout(t,e))}function Qi(e){return typeof e=="string"}function cn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function bg(e){return typeof e=="object"&&Array.isArray(e)}function qa(e){return typeof e=="number"&&!isNaN(e)}function Fr(e){return e===!0||e===!1}function _g(e){return typeof e=="undefined"}function Xi(e){return _g(e)||e===null}function YO(e){return typeof e=="function"}function wg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Sg(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,o){for(let a in o)if(Object.prototype.hasOwnProperty.call(o,a)){let s=i[a],l=o[a],c=r(s,l,a,i,o);c!==void 0?i[a]=c:mg(l)&&mg(s)?i[a]=n(vg({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function mg(e){return e&&typeof e=="object"&&e.constructor===Object}function Ig(e,t){if(Array.isArray(e))return e.concat(t)}function Zi(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:l=!0}=r,c=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),d=function(...u){i=u,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return d.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,c()},d}function XO(e,t){return(...r)=>t(e,...r)}function Bn(e){return t=>XO(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Wt(`${i}`))}})}function Wi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function xg(e,t,r){let n=0;if(e!==t){let i=e.split("."),o=t.split("."),a=Math.max(i.length,o.length);for(let s=0;s<a;s++){let l=parseInt(i[s],10)||0,c=parseInt(o[s],10)||0;if(l>c){n=1;break}else if(l<c){n=-1;break}}}if(!r)return n;switch(r){case">":return n>0;case"<":return n<0;case"=":return n===0;case">=":return n>=0;case"<=":return n<=0;default:return!1}}function bu(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function i1(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com"||a==="mporia.com"||a==="pingplus.ai")return`${o}.${a}`}return`${o}.jolibox.com`}function _u(e){return i1("app","stg-app",e)}function Jn(e){return`https://${_u(e)}`}function l1(e){return new Promise(t=>Og(e)(t))}function Og(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function c1(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Yi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function d1(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)p1(e[n],t[n])}function p1(e,t){if(Qi(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(YO(t)){try{if(e instanceof t)return}catch(r){}if(!Xi(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 f1(){return typeof globalThis!="undefined"?globalThis[Ng]:void 0}function h1(e){typeof globalThis!="undefined"&&(globalThis[Ng]=e)}function W(e=!1){let t=f1();if(!e&&t)return t;let r=new Da,n=new pu,i={registerCommand(o,a,s){r.registerCommand({id:o,handler:a,metadata:s})},executeCommand(o,...a){return n.executeCommand(o,...a)},excuteCommandSync(o,...a){return n.executeCommandThowErr(o,...a)}};return h1(i),i}var fu,$O,fg,VO,WO,hg,vg,zO,yg,ln,ut,QO,hu,eo,mu,Eg,Wt,Ua,Ag,Ma,Cg,kg,to,gu,zt,lu,ZO,vu,gg,e1,V,yu,t1,Gn,zi,ro,r1,n1,Tg,Pg,Rg,Ft,cu,me,o1,a1,Ki,Yi,Kt,du,s1,su,u1,_e,Da,pu,Ng,O=x(()=>{"use strict";fu=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,fg=Object.getOwnPropertySymbols,VO=Object.prototype.hasOwnProperty,WO=Object.prototype.propertyIsEnumerable,hg=(e,t,r)=>t in e?fu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,vg=(e,t)=>{for(var r in t||(t={}))VO.call(t,r)&&hg(e,r,t[r]);if(fg)for(var r of fg(t))WO.call(t,r)&&hg(e,r,t[r]);return e},zO=(e,t)=>{for(var r in t)fu(e,r,{get:t[r],enumerable:!0})},yg=(e,t,r,n)=>{for(var i=n>1?void 0:n?$O(t,r):t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=(n?a(t,r,i):a(i))||i);return n&&i&&fu(t,r,i),i},ln=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}ut=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))}})}};QO=(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))(QO||{}),hu=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}},eo=class extends hu{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},mu=class extends hu{constructor(){super(...arguments),this.kind="USER_ERROR"}},Eg=class extends mu{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Wt=class extends mu{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))}},Ua=class extends mu{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_PAYMENT_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Ag=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Ma=class extends eo{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="INTERNAL_PAYMENT_ERROR",this.priority="P0",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Cg=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},kg=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},to=class extends hu{constructor(e,t,r,n,i){super(e),this.message=e,this.code=t,this.kind="API_ERROR",this.name="API_ERROR",r&&(this.errorType=r),n!==void 0&&(this.stack=n),i&&(this.priority=i)}toJSON(){return{message:this.message,stack:this.stack,name:this.name,code:this.code,errorType:this.errorType}}},gu=class extends eo{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};zt={log:Wi("log"),warn:Wi("warn"),info:Wi("info"),error:Wi("error"),debug:Wi("debug")};Object.assign(globalThis,{logger:zt});lu=Symbol.for("Jolibox.canIUseMap"),ZO={};globalThis[lu]||(globalThis[lu]=ZO);vu={get config(){return globalThis[lu]}},gg=Symbol.for("Jolibox.canIUseMap.native"),e1={};globalThis[gg]||(globalThis[gg]=e1);V=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(V||{}),yu=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(yu||{}),t1=(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))(t1||{}),Gn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});bu();zi=typeof window=="undefined",ro={isiOS:!zi&&(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:!zi&&navigator.userAgent.includes("Android"),isMac:!zi&&navigator.userAgent.includes("Mac"),isFacebook:!zi&&navigator.userAgent.includes("FB_IAB"),isPC:!zi&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},r1="device_id",n1="advertising_id",Tg=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Gn()),window.__joliboxLocalStorage__.getItem(e)),Pg=()=>new URLSearchParams(window.location.search).get("deviceId")||Tg(r1),Rg=()=>new URLSearchParams(window.location.search).get("advertisingId")||Tg(n1);Ft=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=vg({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return ln(this,null,function*(){let r=this.config.keyGenerator(e,t),n=this.pendingRequests.get(r);if(n)return console.log(`[RequestCacheService] Reusing pending request for ${e}`),n;let i=this.requestInternal(e,t),o=this.createTimeoutPromise(),a=Promise.race([i,o]).catch(s=>ln(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,a),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield a}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return ln(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let u=yield this.requestAdapter.execute(e,t),p=this.requestAdapter.extractRealTimeData(u),f=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,u);return f&&!this.config.consistencyChecker(l,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,f,s),u):this.requestAdapter.mergeData(l,p)}catch(u){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,u),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),d=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return d&&this.setCachedDataWithSequence(a,d,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:o,expiresAt:o+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return ln(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return ln(this,null,function*(){var r,n;let i=this.config.keyGenerator(e,t),o=++this.requestSequence;console.log(`[RequestCacheService] Force request for ${e} (sequence: ${o})`);let a=yield this.requestAdapter.execute(e,t),s=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,a);return s&&(this.setCachedDataWithSequence(i,s,o),console.log(`[RequestCacheService] Force updated cache for ${e}`)),a})}warmupCache(e,t){return ln(this,null,function*(){let r=this.config.keyGenerator(e,t);if(this.pendingRequests.has(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - request in progress`);return}if(this.hasValidCache(r)){console.log(`[RequestCacheService] Skipping warmup for ${e} - valid cache exists`);return}try{console.log(`[RequestCacheService] Warming up cache for ${e}`),yield this.forceRequest(e,t)}catch(n){console.warn(`[RequestCacheService] Cache warmup failed for ${e}:`,n)}})}clearCache(e){e?(this.cache.delete(e),this.cacheSequences.delete(e),this.pendingRequests.delete(e),console.log(`[RequestCacheService] Cleared cache for ${e}`)):(this.cache.clear(),this.cacheSequences.clear(),this.pendingRequests.clear(),this.requestSequence=0,console.log("[RequestCacheService] Cleared all cache"))}clearExpiredCache(){let e=Date.now();for(let[t,r]of this.cache)e>r.expiresAt&&(this.cache.delete(t),this.cacheSequences.delete(t));console.log("[RequestCacheService] Cleared expired cache entries")}getCacheStats(){let e=Date.now(),t=0,r=0;for(let n of this.cache.values())e>n.expiresAt?r++:t++;return{cacheCount:this.cache.size,validCount:t,expiredCount:r,pendingRequestCount:this.pendingRequests.size}}getCacheKeys(){return Array.from(this.cache.keys())}hasValidCache(e){let t=this.cache.get(e);return t?Date.now()<=t.expiresAt:!1}getPendingRequestKeys(){return Array.from(this.pendingRequests.keys())}hasPendingRequest(e){return this.pendingRequests.has(e)}getCacheSequence(e){return this.cacheSequences.get(e)}},cu=class uu{constructor(t){this.element=t,this.next=uu.Undefined,this.prev=uu.Undefined}};cu.Undefined=new cu(void 0);me=cu,o1=class{constructor(){this._first=me.Undefined,this._last=me.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===me.Undefined}clear(){let e=this._first;for(;e!==me.Undefined;){let t=e.next;e.prev=me.Undefined,e.next=me.Undefined,e=t}this._first=me.Undefined,this._last=me.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new me(e);if(this._first===me.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==me.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==me.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==me.Undefined&&e.next!==me.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===me.Undefined&&e.next===me.Undefined?(this._first=me.Undefined,this._last=me.Undefined):e.next===me.Undefined?(this._last=this._last.prev,this._last.next=me.Undefined):e.prev===me.Undefined&&(this._first=this._first.next,this._first.prev=me.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==me.Undefined;)yield e.element,e=e.next}},a1=0,Ki=class{constructor(e){this.value=e,this.id=a1++}},Yi=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 Ki&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new Ki(t);return this._listeners?this._listeners instanceof Ki?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Ki)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(u=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||u.call(d));else if(this._listeners){let h=this._listeners.indexOf(c);h>=0&&(this._listeners.splice(h,1),this._size--,this._size===0&&((f=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||f.call(p)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof Ki?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Kt=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t,r=!0){var n;let i=(n=this.listeners.get(e))!=null?n:new Yi,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new o1,this.cachedEventQueue.set(e,n)),n.push({args:t}),r&&r.fire({event:e,args:t})}once(e,t){let r=(...n)=>{t(...n),this.off(e,r)};this.on(e,r,!1)}},du={};zO(du,{None:()=>s1,filter:()=>c1,once:()=>Og,toPromise:()=>l1});s1=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});su=Symbol.for("Jolibox.hostEmitter"),u1=()=>{let e=new Kt;return globalThis[su]||(globalThis[su]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[su]},_e=u1();Da=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Yi,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(...i){return d1(i,r),n(...i)}}let{id:t}=e;this._commands.get(t)&&console.info(`[Jolibox SDK] duplicated command is registered ${t}`),this._commands.set(t,e),this._onDidRegisterCommand.fire(t)}getCommand(e){return this._commands.get(e)}getCommands(){let e=new Map;for(let t of this._commands.keys()){let r=this.getCommand(t);r&&e.set(t,r)}return e}};Da=yg([wg],Da);pu=class{constructor(){this._onWillExecuteCommand=new Yi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Yi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Da,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=KO(3e4)),this._starActivation}executeCommand(e,...t){return ln(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),du.toPromise(du.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}}};pu=yg([wg],pu);Ng=Symbol.for("Jolibox.commands")});function Ee(e,t={}){wu.emit("ERROR_REPORT",{error:e,options:t})}var wu,un,yt=x(()=>{"use strict";O();O();wu=new Kt,un=new Kt;Ee.debounce=Zi(Ee,50,{leading:!0})});var Su,m1,Dg,Lg,qg=x(()=>{"use strict";O();yt();Su=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=t.length%4===0?"":"=".repeat(4-t.length%4),n=atob(t+r);try{return JSON.parse(n)}catch(i){return{}}},m1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Dg=e=>{var t;try{let i=(t=new URL(e).searchParams.get("joliSource"))==null?void 0:t.split(".");if(i!=null&&i.length){let[o,a,s]=i;return{headerJson:Su(o),payloadJson:Su(a),signature:Su(s)}}else throw"joli_source is missing"}catch(r){return Ee(new Ag(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Lg=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=m1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var g1,Iu,Ug=x(()=>{"use strict";O();g1="1.3.7",Iu=()=>g1});function Au(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var v1,Mg,Eu,Fg,ge,y1,S,H=x(()=>{"use strict";O();qg();Ug();O();v1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Pg(),adId:Rg(),pixelRatio:window.devicePixelRatio||1,platform:ro.isAndroid?"android":ro.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Iu()},schema:window.location.href,platform:ro.isAndroid?"android":ro.isiOS?"ios":"h5"},Eu=(Mg=globalThis.joliboxJSCore)==null?void 0:Mg.env,ge=Object.assign({},(Fg=Eu==null?void 0:Eu())!=null?Fg:v1);y1=()=>{var g,b,y,_,I,E,T,k,C,G,ce;let{payloadJson:e,headerJson:t,signature:r}=ge.schema.length?Dg(ge.schema):{},n=`${ge.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ge.schema.length?ge.schema:window.location.href).searchParams,a=(y=(b=(g=o.get("mpId"))!=null?g:o.get("appId"))!=null?b:o.get("gameId"))!=null?y:"",s=(E=(I=(_=ge.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?I:o.get("sessionId"))!=null?E:n,l=!!((k=(T=e==null?void 0:e.testAdsMode)!=null?T:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),c=(ce=(G=(C=e==null?void 0:e.joliboxEnv)!=null?C:e==null?void 0:e.__joliboxEnv)!=null?G:o.get("joliboxEnv"))!=null?ce:"production",d=c==="staging",u=t==null?void 0:t.channel,f=new URL(window.location.href).searchParams,h=e==null?void 0:e.__shouldInterupt;return{get startTime(){var N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var N,R;return(R=(N=f.get("joliSource"))!=null?N:o.get("joliSource"))!=null?R:null},get mpId(){var N;return(N=a!=null?a:e==null?void 0:e.id)!=null?N:""},get mpVersion(){var N;return(N=t==null?void 0:t.ver)!=null?N:Iu()},get mpType(){var N,R;return(R=(N=t==null?void 0:t.__mpType)!=null?N:e==null?void 0:e.__mpType)!=null?R:"game"},get platform(){var N;return((N=ge.platform)!=null?N:ge.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ge.deviceInfo},get sdkInfo(){return ge.sdkInfo},get hostInfo(){return ge.hostInfo},get hostUserInfo(){return ge.hostUserInfo},get sessionId(){var N,R;return(R=(N=ge.clientSessionId)!=null?N:s)!=null?R:n},get channel(){return u},get webviewId(){var N;return(N=ge.webviewId)!=null?N:-1},get shouldInterupt(){return h},get from(){return e==null?void 0:e.__from},get baseApiHost(){return _u(d)},get adId(){var N;return(N=ge.deviceInfo.adId)!=null?N:ge.deviceInfo.did},get language(){return ge.deviceInfo.lang},get sdkEnvironment(){return Au("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Au("gamedistribution","jolibox")?"gamedistribution":Au("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var J,re,Mt;let N=(J=ge.deviceInfo.pixelRatio)!=null?J:1,R=(re=ge.deviceInfo.statusBarHeight)!=null?re:e==null?void 0:e.__androidStatusBarHeight,D=(Mt=ge.deviceInfo.navigationBarHeight)!=null?Mt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:R!==void 0?R/N:20,navigationBarHeight:D!==void 0?D/N:10}},get abTests(){var N,R;return(R=(N=ge.abValues)==null?void 0:N.split(","))!=null?R:[]},get mpInfo(){var N;return(N=ge.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{Sg(ge,N,Ig)},encodeJoliSourceQuery:N=>{var R,D;return t&&r?Lg(P(P({},e),N),(R=o.get("joliSource"))!=null?R:""):(D=o.get("joliSource"))!=null?D:""},setDoExitDirectly:()=>{h=!1}}},S=y1()});var Cu,Bg,b1,_1,jg,w1,Gg=x(()=>{"use strict";O();yt();H();O();Cu=!1,Bg=(e,t)=>e==null?!1:t in e,b1=e=>Bg(e,"kind"),_1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},jg=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=S.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=S.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_1(e.name)},i=B(P({},n),{env:t.environment,isFromUser:r});r?un.emit("GLOBAL_USER_ERROR",e,i):un.emit("GLOBAL_ERROR",e,i)},w1=e=>Bg(e,"kind")&&e.kind==="USER_ERROR";wu.on("ERROR_REPORT",({error:e,options:t})=>{if(Cu)return;Cu=!0;let r=b1(e)&&e.raw?e.raw:e;try{let n=w1(e);jg(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new gu(`${i}, origin error: ${r.message}`);zt.error(o),jg(new gu(o.message),{environment:t.environment},!1)}finally{Cu=!1}})});var Je,ku,jr=x(()=>{"use strict";yt();O();yt();Je=(e,t)=>{var r,n;return new to((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},ku=e=>new Eg(e)});var Jg=x(()=>{"use strict";Gg();jr();O();ue();un.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};F("trackAsync",{event:"reportJsError",data:r})});un.on("GLOBAL_USER_ERROR",(e,t)=>{zt.log("UserError",e,t)})});var xu=x(()=>{"use strict"});function Hg(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=Xe(c,["eventType"]),l=B(P({tag:n,eventType:o!=null?o:a!=null?a:V.Other},t),{extra:P({},s)});n=="globalJsError"?Ee(new kg(JSON.stringify(l))):e("systemLog",l,S.webviewId)};return r.debounce=Zi(r,500,{leading:!0}),r}function $g(e){let t=(r,n,i)=>{var s;let o=(s=i&&JSON.stringify(i))!=null?s:0,a={speed_value_type:r,total_duration:n};o&&Object.assign(a,{extra:o}),e("joliboxSpeedAnalysis",a)};return t.debounce=Zi(t,500,{leading:!0}),t}var Vg=x(()=>{"use strict";O();O();yt();H()});function Wg(e,t){let r=Hg(e,t),n=$g(r);return{track:r,trackPerformance:n}}var zg=x(()=>{"use strict";Vg()});var Kg=x(()=>{"use strict";H();O();O()});var Yg=x(()=>{"use strict";zg();xu();Kg()});var Fa,Qg=x(()=>{"use strict";Fa=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{window.parent&&window.parent.postMessage({type:t,data:r},"*")};this.playGame=t=>{this.reportCount++,(this.reportCount<=3||(this.reportCount-3)%3===0)&&(this.reporter({event:"PLAY_GAME",params:{duration:t}}),this.tracker("PlayGame",{duration:t}),this.notifyIframeGameEvent("JOLIBOX_GAME_PLAY",{duration:t}))};this.timer=this.createRAFTimer(t=>{this.playGame(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.notifyIframeGameEvent("JOLIBOX_GAME_OPEN",{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.notifyIframeGameEvent("JOLIBOX_GAME_CLOSE",{duration:t}),this.timer.stop()}createRAFTimer(t){let r=Date.now(),n,i,o=!1,a=0,s=()=>{if(!o)return;let f=Date.now(),h=f-r;h>=this.interval&&(this.visible&&(a+=Math.min(h,this.interval+1e3),t(a)),r=f),n=requestAnimationFrame(s)},l=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let f=Date.now();f-r>=this.interval&&(r=f)},this.interval)},c=()=>{u(),r=Date.now(),n=requestAnimationFrame(s)},d=()=>{n&&(cancelAnimationFrame(n),n=0)},u=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",f=>{o&&(console.log("visible",f),f?c():l())});let p=this.visible;return{start(){o||(o=!0,p?c():l())},stop(){o=!1,d(),u()}}}}});function ja(e,t,r){var l,c,d;let n=new Map,i=(l=r==null?void 0:r.baseUrl)!=null?l:Jn(S.testMode),o=(c=r==null?void 0:r.type)!=null?c:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return De("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:g,state:b}=f,y=Xe(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(y):p.reject(y),n.delete(g)}else if(u.state==="fail"){let h=u,{requestTaskId:g,state:b}=h,y=Xe(h,["requestTaskId","state"]);p.reject(y),n.delete(g)}else zt.warn("onRequestTaskStateChange unknown event",u)}),_e.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...h)=>v(this,[f,...h],function*(u,p={}){let g=Date.now(),b=S1(u,B(P({},p),{baseUrl:i})),{method:y="GET",responseType:_="text",dataType:I="json",timeout:E,enableCache:T=!1,appendHostCookie:k=!0}=p,C=Object.assign({"content-type":"application/json"},a,p.header),G={url:b,method:y,header:C,enableCache:T,responseType:_,appendHostCookie:k};if(y=="POST"||y=="PUT"){let J=E1(p.data,C["content-type"]);G.data=J}E&&Object.assign(G,{timeout:E});let{data:{requestTaskId:ce}}=F(e,G);if(typeof ce!="string")throw Je({code:-1,msg:"requestTaskId is not a string"});let{resolve:N,reject:R,promise:D}=new ut;n.set(ce,{resolve:N,reject:R});try{let J=yield D,{data:re}=J;return I==="json"&&typeof re=="string"&&(re=I1(re)),{url:b,timeout:E,method:y,response:B(P({},J),{data:re})}}catch(J){let re=J;if(cn(re)){let{errMsg:Mt,prefetchDetail:Bc,isPrefetch:Gc,errNo:UR}=re;Qi(Mt)&&Ee(Je({code:-1,msg:Mt},{errNo:UR,errMsg:Mt}))}throw J}})}function I1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function E1(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 S1,Tu=x(()=>{"use strict";O();ue();yt();jr();H();S1=(e,t)=>{if(/^https?:\/\//.test(e))return e;let r=t==null?void 0:t.query,i=new URLSearchParams(r).toString();return t!=null&&t.baseUrl?`${t.baseUrl}${e}${i?`?${i}`:""}`:`${e}${i?`?${i}`:""}`}});var Pu,Xg,z,dt=x(()=>{"use strict";Tu();H();O();Pu={};(Xg=S.hostUserInfo)!=null&&Xg.token&&(Pu["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(Pu["x-joli-source"]=S.joliSource);z=ja("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Jn(S.testMode),defaultHeaders:Pu})});function Zg(e){let t=vu.config[e];return t||(t={},vu.config[e]=t),(r,n)=>{if(t[r]){zt.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var ev=x(()=>{"use strict";O()});function Ru(e){tv=e}function Ba(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>Ba(t)):Object.keys(e).reduce((t,r)=>(t[r]=Ba(e[r]),t),{})}function fr(e){return typeof e=="number"}function Ou(e){let t=Nu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Nu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var tv,ke,Ga,Ja,Ha,$a,Hn,Va,Wa,za,Ka,Ya,Qa,Xa,Za,es,ts,rs,ns,Du=x(()=>{"use strict";tv=!1;ke=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(tv)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 ${Ou(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Ba(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Ba(this._default)}optional(){return this._optional=!0,this}};Ga=class extends ke{validate(t){return this._optional&&t===void 0?!0:fr(t)?fr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):fr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):fr(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}},Ja=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Ha=class extends ke{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(fr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(fr(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}},$a=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Hn=class extends ke{validate(t){return!0}},Va=class extends ke{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Wa=class extends ke{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},za=class extends ke{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Ka=class extends ke{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 ${Ou(t)}`)}return!0}},Ya=class extends ke{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(fr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(fr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(fr(this._length)&&r.length!==this._length)return this.fail(`the length of ${this.path} should be equal to ${this._length}`);let n=this._item;if(!n)return!0;let i=!0;if(r.forEach((o,a)=>{if(n.path=`${this.path}[${a}]`,n.errors=this.errors,o===void 0&&n.hasDefault){r[a]=n.defaultValue;return}n.validate(o)||(n.hasFallback?r[a]=n.fallbackValue:i=!1)}),this._uniqueItems){let o=new Map;for(let a in r)o.has(r[a])?i=this.fail(`${this.path} should NOT have duplicate items (${this.path}[${o.get(r[a])}] and ${this.path}[${a}] are identical)`):o.set(r[a],a)}return i}minItems(r){return this._minItems=r,this}maxItems(r){return this._maxItems=r,this}uniqueItems(){return this._uniqueItems=!0,this}length(r){return this._length=r,this}},Qa=class extends ke{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Nu(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,o=this._value;o.errors=this.errors;let a=!0;for(let s in i){let l=i[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?o.path=`${this.path}.${s}`:o.path=`${this.path}["${s}"]`,!(l===void 0&&o._optional)){if(l===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(l)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Xa=class extends ke{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Nu(r)!=="object")return this.fail({expect:"object",actual:r});let n=r,i=!0;for(let o in this._object){let a=n[o],s=this._object[o];if(s.errors=this.errors,/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(o)?s.path=`${this.path}.${o}`:s.path=`${this.path}["${o}"]`,!(s._optional&&a===void 0)){if(a===void 0&&s.hasDefault){n[o]=s.defaultValue;continue}s.validate(a)||(s.hasFallback?n[o]=s.fallbackValue:i=!1)}}return i}},Za=class extends ke{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Ou(this.value),actual:r}):!0}},es=class extends ke{constructor(...t){super(),this._items=t}validate(t){if(t===void 0&&this._optional)return!0;let r=[],n=!1,i=this._items.length;for(let o=0;o<i;o++){let a=this._items[o];if(a.errors=[],a.path=this.path,!a.validate(t))r.push(a.errors.join("; "));else if(!n){n=!0;break}}if(!n){let o=r.join(`
|
|
2
2
|
or `);this.errors.push(o)}return n}},ts=class extends ke{constructor(...t){super(),this._items=t;let r=0,n=t.length-1;for(;n>=0;n--){let i=t[n];if(i._optional||i.hasDefault)r+=1;else break}this._minItems=t.length-r}validate(t){if(t===void 0&&this._optional)return!0;if(!Array.isArray(t))return this.fail({expect:"array",actual:t});if(t.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);let r=!0;return this._items.forEach((n,i)=>{if(n.path=`${this.path}[${i}]`,n.errors=this.errors,t[i]===void 0&&n.hasDefault){t[i]=n.defaultValue;return}n.validate(t[i])||(n.hasFallback?t[i]=n._fallback:r=!1)}),r}},rs=class extends ke{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},ns=class extends ke{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 Lu(e,t,r="param"){if(e.errors=[],e.path=r,Ru(!0),!e.validate(t)){let n=e.errors.join(`
|
|
3
3
|
`);throw e.errors.length=0,Ru(!1),new TypeError(n)}}var A,qu=x(()=>{"use strict";Du();Du();A={object(e){return new Xa(e)},array(e){return new Ya(e)},tuple(...e){return new ts(...e)},literal(e){return new Za(e)},or(...e){return new es(...e)},symbol(){return new $a},record(e){return new Qa(e)},function(){return new za},boolean(){return new Ja},string(){return new Ha},number(){return new Ga},undefined(){return new Va},null(){return new Wa},unknown(){return new Hn},any(){return new Hn},as(){return new Hn},arraybuffer(){return new rs},enum(...e){return new Ka(...e)},typedarray(e){return new ns(e)}}});var is,rv,nv=x(()=>{"use strict";O();yt();qu();jr();is=1,rv=e=>{function t(n,i){return(...o)=>{var u,p,f,h;let a=Date.now(),s={method:n,trace_id:is};is+=1;let l="SUCCESS",c=`${n}:ok`,d=0;try{if(i.paramsSchema)try{Lu(i.paramsSchema,o,"params")}catch(_){throw ku(`${n}:fail ${_.message}`)}let g=i.implement(...o),b=g,y=`${n}:ok`;if(g&&"code"in g){let{code:_,data:I,message:E}=g;l=_,b=I,y=E}return{code:l,message:y,data:b}}catch(g){let b=g;d=(p=(u=b.code)!=null?u:b.errNo)!=null?p:2e3,l="FAILURE";let y=(h=(f=b.message)!=null?f:b.errMsg)!=null?h:`${g}`;return c=`${n}:${l} ${y.replace(/^\S+:(fail|cancel)\s?/,"")}`,Ee(new to(c,d)),{code:l,message:c}}finally{let g=Date.now()-a}}}function r(n,i){return(...o)=>v(this,null,function*(){var p,f,h,g;let a=bg(o)?o:[o],s=Date.now(),l={method:n,trace_id:is};is+=1;let c=`${n}:ok`,d="SUCCESS",u={code:d,message:c};try{if(i.paramsSchema)try{Lu(i.paramsSchema,a,"params")}catch(_){throw ku(_.message)}let y=yield i.implement(...a);if(y&&"code"in y){let{code:_,data:I,message:E}=y;d=_,c=E,y=I}return Object.assign(u,{code:d,message:c,data:y}),u}catch(b){let y=b,_=(f=(p=y.code)!=null?p:y.errNo)!=null?f:2e3;d="FAILURE";let I=(g=(h=y.message)!=null?h:y.errMsg)!=null?g:`${b}`,E=`${n}:${d} ${I.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:d,message:E}),Ee(new to(E,_)),u}finally{let b=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var je,Uu=x(()=>{"use strict";H();ue();({canIUseNative:je}=ag(()=>S.sdkInfo.nativeSDKVersionCode,()=>S.platform))});function Mu(e){if(typeof e!="number"||e<=0)return"0.0.0";let t=e.toString(),r=0,n=0,i=0;return t.length>=1&&(r=parseInt(t.substring(0,1),10)),t.length>=3&&(n=parseInt(t.substring(1,3),10)),t.length>=5&&(i=parseInt(t.substring(3,5),10)),`${r}.${n}.${i}`}var iv=x(()=>{"use strict"});var ie,Y,L,He=x(()=>{"use strict";ev();bt();nv();qu();Uu();iv();({createAPI:ie,createSyncAPI:Y}=rv(j)),L=Zg("native")});function ov(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return t==="array"&&(t="object"),P1.includes(t)?t:""}function av(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 sv(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 os,C1,k1,x1,T1,j8,B8,P1,Br,_t,no=x(()=>{"use strict";He();ue();O();dt();H();os=W(),C1=ie("getLocalStorage",{paramsSchema:A.tuple(A.string()),implement(e){return v(this,null,function*(){let{response:t}=yield z(`/api/games/user-storage/${S.mpId}`,{method:"GET",responseType:"json",appendHostCookie:!0,query:{key:e}}),{data:{code:r,message:n,data:i}}=yield t;if(r==="SUCCESS")return{code:r,message:n,data:i==null?void 0:i.value};try{let{data:{data:o,dataType:a}}=yield he("getLocalStorageAsync",{key:e}),s=av(o,a);return{code:r,message:`${n}. fallback to native`,data:s}}catch(o){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get local storage failed",data:null}}})}});os.registerCommand("StorageSDK.getItem",C1);L("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});k1=ie("setStorage",{paramsSchema:A.tuple(A.string(),A.or(A.string(),A.boolean(),A.number())),implement(e,t){return v(this,null,function*(){let r=S.mpId,n=typeof t=="string"?t:String(t),{response:i}=yield z(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:o,message:a}}=i,s=ov(t),l=sv(t,s);return yield he("setLocalStorageAsync",{key:e,data:l,dataType:s}),o=="SUCCESS"?{code:o,message:a}:{code:o,message:`${a}. fallback to native`}})}});os.registerCommand("StorageSDK.setItem",k1);L("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});x1=ie("removeStorage",{paramsSchema:A.tuple(A.string()),implement(e){return v(this,null,function*(){let t=S.mpId,{response:r}=yield z(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:i}}=r;return yield he("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:i}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});os.registerCommand("StorageSDK.removeItem",x1);L("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});T1=ie("clearStorage",{implement(){return v(this,null,function*(){let e=S.mpId,{response:t}=yield z(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});he("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});os.registerCommand("StorageSDK.clear",T1);L("storage.clear",{version:"1.0.0"});j8=ie("getStorageInfo",{implement(){return v(this,null,function*(){let{data:e}=yield he("getStorageInfoAsync");return e})}});L("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});B8=Y("getStorageInfoSync",{implement(){return F("getStorageInfoSync")}}),P1=["string","number","boolean","object",""];Br=ie("getGlobalStorage",{paramsSchema:A.tuple(A.string()),implement(e){return v(this,null,function*(){try{let{data:{data:t,dataType:r}}=yield he("getGlobalStorageAsync",{key:e});return{code:"SUCCESS",message:"success",data:av(t,r)}}catch(t){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get global storage failed",data:null}}})}}),_t=ie("setGlobalStorage",{paramsSchema:A.tuple(A.string(),A.or(A.string(),A.boolean(),A.number(),A.array())),implement(e,t){return v(this,null,function*(){try{let r=ov(t),n=sv(t,r);return yield he("setGlobalStorageAsync",{key:e,data:n,dataType:r}),{code:"SUCCESS",message:"success"}}catch(r){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] set global storage failed"}}})}})});var lv,as,cv=x(()=>{"use strict";H();Qg();O();dt();ue();no();Uu();lv="REPORT_FIRST_OPEN_GAME",as=class extends Fa{constructor(t,r,n){super(r,n),this.gameId=S.mpId,this.sessionId=S.sessionId,this.track=t,this.taskUrl=Jn(S.testMode)+"/api/base/app-event"}reporter(t){return v(this,null,function*(){let{event:r,params:n,extraParams:i}=t,o={eventType:r,gameInfo:P({gameId:this.gameId,sessionId:this.sessionId},n)};i&&Object.assign(o,i),yield this.createTask(o)})}reportToNative(t){return v(this,null,function*(){let{event:r,params:n}=t;yield he("userTrackAsync",{event:r,params:P({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}start(t){super.start(t),this.tryReportOpenGamePlus()}tryReportOpenGamePlus(){Br(lv).then(t=>{Fr(t.data)&&t.data&&this.tracker("OpenGame_2Plus"),_t(lv,!0)})}createTask(t){return je("sendServerEventAsync")?he("sendServerEventAsync",{payload:t}):S.platform==="android"?z("/api/base/app-event",{method:"POST",data:t}):he("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(t)})}}});var hv={};Jm(hv,{nativeTaskEmitter:()=>io,taskTracker:()=>wt,track:()=>j,trackPerformance:()=>pv});var R1,uv,dv,j,pv,fv,io,wt,bt=x(()=>{"use strict";Jg();O();xu();Yg();H();cv();ue();R1=(e,t,r)=>{var c,d,u,p,f,h,g;let n=t,i=cn(n.extra)?n.extra:Qi(n.extra)?JSON.parse(n.extra):{},{mpName:o,mpVersion:a}=(c=S.mpInfo)!=null?c:{},s=P(P(B(P({},i),{mp_id:(d=n.mp_id)!=null?d:"",mp_version:(u=n.mp_version)!=null?u:"",session_id:S.sessionId,user_id:(f=(p=S.hostUserInfo)==null?void 0:p.uid)!=null?f:""}),o?{mp_name:o}:{}),a?{mp_info_version:a}:{}),l=(h=n.eventType)!=null?h:V.Other;F("trackAsync",{event:(g=t.tag)!=null?g:e,data:s,webviewId:r,eventType:l})},{track:j,trackPerformance:pv}=Wg(R1,{type:yu.AppSDK,platform:"native",jssdk_version:(dv=(uv=S.sdkInfo)==null?void 0:uv.jssdkVersion)!=null?dv:"1.0.0",mp_id:S.mpId,mp_version:S.mpVersion}),fv=W();fv.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{pv(e,t,r)});fv.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{j(e,t)});io=new Kt,wt=new as(j,io)});function mv(){let e=null,t=null,r=window.fetch,n=()=>{t=document.createElement("meta"),t.setAttribute("name","viewport"),t.setAttribute("content","viewport-fit=cover, width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"),t.setAttribute("data-jolibox-sdk","viewport-meta"),e=document.createElement("style"),e.setAttribute("data-jolibox-sdk","default-styles");let s=`
|
|
4
4
|
html[data-jolibox-root] {
|
|
@@ -619,7 +619,7 @@ If multiple caches share the same key they might "fight" for each other's style
|
|
|
619
619
|
transform: rotate(360deg);
|
|
620
620
|
}
|
|
621
621
|
}
|
|
622
|
-
`,x4=()=>w("div",{style:QC.container,children:[w("style",{children:k4}),w("div",{style:QC.spinner})]});ite=En()});function Kk(){return v(this,null,function*(){if(Pf)return Pf;let t=`${S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com"}/api/user-retention/exit-recommendations?objectId=${S.mpId}&from=GAME_DETAIL`,{response:{data:r}}=yield z(t);return Pf=r,r})}function Yk(){return v(this,null,function*(){let e=new ut;if(S.mpType!=="game")return e.resolve(!1),e.promise;if(Rf)return e.resolve(!0),e.promise;let t=yield Kk();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:i}=t.data;Rf=!0;let o={domain:"GAME",buttons:t.data.buttons.map(s=>`${s.type}-${s.text}`).join(","),list:r.games.map(s=>s.gameId).join(",")};j("RecommendedGuide",P({eventType:V.View},o));let a=Ok({games:r.games,title:n,buttons:i,onClose:s=>{var l;switch(Rf=!1,s.type){case"quit":j("RecommendedGuide",{eventType:V.Click,type:"QUIT",domain:"GAME"}),e.resolve(!1);break;case"dismiss":j("RecommendedGuide",P({eventType:V.Hide},o)),e.resolve(!0),a.destroy();break;case"navigate":if((l=s.data)!=null&&l.game){let c=s.data.game;T4(c),j("GameItem",{eventType:V.Click,gameId:c.gameId,layerName:"RecommendedGuide",domain:"GAME"}),setTimeout(()=>{e.resolve(!1)},0)}else e.resolve(!0);a.destroy();break;default:j("RecommendedGuide",P({eventType:V.Hide},o)),e.resolve(!0);break}}});return e.promise})}var Pf,T4,Rf,Qk=x(()=>{"use strict";H();ue();O();ar();dt();bt();Pf=null;Kk();T4=e=>{var a;let{data:t}=F("envSync"),r=new URL(t.schema),n=new URLSearchParams(r.search);n.set("gameId",e.gameId),n.set("joliSource",S.encodeJoliSourceQuery({__mpType:"game",__orientation:(a=e.orientation)!=null?a:"VERTICAL"}));let o=`${`https://${e.gameId}.content.jolibox.com/`}index.html?${n.toString()}`;F("openSchemaSync",{schema:o})},Rf=!1});function R4(e){let t=P(P({},P4),e),{url:r,height:n,showCloseButton:i,enableDragClose:o,useAnimation:a,onClose:s,onLoad:l}=t,c=0,d=0,u=!1,p=()=>a?{overlayTransition:"opacity 0.3s ease",containerTransition:"transform 0.3s ease",iframeTransition:"opacity 0.3s ease"}:{overlayTransition:"none",containerTransition:"none",iframeTransition:"none"},f=()=>a?300:0;function h(){let{overlayTransition:_,containerTransition:I,iframeTransition:E}=p();pe=document.createElement("div"),pe.id="jolibox-modal-overlay",pe.style.cssText=`position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); z-index:1000; display:flex; justify-content:center; align-items:flex-end; transition:${_}; opacity:0; visibility:hidden;`,oe=document.createElement("div"),oe.id="jolibox-modal-container",oe.style.cssText=`width:100%; height:${n}; background:white; border-radius:12px 12px 0 0; overflow:hidden; box-shadow:0 -2px 10px rgba(0,0,0,0.2); transform:translateY(100%); transition:${I};`;let T=document.createElement("div");T.id="jolibox-modal-loading",T.style.cssText="position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); width:40px; height:40px; border:4px solid #f3f3f3; border-top:4px solid #3498db; border-radius:50%; animation:spin 1s linear infinite;";let k=document.createElement("style");k.textContent="@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }",document.head.appendChild(k);let C=document.createElement("div");if(C.style.cssText="width:100%; height:100%; display:flex; flex-direction:column; padding-bottom:env(safe-area-inset-bottom, 0); position:relative;",Dt=document.createElement("iframe"),Dt.style.cssText=`width:100%; flex:1; border:none; opacity:0; transition:${E};`,Dt.src=r,Dt.onload=()=>{T.parentNode&&T.parentNode.removeChild(T),Dt.style.opacity="1",g(),l==null||l(),_e.emit("onModalIframeLoaded",{url:r})},C.appendChild(Dt),C.appendChild(T),oe.appendChild(C),i){let G=document.createElement("div");G.style.cssText="position:absolute; top:10px; right:10px; width:30px; height:30px; background:rgba(0,0,0,0.1); border-radius:15px; display:flex; justify-content:center; align-items:center; cursor:pointer; z-index:10;",G.innerHTML="\u2715",G.onclick=y,oe.appendChild(G)}pe.appendChild(oe),document.body.appendChild(pe),pe.addEventListener("click",function(G){G.target===pe&&y()}),o&&b()}function g(){!pe||!oe||u||(pe.style.visibility="visible",a?requestAnimationFrame(()=>{pe&&(pe.style.opacity="1"),oe&&(oe.style.transform="translateY(0)"),u=!0}):(pe&&(pe.style.opacity="1"),oe&&(oe.style.transform="translateY(0)"),u=!0),F("updateContainerConfigSync",{displayCapsuleButton:!1,webviewId:S.webviewId}))}function b(){if(!oe)return;let _=T=>{c=T.touches[0].clientY},I=T=>{if(!u)return;d=T.touches[0].clientY;let k=d-c;k>0&&(oe&&(oe.style.transition="none",oe.style.transform=`translateY(${k}px)`),T.preventDefault())},E=()=>{!u||!oe||(oe.style.transition=a?"transform 0.3s ease":"none",d-c>80?y():oe.style.transform="translateY(0)")};oe.addEventListener("touchstart",_),oe.addEventListener("touchmove",I),oe.addEventListener("touchend",E)}function y(){!pe||!oe||!u||(a?(oe.style.transform="translateY(100%)",pe.style.opacity="0"):pe.style.visibility="hidden",u=!1,F("updateContainerConfigSync",{displayCapsuleButton:!0,webviewId:S.webviewId}),setTimeout(()=>{pe&&(pe.remove(),pe=null,oe=null,Dt=null,s==null||s(),_e.emit("onModalIframeClosed",{url:r}))},f()))}return h(),{close:y}}function Xk(){return window.joliboxUI=B(P({},window.joliboxUI),{createIframeModal:R4}),()=>{window.joliboxUI=void 0,pe&&pe.parentNode&&pe.parentNode.removeChild(pe),oe&&oe.parentNode&&oe.parentNode.removeChild(oe),Dt&&Dt.parentNode&&Dt.parentNode.removeChild(Dt),pe=null,oe=null,Dt=null}}var P4,pe,oe,Dt,Zk=x(()=>{"use strict";ue();H();O();P4={height:"50%",showCloseButton:!0,enableDragClose:!0,useAnimation:!0},pe=null,oe=null,Dt=null});var ox,Nl,Nf,Dl,wi,ax,Si,sx,lx,cx,_i,ex,Ol,tx,O4,ux,Df,rx,dx,N4,nx,Of,px,ix,D4,fx,hx=x(()=>{ox=-1,Nl=function(e){addEventListener("pageshow",function(t){t.persisted&&(ox=t.timeStamp,e(t))},!0)},Nf=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Dl=function(){var e=Nf();return e&&e.activationStart||0},wi=function(e,t){var r=Nf(),n="navigate";return ox>=0?n="back-forward-cache":r&&(document.prerendering||Dl()>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}},ax=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){t(i.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},Si=function(e,t,r,n){var i,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=o,t.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(t.value,r),e(t))}},sx=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},lx=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},cx=function(e){var t=!1;return function(){t||(e(),t=!0)}},_i=-1,ex=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Ol=function(e){document.visibilityState==="hidden"&&_i>-1&&(_i=e.type==="visibilitychange"?e.timeStamp:0,O4())},tx=function(){addEventListener("visibilitychange",Ol,!0),addEventListener("prerenderingchange",Ol,!0)},O4=function(){removeEventListener("visibilitychange",Ol,!0),removeEventListener("prerenderingchange",Ol,!0)},ux=function(){return _i<0&&(_i=ex(),tx(),Nl(function(){setTimeout(function(){_i=ex(),tx()},0)})),{get firstHiddenTime(){return _i}}},Df=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},rx=[1800,3e3],dx=function(e,t){t=t||{},Df(function(){var r,n=ux(),i=wi("FCP"),o=ax("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-Dl(),0),i.entries.push(s),r(!0)))})});o&&(r=Si(e,i,rx,t.reportAllChanges),Nl(function(a){i=wi("FCP"),r=Si(e,i,rx,t.reportAllChanges),sx(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})},N4=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=cx(e),document.visibilityState==="hidden"?e():(r=t(e),lx(e)),r},nx=[2500,4e3],Of={},px=function(e,t){t=t||{},Df(function(){var r,n=ux(),i=wi("LCP"),o=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-Dl(),0),i.entries=[c],r())})},a=ax("largest-contentful-paint",o);if(a){r=Si(e,i,nx,t.reportAllChanges);var s=cx(function(){Of[i.id]||(o(a.takeRecords()),a.disconnect(),Of[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return N4(s)},{once:!0,capture:!0})}),lx(s),Nl(function(l){i=wi("LCP"),r=Si(e,i,nx,t.reportAllChanges),sx(function(){i.value=performance.now()-l.timeStamp,Of[i.id]=!0,r(!0)})})}})},ix=[800,1800],D4=function e(t){document.prerendering?Df(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},fx=function(e,t){t=t||{};var r=wi("TTFB"),n=Si(e,r,ix,t.reportAllChanges);D4(function(){var i=Nf();i&&(r.value=Math.max(i.responseStart-Dl(),0),r.entries=[i],n(!0),Nl(function(){r=wi("TTFB",0),(n=Si(e,r,ix,t.reportAllChanges))(!0)}))})}});var yx={};Jm(yx,{config:()=>V4});function q4(){$n.on("isAdShowing",e=>{Ul=e,Fr(Ul)&&S.mpType==="game"&&F("updateContainerConfigSync",{displayCapsuleButton:!Ul,webviewId:S.webviewId})})}function U4(){_e.on("onInterceptSystemExit",({intercept:e})=>{mx=e})}function M4(){_e.on("onInterceptBackPress",({intercept:e})=>{L4=e}),De("onBeforeBackPress",({uuid:e,disableExitRecommendDialog:t})=>{var r,n;vx(t),_e.emit("onBackPress",{}),(n=(r=globalThis.joliboxJSCore)==null?void 0:r.doBackPress)==null||n.call(r,e)})}function F4(){_e.on("onDocumentReady",()=>{var e;(e=globalThis.joliboxJSCore)==null||e.onDocumentReady(window.location.href),j("onDocumentReady",{start_timestamp:Fl,timestamp:Date.now()})})}function j4(){De("onI18nChanged",({language:e})=>{_e.emit("onI18nChanged",{i18n:e})})}function B4(e){S.mpType==="game"&&wt.start(e)}function G4(){De("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&S.onEnvConfigChanged({hostUserInfo:e}),_e.emit("LifecycleEvent.onReady",P({},S.hostUserInfo?S.hostUserInfo:{isLogin:!1})),j("joliboxServiceReady",{start_timestamp:Fl,timestamp:Date.now()}),B4(t),Ck(()=>S.language)}),De("onBeforeExit",({uuid:e,disableExitRecommendDialog:t})=>{var r;vx(t),(r=globalThis.joliboxJSCore)==null||r.doExit(e)})}function J4(){let e=()=>{j("onBeforeExit",{timestamp:Date.now()}),Ll==null||Ll(),ql==null||ql(),wt.close(Date.now()-Fl)},t=()=>Ul||mx;Pt.onDoExit(()=>v(this,null,function*(){return t()?!0:Fr(S.shouldInterupt)?(S.shouldInterupt||e(),S.shouldInterupt):Ml!=null&&Ml.canShowRecommended&&!gx&&(yield Yk())?!0:(e(),!1)})),Pt.onDoBackPress(()=>v(this,null,function*(){return!!t()}))}function H4(){dx(e=>{j("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),px(e=>{j("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),fx(e=>{j("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function $4(){return v(this,null,function*(){try{let e="/api/fe-configs/js-sdk/basic-meta",{response:{data:t}}=yield z(e);t&&(Ml=t)}catch(e){console.error("fetchMetaConfig error:",e)}})}function V4(){Fl=Date.now(),G4(),q4(),U4(),M4(),J4(),F4(),j4(),$4(),H4(),ql=Xk(),Ll=mv()}var Ll,ql,Fl,Ul,Ml,mx,L4,gx,vx,bx=x(()=>{"use strict";ue();H();O();bt();gv();ss();Qk();dt();ar();Zk();hx();Ul=!1,Ml=null,mx=!1,L4=!1,gx=!1,vx=e=>{Fr(e)&&(gx=e)};Pt.onReady(()=>{})});var _x,W4,z4,K4,Y4,wx=x(()=>{"use strict";O();He();ue();H();_x=W(),W4="env",z4="getSystemInfoSync",K4=Y(z4,{implement:()=>{var r;let e=F("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform.toLowerCase(),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,viewport:{statusBarHeight:S.viewport.statusBarHeight,navigationBarHeight:S.viewport.navigationBarHeight}}}}),Y4=Y(W4,{implement:()=>{var t;let e=F("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});_x.registerCommand("API.getSystemInfoSync",K4);_x.registerCommand("API.env",Y4);L("env",{version:"1.0.0"});L("getSystemInfoSync",{version:"1.0.0",properties:{viewport:"1.0.33"}})});var Sx=m(Lf=>{"use strict";O();He();yt();ue();bt();H();var Q4="exitGame",X4="onReady",Z4="onJoliboxShow",e$="onJoliboxHide",jl=W(),Bl=Bn(Ee),t$=ie(Q4,{paramsSchema:A.tuple(A.function(),A.boolean().optional().default(!1)),implement:(e,t=!1)=>v(Lf,null,function*(){Bl(e).call(Lf),Fr(S.shouldInterupt)&&!S.shouldInterupt&&S.from&&pg("onRetentionResult",{shouldStay:t},S.from,!0),t||S.setDoExitDirectly(),yield he("exitAppAsync")})}),r$=Y(Z4,{paramsSchema:A.tuple(A.function()),implement(e){let t=Bl(e);De("onJoliboxEnterForeground",()=>{t.call(this),io.emit("visible",!0)})}}),n$=Y(e$,{paramsSchema:A.tuple(A.function()),implement(e){let t=Bl(e);De("onJoliboxEnterBackground",()=>{t.call(this),io.emit("visible",!1)})}}),i$=Y(X4,{paramsSchema:A.tuple(A.function()),implement(e){let t=Bl(e);_e.on("LifecycleEvent.onReady",r=>{t(r)})}});jl.registerCommand("LifecycleSDK.exit",t$);jl.registerCommand("LifecycleSDK.onReady",i$);jl.registerCommand("LifecycleSDK.onJoliboxShow",r$);jl.registerCommand("LifecycleSDK.onJoliboxHide",n$);L("lifeCycle.exit",{version:"1.0.0"});L("lifeCycle.onReady",{version:"1.0.0"});L("lifeCycle.onJoliboxShow",{version:"1.0.0"});L("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function Ix(e){let t={};if(!cn(e))return t;for(let[r,n]of Object.entries(e)){let i=r.toLocaleLowerCase();n?typeof n=="object"?t[i]=Object.prototype.toString.call(n):t[i]=String(n):t[i]=""}return t}function Ex(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 Ax(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Cx(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!cn(r))return e;let[n,i=""]=e.split("?"),o=new URLSearchParams(i);for(let[s,l]of Object.entries(r))l!=null&&o.append(s,String(l));let a=o.toString();return a?`${n}?${a}`:n}var kx=x(()=>{"use strict";O()});var o$,a$,qf,Uf,xx,s$,l$,c$,Tx=x(()=>{"use strict";jr();Tu();He();kx();O();yt();H();o$=15,a$=ja("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:S.baseApiHost}),qf=0,Uf=[],xx=Bn(Ee),s$=(e,t)=>{let r=e.filter(t),n=e.filter(i=>!t(i));return e.length=0,e.push(...n),r},l$=e=>{let t=new ut,r=()=>{};return Y("request",{paramsSchema:A.tuple(A.object({url:A.string(),method:A.string(),headers:A.object().optional(),data:A.or(A.object(),A.array()).optional(),query:A.object().optional(),dataType:A.string().default("json"),responseType:A.string().default("text"),enableCache:A.boolean().default(!1),appendHostCookie:A.boolean().default(!0),timeout:A.number().default(3e4),success:A.function(),fail:A.function()})),implement(i){let o=()=>v(this,null,function*(){var s,l,c;let a=xx(i.fail);try{if(qf+=1,t.state!=="pending")return;let{data:d,dataType:u,responseType:p,enableCache:f,appendHostCookie:h}=i,g=Ix((s=i.headers)!=null?s:{}),b=Ex(i.method),y=Ax(i.timeout),_=Cx(i.url,b,d),I=xx(i.success),E=Object.assign({},i,{method:b,header:h?void 0:g,data:b==="GET"||b==="HEAD"?void 0:d,enableCache:f,query:(l=i.query)!=null?l:{},dataType:u,responseType:p,appendHostCookie:h});y&&(E.timeout=y);let T=a$(_,E);{let{response:k}=yield T,{code:C,data:G,message:ce}=k;if(G&&typeof G=="object"&&"status"in G&&G.status!==200)throw Je({code:G.status||-1,msg:`request:fail status ${G.status}`});t.resolve({code:C!=null?C:"SUCCESS",data:G,message:ce!=null?ce:"request:ok"}),I({code:"SUCCESS",message:"request:ok",data:G})}}catch(d){t.reject(d),a({code:"FAILURE",message:"httpRequst: failed"})}finally{qf-=1,(c=Uf.shift())==null||c()}});return qf>=o$?(r=()=>{s$(Uf,a=>a===o)},Uf.push(o)):o(),t.promise}})(e),{abort(){t.reject(Je({code:-1,msg:"request:fail abort"})),r()}}},c$=W();c$.registerCommand("HttpSDK.request",l$);L("request",{version:"1.0.0"})});var u$,d$,p$,Mf,Px=x(()=>{"use strict";O();ue();He();u$=Y("showKeyboard",{paramsSchema:A.tuple(A.object({defaultValue:A.string().optional().default(""),multiple:A.boolean().optional().default(!1),maxLength:A.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)),F("showKeyboardSync",B(P({},e),{defaultValue:r,maxLength:t}))}});L("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"}});d$=Y("updateKeyboard",{paramsSchema:A.tuple(A.object({value:A.string()})),implement(e){F("updateKeyboardSync",e)}});L("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});p$=Y("hideKeyboard",{implement(){F("hideKeyboardSync")}});L("keyboard.hideKeyboard",{version:"1.0.0"});Mf=W();Mf.registerCommand("KeyboardSDK.showKeyboard",u$);Mf.registerCommand("KeyboardSDK.updateKeyboard",d$);Mf.registerCommand("KeyboardSDK.hideKeyboard",p$)});var Rx=m(Gl=>{"use strict";O();He();bt();var Ff=W(),f$=ie("levelFinished",{paramsSchema:A.tuple(A.object({levelId:A.or(A.string(),A.number()),duration:A.number().optional(),rating:A.number().optional(),score:A.number().optional(),variation:A.string().optional()})),implement:e=>v(Gl,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e,a=[];a.push(wt.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})),a.push(wt.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}})),yield Promise.all(a)})}),h$=ie("gamePlayEnded",{paramsSchema:A.tuple(A.object({duration:A.number().optional(),rating:A.number().optional(),score:A.number(),variation:A.string().optional()})),implement:e=>v(Gl,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e,o=[];o.push(wt.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i})),o.push(wt.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})),yield Promise.all(o)})}),m$=ie("levelUpgrade",{paramsSchema:A.tuple(A.object({levelId:A.or(A.string(),A.number()),name:A.string().optional()})),implement:r=>v(Gl,[r],function*({levelId:e,name:t}){let n=[];n.push(wt.tracker("LevelUpgrade",{name:t,levelId:e})),n.push(wt.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})),yield Promise.all(n)})});Ff.registerCommand("TaskTrackerSDK.levelFinished",f$);Ff.registerCommand("TaskTrackerSDK.gamePlayEnded",h$);Ff.registerCommand("TaskTrackerSDK.levelUpgrade",m$);L("TaskTrackerSDK.onLevelFinished",{version:"1.1.25",properties:{params:{levelId:"1.1.25",duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});L("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});L("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}})});var jf,Bf,Gf,g$,Ox,Jl=x(()=>{"use strict";H();ue();He();O();jr();L("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"}});L("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0",isLogin:"1.0.0",isSubUser:"1.2.9"}});jf=new Map;De("onLoginStateChange",({isLogin:e,token:t,uuid:r,isFirstLogin:n,extra:i,appAccountToken:o})=>{let a=jf.get(r);a&&(a.resolve({isLogin:e,token:t,isFirstLogin:n,extra:i,appAccountToken:o}),jf.delete(r))});Bf=(e,t=!1)=>v(void 0,null,function*(){var h,g,b;let{data:{isLogin:r}}=yield he("checkLoginAsync");if(r)return{isLogin:!0,token:(h=S.hostUserInfo)==null?void 0:h.token};let{skipLogin:n,triggerFrom:i}=e!=null?e:{},o=F("loginSync",{skipLogin:n,triggerFrom:i}),{data:{uuid:a}}=o;if(!a)throw Je({code:-1,msg:"login failed"});let s=new ut;jf.set(a,s);let l=yield s.promise,c=F("envSync"),d=(b=(g=c==null?void 0:c.data)==null?void 0:g.hostUserInfo)==null?void 0:b.isSubUser;S.onEnvConfigChanged({hostUserInfo:B(P({},l),{isSubUser:d})});let y=l,{extra:u,appAccountToken:p}=y,f=Xe(y,["extra","appAccountToken"]);return _e.emit("onLoginComplete",f),t?l:f}),Gf=ie("login",{paramsSchema:A.tuple(A.object({skipLogin:A.boolean().optional(),triggerFrom:A.string().optional()}).optional()),implement(e){return v(this,null,function*(){return yield Bf(e!=null?e:{})})}}),g$=ie("checkSession",{implement(){return v(this,null,function*(){var r;let{data:{isLogin:e}}=yield he("checkLoginAsync"),t=(r=S.hostUserInfo)==null?void 0:r.isSubUser;return{isLogin:e,isSubUser:t}})}}),Ox=W();Ox.registerCommand("API.login",Gf);Ox.registerCommand("API.checkSession",g$)});var Nx,Dx=x(()=>{"use strict";Nx=e=>{let t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),n=r+24*60*60*1e3;return e.filter(i=>i>=r&&i<n)}});function An(e){return t=>v(this,null,function*(){var l;let{dailyMaxPopUps:r,minInterval:n}=t,i=yield Br(e);if(!i.data)return{canShow:!0,isFirst:!0};let o=Lx(i.data),a=Nx(o);if(r&&a.length>=r)return{canShow:!1,isFirst:!1};let s=Date.now();return console.log("todayFrequencies",a,n,s-a[0]),n&&s-((l=a==null?void 0:a[0])!=null?l:0)<n?{canShow:!1,isFirst:!1}:{canShow:!0,isFirst:!1}})}function Cn(e){return()=>v(this,null,function*(){var i;let t=Date.now(),r=yield Br(e),n=Lx((i=r.data)!=null?i:"[]");n.push(t),n.sort((o,a)=>a-o).splice(8),yield _t(e,JSON.stringify(n))})}var Lx,qx,Ux,Mx,Fx,jx,Bx,Gx,Jx,Hx,$x,Vx,Wx,zx,Kx,ta=x(()=>{"use strict";no();Dx();Lx=e=>{let t;try{t=JSON.parse(e)}catch(r){t=[]}return t};qx=An("joli_coin_use_modal_frequency"),Ux=An("joli_coin_payment_frequency"),Mx=An("joli_coin_unlogin_modal_frequency"),Fx=An("joli_gem_use_modal_frequency"),jx=An("joli_gem_payment_frequency"),Bx=An("joli_gem_unlogin_modal_frequency"),Gx=An("subscription_frequency");Jx=Cn("joli_coin_use_modal_frequency"),Hx=Cn("joli_coin_payment_frequency"),$x=Cn("joli_coin_unlogin_modal_frequency"),Vx=Cn("joli_gem_use_modal_frequency"),Wx=Cn("joli_gem_payment_frequency"),zx=Cn("joli_gem_unlogin_modal_frequency"),Kx=Cn("subscription_frequency")});var Jf,Hl,Hf=x(()=>{"use strict";dt();Jf=Promise.resolve(),Hl=(e,t)=>v(void 0,null,function*(){Jf=Jf.then(()=>v(void 0,null,function*(){yield z(t,{method:"POST",appendHostCookie:!0,data:{enableAutoDeduct:e}})})),yield Jf})});var $l,Vl,Ht,Wl,kn,$t,Cr,zl,Kl,xn,Ii,v$,M,kr,xr,Be=x(()=>{"use strict";O();$l="UNLOCK_OPTIONS_CHANGED",Vl="INVOKE_PAYMENT",Ht="ON_PAYMENT_RESULT",Wl="ON_USE_MODAL_EVENT",kn="ON_USE_MODAL_RESULT",$t="ON_USE_MODAL_FREQUENCY",Cr="ON_USE_UNLOGIN_MODAL_EVENT",zl="INVOKE_UNLOGIN_MODAL_EVENT",Kl="INVOKE_SUBSCRIPTION_EVENT",xn="ON_USE_SUBSCRIPTION_RESULT",Ii=new Kt,v$=()=>({on:Ii.on.bind(Ii),off:Ii.off.bind(Ii),emit:Ii.emit.bind(Ii)}),M=v$(),kr={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},xr={show:!0,minInterval:8*60*60*1e3}});function Ge(e,t){let r=null,n=null,i=null,o=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(a=>{n=a})};return o(),e.on(t,(...a)=>{let s=a[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||o(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,o(),r),updateData:a=>{if(i)return i=P(P({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}var sr=x(()=>{"use strict"});var Xx=m($f=>{"use strict";ta();Hf();Be();Be();ar();bt();O();sr();var y$={JOLI_COIN:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"unlock_popup_show",coinUnlock:"coin_unlock_click",adUnlock:"ad_unlock_click"},frequencyChecker:qx,frequencyUpdater:Jx,apiEndpointAutoDeduct:"/api/joli-coin/user-config"},JOLI_GEM:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"gem_unlock_popup_show",coinUnlock:"gem_unlock_click",adUnlock:"gem_ad_unlock_click"},frequencyChecker:Fx,frequencyUpdater:Vx,apiEndpointAutoDeduct:"/api/joli-gem/user-config"}},Yx=En(),Qx=Ge(M,$t);Qx.getData();M.on(Wl,(e,t)=>v($f,null,function*(){let r=t.currency,n=y$[r];if(e.includes("ADS-")){yield Yx.show({duration:3e3});let l=yield Qx.getData(),{canShow:c,isFirst:d}=yield n.frequencyChecker(l.joliCoinUseAndCharge[n.frequencyConfigKey]);console.log(`${r} modal show by frequency`,c,d),Yx.hide();let{balance:u}=t.userCurrency;if(u>=t.quantity&&t.enableAutoDeduct&&!d){M.emit(kn,{useModalResult:"CONFIRM"});return}if(!c){M.emit(kn,{useModalResult:"FAILED"});return}}j(n.trackEvents.popupShow,{eventType:V.View,targetType:"game",currency:r});let{userCurrency:i,enableAutoDeduct:o,quantity:a}=t,s=qk({data:{enableAutoDeduct:o,userCurrency:i,quantity:a,currency:r},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>{j(n.trackEvents.coinUnlock,{targetType:"game",eventType:V.Click,coinConsume:t.quantity,ifAutoUnlock:t.enableAutoDeduct,currency:r}),M.emit(kn,{useModalResult:"CONFIRM"}),s.destroy()}},cancel:{text:t.cancelButtonText,onPress:({type:l})=>{l==="FAILED"&&j(n.trackEvents.adUnlock,{targetType:"game",eventType:V.Click,currency:r}),M.emit(kn,{useModalResult:(l!=null?l:"")==="CANCEL"?"CANCEL":"FAILED"}),s.destroy()}},onEnableDeductChanged:l=>v($f,null,function*(){yield Hl(l,n.apiEndpointAutoDeduct)})}});yield n.frequencyUpdater()}))});function Zx(){let e=new Map;return{registerPaymentHandler(r,n){e.set(r,n)},invokePayment(r,...n){return v(this,null,function*(){let i=e.get(r);if(!i)return{code:"FAILED",message:`[joliboxSDK]: ${r} payment not supported in this platform`};try{return yield i(...n)}catch(o){return Ee(o),{code:"FAILED",message:`[joliboxSDK]: paymenterror ${o}`}}})}}}var eT=x(()=>{"use strict";yt()});var ra=x(()=>{"use strict"});var b$,Ei,Ct,_$,Tn,Yl=x(()=>{"use strict";ra();O();H();dt();b$=()=>{let[e,t]=[Ua,Ma].map(r=>(n,i,o)=>new r(n,i,o));return{createPaymentError:e,createPaymentInternalError:t}},{createPaymentError:Ei,createPaymentInternalError:Ct}=b$(),_$=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",Tn=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startPayment=t=>v(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw Ei(n,1001);return yield this.pay()});this.cancelOrder=t=>v(this,null,function*(){var n,i;let{response:r}=yield z(`/api/orders/${t}/cancel`,{method:"POST",data:{}});if(r.code!=="SUCCCESS")throw Ei((i=(n=r.message)!=null?n:r.errMsg)!=null?i:"",1003)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",S.deviceInfo.platform),t.set("joliSource",S.encodeJoliSourceQuery(P({},this.generatePaymentContext()))),`${_$}//payment/callback?${t.toString()}`}}get orderId(){return this._orderId}get status(){return this._orderStatus}}});var Wf,tT,rT=x(()=>{"use strict";dt();Yl();ra();Wf=class extends Tn{constructor(r){super();this.productId=r;this.generatePaymentContext=()=>({type:"JOLI_COIN_ORDER_CONTEXT",state:"TO_VALIDATE",productId:this.productId,orderId:this.orderId});this.pay=()=>v(this,null,function*(){let r=this.generateCallbackUrl();return console.info("callbackUrl",r),{code:"SUCCESS",message:"jolicoin payment success"}})}placeOrder(r){return v(this,null,function*(){var n,i,o,a;try{let{response:s}=yield z("/api/orders/checkout/joli-coin",{method:"POST",data:{productId:r.productId}});if(s.code!=="SUCCESS")throw Ei((i=(n=s.errMsg)!=null?n:s.message)!=null?i:"",1002);return{code:"SUCCESS",message:(o=s.message)!=null?o:"placeorder jolicoin success",data:s.data}}catch(s){throw console.info("[JoliboxSDK] placeorder failed",s),Ct((a=JSON.stringify(s))!=null?a:"jolicoin placeorder failed",1002)}})}},tT=()=>{let e=new Map;return t=>v(void 0,null,function*(){let r=e.get(t);return r||(r=new Wf(t),e.set(t,r)),yield r.startPayment({productId:t}),{code:"SUCCESS",message:"jolicoin payment success"}})}});var nT,iT=x(()=>{"use strict";nT={SUCCESS:"unlockSuccess",FAIL_NOT_LOGIN:"unlockFailedNotLogin",FAIL_PAYING:"unlockFailedPaying",FAIL_PRODUCT_EMPTY:"unlockFailedProductIdNotFound",FAIL_GET_PRODUCT_INFO:"unlockFailedProductInvalid",FAIL_LAUNCH_BILLING:"unlockFailedLaunch",FAIL_TRANSACTION:"unlockFailedTransaction",FAIL_VERIFY:"unlockFaileVerify",TRANSACTION_PENDING:"transactionPending",FAILED:"unlockFailed"}});var zf,oT,Kf,Yf,w$,Qf,aT=x(()=>{"use strict";dt();Yl();ra();ue();O();H();ar();iT();zf=new Map;De("onPaymentStateChange",e=>{console.info("onPaymentStateChange",e);let{orderUUID:t,status:r,totalAmount:n,orderResponse:i}=e,o=zf.get(t);if(o){if(r==="SUCCESS")o.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{totalAmount:n}});else{if(r==="FAILED"&&qa(i==null?void 0:i.errNo)&&(i==null?void 0:i.errNo)!==0)throw Ct(`jolicoin payment failed: ${i==null?void 0:i.errMsg}`,1002);let a=nT[r];a&&Ar(`{slot-error} {slot-i18n-jolicoin.${a}}`,{position:"center",duration:3e3}),o.resolve({code:"FAILED",message:"jolicoin payment failed"})}zf.delete(t)}});oT=e=>v(void 0,null,function*(){var n,i;let t=new ut,r;try{let o=yield he("requestPaymentSync",{paymentBody:{appStoreProductId:e.appStoreProductId,appAccountToken:e.appAccountToken}});if(r=(n=o.data)==null?void 0:n.orderUUID,console.info("---purchaseGem---",o),!r)throw Ct("orderUUID is null",1002);zf.set(r,t)}catch(o){throw Ct((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),Kf=class extends Tn{constructor(r,n){super();this.productId=r;this.appStoreProductId=n;this.generatePaymentContext=()=>({type:"JOLI_COIN_IAP_CONTEXT",state:"TO_VALIDATE",productId:this.productId,appStoreProductId:this.appStoreProductId});this.pay=()=>v(this,null,function*(){return yield oT({appStoreProductId:this.appStoreProductId})})}placeOrder(r){return v(this,null,function*(){return{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},Yf=class extends Tn{constructor(r,n){super();this.productId=r;this.appStoreProductId=n;this.generatePaymentContext=()=>({type:"JOLI_COIN_IAP_CONTEXT",state:"TO_VALIDATE",productId:this.productId,appStoreProductId:this.appStoreProductId});this.pay=()=>v(this,null,function*(){return yield oT({appStoreProductId:this.appStoreProductId,appAccountToken:this.appAccountToken})})}placeOrder(r){return v(this,null,function*(){var a;console.log("----start place order for ios----");let{response:n}=yield z("/api/orders/iap-init",{method:"GET",appendHostCookie:!0}),{data:i,code:o}=n!=null?n:{};if(console.log("----iap init----",i,o),i.code!=="SUCCESS")throw Ct("iap-init failed",1002);return this.appAccountToken=(a=i==null?void 0:i.data)==null?void 0:a.iapToken,{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},w$={android:Kf,ios:Yf},Qf=()=>{let e=new Map;return t=>v(void 0,null,function*(){let{productId:r,appStoreProductId:n}=t,i=e.get(r);if(!i){let s=w$[S.platform];if(!s)throw Ct("platform not supported",1002);i=new s(r,n),e.set(r,i)}let{code:o,message:a}=yield i.startPayment({productId:r,appStoreProductId:n});if(o!=="SUCCESS")throw Ei(a,1002);return{code:"SUCCESS",message:"jolicoin payment success"}})}});var Pn,Xf=x(()=>{"use strict";eT();rT();aT();Pn=Zx();Pn.registerPaymentHandler("JOLI_COIN",tT());Pn.registerPaymentHandler("JOLI_COIN_IAP",Qf());Pn.registerPaymentHandler("JOLI_GEM_IAP",Qf())});function sT(n,i){return v(this,arguments,function*(e,t,r={}){let{storageKeyPrefix:o="joli_cache_"}=r,a=o+e,s=a+"_timestamp";try{let l=yield t(),c=Date.now();try{l!=null&&(yield _t(a,l),yield _t(s,c.toString()),console.log("[Cache] Cached result for key:",e))}catch(d){console.warn("[Cache] Failed to save to localStorage for key:",e,d)}return l}catch(l){throw console.warn("[Cache] Executor failed for key:",e,l),l}})}function Ql(n,i){return v(this,arguments,function*(e,t,r={}){let{cacheDuration:o=-1,storageKeyPrefix:a="joli_cache_"}=r,s=a+e,l=s+"_timestamp",c=o===1/0||o===-1;try{let{data:d}=yield Br(s),{data:u}=yield Br(l);if(d&&u){let p=parseInt(u,10);if(c||Date.now()-p<o){console.log("[Cache] Using localStorage cached data for key:",e);let f=JSON.parse(d);return c||setTimeout(()=>v(this,null,function*(){try{console.log("[Cache] Background updating cache for key:",e);let h=yield t(),g=Date.now();yield _t(s,h),yield _t(l,g.toString()),console.log("[Cache] Background cache update completed for key:",e)}catch(h){console.warn("[Cache] Background cache update failed for key:",e,h)}}),0),f}else yield _t(s,null),yield _t(l,null)}}catch(d){console.warn("[Cache] Failed to read from localStorage for key:",e,d)}try{let d=yield t(),u=Date.now();try{d&&(yield _t(s,d),yield _t(l,u.toString()))}catch(p){console.warn("[Cache] Failed to save to localStorage for key:",e,p)}return d}catch(d){throw console.warn("[Cache] Executor failed for key:",e,d),d}})}var Zf=x(()=>{"use strict";no()});function S$(e,t){Object.keys(t).forEach(r=>{let n=e.paymentChoices.find(i=>i.appStoreProductId===r);n&&(n.totalAmountStr=t[r].price)}),e.paymentChoices=e.paymentChoices.filter(r=>!Xi(r.totalAmountStr))}var rn,eh,lr,ec,th,rh,Xl,Zl,lT,tc,nh=x(()=>{"use strict";Xf();O();ue();dt();O();Zf();rn=class rn{execute(t,r){return v(this,null,function*(){var a,s,l;let{response:n}=yield z(t,{method:"GET",appendHostCookie:!0,responseType:"json"});if(console.log("[PaymentService] get products info from server",t,n.data),!((a=n.data)!=null&&a.data))throw new Error("get products info failed");let i=n.data.data,o=(l=(s=i.paymentChoices)==null?void 0:s.filter(c=>typeof c.appStoreProductId=="string").map(c=>c.appStoreProductId))!=null?l:[];if(o.length>0){let c=yield this.getNativePriceData(o);c&&S$(i,c)}if(i.paymentChoices.length===0)throw new Error("paymentChoices is empty");return i})}getNativePriceData(t){return v(this,null,function*(){let r=t.sort().join(",");return Ql(r,()=>v(this,null,function*(){try{let{data:n}=yield he("requestProductDetailsAsync",{appStoreProductIds:t});return n&&(rn.nativePriceCache.set(r,n),rn.nativePriceCacheTimestamp.set(r,Date.now())),n}catch(n){throw console.warn("[PaymentService] Failed to fetch native product details:",n),n}}),{cacheDuration:rn.NATIVE_PRICE_CACHE_DURATION,storageKeyPrefix:"joli_native_price_"})})}extractCacheableData(t){return{paymentChoices:t.paymentChoices}}mergeData(t,r){return{balance:r.balance,enableAutoDeduct:r.enableAutoDeduct,paymentChoices:t.paymentChoices}}processCachedData(t){return{balance:0,enableAutoDeduct:!1,paymentChoices:t.paymentChoices}}static clearNativePriceCache(){this.nativePriceCache.clear(),this.nativePriceCacheTimestamp.clear(),console.log("[PaymentService] Cleared native price cache")}};rn.nativePriceCache=new Map,rn.NATIVE_PRICE_CACHE_DURATION=10*60*1e3,rn.nativePriceCacheTimestamp=new Map;eh=rn,lr=class lr extends Ft{constructor(r,n){super(new eh,{duration:10*60*1e3,timeout:3e3});this.apiEndpoint=r;this.paymentType=n}getProductsInfo(){return v(this,null,function*(){let r=lr.failureCounters.get(this.apiEndpoint)||0;if(r>=lr.MAX_FAILURE_COUNT)throw new Error(`getProductsInfo has failed more than ${lr.MAX_FAILURE_COUNT} times for ${this.apiEndpoint}`);try{let n=yield this.request(this.apiEndpoint);return lr.failureCounters.delete(this.apiEndpoint),n}catch(n){let i=r+1;throw lr.failureCounters.set(this.apiEndpoint,i),console.warn(`[PaymentService] getProductsInfo failed (${i}/${lr.MAX_FAILURE_COUNT+1}) for ${this.apiEndpoint}:`,n),n}})}purchase(r){return v(this,null,function*(){var a;let n=yield this.getProductsInfo(),i=(a=n==null?void 0:n.paymentChoices.find(s=>s.productId===r))==null?void 0:a.appStoreProductId;if(!i)throw new Error("appStoreProductId not found");return yield Pn.invokePayment(this.paymentType==="JOLI_COIN"?"JOLI_COIN_IAP":"JOLI_GEM_IAP",{productId:r,appStoreProductId:i})})}getProductsInfoWithBalance(){return v(this,null,function*(){return this.request(this.apiEndpoint)})}refreshProductsInfo(){return v(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}static resetFailureCounters(){this.failureCounters.clear()}static getFailureCount(r){return this.failureCounters.get(r)||0}};lr.failureCounters=new Map,lr.MAX_FAILURE_COUNT=2;ec=lr,th=class extends ec{constructor(){super("/api/joli-coin/balance-detail","JOLI_COIN")}},rh=class extends ec{constructor(){super("/api/joli-gem/balance-detail","JOLI_GEM")}},Xl=null,Zl=null,lT=()=>Xl||(Xl=new th,Xl),tc=()=>Zl||(Zl=new rh,Zl)});var dT=m(rc=>{"use strict";Be();ar();H();Jl();O();ta();Xf();ar();He();bt();Hf();sr();nh();var I$={JOLI_COIN:{frequencyConfigKey:"charge",trackEvents:{modalShow:"coinorder_show",orderClick:"coinorder_click",payEnsure:"order_pay_ensure",payResult:"order_pay_result",adUnlock:"ad_unlock_click"},frequencyChecker:Ux,frequencyUpdater:Hx,apiEndpoint:"/api/joli-coin/balance-detail",apiEndpointAutoDeduct:"/api/joli-coin/user-config",paymentType:"JOLI_COIN_IAP"},JOLI_GEM:{frequencyConfigKey:"charge",trackEvents:{modalShow:"gem_order_show",orderClick:"gem_order_click",payEnsure:"gem_pay_ensure",payResult:"gem_pay_result",adUnlock:"gem_ad_unlock_click"},frequencyChecker:jx,frequencyUpdater:Wx,apiEndpoint:"/api/joli-gem/balance-detail",apiEndpointAutoDeduct:"/api/joli-gem/user-config",paymentType:"JOLI_GEM_IAP"}},Ai=En(),cT=lT(),uT=tc(),E$=Ge(M,$t);M.on(Vl,(e,t)=>v(rc,null,function*(){var r,n,i;try{let o=t.currency,a=I$[o];if(!je("requestPaymentSync:paymentBody:appStoreProductId")){console.info("requestPaymentSync:paymentBody:appStoreProductId not supported"),setTimeout(()=>{M.emit(Ht,{paymentResult:"FAILED",currency:o})},0);return}if(e.includes("ADS-")){yield Ai.show({duration:3e3});let d=yield E$.getData(),{canShow:u}=yield a.frequencyChecker(d.joliCoinUseAndCharge[a.frequencyConfigKey]);if(console.log(`${o} payment show by frequency`,u),Ai.hide(),!u){M.emit(Ht,{paymentResult:"FAILED",currency:o});return}console.log("show by frequency")}yield Ai.show({duration:3e3});let s=o==="JOLI_COIN"?cT:uT,l=yield s.getProductsInfo();if(Ai.hide(),!l||!((r=l.paymentChoices)!=null&&r.length)){M.emit(Ht,{paymentResult:"FAILED",currency:o});return}j(a.trackEvents.modalShow,{targetType:"game",eventType:V.View,currency:o});let c=Uk({data:{userCurrency:t.userCurrency,quantity:t.quantity,currency:o,paymentChoices:(i=(n=l.paymentChoices)==null?void 0:n.map(d=>{var u;return B(P({},d),{totalAmountStr:(u=d.totalAmountStr)!=null?u:""})}))!=null?i:[],enableAutoDeduct:t.enableAutoDeduct},buttons:{confirm:{text:t.confirmButtonText,onPress:d=>v(rc,null,function*(){var f,h,g,b,y,_,I,E;if(j(a.trackEvents.payEnsure,{targetType:"game",eventType:V.Click,payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(h=(f=l.paymentChoices.find(T=>T.productId===d))==null?void 0:f.totalAmountStr)!=null?h:""}),!((g=S.hostUserInfo)!=null&&g.isLogin)){let{data:T}=yield Gf({skipLogin:!0});if(!(T!=null&&T.isLogin)){console.log("login failed");return}let k=yield s.refreshProductsInfo();if(((b=k==null?void 0:k.balance)!=null?b:0)>=t.quantity){M.emit(Ht,{paymentResult:"SUCCESS",currency:o}),c.destroy();return}}console.log("invokeNativePayment",d);let u=(_=(y=l==null?void 0:l.paymentChoices)==null?void 0:y.find(T=>T.productId===d))==null?void 0:_.appStoreProductId;if(!u){M.emit(Ht,{paymentResult:"FAILED",currency:o}),c.destroy();return}yield Ai.show({duration:3e3});let{code:p}=yield Pn.invokePayment(a.paymentType,{productId:d,appStoreProductId:u});if(Ai.hide(),j(a.trackEvents.payResult,{eventType:V.Other,targetType:"game",payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(E=(I=l.paymentChoices.find(T=>T.productId===d))==null?void 0:I.totalAmountStr)!=null?E:"",payResult:p}),p!=="SUCCESS"){console.info("[JoliboxSDK] payment failed in payment.invokePaymet");return}Ar("{slot-success} {slot-i18n-jolicoin.unlockSuccess}",{position:"center",duration:3e3}),M.emit(Ht,{paymentResult:"SUCCESS",currency:o}),c.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:d})=>{M.emit(Ht,{paymentResult:(d!=null?d:"")==="CANCEL"?"CANCEL":"FAILED",currency:o}),j(a.trackEvents.adUnlock,{targetType:"game",eventType:V.Click,currency:o}),c.destroy()}},onEnableDeductChanged:d=>v(rc,null,function*(){yield Hl(d,a.apiEndpointAutoDeduct)})},onSelect:d=>{var u,p;j(a.trackEvents.orderClick,{targetType:"game",eventType:V.Click,coinAmount:t.quantity,currency:o,orderPrice:(p=(u=l.paymentChoices.find(f=>f.productId===d))==null?void 0:u.totalAmountStr)!=null?p:""})}});yield a.frequencyUpdater()}catch(o){console.error("payment failed",o),M.emit(Ht,{paymentResult:"FAILED",currency:t.currency})}}));cT.getProductsInfo().catch(e=>{console.error("preload joli coin payment details failed",e)});uT.getProductsInfo().catch(e=>{console.error("preload joli gem payment details failed",e)})});var fT=m(nc=>{"use strict";Be();sr();ta();dt();yt();O();Jl();ar();bt();var A$={JOLI_COIN:{frequencyChecker:Mx,frequencyUpdater:$x,trackEvents:{modalExpose:"LoginGuideModal",clickConfirm:"LoginGuideModal",clickConfirmLogin:"LoginGuideModal",modalHide:"LoginGuideModal",clickClose:"LoginGuideModal",clickWatchAds:"LoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.rewardTips}",usedText:"Jolicoin Used"}},JOLI_GEM:{frequencyChecker:Bx,frequencyUpdater:zx,trackEvents:{modalExpose:"GemLoginGuideModal",clickConfirm:"GemLoginGuideModal",clickConfirmLogin:"GemLoginGuideModal",modalHide:"GemLoginGuideModal",clickClose:"GemLoginGuideModal",clickWatchAds:"GemLoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.gemRewardTips}",usedText:"Gem Used"}}},pT=Ge(M,$t);pT.getData();M.on(zl,(e,t)=>v(nc,null,function*(){var r;try{let n=t.currency,i=A$[n];if(e.includes("ADS-")){let s=yield pT.getData();if(console.log(`${n} unlogin guide config`,s.loginGuide),!s.loginGuide.show){M.emit(Cr,{result:"NOT_SUPPORT"});return}let{canShow:l}=yield i.frequencyChecker(s.loginGuide);if(console.log(`${n} canShowUseModal`,l),!l){M.emit(Cr,{result:"FAILED"});return}}let{firstLogin:o}=(r=yield C$())!=null?r:{};if(!(o!=null&&o.reward)){console.log("[JoliboxSDK] unlogin modal reward is empty"),M.emit(Cr,{result:"NOT_SUPPORT"});return}j(i.trackEvents.modalExpose,{eventType:V.Expose,currency:n},V.Expose);let a=Mk({data:{rewardType:e,rewardValue:o.reward.rewardValue,currency:t.currency},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>v(nc,null,function*(){var d,u,p,f;j(i.trackEvents.clickConfirm,{type:"click_confirm",eventType:V.Click,currency:n},V.Click);let{isLogin:s,extra:l,isFirstLogin:c}=yield Bf({},!0);if(!s){console.log("login failed");return}if(j(i.trackEvents.clickConfirmLogin,{type:"click_confirm_login",isFirstLogin:c,eventType:V.Click,currency:n},V.Click),c&&((d=l==null?void 0:l.firstLogin)!=null&&d.reward)){let{rewardValue:h}=l.firstLogin.reward;Ar(i.toastMessage.i18nKey,{i18nParams:{text:i.toastMessage.usedText,coin:h},position:"top",duration:3e3})}M.emit(Cr,{result:"SUCCESS",rewards:{claimedRewardValue:(f=(p=(u=l==null?void 0:l.firstLogin)==null?void 0:u.reward)==null?void 0:p.rewardValue)!=null?f:0,isFirstLogin:c!=null?c:!1,currency:t.currency}}),a.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:s})=>{j(i.trackEvents.modalHide,{eventType:V.Hide,currency:n},V.Hide);let l=s==="CANCEL"?"click_close":"click_watch_ads",c=s==="CANCEL"?i.trackEvents.clickClose:i.trackEvents.clickWatchAds;j(c,{type:l,eventType:V.Click,currency:n},V.Click),M.emit(Cr,{result:"FAILED"}),a.destroy()}}}});yield i.frequencyUpdater()}catch(n){Ee(new Cg(n)),M.emit(Cr,{result:"FAILED"})}}));var C$=()=>v(nc,null,function*(){var t;let{response:e}=yield z("/api/base/global-config",{method:"GET",appendHostCookie:!0,responseType:"json"});return(t=e.data)==null?void 0:t.data})});function k$(){let e=new Map;return{registerSubscriptionHandler(r,n){e.set(r,n)},invokeSubscription(r,...n){return v(this,null,function*(){let i=e.get(r);if(!i)return{code:"FAILED",message:`[joliboxSDK]: ${r} subscription not supported in this platform`};try{return yield i(...n)}catch(o){return Ee(o),{code:"FAILED",message:`[joliboxSDK]: subscription error ${o}`}}})}}}var na,ih=x(()=>{"use strict";yt();na=k$()});var Rn,ic=x(()=>{"use strict";Rn={PlaceOrderFailed:1001,CancelOrderFailed:1002,SubscriptionFailed:1003,InvalidPlan:1004}});var x$,hT,oc,T$,ia,oh=x(()=>{"use strict";ic();O();H();x$=()=>{let[e,t]=[Ua,Ma].map(r=>(n,i,o)=>new r(n,i,o));return{createSubscriptionError:e,createSubscriptionInternalError:t}},{createSubscriptionError:hT,createSubscriptionInternalError:oc}=x$(),T$=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",ia=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startSubscription=t=>v(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw hT(n,Rn.PlaceOrderFailed);return yield this.subscribe(t)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",S.deviceInfo.platform),t.set("joliSource",S.encodeJoliSourceQuery(P({},this.generateSubscriptionContext()))),`${T$}/subscription/callback?${t.toString()}`};this.createSubscriptionError=hT;this.createSubscriptionInternalError=oc}setOrderId(t){this._orderId=t}setOrderStatus(t){this._orderStatus=t}get orderId(){return this._orderId}get status(){return this._orderStatus}}});function P$(e,t){Object.keys(t).forEach(r=>{var i,o,a,s;let n=e.find(l=>l.appStoreProductId===r);n&&(n.amountStr=t[r].pricing.formattedPrice,n.originalAmountStr=t[r].pricing.originalPrice,n.discountPercentage=(o=(i=t[r].pricing.discountPercentage)==null?void 0:i.toString())!=null?o:"",n.trialDay=(s=(a=t[r].trial)==null?void 0:a.duration)!=null?s:0)}),e=e.filter(r=>!Xi(r.amountStr))}var On,sc,ah,sh,ac,mT,lh=x(()=>{"use strict";O();ue();dt();O();Zf();ih();ue();oh();ic();On=class On{static getNativePriceCache(t){var n;let r=t.sort().join(",");return(n=this.nativePriceCache.get(r))!=null?n:{}}execute(t,r){return v(this,null,function*(){var a,s;let{response:n}=yield z(t,{method:"GET",appendHostCookie:!0,responseType:"json"});if(!((a=n.data)!=null&&a.data))throw new Error("get subscription tiers failed");let i=n.data.data,o=(s=i==null?void 0:i.filter(l=>typeof l.appStoreProductId=="string").map(l=>l.appStoreProductId))!=null?s:[];if(o.length>0){let l=yield this.getNativePriceData(o);l&&P$(i,l)}if(i.length===0)throw new Error("subscription tiers is empty");return i})}requestNativeSubscriptionPlans(t,r){return v(this,null,function*(){try{let{data:n}=yield he("requestSubscriptionPlansAsync",{appStoreProductIds:t,type:"game"});return n&&(On.nativePriceCache.set(r,n),On.nativePriceCacheTimestamp.set(r,Date.now())),n}catch(n){throw console.warn("[SubscriptionService] Failed to fetch native subscription pricing:",n),n}})}getNativePriceData(t,r=!1){return v(this,null,function*(){let n=t.sort().join(",");return(r?sT:Ql)(n,()=>this.requestNativeSubscriptionPlans(t,n),{storageKeyPrefix:"joli_subscription_price_"})})}extractCacheableData(t){return{subscriptionTiers:t}}mergeData(){throw new Error("SubscriptionService does not support real-time data merging")}processCachedData(t){return t.subscriptionTiers}updateNativePriceCache(t){return v(this,null,function*(){yield this.getNativePriceData(t,!0),console.log("[SubscriptionService] Updated native price cache for products:",t)})}static clearNativePriceCache(){this.nativePriceCache.clear(),this.nativePriceCacheTimestamp.clear(),console.log("[SubscriptionService] Cleared native price cache")}};On.nativePriceCache=new Map,On.NATIVE_PRICE_CACHE_DURATION=1*24*60*60*1e3,On.nativePriceCacheTimestamp=new Map;sc=On,ah=class extends Ft{constructor(r){super(new sc,{duration:30*60*1e3,timeout:3e3});this.apiEndpoint=r;this.pendingSubscriptions=new Map;this.subInfoCacheKeys=[];this.listenSubscriptionPanelStateChange()}getSubInfo(){return v(this,null,function*(){var r;try{let n=yield this.request(this.apiEndpoint);return this.subInfoCacheKeys=(r=n==null?void 0:n.map(i=>{var o;return(o=i.appStoreProductId)!=null?o:""}))!=null?r:[],n}catch(n){throw console.warn(`[SubscriptionService] getSubInfo failed for ${this.apiEndpoint}:`,n),n}})}refreshSubInfo(){return v(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}updateNativePriceCache(r){return v(this,null,function*(){yield this.requestAdapter.updateNativePriceCache(r)})}updateAllNativePriceCache(){return v(this,null,function*(){try{this.subInfoCacheKeys.length>0&&(yield this.updateNativePriceCache(this.subInfoCacheKeys),this.forceRequest(this.apiEndpoint))}catch(r){throw console.warn("[SubscriptionService] Failed to update all native price cache:",r),r}})}subscribe(r){return v(this,null,function*(){var s;console.log("[SubscriptionService] subscribe params",na);let n=new AbortController,i=na.invokeSubscription("SUB_APP",{productId:r.nativeProductId,appStoreProductId:r.appStoreProductId,planId:r.basePlanId}),o=this.pollSubscriptionStatus(n.signal),a=yield Promise.race([i.then(l=>{var c;return n.abort(),{result:l.code,subPlanId:(c=l.data)==null?void 0:c.subPlanId,message:l.message}}),o.then(l=>(l==null?void 0:l.result)==="SUCCESS"?(n.abort(),l):new Promise(()=>{console.log("[SubscriptionPolling] Timeout for subscriptionService.subscribe completion")}))]);return{result:a.result,subPlanId:a.subPlanId,message:(s=a.message)!=null?s:""}})}pollSubscriptionStatus(r){return v(this,null,function*(){var o,a;for(let s=0;s<10;s++){if(r.aborted){console.log("[SubscriptionPolling] Aborted due to subscribe completion");return}try{let{response:l}=yield z("/api/subs/info",{method:"GET",appendHostCookie:!0,responseType:"json"});if(((a=(o=l.data)==null?void 0:o.data)==null?void 0:a.status)==="ACTIVE")return{result:"SUCCESS",subPlanId:l.data.data.subPlanId,message:"Subscription activated via polling"}}catch(l){console.warn(`[SubscriptionPolling] Attempt ${s+1} failed:`,l)}s<9&&!r.aborted&&(yield La(5e3))}})}invokeSubscriptionPanel(){return v(this,null,function*(){var i,o;let r=new ut,n;try{if(console.log("[invokeSubscriptionPanel] requestSubscriptionSync params"),n=(i=F("invokeSubscriptionPanelSync",{type:"game"}).data)==null?void 0:i.subUUID,!n)throw oc("orderUUID is null",Rn.SubscriptionFailed);this.pendingSubscriptions.set(n,r)}catch(a){throw oc((o=JSON.stringify(a))!=null?o:"subscription panel failed",Rn.SubscriptionFailed)}return r.promise})}getTierByProductId(r){return v(this,null,function*(){var s;let n=yield this.getSubInfo(),i=n==null?void 0:n.find(l=>l.productId===r);if(!i)return;let o=sc.getNativePriceCache((n!=null?n:[]).map(l=>{var c;return(c=l.appStoreProductId)!=null?c:""}));if(!o)return;let a=o[(s=i.appStoreProductId)!=null?s:""];if(a)return console.log("[SubscriptionService] getTierByProductId nativeSubInfo",a),{nativeProductId:a.productId,appStoreProductId:i.appStoreProductId,basePlanId:a.basePlanId}})}listenSubscriptionPanelStateChange(){De("onSubscriptionPanelStateChange",r=>{var i;console.log("[onSubscriptionPanelStateChange] data",r);let n=this.pendingSubscriptions.get(r.subUUID);n&&(r.status==="SUCCESS"?n.resolve({code:"SUCCESS",message:"subscription panel success",data:{result:"SUCCESS",subPlanId:(i=r.orderResponse)==null?void 0:i.subPlanId}}):n.resolve({code:"FAILED",message:"subscription panel failed",data:{result:"FAILED"}}))})}},sh=class extends ah{constructor(){super("/api/subs/pricing")}},ac=null,mT=()=>ac||(ac=new sh,ac)});var gT=x(()=>{"use strict"});function yT(){let e=new Map;return t=>v(this,null,function*(){console.log("[SubAppSubscriptionHandler] createSubAppSubscriptionHandler params",t);let{productId:r,planId:n}=t,i=`${r}_${n}`,o=e.get(i);if(!o){console.log("[SubAppSubscriptionHandler] createSubAppSubscriptionHandler instance not found",i);let a=R$[S.platform];if(!a)throw new Error(`Platform ${S.platform} not supported for sub-app subscription`);o=new a(r,n),e.set(i,o)}return o.startSubscription({basePlanId:n,appStoreProductId:t.appStoreProductId,productId:r})})}var ch,vT,uh,dh,R$,bT=x(()=>{"use strict";H();oh();ra();Yl();O();ue();O();ic();De("onGlobalSubscriptionStateChange",e=>{let{status:t,orderResponse:r}=e;console.log("[onGlobalSubscriptionStateChange] data",e),t==="SUCCESS"&&(r!=null&&r.subPlanId||r!=null&&r.tickedId)&&S.onEnvConfigChanged({hostUserInfo:{isLogin:!0,isSubUser:!0}})});ch=new Map;De("onSubscritptionStateChange",e=>{var o,a;let{subUUID:t,status:r,orderResponse:n}=e;console.log("[onSubscritptionStateChange] data",e);let i=ch.get(t);if(i){if(r==="SUCCESS")i.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{subPlanId:(o=n==null?void 0:n.subPlanId)!=null?o:n.tickedId}});else{if(r==="FAILED"&&qa(n==null?void 0:n.errNo)&&(n==null?void 0:n.errNo)!==0)throw Ct(`subscription failed: ${n==null?void 0:n.errMsg}`,Rn.SubscriptionFailed);i.resolve({code:r,message:(a=n==null?void 0:n.errMsg)!=null?a:"UNKNOWN_ERROR"})}ch.delete(t)}});vT=e=>v(void 0,null,function*(){var n,i;let t=new ut,r;try{if(console.log("[internalSubscribe] requestSubscriptionSync params",e),r=(n=F("requestSubscriptionSync",P({params:{basePlanId:e.basePlanId,appStoreProductId:e.appStoreProductId,productId:e.productId}},e.appAccountToken?{paymentBody:{appAccountToken:e.appAccountToken,appStoreProductId:e.appStoreProductId}}:{})).data)==null?void 0:n.subUUID,!r)throw Ct("subUUID is null",1002);ch.set(r,t)}catch(o){throw Ct((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),uh=class extends ia{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return v(this,null,function*(){return{code:"SUCCESS",message:"Android subscription order placed locally"}})}cancelOrder(r){return Promise.resolve({code:"SUCCESS",message:"Android order cancelled locally",data:void 0})}generateSubscriptionContext(){return{gameId:S.mpId,productId:this.productId,planId:this.planId}}subscribe(r){return v(this,null,function*(){return yield vT(r)})}},dh=class extends ia{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return v(this,null,function*(){var o,a;console.log("----start place order for iOS subscription----");let n=F("envSync"),i=(a=(o=n==null?void 0:n.data)==null?void 0:o.hostUserInfo)==null?void 0:a.appAccountToken;if(!i)throw Ct("appAccountToken is null",1002);return this.subscriptionToken=i,{code:"SUCCESS",message:"placeorder sub-app success in native"}})}cancelOrder(r){return v(this,null,function*(){return Promise.resolve({code:"SUCCESS",message:"Android order cancelled locally",data:void 0})})}generateSubscriptionContext(){return{gameId:S.mpId,productId:this.productId,planId:this.planId}}subscribe(r){return v(this,null,function*(){return yield vT(B(P({},r),{appAccountToken:this.subscriptionToken}))})}},R$={android:uh,ios:dh}});var Nn,ph=x(()=>{"use strict";lh();gT();ih();bT();lh();Nn=mT();na.registerSubscriptionHandler("SUB_APP",yT())});var IT=m(ST=>{"use strict";ta();Be();sr();He();ph();ar();var O$={SUBSCRIPTION:{frequencyConfigKey:"joinMember",frequencyChecker:Gx,frequencyUpdater:Kx}},_T=En(),wT=Ge(M,$t);wT.getData();M.on(Kl,e=>v(ST,null,function*(){let t=O$.SUBSCRIPTION;if(!je("invokeSubscriptionPanelSync")){console.info("invokeSubscriptionPanelSync not supported"),setTimeout(()=>{M.emit(xn,{result:"FAILED"})},0);return}yield _T.show({duration:3e3});let r=yield wT.getData(),{canShow:n,isFirst:i}=yield t.frequencyChecker(r.joliCoinUseAndCharge[t.frequencyConfigKey]);if(_T.hide(),!n){M.emit(xn,{result:"FAILED"});return}let{data:o,code:a}=yield Nn.invokeSubscriptionPanel();a=="SUCCESS"&&(o!=null&&o.subPlanId)?M.emit(xn,{result:"SUCCESS"}):M.emit(xn,{result:"FAILED"}),yield t.frequencyUpdater()}))});var loe,coe,uoe,doe,ET=x(()=>{"use strict";loe=se(Xx()),coe=se(dT()),uoe=se(fT()),doe=se(IT())});function V$(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function W$(e){return typeof e=="string"}function z$(e){return typeof e=="undefined"}function K$(e){return z$(e)||e===null}function Y$(e){return typeof e=="function"}function cP(e){let t=e,r=null,n=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function oa(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function pc(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,o)=>(i[o]=String(n[o]),i),{})}return e[r]})}function nV(e){let t=e.location?pc(e.location,PT):null,r=e.target?pc(e.target,PT):null;return pc(J$(G$({},e),{location:t,target:r}),tV)}function iV(e){let t=e.events.map(n=>nV(n)),r=pc(e.device,rV);return[e.protocolVersion,t,r,e.project]}function oV(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function uV(e){return new Promise(t=>fP(e)(t))}function fP(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function dV(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new ha(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}function fV(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)hV(e[n],t[n])}function hV(e,t){if(W$(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Y$(t)){try{if(e instanceof t)return}catch(r){}if(!K$(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 ht(e,t,r){return(t=mV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mV(e){var t=gV(e,"string");return typeof t=="symbol"?t:t+""}function gV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lc(e,t,r){return(t=vV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vV(e){var t=yV(e,"string");return typeof t=="symbol"?t:t+""}function yV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cc(e,t,r){return(t=bV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bV(e){var t=_V(e,"string");return typeof t=="symbol"?t:t+""}function _V(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tr(e,t,r){return(t=wV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wV(e){var t=SV(e,"string");return typeof t=="symbol"?t:t+""}function SV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IV(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function EV(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}function PV(e,t){return Ke(e,0)^45?(((t<<2^Ke(e,0))<<2^Ke(e,1))<<2^Ke(e,2))<<2^Ke(e,3):0}function gP(e){return e.trim()}function RV(e,t){return(e=t.exec(e))?e[0]:e}function te(e,t,r){return e.replace(t,r)}function Lh(e,t){return e.indexOf(t)}function Ke(e,t){return e.charCodeAt(t)|0}function ma(e,t,r){return e.slice(t,r)}function cr(e){return e.length}function um(e){return e.length}function uc(e,t){return t.push(e),e}function OV(e,t){return e.map(t).join("")}function Pc(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:Tc,column:Ni,length:a,return:""}}function sa(e,t){return TV(Pc("",null,null,"",null,null,0),e,{length:-e.length},t)}function NV(){return Oe}function DV(){return Oe=gt>0?Ke(Li,--gt):0,Ni--,Oe===10&&(Ni=1,Tc--),Oe}function xt(){return Oe=gt<vP?Ke(Li,gt++):0,Ni++,Oe===10&&(Ni=1,Tc++),Oe}function ur(){return Ke(Li,gt)}function fc(){return gt}function ya(e,t){return ma(Li,e,t)}function ga(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function yP(e){return Tc=Ni=1,vP=cr(Li=e),gt=0,[]}function bP(e){return Li="",e}function hc(e){return gP(ya(gt-1,qh(e===91?e+2:e===40?e+1:e)))}function LV(e){for(;(Oe=ur())&&Oe<33;)xt();return ga(e)>2||ga(Oe)>3?"":" "}function qV(e,t){for(;--t&&xt()&&!(Oe<48||Oe>102||Oe>57&&Oe<65||Oe>70&&Oe<97););return ya(e,fc()+(t<6&&ur()==32&&xt()==32))}function qh(e){for(;xt();)switch(Oe){case e:return gt;case 34:case 39:e!==34&&e!==39&&qh(Oe);break;case 40:e===41&&qh(e);break;case 92:xt();break}return gt}function UV(e,t){for(;xt()&&e+Oe!==57&&!(e+Oe===84&&ur()===47););return"/*"+ya(t,gt-1)+"*"+xc(e===47?e:xt())}function MV(e){for(;!ga(ur());)xt();return ya(e,gt)}function FV(e){return bP(mc("",null,null,null,[""],e=yP(e),0,[0],e))}function mc(e,t,r,n,i,o,a,s,l){for(var c=0,d=0,u=a,p=0,f=0,h=0,g=1,b=1,y=1,_=0,I="",E=i,T=o,k=n,C=I;b;)switch(h=_,_=xt()){case 40:if(h!=108&&Ke(C,u-1)==58){Lh(C+=te(hc(_),"&","&\f"),"&\f")!=-1&&(y=-1);break}case 34:case 39:case 91:C+=hc(_);break;case 9:case 10:case 13:case 32:C+=LV(h);break;case 92:C+=qV(fc()-1,7);continue;case 47:switch(ur()){case 42:case 47:uc(jV(UV(xt(),fc()),t,r),l);break;default:C+="/"}break;case 123*g:s[c++]=cr(C)*y;case 125*g:case 59:case 0:switch(_){case 0:case 125:b=0;case 59+d:y==-1&&(C=te(C,/\f/g,"")),f>0&&cr(C)-u&&uc(f>32?NT(C+";",n,r,u-1):NT(te(C," ","")+";",n,r,u-2),l);break;case 59:C+=";";default:if(uc(k=OT(C,t,r,c,d,i,s,I,E=[],T=[],u),o),_===123)if(d===0)mc(C,t,k,k,E,o,u,s,T);else switch(p===99&&Ke(C,3)===110?100:p){case 100:case 108:case 109:case 115:mc(e,k,k,n&&uc(OT(e,k,k,0,0,i,s,I,i,E=[],u),T),i,T,u,s,n?E:T);break;default:mc(C,k,k,k,[""],T,0,s,T)}}c=d=f=0,g=y=1,I=C="",u=a;break;case 58:u=1+cr(C),f=h;default:if(g<1){if(_==123)--g;else if(_==125&&g++==0&&DV()==125)continue}switch(C+=xc(_),_*g){case 38:y=d>0?1:(C+="\f",-1);break;case 44:s[c++]=(cr(C)-1)*y,y=1;break;case 64:ur()===45&&(C+=hc(xt())),p=ur(),d=u=cr(I=C+=MV(fc())),_++;break;case 45:h===45&&cr(C)==2&&(g=0)}}return o}function OT(e,t,r,n,i,o,a,s,l,c,d){for(var u=i-1,p=i===0?o:[""],f=um(p),h=0,g=0,b=0;h<n;++h)for(var y=0,_=ma(e,u+1,u=xV(g=a[h])),I=e;y<f;++y)(I=gP(g>0?p[y]+" "+_:te(_,/&\f/g,p[y])))&&(l[b++]=I);return Pc(e,t,r,i===0?lm:s,l,c,d)}function jV(e,t,r){return Pc(e,t,r,hP,xc(NV()),ma(e,2,-2),0)}function NT(e,t,r,n){return Pc(e,t,r,cm,ma(e,0,n),ma(e,n+1,-1),n)}function Ri(e,t){for(var r="",n=um(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function BV(e,t,r,n){switch(e.type){case kV:if(e.children.length)break;case CV:case cm:return e.return=e.return||e.value;case hP:return"";case mP:return e.return=e.value+"{"+Ri(e.children,n)+"}";case lm:e.value=e.props.join(",")}return cr(r=Ri(e.children,n))?e.return=e.value+"{"+r+"}":""}function GV(e){var t=um(e);return function(r,n,i,o){for(var a="",s=0;s<t;s++)a+=e[s](r,n,i,o)||"";return a}}function JV(e){return function(t){t.root||(t=t.return)&&e(t)}}function HV(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}function _P(e,t){switch(PV(e,t)){case 5103:return ee+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return ee+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return ee+e+_c+e+it+e+e;case 6828:case 4268:return ee+e+it+e+e;case 6165:return ee+e+it+"flex-"+e+e;case 5187:return ee+e+te(e,/(\w+).+(:[^]+)/,ee+"box-$1$2"+it+"flex-$1$2")+e;case 5443:return ee+e+it+"flex-item-"+te(e,/flex-|-self/,"")+e;case 4675:return ee+e+it+"flex-line-pack"+te(e,/align-content|flex-|-self/,"")+e;case 5548:return ee+e+it+te(e,"shrink","negative")+e;case 5292:return ee+e+it+te(e,"basis","preferred-size")+e;case 6060:return ee+"box-"+te(e,"-grow","")+ee+e+it+te(e,"grow","positive")+e;case 4554:return ee+te(e,/([^-])(transform)/g,"$1"+ee+"$2")+e;case 6187:return te(te(te(e,/(zoom-|grab)/,ee+"$1"),/(image-set)/,ee+"$1"),e,"")+e;case 5495:case 3959:return te(e,/(image-set\([^]*)/,ee+"$1$`$1");case 4968:return te(te(e,/(.+:)(flex-)?(.*)/,ee+"box-pack:$3"+it+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ee+e+e;case 4095:case 3583:case 4068:case 2532:return te(e,/(.+)-inline(.+)/,ee+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(cr(e)-1-t>6)switch(Ke(e,t+1)){case 109:if(Ke(e,t+4)!==45)break;case 102:return te(e,/(.+:)(.+)-([^]+)/,"$1"+ee+"$2-$3$1"+_c+(Ke(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Lh(e,"stretch")?_P(te(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ke(e,t+1)!==115)break;case 6444:switch(Ke(e,cr(e)-3-(~Lh(e,"!important")&&10))){case 107:return te(e,":",":"+ee)+e;case 101:return te(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ee+(Ke(e,14)===45?"inline-":"")+"box$3$1"+ee+"$2$3$1"+it+"$2box$3")+e}break;case 5936:switch(Ke(e,t+11)){case 114:return ee+e+it+te(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ee+e+it+te(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ee+e+it+te(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ee+e+it+e+e}return e}function ZV(e){for(var t=0,r,n=0,i=e.length;i>=4;++n,i-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function wc(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var i=r;if(i.anim===1)return nn={name:i.name,styles:i.styles,next:nn},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)nn={name:a.name,styles:a.styles,next:nn},a=a.next;var s=o.styles+";";return s}return n9(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function n9(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=wc(e,t,r[i])+";";else for(var o in r){var a=r[o];if(typeof a!="object"){var s=a;t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":LT(s)&&(n+=hh(o)+":"+qT(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var l=0;l<a.length;l++)LT(a[l])&&(n+=hh(o)+":"+qT(o,a[l])+";");else{var c=wc(e,t,a);switch(o){case"animation":case"animationName":{n+=hh(o)+":"+c+";";break}default:n+=o+"{"+c+"}"}}}return n}function mh(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,i="";nn=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=wc(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=wc(r,t,e[s]),n){var l=o;i+=l[s]}UT.lastIndex=0;for(var c="",d;(d=UT.exec(i))!==null;)c+="-"+d[1];var u=ZV(i)+c;return{name:u,styles:i,next:nn}}function SP(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}function MT(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function FT(e,t,r){var n=[],i=SP(e,n,r);return n.length<2?r:i+t(n)}function c9(e,t){Me.__h&&Me.__h(kt,e,BT||t),BT=0;var r=kt.__H||(kt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function EP(e,t){var r=c9(Uh++,7);return p9(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function u9(){for(var e;e=IP.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(gc),e.__H.__h.forEach(Mh),e.__H.__h=[]}catch(t){e.__H.__h=[],Me.__e(t,e.__v)}}function d9(e){var t,r=function(){clearTimeout(n),zT&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);zT&&(t=requestAnimationFrame(r))}function gc(e){var t=kt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),kt=t}function Mh(e){var t=kt;e.__c=e.__(),kt=t}function p9(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Rc(){if(on>1)on--;else{for(var e,t=!1;da!==void 0;){var r=da;for(da=void 0,Fh++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&CP(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Fh=0,on--,t)throw e}}function Ye(e){if(on>0)return e();on++;try{return e()}finally{Rc()}}function AP(e){if(le!==void 0){var t=e.n;if(t===void 0||t.t!==le)return t={i:0,S:e,p:le.s,n:void 0,t:le,e:void 0,x:void 0,r:t},le.s!==void 0&&(le.s.n=t),le.s=t,e.n=t,32&le.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=le.s,t.n=void 0,le.s.n=t,le.s=t),t}}function Qe(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function $(e){return new Qe(e)}function CP(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function kP(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function xP(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function qi(e){Qe.call(this,void 0),this.x=e,this.s=void 0,this.g=Sc-1,this.f=4}function pa(e){return new qi(e)}function TP(e){var t=e.u;if(e.u=void 0,typeof t=="function"){on++;var r=le;le=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,dm(e),n}finally{le=r,Rc()}}}function dm(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,TP(e)}function h9(e){if(le!==this)throw new Error("Out-of-order effect");xP(this),le=e,this.f&=-2,8&this.f&&dm(this),Rc()}function ba(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function _a(e){var t=new ba(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function Ui(e,t){q[e]=t.bind(null,q[e]||function(){})}function Ic(e){vh&&vh(),vh=e&&e.S()}function OP(e){var t=this,r=e.data,n=NP(r);n.value=r;var i=EP(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=pa(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""}),d=pa(function(){return!Array.isArray(c.value)&&!Gu(c.value)}),u=_a(function(){if(this.N=DP,d.value){var f=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),p=t.__$u.d;return t.__$u.d=function(){u(),p.call(this)},[d,c]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}function m9(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=$(r);return{o:function(a,s){o.value=a,n=s},d:_a(function(){this.N=DP;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}function NP(e){return EP(function(){return $(e)},[])}function v9(){Ye(function(){for(var e;e=RP.shift();)PP.call(e)})}function DP(){RP.push(this)===1&&(q.requestAnimationFrame||g9)(v9)}function y9(e,t){let r=ii(e);ni(()=>{r.current=e},[e]),yn(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}function K(e,t,r,n,i,o){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--b9,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return q.vnode&&q.vnode(c),c}function Pr(e,t,r){return(t=R9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R9(e){var t=O9(e,"string");return typeof t=="symbol"?t:t+""}function O9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lt(e,t,r){return(t=H9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H9(e){var t=$9(e,"string");return typeof t=="symbol"?t:t+""}function $9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rr(e,t,r){return(t=K9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K9(e){var t=Y9(e,"string");return typeof t=="symbol"?t:t+""}function Y9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nt(e,t,r){return(t=Q9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q9(e){var t=X9(e,"string");return typeof t=="symbol"?t:t+""}function X9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mt(e,t,r){return(t=Z9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z9(e){var t=eW(e,"string");return typeof t=="symbol"?t:t+""}function eW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dn(e,t,r){return(t=tW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tW(e){var t=rW(e,"string");return typeof t=="symbol"?t:t+""}function rW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yh(e,t,r){return(t=nW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nW(e){var t=iW(e,"string");return typeof t=="symbol"?t:t+""}function iW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ct(e,t,r){return(t=oW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oW(e){var t=aW(e,"string");return typeof t=="symbol"?t:t+""}function aW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pW(e){return!!(e!=null&&e.__nativeBuffers__)}function Yh(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!pW(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 i;n.value?i=n.value:n.base64&&(i=fW(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function mW(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=e,n=[];for(let[i,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let a=t?{value:o,key:i}:{base64:hW(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function bW(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function FP(e){return typeof e=="string"}function Oi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function QT(e){return typeof e=="number"&&!isNaN(e)}function wW(e){return typeof e=="undefined"}function SW(e){return wW(e)||e===null}function jP(e){return typeof e=="function"}function IW(e){return Oi(e)&&jP(e.then)}function BP(e){let t=e,r=null,n=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function la(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function PW(e,t,r){let n=e;for(let i of t)if(n&&typeof n=="object")n=n[i];else return r;return n===void 0?r:n}function LW(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function jW(e){return new Promise(t=>GP(e)(t))}function GP(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function BW(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new va(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}function JW(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)HW(e[n],t[n])}function HW(e,t){if(FP(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(jP(t)){try{if(e instanceof t)return}catch(r){}if(!SW(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 Lt(e,t){if(Xh.config[e]){Nc.warn(`[can i use] ${e} already registered`);return}Xh.config[e]=Lr({},t)}function eP(e,t){return`[${e}]:${t}`}function XW(e,t){tP||(wh=new yc({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Sh=new yc({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ih=new yc({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{wh.flush(),Sh.flush(),Ih.flush()}),tP=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:h,invokeCallback:g}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";wh.report({status:b,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&h&&g&&(Sh.report({status:b,method:s,isForeground:d,duration:Number((h-c).toFixed(3))}),Ih.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-g).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function tz(e,t){let r=0,n=!0,i=ez.resolveMap,o=XW(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Eh.forEach(l=>Cc(this,[l],function(c){let{method:d,args:u,resolve:p}=c;return function*(){let f=yield s(d,u);p(f)}()})),Eh.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=Yh(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let h=new _W;if(i.set(r,h.resolve),!n&&zW.includes(l))return new Promise(E=>{Eh.push({method:l,args:c,resolve:E})});let g=uW(Lr({},{method:l,startTime:p,args:c,isForeground:f}),{invokeType:"js-bridge"}),b=WW.includes(l),y=mW(c,b),_=b?y:JSON.stringify(y),I;if(l.endsWith("Sync")||KW.includes(l)?I=(d=e.call)==null?void 0:d.call(e,l,y,r):typeof _=="string"?I=e.invoke(l,_,r):I=(u=e.call)==null?void 0:u.call(e,l,_,r),I){try{typeof I=="string"&&(I=JSON.parse(I)),I=Yh(I)}catch(E){Nc.error(E)}return i.delete(r),I.errorCode&&(I.errorCode=eP(l,I.errorCode)),o(Lr(Lr({},g),I)),I}return l.endsWith("Sync")&&i.delete(r),h.promise.then(E=>(E.errorCode&&(E.errorCode=eP(l,E.errorCode)),o(Lr(Lr({},g),E)),E))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return IW(d)?d.then(u=>rP(l,u)):rP(l,d)},invokeHandler:a}}function rP(e,t){if(!Oi(t)){Nc.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=dW(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new kW(n,i,o,a);return s}function rz(e){if(globalThis[dc])return globalThis[dc];let t=new tm,r=new tm,n=new yc({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),globalThis[dc]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,o,a){let s=Yh(o),l;if(s.__extra){l=s.params;let{type:c,startTime:d}=s.__extra;n.report({type:c,event:i,duration:Date.now()-d})}else l=s;if(i===JP){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice(fa.length),u,a)}catch(p){}});return}if(i.startsWith(fa)){r.emit(i.slice(fa.length),l,a);return}t.emit(i,l,a)}},globalThis[dc]}function nz(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${fa}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(JP,d,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${fa}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(YW,d,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function iz(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=rz(e),{invokeNative:a,invokeHandler:s,applyNative:l}=tz(e,r),{publish:c,emitNative:d}=nz(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:c,subscribe:i,unsubscribe:o}}function HP(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}function cz(e,t,r){return(t=uz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uz(e){var t=dz(e,"string");return typeof t=="symbol"?t:t+""}function dz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Or(e,t,r){return(t=fz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fz(e){var t=hz(e,"string");return typeof t=="symbol"?t:t+""}function hz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nr(e,t,r){return(t=mz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mz(e){var t=gz(e,"string");return typeof t=="symbol"?t:t+""}function gz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ua(e,t,r){return(t=vz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vz(e){var t=yz(e,"string");return typeof t=="symbol"?t:t+""}function yz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vt(e,t,r){return(t=bz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bz(e){var t=_z(e,"string");return typeof t=="symbol"?t:t+""}function _z(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var N$,D$,L$,bc,iP,oP,AT,aP,q$,U$,sP,M$,F$,CT,j$,B$,kT,G$,J$,H$,lP,$$,Q$,X$,xT,Z$,TT,eV,uP,dP,pP,PT,tV,rV,xi,Ch,kh,ye,aV,sV,aa,ha,lV,Th,cV,fh,pV,Ph,RT,Ci,Rh,Oh,Nh,Dh,AV,it,_c,ee,hP,lm,cm,CV,mP,kV,xV,xc,TV,Tc,Ni,vP,gt,Oe,Li,$V,VV,WV,DT,zV,KV,YV,QV,XV,e9,t9,r9,wP,LT,hh,qT,UT,nn,i9,o9,a9,s9,l9,ot,Uh,kt,gh,jT,BT,IP,Me,GT,JT,HT,$T,VT,WT,zT,f9,le,da,on,Fh,Sc,PP,vh,RP,g9,Fe,b9,_9,Dr,jh,Bh,vc,w9,S9,I9,E9,A9,C9,k9,x9,T9,P9,Gh,N9,D9,L9,q9,U9,M9,F9,KT,j9,B9,G9,J9,Jh,Pi,ki,V9,W9,z9,Hh,LP,$h,Vh,Wh,zh,Ec,Kh,sW,lW,cW,Ac,qP,UP,YT,Lr,uW,dW,Cc,fW,hW,gW,vW,MP,yW,_W,EW,AW,Oc,CW,kW,xW,bh,Nc,XT,TW,Qh,RW,Xh,OW,NW,DW,Ti,qW,Zh,be,UW,MW,ca,va,tm,rm,FW,_h,GW,nm,ZT,$W,VW,fa,WW,zW,KW,JP,YW,QW,yc,tP,wh,Sh,Ih,Eh,im,ZW,ez,dc,pm,an,$P,VP,oz,WP,nP,Ah,az,sz,lz,pz,kc,om,am,sm,Di,hoe,fm=x(()=>{"use strict";Wn();Cs();N$=Object.defineProperty,D$=Object.defineProperties,L$=Object.getOwnPropertyDescriptors,bc=Object.getOwnPropertySymbols,iP=Object.prototype.hasOwnProperty,oP=Object.prototype.propertyIsEnumerable,AT=(e,t,r)=>t in e?N$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aP=(e,t)=>{for(var r in t||(t={}))iP.call(t,r)&&AT(e,r,t[r]);if(bc)for(var r of bc(t))oP.call(t,r)&&AT(e,r,t[r]);return e},q$=(e,t)=>D$(e,L$(t)),U$=(e,t)=>{var r={};for(var n in e)iP.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&bc)for(var n of bc(e))t.indexOf(n)<0&&oP.call(e,n)&&(r[n]=e[n]);return r},sP=Object.defineProperty,M$=Object.defineProperties,F$=Object.getOwnPropertyDescriptors,CT=Object.getOwnPropertySymbols,j$=Object.prototype.hasOwnProperty,B$=Object.prototype.propertyIsEnumerable,kT=(e,t,r)=>t in e?sP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,G$=(e,t)=>{for(var r in t||(t={}))j$.call(t,r)&&kT(e,r,t[r]);if(CT)for(var r of CT(t))B$.call(t,r)&&kT(e,r,t[r]);return e},J$=(e,t)=>M$(e,F$(t)),H$=(e,t)=>{for(var r in t)sP(e,r,{get:t[r],enumerable:!0})},lP=(e,t,r,n)=>{for(var i=t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},$$=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Q$=(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))(Q$||{});X$={log:oa("log"),warn:oa("warn"),info:oa("info"),error:oa("error"),debug:oa("debug")};Object.assign(globalThis,{logger:X$});xT=Symbol.for("Jolibox.canIUseMap"),Z$={};globalThis[xT]||(globalThis[xT]=Z$);TT=Symbol.for("Jolibox.canIUseMap.native"),eV={};globalThis[TT]||(globalThis[TT]=eV);uP=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(uP||{}),dP=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(dP||{}),pP=(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))(pP||{}),PT=["name","params"],tV=["name","type","location","target","extra","timestamp","userId"],rV=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];oV();xi=typeof window=="undefined",Ch=()=>!xi&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!xi&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!xi&&navigator.userAgent.includes("Android"),!xi&&navigator.userAgent.includes("Mac"),!xi&&navigator.userAgent.includes("FB_IAB"),!xi&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");kh=class xh{constructor(t){this.element=t,this.next=xh.Undefined,this.prev=xh.Undefined}};kh.Undefined=new kh(void 0);ye=kh,aV=class{constructor(){this._first=ye.Undefined,this._last=ye.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ye.Undefined}clear(){let e=this._first;for(;e!==ye.Undefined;){let t=e.next;e.prev=ye.Undefined,e.next=ye.Undefined,e=t}this._first=ye.Undefined,this._last=ye.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ye(e);if(this._first===ye.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ye.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ye.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ye.Undefined&&e.next!==ye.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ye.Undefined&&e.next===ye.Undefined?(this._first=ye.Undefined,this._last=ye.Undefined):e.next===ye.Undefined?(this._last=this._last.prev,this._last.next=ye.Undefined):e.prev===ye.Undefined&&(this._first=this._first.next,this._first.prev=ye.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ye.Undefined;)yield e.element,e=e.next}},sV=0,aa=class{constructor(e){this.value=e,this.id=sV++}},ha=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 aa&&(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(){return this._event!=null||(this._event=(e,t)=>{var r,n,i,o,a,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new aa(e);return this._listeners?this._listeners instanceof aa?this._listeners=[this._listeners,l]:this._listeners.push(l):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=l,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(s=(a=this.options)==null?void 0:a.onDidAddListener)==null||s.call(a,this),this._size++,()=>{var c,d,u,p;if(!this._disposed){if(this._listeners instanceof aa)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(d=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||d.call(c));else if(this._listeners){let f=this._listeners.indexOf(l);f>=0&&(this._listeners.splice(f,1),this._size--,this._size===0&&((p=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||p.call(u)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof aa?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},lV=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var n;let i=(n=this.listeners.get(e))!=null?n:new ha,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),r=this.cachedEventQueue.get(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r||(r=new aV,this.cachedEventQueue.set(e,r)),r.push({args:i}),t&&t.fire({event:e,args:i})}once(e,t){var r=this;let n=function(){t(...arguments),r.off(e,n)};this.on(e,n,!1)}},Th={};H$(Th,{None:()=>cV,filter:()=>dV,once:()=>fP,toPromise:()=>uV});cV=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});fh=Symbol.for("Jolibox.hostEmitter"),pV=()=>{let e=new lV;return globalThis[fh]||(globalThis[fh]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[fh]};pV();Ph=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new ha,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return fV(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}};Ph=lP([cP],Ph);RT=class{constructor(){this._onWillExecuteCommand=new ha,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new ha,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ph,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=V$(3e4)),this._starActivation}executeCommand(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return $$(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),Th.toPromise(Th.filter(this.registry.onDidRegisterCommand,i=>i===e))])]),this._tryExecuteCommand(e,r))})}executeCommandThowErr(e){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let t=this.registry.getCommand(e);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._onWillExecuteCommand.fire({commandId:e,args:n});let o=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),o}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let 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){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e(...r)}finally{}}};RT=lP([cP],RT);Ci=e=>e?function(){try{for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e==null||e(...r)}catch(i){console.error("Error calling function",i)}}:()=>{console.log("wrapUserFunction: fn is undefined")},Rh=class{constructor(t){ht(this,"context",void 0),ht(this,"continueCallback",void 0),ht(this,"adIsShowingCallback",void 0),ht(this,"isBeforeAdCalled",!1),ht(this,"isBeforeRewardCalled",!1),ht(this,"isAdDismissedCalled",!1),ht(this,"isAdViewedCalled",!1),ht(this,"isAfterAdCalled",!1),ht(this,"currentProvider",void 0),ht(this,"currentClientParams",void 0),ht(this,"adsHasResponse",!1),ht(this,"videoChecker",window.document.createElement("video")),ht(this,"contextInfo",void 0),ht(this,"wrapShowAdFn",r=>()=>{var n,i,o;this.adsHasResponse=!0;let a=!1;this.videoChecker.play().catch(()=>{a=!1}),a=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:a},this.paramsToTrack)),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_REWARD",aP({userEvent:a},this.paramsToTrack)),Ch()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"rewarded",module:"game",game_id:this.contextInfo.objectId}),(o=this.adIsShowingCallback)==null||o.call(this,!0);let s=Ci(r);s==null||s()}),this.context=t,this.contextInfo=t.getContextInfo()}notifyIframeAdsEvent(t,r){window.parent&&window.parent.postMessage({type:t,data:r},"*"),window.dispatchEvent(new CustomEvent(t,{detail:r}))}get paramsToTrack(){var t,r,n,i,o,a;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null,type:(n=this.currentClientParams)==null?void 0:n.type,name:((i=this.currentClientParams)==null?void 0:i.type)==="preroll"?null:(a=(o=this.currentClientParams)==null?void 0:o.name)!=null?a:""}}wrapBeforeAd(t){return()=>{var r,n,i,o;if(this.adsHasResponse=!0,this.context.track("CallBeforeAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_AD",this.paramsToTrack),!this.isBeforeAdCalled){this.isBeforeAdCalled=!0;let a=Ci(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),Ch()&&this.context.track("mmp_ad_impression",{ad_network:(o=(i=this.currentProvider)==null?void 0:i.name)!=null?o:"",ad_format:"interstitial",module:"game",game_id:this.contextInfo.objectId}))}}}wrapBeforeReward(t){return r=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(r)():(this.isBeforeRewardCalled=!0,t==null||t(this.wrapShowAdFn(r)))}}wrapAdDismissed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdDismissedCalled){this.isAdDismissedCalled=!0;let r=Ci(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=Ci(t);r==null||r()}}}wrapAfterAd(t){return()=>{if(this.adsHasResponse=!0,this.context.track("CallAfterAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AFTER_AD",this.paramsToTrack),!this.isAfterAdCalled){this.isAfterAdCalled=!0;let r=Ci(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,l,c,d,u;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:null,breakType:r.breakType,breakName:(o=r.breakName)!=null?o:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(a=this.currentProvider)==null?void 0:a.name)!=null?s:null,breakType:r.breakType,breakName:(l=r.breakName)!=null?l:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=Ci(t);p==null||p(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(d=this.continueCallback)==null||d.call(this,[!1,r]);break}default:{(u=this.continueCallback)==null||u.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return v(this,null,function*(){return this.currentProvider=t,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(o=>{this.continueCallback=o,this.adIsShowingCallback=i;let a;switch(r.type){case"preroll":{a={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),beforeReward:this.wrapBeforeReward(r.beforeReward),adDismissed:this.wrapAdDismissed(r.adDismissed),adViewed:this.wrapAdViewed(r.adViewed),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}default:{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}}window.setTimeout(()=>{var s,l,c,d,u,p,f;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(d=(c=this.currentProvider)==null?void 0:c.name)!=null?d:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(u=r.name)!=null?u:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(f=this.adIsShowingCallback)==null||f.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),t.adBreak(a,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};Oh=class{constructor(t){lc(this,"context",void 0),lc(this,"adBreakIsShowing",!1),lc(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),lc(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=t,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};Nh=class{constructor(t){cc(this,"configs",null),cc(this,"firstRun",!0),cc(this,"context",void 0),cc(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return v(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(t){}})}shouldBypassCallingInterstitial(){var t,r;let n;if(!this.configs)this.init(),n=!this.firstRun;else{let i=(t=this.contextInfo.channel)!=null?t:"",o=this.configs[i],a=(r=o==null?void 0:o.interstitialRate)!=null?r:1;n=Math.random()<a}return this.firstRun=!1,n}};Dh=class{constructor(t,r){Tr(this,"name","ADSENSE"),Tr(this,"context",void 0),Tr(this,"contextInfo",void 0),Tr(this,"configured",!1),Tr(this,"initParams",void 0),Tr(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),Tr(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=U$(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),Tr(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),Tr(this,"adUnit",n=>v(this,null,function*(){var i,o,a,s;if(this.context.track("CallAdUnit",{adFormat:(o=(i=n.adFormat)==null?void 0:i.toString())!=null?o:null,fullWidthResponsive:(a=n.fullWidthResponsive)!=null?a:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:d,fullWidthResponsive:u,style:p}=n,f;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?f=document.querySelector(l):f=l,!f)throw new Error("targeting element not found");let h=c;if(h||(h=this.initParams.unitId),!h)throw new Error("slot is required");let g=typeof d=="object"&&Array.isArray(d)?d.join(", "):d,b=document.createElement("ins");if(b.className="adsbygoogle",b.id="jolibox-ads",b.style.display="block",b.setAttribute("data-ad-client",this.initParams.clientId),b.setAttribute("data-ad-slot",h),g&&b.setAttribute("data-ad-format",g),u&&b.setAttribute("data-full-width-responsive",u),p&&b.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let y=document.createElement("div");y.style.position="absolute",y.style.top="0",y.style.left="0",y.style.width="100%",y.style.height="100%",y.style.display="flex",y.style.justifyContent="center",y.style.alignItems="center",y.style.backgroundColor="rgba(0, 0, 0, 0.5)",y.style.color="white",y.innerHTML="Test Ad",b.style.position="relative",f.appendChild(b),b.appendChild(y)}else f.appendChild(b),new MutationObserver(y=>{y.forEach(_=>{if(_.type==="attributes"&&_.attributeName==="data-ad-status"){let I=b.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:I!=null?I:"null"})}})}).observe(b,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,window.adsbygoogle=window.adsbygoogle||[]}init(){return v(this,null,function*(){var t;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let r="google-adsense",n=(t=this.contextInfo.testAdsMode)!=null?t:!1;if(!document.getElementById(r)&&this.initParams.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.initParams.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&i.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&i.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),this.initParams.admobRewardedSlot&&i.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&i.setAttribute("data-admob-ads-only","on"),document.head.appendChild(i),this.context.track("LoadAdsenseCompleted",null)}})}};AV=function(){function e(r){var n=this;this._insertTag=function(i){var o;n.tags.length===0?n.insertionPoint?o=n.insertionPoint.nextSibling:n.prepend?o=n.container.firstChild:o=n.before:o=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(i,o),n.tags.push(i)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(EV(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=IV(n);try{i.insertRule(r,i.cssRules.length)}catch(o){}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e}(),it="-ms-",_c="-moz-",ee="-webkit-",hP="comm",lm="rule",cm="decl",CV="@import",mP="@keyframes",kV="@layer",xV=Math.abs,xc=String.fromCharCode,TV=Object.assign;Tc=1,Ni=1,vP=0,gt=0,Oe=0,Li="";$V=function(e,t,r){for(var n=0,i=0;n=i,i=ur(),n===38&&i===12&&(t[r]=1),!ga(i);)xt();return ya(e,gt)},VV=function(e,t){var r=-1,n=44;do switch(ga(n)){case 0:n===38&&ur()===12&&(t[r]=1),e[r]+=$V(gt-1,t,r);break;case 2:e[r]+=hc(n);break;case 4:if(n===44){e[++r]=ur()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=xc(n)}while(n=xt());return e},WV=function(e,t){return bP(VV(yP(e),t))},DT=new WeakMap,zV=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!DT.get(r))&&!n){DT.set(e,!0);for(var i=[],o=WV(t,i),a=r.props,s=0,l=0;s<o.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=i[s]?o[s].replace(/&\f/g,a[c]):a[c]+" "+o[s]}}},KV=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};YV=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case cm:e.return=_P(e.value,e.length);break;case mP:return Ri([sa(e,{value:te(e.value,"@","@"+ee)})],n);case lm:if(e.length)return OV(e.props,function(i){switch(RV(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Ri([sa(e,{props:[te(i,/:(read-\w+)/,":"+_c+"$1")]})],n);case"::placeholder":return Ri([sa(e,{props:[te(i,/:(plac\w+)/,":"+ee+"input-$1")]}),sa(e,{props:[te(i,/:(plac\w+)/,":"+_c+"$1")]}),sa(e,{props:[te(i,/:(plac\w+)/,it+"input-$1")]})],n)}return""})}},QV=[YV],XV=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(h){var g=h.getAttribute("data-emotion");g.indexOf(" ")!==-1&&(document.head.appendChild(h),h.setAttribute("data-s",""))})}var n=e.stylisPlugins||QV,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(h){for(var g=h.getAttribute("data-emotion").split(" "),b=1;b<g.length;b++)i[g[b]]=!0;a.push(h)});var s,l=[zV,KV];{var c,d=[BV,JV(function(h){c.insert(h)})],u=GV(l.concat(n,d)),p=function(h){return Ri(FV(h),u)};s=function(h,g,b,y){c=b,p(h?h+"{"+g.styles+"}":g.styles),y&&(f.inserted[g.name]=!0)}}var f={key:t,sheet:new AV({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:s};return f.sheet.hydrate(a),f};e9={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},t9=/[A-Z]|^ms/g,r9=/_EMO_([^_]+?)_([^]*?)_EMO_/g,wP=function(e){return e.charCodeAt(1)===45},LT=function(e){return e!=null&&typeof e!="boolean"},hh=HV(function(e){return wP(e)?e:e.replace(t9,"-$&").toLowerCase()}),qT=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(r9,function(r,n,i){return nn={name:n,styles:i,next:nn},n})}return e9[e]!==1&&!wP(e)&&typeof t=="number"&&t!==0?t+"px":t};UT=/label:\s*([^\s;{]+)\s*(;|$)/g;i9=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},o9=function(e,t,r){i9(e,t);var n=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var i=t;do e.insert(t===i?"."+n:"",i,e.sheet,!0),i=i.next;while(i!==void 0)}};a9=function(e){var t=XV(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=mh(s,t.registered,void 0);return o9(t,c),t.key+"-"+c.name},n=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=mh(s,t.registered),d="animation-"+c.name;return MT(t,{name:c.name,styles:"@keyframes "+d+"{"+c.styles+"}"}),d},i=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=mh(s,t.registered);MT(t,c)},o=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];return FT(t.registered,r,s9(s))};return{css:r,cx:o,injectGlobal:i,keyframes:n,hydrate:function(a){a.forEach(function(s){t.inserted[s]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:SP.bind(null,t.registered),merge:FT.bind(null,t.registered,r)}},s9=function e(t){for(var r="",n=0;n<t.length;n++){var i=t[n];if(i!=null){var o=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))o=e(i);else{o="";for(var a in i)i[a]&&a&&(o&&(o+=" "),o+=a)}break}default:o=i}o&&(r&&(r+=" "),r+=o)}}return r},l9=a9({key:"css"}),ot=l9.css,BT=0,IP=[],Me=q,GT=Me.__b,JT=Me.__r,HT=Me.diffed,$T=Me.__c,VT=Me.unmount,WT=Me.__;Me.__b=function(e){kt=null,GT&>(e)},Me.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),WT&&WT(e,t)},Me.__r=function(e){JT&&JT(e),Uh=0;var t=(kt=e.__c).__H;t&&(gh===kt?(t.__h=[],kt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(gc),t.__h.forEach(Mh),t.__h=[],Uh=0)),gh=kt},Me.diffed=function(e){HT&&HT(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(IP.push(t)!==1&&jT===Me.requestAnimationFrame||((jT=Me.requestAnimationFrame)||d9)(u9)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),gh=kt=null},Me.__c=function(e,t){t.some(function(r){try{r.__h.forEach(gc),r.__h=r.__h.filter(function(n){return!n.__||Mh(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Me.__e(n,r.__v)}}),$T&&$T(e,t)},Me.unmount=function(e){VT&&VT(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{gc(n)}catch(i){t=i}}),r.__H=void 0,t&&Me.__e(t,r.__v))};zT=typeof requestAnimationFrame=="function";f9=Symbol.for("preact-signals");le=void 0,da=void 0,on=0,Fh=0,Sc=0;Qe.prototype.brand=f9;Qe.prototype.h=function(){return!0};Qe.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};Qe.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};Qe.prototype.subscribe=function(e){var t=this;return _a(function(){var r=t.value,n=le;le=void 0;try{e(r)}finally{le=n}})};Qe.prototype.valueOf=function(){return this.value};Qe.prototype.toString=function(){return this.value+""};Qe.prototype.toJSON=function(){return this.value};Qe.prototype.peek=function(){var e=le;le=void 0;try{return this.value}finally{le=e}};Object.defineProperty(Qe.prototype,"value",{get:function(){var e=AP(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Fh>100)throw new Error("Cycle detected");this.v=e,this.i++,Sc++,on++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Rc()}}}});(qi.prototype=new Qe).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Sc))return!0;if(this.g=Sc,this.f|=1,this.i>0&&!CP(this))return this.f&=-2,!0;var e=le;try{kP(this),le=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return le=e,xP(this),this.f&=-2,!0};qi.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Qe.prototype.S.call(this,e)};qi.prototype.U=function(e){if(this.t!==void 0&&(Qe.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};qi.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(qi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=AP(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});ba.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};ba.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,TP(this),kP(this),on++;var e=le;return le=this,h9.bind(this,e)};ba.prototype.N=function(){2&this.f||(this.f|=2,this.o=da,da=this)};ba.prototype.d=function(){this.f|=8,1&this.f||dm(this)};RP=[];_a(function(){PP=this.N})();OP.displayName="_st";Object.defineProperties(Qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:OP},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Ui("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Qe&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});Ui("__r",function(e,t){Ic();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return _a(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Ic(r),e(t)});Ui("__e",function(e,t,r,n){Ic(),e(t,r,n)});Ui("diffed",function(e,t){Ic();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in n)&&(s.d(),o[a]=void 0)}else o={},r.U=o;for(var l in n){var c=o[l],d=n[l];c===void 0?(c=m9(r,l,d,i),o[l]=c):c.o(d,i)}}}e(t)});Ui("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)});Ui("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});St.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(n||o||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var a in e)if(a!=="__source"&&e[a]!==this.props[a])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};g9=function(e){queueMicrotask(function(){queueMicrotask(e)})};Fe=ot`
|
|
622
|
+
`,x4=()=>w("div",{style:QC.container,children:[w("style",{children:k4}),w("div",{style:QC.spinner})]});ite=En()});function Kk(){return v(this,null,function*(){if(Pf)return Pf;let t=`${S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com"}/api/user-retention/exit-recommendations?objectId=${S.mpId}&from=GAME_DETAIL`,{response:{data:r}}=yield z(t);return Pf=r,r})}function Yk(){return v(this,null,function*(){let e=new ut;if(S.mpType!=="game")return e.resolve(!1),e.promise;if(Rf)return e.resolve(!0),e.promise;let t=yield Kk();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:i}=t.data;Rf=!0;let o={domain:"GAME",buttons:t.data.buttons.map(s=>`${s.type}-${s.text}`).join(","),list:r.games.map(s=>s.gameId).join(",")};j("RecommendedGuide",P({eventType:V.View},o));let a=Ok({games:r.games,title:n,buttons:i,onClose:s=>{var l;switch(Rf=!1,s.type){case"quit":j("RecommendedGuide",{eventType:V.Click,type:"QUIT",domain:"GAME"}),e.resolve(!1);break;case"dismiss":j("RecommendedGuide",P({eventType:V.Hide},o)),e.resolve(!0),a.destroy();break;case"navigate":if((l=s.data)!=null&&l.game){let c=s.data.game;T4(c),j("GameItem",{eventType:V.Click,gameId:c.gameId,layerName:"RecommendedGuide",domain:"GAME"}),setTimeout(()=>{e.resolve(!1)},0)}else e.resolve(!0);a.destroy();break;default:j("RecommendedGuide",P({eventType:V.Hide},o)),e.resolve(!0);break}}});return e.promise})}var Pf,T4,Rf,Qk=x(()=>{"use strict";H();ue();O();ar();dt();bt();Pf=null;Kk();T4=e=>{var a;let{data:t}=F("envSync"),r=new URL(t.schema),n=new URLSearchParams(r.search);n.set("gameId",e.gameId),n.set("joliSource",S.encodeJoliSourceQuery({__mpType:"game",__orientation:(a=e.orientation)!=null?a:"VERTICAL"}));let o=`${`https://${e.gameId}.content.jolibox.com/`}index.html?${n.toString()}`;F("openSchemaSync",{schema:o})},Rf=!1});function R4(e){let t=P(P({},P4),e),{url:r,height:n,showCloseButton:i,enableDragClose:o,useAnimation:a,onClose:s,onLoad:l}=t,c=0,d=0,u=!1,p=()=>a?{overlayTransition:"opacity 0.3s ease",containerTransition:"transform 0.3s ease",iframeTransition:"opacity 0.3s ease"}:{overlayTransition:"none",containerTransition:"none",iframeTransition:"none"},f=()=>a?300:0;function h(){let{overlayTransition:_,containerTransition:I,iframeTransition:E}=p();pe=document.createElement("div"),pe.id="jolibox-modal-overlay",pe.style.cssText=`position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); z-index:1000; display:flex; justify-content:center; align-items:flex-end; transition:${_}; opacity:0; visibility:hidden;`,oe=document.createElement("div"),oe.id="jolibox-modal-container",oe.style.cssText=`width:100%; height:${n}; background:white; border-radius:12px 12px 0 0; overflow:hidden; box-shadow:0 -2px 10px rgba(0,0,0,0.2); transform:translateY(100%); transition:${I};`;let T=document.createElement("div");T.id="jolibox-modal-loading",T.style.cssText="position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); width:40px; height:40px; border:4px solid #f3f3f3; border-top:4px solid #3498db; border-radius:50%; animation:spin 1s linear infinite;";let k=document.createElement("style");k.textContent="@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }",document.head.appendChild(k);let C=document.createElement("div");if(C.style.cssText="width:100%; height:100%; display:flex; flex-direction:column; padding-bottom:env(safe-area-inset-bottom, 0); position:relative;",Dt=document.createElement("iframe"),Dt.style.cssText=`width:100%; flex:1; border:none; opacity:0; transition:${E};`,Dt.src=r,Dt.onload=()=>{T.parentNode&&T.parentNode.removeChild(T),Dt.style.opacity="1",g(),l==null||l(),_e.emit("onModalIframeLoaded",{url:r})},C.appendChild(Dt),C.appendChild(T),oe.appendChild(C),i){let G=document.createElement("div");G.style.cssText="position:absolute; top:10px; right:10px; width:30px; height:30px; background:rgba(0,0,0,0.1); border-radius:15px; display:flex; justify-content:center; align-items:center; cursor:pointer; z-index:10;",G.innerHTML="\u2715",G.onclick=y,oe.appendChild(G)}pe.appendChild(oe),document.body.appendChild(pe),pe.addEventListener("click",function(G){G.target===pe&&y()}),o&&b()}function g(){!pe||!oe||u||(pe.style.visibility="visible",a?requestAnimationFrame(()=>{pe&&(pe.style.opacity="1"),oe&&(oe.style.transform="translateY(0)"),u=!0}):(pe&&(pe.style.opacity="1"),oe&&(oe.style.transform="translateY(0)"),u=!0),F("updateContainerConfigSync",{displayCapsuleButton:!1,webviewId:S.webviewId}))}function b(){if(!oe)return;let _=T=>{c=T.touches[0].clientY},I=T=>{if(!u)return;d=T.touches[0].clientY;let k=d-c;k>0&&(oe&&(oe.style.transition="none",oe.style.transform=`translateY(${k}px)`),T.preventDefault())},E=()=>{!u||!oe||(oe.style.transition=a?"transform 0.3s ease":"none",d-c>80?y():oe.style.transform="translateY(0)")};oe.addEventListener("touchstart",_),oe.addEventListener("touchmove",I),oe.addEventListener("touchend",E)}function y(){!pe||!oe||!u||(a?(oe.style.transform="translateY(100%)",pe.style.opacity="0"):pe.style.visibility="hidden",u=!1,F("updateContainerConfigSync",{displayCapsuleButton:!0,webviewId:S.webviewId}),setTimeout(()=>{pe&&(pe.remove(),pe=null,oe=null,Dt=null,s==null||s(),_e.emit("onModalIframeClosed",{url:r}))},f()))}return h(),{close:y}}function Xk(){return window.joliboxUI=B(P({},window.joliboxUI),{createIframeModal:R4}),()=>{window.joliboxUI=void 0,pe&&pe.parentNode&&pe.parentNode.removeChild(pe),oe&&oe.parentNode&&oe.parentNode.removeChild(oe),Dt&&Dt.parentNode&&Dt.parentNode.removeChild(Dt),pe=null,oe=null,Dt=null}}var P4,pe,oe,Dt,Zk=x(()=>{"use strict";ue();H();O();P4={height:"50%",showCloseButton:!0,enableDragClose:!0,useAnimation:!0},pe=null,oe=null,Dt=null});var ox,Nl,Nf,Dl,wi,ax,Si,sx,lx,cx,_i,ex,Ol,tx,O4,ux,Df,rx,dx,N4,nx,Of,px,ix,D4,fx,hx=x(()=>{ox=-1,Nl=function(e){addEventListener("pageshow",function(t){t.persisted&&(ox=t.timeStamp,e(t))},!0)},Nf=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Dl=function(){var e=Nf();return e&&e.activationStart||0},wi=function(e,t){var r=Nf(),n="navigate";return ox>=0?n="back-forward-cache":r&&(document.prerendering||Dl()>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}},ax=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){t(i.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},Si=function(e,t,r,n){var i,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=o,t.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(t.value,r),e(t))}},sx=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},lx=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},cx=function(e){var t=!1;return function(){t||(e(),t=!0)}},_i=-1,ex=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Ol=function(e){document.visibilityState==="hidden"&&_i>-1&&(_i=e.type==="visibilitychange"?e.timeStamp:0,O4())},tx=function(){addEventListener("visibilitychange",Ol,!0),addEventListener("prerenderingchange",Ol,!0)},O4=function(){removeEventListener("visibilitychange",Ol,!0),removeEventListener("prerenderingchange",Ol,!0)},ux=function(){return _i<0&&(_i=ex(),tx(),Nl(function(){setTimeout(function(){_i=ex(),tx()},0)})),{get firstHiddenTime(){return _i}}},Df=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},rx=[1800,3e3],dx=function(e,t){t=t||{},Df(function(){var r,n=ux(),i=wi("FCP"),o=ax("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-Dl(),0),i.entries.push(s),r(!0)))})});o&&(r=Si(e,i,rx,t.reportAllChanges),Nl(function(a){i=wi("FCP"),r=Si(e,i,rx,t.reportAllChanges),sx(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})},N4=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=cx(e),document.visibilityState==="hidden"?e():(r=t(e),lx(e)),r},nx=[2500,4e3],Of={},px=function(e,t){t=t||{},Df(function(){var r,n=ux(),i=wi("LCP"),o=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-Dl(),0),i.entries=[c],r())})},a=ax("largest-contentful-paint",o);if(a){r=Si(e,i,nx,t.reportAllChanges);var s=cx(function(){Of[i.id]||(o(a.takeRecords()),a.disconnect(),Of[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return N4(s)},{once:!0,capture:!0})}),lx(s),Nl(function(l){i=wi("LCP"),r=Si(e,i,nx,t.reportAllChanges),sx(function(){i.value=performance.now()-l.timeStamp,Of[i.id]=!0,r(!0)})})}})},ix=[800,1800],D4=function e(t){document.prerendering?Df(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},fx=function(e,t){t=t||{};var r=wi("TTFB"),n=Si(e,r,ix,t.reportAllChanges);D4(function(){var i=Nf();i&&(r.value=Math.max(i.responseStart-Dl(),0),r.entries=[i],n(!0),Nl(function(){r=wi("TTFB",0),(n=Si(e,r,ix,t.reportAllChanges))(!0)}))})}});var yx={};Jm(yx,{config:()=>V4});function q4(){$n.on("isAdShowing",e=>{Ul=e,Fr(Ul)&&S.mpType==="game"&&F("updateContainerConfigSync",{displayCapsuleButton:!Ul,webviewId:S.webviewId})})}function U4(){_e.on("onInterceptSystemExit",({intercept:e})=>{mx=e})}function M4(){_e.on("onInterceptBackPress",({intercept:e})=>{L4=e}),De("onBeforeBackPress",({uuid:e,disableExitRecommendDialog:t})=>{var r,n;vx(t),_e.emit("onBackPress",{}),(n=(r=globalThis.joliboxJSCore)==null?void 0:r.doBackPress)==null||n.call(r,e)})}function F4(){_e.on("onDocumentReady",()=>{var e;(e=globalThis.joliboxJSCore)==null||e.onDocumentReady(window.location.href),j("onDocumentReady",{start_timestamp:Fl,timestamp:Date.now()})})}function j4(){De("onI18nChanged",({language:e})=>{_e.emit("onI18nChanged",{i18n:e})})}function B4(e){S.mpType==="game"&&wt.start(e)}function G4(){De("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&S.onEnvConfigChanged({hostUserInfo:e}),_e.emit("LifecycleEvent.onReady",P({},S.hostUserInfo?S.hostUserInfo:{isLogin:!1})),j("joliboxServiceReady",{start_timestamp:Fl,timestamp:Date.now()}),B4(t),Ck(()=>S.language)}),De("onBeforeExit",({uuid:e,disableExitRecommendDialog:t})=>{var r;vx(t),(r=globalThis.joliboxJSCore)==null||r.doExit(e)})}function J4(){let e=()=>{j("onBeforeExit",{timestamp:Date.now()}),Ll==null||Ll(),ql==null||ql(),wt.close(Date.now()-Fl)},t=()=>Ul||mx;Pt.onDoExit(()=>v(this,null,function*(){return t()?!0:Fr(S.shouldInterupt)?(S.shouldInterupt||e(),S.shouldInterupt):Ml!=null&&Ml.canShowRecommended&&!gx&&(yield Yk())?!0:(e(),!1)})),Pt.onDoBackPress(()=>v(this,null,function*(){return!!t()}))}function H4(){dx(e=>{j("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),px(e=>{j("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),fx(e=>{j("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function $4(){return v(this,null,function*(){try{let e="/api/fe-configs/js-sdk/basic-meta",{response:{data:t}}=yield z(e);t&&(Ml=t)}catch(e){console.error("fetchMetaConfig error:",e)}})}function V4(){Fl=Date.now(),G4(),q4(),U4(),M4(),J4(),F4(),j4(),$4(),H4(),ql=Xk(),Ll=mv()}var Ll,ql,Fl,Ul,Ml,mx,L4,gx,vx,bx=x(()=>{"use strict";ue();H();O();bt();gv();ss();Qk();dt();ar();Zk();hx();Ul=!1,Ml=null,mx=!1,L4=!1,gx=!1,vx=e=>{Fr(e)&&(gx=e)};Pt.onReady(()=>{})});var _x,W4,z4,K4,Y4,wx=x(()=>{"use strict";O();He();ue();H();_x=W(),W4="env",z4="getSystemInfoSync",K4=Y(z4,{implement:()=>{var r;let e=F("envSync"),{data:t}=e;return{system:t.deviceInfo.system,platform:t.deviceInfo.platform.toLowerCase(),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,viewport:{statusBarHeight:S.viewport.statusBarHeight,navigationBarHeight:S.viewport.navigationBarHeight}}}}),Y4=Y(W4,{implement:()=>{var t;let e=F("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});_x.registerCommand("API.getSystemInfoSync",K4);_x.registerCommand("API.env",Y4);L("env",{version:"1.0.0"});L("getSystemInfoSync",{version:"1.0.0",properties:{viewport:"1.0.33"}})});var Sx=m(Lf=>{"use strict";O();He();yt();ue();bt();H();var Q4="exitGame",X4="onReady",Z4="onJoliboxShow",e$="onJoliboxHide",jl=W(),Bl=Bn(Ee),t$=ie(Q4,{paramsSchema:A.tuple(A.function(),A.boolean().optional().default(!1)),implement:(e,t=!1)=>v(Lf,null,function*(){Bl(e).call(Lf),Fr(S.shouldInterupt)&&!S.shouldInterupt&&S.from&&pg("onRetentionResult",{shouldStay:t},S.from,!0),t||S.setDoExitDirectly(),yield he("exitAppAsync")})}),r$=Y(Z4,{paramsSchema:A.tuple(A.function()),implement(e){let t=Bl(e);De("onJoliboxEnterForeground",()=>{t.call(this),io.emit("visible",!0)})}}),n$=Y(e$,{paramsSchema:A.tuple(A.function()),implement(e){let t=Bl(e);De("onJoliboxEnterBackground",()=>{t.call(this),io.emit("visible",!1)})}}),i$=Y(X4,{paramsSchema:A.tuple(A.function()),implement(e){let t=Bl(e);_e.on("LifecycleEvent.onReady",r=>{t(r)})}});jl.registerCommand("LifecycleSDK.exit",t$);jl.registerCommand("LifecycleSDK.onReady",i$);jl.registerCommand("LifecycleSDK.onJoliboxShow",r$);jl.registerCommand("LifecycleSDK.onJoliboxHide",n$);L("lifeCycle.exit",{version:"1.0.0"});L("lifeCycle.onReady",{version:"1.0.0"});L("lifeCycle.onJoliboxShow",{version:"1.0.0"});L("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function Ix(e){let t={};if(!cn(e))return t;for(let[r,n]of Object.entries(e)){let i=r.toLocaleLowerCase();n?typeof n=="object"?t[i]=Object.prototype.toString.call(n):t[i]=String(n):t[i]=""}return t}function Ex(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 Ax(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Cx(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!cn(r))return e;let[n,i=""]=e.split("?"),o=new URLSearchParams(i);for(let[s,l]of Object.entries(r))l!=null&&o.append(s,String(l));let a=o.toString();return a?`${n}?${a}`:n}var kx=x(()=>{"use strict";O()});var o$,a$,qf,Uf,xx,s$,l$,c$,Tx=x(()=>{"use strict";jr();Tu();He();kx();O();yt();H();o$=15,a$=ja("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:S.baseApiHost}),qf=0,Uf=[],xx=Bn(Ee),s$=(e,t)=>{let r=e.filter(t),n=e.filter(i=>!t(i));return e.length=0,e.push(...n),r},l$=e=>{let t=new ut,r=()=>{};return Y("request",{paramsSchema:A.tuple(A.object({url:A.string(),method:A.string(),headers:A.object().optional(),data:A.or(A.object(),A.array()).optional(),query:A.object().optional(),dataType:A.string().default("json"),responseType:A.string().default("text"),enableCache:A.boolean().default(!1),appendHostCookie:A.boolean().default(!0),timeout:A.number().default(3e4),success:A.function(),fail:A.function()})),implement(i){let o=()=>v(this,null,function*(){var s,l,c;let a=xx(i.fail);try{if(qf+=1,t.state!=="pending")return;let{data:d,dataType:u,responseType:p,enableCache:f,appendHostCookie:h}=i,g=Ix((s=i.headers)!=null?s:{}),b=Ex(i.method),y=Ax(i.timeout),_=Cx(i.url,b,d),I=xx(i.success),E=Object.assign({},i,{method:b,header:h?void 0:g,data:b==="GET"||b==="HEAD"?void 0:d,enableCache:f,query:(l=i.query)!=null?l:{},dataType:u,responseType:p,appendHostCookie:h});y&&(E.timeout=y);let T=a$(_,E);{let{response:k}=yield T,{code:C,data:G,message:ce}=k;if(G&&typeof G=="object"&&"status"in G&&G.status!==200)throw Je({code:G.status||-1,msg:`request:fail status ${G.status}`});t.resolve({code:C!=null?C:"SUCCESS",data:G,message:ce!=null?ce:"request:ok"}),I({code:"SUCCESS",message:"request:ok",data:G})}}catch(d){t.reject(d),a({code:"FAILURE",message:"httpRequst: failed"})}finally{qf-=1,(c=Uf.shift())==null||c()}});return qf>=o$?(r=()=>{s$(Uf,a=>a===o)},Uf.push(o)):o(),t.promise}})(e),{abort(){t.reject(Je({code:-1,msg:"request:fail abort"})),r()}}},c$=W();c$.registerCommand("HttpSDK.request",l$);L("request",{version:"1.0.0"})});var u$,d$,p$,Mf,Px=x(()=>{"use strict";O();ue();He();u$=Y("showKeyboard",{paramsSchema:A.tuple(A.object({defaultValue:A.string().optional().default(""),multiple:A.boolean().optional().default(!1),maxLength:A.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)),F("showKeyboardSync",B(P({},e),{defaultValue:r,maxLength:t}))}});L("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"}});d$=Y("updateKeyboard",{paramsSchema:A.tuple(A.object({value:A.string()})),implement(e){F("updateKeyboardSync",e)}});L("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});p$=Y("hideKeyboard",{implement(){F("hideKeyboardSync")}});L("keyboard.hideKeyboard",{version:"1.0.0"});Mf=W();Mf.registerCommand("KeyboardSDK.showKeyboard",u$);Mf.registerCommand("KeyboardSDK.updateKeyboard",d$);Mf.registerCommand("KeyboardSDK.hideKeyboard",p$)});var Rx=m(Gl=>{"use strict";O();He();bt();var Ff=W(),f$=ie("levelFinished",{paramsSchema:A.tuple(A.object({levelId:A.or(A.string(),A.number()),duration:A.number().optional(),rating:A.number().optional(),score:A.number().optional(),variation:A.string().optional()})),implement:e=>v(Gl,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e,a=[];a.push(wt.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})),a.push(wt.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}})),yield Promise.all(a)})}),h$=ie("gamePlayEnded",{paramsSchema:A.tuple(A.object({duration:A.number().optional(),rating:A.number().optional(),score:A.number(),variation:A.string().optional()})),implement:e=>v(Gl,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e,o=[];o.push(wt.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i})),o.push(wt.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})),yield Promise.all(o)})}),m$=ie("levelUpgrade",{paramsSchema:A.tuple(A.object({levelId:A.or(A.string(),A.number()),name:A.string().optional()})),implement:r=>v(Gl,[r],function*({levelId:e,name:t}){let n=[];n.push(wt.tracker("LevelUpgrade",{name:t,levelId:e})),n.push(wt.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})),yield Promise.all(n)})});Ff.registerCommand("TaskTrackerSDK.levelFinished",f$);Ff.registerCommand("TaskTrackerSDK.gamePlayEnded",h$);Ff.registerCommand("TaskTrackerSDK.levelUpgrade",m$);L("TaskTrackerSDK.onLevelFinished",{version:"1.1.25",properties:{params:{levelId:"1.1.25",duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});L("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});L("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}})});var jf,Bf,Gf,g$,Ox,Jl=x(()=>{"use strict";H();ue();He();O();jr();L("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"}});L("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0",isLogin:"1.0.0",isSubUser:"1.2.9"}});jf=new Map;De("onLoginStateChange",({isLogin:e,token:t,uuid:r,isFirstLogin:n,extra:i,appAccountToken:o})=>{let a=jf.get(r);a&&(a.resolve({isLogin:e,token:t,isFirstLogin:n,extra:i,appAccountToken:o}),jf.delete(r))});Bf=(e,t=!1)=>v(void 0,null,function*(){var h,g,b;let{data:{isLogin:r}}=yield he("checkLoginAsync");if(r)return{isLogin:!0,token:(h=S.hostUserInfo)==null?void 0:h.token};let{skipLogin:n,triggerFrom:i}=e!=null?e:{},o=F("loginSync",{skipLogin:n,triggerFrom:i}),{data:{uuid:a}}=o;if(!a)throw Je({code:-1,msg:"login failed"});let s=new ut;jf.set(a,s);let l=yield s.promise,c=F("envSync"),d=(b=(g=c==null?void 0:c.data)==null?void 0:g.hostUserInfo)==null?void 0:b.isSubUser;S.onEnvConfigChanged({hostUserInfo:B(P({},l),{isSubUser:d})});let y=l,{extra:u,appAccountToken:p}=y,f=Xe(y,["extra","appAccountToken"]);return _e.emit("onLoginComplete",f),t?l:f}),Gf=ie("login",{paramsSchema:A.tuple(A.object({skipLogin:A.boolean().optional(),triggerFrom:A.string().optional()}).optional()),implement(e){return v(this,null,function*(){return yield Bf(e!=null?e:{})})}}),g$=ie("checkSession",{implement(){return v(this,null,function*(){var r;let{data:{isLogin:e}}=yield he("checkLoginAsync"),t=(r=S.hostUserInfo)==null?void 0:r.isSubUser;return{isLogin:e,isSubUser:t}})}}),Ox=W();Ox.registerCommand("API.login",Gf);Ox.registerCommand("API.checkSession",g$)});var Nx,Dx=x(()=>{"use strict";Nx=e=>{let t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),n=r+24*60*60*1e3;return e.filter(i=>i>=r&&i<n)}});function An(e){return t=>v(this,null,function*(){var l;let{dailyMaxPopUps:r,minInterval:n}=t,i=yield Br(e);if(!i.data)return{canShow:!0,isFirst:!0};let o=Lx(i.data),a=Nx(o);if(r&&a.length>=r)return{canShow:!1,isFirst:!1};let s=Date.now();return console.log("todayFrequencies",a,n,s-a[0]),n&&s-((l=a==null?void 0:a[0])!=null?l:0)<n?{canShow:!1,isFirst:!1}:{canShow:!0,isFirst:!1}})}function Cn(e){return()=>v(this,null,function*(){var i;let t=Date.now(),r=yield Br(e),n=Lx((i=r.data)!=null?i:"[]");n.push(t),n.sort((o,a)=>a-o).splice(8),yield _t(e,JSON.stringify(n))})}var Lx,qx,Ux,Mx,Fx,jx,Bx,Gx,Jx,Hx,$x,Vx,Wx,zx,Kx,ta=x(()=>{"use strict";no();Dx();Lx=e=>{let t;try{t=JSON.parse(e)}catch(r){t=[]}return t};qx=An("joli_coin_use_modal_frequency"),Ux=An("joli_coin_payment_frequency"),Mx=An("joli_coin_unlogin_modal_frequency"),Fx=An("joli_gem_use_modal_frequency"),jx=An("joli_gem_payment_frequency"),Bx=An("joli_gem_unlogin_modal_frequency"),Gx=An("subscription_frequency");Jx=Cn("joli_coin_use_modal_frequency"),Hx=Cn("joli_coin_payment_frequency"),$x=Cn("joli_coin_unlogin_modal_frequency"),Vx=Cn("joli_gem_use_modal_frequency"),Wx=Cn("joli_gem_payment_frequency"),zx=Cn("joli_gem_unlogin_modal_frequency"),Kx=Cn("subscription_frequency")});var Jf,Hl,Hf=x(()=>{"use strict";dt();Jf=Promise.resolve(),Hl=(e,t)=>v(void 0,null,function*(){Jf=Jf.then(()=>v(void 0,null,function*(){yield z(t,{method:"POST",appendHostCookie:!0,data:{enableAutoDeduct:e}})})),yield Jf})});var $l,Vl,Ht,Wl,kn,$t,Cr,zl,Kl,xn,Ii,v$,M,kr,xr,Be=x(()=>{"use strict";O();$l="UNLOCK_OPTIONS_CHANGED",Vl="INVOKE_PAYMENT",Ht="ON_PAYMENT_RESULT",Wl="ON_USE_MODAL_EVENT",kn="ON_USE_MODAL_RESULT",$t="ON_USE_MODAL_FREQUENCY",Cr="ON_USE_UNLOGIN_MODAL_EVENT",zl="INVOKE_UNLOGIN_MODAL_EVENT",Kl="INVOKE_SUBSCRIPTION_EVENT",xn="ON_USE_SUBSCRIPTION_RESULT",Ii=new Kt,v$=()=>({on:Ii.on.bind(Ii),off:Ii.off.bind(Ii),emit:Ii.emit.bind(Ii)}),M=v$(),kr={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},xr={show:!0,minInterval:8*60*60*1e3}});function Ge(e,t){let r=null,n=null,i=null,o=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(a=>{n=a})};return o(),e.on(t,(...a)=>{let s=a[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||o(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,o(),r),updateData:a=>{if(i)return i=P(P({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}var sr=x(()=>{"use strict"});var Xx=m($f=>{"use strict";ta();Hf();Be();Be();ar();bt();O();sr();var y$={JOLI_COIN:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"unlock_popup_show",coinUnlock:"coin_unlock_click",adUnlock:"ad_unlock_click"},frequencyChecker:qx,frequencyUpdater:Jx,apiEndpointAutoDeduct:"/api/joli-coin/user-config"},JOLI_GEM:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"gem_unlock_popup_show",coinUnlock:"gem_unlock_click",adUnlock:"gem_ad_unlock_click"},frequencyChecker:Fx,frequencyUpdater:Vx,apiEndpointAutoDeduct:"/api/joli-gem/user-config"}},Yx=En(),Qx=Ge(M,$t);Qx.getData();M.on(Wl,(e,t)=>v($f,null,function*(){let r=t.currency,n=y$[r];if(e.includes("ADS-")){yield Yx.show({duration:3e3});let l=yield Qx.getData(),{canShow:c,isFirst:d}=yield n.frequencyChecker(l.joliCoinUseAndCharge[n.frequencyConfigKey]);console.log(`${r} modal show by frequency`,c,d),Yx.hide();let{balance:u}=t.userCurrency;if(u>=t.quantity&&t.enableAutoDeduct&&!d){M.emit(kn,{useModalResult:"CONFIRM"});return}if(!c){M.emit(kn,{useModalResult:"FAILED"});return}}j(n.trackEvents.popupShow,{eventType:V.View,targetType:"game",currency:r});let{userCurrency:i,enableAutoDeduct:o,quantity:a}=t,s=qk({data:{enableAutoDeduct:o,userCurrency:i,quantity:a,currency:r},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>{j(n.trackEvents.coinUnlock,{targetType:"game",eventType:V.Click,coinConsume:t.quantity,ifAutoUnlock:t.enableAutoDeduct,currency:r}),M.emit(kn,{useModalResult:"CONFIRM"}),s.destroy()}},cancel:{text:t.cancelButtonText,onPress:({type:l})=>{l==="FAILED"&&j(n.trackEvents.adUnlock,{targetType:"game",eventType:V.Click,currency:r}),M.emit(kn,{useModalResult:(l!=null?l:"")==="CANCEL"?"CANCEL":"FAILED"}),s.destroy()}},onEnableDeductChanged:l=>v($f,null,function*(){yield Hl(l,n.apiEndpointAutoDeduct)})}});yield n.frequencyUpdater()}))});function Zx(){let e=new Map;return{registerPaymentHandler(r,n){e.set(r,n)},invokePayment(r,...n){return v(this,null,function*(){let i=e.get(r);if(!i)return{code:"FAILED",message:`[joliboxSDK]: ${r} payment not supported in this platform`};try{return yield i(...n)}catch(o){return Ee(o),{code:"FAILED",message:`[joliboxSDK]: paymenterror ${o}`}}})}}}var eT=x(()=>{"use strict";yt()});var ra=x(()=>{"use strict"});var b$,Ei,Ct,_$,Tn,Yl=x(()=>{"use strict";ra();O();H();dt();b$=()=>{let[e,t]=[Ua,Ma].map(r=>(n,i,o)=>new r(n,i,o));return{createPaymentError:e,createPaymentInternalError:t}},{createPaymentError:Ei,createPaymentInternalError:Ct}=b$(),_$=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",Tn=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startPayment=t=>v(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw Ei(n,1001);return yield this.pay()});this.cancelOrder=t=>v(this,null,function*(){var n,i;let{response:r}=yield z(`/api/orders/${t}/cancel`,{method:"POST",data:{}});if(r.code!=="SUCCCESS")throw Ei((i=(n=r.message)!=null?n:r.errMsg)!=null?i:"",1003)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",S.deviceInfo.platform),t.set("joliSource",S.encodeJoliSourceQuery(P({},this.generatePaymentContext()))),`${_$}//payment/callback?${t.toString()}`}}get orderId(){return this._orderId}get status(){return this._orderStatus}}});var Wf,tT,rT=x(()=>{"use strict";dt();Yl();ra();Wf=class extends Tn{constructor(r){super();this.productId=r;this.generatePaymentContext=()=>({type:"JOLI_COIN_ORDER_CONTEXT",state:"TO_VALIDATE",productId:this.productId,orderId:this.orderId});this.pay=()=>v(this,null,function*(){let r=this.generateCallbackUrl();return console.info("callbackUrl",r),{code:"SUCCESS",message:"jolicoin payment success"}})}placeOrder(r){return v(this,null,function*(){var n,i,o,a;try{let{response:s}=yield z("/api/orders/checkout/joli-coin",{method:"POST",data:{productId:r.productId}});if(s.code!=="SUCCESS")throw Ei((i=(n=s.errMsg)!=null?n:s.message)!=null?i:"",1002);return{code:"SUCCESS",message:(o=s.message)!=null?o:"placeorder jolicoin success",data:s.data}}catch(s){throw console.info("[JoliboxSDK] placeorder failed",s),Ct((a=JSON.stringify(s))!=null?a:"jolicoin placeorder failed",1002)}})}},tT=()=>{let e=new Map;return t=>v(void 0,null,function*(){let r=e.get(t);return r||(r=new Wf(t),e.set(t,r)),yield r.startPayment({productId:t}),{code:"SUCCESS",message:"jolicoin payment success"}})}});var nT,iT=x(()=>{"use strict";nT={SUCCESS:"unlockSuccess",FAIL_NOT_LOGIN:"unlockFailedNotLogin",FAIL_PAYING:"unlockFailedPaying",FAIL_PRODUCT_EMPTY:"unlockFailedProductIdNotFound",FAIL_GET_PRODUCT_INFO:"unlockFailedProductInvalid",FAIL_LAUNCH_BILLING:"unlockFailedLaunch",FAIL_TRANSACTION:"unlockFailedTransaction",FAIL_VERIFY:"unlockFaileVerify",TRANSACTION_PENDING:"transactionPending",FAILED:"unlockFailed"}});var zf,oT,Kf,Yf,w$,Qf,aT=x(()=>{"use strict";dt();Yl();ra();ue();O();H();ar();iT();zf=new Map;De("onPaymentStateChange",e=>{console.info("onPaymentStateChange",e);let{orderUUID:t,status:r,totalAmount:n,orderResponse:i}=e,o=zf.get(t);if(o){if(r==="SUCCESS")o.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{totalAmount:n}});else{if(r==="FAILED"&&qa(i==null?void 0:i.errNo)&&(i==null?void 0:i.errNo)!==0)throw Ct(`jolicoin payment failed: ${i==null?void 0:i.errMsg}`,1002);let a=nT[r];a&&Ar(`{slot-error} {slot-i18n-jolicoin.${a}}`,{position:"center",duration:3e3}),o.resolve({code:"FAILED",message:"jolicoin payment failed"})}zf.delete(t)}});oT=e=>v(void 0,null,function*(){var n,i;let t=new ut,r;try{let o=yield he("requestPaymentSync",{paymentBody:{appStoreProductId:e.appStoreProductId,appAccountToken:e.appAccountToken}});if(r=(n=o.data)==null?void 0:n.orderUUID,console.info("---purchaseGem---",o),!r)throw Ct("orderUUID is null",1002);zf.set(r,t)}catch(o){throw Ct((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),Kf=class extends Tn{constructor(r,n){super();this.productId=r;this.appStoreProductId=n;this.generatePaymentContext=()=>({type:"JOLI_COIN_IAP_CONTEXT",state:"TO_VALIDATE",productId:this.productId,appStoreProductId:this.appStoreProductId});this.pay=()=>v(this,null,function*(){return yield oT({appStoreProductId:this.appStoreProductId})})}placeOrder(r){return v(this,null,function*(){return{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},Yf=class extends Tn{constructor(r,n){super();this.productId=r;this.appStoreProductId=n;this.generatePaymentContext=()=>({type:"JOLI_COIN_IAP_CONTEXT",state:"TO_VALIDATE",productId:this.productId,appStoreProductId:this.appStoreProductId});this.pay=()=>v(this,null,function*(){return yield oT({appStoreProductId:this.appStoreProductId,appAccountToken:this.appAccountToken})})}placeOrder(r){return v(this,null,function*(){var a;console.log("----start place order for ios----");let{response:n}=yield z("/api/orders/iap-init",{method:"GET",appendHostCookie:!0}),{data:i,code:o}=n!=null?n:{};if(console.log("----iap init----",i,o),i.code!=="SUCCESS")throw Ct("iap-init failed",1002);return this.appAccountToken=(a=i==null?void 0:i.data)==null?void 0:a.iapToken,{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},w$={android:Kf,ios:Yf},Qf=()=>{let e=new Map;return t=>v(void 0,null,function*(){let{productId:r,appStoreProductId:n}=t,i=e.get(r);if(!i){let s=w$[S.platform];if(!s)throw Ct("platform not supported",1002);i=new s(r,n),e.set(r,i)}let{code:o,message:a}=yield i.startPayment({productId:r,appStoreProductId:n});if(o!=="SUCCESS")throw Ei(a,1002);return{code:"SUCCESS",message:"jolicoin payment success"}})}});var Pn,Xf=x(()=>{"use strict";eT();rT();aT();Pn=Zx();Pn.registerPaymentHandler("JOLI_COIN",tT());Pn.registerPaymentHandler("JOLI_COIN_IAP",Qf());Pn.registerPaymentHandler("JOLI_GEM_IAP",Qf())});function sT(n,i){return v(this,arguments,function*(e,t,r={}){let{storageKeyPrefix:o="joli_cache_"}=r,a=o+e,s=a+"_timestamp";try{let l=yield t(),c=Date.now();try{l!=null&&(yield _t(a,l),yield _t(s,c.toString()),console.log("[Cache] Cached result for key:",e))}catch(d){console.warn("[Cache] Failed to save to localStorage for key:",e,d)}return l}catch(l){throw console.warn("[Cache] Executor failed for key:",e,l),l}})}function Ql(n,i){return v(this,arguments,function*(e,t,r={}){let{cacheDuration:o=-1,storageKeyPrefix:a="joli_cache_"}=r,s=a+e,l=s+"_timestamp",c=o===1/0||o===-1;try{let{data:d}=yield Br(s),{data:u}=yield Br(l);if(d&&u){let p=parseInt(u,10);if(c||Date.now()-p<o){console.log("[Cache] Using localStorage cached data for key:",e);let f=JSON.parse(d);return c||setTimeout(()=>v(this,null,function*(){try{console.log("[Cache] Background updating cache for key:",e);let h=yield t(),g=Date.now();yield _t(s,h),yield _t(l,g.toString()),console.log("[Cache] Background cache update completed for key:",e)}catch(h){console.warn("[Cache] Background cache update failed for key:",e,h)}}),0),f}else yield _t(s,null),yield _t(l,null)}}catch(d){console.warn("[Cache] Failed to read from localStorage for key:",e,d)}try{let d=yield t(),u=Date.now();try{d&&(yield _t(s,d),yield _t(l,u.toString()))}catch(p){console.warn("[Cache] Failed to save to localStorage for key:",e,p)}return d}catch(d){throw console.warn("[Cache] Executor failed for key:",e,d),d}})}var Zf=x(()=>{"use strict";no()});function S$(e,t){Object.keys(t).forEach(r=>{let n=e.paymentChoices.find(i=>i.appStoreProductId===r);n&&(n.totalAmountStr=t[r].price)}),e.paymentChoices=e.paymentChoices.filter(r=>!Xi(r.totalAmountStr))}var rn,eh,lr,ec,th,rh,Xl,Zl,lT,tc,nh=x(()=>{"use strict";Xf();O();ue();dt();O();Zf();rn=class rn{execute(t,r){return v(this,null,function*(){var a,s,l;let{response:n}=yield z(t,{method:"GET",appendHostCookie:!0,responseType:"json"});if(console.log("[PaymentService] get products info from server",t,n.data),!((a=n.data)!=null&&a.data))throw new Error("get products info failed");let i=n.data.data,o=(l=(s=i.paymentChoices)==null?void 0:s.filter(c=>typeof c.appStoreProductId=="string").map(c=>c.appStoreProductId))!=null?l:[];if(o.length>0){let c=yield this.getNativePriceData(o);c&&S$(i,c)}if(i.paymentChoices.length===0)throw new Error("paymentChoices is empty");return i})}getNativePriceData(t){return v(this,null,function*(){let r=t.sort().join(",");return Ql(r,()=>v(this,null,function*(){try{let{data:n}=yield he("requestProductDetailsAsync",{appStoreProductIds:t});return n&&(rn.nativePriceCache.set(r,n),rn.nativePriceCacheTimestamp.set(r,Date.now())),n}catch(n){throw console.warn("[PaymentService] Failed to fetch native product details:",n),n}}),{cacheDuration:rn.NATIVE_PRICE_CACHE_DURATION,storageKeyPrefix:"joli_native_price_"})})}extractCacheableData(t){return{paymentChoices:t.paymentChoices}}mergeData(t,r){return{balance:r.balance,enableAutoDeduct:r.enableAutoDeduct,paymentChoices:t.paymentChoices}}processCachedData(t){return{balance:0,enableAutoDeduct:!1,paymentChoices:t.paymentChoices}}static clearNativePriceCache(){this.nativePriceCache.clear(),this.nativePriceCacheTimestamp.clear(),console.log("[PaymentService] Cleared native price cache")}};rn.nativePriceCache=new Map,rn.NATIVE_PRICE_CACHE_DURATION=10*60*1e3,rn.nativePriceCacheTimestamp=new Map;eh=rn,lr=class lr extends Ft{constructor(r,n){super(new eh,{duration:10*60*1e3,timeout:3e3});this.apiEndpoint=r;this.paymentType=n}getProductsInfo(){return v(this,null,function*(){let r=lr.failureCounters.get(this.apiEndpoint)||0;if(r>=lr.MAX_FAILURE_COUNT)throw new Error(`getProductsInfo has failed more than ${lr.MAX_FAILURE_COUNT} times for ${this.apiEndpoint}`);try{let n=yield this.request(this.apiEndpoint);return lr.failureCounters.delete(this.apiEndpoint),n}catch(n){let i=r+1;throw lr.failureCounters.set(this.apiEndpoint,i),console.warn(`[PaymentService] getProductsInfo failed (${i}/${lr.MAX_FAILURE_COUNT+1}) for ${this.apiEndpoint}:`,n),n}})}purchase(r){return v(this,null,function*(){var a;let n=yield this.getProductsInfo(),i=(a=n==null?void 0:n.paymentChoices.find(s=>s.productId===r))==null?void 0:a.appStoreProductId;if(!i)throw new Error("appStoreProductId not found");return yield Pn.invokePayment(this.paymentType==="JOLI_COIN"?"JOLI_COIN_IAP":"JOLI_GEM_IAP",{productId:r,appStoreProductId:i})})}getProductsInfoWithBalance(){return v(this,null,function*(){return this.request(this.apiEndpoint)})}refreshProductsInfo(){return v(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}static resetFailureCounters(){this.failureCounters.clear()}static getFailureCount(r){return this.failureCounters.get(r)||0}};lr.failureCounters=new Map,lr.MAX_FAILURE_COUNT=2;ec=lr,th=class extends ec{constructor(){super("/api/joli-coin/balance-detail","JOLI_COIN")}},rh=class extends ec{constructor(){super("/api/joli-gem/balance-detail","JOLI_GEM")}},Xl=null,Zl=null,lT=()=>Xl||(Xl=new th,Xl),tc=()=>Zl||(Zl=new rh,Zl)});var dT=m(rc=>{"use strict";Be();ar();H();Jl();O();ta();Xf();ar();He();bt();Hf();sr();nh();var I$={JOLI_COIN:{frequencyConfigKey:"charge",trackEvents:{modalShow:"coinorder_show",orderClick:"coinorder_click",payEnsure:"order_pay_ensure",payResult:"order_pay_result",adUnlock:"ad_unlock_click"},frequencyChecker:Ux,frequencyUpdater:Hx,apiEndpoint:"/api/joli-coin/balance-detail",apiEndpointAutoDeduct:"/api/joli-coin/user-config",paymentType:"JOLI_COIN_IAP"},JOLI_GEM:{frequencyConfigKey:"charge",trackEvents:{modalShow:"gem_order_show",orderClick:"gem_order_click",payEnsure:"gem_pay_ensure",payResult:"gem_pay_result",adUnlock:"gem_ad_unlock_click"},frequencyChecker:jx,frequencyUpdater:Wx,apiEndpoint:"/api/joli-gem/balance-detail",apiEndpointAutoDeduct:"/api/joli-gem/user-config",paymentType:"JOLI_GEM_IAP"}},Ai=En(),cT=lT(),uT=tc(),E$=Ge(M,$t);M.on(Vl,(e,t)=>v(rc,null,function*(){var r,n,i;try{let o=t.currency,a=I$[o];if(!je("requestPaymentSync:paymentBody:appStoreProductId")){console.info("requestPaymentSync:paymentBody:appStoreProductId not supported"),setTimeout(()=>{M.emit(Ht,{paymentResult:"FAILED",currency:o})},0);return}if(e.includes("ADS-")){yield Ai.show({duration:3e3});let d=yield E$.getData(),{canShow:u}=yield a.frequencyChecker(d.joliCoinUseAndCharge[a.frequencyConfigKey]);if(console.log(`${o} payment show by frequency`,u),Ai.hide(),!u){M.emit(Ht,{paymentResult:"FAILED",currency:o});return}console.log("show by frequency")}yield Ai.show({duration:3e3});let s=o==="JOLI_COIN"?cT:uT,l=yield s.getProductsInfo();if(Ai.hide(),!l||!((r=l.paymentChoices)!=null&&r.length)){M.emit(Ht,{paymentResult:"FAILED",currency:o});return}j(a.trackEvents.modalShow,{targetType:"game",eventType:V.View,currency:o});let c=Uk({data:{userCurrency:t.userCurrency,quantity:t.quantity,currency:o,paymentChoices:(i=(n=l.paymentChoices)==null?void 0:n.map(d=>{var u;return B(P({},d),{totalAmountStr:(u=d.totalAmountStr)!=null?u:""})}))!=null?i:[],enableAutoDeduct:t.enableAutoDeduct},buttons:{confirm:{text:t.confirmButtonText,onPress:d=>v(rc,null,function*(){var f,h,g,b,y,_,I,E;if(j(a.trackEvents.payEnsure,{targetType:"game",eventType:V.Click,payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(h=(f=l.paymentChoices.find(T=>T.productId===d))==null?void 0:f.totalAmountStr)!=null?h:""}),!((g=S.hostUserInfo)!=null&&g.isLogin)){let{data:T}=yield Gf({skipLogin:!0});if(!(T!=null&&T.isLogin)){console.log("login failed");return}let k=yield s.refreshProductsInfo();if(((b=k==null?void 0:k.balance)!=null?b:0)>=t.quantity){M.emit(Ht,{paymentResult:"SUCCESS",currency:o}),c.destroy();return}}console.log("invokeNativePayment",d);let u=(_=(y=l==null?void 0:l.paymentChoices)==null?void 0:y.find(T=>T.productId===d))==null?void 0:_.appStoreProductId;if(!u){M.emit(Ht,{paymentResult:"FAILED",currency:o}),c.destroy();return}yield Ai.show({duration:3e3});let{code:p}=yield Pn.invokePayment(a.paymentType,{productId:d,appStoreProductId:u});if(Ai.hide(),j(a.trackEvents.payResult,{eventType:V.Other,targetType:"game",payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(E=(I=l.paymentChoices.find(T=>T.productId===d))==null?void 0:I.totalAmountStr)!=null?E:"",payResult:p}),p!=="SUCCESS"){console.info("[JoliboxSDK] payment failed in payment.invokePaymet");return}Ar("{slot-success} {slot-i18n-jolicoin.unlockSuccess}",{position:"center",duration:3e3}),M.emit(Ht,{paymentResult:"SUCCESS",currency:o}),c.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:d})=>{M.emit(Ht,{paymentResult:(d!=null?d:"")==="CANCEL"?"CANCEL":"FAILED",currency:o}),j(a.trackEvents.adUnlock,{targetType:"game",eventType:V.Click,currency:o}),c.destroy()}},onEnableDeductChanged:d=>v(rc,null,function*(){yield Hl(d,a.apiEndpointAutoDeduct)})},onSelect:d=>{var u,p;j(a.trackEvents.orderClick,{targetType:"game",eventType:V.Click,coinAmount:t.quantity,currency:o,orderPrice:(p=(u=l.paymentChoices.find(f=>f.productId===d))==null?void 0:u.totalAmountStr)!=null?p:""})}});yield a.frequencyUpdater()}catch(o){console.error("payment failed",o),M.emit(Ht,{paymentResult:"FAILED",currency:t.currency})}}));cT.getProductsInfo().catch(e=>{console.error("preload joli coin payment details failed",e)});uT.getProductsInfo().catch(e=>{console.error("preload joli gem payment details failed",e)})});var fT=m(nc=>{"use strict";Be();sr();ta();dt();yt();O();Jl();ar();bt();var A$={JOLI_COIN:{frequencyChecker:Mx,frequencyUpdater:$x,trackEvents:{modalExpose:"LoginGuideModal",clickConfirm:"LoginGuideModal",clickConfirmLogin:"LoginGuideModal",modalHide:"LoginGuideModal",clickClose:"LoginGuideModal",clickWatchAds:"LoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.rewardTips}",usedText:"Jolicoin Used"}},JOLI_GEM:{frequencyChecker:Bx,frequencyUpdater:zx,trackEvents:{modalExpose:"GemLoginGuideModal",clickConfirm:"GemLoginGuideModal",clickConfirmLogin:"GemLoginGuideModal",modalHide:"GemLoginGuideModal",clickClose:"GemLoginGuideModal",clickWatchAds:"GemLoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.gemRewardTips}",usedText:"Gem Used"}}},pT=Ge(M,$t);pT.getData();M.on(zl,(e,t)=>v(nc,null,function*(){var r;try{let n=t.currency,i=A$[n];if(e.includes("ADS-")){let s=yield pT.getData();if(console.log(`${n} unlogin guide config`,s.loginGuide),!s.loginGuide.show){M.emit(Cr,{result:"NOT_SUPPORT"});return}let{canShow:l}=yield i.frequencyChecker(s.loginGuide);if(console.log(`${n} canShowUseModal`,l),!l){M.emit(Cr,{result:"FAILED"});return}}let{firstLogin:o}=(r=yield C$())!=null?r:{};if(!(o!=null&&o.reward)){console.log("[JoliboxSDK] unlogin modal reward is empty"),M.emit(Cr,{result:"NOT_SUPPORT"});return}j(i.trackEvents.modalExpose,{eventType:V.Expose,currency:n},V.Expose);let a=Mk({data:{rewardType:e,rewardValue:o.reward.rewardValue,currency:t.currency},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>v(nc,null,function*(){var d,u,p,f;j(i.trackEvents.clickConfirm,{type:"click_confirm",eventType:V.Click,currency:n},V.Click);let{isLogin:s,extra:l,isFirstLogin:c}=yield Bf({},!0);if(!s){console.log("login failed");return}if(j(i.trackEvents.clickConfirmLogin,{type:"click_confirm_login",isFirstLogin:c,eventType:V.Click,currency:n},V.Click),c&&((d=l==null?void 0:l.firstLogin)!=null&&d.reward)){let{rewardValue:h}=l.firstLogin.reward;Ar(i.toastMessage.i18nKey,{i18nParams:{text:i.toastMessage.usedText,coin:h},position:"top",duration:3e3})}M.emit(Cr,{result:"SUCCESS",rewards:{claimedRewardValue:(f=(p=(u=l==null?void 0:l.firstLogin)==null?void 0:u.reward)==null?void 0:p.rewardValue)!=null?f:0,isFirstLogin:c!=null?c:!1,currency:t.currency}}),a.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:s})=>{j(i.trackEvents.modalHide,{eventType:V.Hide,currency:n},V.Hide);let l=s==="CANCEL"?"click_close":"click_watch_ads",c=s==="CANCEL"?i.trackEvents.clickClose:i.trackEvents.clickWatchAds;j(c,{type:l,eventType:V.Click,currency:n},V.Click),M.emit(Cr,{result:"FAILED"}),a.destroy()}}}});yield i.frequencyUpdater()}catch(n){Ee(new Cg(n)),M.emit(Cr,{result:"FAILED"})}}));var C$=()=>v(nc,null,function*(){var t;let{response:e}=yield z("/api/base/global-config",{method:"GET",appendHostCookie:!0,responseType:"json"});return(t=e.data)==null?void 0:t.data})});function k$(){let e=new Map;return{registerSubscriptionHandler(r,n){e.set(r,n)},invokeSubscription(r,...n){return v(this,null,function*(){let i=e.get(r);if(!i)return{code:"FAILED",message:`[joliboxSDK]: ${r} subscription not supported in this platform`};try{return yield i(...n)}catch(o){return Ee(o),{code:"FAILED",message:`[joliboxSDK]: subscription error ${o}`}}})}}}var na,ih=x(()=>{"use strict";yt();na=k$()});var Rn,ic=x(()=>{"use strict";Rn={PlaceOrderFailed:1001,CancelOrderFailed:1002,SubscriptionFailed:1003,InvalidPlan:1004}});var x$,hT,oc,T$,ia,oh=x(()=>{"use strict";ic();O();H();x$=()=>{let[e,t]=[Ua,Ma].map(r=>(n,i,o)=>new r(n,i,o));return{createSubscriptionError:e,createSubscriptionInternalError:t}},{createSubscriptionError:hT,createSubscriptionInternalError:oc}=x$(),T$=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",ia=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startSubscription=t=>v(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw hT(n,Rn.PlaceOrderFailed);return yield this.subscribe(t)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",S.deviceInfo.platform),t.set("joliSource",S.encodeJoliSourceQuery(P({},this.generateSubscriptionContext()))),`${T$}/subscription/callback?${t.toString()}`};this.createSubscriptionError=hT;this.createSubscriptionInternalError=oc}setOrderId(t){this._orderId=t}setOrderStatus(t){this._orderStatus=t}get orderId(){return this._orderId}get status(){return this._orderStatus}}});function P$(e,t){Object.keys(t).forEach(r=>{var i,o,a,s;let n=e.find(l=>l.appStoreProductId===r);n&&(n.amountStr=t[r].pricing.formattedPrice,n.originalAmountStr=t[r].pricing.originalPrice,n.discountPercentage=(o=(i=t[r].pricing.discountPercentage)==null?void 0:i.toString())!=null?o:"",n.trialDay=(s=(a=t[r].trial)==null?void 0:a.duration)!=null?s:0)}),e=e.filter(r=>!Xi(r.amountStr))}var On,sc,ah,sh,ac,mT,lh=x(()=>{"use strict";O();ue();dt();O();Zf();ih();ue();oh();ic();On=class On{static getNativePriceCache(t){var n;let r=t.sort().join(",");return(n=this.nativePriceCache.get(r))!=null?n:{}}execute(t,r){return v(this,null,function*(){var a,s;let{response:n}=yield z(t,{method:"GET",appendHostCookie:!0,responseType:"json"});if(!((a=n.data)!=null&&a.data))throw new Error("get subscription tiers failed");let i=n.data.data,o=(s=i==null?void 0:i.filter(l=>typeof l.appStoreProductId=="string").map(l=>l.appStoreProductId))!=null?s:[];if(o.length>0){let l=yield this.getNativePriceData(o);l&&P$(i,l)}if(i.length===0)throw new Error("subscription tiers is empty");return i})}requestNativeSubscriptionPlans(t,r){return v(this,null,function*(){try{let{data:n}=yield he("requestSubscriptionPlansAsync",{appStoreProductIds:t,type:"game"});return n&&(On.nativePriceCache.set(r,n),On.nativePriceCacheTimestamp.set(r,Date.now())),n}catch(n){throw console.warn("[SubscriptionService] Failed to fetch native subscription pricing:",n),n}})}getNativePriceData(t,r=!1){return v(this,null,function*(){let n=t.sort().join(",");return(r?sT:Ql)(n,()=>this.requestNativeSubscriptionPlans(t,n),{storageKeyPrefix:"joli_subscription_price_"})})}extractCacheableData(t){return{subscriptionTiers:t}}mergeData(){throw new Error("SubscriptionService does not support real-time data merging")}processCachedData(t){return t.subscriptionTiers}updateNativePriceCache(t){return v(this,null,function*(){yield this.getNativePriceData(t,!0),console.log("[SubscriptionService] Updated native price cache for products:",t)})}static clearNativePriceCache(){this.nativePriceCache.clear(),this.nativePriceCacheTimestamp.clear(),console.log("[SubscriptionService] Cleared native price cache")}};On.nativePriceCache=new Map,On.NATIVE_PRICE_CACHE_DURATION=1*24*60*60*1e3,On.nativePriceCacheTimestamp=new Map;sc=On,ah=class extends Ft{constructor(r){super(new sc,{duration:30*60*1e3,timeout:3e3});this.apiEndpoint=r;this.pendingSubscriptions=new Map;this.subInfoCacheKeys=[];this.listenSubscriptionPanelStateChange()}getSubInfo(){return v(this,null,function*(){var r;try{let n=yield this.request(this.apiEndpoint);return this.subInfoCacheKeys=(r=n==null?void 0:n.map(i=>{var o;return(o=i.appStoreProductId)!=null?o:""}))!=null?r:[],n}catch(n){throw console.warn(`[SubscriptionService] getSubInfo failed for ${this.apiEndpoint}:`,n),n}})}refreshSubInfo(){return v(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}updateNativePriceCache(r){return v(this,null,function*(){yield this.requestAdapter.updateNativePriceCache(r)})}updateAllNativePriceCache(){return v(this,null,function*(){try{this.subInfoCacheKeys.length>0&&(yield this.updateNativePriceCache(this.subInfoCacheKeys),this.forceRequest(this.apiEndpoint))}catch(r){throw console.warn("[SubscriptionService] Failed to update all native price cache:",r),r}})}subscribe(r){return v(this,null,function*(){var s;console.log("[SubscriptionService] subscribe params",na);let n=new AbortController,i=na.invokeSubscription("SUB_APP",{productId:r.nativeProductId,appStoreProductId:r.appStoreProductId,planId:r.basePlanId}),o=this.pollSubscriptionStatus(n.signal),a=yield Promise.race([i.then(l=>{var c;return n.abort(),{result:l.code,subPlanId:(c=l.data)==null?void 0:c.subPlanId,message:l.message}}),o.then(l=>(l==null?void 0:l.result)==="SUCCESS"?(n.abort(),l):new Promise(()=>{console.log("[SubscriptionPolling] Timeout for subscriptionService.subscribe completion")}))]);return{result:a.result,subPlanId:a.subPlanId,message:(s=a.message)!=null?s:""}})}pollSubscriptionStatus(r){return v(this,null,function*(){var o,a;for(let s=0;s<10;s++){if(r.aborted){console.log("[SubscriptionPolling] Aborted due to subscribe completion");return}try{let{response:l}=yield z("/api/subs/info",{method:"GET",appendHostCookie:!0,responseType:"json"});if(((a=(o=l.data)==null?void 0:o.data)==null?void 0:a.status)==="ACTIVE")return{result:"SUCCESS",subPlanId:l.data.data.subPlanId,message:"Subscription activated via polling"}}catch(l){console.warn(`[SubscriptionPolling] Attempt ${s+1} failed:`,l)}s<9&&!r.aborted&&(yield La(5e3))}})}invokeSubscriptionPanel(){return v(this,null,function*(){var i,o;let r=new ut,n;try{if(console.log("[invokeSubscriptionPanel] requestSubscriptionSync params"),n=(i=F("invokeSubscriptionPanelSync",{type:"game"}).data)==null?void 0:i.subUUID,!n)throw oc("orderUUID is null",Rn.SubscriptionFailed);this.pendingSubscriptions.set(n,r)}catch(a){throw oc((o=JSON.stringify(a))!=null?o:"subscription panel failed",Rn.SubscriptionFailed)}return r.promise})}getTierByProductId(r){return v(this,null,function*(){var s;let n=yield this.getSubInfo(),i=n==null?void 0:n.find(l=>l.productId===r);if(!i)return;let o=sc.getNativePriceCache((n!=null?n:[]).map(l=>{var c;return(c=l.appStoreProductId)!=null?c:""}));if(!o)return;let a=o[(s=i.appStoreProductId)!=null?s:""];if(a)return console.log("[SubscriptionService] getTierByProductId nativeSubInfo",a),{nativeProductId:a.productId,appStoreProductId:i.appStoreProductId,basePlanId:a.basePlanId}})}listenSubscriptionPanelStateChange(){De("onSubscriptionPanelStateChange",r=>{var i;console.log("[onSubscriptionPanelStateChange] data",r);let n=this.pendingSubscriptions.get(r.subUUID);n&&(r.status==="SUCCESS"?n.resolve({code:"SUCCESS",message:"subscription panel success",data:{result:"SUCCESS",subPlanId:(i=r.orderResponse)==null?void 0:i.subPlanId}}):n.resolve({code:"FAILED",message:"subscription panel failed",data:{result:"FAILED"}}))})}},sh=class extends ah{constructor(){super("/api/subs/pricing")}},ac=null,mT=()=>ac||(ac=new sh,ac)});var gT=x(()=>{"use strict"});function yT(){let e=new Map;return t=>v(this,null,function*(){console.log("[SubAppSubscriptionHandler] createSubAppSubscriptionHandler params",t);let{productId:r,planId:n}=t,i=`${r}_${n}`,o=e.get(i);if(!o){console.log("[SubAppSubscriptionHandler] createSubAppSubscriptionHandler instance not found",i);let a=R$[S.platform];if(!a)throw new Error(`Platform ${S.platform} not supported for sub-app subscription`);o=new a(r,n),e.set(i,o)}return o.startSubscription({basePlanId:n,appStoreProductId:t.appStoreProductId,productId:r})})}var ch,vT,uh,dh,R$,bT=x(()=>{"use strict";H();oh();ra();Yl();O();ue();O();ic();De("onGlobalSubscriptionStateChange",e=>{let{status:t,orderResponse:r}=e;console.log("[onGlobalSubscriptionStateChange] data",e),t==="SUCCESS"&&(r!=null&&r.subPlanId||r!=null&&r.ticketId)&&S.onEnvConfigChanged({hostUserInfo:{isLogin:!0,isSubUser:!0}})});ch=new Map;De("onSubscritptionStateChange",e=>{var o,a,s;let{subUUID:t,status:r,orderResponse:n}=e;console.log("[onSubscritptionStateChange] data",e);let i=ch.get(t);if(i){if(r==="SUCCESS")console.log("=======onSubscritptionStateChange",r,(o=n==null?void 0:n.subPlanId)!=null?o:n==null?void 0:n.ticketId),i.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{subPlanId:(a=n==null?void 0:n.subPlanId)!=null?a:n==null?void 0:n.ticketId}});else{if(r==="FAILED"&&qa(n==null?void 0:n.errNo)&&(n==null?void 0:n.errNo)!==0)throw Ct(`subscription failed: ${n==null?void 0:n.errMsg}`,Rn.SubscriptionFailed);i.resolve({code:r,message:(s=n==null?void 0:n.errMsg)!=null?s:"UNKNOWN_ERROR"})}ch.delete(t)}});vT=e=>v(void 0,null,function*(){var n,i;let t=new ut,r;try{if(console.log("[internalSubscribe] requestSubscriptionSync params",e),r=(n=F("requestSubscriptionSync",P({params:{basePlanId:e.basePlanId,appStoreProductId:e.appStoreProductId,productId:e.productId}},e.appAccountToken?{paymentBody:{appAccountToken:e.appAccountToken,appStoreProductId:e.appStoreProductId}}:{})).data)==null?void 0:n.subUUID,!r)throw Ct("subUUID is null",1002);ch.set(r,t)}catch(o){throw Ct((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),uh=class extends ia{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return v(this,null,function*(){return{code:"SUCCESS",message:"Android subscription order placed locally"}})}cancelOrder(r){return Promise.resolve({code:"SUCCESS",message:"Android order cancelled locally",data:void 0})}generateSubscriptionContext(){return{gameId:S.mpId,productId:this.productId,planId:this.planId}}subscribe(r){return v(this,null,function*(){return yield vT(r)})}},dh=class extends ia{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return v(this,null,function*(){var o,a;console.log("----start place order for iOS subscription----");let n=F("envSync"),i=(a=(o=n==null?void 0:n.data)==null?void 0:o.hostUserInfo)==null?void 0:a.appAccountToken;if(!i)throw Ct("appAccountToken is null",1002);return this.subscriptionToken=i,{code:"SUCCESS",message:"placeorder sub-app success in native"}})}cancelOrder(r){return v(this,null,function*(){return Promise.resolve({code:"SUCCESS",message:"Android order cancelled locally",data:void 0})})}generateSubscriptionContext(){return{gameId:S.mpId,productId:this.productId,planId:this.planId}}subscribe(r){return v(this,null,function*(){return yield vT(B(P({},r),{appAccountToken:this.subscriptionToken}))})}},R$={android:uh,ios:dh}});var Nn,ph=x(()=>{"use strict";lh();gT();ih();bT();lh();Nn=mT();na.registerSubscriptionHandler("SUB_APP",yT())});var IT=m(ST=>{"use strict";ta();Be();sr();He();ph();ar();var O$={SUBSCRIPTION:{frequencyConfigKey:"joinMember",frequencyChecker:Gx,frequencyUpdater:Kx}},_T=En(),wT=Ge(M,$t);wT.getData();M.on(Kl,e=>v(ST,null,function*(){let t=O$.SUBSCRIPTION;if(!je("invokeSubscriptionPanelSync")){console.info("invokeSubscriptionPanelSync not supported"),setTimeout(()=>{M.emit(xn,{result:"FAILED"})},0);return}yield _T.show({duration:3e3});let r=yield wT.getData(),{canShow:n,isFirst:i}=yield t.frequencyChecker(r.joliCoinUseAndCharge[t.frequencyConfigKey]);if(_T.hide(),!n){M.emit(xn,{result:"FAILED"});return}let{data:o,code:a}=yield Nn.invokeSubscriptionPanel();a=="SUCCESS"?M.emit(xn,{result:"SUCCESS"}):M.emit(xn,{result:"FAILED"}),yield t.frequencyUpdater()}))});var loe,coe,uoe,doe,ET=x(()=>{"use strict";loe=se(Xx()),coe=se(dT()),uoe=se(fT()),doe=se(IT())});function V$(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function W$(e){return typeof e=="string"}function z$(e){return typeof e=="undefined"}function K$(e){return z$(e)||e===null}function Y$(e){return typeof e=="function"}function cP(e){let t=e,r=null,n=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function oa(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function pc(e,t){return t.map(r=>{if(r==="params"&&e[r]){let n=e[r];return Object.keys(n).reduce((i,o)=>(i[o]=String(n[o]),i),{})}return e[r]})}function nV(e){let t=e.location?pc(e.location,PT):null,r=e.target?pc(e.target,PT):null;return pc(J$(G$({},e),{location:t,target:r}),tV)}function iV(e){let t=e.events.map(n=>nV(n)),r=pc(e.device,rV);return[e.protocolVersion,t,r,e.project]}function oV(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function uV(e){return new Promise(t=>fP(e)(t))}function fP(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function dV(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new ha(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}function fV(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)hV(e[n],t[n])}function hV(e,t){if(W$(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Y$(t)){try{if(e instanceof t)return}catch(r){}if(!K$(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 ht(e,t,r){return(t=mV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mV(e){var t=gV(e,"string");return typeof t=="symbol"?t:t+""}function gV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lc(e,t,r){return(t=vV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vV(e){var t=yV(e,"string");return typeof t=="symbol"?t:t+""}function yV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function cc(e,t,r){return(t=bV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bV(e){var t=_V(e,"string");return typeof t=="symbol"?t:t+""}function _V(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Tr(e,t,r){return(t=wV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wV(e){var t=SV(e,"string");return typeof t=="symbol"?t:t+""}function SV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IV(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function EV(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}function PV(e,t){return Ke(e,0)^45?(((t<<2^Ke(e,0))<<2^Ke(e,1))<<2^Ke(e,2))<<2^Ke(e,3):0}function gP(e){return e.trim()}function RV(e,t){return(e=t.exec(e))?e[0]:e}function te(e,t,r){return e.replace(t,r)}function Lh(e,t){return e.indexOf(t)}function Ke(e,t){return e.charCodeAt(t)|0}function ma(e,t,r){return e.slice(t,r)}function cr(e){return e.length}function um(e){return e.length}function uc(e,t){return t.push(e),e}function OV(e,t){return e.map(t).join("")}function Pc(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:Tc,column:Ni,length:a,return:""}}function sa(e,t){return TV(Pc("",null,null,"",null,null,0),e,{length:-e.length},t)}function NV(){return Oe}function DV(){return Oe=gt>0?Ke(Li,--gt):0,Ni--,Oe===10&&(Ni=1,Tc--),Oe}function xt(){return Oe=gt<vP?Ke(Li,gt++):0,Ni++,Oe===10&&(Ni=1,Tc++),Oe}function ur(){return Ke(Li,gt)}function fc(){return gt}function ya(e,t){return ma(Li,e,t)}function ga(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function yP(e){return Tc=Ni=1,vP=cr(Li=e),gt=0,[]}function bP(e){return Li="",e}function hc(e){return gP(ya(gt-1,qh(e===91?e+2:e===40?e+1:e)))}function LV(e){for(;(Oe=ur())&&Oe<33;)xt();return ga(e)>2||ga(Oe)>3?"":" "}function qV(e,t){for(;--t&&xt()&&!(Oe<48||Oe>102||Oe>57&&Oe<65||Oe>70&&Oe<97););return ya(e,fc()+(t<6&&ur()==32&&xt()==32))}function qh(e){for(;xt();)switch(Oe){case e:return gt;case 34:case 39:e!==34&&e!==39&&qh(Oe);break;case 40:e===41&&qh(e);break;case 92:xt();break}return gt}function UV(e,t){for(;xt()&&e+Oe!==57&&!(e+Oe===84&&ur()===47););return"/*"+ya(t,gt-1)+"*"+xc(e===47?e:xt())}function MV(e){for(;!ga(ur());)xt();return ya(e,gt)}function FV(e){return bP(mc("",null,null,null,[""],e=yP(e),0,[0],e))}function mc(e,t,r,n,i,o,a,s,l){for(var c=0,d=0,u=a,p=0,f=0,h=0,g=1,b=1,y=1,_=0,I="",E=i,T=o,k=n,C=I;b;)switch(h=_,_=xt()){case 40:if(h!=108&&Ke(C,u-1)==58){Lh(C+=te(hc(_),"&","&\f"),"&\f")!=-1&&(y=-1);break}case 34:case 39:case 91:C+=hc(_);break;case 9:case 10:case 13:case 32:C+=LV(h);break;case 92:C+=qV(fc()-1,7);continue;case 47:switch(ur()){case 42:case 47:uc(jV(UV(xt(),fc()),t,r),l);break;default:C+="/"}break;case 123*g:s[c++]=cr(C)*y;case 125*g:case 59:case 0:switch(_){case 0:case 125:b=0;case 59+d:y==-1&&(C=te(C,/\f/g,"")),f>0&&cr(C)-u&&uc(f>32?NT(C+";",n,r,u-1):NT(te(C," ","")+";",n,r,u-2),l);break;case 59:C+=";";default:if(uc(k=OT(C,t,r,c,d,i,s,I,E=[],T=[],u),o),_===123)if(d===0)mc(C,t,k,k,E,o,u,s,T);else switch(p===99&&Ke(C,3)===110?100:p){case 100:case 108:case 109:case 115:mc(e,k,k,n&&uc(OT(e,k,k,0,0,i,s,I,i,E=[],u),T),i,T,u,s,n?E:T);break;default:mc(C,k,k,k,[""],T,0,s,T)}}c=d=f=0,g=y=1,I=C="",u=a;break;case 58:u=1+cr(C),f=h;default:if(g<1){if(_==123)--g;else if(_==125&&g++==0&&DV()==125)continue}switch(C+=xc(_),_*g){case 38:y=d>0?1:(C+="\f",-1);break;case 44:s[c++]=(cr(C)-1)*y,y=1;break;case 64:ur()===45&&(C+=hc(xt())),p=ur(),d=u=cr(I=C+=MV(fc())),_++;break;case 45:h===45&&cr(C)==2&&(g=0)}}return o}function OT(e,t,r,n,i,o,a,s,l,c,d){for(var u=i-1,p=i===0?o:[""],f=um(p),h=0,g=0,b=0;h<n;++h)for(var y=0,_=ma(e,u+1,u=xV(g=a[h])),I=e;y<f;++y)(I=gP(g>0?p[y]+" "+_:te(_,/&\f/g,p[y])))&&(l[b++]=I);return Pc(e,t,r,i===0?lm:s,l,c,d)}function jV(e,t,r){return Pc(e,t,r,hP,xc(NV()),ma(e,2,-2),0)}function NT(e,t,r,n){return Pc(e,t,r,cm,ma(e,0,n),ma(e,n+1,-1),n)}function Ri(e,t){for(var r="",n=um(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function BV(e,t,r,n){switch(e.type){case kV:if(e.children.length)break;case CV:case cm:return e.return=e.return||e.value;case hP:return"";case mP:return e.return=e.value+"{"+Ri(e.children,n)+"}";case lm:e.value=e.props.join(",")}return cr(r=Ri(e.children,n))?e.return=e.value+"{"+r+"}":""}function GV(e){var t=um(e);return function(r,n,i,o){for(var a="",s=0;s<t;s++)a+=e[s](r,n,i,o)||"";return a}}function JV(e){return function(t){t.root||(t=t.return)&&e(t)}}function HV(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}function _P(e,t){switch(PV(e,t)){case 5103:return ee+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return ee+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return ee+e+_c+e+it+e+e;case 6828:case 4268:return ee+e+it+e+e;case 6165:return ee+e+it+"flex-"+e+e;case 5187:return ee+e+te(e,/(\w+).+(:[^]+)/,ee+"box-$1$2"+it+"flex-$1$2")+e;case 5443:return ee+e+it+"flex-item-"+te(e,/flex-|-self/,"")+e;case 4675:return ee+e+it+"flex-line-pack"+te(e,/align-content|flex-|-self/,"")+e;case 5548:return ee+e+it+te(e,"shrink","negative")+e;case 5292:return ee+e+it+te(e,"basis","preferred-size")+e;case 6060:return ee+"box-"+te(e,"-grow","")+ee+e+it+te(e,"grow","positive")+e;case 4554:return ee+te(e,/([^-])(transform)/g,"$1"+ee+"$2")+e;case 6187:return te(te(te(e,/(zoom-|grab)/,ee+"$1"),/(image-set)/,ee+"$1"),e,"")+e;case 5495:case 3959:return te(e,/(image-set\([^]*)/,ee+"$1$`$1");case 4968:return te(te(e,/(.+:)(flex-)?(.*)/,ee+"box-pack:$3"+it+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ee+e+e;case 4095:case 3583:case 4068:case 2532:return te(e,/(.+)-inline(.+)/,ee+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(cr(e)-1-t>6)switch(Ke(e,t+1)){case 109:if(Ke(e,t+4)!==45)break;case 102:return te(e,/(.+:)(.+)-([^]+)/,"$1"+ee+"$2-$3$1"+_c+(Ke(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Lh(e,"stretch")?_P(te(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ke(e,t+1)!==115)break;case 6444:switch(Ke(e,cr(e)-3-(~Lh(e,"!important")&&10))){case 107:return te(e,":",":"+ee)+e;case 101:return te(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ee+(Ke(e,14)===45?"inline-":"")+"box$3$1"+ee+"$2$3$1"+it+"$2box$3")+e}break;case 5936:switch(Ke(e,t+11)){case 114:return ee+e+it+te(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ee+e+it+te(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ee+e+it+te(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ee+e+it+e+e}return e}function ZV(e){for(var t=0,r,n=0,i=e.length;i>=4;++n,i-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}function wc(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var i=r;if(i.anim===1)return nn={name:i.name,styles:i.styles,next:nn},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)nn={name:a.name,styles:a.styles,next:nn},a=a.next;var s=o.styles+";";return s}return n9(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function n9(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=wc(e,t,r[i])+";";else for(var o in r){var a=r[o];if(typeof a!="object"){var s=a;t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":LT(s)&&(n+=hh(o)+":"+qT(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var l=0;l<a.length;l++)LT(a[l])&&(n+=hh(o)+":"+qT(o,a[l])+";");else{var c=wc(e,t,a);switch(o){case"animation":case"animationName":{n+=hh(o)+":"+c+";";break}default:n+=o+"{"+c+"}"}}}return n}function mh(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,i="";nn=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=wc(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=wc(r,t,e[s]),n){var l=o;i+=l[s]}UT.lastIndex=0;for(var c="",d;(d=UT.exec(i))!==null;)c+="-"+d[1];var u=ZV(i)+c;return{name:u,styles:i,next:nn}}function SP(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}function MT(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function FT(e,t,r){var n=[],i=SP(e,n,r);return n.length<2?r:i+t(n)}function c9(e,t){Me.__h&&Me.__h(kt,e,BT||t),BT=0;var r=kt.__H||(kt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function EP(e,t){var r=c9(Uh++,7);return p9(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function u9(){for(var e;e=IP.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(gc),e.__H.__h.forEach(Mh),e.__H.__h=[]}catch(t){e.__H.__h=[],Me.__e(t,e.__v)}}function d9(e){var t,r=function(){clearTimeout(n),zT&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);zT&&(t=requestAnimationFrame(r))}function gc(e){var t=kt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),kt=t}function Mh(e){var t=kt;e.__c=e.__(),kt=t}function p9(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Rc(){if(on>1)on--;else{for(var e,t=!1;da!==void 0;){var r=da;for(da=void 0,Fh++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&CP(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Fh=0,on--,t)throw e}}function Ye(e){if(on>0)return e();on++;try{return e()}finally{Rc()}}function AP(e){if(le!==void 0){var t=e.n;if(t===void 0||t.t!==le)return t={i:0,S:e,p:le.s,n:void 0,t:le,e:void 0,x:void 0,r:t},le.s!==void 0&&(le.s.n=t),le.s=t,e.n=t,32&le.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=le.s,t.n=void 0,le.s.n=t,le.s=t),t}}function Qe(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function $(e){return new Qe(e)}function CP(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function kP(e){for(var t=e.s;t!==void 0;t=t.n){var r=t.S.n;if(r!==void 0&&(t.r=r),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function xP(e){for(var t=e.s,r=void 0;t!==void 0;){var n=t.p;t.i===-1?(t.S.U(t),n!==void 0&&(n.n=t.n),t.n!==void 0&&(t.n.p=n)):r=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=n}e.s=r}function qi(e){Qe.call(this,void 0),this.x=e,this.s=void 0,this.g=Sc-1,this.f=4}function pa(e){return new qi(e)}function TP(e){var t=e.u;if(e.u=void 0,typeof t=="function"){on++;var r=le;le=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,dm(e),n}finally{le=r,Rc()}}}function dm(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,TP(e)}function h9(e){if(le!==this)throw new Error("Out-of-order effect");xP(this),le=e,this.f&=-2,8&this.f&&dm(this),Rc()}function ba(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function _a(e){var t=new ba(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function Ui(e,t){q[e]=t.bind(null,q[e]||function(){})}function Ic(e){vh&&vh(),vh=e&&e.S()}function OP(e){var t=this,r=e.data,n=NP(r);n.value=r;var i=EP(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=pa(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""}),d=pa(function(){return!Array.isArray(c.value)&&!Gu(c.value)}),u=_a(function(){if(this.N=DP,d.value){var f=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),p=t.__$u.d;return t.__$u.d=function(){u(),p.call(this)},[d,c]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}function m9(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=$(r);return{o:function(a,s){o.value=a,n=s},d:_a(function(){this.N=DP;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}function NP(e){return EP(function(){return $(e)},[])}function v9(){Ye(function(){for(var e;e=RP.shift();)PP.call(e)})}function DP(){RP.push(this)===1&&(q.requestAnimationFrame||g9)(v9)}function y9(e,t){let r=ii(e);ni(()=>{r.current=e},[e]),yn(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}function K(e,t,r,n,i,o){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--b9,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return q.vnode&&q.vnode(c),c}function Pr(e,t,r){return(t=R9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R9(e){var t=O9(e,"string");return typeof t=="symbol"?t:t+""}function O9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function lt(e,t,r){return(t=H9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H9(e){var t=$9(e,"string");return typeof t=="symbol"?t:t+""}function $9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rr(e,t,r){return(t=K9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function K9(e){var t=Y9(e,"string");return typeof t=="symbol"?t:t+""}function Y9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function nt(e,t,r){return(t=Q9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Q9(e){var t=X9(e,"string");return typeof t=="symbol"?t:t+""}function X9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function mt(e,t,r){return(t=Z9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z9(e){var t=eW(e,"string");return typeof t=="symbol"?t:t+""}function eW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Dn(e,t,r){return(t=tW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tW(e){var t=rW(e,"string");return typeof t=="symbol"?t:t+""}function rW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function yh(e,t,r){return(t=nW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nW(e){var t=iW(e,"string");return typeof t=="symbol"?t:t+""}function iW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ct(e,t,r){return(t=oW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function oW(e){var t=aW(e,"string");return typeof t=="symbol"?t:t+""}function aW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pW(e){return!!(e!=null&&e.__nativeBuffers__)}function Yh(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!pW(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 i;n.value?i=n.value:n.base64&&(i=fW(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function mW(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=e,n=[];for(let[i,o]of Object.entries(r))if(o!==void 0&&o instanceof ArrayBuffer&&o.byteLength!==void 0){let a=t?{value:o,key:i}:{base64:hW(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function bW(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function FP(e){return typeof e=="string"}function Oi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function QT(e){return typeof e=="number"&&!isNaN(e)}function wW(e){return typeof e=="undefined"}function SW(e){return wW(e)||e===null}function jP(e){return typeof e=="function"}function IW(e){return Oi(e)&&jP(e.then)}function BP(e){let t=e,r=null,n=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return r||(r=new t(...o)),r};return n.prototype=t.prototype,n}function la(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function PW(e,t,r){let n=e;for(let i of t)if(n&&typeof n=="object")n=n[i];else return r;return n===void 0?r:n}function LW(){if(typeof window=="undefined")return{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{},length:0,key:()=>null};try{if(window.__joliboxLocalStorage__)return window.__joliboxLocalStorage__;let e=Object.getOwnPropertyDescriptor(window,"localStorage");if(e&&e.get){let n=e.get.call(window);return window.__joliboxLocalStorage__=n,n}if(e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(window),"localStorage"),e&&e.get)return e.get.call(window);let t=Window.prototype,r=Object.getOwnPropertyDescriptor(t,"localStorage");if(r&&r.get){let n=r.get.call(window);return window.__joliboxLocalStorage__=n,n}return localStorage}catch(e){return console.warn("Failed to get original localStorage, fallback to default implementation",e),localStorage}}function jW(e){return new Promise(t=>GP(e)(t))}function GP(e){return function(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function BW(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new va(n);return i.event})(function(r){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;return e(i=>t(i)&&r.call(n,i),null)})}function JW(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)HW(e[n],t[n])}function HW(e,t){if(FP(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(jP(t)){try{if(e instanceof t)return}catch(r){}if(!SW(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 Lt(e,t){if(Xh.config[e]){Nc.warn(`[can i use] ${e} already registered`);return}Xh.config[e]=Lr({},t)}function eP(e,t){return`[${e}]:${t}`}function XW(e,t){tP||(wh=new yc({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Sh=new yc({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ih=new yc({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{wh.flush(),Sh.flush(),Ih.flush()}),tP=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:h,invokeCallback:g}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";wh.report({status:b,method:n(s,l),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-c}),c&&h&&g&&(Sh.report({status:b,method:s,isForeground:d,duration:Number((h-c).toFixed(3))}),Ih.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-g).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function tz(e,t){let r=0,n=!0,i=ez.resolveMap,o=XW(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Eh.forEach(l=>Cc(this,[l],function(c){let{method:d,args:u,resolve:p}=c;return function*(){let f=yield s(d,u);p(f)}()})),Eh.length=0});let a=(l,c)=>{let d=i.get(Number(l));if(!d)return;let u=Yh(c);d(u),i.delete(Number(l))},s=(l,c)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let h=new _W;if(i.set(r,h.resolve),!n&&zW.includes(l))return new Promise(E=>{Eh.push({method:l,args:c,resolve:E})});let g=uW(Lr({},{method:l,startTime:p,args:c,isForeground:f}),{invokeType:"js-bridge"}),b=WW.includes(l),y=mW(c,b),_=b?y:JSON.stringify(y),I;if(l.endsWith("Sync")||KW.includes(l)?I=(d=e.call)==null?void 0:d.call(e,l,y,r):typeof _=="string"?I=e.invoke(l,_,r):I=(u=e.call)==null?void 0:u.call(e,l,_,r),I){try{typeof I=="string"&&(I=JSON.parse(I)),I=Yh(I)}catch(E){Nc.error(E)}return i.delete(r),I.errorCode&&(I.errorCode=eP(l,I.errorCode)),o(Lr(Lr({},g),I)),I}return l.endsWith("Sync")&&i.delete(r),h.promise.then(E=>(E.errorCode&&(E.errorCode=eP(l,E.errorCode)),o(Lr(Lr({},g),E)),E))};return{invokeNative:s,applyNative:(l,c)=>{let d=s(l,c);return IW(d)?d.then(u=>rP(l,u)):rP(l,d)},invokeHandler:a}}function rP(e,t){if(!Oi(t)){Nc.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=dW(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new kW(n,i,o,a);return s}function rz(e){if(globalThis[dc])return globalThis[dc];let t=new tm,r=new tm,n=new yc({eventName:"jolibox_publish",tagNameOrder:["type","event"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}});return t.on("onJoliboxEnterBackground",()=>{n.flush()}),globalThis[dc]={onNative:t.on.bind(t),offNative:t.off.bind(t),subscribe:r.on.bind(r),unsubscribe:r.off.bind(r),subscribeHandler(i,o,a){let s=Yh(o),l;if(s.__extra){l=s.params;let{type:c,startTime:d}=s.__extra;n.report({type:c,event:i,duration:Date.now()-d})}else l=s;if(i===JP){l.forEach(c=>{let[d,u]=c;try{r.emit(d.slice(fa.length),u,a)}catch(p){}});return}if(i.startsWith(fa)){r.emit(i.slice(fa.length),l,a);return}t.emit(i,l,a)}},globalThis[dc]}function nz(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${fa}${o}`,a,d);return}n||(n=Promise.resolve().then(()=>{t.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(JP,d,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${fa}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,d),console.log("emitNative",o,a,d);return}i||(i=Promise.resolve().then(()=>{r.forEach((d,u)=>{try{let p=u!==void 0?u==="*"?"*":[u]:void 0;e.publish(YW,d,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function iz(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=rz(e),{invokeNative:a,invokeHandler:s,applyNative:l}=tz(e,r),{publish:c,emitNative:d}=nz(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:c,subscribe:i,unsubscribe:o}}function HP(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}function cz(e,t,r){return(t=uz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uz(e){var t=dz(e,"string");return typeof t=="symbol"?t:t+""}function dz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Or(e,t,r){return(t=fz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fz(e){var t=hz(e,"string");return typeof t=="symbol"?t:t+""}function hz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nr(e,t,r){return(t=mz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mz(e){var t=gz(e,"string");return typeof t=="symbol"?t:t+""}function gz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ua(e,t,r){return(t=vz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vz(e){var t=yz(e,"string");return typeof t=="symbol"?t:t+""}function yz(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Vt(e,t,r){return(t=bz(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bz(e){var t=_z(e,"string");return typeof t=="symbol"?t:t+""}function _z(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var N$,D$,L$,bc,iP,oP,AT,aP,q$,U$,sP,M$,F$,CT,j$,B$,kT,G$,J$,H$,lP,$$,Q$,X$,xT,Z$,TT,eV,uP,dP,pP,PT,tV,rV,xi,Ch,kh,ye,aV,sV,aa,ha,lV,Th,cV,fh,pV,Ph,RT,Ci,Rh,Oh,Nh,Dh,AV,it,_c,ee,hP,lm,cm,CV,mP,kV,xV,xc,TV,Tc,Ni,vP,gt,Oe,Li,$V,VV,WV,DT,zV,KV,YV,QV,XV,e9,t9,r9,wP,LT,hh,qT,UT,nn,i9,o9,a9,s9,l9,ot,Uh,kt,gh,jT,BT,IP,Me,GT,JT,HT,$T,VT,WT,zT,f9,le,da,on,Fh,Sc,PP,vh,RP,g9,Fe,b9,_9,Dr,jh,Bh,vc,w9,S9,I9,E9,A9,C9,k9,x9,T9,P9,Gh,N9,D9,L9,q9,U9,M9,F9,KT,j9,B9,G9,J9,Jh,Pi,ki,V9,W9,z9,Hh,LP,$h,Vh,Wh,zh,Ec,Kh,sW,lW,cW,Ac,qP,UP,YT,Lr,uW,dW,Cc,fW,hW,gW,vW,MP,yW,_W,EW,AW,Oc,CW,kW,xW,bh,Nc,XT,TW,Qh,RW,Xh,OW,NW,DW,Ti,qW,Zh,be,UW,MW,ca,va,tm,rm,FW,_h,GW,nm,ZT,$W,VW,fa,WW,zW,KW,JP,YW,QW,yc,tP,wh,Sh,Ih,Eh,im,ZW,ez,dc,pm,an,$P,VP,oz,WP,nP,Ah,az,sz,lz,pz,kc,om,am,sm,Di,hoe,fm=x(()=>{"use strict";Wn();Cs();N$=Object.defineProperty,D$=Object.defineProperties,L$=Object.getOwnPropertyDescriptors,bc=Object.getOwnPropertySymbols,iP=Object.prototype.hasOwnProperty,oP=Object.prototype.propertyIsEnumerable,AT=(e,t,r)=>t in e?N$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aP=(e,t)=>{for(var r in t||(t={}))iP.call(t,r)&&AT(e,r,t[r]);if(bc)for(var r of bc(t))oP.call(t,r)&&AT(e,r,t[r]);return e},q$=(e,t)=>D$(e,L$(t)),U$=(e,t)=>{var r={};for(var n in e)iP.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&bc)for(var n of bc(e))t.indexOf(n)<0&&oP.call(e,n)&&(r[n]=e[n]);return r},sP=Object.defineProperty,M$=Object.defineProperties,F$=Object.getOwnPropertyDescriptors,CT=Object.getOwnPropertySymbols,j$=Object.prototype.hasOwnProperty,B$=Object.prototype.propertyIsEnumerable,kT=(e,t,r)=>t in e?sP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,G$=(e,t)=>{for(var r in t||(t={}))j$.call(t,r)&&kT(e,r,t[r]);if(CT)for(var r of CT(t))B$.call(t,r)&&kT(e,r,t[r]);return e},J$=(e,t)=>M$(e,F$(t)),H$=(e,t)=>{for(var r in t)sP(e,r,{get:t[r],enumerable:!0})},lP=(e,t,r,n)=>{for(var i=t,o=e.length-1,a;o>=0;o--)(a=e[o])&&(i=a(i)||i);return i},$$=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Q$=(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))(Q$||{});X$={log:oa("log"),warn:oa("warn"),info:oa("info"),error:oa("error"),debug:oa("debug")};Object.assign(globalThis,{logger:X$});xT=Symbol.for("Jolibox.canIUseMap"),Z$={};globalThis[xT]||(globalThis[xT]=Z$);TT=Symbol.for("Jolibox.canIUseMap.native"),eV={};globalThis[TT]||(globalThis[TT]=eV);uP=(e=>(e[e.Other=0]="Other",e[e.Route=1]="Route",e[e.Click=2]="Click",e[e.View=3]="View",e[e.Expose=4]="Expose",e[e.Swipe=5]="Swipe",e[e.Input=6]="Input",e[e.Select=7]="Select",e[e.SwitchOn=8]="SwitchOn",e[e.SwitchOff=9]="SwitchOff",e[e.Submit=10]="Submit",e[e.Scroll=11]="Scroll",e[e.Hide=12]="Hide",e[e.System=1e3]="System",e[e.ErrorTrace=1001]="ErrorTrace",e[e.UserDefined=1002]="UserDefined",e))(uP||{}),dP=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(dP||{}),pP=(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))(pP||{}),PT=["name","params"],tV=["name","type","location","target","extra","timestamp","userId"],rV=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];oV();xi=typeof window=="undefined",Ch=()=>!xi&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!xi&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!xi&&navigator.userAgent.includes("Android"),!xi&&navigator.userAgent.includes("Mac"),!xi&&navigator.userAgent.includes("FB_IAB"),!xi&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");kh=class xh{constructor(t){this.element=t,this.next=xh.Undefined,this.prev=xh.Undefined}};kh.Undefined=new kh(void 0);ye=kh,aV=class{constructor(){this._first=ye.Undefined,this._last=ye.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ye.Undefined}clear(){let e=this._first;for(;e!==ye.Undefined;){let t=e.next;e.prev=ye.Undefined,e.next=ye.Undefined,e=t}this._first=ye.Undefined,this._last=ye.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ye(e);if(this._first===ye.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==ye.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ye.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ye.Undefined&&e.next!==ye.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ye.Undefined&&e.next===ye.Undefined?(this._first=ye.Undefined,this._last=ye.Undefined):e.next===ye.Undefined?(this._last=this._last.prev,this._last.next=ye.Undefined):e.prev===ye.Undefined&&(this._first=this._first.next,this._first.prev=ye.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ye.Undefined;)yield e.element,e=e.next}},sV=0,aa=class{constructor(e){this.value=e,this.id=sV++}},ha=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 aa&&(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(){return this._event!=null||(this._event=(e,t)=>{var r,n,i,o,a,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new aa(e);return this._listeners?this._listeners instanceof aa?this._listeners=[this._listeners,l]:this._listeners.push(l):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=l,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(s=(a=this.options)==null?void 0:a.onDidAddListener)==null||s.call(a,this),this._size++,()=>{var c,d,u,p;if(!this._disposed){if(this._listeners instanceof aa)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(d=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||d.call(c));else if(this._listeners){let f=this._listeners.indexOf(l);f>=0&&(this._listeners.splice(f,1),this._size--,this._size===0&&((p=(u=this.options)==null?void 0:u.onDidRemoveLastListener)==null||p.call(u)))}}}}),this._event}_deliver(e,t){var r;if(!e)return;let n=((r=this.options)==null?void 0:r.onListenerError)||Error.constructor;if(!n){e.value(t);return}try{e.value(t)}catch(i){n(i)}}fire(e){this._listeners&&(this._listeners instanceof aa?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},lV=class{constructor(){this.listeners=new Map,this.listerHandlerMap=new WeakMap,this.cachedEventQueue=new Map}on(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;var n;let i=(n=this.listeners.get(e))!=null?n:new ha,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),r=this.cachedEventQueue.get(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r||(r=new aV,this.cachedEventQueue.set(e,r)),r.push({args:i}),t&&t.fire({event:e,args:i})}once(e,t){var r=this;let n=function(){t(...arguments),r.off(e,n)};this.on(e,n,!1)}},Th={};H$(Th,{None:()=>cV,filter:()=>dV,once:()=>fP,toPromise:()=>uV});cV=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});fh=Symbol.for("Jolibox.hostEmitter"),pV=()=>{let e=new lV;return globalThis[fh]||(globalThis[fh]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[fh]};pV();Ph=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new ha,this.onDidRegisterCommand=this._onDidRegisterCommand.event,console.log("[Jolibox SDK] command registry")}registerCommand(e){if(!e)throw new Error("invalid command");if(e.metadata&&Array.isArray(e.metadata.args)){let r=[];for(let i of e.metadata.args)r.push(i.constraint);let n=e.handler;e.handler=function(){for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return fV(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}};Ph=lP([cP],Ph);RT=class{constructor(){this._onWillExecuteCommand=new ha,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new ha,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ph,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=V$(3e4)),this._starActivation}executeCommand(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return $$(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),Th.toPromise(Th.filter(this.registry.onDidRegisterCommand,i=>i===e))])]),this._tryExecuteCommand(e,r))})}executeCommandThowErr(e){if(!this.registry.getCommand(e))throw new Error(`command '${e}' not found`);let t=this.registry.getCommand(e);for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];this._onWillExecuteCommand.fire({commandId:e,args:n});let o=this.invokeFunction(t.handler,...n);return this._onDidExecuteCommand.fire({commandId:e,args:n}),o}_tryExecuteCommand(e,t){let r=this.registry.getCommand(e);if(!r)return Promise.reject(new Error(`command '${e}' not found`));try{this._onWillExecuteCommand.fire({commandId:e,args:t});let 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){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e(...r)}finally{}}};RT=lP([cP],RT);Ci=e=>e?function(){try{for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e==null||e(...r)}catch(i){console.error("Error calling function",i)}}:()=>{console.log("wrapUserFunction: fn is undefined")},Rh=class{constructor(t){ht(this,"context",void 0),ht(this,"continueCallback",void 0),ht(this,"adIsShowingCallback",void 0),ht(this,"isBeforeAdCalled",!1),ht(this,"isBeforeRewardCalled",!1),ht(this,"isAdDismissedCalled",!1),ht(this,"isAdViewedCalled",!1),ht(this,"isAfterAdCalled",!1),ht(this,"currentProvider",void 0),ht(this,"currentClientParams",void 0),ht(this,"adsHasResponse",!1),ht(this,"videoChecker",window.document.createElement("video")),ht(this,"contextInfo",void 0),ht(this,"wrapShowAdFn",r=>()=>{var n,i,o;this.adsHasResponse=!0;let a=!1;this.videoChecker.play().catch(()=>{a=!1}),a=!this.videoChecker.paused,this.videoChecker.pause(),this.context.track("CallShowAdFn",Object.assign({},{userEvent:a},this.paramsToTrack)),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_REWARD",aP({userEvent:a},this.paramsToTrack)),Ch()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"rewarded",module:"game",game_id:this.contextInfo.objectId}),(o=this.adIsShowingCallback)==null||o.call(this,!0);let s=Ci(r);s==null||s()}),this.context=t,this.contextInfo=t.getContextInfo()}notifyIframeAdsEvent(t,r){window.parent&&window.parent.postMessage({type:t,data:r},"*"),window.dispatchEvent(new CustomEvent(t,{detail:r}))}get paramsToTrack(){var t,r,n,i,o,a;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null,type:(n=this.currentClientParams)==null?void 0:n.type,name:((i=this.currentClientParams)==null?void 0:i.type)==="preroll"?null:(a=(o=this.currentClientParams)==null?void 0:o.name)!=null?a:""}}wrapBeforeAd(t){return()=>{var r,n,i,o;if(this.adsHasResponse=!0,this.context.track("CallBeforeAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_BEFORE_AD",this.paramsToTrack),!this.isBeforeAdCalled){this.isBeforeAdCalled=!0;let a=Ci(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),Ch()&&this.context.track("mmp_ad_impression",{ad_network:(o=(i=this.currentProvider)==null?void 0:i.name)!=null?o:"",ad_format:"interstitial",module:"game",game_id:this.contextInfo.objectId}))}}}wrapBeforeReward(t){return r=>{this.adsHasResponse=!0,this.isBeforeRewardCalled?this.wrapShowAdFn(r)():(this.isBeforeRewardCalled=!0,t==null||t(this.wrapShowAdFn(r)))}}wrapAdDismissed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdDismissedCalled){this.isAdDismissedCalled=!0;let r=Ci(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=Ci(t);r==null||r()}}}wrapAfterAd(t){return()=>{if(this.adsHasResponse=!0,this.context.track("CallAfterAd",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AFTER_AD",this.paramsToTrack),!this.isAfterAdCalled){this.isAfterAdCalled=!0;let r=Ci(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,l,c,d,u;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:null,breakType:r.breakType,breakName:(o=r.breakName)!=null?o:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(a=this.currentProvider)==null?void 0:a.name)!=null?s:null,breakType:r.breakType,breakName:(l=r.breakName)!=null?l:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=Ci(t);p==null||p(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(d=this.continueCallback)==null||d.call(this,[!1,r]);break}default:{(u=this.continueCallback)==null||u.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return v(this,null,function*(){return this.currentProvider=t,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(o=>{this.continueCallback=o,this.adIsShowingCallback=i;let a;switch(r.type){case"preroll":{a={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),beforeReward:this.wrapBeforeReward(r.beforeReward),adDismissed:this.wrapAdDismissed(r.adDismissed),adViewed:this.wrapAdViewed(r.adViewed),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}default:{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}}window.setTimeout(()=>{var s,l,c,d,u,p,f;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(d=(c=this.currentProvider)==null?void 0:c.name)!=null?d:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(u=r.name)!=null?u:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(f=this.adIsShowingCallback)==null||f.call(this,!1))},5e3),this.context.track("CallAdBreak",this.paramsToTrack),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK",this.paramsToTrack),t.adBreak(a,n),window.JoliTesterBridge&&console.log("joli-fullscreen-ad-show")})})}};Oh=class{constructor(t){lc(this,"context",void 0),lc(this,"adBreakIsShowing",!1),lc(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),lc(this,"reportPageHide",()=>{this.context.track("AdBreakHide",{context:"AdsActionDetection"})}),this.context=t,window.addEventListener("visibilitychange",()=>{document.hidden&&this.adBreakIsShowing&&this.reportPageHide()}),window.addEventListener("beforeunload",r=>{this.adBreakIsShowing&&this.reportPageJumpOut()})}};Nh=class{constructor(t){cc(this,"configs",null),cc(this,"firstRun",!0),cc(this,"context",void 0),cc(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return v(this,null,function*(){try{this.configs=yield this.context.httpClient.get("/api/fe-configs/js-sdk/ads-channel-config",{})}catch(t){}})}shouldBypassCallingInterstitial(){var t,r;let n;if(!this.configs)this.init(),n=!this.firstRun;else{let i=(t=this.contextInfo.channel)!=null?t:"",o=this.configs[i],a=(r=o==null?void 0:o.interstitialRate)!=null?r:1;n=Math.random()<a}return this.firstRun=!1,n}};Dh=class{constructor(t,r){Tr(this,"name","ADSENSE"),Tr(this,"context",void 0),Tr(this,"contextInfo",void 0),Tr(this,"configured",!1),Tr(this,"initParams",void 0),Tr(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),Tr(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=U$(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),Tr(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),Tr(this,"adUnit",n=>v(this,null,function*(){var i,o,a,s;if(this.context.track("CallAdUnit",{adFormat:(o=(i=n.adFormat)==null?void 0:i.toString())!=null?o:null,fullWidthResponsive:(a=n.fullWidthResponsive)!=null?a:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:d,fullWidthResponsive:u,style:p}=n,f;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?f=document.querySelector(l):f=l,!f)throw new Error("targeting element not found");let h=c;if(h||(h=this.initParams.unitId),!h)throw new Error("slot is required");let g=typeof d=="object"&&Array.isArray(d)?d.join(", "):d,b=document.createElement("ins");if(b.className="adsbygoogle",b.id="jolibox-ads",b.style.display="block",b.setAttribute("data-ad-client",this.initParams.clientId),b.setAttribute("data-ad-slot",h),g&&b.setAttribute("data-ad-format",g),u&&b.setAttribute("data-full-width-responsive",u),p&&b.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let y=document.createElement("div");y.style.position="absolute",y.style.top="0",y.style.left="0",y.style.width="100%",y.style.height="100%",y.style.display="flex",y.style.justifyContent="center",y.style.alignItems="center",y.style.backgroundColor="rgba(0, 0, 0, 0.5)",y.style.color="white",y.innerHTML="Test Ad",b.style.position="relative",f.appendChild(b),b.appendChild(y)}else f.appendChild(b),new MutationObserver(y=>{y.forEach(_=>{if(_.type==="attributes"&&_.attributeName==="data-ad-status"){let I=b.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:I!=null?I:"null"})}})}).observe(b,{attributes:!0,attributeFilter:["data-ad-status"]}),this.push({})})),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,window.adsbygoogle=window.adsbygoogle||[]}init(){return v(this,null,function*(){var t;if(this.context.track("CallAdsInit",{provider:this.name}),typeof window=="undefined")return;let r="google-adsense",n=(t=this.contextInfo.testAdsMode)!=null?t:!1;if(!document.getElementById(r)&&this.initParams.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.initParams.clientId}`,n&&i.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&i.setAttribute("data-ad-channel",this.initParams.channelId),this.initParams.admobInterstitialSlot&&i.setAttribute("data-admob-interstitial-slot",this.initParams.admobInterstitialSlot),this.initParams.admobRewardedSlot&&i.setAttribute("data-admob-rewarded-slot",this.initParams.admobRewardedSlot),this.initParams.admobOnly&&i.setAttribute("data-admob-ads-only","on"),document.head.appendChild(i),this.context.track("LoadAdsenseCompleted",null)}})}};AV=function(){function e(r){var n=this;this._insertTag=function(i){var o;n.tags.length===0?n.insertionPoint?o=n.insertionPoint.nextSibling:n.prepend?o=n.container.firstChild:o=n.before:o=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(i,o),n.tags.push(i)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(r){r.forEach(this._insertTag)},t.insert=function(r){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(EV(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=IV(n);try{i.insertRule(r,i.cssRules.length)}catch(o){}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e}(),it="-ms-",_c="-moz-",ee="-webkit-",hP="comm",lm="rule",cm="decl",CV="@import",mP="@keyframes",kV="@layer",xV=Math.abs,xc=String.fromCharCode,TV=Object.assign;Tc=1,Ni=1,vP=0,gt=0,Oe=0,Li="";$V=function(e,t,r){for(var n=0,i=0;n=i,i=ur(),n===38&&i===12&&(t[r]=1),!ga(i);)xt();return ya(e,gt)},VV=function(e,t){var r=-1,n=44;do switch(ga(n)){case 0:n===38&&ur()===12&&(t[r]=1),e[r]+=$V(gt-1,t,r);break;case 2:e[r]+=hc(n);break;case 4:if(n===44){e[++r]=ur()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=xc(n)}while(n=xt());return e},WV=function(e,t){return bP(VV(yP(e),t))},DT=new WeakMap,zV=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!DT.get(r))&&!n){DT.set(e,!0);for(var i=[],o=WV(t,i),a=r.props,s=0,l=0;s<o.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=i[s]?o[s].replace(/&\f/g,a[c]):a[c]+" "+o[s]}}},KV=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};YV=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case cm:e.return=_P(e.value,e.length);break;case mP:return Ri([sa(e,{value:te(e.value,"@","@"+ee)})],n);case lm:if(e.length)return OV(e.props,function(i){switch(RV(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Ri([sa(e,{props:[te(i,/:(read-\w+)/,":"+_c+"$1")]})],n);case"::placeholder":return Ri([sa(e,{props:[te(i,/:(plac\w+)/,":"+ee+"input-$1")]}),sa(e,{props:[te(i,/:(plac\w+)/,":"+_c+"$1")]}),sa(e,{props:[te(i,/:(plac\w+)/,it+"input-$1")]})],n)}return""})}},QV=[YV],XV=function(e){var t=e.key;if(t==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(h){var g=h.getAttribute("data-emotion");g.indexOf(" ")!==-1&&(document.head.appendChild(h),h.setAttribute("data-s",""))})}var n=e.stylisPlugins||QV,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(h){for(var g=h.getAttribute("data-emotion").split(" "),b=1;b<g.length;b++)i[g[b]]=!0;a.push(h)});var s,l=[zV,KV];{var c,d=[BV,JV(function(h){c.insert(h)})],u=GV(l.concat(n,d)),p=function(h){return Ri(FV(h),u)};s=function(h,g,b,y){c=b,p(h?h+"{"+g.styles+"}":g.styles),y&&(f.inserted[g.name]=!0)}}var f={key:t,sheet:new AV({key:t,container:o,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:i,registered:{},insert:s};return f.sheet.hydrate(a),f};e9={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},t9=/[A-Z]|^ms/g,r9=/_EMO_([^_]+?)_([^]*?)_EMO_/g,wP=function(e){return e.charCodeAt(1)===45},LT=function(e){return e!=null&&typeof e!="boolean"},hh=HV(function(e){return wP(e)?e:e.replace(t9,"-$&").toLowerCase()}),qT=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(r9,function(r,n,i){return nn={name:n,styles:i,next:nn},n})}return e9[e]!==1&&!wP(e)&&typeof t=="number"&&t!==0?t+"px":t};UT=/label:\s*([^\s;{]+)\s*(;|$)/g;i9=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},o9=function(e,t,r){i9(e,t);var n=e.key+"-"+t.name;if(e.inserted[t.name]===void 0){var i=t;do e.insert(t===i?"."+n:"",i,e.sheet,!0),i=i.next;while(i!==void 0)}};a9=function(e){var t=XV(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=mh(s,t.registered,void 0);return o9(t,c),t.key+"-"+c.name},n=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=mh(s,t.registered),d="animation-"+c.name;return MT(t,{name:c.name,styles:"@keyframes "+d+"{"+c.styles+"}"}),d},i=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=mh(s,t.registered);MT(t,c)},o=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];return FT(t.registered,r,s9(s))};return{css:r,cx:o,injectGlobal:i,keyframes:n,hydrate:function(a){a.forEach(function(s){t.inserted[s]=!0})},flush:function(){t.registered={},t.inserted={},t.sheet.flush()},sheet:t.sheet,cache:t,getRegisteredStyles:SP.bind(null,t.registered),merge:FT.bind(null,t.registered,r)}},s9=function e(t){for(var r="",n=0;n<t.length;n++){var i=t[n];if(i!=null){var o=void 0;switch(typeof i){case"boolean":break;case"object":{if(Array.isArray(i))o=e(i);else{o="";for(var a in i)i[a]&&a&&(o&&(o+=" "),o+=a)}break}default:o=i}o&&(r&&(r+=" "),r+=o)}}return r},l9=a9({key:"css"}),ot=l9.css,BT=0,IP=[],Me=q,GT=Me.__b,JT=Me.__r,HT=Me.diffed,$T=Me.__c,VT=Me.unmount,WT=Me.__;Me.__b=function(e){kt=null,GT&>(e)},Me.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),WT&&WT(e,t)},Me.__r=function(e){JT&&JT(e),Uh=0;var t=(kt=e.__c).__H;t&&(gh===kt?(t.__h=[],kt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(gc),t.__h.forEach(Mh),t.__h=[],Uh=0)),gh=kt},Me.diffed=function(e){HT&&HT(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(IP.push(t)!==1&&jT===Me.requestAnimationFrame||((jT=Me.requestAnimationFrame)||d9)(u9)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),gh=kt=null},Me.__c=function(e,t){t.some(function(r){try{r.__h.forEach(gc),r.__h=r.__h.filter(function(n){return!n.__||Mh(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Me.__e(n,r.__v)}}),$T&&$T(e,t)},Me.unmount=function(e){VT&&VT(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{gc(n)}catch(i){t=i}}),r.__H=void 0,t&&Me.__e(t,r.__v))};zT=typeof requestAnimationFrame=="function";f9=Symbol.for("preact-signals");le=void 0,da=void 0,on=0,Fh=0,Sc=0;Qe.prototype.brand=f9;Qe.prototype.h=function(){return!0};Qe.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)};Qe.prototype.U=function(e){if(this.t!==void 0){var t=e.e,r=e.x;t!==void 0&&(t.x=r,e.e=void 0),r!==void 0&&(r.e=t,e.x=void 0),e===this.t&&(this.t=r)}};Qe.prototype.subscribe=function(e){var t=this;return _a(function(){var r=t.value,n=le;le=void 0;try{e(r)}finally{le=n}})};Qe.prototype.valueOf=function(){return this.value};Qe.prototype.toString=function(){return this.value+""};Qe.prototype.toJSON=function(){return this.value};Qe.prototype.peek=function(){var e=le;le=void 0;try{return this.value}finally{le=e}};Object.defineProperty(Qe.prototype,"value",{get:function(){var e=AP(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Fh>100)throw new Error("Cycle detected");this.v=e,this.i++,Sc++,on++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Rc()}}}});(qi.prototype=new Qe).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Sc))return!0;if(this.g=Sc,this.f|=1,this.i>0&&!CP(this))return this.f&=-2,!0;var e=le;try{kP(this),le=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return le=e,xP(this),this.f&=-2,!0};qi.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Qe.prototype.S.call(this,e)};qi.prototype.U=function(e){if(this.t!==void 0&&(Qe.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}};qi.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}};Object.defineProperty(qi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=AP(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});ba.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}};ba.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,TP(this),kP(this),on++;var e=le;return le=this,h9.bind(this,e)};ba.prototype.N=function(){2&this.f||(this.f|=2,this.o=da,da=this)};ba.prototype.d=function(){this.f|=8,1&this.f||dm(this)};RP=[];_a(function(){PP=this.N})();OP.displayName="_st";Object.defineProperties(Qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:OP},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Ui("__b",function(e,t){if(typeof t.type=="string"){var r,n=t.props;for(var i in n)if(i!=="children"){var o=n[i];o instanceof Qe&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});Ui("__r",function(e,t){Ic();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return _a(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Ic(r),e(t)});Ui("__e",function(e,t,r,n){Ic(),e(t,r,n)});Ui("diffed",function(e,t){Ic();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in n)&&(s.d(),o[a]=void 0)}else o={},r.U=o;for(var l in n){var c=o[l],d=n[l];c===void 0?(c=m9(r,l,d,i),o[l]=c):c.o(d,i)}}}e(t)});Ui("unmount",function(e,t){if(typeof t.type=="string"){var r=t.__e;if(r){var n=r.U;if(n){r.U=void 0;for(var i in n){var o=n[i];o&&o.d()}}}}else{var a=t.__c;if(a){var s=a.__$u;s&&(a.__$u=void 0,s.d())}}e(t)});Ui("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});St.prototype.shouldComponentUpdate=function(e,t){var r=this.__$u,n=r&&r.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var o=2&this.__$f;if(!(n||o||4&this.__$f)||1&this.__$f)return!0}else if(!(n||4&this.__$f)||3&this.__$f)return!0;for(var a in e)if(a!=="__source"&&e[a]!==this.props[a])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};g9=function(e){queueMicrotask(function(){queueMicrotask(e)})};Fe=ot`
|
|
623
623
|
inset: 0;
|
|
624
624
|
clear: none;
|
|
625
625
|
float: none;
|