@jolibox/implement 1.2.9-beta.9 → 1.3.0
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 +4 -4
- package/dist/index.js +9 -9
- package/dist/index.native.js +3 -3
- package/implement.build.log +2 -2
- package/package.json +5 -5
- package/src/common/rewards/registers/utils/subscription/sub-handler.ts +0 -1
- package/src/native/api/payment.ts +5 -6
- package/src/native/payment/payment-service.ts +1 -1
package/dist/index.native.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var XP=Object.create;var oa=Object.defineProperty,ZP=Object.defineProperties,eT=Object.getOwnPropertyDescriptor,tT=Object.getOwnPropertyDescriptors,rT=Object.getOwnPropertyNames,ia=Object.getOwnPropertySymbols,nT=Object.getPrototypeOf,ul=Object.prototype.hasOwnProperty,Um=Object.prototype.propertyIsEnumerable;var Mm=(e,t,r)=>t in e?oa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,x=(e,t)=>{for(var r in t||(t={}))ul.call(t,r)&&Mm(e,r,t[r]);if(ia)for(var r of ia(t))Um.call(t,r)&&Mm(e,r,t[r]);return e},U=(e,t)=>ZP(e,tT(t));var $e=(e,t)=>{var r={};for(var n in e)ul.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ia)for(var n of ia(e))t.indexOf(n)<0&&Um.call(e,n)&&(r[n]=e[n]);return r};var C=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Fm=(e,t)=>{for(var r in t)oa(e,r,{get:t[r],enumerable:!0})},iT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rT(t))!ul.call(e,i)&&i!==r&&oa(e,i,{get:()=>t[i],enumerable:!(n=eT(t,i))||n.enumerable});return e};var re=(e,t,r)=>(r=e!=null?XP(nT(e)):{},iT(t||!e||!e.__esModule?oa(r,"default",{value:e,enumerable:!0}):r,e));var y=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((r=r.apply(e,t)).next())});function uT(e){return!!(e!=null&&e.__nativeBuffers__)}function vl(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!uT(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=dT(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function fT(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:pT(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function vT(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Xm(e){return typeof e=="string"}function Pn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Gm(e){return typeof e=="number"&&!isNaN(e)}function bT(e){return typeof e=="undefined"}function _T(e){return bT(e)||e===null}function Zm(e){return typeof e=="function"}function wT(e){return Pn(e)&&Zm(e.then)}function eh(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Ei(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function xT(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 NT(){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 UT(e){return new Promise(t=>th(e)(t))}function th(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function FT(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Ai(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function GT(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)BT(e[n],t[n])}function BT(e,t){if(Xm(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Zm(t)){try{if(e instanceof t)return}catch(r){}if(!_T(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 zr(e,t){if(bl.config[e]){da.warn(`[can i use] ${e} already registered`);return}bl.config[e]=ar({},t)}function Hm(e,t){return`[${e}]:${t}`}function KT(e,t){$m||(fl=new sa({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),ml=new sa({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),hl=new sa({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{fl.flush(),ml.flush(),hl.flush()}),$m=!0);function r(i){var o,a;let{method:s,args:c,startTime:l,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:m,invokeCallback:g}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";fl.report({status:b,method:n(s,c),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-l}),l&&m&&g&&(ml.report({status:b,method:s,isForeground:d,duration:Number((m-l).toFixed(3))}),hl.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 ZT(e,t){let r=0,n=!0,i=XT.resolveMap,o=KT(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,gl.forEach(c=>la(this,[c],function*({method:l,args:d,resolve:u}){let p=yield s(l,d);u(p)})),gl.length=0});let a=(c,l)=>{let d=i.get(Number(c));if(!d)return;let u=vl(l);d(u),i.delete(Number(c))},s=(c,l)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let m=new yT;if(i.set(r,m.resolve),!n&&$T.includes(c))return new Promise(A=>{gl.push({method:c,args:l,resolve:A})});let g=cT(ar({},{method:c,startTime:p,args:l,isForeground:f}),{invokeType:"js-bridge"}),b=!YT&&HT.includes(c),v=fT(l,b),w=b?v:JSON.stringify(v),E;if(c.endsWith("Sync")||VT.includes(c)?E=(d=e.call)==null?void 0:d.call(e,c,v,r):typeof w=="string"?E=e.invoke(c,w,r):E=(u=e.call)==null?void 0:u.call(e,c,w,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=vl(E)}catch(A){da.error(A)}return i.delete(r),E.errorCode&&(E.errorCode=Hm(c,E.errorCode)),o(ar(ar({},g),E)),E}return c.endsWith("Sync")&&i.delete(r),m.promise.then(A=>(A.errorCode&&(A.errorCode=Hm(c,A.errorCode)),o(ar(ar({},g),A)),A))};return{invokeNative:s,applyNative:(c,l)=>{let d=s(c,l);return wT(d)?d.then(u=>Vm(c,u)):Vm(c,d)},invokeHandler:a}}function Vm(e,t){if(!Pn(t)){da.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=lT(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new kT(n,i,o,a);return s}function eR(e){if(globalThis[aa])return globalThis[aa];let t=new Sl,r=new Sl,n=new sa({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[aa]={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=vl(o),c;if(s.__extra){c=s.params;let{type:l,startTime:d}=s.__extra;n.report({type:l,event:i,duration:Date.now()-d})}else c=s;if(i===nh){c.forEach(l=>{let[d,u]=l;try{r.emit(d.slice(Ci.length),u,a)}catch(p){}});return}if(i.startsWith(Ci)){r.emit(i.slice(Ci.length),c,a);return}t.emit(i,c,a)}},globalThis[aa]}function tR(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,c)=>{if(c){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Ci}${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(nh,d,p)}catch(p){}}),n=void 0,t.clear()}));let l=t.get(s);l||(l=[],t.set(s,l)),l.push([`${Ci}${o}`,a])},emitNative:(o,a,s,c)=>{if(c){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(WT,d,p)}catch(p){}}),i=void 0,r.clear()}));let l=r.get(s);l||(l=[],r.set(s,l)),l.push([o,a])}}}function rR(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=eR(e),{invokeNative:a,invokeHandler:s,applyNative:c}=ZT(e,r),{publish:l,emitNative:d}=tR(e);return{invokeHandler:s,subscribeHandler:t,applyNative:c,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:l,subscribe:i,unsubscribe:o}}function ih(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var oT,aT,sT,ca,zm,Km,jm,ar,cT,lT,la,dT,pT,Ym,mT,hT,Qm,gT,yT,ST,IT,ua,ET,kT,CT,dl,da,Bm,AT,yl,PT,bl,TT,RT,OT,xn,DT,jV,_l,se,qT,LT,ki,Ai,Sl,Il,MT,pl,jT,GV,El,Jm,BV,rh,JT,Ci,HT,$T,VT,nh,WT,zT,sa,$m,fl,ml,hl,gl,YT,kl,QT,XT,aa,Cl,It,oh,ah,nR,sh,Wm,me,F,Re,JV,iR,ch,Al,HV,$V,ce=C(()=>{"use strict";oT=Object.defineProperty,aT=Object.defineProperties,sT=Object.getOwnPropertyDescriptors,ca=Object.getOwnPropertySymbols,zm=Object.prototype.hasOwnProperty,Km=Object.prototype.propertyIsEnumerable,jm=(e,t,r)=>t in e?oT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ar=(e,t)=>{for(var r in t||(t={}))zm.call(t,r)&&jm(e,r,t[r]);if(ca)for(var r of ca(t))Km.call(t,r)&&jm(e,r,t[r]);return e},cT=(e,t)=>aT(e,sT(t)),lT=(e,t)=>{var r={};for(var n in e)zm.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&&Km.call(e,n)&&(r[n]=e[n]);return r},la=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((r=r.apply(e,t)).next())});dT=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};pT=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)};Ym=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,hT=(e,t)=>{for(var r in t)Ym(e,r,{get:t[r],enumerable:!0})},Qm=(e,t,r,n)=>{for(var i=n>1?void 0:n?mT(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&&Ym(t,r,i),i},gT=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}yT=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))}})}};ST=(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))(ST||{}),IT=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}},ua=class extends IT{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},ET=class extends ua{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},kT=class extends ua{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},CT=class extends ua{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},dl=class extends ua{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};da={log:Ei("log"),warn:Ei("warn"),info:Ei("info"),error:Ei("error"),debug:Ei("debug")};Object.assign(globalThis,{logger:da});Bm=Symbol.for("Jolibox.canIUseMap"),AT={};globalThis[Bm]||(globalThis[Bm]=AT);yl=Symbol.for("Jolibox.canIUseMap.native"),PT={};globalThis[yl]||(globalThis[yl]=PT);bl={get config(){return globalThis[yl]}},TT=(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))(TT||{}),RT=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(RT||{}),OT=(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))(OT||{});NT();xn=typeof window=="undefined",DT=()=>!xn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),jV={isiOS:!xn&&(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:!xn&&navigator.userAgent.includes("Android"),isMac:!xn&&navigator.userAgent.includes("Mac"),isFacebook:!xn&&navigator.userAgent.includes("FB_IAB"),isPC:!xn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},_l=class wl{constructor(t){this.element=t,this.next=wl.Undefined,this.prev=wl.Undefined}};_l.Undefined=new _l(void 0);se=_l,qT=class{constructor(){this._first=se.Undefined,this._last=se.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===se.Undefined}clear(){let e=this._first;for(;e!==se.Undefined;){let t=e.next;e.prev=se.Undefined,e.next=se.Undefined,e=t}this._first=se.Undefined,this._last=se.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new se(e);if(this._first===se.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!==se.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==se.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==se.Undefined&&e.next!==se.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===se.Undefined&&e.next===se.Undefined?(this._first=se.Undefined,this._last=se.Undefined):e.next===se.Undefined?(this._last=this._last.prev,this._last.next=se.Undefined):e.prev===se.Undefined&&(this._first=this._first.next,this._first.prev=se.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==se.Undefined;)yield e.element,e=e.next}},LT=0,ki=class{constructor(e){this.value=e,this.id=LT++}},Ai=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,c;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let l=new ki(t);return this._listeners?this._listeners instanceof ki?this._listeners=[this._listeners,l]:this._listeners.push(l):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=l,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(c=(s=this.options)==null?void 0:s.onDidAddListener)==null||c.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof ki)this._listeners.id===l.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 m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,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}},Sl=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 Ai,o=c=>t(...c.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 c of s)t(...c.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 qT,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)}},Il={};hT(Il,{None:()=>MT,filter:()=>FT,once:()=>th,toPromise:()=>UT});MT=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});pl=Symbol.for("Jolibox.hostEmitter"),jT=()=>{let e=new Sl;return globalThis[pl]||(globalThis[pl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[pl]},GV=jT();El=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ai,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 GT(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}};El=Qm([eh],El);Jm=class{constructor(){this._onWillExecuteCommand=new Ai,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ai,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new El,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=vT(3e4)),this._starActivation}executeCommand(e,...t){return gT(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Il.toPromise(Il.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}}};Jm=Qm([eh],Jm);BV=Symbol.for("Jolibox.commands");zr("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});zr("requestProductDetailsAsync",{version:102e4});zr("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});zr("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});zr("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});zr("userTrackAsync",{version:1e6});zr("openMiniapp",{version:1050100});rh=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let c=bl.config[a];if(!c)return!1;let l=(o=t==null?void 0:t())!=null?o:"",d=c.version;if(c.platforms&&l in c.platforms){let p=c.platforms[l];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(c,s,u)||n(c.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=xT(i,o);if(!s)return!1;if(Pn(s)){let c=s.version;return Gm(c)?typeof a=="number"&&a>=c:!0}return Gm(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};JT=()=>DT(),Ci="custom_event_",HT=[],$T=[],VT=["env","createRequestTask","login"],nh="__batch_event__",WT="__native_batch_event__",zT=e=>e==="pv"?e:"default",sa=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=zT(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&&Pn(a))throw new dl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let c=[];if(Pn(a))c.push(...Object.keys(a));else if(Xm(a)){if(i.length>0)throw new dl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);c.push(a)}else throw new dl(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);c.forEach(l=>{n[l]||(n[l]={});let d=Pn(a)?a[l]:a;t(n[l],[...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={}}},$m=!1;gl=[],YT=!1,kl=Symbol.for("Jolibox.invokeResolverInstance"),QT=new Map;globalThis[kl]||(globalThis[kl]=QT);XT={get resolveMap(){return globalThis[kl]}};aa=Symbol.for("Jolibox.subscribeInstance");It={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){It.trigger=e},onDoExit(e){It.exit=e},onDoBackPress(e){It.backPress=e}},oh=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new ET("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="")=>{It.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>la(void 0,null,function*(){let o=yield It.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});Cl={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=ih(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:oh,doExit:r};globalThis.joliboxJSCore=ar({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{It.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>la(void 0,null,function*(){let a=yield It.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});Cl={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let c=ih(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(c),webviewIds:s}))},call(o,a,s){let c=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(c)return JSON.parse(c)},doBackPress(o){return la(this,null,function*(){let a=yield It.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:oh,doExit:n};globalThis.joliboxJSCore=ar({},i)}ah=Cl;if(!ah&&JT())throw new CT("No joliboxJScore is found, native bridge not found.");nR=ar({},ah),sh=rR(nR),{invokeHandler:Wm}=sh,{applyNative:me,invokeNative:F,onNative:Re,offNative:JV,subscribeHandler:iR,publish:ch,emitNative:Al,subscribe:HV,unsubscribe:$V}=sh;globalThis.joliboxJSBridge={callHandler:Wm,invokeHandler:Wm,subscribeHandler:iR}});function lR(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function hh(e){return new Promise(t=>setTimeout(t,e))}function Oi(e){return typeof e=="string"}function Yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function gh(e){return typeof e=="object"&&Array.isArray(e)}function fa(e){return typeof e=="number"&&!isNaN(e)}function xr(e){return e===!0||e===!1}function vh(e){return typeof e=="undefined"}function Ni(e){return vh(e)||e===null}function uR(e){return typeof e=="function"}function yh(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function bh(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],c=o[a],l=r(s,c,a,i,o);l!==void 0?i[a]=l:dh(c)&&dh(s)?i[a]=n(fh({},s),c):Array.isArray(c)&&Array.isArray(s)?i[a]=[...s,...c]:i[a]=c}return i}return n(e,t)}function dh(e){return e&&typeof e=="object"&&e.constructor===Object}function _h(e,t){if(Array.isArray(e))return e.concat(t)}function Di(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:c=!0}=r,l=()=>(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,c&&!p&&l()},t),p)return l()};return d.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,l()},d}function pR(e,t){return(...r)=>t(e,...r)}function ga(e){return t=>pR(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Gt(`${i}`))}})}function xi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function kh(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 c=parseInt(i[s],10)||0,l=parseInt(o[s],10)||0;if(c>l){n=1;break}else if(c<l){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 jl(){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 yR(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")return`${o}.${a}`}return`${o}.jolibox.com`}function Gl(e){return yR("app","stg-app",e)}function Rn(e){return`https://${Gl(e)}`}function SR(e){return new Promise(t=>Ph(e)(t))}function Ph(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function IR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Ri(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function kR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)CR(e[n],t[n])}function CR(e,t){if(Oi(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(uR(t)){try{if(e instanceof t)return}catch(r){}if(!Ni(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 AR(){return typeof globalThis!="undefined"?globalThis[Th]:void 0}function xR(e){typeof globalThis!="undefined"&&(globalThis[Th]=e)}function Y(e=!1){let t=AR();if(!e&&t)return t;let r=new pa,n=new Nl,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 xR(i),i}var Dl,oR,lh,aR,sR,uh,fh,cR,mh,Kr,nt,dR,ql,qi,Ll,wh,Gt,ma,Sh,ha,Ih,Eh,Li,Ml,Bt,Pl,fR,Ul,ph,mR,J,Fl,hR,Tn,Pi,Mi,gR,vR,Ch,Ah,xh,Rt,Tl,le,bR,_R,Ti,Ri,Jt,Ol,wR,xl,ER,he,pa,Nl,Th,R=C(()=>{"use strict";Dl=Object.defineProperty,oR=Object.getOwnPropertyDescriptor,lh=Object.getOwnPropertySymbols,aR=Object.prototype.hasOwnProperty,sR=Object.prototype.propertyIsEnumerable,uh=(e,t,r)=>t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fh=(e,t)=>{for(var r in t||(t={}))aR.call(t,r)&&uh(e,r,t[r]);if(lh)for(var r of lh(t))sR.call(t,r)&&uh(e,r,t[r]);return e},cR=(e,t)=>{for(var r in t)Dl(e,r,{get:t[r],enumerable:!0})},mh=(e,t,r,n)=>{for(var i=n>1?void 0:n?oR(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&&Dl(t,r,i),i},Kr=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}nt=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))}})}};dR=(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))(dR||{}),ql=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}},qi=class extends ql{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Ll=class extends ql{constructor(){super(...arguments),this.kind="USER_ERROR"}},wh=class extends Ll{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Gt=class extends Ll{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))}},ma=class extends Ll{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))}},Sh=class extends qi{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},ha=class extends qi{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))}},Ih=class extends qi{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},Eh=class extends qi{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Li=class extends ql{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}}},Ml=class extends qi{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Bt={log:xi("log"),warn:xi("warn"),info:xi("info"),error:xi("error"),debug:xi("debug")};Object.assign(globalThis,{logger:Bt});Pl=Symbol.for("Jolibox.canIUseMap"),fR={};globalThis[Pl]||(globalThis[Pl]=fR);Ul={get config(){return globalThis[Pl]}},ph=Symbol.for("Jolibox.canIUseMap.native"),mR={};globalThis[ph]||(globalThis[ph]=mR);J=(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))(J||{}),Fl=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Fl||{}),hR=(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))(hR||{}),Tn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});jl();Pi=typeof window=="undefined",Mi={isiOS:!Pi&&(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:!Pi&&navigator.userAgent.includes("Android"),isMac:!Pi&&navigator.userAgent.includes("Mac"),isFacebook:!Pi&&navigator.userAgent.includes("FB_IAB"),isPC:!Pi&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},gR="device_id",vR="advertising_id",Ch=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Tn()),window.__joliboxLocalStorage__.getItem(e)),Ah=()=>new URLSearchParams(window.location.search).get("deviceId")||Ch(gR),xh=()=>new URLSearchParams(window.location.search).get("advertisingId")||Ch(vR);Rt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=fh({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Kr(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=>Kr(this,null,function*(){if(s.message.includes("timeout")){let c=this.getValidCachedData(r);if(c)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}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 Kr(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,c=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",c),c){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(c,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,f,s),u):this.requestAdapter.mergeData(c,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(c):c}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let l=yield this.requestAdapter.execute(e,t),d=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,l);return d&&this.setCachedDataWithSequence(a,d,s),l})}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 Kr(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Kr(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 Kr(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)}},Tl=class Rl{constructor(t){this.element=t,this.next=Rl.Undefined,this.prev=Rl.Undefined}};Tl.Undefined=new Tl(void 0);le=Tl,bR=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.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!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},_R=0,Ti=class{constructor(e){this.value=e,this.id=_R++}},Ri=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 Ti&&(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,c;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let l=new Ti(t);return this._listeners?this._listeners instanceof Ti?this._listeners=[this._listeners,l]:this._listeners.push(l):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=l,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(c=(s=this.options)==null?void 0:s.onDidAddListener)==null||c.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Ti)this._listeners.id===l.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 m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,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 Ti?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Jt=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 Ri,o=c=>t(...c.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 c of s)t(...c.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 bR,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)}},Ol={};cR(Ol,{None:()=>wR,filter:()=>IR,once:()=>Ph,toPromise:()=>SR});wR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});xl=Symbol.for("Jolibox.hostEmitter"),ER=()=>{let e=new Jt;return globalThis[xl]||(globalThis[xl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[xl]},he=ER();pa=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ri,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 kR(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}};pa=mh([yh],pa);Nl=class{constructor(){this._onWillExecuteCommand=new Ri,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ri,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new pa,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=lR(3e4)),this._starActivation}executeCommand(e,...t){return Kr(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Ol.toPromise(Ol.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}}};Nl=mh([yh],Nl);Th=Symbol.for("Jolibox.commands")});function _e(e,t={}){Bl.emit("ERROR_REPORT",{error:e,options:t})}var Bl,Qr,dt=C(()=>{"use strict";R();R();Bl=new Jt,Qr=new Jt;_e.debounce=Di(_e,50,{leading:!0})});var Jl,PR,Rh,Oh,Nh=C(()=>{"use strict";R();dt();Jl=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{}}},PR=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rh=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:Jl(o),payloadJson:Jl(a),signature:Jl(s)}}else throw"joli_source is missing"}catch(r){return _e(new Sh(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Oh=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=PR(e),o=r[2];return`${n}.${i}.${o}`}return t}});var TR,Hl,Dh=C(()=>{"use strict";R();TR="1.2.9-beta.9",Hl=()=>TR});function Vl(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var RR,qh,$l,Lh,ue,OR,S,B=C(()=>{"use strict";R();Nh();Dh();R();RR={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Ah(),adId:xh(),pixelRatio:window.devicePixelRatio||1,platform:Mi.isAndroid?"android":Mi.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Hl()},schema:window.location.href,platform:Mi.isAndroid?"android":Mi.isiOS?"ios":"h5"},$l=(qh=globalThis.joliboxJSCore)==null?void 0:qh.env,ue=Object.assign({},(Lh=$l==null?void 0:$l())!=null?Lh:RR);OR=()=>{var g,b,v,w,E,A,P,T,k,G,fe;let{payloadJson:e,headerJson:t,signature:r}=ue.schema.length?Rh(ue.schema):{},n=`${ue.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ue.schema.length?ue.schema:window.location.href).searchParams,a=(v=(b=(g=o.get("mpId"))!=null?g:o.get("appId"))!=null?b:o.get("gameId"))!=null?v:"",s=(A=(E=(w=ue.clientSessionId)!=null?w:e==null?void 0:e.sessionId)!=null?E:o.get("sessionId"))!=null?A:n,c=!!((T=(P=e==null?void 0:e.testAdsMode)!=null?P:e==null?void 0:e.__testAdsMode)!=null?T:o.get("testAdsMode")==="true"),l=(fe=(G=(k=e==null?void 0:e.joliboxEnv)!=null?k:e==null?void 0:e.__joliboxEnv)!=null?G:o.get("joliboxEnv"))!=null?fe:"production",d=l==="staging",u=t==null?void 0:t.channel,f=new URL(window.location.href).searchParams,m=e==null?void 0:e.__shouldInterupt;return{get startTime(){var L;return(L=performance.timeOrigin)!=null?L:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return c},get joliboxEnv(){return l},get joliSource(){var L,O;return(O=(L=f.get("joliSource"))!=null?L:o.get("joliSource"))!=null?O:null},get mpId(){var L;return(L=a!=null?a:e==null?void 0:e.id)!=null?L:""},get mpVersion(){var L;return(L=t==null?void 0:t.ver)!=null?L:Hl()},get mpType(){var L,O;return(O=(L=t==null?void 0:t.__mpType)!=null?L:e==null?void 0:e.__mpType)!=null?O:"game"},get platform(){var L;return((L=ue.platform)!=null?L:ue.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ue.deviceInfo},get sdkInfo(){return ue.sdkInfo},get hostInfo(){return ue.hostInfo},get hostUserInfo(){return ue.hostUserInfo},get sessionId(){var L,O;return(O=(L=ue.clientSessionId)!=null?L:s)!=null?O:n},get channel(){return u},get webviewId(){var L;return(L=ue.webviewId)!=null?L:-1},get shouldInterupt(){return m},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Gl(d)},get adId(){var L;return(L=ue.deviceInfo.adId)!=null?L:ue.deviceInfo.did},get language(){return ue.deviceInfo.lang},get sdkEnvironment(){return Vl("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Vl("gamedistribution","jolibox")?"gamedistribution":Vl("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var Ue,jt,An;let L=(Ue=ue.deviceInfo.pixelRatio)!=null?Ue:1,O=(jt=ue.deviceInfo.statusBarHeight)!=null?jt:e==null?void 0:e.__androidStatusBarHeight,be=(An=ue.deviceInfo.navigationBarHeight)!=null?An:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:O!==void 0?O/L:20,navigationBarHeight:be!==void 0?be/L:10}},get abTests(){var L,O;return(O=(L=ue.abValues)==null?void 0:L.split(","))!=null?O:[]},get mpInfo(){var L;return(L=ue.mpInfo)!=null?L:{mpName:"unknown"}},onEnvConfigChanged:L=>{bh(ue,L,_h)},encodeJoliSourceQuery:L=>{var O,be;return t&&r?Oh(x(x({},e),L),(O=o.get("joliSource"))!=null?O:""):(be=o.get("joliSource"))!=null?be:""},setDoExitDirectly:()=>{m=!1}}},S=OR()});var Wl,Uh,NR,DR,Mh,qR,Fh=C(()=>{"use strict";R();dt();B();R();Wl=!1,Uh=(e,t)=>e==null?!1:t in e,NR=e=>Uh(e,"kind"),DR=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Mh=(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:DR(e.name)},i=U(x({},n),{env:t.environment,isFromUser:r});r?Qr.emit("GLOBAL_USER_ERROR",e,i):Qr.emit("GLOBAL_ERROR",e,i)},qR=e=>Uh(e,"kind")&&e.kind==="USER_ERROR";Bl.on("ERROR_REPORT",({error:e,options:t})=>{if(Wl)return;Wl=!0;let r=NR(e)&&e.raw?e.raw:e;try{let n=qR(e);Mh(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new Ml(`${i}, origin error: ${r.message}`);Bt.error(o),Mh(new Ml(o.message),{environment:t.environment},!1)}finally{Wl=!1}})});var Et,zl,Xr=C(()=>{"use strict";dt();R();dt();Et=(e,t)=>{var r,n;return new Li((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},zl=e=>new wh(e)});var jh=C(()=>{"use strict";Fh();Xr();R();ce();Qr.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})});Qr.on("GLOBAL_USER_ERROR",(e,t)=>{Bt.log("UserError",e,t)})});var Kl=C(()=>{"use strict"});function Gh(e,t){let r=(n,i,o)=>{let l=i!=null?i:{},{eventType:a}=l,s=$e(l,["eventType"]),c=U(x({tag:n,eventType:o!=null?o:a!=null?a:J.Other},t),{extra:x({},s)});n=="globalJsError"?_e(new Eh(JSON.stringify(c))):e("systemLog",c,S.webviewId)};return r.debounce=Di(r,500,{leading:!0}),r}function Bh(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=Di(t,500,{leading:!0}),t}var Jh=C(()=>{"use strict";R();R();dt();B()});function Hh(e,t){let r=Gh(e,t),n=Bh(r);return{track:r,trackPerformance:n}}var $h=C(()=>{"use strict";Jh()});var Vh=C(()=>{"use strict";B();R();R()});var Wh=C(()=>{"use strict";$h();Kl();Vh()});var va,zh=C(()=>{"use strict";va=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(),m=f-r;m>=this.interval&&(this.visible&&(a+=Math.min(m,this.interval+1e3),t(a)),r=f),n=requestAnimationFrame(s)},c=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let f=Date.now();f-r>=this.interval&&(r=f)},this.interval)},l=()=>{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?l():c())});let p=this.visible;return{start(){o||(o=!0,p?l():c())},stop(){o=!1,d(),u()}}}}});function ya(e,t,r){var c,l,d;let n=new Map,i=(c=r==null?void 0:r.baseUrl)!=null?c:Rn(S.testMode),o=(l=r==null?void 0:r.type)!=null?l:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return Re("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,v=$e(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(v):p.reject(v),n.delete(g)}else if(u.state==="fail"){let m=u,{requestTaskId:g,state:b}=m,v=$e(m,["requestTaskId","state"]);p.reject(v),n.delete(g)}else Bt.warn("onRequestTaskStateChange unknown event",u)}),he.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...m)=>y(this,[f,...m],function*(u,p={}){let g=Date.now(),b=LR(u,U(x({},p),{baseUrl:i})),{method:v="GET",responseType:w="text",dataType:E="json",timeout:A,enableCache:P=!1,appendHostCookie:T=!0}=p,k=Object.assign({"content-type":"application/json"},a,p.header),G={url:b,method:v,header:k,enableCache:P,responseType:w,appendHostCookie:T};if(v=="POST"||v=="PUT"){let Ue=UR(p.data,k["content-type"]);G.data=Ue}A&&Object.assign(G,{timeout:A});let{data:{requestTaskId:fe}}=F(e,G);if(typeof fe!="string")throw Et({code:-1,msg:"requestTaskId is not a string"});let{resolve:L,reject:O,promise:be}=new nt;n.set(fe,{resolve:L,reject:O});try{let Ue=yield be,{data:jt}=Ue;return E==="json"&&typeof jt=="string"&&(jt=MR(jt)),{url:b,timeout:A,method:v,response:U(x({},Ue),{data:jt})}}catch(Ue){let jt=Ue;if(Yr(jt)){let{errMsg:An,prefetchDetail:MV,isPrefetch:UV,errNo:QP}=jt;Oi(An)&&_e(Et({code:-1,msg:An},{errNo:QP,errMsg:An}))}throw Ue}})}function MR(e){try{return JSON.parse(e.trim())}catch(t){return e}}function UR(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 LR,Yl=C(()=>{"use strict";R();ce();dt();Xr();B();LR=(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 Ql,Kh,Z,pt=C(()=>{"use strict";Yl();B();R();Ql={};(Kh=S.hostUserInfo)!=null&&Kh.token&&(Ql["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(Ql["x-joli-source"]=S.joliSource);Z=ya("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Rn(S.testMode),defaultHeaders:Ql})});function Yh(e){let t=Ul.config[e];return t||(t={},Ul.config[e]=t),(r,n)=>{if(t[r]){Bt.warn(`[can i use] ${r} already registered`);return}t[r]=x({},n)}}var Qh=C(()=>{"use strict";R()});function Xl(e){Xh=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 sr(e){return typeof e=="number"}function Zl(e){let t=eu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function eu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Xh,Ee,_a,wa,Sa,Ia,On,Ea,ka,Ca,Aa,xa,Pa,Ta,Ra,Oa,Na,Da,qa,tu=C(()=>{"use strict";Xh=!1;Ee=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Xh)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 ${Zl(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}};_a=class extends Ee{validate(t){return this._optional&&t===void 0?!0:sr(t)?sr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):sr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):sr(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}},wa=class extends Ee{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Sa=class extends Ee{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(sr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(sr(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}},Ia=class extends Ee{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},On=class extends Ee{validate(t){return!0}},Ea=class extends Ee{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ka=class extends Ee{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Ca=class extends Ee{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Aa=class extends Ee{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 ${Zl(t)}`)}return!0}},xa=class extends Ee{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(sr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(sr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(sr(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}},Pa=class extends Ee{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(eu(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 c=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}"]`,!(c===void 0&&o._optional)){if(c===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(c)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Ta=class extends Ee{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(eu(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}},Ra=class extends Ee{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Zl(this.value),actual:r}):!0}},Oa=class extends Ee{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 XP=Object.create;var oa=Object.defineProperty,ZP=Object.defineProperties,eT=Object.getOwnPropertyDescriptor,tT=Object.getOwnPropertyDescriptors,rT=Object.getOwnPropertyNames,ia=Object.getOwnPropertySymbols,nT=Object.getPrototypeOf,ul=Object.prototype.hasOwnProperty,Um=Object.prototype.propertyIsEnumerable;var Mm=(e,t,r)=>t in e?oa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,x=(e,t)=>{for(var r in t||(t={}))ul.call(t,r)&&Mm(e,r,t[r]);if(ia)for(var r of ia(t))Um.call(t,r)&&Mm(e,r,t[r]);return e},U=(e,t)=>ZP(e,tT(t));var $e=(e,t)=>{var r={};for(var n in e)ul.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ia)for(var n of ia(e))t.indexOf(n)<0&&Um.call(e,n)&&(r[n]=e[n]);return r};var C=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Fm=(e,t)=>{for(var r in t)oa(e,r,{get:t[r],enumerable:!0})},iT=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rT(t))!ul.call(e,i)&&i!==r&&oa(e,i,{get:()=>t[i],enumerable:!(n=eT(t,i))||n.enumerable});return e};var re=(e,t,r)=>(r=e!=null?XP(nT(e)):{},iT(t||!e||!e.__esModule?oa(r,"default",{value:e,enumerable:!0}):r,e));var y=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((r=r.apply(e,t)).next())});function uT(e){return!!(e!=null&&e.__nativeBuffers__)}function vl(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!uT(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=dT(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function fT(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:pT(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function vT(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Xm(e){return typeof e=="string"}function Pn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Gm(e){return typeof e=="number"&&!isNaN(e)}function bT(e){return typeof e=="undefined"}function _T(e){return bT(e)||e===null}function Zm(e){return typeof e=="function"}function wT(e){return Pn(e)&&Zm(e.then)}function eh(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Ei(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function xT(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 NT(){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 UT(e){return new Promise(t=>th(e)(t))}function th(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function FT(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Ai(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function GT(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)BT(e[n],t[n])}function BT(e,t){if(Xm(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Zm(t)){try{if(e instanceof t)return}catch(r){}if(!_T(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 zr(e,t){if(bl.config[e]){da.warn(`[can i use] ${e} already registered`);return}bl.config[e]=ar({},t)}function Hm(e,t){return`[${e}]:${t}`}function KT(e,t){$m||(fl=new sa({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),ml=new sa({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),hl=new sa({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{fl.flush(),ml.flush(),hl.flush()}),$m=!0);function r(i){var o,a;let{method:s,args:c,startTime:l,isForeground:d,errMsg:u=`${s}:fail no errMsg`,errNo:p=0,__timing:f={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:m,invokeCallback:g}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";fl.report({status:b,method:n(s,c),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-l}),l&&m&&g&&(ml.report({status:b,method:s,isForeground:d,duration:Number((m-l).toFixed(3))}),hl.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 ZT(e,t){let r=0,n=!0,i=XT.resolveMap,o=KT(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,gl.forEach(c=>la(this,[c],function*({method:l,args:d,resolve:u}){let p=yield s(l,d);u(p)})),gl.length=0});let a=(c,l)=>{let d=i.get(Number(c));if(!d)return;let u=vl(l);d(u),i.delete(Number(c))},s=(c,l)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let m=new yT;if(i.set(r,m.resolve),!n&&$T.includes(c))return new Promise(A=>{gl.push({method:c,args:l,resolve:A})});let g=cT(ar({},{method:c,startTime:p,args:l,isForeground:f}),{invokeType:"js-bridge"}),b=!YT&&HT.includes(c),v=fT(l,b),w=b?v:JSON.stringify(v),E;if(c.endsWith("Sync")||VT.includes(c)?E=(d=e.call)==null?void 0:d.call(e,c,v,r):typeof w=="string"?E=e.invoke(c,w,r):E=(u=e.call)==null?void 0:u.call(e,c,w,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=vl(E)}catch(A){da.error(A)}return i.delete(r),E.errorCode&&(E.errorCode=Hm(c,E.errorCode)),o(ar(ar({},g),E)),E}return c.endsWith("Sync")&&i.delete(r),m.promise.then(A=>(A.errorCode&&(A.errorCode=Hm(c,A.errorCode)),o(ar(ar({},g),A)),A))};return{invokeNative:s,applyNative:(c,l)=>{let d=s(c,l);return wT(d)?d.then(u=>Vm(c,u)):Vm(c,d)},invokeHandler:a}}function Vm(e,t){if(!Pn(t)){da.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=lT(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new kT(n,i,o,a);return s}function eR(e){if(globalThis[aa])return globalThis[aa];let t=new Sl,r=new Sl,n=new sa({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[aa]={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=vl(o),c;if(s.__extra){c=s.params;let{type:l,startTime:d}=s.__extra;n.report({type:l,event:i,duration:Date.now()-d})}else c=s;if(i===nh){c.forEach(l=>{let[d,u]=l;try{r.emit(d.slice(Ci.length),u,a)}catch(p){}});return}if(i.startsWith(Ci)){r.emit(i.slice(Ci.length),c,a);return}t.emit(i,c,a)}},globalThis[aa]}function tR(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,c)=>{if(c){let d=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Ci}${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(nh,d,p)}catch(p){}}),n=void 0,t.clear()}));let l=t.get(s);l||(l=[],t.set(s,l)),l.push([`${Ci}${o}`,a])},emitNative:(o,a,s,c)=>{if(c){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(WT,d,p)}catch(p){}}),i=void 0,r.clear()}));let l=r.get(s);l||(l=[],r.set(s,l)),l.push([o,a])}}}function rR(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=eR(e),{invokeNative:a,invokeHandler:s,applyNative:c}=ZT(e,r),{publish:l,emitNative:d}=tR(e);return{invokeHandler:s,subscribeHandler:t,applyNative:c,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:l,subscribe:i,unsubscribe:o}}function ih(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var oT,aT,sT,ca,zm,Km,jm,ar,cT,lT,la,dT,pT,Ym,mT,hT,Qm,gT,yT,ST,IT,ua,ET,kT,CT,dl,da,Bm,AT,yl,PT,bl,TT,RT,OT,xn,DT,jV,_l,se,qT,LT,ki,Ai,Sl,Il,MT,pl,jT,GV,El,Jm,BV,rh,JT,Ci,HT,$T,VT,nh,WT,zT,sa,$m,fl,ml,hl,gl,YT,kl,QT,XT,aa,Cl,It,oh,ah,nR,sh,Wm,me,F,Re,JV,iR,ch,Al,HV,$V,ce=C(()=>{"use strict";oT=Object.defineProperty,aT=Object.defineProperties,sT=Object.getOwnPropertyDescriptors,ca=Object.getOwnPropertySymbols,zm=Object.prototype.hasOwnProperty,Km=Object.prototype.propertyIsEnumerable,jm=(e,t,r)=>t in e?oT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ar=(e,t)=>{for(var r in t||(t={}))zm.call(t,r)&&jm(e,r,t[r]);if(ca)for(var r of ca(t))Km.call(t,r)&&jm(e,r,t[r]);return e},cT=(e,t)=>aT(e,sT(t)),lT=(e,t)=>{var r={};for(var n in e)zm.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&&Km.call(e,n)&&(r[n]=e[n]);return r},la=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(o,a);s((r=r.apply(e,t)).next())});dT=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};pT=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)};Ym=Object.defineProperty,mT=Object.getOwnPropertyDescriptor,hT=(e,t)=>{for(var r in t)Ym(e,r,{get:t[r],enumerable:!0})},Qm=(e,t,r,n)=>{for(var i=n>1?void 0:n?mT(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&&Ym(t,r,i),i},gT=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}yT=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))}})}};ST=(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))(ST||{}),IT=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}},ua=class extends IT{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},ET=class extends ua{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},kT=class extends ua{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},CT=class extends ua{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},dl=class extends ua{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};da={log:Ei("log"),warn:Ei("warn"),info:Ei("info"),error:Ei("error"),debug:Ei("debug")};Object.assign(globalThis,{logger:da});Bm=Symbol.for("Jolibox.canIUseMap"),AT={};globalThis[Bm]||(globalThis[Bm]=AT);yl=Symbol.for("Jolibox.canIUseMap.native"),PT={};globalThis[yl]||(globalThis[yl]=PT);bl={get config(){return globalThis[yl]}},TT=(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))(TT||{}),RT=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(RT||{}),OT=(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))(OT||{});NT();xn=typeof window=="undefined",DT=()=>!xn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),jV={isiOS:!xn&&(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:!xn&&navigator.userAgent.includes("Android"),isMac:!xn&&navigator.userAgent.includes("Mac"),isFacebook:!xn&&navigator.userAgent.includes("FB_IAB"),isPC:!xn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},_l=class wl{constructor(t){this.element=t,this.next=wl.Undefined,this.prev=wl.Undefined}};_l.Undefined=new _l(void 0);se=_l,qT=class{constructor(){this._first=se.Undefined,this._last=se.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===se.Undefined}clear(){let e=this._first;for(;e!==se.Undefined;){let t=e.next;e.prev=se.Undefined,e.next=se.Undefined,e=t}this._first=se.Undefined,this._last=se.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new se(e);if(this._first===se.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!==se.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==se.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==se.Undefined&&e.next!==se.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===se.Undefined&&e.next===se.Undefined?(this._first=se.Undefined,this._last=se.Undefined):e.next===se.Undefined?(this._last=this._last.prev,this._last.next=se.Undefined):e.prev===se.Undefined&&(this._first=this._first.next,this._first.prev=se.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==se.Undefined;)yield e.element,e=e.next}},LT=0,ki=class{constructor(e){this.value=e,this.id=LT++}},Ai=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,c;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let l=new ki(t);return this._listeners?this._listeners instanceof ki?this._listeners=[this._listeners,l]:this._listeners.push(l):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=l,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(c=(s=this.options)==null?void 0:s.onDidAddListener)==null||c.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof ki)this._listeners.id===l.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 m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,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}},Sl=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 Ai,o=c=>t(...c.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 c of s)t(...c.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 qT,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)}},Il={};hT(Il,{None:()=>MT,filter:()=>FT,once:()=>th,toPromise:()=>UT});MT=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});pl=Symbol.for("Jolibox.hostEmitter"),jT=()=>{let e=new Sl;return globalThis[pl]||(globalThis[pl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[pl]},GV=jT();El=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ai,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 GT(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}};El=Qm([eh],El);Jm=class{constructor(){this._onWillExecuteCommand=new Ai,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ai,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new El,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=vT(3e4)),this._starActivation}executeCommand(e,...t){return gT(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Il.toPromise(Il.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}}};Jm=Qm([eh],Jm);BV=Symbol.for("Jolibox.commands");zr("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});zr("requestProductDetailsAsync",{version:102e4});zr("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});zr("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});zr("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});zr("userTrackAsync",{version:1e6});zr("openMiniapp",{version:1050100});rh=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let c=bl.config[a];if(!c)return!1;let l=(o=t==null?void 0:t())!=null?o:"",d=c.version;if(c.platforms&&l in c.platforms){let p=c.platforms[l];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(c,s,u)||n(c.properties,s,u)}function n(i,o,a){if(!i)return!1;let s=xT(i,o);if(!s)return!1;if(Pn(s)){let c=s.version;return Gm(c)?typeof a=="number"&&a>=c:!0}return Gm(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};JT=()=>DT(),Ci="custom_event_",HT=[],$T=[],VT=["env","createRequestTask","login"],nh="__batch_event__",WT="__native_batch_event__",zT=e=>e==="pv"?e:"default",sa=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=zT(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&&Pn(a))throw new dl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let c=[];if(Pn(a))c.push(...Object.keys(a));else if(Xm(a)){if(i.length>0)throw new dl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);c.push(a)}else throw new dl(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);c.forEach(l=>{n[l]||(n[l]={});let d=Pn(a)?a[l]:a;t(n[l],[...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={}}},$m=!1;gl=[],YT=!1,kl=Symbol.for("Jolibox.invokeResolverInstance"),QT=new Map;globalThis[kl]||(globalThis[kl]=QT);XT={get resolveMap(){return globalThis[kl]}};aa=Symbol.for("Jolibox.subscribeInstance");It={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){It.trigger=e},onDoExit(e){It.exit=e},onDoBackPress(e){It.backPress=e}},oh=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new ET("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="")=>{It.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>la(void 0,null,function*(){let o=yield It.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});Cl={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=ih(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:oh,doExit:r};globalThis.joliboxJSCore=ar({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{It.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>la(void 0,null,function*(){let a=yield It.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});Cl={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let c=ih(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(c),webviewIds:s}))},call(o,a,s){let c=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(c)return JSON.parse(c)},doBackPress(o){return la(this,null,function*(){let a=yield It.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:oh,doExit:n};globalThis.joliboxJSCore=ar({},i)}ah=Cl;if(!ah&&JT())throw new CT("No joliboxJScore is found, native bridge not found.");nR=ar({},ah),sh=rR(nR),{invokeHandler:Wm}=sh,{applyNative:me,invokeNative:F,onNative:Re,offNative:JV,subscribeHandler:iR,publish:ch,emitNative:Al,subscribe:HV,unsubscribe:$V}=sh;globalThis.joliboxJSBridge={callHandler:Wm,invokeHandler:Wm,subscribeHandler:iR}});function lR(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function hh(e){return new Promise(t=>setTimeout(t,e))}function Oi(e){return typeof e=="string"}function Yr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function gh(e){return typeof e=="object"&&Array.isArray(e)}function fa(e){return typeof e=="number"&&!isNaN(e)}function xr(e){return e===!0||e===!1}function vh(e){return typeof e=="undefined"}function Ni(e){return vh(e)||e===null}function uR(e){return typeof e=="function"}function yh(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function bh(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],c=o[a],l=r(s,c,a,i,o);l!==void 0?i[a]=l:dh(c)&&dh(s)?i[a]=n(fh({},s),c):Array.isArray(c)&&Array.isArray(s)?i[a]=[...s,...c]:i[a]=c}return i}return n(e,t)}function dh(e){return e&&typeof e=="object"&&e.constructor===Object}function _h(e,t){if(Array.isArray(e))return e.concat(t)}function Di(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:c=!0}=r,l=()=>(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,c&&!p&&l()},t),p)return l()};return d.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},d.flush=()=>{if(n)return clearTimeout(n),n=null,l()},d}function pR(e,t){return(...r)=>t(e,...r)}function ga(e){return t=>pR(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Gt(`${i}`))}})}function xi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function kh(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 c=parseInt(i[s],10)||0,l=parseInt(o[s],10)||0;if(c>l){n=1;break}else if(c<l){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 jl(){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 yR(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")return`${o}.${a}`}return`${o}.jolibox.com`}function Gl(e){return yR("app","stg-app",e)}function Rn(e){return`https://${Gl(e)}`}function SR(e){return new Promise(t=>Ph(e)(t))}function Ph(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function IR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Ri(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function kR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)CR(e[n],t[n])}function CR(e,t){if(Oi(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(uR(t)){try{if(e instanceof t)return}catch(r){}if(!Ni(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 AR(){return typeof globalThis!="undefined"?globalThis[Th]:void 0}function xR(e){typeof globalThis!="undefined"&&(globalThis[Th]=e)}function Y(e=!1){let t=AR();if(!e&&t)return t;let r=new pa,n=new Nl,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 xR(i),i}var Dl,oR,lh,aR,sR,uh,fh,cR,mh,Kr,nt,dR,ql,qi,Ll,wh,Gt,ma,Sh,ha,Ih,Eh,Li,Ml,Bt,Pl,fR,Ul,ph,mR,J,Fl,hR,Tn,Pi,Mi,gR,vR,Ch,Ah,xh,Rt,Tl,le,bR,_R,Ti,Ri,Jt,Ol,wR,xl,ER,he,pa,Nl,Th,R=C(()=>{"use strict";Dl=Object.defineProperty,oR=Object.getOwnPropertyDescriptor,lh=Object.getOwnPropertySymbols,aR=Object.prototype.hasOwnProperty,sR=Object.prototype.propertyIsEnumerable,uh=(e,t,r)=>t in e?Dl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fh=(e,t)=>{for(var r in t||(t={}))aR.call(t,r)&&uh(e,r,t[r]);if(lh)for(var r of lh(t))sR.call(t,r)&&uh(e,r,t[r]);return e},cR=(e,t)=>{for(var r in t)Dl(e,r,{get:t[r],enumerable:!0})},mh=(e,t,r,n)=>{for(var i=n>1?void 0:n?oR(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&&Dl(t,r,i),i},Kr=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}nt=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))}})}};dR=(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))(dR||{}),ql=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}},qi=class extends ql{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Ll=class extends ql{constructor(){super(...arguments),this.kind="USER_ERROR"}},wh=class extends Ll{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Gt=class extends Ll{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))}},ma=class extends Ll{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))}},Sh=class extends qi{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},ha=class extends qi{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))}},Ih=class extends qi{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},Eh=class extends qi{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Li=class extends ql{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}}},Ml=class extends qi{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Bt={log:xi("log"),warn:xi("warn"),info:xi("info"),error:xi("error"),debug:xi("debug")};Object.assign(globalThis,{logger:Bt});Pl=Symbol.for("Jolibox.canIUseMap"),fR={};globalThis[Pl]||(globalThis[Pl]=fR);Ul={get config(){return globalThis[Pl]}},ph=Symbol.for("Jolibox.canIUseMap.native"),mR={};globalThis[ph]||(globalThis[ph]=mR);J=(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))(J||{}),Fl=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Fl||{}),hR=(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))(hR||{}),Tn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});jl();Pi=typeof window=="undefined",Mi={isiOS:!Pi&&(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:!Pi&&navigator.userAgent.includes("Android"),isMac:!Pi&&navigator.userAgent.includes("Mac"),isFacebook:!Pi&&navigator.userAgent.includes("FB_IAB"),isPC:!Pi&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},gR="device_id",vR="advertising_id",Ch=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Tn()),window.__joliboxLocalStorage__.getItem(e)),Ah=()=>new URLSearchParams(window.location.search).get("deviceId")||Ch(gR),xh=()=>new URLSearchParams(window.location.search).get("advertisingId")||Ch(vR);Rt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=fh({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Kr(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=>Kr(this,null,function*(){if(s.message.includes("timeout")){let c=this.getValidCachedData(r);if(c)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}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 Kr(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,c=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",c),c){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(c,f)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,f,s),u):this.requestAdapter.mergeData(c,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(c):c}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(c):c}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let l=yield this.requestAdapter.execute(e,t),d=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,l);return d&&this.setCachedDataWithSequence(a,d,s),l})}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 Kr(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Kr(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 Kr(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)}},Tl=class Rl{constructor(t){this.element=t,this.next=Rl.Undefined,this.prev=Rl.Undefined}};Tl.Undefined=new Tl(void 0);le=Tl,bR=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.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!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},_R=0,Ti=class{constructor(e){this.value=e,this.id=_R++}},Ri=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 Ti&&(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,c;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let l=new Ti(t);return this._listeners?this._listeners instanceof Ti?this._listeners=[this._listeners,l]:this._listeners.push(l):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=l,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(c=(s=this.options)==null?void 0:s.onDidAddListener)==null||c.call(s,this),this._size++,()=>{var d,u,p,f;if(!this._disposed){if(this._listeners instanceof Ti)this._listeners.id===l.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 m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,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 Ti?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Jt=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 Ri,o=c=>t(...c.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 c of s)t(...c.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 bR,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)}},Ol={};cR(Ol,{None:()=>wR,filter:()=>IR,once:()=>Ph,toPromise:()=>SR});wR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});xl=Symbol.for("Jolibox.hostEmitter"),ER=()=>{let e=new Jt;return globalThis[xl]||(globalThis[xl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[xl]},he=ER();pa=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Ri,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 kR(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}};pa=mh([yh],pa);Nl=class{constructor(){this._onWillExecuteCommand=new Ri,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Ri,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new pa,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=lR(3e4)),this._starActivation}executeCommand(e,...t){return Kr(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Ol.toPromise(Ol.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}}};Nl=mh([yh],Nl);Th=Symbol.for("Jolibox.commands")});function _e(e,t={}){Bl.emit("ERROR_REPORT",{error:e,options:t})}var Bl,Qr,dt=C(()=>{"use strict";R();R();Bl=new Jt,Qr=new Jt;_e.debounce=Di(_e,50,{leading:!0})});var Jl,PR,Rh,Oh,Nh=C(()=>{"use strict";R();dt();Jl=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{}}},PR=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rh=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:Jl(o),payloadJson:Jl(a),signature:Jl(s)}}else throw"joli_source is missing"}catch(r){return _e(new Sh(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Oh=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=PR(e),o=r[2];return`${n}.${i}.${o}`}return t}});var TR,Hl,Dh=C(()=>{"use strict";R();TR="1.3.0",Hl=()=>TR});function Vl(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var RR,qh,$l,Lh,ue,OR,S,B=C(()=>{"use strict";R();Nh();Dh();R();RR={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Ah(),adId:xh(),pixelRatio:window.devicePixelRatio||1,platform:Mi.isAndroid?"android":Mi.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Hl()},schema:window.location.href,platform:Mi.isAndroid?"android":Mi.isiOS?"ios":"h5"},$l=(qh=globalThis.joliboxJSCore)==null?void 0:qh.env,ue=Object.assign({},(Lh=$l==null?void 0:$l())!=null?Lh:RR);OR=()=>{var g,b,v,w,E,A,P,T,k,G,fe;let{payloadJson:e,headerJson:t,signature:r}=ue.schema.length?Rh(ue.schema):{},n=`${ue.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ue.schema.length?ue.schema:window.location.href).searchParams,a=(v=(b=(g=o.get("mpId"))!=null?g:o.get("appId"))!=null?b:o.get("gameId"))!=null?v:"",s=(A=(E=(w=ue.clientSessionId)!=null?w:e==null?void 0:e.sessionId)!=null?E:o.get("sessionId"))!=null?A:n,c=!!((T=(P=e==null?void 0:e.testAdsMode)!=null?P:e==null?void 0:e.__testAdsMode)!=null?T:o.get("testAdsMode")==="true"),l=(fe=(G=(k=e==null?void 0:e.joliboxEnv)!=null?k:e==null?void 0:e.__joliboxEnv)!=null?G:o.get("joliboxEnv"))!=null?fe:"production",d=l==="staging",u=t==null?void 0:t.channel,f=new URL(window.location.href).searchParams,m=e==null?void 0:e.__shouldInterupt;return{get startTime(){var L;return(L=performance.timeOrigin)!=null?L:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return c},get joliboxEnv(){return l},get joliSource(){var L,O;return(O=(L=f.get("joliSource"))!=null?L:o.get("joliSource"))!=null?O:null},get mpId(){var L;return(L=a!=null?a:e==null?void 0:e.id)!=null?L:""},get mpVersion(){var L;return(L=t==null?void 0:t.ver)!=null?L:Hl()},get mpType(){var L,O;return(O=(L=t==null?void 0:t.__mpType)!=null?L:e==null?void 0:e.__mpType)!=null?O:"game"},get platform(){var L;return((L=ue.platform)!=null?L:ue.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ue.deviceInfo},get sdkInfo(){return ue.sdkInfo},get hostInfo(){return ue.hostInfo},get hostUserInfo(){return ue.hostUserInfo},get sessionId(){var L,O;return(O=(L=ue.clientSessionId)!=null?L:s)!=null?O:n},get channel(){return u},get webviewId(){var L;return(L=ue.webviewId)!=null?L:-1},get shouldInterupt(){return m},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Gl(d)},get adId(){var L;return(L=ue.deviceInfo.adId)!=null?L:ue.deviceInfo.did},get language(){return ue.deviceInfo.lang},get sdkEnvironment(){return Vl("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Vl("gamedistribution","jolibox")?"gamedistribution":Vl("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var Ue,jt,An;let L=(Ue=ue.deviceInfo.pixelRatio)!=null?Ue:1,O=(jt=ue.deviceInfo.statusBarHeight)!=null?jt:e==null?void 0:e.__androidStatusBarHeight,be=(An=ue.deviceInfo.navigationBarHeight)!=null?An:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:O!==void 0?O/L:20,navigationBarHeight:be!==void 0?be/L:10}},get abTests(){var L,O;return(O=(L=ue.abValues)==null?void 0:L.split(","))!=null?O:[]},get mpInfo(){var L;return(L=ue.mpInfo)!=null?L:{mpName:"unknown"}},onEnvConfigChanged:L=>{bh(ue,L,_h)},encodeJoliSourceQuery:L=>{var O,be;return t&&r?Oh(x(x({},e),L),(O=o.get("joliSource"))!=null?O:""):(be=o.get("joliSource"))!=null?be:""},setDoExitDirectly:()=>{m=!1}}},S=OR()});var Wl,Uh,NR,DR,Mh,qR,Fh=C(()=>{"use strict";R();dt();B();R();Wl=!1,Uh=(e,t)=>e==null?!1:t in e,NR=e=>Uh(e,"kind"),DR=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Mh=(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:DR(e.name)},i=U(x({},n),{env:t.environment,isFromUser:r});r?Qr.emit("GLOBAL_USER_ERROR",e,i):Qr.emit("GLOBAL_ERROR",e,i)},qR=e=>Uh(e,"kind")&&e.kind==="USER_ERROR";Bl.on("ERROR_REPORT",({error:e,options:t})=>{if(Wl)return;Wl=!0;let r=NR(e)&&e.raw?e.raw:e;try{let n=qR(e);Mh(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new Ml(`${i}, origin error: ${r.message}`);Bt.error(o),Mh(new Ml(o.message),{environment:t.environment},!1)}finally{Wl=!1}})});var Et,zl,Xr=C(()=>{"use strict";dt();R();dt();Et=(e,t)=>{var r,n;return new Li((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},zl=e=>new wh(e)});var jh=C(()=>{"use strict";Fh();Xr();R();ce();Qr.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})});Qr.on("GLOBAL_USER_ERROR",(e,t)=>{Bt.log("UserError",e,t)})});var Kl=C(()=>{"use strict"});function Gh(e,t){let r=(n,i,o)=>{let l=i!=null?i:{},{eventType:a}=l,s=$e(l,["eventType"]),c=U(x({tag:n,eventType:o!=null?o:a!=null?a:J.Other},t),{extra:x({},s)});n=="globalJsError"?_e(new Eh(JSON.stringify(c))):e("systemLog",c,S.webviewId)};return r.debounce=Di(r,500,{leading:!0}),r}function Bh(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=Di(t,500,{leading:!0}),t}var Jh=C(()=>{"use strict";R();R();dt();B()});function Hh(e,t){let r=Gh(e,t),n=Bh(r);return{track:r,trackPerformance:n}}var $h=C(()=>{"use strict";Jh()});var Vh=C(()=>{"use strict";B();R();R()});var Wh=C(()=>{"use strict";$h();Kl();Vh()});var va,zh=C(()=>{"use strict";va=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(),m=f-r;m>=this.interval&&(this.visible&&(a+=Math.min(m,this.interval+1e3),t(a)),r=f),n=requestAnimationFrame(s)},c=()=>{d(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let f=Date.now();f-r>=this.interval&&(r=f)},this.interval)},l=()=>{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?l():c())});let p=this.visible;return{start(){o||(o=!0,p?l():c())},stop(){o=!1,d(),u()}}}}});function ya(e,t,r){var c,l,d;let n=new Map,i=(c=r==null?void 0:r.baseUrl)!=null?c:Rn(S.testMode),o=(l=r==null?void 0:r.type)!=null?l:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return Re("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,v=$e(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(v):p.reject(v),n.delete(g)}else if(u.state==="fail"){let m=u,{requestTaskId:g,state:b}=m,v=$e(m,["requestTaskId","state"]);p.reject(v),n.delete(g)}else Bt.warn("onRequestTaskStateChange unknown event",u)}),he.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...m)=>y(this,[f,...m],function*(u,p={}){let g=Date.now(),b=LR(u,U(x({},p),{baseUrl:i})),{method:v="GET",responseType:w="text",dataType:E="json",timeout:A,enableCache:P=!1,appendHostCookie:T=!0}=p,k=Object.assign({"content-type":"application/json"},a,p.header),G={url:b,method:v,header:k,enableCache:P,responseType:w,appendHostCookie:T};if(v=="POST"||v=="PUT"){let Ue=UR(p.data,k["content-type"]);G.data=Ue}A&&Object.assign(G,{timeout:A});let{data:{requestTaskId:fe}}=F(e,G);if(typeof fe!="string")throw Et({code:-1,msg:"requestTaskId is not a string"});let{resolve:L,reject:O,promise:be}=new nt;n.set(fe,{resolve:L,reject:O});try{let Ue=yield be,{data:jt}=Ue;return E==="json"&&typeof jt=="string"&&(jt=MR(jt)),{url:b,timeout:A,method:v,response:U(x({},Ue),{data:jt})}}catch(Ue){let jt=Ue;if(Yr(jt)){let{errMsg:An,prefetchDetail:MV,isPrefetch:UV,errNo:QP}=jt;Oi(An)&&_e(Et({code:-1,msg:An},{errNo:QP,errMsg:An}))}throw Ue}})}function MR(e){try{return JSON.parse(e.trim())}catch(t){return e}}function UR(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 LR,Yl=C(()=>{"use strict";R();ce();dt();Xr();B();LR=(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 Ql,Kh,Z,pt=C(()=>{"use strict";Yl();B();R();Ql={};(Kh=S.hostUserInfo)!=null&&Kh.token&&(Ql["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(Ql["x-joli-source"]=S.joliSource);Z=ya("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Rn(S.testMode),defaultHeaders:Ql})});function Yh(e){let t=Ul.config[e];return t||(t={},Ul.config[e]=t),(r,n)=>{if(t[r]){Bt.warn(`[can i use] ${r} already registered`);return}t[r]=x({},n)}}var Qh=C(()=>{"use strict";R()});function Xl(e){Xh=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 sr(e){return typeof e=="number"}function Zl(e){let t=eu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function eu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Xh,Ee,_a,wa,Sa,Ia,On,Ea,ka,Ca,Aa,xa,Pa,Ta,Ra,Oa,Na,Da,qa,tu=C(()=>{"use strict";Xh=!1;Ee=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Xh)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 ${Zl(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}};_a=class extends Ee{validate(t){return this._optional&&t===void 0?!0:sr(t)?sr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):sr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):sr(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}},wa=class extends Ee{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Sa=class extends Ee{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(sr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(sr(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}},Ia=class extends Ee{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},On=class extends Ee{validate(t){return!0}},Ea=class extends Ee{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},ka=class extends Ee{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Ca=class extends Ee{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},Aa=class extends Ee{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 ${Zl(t)}`)}return!0}},xa=class extends Ee{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(sr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(sr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(sr(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}},Pa=class extends Ee{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(eu(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 c=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}"]`,!(c===void 0&&o._optional)){if(c===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(c)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Ta=class extends Ee{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(eu(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}},Ra=class extends Ee{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:Zl(this.value),actual:r}):!0}},Oa=class extends Ee{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}},Na=class extends Ee{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}},Da=class extends Ee{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},qa=class extends Ee{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 ru(e,t,r="param"){if(e.errors=[],e.path=r,Xl(!0),!e.validate(t)){let n=e.errors.join(`
|
|
3
3
|
`);throw e.errors.length=0,Xl(!1),new TypeError(n)}}var I,nu=C(()=>{"use strict";tu();tu();I={object(e){return new Ta(e)},array(e){return new xa(e)},tuple(...e){return new Na(...e)},literal(e){return new Ra(e)},or(...e){return new Oa(...e)},symbol(){return new Ia},record(e){return new Pa(e)},function(){return new Ca},boolean(){return new wa},string(){return new Sa},number(){return new _a},undefined(){return new Ea},null(){return new ka},unknown(){return new On},any(){return new On},as(){return new On},arraybuffer(){return new Da},enum(...e){return new Aa(...e)},typedarray(e){return new qa(e)}}});var La,Zh,eg=C(()=>{"use strict";R();dt();nu();Xr();La=1,Zh=e=>{function t(n,i){return(...o)=>{var u,p,f,m;let a=Date.now(),s={method:n,trace_id:La};La+=1;let c="SUCCESS",l=`${n}:ok`,d=0;try{if(i.paramsSchema)try{ru(i.paramsSchema,o,"params")}catch(w){throw zl(`${n}:fail ${w.message}`)}let g=i.implement(...o),b=g,v=`${n}:ok`;if(g&&"code"in g){let{code:w,data:E,message:A}=g;c=w,b=E,v=A}return{code:c,message:v,data:b}}catch(g){let b=g;d=(p=(u=b.code)!=null?u:b.errNo)!=null?p:2e3,c="FAILURE";let v=(m=(f=b.message)!=null?f:b.errMsg)!=null?m:`${g}`;return l=`${n}:${c} ${v.replace(/^\S+:(fail|cancel)\s?/,"")}`,_e(new Li(l,d)),{code:c,message:l}}finally{let g=Date.now()-a}}}function r(n,i){return(...o)=>y(this,null,function*(){var p,f,m,g;let a=gh(o)?o:[o],s=Date.now(),c={method:n,trace_id:La};La+=1;let l=`${n}:ok`,d="SUCCESS",u={code:d,message:l};try{if(i.paramsSchema)try{ru(i.paramsSchema,a,"params")}catch(w){throw zl(w.message)}let v=yield i.implement(...a);if(v&&"code"in v){let{code:w,data:E,message:A}=v;d=w,l=A,v=E}return Object.assign(u,{code:d,message:l,data:v}),u}catch(b){let v=b,w=(f=(p=v.code)!=null?p:v.errNo)!=null?f:2e3;d="FAILURE";let E=(g=(m=v.message)!=null?m:v.errMsg)!=null?g:`${b}`,A=`${n}:${d} ${E.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:d,message:A}),_e(new Li(A,w)),u}finally{let b=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});function iu(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 tg=C(()=>{"use strict"});var ne,H,M,ft,Ve=C(()=>{"use strict";Qh();kt();eg();nu();ce();B();tg();({createAPI:ne,createSyncAPI:H}=Zh(j)),M=Yh("native"),{canIUseNative:ft}=rh(()=>S.sdkInfo.nativeSDKVersionCode,()=>S.platform)});function rg(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return t==="array"&&(t="object"),HR.includes(t)?t:""}function ng(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 ig(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 Ma,jR,GR,BR,JR,vz,yz,HR,Pr,mt,Ui=C(()=>{"use strict";Ve();ce();R();pt();B();Ma=Y(),jR=ne("getLocalStorage",{paramsSchema:I.tuple(I.string()),implement(e){return y(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 me("getLocalStorageAsync",{key:e}),s=ng(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}}})}});Ma.registerCommand("StorageSDK.getItem",jR);M("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});GR=ne("setStorage",{paramsSchema:I.tuple(I.string(),I.or(I.string(),I.boolean(),I.number())),implement(e,t){return y(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=rg(t),c=ig(t,s);return yield me("setLocalStorageAsync",{key:e,data:c,dataType:s}),o=="SUCCESS"?{code:o,message:a}:{code:o,message:`${a}. fallback to native`}})}});Ma.registerCommand("StorageSDK.setItem",GR);M("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});BR=ne("removeStorage",{paramsSchema:I.tuple(I.string()),implement(e){return y(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 me("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:i}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});Ma.registerCommand("StorageSDK.removeItem",BR);M("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});JR=ne("clearStorage",{implement(){return y(this,null,function*(){let e=S.mpId,{response:t}=yield Z(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});me("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});Ma.registerCommand("StorageSDK.clear",JR);M("storage.clear",{version:"1.0.0"});vz=ne("getStorageInfo",{implement(){return y(this,null,function*(){let{data:e}=yield me("getStorageInfoAsync");return e})}});M("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});yz=H("getStorageInfoSync",{implement(){return F("getStorageInfoSync")}}),HR=["string","number","boolean","object",""];Pr=ne("getGlobalStorage",{paramsSchema:I.tuple(I.string()),implement(e){return y(this,null,function*(){try{let{data:{data:t,dataType:r}}=yield me("getGlobalStorageAsync",{key:e});return{code:"SUCCESS",message:"success",data:ng(t,r)}}catch(t){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get global storage failed",data:null}}})}}),mt=ne("setGlobalStorage",{paramsSchema:I.tuple(I.string(),I.or(I.string(),I.boolean(),I.number(),I.array())),implement(e,t){return y(this,null,function*(){try{let r=rg(t),n=ig(t,r);return yield me("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 og,Ua,ag=C(()=>{"use strict";B();zh();R();pt();ce();Ui();og="REPORT_FIRST_OPEN_GAME",Ua=class extends va{constructor(t,r,n){super(r,n),this.gameId=S.mpId,this.sessionId=S.sessionId,this.track=t,this.taskUrl=Rn(S.testMode)+"/api/base/app-event"}reporter(t){return y(this,null,function*(){let{event:r,params:n,extraParams:i}=t,o={eventType:r,gameInfo:x({gameId:this.gameId,sessionId:this.sessionId},n)};i&&Object.assign(o,i),yield S.platform==="android"?Z("/api/base/app-event",{method:"POST",data:o}):me("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(o)})})}reportToNative(t){return y(this,null,function*(){let{event:r,params:n}=t;yield me("userTrackAsync",{event:r,params:x({},n),gameId:this.gameId})})}tracker(t,r=null){this.track(t,r)}start(t){super.start(t),this.tryReportOpenGamePlus()}tryReportOpenGamePlus(){Pr(og).then(t=>{xr(t.data)&&t.data&&this.tracker("OpenGame_2Plus"),mt(og,!0)})}}});var dg={};Fm(dg,{nativeTaskEmitter:()=>Fi,taskTracker:()=>Ot,track:()=>j,trackPerformance:()=>lg});var $R,sg,cg,j,lg,ug,Fi,Ot,kt=C(()=>{"use strict";jh();R();Kl();Wh();B();ag();ce();$R=(e,t,r)=>{var l,d,u,p,f,m,g;let n=t,i=Yr(n.extra)?n.extra:Oi(n.extra)?JSON.parse(n.extra):{},{mpName:o,mpVersion:a}=(l=S.mpInfo)!=null?l:{},s=x(x(U(x({},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}:{}),c=(m=n.eventType)!=null?m:J.Other;F("trackAsync",{event:(g=t.tag)!=null?g:e,data:s,webviewId:r,eventType:c})},{track:j,trackPerformance:lg}=Hh($R,{type:Fl.AppSDK,platform:"native",jssdk_version:(cg=(sg=S.sdkInfo)==null?void 0:sg.jssdkVersion)!=null?cg:"1.0.0",mp_id:S.mpId,mp_version:S.mpVersion}),ug=Y();ug.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{lg(e,t,r)});ug.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{j(e,t)});Fi=new Jt,Ot=new Ua(j,Fi)});function pg(){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
|
-
`,B5=()=>_("div",{style:zk.container,children:[_("style",{children:G5}),_("div",{style:zk.spinner})]});DQ=pn()});function VC(){return y(this,null,function*(){if(Qp)return Qp;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 Qp=r,r})}function WC(){return y(this,null,function*(){let e=new nt;if(S.mpType!=="game")return e.resolve(!1),e.promise;if(Xp)return e.resolve(!0),e.promise;let t=yield VC();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:i}=t.data;Xp=!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",x({eventType:J.View},o));let a=PC({games:r.games,title:n,buttons:i,onClose:s=>{var c;switch(Xp=!1,s.type){case"quit":j("RecommendedGuide",{eventType:J.Click,type:"QUIT",domain:"GAME"}),e.resolve(!1);break;case"dismiss":j("RecommendedGuide",x({eventType:J.Hide},o)),e.resolve(!0),a.destroy();break;case"navigate":if((c=s.data)!=null&&c.game){let l=s.data.game;J5(l),j("GameItem",{eventType:J.Click,gameId:l.gameId,layerName:"RecommendedGuide",domain:"GAME"}),setTimeout(()=>{e.resolve(!1)},0)}else e.resolve(!0);a.destroy();break;default:j("RecommendedGuide",x({eventType:J.Hide},o)),e.resolve(!0);break}}});return e.promise})}var Qp,J5,Xp,zC=C(()=>{"use strict";B();ce();R();er();pt();kt();Qp=null;VC();J5=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})},Xp=!1});function $5(e){let t=x(x({},H5),e),{url:r,height:n,showCloseButton:i,enableDragClose:o,useAnimation:a,onClose:s,onLoad:c}=t,l=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 m(){let{overlayTransition:w,containerTransition:E,iframeTransition:A}=p();ae=document.createElement("div"),ae.id="jolibox-modal-overlay",ae.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:${w}; opacity:0; visibility:hidden;`,X=document.createElement("div"),X.id="jolibox-modal-container",X.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:${E};`;let P=document.createElement("div");P.id="jolibox-modal-loading",P.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 T=document.createElement("style");T.textContent="@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }",document.head.appendChild(T);let k=document.createElement("div");if(k.style.cssText="width:100%; height:100%; display:flex; flex-direction:column; padding-bottom:env(safe-area-inset-bottom, 0); position:relative;",xt=document.createElement("iframe"),xt.style.cssText=`width:100%; flex:1; border:none; opacity:0; transition:${A};`,xt.src=r,xt.onload=()=>{P.parentNode&&P.parentNode.removeChild(P),xt.style.opacity="1",g(),c==null||c(),he.emit("onModalIframeLoaded",{url:r})},k.appendChild(xt),k.appendChild(P),X.appendChild(k),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=v,X.appendChild(G)}ae.appendChild(X),document.body.appendChild(ae),ae.addEventListener("click",function(G){G.target===ae&&v()}),o&&b()}function g(){!ae||!X||u||(ae.style.visibility="visible",a?requestAnimationFrame(()=>{ae&&(ae.style.opacity="1"),X&&(X.style.transform="translateY(0)"),u=!0}):(ae&&(ae.style.opacity="1"),X&&(X.style.transform="translateY(0)"),u=!0),F("updateContainerConfigSync",{displayCapsuleButton:!1,webviewId:S.webviewId}))}function b(){if(!X)return;let w=P=>{l=P.touches[0].clientY},E=P=>{if(!u)return;d=P.touches[0].clientY;let T=d-l;T>0&&(X&&(X.style.transition="none",X.style.transform=`translateY(${T}px)`),P.preventDefault())},A=()=>{!u||!X||(X.style.transition=a?"transform 0.3s ease":"none",d-l>80?v():X.style.transform="translateY(0)")};X.addEventListener("touchstart",w),X.addEventListener("touchmove",E),X.addEventListener("touchend",A)}function v(){!ae||!X||!u||(a?(X.style.transform="translateY(100%)",ae.style.opacity="0"):ae.style.visibility="hidden",u=!1,F("updateContainerConfigSync",{displayCapsuleButton:!0,webviewId:S.webviewId}),setTimeout(()=>{ae&&(ae.remove(),ae=null,X=null,xt=null,s==null||s(),he.emit("onModalIframeClosed",{url:r}))},f()))}return m(),{close:v}}function KC(){return window.joliboxUI=U(x({},window.joliboxUI),{createIframeModal:$5}),()=>{window.joliboxUI=void 0,ae&&ae.parentNode&&ae.parentNode.removeChild(ae),X&&X.parentNode&&X.parentNode.removeChild(X),xt&&xt.parentNode&&xt.parentNode.removeChild(xt),ae=null,X=null,xt=null}}var H5,ae,X,xt,YC=C(()=>{"use strict";ce();B();R();H5={height:"50%",showCloseButton:!0,enableDragClose:!0,useAnimation:!0},ae=null,X=null,xt=null});var eA={};Fm(eA,{config:()=>r3});function W5(){Fa.on("isAdShowing",e=>{pc=e,xr(pc)&&F("updateContainerConfigSync",{displayCapsuleButton:!pc,webviewId:S.webviewId})})}function z5(){he.on("onInterceptSystemExit",({intercept:e})=>{QC=e})}function K5(){he.on("onInterceptBackPress",({intercept:e})=>{V5=e}),Re("onBeforeBackPress",({uuid:e,disableExitRecommendDialog:t})=>{var r,n;ZC(t),he.emit("onBackPress",{}),(n=(r=globalThis.joliboxJSCore)==null?void 0:r.doBackPress)==null||n.call(r,e)})}function Y5(){he.on("onDocumentReady",()=>{var e;(e=globalThis.joliboxJSCore)==null||e.onDocumentReady(window.location.href),j("onDocumentReady",{start_timestamp:mc,timestamp:Date.now()})})}function Q5(){Re("onI18nChanged",({language:e})=>{he.emit("onI18nChanged",{i18n:e})})}function X5(e){S.mpType==="game"&&Ot.start(e)}function Z5(){Re("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&S.onEnvConfigChanged({hostUserInfo:e}),he.emit("LifecycleEvent.onReady",x({},S.hostUserInfo?S.hostUserInfo:{isLogin:!1})),j("joliboxServiceReady",{start_timestamp:mc,timestamp:Date.now()}),X5(t),IC(()=>S.language)}),Re("onBeforeExit",({uuid:e,disableExitRecommendDialog:t})=>{var r;ZC(t),(r=globalThis.joliboxJSCore)==null||r.doExit(e)})}function e3(){let e=()=>{j("onBeforeExit",{timestamp:Date.now()}),uc==null||uc(),dc==null||dc(),Ot.close(Date.now()-mc)},t=()=>pc||QC;It.onDoExit(()=>y(this,null,function*(){return t()?!0:xr(S.shouldInterupt)?(S.shouldInterupt||e(),S.shouldInterupt):fc!=null&&fc.canShowRecommended&&!XC&&(yield WC())?!0:(e(),!1)})),It.onDoBackPress(()=>y(this,null,function*(){return!!t()}))}function t3(){return y(this,null,function*(){try{let e="/api/fe-configs/js-sdk/basic-meta",{response:{data:t}}=yield Z(e);t&&(fc=t)}catch(e){console.error("fetchMetaConfig error:",e)}})}function r3(){mc=Date.now(),Z5(),W5(),z5(),K5(),e3(),Y5(),Q5(),t3(),dc=KC(),uc=pg()}var uc,dc,mc,pc,fc,QC,V5,XC,ZC,tA=C(()=>{"use strict";ce();B();R();kt();fg();ou();zC();pt();er();YC();pc=!1,fc=null,QC=!1,V5=!1,XC=!1,ZC=e=>{xr(e)&&(XC=e)};It.onReady(()=>{})});var rA,n3,i3,o3,a3,nA=C(()=>{"use strict";R();Ve();ce();B();rA=Y(),n3="env",i3="getSystemInfoSync",o3=H(i3,{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}}}}),a3=H(n3,{implement:()=>{var t;let e=F("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});rA.registerCommand("API.getSystemInfoSync",o3);rA.registerCommand("API.env",a3);M("env",{version:"1.0.0"});M("getSystemInfoSync",{version:"1.0.0",properties:{viewport:"1.0.33"}})});var iA=h(Zp=>{"use strict";R();Ve();dt();ce();kt();B();var s3="exitGame",c3="onReady",l3="onJoliboxShow",u3="onJoliboxHide",hc=Y(),gc=ga(_e),d3=ne(s3,{paramsSchema:I.tuple(I.function(),I.boolean().optional().default(!1)),implement:(e,t=!1)=>y(Zp,null,function*(){gc(e).call(Zp),xr(S.shouldInterupt)&&!S.shouldInterupt&&S.from&&ch("onRetentionResult",{shouldStay:t},S.from,!0),t||S.setDoExitDirectly(),yield me("exitAppAsync")})}),p3=H(l3,{paramsSchema:I.tuple(I.function()),implement(e){let t=gc(e);Re("onJoliboxEnterForeground",()=>{t.call(this),Fi.emit("visible",!0)})}}),f3=H(u3,{paramsSchema:I.tuple(I.function()),implement(e){let t=gc(e);Re("onJoliboxEnterBackground",()=>{t.call(this),Fi.emit("visible",!1)})}}),m3=H(c3,{paramsSchema:I.tuple(I.function()),implement(e){let t=gc(e);he.on("LifecycleEvent.onReady",r=>{t(r)})}});hc.registerCommand("LifecycleSDK.exit",d3);hc.registerCommand("LifecycleSDK.onReady",m3);hc.registerCommand("LifecycleSDK.onJoliboxShow",p3);hc.registerCommand("LifecycleSDK.onJoliboxHide",f3);M("lifeCycle.exit",{version:"1.0.0"});M("lifeCycle.onReady",{version:"1.0.0"});M("lifeCycle.onJoliboxShow",{version:"1.0.0"});M("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function oA(e){let t={};if(!Yr(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 aA(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 sA(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function cA(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!Yr(r))return e;let[n,i=""]=e.split("?"),o=new URLSearchParams(i);for(let[s,c]of Object.entries(r))c!=null&&o.append(s,String(c));let a=o.toString();return a?`${n}?${a}`:n}var lA=C(()=>{"use strict";R()});var h3,g3,ef,tf,uA,v3,y3,b3,dA=C(()=>{"use strict";Xr();Yl();Ve();lA();R();dt();B();h3=15,g3=ya("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:S.baseApiHost}),ef=0,tf=[],uA=ga(_e),v3=(e,t)=>{let r=e.filter(t),n=e.filter(i=>!t(i));return e.length=0,e.push(...n),r},y3=e=>{let t=new nt,r=()=>{};return H("request",{paramsSchema:I.tuple(I.object({url:I.string(),method:I.string(),headers:I.object().optional(),data:I.or(I.object(),I.array()).optional(),query:I.object().optional(),dataType:I.string().default("json"),responseType:I.string().default("text"),enableCache:I.boolean().default(!1),appendHostCookie:I.boolean().default(!0),timeout:I.number().default(3e4),success:I.function(),fail:I.function()})),implement(i){let o=()=>y(this,null,function*(){var s,c,l;let a=uA(i.fail);try{if(ef+=1,t.state!=="pending")return;let{data:d,dataType:u,responseType:p,enableCache:f,appendHostCookie:m}=i,g=oA((s=i.headers)!=null?s:{}),b=aA(i.method),v=sA(i.timeout),w=cA(i.url,b,d),E=uA(i.success),A=Object.assign({},i,{method:b,header:m?void 0:g,data:b==="GET"||b==="HEAD"?void 0:d,enableCache:f,query:(c=i.query)!=null?c:{},dataType:u,responseType:p,appendHostCookie:m});v&&(A.timeout=v);let P=g3(w,A);{let{response:T}=yield P,{code:k,data:G,message:fe}=T;if(G&&typeof G=="object"&&"status"in G&&G.status!==200)throw Et({code:G.status||-1,msg:`request:fail status ${G.status}`});t.resolve({code:k!=null?k:"SUCCESS",data:G,message:fe!=null?fe:"request:ok"}),E({code:"SUCCESS",message:"request:ok",data:G})}}catch(d){t.reject(d),a({code:"FAILURE",message:"httpRequst: failed"})}finally{ef-=1,(l=tf.shift())==null||l()}});return ef>=h3?(r=()=>{v3(tf,a=>a===o)},tf.push(o)):o(),t.promise}})(e),{abort(){t.reject(Et({code:-1,msg:"request:fail abort"})),r()}}},b3=Y();b3.registerCommand("HttpSDK.request",y3);M("request",{version:"1.0.0"})});var _3,w3,S3,rf,pA=C(()=>{"use strict";R();ce();Ve();_3=H("showKeyboard",{paramsSchema:I.tuple(I.object({defaultValue:I.string().optional().default(""),multiple:I.boolean().optional().default(!1),maxLength:I.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",U(x({},e),{defaultValue:r,maxLength:t}))}});M("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"}});w3=H("updateKeyboard",{paramsSchema:I.tuple(I.object({value:I.string()})),implement(e){F("updateKeyboardSync",e)}});M("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});S3=H("hideKeyboard",{implement(){F("hideKeyboardSync")}});M("keyboard.hideKeyboard",{version:"1.0.0"});rf=Y();rf.registerCommand("KeyboardSDK.showKeyboard",_3);rf.registerCommand("KeyboardSDK.updateKeyboard",w3);rf.registerCommand("KeyboardSDK.hideKeyboard",S3)});var fA=h(vc=>{"use strict";R();Ve();kt();var nf=Y(),I3=ne("levelFinished",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number()),duration:I.number().optional(),rating:I.number().optional(),score:I.number().optional(),variation:I.string().optional()})),implement:e=>y(vc,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e,a=[];a.push(Ot.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})),a.push(Ot.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}})),yield Promise.all(a)})}),E3=ne("gamePlayEnded",{paramsSchema:I.tuple(I.object({duration:I.number().optional(),rating:I.number().optional(),score:I.number(),variation:I.string().optional()})),implement:e=>y(vc,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e,o=[];o.push(Ot.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i})),o.push(Ot.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})),yield Promise.all(o)})}),k3=ne("levelUpgrade",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number()),name:I.string().optional()})),implement:r=>y(vc,[r],function*({levelId:e,name:t}){let n=[];n.push(Ot.tracker("LevelUpgrade",{name:t,levelId:e})),n.push(Ot.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})),yield Promise.all(n)})});nf.registerCommand("TaskTrackerSDK.levelFinished",I3);nf.registerCommand("TaskTrackerSDK.gamePlayEnded",E3);nf.registerCommand("TaskTrackerSDK.levelUpgrade",k3);M("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"}}});M("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});M("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}})});var of,af,sf,C3,mA,yc=C(()=>{"use strict";B();ce();Ve();R();Xr();M("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"}});M("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0",isLogin:"1.0.0",isSubUser:"1.2.9"}});of=new Map;Re("onLoginStateChange",({isLogin:e,token:t,uuid:r,isFirstLogin:n,extra:i,appAccountToken:o})=>{let a=of.get(r);a&&(a.resolve({isLogin:e,token:t,isFirstLogin:n,extra:i,appAccountToken:o}),of.delete(r))});af=(e,t=!1)=>y(void 0,null,function*(){var m,g,b;let{data:{isLogin:r}}=yield me("checkLoginAsync");if(r)return{isLogin:!0,token:(m=S.hostUserInfo)==null?void 0:m.token};let{skipLogin:n,triggerFrom:i}=e!=null?e:{},o=F("loginSync",{skipLogin:n,triggerFrom:i}),{data:{uuid:a}}=o;if(!a)throw Et({code:-1,msg:"login failed"});let s=new nt;of.set(a,s);let c=yield s.promise,l=F("envSync"),d=(b=(g=l==null?void 0:l.data)==null?void 0:g.hostUserInfo)==null?void 0:b.isSubUser;S.onEnvConfigChanged({hostUserInfo:U(x({},c),{isSubUser:d})});let v=c,{extra:u,appAccountToken:p}=v,f=$e(v,["extra","appAccountToken"]);return he.emit("onLoginComplete",f),t?c:f}),sf=ne("login",{paramsSchema:I.tuple(I.object({skipLogin:I.boolean().optional(),triggerFrom:I.string().optional()}).optional()),implement(e){return y(this,null,function*(){return yield af(e!=null?e:{})})}}),C3=ne("checkSession",{implement(){return y(this,null,function*(){var r;let{data:{isLogin:e}}=yield me("checkLoginAsync"),t=(r=S.hostUserInfo)==null?void 0:r.isSubUser;return{isLogin:e,isSubUser:t}})}}),mA=Y();mA.registerCommand("API.login",sf);mA.registerCommand("API.checkSession",C3)});var hA,gA=C(()=>{"use strict";hA=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 fn(e){return t=>y(this,null,function*(){var c;let{dailyMaxPopUps:r,minInterval:n}=t,i=yield Pr(e);if(!i.data)return{canShow:!0,isFirst:!0};let o=vA(i.data),a=hA(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-((c=a==null?void 0:a[0])!=null?c:0)<n?{canShow:!1,isFirst:!1}:{canShow:!0,isFirst:!1}})}function mn(e){return()=>y(this,null,function*(){var i;let t=Date.now(),r=yield Pr(e),n=vA((i=r.data)!=null?i:"[]");n.push(t),n.sort((o,a)=>a-o).splice(8),yield mt(e,JSON.stringify(n))})}var vA,yA,bA,_A,wA,SA,IA,EA,kA,CA,AA,xA,PA,TA,RA,Uo=C(()=>{"use strict";Ui();gA();vA=e=>{let t;try{t=JSON.parse(e)}catch(r){t=[]}return t};yA=fn("joli_coin_use_modal_frequency"),bA=fn("joli_coin_payment_frequency"),_A=fn("joli_coin_unlogin_modal_frequency"),wA=fn("joli_gem_use_modal_frequency"),SA=fn("joli_gem_payment_frequency"),IA=fn("joli_gem_unlogin_modal_frequency"),EA=fn("subscription_frequency");kA=mn("joli_coin_use_modal_frequency"),CA=mn("joli_coin_payment_frequency"),AA=mn("joli_coin_unlogin_modal_frequency"),xA=mn("joli_gem_use_modal_frequency"),PA=mn("joli_gem_payment_frequency"),TA=mn("joli_gem_unlogin_modal_frequency"),RA=mn("subscription_frequency")});var cf,bc,lf=C(()=>{"use strict";pt();cf=Promise.resolve(),bc=(e,t)=>y(void 0,null,function*(){cf=cf.then(()=>y(void 0,null,function*(){yield Z(t,{method:"POST",appendHostCookie:!0,data:{enableAutoDeduct:e}})})),yield cf})});var _c,wc,Mt,Sc,hn,Ut,yr,Ic,Ec,gn,ai,A3,q,br,_r,Le=C(()=>{"use strict";R();_c="UNLOCK_OPTIONS_CHANGED",wc="INVOKE_PAYMENT",Mt="ON_PAYMENT_RESULT",Sc="ON_USE_MODAL_EVENT",hn="ON_USE_MODAL_RESULT",Ut="ON_USE_MODAL_FREQUENCY",yr="ON_USE_UNLOGIN_MODAL_EVENT",Ic="INVOKE_UNLOGIN_MODAL_EVENT",Ec="INVOKE_SUBSCRIPTION_EVENT",gn="ON_USE_SUBSCRIPTION_RESULT",ai=new Jt,A3=()=>({on:ai.on.bind(ai),off:ai.off.bind(ai),emit:ai.emit.bind(ai)}),q=A3(),br={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},_r={show:!0,minInterval:8*60*60*1e3}});function Me(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=x(x({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}var tr=C(()=>{"use strict"});var DA=h(uf=>{"use strict";Uo();lf();Le();Le();er();kt();R();tr();var x3={JOLI_COIN:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"unlock_popup_show",coinUnlock:"coin_unlock_click",adUnlock:"ad_unlock_click"},frequencyChecker:yA,frequencyUpdater:kA,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:wA,frequencyUpdater:xA,apiEndpointAutoDeduct:"/api/joli-gem/user-config"}},OA=pn(),NA=Me(q,Ut);NA.getData();q.on(Sc,(e,t)=>y(uf,null,function*(){let r=t.currency,n=x3[r];if(e.includes("ADS-")){yield OA.show({duration:3e3});let c=yield NA.getData(),{canShow:l,isFirst:d}=yield n.frequencyChecker(c.joliCoinUseAndCharge[n.frequencyConfigKey]);console.log(`${r} modal show by frequency`,l,d),OA.hide();let{balance:u}=t.userCurrency;if(u>=t.quantity&&t.enableAutoDeduct&&!d){q.emit(hn,{useModalResult:"CONFIRM"});return}if(!l){q.emit(hn,{useModalResult:"FAILED"});return}}j(n.trackEvents.popupShow,{eventType:J.View,targetType:"game",currency:r});let{userCurrency:i,enableAutoDeduct:o,quantity:a}=t,s=NC({data:{enableAutoDeduct:o,userCurrency:i,quantity:a,currency:r},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>{j(n.trackEvents.coinUnlock,{targetType:"game",eventType:J.Click,coinConsume:t.quantity,ifAutoUnlock:t.enableAutoDeduct,currency:r}),q.emit(hn,{useModalResult:"CONFIRM"}),s.destroy()}},cancel:{text:t.cancelButtonText,onPress:({type:c})=>{c==="FAILED"&&j(n.trackEvents.adUnlock,{targetType:"game",eventType:J.Click,currency:r}),q.emit(hn,{useModalResult:(c!=null?c:"")==="CANCEL"?"CANCEL":"FAILED"}),s.destroy()}},onEnableDeductChanged:c=>y(uf,null,function*(){yield bc(c,n.apiEndpointAutoDeduct)})}});yield n.frequencyUpdater()}))});function qA(){let e=new Map;return{registerPaymentHandler(r,n){e.set(r,n)},invokePayment(r,...n){return y(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 _e(o),{code:"FAILED",message:`[joliboxSDK]: paymenterror ${o}`}}})}}}var LA=C(()=>{"use strict";dt()});var Fo=C(()=>{"use strict"});var P3,si,bt,T3,vn,kc=C(()=>{"use strict";Fo();R();B();pt();P3=()=>{let[e,t]=[ma,ha].map(r=>(n,i,o)=>new r(n,i,o));return{createPaymentError:e,createPaymentInternalError:t}},{createPaymentError:si,createPaymentInternalError:bt}=P3(),T3=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",vn=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startPayment=t=>y(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw si(n,1001);return yield this.pay()});this.cancelOrder=t=>y(this,null,function*(){var n,i;let{response:r}=yield Z(`/api/orders/${t}/cancel`,{method:"POST",data:{}});if(r.code!=="SUCCCESS")throw si((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(x({},this.generatePaymentContext()))),`${T3}//payment/callback?${t.toString()}`}}get orderId(){return this._orderId}get status(){return this._orderStatus}}});var pf,MA,UA=C(()=>{"use strict";pt();kc();Fo();pf=class extends vn{constructor(r){super();this.productId=r;this.generatePaymentContext=()=>({type:"JOLI_COIN_ORDER_CONTEXT",state:"TO_VALIDATE",productId:this.productId,orderId:this.orderId});this.pay=()=>y(this,null,function*(){let r=this.generateCallbackUrl();return console.info("callbackUrl",r),{code:"SUCCESS",message:"jolicoin payment success"}})}placeOrder(r){return y(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 si((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),bt((a=JSON.stringify(s))!=null?a:"jolicoin placeorder failed",1002)}})}},MA=()=>{let e=new Map;return t=>y(void 0,null,function*(){let r=e.get(t);return r||(r=new pf(t),e.set(t,r)),yield r.startPayment({productId:t}),{code:"SUCCESS",message:"jolicoin payment success"}})}});var FA,jA=C(()=>{"use strict";FA={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 ff,GA,mf,hf,R3,gf,BA=C(()=>{"use strict";pt();kc();Fo();ce();R();B();er();jA();ff=new Map;Re("onPaymentStateChange",e=>{console.info("onPaymentStateChange",e);let{orderUUID:t,status:r,totalAmount:n,orderResponse:i}=e,o=ff.get(t);if(o){if(r==="SUCCESS")Jr("{slot-success} {slot-i18n-jolicoin.unlockSuccess}",{position:"center",duration:3e3}),o.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{totalAmount:n}});else{if(r==="FAILED"&&fa(i==null?void 0:i.errNo)&&(i==null?void 0:i.errNo)!==0)throw bt(`jolicoin payment failed: ${i==null?void 0:i.errMsg}`,1002);let a=FA[r];a&&Jr(`{slot-error} {slot-i18n-jolicoin.${a}}`,{position:"center",duration:3e3}),o.resolve({code:"FAILED",message:"jolicoin payment failed"})}ff.delete(t)}});GA=e=>y(void 0,null,function*(){var n,i;let t=new nt,r;try{let o=yield me("requestPaymentSync",{paymentBody:{appStoreProductId:e.appStoreProductId,appAccountToken:e.appAccountToken}});if(r=(n=o.data)==null?void 0:n.orderUUID,console.info("---purchaseGem---",o),!r)throw bt("orderUUID is null",1002);ff.set(r,t)}catch(o){throw bt((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),mf=class extends vn{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=()=>y(this,null,function*(){return yield GA({appStoreProductId:this.appStoreProductId})})}placeOrder(r){return y(this,null,function*(){return{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},hf=class extends vn{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=()=>y(this,null,function*(){return yield GA({appStoreProductId:this.appStoreProductId,appAccountToken:this.appAccountToken})})}placeOrder(r){return y(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 bt("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"}})}},R3={android:mf,ios:hf},gf=()=>{let e=new Map;return t=>y(void 0,null,function*(){let{productId:r,appStoreProductId:n}=t,i=e.get(r);if(!i){let s=R3[S.platform];if(!s)throw bt("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 si(a,1002);return{code:"SUCCESS",message:"jolicoin payment success"}})}});var yn,vf=C(()=>{"use strict";LA();UA();BA();yn=qA();yn.registerPaymentHandler("JOLI_COIN",MA());yn.registerPaymentHandler("JOLI_COIN_IAP",gf());yn.registerPaymentHandler("JOLI_GEM_IAP",gf())});function JA(n,i){return y(this,arguments,function*(e,t,r={}){let{storageKeyPrefix:o="joli_cache_"}=r,a=o+e,s=a+"_timestamp";try{let c=yield t(),l=Date.now();try{c!=null&&(yield mt(a,c),yield mt(s,l.toString()),console.log("[Cache] Cached result for key:",e))}catch(d){console.warn("[Cache] Failed to save to localStorage for key:",e,d)}return c}catch(c){throw console.warn("[Cache] Executor failed for key:",e,c),c}})}function Cc(n,i){return y(this,arguments,function*(e,t,r={}){let{cacheDuration:o=-1,storageKeyPrefix:a="joli_cache_"}=r,s=a+e,c=s+"_timestamp",l=o===1/0||o===-1;try{let{data:d}=yield Pr(s),{data:u}=yield Pr(c);if(d&&u){let p=parseInt(u,10);if(l||Date.now()-p<o){console.log("[Cache] Using localStorage cached data for key:",e);let f=JSON.parse(d);return l||setTimeout(()=>y(this,null,function*(){try{console.log("[Cache] Background updating cache for key:",e);let m=yield t(),g=Date.now();yield mt(s,m),yield mt(c,g.toString()),console.log("[Cache] Background cache update completed for key:",e)}catch(m){console.warn("[Cache] Background cache update failed for key:",e,m)}}),0),f}else yield mt(s,null),yield mt(c,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 mt(s,d),yield mt(c,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 yf=C(()=>{"use strict";Ui()});function O3(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=>!Ni(r.totalAmountStr))}var Hr,bf,rr,Pc,_f,wf,Ac,xc,HA,Tc,Sf=C(()=>{"use strict";vf();R();ce();pt();R();yf();Hr=class Hr{execute(t,r){return y(this,null,function*(){var a,s,c;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=(c=(s=i.paymentChoices)==null?void 0:s.filter(l=>typeof l.appStoreProductId=="string").map(l=>l.appStoreProductId))!=null?c:[];if(o.length>0){let l=yield this.getNativePriceData(o);l&&O3(i,l)}if(i.paymentChoices.length===0)throw new Error("paymentChoices is empty");return i})}getNativePriceData(t){return y(this,null,function*(){let r=t.sort().join(",");return Cc(r,()=>y(this,null,function*(){try{let{data:n}=yield me("requestProductDetailsAsync",{appStoreProductIds:t});return n&&(Hr.nativePriceCache.set(r,n),Hr.nativePriceCacheTimestamp.set(r,Date.now())),n}catch(n){throw console.warn("[PaymentService] Failed to fetch native product details:",n),n}}),{cacheDuration:Hr.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")}};Hr.nativePriceCache=new Map,Hr.NATIVE_PRICE_CACHE_DURATION=1*24*60*60*1e3,Hr.nativePriceCacheTimestamp=new Map;bf=Hr,rr=class rr extends Rt{constructor(r,n){super(new bf,{duration:10*60*1e3,timeout:1e3});this.apiEndpoint=r;this.paymentType=n}getProductsInfo(){return y(this,null,function*(){let r=rr.failureCounters.get(this.apiEndpoint)||0;if(r>=rr.MAX_FAILURE_COUNT)throw new Error(`getProductsInfo has failed more than ${rr.MAX_FAILURE_COUNT} times for ${this.apiEndpoint}`);try{let n=yield this.request(this.apiEndpoint);return rr.failureCounters.delete(this.apiEndpoint),n}catch(n){let i=r+1;throw rr.failureCounters.set(this.apiEndpoint,i),console.warn(`[PaymentService] getProductsInfo failed (${i}/${rr.MAX_FAILURE_COUNT+1}) for ${this.apiEndpoint}:`,n),n}})}purchase(r){return y(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 yn.invokePayment(this.paymentType==="JOLI_COIN"?"JOLI_COIN_IAP":"JOLI_GEM_IAP",{productId:r,appStoreProductId:i})})}getProductsInfoWithBalance(){return y(this,null,function*(){return this.request(this.apiEndpoint)})}refreshProductsInfo(){return y(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}static resetFailureCounters(){this.failureCounters.clear()}static getFailureCount(r){return this.failureCounters.get(r)||0}};rr.failureCounters=new Map,rr.MAX_FAILURE_COUNT=2;Pc=rr,_f=class extends Pc{constructor(){super("/api/joli-coin/balance-detail","JOLI_COIN")}},wf=class extends Pc{constructor(){super("/api/joli-gem/balance-detail","JOLI_GEM")}},Ac=null,xc=null,HA=()=>Ac||(Ac=new _f,Ac),Tc=()=>xc||(xc=new wf,xc)});var WA=h(Rc=>{"use strict";Le();er();B();yc();R();Uo();vf();er();Ve();kt();lf();tr();Sf();var N3={JOLI_COIN:{frequencyConfigKey:"charge",trackEvents:{modalShow:"coinorder_show",orderClick:"coinorder_click",payEnsure:"order_pay_ensure",payResult:"order_pay_result",adUnlock:"ad_unlock_click"},frequencyChecker:bA,frequencyUpdater:CA,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:SA,frequencyUpdater:PA,apiEndpoint:"/api/joli-gem/balance-detail",apiEndpointAutoDeduct:"/api/joli-gem/user-config",paymentType:"JOLI_GEM_IAP"}},ci=pn(),$A=HA(),VA=Tc(),D3=Me(q,Ut);q.on(wc,(e,t)=>y(Rc,null,function*(){var r,n,i;try{let o=t.currency,a=N3[o];if(!ft("requestPaymentSync:paymentBody:appStoreProductId")){console.info("requestPaymentSync:paymentBody:appStoreProductId not supported"),setTimeout(()=>{q.emit(Mt,{paymentResult:"FAILED",currency:o})},0);return}if(e.includes("ADS-")){yield ci.show({duration:3e3});let d=yield D3.getData(),{canShow:u}=yield a.frequencyChecker(d.joliCoinUseAndCharge[a.frequencyConfigKey]);if(console.log(`${o} payment show by frequency`,u),ci.hide(),!u){q.emit(Mt,{paymentResult:"FAILED",currency:o});return}console.log("show by frequency")}yield ci.show({duration:3e3});let s=o==="JOLI_COIN"?$A:VA,c=yield s.getProductsInfo();if(ci.hide(),!c||!((r=c.paymentChoices)!=null&&r.length)){q.emit(Mt,{paymentResult:"FAILED",currency:o});return}j(a.trackEvents.modalShow,{targetType:"game",eventType:J.View,currency:o});let l=DC({data:{userCurrency:t.userCurrency,quantity:t.quantity,currency:o,paymentChoices:(i=(n=c.paymentChoices)==null?void 0:n.map(d=>{var u;return U(x({},d),{totalAmountStr:(u=d.totalAmountStr)!=null?u:""})}))!=null?i:[],enableAutoDeduct:t.enableAutoDeduct},buttons:{confirm:{text:t.confirmButtonText,onPress:d=>y(Rc,null,function*(){var f,m,g,b,v,w,E,A;if(j(a.trackEvents.payEnsure,{targetType:"game",eventType:J.Click,payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(m=(f=c.paymentChoices.find(P=>P.productId===d))==null?void 0:f.totalAmountStr)!=null?m:""}),!((g=S.hostUserInfo)!=null&&g.isLogin)){let{data:P}=yield sf({skipLogin:!0});if(!(P!=null&&P.isLogin)){console.log("login failed");return}let T=yield s.refreshProductsInfo();if(((b=T==null?void 0:T.balance)!=null?b:0)>=t.quantity){q.emit(Mt,{paymentResult:"SUCCESS",currency:o}),l.destroy();return}}console.log("invokeNativePayment",d);let u=(w=(v=c==null?void 0:c.paymentChoices)==null?void 0:v.find(P=>P.productId===d))==null?void 0:w.appStoreProductId;if(!u){q.emit(Mt,{paymentResult:"FAILED",currency:o}),l.destroy();return}yield ci.show({duration:3e3});let{code:p}=yield yn.invokePayment(a.paymentType,{productId:d,appStoreProductId:u});if(ci.hide(),j(a.trackEvents.payResult,{eventType:J.Other,targetType:"game",payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(A=(E=c.paymentChoices.find(P=>P.productId===d))==null?void 0:E.totalAmountStr)!=null?A:"",payResult:p}),console.log("payment result",p),p!=="SUCCESS"){console.info("[JoliboxSDK] payment failed in payment.invokePaymet");return}q.emit(Mt,{paymentResult:"SUCCESS",currency:o}),l.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:d})=>{q.emit(Mt,{paymentResult:(d!=null?d:"")==="CANCEL"?"CANCEL":"FAILED",currency:o}),j(a.trackEvents.adUnlock,{targetType:"game",eventType:J.Click,currency:o}),l.destroy()}},onEnableDeductChanged:d=>y(Rc,null,function*(){yield bc(d,a.apiEndpointAutoDeduct)})},onSelect:d=>{var u,p;j(a.trackEvents.orderClick,{targetType:"game",eventType:J.Click,coinAmount:t.quantity,currency:o,orderPrice:(p=(u=c.paymentChoices.find(f=>f.productId===d))==null?void 0:u.totalAmountStr)!=null?p:""})}});yield a.frequencyUpdater()}catch(o){console.error("payment failed",o),q.emit(Mt,{paymentResult:"FAILED",currency:t.currency})}}));$A.getProductsInfo().catch(e=>{console.error("preload joli coin payment details failed",e)});VA.getProductsInfo().catch(e=>{console.error("preload joli gem payment details failed",e)})});var KA=h(Oc=>{"use strict";Le();tr();Uo();pt();dt();R();yc();er();kt();var q3={JOLI_COIN:{frequencyChecker:_A,frequencyUpdater:AA,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:IA,frequencyUpdater:TA,trackEvents:{modalExpose:"GemLoginGuideModal",clickConfirm:"GemLoginGuideModal",clickConfirmLogin:"GemLoginGuideModal",modalHide:"GemLoginGuideModal",clickClose:"GemLoginGuideModal",clickWatchAds:"GemLoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.gemRewardTips}",usedText:"Gem Used"}}},zA=Me(q,Ut);zA.getData();q.on(Ic,(e,t)=>y(Oc,null,function*(){var r;try{let n=t.currency,i=q3[n];if(e.includes("ADS-")){let s=yield zA.getData();if(console.log(`${n} unlogin guide config`,s.loginGuide),!s.loginGuide.show){q.emit(yr,{result:"NOT_SUPPORT"});return}let{canShow:c}=yield i.frequencyChecker(s.loginGuide);if(console.log(`${n} canShowUseModal`,c),!c){q.emit(yr,{result:"FAILED"});return}}let{firstLogin:o}=(r=yield L3())!=null?r:{};if(!(o!=null&&o.reward)){console.log("[JoliboxSDK] unlogin modal reward is empty"),q.emit(yr,{result:"NOT_SUPPORT"});return}j(i.trackEvents.modalExpose,{eventType:J.Expose,currency:n},J.Expose);let a=qC({data:{rewardType:e,rewardValue:o.reward.rewardValue,currency:t.currency},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>y(Oc,null,function*(){var d,u,p,f;j(i.trackEvents.clickConfirm,{type:"click_confirm",eventType:J.Click,currency:n},J.Click);let{isLogin:s,extra:c,isFirstLogin:l}=yield af({},!0);if(!s){console.log("login failed");return}if(j(i.trackEvents.clickConfirmLogin,{type:"click_confirm_login",isFirstLogin:l,eventType:J.Click,currency:n},J.Click),l&&((d=c==null?void 0:c.firstLogin)!=null&&d.reward)){let{rewardValue:m}=c.firstLogin.reward;Jr(i.toastMessage.i18nKey,{i18nParams:{text:i.toastMessage.usedText,coin:m},position:"top",duration:3e3})}q.emit(yr,{result:"SUCCESS",rewards:{claimedRewardValue:(f=(p=(u=c==null?void 0:c.firstLogin)==null?void 0:u.reward)==null?void 0:p.rewardValue)!=null?f:0,isFirstLogin:l!=null?l:!1,currency:t.currency}}),a.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:s})=>{j(i.trackEvents.modalHide,{eventType:J.Hide,currency:n},J.Hide);let c=s==="CANCEL"?"click_close":"click_watch_ads",l=s==="CANCEL"?i.trackEvents.clickClose:i.trackEvents.clickWatchAds;j(l,{type:c,eventType:J.Click,currency:n},J.Click),q.emit(yr,{result:"FAILED"}),a.destroy()}}}});yield i.frequencyUpdater()}catch(n){_e(new Ih(n)),q.emit(yr,{result:"FAILED"})}}));var L3=()=>y(Oc,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 M3(){let e=new Map;return{registerSubscriptionHandler(r,n){e.set(r,n)},invokeSubscription(r,...n){return y(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 _e(o),{code:"FAILED",message:`[joliboxSDK]: subscription error ${o}`}}})}}}var jo,If=C(()=>{"use strict";dt();jo=M3()});var bn,Nc=C(()=>{"use strict";bn={PlaceOrderFailed:1001,CancelOrderFailed:1002,SubscriptionFailed:1003,InvalidPlan:1004}});var U3,YA,Dc,F3,Go,Ef=C(()=>{"use strict";Nc();R();B();U3=()=>{let[e,t]=[ma,ha].map(r=>(n,i,o)=>new r(n,i,o));return{createSubscriptionError:e,createSubscriptionInternalError:t}},{createSubscriptionError:YA,createSubscriptionInternalError:Dc}=U3(),F3=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",Go=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startSubscription=t=>y(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw YA(n,bn.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(x({},this.generateSubscriptionContext()))),`${F3}/subscription/callback?${t.toString()}`};this.createSubscriptionError=YA;this.createSubscriptionInternalError=Dc}setOrderId(t){this._orderId=t}setOrderStatus(t){this._orderStatus=t}get orderId(){return this._orderId}get status(){return this._orderStatus}}});function j3(e,t){Object.keys(t).forEach(r=>{var i,o,a,s;let n=e.find(c=>c.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=>!Ni(r.amountStr))}var _n,Lc,kf,Cf,qc,QA,Af=C(()=>{"use strict";R();ce();pt();R();yf();If();ce();Ef();Nc();_n=class _n{static getNativePriceCache(t){var n;let r=t.sort().join(",");return(n=this.nativePriceCache.get(r))!=null?n:{}}execute(t,r){return y(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(c=>typeof c.appStoreProductId=="string").map(c=>c.appStoreProductId))!=null?s:[];if(o.length>0){let c=yield this.getNativePriceData(o);c&&j3(i,c)}if(i.length===0)throw new Error("subscription tiers is empty");return i})}requestNativeSubscriptionPlans(t,r){return y(this,null,function*(){try{let{data:n}=yield me("requestSubscriptionPlansAsync",{appStoreProductIds:t,type:"game"});return n&&(_n.nativePriceCache.set(r,n),_n.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 y(this,null,function*(){let n=t.sort().join(",");return(r?JA:Cc)(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 y(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")}};_n.nativePriceCache=new Map,_n.NATIVE_PRICE_CACHE_DURATION=1*24*60*60*1e3,_n.nativePriceCacheTimestamp=new Map;Lc=_n,kf=class extends Rt{constructor(r){super(new Lc,{duration:30*60*1e3,timeout:3e3});this.apiEndpoint=r;this.pendingSubscriptions=new Map;this.subInfoCacheKeys=[];this.listenSubscriptionPanelStateChange()}getSubInfo(){return y(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 y(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}updateNativePriceCache(r){return y(this,null,function*(){yield this.requestAdapter.updateNativePriceCache(r)})}updateAllNativePriceCache(){return y(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 y(this,null,function*(){var i;console.log("[SubscriptionService] subscribe params",jo);let n=yield jo.invokeSubscription("SUB_APP",{productId:r.nativeProductId,appStoreProductId:r.appStoreProductId,planId:r.basePlanId});return{result:n.code,subPlanId:(i=n.data)==null?void 0:i.subPlanId,message:n.message}})}invokeSubscriptionPanel(){return y(this,null,function*(){var i,o;let r=new nt,n;try{if(console.log("[invokeSubscriptionPanel] requestSubscriptionSync params"),n=(i=F("invokeSubscriptionPanelSync",{type:"game"}).data)==null?void 0:i.subUUID,!n)throw Dc("orderUUID is null",bn.SubscriptionFailed);this.pendingSubscriptions.set(n,r)}catch(a){throw Dc((o=JSON.stringify(a))!=null?o:"subscription panel failed",bn.SubscriptionFailed)}return r.promise})}getTierByProductId(r){return y(this,null,function*(){var s;let n=yield this.getSubInfo(),i=n==null?void 0:n.find(c=>c.productId===r);if(!i)return;let o=Lc.getNativePriceCache((n!=null?n:[]).map(c=>{var l;return(l=c.appStoreProductId)!=null?l:""}));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(){Re("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"}}))})}},Cf=class extends kf{constructor(){super("/api/subs/pricing")}},qc=null,QA=()=>qc||(qc=new Cf,qc)});var XA=C(()=>{"use strict"});function ex(){let e=new Map;return t=>y(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=G3[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 xf,ZA,Pf,Tf,G3,tx=C(()=>{"use strict";B();Ef();Fo();kc();R();ce();R();Nc();Re("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}})});xf=new Map;Re("onSubscritptionStateChange",e=>{var o,a;let{subUUID:t,status:r,orderResponse:n}=e;console.log("[onSubscritptionStateChange] data",e);let i=xf.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"&&fa(n==null?void 0:n.errNo)&&(n==null?void 0:n.errNo)!==0)throw bt(`subscription failed: ${n==null?void 0:n.errMsg}`,bn.SubscriptionFailed);i.resolve({code:r,message:(a=n==null?void 0:n.errMsg)!=null?a:"UNKNOWN_ERROR"})}xf.delete(t)}});ZA=e=>y(void 0,null,function*(){var n,i;let t=new nt,r;try{if(console.log("[internalSubscribe] requestSubscriptionSync params",e),r=(n=F("requestSubscriptionSync",x({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 bt("subUUID is null",1002);xf.set(r,t)}catch(o){throw bt((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),Pf=class extends Go{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return y(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 y(this,null,function*(){return yield ZA(r)})}},Tf=class extends Go{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return y(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 bt("appAccountToken is null",1002);return this.subscriptionToken=i,{code:"SUCCESS",message:"placeorder sub-app success in native"}})}cancelOrder(r){return y(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 y(this,null,function*(){return yield ZA(U(x({},r),{appAccountToken:this.subscriptionToken}))})}},G3={android:Pf,ios:Tf}});var wn,Rf=C(()=>{"use strict";Af();XA();If();tx();Af();wn=QA();jo.registerSubscriptionHandler("SUB_APP",ex())});var ox=h(ix=>{"use strict";Uo();Le();tr();Ve();Rf();er();var B3={SUBSCRIPTION:{frequencyConfigKey:"joinMember",frequencyChecker:EA,frequencyUpdater:RA}},rx=pn(),nx=Me(q,Ut);nx.getData();q.on(Ec,e=>y(ix,null,function*(){let t=B3.SUBSCRIPTION;if(!ft("invokeSubscriptionPanelSync")){console.info("invokeSubscriptionPanelSync not supported"),setTimeout(()=>{q.emit(gn,{result:"FAILED"})},0);return}yield rx.show({duration:3e3});let r=yield nx.getData(),{canShow:n,isFirst:i}=yield t.frequencyChecker(r.joliCoinUseAndCharge[t.frequencyConfigKey]);if(rx.hide(),!n){q.emit(gn,{result:"FAILED"});return}let{data:o,code:a}=yield wn.invokeSubscriptionPanel();a=="SUCCESS"&&(o!=null&&o.subPlanId)?q.emit(gn,{result:"SUCCESS"}):q.emit(gn,{result:"FAILED"}),yield t.frequencyUpdater()}))});var Lte,Mte,Ute,Fte,ax=C(()=>{"use strict";Lte=re(DA()),Mte=re(WA()),Ute=re(KA()),Fte=re(ox())});function e4(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function t4(e){return typeof e=="string"}function r4(e){return typeof e=="undefined"}function n4(e){return r4(e)||e===null}function i4(e){return typeof e=="function"}function Lx(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 Bo(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function jc(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 d4(e){let t=e.location?jc(e.location,px):null,r=e.target?jc(e.target,px):null;return jc(Q3(Y3({},e),{location:t,target:r}),l4)}function p4(e){let t=e.events.map(n=>d4(n)),r=jc(e.device,u4);return[e.protocolVersion,t,r,e.project]}function f4(){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 y4(e){return new Promise(t=>jx(e)(t))}function jx(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 b4(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new Wo(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 w4(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)S4(e[n],t[n])}function S4(e,t){if(t4(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(i4(t)){try{if(e instanceof t)return}catch(r){}if(!n4(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 at(e,t,r){return(t=I4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function I4(e){var t=E4(e,"string");return typeof t=="symbol"?t:t+""}function E4(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 Mc(e,t,r){return(t=k4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k4(e){var t=C4(e,"string");return typeof t=="symbol"?t:t+""}function C4(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 Uc(e,t,r){return(t=A4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A4(e){var t=x4(e,"string");return typeof t=="symbol"?t:t+""}function x4(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 wr(e,t,r){return(t=P4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P4(e){var t=T4(e,"string");return typeof t=="symbol"?t:t+""}function T4(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 R4(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 O4(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 U4(e,t){return Je(e,0)^45?(((t<<2^Je(e,0))<<2^Je(e,1))<<2^Je(e,2))<<2^Je(e,3):0}function Jx(e){return e.trim()}function F4(e,t){return(e=t.exec(e))?e[0]:e}function K(e,t,r){return e.replace(t,r)}function Vf(e,t){return e.indexOf(t)}function Je(e,t){return e.charCodeAt(t)|0}function zo(e,t,r){return e.slice(t,r)}function nr(e){return e.length}function cm(e){return e.length}function Fc(e,t){return t.push(e),e}function j4(e,t){return e.map(t).join("")}function tl(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:el,column:mi,length:a,return:""}}function Ho(e,t){return M4(tl("",null,null,"",null,null,0),e,{length:-e.length},t)}function G4(){return Pe}function B4(){return Pe=lt>0?Je(hi,--lt):0,mi--,Pe===10&&(mi=1,el--),Pe}function wt(){return Pe=lt<Hx?Je(hi,lt++):0,mi++,Pe===10&&(mi=1,el++),Pe}function ir(){return Je(hi,lt)}function Gc(){return lt}function Yo(e,t){return zo(hi,e,t)}function Ko(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 $x(e){return el=mi=1,Hx=nr(hi=e),lt=0,[]}function Vx(e){return hi="",e}function Bc(e){return Jx(Yo(lt-1,Wf(e===91?e+2:e===40?e+1:e)))}function J4(e){for(;(Pe=ir())&&Pe<33;)wt();return Ko(e)>2||Ko(Pe)>3?"":" "}function H4(e,t){for(;--t&&wt()&&!(Pe<48||Pe>102||Pe>57&&Pe<65||Pe>70&&Pe<97););return Yo(e,Gc()+(t<6&&ir()==32&&wt()==32))}function Wf(e){for(;wt();)switch(Pe){case e:return lt;case 34:case 39:e!==34&&e!==39&&Wf(Pe);break;case 40:e===41&&Wf(e);break;case 92:wt();break}return lt}function $4(e,t){for(;wt()&&e+Pe!==57&&!(e+Pe===84&&ir()===47););return"/*"+Yo(t,lt-1)+"*"+Zc(e===47?e:wt())}function V4(e){for(;!Ko(ir());)wt();return Yo(e,lt)}function W4(e){return Vx(Jc("",null,null,null,[""],e=$x(e),0,[0],e))}function Jc(e,t,r,n,i,o,a,s,c){for(var l=0,d=0,u=a,p=0,f=0,m=0,g=1,b=1,v=1,w=0,E="",A=i,P=o,T=n,k=E;b;)switch(m=w,w=wt()){case 40:if(m!=108&&Je(k,u-1)==58){Vf(k+=K(Bc(w),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:k+=Bc(w);break;case 9:case 10:case 13:case 32:k+=J4(m);break;case 92:k+=H4(Gc()-1,7);continue;case 47:switch(ir()){case 42:case 47:Fc(z4($4(wt(),Gc()),t,r),c);break;default:k+="/"}break;case 123*g:s[l++]=nr(k)*v;case 125*g:case 59:case 0:switch(w){case 0:case 125:b=0;case 59+d:v==-1&&(k=K(k,/\f/g,"")),f>0&&nr(k)-u&&Fc(f>32?gx(k+";",n,r,u-1):gx(K(k," ","")+";",n,r,u-2),c);break;case 59:k+=";";default:if(Fc(T=hx(k,t,r,l,d,i,s,E,A=[],P=[],u),o),w===123)if(d===0)Jc(k,t,T,T,A,o,u,s,P);else switch(p===99&&Je(k,3)===110?100:p){case 100:case 108:case 109:case 115:Jc(e,T,T,n&&Fc(hx(e,T,T,0,0,i,s,E,i,A=[],u),P),i,P,u,s,n?A:P);break;default:Jc(k,T,T,T,[""],P,0,s,P)}}l=d=f=0,g=v=1,E=k="",u=a;break;case 58:u=1+nr(k),f=m;default:if(g<1){if(w==123)--g;else if(w==125&&g++==0&&B4()==125)continue}switch(k+=Zc(w),w*g){case 38:v=d>0?1:(k+="\f",-1);break;case 44:s[l++]=(nr(k)-1)*v,v=1;break;case 64:ir()===45&&(k+=Bc(wt())),p=ir(),d=u=nr(E=k+=V4(Gc())),w++;break;case 45:m===45&&nr(k)==2&&(g=0)}}return o}function hx(e,t,r,n,i,o,a,s,c,l,d){for(var u=i-1,p=i===0?o:[""],f=cm(p),m=0,g=0,b=0;m<n;++m)for(var v=0,w=zo(e,u+1,u=L4(g=a[m])),E=e;v<f;++v)(E=Jx(g>0?p[v]+" "+w:K(w,/&\f/g,p[v])))&&(c[b++]=E);return tl(e,t,r,i===0?am:s,c,l,d)}function z4(e,t,r){return tl(e,t,r,Gx,Zc(G4()),zo(e,2,-2),0)}function gx(e,t,r,n){return tl(e,t,r,sm,zo(e,0,n),zo(e,n+1,-1),n)}function fi(e,t){for(var r="",n=cm(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function K4(e,t,r,n){switch(e.type){case q4:if(e.children.length)break;case D4:case sm:return e.return=e.return||e.value;case Gx:return"";case Bx:return e.return=e.value+"{"+fi(e.children,n)+"}";case am:e.value=e.props.join(",")}return nr(r=fi(e.children,n))?e.return=e.value+"{"+r+"}":""}function Y4(e){var t=cm(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 Q4(e){return function(t){t.root||(t=t.return)&&e(t)}}function X4(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}function Wx(e,t){switch(U4(e,t)){case 5103:return z+"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 z+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return z+e+Wc+e+Xe+e+e;case 6828:case 4268:return z+e+Xe+e+e;case 6165:return z+e+Xe+"flex-"+e+e;case 5187:return z+e+K(e,/(\w+).+(:[^]+)/,z+"box-$1$2"+Xe+"flex-$1$2")+e;case 5443:return z+e+Xe+"flex-item-"+K(e,/flex-|-self/,"")+e;case 4675:return z+e+Xe+"flex-line-pack"+K(e,/align-content|flex-|-self/,"")+e;case 5548:return z+e+Xe+K(e,"shrink","negative")+e;case 5292:return z+e+Xe+K(e,"basis","preferred-size")+e;case 6060:return z+"box-"+K(e,"-grow","")+z+e+Xe+K(e,"grow","positive")+e;case 4554:return z+K(e,/([^-])(transform)/g,"$1"+z+"$2")+e;case 6187:return K(K(K(e,/(zoom-|grab)/,z+"$1"),/(image-set)/,z+"$1"),e,"")+e;case 5495:case 3959:return K(e,/(image-set\([^]*)/,z+"$1$`$1");case 4968:return K(K(e,/(.+:)(flex-)?(.*)/,z+"box-pack:$3"+Xe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+z+e+e;case 4095:case 3583:case 4068:case 2532:return K(e,/(.+)-inline(.+)/,z+"$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(nr(e)-1-t>6)switch(Je(e,t+1)){case 109:if(Je(e,t+4)!==45)break;case 102:return K(e,/(.+:)(.+)-([^]+)/,"$1"+z+"$2-$3$1"+Wc+(Je(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Vf(e,"stretch")?Wx(K(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Je(e,t+1)!==115)break;case 6444:switch(Je(e,nr(e)-3-(~Vf(e,"!important")&&10))){case 107:return K(e,":",":"+z)+e;case 101:return K(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+z+(Je(e,14)===45?"inline-":"")+"box$3$1"+z+"$2$3$1"+Xe+"$2box$3")+e}break;case 5936:switch(Je(e,t+11)){case 114:return z+e+Xe+K(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return z+e+Xe+K(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return z+e+Xe+K(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return z+e+Xe+e+e}return e}function s$(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 zc(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 $r={name:i.name,styles:i.styles,next:$r},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)$r={name:a.name,styles:a.styles,next:$r},a=a.next;var s=o.styles+";";return s}return d$(e,t,r)}}var c=r;if(t==null)return c;var l=t[c];return l!==void 0?l:c}function d$(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=zc(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]+"}":yx(s)&&(n+=Nf(o)+":"+bx(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var c=0;c<a.length;c++)yx(a[c])&&(n+=Nf(o)+":"+bx(o,a[c])+";");else{var l=zc(e,t,a);switch(o){case"animation":case"animationName":{n+=Nf(o)+":"+l+";";break}default:n+=o+"{"+l+"}"}}}return n}function Df(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="";$r=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=zc(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=zc(r,t,e[s]),n){var c=o;i+=c[s]}_x.lastIndex=0;for(var l="",d;(d=_x.exec(i))!==null;)l+="-"+d[1];var u=s$(i)+l;return{name:u,styles:i,next:$r}}function Kx(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}function wx(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function Sx(e,t,r){var n=[],i=Kx(e,n,r);return n.length<2?r:i+t(n)}function v$(e,t){qe.__h&&qe.__h(_t,e,Ex||t),Ex=0;var r=_t.__H||(_t.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Qx(e,t){var r=v$(zf++,7);return _$(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function y$(){for(var e;e=Yx.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Hc),e.__H.__h.forEach(Kf),e.__H.__h=[]}catch(t){e.__H.__h=[],qe.__e(t,e.__v)}}function b$(e){var t,r=function(){clearTimeout(n),Rx&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Rx&&(t=requestAnimationFrame(r))}function Hc(e){var t=_t,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),_t=t}function Kf(e){var t=_t;e.__c=e.__(),_t=t}function _$(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function rl(){if(Vr>1)Vr--;else{for(var e,t=!1;$o!==void 0;){var r=$o;for($o=void 0,Yf++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Zx(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Yf=0,Vr--,t)throw e}}function ct(e){if(Vr>0)return e();Vr++;try{return e()}finally{rl()}}function Xx(e){if(te!==void 0){var t=e.n;if(t===void 0||t.t!==te)return t={i:0,S:e,p:te.s,n:void 0,t:te,e:void 0,x:void 0,r:t},te.s!==void 0&&(te.s.n=t),te.s=t,e.n=t,32&te.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=te.s,t.n=void 0,te.s.n=t,te.s=t),t}}function He(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function ie(e){return new He(e)}function Zx(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 eP(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 tP(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 yi(e){He.call(this,void 0),this.x=e,this.s=void 0,this.g=Kc-1,this.f=4}function Vo(e){return new yi(e)}function rP(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Vr++;var r=te;te=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,lm(e),n}finally{te=r,rl()}}}function lm(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,rP(e)}function S$(e){if(te!==this)throw new Error("Out-of-order effect");tP(this),te=e,this.f&=-2,8&this.f&&lm(this),rl()}function Qo(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Xo(e){var t=new Qo(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function bi(e,t){N[e]=t.bind(null,N[e]||function(){})}function Yc(e){Lf&&Lf(),Lf=e&&e.S()}function oP(e){var t=this,r=e.data,n=aP(r);n.value=r;var i=Qx(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var l=Vo(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""}),d=Vo(function(){return!Array.isArray(l.value)&&!lu(l.value)}),u=Xo(function(){if(this.N=sP,d.value){var f=l.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,l]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}function I$(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=ie(r);return{o:function(a,s){o.value=a,n=s},d:Xo(function(){this.N=sP;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}function aP(e){return Qx(function(){return ie(e)},[])}function k$(){ct(function(){for(var e;e=iP.shift();)nP.call(e)})}function sP(){iP.push(this)===1&&(N.requestAnimationFrame||E$)(k$)}function C$(e,t){let r=so(e);Hn(()=>{r.current=e},[e]),ao(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}function Ie(e,t,r,n,i,o){t||(t={});var a,s,c=t;if("ref"in c)for(s in c={},t)s=="ref"?a=t[s]:c[s]=t[s];var l={type:e,props:c,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--A$,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)c[s]===void 0&&(c[s]=a[s]);return N.vnode&&N.vnode(l),l}function Sr(e,t,r){return(t=F$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F$(e){var t=j$(e,"string");return typeof t=="symbol"?t:t+""}function j$(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 Ir(e,t,r){return(t=H$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H$(e){var t=$$(e,"string");return typeof t=="symbol"?t:t+""}function $$(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 Qe(e,t,r){return(t=V$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V$(e){var t=W$(e,"string");return typeof t=="symbol"?t:t+""}function W$(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 st(e,t,r){return(t=z$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z$(e){var t=K$(e,"string");return typeof t=="symbol"?t:t+""}function K$(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 Sn(e,t,r){return(t=Y$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y$(e){var t=Q$(e,"string");return typeof t=="symbol"?t:t+""}function Q$(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 Mf(e,t,r){return(t=X$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X$(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)}function rt(e,t,r){return(t=eV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eV(e){var t=tV(e,"string");return typeof t=="symbol"?t:t+""}function tV(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 Ft(e,t,r){return(t=rV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rV(e){var t=nV(e,"string");return typeof t=="symbol"?t:t+""}function nV(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 J3,Vc,Ox,Nx,sx,H3,$3,Dx,V3,W3,cx,z3,K3,lx,Y3,Q3,X3,qx,Z3,o4,a4,ux,s4,dx,c4,Mx,Ux,Fx,px,l4,u4,di,fx,Uf,pe,m4,h4,Jo,Wo,g4,jf,v4,Of,_4,Gf,mx,li,Bf,Jf,Hf,$f,N4,Xe,Wc,z,Gx,am,sm,D4,Bx,q4,L4,Zc,M4,el,mi,Hx,lt,Pe,hi,Z4,e$,t$,vx,r$,n$,i$,o$,a$,c$,l$,u$,zx,yx,Nf,bx,_x,$r,p$,f$,m$,h$,g$,gi,zf,_t,qf,Ix,Ex,Yx,qe,kx,Cx,Ax,xx,Px,Tx,Rx,w$,te,$o,Vr,Yf,Kc,nP,Lf,iP,E$,Ze,A$,x$,Er,Qf,Xf,$c,P$,T$,R$,O$,N$,D$,q$,L$,M$,U$,Zf,pi,ui,G$,B$,J$,em,cP,tm,rm,nm,im,Qc,om,Xc,Bte,lP=C(()=>{"use strict";Dn();is();J3=Object.defineProperty,Vc=Object.getOwnPropertySymbols,Ox=Object.prototype.hasOwnProperty,Nx=Object.prototype.propertyIsEnumerable,sx=(e,t,r)=>t in e?J3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,H3=(e,t)=>{for(var r in t||(t={}))Ox.call(t,r)&&sx(e,r,t[r]);if(Vc)for(var r of Vc(t))Nx.call(t,r)&&sx(e,r,t[r]);return e},$3=(e,t)=>{var r={};for(var n in e)Ox.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Vc)for(var n of Vc(e))t.indexOf(n)<0&&Nx.call(e,n)&&(r[n]=e[n]);return r},Dx=Object.defineProperty,V3=Object.defineProperties,W3=Object.getOwnPropertyDescriptors,cx=Object.getOwnPropertySymbols,z3=Object.prototype.hasOwnProperty,K3=Object.prototype.propertyIsEnumerable,lx=(e,t,r)=>t in e?Dx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Y3=(e,t)=>{for(var r in t||(t={}))z3.call(t,r)&&lx(e,r,t[r]);if(cx)for(var r of cx(t))K3.call(t,r)&&lx(e,r,t[r]);return e},Q3=(e,t)=>V3(e,W3(t)),X3=(e,t)=>{for(var r in t)Dx(e,r,{get:t[r],enumerable:!0})},qx=(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},Z3=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}o4=(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))(o4||{});a4={log:Bo("log"),warn:Bo("warn"),info:Bo("info"),error:Bo("error"),debug:Bo("debug")};Object.assign(globalThis,{logger:a4});ux=Symbol.for("Jolibox.canIUseMap"),s4={};globalThis[ux]||(globalThis[ux]=s4);dx=Symbol.for("Jolibox.canIUseMap.native"),c4={};globalThis[dx]||(globalThis[dx]=c4);Mx=(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))(Mx||{}),Ux=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Ux||{}),Fx=(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))(Fx||{}),px=["name","params"],l4=["name","type","location","target","extra","timestamp","userId"],u4=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];f4();di=typeof window=="undefined",fx=()=>!di&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!di&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!di&&navigator.userAgent.includes("Android"),!di&&navigator.userAgent.includes("Mac"),!di&&navigator.userAgent.includes("FB_IAB"),!di&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");Uf=class Ff{constructor(t){this.element=t,this.next=Ff.Undefined,this.prev=Ff.Undefined}};Uf.Undefined=new Uf(void 0);pe=Uf,m4=class{constructor(){this._first=pe.Undefined,this._last=pe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===pe.Undefined}clear(){let e=this._first;for(;e!==pe.Undefined;){let t=e.next;e.prev=pe.Undefined,e.next=pe.Undefined,e=t}this._first=pe.Undefined,this._last=pe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new pe(e);if(this._first===pe.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!==pe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==pe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==pe.Undefined&&e.next!==pe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===pe.Undefined&&e.next===pe.Undefined?(this._first=pe.Undefined,this._last=pe.Undefined):e.next===pe.Undefined?(this._last=this._last.prev,this._last.next=pe.Undefined):e.prev===pe.Undefined&&(this._first=this._first.next,this._first.prev=pe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==pe.Undefined;)yield e.element,e=e.next}},h4=0,Jo=class{constructor(e){this.value=e,this.id=h4++}},Wo=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 Jo&&(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 c=new Jo(e);return this._listeners?this._listeners instanceof Jo?this._listeners=[this._listeners,c]:this._listeners.push(c):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=c,(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 l,d,u,p;if(!this._disposed){if(this._listeners instanceof Jo)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(l=this.options)==null?void 0:l.onDidRemoveLastListener)==null||d.call(l));else if(this._listeners){let f=this._listeners.indexOf(c);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 Jo?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},g4=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 Wo,o=c=>t(...c.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 c of s)t(...c.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 m4,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)}},jf={};X3(jf,{None:()=>v4,filter:()=>b4,once:()=>jx,toPromise:()=>y4});v4=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Of=Symbol.for("Jolibox.hostEmitter"),_4=()=>{let e=new g4;return globalThis[Of]||(globalThis[Of]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Of]};_4();Gf=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Wo,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 w4(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}};Gf=qx([Lx],Gf);mx=class{constructor(){this._onWillExecuteCommand=new Wo,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Wo,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Gf,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=e4(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 Z3(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),jf.toPromise(jf.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{}}};mx=qx([Lx],mx);li=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")},Bf=class{constructor(t){at(this,"context",void 0),at(this,"continueCallback",void 0),at(this,"adIsShowingCallback",void 0),at(this,"isBeforeAdCalled",!1),at(this,"isBeforeRewardCalled",!1),at(this,"isAdDismissedCalled",!1),at(this,"isAdViewedCalled",!1),at(this,"isAfterAdCalled",!1),at(this,"currentProvider",void 0),at(this,"currentClientParams",void 0),at(this,"adsHasResponse",!1),at(this,"videoChecker",window.document.createElement("video")),at(this,"contextInfo",void 0),at(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",H3({userEvent:a},this.paramsToTrack)),fx()&&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=li(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=li(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),fx()&&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=li(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=li(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=li(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,c,l,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:(c=r.breakName)!=null?c:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=li(t);p==null||p(r),(l=this.adIsShowingCallback)==null||l.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 y(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,c,l,d,u,p,f;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(c=(s=this.currentProvider)==null?void 0:s.name)!=null?c:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(d=(l=this.currentProvider)==null?void 0:l.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")})})}};Jf=class{constructor(t){Mc(this,"context",void 0),Mc(this,"adBreakIsShowing",!1),Mc(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),Mc(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()})}};Hf=class{constructor(t){Uc(this,"configs",null),Uc(this,"firstRun",!0),Uc(this,"context",void 0),Uc(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return y(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}};$f=class{constructor(t,r){wr(this,"name","ADSENSE"),wr(this,"context",void 0),wr(this,"contextInfo",void 0),wr(this,"configured",!1),wr(this,"initParams",void 0),wr(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),wr(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=$3(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),wr(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),wr(this,"adUnit",n=>y(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:c,slot:l,adFormat:d,fullWidthResponsive:u,style:p}=n,f;if(!c)throw new Error("targeting element is required");if(typeof c=="string"?f=document.querySelector(c):f=c,!f)throw new Error("targeting element not found");let m=l;if(m||(m=this.initParams.unitId),!m)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",m),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 v=document.createElement("div");v.style.position="absolute",v.style.top="0",v.style.left="0",v.style.width="100%",v.style.height="100%",v.style.display="flex",v.style.justifyContent="center",v.style.alignItems="center",v.style.backgroundColor="rgba(0, 0, 0, 0.5)",v.style.color="white",v.innerHTML="Test Ad",b.style.position="relative",f.appendChild(b),b.appendChild(v)}else f.appendChild(b),new MutationObserver(v=>{v.forEach(w=>{if(w.type==="attributes"&&w.attributeName==="data-ad-status"){let E=b.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:E!=null?E:"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 y(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)}})}};N4=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(O4(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=R4(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}(),Xe="-ms-",Wc="-moz-",z="-webkit-",Gx="comm",am="rule",sm="decl",D4="@import",Bx="@keyframes",q4="@layer",L4=Math.abs,Zc=String.fromCharCode,M4=Object.assign;el=1,mi=1,Hx=0,lt=0,Pe=0,hi="";Z4=function(e,t,r){for(var n=0,i=0;n=i,i=ir(),n===38&&i===12&&(t[r]=1),!Ko(i);)wt();return Yo(e,lt)},e$=function(e,t){var r=-1,n=44;do switch(Ko(n)){case 0:n===38&&ir()===12&&(t[r]=1),e[r]+=Z4(lt-1,t,r);break;case 2:e[r]+=Bc(n);break;case 4:if(n===44){e[++r]=ir()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Zc(n)}while(n=wt());return e},t$=function(e,t){return Vx(e$($x(e),t))},vx=new WeakMap,r$=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&&!vx.get(r))&&!n){vx.set(e,!0);for(var i=[],o=t$(t,i),a=r.props,s=0,c=0;s<o.length;s++)for(var l=0;l<a.length;l++,c++)e.props[c]=i[s]?o[s].replace(/&\f/g,a[l]):a[l]+" "+o[s]}}},n$=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};i$=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case sm:e.return=Wx(e.value,e.length);break;case Bx:return fi([Ho(e,{value:K(e.value,"@","@"+z)})],n);case am:if(e.length)return j4(e.props,function(i){switch(F4(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return fi([Ho(e,{props:[K(i,/:(read-\w+)/,":"+Wc+"$1")]})],n);case"::placeholder":return fi([Ho(e,{props:[K(i,/:(plac\w+)/,":"+z+"input-$1")]}),Ho(e,{props:[K(i,/:(plac\w+)/,":"+Wc+"$1")]}),Ho(e,{props:[K(i,/:(plac\w+)/,Xe+"input-$1")]})],n)}return""})}},o$=[i$],a$=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(m){var g=m.getAttribute("data-emotion");g.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var n=e.stylisPlugins||o$,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(m){for(var g=m.getAttribute("data-emotion").split(" "),b=1;b<g.length;b++)i[g[b]]=!0;a.push(m)});var s,c=[r$,n$];{var l,d=[K4,Q4(function(m){l.insert(m)})],u=Y4(c.concat(n,d)),p=function(m){return fi(W4(m),u)};s=function(m,g,b,v){l=b,p(m?m+"{"+g.styles+"}":g.styles),v&&(f.inserted[g.name]=!0)}}var f={key:t,sheet:new N4({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};c$={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},l$=/[A-Z]|^ms/g,u$=/_EMO_([^_]+?)_([^]*?)_EMO_/g,zx=function(e){return e.charCodeAt(1)===45},yx=function(e){return e!=null&&typeof e!="boolean"},Nf=X4(function(e){return zx(e)?e:e.replace(l$,"-$&").toLowerCase()}),bx=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(u$,function(r,n,i){return $r={name:n,styles:i,next:$r},n})}return c$[e]!==1&&!zx(e)&&typeof t=="number"&&t!==0?t+"px":t};_x=/label:\s*([^\s;{]+)\s*(;|$)/g;p$=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},f$=function(e,t,r){p$(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)}};m$=function(e){var t=a$(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];var l=Df(s,t.registered,void 0);return f$(t,l),t.key+"-"+l.name},n=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];var l=Df(s,t.registered),d="animation-"+l.name;return wx(t,{name:l.name,styles:"@keyframes "+d+"{"+l.styles+"}"}),d},i=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];var l=Df(s,t.registered);wx(t,l)},o=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];return Sx(t.registered,r,h$(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:Kx.bind(null,t.registered),merge:Sx.bind(null,t.registered,r)}},h$=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},g$=m$({key:"css"}),gi=g$.css,Ex=0,Yx=[],qe=N,kx=qe.__b,Cx=qe.__r,Ax=qe.diffed,xx=qe.__c,Px=qe.unmount,Tx=qe.__;qe.__b=function(e){_t=null,kx&&kx(e)},qe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Tx&&Tx(e,t)},qe.__r=function(e){Cx&&Cx(e),zf=0;var t=(_t=e.__c).__H;t&&(qf===_t?(t.__h=[],_t.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Hc),t.__h.forEach(Kf),t.__h=[],zf=0)),qf=_t},qe.diffed=function(e){Ax&&Ax(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Yx.push(t)!==1&&Ix===qe.requestAnimationFrame||((Ix=qe.requestAnimationFrame)||b$)(y$)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),qf=_t=null},qe.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Hc),r.__h=r.__h.filter(function(n){return!n.__||Kf(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],qe.__e(n,r.__v)}}),xx&&xx(e,t)},qe.unmount=function(e){Px&&Px(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Hc(n)}catch(i){t=i}}),r.__H=void 0,t&&qe.__e(t,r.__v))};Rx=typeof requestAnimationFrame=="function";w$=Symbol.for("preact-signals");te=void 0,$o=void 0,Vr=0,Yf=0,Kc=0;He.prototype.brand=w$;He.prototype.h=function(){return!0};He.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)};He.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)}};He.prototype.subscribe=function(e){var t=this;return Xo(function(){var r=t.value,n=te;te=void 0;try{e(r)}finally{te=n}})};He.prototype.valueOf=function(){return this.value};He.prototype.toString=function(){return this.value+""};He.prototype.toJSON=function(){return this.value};He.prototype.peek=function(){var e=te;te=void 0;try{return this.value}finally{te=e}};Object.defineProperty(He.prototype,"value",{get:function(){var e=Xx(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Yf>100)throw new Error("Cycle detected");this.v=e,this.i++,Kc++,Vr++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{rl()}}}});(yi.prototype=new He).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Kc))return!0;if(this.g=Kc,this.f|=1,this.i>0&&!Zx(this))return this.f&=-2,!0;var e=te;try{eP(this),te=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 te=e,tP(this),this.f&=-2,!0};yi.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)}He.prototype.S.call(this,e)};yi.prototype.U=function(e){if(this.t!==void 0&&(He.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)}};yi.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(yi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Xx(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});Qo.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()}};Qo.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,rP(this),eP(this),Vr++;var e=te;return te=this,S$.bind(this,e)};Qo.prototype.N=function(){2&this.f||(this.f|=2,this.o=$o,$o=this)};Qo.prototype.d=function(){this.f|=8,1&this.f||lm(this)};iP=[];Xo(function(){nP=this.N})();oP.displayName="_st";Object.defineProperties(He.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}});bi("__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 He&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});bi("__r",function(e,t){Yc();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return Xo(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Yc(r),e(t)});bi("__e",function(e,t,r,n){Yc(),e(t,r,n)});bi("diffed",function(e,t){Yc();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 c in n){var l=o[c],d=n[c];l===void 0?(l=I$(r,c,d,i),o[c]=l):l.o(d,i)}}}e(t)});bi("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)});bi("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});ht.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};E$=function(e){queueMicrotask(function(){queueMicrotask(e)})};Ze=gi`
|
|
622
|
+
`,B5=()=>_("div",{style:zk.container,children:[_("style",{children:G5}),_("div",{style:zk.spinner})]});DQ=pn()});function VC(){return y(this,null,function*(){if(Qp)return Qp;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 Qp=r,r})}function WC(){return y(this,null,function*(){let e=new nt;if(S.mpType!=="game")return e.resolve(!1),e.promise;if(Xp)return e.resolve(!0),e.promise;let t=yield VC();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:i}=t.data;Xp=!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",x({eventType:J.View},o));let a=PC({games:r.games,title:n,buttons:i,onClose:s=>{var c;switch(Xp=!1,s.type){case"quit":j("RecommendedGuide",{eventType:J.Click,type:"QUIT",domain:"GAME"}),e.resolve(!1);break;case"dismiss":j("RecommendedGuide",x({eventType:J.Hide},o)),e.resolve(!0),a.destroy();break;case"navigate":if((c=s.data)!=null&&c.game){let l=s.data.game;J5(l),j("GameItem",{eventType:J.Click,gameId:l.gameId,layerName:"RecommendedGuide",domain:"GAME"}),setTimeout(()=>{e.resolve(!1)},0)}else e.resolve(!0);a.destroy();break;default:j("RecommendedGuide",x({eventType:J.Hide},o)),e.resolve(!0);break}}});return e.promise})}var Qp,J5,Xp,zC=C(()=>{"use strict";B();ce();R();er();pt();kt();Qp=null;VC();J5=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})},Xp=!1});function $5(e){let t=x(x({},H5),e),{url:r,height:n,showCloseButton:i,enableDragClose:o,useAnimation:a,onClose:s,onLoad:c}=t,l=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 m(){let{overlayTransition:w,containerTransition:E,iframeTransition:A}=p();ae=document.createElement("div"),ae.id="jolibox-modal-overlay",ae.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:${w}; opacity:0; visibility:hidden;`,X=document.createElement("div"),X.id="jolibox-modal-container",X.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:${E};`;let P=document.createElement("div");P.id="jolibox-modal-loading",P.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 T=document.createElement("style");T.textContent="@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }",document.head.appendChild(T);let k=document.createElement("div");if(k.style.cssText="width:100%; height:100%; display:flex; flex-direction:column; padding-bottom:env(safe-area-inset-bottom, 0); position:relative;",xt=document.createElement("iframe"),xt.style.cssText=`width:100%; flex:1; border:none; opacity:0; transition:${A};`,xt.src=r,xt.onload=()=>{P.parentNode&&P.parentNode.removeChild(P),xt.style.opacity="1",g(),c==null||c(),he.emit("onModalIframeLoaded",{url:r})},k.appendChild(xt),k.appendChild(P),X.appendChild(k),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=v,X.appendChild(G)}ae.appendChild(X),document.body.appendChild(ae),ae.addEventListener("click",function(G){G.target===ae&&v()}),o&&b()}function g(){!ae||!X||u||(ae.style.visibility="visible",a?requestAnimationFrame(()=>{ae&&(ae.style.opacity="1"),X&&(X.style.transform="translateY(0)"),u=!0}):(ae&&(ae.style.opacity="1"),X&&(X.style.transform="translateY(0)"),u=!0),F("updateContainerConfigSync",{displayCapsuleButton:!1,webviewId:S.webviewId}))}function b(){if(!X)return;let w=P=>{l=P.touches[0].clientY},E=P=>{if(!u)return;d=P.touches[0].clientY;let T=d-l;T>0&&(X&&(X.style.transition="none",X.style.transform=`translateY(${T}px)`),P.preventDefault())},A=()=>{!u||!X||(X.style.transition=a?"transform 0.3s ease":"none",d-l>80?v():X.style.transform="translateY(0)")};X.addEventListener("touchstart",w),X.addEventListener("touchmove",E),X.addEventListener("touchend",A)}function v(){!ae||!X||!u||(a?(X.style.transform="translateY(100%)",ae.style.opacity="0"):ae.style.visibility="hidden",u=!1,F("updateContainerConfigSync",{displayCapsuleButton:!0,webviewId:S.webviewId}),setTimeout(()=>{ae&&(ae.remove(),ae=null,X=null,xt=null,s==null||s(),he.emit("onModalIframeClosed",{url:r}))},f()))}return m(),{close:v}}function KC(){return window.joliboxUI=U(x({},window.joliboxUI),{createIframeModal:$5}),()=>{window.joliboxUI=void 0,ae&&ae.parentNode&&ae.parentNode.removeChild(ae),X&&X.parentNode&&X.parentNode.removeChild(X),xt&&xt.parentNode&&xt.parentNode.removeChild(xt),ae=null,X=null,xt=null}}var H5,ae,X,xt,YC=C(()=>{"use strict";ce();B();R();H5={height:"50%",showCloseButton:!0,enableDragClose:!0,useAnimation:!0},ae=null,X=null,xt=null});var eA={};Fm(eA,{config:()=>r3});function W5(){Fa.on("isAdShowing",e=>{pc=e,xr(pc)&&F("updateContainerConfigSync",{displayCapsuleButton:!pc,webviewId:S.webviewId})})}function z5(){he.on("onInterceptSystemExit",({intercept:e})=>{QC=e})}function K5(){he.on("onInterceptBackPress",({intercept:e})=>{V5=e}),Re("onBeforeBackPress",({uuid:e,disableExitRecommendDialog:t})=>{var r,n;ZC(t),he.emit("onBackPress",{}),(n=(r=globalThis.joliboxJSCore)==null?void 0:r.doBackPress)==null||n.call(r,e)})}function Y5(){he.on("onDocumentReady",()=>{var e;(e=globalThis.joliboxJSCore)==null||e.onDocumentReady(window.location.href),j("onDocumentReady",{start_timestamp:mc,timestamp:Date.now()})})}function Q5(){Re("onI18nChanged",({language:e})=>{he.emit("onI18nChanged",{i18n:e})})}function X5(e){S.mpType==="game"&&Ot.start(e)}function Z5(){Re("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&S.onEnvConfigChanged({hostUserInfo:e}),he.emit("LifecycleEvent.onReady",x({},S.hostUserInfo?S.hostUserInfo:{isLogin:!1})),j("joliboxServiceReady",{start_timestamp:mc,timestamp:Date.now()}),X5(t),IC(()=>S.language)}),Re("onBeforeExit",({uuid:e,disableExitRecommendDialog:t})=>{var r;ZC(t),(r=globalThis.joliboxJSCore)==null||r.doExit(e)})}function e3(){let e=()=>{j("onBeforeExit",{timestamp:Date.now()}),uc==null||uc(),dc==null||dc(),Ot.close(Date.now()-mc)},t=()=>pc||QC;It.onDoExit(()=>y(this,null,function*(){return t()?!0:xr(S.shouldInterupt)?(S.shouldInterupt||e(),S.shouldInterupt):fc!=null&&fc.canShowRecommended&&!XC&&(yield WC())?!0:(e(),!1)})),It.onDoBackPress(()=>y(this,null,function*(){return!!t()}))}function t3(){return y(this,null,function*(){try{let e="/api/fe-configs/js-sdk/basic-meta",{response:{data:t}}=yield Z(e);t&&(fc=t)}catch(e){console.error("fetchMetaConfig error:",e)}})}function r3(){mc=Date.now(),Z5(),W5(),z5(),K5(),e3(),Y5(),Q5(),t3(),dc=KC(),uc=pg()}var uc,dc,mc,pc,fc,QC,V5,XC,ZC,tA=C(()=>{"use strict";ce();B();R();kt();fg();ou();zC();pt();er();YC();pc=!1,fc=null,QC=!1,V5=!1,XC=!1,ZC=e=>{xr(e)&&(XC=e)};It.onReady(()=>{})});var rA,n3,i3,o3,a3,nA=C(()=>{"use strict";R();Ve();ce();B();rA=Y(),n3="env",i3="getSystemInfoSync",o3=H(i3,{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}}}}),a3=H(n3,{implement:()=>{var t;let e=F("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});rA.registerCommand("API.getSystemInfoSync",o3);rA.registerCommand("API.env",a3);M("env",{version:"1.0.0"});M("getSystemInfoSync",{version:"1.0.0",properties:{viewport:"1.0.33"}})});var iA=h(Zp=>{"use strict";R();Ve();dt();ce();kt();B();var s3="exitGame",c3="onReady",l3="onJoliboxShow",u3="onJoliboxHide",hc=Y(),gc=ga(_e),d3=ne(s3,{paramsSchema:I.tuple(I.function(),I.boolean().optional().default(!1)),implement:(e,t=!1)=>y(Zp,null,function*(){gc(e).call(Zp),xr(S.shouldInterupt)&&!S.shouldInterupt&&S.from&&ch("onRetentionResult",{shouldStay:t},S.from,!0),t||S.setDoExitDirectly(),yield me("exitAppAsync")})}),p3=H(l3,{paramsSchema:I.tuple(I.function()),implement(e){let t=gc(e);Re("onJoliboxEnterForeground",()=>{t.call(this),Fi.emit("visible",!0)})}}),f3=H(u3,{paramsSchema:I.tuple(I.function()),implement(e){let t=gc(e);Re("onJoliboxEnterBackground",()=>{t.call(this),Fi.emit("visible",!1)})}}),m3=H(c3,{paramsSchema:I.tuple(I.function()),implement(e){let t=gc(e);he.on("LifecycleEvent.onReady",r=>{t(r)})}});hc.registerCommand("LifecycleSDK.exit",d3);hc.registerCommand("LifecycleSDK.onReady",m3);hc.registerCommand("LifecycleSDK.onJoliboxShow",p3);hc.registerCommand("LifecycleSDK.onJoliboxHide",f3);M("lifeCycle.exit",{version:"1.0.0"});M("lifeCycle.onReady",{version:"1.0.0"});M("lifeCycle.onJoliboxShow",{version:"1.0.0"});M("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function oA(e){let t={};if(!Yr(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 aA(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 sA(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function cA(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!Yr(r))return e;let[n,i=""]=e.split("?"),o=new URLSearchParams(i);for(let[s,c]of Object.entries(r))c!=null&&o.append(s,String(c));let a=o.toString();return a?`${n}?${a}`:n}var lA=C(()=>{"use strict";R()});var h3,g3,ef,tf,uA,v3,y3,b3,dA=C(()=>{"use strict";Xr();Yl();Ve();lA();R();dt();B();h3=15,g3=ya("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:S.baseApiHost}),ef=0,tf=[],uA=ga(_e),v3=(e,t)=>{let r=e.filter(t),n=e.filter(i=>!t(i));return e.length=0,e.push(...n),r},y3=e=>{let t=new nt,r=()=>{};return H("request",{paramsSchema:I.tuple(I.object({url:I.string(),method:I.string(),headers:I.object().optional(),data:I.or(I.object(),I.array()).optional(),query:I.object().optional(),dataType:I.string().default("json"),responseType:I.string().default("text"),enableCache:I.boolean().default(!1),appendHostCookie:I.boolean().default(!0),timeout:I.number().default(3e4),success:I.function(),fail:I.function()})),implement(i){let o=()=>y(this,null,function*(){var s,c,l;let a=uA(i.fail);try{if(ef+=1,t.state!=="pending")return;let{data:d,dataType:u,responseType:p,enableCache:f,appendHostCookie:m}=i,g=oA((s=i.headers)!=null?s:{}),b=aA(i.method),v=sA(i.timeout),w=cA(i.url,b,d),E=uA(i.success),A=Object.assign({},i,{method:b,header:m?void 0:g,data:b==="GET"||b==="HEAD"?void 0:d,enableCache:f,query:(c=i.query)!=null?c:{},dataType:u,responseType:p,appendHostCookie:m});v&&(A.timeout=v);let P=g3(w,A);{let{response:T}=yield P,{code:k,data:G,message:fe}=T;if(G&&typeof G=="object"&&"status"in G&&G.status!==200)throw Et({code:G.status||-1,msg:`request:fail status ${G.status}`});t.resolve({code:k!=null?k:"SUCCESS",data:G,message:fe!=null?fe:"request:ok"}),E({code:"SUCCESS",message:"request:ok",data:G})}}catch(d){t.reject(d),a({code:"FAILURE",message:"httpRequst: failed"})}finally{ef-=1,(l=tf.shift())==null||l()}});return ef>=h3?(r=()=>{v3(tf,a=>a===o)},tf.push(o)):o(),t.promise}})(e),{abort(){t.reject(Et({code:-1,msg:"request:fail abort"})),r()}}},b3=Y();b3.registerCommand("HttpSDK.request",y3);M("request",{version:"1.0.0"})});var _3,w3,S3,rf,pA=C(()=>{"use strict";R();ce();Ve();_3=H("showKeyboard",{paramsSchema:I.tuple(I.object({defaultValue:I.string().optional().default(""),multiple:I.boolean().optional().default(!1),maxLength:I.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",U(x({},e),{defaultValue:r,maxLength:t}))}});M("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"}});w3=H("updateKeyboard",{paramsSchema:I.tuple(I.object({value:I.string()})),implement(e){F("updateKeyboardSync",e)}});M("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});S3=H("hideKeyboard",{implement(){F("hideKeyboardSync")}});M("keyboard.hideKeyboard",{version:"1.0.0"});rf=Y();rf.registerCommand("KeyboardSDK.showKeyboard",_3);rf.registerCommand("KeyboardSDK.updateKeyboard",w3);rf.registerCommand("KeyboardSDK.hideKeyboard",S3)});var fA=h(vc=>{"use strict";R();Ve();kt();var nf=Y(),I3=ne("levelFinished",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number()),duration:I.number().optional(),rating:I.number().optional(),score:I.number().optional(),variation:I.string().optional()})),implement:e=>y(vc,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e,a=[];a.push(Ot.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})),a.push(Ot.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}})),yield Promise.all(a)})}),E3=ne("gamePlayEnded",{paramsSchema:I.tuple(I.object({duration:I.number().optional(),rating:I.number().optional(),score:I.number(),variation:I.string().optional()})),implement:e=>y(vc,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e,o=[];o.push(Ot.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i})),o.push(Ot.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})),yield Promise.all(o)})}),k3=ne("levelUpgrade",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number()),name:I.string().optional()})),implement:r=>y(vc,[r],function*({levelId:e,name:t}){let n=[];n.push(Ot.tracker("LevelUpgrade",{name:t,levelId:e})),n.push(Ot.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})),yield Promise.all(n)})});nf.registerCommand("TaskTrackerSDK.levelFinished",I3);nf.registerCommand("TaskTrackerSDK.gamePlayEnded",E3);nf.registerCommand("TaskTrackerSDK.levelUpgrade",k3);M("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"}}});M("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});M("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}})});var of,af,sf,C3,mA,yc=C(()=>{"use strict";B();ce();Ve();R();Xr();M("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"}});M("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0",isLogin:"1.0.0",isSubUser:"1.2.9"}});of=new Map;Re("onLoginStateChange",({isLogin:e,token:t,uuid:r,isFirstLogin:n,extra:i,appAccountToken:o})=>{let a=of.get(r);a&&(a.resolve({isLogin:e,token:t,isFirstLogin:n,extra:i,appAccountToken:o}),of.delete(r))});af=(e,t=!1)=>y(void 0,null,function*(){var m,g,b;let{data:{isLogin:r}}=yield me("checkLoginAsync");if(r)return{isLogin:!0,token:(m=S.hostUserInfo)==null?void 0:m.token};let{skipLogin:n,triggerFrom:i}=e!=null?e:{},o=F("loginSync",{skipLogin:n,triggerFrom:i}),{data:{uuid:a}}=o;if(!a)throw Et({code:-1,msg:"login failed"});let s=new nt;of.set(a,s);let c=yield s.promise,l=F("envSync"),d=(b=(g=l==null?void 0:l.data)==null?void 0:g.hostUserInfo)==null?void 0:b.isSubUser;S.onEnvConfigChanged({hostUserInfo:U(x({},c),{isSubUser:d})});let v=c,{extra:u,appAccountToken:p}=v,f=$e(v,["extra","appAccountToken"]);return he.emit("onLoginComplete",f),t?c:f}),sf=ne("login",{paramsSchema:I.tuple(I.object({skipLogin:I.boolean().optional(),triggerFrom:I.string().optional()}).optional()),implement(e){return y(this,null,function*(){return yield af(e!=null?e:{})})}}),C3=ne("checkSession",{implement(){return y(this,null,function*(){var r;let{data:{isLogin:e}}=yield me("checkLoginAsync"),t=(r=S.hostUserInfo)==null?void 0:r.isSubUser;return{isLogin:e,isSubUser:t}})}}),mA=Y();mA.registerCommand("API.login",sf);mA.registerCommand("API.checkSession",C3)});var hA,gA=C(()=>{"use strict";hA=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 fn(e){return t=>y(this,null,function*(){var c;let{dailyMaxPopUps:r,minInterval:n}=t,i=yield Pr(e);if(!i.data)return{canShow:!0,isFirst:!0};let o=vA(i.data),a=hA(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-((c=a==null?void 0:a[0])!=null?c:0)<n?{canShow:!1,isFirst:!1}:{canShow:!0,isFirst:!1}})}function mn(e){return()=>y(this,null,function*(){var i;let t=Date.now(),r=yield Pr(e),n=vA((i=r.data)!=null?i:"[]");n.push(t),n.sort((o,a)=>a-o).splice(8),yield mt(e,JSON.stringify(n))})}var vA,yA,bA,_A,wA,SA,IA,EA,kA,CA,AA,xA,PA,TA,RA,Uo=C(()=>{"use strict";Ui();gA();vA=e=>{let t;try{t=JSON.parse(e)}catch(r){t=[]}return t};yA=fn("joli_coin_use_modal_frequency"),bA=fn("joli_coin_payment_frequency"),_A=fn("joli_coin_unlogin_modal_frequency"),wA=fn("joli_gem_use_modal_frequency"),SA=fn("joli_gem_payment_frequency"),IA=fn("joli_gem_unlogin_modal_frequency"),EA=fn("subscription_frequency");kA=mn("joli_coin_use_modal_frequency"),CA=mn("joli_coin_payment_frequency"),AA=mn("joli_coin_unlogin_modal_frequency"),xA=mn("joli_gem_use_modal_frequency"),PA=mn("joli_gem_payment_frequency"),TA=mn("joli_gem_unlogin_modal_frequency"),RA=mn("subscription_frequency")});var cf,bc,lf=C(()=>{"use strict";pt();cf=Promise.resolve(),bc=(e,t)=>y(void 0,null,function*(){cf=cf.then(()=>y(void 0,null,function*(){yield Z(t,{method:"POST",appendHostCookie:!0,data:{enableAutoDeduct:e}})})),yield cf})});var _c,wc,Mt,Sc,hn,Ut,yr,Ic,Ec,gn,ai,A3,q,br,_r,Le=C(()=>{"use strict";R();_c="UNLOCK_OPTIONS_CHANGED",wc="INVOKE_PAYMENT",Mt="ON_PAYMENT_RESULT",Sc="ON_USE_MODAL_EVENT",hn="ON_USE_MODAL_RESULT",Ut="ON_USE_MODAL_FREQUENCY",yr="ON_USE_UNLOGIN_MODAL_EVENT",Ic="INVOKE_UNLOGIN_MODAL_EVENT",Ec="INVOKE_SUBSCRIPTION_EVENT",gn="ON_USE_SUBSCRIPTION_RESULT",ai=new Jt,A3=()=>({on:ai.on.bind(ai),off:ai.off.bind(ai),emit:ai.emit.bind(ai)}),q=A3(),br={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},_r={show:!0,minInterval:8*60*60*1e3}});function Me(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=x(x({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}var tr=C(()=>{"use strict"});var DA=h(uf=>{"use strict";Uo();lf();Le();Le();er();kt();R();tr();var x3={JOLI_COIN:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"unlock_popup_show",coinUnlock:"coin_unlock_click",adUnlock:"ad_unlock_click"},frequencyChecker:yA,frequencyUpdater:kA,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:wA,frequencyUpdater:xA,apiEndpointAutoDeduct:"/api/joli-gem/user-config"}},OA=pn(),NA=Me(q,Ut);NA.getData();q.on(Sc,(e,t)=>y(uf,null,function*(){let r=t.currency,n=x3[r];if(e.includes("ADS-")){yield OA.show({duration:3e3});let c=yield NA.getData(),{canShow:l,isFirst:d}=yield n.frequencyChecker(c.joliCoinUseAndCharge[n.frequencyConfigKey]);console.log(`${r} modal show by frequency`,l,d),OA.hide();let{balance:u}=t.userCurrency;if(u>=t.quantity&&t.enableAutoDeduct&&!d){q.emit(hn,{useModalResult:"CONFIRM"});return}if(!l){q.emit(hn,{useModalResult:"FAILED"});return}}j(n.trackEvents.popupShow,{eventType:J.View,targetType:"game",currency:r});let{userCurrency:i,enableAutoDeduct:o,quantity:a}=t,s=NC({data:{enableAutoDeduct:o,userCurrency:i,quantity:a,currency:r},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>{j(n.trackEvents.coinUnlock,{targetType:"game",eventType:J.Click,coinConsume:t.quantity,ifAutoUnlock:t.enableAutoDeduct,currency:r}),q.emit(hn,{useModalResult:"CONFIRM"}),s.destroy()}},cancel:{text:t.cancelButtonText,onPress:({type:c})=>{c==="FAILED"&&j(n.trackEvents.adUnlock,{targetType:"game",eventType:J.Click,currency:r}),q.emit(hn,{useModalResult:(c!=null?c:"")==="CANCEL"?"CANCEL":"FAILED"}),s.destroy()}},onEnableDeductChanged:c=>y(uf,null,function*(){yield bc(c,n.apiEndpointAutoDeduct)})}});yield n.frequencyUpdater()}))});function qA(){let e=new Map;return{registerPaymentHandler(r,n){e.set(r,n)},invokePayment(r,...n){return y(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 _e(o),{code:"FAILED",message:`[joliboxSDK]: paymenterror ${o}`}}})}}}var LA=C(()=>{"use strict";dt()});var Fo=C(()=>{"use strict"});var P3,si,bt,T3,vn,kc=C(()=>{"use strict";Fo();R();B();pt();P3=()=>{let[e,t]=[ma,ha].map(r=>(n,i,o)=>new r(n,i,o));return{createPaymentError:e,createPaymentInternalError:t}},{createPaymentError:si,createPaymentInternalError:bt}=P3(),T3=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",vn=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startPayment=t=>y(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw si(n,1001);return yield this.pay()});this.cancelOrder=t=>y(this,null,function*(){var n,i;let{response:r}=yield Z(`/api/orders/${t}/cancel`,{method:"POST",data:{}});if(r.code!=="SUCCCESS")throw si((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(x({},this.generatePaymentContext()))),`${T3}//payment/callback?${t.toString()}`}}get orderId(){return this._orderId}get status(){return this._orderStatus}}});var pf,MA,UA=C(()=>{"use strict";pt();kc();Fo();pf=class extends vn{constructor(r){super();this.productId=r;this.generatePaymentContext=()=>({type:"JOLI_COIN_ORDER_CONTEXT",state:"TO_VALIDATE",productId:this.productId,orderId:this.orderId});this.pay=()=>y(this,null,function*(){let r=this.generateCallbackUrl();return console.info("callbackUrl",r),{code:"SUCCESS",message:"jolicoin payment success"}})}placeOrder(r){return y(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 si((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),bt((a=JSON.stringify(s))!=null?a:"jolicoin placeorder failed",1002)}})}},MA=()=>{let e=new Map;return t=>y(void 0,null,function*(){let r=e.get(t);return r||(r=new pf(t),e.set(t,r)),yield r.startPayment({productId:t}),{code:"SUCCESS",message:"jolicoin payment success"}})}});var FA,jA=C(()=>{"use strict";FA={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 ff,GA,mf,hf,R3,gf,BA=C(()=>{"use strict";pt();kc();Fo();ce();R();B();er();jA();ff=new Map;Re("onPaymentStateChange",e=>{console.info("onPaymentStateChange",e);let{orderUUID:t,status:r,totalAmount:n,orderResponse:i}=e,o=ff.get(t);if(o){if(r==="SUCCESS")Jr("{slot-success} {slot-i18n-jolicoin.unlockSuccess}",{position:"center",duration:3e3}),o.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{totalAmount:n}});else{if(r==="FAILED"&&fa(i==null?void 0:i.errNo)&&(i==null?void 0:i.errNo)!==0)throw bt(`jolicoin payment failed: ${i==null?void 0:i.errMsg}`,1002);let a=FA[r];a&&Jr(`{slot-error} {slot-i18n-jolicoin.${a}}`,{position:"center",duration:3e3}),o.resolve({code:"FAILED",message:"jolicoin payment failed"})}ff.delete(t)}});GA=e=>y(void 0,null,function*(){var n,i;let t=new nt,r;try{let o=yield me("requestPaymentSync",{paymentBody:{appStoreProductId:e.appStoreProductId,appAccountToken:e.appAccountToken}});if(r=(n=o.data)==null?void 0:n.orderUUID,console.info("---purchaseGem---",o),!r)throw bt("orderUUID is null",1002);ff.set(r,t)}catch(o){throw bt((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),mf=class extends vn{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=()=>y(this,null,function*(){return yield GA({appStoreProductId:this.appStoreProductId})})}placeOrder(r){return y(this,null,function*(){return{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},hf=class extends vn{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=()=>y(this,null,function*(){return yield GA({appStoreProductId:this.appStoreProductId,appAccountToken:this.appAccountToken})})}placeOrder(r){return y(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 bt("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"}})}},R3={android:mf,ios:hf},gf=()=>{let e=new Map;return t=>y(void 0,null,function*(){let{productId:r,appStoreProductId:n}=t,i=e.get(r);if(!i){let s=R3[S.platform];if(!s)throw bt("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 si(a,1002);return{code:"SUCCESS",message:"jolicoin payment success"}})}});var yn,vf=C(()=>{"use strict";LA();UA();BA();yn=qA();yn.registerPaymentHandler("JOLI_COIN",MA());yn.registerPaymentHandler("JOLI_COIN_IAP",gf());yn.registerPaymentHandler("JOLI_GEM_IAP",gf())});function JA(n,i){return y(this,arguments,function*(e,t,r={}){let{storageKeyPrefix:o="joli_cache_"}=r,a=o+e,s=a+"_timestamp";try{let c=yield t(),l=Date.now();try{c!=null&&(yield mt(a,c),yield mt(s,l.toString()),console.log("[Cache] Cached result for key:",e))}catch(d){console.warn("[Cache] Failed to save to localStorage for key:",e,d)}return c}catch(c){throw console.warn("[Cache] Executor failed for key:",e,c),c}})}function Cc(n,i){return y(this,arguments,function*(e,t,r={}){let{cacheDuration:o=-1,storageKeyPrefix:a="joli_cache_"}=r,s=a+e,c=s+"_timestamp",l=o===1/0||o===-1;try{let{data:d}=yield Pr(s),{data:u}=yield Pr(c);if(d&&u){let p=parseInt(u,10);if(l||Date.now()-p<o){console.log("[Cache] Using localStorage cached data for key:",e);let f=JSON.parse(d);return l||setTimeout(()=>y(this,null,function*(){try{console.log("[Cache] Background updating cache for key:",e);let m=yield t(),g=Date.now();yield mt(s,m),yield mt(c,g.toString()),console.log("[Cache] Background cache update completed for key:",e)}catch(m){console.warn("[Cache] Background cache update failed for key:",e,m)}}),0),f}else yield mt(s,null),yield mt(c,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 mt(s,d),yield mt(c,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 yf=C(()=>{"use strict";Ui()});function O3(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=>!Ni(r.totalAmountStr))}var Hr,bf,rr,Pc,_f,wf,Ac,xc,HA,Tc,Sf=C(()=>{"use strict";vf();R();ce();pt();R();yf();Hr=class Hr{execute(t,r){return y(this,null,function*(){var a,s,c;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=(c=(s=i.paymentChoices)==null?void 0:s.filter(l=>typeof l.appStoreProductId=="string").map(l=>l.appStoreProductId))!=null?c:[];if(o.length>0){let l=yield this.getNativePriceData(o);l&&O3(i,l)}if(i.paymentChoices.length===0)throw new Error("paymentChoices is empty");return i})}getNativePriceData(t){return y(this,null,function*(){let r=t.sort().join(",");return Cc(r,()=>y(this,null,function*(){try{let{data:n}=yield me("requestProductDetailsAsync",{appStoreProductIds:t});return n&&(Hr.nativePriceCache.set(r,n),Hr.nativePriceCacheTimestamp.set(r,Date.now())),n}catch(n){throw console.warn("[PaymentService] Failed to fetch native product details:",n),n}}),{cacheDuration:Hr.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")}};Hr.nativePriceCache=new Map,Hr.NATIVE_PRICE_CACHE_DURATION=10*60*1e3,Hr.nativePriceCacheTimestamp=new Map;bf=Hr,rr=class rr extends Rt{constructor(r,n){super(new bf,{duration:10*60*1e3,timeout:1e3});this.apiEndpoint=r;this.paymentType=n}getProductsInfo(){return y(this,null,function*(){let r=rr.failureCounters.get(this.apiEndpoint)||0;if(r>=rr.MAX_FAILURE_COUNT)throw new Error(`getProductsInfo has failed more than ${rr.MAX_FAILURE_COUNT} times for ${this.apiEndpoint}`);try{let n=yield this.request(this.apiEndpoint);return rr.failureCounters.delete(this.apiEndpoint),n}catch(n){let i=r+1;throw rr.failureCounters.set(this.apiEndpoint,i),console.warn(`[PaymentService] getProductsInfo failed (${i}/${rr.MAX_FAILURE_COUNT+1}) for ${this.apiEndpoint}:`,n),n}})}purchase(r){return y(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 yn.invokePayment(this.paymentType==="JOLI_COIN"?"JOLI_COIN_IAP":"JOLI_GEM_IAP",{productId:r,appStoreProductId:i})})}getProductsInfoWithBalance(){return y(this,null,function*(){return this.request(this.apiEndpoint)})}refreshProductsInfo(){return y(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}static resetFailureCounters(){this.failureCounters.clear()}static getFailureCount(r){return this.failureCounters.get(r)||0}};rr.failureCounters=new Map,rr.MAX_FAILURE_COUNT=2;Pc=rr,_f=class extends Pc{constructor(){super("/api/joli-coin/balance-detail","JOLI_COIN")}},wf=class extends Pc{constructor(){super("/api/joli-gem/balance-detail","JOLI_GEM")}},Ac=null,xc=null,HA=()=>Ac||(Ac=new _f,Ac),Tc=()=>xc||(xc=new wf,xc)});var WA=h(Rc=>{"use strict";Le();er();B();yc();R();Uo();vf();er();Ve();kt();lf();tr();Sf();var N3={JOLI_COIN:{frequencyConfigKey:"charge",trackEvents:{modalShow:"coinorder_show",orderClick:"coinorder_click",payEnsure:"order_pay_ensure",payResult:"order_pay_result",adUnlock:"ad_unlock_click"},frequencyChecker:bA,frequencyUpdater:CA,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:SA,frequencyUpdater:PA,apiEndpoint:"/api/joli-gem/balance-detail",apiEndpointAutoDeduct:"/api/joli-gem/user-config",paymentType:"JOLI_GEM_IAP"}},ci=pn(),$A=HA(),VA=Tc(),D3=Me(q,Ut);q.on(wc,(e,t)=>y(Rc,null,function*(){var r,n,i;try{let o=t.currency,a=N3[o];if(!ft("requestPaymentSync:paymentBody:appStoreProductId")){console.info("requestPaymentSync:paymentBody:appStoreProductId not supported"),setTimeout(()=>{q.emit(Mt,{paymentResult:"FAILED",currency:o})},0);return}if(e.includes("ADS-")){yield ci.show({duration:3e3});let d=yield D3.getData(),{canShow:u}=yield a.frequencyChecker(d.joliCoinUseAndCharge[a.frequencyConfigKey]);if(console.log(`${o} payment show by frequency`,u),ci.hide(),!u){q.emit(Mt,{paymentResult:"FAILED",currency:o});return}console.log("show by frequency")}yield ci.show({duration:3e3});let s=o==="JOLI_COIN"?$A:VA,c=yield s.getProductsInfo();if(ci.hide(),!c||!((r=c.paymentChoices)!=null&&r.length)){q.emit(Mt,{paymentResult:"FAILED",currency:o});return}j(a.trackEvents.modalShow,{targetType:"game",eventType:J.View,currency:o});let l=DC({data:{userCurrency:t.userCurrency,quantity:t.quantity,currency:o,paymentChoices:(i=(n=c.paymentChoices)==null?void 0:n.map(d=>{var u;return U(x({},d),{totalAmountStr:(u=d.totalAmountStr)!=null?u:""})}))!=null?i:[],enableAutoDeduct:t.enableAutoDeduct},buttons:{confirm:{text:t.confirmButtonText,onPress:d=>y(Rc,null,function*(){var f,m,g,b,v,w,E,A;if(j(a.trackEvents.payEnsure,{targetType:"game",eventType:J.Click,payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(m=(f=c.paymentChoices.find(P=>P.productId===d))==null?void 0:f.totalAmountStr)!=null?m:""}),!((g=S.hostUserInfo)!=null&&g.isLogin)){let{data:P}=yield sf({skipLogin:!0});if(!(P!=null&&P.isLogin)){console.log("login failed");return}let T=yield s.refreshProductsInfo();if(((b=T==null?void 0:T.balance)!=null?b:0)>=t.quantity){q.emit(Mt,{paymentResult:"SUCCESS",currency:o}),l.destroy();return}}console.log("invokeNativePayment",d);let u=(w=(v=c==null?void 0:c.paymentChoices)==null?void 0:v.find(P=>P.productId===d))==null?void 0:w.appStoreProductId;if(!u){q.emit(Mt,{paymentResult:"FAILED",currency:o}),l.destroy();return}yield ci.show({duration:3e3});let{code:p}=yield yn.invokePayment(a.paymentType,{productId:d,appStoreProductId:u});if(ci.hide(),j(a.trackEvents.payResult,{eventType:J.Other,targetType:"game",payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(A=(E=c.paymentChoices.find(P=>P.productId===d))==null?void 0:E.totalAmountStr)!=null?A:"",payResult:p}),console.log("payment result",p),p!=="SUCCESS"){console.info("[JoliboxSDK] payment failed in payment.invokePaymet");return}q.emit(Mt,{paymentResult:"SUCCESS",currency:o}),l.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:d})=>{q.emit(Mt,{paymentResult:(d!=null?d:"")==="CANCEL"?"CANCEL":"FAILED",currency:o}),j(a.trackEvents.adUnlock,{targetType:"game",eventType:J.Click,currency:o}),l.destroy()}},onEnableDeductChanged:d=>y(Rc,null,function*(){yield bc(d,a.apiEndpointAutoDeduct)})},onSelect:d=>{var u,p;j(a.trackEvents.orderClick,{targetType:"game",eventType:J.Click,coinAmount:t.quantity,currency:o,orderPrice:(p=(u=c.paymentChoices.find(f=>f.productId===d))==null?void 0:u.totalAmountStr)!=null?p:""})}});yield a.frequencyUpdater()}catch(o){console.error("payment failed",o),q.emit(Mt,{paymentResult:"FAILED",currency:t.currency})}}));$A.getProductsInfo().catch(e=>{console.error("preload joli coin payment details failed",e)});VA.getProductsInfo().catch(e=>{console.error("preload joli gem payment details failed",e)})});var KA=h(Oc=>{"use strict";Le();tr();Uo();pt();dt();R();yc();er();kt();var q3={JOLI_COIN:{frequencyChecker:_A,frequencyUpdater:AA,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:IA,frequencyUpdater:TA,trackEvents:{modalExpose:"GemLoginGuideModal",clickConfirm:"GemLoginGuideModal",clickConfirmLogin:"GemLoginGuideModal",modalHide:"GemLoginGuideModal",clickClose:"GemLoginGuideModal",clickWatchAds:"GemLoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.gemRewardTips}",usedText:"Gem Used"}}},zA=Me(q,Ut);zA.getData();q.on(Ic,(e,t)=>y(Oc,null,function*(){var r;try{let n=t.currency,i=q3[n];if(e.includes("ADS-")){let s=yield zA.getData();if(console.log(`${n} unlogin guide config`,s.loginGuide),!s.loginGuide.show){q.emit(yr,{result:"NOT_SUPPORT"});return}let{canShow:c}=yield i.frequencyChecker(s.loginGuide);if(console.log(`${n} canShowUseModal`,c),!c){q.emit(yr,{result:"FAILED"});return}}let{firstLogin:o}=(r=yield L3())!=null?r:{};if(!(o!=null&&o.reward)){console.log("[JoliboxSDK] unlogin modal reward is empty"),q.emit(yr,{result:"NOT_SUPPORT"});return}j(i.trackEvents.modalExpose,{eventType:J.Expose,currency:n},J.Expose);let a=qC({data:{rewardType:e,rewardValue:o.reward.rewardValue,currency:t.currency},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>y(Oc,null,function*(){var d,u,p,f;j(i.trackEvents.clickConfirm,{type:"click_confirm",eventType:J.Click,currency:n},J.Click);let{isLogin:s,extra:c,isFirstLogin:l}=yield af({},!0);if(!s){console.log("login failed");return}if(j(i.trackEvents.clickConfirmLogin,{type:"click_confirm_login",isFirstLogin:l,eventType:J.Click,currency:n},J.Click),l&&((d=c==null?void 0:c.firstLogin)!=null&&d.reward)){let{rewardValue:m}=c.firstLogin.reward;Jr(i.toastMessage.i18nKey,{i18nParams:{text:i.toastMessage.usedText,coin:m},position:"top",duration:3e3})}q.emit(yr,{result:"SUCCESS",rewards:{claimedRewardValue:(f=(p=(u=c==null?void 0:c.firstLogin)==null?void 0:u.reward)==null?void 0:p.rewardValue)!=null?f:0,isFirstLogin:l!=null?l:!1,currency:t.currency}}),a.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:s})=>{j(i.trackEvents.modalHide,{eventType:J.Hide,currency:n},J.Hide);let c=s==="CANCEL"?"click_close":"click_watch_ads",l=s==="CANCEL"?i.trackEvents.clickClose:i.trackEvents.clickWatchAds;j(l,{type:c,eventType:J.Click,currency:n},J.Click),q.emit(yr,{result:"FAILED"}),a.destroy()}}}});yield i.frequencyUpdater()}catch(n){_e(new Ih(n)),q.emit(yr,{result:"FAILED"})}}));var L3=()=>y(Oc,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 M3(){let e=new Map;return{registerSubscriptionHandler(r,n){e.set(r,n)},invokeSubscription(r,...n){return y(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 _e(o),{code:"FAILED",message:`[joliboxSDK]: subscription error ${o}`}}})}}}var jo,If=C(()=>{"use strict";dt();jo=M3()});var bn,Nc=C(()=>{"use strict";bn={PlaceOrderFailed:1001,CancelOrderFailed:1002,SubscriptionFailed:1003,InvalidPlan:1004}});var U3,YA,Dc,F3,Go,Ef=C(()=>{"use strict";Nc();R();B();U3=()=>{let[e,t]=[ma,ha].map(r=>(n,i,o)=>new r(n,i,o));return{createSubscriptionError:e,createSubscriptionInternalError:t}},{createSubscriptionError:YA,createSubscriptionInternalError:Dc}=U3(),F3=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",Go=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startSubscription=t=>y(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw YA(n,bn.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(x({},this.generateSubscriptionContext()))),`${F3}/subscription/callback?${t.toString()}`};this.createSubscriptionError=YA;this.createSubscriptionInternalError=Dc}setOrderId(t){this._orderId=t}setOrderStatus(t){this._orderStatus=t}get orderId(){return this._orderId}get status(){return this._orderStatus}}});function j3(e,t){Object.keys(t).forEach(r=>{var i,o,a,s;let n=e.find(c=>c.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=>!Ni(r.amountStr))}var _n,Lc,kf,Cf,qc,QA,Af=C(()=>{"use strict";R();ce();pt();R();yf();If();ce();Ef();Nc();_n=class _n{static getNativePriceCache(t){var n;let r=t.sort().join(",");return(n=this.nativePriceCache.get(r))!=null?n:{}}execute(t,r){return y(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(c=>typeof c.appStoreProductId=="string").map(c=>c.appStoreProductId))!=null?s:[];if(o.length>0){let c=yield this.getNativePriceData(o);c&&j3(i,c)}if(i.length===0)throw new Error("subscription tiers is empty");return i})}requestNativeSubscriptionPlans(t,r){return y(this,null,function*(){try{let{data:n}=yield me("requestSubscriptionPlansAsync",{appStoreProductIds:t,type:"game"});return n&&(_n.nativePriceCache.set(r,n),_n.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 y(this,null,function*(){let n=t.sort().join(",");return(r?JA:Cc)(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 y(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")}};_n.nativePriceCache=new Map,_n.NATIVE_PRICE_CACHE_DURATION=1*24*60*60*1e3,_n.nativePriceCacheTimestamp=new Map;Lc=_n,kf=class extends Rt{constructor(r){super(new Lc,{duration:30*60*1e3,timeout:3e3});this.apiEndpoint=r;this.pendingSubscriptions=new Map;this.subInfoCacheKeys=[];this.listenSubscriptionPanelStateChange()}getSubInfo(){return y(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 y(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}updateNativePriceCache(r){return y(this,null,function*(){yield this.requestAdapter.updateNativePriceCache(r)})}updateAllNativePriceCache(){return y(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 y(this,null,function*(){var i;console.log("[SubscriptionService] subscribe params",jo);let n=yield jo.invokeSubscription("SUB_APP",{productId:r.nativeProductId,appStoreProductId:r.appStoreProductId,planId:r.basePlanId});return{result:n.code,subPlanId:(i=n.data)==null?void 0:i.subPlanId,message:n.message}})}invokeSubscriptionPanel(){return y(this,null,function*(){var i,o;let r=new nt,n;try{if(console.log("[invokeSubscriptionPanel] requestSubscriptionSync params"),n=(i=F("invokeSubscriptionPanelSync",{type:"game"}).data)==null?void 0:i.subUUID,!n)throw Dc("orderUUID is null",bn.SubscriptionFailed);this.pendingSubscriptions.set(n,r)}catch(a){throw Dc((o=JSON.stringify(a))!=null?o:"subscription panel failed",bn.SubscriptionFailed)}return r.promise})}getTierByProductId(r){return y(this,null,function*(){var s;let n=yield this.getSubInfo(),i=n==null?void 0:n.find(c=>c.productId===r);if(!i)return;let o=Lc.getNativePriceCache((n!=null?n:[]).map(c=>{var l;return(l=c.appStoreProductId)!=null?l:""}));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(){Re("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"}}))})}},Cf=class extends kf{constructor(){super("/api/subs/pricing")}},qc=null,QA=()=>qc||(qc=new Cf,qc)});var XA=C(()=>{"use strict"});function ex(){let e=new Map;return t=>y(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=G3[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 xf,ZA,Pf,Tf,G3,tx=C(()=>{"use strict";B();Ef();Fo();kc();R();ce();R();Nc();Re("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}})});xf=new Map;Re("onSubscritptionStateChange",e=>{var o,a;let{subUUID:t,status:r,orderResponse:n}=e;console.log("[onSubscritptionStateChange] data",e);let i=xf.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"&&fa(n==null?void 0:n.errNo)&&(n==null?void 0:n.errNo)!==0)throw bt(`subscription failed: ${n==null?void 0:n.errMsg}`,bn.SubscriptionFailed);i.resolve({code:r,message:(a=n==null?void 0:n.errMsg)!=null?a:"UNKNOWN_ERROR"})}xf.delete(t)}});ZA=e=>y(void 0,null,function*(){var n,i;let t=new nt,r;try{if(console.log("[internalSubscribe] requestSubscriptionSync params",e),r=(n=F("requestSubscriptionSync",x({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 bt("subUUID is null",1002);xf.set(r,t)}catch(o){throw bt((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),Pf=class extends Go{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return y(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 y(this,null,function*(){return yield ZA(r)})}},Tf=class extends Go{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return y(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 bt("appAccountToken is null",1002);return this.subscriptionToken=i,{code:"SUCCESS",message:"placeorder sub-app success in native"}})}cancelOrder(r){return y(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 y(this,null,function*(){return yield ZA(U(x({},r),{appAccountToken:this.subscriptionToken}))})}},G3={android:Pf,ios:Tf}});var wn,Rf=C(()=>{"use strict";Af();XA();If();tx();Af();wn=QA();jo.registerSubscriptionHandler("SUB_APP",ex())});var ox=h(ix=>{"use strict";Uo();Le();tr();Ve();Rf();er();var B3={SUBSCRIPTION:{frequencyConfigKey:"joinMember",frequencyChecker:EA,frequencyUpdater:RA}},rx=pn(),nx=Me(q,Ut);nx.getData();q.on(Ec,e=>y(ix,null,function*(){let t=B3.SUBSCRIPTION;if(!ft("invokeSubscriptionPanelSync")){console.info("invokeSubscriptionPanelSync not supported"),setTimeout(()=>{q.emit(gn,{result:"FAILED"})},0);return}yield rx.show({duration:3e3});let r=yield nx.getData(),{canShow:n,isFirst:i}=yield t.frequencyChecker(r.joliCoinUseAndCharge[t.frequencyConfigKey]);if(rx.hide(),!n){q.emit(gn,{result:"FAILED"});return}let{data:o,code:a}=yield wn.invokeSubscriptionPanel();a=="SUCCESS"&&(o!=null&&o.subPlanId)?q.emit(gn,{result:"SUCCESS"}):q.emit(gn,{result:"FAILED"}),yield t.frequencyUpdater()}))});var Lte,Mte,Ute,Fte,ax=C(()=>{"use strict";Lte=re(DA()),Mte=re(WA()),Ute=re(KA()),Fte=re(ox())});function e4(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function t4(e){return typeof e=="string"}function r4(e){return typeof e=="undefined"}function n4(e){return r4(e)||e===null}function i4(e){return typeof e=="function"}function Lx(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 Bo(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function jc(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 d4(e){let t=e.location?jc(e.location,px):null,r=e.target?jc(e.target,px):null;return jc(Q3(Y3({},e),{location:t,target:r}),l4)}function p4(e){let t=e.events.map(n=>d4(n)),r=jc(e.device,u4);return[e.protocolVersion,t,r,e.project]}function f4(){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 y4(e){return new Promise(t=>jx(e)(t))}function jx(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 b4(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new Wo(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 w4(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)S4(e[n],t[n])}function S4(e,t){if(t4(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(i4(t)){try{if(e instanceof t)return}catch(r){}if(!n4(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 at(e,t,r){return(t=I4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function I4(e){var t=E4(e,"string");return typeof t=="symbol"?t:t+""}function E4(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 Mc(e,t,r){return(t=k4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function k4(e){var t=C4(e,"string");return typeof t=="symbol"?t:t+""}function C4(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 Uc(e,t,r){return(t=A4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function A4(e){var t=x4(e,"string");return typeof t=="symbol"?t:t+""}function x4(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 wr(e,t,r){return(t=P4(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P4(e){var t=T4(e,"string");return typeof t=="symbol"?t:t+""}function T4(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 R4(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 O4(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 U4(e,t){return Je(e,0)^45?(((t<<2^Je(e,0))<<2^Je(e,1))<<2^Je(e,2))<<2^Je(e,3):0}function Jx(e){return e.trim()}function F4(e,t){return(e=t.exec(e))?e[0]:e}function K(e,t,r){return e.replace(t,r)}function Vf(e,t){return e.indexOf(t)}function Je(e,t){return e.charCodeAt(t)|0}function zo(e,t,r){return e.slice(t,r)}function nr(e){return e.length}function cm(e){return e.length}function Fc(e,t){return t.push(e),e}function j4(e,t){return e.map(t).join("")}function tl(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:el,column:mi,length:a,return:""}}function Ho(e,t){return M4(tl("",null,null,"",null,null,0),e,{length:-e.length},t)}function G4(){return Pe}function B4(){return Pe=lt>0?Je(hi,--lt):0,mi--,Pe===10&&(mi=1,el--),Pe}function wt(){return Pe=lt<Hx?Je(hi,lt++):0,mi++,Pe===10&&(mi=1,el++),Pe}function ir(){return Je(hi,lt)}function Gc(){return lt}function Yo(e,t){return zo(hi,e,t)}function Ko(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 $x(e){return el=mi=1,Hx=nr(hi=e),lt=0,[]}function Vx(e){return hi="",e}function Bc(e){return Jx(Yo(lt-1,Wf(e===91?e+2:e===40?e+1:e)))}function J4(e){for(;(Pe=ir())&&Pe<33;)wt();return Ko(e)>2||Ko(Pe)>3?"":" "}function H4(e,t){for(;--t&&wt()&&!(Pe<48||Pe>102||Pe>57&&Pe<65||Pe>70&&Pe<97););return Yo(e,Gc()+(t<6&&ir()==32&&wt()==32))}function Wf(e){for(;wt();)switch(Pe){case e:return lt;case 34:case 39:e!==34&&e!==39&&Wf(Pe);break;case 40:e===41&&Wf(e);break;case 92:wt();break}return lt}function $4(e,t){for(;wt()&&e+Pe!==57&&!(e+Pe===84&&ir()===47););return"/*"+Yo(t,lt-1)+"*"+Zc(e===47?e:wt())}function V4(e){for(;!Ko(ir());)wt();return Yo(e,lt)}function W4(e){return Vx(Jc("",null,null,null,[""],e=$x(e),0,[0],e))}function Jc(e,t,r,n,i,o,a,s,c){for(var l=0,d=0,u=a,p=0,f=0,m=0,g=1,b=1,v=1,w=0,E="",A=i,P=o,T=n,k=E;b;)switch(m=w,w=wt()){case 40:if(m!=108&&Je(k,u-1)==58){Vf(k+=K(Bc(w),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:k+=Bc(w);break;case 9:case 10:case 13:case 32:k+=J4(m);break;case 92:k+=H4(Gc()-1,7);continue;case 47:switch(ir()){case 42:case 47:Fc(z4($4(wt(),Gc()),t,r),c);break;default:k+="/"}break;case 123*g:s[l++]=nr(k)*v;case 125*g:case 59:case 0:switch(w){case 0:case 125:b=0;case 59+d:v==-1&&(k=K(k,/\f/g,"")),f>0&&nr(k)-u&&Fc(f>32?gx(k+";",n,r,u-1):gx(K(k," ","")+";",n,r,u-2),c);break;case 59:k+=";";default:if(Fc(T=hx(k,t,r,l,d,i,s,E,A=[],P=[],u),o),w===123)if(d===0)Jc(k,t,T,T,A,o,u,s,P);else switch(p===99&&Je(k,3)===110?100:p){case 100:case 108:case 109:case 115:Jc(e,T,T,n&&Fc(hx(e,T,T,0,0,i,s,E,i,A=[],u),P),i,P,u,s,n?A:P);break;default:Jc(k,T,T,T,[""],P,0,s,P)}}l=d=f=0,g=v=1,E=k="",u=a;break;case 58:u=1+nr(k),f=m;default:if(g<1){if(w==123)--g;else if(w==125&&g++==0&&B4()==125)continue}switch(k+=Zc(w),w*g){case 38:v=d>0?1:(k+="\f",-1);break;case 44:s[l++]=(nr(k)-1)*v,v=1;break;case 64:ir()===45&&(k+=Bc(wt())),p=ir(),d=u=nr(E=k+=V4(Gc())),w++;break;case 45:m===45&&nr(k)==2&&(g=0)}}return o}function hx(e,t,r,n,i,o,a,s,c,l,d){for(var u=i-1,p=i===0?o:[""],f=cm(p),m=0,g=0,b=0;m<n;++m)for(var v=0,w=zo(e,u+1,u=L4(g=a[m])),E=e;v<f;++v)(E=Jx(g>0?p[v]+" "+w:K(w,/&\f/g,p[v])))&&(c[b++]=E);return tl(e,t,r,i===0?am:s,c,l,d)}function z4(e,t,r){return tl(e,t,r,Gx,Zc(G4()),zo(e,2,-2),0)}function gx(e,t,r,n){return tl(e,t,r,sm,zo(e,0,n),zo(e,n+1,-1),n)}function fi(e,t){for(var r="",n=cm(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function K4(e,t,r,n){switch(e.type){case q4:if(e.children.length)break;case D4:case sm:return e.return=e.return||e.value;case Gx:return"";case Bx:return e.return=e.value+"{"+fi(e.children,n)+"}";case am:e.value=e.props.join(",")}return nr(r=fi(e.children,n))?e.return=e.value+"{"+r+"}":""}function Y4(e){var t=cm(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 Q4(e){return function(t){t.root||(t=t.return)&&e(t)}}function X4(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}function Wx(e,t){switch(U4(e,t)){case 5103:return z+"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 z+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return z+e+Wc+e+Xe+e+e;case 6828:case 4268:return z+e+Xe+e+e;case 6165:return z+e+Xe+"flex-"+e+e;case 5187:return z+e+K(e,/(\w+).+(:[^]+)/,z+"box-$1$2"+Xe+"flex-$1$2")+e;case 5443:return z+e+Xe+"flex-item-"+K(e,/flex-|-self/,"")+e;case 4675:return z+e+Xe+"flex-line-pack"+K(e,/align-content|flex-|-self/,"")+e;case 5548:return z+e+Xe+K(e,"shrink","negative")+e;case 5292:return z+e+Xe+K(e,"basis","preferred-size")+e;case 6060:return z+"box-"+K(e,"-grow","")+z+e+Xe+K(e,"grow","positive")+e;case 4554:return z+K(e,/([^-])(transform)/g,"$1"+z+"$2")+e;case 6187:return K(K(K(e,/(zoom-|grab)/,z+"$1"),/(image-set)/,z+"$1"),e,"")+e;case 5495:case 3959:return K(e,/(image-set\([^]*)/,z+"$1$`$1");case 4968:return K(K(e,/(.+:)(flex-)?(.*)/,z+"box-pack:$3"+Xe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+z+e+e;case 4095:case 3583:case 4068:case 2532:return K(e,/(.+)-inline(.+)/,z+"$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(nr(e)-1-t>6)switch(Je(e,t+1)){case 109:if(Je(e,t+4)!==45)break;case 102:return K(e,/(.+:)(.+)-([^]+)/,"$1"+z+"$2-$3$1"+Wc+(Je(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Vf(e,"stretch")?Wx(K(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Je(e,t+1)!==115)break;case 6444:switch(Je(e,nr(e)-3-(~Vf(e,"!important")&&10))){case 107:return K(e,":",":"+z)+e;case 101:return K(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+z+(Je(e,14)===45?"inline-":"")+"box$3$1"+z+"$2$3$1"+Xe+"$2box$3")+e}break;case 5936:switch(Je(e,t+11)){case 114:return z+e+Xe+K(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return z+e+Xe+K(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return z+e+Xe+K(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return z+e+Xe+e+e}return e}function s$(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 zc(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 $r={name:i.name,styles:i.styles,next:$r},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)$r={name:a.name,styles:a.styles,next:$r},a=a.next;var s=o.styles+";";return s}return d$(e,t,r)}}var c=r;if(t==null)return c;var l=t[c];return l!==void 0?l:c}function d$(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=zc(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]+"}":yx(s)&&(n+=Nf(o)+":"+bx(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var c=0;c<a.length;c++)yx(a[c])&&(n+=Nf(o)+":"+bx(o,a[c])+";");else{var l=zc(e,t,a);switch(o){case"animation":case"animationName":{n+=Nf(o)+":"+l+";";break}default:n+=o+"{"+l+"}"}}}return n}function Df(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="";$r=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=zc(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=zc(r,t,e[s]),n){var c=o;i+=c[s]}_x.lastIndex=0;for(var l="",d;(d=_x.exec(i))!==null;)l+="-"+d[1];var u=s$(i)+l;return{name:u,styles:i,next:$r}}function Kx(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}function wx(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function Sx(e,t,r){var n=[],i=Kx(e,n,r);return n.length<2?r:i+t(n)}function v$(e,t){qe.__h&&qe.__h(_t,e,Ex||t),Ex=0;var r=_t.__H||(_t.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function Qx(e,t){var r=v$(zf++,7);return _$(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function y$(){for(var e;e=Yx.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Hc),e.__H.__h.forEach(Kf),e.__H.__h=[]}catch(t){e.__H.__h=[],qe.__e(t,e.__v)}}function b$(e){var t,r=function(){clearTimeout(n),Rx&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);Rx&&(t=requestAnimationFrame(r))}function Hc(e){var t=_t,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),_t=t}function Kf(e){var t=_t;e.__c=e.__(),_t=t}function _$(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function rl(){if(Vr>1)Vr--;else{for(var e,t=!1;$o!==void 0;){var r=$o;for($o=void 0,Yf++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Zx(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Yf=0,Vr--,t)throw e}}function ct(e){if(Vr>0)return e();Vr++;try{return e()}finally{rl()}}function Xx(e){if(te!==void 0){var t=e.n;if(t===void 0||t.t!==te)return t={i:0,S:e,p:te.s,n:void 0,t:te,e:void 0,x:void 0,r:t},te.s!==void 0&&(te.s.n=t),te.s=t,e.n=t,32&te.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=te.s,t.n=void 0,te.s.n=t,te.s=t),t}}function He(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function ie(e){return new He(e)}function Zx(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 eP(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 tP(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 yi(e){He.call(this,void 0),this.x=e,this.s=void 0,this.g=Kc-1,this.f=4}function Vo(e){return new yi(e)}function rP(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Vr++;var r=te;te=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,lm(e),n}finally{te=r,rl()}}}function lm(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,rP(e)}function S$(e){if(te!==this)throw new Error("Out-of-order effect");tP(this),te=e,this.f&=-2,8&this.f&&lm(this),rl()}function Qo(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Xo(e){var t=new Qo(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function bi(e,t){N[e]=t.bind(null,N[e]||function(){})}function Yc(e){Lf&&Lf(),Lf=e&&e.S()}function oP(e){var t=this,r=e.data,n=aP(r);n.value=r;var i=Qx(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var l=Vo(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""}),d=Vo(function(){return!Array.isArray(l.value)&&!lu(l.value)}),u=Xo(function(){if(this.N=sP,d.value){var f=l.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,l]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}function I$(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=ie(r);return{o:function(a,s){o.value=a,n=s},d:Xo(function(){this.N=sP;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}function aP(e){return Qx(function(){return ie(e)},[])}function k$(){ct(function(){for(var e;e=iP.shift();)nP.call(e)})}function sP(){iP.push(this)===1&&(N.requestAnimationFrame||E$)(k$)}function C$(e,t){let r=so(e);Hn(()=>{r.current=e},[e]),ao(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}function Ie(e,t,r,n,i,o){t||(t={});var a,s,c=t;if("ref"in c)for(s in c={},t)s=="ref"?a=t[s]:c[s]=t[s];var l={type:e,props:c,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--A$,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)c[s]===void 0&&(c[s]=a[s]);return N.vnode&&N.vnode(l),l}function Sr(e,t,r){return(t=F$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F$(e){var t=j$(e,"string");return typeof t=="symbol"?t:t+""}function j$(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 Ir(e,t,r){return(t=H$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function H$(e){var t=$$(e,"string");return typeof t=="symbol"?t:t+""}function $$(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 Qe(e,t,r){return(t=V$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V$(e){var t=W$(e,"string");return typeof t=="symbol"?t:t+""}function W$(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 st(e,t,r){return(t=z$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z$(e){var t=K$(e,"string");return typeof t=="symbol"?t:t+""}function K$(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 Sn(e,t,r){return(t=Y$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y$(e){var t=Q$(e,"string");return typeof t=="symbol"?t:t+""}function Q$(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 Mf(e,t,r){return(t=X$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X$(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)}function rt(e,t,r){return(t=eV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eV(e){var t=tV(e,"string");return typeof t=="symbol"?t:t+""}function tV(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 Ft(e,t,r){return(t=rV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rV(e){var t=nV(e,"string");return typeof t=="symbol"?t:t+""}function nV(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 J3,Vc,Ox,Nx,sx,H3,$3,Dx,V3,W3,cx,z3,K3,lx,Y3,Q3,X3,qx,Z3,o4,a4,ux,s4,dx,c4,Mx,Ux,Fx,px,l4,u4,di,fx,Uf,pe,m4,h4,Jo,Wo,g4,jf,v4,Of,_4,Gf,mx,li,Bf,Jf,Hf,$f,N4,Xe,Wc,z,Gx,am,sm,D4,Bx,q4,L4,Zc,M4,el,mi,Hx,lt,Pe,hi,Z4,e$,t$,vx,r$,n$,i$,o$,a$,c$,l$,u$,zx,yx,Nf,bx,_x,$r,p$,f$,m$,h$,g$,gi,zf,_t,qf,Ix,Ex,Yx,qe,kx,Cx,Ax,xx,Px,Tx,Rx,w$,te,$o,Vr,Yf,Kc,nP,Lf,iP,E$,Ze,A$,x$,Er,Qf,Xf,$c,P$,T$,R$,O$,N$,D$,q$,L$,M$,U$,Zf,pi,ui,G$,B$,J$,em,cP,tm,rm,nm,im,Qc,om,Xc,Bte,lP=C(()=>{"use strict";Dn();is();J3=Object.defineProperty,Vc=Object.getOwnPropertySymbols,Ox=Object.prototype.hasOwnProperty,Nx=Object.prototype.propertyIsEnumerable,sx=(e,t,r)=>t in e?J3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,H3=(e,t)=>{for(var r in t||(t={}))Ox.call(t,r)&&sx(e,r,t[r]);if(Vc)for(var r of Vc(t))Nx.call(t,r)&&sx(e,r,t[r]);return e},$3=(e,t)=>{var r={};for(var n in e)Ox.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Vc)for(var n of Vc(e))t.indexOf(n)<0&&Nx.call(e,n)&&(r[n]=e[n]);return r},Dx=Object.defineProperty,V3=Object.defineProperties,W3=Object.getOwnPropertyDescriptors,cx=Object.getOwnPropertySymbols,z3=Object.prototype.hasOwnProperty,K3=Object.prototype.propertyIsEnumerable,lx=(e,t,r)=>t in e?Dx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Y3=(e,t)=>{for(var r in t||(t={}))z3.call(t,r)&&lx(e,r,t[r]);if(cx)for(var r of cx(t))K3.call(t,r)&&lx(e,r,t[r]);return e},Q3=(e,t)=>V3(e,W3(t)),X3=(e,t)=>{for(var r in t)Dx(e,r,{get:t[r],enumerable:!0})},qx=(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},Z3=(e,t,r)=>new Promise((n,i)=>{var o=c=>{try{s(r.next(c))}catch(l){i(l)}},a=c=>{try{s(r.throw(c))}catch(l){i(l)}},s=c=>c.done?n(c.value):Promise.resolve(c.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}o4=(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))(o4||{});a4={log:Bo("log"),warn:Bo("warn"),info:Bo("info"),error:Bo("error"),debug:Bo("debug")};Object.assign(globalThis,{logger:a4});ux=Symbol.for("Jolibox.canIUseMap"),s4={};globalThis[ux]||(globalThis[ux]=s4);dx=Symbol.for("Jolibox.canIUseMap.native"),c4={};globalThis[dx]||(globalThis[dx]=c4);Mx=(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))(Mx||{}),Ux=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Ux||{}),Fx=(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))(Fx||{}),px=["name","params"],l4=["name","type","location","target","extra","timestamp","userId"],u4=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];f4();di=typeof window=="undefined",fx=()=>!di&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!di&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!di&&navigator.userAgent.includes("Android"),!di&&navigator.userAgent.includes("Mac"),!di&&navigator.userAgent.includes("FB_IAB"),!di&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");Uf=class Ff{constructor(t){this.element=t,this.next=Ff.Undefined,this.prev=Ff.Undefined}};Uf.Undefined=new Uf(void 0);pe=Uf,m4=class{constructor(){this._first=pe.Undefined,this._last=pe.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===pe.Undefined}clear(){let e=this._first;for(;e!==pe.Undefined;){let t=e.next;e.prev=pe.Undefined,e.next=pe.Undefined,e=t}this._first=pe.Undefined,this._last=pe.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new pe(e);if(this._first===pe.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!==pe.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==pe.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==pe.Undefined&&e.next!==pe.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===pe.Undefined&&e.next===pe.Undefined?(this._first=pe.Undefined,this._last=pe.Undefined):e.next===pe.Undefined?(this._last=this._last.prev,this._last.next=pe.Undefined):e.prev===pe.Undefined&&(this._first=this._first.next,this._first.prev=pe.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==pe.Undefined;)yield e.element,e=e.next}},h4=0,Jo=class{constructor(e){this.value=e,this.id=h4++}},Wo=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 Jo&&(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 c=new Jo(e);return this._listeners?this._listeners instanceof Jo?this._listeners=[this._listeners,c]:this._listeners.push(c):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=c,(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 l,d,u,p;if(!this._disposed){if(this._listeners instanceof Jo)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(l=this.options)==null?void 0:l.onDidRemoveLastListener)==null||d.call(l));else if(this._listeners){let f=this._listeners.indexOf(c);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 Jo?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},g4=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 Wo,o=c=>t(...c.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 c of s)t(...c.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 m4,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)}},jf={};X3(jf,{None:()=>v4,filter:()=>b4,once:()=>jx,toPromise:()=>y4});v4=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Of=Symbol.for("Jolibox.hostEmitter"),_4=()=>{let e=new g4;return globalThis[Of]||(globalThis[Of]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Of]};_4();Gf=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Wo,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 w4(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}};Gf=qx([Lx],Gf);mx=class{constructor(){this._onWillExecuteCommand=new Wo,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Wo,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Gf,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=e4(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 Z3(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),jf.toPromise(jf.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{}}};mx=qx([Lx],mx);li=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")},Bf=class{constructor(t){at(this,"context",void 0),at(this,"continueCallback",void 0),at(this,"adIsShowingCallback",void 0),at(this,"isBeforeAdCalled",!1),at(this,"isBeforeRewardCalled",!1),at(this,"isAdDismissedCalled",!1),at(this,"isAdViewedCalled",!1),at(this,"isAfterAdCalled",!1),at(this,"currentProvider",void 0),at(this,"currentClientParams",void 0),at(this,"adsHasResponse",!1),at(this,"videoChecker",window.document.createElement("video")),at(this,"contextInfo",void 0),at(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",H3({userEvent:a},this.paramsToTrack)),fx()&&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=li(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=li(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),fx()&&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=li(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=li(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=li(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,c,l,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:(c=r.breakName)!=null?c:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=li(t);p==null||p(r),(l=this.adIsShowingCallback)==null||l.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 y(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,c,l,d,u,p,f;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(c=(s=this.currentProvider)==null?void 0:s.name)!=null?c:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(d=(l=this.currentProvider)==null?void 0:l.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")})})}};Jf=class{constructor(t){Mc(this,"context",void 0),Mc(this,"adBreakIsShowing",!1),Mc(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),Mc(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()})}};Hf=class{constructor(t){Uc(this,"configs",null),Uc(this,"firstRun",!0),Uc(this,"context",void 0),Uc(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return y(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}};$f=class{constructor(t,r){wr(this,"name","ADSENSE"),wr(this,"context",void 0),wr(this,"contextInfo",void 0),wr(this,"configured",!1),wr(this,"initParams",void 0),wr(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),wr(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=$3(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),wr(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),wr(this,"adUnit",n=>y(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:c,slot:l,adFormat:d,fullWidthResponsive:u,style:p}=n,f;if(!c)throw new Error("targeting element is required");if(typeof c=="string"?f=document.querySelector(c):f=c,!f)throw new Error("targeting element not found");let m=l;if(m||(m=this.initParams.unitId),!m)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",m),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 v=document.createElement("div");v.style.position="absolute",v.style.top="0",v.style.left="0",v.style.width="100%",v.style.height="100%",v.style.display="flex",v.style.justifyContent="center",v.style.alignItems="center",v.style.backgroundColor="rgba(0, 0, 0, 0.5)",v.style.color="white",v.innerHTML="Test Ad",b.style.position="relative",f.appendChild(b),b.appendChild(v)}else f.appendChild(b),new MutationObserver(v=>{v.forEach(w=>{if(w.type==="attributes"&&w.attributeName==="data-ad-status"){let E=b.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:E!=null?E:"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 y(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)}})}};N4=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(O4(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=R4(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}(),Xe="-ms-",Wc="-moz-",z="-webkit-",Gx="comm",am="rule",sm="decl",D4="@import",Bx="@keyframes",q4="@layer",L4=Math.abs,Zc=String.fromCharCode,M4=Object.assign;el=1,mi=1,Hx=0,lt=0,Pe=0,hi="";Z4=function(e,t,r){for(var n=0,i=0;n=i,i=ir(),n===38&&i===12&&(t[r]=1),!Ko(i);)wt();return Yo(e,lt)},e$=function(e,t){var r=-1,n=44;do switch(Ko(n)){case 0:n===38&&ir()===12&&(t[r]=1),e[r]+=Z4(lt-1,t,r);break;case 2:e[r]+=Bc(n);break;case 4:if(n===44){e[++r]=ir()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Zc(n)}while(n=wt());return e},t$=function(e,t){return Vx(e$($x(e),t))},vx=new WeakMap,r$=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&&!vx.get(r))&&!n){vx.set(e,!0);for(var i=[],o=t$(t,i),a=r.props,s=0,c=0;s<o.length;s++)for(var l=0;l<a.length;l++,c++)e.props[c]=i[s]?o[s].replace(/&\f/g,a[l]):a[l]+" "+o[s]}}},n$=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};i$=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case sm:e.return=Wx(e.value,e.length);break;case Bx:return fi([Ho(e,{value:K(e.value,"@","@"+z)})],n);case am:if(e.length)return j4(e.props,function(i){switch(F4(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return fi([Ho(e,{props:[K(i,/:(read-\w+)/,":"+Wc+"$1")]})],n);case"::placeholder":return fi([Ho(e,{props:[K(i,/:(plac\w+)/,":"+z+"input-$1")]}),Ho(e,{props:[K(i,/:(plac\w+)/,":"+Wc+"$1")]}),Ho(e,{props:[K(i,/:(plac\w+)/,Xe+"input-$1")]})],n)}return""})}},o$=[i$],a$=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(m){var g=m.getAttribute("data-emotion");g.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var n=e.stylisPlugins||o$,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(m){for(var g=m.getAttribute("data-emotion").split(" "),b=1;b<g.length;b++)i[g[b]]=!0;a.push(m)});var s,c=[r$,n$];{var l,d=[K4,Q4(function(m){l.insert(m)})],u=Y4(c.concat(n,d)),p=function(m){return fi(W4(m),u)};s=function(m,g,b,v){l=b,p(m?m+"{"+g.styles+"}":g.styles),v&&(f.inserted[g.name]=!0)}}var f={key:t,sheet:new N4({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};c$={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},l$=/[A-Z]|^ms/g,u$=/_EMO_([^_]+?)_([^]*?)_EMO_/g,zx=function(e){return e.charCodeAt(1)===45},yx=function(e){return e!=null&&typeof e!="boolean"},Nf=X4(function(e){return zx(e)?e:e.replace(l$,"-$&").toLowerCase()}),bx=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(u$,function(r,n,i){return $r={name:n,styles:i,next:$r},n})}return c$[e]!==1&&!zx(e)&&typeof t=="number"&&t!==0?t+"px":t};_x=/label:\s*([^\s;{]+)\s*(;|$)/g;p$=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},f$=function(e,t,r){p$(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)}};m$=function(e){var t=a$(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];var l=Df(s,t.registered,void 0);return f$(t,l),t.key+"-"+l.name},n=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];var l=Df(s,t.registered),d="animation-"+l.name;return wx(t,{name:l.name,styles:"@keyframes "+d+"{"+l.styles+"}"}),d},i=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];var l=Df(s,t.registered);wx(t,l)},o=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];return Sx(t.registered,r,h$(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:Kx.bind(null,t.registered),merge:Sx.bind(null,t.registered,r)}},h$=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},g$=m$({key:"css"}),gi=g$.css,Ex=0,Yx=[],qe=N,kx=qe.__b,Cx=qe.__r,Ax=qe.diffed,xx=qe.__c,Px=qe.unmount,Tx=qe.__;qe.__b=function(e){_t=null,kx&&kx(e)},qe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Tx&&Tx(e,t)},qe.__r=function(e){Cx&&Cx(e),zf=0;var t=(_t=e.__c).__H;t&&(qf===_t?(t.__h=[],_t.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Hc),t.__h.forEach(Kf),t.__h=[],zf=0)),qf=_t},qe.diffed=function(e){Ax&&Ax(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Yx.push(t)!==1&&Ix===qe.requestAnimationFrame||((Ix=qe.requestAnimationFrame)||b$)(y$)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),qf=_t=null},qe.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Hc),r.__h=r.__h.filter(function(n){return!n.__||Kf(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],qe.__e(n,r.__v)}}),xx&&xx(e,t)},qe.unmount=function(e){Px&&Px(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Hc(n)}catch(i){t=i}}),r.__H=void 0,t&&qe.__e(t,r.__v))};Rx=typeof requestAnimationFrame=="function";w$=Symbol.for("preact-signals");te=void 0,$o=void 0,Vr=0,Yf=0,Kc=0;He.prototype.brand=w$;He.prototype.h=function(){return!0};He.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)};He.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)}};He.prototype.subscribe=function(e){var t=this;return Xo(function(){var r=t.value,n=te;te=void 0;try{e(r)}finally{te=n}})};He.prototype.valueOf=function(){return this.value};He.prototype.toString=function(){return this.value+""};He.prototype.toJSON=function(){return this.value};He.prototype.peek=function(){var e=te;te=void 0;try{return this.value}finally{te=e}};Object.defineProperty(He.prototype,"value",{get:function(){var e=Xx(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Yf>100)throw new Error("Cycle detected");this.v=e,this.i++,Kc++,Vr++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{rl()}}}});(yi.prototype=new He).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Kc))return!0;if(this.g=Kc,this.f|=1,this.i>0&&!Zx(this))return this.f&=-2,!0;var e=te;try{eP(this),te=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 te=e,tP(this),this.f&=-2,!0};yi.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)}He.prototype.S.call(this,e)};yi.prototype.U=function(e){if(this.t!==void 0&&(He.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)}};yi.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(yi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Xx(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});Qo.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()}};Qo.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,rP(this),eP(this),Vr++;var e=te;return te=this,S$.bind(this,e)};Qo.prototype.N=function(){2&this.f||(this.f|=2,this.o=$o,$o=this)};Qo.prototype.d=function(){this.f|=8,1&this.f||lm(this)};iP=[];Xo(function(){nP=this.N})();oP.displayName="_st";Object.defineProperties(He.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}});bi("__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 He&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});bi("__r",function(e,t){Yc();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return Xo(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Yc(r),e(t)});bi("__e",function(e,t,r,n){Yc(),e(t,r,n)});bi("diffed",function(e,t){Yc();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 c in n){var l=o[c],d=n[c];l===void 0?(l=I$(r,c,d,i),o[c]=l):l.o(d,i)}}}e(t)});bi("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)});bi("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});ht.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};E$=function(e){queueMicrotask(function(){queueMicrotask(e)})};Ze=gi`
|
|
623
623
|
inset: 0;
|
|
624
624
|
clear: none;
|
|
625
625
|
float: none;
|
|
@@ -828,4 +828,4 @@ If multiple caches share the same key they might "fight" for each other's style
|
|
|
828
828
|
cursor: pointer;
|
|
829
829
|
}
|
|
830
830
|
}
|
|
831
|
-
`});function dP(){let e=new Map,t,r;return{registerRewardHandler(i,o){e.set(i,o)},handleReward(i,...o){return y(this,null,function*(){return yield i.reduce((s,c)=>y(this,null,function*(){let l=yield s;if(l===!0)return!0;uP&&console.log(`handleReward ${c}`);let d=e.get(c),u=d?yield d(...o):l;return uP&&console.log(`handleReward ${c} ${u}`),u}),Promise.resolve(!1))})},registerRewardsFetcher(i){return y(this,null,function*(){t=(...o)=>y(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return y(this,null,function*(){r=(...o)=>y(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),{joliCoinUseAndCharge:br,loginGuide:_r}}})})},getRewardsTypes(...i){return y(this,null,function*(){return t?yield t(...i):["ADS"]})},getRewardFrequencyConfig(...i){return y(this,null,function*(){return r?yield r(...i):{joliCoinUseAndCharge:br,loginGuide:_r}})}}}var uP,pP=C(()=>{"use strict";B();Le();uP=S.testMode});var um,dm,nl,fP=C(()=>{"use strict";R();um=class{constructor(t){this.httpClient=t}execute(t,r){return y(this,null,function*(){let n=(r==null?void 0:r.method)||"POST",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){var r,n,i;return{unlockOptions:((r=t.data)==null?void 0:r.unlockOptions)||[],joliCoin:((n=t.extra)==null?void 0:n.joliCoin)||{balance:0,enableAutoDeduct:!1},joliGem:((i=t.extra)==null?void 0:i.joliGem)||{balance:0,enableAutoDeduct:!1}}}mergeData(t,r){return{code:"SUCCESS",message:"success",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin||{balance:0,enableAutoDeduct:!1},joliGem:t.joliGem||{balance:0,enableAutoDeduct:!1}}}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin,joliGem:t.joliGem}}}},dm=class{constructor(t){this.httpClient=t}execute(t,r){return y(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){let r=t.data;return x({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},nl=class{constructor(t){this.unlockOptionsService=new Rt(new um(t),{duration:30*60*1e3,timeout:1e3,keyGenerator:r=>r,consistencyChecker:(r,n)=>r.unlockOptions.length!==n.unlockOptions.length?!1:r.unlockOptions.every((i,o)=>{var s,c;let a=n.unlockOptions[o];return i.type===a.type&&((s=i.joliGemChoice)==null?void 0:s.joliGemQuantity)===((c=a.joliGemChoice)==null?void 0:c.joliGemQuantity)})}),this.globalConfigService=new Rt(new dm(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return y(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return y(this,null,function*(){return yield this.globalConfigService.request("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}refreshUnlockOptions(){return y(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return y(this,null,function*(){return yield this.globalConfigService.forceRequest("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}warmupCache(){return y(this,null,function*(){yield Promise.all([this.unlockOptionsService.warmupCache("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",method:"POST"}),this.globalConfigService.warmupCache("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})])})}clearAllCache(){this.unlockOptionsService.clearCache(),this.globalConfigService.clearCache()}getCacheStats(){return{unlockOptions:this.unlockOptionsService.getCacheStats(),globalConfig:this.globalConfigService.getCacheStats()}}clearExpiredCache(){this.unlockOptionsService.clearExpiredCache(),this.globalConfigService.clearExpiredCache()}}});function fm(e){return pm||(pm=new nl(e)),pm}var iV,oV,aV,pm,mm,hm,gm,vm=C(()=>{"use strict";fP();Le();R();iV=()=>(e,t)=>{let r={SUBSCRIPTION:4,JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return r[t]-r[e]},oV=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],aV=e=>{if(!e.length)return["ADS"];if(e.includes("JOLI_GEM")){if(e.length===1)return["JOLI_GEM_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_GEM_ONLY"]}if(e.includes("JOLI_COIN")){if(e.length===1)return["JOLI_COIN_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_COIN_ONLY"]}return e.sort(iV())},pm=null;mm=e=>{e.registerRewardsFetcher(t=>y(void 0,null,function*(){var i,o,a,s,c;let r=["ADS"],n=fm(t);try{let l=yield n.getUnlockOptions({});if(l.code!=="SUCCESS")return r;q.emit(_c,{options:((i=l.data)==null?void 0:i.unlockOptions)||[],userJoliCoin:((o=l.extra)==null?void 0:o.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((a=l.extra)==null?void 0:a.joliGem)||{balance:0,enableAutoDeduct:!1}});let d=((c=(s=l.data)==null?void 0:s.unlockOptions)==null?void 0:c.map(u=>u.type))||Array.from(r);return aV(d)}catch(l){return console.error("getRewardOptions error (cached):",l),r}}))},hm=e=>{e.registerRewardFrequencyConfigFetcher(t=>y(void 0,null,function*(){var n,i,o,a;let r=fm(t);try{let s=yield r.getGlobalConfig();return q.emit(Ut,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||br,loginGuide:((i=s.data)==null?void 0:i.loginGuide)||_r}),s.data&&he.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((o=s.data)==null?void 0:o.joliCoinUseAndCharge)||br,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||_r}}catch(s){return console.error("getGlobalConfig error (cached):",s),q.emit(Ut,{joliCoinUseAndCharge:br,loginGuide:_r}),he.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:br,loginGuide:_r,supportedHostMethods:oV}}),{joliCoinUseAndCharge:br,loginGuide:_r}}}))},gm=e=>y(void 0,null,function*(){yield fm(e).warmupCache(),console.log("Reward cache warmed up")})});var ym=C(()=>{"use strict";vm();vm()});var mP,hP=C(()=>{"use strict";mP=e=>t=>y(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",t),yield e.adBreak(t)}catch(r){console.error("-----createAdsRewardHandler error-----",r)}return!0})});var Te,_i,St=C(()=>{"use strict";Le();tr();Le();Te=Me(q,_c),_i=(e,t)=>{var n;let r=(n=e.options)==null?void 0:n.some(i=>i.type==="SUBSCRIPTION");return console.log("typeof extraCheck",typeof t,t==null?void 0:t()),r&&(!t||(t==null?void 0:t()))}});var il,bm=C(()=>{"use strict";il={JOLI_COIN:{balanceEndpoint:"/api/joli-coin/balance",balanceDetailEndpoint:"/api/joli-coin/balance-detail",unlockEndpoint:"/api/joli-coin/unlock",unlockType:"JOLI_COIN"},GEM:{balanceEndpoint:"/api/joli-gem/balance",balanceDetailEndpoint:"/api/joli-gem/balance-detail",unlockEndpoint:"/api/joli-gem/unlock",unlockType:"GEM"}}});var ut,Wr=C(()=>{"use strict";R();ut=Y()});function gP(e){return _m||(_m=new Sm(e)),_m}var wm,Sm,_m,Im,In,wi=C(()=>{"use strict";R();wm=class{constructor(t){this.httpClient=t}execute(t,r){return y(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Sm=class{constructor(t){this.balanceService=new Rt(new wm(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getBalance(t="JOLI_COIN"){return y(this,null,function*(){return(yield this.balanceService.request("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}refreshBalance(t="JOLI_COIN"){return y(this,null,function*(){return(yield this.balanceService.forceRequest("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}warmupBalance(t="JOLI_COIN"){return y(this,null,function*(){yield this.balanceService.warmupCache("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})})}clearBalanceCache(){this.balanceService.clearCache()}getBalanceCacheStats(){return this.balanceService.getCacheStats()}clearExpiredCache(){this.balanceService.clearExpiredCache()}},_m=null;Im=(e,t="JOLI_COIN")=>y(void 0,null,function*(){return yield gP(e).getBalance(t)}),In=(e,t="JOLI_COIN")=>y(void 0,null,function*(){let n=yield gP(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n})});var vP=C(()=>{"use strict";wi()});function Am(e){return Em||(Em=new Cm(e)),Em}var km,Cm,Em,xm,En,ol,Si=C(()=>{"use strict";R();km=class{constructor(t){this.httpClient=t}execute(t,r){return y(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Cm=class{constructor(t){this.gemBalanceService=new Rt(new km(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getGemBalance(t="GEM"){return y(this,null,function*(){return(yield this.gemBalanceService.request("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}refreshGemBalance(t="GEM"){return y(this,null,function*(){return(yield this.gemBalanceService.forceRequest("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}warmupGemBalance(t="GEM"){return y(this,null,function*(){yield this.gemBalanceService.warmupCache("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})})}clearGemBalanceCache(){this.gemBalanceService.clearCache()}getGemBalanceCacheStats(){return this.gemBalanceService.getCacheStats()}clearExpiredCache(){this.gemBalanceService.clearExpiredCache()}},Em=null;xm=(e,t="GEM")=>y(void 0,null,function*(){return yield Am(e).getGemBalance(t)}),En=(e,t="GEM")=>y(void 0,null,function*(){let n=yield Am(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n}),ol=(e,t="GEM")=>y(void 0,null,function*(){yield Am(e).warmupGemBalance(t),console.log(`Gem balance cache warmed up for type: ${t}`)})});var yP=C(()=>{"use strict";Si()});var Pt,kn=C(()=>{"use strict";vP();yP();Pt={JOLI_COIN:{fetchBalance:Im,getQuantity:e=>{var t,r,n;return(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(i=>i.type==="JOLI_COIN"))==null?void 0:r.joliCoinChoices[0].joliCoinQuantity)!=null?n:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userJoliCoin)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userJoliCoin",isEnough:(e,t)=>{var r,n;return(n=(r=e==null?void 0:e.options)==null?void 0:r.some(i=>i.type==="JOLI_COIN"&&i.joliCoinChoices.some(o=>{var a;return o.joliCoinQuantity<=((a=t==null?void 0:t.balance)!=null?a:0)})))!=null?n:!1}},JOLI_GEM:{fetchBalance:xm,getQuantity:e=>{var t,r,n,i;return(i=(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(o=>o.type==="JOLI_GEM"))==null?void 0:r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userGem)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userGem",isEnough:(e,t)=>{var n,i,o;let r=e==null?void 0:e.options.find(a=>a.type==="JOLI_GEM");return r?((i=(n=r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0)<=((o=t==null?void 0:t.balance)!=null?o:0):!1}}}});var Zo,kr,Pm=C(()=>{"use strict";Wr();St();tr();Le();Le();kn();Zo=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;ut.registerCommand(`Rewards.${e}.useJolicoin`,()=>y(void 0,null,function*(){let i=yield Te.getData(),o=Pt[t],a=o.getCurrentUser(i),s=o.getQuantity(i),c=!!(a!=null&&a.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",i,c,s),(yield n({enableAutoDeduct:c,userCurrency:a,quantity:s,currency:t}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},kr=(e,t)=>r=>y(void 0,null,function*(){let n=Me(q,hn);return q.emit(Sc,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult})});var ea,Cr,bP=C(()=>{"use strict";Wr();St();Le();tr();Le();kn();Si();wi();ea=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;ut.registerCommand(`Rewards.${e}.usePayment`,()=>y(void 0,null,function*(){var p;let o=yield Te.getData(),a=Pt[t],s=yield a.fetchBalance(n),c=a.getQuantity(o),l=a.getCurrentUser(o),d=a.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,l.enableAutoDeduct),u=a.getUpdateKey();if(Te.updateData({[u]:d}),console.log("-----unlockOptions payment-----",o,d,c,t),!a.isEnough(o,d)){let f=yield i({userCurrency:d,currencyQuantity:c,currency:t});return t==="JOLI_GEM"?En(n):In(n),{result:f==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},Cr=(e,t)=>r=>y(void 0,null,function*(){let n=Me(q,Mt);return q.emit(wc,e,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).paymentResult})});var Tm,Ar,_P=C(()=>{"use strict";B();Wr();tr();Le();Le();R();St();kn();Tm=(e,t,r)=>{let{showUnloginModal:n,httpClient:i}=r;ut.registerCommand(`Rewards.${e}.useUnloginModal`,()=>y(void 0,null,function*(){var s,c,l;let o=(s=S.hostUserInfo)==null?void 0:s.isLogin,a=yield Te.getData();if(console.log("-----isLogin-----",!!o),!o){let d=yield n(t);if(console.log("-----unloginModalResult-----",d),d.result=="FAILED"||d.result=="CANCEL")return{result:"FAILED"};let{isFirstLogin:u,claimedRewardValue:p}=(c=d.rewards)!=null?c:{};if(d.result=="SUCCESS"){u&&p&&(yield hh(3e3));let f=Pt[t],m=yield f.fetchBalance(i),g=f.getQuantity(a),b=f.getCurrentUser(a),v=f.createUpdatedUser((l=m==null?void 0:m.balance)!=null?l:0,b.enableAutoDeduct),w=f.getUpdateKey();if(Te.updateData({[w]:v}),v.balance>=g)return{result:"SUCCESS"}}}return{result:"CONTINUE"}}))},Ar=(e,t)=>r=>y(void 0,null,function*(){let n=Me(q,yr);return q.emit(Ic,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()})});var Cn=C(()=>{"use strict";Pm();bP();_P()});var cV,al,Rm=C(()=>{"use strict";B();R();bm();Cn();Wr();wi();kn();St();cV=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:o,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:s,showUnloginModal:c,hasSubscription:l}})=>{ea(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:a}),Zo(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let d=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return u=>y(void 0,null,function*(){var p,f,m,g;try{let b=yield o.getData();if(_i(b,l)){let A=Pt.JOLI_COIN,P=yield A.fetchBalance(t),T=A.getCurrentUser(b),k=A.createUpdatedUser((p=P==null?void 0:P.balance)!=null?p:0,T.enableAutoDeduct);if(!A.isEnough(b,k))return i==null||i(u),!1}else{let A=!0;for(let P of d){let T=yield ut.executeCommand(P);if(A=A&&T.result!=="FAILED",T.result!=="CONTINUE")break}if(!A)return i==null||i(u),!1}let w=il[r],E=yield t.post(w.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${Tn()}-${S.mpType}-${Date.now()}`,gameInfo:{gameId:S.mpId}}});if(console.log("-----unlockWithCurrency request result-----",E),E.code=="SUCCESS"){try{(m=u.adBreakDone)==null||m.call(u,{breakType:u.type,breakName:"name"in u&&(f=u.name)!=null?f:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in u&&((g=u.adViewed)==null||g.call(u)),In(t)}catch(A){console.error("-----unlockWithJolicoin adBreakDone error-----",A)}return n==null||n({quantity:E.data.quantity,balance:E.data.balance}),!0}return i==null||i(u),!1}catch(b){if(console.info("JolicoinRewardHandler error:",b),b instanceof Error&&b.message=="CANCEL")throw b;return i==null||i(u),!1}finally{o.clearCache()}})},al=(e,t,r)=>cV(e,t,"JOLI_COIN",r)});var wP,SP=C(()=>{"use strict";St();Rm();Cn();wP=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=kr("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),a=Cr("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Ar("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return al("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Te,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})}});var IP,EP=C(()=>{"use strict";Rm();St();Cn();IP=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=l=>{var d;r==null||r(),(d=l.adBreakDone)==null||d.call(l,{breakType:l.type,breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},o=kr("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),a=Cr("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Ar("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return al("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Te,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})}});var sl,Om=C(()=>{"use strict";B();R();bm();Cn();Pm();Wr();Si();kn();St();sl=(e,t,{handlers:{handleUnlockSuccess:r,handleUnlockFailed:n,unlockOptionsHandler:i,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:a,showUnloginModal:s,hasSubscription:c}})=>{Tm(e,"JOLI_GEM",{httpClient:t,showUnloginModal:s}),ea(e,"JOLI_GEM",{httpClient:t,initiateAndAwaitPayment:o}),Zo(e,"JOLI_GEM",{showUnlockWithCurrencyModal:a});let l=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return d=>y(void 0,null,function*(){var u,p,f,m;try{let g=yield i.getData(),b=_i(g,c);if(console.log("[GemHandler] supportSubscription",b,g),b){let E=Pt.JOLI_GEM,A=yield E.fetchBalance(t),P=E.getCurrentUser(g),T=E.createUpdatedUser((u=A==null?void 0:A.balance)!=null?u:0,P.enableAutoDeduct);if(!E.isEnough(g,T))return n==null||n(d),!1}else{let E=!0;for(let A of l){let P=yield ut.executeCommand(A);if(console.log("[GemHandler] command result",P,A),E=E&&P.result!=="FAILED",P.result!=="CONTINUE")break}if(!E)return n==null||n(d),!1}let v=il.GEM,w=yield t.post(v.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${Tn()}-${S.mpType}-${Date.now()}`,gameInfo:{gameId:S.mpId}}});if(console.log("-----unlockWithGem request result-----",w),w.code=="SUCCESS"){try{(f=d.adBreakDone)==null||f.call(d,{breakType:d.type,breakName:"name"in d&&(p=d.name)!=null?p:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in d&&((m=d.adViewed)==null||m.call(d)),En(t)}catch(E){console.error("-----unlockWithGem adBreakDone error-----",E)}return r==null||r({quantity:w.data.quantity,balance:w.data.balance}),!0}return n==null||n(d),!1}catch(g){if(console.info("GemRewardHandler error:",g),g instanceof Error&&g.message=="CANCEL")throw g;return n==null||n(d),!1}finally{i.clearCache()}})}});var kP,CP=C(()=>{"use strict";St();Om();Cn();kP=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=kr("ADS-JOLI_GEM",{confirmButtonText:"joligem.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),a=Cr("ADS-JOLI_GEM",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Ar("ADS-JOLI_GEM",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return sl("ADS-JOLI_GEM",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Te,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})}});var AP,xP=C(()=>{"use strict";Om();St();Cn();AP=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=l=>{var d;r==null||r(),(d=l.adBreakDone)==null||d.call(l,{breakType:l.type,breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},o=kr("JOLI_GEM",{confirmButtonText:"joligem.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),a=Cr("JOLI_GEM",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Ar("JOLI_GEM",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return sl("JOLI_GEM",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Te,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})}});var PP,TP,Nm=C(()=>{"use strict";kn();Wr();St();tr();Le();Le();PP=e=>{let{showSubscriptionModal:t}=e;ut.registerCommand("Rewards.subscription",()=>y(void 0,null,function*(){var s,c;let r=yield Te.getData(),n=(c=(s=r==null?void 0:r.options)==null?void 0:s.find(l=>l.type==="JOLI_GEM"))==null?void 0:c.type,i=Pt[n?"JOLI_GEM":"JOLI_COIN"],o=i.getCurrentUser(r);return i.isEnough(r,o)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},TP=e=>()=>y(void 0,null,function*(){let t=Me(q,gn);return q.emit(Ec,e),(yield t.getFreshData()).result})});var RP=C(()=>{"use strict";Nm()});var OP,NP=C(()=>{"use strict";Wr();RP();B();St();wi();Si();OP=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:o,hasSubscription:a}})=>{PP({showSubscriptionModal:o});let s=["Rewards.subscription"];return c=>y(void 0,null,function*(){var l,d,u,p,f,m;try{let g=yield i.getData();if(!_i(g,a))return!1;let v=!0;for(let w of s){let E=yield ut.executeCommand(w);if(v=v&&E.result!=="FAILED",E.result!=="CONTINUE")break}if(In(t),En(t),console.log("-----unlockWithSubscription result-----",v),v){try{(d=c.adBreakDone)==null||d.call(c,{breakType:c.type,breakName:"name"in c&&(l=c.name)!=null?l:"",breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in c&&((u=c.adViewed)==null||u.call(c)),(m=(f=S).onEnvConfigChanged)==null||m.call(f,{hostUserInfo:U(x({},(p=S.hostUserInfo)!=null?p:{isLogin:!1}),{isSubUser:!0})})}catch(w){console.error("-----unlockWithSubscription adBreakDone error-----",w)}return r==null||r(),!0}return n==null||n(c),!1}catch(g){if(console.info("SubscriptionRewardHandler error:",g),g instanceof Error&&g.message=="CANCEL")throw g;return n==null||n(c),!1}finally{}})}});var DP,qP=C(()=>{"use strict";St();NP();Nm();DP=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=TP("SUBSCRIPTION");return OP("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:Te,showSubscriptionModal:o,hasSubscription:n}})}});var Tt,LP=C(()=>{"use strict";pP();ym();hP();SP();EP();CP();xP();qP();wi();Si();Tt=dP();mm(Tt);hm(Tt)});var cl,lV,or,uV,ta,dV,MP,UP,pV,fV,Dm,mV,hV,gV,FP=C(()=>{"use strict";R();Ve();er();ax();lP();kt();B();pt();ce();LP();ou();ym();cl=Y(),lV=()=>{let{data:e}=F("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},or={get:(e,t)=>Z(e,x({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data),post:(e,t)=>Z(e,x({method:"POST",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data)},uV={httpClient:or,checkNetwork:lV,track:j,eventEmitter:Fa,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:30}),handleLinkClicked:e=>{window.open(e,"_blank")},getContextInfo:()=>{var e,t,r,n,i,o,a,s,c;return{hostAppId:(t=(e=S.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(r=S.deviceInfo.did)!=null?r:"",adId:(n=S.deviceInfo.adId)!=null?n:"",sessionId:(i=S.sessionId)!=null?i:"",userId:(a=(o=S.hostUserInfo)==null?void 0:o.uid)!=null?a:"",objectType:"GAME",objectId:S.mpId,testAdsMode:S.testAdsMode,channel:(s=S.joliSource)!=null?s:"",deviceBrand:S.deviceInfo.brand,deviceModel:S.deviceInfo.model,osType:S.platform==="android"?"ANDROID":S.platform==="ios"?"IOS":"PC",runtimeType:"APP",platform:1e3,joliSource:(c=S.joliSource)!=null?c:""}}},ta=new Xc(uV);Tt.getRewardFrequencyConfig(or).then(e=>{console.log("getRewardFrequencyConfig",e)});Tt.registerRewardHandler("ADS",mP(ta));Tt.registerRewardHandler("JOLI_COIN",wP(or,{onUnlockSuccess:e=>{MP(e),j("jolicoin_unlock_success",{quantity:e.quantity})},onUnlockFailed:()=>{console.log("onUnlockFailed")},hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));Tt.registerRewardHandler("JOLI_COIN_ONLY",IP(or,{onUnlockSuccess:e=>{MP(e),j("jolicoin_unlock_success",{quantity:e.quantity,isOnly:!0})},onUnlockFailed:()=>{console.log("onUnlockFailed")},hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));Tt.registerRewardHandler("JOLI_GEM",kP(or,{onUnlockSuccess:e=>{UP(e),j("gem_unlock_success",{quantity:e.quantity})},hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));Tt.registerRewardHandler("JOLI_GEM_ONLY",AP(or,{onUnlockSuccess:e=>{UP(e),j("gem_unlock_success",{quantity:e.quantity,isOnly:!0})},hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));dV=()=>{j("subscription_unlock_success",{})};Tt.registerRewardHandler("SUBSCRIPTION",DP(or,{onSubSuccess:dV.bind(void 0),hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));MP=e=>{let{quantity:t}=e,r=`{slot-coin} ${t} {slot-i18n-jolicoin.coinUsed}`;Jr(r,{customStyle:{mark:{marginRight:"8px"},base:{with:"auto"}},i18nParams:{text:"Jolicoin Used"}})};gm(or);ol(or);UP=e=>{let{quantity:t}=e,r=`{slot-correct} ${t*-1} {slot-gem}`;Jr(r,{customStyle:{mark:{marginRight:"8px"},base:{"font-size":"25px","font-weight":"700","line-height":"18px"},span:{width:"auto",minWidth:"fit-content",maxWidth:"60px",textAlign:"center",padding:"0 2px",lineHeight:"25px"},gem:{transform:"translateY(-2px)",width:"28px",height:"28px"}}})},pV=H("adInit",{implement:e=>{ta.init(e)}}),fV=H("adConfig",{implement:e=>{ta.adConfig(e)}}),Dm=!1,mV=e=>{var t,r,n;(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:"name"in e&&(t=e.name)!=null?t:"",breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in e&&((n=e.adViewed)==null||n.call(e))},hV=H("adBreak",{implement:e=>{var r;if((r=S.hostUserInfo)==null?void 0:r.isSubUser){mV(e);return}if(e.type==="reward"){if(Dm)return;Dm=!0,Tt.getRewardsTypes(or).then(n=>{Tt.handleReward(n,e).catch(i=>{var o;console.info("handleReward failed in native",i),(o=e.adBreakDone)==null||o.call(e,{breakType:e.type,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}).finally(()=>{Dm=!1})})}else ta.adBreak(e)}}),gV=H("adUnit",{implement:e=>{ta.adUnit(e)}});cl.registerCommand("AdsSDK.init",pV);cl.registerCommand("AdsSDK.adConfig",fV);cl.registerCommand("AdsSDK.adBreak",hV);cl.registerCommand("AdsSDK.adUnit",gV);M("AdsSDK.init",{version:"1.0.0"});M("AdsSDK.adConfig",{version:"1.0.0"});M("AdsSDK.adBreak",{version:"1.0.0"});M("AdsSDK.adUnit",{version:"1.0.0"})});var ra,vV,yV,bV,_V,wV,jP=C(()=>{"use strict";R();ce();Ve();B();ra=Y(),vV=H("openSchemaSync",{paramsSchema:I.tuple(I.string()),implement:e=>{let t=e;e.match(/^https?:\/\//)||(t=`https://${S.mpId}.app.jolibox.com${e.startsWith("/")?"":"/"}${e}`);let r=F("openSchemaSync",{schema:t});if(r.errNo!==0)throw new Gt(r.errMsg,r.errNo)}}),yV=H("openPageSync",{paramsSchema:I.tuple(I.string()),implement:e=>{let{errNo:t,errMsg:r,data:n}=F("openPageSync",{url:e});if(t!==0||!n)throw new Gt(r,t);return{webviewId:n.webviewId}}}),bV=H("closePageSync",{paramsSchema:I.tuple(I.number()),implement:e=>{let{errNo:t,errMsg:r}=F("closePageSync",{webviewId:e});if(t!==0)throw new Gt(r,t)}}),_V=H("interceptSystemExitSync",{paramsSchema:I.tuple(I.boolean()),implement:e=>{he.emit("onInterceptSystemExit",{intercept:e}),he.emit("onInterceptBackPress",{intercept:e})}}),wV=H("navigateToNativePage",{paramsSchema:I.tuple(I.enum("openHistory","openDiscover","openDiscover","openGame","openDrama","openTopup","openFeed","openRewards"),I.object()),implement:(e,t)=>{F("callHostMethodAsync",{method:e,params:x({},t)})}});ra.registerCommand("RouterSDK.openSchema",vV);ra.registerCommand("RouterSDK.openPage",yV);ra.registerCommand("RouterSDK.closePage",bV);ra.registerCommand("RouterSDK.interceptSystemExit",_V);ra.registerCommand("RouterSDK.navigateToNativePage",wV);M("router.openSchema",{version:"1.1.10"});M("router.openPage",{version:"1.1.10"});M("router.closePage",{version:"1.1.10"});M("router.interceptSystemExit",{version:"1.1.18"});M("router.navigateToNativePage",{version:"1.1.19"})});function EV(e){Al("cpLoadProgressEvent",{progress:e},S.webviewId,!0)}var BP,SV,ll,qm,GP,IV,kV,JP=C(()=>{"use strict";R();Ve();ce();B();kt();BP=Y(),SV=H("onLoadFinished",{implement:()=>{Al("cpLoadFinishEvent",{},S.webviewId,!0),j("loadFinished",{duration:performance.now()})}}),ll=null,qm=!1,GP=0,IV=200;kV=H("onLoadProgress",{paramsSchema:I.tuple(I.number()),implement:e=>{ll=e,qm||(qm=!0,requestAnimationFrame(function t(){let r=Date.now();r-GP>=IV?(ll!==null&&(EV(ll),GP=r,ll=null),qm=!1):requestAnimationFrame(t)}))}});BP.registerCommand("RuntimeSDK.loadFinishedEvent",SV);BP.registerCommand("RuntimeSDK.loadProgressEvent",kV)});var CV,AV,xV,HP=C(()=>{"use strict";R();Ve();B();CV=Y(),AV="isNativeSupport",xV=H(AV,{paramsSchema:I.tuple(I.object({version:I.string()})),implement:e=>{let t=S.sdkInfo.nativeSDKVersionCode,{version:r}=e;return r?{code:"SUCCESS",data:kh(iu(t!=null?t:0),r,">=")}:{code:"FAILURE",message:"[Jolibox SDK] api or versionCode is required",data:!1}}});CV.registerCommand("API.isNativeSupport",xV);M("isNativeSupport",{version:"1.1.46"})});var VP=h(Lm=>{"use strict";Ve();ce();R();R();B();var $P=Y(),PV=ne("callHostMethod",{paramsSchema:I.tuple(I.object({method:I.string(),params:I.object().optional().default({})})),implement:r=>y(Lm,[r],function*({method:e,params:t}){if(!ft(e))throw new Gt("Method not supported",10001);let{errNo:n,errMsg:i,data:o}=yield F("callHostMethodAsync",{method:e,params:x({},t)});if(n!==0)throw new Gt(i,n);let c=o,{callHostMethodId:a}=c,s=$e(c,["callHostMethodId"]);return x({},s)})});$P.registerCommand("API.callHostMethod",PV);M("callHostMethod",{version:"1.1.49"});var TV=ne("userTrackAsync",{paramsSchema:I.tuple(I.object({event:I.string(),eventType:I.number(),params:I.object().optional().default({})})),implement:n=>y(Lm,[n],function*({event:e,eventType:t,params:r}){if(!ft("userTrackAsync"))throw new Gt("Method not supported",10001);let{errNo:i,errMsg:o}=yield F("trackAsync",{event:e,eventType:t,data:x({},r),webviewId:S.webviewId});if(i!==0)throw new Gt(o,i)})});$P.registerCommand("API.track",TV);M("track",{version:"1.1.53"})});var zP=h(Ii=>{"use strict";R();Ve();Sf();Xr();Rf();var na=Y(),WP=Tc(),RV=ne("purchaseGem",{paramsSchema:I.tuple(I.object({productId:I.string()})),implement:e=>y(Ii,null,function*(){var r,n;let t=yield WP.purchase(e.productId);if(t.code!=="SUCCESS")throw Et({code:-1,msg:"[JoliboxSDK]: purchase gem failed: "+t.message});return{totalAmount:(n=(r=t.data)==null?void 0:r.totalAmount)!=null?n:""}})}),OV=ne("getGemProducts",{paramsSchema:I.tuple(),implement:()=>y(Ii,null,function*(){var t,r;let e=(r=(t=yield WP.getProductsInfo())==null?void 0:t.paymentChoices)!=null?r:[];return console.info("choices",e),{products:e.map(n=>{var i;return{productId:n.productId,totalAmountStr:(i=n.totalAmountStr)!=null?i:"",quantity:n.quantity}})}})}),NV=ne("getSubscriptionPlans",{paramsSchema:I.tuple(),implement:()=>y(Ii,null,function*(){let e=yield wn.getSubInfo();if(console.log("[PaymentAPI] getSubscriptionPlans result",e),!e)throw Et({code:-1,msg:"[JoliboxSDK]: get subscription plans failed"});return{plans:e}})}),DV=ne("flushSubInfoCache",{paramsSchema:I.tuple(),implement:()=>y(Ii,null,function*(){yield wn.updateAllNativePriceCache()})}),qV=ne("subscribe",{paramsSchema:I.tuple(I.object({productId:I.string()})),implement:e=>y(Ii,null,function*(){var a;let t=yield wn.getTierByProductId(e.productId);if(!t)throw Et({code:-1,msg:"[JoliboxSDK]: product not found"});let{basePlanId:r,appStoreProductId:n,nativeProductId:i}=t,o=yield wn.subscribe({basePlanId:r,nativeProductId:i,appStoreProductId:n});return{result:o.result,subPlanId:o.subPlanId,errMsg:(a=o.message)!=null?a:""}})});na.registerCommand("PaymentSDK.purchaseGem",RV);na.registerCommand("PaymentSDK.getGemProducts",OV);na.registerCommand("PaymentSDK.getSubscriptionPlans",NV);na.registerCommand("PaymentSDK.subscribe",qV);na.registerCommand("PaymentSDK.flushSubInfoCache",DV);M("payment.purchaseGem",{version:"1.2.3"});M("payment.getGemProducts",{version:"1.2.3"});M("payment.getSubscriptionPlans",{version:"1.2.5"});M("payment.subscribe",{version:"1.2.5"});M("payment.flushSubInfoCache",{version:"1.2.5"})});var LV={};var tae,oae,dae,pae,KP=C(()=>{"use strict";nA();tae=re(iA());dA();Ui();pA();oae=re(fA());yc();FP();jP();JP();HP();dae=re(VP()),pae=re(zP())});var YP=Symbol.for("JOLIBOX_IMPLEMENT_INIT");if(window[YP])throw console.info("Jolibox Implement Already Initialized"),new Error("Jolibox Implement Already Initialized");window[YP]=!0;y(void 0,null,function*(){let[{config:e}]=yield Promise.all([Promise.resolve().then(()=>(tA(),eA)),Promise.resolve().then(()=>(KP(),LV)),Promise.resolve().then(()=>(kt(),dg))]);e()});
|
|
831
|
+
`});function dP(){let e=new Map,t,r;return{registerRewardHandler(i,o){e.set(i,o)},handleReward(i,...o){return y(this,null,function*(){return yield i.reduce((s,c)=>y(this,null,function*(){let l=yield s;if(l===!0)return!0;uP&&console.log(`handleReward ${c}`);let d=e.get(c),u=d?yield d(...o):l;return uP&&console.log(`handleReward ${c} ${u}`),u}),Promise.resolve(!1))})},registerRewardsFetcher(i){return y(this,null,function*(){t=(...o)=>y(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return y(this,null,function*(){r=(...o)=>y(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),{joliCoinUseAndCharge:br,loginGuide:_r}}})})},getRewardsTypes(...i){return y(this,null,function*(){return t?yield t(...i):["ADS"]})},getRewardFrequencyConfig(...i){return y(this,null,function*(){return r?yield r(...i):{joliCoinUseAndCharge:br,loginGuide:_r}})}}}var uP,pP=C(()=>{"use strict";B();Le();uP=S.testMode});var um,dm,nl,fP=C(()=>{"use strict";R();um=class{constructor(t){this.httpClient=t}execute(t,r){return y(this,null,function*(){let n=(r==null?void 0:r.method)||"POST",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){var r,n,i;return{unlockOptions:((r=t.data)==null?void 0:r.unlockOptions)||[],joliCoin:((n=t.extra)==null?void 0:n.joliCoin)||{balance:0,enableAutoDeduct:!1},joliGem:((i=t.extra)==null?void 0:i.joliGem)||{balance:0,enableAutoDeduct:!1}}}mergeData(t,r){return{code:"SUCCESS",message:"success",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin||{balance:0,enableAutoDeduct:!1},joliGem:t.joliGem||{balance:0,enableAutoDeduct:!1}}}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin,joliGem:t.joliGem}}}},dm=class{constructor(t){this.httpClient=t}execute(t,r){return y(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){let r=t.data;return x({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},nl=class{constructor(t){this.unlockOptionsService=new Rt(new um(t),{duration:30*60*1e3,timeout:1e3,keyGenerator:r=>r,consistencyChecker:(r,n)=>r.unlockOptions.length!==n.unlockOptions.length?!1:r.unlockOptions.every((i,o)=>{var s,c;let a=n.unlockOptions[o];return i.type===a.type&&((s=i.joliGemChoice)==null?void 0:s.joliGemQuantity)===((c=a.joliGemChoice)==null?void 0:c.joliGemQuantity)})}),this.globalConfigService=new Rt(new dm(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return y(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return y(this,null,function*(){return yield this.globalConfigService.request("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}refreshUnlockOptions(){return y(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return y(this,null,function*(){return yield this.globalConfigService.forceRequest("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}warmupCache(){return y(this,null,function*(){yield Promise.all([this.unlockOptionsService.warmupCache("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",method:"POST"}),this.globalConfigService.warmupCache("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})])})}clearAllCache(){this.unlockOptionsService.clearCache(),this.globalConfigService.clearCache()}getCacheStats(){return{unlockOptions:this.unlockOptionsService.getCacheStats(),globalConfig:this.globalConfigService.getCacheStats()}}clearExpiredCache(){this.unlockOptionsService.clearExpiredCache(),this.globalConfigService.clearExpiredCache()}}});function fm(e){return pm||(pm=new nl(e)),pm}var iV,oV,aV,pm,mm,hm,gm,vm=C(()=>{"use strict";fP();Le();R();iV=()=>(e,t)=>{let r={SUBSCRIPTION:4,JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return r[t]-r[e]},oV=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],aV=e=>{if(!e.length)return["ADS"];if(e.includes("JOLI_GEM")){if(e.length===1)return["JOLI_GEM_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_GEM_ONLY"]}if(e.includes("JOLI_COIN")){if(e.length===1)return["JOLI_COIN_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_COIN_ONLY"]}return e.sort(iV())},pm=null;mm=e=>{e.registerRewardsFetcher(t=>y(void 0,null,function*(){var i,o,a,s,c;let r=["ADS"],n=fm(t);try{let l=yield n.getUnlockOptions({});if(l.code!=="SUCCESS")return r;q.emit(_c,{options:((i=l.data)==null?void 0:i.unlockOptions)||[],userJoliCoin:((o=l.extra)==null?void 0:o.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((a=l.extra)==null?void 0:a.joliGem)||{balance:0,enableAutoDeduct:!1}});let d=((c=(s=l.data)==null?void 0:s.unlockOptions)==null?void 0:c.map(u=>u.type))||Array.from(r);return aV(d)}catch(l){return console.error("getRewardOptions error (cached):",l),r}}))},hm=e=>{e.registerRewardFrequencyConfigFetcher(t=>y(void 0,null,function*(){var n,i,o,a;let r=fm(t);try{let s=yield r.getGlobalConfig();return q.emit(Ut,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||br,loginGuide:((i=s.data)==null?void 0:i.loginGuide)||_r}),s.data&&he.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((o=s.data)==null?void 0:o.joliCoinUseAndCharge)||br,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||_r}}catch(s){return console.error("getGlobalConfig error (cached):",s),q.emit(Ut,{joliCoinUseAndCharge:br,loginGuide:_r}),he.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:br,loginGuide:_r,supportedHostMethods:oV}}),{joliCoinUseAndCharge:br,loginGuide:_r}}}))},gm=e=>y(void 0,null,function*(){yield fm(e).warmupCache(),console.log("Reward cache warmed up")})});var ym=C(()=>{"use strict";vm();vm()});var mP,hP=C(()=>{"use strict";mP=e=>t=>y(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",t),yield e.adBreak(t)}catch(r){console.error("-----createAdsRewardHandler error-----",r)}return!0})});var Te,_i,St=C(()=>{"use strict";Le();tr();Le();Te=Me(q,_c),_i=(e,t)=>{var n;let r=(n=e.options)==null?void 0:n.some(i=>i.type==="SUBSCRIPTION");return console.log("typeof extraCheck",typeof t,t==null?void 0:t()),r&&(!t||(t==null?void 0:t()))}});var il,bm=C(()=>{"use strict";il={JOLI_COIN:{balanceEndpoint:"/api/joli-coin/balance",balanceDetailEndpoint:"/api/joli-coin/balance-detail",unlockEndpoint:"/api/joli-coin/unlock",unlockType:"JOLI_COIN"},GEM:{balanceEndpoint:"/api/joli-gem/balance",balanceDetailEndpoint:"/api/joli-gem/balance-detail",unlockEndpoint:"/api/joli-gem/unlock",unlockType:"GEM"}}});var ut,Wr=C(()=>{"use strict";R();ut=Y()});function gP(e){return _m||(_m=new Sm(e)),_m}var wm,Sm,_m,Im,In,wi=C(()=>{"use strict";R();wm=class{constructor(t){this.httpClient=t}execute(t,r){return y(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Sm=class{constructor(t){this.balanceService=new Rt(new wm(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getBalance(t="JOLI_COIN"){return y(this,null,function*(){return(yield this.balanceService.request("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}refreshBalance(t="JOLI_COIN"){return y(this,null,function*(){return(yield this.balanceService.forceRequest("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}warmupBalance(t="JOLI_COIN"){return y(this,null,function*(){yield this.balanceService.warmupCache("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})})}clearBalanceCache(){this.balanceService.clearCache()}getBalanceCacheStats(){return this.balanceService.getCacheStats()}clearExpiredCache(){this.balanceService.clearExpiredCache()}},_m=null;Im=(e,t="JOLI_COIN")=>y(void 0,null,function*(){return yield gP(e).getBalance(t)}),In=(e,t="JOLI_COIN")=>y(void 0,null,function*(){let n=yield gP(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n})});var vP=C(()=>{"use strict";wi()});function Am(e){return Em||(Em=new Cm(e)),Em}var km,Cm,Em,xm,En,ol,Si=C(()=>{"use strict";R();km=class{constructor(t){this.httpClient=t}execute(t,r){return y(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Cm=class{constructor(t){this.gemBalanceService=new Rt(new km(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getGemBalance(t="GEM"){return y(this,null,function*(){return(yield this.gemBalanceService.request("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}refreshGemBalance(t="GEM"){return y(this,null,function*(){return(yield this.gemBalanceService.forceRequest("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}warmupGemBalance(t="GEM"){return y(this,null,function*(){yield this.gemBalanceService.warmupCache("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})})}clearGemBalanceCache(){this.gemBalanceService.clearCache()}getGemBalanceCacheStats(){return this.gemBalanceService.getCacheStats()}clearExpiredCache(){this.gemBalanceService.clearExpiredCache()}},Em=null;xm=(e,t="GEM")=>y(void 0,null,function*(){return yield Am(e).getGemBalance(t)}),En=(e,t="GEM")=>y(void 0,null,function*(){let n=yield Am(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n}),ol=(e,t="GEM")=>y(void 0,null,function*(){yield Am(e).warmupGemBalance(t),console.log(`Gem balance cache warmed up for type: ${t}`)})});var yP=C(()=>{"use strict";Si()});var Pt,kn=C(()=>{"use strict";vP();yP();Pt={JOLI_COIN:{fetchBalance:Im,getQuantity:e=>{var t,r,n;return(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(i=>i.type==="JOLI_COIN"))==null?void 0:r.joliCoinChoices[0].joliCoinQuantity)!=null?n:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userJoliCoin)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userJoliCoin",isEnough:(e,t)=>{var r,n;return(n=(r=e==null?void 0:e.options)==null?void 0:r.some(i=>i.type==="JOLI_COIN"&&i.joliCoinChoices.some(o=>{var a;return o.joliCoinQuantity<=((a=t==null?void 0:t.balance)!=null?a:0)})))!=null?n:!1}},JOLI_GEM:{fetchBalance:xm,getQuantity:e=>{var t,r,n,i;return(i=(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(o=>o.type==="JOLI_GEM"))==null?void 0:r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userGem)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userGem",isEnough:(e,t)=>{var n,i,o;let r=e==null?void 0:e.options.find(a=>a.type==="JOLI_GEM");return r?((i=(n=r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0)<=((o=t==null?void 0:t.balance)!=null?o:0):!1}}}});var Zo,kr,Pm=C(()=>{"use strict";Wr();St();tr();Le();Le();kn();Zo=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;ut.registerCommand(`Rewards.${e}.useJolicoin`,()=>y(void 0,null,function*(){let i=yield Te.getData(),o=Pt[t],a=o.getCurrentUser(i),s=o.getQuantity(i),c=!!(a!=null&&a.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",i,c,s),(yield n({enableAutoDeduct:c,userCurrency:a,quantity:s,currency:t}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},kr=(e,t)=>r=>y(void 0,null,function*(){let n=Me(q,hn);return q.emit(Sc,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult})});var ea,Cr,bP=C(()=>{"use strict";Wr();St();Le();tr();Le();kn();Si();wi();ea=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;ut.registerCommand(`Rewards.${e}.usePayment`,()=>y(void 0,null,function*(){var p;let o=yield Te.getData(),a=Pt[t],s=yield a.fetchBalance(n),c=a.getQuantity(o),l=a.getCurrentUser(o),d=a.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,l.enableAutoDeduct),u=a.getUpdateKey();if(Te.updateData({[u]:d}),console.log("-----unlockOptions payment-----",o,d,c,t),!a.isEnough(o,d)){let f=yield i({userCurrency:d,currencyQuantity:c,currency:t});return t==="JOLI_GEM"?En(n):In(n),{result:f==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},Cr=(e,t)=>r=>y(void 0,null,function*(){let n=Me(q,Mt);return q.emit(wc,e,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).paymentResult})});var Tm,Ar,_P=C(()=>{"use strict";B();Wr();tr();Le();Le();R();St();kn();Tm=(e,t,r)=>{let{showUnloginModal:n,httpClient:i}=r;ut.registerCommand(`Rewards.${e}.useUnloginModal`,()=>y(void 0,null,function*(){var s,c,l;let o=(s=S.hostUserInfo)==null?void 0:s.isLogin,a=yield Te.getData();if(console.log("-----isLogin-----",!!o),!o){let d=yield n(t);if(console.log("-----unloginModalResult-----",d),d.result=="FAILED"||d.result=="CANCEL")return{result:"FAILED"};let{isFirstLogin:u,claimedRewardValue:p}=(c=d.rewards)!=null?c:{};if(d.result=="SUCCESS"){u&&p&&(yield hh(3e3));let f=Pt[t],m=yield f.fetchBalance(i),g=f.getQuantity(a),b=f.getCurrentUser(a),v=f.createUpdatedUser((l=m==null?void 0:m.balance)!=null?l:0,b.enableAutoDeduct),w=f.getUpdateKey();if(Te.updateData({[w]:v}),v.balance>=g)return{result:"SUCCESS"}}}return{result:"CONTINUE"}}))},Ar=(e,t)=>r=>y(void 0,null,function*(){let n=Me(q,yr);return q.emit(Ic,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()})});var Cn=C(()=>{"use strict";Pm();bP();_P()});var cV,al,Rm=C(()=>{"use strict";B();R();bm();Cn();Wr();wi();kn();St();cV=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:o,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:s,showUnloginModal:c,hasSubscription:l}})=>{ea(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:a}),Zo(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let d=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return u=>y(void 0,null,function*(){var p,f,m,g;try{let b=yield o.getData();if(_i(b,l)){let A=Pt.JOLI_COIN,P=yield A.fetchBalance(t),T=A.getCurrentUser(b),k=A.createUpdatedUser((p=P==null?void 0:P.balance)!=null?p:0,T.enableAutoDeduct);if(!A.isEnough(b,k))return i==null||i(u),!1}else{let A=!0;for(let P of d){let T=yield ut.executeCommand(P);if(A=A&&T.result!=="FAILED",T.result!=="CONTINUE")break}if(!A)return i==null||i(u),!1}let w=il[r],E=yield t.post(w.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${Tn()}-${S.mpType}-${Date.now()}`,gameInfo:{gameId:S.mpId}}});if(console.log("-----unlockWithCurrency request result-----",E),E.code=="SUCCESS"){try{(m=u.adBreakDone)==null||m.call(u,{breakType:u.type,breakName:"name"in u&&(f=u.name)!=null?f:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in u&&((g=u.adViewed)==null||g.call(u)),In(t)}catch(A){console.error("-----unlockWithJolicoin adBreakDone error-----",A)}return n==null||n({quantity:E.data.quantity,balance:E.data.balance}),!0}return i==null||i(u),!1}catch(b){if(console.info("JolicoinRewardHandler error:",b),b instanceof Error&&b.message=="CANCEL")throw b;return i==null||i(u),!1}finally{o.clearCache()}})},al=(e,t,r)=>cV(e,t,"JOLI_COIN",r)});var wP,SP=C(()=>{"use strict";St();Rm();Cn();wP=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=kr("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),a=Cr("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Ar("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return al("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Te,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})}});var IP,EP=C(()=>{"use strict";Rm();St();Cn();IP=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=l=>{var d;r==null||r(),(d=l.adBreakDone)==null||d.call(l,{breakType:l.type,breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},o=kr("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),a=Cr("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Ar("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return al("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Te,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})}});var sl,Om=C(()=>{"use strict";B();R();bm();Cn();Pm();Wr();Si();kn();St();sl=(e,t,{handlers:{handleUnlockSuccess:r,handleUnlockFailed:n,unlockOptionsHandler:i,initiateAndAwaitPayment:o,showUnlockWithCurrencyModal:a,showUnloginModal:s,hasSubscription:c}})=>{Tm(e,"JOLI_GEM",{httpClient:t,showUnloginModal:s}),ea(e,"JOLI_GEM",{httpClient:t,initiateAndAwaitPayment:o}),Zo(e,"JOLI_GEM",{showUnlockWithCurrencyModal:a});let l=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return d=>y(void 0,null,function*(){var u,p,f,m;try{let g=yield i.getData(),b=_i(g,c);if(console.log("[GemHandler] supportSubscription",b,g),b){let E=Pt.JOLI_GEM,A=yield E.fetchBalance(t),P=E.getCurrentUser(g),T=E.createUpdatedUser((u=A==null?void 0:A.balance)!=null?u:0,P.enableAutoDeduct);if(!E.isEnough(g,T))return n==null||n(d),!1}else{let E=!0;for(let A of l){let P=yield ut.executeCommand(A);if(console.log("[GemHandler] command result",P,A),E=E&&P.result!=="FAILED",P.result!=="CONTINUE")break}if(!E)return n==null||n(d),!1}let v=il.GEM,w=yield t.post(v.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${Tn()}-${S.mpType}-${Date.now()}`,gameInfo:{gameId:S.mpId}}});if(console.log("-----unlockWithGem request result-----",w),w.code=="SUCCESS"){try{(f=d.adBreakDone)==null||f.call(d,{breakType:d.type,breakName:"name"in d&&(p=d.name)!=null?p:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in d&&((m=d.adViewed)==null||m.call(d)),En(t)}catch(E){console.error("-----unlockWithGem adBreakDone error-----",E)}return r==null||r({quantity:w.data.quantity,balance:w.data.balance}),!0}return n==null||n(d),!1}catch(g){if(console.info("GemRewardHandler error:",g),g instanceof Error&&g.message=="CANCEL")throw g;return n==null||n(d),!1}finally{i.clearCache()}})}});var kP,CP=C(()=>{"use strict";St();Om();Cn();kP=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=kr("ADS-JOLI_GEM",{confirmButtonText:"joligem.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),a=Cr("ADS-JOLI_GEM",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=Ar("ADS-JOLI_GEM",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return sl("ADS-JOLI_GEM",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Te,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})}});var AP,xP=C(()=>{"use strict";Om();St();Cn();AP=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=l=>{var d;r==null||r(),(d=l.adBreakDone)==null||d.call(l,{breakType:l.type,breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},o=kr("JOLI_GEM",{confirmButtonText:"joligem.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),a=Cr("JOLI_GEM",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=Ar("JOLI_GEM",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return sl("JOLI_GEM",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Te,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})}});var PP,TP,Nm=C(()=>{"use strict";kn();Wr();St();tr();Le();Le();PP=e=>{let{showSubscriptionModal:t}=e;ut.registerCommand("Rewards.subscription",()=>y(void 0,null,function*(){var s,c;let r=yield Te.getData(),n=(c=(s=r==null?void 0:r.options)==null?void 0:s.find(l=>l.type==="JOLI_GEM"))==null?void 0:c.type,i=Pt[n?"JOLI_GEM":"JOLI_COIN"],o=i.getCurrentUser(r);return i.isEnough(r,o)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},TP=e=>()=>y(void 0,null,function*(){let t=Me(q,gn);return q.emit(Ec,e),(yield t.getFreshData()).result})});var RP=C(()=>{"use strict";Nm()});var OP,NP=C(()=>{"use strict";Wr();RP();B();St();wi();Si();OP=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:o,hasSubscription:a}})=>{PP({showSubscriptionModal:o});let s=["Rewards.subscription"];return c=>y(void 0,null,function*(){var l,d,u,p,f,m;try{let g=yield i.getData();if(!_i(g,a))return!1;let v=!0;for(let w of s){let E=yield ut.executeCommand(w);if(v=v&&E.result!=="FAILED",E.result!=="CONTINUE")break}if(In(t),En(t),console.log("-----unlockWithSubscription result-----",v),v){try{(d=c.adBreakDone)==null||d.call(c,{breakType:c.type,breakName:"name"in c&&(l=c.name)!=null?l:"",breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in c&&((u=c.adViewed)==null||u.call(c)),(m=(f=S).onEnvConfigChanged)==null||m.call(f,{hostUserInfo:U(x({},(p=S.hostUserInfo)!=null?p:{isLogin:!1}),{isSubUser:!0})})}catch(w){console.error("-----unlockWithSubscription adBreakDone error-----",w)}return r==null||r(),!0}return n==null||n(c),!1}catch(g){if(console.info("SubscriptionRewardHandler error:",g),g instanceof Error&&g.message=="CANCEL")throw g;return n==null||n(c),!1}finally{}})}});var DP,qP=C(()=>{"use strict";St();NP();Nm();DP=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=TP("SUBSCRIPTION");return OP("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:Te,showSubscriptionModal:o,hasSubscription:n}})}});var Tt,LP=C(()=>{"use strict";pP();ym();hP();SP();EP();CP();xP();qP();wi();Si();Tt=dP();mm(Tt);hm(Tt)});var cl,lV,or,uV,ta,dV,MP,UP,pV,fV,Dm,mV,hV,gV,FP=C(()=>{"use strict";R();Ve();er();ax();lP();kt();B();pt();ce();LP();ou();ym();cl=Y(),lV=()=>{let{data:e}=F("getNetworkStatusSync");return!!(e!=null&&e.isConnected)},or={get:(e,t)=>Z(e,x({method:"GET",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data),post:(e,t)=>Z(e,x({method:"POST",responseType:"json",appendHostCookie:!0},t)).then(r=>r.response.data)},uV={httpClient:or,checkNetwork:lV,track:j,eventEmitter:Fa,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:30}),handleLinkClicked:e=>{window.open(e,"_blank")},getContextInfo:()=>{var e,t,r,n,i,o,a,s,c;return{hostAppId:(t=(e=S.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(r=S.deviceInfo.did)!=null?r:"",adId:(n=S.deviceInfo.adId)!=null?n:"",sessionId:(i=S.sessionId)!=null?i:"",userId:(a=(o=S.hostUserInfo)==null?void 0:o.uid)!=null?a:"",objectType:"GAME",objectId:S.mpId,testAdsMode:S.testAdsMode,channel:(s=S.joliSource)!=null?s:"",deviceBrand:S.deviceInfo.brand,deviceModel:S.deviceInfo.model,osType:S.platform==="android"?"ANDROID":S.platform==="ios"?"IOS":"PC",runtimeType:"APP",platform:1e3,joliSource:(c=S.joliSource)!=null?c:""}}},ta=new Xc(uV);Tt.getRewardFrequencyConfig(or).then(e=>{console.log("getRewardFrequencyConfig",e)});Tt.registerRewardHandler("ADS",mP(ta));Tt.registerRewardHandler("JOLI_COIN",wP(or,{onUnlockSuccess:e=>{MP(e),j("jolicoin_unlock_success",{quantity:e.quantity})},onUnlockFailed:()=>{console.log("onUnlockFailed")},hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));Tt.registerRewardHandler("JOLI_COIN_ONLY",IP(or,{onUnlockSuccess:e=>{MP(e),j("jolicoin_unlock_success",{quantity:e.quantity,isOnly:!0})},onUnlockFailed:()=>{console.log("onUnlockFailed")},hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));Tt.registerRewardHandler("JOLI_GEM",kP(or,{onUnlockSuccess:e=>{UP(e),j("gem_unlock_success",{quantity:e.quantity})},hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));Tt.registerRewardHandler("JOLI_GEM_ONLY",AP(or,{onUnlockSuccess:e=>{UP(e),j("gem_unlock_success",{quantity:e.quantity,isOnly:!0})},hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));dV=()=>{j("subscription_unlock_success",{})};Tt.registerRewardHandler("SUBSCRIPTION",DP(or,{onSubSuccess:dV.bind(void 0),hasSubscription:()=>ft("invokeSubscriptionPanelSync")}));MP=e=>{let{quantity:t}=e,r=`{slot-coin} ${t} {slot-i18n-jolicoin.coinUsed}`;Jr(r,{customStyle:{mark:{marginRight:"8px"},base:{with:"auto"}},i18nParams:{text:"Jolicoin Used"}})};gm(or);ol(or);UP=e=>{let{quantity:t}=e,r=`{slot-correct} ${t*-1} {slot-gem}`;Jr(r,{customStyle:{mark:{marginRight:"8px"},base:{"font-size":"25px","font-weight":"700","line-height":"18px"},span:{width:"auto",minWidth:"fit-content",maxWidth:"60px",textAlign:"center",padding:"0 2px",lineHeight:"25px"},gem:{transform:"translateY(-2px)",width:"28px",height:"28px"}}})},pV=H("adInit",{implement:e=>{ta.init(e)}}),fV=H("adConfig",{implement:e=>{ta.adConfig(e)}}),Dm=!1,mV=e=>{var t,r,n;(r=e.adBreakDone)==null||r.call(e,{breakType:e.type,breakName:"name"in e&&(t=e.name)!=null?t:"",breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in e&&((n=e.adViewed)==null||n.call(e))},hV=H("adBreak",{implement:e=>{var r;if((r=S.hostUserInfo)==null?void 0:r.isSubUser){mV(e);return}if(e.type==="reward"){if(Dm)return;Dm=!0,Tt.getRewardsTypes(or).then(n=>{Tt.handleReward(n,e).catch(i=>{var o;console.info("handleReward failed in native",i),(o=e.adBreakDone)==null||o.call(e,{breakType:e.type,breakFormat:e.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}).finally(()=>{Dm=!1})})}else ta.adBreak(e)}}),gV=H("adUnit",{implement:e=>{ta.adUnit(e)}});cl.registerCommand("AdsSDK.init",pV);cl.registerCommand("AdsSDK.adConfig",fV);cl.registerCommand("AdsSDK.adBreak",hV);cl.registerCommand("AdsSDK.adUnit",gV);M("AdsSDK.init",{version:"1.0.0"});M("AdsSDK.adConfig",{version:"1.0.0"});M("AdsSDK.adBreak",{version:"1.0.0"});M("AdsSDK.adUnit",{version:"1.0.0"})});var ra,vV,yV,bV,_V,wV,jP=C(()=>{"use strict";R();ce();Ve();B();ra=Y(),vV=H("openSchemaSync",{paramsSchema:I.tuple(I.string()),implement:e=>{let t=e;e.match(/^https?:\/\//)||(t=`https://${S.mpId}.app.jolibox.com${e.startsWith("/")?"":"/"}${e}`);let r=F("openSchemaSync",{schema:t});if(r.errNo!==0)throw new Gt(r.errMsg,r.errNo)}}),yV=H("openPageSync",{paramsSchema:I.tuple(I.string()),implement:e=>{let{errNo:t,errMsg:r,data:n}=F("openPageSync",{url:e});if(t!==0||!n)throw new Gt(r,t);return{webviewId:n.webviewId}}}),bV=H("closePageSync",{paramsSchema:I.tuple(I.number()),implement:e=>{let{errNo:t,errMsg:r}=F("closePageSync",{webviewId:e});if(t!==0)throw new Gt(r,t)}}),_V=H("interceptSystemExitSync",{paramsSchema:I.tuple(I.boolean()),implement:e=>{he.emit("onInterceptSystemExit",{intercept:e}),he.emit("onInterceptBackPress",{intercept:e})}}),wV=H("navigateToNativePage",{paramsSchema:I.tuple(I.enum("openHistory","openDiscover","openDiscover","openGame","openDrama","openTopup","openFeed","openRewards"),I.object()),implement:(e,t)=>{F("callHostMethodAsync",{method:e,params:x({},t)})}});ra.registerCommand("RouterSDK.openSchema",vV);ra.registerCommand("RouterSDK.openPage",yV);ra.registerCommand("RouterSDK.closePage",bV);ra.registerCommand("RouterSDK.interceptSystemExit",_V);ra.registerCommand("RouterSDK.navigateToNativePage",wV);M("router.openSchema",{version:"1.1.10"});M("router.openPage",{version:"1.1.10"});M("router.closePage",{version:"1.1.10"});M("router.interceptSystemExit",{version:"1.1.18"});M("router.navigateToNativePage",{version:"1.1.19"})});function EV(e){Al("cpLoadProgressEvent",{progress:e},S.webviewId,!0)}var BP,SV,ll,qm,GP,IV,kV,JP=C(()=>{"use strict";R();Ve();ce();B();kt();BP=Y(),SV=H("onLoadFinished",{implement:()=>{Al("cpLoadFinishEvent",{},S.webviewId,!0),j("loadFinished",{duration:performance.now()})}}),ll=null,qm=!1,GP=0,IV=200;kV=H("onLoadProgress",{paramsSchema:I.tuple(I.number()),implement:e=>{ll=e,qm||(qm=!0,requestAnimationFrame(function t(){let r=Date.now();r-GP>=IV?(ll!==null&&(EV(ll),GP=r,ll=null),qm=!1):requestAnimationFrame(t)}))}});BP.registerCommand("RuntimeSDK.loadFinishedEvent",SV);BP.registerCommand("RuntimeSDK.loadProgressEvent",kV)});var CV,AV,xV,HP=C(()=>{"use strict";R();Ve();B();CV=Y(),AV="isNativeSupport",xV=H(AV,{paramsSchema:I.tuple(I.object({version:I.string()})),implement:e=>{let t=S.sdkInfo.nativeSDKVersionCode,{version:r}=e;return r?{code:"SUCCESS",data:kh(iu(t!=null?t:0),r,">=")}:{code:"FAILURE",message:"[Jolibox SDK] api or versionCode is required",data:!1}}});CV.registerCommand("API.isNativeSupport",xV);M("isNativeSupport",{version:"1.1.46"})});var VP=h(Lm=>{"use strict";Ve();ce();R();R();B();var $P=Y(),PV=ne("callHostMethod",{paramsSchema:I.tuple(I.object({method:I.string(),params:I.object().optional().default({})})),implement:r=>y(Lm,[r],function*({method:e,params:t}){if(!ft(e))throw new Gt("Method not supported",10001);let{errNo:n,errMsg:i,data:o}=yield F("callHostMethodAsync",{method:e,params:x({},t)});if(n!==0)throw new Gt(i,n);let c=o,{callHostMethodId:a}=c,s=$e(c,["callHostMethodId"]);return x({},s)})});$P.registerCommand("API.callHostMethod",PV);M("callHostMethod",{version:"1.1.49"});var TV=ne("userTrackAsync",{paramsSchema:I.tuple(I.object({event:I.string(),eventType:I.number(),params:I.object().optional().default({})})),implement:n=>y(Lm,[n],function*({event:e,eventType:t,params:r}){if(!ft("userTrackAsync"))throw new Gt("Method not supported",10001);let{errNo:i,errMsg:o}=yield F("trackAsync",{event:e,eventType:t,data:x({},r),webviewId:S.webviewId});if(i!==0)throw new Gt(o,i)})});$P.registerCommand("API.track",TV);M("track",{version:"1.1.53"})});var zP=h(Ii=>{"use strict";R();Ve();Sf();Xr();Rf();var na=Y(),WP=Tc(),RV=ne("purchaseGem",{paramsSchema:I.tuple(I.object({productId:I.string()})),implement:e=>y(Ii,null,function*(){var r,n;let t=yield WP.purchase(e.productId);if(t.code!=="SUCCESS")throw Et({code:-1,msg:"[JoliboxSDK]: purchase gem failed: "+t.message});return{totalAmount:(n=(r=t.data)==null?void 0:r.totalAmount)!=null?n:""}})}),OV=ne("getGemProducts",{paramsSchema:I.tuple(),implement:()=>y(Ii,null,function*(){var t,r;let e=(r=(t=yield WP.getProductsInfo())==null?void 0:t.paymentChoices)!=null?r:[];return console.info("choices",e),{products:e.map(n=>{var i;return{productId:n.productId,totalAmountStr:(i=n.totalAmountStr)!=null?i:"",quantity:n.quantity}})}})}),NV=ne("getSubscriptionPlans",{paramsSchema:I.tuple(),implement:()=>y(Ii,null,function*(){let e=yield wn.getSubInfo();if(console.log("[PaymentAPI] getSubscriptionPlans result",e),!e)throw Et({code:-1,msg:"[JoliboxSDK]: get subscription plans failed"});return{plans:e}})}),DV=ne("flushSubInfoCache",{paramsSchema:I.tuple(),implement:()=>y(Ii,null,function*(){yield wn.updateAllNativePriceCache()})}),qV=ne("subscribe",{paramsSchema:I.tuple(I.object({productId:I.string()})),implement:e=>y(Ii,null,function*(){var a;let t=yield wn.getTierByProductId(e.productId);if(!t)throw Et({code:-1,msg:"[JoliboxSDK]: product not found"});let{basePlanId:r,appStoreProductId:n,nativeProductId:i}=t,o=yield wn.subscribe({basePlanId:r,nativeProductId:i,appStoreProductId:n});return{result:o.result,subPlanId:o.subPlanId,errMsg:(a=o.message)!=null?a:""}})});na.registerCommand("PaymentSDK.purchaseGem",RV);na.registerCommand("PaymentSDK.getGemProducts",OV);na.registerCommand("PaymentSDK.getSubscriptionPlans",NV);na.registerCommand("PaymentSDK.subscribe",qV);na.registerCommand("PaymentSDK.flushSubInfoCache",DV);M("payment.purchaseGem",{version:"1.2.9"});M("payment.getGemProducts",{version:"1.2.9"});M("payment.getSubscriptionPlans",{version:"1.2.9"});M("payment.subscribe",{version:"1.2.9"});M("payment.flushSubInfoCache",{version:"1.2.9"})});var LV={};var tae,oae,dae,pae,KP=C(()=>{"use strict";nA();tae=re(iA());dA();Ui();pA();oae=re(fA());yc();FP();jP();JP();HP();dae=re(VP()),pae=re(zP())});var YP=Symbol.for("JOLIBOX_IMPLEMENT_INIT");if(window[YP])throw console.info("Jolibox Implement Already Initialized"),new Error("Jolibox Implement Already Initialized");window[YP]=!0;y(void 0,null,function*(){let[{config:e}]=yield Promise.all([Promise.resolve().then(()=>(tA(),eA)),Promise.resolve().then(()=>(KP(),LV)),Promise.resolve().then(()=>(kt(),dg))]);e()});
|