@jolibox/implement 1.4.15 → 1.4.16

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.
@@ -1,4 +1,4 @@
1
- var AO=Object.create;var Na=Object.defineProperty,CO=Object.defineProperties,kO=Object.getOwnPropertyDescriptor,xO=Object.getOwnPropertyDescriptors,TO=Object.getOwnPropertyNames,Ra=Object.getOwnPropertySymbols,PO=Object.getPrototypeOf,zl=Object.prototype.hasOwnProperty,jh=Object.prototype.propertyIsEnumerable;var Fh=(e,t,r)=>t in e?Na(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))zl.call(t,r)&&Fh(e,r,t[r]);if(Ra)for(var r of Ra(t))jh.call(t,r)&&Fh(e,r,t[r]);return e},B=(e,t)=>CO(e,xO(t));var Qe=(e,t)=>{var r={};for(var n in e)zl.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ra)for(var n of Ra(e))t.indexOf(n)<0&&jh.call(e,n)&&(r[n]=e[n]);return r};var T=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bh=(e,t)=>{for(var r in t)Na(e,r,{get:t[r],enumerable:!0})},OO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of TO(t))!zl.call(e,i)&&i!==r&&Na(e,i,{get:()=>t[i],enumerable:!(n=kO(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?AO(PO(e)):{},OO(t||!e||!e.__esModule?Na(r,"default",{value:e,enumerable:!0}):r,e));var g=(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 UO(e){return!!(e!=null&&e.__nativeBuffers__)}function tu(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!UO(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=MO(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function jO(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:FO(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function HO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function eg(e){return typeof e=="string"}function Kn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Jh(e){return typeof e=="number"&&!isNaN(e)}function $O(e){return typeof e=="undefined"}function WO(e){return $O(e)||e===null}function tg(e){return typeof e=="function"}function zO(e){return Kn(e)&&tg(e.then)}function rg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Yi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function tR(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 aR(){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 dR(e){return new Promise(t=>ng(e)(t))}function ng(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function pR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Zi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function mR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)hR(e[n],t[n])}function hR(e,t){if(eg(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(tg(t)){try{if(e instanceof t)return}catch(r){}if(!WO(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 Ze(e,t){if(nu.config[e]){Fa.warn(`[can i use] ${e} already registered`);return}nu.config[e]=gr({},t)}function $h(e,t){return`[${e}]:${t}`}function SR(e,t){Wh||(Xl=new La({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ql=new La({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Zl=new La({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Xl.flush(),Ql.flush(),Zl.flush()}),Wh=!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:v}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Xl.report({status:b,method:n(s,c),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-l}),l&&m&&v&&(Ql.report({status:b,method:s,isForeground:d,duration:Number((m-l).toFixed(3))}),Zl.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-v).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function CR(e,t){let r=0,n=!0,i=AR.resolveMap,o=SR(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,eu.forEach(c=>Ua(this,[c],function*({method:l,args:d,resolve:u}){let p=yield s(l,d);u(p)})),eu.length=0});let a=(c,l)=>{let d=i.get(Number(c));if(!d)return;let u=tu(l);d(u),i.delete(Number(c))},s=(c,l)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let m=new VO;if(i.set(r,m.resolve),!n&&yR.includes(c))return new Promise(C=>{eu.push({method:c,args:l,resolve:C})});let v=LO(gr({},{method:c,startTime:p,args:l,isForeground:f}),{invokeType:"js-bridge"}),b=!IR&&vR.includes(c),y=jO(l,b),_=b?y:JSON.stringify(y),E;if(c.endsWith("Sync")||bR.includes(c)?E=(d=e.call)==null?void 0:d.call(e,c,y,r):typeof _=="string"?E=e.invoke(c,_,r):E=(u=e.call)==null?void 0:u.call(e,c,_,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=tu(E)}catch(C){Fa.error(C)}return i.delete(r),E.errorCode&&(E.errorCode=$h(c,E.errorCode)),o(gr(gr({},v),E)),E}return c.endsWith("Sync")&&i.delete(r),m.promise.then(C=>(C.errorCode&&(C.errorCode=$h(c,C.errorCode)),o(gr(gr({},v),C)),C))};return{invokeNative:s,applyNative:(c,l)=>{let d=s(c,l);return zO(d)?d.then(u=>zh(c,u)):zh(c,d)},invokeHandler:a}}function zh(e,t){if(!Kn(t)){Fa.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=qO(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new QO(n,i,o,a);return s}function kR(e){if(globalThis[Da])return globalThis[Da];let t=new au,r=new au,n=new La({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[Da]={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=tu(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===ig){c.forEach(l=>{let[d,u]=l;try{r.emit(d.slice(Qi.length),u,a)}catch(p){}});return}if(i.startsWith(Qi)){r.emit(i.slice(Qi.length),c,a);return}t.emit(i,c,a)}},globalThis[Da]}function xR(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(`${Qi}${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(ig,d,p)}catch(p){}}),n=void 0,t.clear()}));let l=t.get(s);l||(l=[],t.set(s,l)),l.push([`${Qi}${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(_R,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 TR(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=kR(e),{invokeNative:a,invokeHandler:s,applyNative:c}=CR(e,r),{publish:l,emitNative:d}=xR(e);return{invokeHandler:s,subscribeHandler:t,applyNative:c,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:l,subscribe:i,unsubscribe:o}}function og(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var RO,NO,DO,qa,Yh,Xh,Gh,gr,LO,qO,Ua,MO,FO,Qh,BO,GO,Zh,JO,VO,KO,YO,Ma,XO,QO,ZO,Kl,Fa,Hh,eR,ru,rR,nu,nR,iR,oR,zn,sR,_z,iu,he,cR,lR,Xi,Zi,au,su,uR,Yl,fR,wz,cu,Vh,Sz,ja,gR,Qi,vR,yR,bR,ig,_R,wR,La,Wh,Xl,Ql,Zl,eu,IR,lu,ER,AR,Da,uu,Rt,ag,sg,PR,cg,Kh,de,L,we,lg,OR,ug,hn,Iz,Ez,ce=T(()=>{"use strict";RO=Object.defineProperty,NO=Object.defineProperties,DO=Object.getOwnPropertyDescriptors,qa=Object.getOwnPropertySymbols,Yh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,Gh=(e,t,r)=>t in e?RO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gr=(e,t)=>{for(var r in t||(t={}))Yh.call(t,r)&&Gh(e,r,t[r]);if(qa)for(var r of qa(t))Xh.call(t,r)&&Gh(e,r,t[r]);return e},LO=(e,t)=>NO(e,DO(t)),qO=(e,t)=>{var r={};for(var n in e)Yh.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&qa)for(var n of qa(e))t.indexOf(n)<0&&Xh.call(e,n)&&(r[n]=e[n]);return r},Ua=(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())});MO=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};FO=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)};Qh=Object.defineProperty,BO=Object.getOwnPropertyDescriptor,GO=(e,t)=>{for(var r in t)Qh(e,r,{get:t[r],enumerable:!0})},Zh=(e,t,r,n)=>{for(var i=n>1?void 0:n?BO(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&&Qh(t,r,i),i},JO=(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}VO=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))}})}};KO=(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))(KO||{}),YO=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}},Ma=class extends YO{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},XO=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},QO=class extends Ma{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},ZO=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Kl=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Fa={log:Yi("log"),warn:Yi("warn"),info:Yi("info"),error:Yi("error"),debug:Yi("debug")};Object.assign(globalThis,{logger:Fa});Hh=Symbol.for("Jolibox.canIUseMap"),eR={};globalThis[Hh]||(globalThis[Hh]=eR);ru=Symbol.for("Jolibox.canIUseMap.native"),rR={};globalThis[ru]||(globalThis[ru]=rR);nu={get config(){return globalThis[ru]}},nR=(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))(nR||{}),iR=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(iR||{}),oR=(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))(oR||{});aR();zn=typeof window=="undefined",sR=()=>!zn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),_z={isiOS:!zn&&(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:!zn&&navigator.userAgent.includes("Android"),isMac:!zn&&navigator.userAgent.includes("Mac"),isFacebook:!zn&&navigator.userAgent.includes("FB_IAB"),isPC:!zn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},iu=class ou{constructor(t){this.element=t,this.next=ou.Undefined,this.prev=ou.Undefined}};iu.Undefined=new iu(void 0);he=iu,cR=class{constructor(){this._first=he.Undefined,this._last=he.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===he.Undefined}clear(){let e=this._first;for(;e!==he.Undefined;){let t=e.next;e.prev=he.Undefined,e.next=he.Undefined,e=t}this._first=he.Undefined,this._last=he.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new he(e);if(this._first===he.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!==he.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==he.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==he.Undefined&&e.next!==he.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===he.Undefined&&e.next===he.Undefined?(this._first=he.Undefined,this._last=he.Undefined):e.next===he.Undefined?(this._last=this._last.prev,this._last.next=he.Undefined):e.prev===he.Undefined&&(this._first=this._first.next,this._first.prev=he.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==he.Undefined;)yield e.element,e=e.next}},lR=0,Xi=class{constructor(e){this.value=e,this.id=lR++}},Zi=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 Xi&&(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 Xi(t);return this._listeners?this._listeners instanceof Xi?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 Xi)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 Xi?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},au=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 Zi,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 cR,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)}},su={};GO(su,{None:()=>uR,filter:()=>pR,once:()=>ng,toPromise:()=>dR});uR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Yl=Symbol.for("Jolibox.hostEmitter"),fR=()=>{let e=new au;return globalThis[Yl]||(globalThis[Yl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Yl]},wz=fR();cu=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Zi,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 mR(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}};cu=Zh([rg],cu);Vh=class{constructor(){this._onWillExecuteCommand=new Zi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Zi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new cu,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=HO(3e4)),this._starActivation}executeCommand(e,...t){return JO(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),su.toPromise(su.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}}};Vh=Zh([rg],Vh);Sz=Symbol.for("Jolibox.commands");Ze("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Ze("requestProductDetailsAsync",{version:102e4});Ze("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Ze("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Ze("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Ze("userTrackAsync",{version:1e6});Ze("openMiniapp",{version:1050100});Ze("requestCoinDetailsSync",{version:1070100});Ze("requestCoinDetailsAsync",{version:1070100});Ze("sendServerEventAsync",{version:1070100});Ze("requestGameLeaderboardSync",{version:108e4});Ze("requestGameLeaderboardAsync",{version:108e4});Ze("notifyTaskGameInfoAsync",{version:1080100});Ze("loadAdsAsync",{version:1070200});Ze("showAdAsync",{version:1070200});Ze("onJoliboxHideLoading",{version:1070300});ja=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let c=nu.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=tR(i,o);if(!s)return!1;if(Kn(s)){let c=s.version;return Jh(c)?typeof a=="number"&&a>=c:!0}return Jh(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};gR=()=>sR(),Qi="custom_event_",vR=[],yR=[],bR=["env","createRequestTask","login"],ig="__batch_event__",_R="__native_batch_event__",wR=e=>e==="pv"?e:"default",La=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=wR(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&&Kn(a))throw new Kl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let c=[];if(Kn(a))c.push(...Object.keys(a));else if(eg(a)){if(i.length>0)throw new Kl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);c.push(a)}else throw new Kl(`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=Kn(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={}}},Wh=!1;eu=[],IR=!1,lu=Symbol.for("Jolibox.invokeResolverInstance"),ER=new Map;globalThis[lu]||(globalThis[lu]=ER);AR={get resolveMap(){return globalThis[lu]}};Da=Symbol.for("Jolibox.subscribeInstance");Rt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Rt.trigger=e},onDoExit(e){Rt.exit=e},onDoBackPress(e){Rt.backPress=e}},ag=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new XO("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="")=>{Rt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ua(void 0,null,function*(){let o=yield Rt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});uu={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=og(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:ag,doExit:r};globalThis.joliboxJSCore=gr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Rt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ua(void 0,null,function*(){let a=yield Rt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});uu={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let c=og(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 Ua(this,null,function*(){let a=yield Rt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:ag,doExit:n};globalThis.joliboxJSCore=gr({},i)}sg=uu;if(!sg&&gR())throw new ZO("No joliboxJScore is found, native bridge not found.");PR=gr({},sg),cg=TR(PR),{invokeHandler:Kh}=cg,{applyNative:de,invokeNative:L,onNative:we,offNative:lg,subscribeHandler:OR,publish:ug,emitNative:hn,subscribe:Iz,unsubscribe:Ez}=cg;globalThis.joliboxJSBridge={callHandler:Kh,invokeHandler:Kh,subscribeHandler:OR}});function qR(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Ga(e){return new Promise(t=>setTimeout(t,e))}function io(e){return typeof e=="string"}function vn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function vg(e){return typeof e=="object"&&Array.isArray(e)}function Ja(e){return typeof e=="number"&&!isNaN(e)}function Jr(e){return e===!0||e===!1}function yg(e){return typeof e=="undefined"}function oo(e){return yg(e)||e===null}function UR(e){return typeof e=="function"}function bg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function _g(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:fg(c)&&fg(s)?i[a]=n(hg({},s),c):Array.isArray(c)&&Array.isArray(s)?i[a]=[...s,...c]:i[a]=c}return i}return n(e,t)}function fg(e){return e&&typeof e=="object"&&e.constructor===Object}function wg(e,t){if(Array.isArray(e))return e.concat(t)}function ao(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 FR(e,t){return(...r)=>t(e,...r)}function Yn(e){return t=>FR(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new zt(`${i}`))}})}function eo(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Cg(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 Iu(){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 VR(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com"||a==="mporia.com"||a==="pingplus.ai")return`${o}.${a}`}return`${o}.jolibox.com`}function Eu(e){return VR("app","stg-app",e)}function Qn(e){return`https://${Eu(e)}`}function KR(e){return new Promise(t=>Pg(e)(t))}function Pg(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function YR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new no(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function QR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ZR(e[n],t[n])}function ZR(e,t){if(io(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(!oo(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 e1(){return typeof globalThis!="undefined"?globalThis[Og]:void 0}function t1(e){typeof globalThis!="undefined"&&(globalThis[Og]=e)}function Y(e=!1){let t=e1();if(!e&&t)return t;let r=new Ba,n=new gu,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 t1(i),i}var vu,RR,dg,NR,DR,pg,hg,LR,gg,gn,pt,MR,yu,so,bu,Sg,zt,Ha,Ig,Va,Eg,Ag,co,_u,Kt,pu,jR,wu,mg,BR,K,Su,GR,Xn,to,lo,JR,HR,kg,xg,Tg,Ft,fu,ge,$R,WR,ro,no,Yt,hu,zR,du,XR,Se,Ba,gu,Og,R=T(()=>{"use strict";vu=Object.defineProperty,RR=Object.getOwnPropertyDescriptor,dg=Object.getOwnPropertySymbols,NR=Object.prototype.hasOwnProperty,DR=Object.prototype.propertyIsEnumerable,pg=(e,t,r)=>t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hg=(e,t)=>{for(var r in t||(t={}))NR.call(t,r)&&pg(e,r,t[r]);if(dg)for(var r of dg(t))DR.call(t,r)&&pg(e,r,t[r]);return e},LR=(e,t)=>{for(var r in t)vu(e,r,{get:t[r],enumerable:!0})},gg=(e,t,r,n)=>{for(var i=n>1?void 0:n?RR(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&&vu(t,r,i),i},gn=(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}pt=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))}})}};MR=(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))(MR||{}),yu=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}},so=class extends yu{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},bu=class extends yu{constructor(){super(...arguments),this.kind="USER_ERROR"}},Sg=class extends bu{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},zt=class extends bu{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))}},Ha=class extends bu{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))}},Ig=class extends so{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Va=class extends so{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))}},Eg=class extends so{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},Ag=class extends so{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},co=class extends yu{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}}},_u=class extends so{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Kt={log:eo("log"),warn:eo("warn"),info:eo("info"),error:eo("error"),debug:eo("debug")};Object.assign(globalThis,{logger:Kt});pu=Symbol.for("Jolibox.canIUseMap"),jR={};globalThis[pu]||(globalThis[pu]=jR);wu={get config(){return globalThis[pu]}},mg=Symbol.for("Jolibox.canIUseMap.native"),BR={};globalThis[mg]||(globalThis[mg]=BR);K=(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))(K||{}),Su=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Su||{}),GR=(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))(GR||{}),Xn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});Iu();to=typeof window=="undefined",lo={isiOS:!to&&(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:!to&&navigator.userAgent.includes("Android"),isMac:!to&&navigator.userAgent.includes("Mac"),isFacebook:!to&&navigator.userAgent.includes("FB_IAB"),isPC:!to&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},JR="device_id",HR="advertising_id",kg=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Xn()),window.__joliboxLocalStorage__.getItem(e)),xg=()=>new URLSearchParams(window.location.search).get("deviceId")||kg(JR),Tg=()=>new URLSearchParams(window.location.search).get("advertisingId")||kg(HR);Ft=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=hg({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return gn(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=>gn(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 gn(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 gn(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return gn(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 gn(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)}},fu=class mu{constructor(t){this.element=t,this.next=mu.Undefined,this.prev=mu.Undefined}};fu.Undefined=new fu(void 0);ge=fu,$R=class{constructor(){this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ge.Undefined}clear(){let e=this._first;for(;e!==ge.Undefined;){let t=e.next;e.prev=ge.Undefined,e.next=ge.Undefined,e=t}this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ge(e);if(this._first===ge.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!==ge.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ge.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ge.Undefined&&e.next!==ge.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ge.Undefined&&e.next===ge.Undefined?(this._first=ge.Undefined,this._last=ge.Undefined):e.next===ge.Undefined?(this._last=this._last.prev,this._last.next=ge.Undefined):e.prev===ge.Undefined&&(this._first=this._first.next,this._first.prev=ge.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ge.Undefined;)yield e.element,e=e.next}},WR=0,ro=class{constructor(e){this.value=e,this.id=WR++}},no=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 ro&&(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 ro(t);return this._listeners?this._listeners instanceof ro?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 ro)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 ro?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Yt=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 no,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 $R,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)}},hu={};LR(hu,{None:()=>zR,filter:()=>YR,once:()=>Pg,toPromise:()=>KR});zR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});du=Symbol.for("Jolibox.hostEmitter"),XR=()=>{let e=new Yt;return globalThis[du]||(globalThis[du]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[du]},Se=XR();Ba=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new no,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 QR(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}};Ba=gg([bg],Ba);gu=class{constructor(){this._onWillExecuteCommand=new no,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new no,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ba,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=qR(3e4)),this._starActivation}executeCommand(e,...t){return gn(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),hu.toPromise(hu.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}}};gu=gg([bg],gu);Og=Symbol.for("Jolibox.commands")});function ke(e,t={}){Au.emit("ERROR_REPORT",{error:e,options:t})}var Au,yn,_t=T(()=>{"use strict";R();R();Au=new Yt,yn=new Yt;ke.debounce=ao(ke,50,{leading:!0})});var Cu,r1,Rg,Ng,Dg=T(()=>{"use strict";R();_t();Cu=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{}}},r1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rg=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:Cu(o),payloadJson:Cu(a),signature:Cu(s)}}else throw"joli_source is missing"}catch(r){return ke(new Ig(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Ng=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=r1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var n1,ku,Lg=T(()=>{"use strict";R();n1="1.4.15",ku=()=>n1});function Tu(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var i1,qg,xu,Ug,ve,o1,S,$=T(()=>{"use strict";R();Dg();Lg();R();i1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:xg(),adId:Tg(),pixelRatio:window.devicePixelRatio||1,platform:lo.isAndroid?"android":lo.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ku()},schema:window.location.href,platform:lo.isAndroid?"android":lo.isiOS?"ios":"h5"},xu=(qg=globalThis.joliboxJSCore)==null?void 0:qg.env,ve=Object.assign({},(Ug=xu==null?void 0:xu())!=null?Ug:i1);o1=()=>{var v,b,y,_,E,C,x,k,A,H,ue;let{payloadJson:e,headerJson:t,signature:r}=ve.schema.length?Rg(ve.schema):{},n=`${ve.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ve.schema.length?ve.schema:window.location.href).searchParams,a=(y=(b=(v=o.get("mpId"))!=null?v:o.get("appId"))!=null?b:o.get("gameId"))!=null?y:"",s=(C=(E=(_=ve.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?E:o.get("sessionId"))!=null?C:n,c=!!((k=(x=e==null?void 0:e.testAdsMode)!=null?x:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),l=(ue=(H=(A=e==null?void 0:e.joliboxEnv)!=null?A:e==null?void 0:e.__joliboxEnv)!=null?H:o.get("joliboxEnv"))!=null?ue:"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 N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return c},get joliboxEnv(){return l},get joliSource(){var N,O;return(O=(N=f.get("joliSource"))!=null?N:o.get("joliSource"))!=null?O:null},get mpId(){var N;return(N=a!=null?a:e==null?void 0:e.id)!=null?N:""},get mpVersion(){var N;return(N=t==null?void 0:t.ver)!=null?N:ku()},get mpType(){var N,O;return(O=(N=t==null?void 0:t.__mpType)!=null?N:e==null?void 0:e.__mpType)!=null?O:"game"},get platform(){var N;return((N=ve.platform)!=null?N:ve.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ve.deviceInfo},get sdkInfo(){return ve.sdkInfo},get hostInfo(){return ve.hostInfo},get hostUserInfo(){return ve.hostUserInfo},get sessionId(){var N,O;return(O=(N=ve.clientSessionId)!=null?N:s)!=null?O:n},get channel(){return u},get webviewId(){var N;return(N=ve.webviewId)!=null?N:-1},get shouldInterupt(){return m},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Eu(d)},get adId(){var N;return(N=ve.deviceInfo.adId)!=null?N:ve.deviceInfo.did},get language(){return ve.deviceInfo.lang},get sdkEnvironment(){return Tu("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Tu("gamedistribution","jolibox")?"gamedistribution":Tu("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var J,V,Mt;let N=(J=ve.deviceInfo.pixelRatio)!=null?J:1,O=(V=ve.deviceInfo.statusBarHeight)!=null?V:e==null?void 0:e.__androidStatusBarHeight,F=(Mt=ve.deviceInfo.navigationBarHeight)!=null?Mt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:O!==void 0?O/N:20,navigationBarHeight:F!==void 0?F/N:10}},get abTests(){var N,O;return(O=(N=ve.abValues)==null?void 0:N.split(","))!=null?O:[]},get mpInfo(){var N;return(N=ve.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{_g(ve,N,wg)},encodeJoliSourceQuery:N=>{var O,F;return t&&r?Ng(P(P({},e),N),(O=o.get("joliSource"))!=null?O:""):(F=o.get("joliSource"))!=null?F:""},setDoExitDirectly:()=>{m=!1}}},S=o1()});var Pu,Fg,a1,s1,Mg,c1,jg=T(()=>{"use strict";R();_t();$();R();Pu=!1,Fg=(e,t)=>e==null?!1:t in e,a1=e=>Fg(e,"kind"),s1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Mg=(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:s1(e.name)},i=B(P({},n),{env:t.environment,isFromUser:r});r?yn.emit("GLOBAL_USER_ERROR",e,i):yn.emit("GLOBAL_ERROR",e,i)},c1=e=>Fg(e,"kind")&&e.kind==="USER_ERROR";Au.on("ERROR_REPORT",({error:e,options:t})=>{if(Pu)return;Pu=!0;let r=a1(e)&&e.raw?e.raw:e;try{let n=c1(e);Mg(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new _u(`${i}, origin error: ${r.message}`);Kt.error(o),Mg(new _u(o.message),{environment:t.environment},!1)}finally{Pu=!1}})});var xe,Ou,Hr=T(()=>{"use strict";_t();R();_t();xe=(e,t)=>{var r,n;return new co((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Ou=e=>new Sg(e)});var Bg=T(()=>{"use strict";jg();Hr();R();ce();yn.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};L("trackAsync",{event:"reportJsError",data:r})});yn.on("GLOBAL_USER_ERROR",(e,t)=>{Kt.log("UserError",e,t)})});var Ru=T(()=>{"use strict"});function Gg(e,t){let r=(n,i,o)=>{let l=i!=null?i:{},{eventType:a}=l,s=Qe(l,["eventType"]),c=B(P({tag:n,eventType:o!=null?o:a!=null?a:K.Other},t),{extra:P({},s)});n=="globalJsError"?ke(new Ag(JSON.stringify(c))):e("systemLog",c,S.webviewId)};return r.debounce=ao(r,500,{leading:!0}),r}function Jg(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=ao(t,500,{leading:!0}),t}var Hg=T(()=>{"use strict";R();R();_t();$()});function Vg(e,t){let r=Gg(e,t),n=Jg(r);return{track:r,trackPerformance:n}}var $g=T(()=>{"use strict";Hg()});var Wg=T(()=>{"use strict";$();R();R()});var zg=T(()=>{"use strict";$g();Ru();Wg()});var $a,Kg=T(()=>{"use strict";$a=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 Wa(e,t,r){var c,l,d;let n=new Map,i=(c=r==null?void 0:r.baseUrl)!=null?c:Qn(S.testMode),o=(l=r==null?void 0:r.type)!=null?l:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return we("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:v,state:b}=f,y=Qe(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(y):p.reject(y),n.delete(v)}else if(u.state==="fail"){let m=u,{requestTaskId:v,state:b}=m,y=Qe(m,["requestTaskId","state"]);p.reject(y),n.delete(v)}else Kt.warn("onRequestTaskStateChange unknown event",u)}),Se.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...m)=>g(this,[f,...m],function*(u,p={}){let v=Date.now(),b=l1(u,B(P({},p),{baseUrl:i})),{method:y="GET",responseType:_="text",dataType:E="json",timeout:C,enableCache:x=!1,appendHostCookie:k=!0}=p,A=Object.assign({"content-type":"application/json"},a,p.header),H={url:b,method:y,header:A,enableCache:x,responseType:_,appendHostCookie:k};if(y=="POST"||y=="PUT"){let J=d1(p.data,A["content-type"]);H.data=J}C&&Object.assign(H,{timeout:C});let{data:{requestTaskId:ue}}=L(e,H);if(typeof ue!="string")throw xe({code:-1,msg:"requestTaskId is not a string"});let{resolve:N,reject:O,promise:F}=new pt;n.set(ue,{resolve:N,reject:O});try{let J=yield F,{data:V}=J;return E==="json"&&typeof V=="string"&&(V=u1(V)),{url:b,timeout:C,method:y,response:B(P({},J),{data:V})}}catch(J){let V=J;if(vn(V)){let{errMsg:Mt,prefetchDetail:Mh,isPrefetch:Wl,errNo:Oa}=V;io(Mt)&&ke(xe({code:-1,msg:Mt},{errNo:Oa,errMsg:Mt}))}throw J}})}function u1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function d1(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 l1,Nu=T(()=>{"use strict";R();ce();_t();Hr();$();l1=(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 Du,Yg,X,ft=T(()=>{"use strict";Nu();$();R();Du={};(Yg=S.hostUserInfo)!=null&&Yg.token&&(Du["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(Du["x-joli-source"]=S.joliSource);X=Wa("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Qn(S.testMode),defaultHeaders:Du})});function Xg(e){let t=wu.config[e];return t||(t={},wu.config[e]=t),(r,n)=>{if(t[r]){Kt.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var Qg=T(()=>{"use strict";R()});function Lu(e){Zg=e}function za(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>za(t)):Object.keys(e).reduce((t,r)=>(t[r]=za(e[r]),t),{})}function vr(e){return typeof e=="number"}function qu(e){let t=Uu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Uu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Zg,Oe,Ka,Ya,Xa,Qa,Zn,Za,es,ts,rs,ns,is,os,as,ss,cs,ls,us,Mu=T(()=>{"use strict";Zg=!1;Oe=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Zg)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 ${qu(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return za(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:za(this._default)}optional(){return this._optional=!0,this}};Ka=class extends Oe{validate(t){return this._optional&&t===void 0?!0:vr(t)?vr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):vr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):vr(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}},Ya=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Xa=class extends Oe{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(vr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(vr(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}},Qa=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Zn=class extends Oe{validate(t){return!0}},Za=class extends Oe{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},es=class extends Oe{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ts=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},rs=class extends Oe{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 ${qu(t)}`)}return!0}},ns=class extends Oe{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(vr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(vr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(vr(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}},is=class extends Oe{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Uu(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}},os=class extends Oe{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Uu(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}},as=class extends Oe{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:qu(this.value),actual:r}):!0}},ss=class extends Oe{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 AO=Object.create;var Na=Object.defineProperty,CO=Object.defineProperties,kO=Object.getOwnPropertyDescriptor,xO=Object.getOwnPropertyDescriptors,TO=Object.getOwnPropertyNames,Ra=Object.getOwnPropertySymbols,PO=Object.getPrototypeOf,zl=Object.prototype.hasOwnProperty,jh=Object.prototype.propertyIsEnumerable;var Fh=(e,t,r)=>t in e?Na(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))zl.call(t,r)&&Fh(e,r,t[r]);if(Ra)for(var r of Ra(t))jh.call(t,r)&&Fh(e,r,t[r]);return e},B=(e,t)=>CO(e,xO(t));var Qe=(e,t)=>{var r={};for(var n in e)zl.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ra)for(var n of Ra(e))t.indexOf(n)<0&&jh.call(e,n)&&(r[n]=e[n]);return r};var T=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Bh=(e,t)=>{for(var r in t)Na(e,r,{get:t[r],enumerable:!0})},OO=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of TO(t))!zl.call(e,i)&&i!==r&&Na(e,i,{get:()=>t[i],enumerable:!(n=kO(t,i))||n.enumerable});return e};var se=(e,t,r)=>(r=e!=null?AO(PO(e)):{},OO(t||!e||!e.__esModule?Na(r,"default",{value:e,enumerable:!0}):r,e));var g=(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 UO(e){return!!(e!=null&&e.__nativeBuffers__)}function tu(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!UO(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=MO(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}function jO(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:FO(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}function HO(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function eg(e){return typeof e=="string"}function Kn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Jh(e){return typeof e=="number"&&!isNaN(e)}function $O(e){return typeof e=="undefined"}function WO(e){return $O(e)||e===null}function tg(e){return typeof e=="function"}function zO(e){return Kn(e)&&tg(e.then)}function rg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Yi(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function tR(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 aR(){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 dR(e){return new Promise(t=>ng(e)(t))}function ng(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function pR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Zi(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function mR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)hR(e[n],t[n])}function hR(e,t){if(eg(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(tg(t)){try{if(e instanceof t)return}catch(r){}if(!WO(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 Ze(e,t){if(nu.config[e]){Fa.warn(`[can i use] ${e} already registered`);return}nu.config[e]=gr({},t)}function $h(e,t){return`[${e}]:${t}`}function SR(e,t){Wh||(Xl=new La({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ql=new La({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Zl=new La({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{Xl.flush(),Ql.flush(),Zl.flush()}),Wh=!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:v}=f,b=(a=(o=u.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";Xl.report({status:b,method:n(s,c),errNo:`${p}`,errMsg:u,isForeground:d,duration:Date.now()-l}),l&&m&&v&&(Ql.report({status:b,method:s,isForeground:d,duration:Number((m-l).toFixed(3))}),Zl.report({status:b,method:s,isForeground:d,duration:Number((Date.now()-v).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}function CR(e,t){let r=0,n=!0,i=AR.resolveMap,o=SR(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,eu.forEach(c=>Ua(this,[c],function*({method:l,args:d,resolve:u}){let p=yield s(l,d);u(p)})),eu.length=0});let a=(c,l)=>{let d=i.get(Number(c));if(!d)return;let u=tu(l);d(u),i.delete(Number(c))},s=(c,l)=>{var d,u;let p=Date.now(),f=`${n}`;r+=1;let m=new VO;if(i.set(r,m.resolve),!n&&yR.includes(c))return new Promise(C=>{eu.push({method:c,args:l,resolve:C})});let v=LO(gr({},{method:c,startTime:p,args:l,isForeground:f}),{invokeType:"js-bridge"}),b=!IR&&vR.includes(c),y=jO(l,b),_=b?y:JSON.stringify(y),E;if(c.endsWith("Sync")||bR.includes(c)?E=(d=e.call)==null?void 0:d.call(e,c,y,r):typeof _=="string"?E=e.invoke(c,_,r):E=(u=e.call)==null?void 0:u.call(e,c,_,r),E){try{typeof E=="string"&&(E=JSON.parse(E)),E=tu(E)}catch(C){Fa.error(C)}return i.delete(r),E.errorCode&&(E.errorCode=$h(c,E.errorCode)),o(gr(gr({},v),E)),E}return c.endsWith("Sync")&&i.delete(r),m.promise.then(C=>(C.errorCode&&(C.errorCode=$h(c,C.errorCode)),o(gr(gr({},v),C)),C))};return{invokeNative:s,applyNative:(c,l)=>{let d=s(c,l);return zO(d)?d.then(u=>zh(c,u)):zh(c,d)},invokeHandler:a}}function zh(e,t){if(!Kn(t)){Fa.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=qO(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new QO(n,i,o,a);return s}function kR(e){if(globalThis[Da])return globalThis[Da];let t=new au,r=new au,n=new La({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[Da]={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=tu(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===ig){c.forEach(l=>{let[d,u]=l;try{r.emit(d.slice(Qi.length),u,a)}catch(p){}});return}if(i.startsWith(Qi)){r.emit(i.slice(Qi.length),c,a);return}t.emit(i,c,a)}},globalThis[Da]}function xR(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(`${Qi}${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(ig,d,p)}catch(p){}}),n=void 0,t.clear()}));let l=t.get(s);l||(l=[],t.set(s,l)),l.push([`${Qi}${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(_R,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 TR(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=kR(e),{invokeNative:a,invokeHandler:s,applyNative:c}=CR(e,r),{publish:l,emitNative:d}=xR(e);return{invokeHandler:s,subscribeHandler:t,applyNative:c,invokeNative:a,onNative:r,offNative:n,emitNative:d,publish:l,subscribe:i,unsubscribe:o}}function og(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var RO,NO,DO,qa,Yh,Xh,Gh,gr,LO,qO,Ua,MO,FO,Qh,BO,GO,Zh,JO,VO,KO,YO,Ma,XO,QO,ZO,Kl,Fa,Hh,eR,ru,rR,nu,nR,iR,oR,zn,sR,_z,iu,he,cR,lR,Xi,Zi,au,su,uR,Yl,fR,wz,cu,Vh,Sz,ja,gR,Qi,vR,yR,bR,ig,_R,wR,La,Wh,Xl,Ql,Zl,eu,IR,lu,ER,AR,Da,uu,Rt,ag,sg,PR,cg,Kh,de,L,we,lg,OR,ug,hn,Iz,Ez,ce=T(()=>{"use strict";RO=Object.defineProperty,NO=Object.defineProperties,DO=Object.getOwnPropertyDescriptors,qa=Object.getOwnPropertySymbols,Yh=Object.prototype.hasOwnProperty,Xh=Object.prototype.propertyIsEnumerable,Gh=(e,t,r)=>t in e?RO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gr=(e,t)=>{for(var r in t||(t={}))Yh.call(t,r)&&Gh(e,r,t[r]);if(qa)for(var r of qa(t))Xh.call(t,r)&&Gh(e,r,t[r]);return e},LO=(e,t)=>NO(e,DO(t)),qO=(e,t)=>{var r={};for(var n in e)Yh.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&qa)for(var n of qa(e))t.indexOf(n)<0&&Xh.call(e,n)&&(r[n]=e[n]);return r},Ua=(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())});MO=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};FO=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)};Qh=Object.defineProperty,BO=Object.getOwnPropertyDescriptor,GO=(e,t)=>{for(var r in t)Qh(e,r,{get:t[r],enumerable:!0})},Zh=(e,t,r,n)=>{for(var i=n>1?void 0:n?BO(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&&Qh(t,r,i),i},JO=(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}VO=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))}})}};KO=(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))(KO||{}),YO=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}},Ma=class extends YO{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},XO=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},QO=class extends Ma{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},ZO=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Kl=class extends Ma{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};Fa={log:Yi("log"),warn:Yi("warn"),info:Yi("info"),error:Yi("error"),debug:Yi("debug")};Object.assign(globalThis,{logger:Fa});Hh=Symbol.for("Jolibox.canIUseMap"),eR={};globalThis[Hh]||(globalThis[Hh]=eR);ru=Symbol.for("Jolibox.canIUseMap.native"),rR={};globalThis[ru]||(globalThis[ru]=rR);nu={get config(){return globalThis[ru]}},nR=(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))(nR||{}),iR=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(iR||{}),oR=(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))(oR||{});aR();zn=typeof window=="undefined",sR=()=>!zn&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),_z={isiOS:!zn&&(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:!zn&&navigator.userAgent.includes("Android"),isMac:!zn&&navigator.userAgent.includes("Mac"),isFacebook:!zn&&navigator.userAgent.includes("FB_IAB"),isPC:!zn&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},iu=class ou{constructor(t){this.element=t,this.next=ou.Undefined,this.prev=ou.Undefined}};iu.Undefined=new iu(void 0);he=iu,cR=class{constructor(){this._first=he.Undefined,this._last=he.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===he.Undefined}clear(){let e=this._first;for(;e!==he.Undefined;){let t=e.next;e.prev=he.Undefined,e.next=he.Undefined,e=t}this._first=he.Undefined,this._last=he.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new he(e);if(this._first===he.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!==he.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==he.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==he.Undefined&&e.next!==he.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===he.Undefined&&e.next===he.Undefined?(this._first=he.Undefined,this._last=he.Undefined):e.next===he.Undefined?(this._last=this._last.prev,this._last.next=he.Undefined):e.prev===he.Undefined&&(this._first=this._first.next,this._first.prev=he.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==he.Undefined;)yield e.element,e=e.next}},lR=0,Xi=class{constructor(e){this.value=e,this.id=lR++}},Zi=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 Xi&&(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 Xi(t);return this._listeners?this._listeners instanceof Xi?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 Xi)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 Xi?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},au=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 Zi,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 cR,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)}},su={};GO(su,{None:()=>uR,filter:()=>pR,once:()=>ng,toPromise:()=>dR});uR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Yl=Symbol.for("Jolibox.hostEmitter"),fR=()=>{let e=new au;return globalThis[Yl]||(globalThis[Yl]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Yl]},wz=fR();cu=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Zi,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 mR(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}};cu=Zh([rg],cu);Vh=class{constructor(){this._onWillExecuteCommand=new Zi,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Zi,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new cu,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=HO(3e4)),this._starActivation}executeCommand(e,...t){return JO(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),su.toPromise(su.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}}};Vh=Zh([rg],Vh);Sz=Symbol.for("Jolibox.commands");Ze("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Ze("requestProductDetailsAsync",{version:102e4});Ze("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Ze("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Ze("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Ze("userTrackAsync",{version:1e6});Ze("openMiniapp",{version:1050100});Ze("requestCoinDetailsSync",{version:1070100});Ze("requestCoinDetailsAsync",{version:1070100});Ze("sendServerEventAsync",{version:1070100});Ze("requestGameLeaderboardSync",{version:108e4});Ze("requestGameLeaderboardAsync",{version:108e4});Ze("notifyTaskGameInfoAsync",{version:1080100});Ze("loadAdsAsync",{version:1070200});Ze("showAdAsync",{version:1070200});Ze("onJoliboxHideLoading",{version:1070300});ja=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let c=nu.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=tR(i,o);if(!s)return!1;if(Kn(s)){let c=s.version;return Jh(c)?typeof a=="number"&&a>=c:!0}return Jh(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};gR=()=>sR(),Qi="custom_event_",vR=[],yR=[],bR=["env","createRequestTask","login"],ig="__batch_event__",_R="__native_batch_event__",wR=e=>e==="pv"?e:"default",La=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=wR(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&&Kn(a))throw new Kl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let c=[];if(Kn(a))c.push(...Object.keys(a));else if(eg(a)){if(i.length>0)throw new Kl(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);c.push(a)}else throw new Kl(`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=Kn(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={}}},Wh=!1;eu=[],IR=!1,lu=Symbol.for("Jolibox.invokeResolverInstance"),ER=new Map;globalThis[lu]||(globalThis[lu]=ER);AR={get resolveMap(){return globalThis[lu]}};Da=Symbol.for("Jolibox.subscribeInstance");Rt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Rt.trigger=e},onDoExit(e){Rt.exit=e},onDoBackPress(e){Rt.backPress=e}},ag=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new XO("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="")=>{Rt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ua(void 0,null,function*(){let o=yield Rt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});uu={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=og(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:ag,doExit:r};globalThis.joliboxJSCore=gr({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Rt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ua(void 0,null,function*(){let a=yield Rt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});uu={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let c=og(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 Ua(this,null,function*(){let a=yield Rt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:ag,doExit:n};globalThis.joliboxJSCore=gr({},i)}sg=uu;if(!sg&&gR())throw new ZO("No joliboxJScore is found, native bridge not found.");PR=gr({},sg),cg=TR(PR),{invokeHandler:Kh}=cg,{applyNative:de,invokeNative:L,onNative:we,offNative:lg,subscribeHandler:OR,publish:ug,emitNative:hn,subscribe:Iz,unsubscribe:Ez}=cg;globalThis.joliboxJSBridge={callHandler:Kh,invokeHandler:Kh,subscribeHandler:OR}});function qR(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Ga(e){return new Promise(t=>setTimeout(t,e))}function io(e){return typeof e=="string"}function vn(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function vg(e){return typeof e=="object"&&Array.isArray(e)}function Ja(e){return typeof e=="number"&&!isNaN(e)}function Jr(e){return e===!0||e===!1}function yg(e){return typeof e=="undefined"}function oo(e){return yg(e)||e===null}function UR(e){return typeof e=="function"}function bg(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function _g(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:fg(c)&&fg(s)?i[a]=n(hg({},s),c):Array.isArray(c)&&Array.isArray(s)?i[a]=[...s,...c]:i[a]=c}return i}return n(e,t)}function fg(e){return e&&typeof e=="object"&&e.constructor===Object}function wg(e,t){if(Array.isArray(e))return e.concat(t)}function ao(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 FR(e,t){return(...r)=>t(e,...r)}function Yn(e){return t=>FR(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new zt(`${i}`))}})}function eo(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function Cg(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 Iu(){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 VR(e,t,r){let n=window.location.hostname,i=n.split("."),o=r?t:e;if(/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(n))return`${o}.jolibox.com`;if(i.length>=2){let a=i.slice(-2).join(".");if(a==="jolibox.com"||a==="pico-game.com"||a==="joyslite.com"||a==="mporia.com"||a==="pingplus.ai")return`${o}.${a}`}return`${o}.jolibox.com`}function Eu(e){return VR("app","stg-app",e)}function Qn(e){return`https://${Eu(e)}`}function KR(e){return new Promise(t=>Pg(e)(t))}function Pg(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function YR(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new no(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function QR(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ZR(e[n],t[n])}function ZR(e,t){if(io(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(!oo(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 e1(){return typeof globalThis!="undefined"?globalThis[Og]:void 0}function t1(e){typeof globalThis!="undefined"&&(globalThis[Og]=e)}function Y(e=!1){let t=e1();if(!e&&t)return t;let r=new Ba,n=new gu,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 t1(i),i}var vu,RR,dg,NR,DR,pg,hg,LR,gg,gn,pt,MR,yu,so,bu,Sg,zt,Ha,Ig,Va,Eg,Ag,co,_u,Kt,pu,jR,wu,mg,BR,K,Su,GR,Xn,to,lo,JR,HR,kg,xg,Tg,Ft,fu,ge,$R,WR,ro,no,Yt,hu,zR,du,XR,Se,Ba,gu,Og,R=T(()=>{"use strict";vu=Object.defineProperty,RR=Object.getOwnPropertyDescriptor,dg=Object.getOwnPropertySymbols,NR=Object.prototype.hasOwnProperty,DR=Object.prototype.propertyIsEnumerable,pg=(e,t,r)=>t in e?vu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hg=(e,t)=>{for(var r in t||(t={}))NR.call(t,r)&&pg(e,r,t[r]);if(dg)for(var r of dg(t))DR.call(t,r)&&pg(e,r,t[r]);return e},LR=(e,t)=>{for(var r in t)vu(e,r,{get:t[r],enumerable:!0})},gg=(e,t,r,n)=>{for(var i=n>1?void 0:n?RR(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&&vu(t,r,i),i},gn=(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}pt=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))}})}};MR=(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))(MR||{}),yu=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}},so=class extends yu{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},bu=class extends yu{constructor(){super(...arguments),this.kind="USER_ERROR"}},Sg=class extends bu{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},zt=class extends bu{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))}},Ha=class extends bu{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))}},Ig=class extends so{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Va=class extends so{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))}},Eg=class extends so{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_METHOD_ERROR"}},Ag=class extends so{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},co=class extends yu{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}}},_u=class extends so{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Kt={log:eo("log"),warn:eo("warn"),info:eo("info"),error:eo("error"),debug:eo("debug")};Object.assign(globalThis,{logger:Kt});pu=Symbol.for("Jolibox.canIUseMap"),jR={};globalThis[pu]||(globalThis[pu]=jR);wu={get config(){return globalThis[pu]}},mg=Symbol.for("Jolibox.canIUseMap.native"),BR={};globalThis[mg]||(globalThis[mg]=BR);K=(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))(K||{}),Su=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Su||{}),GR=(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))(GR||{}),Xn=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});Iu();to=typeof window=="undefined",lo={isiOS:!to&&(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:!to&&navigator.userAgent.includes("Android"),isMac:!to&&navigator.userAgent.includes("Mac"),isFacebook:!to&&navigator.userAgent.includes("FB_IAB"),isPC:!to&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},JR="device_id",HR="advertising_id",kg=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Xn()),window.__joliboxLocalStorage__.getItem(e)),xg=()=>new URLSearchParams(window.location.search).get("deviceId")||kg(JR),Tg=()=>new URLSearchParams(window.location.search).get("advertisingId")||kg(HR);Ft=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=hg({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return gn(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=>gn(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 gn(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 gn(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return gn(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 gn(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)}},fu=class mu{constructor(t){this.element=t,this.next=mu.Undefined,this.prev=mu.Undefined}};fu.Undefined=new fu(void 0);ge=fu,$R=class{constructor(){this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ge.Undefined}clear(){let e=this._first;for(;e!==ge.Undefined;){let t=e.next;e.prev=ge.Undefined,e.next=ge.Undefined,e=t}this._first=ge.Undefined,this._last=ge.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ge(e);if(this._first===ge.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!==ge.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ge.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ge.Undefined&&e.next!==ge.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ge.Undefined&&e.next===ge.Undefined?(this._first=ge.Undefined,this._last=ge.Undefined):e.next===ge.Undefined?(this._last=this._last.prev,this._last.next=ge.Undefined):e.prev===ge.Undefined&&(this._first=this._first.next,this._first.prev=ge.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ge.Undefined;)yield e.element,e=e.next}},WR=0,ro=class{constructor(e){this.value=e,this.id=WR++}},no=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 ro&&(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 ro(t);return this._listeners?this._listeners instanceof ro?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 ro)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 ro?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Yt=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 no,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 $R,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)}},hu={};LR(hu,{None:()=>zR,filter:()=>YR,once:()=>Pg,toPromise:()=>KR});zR=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});du=Symbol.for("Jolibox.hostEmitter"),XR=()=>{let e=new Yt;return globalThis[du]||(globalThis[du]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[du]},Se=XR();Ba=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new no,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 QR(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}};Ba=gg([bg],Ba);gu=class{constructor(){this._onWillExecuteCommand=new no,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new no,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Ba,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=qR(3e4)),this._starActivation}executeCommand(e,...t){return gn(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),hu.toPromise(hu.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}}};gu=gg([bg],gu);Og=Symbol.for("Jolibox.commands")});function ke(e,t={}){Au.emit("ERROR_REPORT",{error:e,options:t})}var Au,yn,_t=T(()=>{"use strict";R();R();Au=new Yt,yn=new Yt;ke.debounce=ao(ke,50,{leading:!0})});var Cu,r1,Rg,Ng,Dg=T(()=>{"use strict";R();_t();Cu=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{}}},r1=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Rg=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:Cu(o),payloadJson:Cu(a),signature:Cu(s)}}else throw"joli_source is missing"}catch(r){return ke(new Ig(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Ng=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=r1(e),o=r[2];return`${n}.${i}.${o}`}return t}});var n1,ku,Lg=T(()=>{"use strict";R();n1="1.4.16",ku=()=>n1});function Tu(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var i1,qg,xu,Ug,ve,o1,S,$=T(()=>{"use strict";R();Dg();Lg();R();i1={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:xg(),adId:Tg(),pixelRatio:window.devicePixelRatio||1,platform:lo.isAndroid?"android":lo.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:ku()},schema:window.location.href,platform:lo.isAndroid?"android":lo.isiOS?"ios":"h5"},xu=(qg=globalThis.joliboxJSCore)==null?void 0:qg.env,ve=Object.assign({},(Ug=xu==null?void 0:xu())!=null?Ug:i1);o1=()=>{var v,b,y,_,E,C,x,k,A,H,ue;let{payloadJson:e,headerJson:t,signature:r}=ve.schema.length?Rg(ve.schema):{},n=`${ve.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ve.schema.length?ve.schema:window.location.href).searchParams,a=(y=(b=(v=o.get("mpId"))!=null?v:o.get("appId"))!=null?b:o.get("gameId"))!=null?y:"",s=(C=(E=(_=ve.clientSessionId)!=null?_:e==null?void 0:e.sessionId)!=null?E:o.get("sessionId"))!=null?C:n,c=!!((k=(x=e==null?void 0:e.testAdsMode)!=null?x:e==null?void 0:e.__testAdsMode)!=null?k:o.get("testAdsMode")==="true"),l=(ue=(H=(A=e==null?void 0:e.joliboxEnv)!=null?A:e==null?void 0:e.__joliboxEnv)!=null?H:o.get("joliboxEnv"))!=null?ue:"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 N;return(N=performance.timeOrigin)!=null?N:performance.timing.navigationStart},get testMode(){return d},get testAdsMode(){return c},get joliboxEnv(){return l},get joliSource(){var N,O;return(O=(N=f.get("joliSource"))!=null?N:o.get("joliSource"))!=null?O:null},get mpId(){var N;return(N=a!=null?a:e==null?void 0:e.id)!=null?N:""},get mpVersion(){var N;return(N=t==null?void 0:t.ver)!=null?N:ku()},get mpType(){var N,O;return(O=(N=t==null?void 0:t.__mpType)!=null?N:e==null?void 0:e.__mpType)!=null?O:"game"},get platform(){var N;return((N=ve.platform)!=null?N:ve.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ve.deviceInfo},get sdkInfo(){return ve.sdkInfo},get hostInfo(){return ve.hostInfo},get hostUserInfo(){return ve.hostUserInfo},get sessionId(){var N,O;return(O=(N=ve.clientSessionId)!=null?N:s)!=null?O:n},get channel(){return u},get webviewId(){var N;return(N=ve.webviewId)!=null?N:-1},get shouldInterupt(){return m},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Eu(d)},get adId(){var N;return(N=ve.deviceInfo.adId)!=null?N:ve.deviceInfo.did},get language(){return ve.deviceInfo.lang},get sdkEnvironment(){return Tu("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Tu("gamedistribution","jolibox")?"gamedistribution":Tu("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var J,V,Mt;let N=(J=ve.deviceInfo.pixelRatio)!=null?J:1,O=(V=ve.deviceInfo.statusBarHeight)!=null?V:e==null?void 0:e.__androidStatusBarHeight,F=(Mt=ve.deviceInfo.navigationBarHeight)!=null?Mt:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:O!==void 0?O/N:20,navigationBarHeight:F!==void 0?F/N:10}},get abTests(){var N,O;return(O=(N=ve.abValues)==null?void 0:N.split(","))!=null?O:[]},get mpInfo(){var N;return(N=ve.mpInfo)!=null?N:{mpName:"unknown"}},onEnvConfigChanged:N=>{_g(ve,N,wg)},encodeJoliSourceQuery:N=>{var O,F;return t&&r?Ng(P(P({},e),N),(O=o.get("joliSource"))!=null?O:""):(F=o.get("joliSource"))!=null?F:""},setDoExitDirectly:()=>{m=!1}}},S=o1()});var Pu,Fg,a1,s1,Mg,c1,jg=T(()=>{"use strict";R();_t();$();R();Pu=!1,Fg=(e,t)=>e==null?!1:t in e,a1=e=>Fg(e,"kind"),s1=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Mg=(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:s1(e.name)},i=B(P({},n),{env:t.environment,isFromUser:r});r?yn.emit("GLOBAL_USER_ERROR",e,i):yn.emit("GLOBAL_ERROR",e,i)},c1=e=>Fg(e,"kind")&&e.kind==="USER_ERROR";Au.on("ERROR_REPORT",({error:e,options:t})=>{if(Pu)return;Pu=!0;let r=a1(e)&&e.raw?e.raw:e;try{let n=c1(e);Mg(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new _u(`${i}, origin error: ${r.message}`);Kt.error(o),Mg(new _u(o.message),{environment:t.environment},!1)}finally{Pu=!1}})});var xe,Ou,Hr=T(()=>{"use strict";_t();R();_t();xe=(e,t)=>{var r,n;return new co((n=(r=t==null?void 0:t.errMsg)!=null?r:e.msg)!=null?n:"",e.code,e.type)},Ou=e=>new Sg(e)});var Bg=T(()=>{"use strict";jg();Hr();R();ce();yn.on("GLOBAL_ERROR",(e,t)=>{var n;let r={message:e.message,stack:(n=e.stack)!=null?n:"",errorType:e.name,source:0};L("trackAsync",{event:"reportJsError",data:r})});yn.on("GLOBAL_USER_ERROR",(e,t)=>{Kt.log("UserError",e,t)})});var Ru=T(()=>{"use strict"});function Gg(e,t){let r=(n,i,o)=>{let l=i!=null?i:{},{eventType:a}=l,s=Qe(l,["eventType"]),c=B(P({tag:n,eventType:o!=null?o:a!=null?a:K.Other},t),{extra:P({},s)});n=="globalJsError"?ke(new Ag(JSON.stringify(c))):e("systemLog",c,S.webviewId)};return r.debounce=ao(r,500,{leading:!0}),r}function Jg(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=ao(t,500,{leading:!0}),t}var Hg=T(()=>{"use strict";R();R();_t();$()});function Vg(e,t){let r=Gg(e,t),n=Jg(r);return{track:r,trackPerformance:n}}var $g=T(()=>{"use strict";Hg()});var Wg=T(()=>{"use strict";$();R();R()});var zg=T(()=>{"use strict";$g();Ru();Wg()});var $a,Kg=T(()=>{"use strict";$a=class{constructor(t,r){this.eventEmitter=t;this.lastReportTime=0;this.visible=!0;this.reportCount=0;this.notifyIframeGameEvent=(t,r)=>{let n=window.parent;n&&n!==window&&typeof n.postMessage=="function"&&n.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 Wa(e,t,r){var c,l,d;let n=new Map,i=(c=r==null?void 0:r.baseUrl)!=null?c:Qn(S.testMode),o=(l=r==null?void 0:r.type)!=null?l:"public",a=(d=r==null?void 0:r.defaultHeaders)!=null?d:{};return we("onRequestTaskStateChange",u=>{if(typeof u.requestTaskId!="string")return;let p=n.get(u.requestTaskId);if(p)if(u.state==="success"){let f=u,{requestTaskId:v,state:b}=f,y=Qe(f,["requestTaskId","state"]);u.statusCode===200?p.resolve(y):p.reject(y),n.delete(v)}else if(u.state==="fail"){let m=u,{requestTaskId:v,state:b}=m,y=Qe(m,["requestTaskId","state"]);p.reject(y),n.delete(v)}else Kt.warn("onRequestTaskStateChange unknown event",u)}),Se.on("onLoginComplete",({isLogin:u,token:p})=>{o!=="public"&&u&&p&&(a["X-JOLI-TOKEN"]=p)}),(f,...m)=>g(this,[f,...m],function*(u,p={}){let v=Date.now(),b=l1(u,B(P({},p),{baseUrl:i})),{method:y="GET",responseType:_="text",dataType:E="json",timeout:C,enableCache:x=!1,appendHostCookie:k=!0}=p,A=Object.assign({"content-type":"application/json"},a,p.header),H={url:b,method:y,header:A,enableCache:x,responseType:_,appendHostCookie:k};if(y=="POST"||y=="PUT"){let J=d1(p.data,A["content-type"]);H.data=J}C&&Object.assign(H,{timeout:C});let{data:{requestTaskId:ue}}=L(e,H);if(typeof ue!="string")throw xe({code:-1,msg:"requestTaskId is not a string"});let{resolve:N,reject:O,promise:F}=new pt;n.set(ue,{resolve:N,reject:O});try{let J=yield F,{data:V}=J;return E==="json"&&typeof V=="string"&&(V=u1(V)),{url:b,timeout:C,method:y,response:B(P({},J),{data:V})}}catch(J){let V=J;if(vn(V)){let{errMsg:Mt,prefetchDetail:Mh,isPrefetch:Wl,errNo:Oa}=V;io(Mt)&&ke(xe({code:-1,msg:Mt},{errNo:Oa,errMsg:Mt}))}throw J}})}function u1(e){try{return JSON.parse(e.trim())}catch(t){return e}}function d1(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 l1,Nu=T(()=>{"use strict";R();ce();_t();Hr();$();l1=(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 Du,Yg,X,ft=T(()=>{"use strict";Nu();$();R();Du={};(Yg=S.hostUserInfo)!=null&&Yg.token&&(Du["x-joli-token"]=S.hostUserInfo.token);S.joliSource&&(Du["x-joli-source"]=S.joliSource);X=Wa("createRequestTaskSync","operateRequestTaskSync",{type:"inner",baseUrl:Qn(S.testMode),defaultHeaders:Du})});function Xg(e){let t=wu.config[e];return t||(t={},wu.config[e]=t),(r,n)=>{if(t[r]){Kt.warn(`[can i use] ${r} already registered`);return}t[r]=P({},n)}}var Qg=T(()=>{"use strict";R()});function Lu(e){Zg=e}function za(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>za(t)):Object.keys(e).reduce((t,r)=>(t[r]=za(e[r]),t),{})}function vr(e){return typeof e=="number"}function qu(e){let t=Uu(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function Uu(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var Zg,Oe,Ka,Ya,Xa,Qa,Zn,Za,es,ts,rs,ns,is,os,as,ss,cs,ls,us,Mu=T(()=>{"use strict";Zg=!1;Oe=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(Zg)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 ${qu(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return za(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:za(this._default)}optional(){return this._optional=!0,this}};Ka=class extends Oe{validate(t){return this._optional&&t===void 0?!0:vr(t)?vr(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):vr(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):vr(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}},Ya=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Xa=class extends Oe{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(vr(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(vr(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}},Qa=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},Zn=class extends Oe{validate(t){return!0}},Za=class extends Oe{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},es=class extends Oe{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},ts=class extends Oe{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},rs=class extends Oe{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 ${qu(t)}`)}return!0}},ns=class extends Oe{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(vr(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(vr(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(vr(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}},is=class extends Oe{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(Uu(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}},os=class extends Oe{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(Uu(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}},as=class extends Oe{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:qu(this.value),actual:r}):!0}},ss=class extends Oe{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}},cs=class extends Oe{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}},ls=class extends Oe{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},us=class extends Oe{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 Fu(e,t,r="param"){if(e.errors=[],e.path=r,Lu(!0),!e.validate(t)){let n=e.errors.join(`
3
3
  `);throw e.errors.length=0,Lu(!1),new TypeError(n)}}var I,ju=T(()=>{"use strict";Mu();Mu();I={object(e){return new os(e)},array(e){return new ns(e)},tuple(...e){return new cs(...e)},literal(e){return new as(e)},or(...e){return new ss(...e)},symbol(){return new Qa},record(e){return new is(e)},function(){return new ts},boolean(){return new Ya},string(){return new Xa},number(){return new Ka},undefined(){return new Za},null(){return new es},unknown(){return new Zn},any(){return new Zn},as(){return new Zn},arraybuffer(){return new ls},enum(...e){return new rs(...e)},typedarray(e){return new us(e)}}});var ds,ev,tv=T(()=>{"use strict";R();_t();ju();Hr();ds=1,ev=e=>{function t(n,i){return(...o)=>{var u,p,f,m;let a=Date.now(),s={method:n,trace_id:ds};ds+=1;let c="SUCCESS",l=`${n}:ok`,d=0;try{if(i.paramsSchema)try{Fu(i.paramsSchema,o,"params")}catch(_){throw Ou(`${n}:fail ${_.message}`)}let v=i.implement(...o),b=v,y=`${n}:ok`;if(v&&"code"in v){let{code:_,data:E,message:C}=v;c=_,b=E,y=C}return{code:c,message:y,data:b}}catch(v){let b=v;d=(p=(u=b.code)!=null?u:b.errNo)!=null?p:2e3,c="FAILURE";let y=(m=(f=b.message)!=null?f:b.errMsg)!=null?m:`${v}`;return l=`${n}:${c} ${y.replace(/^\S+:(fail|cancel)\s?/,"")}`,ke(new co(l,d)),{code:c,message:l}}finally{let v=Date.now()-a}}}function r(n,i){return(...o)=>g(this,null,function*(){var p,f,m,v;let a=vg(o)?o:[o],s=Date.now(),c={method:n,trace_id:ds};ds+=1;let l=`${n}:ok`,d="SUCCESS",u={code:d,message:l};try{if(i.paramsSchema)try{Fu(i.paramsSchema,a,"params")}catch(_){throw Ou(_.message)}let y=yield i.implement(...a);if(y&&"code"in y){let{code:_,data:E,message:C}=y;d=_,l=C,y=E}return Object.assign(u,{code:d,message:l,data:y}),u}catch(b){let y=b,_=(f=(p=y.code)!=null?p:y.errNo)!=null?f:2e3;d="FAILURE";let E=(v=(m=y.message)!=null?m:y.errMsg)!=null?v:`${b}`,C=`${n}:${d} ${E.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(u,{code:d,message:C}),ke(new co(C,_)),u}finally{let b=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var ye,ps=T(()=>{"use strict";$();ce();({canIUseNative:ye}=ja(()=>S.sdkInfo.nativeSDKVersionCode,()=>S.platform))});function Bu(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 rv=T(()=>{"use strict"});var z,Q,D,Ve=T(()=>{"use strict";Qg();wt();tv();ju();ps();rv();({createAPI:z,createSyncAPI:Q}=ev(j)),D=Xg("native")});function nv(e){let t=Object.prototype.toString.call(e).split(" ")[1].split("]")[0].toLocaleLowerCase();return t==="array"&&(t="object"),v1.includes(t)?t:""}function iv(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 ov(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 fs,f1,m1,h1,g1,Q6,Z6,v1,Vr,St,uo=T(()=>{"use strict";Ve();ce();R();ft();$();fs=Y(),f1=z("getLocalStorage",{paramsSchema:I.tuple(I.string()),implement(e){return g(this,null,function*(){let{response:t}=yield X(`/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 de("getLocalStorageAsync",{key:e}),s=iv(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}}})}});fs.registerCommand("StorageSDK.getItem",f1);D("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});m1=z("setStorage",{paramsSchema:I.tuple(I.string(),I.or(I.string(),I.boolean(),I.number())),implement(e,t){return g(this,null,function*(){let r=S.mpId,n=typeof t=="string"?t:String(t),{response:i}=yield X(`/api/games/user-storage/${r}`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e,value:n}}),{data:{code:o,message:a}}=i,s=nv(t),c=ov(t,s);return yield de("setLocalStorageAsync",{key:e,data:c,dataType:s}),o=="SUCCESS"?{code:o,message:a}:{code:o,message:`${a}. fallback to native`}})}});fs.registerCommand("StorageSDK.setItem",m1);D("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});h1=z("removeStorage",{paramsSchema:I.tuple(I.string()),implement(e){return g(this,null,function*(){let t=S.mpId,{response:r}=yield X(`/api/games/user-storage/${t}/remove`,{method:"POST",responseType:"json",appendHostCookie:!0,data:{key:e}}),{data:{code:n,message:i}}=r;return yield de("removeLocalStorageAsync",{key:e}),n==="SUCCESS"?{code:n,message:i}:{code:n,message:"[Jolibox SDK] remove item succ"}})}});fs.registerCommand("StorageSDK.removeItem",h1);D("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});g1=z("clearStorage",{implement(){return g(this,null,function*(){let e=S.mpId,{response:t}=yield X(`/api/games/user-storage/${e}/clear`,{method:"POST",appendHostCookie:!0});de("clearLocalStorageAsync");let{data:{code:r,message:n}}=t;return r==="SUCCESS"?{code:r,message:n}:{code:r,message:`${n}.fallback to native`}})}});fs.registerCommand("StorageSDK.clear",g1);D("storage.clear",{version:"1.0.0"});Q6=z("getStorageInfo",{implement(){return g(this,null,function*(){let{data:e}=yield de("getStorageInfoAsync");return e})}});D("getStorageInfo",{version:"1.0.0",success:{keys:"1.0.0",currentSize:"1.0.0",limitSize:"1.0.0"}});Z6=Q("getStorageInfoSync",{implement(){return L("getStorageInfoSync")}}),v1=["string","number","boolean","object",""];Vr=z("getGlobalStorage",{paramsSchema:I.tuple(I.string()),implement(e){return g(this,null,function*(){try{let{data:{data:t,dataType:r}}=yield de("getGlobalStorageAsync",{key:e});return{code:"SUCCESS",message:"success",data:iv(t,r)}}catch(t){return{code:"INTERNAL_ERROR",message:"[Jolibox SDK] get global storage failed",data:null}}})}}),St=z("setGlobalStorage",{paramsSchema:I.tuple(I.string(),I.or(I.string(),I.boolean(),I.number(),I.array())),implement(e,t){return g(this,null,function*(){try{let r=nv(t),n=ov(t,r);return yield de("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 av,ms,sv=T(()=>{"use strict";$();Kg();R();ft();ce();uo();ps();av="REPORT_FIRST_OPEN_GAME",ms=class extends $a{constructor(r,n,i){super(n,i);this.started=!1;this.gameId=S.mpId,this.sessionId=S.sessionId,this.track=r,this.taskUrl=Qn(S.testMode)+"/api/base/app-event"}reporter(r){return g(this,null,function*(){let{event:n,params:i,extraParams:o}=r,a={eventType:n,gameInfo:P({gameId:this.gameId,sessionId:this.sessionId},i)};o&&Object.assign(a,o),yield this.createTask(a)})}reportToNative(r){return g(this,null,function*(){let{event:n,params:i}=r;yield de("userTrackAsync",{event:n,params:P({},i),gameId:this.gameId})})}tracker(r,n=null){this.track(r,n)}start(r){if(this.started){console.info("[JoliboxSDK] taskTrakcer has started");return}super.start(r),this.tryReportOpenGamePlus(),this.started=!0}tryReportOpenGamePlus(){Vr(av).then(r=>{Jr(r.data)&&r.data&&this.tracker("OpenGame_2Plus"),St(av,!0)})}createTask(r){return ye("sendServerEventAsync")?de("sendServerEventAsync",{payload:r}):S.platform==="android"?X("/api/base/app-event",{method:"POST",data:r}):de("trackAppEventAsync",{url:this.taskUrl,body:JSON.stringify(r)})}}});var pv={};Bh(pv,{nativeTaskEmitter:()=>po,taskTracker:()=>It,track:()=>j,trackPerformance:()=>uv});var y1,cv,lv,j,uv,dv,po,It,wt=T(()=>{"use strict";Bg();R();Ru();zg();$();sv();ce();y1=(e,t,r)=>{var l,d,u,p,f,m,v;let n=t,i=vn(n.extra)?n.extra:io(n.extra)?JSON.parse(n.extra):{},{mpName:o,mpVersion:a}=(l=S.mpInfo)!=null?l:{},s=P(P(B(P({},i),{mp_id:(d=n.mp_id)!=null?d:"",mp_version:(u=n.mp_version)!=null?u:"",session_id:S.sessionId,user_id:(f=(p=S.hostUserInfo)==null?void 0:p.uid)!=null?f:""}),o?{mp_name:o}:{}),a?{mp_info_version:a}:{}),c=(m=n.eventType)!=null?m:K.Other;L("trackAsync",{event:(v=t.tag)!=null?v:e,data:s,webviewId:r,eventType:c})},{track:j,trackPerformance:uv}=Vg(y1,{type:Su.AppSDK,platform:"native",jssdk_version:(lv=(cv=S.sdkInfo)==null?void 0:cv.jssdkVersion)!=null?lv:"1.0.0",mp_id:S.mpId,mp_version:S.mpVersion}),dv=Y();dv.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{uv(e,t,r)});dv.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{j(e,t)});po=new Yt,It=new ms(j,po)});function fv(){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
- `,h4=()=>w("div",{style:zC.container,children:[w("style",{children:m4}),w("div",{style:zC.spinner})]});gee=Rn()});function $k(){return g(this,null,function*(){if(Nf)return Nf;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 X(t);return Nf=r,r})}function Wk(){return g(this,null,function*(){let e=new pt;if(S.mpType!=="game")return e.resolve(!1),e.promise;if(Df)return e.resolve(!0),e.promise;let t=yield $k();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:i}=t.data;Df=!0;let o={domain:"GAME",buttons:t.data.buttons.map(s=>`${s.type}-${s.text}`).join(","),list:r.games.map(s=>s.gameId).join(",")};j("RecommendedGuide",P({eventType:K.View},o));let a=Tk({games:r.games,title:n,buttons:i,onClose:s=>{var c;switch(Df=!1,s.type){case"quit":j("RecommendedGuide",{eventType:K.Click,type:"QUIT",domain:"GAME"}),e.resolve(!1);break;case"dismiss":j("RecommendedGuide",P({eventType:K.Hide},o)),e.resolve(!0),a.destroy();break;case"navigate":if((c=s.data)!=null&&c.game){let l=s.data.game;g4(l),j("GameItem",{eventType:K.Click,gameId:l.gameId,layerName:"RecommendedGuide",domain:"GAME"}),setTimeout(()=>{e.resolve(!1)},0)}else e.resolve(!0);a.destroy();break;default:j("RecommendedGuide",P({eventType:K.Hide},o)),e.resolve(!0);break}}});return e.promise})}var Nf,g4,Df,zk=T(()=>{"use strict";$();ce();R();cr();ft();wt();Nf=null;$k();g4=e=>{var a;let{data:t}=L("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()}`;L("openSchemaSync",{schema:o})},Df=!1});function y4(e){let t=P(P({},v4),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:_,containerTransition:E,iframeTransition:C}=p();fe=document.createElement("div"),fe.id="jolibox-modal-overlay",fe.style.cssText=`position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); z-index:1000; display:flex; justify-content:center; align-items:flex-end; transition:${_}; opacity:0; visibility:hidden;`,oe=document.createElement("div"),oe.id="jolibox-modal-container",oe.style.cssText=`width:100%; height:${n}; background:white; border-radius:12px 12px 0 0; overflow:hidden; box-shadow:0 -2px 10px rgba(0,0,0,0.2); transform:translateY(100%); transition:${E};`;let x=document.createElement("div");x.id="jolibox-modal-loading",x.style.cssText="position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); width:40px; height:40px; border:4px solid #f3f3f3; border-top:4px solid #3498db; border-radius:50%; animation:spin 1s linear infinite;";let k=document.createElement("style");k.textContent="@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }",document.head.appendChild(k);let A=document.createElement("div");if(A.style.cssText="width:100%; height:100%; display:flex; flex-direction:column; padding-bottom:env(safe-area-inset-bottom, 0); position:relative;",Lt=document.createElement("iframe"),Lt.style.cssText=`width:100%; flex:1; border:none; opacity:0; transition:${C};`,Lt.src=r,Lt.onload=()=>{x.parentNode&&x.parentNode.removeChild(x),Lt.style.opacity="1",v(),c==null||c(),Se.emit("onModalIframeLoaded",{url:r})},A.appendChild(Lt),A.appendChild(x),oe.appendChild(A),i){let H=document.createElement("div");H.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;",H.innerHTML="\u2715",H.onclick=y,oe.appendChild(H)}fe.appendChild(oe),document.body.appendChild(fe),fe.addEventListener("click",function(H){H.target===fe&&y()}),o&&b()}function v(){!fe||!oe||u||(fe.style.visibility="visible",a?requestAnimationFrame(()=>{fe&&(fe.style.opacity="1"),oe&&(oe.style.transform="translateY(0)"),u=!0}):(fe&&(fe.style.opacity="1"),oe&&(oe.style.transform="translateY(0)"),u=!0),L("updateContainerConfigSync",{displayCapsuleButton:!1,webviewId:S.webviewId}))}function b(){if(!oe)return;let _=x=>{l=x.touches[0].clientY},E=x=>{if(!u)return;d=x.touches[0].clientY;let k=d-l;k>0&&(oe&&(oe.style.transition="none",oe.style.transform=`translateY(${k}px)`),x.preventDefault())},C=()=>{!u||!oe||(oe.style.transition=a?"transform 0.3s ease":"none",d-l>80?y():oe.style.transform="translateY(0)")};oe.addEventListener("touchstart",_),oe.addEventListener("touchmove",E),oe.addEventListener("touchend",C)}function y(){!fe||!oe||!u||(a?(oe.style.transform="translateY(100%)",fe.style.opacity="0"):fe.style.visibility="hidden",u=!1,L("updateContainerConfigSync",{displayCapsuleButton:!0,webviewId:S.webviewId}),setTimeout(()=>{fe&&(fe.remove(),fe=null,oe=null,Lt=null,s==null||s(),Se.emit("onModalIframeClosed",{url:r}))},f()))}return m(),{close:y}}function Kk(){return window.joliboxUI=B(P({},window.joliboxUI),{createIframeModal:y4}),()=>{window.joliboxUI=void 0,fe&&fe.parentNode&&fe.parentNode.removeChild(fe),oe&&oe.parentNode&&oe.parentNode.removeChild(oe),Lt&&Lt.parentNode&&Lt.parentNode.removeChild(Lt),fe=null,oe=null,Lt=null}}var v4,fe,oe,Lt,Yk=T(()=>{"use strict";ce();$();R();v4={height:"50%",showCloseButton:!0,enableDragClose:!0,useAnimation:!0},fe=null,oe=null,Lt=null});var rx,jc,qf,Bc,Ti,nx,Pi,ix,ox,ax,xi,Xk,Fc,Qk,b4,sx,Uf,Zk,cx,_4,ex,Lf,lx,tx,w4,ux,dx=T(()=>{rx=-1,jc=function(e){addEventListener("pageshow",function(t){t.persisted&&(rx=t.timeStamp,e(t))},!0)},qf=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Bc=function(){var e=qf();return e&&e.activationStart||0},Ti=function(e,t){var r=qf(),n="navigate";return rx>=0?n="back-forward-cache":r&&(document.prerendering||Bc()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},nx=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){t(i.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},Pi=function(e,t,r,n){var i,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=o,t.rating=function(s,c){return s>c[1]?"poor":s>c[0]?"needs-improvement":"good"}(t.value,r),e(t))}},ix=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},ox=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},ax=function(e){var t=!1;return function(){t||(e(),t=!0)}},xi=-1,Xk=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Fc=function(e){document.visibilityState==="hidden"&&xi>-1&&(xi=e.type==="visibilitychange"?e.timeStamp:0,b4())},Qk=function(){addEventListener("visibilitychange",Fc,!0),addEventListener("prerenderingchange",Fc,!0)},b4=function(){removeEventListener("visibilitychange",Fc,!0),removeEventListener("prerenderingchange",Fc,!0)},sx=function(){return xi<0&&(xi=Xk(),Qk(),jc(function(){setTimeout(function(){xi=Xk(),Qk()},0)})),{get firstHiddenTime(){return xi}}},Uf=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},Zk=[1800,3e3],cx=function(e,t){t=t||{},Uf(function(){var r,n=sx(),i=Ti("FCP"),o=nx("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-Bc(),0),i.entries.push(s),r(!0)))})});o&&(r=Pi(e,i,Zk,t.reportAllChanges),jc(function(a){i=Ti("FCP"),r=Pi(e,i,Zk,t.reportAllChanges),ix(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})},_4=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=ax(e),document.visibilityState==="hidden"?e():(r=t(e),ox(e)),r},ex=[2500,4e3],Lf={},lx=function(e,t){t=t||{},Uf(function(){var r,n=sx(),i=Ti("LCP"),o=function(c){t.reportAllChanges||(c=c.slice(-1)),c.forEach(function(l){l.startTime<n.firstHiddenTime&&(i.value=Math.max(l.startTime-Bc(),0),i.entries=[l],r())})},a=nx("largest-contentful-paint",o);if(a){r=Pi(e,i,ex,t.reportAllChanges);var s=ax(function(){Lf[i.id]||(o(a.takeRecords()),a.disconnect(),Lf[i.id]=!0,r(!0))});["keydown","click"].forEach(function(c){addEventListener(c,function(){return _4(s)},{once:!0,capture:!0})}),ox(s),jc(function(c){i=Ti("LCP"),r=Pi(e,i,ex,t.reportAllChanges),ix(function(){i.value=performance.now()-c.timeStamp,Lf[i.id]=!0,r(!0)})})}})},tx=[800,1800],w4=function e(t){document.prerendering?Uf(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},ux=function(e,t){t=t||{};var r=Ti("TTFB"),n=Pi(e,r,tx,t.reportAllChanges);w4(function(){var i=qf();i&&(r.value=Math.max(i.responseStart-Bc(),0),r.entries=[i],n(!0),jc(function(){r=Ti("TTFB",0),(n=Pi(e,r,tx,t.reportAllChanges))(!0)}))})}});var gx={};Bh(gx,{config:()=>R4});function I4(){bn.on("isAdShowing",e=>{Hc=e,Jr(Hc)&&S.mpType==="game"&&L("updateContainerConfigSync",{displayCapsuleButton:!Hc,webviewId:S.webviewId})})}function E4(){Se.on("onInterceptSystemExit",({intercept:e})=>{fx=e})}function A4(){Se.on("onInterceptBackPress",({intercept:e})=>{S4=e}),we("onBeforeBackPress",({uuid:e,disableExitRecommendDialog:t})=>{var r,n;hx(t),Se.emit("onBackPress",{}),(n=(r=globalThis.joliboxJSCore)==null?void 0:r.doBackPress)==null||n.call(r,e)})}function C4(){Se.on("onDocumentReady",()=>{var e;(e=globalThis.joliboxJSCore)==null||e.onDocumentReady(window.location.href),j("onDocumentReady",{start_timestamp:$c,timestamp:Date.now()})})}function k4(){we("onI18nChanged",({language:e})=>{Se.emit("onI18nChanged",{i18n:e})})}function px(e){S.mpType==="game"&&It.start(e)}function x4(){we("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&S.onEnvConfigChanged({hostUserInfo:e}),Se.emit("LifecycleEvent.onReady",P({},S.hostUserInfo?S.hostUserInfo:{isLogin:!1})),j("joliboxServiceReady",{start_timestamp:$c,timestamp:Date.now()}),ye("onJoliboxHideLoading")||px(t),Ik(()=>S.language)}),we("onBeforeExit",({uuid:e,disableExitRecommendDialog:t})=>{var r;hx(t),(r=globalThis.joliboxJSCore)==null||r.doExit(e)}),we("onJoliboxHideLoading",({duration:e})=>{px(e)})}function T4(){let e=()=>{j("onBeforeExit",{timestamp:Date.now()}),Gc==null||Gc(),Jc==null||Jc(),It.close(Date.now()-$c)},t=()=>Hc||fx;Rt.onDoExit(()=>g(this,null,function*(){return t()?!0:S.platform==="ios"?(e(),!1):Jr(S.shouldInterupt)?(S.shouldInterupt||e(),S.shouldInterupt):Vc!=null&&Vc.canShowRecommended&&!mx&&(yield Wk())?!0:(e(),!1)})),Rt.onDoBackPress(()=>g(this,null,function*(){return!!t()}))}function P4(){cx(e=>{j("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),lx(e=>{j("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),ux(e=>{j("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function O4(){return g(this,null,function*(){try{let e="/api/fe-configs/js-sdk/basic-meta",{response:{data:t}}=yield X(e);t&&(Vc=t)}catch(e){console.error("fetchMetaConfig error:",e)}})}function R4(){$c=Date.now(),x4(),I4(),E4(),A4(),T4(),C4(),k4(),O4(),P4(),Jc=Kk(),Gc=fv()}var Gc,Jc,$c,Hc,Vc,fx,S4,mx,hx,vx=T(()=>{"use strict";ce();$();R();wt();mv();hs();zk();ft();cr();Yk();dx();ps();Hc=!1,Vc=null,fx=!1,S4=!1,mx=!1,hx=e=>{Jr(e)&&(mx=e)};Rt.onReady(()=>{})});var yx,N4,D4,L4,q4,bx=T(()=>{"use strict";R();Ve();ce();$();yx=Y(),N4="env",D4="getSystemInfoSync",L4=Q(D4,{implement:()=>{var r;let e=L("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}}}}),q4=Q(N4,{implement:()=>{var t;let e=L("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});yx.registerCommand("API.getSystemInfoSync",L4);yx.registerCommand("API.env",q4);D("env",{version:"1.0.0"});D("getSystemInfoSync",{version:"1.0.0",properties:{viewport:"1.0.33"}})});var _x=h(Mf=>{"use strict";R();Ve();_t();ce();wt();$();var U4="exitGame",M4="onReady",F4="onJoliboxShow",j4="onJoliboxHide",Wc=Y(),zc=Yn(ke),B4=z(U4,{paramsSchema:I.tuple(I.function(),I.boolean().optional().default(!1)),implement:(e,t=!1)=>g(Mf,null,function*(){zc(e).call(Mf),Jr(S.shouldInterupt)&&!S.shouldInterupt&&S.from&&ug("onRetentionResult",{shouldStay:t},S.from,!0),t||S.setDoExitDirectly(),yield de("exitAppAsync")})}),G4=Q(F4,{paramsSchema:I.tuple(I.function()),implement(e){let t=zc(e);we("onJoliboxEnterForeground",()=>{t.call(this),po.emit("visible",!0)})}}),J4=Q(j4,{paramsSchema:I.tuple(I.function()),implement(e){let t=zc(e);we("onJoliboxEnterBackground",()=>{t.call(this),po.emit("visible",!1)})}}),H4=Q(M4,{paramsSchema:I.tuple(I.function()),implement(e){let t=zc(e);Se.on("LifecycleEvent.onReady",r=>{t(r)})}});Wc.registerCommand("LifecycleSDK.exit",B4);Wc.registerCommand("LifecycleSDK.onReady",H4);Wc.registerCommand("LifecycleSDK.onJoliboxShow",G4);Wc.registerCommand("LifecycleSDK.onJoliboxHide",J4);D("lifeCycle.exit",{version:"1.0.0"});D("lifeCycle.onReady",{version:"1.0.0"});D("lifeCycle.onJoliboxShow",{version:"1.0.0"});D("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function wx(e){let t={};if(!vn(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 Sx(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 Ix(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Ex(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!vn(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 Ax=T(()=>{"use strict";R()});var V4,$4,Ff,jf,Cx,W4,z4,K4,kx=T(()=>{"use strict";Hr();Nu();Ve();Ax();R();_t();$();V4=15,$4=Wa("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:S.baseApiHost}),Ff=0,jf=[],Cx=Yn(ke),W4=(e,t)=>{let r=e.filter(t),n=e.filter(i=>!t(i));return e.length=0,e.push(...n),r},z4=e=>{let t=new pt,r=()=>{};return Q("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=()=>g(this,null,function*(){var s,c,l;let a=Cx(i.fail);try{if(Ff+=1,t.state!=="pending")return;let{data:d,dataType:u,responseType:p,enableCache:f,appendHostCookie:m}=i,v=wx((s=i.headers)!=null?s:{}),b=Sx(i.method),y=Ix(i.timeout),_=Ex(i.url,b,d),E=Cx(i.success),C=Object.assign({},i,{method:b,header:m?void 0:v,data:b==="GET"||b==="HEAD"?void 0:d,enableCache:f,query:(c=i.query)!=null?c:{},dataType:u,responseType:p,appendHostCookie:m});y&&(C.timeout=y);let x=$4(_,C);{let{response:k}=yield x,{code:A,data:H,message:ue}=k;if(H&&typeof H=="object"&&"status"in H&&H.status!==200)throw xe({code:H.status||-1,msg:`request:fail status ${H.status}`});t.resolve({code:A!=null?A:"SUCCESS",data:H,message:ue!=null?ue:"request:ok"}),E({code:"SUCCESS",message:"request:ok",data:H})}}catch(d){t.reject(d),a({code:"FAILURE",message:"httpRequst: failed"})}finally{Ff-=1,(l=jf.shift())==null||l()}});return Ff>=V4?(r=()=>{W4(jf,a=>a===o)},jf.push(o)):o(),t.promise}})(e),{abort(){t.reject(xe({code:-1,msg:"request:fail abort"})),r()}}},K4=Y();K4.registerCommand("HttpSDK.request",z4);D("request",{version:"1.0.0"})});var Y4,X4,Q4,Bf,xx=T(()=>{"use strict";R();ce();Ve();Y4=Q("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)),L("showKeyboardSync",B(P({},e),{defaultValue:r,maxLength:t}))}});D("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"}});X4=Q("updateKeyboard",{paramsSchema:I.tuple(I.object({value:I.string()})),implement(e){L("updateKeyboardSync",e)}});D("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});Q4=Q("hideKeyboard",{implement(){L("hideKeyboardSync")}});D("keyboard.hideKeyboard",{version:"1.0.0"});Bf=Y();Bf.registerCommand("KeyboardSDK.showKeyboard",Y4);Bf.registerCommand("KeyboardSDK.updateKeyboard",X4);Bf.registerCommand("KeyboardSDK.hideKeyboard",Q4)});var Ox=h(Oi=>{"use strict";R();Ve();wt();ce();$();var la=Y(),Kc=null,Gf=!1,Tx=0,Z4=200;function eV(e){hn("cpUpdateScoreEvent",e,S.webviewId)}function Px(e){Kc=e,Gf||(Gf=!0,requestAnimationFrame(function t(){let r=Date.now();r-Tx>=Z4?(Kc!==null&&(eV(Kc),Tx=r,Kc=null),Gf=!1):requestAnimationFrame(t)}))}function Jf(e,t){return ye("notifyTaskGameInfoAsync")?L("notifyTaskGameInfoAsync",{event:e,inGameInfo:t}):It.reporter({event:e,extraParams:{inGameInfo:t}})}var tV=z("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=>g(Oi,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e,a=[];a.push(It.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})),a.push(Jf("COMPLETE_GAME_LEVEL",{levelId:t,duration:r,rating:n,score:i})),Px({levelId:t,duration:r,rating:n,score:i}),yield Promise.all(a)})}),rV=z("gamePlayEnded",{paramsSchema:I.tuple(I.object({duration:I.number().optional(),rating:I.number().optional(),score:I.number(),variation:I.string().optional()})),implement:e=>g(Oi,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e,o=[];o.push(It.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i})),o.push(Jf("GAME_ENDED",{duration:t,rating:r,score:n})),Px({duration:t,rating:r,score:n}),yield Promise.all(o)})}),nV=z("levelUpgrade",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number()),name:I.string().optional()})),implement:r=>g(Oi,[r],function*({levelId:e,name:t}){let n=[];n.push(It.tracker("LevelUpgrade",{name:t,levelId:e})),n.push(Jf("GAME_LEVEL_UP",{levelId:e,levelName:t})),hn("cpUpdateScoreEvent",{levelId:e},S.webviewId),yield Promise.all(n)})}),iV=z("levelStart",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number())})),implement:e=>g(Oi,null,function*(){let{levelId:t}=e;yield It.tracker("LevelStart",{levelId:t})})}),oV=z("levelFailed",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number()),score:I.number().optional(),rating:I.number().optional(),duration:I.number().optional()})),implement:e=>g(Oi,null,function*(){let{levelId:t,score:r,rating:n,duration:i}=e;yield It.tracker("LevelFailed",{levelId:t,score:r,rating:n,duration:i})})});la.registerCommand("TaskTrackerSDK.levelFinished",tV);la.registerCommand("TaskTrackerSDK.gamePlayEnded",rV);la.registerCommand("TaskTrackerSDK.levelUpgrade",nV);la.registerCommand("TaskTrackerSDK.levelStart",iV);la.registerCommand("TaskTrackerSDK.levelFailed",oV);D("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"}}});D("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});D("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});D("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});D("TaskTrackerSDK.onLevelFailed",{version:"1.3.8",properties:{params:{levelId:"1.3.8",score:"1.3.8",rating:"1.3.8",duration:"1.3.8"}}})});var Hf,Vf,$f,aV,Rx,Yc=T(()=>{"use strict";$();ce();Ve();R();Hr();D("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"}});D("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0",isLogin:"1.0.0",isSubUser:"1.2.9"}});Hf=new Map;we("onLoginStateChange",({isLogin:e,token:t,uuid:r,isFirstLogin:n,extra:i,appAccountToken:o})=>{let a=Hf.get(r);a&&(a.resolve({isLogin:e,token:t,isFirstLogin:n,extra:i,appAccountToken:o}),Hf.delete(r))});Vf=(e,t=!1)=>g(void 0,null,function*(){var m,v,b;let{data:{isLogin:r}}=yield de("checkLoginAsync");if(r)return{isLogin:!0,token:(m=S.hostUserInfo)==null?void 0:m.token};let{skipLogin:n,triggerFrom:i}=e!=null?e:{},o=L("loginSync",{skipLogin:n,triggerFrom:i}),{data:{uuid:a}}=o;if(!a)throw xe({code:-1,msg:"login failed"});let s=new pt;Hf.set(a,s);let c=yield s.promise,l=L("envSync"),d=(b=(v=l==null?void 0:l.data)==null?void 0:v.hostUserInfo)==null?void 0:b.isSubUser;S.onEnvConfigChanged({hostUserInfo:B(P({},c),{isSubUser:d})});let y=c,{extra:u,appAccountToken:p}=y,f=Qe(y,["extra","appAccountToken"]);return Se.emit("onLoginComplete",f),t?c:f}),$f=z("login",{paramsSchema:I.tuple(I.object({skipLogin:I.boolean().optional(),triggerFrom:I.string().optional()}).optional()),implement(e){return g(this,null,function*(){return yield Vf(e!=null?e:{})})}}),aV=z("checkSession",{implement(){return g(this,null,function*(){var r;let{data:{isLogin:e}}=yield de("checkLoginAsync"),t=(r=S.hostUserInfo)==null?void 0:r.isSubUser;return{isLogin:e,isSubUser:t}})}}),Rx=Y();Rx.registerCommand("API.login",$f);Rx.registerCommand("API.checkSession",aV)});var Nx,Dx=T(()=>{"use strict";Nx=e=>{let t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),n=r+24*60*60*1e3;return e.filter(i=>i>=r&&i<n)}});function Nn(e){return t=>g(this,null,function*(){var c;let{dailyMaxPopUps:r,minInterval:n}=t,i=yield Vr(e);if(!i.data)return{canShow:!0,isFirst:!0};let o=Lx(i.data),a=Nx(o);if(r&&a.length>=r)return{canShow:!1,isFirst:!1};let s=Date.now();return console.log("todayFrequencies",a,n,s-a[0]),n&&s-((c=a==null?void 0:a[0])!=null?c:0)<n?{canShow:!1,isFirst:!1}:{canShow:!0,isFirst:!1}})}function Dn(e){return()=>g(this,null,function*(){var i;let t=Date.now(),r=yield Vr(e),n=Lx((i=r.data)!=null?i:"[]");n.push(t),n.sort((o,a)=>a-o).splice(8),yield St(e,JSON.stringify(n))})}var Lx,qx,Ux,Mx,Fx,jx,Bx,Gx,Jx,Hx,Vx,$x,Wx,zx,Kx,ua=T(()=>{"use strict";uo();Dx();Lx=e=>{let t;try{t=JSON.parse(e)}catch(r){t=[]}return t};qx=Nn("joli_coin_use_modal_frequency"),Ux=Nn("joli_coin_payment_frequency"),Mx=Nn("joli_coin_unlogin_modal_frequency"),Fx=Nn("joli_gem_use_modal_frequency"),jx=Nn("joli_gem_payment_frequency"),Bx=Nn("joli_gem_unlogin_modal_frequency"),Gx=Nn("subscription_frequency");Jx=Dn("joli_coin_use_modal_frequency"),Hx=Dn("joli_coin_payment_frequency"),Vx=Dn("joli_coin_unlogin_modal_frequency"),$x=Dn("joli_gem_use_modal_frequency"),Wx=Dn("joli_gem_payment_frequency"),zx=Dn("joli_gem_unlogin_modal_frequency"),Kx=Dn("subscription_frequency")});var Wf,Xc,zf=T(()=>{"use strict";ft();Wf=Promise.resolve(),Xc=(e,t)=>g(void 0,null,function*(){Wf=Wf.then(()=>g(void 0,null,function*(){yield X(t,{method:"POST",appendHostCookie:!0,data:{enableAutoDeduct:e}})})),yield Wf})});var Qc,Zc,Ht,el,Ln,Vt,Pr,tl,rl,qn,Ri,sV,M,Or,Rr,Je=T(()=>{"use strict";R();Qc="UNLOCK_OPTIONS_CHANGED",Zc="INVOKE_PAYMENT",Ht="ON_PAYMENT_RESULT",el="ON_USE_MODAL_EVENT",Ln="ON_USE_MODAL_RESULT",Vt="ON_USE_MODAL_FREQUENCY",Pr="ON_USE_UNLOGIN_MODAL_EVENT",tl="INVOKE_UNLOGIN_MODAL_EVENT",rl="INVOKE_SUBSCRIPTION_EVENT",qn="ON_USE_SUBSCRIPTION_RESULT",Ri=new Yt,sV=()=>({on:Ri.on.bind(Ri),off:Ri.off.bind(Ri),emit:Ri.emit.bind(Ri)}),M=sV(),Or={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},Rr={show:!0,minInterval:8*60*60*1e3}});function He(e,t){let r=null,n=null,i=null,o=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(a=>{n=a})};return o(),e.on(t,(...a)=>{let s=a[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||o(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,o(),r),updateData:a=>{if(i)return i=P(P({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}var lr=T(()=>{"use strict"});var Qx=h(Kf=>{"use strict";ua();zf();Je();Je();cr();wt();R();lr();var cV={JOLI_COIN:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"unlock_popup_show",coinUnlock:"coin_unlock_click",adUnlock:"ad_unlock_click"},frequencyChecker:qx,frequencyUpdater:Jx,apiEndpointAutoDeduct:"/api/joli-coin/user-config"},JOLI_GEM:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"gem_unlock_popup_show",coinUnlock:"gem_unlock_click",adUnlock:"gem_ad_unlock_click"},frequencyChecker:Fx,frequencyUpdater:$x,apiEndpointAutoDeduct:"/api/joli-gem/user-config"}},Yx=Rn(),Xx=He(M,Vt);Xx.getData();M.on(el,(e,t)=>g(Kf,null,function*(){let r=t.currency,n=cV[r];if(e.includes("ADS-")){yield Yx.show({duration:3e3});let c=yield Xx.getData(),{canShow:l,isFirst:d}=yield n.frequencyChecker(c.joliCoinUseAndCharge[n.frequencyConfigKey]);console.log(`${r} modal show by frequency`,l,d),Yx.hide();let{balance:u}=t.userCurrency;if(u>=t.quantity&&t.enableAutoDeduct&&!d){M.emit(Ln,{useModalResult:"CONFIRM"});return}if(!l){M.emit(Ln,{useModalResult:"FAILED"});return}}j(n.trackEvents.popupShow,{eventType:K.View,targetType:"game",currency:r});let{userCurrency:i,enableAutoDeduct:o,quantity:a}=t,s=Nk({data:{enableAutoDeduct:o,userCurrency:i,quantity:a,currency:r},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>{j(n.trackEvents.coinUnlock,{targetType:"game",eventType:K.Click,coinConsume:t.quantity,ifAutoUnlock:t.enableAutoDeduct,currency:r}),M.emit(Ln,{useModalResult:"CONFIRM"}),s.destroy()}},cancel:{text:t.cancelButtonText,onPress:({type:c})=>{c==="FAILED"&&j(n.trackEvents.adUnlock,{targetType:"game",eventType:K.Click,currency:r}),M.emit(Ln,{useModalResult:(c!=null?c:"")==="CANCEL"?"CANCEL":"FAILED"}),s.destroy()}},onEnableDeductChanged:c=>g(Kf,null,function*(){yield Xc(c,n.apiEndpointAutoDeduct)})}});yield n.frequencyUpdater()}))});function Zx(){let e=new Map;return{registerPaymentHandler(r,n){e.set(r,n)},invokePayment(r,...n){return g(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 ke(o),{code:"FAILED",message:`[joliboxSDK]: paymenterror ${o}`}}})}}}var eT=T(()=>{"use strict";_t()});var da=T(()=>{"use strict"});var lV,Ni,xt,uV,Un,nl=T(()=>{"use strict";da();R();$();ft();lV=()=>{let[e,t]=[Ha,Va].map(r=>(n,i,o)=>new r(n,i,o));return{createPaymentError:e,createPaymentInternalError:t}},{createPaymentError:Ni,createPaymentInternalError:xt}=lV(),uV=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",Un=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startPayment=t=>g(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw Ni(n,1001);return yield this.pay()});this.cancelOrder=t=>g(this,null,function*(){var n,i;let{response:r}=yield X(`/api/orders/${t}/cancel`,{method:"POST",data:{}});if(r.code!=="SUCCCESS")throw Ni((i=(n=r.message)!=null?n:r.errMsg)!=null?i:"",1003)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",S.deviceInfo.platform),t.set("joliSource",S.encodeJoliSourceQuery(P({},this.generatePaymentContext()))),`${uV}//payment/callback?${t.toString()}`}}get orderId(){return this._orderId}get status(){return this._orderStatus}}});var Xf,tT,rT=T(()=>{"use strict";ft();nl();da();Xf=class extends Un{constructor(r){super();this.productId=r;this.generatePaymentContext=()=>({type:"JOLI_COIN_ORDER_CONTEXT",state:"TO_VALIDATE",productId:this.productId,orderId:this.orderId});this.pay=()=>g(this,null,function*(){let r=this.generateCallbackUrl();return console.info("callbackUrl",r),{code:"SUCCESS",message:"jolicoin payment success"}})}placeOrder(r){return g(this,null,function*(){var n,i,o,a;try{let{response:s}=yield X("/api/orders/checkout/joli-coin",{method:"POST",data:{productId:r.productId}});if(s.code!=="SUCCESS")throw Ni((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),xt((a=JSON.stringify(s))!=null?a:"jolicoin placeorder failed",1002)}})}},tT=()=>{let e=new Map;return t=>g(void 0,null,function*(){let r=e.get(t);return r||(r=new Xf(t),e.set(t,r)),yield r.startPayment({productId:t}),{code:"SUCCESS",message:"jolicoin payment success"}})}});var nT,iT=T(()=>{"use strict";nT={SUCCESS:"unlockSuccess",FAIL_NOT_LOGIN:"unlockFailedNotLogin",FAIL_PAYING:"unlockFailedPaying",FAIL_PRODUCT_EMPTY:"unlockFailedProductIdNotFound",FAIL_GET_PRODUCT_INFO:"unlockFailedProductInvalid",FAIL_LAUNCH_BILLING:"unlockFailedLaunch",FAIL_TRANSACTION:"unlockFailedTransaction",FAIL_VERIFY:"unlockFaileVerify",TRANSACTION_PENDING:"transactionPending",FAILED:"unlockFailed"}});var Qf,oT,Zf,em,dV,tm,aT=T(()=>{"use strict";ft();nl();da();ce();R();$();cr();iT();Qf=new Map;we("onPaymentStateChange",e=>{console.info("onPaymentStateChange",e);let{orderUUID:t,status:r,totalAmount:n,orderResponse:i}=e,o=Qf.get(t);if(o){if(r==="SUCCESS")o.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{totalAmount:n}});else{if(r==="FAILED"&&Ja(i==null?void 0:i.errNo)&&(i==null?void 0:i.errNo)!==0)throw xt(`jolicoin payment failed: ${i==null?void 0:i.errMsg}`,1002);let a=nT[r];a&&Tr(`{slot-error} {slot-i18n-jolicoin.${a}}`,{position:"center",duration:3e3}),o.resolve({code:"FAILED",message:"jolicoin payment failed"})}Qf.delete(t)}});oT=e=>g(void 0,null,function*(){var n,i;let t=new pt,r;try{let o=yield de("requestPaymentSync",{paymentBody:{appStoreProductId:e.appStoreProductId,appAccountToken:e.appAccountToken}});if(r=(n=o.data)==null?void 0:n.orderUUID,console.info("---purchaseGem---",o),!r)throw xt("orderUUID is null",1002);Qf.set(r,t)}catch(o){throw xt((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),Zf=class extends Un{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=()=>g(this,null,function*(){return yield oT({appStoreProductId:this.appStoreProductId})})}placeOrder(r){return g(this,null,function*(){return{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},em=class extends Un{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=()=>g(this,null,function*(){return yield oT({appStoreProductId:this.appStoreProductId,appAccountToken:this.appAccountToken})})}placeOrder(r){return g(this,null,function*(){var a;console.log("----start place order for ios----");let{response:n}=yield X("/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 xt("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"}})}},dV={android:Zf,ios:em},tm=()=>{let e=new Map;return t=>g(void 0,null,function*(){let{productId:r,appStoreProductId:n}=t,i=e.get(r);if(!i){let s=dV[S.platform];if(!s)throw xt("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 Ni(a,1002);return{code:"SUCCESS",message:"jolicoin payment success"}})}});var Mn,rm=T(()=>{"use strict";eT();rT();aT();Mn=Zx();Mn.registerPaymentHandler("JOLI_COIN",tT());Mn.registerPaymentHandler("JOLI_COIN_IAP",tm());Mn.registerPaymentHandler("JOLI_GEM_IAP",tm())});function sT(n,i){return g(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 St(a,c),yield St(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 il(n,i){return g(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 Vr(s),{data:u}=yield Vr(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(()=>g(this,null,function*(){try{console.log("[Cache] Background updating cache for key:",e);let m=yield t(),v=Date.now();yield St(s,m),yield St(c,v.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 St(s,null),yield St(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 St(s,d),yield St(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 nm=T(()=>{"use strict";uo()});function pV(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=>!oo(r.totalAmountStr))}var cn,im,ur,sl,om,am,ol,al,cT,cl,sm=T(()=>{"use strict";rm();R();ce();ft();R();nm();cn=class cn{execute(t,r){return g(this,null,function*(){var a,s,c;let{response:n}=yield X(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&&pV(i,l)}if(i.paymentChoices.length===0)throw new Error("paymentChoices is empty");return i})}getNativePriceData(t){return g(this,null,function*(){let r=t.sort().join(",");return il(r,()=>g(this,null,function*(){try{let{data:n}=yield de("requestProductDetailsAsync",{appStoreProductIds:t});return n&&(cn.nativePriceCache.set(r,n),cn.nativePriceCacheTimestamp.set(r,Date.now())),n}catch(n){throw console.warn("[PaymentService] Failed to fetch native product details:",n),n}}),{cacheDuration:cn.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")}};cn.nativePriceCache=new Map,cn.NATIVE_PRICE_CACHE_DURATION=10*60*1e3,cn.nativePriceCacheTimestamp=new Map;im=cn,ur=class ur extends Ft{constructor(r,n){super(new im,{duration:10*60*1e3,timeout:3e3});this.apiEndpoint=r;this.paymentType=n}getProductsInfo(){return g(this,null,function*(){let r=ur.failureCounters.get(this.apiEndpoint)||0;if(r>=ur.MAX_FAILURE_COUNT)throw new Error(`getProductsInfo has failed more than ${ur.MAX_FAILURE_COUNT} times for ${this.apiEndpoint}`);try{let n=yield this.request(this.apiEndpoint);return ur.failureCounters.delete(this.apiEndpoint),n}catch(n){let i=r+1;throw ur.failureCounters.set(this.apiEndpoint,i),console.warn(`[PaymentService] getProductsInfo failed (${i}/${ur.MAX_FAILURE_COUNT+1}) for ${this.apiEndpoint}:`,n),n}})}purchase(r){return g(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 Mn.invokePayment(this.paymentType==="JOLI_COIN"?"JOLI_COIN_IAP":"JOLI_GEM_IAP",{productId:r,appStoreProductId:i})})}getProductsInfoWithBalance(){return g(this,null,function*(){return this.request(this.apiEndpoint)})}refreshProductsInfo(){return g(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}static resetFailureCounters(){this.failureCounters.clear()}static getFailureCount(r){return this.failureCounters.get(r)||0}};ur.failureCounters=new Map,ur.MAX_FAILURE_COUNT=2;sl=ur,om=class extends sl{constructor(){super("/api/joli-coin/balance-detail","JOLI_COIN")}},am=class extends sl{constructor(){super("/api/joli-gem/balance-detail","JOLI_GEM")}},ol=null,al=null,cT=()=>ol||(ol=new om,ol),cl=()=>al||(al=new am,al)});var dT=h(ll=>{"use strict";Je();cr();$();Yc();R();ua();rm();cr();Ve();wt();zf();lr();sm();var fV={JOLI_COIN:{frequencyConfigKey:"charge",trackEvents:{modalShow:"coinorder_show",orderClick:"coinorder_click",payEnsure:"order_pay_ensure",payResult:"order_pay_result",adUnlock:"ad_unlock_click"},frequencyChecker:Ux,frequencyUpdater:Hx,apiEndpoint:"/api/joli-coin/balance-detail",apiEndpointAutoDeduct:"/api/joli-coin/user-config",paymentType:"JOLI_COIN_IAP"},JOLI_GEM:{frequencyConfigKey:"charge",trackEvents:{modalShow:"gem_order_show",orderClick:"gem_order_click",payEnsure:"gem_pay_ensure",payResult:"gem_pay_result",adUnlock:"gem_ad_unlock_click"},frequencyChecker:jx,frequencyUpdater:Wx,apiEndpoint:"/api/joli-gem/balance-detail",apiEndpointAutoDeduct:"/api/joli-gem/user-config",paymentType:"JOLI_GEM_IAP"}},Di=Rn(),lT=cT(),uT=cl(),mV=He(M,Vt);M.on(Zc,(e,t)=>g(ll,null,function*(){var r,n,i;try{let o=t.currency,a=fV[o];if(!ye("requestPaymentSync:paymentBody:appStoreProductId")){console.info("requestPaymentSync:paymentBody:appStoreProductId not supported"),setTimeout(()=>{M.emit(Ht,{paymentResult:"FAILED",currency:o})},0);return}if(e.includes("ADS-")){yield Di.show({duration:3e3});let d=yield mV.getData(),{canShow:u}=yield a.frequencyChecker(d.joliCoinUseAndCharge[a.frequencyConfigKey]);if(console.log(`${o} payment show by frequency`,u),Di.hide(),!u){M.emit(Ht,{paymentResult:"FAILED",currency:o});return}console.log("show by frequency")}yield Di.show({duration:3e3});let s=o==="JOLI_COIN"?lT:uT,c=yield s.getProductsInfo();if(Di.hide(),!c||!((r=c.paymentChoices)!=null&&r.length)){M.emit(Ht,{paymentResult:"FAILED",currency:o});return}j(a.trackEvents.modalShow,{targetType:"game",eventType:K.View,currency:o});let l=Dk({data:{userCurrency:t.userCurrency,quantity:t.quantity,currency:o,paymentChoices:(i=(n=c.paymentChoices)==null?void 0:n.map(d=>{var u;return B(P({},d),{totalAmountStr:(u=d.totalAmountStr)!=null?u:""})}))!=null?i:[],enableAutoDeduct:t.enableAutoDeduct},buttons:{confirm:{text:t.confirmButtonText,onPress:d=>g(ll,null,function*(){var f,m,v,b,y,_,E,C;if(j(a.trackEvents.payEnsure,{targetType:"game",eventType:K.Click,payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(m=(f=c.paymentChoices.find(x=>x.productId===d))==null?void 0:f.totalAmountStr)!=null?m:""}),!((v=S.hostUserInfo)!=null&&v.isLogin)){let{data:x}=yield $f({skipLogin:!0});if(!(x!=null&&x.isLogin)){console.log("login failed");return}let k=yield s.refreshProductsInfo();if(((b=k==null?void 0:k.balance)!=null?b:0)>=t.quantity){M.emit(Ht,{paymentResult:"SUCCESS",currency:o}),l.destroy();return}}console.log("invokeNativePayment",d);let u=(_=(y=c==null?void 0:c.paymentChoices)==null?void 0:y.find(x=>x.productId===d))==null?void 0:_.appStoreProductId;if(!u){M.emit(Ht,{paymentResult:"FAILED",currency:o}),l.destroy();return}yield Di.show({duration:3e3});let{code:p}=yield Mn.invokePayment(a.paymentType,{productId:d,appStoreProductId:u});if(Di.hide(),j(a.trackEvents.payResult,{eventType:K.Other,targetType:"game",payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(C=(E=c.paymentChoices.find(x=>x.productId===d))==null?void 0:E.totalAmountStr)!=null?C:"",payResult:p}),p!=="SUCCESS"){console.info("[JoliboxSDK] payment failed in payment.invokePaymet");return}Tr("{slot-success} {slot-i18n-jolicoin.unlockSuccess}",{position:"center",duration:3e3}),M.emit(Ht,{paymentResult:"SUCCESS",currency:o}),l.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:d})=>{M.emit(Ht,{paymentResult:(d!=null?d:"")==="CANCEL"?"CANCEL":"FAILED",currency:o}),j(a.trackEvents.adUnlock,{targetType:"game",eventType:K.Click,currency:o}),l.destroy()}},onEnableDeductChanged:d=>g(ll,null,function*(){yield Xc(d,a.apiEndpointAutoDeduct)})},onSelect:d=>{var u,p;j(a.trackEvents.orderClick,{targetType:"game",eventType:K.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),M.emit(Ht,{paymentResult:"FAILED",currency:t.currency})}}));lT.getProductsInfo().catch(e=>{console.error("preload joli coin payment details failed",e)});uT.getProductsInfo().catch(e=>{console.error("preload joli gem payment details failed",e)})});var fT=h(ul=>{"use strict";Je();lr();ua();ft();_t();R();Yc();cr();wt();var hV={JOLI_COIN:{frequencyChecker:Mx,frequencyUpdater:Vx,trackEvents:{modalExpose:"LoginGuideModal",clickConfirm:"LoginGuideModal",clickConfirmLogin:"LoginGuideModal",modalHide:"LoginGuideModal",clickClose:"LoginGuideModal",clickWatchAds:"LoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.rewardTips}",usedText:"Jolicoin Used"}},JOLI_GEM:{frequencyChecker:Bx,frequencyUpdater:zx,trackEvents:{modalExpose:"GemLoginGuideModal",clickConfirm:"GemLoginGuideModal",clickConfirmLogin:"GemLoginGuideModal",modalHide:"GemLoginGuideModal",clickClose:"GemLoginGuideModal",clickWatchAds:"GemLoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.gemRewardTips}",usedText:"Gem Used"}}},pT=He(M,Vt);pT.getData();M.on(tl,(e,t)=>g(ul,null,function*(){var r;try{let n=t.currency,i=hV[n];if(e.includes("ADS-")){let s=yield pT.getData();if(console.log(`${n} unlogin guide config`,s.loginGuide),!s.loginGuide.show){M.emit(Pr,{result:"NOT_SUPPORT"});return}let{canShow:c}=yield i.frequencyChecker(s.loginGuide);if(console.log(`${n} canShowUseModal`,c),!c){M.emit(Pr,{result:"FAILED"});return}}let{firstLogin:o}=(r=yield gV())!=null?r:{};if(!(o!=null&&o.reward)){console.log("[JoliboxSDK] unlogin modal reward is empty"),M.emit(Pr,{result:"NOT_SUPPORT"});return}j(i.trackEvents.modalExpose,{eventType:K.Expose,currency:n},K.Expose);let a=Lk({data:{rewardType:e,rewardValue:o.reward.rewardValue,currency:t.currency},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>g(ul,null,function*(){var d,u,p,f;j(i.trackEvents.clickConfirm,{type:"click_confirm",eventType:K.Click,currency:n},K.Click);let{isLogin:s,extra:c,isFirstLogin:l}=yield Vf({},!0);if(!s){console.log("login failed");return}if(j(i.trackEvents.clickConfirmLogin,{type:"click_confirm_login",isFirstLogin:l,eventType:K.Click,currency:n},K.Click),l&&((d=c==null?void 0:c.firstLogin)!=null&&d.reward)){let{rewardValue:m}=c.firstLogin.reward;Tr(i.toastMessage.i18nKey,{i18nParams:{text:i.toastMessage.usedText,coin:m},position:"top",duration:3e3})}M.emit(Pr,{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:K.Hide,currency:n},K.Hide);let c=s==="CANCEL"?"click_close":"click_watch_ads",l=s==="CANCEL"?i.trackEvents.clickClose:i.trackEvents.clickWatchAds;j(l,{type:c,eventType:K.Click,currency:n},K.Click),M.emit(Pr,{result:"FAILED"}),a.destroy()}}}});yield i.frequencyUpdater()}catch(n){ke(new Eg(n)),M.emit(Pr,{result:"FAILED"})}}));var gV=()=>g(ul,null,function*(){var t;let{response:e}=yield X("/api/base/global-config",{method:"GET",appendHostCookie:!0,responseType:"json"});return(t=e.data)==null?void 0:t.data})});function vV(){let e=new Map;return{registerSubscriptionHandler(r,n){e.set(r,n)},invokeSubscription(r,...n){return g(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 ke(o),{code:"FAILED",message:`[joliboxSDK]: subscription error ${o}`}}})}}}var pa,cm=T(()=>{"use strict";_t();pa=vV()});var Fn,dl=T(()=>{"use strict";Fn={PlaceOrderFailed:1001,CancelOrderFailed:1002,SubscriptionFailed:1003,InvalidPlan:1004}});var yV,mT,pl,bV,fa,lm=T(()=>{"use strict";dl();R();$();yV=()=>{let[e,t]=[Ha,Va].map(r=>(n,i,o)=>new r(n,i,o));return{createSubscriptionError:e,createSubscriptionInternalError:t}},{createSubscriptionError:mT,createSubscriptionInternalError:pl}=yV(),bV=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",fa=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startSubscription=t=>g(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw mT(n,Fn.PlaceOrderFailed);return yield this.subscribe(t)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",S.deviceInfo.platform),t.set("joliSource",S.encodeJoliSourceQuery(P({},this.generateSubscriptionContext()))),`${bV}/subscription/callback?${t.toString()}`};this.createSubscriptionError=mT;this.createSubscriptionInternalError=pl}setOrderId(t){this._orderId=t}setOrderStatus(t){this._orderStatus=t}get orderId(){return this._orderId}get status(){return this._orderStatus}}});function _V(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=>!oo(r.amountStr))}var jn,ml,um,dm,fl,hT,pm=T(()=>{"use strict";R();ce();ft();R();nm();cm();ce();lm();dl();jn=class jn{static getNativePriceCache(t){var n;let r=t.sort().join(",");return(n=this.nativePriceCache.get(r))!=null?n:{}}execute(t,r){return g(this,null,function*(){var a,s;let{response:n}=yield X(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&&_V(i,c)}if(i.length===0)throw new Error("subscription tiers is empty");return i})}requestNativeSubscriptionPlans(t,r){return g(this,null,function*(){try{let{data:n}=yield de("requestSubscriptionPlansAsync",{appStoreProductIds:t,type:"game"});return n&&(jn.nativePriceCache.set(r,n),jn.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 g(this,null,function*(){let n=t.sort().join(",");return(r?sT:il)(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 g(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")}};jn.nativePriceCache=new Map,jn.NATIVE_PRICE_CACHE_DURATION=1*24*60*60*1e3,jn.nativePriceCacheTimestamp=new Map;ml=jn,um=class extends Ft{constructor(r){super(new ml,{duration:30*60*1e3,timeout:3e3});this.apiEndpoint=r;this.pendingSubscriptions=new Map;this.subInfoCacheKeys=[];this.listenSubscriptionPanelStateChange()}getSubInfo(){return g(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 g(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}updateNativePriceCache(r){return g(this,null,function*(){yield this.requestAdapter.updateNativePriceCache(r)})}updateAllNativePriceCache(){return g(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 g(this,null,function*(){var s;console.log("[SubscriptionService] subscribe params",pa);let n=new AbortController,i=pa.invokeSubscription("SUB_APP",{productId:r.nativeProductId,appStoreProductId:r.appStoreProductId,planId:r.basePlanId}),o=this.pollSubscriptionStatus(n.signal),a=yield Promise.race([i.then(c=>{var l;return n.abort(),{result:c.code,subPlanId:(l=c.data)==null?void 0:l.subPlanId,message:c.message}}),o.then(c=>(c==null?void 0:c.result)==="SUCCESS"?(n.abort(),c):new Promise(()=>{console.log("[SubscriptionPolling] Timeout for subscriptionService.subscribe completion")}))]);return{result:a.result,subPlanId:a.subPlanId,message:(s=a.message)!=null?s:""}})}pollSubscriptionStatus(r){return g(this,null,function*(){var o,a;for(let s=0;s<10;s++){if(r.aborted){console.log("[SubscriptionPolling] Aborted due to subscribe completion");return}try{let{response:c}=yield X("/api/subs/info",{method:"GET",appendHostCookie:!0,responseType:"json"});if(((a=(o=c.data)==null?void 0:o.data)==null?void 0:a.status)==="ACTIVE")return{result:"SUCCESS",subPlanId:c.data.data.subPlanId,message:"Subscription activated via polling"}}catch(c){console.warn(`[SubscriptionPolling] Attempt ${s+1} failed:`,c)}s<9&&!r.aborted&&(yield Ga(5e3))}})}invokeSubscriptionPanel(){return g(this,null,function*(){var i,o;let r=new pt,n;try{if(console.log("[invokeSubscriptionPanel] requestSubscriptionSync params"),n=(i=L("invokeSubscriptionPanelSync",{type:"game"}).data)==null?void 0:i.subUUID,!n)throw pl("orderUUID is null",Fn.SubscriptionFailed);this.pendingSubscriptions.set(n,r)}catch(a){throw pl((o=JSON.stringify(a))!=null?o:"subscription panel failed",Fn.SubscriptionFailed)}return r.promise})}getTierByProductId(r){return g(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=ml.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(){we("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"}}))})}},dm=class extends um{constructor(){super("/api/subs/pricing")}},fl=null,hT=()=>fl||(fl=new dm,fl)});var gT=T(()=>{"use strict"});function yT(){let e=new Map;return t=>g(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=wV[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 fm,vT,mm,hm,wV,bT=T(()=>{"use strict";$();lm();da();nl();R();ce();R();dl();we("onGlobalSubscriptionStateChange",e=>{let{status:t,orderResponse:r}=e;console.log("[onGlobalSubscriptionStateChange] data",e),t==="SUCCESS"&&(r!=null&&r.subPlanId||r!=null&&r.ticketId)&&S.onEnvConfigChanged({hostUserInfo:{isLogin:!0,isSubUser:!0}})});fm=new Map;we("onSubscritptionStateChange",e=>{var o,a,s;let{subUUID:t,status:r,orderResponse:n}=e;console.log("[onSubscritptionStateChange] data",e);let i=fm.get(t);if(i){if(r==="SUCCESS")console.log("=======onSubscritptionStateChange",r,(o=n==null?void 0:n.subPlanId)!=null?o:n==null?void 0:n.ticketId),i.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{subPlanId:(a=n==null?void 0:n.subPlanId)!=null?a:n==null?void 0:n.ticketId}});else{if(r==="FAILED"&&Ja(n==null?void 0:n.errNo)&&(n==null?void 0:n.errNo)!==0)throw xt(`subscription failed: ${n==null?void 0:n.errMsg}`,Fn.SubscriptionFailed);i.resolve({code:r,message:(s=n==null?void 0:n.errMsg)!=null?s:"UNKNOWN_ERROR"})}fm.delete(t)}});vT=e=>g(void 0,null,function*(){var n,i;let t=new pt,r;try{if(console.log("[internalSubscribe] requestSubscriptionSync params",e),r=(n=L("requestSubscriptionSync",P({params:{basePlanId:e.basePlanId,appStoreProductId:e.appStoreProductId,productId:e.productId}},e.appAccountToken?{paymentBody:{appAccountToken:e.appAccountToken,appStoreProductId:e.appStoreProductId}}:{})).data)==null?void 0:n.subUUID,!r)throw xt("subUUID is null",1002);fm.set(r,t)}catch(o){throw xt((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),mm=class extends fa{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return g(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 g(this,null,function*(){return yield vT(r)})}},hm=class extends fa{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return g(this,null,function*(){var o,a;console.log("----start place order for iOS subscription----");let n=L("envSync"),i=(a=(o=n==null?void 0:n.data)==null?void 0:o.hostUserInfo)==null?void 0:a.appAccountToken;if(!i)throw xt("appAccountToken is null",1002);return this.subscriptionToken=i,{code:"SUCCESS",message:"placeorder sub-app success in native"}})}cancelOrder(r){return g(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 g(this,null,function*(){return yield vT(B(P({},r),{appAccountToken:this.subscriptionToken}))})}},wV={android:mm,ios:hm}});var Bn,gm=T(()=>{"use strict";pm();gT();cm();bT();pm();Bn=hT();pa.registerSubscriptionHandler("SUB_APP",yT())});var IT=h(ST=>{"use strict";ua();Je();lr();Ve();gm();cr();var SV={SUBSCRIPTION:{frequencyConfigKey:"joinMember",frequencyChecker:Gx,frequencyUpdater:Kx}},_T=Rn(),wT=He(M,Vt);wT.getData();M.on(rl,e=>g(ST,null,function*(){let t=SV.SUBSCRIPTION;if(!ye("invokeSubscriptionPanelSync")){console.info("invokeSubscriptionPanelSync not supported"),setTimeout(()=>{M.emit(qn,{result:"FAILED"})},0);return}yield _T.show({duration:3e3});let r=yield wT.getData(),{canShow:n,isFirst:i}=yield t.frequencyChecker(r.joliCoinUseAndCharge[t.frequencyConfigKey]);if(_T.hide(),!n){M.emit(qn,{result:"FAILED"});return}let{data:o,code:a}=yield Bn.invokeSubscriptionPanel();a=="SUCCESS"?M.emit(qn,{result:"SUCCESS"}):M.emit(qn,{result:"FAILED"}),yield t.frequencyUpdater()}))});var Iie,Eie,Aie,Cie,ET=T(()=>{"use strict";Iie=se(Qx()),Eie=se(dT()),Aie=se(fT()),Cie=se(IT())});var Li,vm=T(()=>{"use strict";Li=(e,t)=>{var r;window.dispatchEvent(new CustomEvent(e,{detail:t})),(r=window.parent)==null||r.postMessage({type:e,data:{detail:t}},"*")}});function qV(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function UV(e){return typeof e=="string"}function MV(e){return typeof e=="undefined"}function FV(e){return MV(e)||e===null}function jV(e){return typeof e=="function"}function nP(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 ma(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function bl(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 WV(e){let t=e.location?bl(e.location,PT):null,r=e.target?bl(e.target,PT):null;return bl(NV(RV({},e),{location:t,target:r}),VV)}function zV(e){let t=e.events.map(n=>WV(n)),r=bl(e.device,$V);return[e.protocolVersion,t,r,e.project]}function KV(){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 e$(e){return new Promise(t=>sP(e)(t))}function sP(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 t$(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new _a(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 n$(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)i$(e[n],t[n])}function i$(e,t){if(UV(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(jV(t)){try{if(e instanceof t)return}catch(r){}if(!FV(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 gt(e,t,r){return(t=o$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o$(e){var t=a$(e,"string");return typeof t=="symbol"?t:t+""}function a$(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 hl(e,t,r){return(t=s$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s$(e){var t=c$(e,"string");return typeof t=="symbol"?t:t+""}function c$(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 gl(e,t,r){return(t=l$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l$(e){var t=u$(e,"string");return typeof t=="symbol"?t:t+""}function u$(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nr(e,t,r){return(t=d$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d$(e){var t=p$(e,"string");return typeof t=="symbol"?t:t+""}function p$(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 f$(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 m$(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 _$(e,t){return Ye(e,0)^45?(((t<<2^Ye(e,0))<<2^Ye(e,1))<<2^Ye(e,2))<<2^Ye(e,3):0}function uP(e){return e.trim()}function w$(e,t){return(e=t.exec(e))?e[0]:e}function ne(e,t,r){return e.replace(t,r)}function Dm(e,t){return e.indexOf(t)}function Ye(e,t){return e.charCodeAt(t)|0}function wa(e,t,r){return e.slice(t,r)}function fr(e){return e.length}function ah(e){return e.length}function vl(e,t){return t.push(e),e}function S$(e,t){return e.map(t).join("")}function Ml(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:Ul,column:Gi,length:a,return:""}}function ga(e,t){return b$(Ml("",null,null,"",null,null,0),e,{length:-e.length},t)}function I$(){return qe}function E$(){return qe=yt>0?Ye(Hi,--yt):0,Gi--,qe===10&&(Gi=1,Ul--),qe}function Pt(){return qe=yt<dP?Ye(Hi,yt++):0,Gi++,qe===10&&(Gi=1,Ul++),qe}function mr(){return Ye(Hi,yt)}function _l(){return yt}function Ea(e,t){return wa(Hi,e,t)}function Sa(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 pP(e){return Ul=Gi=1,dP=fr(Hi=e),yt=0,[]}function fP(e){return Hi="",e}function wl(e){return uP(Ea(yt-1,Lm(e===91?e+2:e===40?e+1:e)))}function A$(e){for(;(qe=mr())&&qe<33;)Pt();return Sa(e)>2||Sa(qe)>3?"":" "}function C$(e,t){for(;--t&&Pt()&&!(qe<48||qe>102||qe>57&&qe<65||qe>70&&qe<97););return Ea(e,_l()+(t<6&&mr()==32&&Pt()==32))}function Lm(e){for(;Pt();)switch(qe){case e:return yt;case 34:case 39:e!==34&&e!==39&&Lm(qe);break;case 40:e===41&&Lm(e);break;case 92:Pt();break}return yt}function k$(e,t){for(;Pt()&&e+qe!==57&&!(e+qe===84&&mr()===47););return"/*"+Ea(t,yt-1)+"*"+ql(e===47?e:Pt())}function x$(e){for(;!Sa(mr());)Pt();return Ea(e,yt)}function T$(e){return fP(Sl("",null,null,null,[""],e=pP(e),0,[0],e))}function Sl(e,t,r,n,i,o,a,s,c){for(var l=0,d=0,u=a,p=0,f=0,m=0,v=1,b=1,y=1,_=0,E="",C=i,x=o,k=n,A=E;b;)switch(m=_,_=Pt()){case 40:if(m!=108&&Ye(A,u-1)==58){Dm(A+=ne(wl(_),"&","&\f"),"&\f")!=-1&&(y=-1);break}case 34:case 39:case 91:A+=wl(_);break;case 9:case 10:case 13:case 32:A+=A$(m);break;case 92:A+=C$(_l()-1,7);continue;case 47:switch(mr()){case 42:case 47:vl(P$(k$(Pt(),_l()),t,r),c);break;default:A+="/"}break;case 123*v:s[l++]=fr(A)*y;case 125*v:case 59:case 0:switch(_){case 0:case 125:b=0;case 59+d:y==-1&&(A=ne(A,/\f/g,"")),f>0&&fr(A)-u&&vl(f>32?NT(A+";",n,r,u-1):NT(ne(A," ","")+";",n,r,u-2),c);break;case 59:A+=";";default:if(vl(k=RT(A,t,r,l,d,i,s,E,C=[],x=[],u),o),_===123)if(d===0)Sl(A,t,k,k,C,o,u,s,x);else switch(p===99&&Ye(A,3)===110?100:p){case 100:case 108:case 109:case 115:Sl(e,k,k,n&&vl(RT(e,k,k,0,0,i,s,E,i,C=[],u),x),i,x,u,s,n?C:x);break;default:Sl(A,k,k,k,[""],x,0,s,x)}}l=d=f=0,v=y=1,E=A="",u=a;break;case 58:u=1+fr(A),f=m;default:if(v<1){if(_==123)--v;else if(_==125&&v++==0&&E$()==125)continue}switch(A+=ql(_),_*v){case 38:y=d>0?1:(A+="\f",-1);break;case 44:s[l++]=(fr(A)-1)*y,y=1;break;case 64:mr()===45&&(A+=wl(Pt())),p=mr(),d=u=fr(E=A+=x$(_l())),_++;break;case 45:m===45&&fr(A)==2&&(v=0)}}return o}function RT(e,t,r,n,i,o,a,s,c,l,d){for(var u=i-1,p=i===0?o:[""],f=ah(p),m=0,v=0,b=0;m<n;++m)for(var y=0,_=wa(e,u+1,u=y$(v=a[m])),E=e;y<f;++y)(E=uP(v>0?p[y]+" "+_:ne(_,/&\f/g,p[y])))&&(c[b++]=E);return Ml(e,t,r,i===0?ih:s,c,l,d)}function P$(e,t,r){return Ml(e,t,r,cP,ql(I$()),wa(e,2,-2),0)}function NT(e,t,r,n){return Ml(e,t,r,oh,wa(e,0,n),wa(e,n+1,-1),n)}function Bi(e,t){for(var r="",n=ah(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function O$(e,t,r,n){switch(e.type){case v$:if(e.children.length)break;case g$:case oh:return e.return=e.return||e.value;case cP:return"";case lP:return e.return=e.value+"{"+Bi(e.children,n)+"}";case ih:e.value=e.props.join(",")}return fr(r=Bi(e.children,n))?e.return=e.value+"{"+r+"}":""}function R$(e){var t=ah(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 N$(e){return function(t){t.root||(t=t.return)&&e(t)}}function D$(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}function mP(e,t){switch(_$(e,t)){case 5103:return re+"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 re+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return re+e+Tl+e+ot+e+e;case 6828:case 4268:return re+e+ot+e+e;case 6165:return re+e+ot+"flex-"+e+e;case 5187:return re+e+ne(e,/(\w+).+(:[^]+)/,re+"box-$1$2"+ot+"flex-$1$2")+e;case 5443:return re+e+ot+"flex-item-"+ne(e,/flex-|-self/,"")+e;case 4675:return re+e+ot+"flex-line-pack"+ne(e,/align-content|flex-|-self/,"")+e;case 5548:return re+e+ot+ne(e,"shrink","negative")+e;case 5292:return re+e+ot+ne(e,"basis","preferred-size")+e;case 6060:return re+"box-"+ne(e,"-grow","")+re+e+ot+ne(e,"grow","positive")+e;case 4554:return re+ne(e,/([^-])(transform)/g,"$1"+re+"$2")+e;case 6187:return ne(ne(ne(e,/(zoom-|grab)/,re+"$1"),/(image-set)/,re+"$1"),e,"")+e;case 5495:case 3959:return ne(e,/(image-set\([^]*)/,re+"$1$`$1");case 4968:return ne(ne(e,/(.+:)(flex-)?(.*)/,re+"box-pack:$3"+ot+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+re+e+e;case 4095:case 3583:case 4068:case 2532:return ne(e,/(.+)-inline(.+)/,re+"$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(fr(e)-1-t>6)switch(Ye(e,t+1)){case 109:if(Ye(e,t+4)!==45)break;case 102:return ne(e,/(.+:)(.+)-([^]+)/,"$1"+re+"$2-$3$1"+Tl+(Ye(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Dm(e,"stretch")?mP(ne(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ye(e,t+1)!==115)break;case 6444:switch(Ye(e,fr(e)-3-(~Dm(e,"!important")&&10))){case 107:return ne(e,":",":"+re)+e;case 101:return ne(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+re+(Ye(e,14)===45?"inline-":"")+"box$3$1"+re+"$2$3$1"+ot+"$2box$3")+e}break;case 5936:switch(Ye(e,t+11)){case 114:return re+e+ot+ne(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return re+e+ot+ne(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return re+e+ot+ne(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return re+e+ot+e+e}return e}function J$(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 Pl(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 un={name:i.name,styles:i.styles,next:un},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)un={name:a.name,styles:a.styles,next:un},a=a.next;var s=o.styles+";";return s}return W$(e,t,r)}}var c=r;if(t==null)return c;var l=t[c];return l!==void 0?l:c}function W$(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Pl(e,t,r[i])+";";else for(var o in r){var a=r[o];if(typeof a!="object"){var s=a;t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":LT(s)&&(n+=bm(o)+":"+qT(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++)LT(a[c])&&(n+=bm(o)+":"+qT(o,a[c])+";");else{var l=Pl(e,t,a);switch(o){case"animation":case"animationName":{n+=bm(o)+":"+l+";";break}default:n+=o+"{"+l+"}"}}}return n}function _m(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="";un=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=Pl(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=Pl(r,t,e[s]),n){var c=o;i+=c[s]}UT.lastIndex=0;for(var l="",d;(d=UT.exec(i))!==null;)l+="-"+d[1];var u=J$(i)+l;return{name:u,styles:i,next:un}}function gP(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}function MT(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function FT(e,t,r){var n=[],i=gP(e,n,r);return n.length<2?r:i+t(n)}function Z$(e,t){Be.__h&&Be.__h(Tt,e,BT||t),BT=0;var r=Tt.__H||(Tt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function yP(e,t){var r=Z$(qm++,7);return r9(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function e9(){for(var e;e=vP.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Il),e.__H.__h.forEach(Um),e.__H.__h=[]}catch(t){e.__H.__h=[],Be.__e(t,e.__v)}}function t9(e){var t,r=function(){clearTimeout(n),zT&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);zT&&(t=requestAnimationFrame(r))}function Il(e){var t=Tt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Tt=t}function Um(e){var t=Tt;e.__c=e.__(),Tt=t}function r9(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Fl(){if(dn>1)dn--;else{for(var e,t=!1;ya!==void 0;){var r=ya;for(ya=void 0,Mm++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&_P(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Mm=0,dn--,t)throw e}}function Ce(e){if(dn>0)return e();dn++;try{return e()}finally{Fl()}}function bP(e){if(le!==void 0){var t=e.n;if(t===void 0||t.t!==le)return t={i:0,S:e,p:le.s,n:void 0,t:le,e:void 0,x:void 0,r:t},le.s!==void 0&&(le.s.n=t),le.s=t,e.n=t,32&le.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=le.s,t.n=void 0,le.s.n=t,le.s=t),t}}function Xe(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function W(e){return new Xe(e)}function _P(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 wP(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 SP(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 Vi(e){Xe.call(this,void 0),this.x=e,this.s=void 0,this.g=Ol-1,this.f=4}function ba(e){return new Vi(e)}function IP(e){var t=e.u;if(e.u=void 0,typeof t=="function"){dn++;var r=le;le=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,sh(e),n}finally{le=r,Fl()}}}function sh(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,IP(e)}function i9(e){if(le!==this)throw new Error("Out-of-order effect");SP(this),le=e,this.f&=-2,8&this.f&&sh(this),Fl()}function Aa(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Ca(e){var t=new Aa(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function $i(e,t){q[e]=t.bind(null,q[e]||function(){})}function Rl(e){Sm&&Sm(),Sm=e&&e.S()}function CP(e){var t=this,r=e.data,n=kP(r);n.value=r;var i=yP(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var l=ba(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""}),d=ba(function(){return!Array.isArray(l.value)&&!Vu(l.value)}),u=Ca(function(){if(this.N=xP,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 o9(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=W(r);return{o:function(a,s){o.value=a,n=s},d:Ca(function(){this.N=xP;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}function kP(e){return yP(function(){return W(e)},[])}function s9(){Ce(function(){for(var e;e=AP.shift();)EP.call(e)})}function xP(){AP.push(this)===1&&(q.requestAnimationFrame||a9)(s9)}function c9(e,t){let r=pi(e);di(()=>{r.current=e},[e]),Yr(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}function G(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:--l9,__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 q.vnode&&q.vnode(l),l}function Dr(e,t,r){return(t=b9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b9(e){var t=_9(e,"string");return typeof t=="symbol"?t:t+""}function _9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ut(e,t,r){return(t=R9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R9(e){var t=N9(e,"string");return typeof t=="symbol"?t:t+""}function N9(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 Lr(e,t,r){return(t=L9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L9(e){var t=q9(e,"string");return typeof t=="symbol"?t:t+""}function q9(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 it(e,t,r){return(t=U9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U9(e){var t=M9(e,"string");return typeof t=="symbol"?t:t+""}function M9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vt(e,t,r){return(t=F9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F9(e){var t=j9(e,"string");return typeof t=="symbol"?t:t+""}function j9(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 Gn(e,t,r){return(t=B9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B9(e){var t=G9(e,"string");return typeof t=="symbol"?t:t+""}function G9(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 Im(e,t,r){return(t=J9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J9(e){var t=H9(e,"string");return typeof t=="symbol"?t:t+""}function H9(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 dt(e,t,r){return(t=V9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V9(e){var t=$9(e,"string");return typeof t=="symbol"?t:t+""}function $9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W9(e,t,r){return(t=z9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z9(e){var t=K9(e,"string");return typeof t=="symbol"?t:t+""}function K9(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 qr(e,t,r){return(t=X9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X9(e){var t=Q9(e,"string");return typeof t=="symbol"?t:t+""}function Q9(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 Ur(e,t,r){return(t=Z9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z9(e){var t=eW(e,"string");return typeof t=="symbol"?t:t+""}function eW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function va(e,t,r){return(t=tW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tW(e){var t=rW(e,"string");return typeof t=="symbol"?t:t+""}function rW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function iW(e,t){return t==="call"&&e.join(".")==="GameSDK.showRewardAd"?0:15e3}function YT(e,t,r,n){return new Promise((i,o)=>{if(!window.parent||window.parent===window){o(new Error("[ParentProxy] No parent window"));return}let a=`${Em}-${++nW}`,s=d=>{let u=d.data;(u==null?void 0:u.type)===`${Em}:response`&&u.id===a&&(window.removeEventListener("message",s),l&&clearTimeout(l),u.error?o(new Error(u.error)):i(u.result))},c=iW(e,t),l=c>0?window.setTimeout(()=>{window.removeEventListener("message",s),o(new Error(`[ParentProxy] Timeout after ${c}ms: ${e.join(".")}.${t}`))},c):null;window.addEventListener("message",s),window.parent.postMessage({type:`${Em}:request`,id:a,path:e,action:t,args:r,value:n},"*")})}function LP(e){return console.log("[JoliboxSDK] NewsBreak createProxyForPath basePath:",e),new Proxy(()=>{},{get(t,r){if(console.log("[JoliboxSDK] NewsBreak createProxyForPath get:",r),!(r==="then"||r==="toJSON"||typeof r=="symbol"))return LP([...e,r])},set(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath set:",r),YT([...e,r],"set",void 0,n).catch(i=>{console.warn(`[ParentProxy] set ${[...e,r].join(".")} failed:`,i)}),!0},apply(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath apply:",n),YT(e,"call",n)}})}function oW(e){return LP([e])}function Mi(e,t,r){return(t=aW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aW(e){var t=sW(e,"string");return typeof t=="symbol"?t:t+""}function sW(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 XT(e,t,r){return(t=cW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cW(e){var t=lW(e,"string");return typeof t=="symbol"?t:t+""}function lW(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 $t(e,t,r){return(t=uW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uW(e){var t=dW(e,"string");return typeof t=="symbol"?t:t+""}function dW(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 yl(e,t,r){return(t=pW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pW(e){var t=fW(e,"string");return typeof t=="symbol"?t:t+""}function fW(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 Am(e,t,r){return(t=mW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mW(e){var t=hW(e,"string");return typeof t=="symbol"?t:t+""}function hW(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 me(e,t,r){return(t=gW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gW(e){var t=vW(e,"string");return typeof t=="symbol"?t:t+""}function vW(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 Mr(e,t,r){return(t=wW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wW(e){var t=SW(e,"string");return typeof t=="symbol"?t:t+""}function SW(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 dr(e,t,r){return(t=IW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function IW(e){var t=EW(e,"string");return typeof t=="symbol"?t:t+""}function EW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wt(e,t,r){return(t=AW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AW(e){var t=CW(e,"string");return typeof t=="symbol"?t:t+""}function CW(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 ln(e,t,r){return(t=kW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kW(e){var t=xW(e,"string");return typeof t=="symbol"?t:t+""}function xW(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 pr(e,t,r){return(t=TW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function TW(e){var t=PW(e,"string");return typeof t=="symbol"?t:t+""}function PW(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 IV,EV,AV,kl,QT,ZT,AT,eP,CV,kV,tP,xV,TV,CT,PV,OV,kT,RV,NV,DV,rP,LV,BV,GV,xT,JV,TT,HV,iP,oP,aP,PT,VV,$V,Fi,xl,Cm,_e,YV,XV,ha,_a,QV,xm,ZV,ym,r$,Tm,OT,qi,Pm,Om,Rm,Nm,h$,ot,Tl,re,cP,ih,oh,g$,lP,v$,y$,ql,b$,Ul,Gi,dP,yt,qe,Hi,L$,q$,U$,DT,M$,F$,j$,B$,G$,H$,V$,$$,hP,LT,bm,qT,UT,un,z$,K$,Y$,X$,Q$,st,qm,Tt,wm,jT,BT,vP,Be,GT,JT,HT,VT,$T,WT,zT,n9,le,ya,dn,Mm,Ol,EP,Sm,AP,a9,Ge,l9,u9,Fr,Fm,jm,El,d9,p9,f9,m9,h9,g9,v9,TP,y9,PP,Bm,w9,S9,I9,E9,A9,C9,k9,KT,x9,T9,P9,O9,Gm,ji,Ui,OP,D9,RP,Jm,NP,DP,Hm,Vm,$m,Ia,Nl,Y9,Dl,Wm,zm,Km,Em,nW,Al,Ym,Xm,Ji,Qm,at,Zm,Cl,yW,bW,_W,eh,th,rh,nh,Ll,ch=T(()=>{"use strict";ti();Ns();ce();IV=Object.defineProperty,EV=Object.defineProperties,AV=Object.getOwnPropertyDescriptors,kl=Object.getOwnPropertySymbols,QT=Object.prototype.hasOwnProperty,ZT=Object.prototype.propertyIsEnumerable,AT=(e,t,r)=>t in e?IV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eP=(e,t)=>{for(var r in t||(t={}))QT.call(t,r)&&AT(e,r,t[r]);if(kl)for(var r of kl(t))ZT.call(t,r)&&AT(e,r,t[r]);return e},CV=(e,t)=>EV(e,AV(t)),kV=(e,t)=>{var r={};for(var n in e)QT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&kl)for(var n of kl(e))t.indexOf(n)<0&&ZT.call(e,n)&&(r[n]=e[n]);return r},tP=Object.defineProperty,xV=Object.defineProperties,TV=Object.getOwnPropertyDescriptors,CT=Object.getOwnPropertySymbols,PV=Object.prototype.hasOwnProperty,OV=Object.prototype.propertyIsEnumerable,kT=(e,t,r)=>t in e?tP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RV=(e,t)=>{for(var r in t||(t={}))PV.call(t,r)&&kT(e,r,t[r]);if(CT)for(var r of CT(t))OV.call(t,r)&&kT(e,r,t[r]);return e},NV=(e,t)=>xV(e,TV(t)),DV=(e,t)=>{for(var r in t)tP(e,r,{get:t[r],enumerable:!0})},rP=(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},LV=(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}BV=(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))(BV||{});GV={log:ma("log"),warn:ma("warn"),info:ma("info"),error:ma("error"),debug:ma("debug")};Object.assign(globalThis,{logger:GV});xT=Symbol.for("Jolibox.canIUseMap"),JV={};globalThis[xT]||(globalThis[xT]=JV);TT=Symbol.for("Jolibox.canIUseMap.native"),HV={};globalThis[TT]||(globalThis[TT]=HV);iP=(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))(iP||{}),oP=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(oP||{}),aP=(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))(aP||{}),PT=["name","params"],VV=["name","type","location","target","extra","timestamp","userId"],$V=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];KV();Fi=typeof window=="undefined",xl=()=>!Fi&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!Fi&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!Fi&&navigator.userAgent.includes("Android"),!Fi&&navigator.userAgent.includes("Mac"),!Fi&&navigator.userAgent.includes("FB_IAB"),!Fi&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");Cm=class km{constructor(t){this.element=t,this.next=km.Undefined,this.prev=km.Undefined}};Cm.Undefined=new Cm(void 0);_e=Cm,YV=class{constructor(){this._first=_e.Undefined,this._last=_e.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===_e.Undefined}clear(){let e=this._first;for(;e!==_e.Undefined;){let t=e.next;e.prev=_e.Undefined,e.next=_e.Undefined,e=t}this._first=_e.Undefined,this._last=_e.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new _e(e);if(this._first===_e.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!==_e.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==_e.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==_e.Undefined&&e.next!==_e.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===_e.Undefined&&e.next===_e.Undefined?(this._first=_e.Undefined,this._last=_e.Undefined):e.next===_e.Undefined?(this._last=this._last.prev,this._last.next=_e.Undefined):e.prev===_e.Undefined&&(this._first=this._first.next,this._first.prev=_e.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==_e.Undefined;)yield e.element,e=e.next}},XV=0,ha=class{constructor(e){this.value=e,this.id=XV++}},_a=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 ha&&(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 ha(e);return this._listeners?this._listeners instanceof ha?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 ha)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 ha?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},QV=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 _a,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 YV,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)}},xm={};DV(xm,{None:()=>ZV,filter:()=>t$,once:()=>sP,toPromise:()=>e$});ZV=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});ym=Symbol.for("Jolibox.hostEmitter"),r$=()=>{let e=new QV;return globalThis[ym]||(globalThis[ym]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[ym]};r$();Tm=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new _a,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 n$(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}};Tm=rP([nP],Tm);OT=class{constructor(){this._onWillExecuteCommand=new _a,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new _a,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Tm,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=qV(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 LV(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),xm.toPromise(xm.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{}}};OT=rP([nP],OT);qi=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")},Pm=class{constructor(t){gt(this,"context",void 0),gt(this,"continueCallback",void 0),gt(this,"adIsShowingCallback",void 0),gt(this,"isBeforeAdCalled",!1),gt(this,"isBeforeRewardCalled",!1),gt(this,"isAdDismissedCalled",!1),gt(this,"isAdViewedCalled",!1),gt(this,"isAfterAdCalled",!1),gt(this,"currentProvider",void 0),gt(this,"currentClientParams",void 0),gt(this,"adsHasResponse",!1),gt(this,"videoChecker",window.document.createElement("video")),gt(this,"contextInfo",void 0),gt(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",eP({userEvent:a},this.paramsToTrack)),xl()&&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=qi(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=qi(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),xl()&&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=qi(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=qi(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=qi(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=qi(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 g(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")})})}};Om=class{constructor(t){hl(this,"context",void 0),hl(this,"adBreakIsShowing",!1),hl(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),hl(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()})}};Rm=class{constructor(t){gl(this,"configs",null),gl(this,"firstRun",!0),gl(this,"context",void 0),gl(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return g(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}};Nm=class{constructor(t,r){Nr(this,"name","ADSENSE"),Nr(this,"context",void 0),Nr(this,"contextInfo",void 0),Nr(this,"configured",!1),Nr(this,"initParams",void 0),Nr(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),Nr(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=kV(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),Nr(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),Nr(this,"adUnit",n=>g(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 v=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),v&&b.setAttribute("data-ad-format",v),u&&b.setAttribute("data-full-width-responsive",u),p&&b.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let y=document.createElement("div");y.style.position="absolute",y.style.top="0",y.style.left="0",y.style.width="100%",y.style.height="100%",y.style.display="flex",y.style.justifyContent="center",y.style.alignItems="center",y.style.backgroundColor="rgba(0, 0, 0, 0.5)",y.style.color="white",y.innerHTML="Test Ad",b.style.position="relative",f.appendChild(b),b.appendChild(y)}else f.appendChild(b),new MutationObserver(y=>{y.forEach(_=>{if(_.type==="attributes"&&_.attributeName==="data-ad-status"){let 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 g(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)}})}};h$=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(m$(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=f$(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}(),ot="-ms-",Tl="-moz-",re="-webkit-",cP="comm",ih="rule",oh="decl",g$="@import",lP="@keyframes",v$="@layer",y$=Math.abs,ql=String.fromCharCode,b$=Object.assign;Ul=1,Gi=1,dP=0,yt=0,qe=0,Hi="";L$=function(e,t,r){for(var n=0,i=0;n=i,i=mr(),n===38&&i===12&&(t[r]=1),!Sa(i);)Pt();return Ea(e,yt)},q$=function(e,t){var r=-1,n=44;do switch(Sa(n)){case 0:n===38&&mr()===12&&(t[r]=1),e[r]+=L$(yt-1,t,r);break;case 2:e[r]+=wl(n);break;case 4:if(n===44){e[++r]=mr()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=ql(n)}while(n=Pt());return e},U$=function(e,t){return fP(q$(pP(e),t))},DT=new WeakMap,M$=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!DT.get(r))&&!n){DT.set(e,!0);for(var i=[],o=U$(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]}}},F$=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};j$=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case oh:e.return=mP(e.value,e.length);break;case lP:return Bi([ga(e,{value:ne(e.value,"@","@"+re)})],n);case ih:if(e.length)return S$(e.props,function(i){switch(w$(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Bi([ga(e,{props:[ne(i,/:(read-\w+)/,":"+Tl+"$1")]})],n);case"::placeholder":return Bi([ga(e,{props:[ne(i,/:(plac\w+)/,":"+re+"input-$1")]}),ga(e,{props:[ne(i,/:(plac\w+)/,":"+Tl+"$1")]}),ga(e,{props:[ne(i,/:(plac\w+)/,ot+"input-$1")]})],n)}return""})}},B$=[j$],G$=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 v=m.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var n=e.stylisPlugins||B$,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(m){for(var v=m.getAttribute("data-emotion").split(" "),b=1;b<v.length;b++)i[v[b]]=!0;a.push(m)});var s,c=[M$,F$];{var l,d=[O$,N$(function(m){l.insert(m)})],u=R$(c.concat(n,d)),p=function(m){return Bi(T$(m),u)};s=function(m,v,b,y){l=b,p(m?m+"{"+v.styles+"}":v.styles),y&&(f.inserted[v.name]=!0)}}var f={key:t,sheet:new h$({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};H$={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},V$=/[A-Z]|^ms/g,$$=/_EMO_([^_]+?)_([^]*?)_EMO_/g,hP=function(e){return e.charCodeAt(1)===45},LT=function(e){return e!=null&&typeof e!="boolean"},bm=D$(function(e){return hP(e)?e:e.replace(V$,"-$&").toLowerCase()}),qT=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace($$,function(r,n,i){return un={name:n,styles:i,next:un},n})}return H$[e]!==1&&!hP(e)&&typeof t=="number"&&t!==0?t+"px":t};UT=/label:\s*([^\s;{]+)\s*(;|$)/g;z$=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},K$=function(e,t,r){z$(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)}};Y$=function(e){var t=G$(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=_m(s,t.registered,void 0);return K$(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=_m(s,t.registered),d="animation-"+l.name;return MT(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=_m(s,t.registered);MT(t,l)},o=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];return FT(t.registered,r,X$(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:gP.bind(null,t.registered),merge:FT.bind(null,t.registered,r)}},X$=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},Q$=Y$({key:"css"}),st=Q$.css,BT=0,vP=[],Be=q,GT=Be.__b,JT=Be.__r,HT=Be.diffed,VT=Be.__c,$T=Be.unmount,WT=Be.__;Be.__b=function(e){Tt=null,GT&&GT(e)},Be.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),WT&&WT(e,t)},Be.__r=function(e){JT&&JT(e),qm=0;var t=(Tt=e.__c).__H;t&&(wm===Tt?(t.__h=[],Tt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Il),t.__h.forEach(Um),t.__h=[],qm=0)),wm=Tt},Be.diffed=function(e){HT&&HT(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vP.push(t)!==1&&jT===Be.requestAnimationFrame||((jT=Be.requestAnimationFrame)||t9)(e9)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),wm=Tt=null},Be.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Il),r.__h=r.__h.filter(function(n){return!n.__||Um(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Be.__e(n,r.__v)}}),VT&&VT(e,t)},Be.unmount=function(e){$T&&$T(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Il(n)}catch(i){t=i}}),r.__H=void 0,t&&Be.__e(t,r.__v))};zT=typeof requestAnimationFrame=="function";n9=Symbol.for("preact-signals");le=void 0,ya=void 0,dn=0,Mm=0,Ol=0;Xe.prototype.brand=n9;Xe.prototype.h=function(){return!0};Xe.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)};Xe.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)}};Xe.prototype.subscribe=function(e){var t=this;return Ca(function(){var r=t.value,n=le;le=void 0;try{e(r)}finally{le=n}})};Xe.prototype.valueOf=function(){return this.value};Xe.prototype.toString=function(){return this.value+""};Xe.prototype.toJSON=function(){return this.value};Xe.prototype.peek=function(){var e=le;le=void 0;try{return this.value}finally{le=e}};Object.defineProperty(Xe.prototype,"value",{get:function(){var e=bP(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Mm>100)throw new Error("Cycle detected");this.v=e,this.i++,Ol++,dn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Fl()}}}});(Vi.prototype=new Xe).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ol))return!0;if(this.g=Ol,this.f|=1,this.i>0&&!_P(this))return this.f&=-2,!0;var e=le;try{wP(this),le=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return le=e,SP(this),this.f&=-2,!0};Vi.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)}Xe.prototype.S.call(this,e)};Vi.prototype.U=function(e){if(this.t!==void 0&&(Xe.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)}};Vi.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(Vi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=bP(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});Aa.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()}};Aa.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,IP(this),wP(this),dn++;var e=le;return le=this,i9.bind(this,e)};Aa.prototype.N=function(){2&this.f||(this.f|=2,this.o=ya,ya=this)};Aa.prototype.d=function(){this.f|=8,1&this.f||sh(this)};AP=[];Ca(function(){EP=this.N})();CP.displayName="_st";Object.defineProperties(Xe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:CP},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});$i("__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 Xe&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});$i("__r",function(e,t){Rl();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return Ca(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Rl(r),e(t)});$i("__e",function(e,t,r,n){Rl(),e(t,r,n)});$i("diffed",function(e,t){Rl();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=o9(r,c,d,i),o[c]=l):l.o(d,i)}}}e(t)});$i("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)});$i("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Et.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};a9=function(e){queueMicrotask(function(){queueMicrotask(e)})};Ge=st`
622
+ `,h4=()=>w("div",{style:zC.container,children:[w("style",{children:m4}),w("div",{style:zC.spinner})]});gee=Rn()});function $k(){return g(this,null,function*(){if(Nf)return Nf;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 X(t);return Nf=r,r})}function Wk(){return g(this,null,function*(){let e=new pt;if(S.mpType!=="game")return e.resolve(!1),e.promise;if(Df)return e.resolve(!0),e.promise;let t=yield $k();if(t.code!=="SUCCESS")return e.resolve(!1),e.promise;let{gameListInfo:r,title:n,buttons:i}=t.data;Df=!0;let o={domain:"GAME",buttons:t.data.buttons.map(s=>`${s.type}-${s.text}`).join(","),list:r.games.map(s=>s.gameId).join(",")};j("RecommendedGuide",P({eventType:K.View},o));let a=Tk({games:r.games,title:n,buttons:i,onClose:s=>{var c;switch(Df=!1,s.type){case"quit":j("RecommendedGuide",{eventType:K.Click,type:"QUIT",domain:"GAME"}),e.resolve(!1);break;case"dismiss":j("RecommendedGuide",P({eventType:K.Hide},o)),e.resolve(!0),a.destroy();break;case"navigate":if((c=s.data)!=null&&c.game){let l=s.data.game;g4(l),j("GameItem",{eventType:K.Click,gameId:l.gameId,layerName:"RecommendedGuide",domain:"GAME"}),setTimeout(()=>{e.resolve(!1)},0)}else e.resolve(!0);a.destroy();break;default:j("RecommendedGuide",P({eventType:K.Hide},o)),e.resolve(!0);break}}});return e.promise})}var Nf,g4,Df,zk=T(()=>{"use strict";$();ce();R();cr();ft();wt();Nf=null;$k();g4=e=>{var a;let{data:t}=L("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()}`;L("openSchemaSync",{schema:o})},Df=!1});function y4(e){let t=P(P({},v4),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:_,containerTransition:E,iframeTransition:C}=p();fe=document.createElement("div"),fe.id="jolibox-modal-overlay",fe.style.cssText=`position:fixed; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); z-index:1000; display:flex; justify-content:center; align-items:flex-end; transition:${_}; opacity:0; visibility:hidden;`,oe=document.createElement("div"),oe.id="jolibox-modal-container",oe.style.cssText=`width:100%; height:${n}; background:white; border-radius:12px 12px 0 0; overflow:hidden; box-shadow:0 -2px 10px rgba(0,0,0,0.2); transform:translateY(100%); transition:${E};`;let x=document.createElement("div");x.id="jolibox-modal-loading",x.style.cssText="position:absolute; top:50%; left:50%; transform:translate(-50%, -50%); width:40px; height:40px; border:4px solid #f3f3f3; border-top:4px solid #3498db; border-radius:50%; animation:spin 1s linear infinite;";let k=document.createElement("style");k.textContent="@keyframes spin { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }",document.head.appendChild(k);let A=document.createElement("div");if(A.style.cssText="width:100%; height:100%; display:flex; flex-direction:column; padding-bottom:env(safe-area-inset-bottom, 0); position:relative;",Lt=document.createElement("iframe"),Lt.style.cssText=`width:100%; flex:1; border:none; opacity:0; transition:${C};`,Lt.src=r,Lt.onload=()=>{x.parentNode&&x.parentNode.removeChild(x),Lt.style.opacity="1",v(),c==null||c(),Se.emit("onModalIframeLoaded",{url:r})},A.appendChild(Lt),A.appendChild(x),oe.appendChild(A),i){let H=document.createElement("div");H.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;",H.innerHTML="\u2715",H.onclick=y,oe.appendChild(H)}fe.appendChild(oe),document.body.appendChild(fe),fe.addEventListener("click",function(H){H.target===fe&&y()}),o&&b()}function v(){!fe||!oe||u||(fe.style.visibility="visible",a?requestAnimationFrame(()=>{fe&&(fe.style.opacity="1"),oe&&(oe.style.transform="translateY(0)"),u=!0}):(fe&&(fe.style.opacity="1"),oe&&(oe.style.transform="translateY(0)"),u=!0),L("updateContainerConfigSync",{displayCapsuleButton:!1,webviewId:S.webviewId}))}function b(){if(!oe)return;let _=x=>{l=x.touches[0].clientY},E=x=>{if(!u)return;d=x.touches[0].clientY;let k=d-l;k>0&&(oe&&(oe.style.transition="none",oe.style.transform=`translateY(${k}px)`),x.preventDefault())},C=()=>{!u||!oe||(oe.style.transition=a?"transform 0.3s ease":"none",d-l>80?y():oe.style.transform="translateY(0)")};oe.addEventListener("touchstart",_),oe.addEventListener("touchmove",E),oe.addEventListener("touchend",C)}function y(){!fe||!oe||!u||(a?(oe.style.transform="translateY(100%)",fe.style.opacity="0"):fe.style.visibility="hidden",u=!1,L("updateContainerConfigSync",{displayCapsuleButton:!0,webviewId:S.webviewId}),setTimeout(()=>{fe&&(fe.remove(),fe=null,oe=null,Lt=null,s==null||s(),Se.emit("onModalIframeClosed",{url:r}))},f()))}return m(),{close:y}}function Kk(){return window.joliboxUI=B(P({},window.joliboxUI),{createIframeModal:y4}),()=>{window.joliboxUI=void 0,fe&&fe.parentNode&&fe.parentNode.removeChild(fe),oe&&oe.parentNode&&oe.parentNode.removeChild(oe),Lt&&Lt.parentNode&&Lt.parentNode.removeChild(Lt),fe=null,oe=null,Lt=null}}var v4,fe,oe,Lt,Yk=T(()=>{"use strict";ce();$();R();v4={height:"50%",showCloseButton:!0,enableDragClose:!0,useAnimation:!0},fe=null,oe=null,Lt=null});var rx,jc,qf,Bc,Ti,nx,Pi,ix,ox,ax,xi,Xk,Fc,Qk,b4,sx,Uf,Zk,cx,_4,ex,Lf,lx,tx,w4,ux,dx=T(()=>{rx=-1,jc=function(e){addEventListener("pageshow",function(t){t.persisted&&(rx=t.timeStamp,e(t))},!0)},qf=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Bc=function(){var e=qf();return e&&e.activationStart||0},Ti=function(e,t){var r=qf(),n="navigate";return rx>=0?n="back-forward-cache":r&&(document.prerendering||Bc()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:n}},nx=function(e,t,r){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var n=new PerformanceObserver(function(i){Promise.resolve().then(function(){t(i.getEntries())})});return n.observe(Object.assign({type:e,buffered:!0},r||{})),n}}catch(i){}},Pi=function(e,t,r,n){var i,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=o,t.rating=function(s,c){return s>c[1]?"poor":s>c[0]?"needs-improvement":"good"}(t.value,r),e(t))}},ix=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},ox=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},ax=function(e){var t=!1;return function(){t||(e(),t=!0)}},xi=-1,Xk=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},Fc=function(e){document.visibilityState==="hidden"&&xi>-1&&(xi=e.type==="visibilitychange"?e.timeStamp:0,b4())},Qk=function(){addEventListener("visibilitychange",Fc,!0),addEventListener("prerenderingchange",Fc,!0)},b4=function(){removeEventListener("visibilitychange",Fc,!0),removeEventListener("prerenderingchange",Fc,!0)},sx=function(){return xi<0&&(xi=Xk(),Qk(),jc(function(){setTimeout(function(){xi=Xk(),Qk()},0)})),{get firstHiddenTime(){return xi}}},Uf=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},Zk=[1800,3e3],cx=function(e,t){t=t||{},Uf(function(){var r,n=sx(),i=Ti("FCP"),o=nx("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-Bc(),0),i.entries.push(s),r(!0)))})});o&&(r=Pi(e,i,Zk,t.reportAllChanges),jc(function(a){i=Ti("FCP"),r=Pi(e,i,Zk,t.reportAllChanges),ix(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})},_4=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=ax(e),document.visibilityState==="hidden"?e():(r=t(e),ox(e)),r},ex=[2500,4e3],Lf={},lx=function(e,t){t=t||{},Uf(function(){var r,n=sx(),i=Ti("LCP"),o=function(c){t.reportAllChanges||(c=c.slice(-1)),c.forEach(function(l){l.startTime<n.firstHiddenTime&&(i.value=Math.max(l.startTime-Bc(),0),i.entries=[l],r())})},a=nx("largest-contentful-paint",o);if(a){r=Pi(e,i,ex,t.reportAllChanges);var s=ax(function(){Lf[i.id]||(o(a.takeRecords()),a.disconnect(),Lf[i.id]=!0,r(!0))});["keydown","click"].forEach(function(c){addEventListener(c,function(){return _4(s)},{once:!0,capture:!0})}),ox(s),jc(function(c){i=Ti("LCP"),r=Pi(e,i,ex,t.reportAllChanges),ix(function(){i.value=performance.now()-c.timeStamp,Lf[i.id]=!0,r(!0)})})}})},tx=[800,1800],w4=function e(t){document.prerendering?Uf(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},ux=function(e,t){t=t||{};var r=Ti("TTFB"),n=Pi(e,r,tx,t.reportAllChanges);w4(function(){var i=qf();i&&(r.value=Math.max(i.responseStart-Bc(),0),r.entries=[i],n(!0),jc(function(){r=Ti("TTFB",0),(n=Pi(e,r,tx,t.reportAllChanges))(!0)}))})}});var gx={};Bh(gx,{config:()=>R4});function I4(){bn.on("isAdShowing",e=>{Hc=e,Jr(Hc)&&S.mpType==="game"&&L("updateContainerConfigSync",{displayCapsuleButton:!Hc,webviewId:S.webviewId})})}function E4(){Se.on("onInterceptSystemExit",({intercept:e})=>{fx=e})}function A4(){Se.on("onInterceptBackPress",({intercept:e})=>{S4=e}),we("onBeforeBackPress",({uuid:e,disableExitRecommendDialog:t})=>{var r,n;hx(t),Se.emit("onBackPress",{}),(n=(r=globalThis.joliboxJSCore)==null?void 0:r.doBackPress)==null||n.call(r,e)})}function C4(){Se.on("onDocumentReady",()=>{var e;(e=globalThis.joliboxJSCore)==null||e.onDocumentReady(window.location.href),j("onDocumentReady",{start_timestamp:$c,timestamp:Date.now()})})}function k4(){we("onI18nChanged",({language:e})=>{Se.emit("onI18nChanged",{i18n:e})})}function px(e){S.mpType==="game"&&It.start(e)}function x4(){we("onJoliboxServiceReady",({runtimeInfo:e,loadDuration:t})=>{e&&S.onEnvConfigChanged({hostUserInfo:e}),Se.emit("LifecycleEvent.onReady",P({},S.hostUserInfo?S.hostUserInfo:{isLogin:!1})),j("joliboxServiceReady",{start_timestamp:$c,timestamp:Date.now()}),ye("onJoliboxHideLoading")||px(t),Ik(()=>S.language)}),we("onBeforeExit",({uuid:e,disableExitRecommendDialog:t})=>{var r;hx(t),(r=globalThis.joliboxJSCore)==null||r.doExit(e)}),we("onJoliboxHideLoading",({duration:e})=>{px(e)})}function T4(){let e=()=>{j("onBeforeExit",{timestamp:Date.now()}),Gc==null||Gc(),Jc==null||Jc(),It.close(Date.now()-$c)},t=()=>Hc||fx;Rt.onDoExit(()=>g(this,null,function*(){return t()?!0:S.platform==="ios"?(e(),!1):Jr(S.shouldInterupt)?(S.shouldInterupt||e(),S.shouldInterupt):Vc!=null&&Vc.canShowRecommended&&!mx&&(yield Wk())?!0:(e(),!1)})),Rt.onDoBackPress(()=>g(this,null,function*(){return!!t()}))}function P4(){cx(e=>{j("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),lx(e=>{j("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),ux(e=>{j("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function O4(){return g(this,null,function*(){try{let e="/api/fe-configs/js-sdk/basic-meta",{response:{data:t}}=yield X(e);t&&(Vc=t)}catch(e){console.error("fetchMetaConfig error:",e)}})}function R4(){$c=Date.now(),x4(),I4(),E4(),A4(),T4(),C4(),k4(),O4(),P4(),Jc=Kk(),Gc=fv()}var Gc,Jc,$c,Hc,Vc,fx,S4,mx,hx,vx=T(()=>{"use strict";ce();$();R();wt();mv();hs();zk();ft();cr();Yk();dx();ps();Hc=!1,Vc=null,fx=!1,S4=!1,mx=!1,hx=e=>{Jr(e)&&(mx=e)};Rt.onReady(()=>{})});var yx,N4,D4,L4,q4,bx=T(()=>{"use strict";R();Ve();ce();$();yx=Y(),N4="env",D4="getSystemInfoSync",L4=Q(D4,{implement:()=>{var r;let e=L("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}}}}),q4=Q(N4,{implement:()=>{var t;let e=L("envSync");return(t=e==null?void 0:e.data)!=null?t:void 0}});yx.registerCommand("API.getSystemInfoSync",L4);yx.registerCommand("API.env",q4);D("env",{version:"1.0.0"});D("getSystemInfoSync",{version:"1.0.0",properties:{viewport:"1.0.33"}})});var _x=h(Mf=>{"use strict";R();Ve();_t();ce();wt();$();var U4="exitGame",M4="onReady",F4="onJoliboxShow",j4="onJoliboxHide",Wc=Y(),zc=Yn(ke),B4=z(U4,{paramsSchema:I.tuple(I.function(),I.boolean().optional().default(!1)),implement:(e,t=!1)=>g(Mf,null,function*(){zc(e).call(Mf),Jr(S.shouldInterupt)&&!S.shouldInterupt&&S.from&&ug("onRetentionResult",{shouldStay:t},S.from,!0),t||S.setDoExitDirectly(),yield de("exitAppAsync")})}),G4=Q(F4,{paramsSchema:I.tuple(I.function()),implement(e){let t=zc(e);we("onJoliboxEnterForeground",()=>{t.call(this),po.emit("visible",!0)})}}),J4=Q(j4,{paramsSchema:I.tuple(I.function()),implement(e){let t=zc(e);we("onJoliboxEnterBackground",()=>{t.call(this),po.emit("visible",!1)})}}),H4=Q(M4,{paramsSchema:I.tuple(I.function()),implement(e){let t=zc(e);Se.on("LifecycleEvent.onReady",r=>{t(r)})}});Wc.registerCommand("LifecycleSDK.exit",B4);Wc.registerCommand("LifecycleSDK.onReady",H4);Wc.registerCommand("LifecycleSDK.onJoliboxShow",G4);Wc.registerCommand("LifecycleSDK.onJoliboxHide",J4);D("lifeCycle.exit",{version:"1.0.0"});D("lifeCycle.onReady",{version:"1.0.0"});D("lifeCycle.onJoliboxShow",{version:"1.0.0"});D("lifeCycle.onJoliboxHide",{version:"1.0.0"})});function wx(e){let t={};if(!vn(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 Sx(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 Ix(e,t=!1){if(e)return t||e>0&&e<=6e4?Math.ceil(e):6e4}function Ex(e,t,r){if(["POST","PUT","PATCH"].includes(t)||!vn(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 Ax=T(()=>{"use strict";R()});var V4,$4,Ff,jf,Cx,W4,z4,K4,kx=T(()=>{"use strict";Hr();Nu();Ve();Ax();R();_t();$();V4=15,$4=Wa("createRequestTaskSync","operateRequestTaskSync",{type:"public",baseUrl:S.baseApiHost}),Ff=0,jf=[],Cx=Yn(ke),W4=(e,t)=>{let r=e.filter(t),n=e.filter(i=>!t(i));return e.length=0,e.push(...n),r},z4=e=>{let t=new pt,r=()=>{};return Q("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=()=>g(this,null,function*(){var s,c,l;let a=Cx(i.fail);try{if(Ff+=1,t.state!=="pending")return;let{data:d,dataType:u,responseType:p,enableCache:f,appendHostCookie:m}=i,v=wx((s=i.headers)!=null?s:{}),b=Sx(i.method),y=Ix(i.timeout),_=Ex(i.url,b,d),E=Cx(i.success),C=Object.assign({},i,{method:b,header:m?void 0:v,data:b==="GET"||b==="HEAD"?void 0:d,enableCache:f,query:(c=i.query)!=null?c:{},dataType:u,responseType:p,appendHostCookie:m});y&&(C.timeout=y);let x=$4(_,C);{let{response:k}=yield x,{code:A,data:H,message:ue}=k;if(H&&typeof H=="object"&&"status"in H&&H.status!==200)throw xe({code:H.status||-1,msg:`request:fail status ${H.status}`});t.resolve({code:A!=null?A:"SUCCESS",data:H,message:ue!=null?ue:"request:ok"}),E({code:"SUCCESS",message:"request:ok",data:H})}}catch(d){t.reject(d),a({code:"FAILURE",message:"httpRequst: failed"})}finally{Ff-=1,(l=jf.shift())==null||l()}});return Ff>=V4?(r=()=>{W4(jf,a=>a===o)},jf.push(o)):o(),t.promise}})(e),{abort(){t.reject(xe({code:-1,msg:"request:fail abort"})),r()}}},K4=Y();K4.registerCommand("HttpSDK.request",z4);D("request",{version:"1.0.0"})});var Y4,X4,Q4,Bf,xx=T(()=>{"use strict";R();ce();Ve();Y4=Q("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)),L("showKeyboardSync",B(P({},e),{defaultValue:r,maxLength:t}))}});D("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"}});X4=Q("updateKeyboard",{paramsSchema:I.tuple(I.object({value:I.string()})),implement(e){L("updateKeyboardSync",e)}});D("keyboard.updateKeyboard",{version:"1.0.0",properties:{params:{value:"1.0.0"}}});Q4=Q("hideKeyboard",{implement(){L("hideKeyboardSync")}});D("keyboard.hideKeyboard",{version:"1.0.0"});Bf=Y();Bf.registerCommand("KeyboardSDK.showKeyboard",Y4);Bf.registerCommand("KeyboardSDK.updateKeyboard",X4);Bf.registerCommand("KeyboardSDK.hideKeyboard",Q4)});var Ox=h(Oi=>{"use strict";R();Ve();wt();ce();$();var la=Y(),Kc=null,Gf=!1,Tx=0,Z4=200;function eV(e){hn("cpUpdateScoreEvent",e,S.webviewId)}function Px(e){Kc=e,Gf||(Gf=!0,requestAnimationFrame(function t(){let r=Date.now();r-Tx>=Z4?(Kc!==null&&(eV(Kc),Tx=r,Kc=null),Gf=!1):requestAnimationFrame(t)}))}function Jf(e,t){return ye("notifyTaskGameInfoAsync")?L("notifyTaskGameInfoAsync",{event:e,inGameInfo:t}):It.reporter({event:e,extraParams:{inGameInfo:t}})}var tV=z("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=>g(Oi,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e,a=[];a.push(It.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})),a.push(Jf("COMPLETE_GAME_LEVEL",{levelId:t,duration:r,rating:n,score:i})),Px({levelId:t,duration:r,rating:n,score:i}),yield Promise.all(a)})}),rV=z("gamePlayEnded",{paramsSchema:I.tuple(I.object({duration:I.number().optional(),rating:I.number().optional(),score:I.number(),variation:I.string().optional()})),implement:e=>g(Oi,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e,o=[];o.push(It.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i})),o.push(Jf("GAME_ENDED",{duration:t,rating:r,score:n})),Px({duration:t,rating:r,score:n}),yield Promise.all(o)})}),nV=z("levelUpgrade",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number()),name:I.string().optional()})),implement:r=>g(Oi,[r],function*({levelId:e,name:t}){let n=[];n.push(It.tracker("LevelUpgrade",{name:t,levelId:e})),n.push(Jf("GAME_LEVEL_UP",{levelId:e,levelName:t})),hn("cpUpdateScoreEvent",{levelId:e},S.webviewId),yield Promise.all(n)})}),iV=z("levelStart",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number())})),implement:e=>g(Oi,null,function*(){let{levelId:t}=e;yield It.tracker("LevelStart",{levelId:t})})}),oV=z("levelFailed",{paramsSchema:I.tuple(I.object({levelId:I.or(I.string(),I.number()),score:I.number().optional(),rating:I.number().optional(),duration:I.number().optional()})),implement:e=>g(Oi,null,function*(){let{levelId:t,score:r,rating:n,duration:i}=e;yield It.tracker("LevelFailed",{levelId:t,score:r,rating:n,duration:i})})});la.registerCommand("TaskTrackerSDK.levelFinished",tV);la.registerCommand("TaskTrackerSDK.gamePlayEnded",rV);la.registerCommand("TaskTrackerSDK.levelUpgrade",nV);la.registerCommand("TaskTrackerSDK.levelStart",iV);la.registerCommand("TaskTrackerSDK.levelFailed",oV);D("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"}}});D("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});D("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});D("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});D("TaskTrackerSDK.onLevelFailed",{version:"1.3.8",properties:{params:{levelId:"1.3.8",score:"1.3.8",rating:"1.3.8",duration:"1.3.8"}}})});var Hf,Vf,$f,aV,Rx,Yc=T(()=>{"use strict";$();ce();Ve();R();Hr();D("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"}});D("checkSession",{version:"1.0.0",success:{errMsg:"1.0.0",isLogin:"1.0.0",isSubUser:"1.2.9"}});Hf=new Map;we("onLoginStateChange",({isLogin:e,token:t,uuid:r,isFirstLogin:n,extra:i,appAccountToken:o})=>{let a=Hf.get(r);a&&(a.resolve({isLogin:e,token:t,isFirstLogin:n,extra:i,appAccountToken:o}),Hf.delete(r))});Vf=(e,t=!1)=>g(void 0,null,function*(){var m,v,b;let{data:{isLogin:r}}=yield de("checkLoginAsync");if(r)return{isLogin:!0,token:(m=S.hostUserInfo)==null?void 0:m.token};let{skipLogin:n,triggerFrom:i}=e!=null?e:{},o=L("loginSync",{skipLogin:n,triggerFrom:i}),{data:{uuid:a}}=o;if(!a)throw xe({code:-1,msg:"login failed"});let s=new pt;Hf.set(a,s);let c=yield s.promise,l=L("envSync"),d=(b=(v=l==null?void 0:l.data)==null?void 0:v.hostUserInfo)==null?void 0:b.isSubUser;S.onEnvConfigChanged({hostUserInfo:B(P({},c),{isSubUser:d})});let y=c,{extra:u,appAccountToken:p}=y,f=Qe(y,["extra","appAccountToken"]);return Se.emit("onLoginComplete",f),t?c:f}),$f=z("login",{paramsSchema:I.tuple(I.object({skipLogin:I.boolean().optional(),triggerFrom:I.string().optional()}).optional()),implement(e){return g(this,null,function*(){return yield Vf(e!=null?e:{})})}}),aV=z("checkSession",{implement(){return g(this,null,function*(){var r;let{data:{isLogin:e}}=yield de("checkLoginAsync"),t=(r=S.hostUserInfo)==null?void 0:r.isSubUser;return{isLogin:e,isSubUser:t}})}}),Rx=Y();Rx.registerCommand("API.login",$f);Rx.registerCommand("API.checkSession",aV)});var Nx,Dx=T(()=>{"use strict";Nx=e=>{let t=new Date,r=new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime(),n=r+24*60*60*1e3;return e.filter(i=>i>=r&&i<n)}});function Nn(e){return t=>g(this,null,function*(){var c;let{dailyMaxPopUps:r,minInterval:n}=t,i=yield Vr(e);if(!i.data)return{canShow:!0,isFirst:!0};let o=Lx(i.data),a=Nx(o);if(r&&a.length>=r)return{canShow:!1,isFirst:!1};let s=Date.now();return console.log("todayFrequencies",a,n,s-a[0]),n&&s-((c=a==null?void 0:a[0])!=null?c:0)<n?{canShow:!1,isFirst:!1}:{canShow:!0,isFirst:!1}})}function Dn(e){return()=>g(this,null,function*(){var i;let t=Date.now(),r=yield Vr(e),n=Lx((i=r.data)!=null?i:"[]");n.push(t),n.sort((o,a)=>a-o).splice(8),yield St(e,JSON.stringify(n))})}var Lx,qx,Ux,Mx,Fx,jx,Bx,Gx,Jx,Hx,Vx,$x,Wx,zx,Kx,ua=T(()=>{"use strict";uo();Dx();Lx=e=>{let t;try{t=JSON.parse(e)}catch(r){t=[]}return t};qx=Nn("joli_coin_use_modal_frequency"),Ux=Nn("joli_coin_payment_frequency"),Mx=Nn("joli_coin_unlogin_modal_frequency"),Fx=Nn("joli_gem_use_modal_frequency"),jx=Nn("joli_gem_payment_frequency"),Bx=Nn("joli_gem_unlogin_modal_frequency"),Gx=Nn("subscription_frequency");Jx=Dn("joli_coin_use_modal_frequency"),Hx=Dn("joli_coin_payment_frequency"),Vx=Dn("joli_coin_unlogin_modal_frequency"),$x=Dn("joli_gem_use_modal_frequency"),Wx=Dn("joli_gem_payment_frequency"),zx=Dn("joli_gem_unlogin_modal_frequency"),Kx=Dn("subscription_frequency")});var Wf,Xc,zf=T(()=>{"use strict";ft();Wf=Promise.resolve(),Xc=(e,t)=>g(void 0,null,function*(){Wf=Wf.then(()=>g(void 0,null,function*(){yield X(t,{method:"POST",appendHostCookie:!0,data:{enableAutoDeduct:e}})})),yield Wf})});var Qc,Zc,Ht,el,Ln,Vt,Pr,tl,rl,qn,Ri,sV,M,Or,Rr,Je=T(()=>{"use strict";R();Qc="UNLOCK_OPTIONS_CHANGED",Zc="INVOKE_PAYMENT",Ht="ON_PAYMENT_RESULT",el="ON_USE_MODAL_EVENT",Ln="ON_USE_MODAL_RESULT",Vt="ON_USE_MODAL_FREQUENCY",Pr="ON_USE_UNLOGIN_MODAL_EVENT",tl="INVOKE_UNLOGIN_MODAL_EVENT",rl="INVOKE_SUBSCRIPTION_EVENT",qn="ON_USE_SUBSCRIPTION_RESULT",Ri=new Yt,sV=()=>({on:Ri.on.bind(Ri),off:Ri.off.bind(Ri),emit:Ri.emit.bind(Ri)}),M=sV(),Or={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},Rr={show:!0,minInterval:8*60*60*1e3}});function He(e,t){let r=null,n=null,i=null,o=()=>{if(i){r=Promise.resolve(i);return}r=new Promise(a=>{n=a})};return o(),e.on(t,(...a)=>{let s=a[0];i=s,n&&(n(s),n=null)}),{getData:()=>(r||o(),r),getCachedData:()=>i,clearCache:()=>{i=null,r=null},getFreshData:()=>(i=null,r=null,o(),r),updateData:a=>{if(i)return i=P(P({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}var lr=T(()=>{"use strict"});var Qx=h(Kf=>{"use strict";ua();zf();Je();Je();cr();wt();R();lr();var cV={JOLI_COIN:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"unlock_popup_show",coinUnlock:"coin_unlock_click",adUnlock:"ad_unlock_click"},frequencyChecker:qx,frequencyUpdater:Jx,apiEndpointAutoDeduct:"/api/joli-coin/user-config"},JOLI_GEM:{frequencyConfigKey:"useJolicoin",trackEvents:{popupShow:"gem_unlock_popup_show",coinUnlock:"gem_unlock_click",adUnlock:"gem_ad_unlock_click"},frequencyChecker:Fx,frequencyUpdater:$x,apiEndpointAutoDeduct:"/api/joli-gem/user-config"}},Yx=Rn(),Xx=He(M,Vt);Xx.getData();M.on(el,(e,t)=>g(Kf,null,function*(){let r=t.currency,n=cV[r];if(e.includes("ADS-")){yield Yx.show({duration:3e3});let c=yield Xx.getData(),{canShow:l,isFirst:d}=yield n.frequencyChecker(c.joliCoinUseAndCharge[n.frequencyConfigKey]);console.log(`${r} modal show by frequency`,l,d),Yx.hide();let{balance:u}=t.userCurrency;if(u>=t.quantity&&t.enableAutoDeduct&&!d){M.emit(Ln,{useModalResult:"CONFIRM"});return}if(!l){M.emit(Ln,{useModalResult:"FAILED"});return}}j(n.trackEvents.popupShow,{eventType:K.View,targetType:"game",currency:r});let{userCurrency:i,enableAutoDeduct:o,quantity:a}=t,s=Nk({data:{enableAutoDeduct:o,userCurrency:i,quantity:a,currency:r},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>{j(n.trackEvents.coinUnlock,{targetType:"game",eventType:K.Click,coinConsume:t.quantity,ifAutoUnlock:t.enableAutoDeduct,currency:r}),M.emit(Ln,{useModalResult:"CONFIRM"}),s.destroy()}},cancel:{text:t.cancelButtonText,onPress:({type:c})=>{c==="FAILED"&&j(n.trackEvents.adUnlock,{targetType:"game",eventType:K.Click,currency:r}),M.emit(Ln,{useModalResult:(c!=null?c:"")==="CANCEL"?"CANCEL":"FAILED"}),s.destroy()}},onEnableDeductChanged:c=>g(Kf,null,function*(){yield Xc(c,n.apiEndpointAutoDeduct)})}});yield n.frequencyUpdater()}))});function Zx(){let e=new Map;return{registerPaymentHandler(r,n){e.set(r,n)},invokePayment(r,...n){return g(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 ke(o),{code:"FAILED",message:`[joliboxSDK]: paymenterror ${o}`}}})}}}var eT=T(()=>{"use strict";_t()});var da=T(()=>{"use strict"});var lV,Ni,xt,uV,Un,nl=T(()=>{"use strict";da();R();$();ft();lV=()=>{let[e,t]=[Ha,Va].map(r=>(n,i,o)=>new r(n,i,o));return{createPaymentError:e,createPaymentInternalError:t}},{createPaymentError:Ni,createPaymentInternalError:xt}=lV(),uV=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",Un=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startPayment=t=>g(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw Ni(n,1001);return yield this.pay()});this.cancelOrder=t=>g(this,null,function*(){var n,i;let{response:r}=yield X(`/api/orders/${t}/cancel`,{method:"POST",data:{}});if(r.code!=="SUCCCESS")throw Ni((i=(n=r.message)!=null?n:r.errMsg)!=null?i:"",1003)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",S.deviceInfo.platform),t.set("joliSource",S.encodeJoliSourceQuery(P({},this.generatePaymentContext()))),`${uV}//payment/callback?${t.toString()}`}}get orderId(){return this._orderId}get status(){return this._orderStatus}}});var Xf,tT,rT=T(()=>{"use strict";ft();nl();da();Xf=class extends Un{constructor(r){super();this.productId=r;this.generatePaymentContext=()=>({type:"JOLI_COIN_ORDER_CONTEXT",state:"TO_VALIDATE",productId:this.productId,orderId:this.orderId});this.pay=()=>g(this,null,function*(){let r=this.generateCallbackUrl();return console.info("callbackUrl",r),{code:"SUCCESS",message:"jolicoin payment success"}})}placeOrder(r){return g(this,null,function*(){var n,i,o,a;try{let{response:s}=yield X("/api/orders/checkout/joli-coin",{method:"POST",data:{productId:r.productId}});if(s.code!=="SUCCESS")throw Ni((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),xt((a=JSON.stringify(s))!=null?a:"jolicoin placeorder failed",1002)}})}},tT=()=>{let e=new Map;return t=>g(void 0,null,function*(){let r=e.get(t);return r||(r=new Xf(t),e.set(t,r)),yield r.startPayment({productId:t}),{code:"SUCCESS",message:"jolicoin payment success"}})}});var nT,iT=T(()=>{"use strict";nT={SUCCESS:"unlockSuccess",FAIL_NOT_LOGIN:"unlockFailedNotLogin",FAIL_PAYING:"unlockFailedPaying",FAIL_PRODUCT_EMPTY:"unlockFailedProductIdNotFound",FAIL_GET_PRODUCT_INFO:"unlockFailedProductInvalid",FAIL_LAUNCH_BILLING:"unlockFailedLaunch",FAIL_TRANSACTION:"unlockFailedTransaction",FAIL_VERIFY:"unlockFaileVerify",TRANSACTION_PENDING:"transactionPending",FAILED:"unlockFailed"}});var Qf,oT,Zf,em,dV,tm,aT=T(()=>{"use strict";ft();nl();da();ce();R();$();cr();iT();Qf=new Map;we("onPaymentStateChange",e=>{console.info("onPaymentStateChange",e);let{orderUUID:t,status:r,totalAmount:n,orderResponse:i}=e,o=Qf.get(t);if(o){if(r==="SUCCESS")o.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{totalAmount:n}});else{if(r==="FAILED"&&Ja(i==null?void 0:i.errNo)&&(i==null?void 0:i.errNo)!==0)throw xt(`jolicoin payment failed: ${i==null?void 0:i.errMsg}`,1002);let a=nT[r];a&&Tr(`{slot-error} {slot-i18n-jolicoin.${a}}`,{position:"center",duration:3e3}),o.resolve({code:"FAILED",message:"jolicoin payment failed"})}Qf.delete(t)}});oT=e=>g(void 0,null,function*(){var n,i;let t=new pt,r;try{let o=yield de("requestPaymentSync",{paymentBody:{appStoreProductId:e.appStoreProductId,appAccountToken:e.appAccountToken}});if(r=(n=o.data)==null?void 0:n.orderUUID,console.info("---purchaseGem---",o),!r)throw xt("orderUUID is null",1002);Qf.set(r,t)}catch(o){throw xt((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),Zf=class extends Un{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=()=>g(this,null,function*(){return yield oT({appStoreProductId:this.appStoreProductId})})}placeOrder(r){return g(this,null,function*(){return{code:"SUCCESS",message:"placeorder jolicoin success in native"}})}},em=class extends Un{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=()=>g(this,null,function*(){return yield oT({appStoreProductId:this.appStoreProductId,appAccountToken:this.appAccountToken})})}placeOrder(r){return g(this,null,function*(){var a;console.log("----start place order for ios----");let{response:n}=yield X("/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 xt("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"}})}},dV={android:Zf,ios:em},tm=()=>{let e=new Map;return t=>g(void 0,null,function*(){let{productId:r,appStoreProductId:n}=t,i=e.get(r);if(!i){let s=dV[S.platform];if(!s)throw xt("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 Ni(a,1002);return{code:"SUCCESS",message:"jolicoin payment success"}})}});var Mn,rm=T(()=>{"use strict";eT();rT();aT();Mn=Zx();Mn.registerPaymentHandler("JOLI_COIN",tT());Mn.registerPaymentHandler("JOLI_COIN_IAP",tm());Mn.registerPaymentHandler("JOLI_GEM_IAP",tm())});function sT(n,i){return g(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 St(a,c),yield St(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 il(n,i){return g(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 Vr(s),{data:u}=yield Vr(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(()=>g(this,null,function*(){try{console.log("[Cache] Background updating cache for key:",e);let m=yield t(),v=Date.now();yield St(s,m),yield St(c,v.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 St(s,null),yield St(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 St(s,d),yield St(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 nm=T(()=>{"use strict";uo()});function pV(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=>!oo(r.totalAmountStr))}var cn,im,ur,sl,om,am,ol,al,cT,cl,sm=T(()=>{"use strict";rm();R();ce();ft();R();nm();cn=class cn{execute(t,r){return g(this,null,function*(){var a,s,c;let{response:n}=yield X(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&&pV(i,l)}if(i.paymentChoices.length===0)throw new Error("paymentChoices is empty");return i})}getNativePriceData(t){return g(this,null,function*(){let r=t.sort().join(",");return il(r,()=>g(this,null,function*(){try{let{data:n}=yield de("requestProductDetailsAsync",{appStoreProductIds:t});return n&&(cn.nativePriceCache.set(r,n),cn.nativePriceCacheTimestamp.set(r,Date.now())),n}catch(n){throw console.warn("[PaymentService] Failed to fetch native product details:",n),n}}),{cacheDuration:cn.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")}};cn.nativePriceCache=new Map,cn.NATIVE_PRICE_CACHE_DURATION=10*60*1e3,cn.nativePriceCacheTimestamp=new Map;im=cn,ur=class ur extends Ft{constructor(r,n){super(new im,{duration:10*60*1e3,timeout:3e3});this.apiEndpoint=r;this.paymentType=n}getProductsInfo(){return g(this,null,function*(){let r=ur.failureCounters.get(this.apiEndpoint)||0;if(r>=ur.MAX_FAILURE_COUNT)throw new Error(`getProductsInfo has failed more than ${ur.MAX_FAILURE_COUNT} times for ${this.apiEndpoint}`);try{let n=yield this.request(this.apiEndpoint);return ur.failureCounters.delete(this.apiEndpoint),n}catch(n){let i=r+1;throw ur.failureCounters.set(this.apiEndpoint,i),console.warn(`[PaymentService] getProductsInfo failed (${i}/${ur.MAX_FAILURE_COUNT+1}) for ${this.apiEndpoint}:`,n),n}})}purchase(r){return g(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 Mn.invokePayment(this.paymentType==="JOLI_COIN"?"JOLI_COIN_IAP":"JOLI_GEM_IAP",{productId:r,appStoreProductId:i})})}getProductsInfoWithBalance(){return g(this,null,function*(){return this.request(this.apiEndpoint)})}refreshProductsInfo(){return g(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}static resetFailureCounters(){this.failureCounters.clear()}static getFailureCount(r){return this.failureCounters.get(r)||0}};ur.failureCounters=new Map,ur.MAX_FAILURE_COUNT=2;sl=ur,om=class extends sl{constructor(){super("/api/joli-coin/balance-detail","JOLI_COIN")}},am=class extends sl{constructor(){super("/api/joli-gem/balance-detail","JOLI_GEM")}},ol=null,al=null,cT=()=>ol||(ol=new om,ol),cl=()=>al||(al=new am,al)});var dT=h(ll=>{"use strict";Je();cr();$();Yc();R();ua();rm();cr();Ve();wt();zf();lr();sm();var fV={JOLI_COIN:{frequencyConfigKey:"charge",trackEvents:{modalShow:"coinorder_show",orderClick:"coinorder_click",payEnsure:"order_pay_ensure",payResult:"order_pay_result",adUnlock:"ad_unlock_click"},frequencyChecker:Ux,frequencyUpdater:Hx,apiEndpoint:"/api/joli-coin/balance-detail",apiEndpointAutoDeduct:"/api/joli-coin/user-config",paymentType:"JOLI_COIN_IAP"},JOLI_GEM:{frequencyConfigKey:"charge",trackEvents:{modalShow:"gem_order_show",orderClick:"gem_order_click",payEnsure:"gem_pay_ensure",payResult:"gem_pay_result",adUnlock:"gem_ad_unlock_click"},frequencyChecker:jx,frequencyUpdater:Wx,apiEndpoint:"/api/joli-gem/balance-detail",apiEndpointAutoDeduct:"/api/joli-gem/user-config",paymentType:"JOLI_GEM_IAP"}},Di=Rn(),lT=cT(),uT=cl(),mV=He(M,Vt);M.on(Zc,(e,t)=>g(ll,null,function*(){var r,n,i;try{let o=t.currency,a=fV[o];if(!ye("requestPaymentSync:paymentBody:appStoreProductId")){console.info("requestPaymentSync:paymentBody:appStoreProductId not supported"),setTimeout(()=>{M.emit(Ht,{paymentResult:"FAILED",currency:o})},0);return}if(e.includes("ADS-")){yield Di.show({duration:3e3});let d=yield mV.getData(),{canShow:u}=yield a.frequencyChecker(d.joliCoinUseAndCharge[a.frequencyConfigKey]);if(console.log(`${o} payment show by frequency`,u),Di.hide(),!u){M.emit(Ht,{paymentResult:"FAILED",currency:o});return}console.log("show by frequency")}yield Di.show({duration:3e3});let s=o==="JOLI_COIN"?lT:uT,c=yield s.getProductsInfo();if(Di.hide(),!c||!((r=c.paymentChoices)!=null&&r.length)){M.emit(Ht,{paymentResult:"FAILED",currency:o});return}j(a.trackEvents.modalShow,{targetType:"game",eventType:K.View,currency:o});let l=Dk({data:{userCurrency:t.userCurrency,quantity:t.quantity,currency:o,paymentChoices:(i=(n=c.paymentChoices)==null?void 0:n.map(d=>{var u;return B(P({},d),{totalAmountStr:(u=d.totalAmountStr)!=null?u:""})}))!=null?i:[],enableAutoDeduct:t.enableAutoDeduct},buttons:{confirm:{text:t.confirmButtonText,onPress:d=>g(ll,null,function*(){var f,m,v,b,y,_,E,C;if(j(a.trackEvents.payEnsure,{targetType:"game",eventType:K.Click,payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(m=(f=c.paymentChoices.find(x=>x.productId===d))==null?void 0:f.totalAmountStr)!=null?m:""}),!((v=S.hostUserInfo)!=null&&v.isLogin)){let{data:x}=yield $f({skipLogin:!0});if(!(x!=null&&x.isLogin)){console.log("login failed");return}let k=yield s.refreshProductsInfo();if(((b=k==null?void 0:k.balance)!=null?b:0)>=t.quantity){M.emit(Ht,{paymentResult:"SUCCESS",currency:o}),l.destroy();return}}console.log("invokeNativePayment",d);let u=(_=(y=c==null?void 0:c.paymentChoices)==null?void 0:y.find(x=>x.productId===d))==null?void 0:_.appStoreProductId;if(!u){M.emit(Ht,{paymentResult:"FAILED",currency:o}),l.destroy();return}yield Di.show({duration:3e3});let{code:p}=yield Mn.invokePayment(a.paymentType,{productId:d,appStoreProductId:u});if(Di.hide(),j(a.trackEvents.payResult,{eventType:K.Other,targetType:"game",payWay:"app_iap",coinAmount:t.quantity,currency:o,orderPrice:(C=(E=c.paymentChoices.find(x=>x.productId===d))==null?void 0:E.totalAmountStr)!=null?C:"",payResult:p}),p!=="SUCCESS"){console.info("[JoliboxSDK] payment failed in payment.invokePaymet");return}Tr("{slot-success} {slot-i18n-jolicoin.unlockSuccess}",{position:"center",duration:3e3}),M.emit(Ht,{paymentResult:"SUCCESS",currency:o}),l.destroy()})},cancel:{text:t.cancelButtonText,onPress:({type:d})=>{M.emit(Ht,{paymentResult:(d!=null?d:"")==="CANCEL"?"CANCEL":"FAILED",currency:o}),j(a.trackEvents.adUnlock,{targetType:"game",eventType:K.Click,currency:o}),l.destroy()}},onEnableDeductChanged:d=>g(ll,null,function*(){yield Xc(d,a.apiEndpointAutoDeduct)})},onSelect:d=>{var u,p;j(a.trackEvents.orderClick,{targetType:"game",eventType:K.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),M.emit(Ht,{paymentResult:"FAILED",currency:t.currency})}}));lT.getProductsInfo().catch(e=>{console.error("preload joli coin payment details failed",e)});uT.getProductsInfo().catch(e=>{console.error("preload joli gem payment details failed",e)})});var fT=h(ul=>{"use strict";Je();lr();ua();ft();_t();R();Yc();cr();wt();var hV={JOLI_COIN:{frequencyChecker:Mx,frequencyUpdater:Vx,trackEvents:{modalExpose:"LoginGuideModal",clickConfirm:"LoginGuideModal",clickConfirmLogin:"LoginGuideModal",modalHide:"LoginGuideModal",clickClose:"LoginGuideModal",clickWatchAds:"LoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.rewardTips}",usedText:"Jolicoin Used"}},JOLI_GEM:{frequencyChecker:Bx,frequencyUpdater:zx,trackEvents:{modalExpose:"GemLoginGuideModal",clickConfirm:"GemLoginGuideModal",clickConfirmLogin:"GemLoginGuideModal",modalHide:"GemLoginGuideModal",clickClose:"GemLoginGuideModal",clickWatchAds:"GemLoginGuideModal"},toastMessage:{i18nKey:"{slot-i18ntran-loginGuide.gemRewardTips}",usedText:"Gem Used"}}},pT=He(M,Vt);pT.getData();M.on(tl,(e,t)=>g(ul,null,function*(){var r;try{let n=t.currency,i=hV[n];if(e.includes("ADS-")){let s=yield pT.getData();if(console.log(`${n} unlogin guide config`,s.loginGuide),!s.loginGuide.show){M.emit(Pr,{result:"NOT_SUPPORT"});return}let{canShow:c}=yield i.frequencyChecker(s.loginGuide);if(console.log(`${n} canShowUseModal`,c),!c){M.emit(Pr,{result:"FAILED"});return}}let{firstLogin:o}=(r=yield gV())!=null?r:{};if(!(o!=null&&o.reward)){console.log("[JoliboxSDK] unlogin modal reward is empty"),M.emit(Pr,{result:"NOT_SUPPORT"});return}j(i.trackEvents.modalExpose,{eventType:K.Expose,currency:n},K.Expose);let a=Lk({data:{rewardType:e,rewardValue:o.reward.rewardValue,currency:t.currency},buttons:{confirm:{text:t.confirmButtonText,onPress:()=>g(ul,null,function*(){var d,u,p,f;j(i.trackEvents.clickConfirm,{type:"click_confirm",eventType:K.Click,currency:n},K.Click);let{isLogin:s,extra:c,isFirstLogin:l}=yield Vf({},!0);if(!s){console.log("login failed");return}if(j(i.trackEvents.clickConfirmLogin,{type:"click_confirm_login",isFirstLogin:l,eventType:K.Click,currency:n},K.Click),l&&((d=c==null?void 0:c.firstLogin)!=null&&d.reward)){let{rewardValue:m}=c.firstLogin.reward;Tr(i.toastMessage.i18nKey,{i18nParams:{text:i.toastMessage.usedText,coin:m},position:"top",duration:3e3})}M.emit(Pr,{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:K.Hide,currency:n},K.Hide);let c=s==="CANCEL"?"click_close":"click_watch_ads",l=s==="CANCEL"?i.trackEvents.clickClose:i.trackEvents.clickWatchAds;j(l,{type:c,eventType:K.Click,currency:n},K.Click),M.emit(Pr,{result:"FAILED"}),a.destroy()}}}});yield i.frequencyUpdater()}catch(n){ke(new Eg(n)),M.emit(Pr,{result:"FAILED"})}}));var gV=()=>g(ul,null,function*(){var t;let{response:e}=yield X("/api/base/global-config",{method:"GET",appendHostCookie:!0,responseType:"json"});return(t=e.data)==null?void 0:t.data})});function vV(){let e=new Map;return{registerSubscriptionHandler(r,n){e.set(r,n)},invokeSubscription(r,...n){return g(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 ke(o),{code:"FAILED",message:`[joliboxSDK]: subscription error ${o}`}}})}}}var pa,cm=T(()=>{"use strict";_t();pa=vV()});var Fn,dl=T(()=>{"use strict";Fn={PlaceOrderFailed:1001,CancelOrderFailed:1002,SubscriptionFailed:1003,InvalidPlan:1004}});var yV,mT,pl,bV,fa,lm=T(()=>{"use strict";dl();R();$();yV=()=>{let[e,t]=[Ha,Va].map(r=>(n,i,o)=>new r(n,i,o));return{createSubscriptionError:e,createSubscriptionInternalError:t}},{createSubscriptionError:mT,createSubscriptionInternalError:pl}=yV(),bV=S.testMode?"https://stg-game.jolibox.com":"https://game.jolibox.com",fa=class{constructor(){this._orderId=null;this._orderStatus="INIT";this.startSubscription=t=>g(this,null,function*(){this._orderId&&(yield this.cancelOrder(this.orderId));let{code:r,message:n}=yield this.placeOrder(t);if(r!=="SUCCESS")throw mT(n,Fn.PlaceOrderFailed);return yield this.subscribe(t)});this.generateCallbackUrl=()=>{let t=new URLSearchParams("");return t.set("utm_source",S.deviceInfo.platform),t.set("joliSource",S.encodeJoliSourceQuery(P({},this.generateSubscriptionContext()))),`${bV}/subscription/callback?${t.toString()}`};this.createSubscriptionError=mT;this.createSubscriptionInternalError=pl}setOrderId(t){this._orderId=t}setOrderStatus(t){this._orderStatus=t}get orderId(){return this._orderId}get status(){return this._orderStatus}}});function _V(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=>!oo(r.amountStr))}var jn,ml,um,dm,fl,hT,pm=T(()=>{"use strict";R();ce();ft();R();nm();cm();ce();lm();dl();jn=class jn{static getNativePriceCache(t){var n;let r=t.sort().join(",");return(n=this.nativePriceCache.get(r))!=null?n:{}}execute(t,r){return g(this,null,function*(){var a,s;let{response:n}=yield X(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&&_V(i,c)}if(i.length===0)throw new Error("subscription tiers is empty");return i})}requestNativeSubscriptionPlans(t,r){return g(this,null,function*(){try{let{data:n}=yield de("requestSubscriptionPlansAsync",{appStoreProductIds:t,type:"game"});return n&&(jn.nativePriceCache.set(r,n),jn.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 g(this,null,function*(){let n=t.sort().join(",");return(r?sT:il)(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 g(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")}};jn.nativePriceCache=new Map,jn.NATIVE_PRICE_CACHE_DURATION=1*24*60*60*1e3,jn.nativePriceCacheTimestamp=new Map;ml=jn,um=class extends Ft{constructor(r){super(new ml,{duration:30*60*1e3,timeout:3e3});this.apiEndpoint=r;this.pendingSubscriptions=new Map;this.subInfoCacheKeys=[];this.listenSubscriptionPanelStateChange()}getSubInfo(){return g(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 g(this,null,function*(){return this.forceRequest(this.apiEndpoint)})}updateNativePriceCache(r){return g(this,null,function*(){yield this.requestAdapter.updateNativePriceCache(r)})}updateAllNativePriceCache(){return g(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 g(this,null,function*(){var s;console.log("[SubscriptionService] subscribe params",pa);let n=new AbortController,i=pa.invokeSubscription("SUB_APP",{productId:r.nativeProductId,appStoreProductId:r.appStoreProductId,planId:r.basePlanId}),o=this.pollSubscriptionStatus(n.signal),a=yield Promise.race([i.then(c=>{var l;return n.abort(),{result:c.code,subPlanId:(l=c.data)==null?void 0:l.subPlanId,message:c.message}}),o.then(c=>(c==null?void 0:c.result)==="SUCCESS"?(n.abort(),c):new Promise(()=>{console.log("[SubscriptionPolling] Timeout for subscriptionService.subscribe completion")}))]);return{result:a.result,subPlanId:a.subPlanId,message:(s=a.message)!=null?s:""}})}pollSubscriptionStatus(r){return g(this,null,function*(){var o,a;for(let s=0;s<10;s++){if(r.aborted){console.log("[SubscriptionPolling] Aborted due to subscribe completion");return}try{let{response:c}=yield X("/api/subs/info",{method:"GET",appendHostCookie:!0,responseType:"json"});if(((a=(o=c.data)==null?void 0:o.data)==null?void 0:a.status)==="ACTIVE")return{result:"SUCCESS",subPlanId:c.data.data.subPlanId,message:"Subscription activated via polling"}}catch(c){console.warn(`[SubscriptionPolling] Attempt ${s+1} failed:`,c)}s<9&&!r.aborted&&(yield Ga(5e3))}})}invokeSubscriptionPanel(){return g(this,null,function*(){var i,o;let r=new pt,n;try{if(console.log("[invokeSubscriptionPanel] requestSubscriptionSync params"),n=(i=L("invokeSubscriptionPanelSync",{type:"game"}).data)==null?void 0:i.subUUID,!n)throw pl("orderUUID is null",Fn.SubscriptionFailed);this.pendingSubscriptions.set(n,r)}catch(a){throw pl((o=JSON.stringify(a))!=null?o:"subscription panel failed",Fn.SubscriptionFailed)}return r.promise})}getTierByProductId(r){return g(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=ml.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(){we("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"}}))})}},dm=class extends um{constructor(){super("/api/subs/pricing")}},fl=null,hT=()=>fl||(fl=new dm,fl)});var gT=T(()=>{"use strict"});function yT(){let e=new Map;return t=>g(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=wV[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 fm,vT,mm,hm,wV,bT=T(()=>{"use strict";$();lm();da();nl();R();ce();R();dl();we("onGlobalSubscriptionStateChange",e=>{let{status:t,orderResponse:r}=e;console.log("[onGlobalSubscriptionStateChange] data",e),t==="SUCCESS"&&(r!=null&&r.subPlanId||r!=null&&r.ticketId)&&S.onEnvConfigChanged({hostUserInfo:{isLogin:!0,isSubUser:!0}})});fm=new Map;we("onSubscritptionStateChange",e=>{var o,a,s;let{subUUID:t,status:r,orderResponse:n}=e;console.log("[onSubscritptionStateChange] data",e);let i=fm.get(t);if(i){if(r==="SUCCESS")console.log("=======onSubscritptionStateChange",r,(o=n==null?void 0:n.subPlanId)!=null?o:n==null?void 0:n.ticketId),i.resolve({code:"SUCCESS",message:"jolicoin payment success",data:{subPlanId:(a=n==null?void 0:n.subPlanId)!=null?a:n==null?void 0:n.ticketId}});else{if(r==="FAILED"&&Ja(n==null?void 0:n.errNo)&&(n==null?void 0:n.errNo)!==0)throw xt(`subscription failed: ${n==null?void 0:n.errMsg}`,Fn.SubscriptionFailed);i.resolve({code:r,message:(s=n==null?void 0:n.errMsg)!=null?s:"UNKNOWN_ERROR"})}fm.delete(t)}});vT=e=>g(void 0,null,function*(){var n,i;let t=new pt,r;try{if(console.log("[internalSubscribe] requestSubscriptionSync params",e),r=(n=L("requestSubscriptionSync",P({params:{basePlanId:e.basePlanId,appStoreProductId:e.appStoreProductId,productId:e.productId}},e.appAccountToken?{paymentBody:{appAccountToken:e.appAccountToken,appStoreProductId:e.appStoreProductId}}:{})).data)==null?void 0:n.subUUID,!r)throw xt("subUUID is null",1002);fm.set(r,t)}catch(o){throw xt((i=JSON.stringify(o))!=null?i:"jolicoin payment failed",1002)}return t.promise}),mm=class extends fa{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return g(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 g(this,null,function*(){return yield vT(r)})}},hm=class extends fa{constructor(r,n){super();this.productId=r;this.planId=n}placeOrder(r){return g(this,null,function*(){var o,a;console.log("----start place order for iOS subscription----");let n=L("envSync"),i=(a=(o=n==null?void 0:n.data)==null?void 0:o.hostUserInfo)==null?void 0:a.appAccountToken;if(!i)throw xt("appAccountToken is null",1002);return this.subscriptionToken=i,{code:"SUCCESS",message:"placeorder sub-app success in native"}})}cancelOrder(r){return g(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 g(this,null,function*(){return yield vT(B(P({},r),{appAccountToken:this.subscriptionToken}))})}},wV={android:mm,ios:hm}});var Bn,gm=T(()=>{"use strict";pm();gT();cm();bT();pm();Bn=hT();pa.registerSubscriptionHandler("SUB_APP",yT())});var IT=h(ST=>{"use strict";ua();Je();lr();Ve();gm();cr();var SV={SUBSCRIPTION:{frequencyConfigKey:"joinMember",frequencyChecker:Gx,frequencyUpdater:Kx}},_T=Rn(),wT=He(M,Vt);wT.getData();M.on(rl,e=>g(ST,null,function*(){let t=SV.SUBSCRIPTION;if(!ye("invokeSubscriptionPanelSync")){console.info("invokeSubscriptionPanelSync not supported"),setTimeout(()=>{M.emit(qn,{result:"FAILED"})},0);return}yield _T.show({duration:3e3});let r=yield wT.getData(),{canShow:n,isFirst:i}=yield t.frequencyChecker(r.joliCoinUseAndCharge[t.frequencyConfigKey]);if(_T.hide(),!n){M.emit(qn,{result:"FAILED"});return}let{data:o,code:a}=yield Bn.invokeSubscriptionPanel();a=="SUCCESS"?M.emit(qn,{result:"SUCCESS"}):M.emit(qn,{result:"FAILED"}),yield t.frequencyUpdater()}))});var Iie,Eie,Aie,Cie,ET=T(()=>{"use strict";Iie=se(Qx()),Eie=se(dT()),Aie=se(fT()),Cie=se(IT())});var Li,vm=T(()=>{"use strict";Li=(e,t)=>{window.dispatchEvent(new CustomEvent(e,{detail:t}));let r=window.parent;r&&r!==window&&typeof r.postMessage=="function"&&r.postMessage({type:e,data:{detail:t}},"*")}});function qV(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function UV(e){return typeof e=="string"}function MV(e){return typeof e=="undefined"}function FV(e){return MV(e)||e===null}function jV(e){return typeof e=="function"}function nP(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 ma(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}function bl(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 WV(e){let t=e.location?bl(e.location,PT):null,r=e.target?bl(e.target,PT):null;return bl(NV(RV({},e),{location:t,target:r}),VV)}function zV(e){let t=e.events.map(n=>WV(n)),r=bl(e.device,$V);return[e.protocolVersion,t,r,e.project]}function KV(){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 e$(e){return new Promise(t=>sP(e)(t))}function sP(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 t$(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new _a(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 n$(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)i$(e[n],t[n])}function i$(e,t){if(UV(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(jV(t)){try{if(e instanceof t)return}catch(r){}if(!FV(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 gt(e,t,r){return(t=o$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o$(e){var t=a$(e,"string");return typeof t=="symbol"?t:t+""}function a$(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 hl(e,t,r){return(t=s$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s$(e){var t=c$(e,"string");return typeof t=="symbol"?t:t+""}function c$(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 gl(e,t,r){return(t=l$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l$(e){var t=u$(e,"string");return typeof t=="symbol"?t:t+""}function u$(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Nr(e,t,r){return(t=d$(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function d$(e){var t=p$(e,"string");return typeof t=="symbol"?t:t+""}function p$(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 f$(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 m$(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 _$(e,t){return Ye(e,0)^45?(((t<<2^Ye(e,0))<<2^Ye(e,1))<<2^Ye(e,2))<<2^Ye(e,3):0}function uP(e){return e.trim()}function w$(e,t){return(e=t.exec(e))?e[0]:e}function ne(e,t,r){return e.replace(t,r)}function Dm(e,t){return e.indexOf(t)}function Ye(e,t){return e.charCodeAt(t)|0}function wa(e,t,r){return e.slice(t,r)}function fr(e){return e.length}function ah(e){return e.length}function vl(e,t){return t.push(e),e}function S$(e,t){return e.map(t).join("")}function Ml(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:Ul,column:Gi,length:a,return:""}}function ga(e,t){return b$(Ml("",null,null,"",null,null,0),e,{length:-e.length},t)}function I$(){return qe}function E$(){return qe=yt>0?Ye(Hi,--yt):0,Gi--,qe===10&&(Gi=1,Ul--),qe}function Pt(){return qe=yt<dP?Ye(Hi,yt++):0,Gi++,qe===10&&(Gi=1,Ul++),qe}function mr(){return Ye(Hi,yt)}function _l(){return yt}function Ea(e,t){return wa(Hi,e,t)}function Sa(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 pP(e){return Ul=Gi=1,dP=fr(Hi=e),yt=0,[]}function fP(e){return Hi="",e}function wl(e){return uP(Ea(yt-1,Lm(e===91?e+2:e===40?e+1:e)))}function A$(e){for(;(qe=mr())&&qe<33;)Pt();return Sa(e)>2||Sa(qe)>3?"":" "}function C$(e,t){for(;--t&&Pt()&&!(qe<48||qe>102||qe>57&&qe<65||qe>70&&qe<97););return Ea(e,_l()+(t<6&&mr()==32&&Pt()==32))}function Lm(e){for(;Pt();)switch(qe){case e:return yt;case 34:case 39:e!==34&&e!==39&&Lm(qe);break;case 40:e===41&&Lm(e);break;case 92:Pt();break}return yt}function k$(e,t){for(;Pt()&&e+qe!==57&&!(e+qe===84&&mr()===47););return"/*"+Ea(t,yt-1)+"*"+ql(e===47?e:Pt())}function x$(e){for(;!Sa(mr());)Pt();return Ea(e,yt)}function T$(e){return fP(Sl("",null,null,null,[""],e=pP(e),0,[0],e))}function Sl(e,t,r,n,i,o,a,s,c){for(var l=0,d=0,u=a,p=0,f=0,m=0,v=1,b=1,y=1,_=0,E="",C=i,x=o,k=n,A=E;b;)switch(m=_,_=Pt()){case 40:if(m!=108&&Ye(A,u-1)==58){Dm(A+=ne(wl(_),"&","&\f"),"&\f")!=-1&&(y=-1);break}case 34:case 39:case 91:A+=wl(_);break;case 9:case 10:case 13:case 32:A+=A$(m);break;case 92:A+=C$(_l()-1,7);continue;case 47:switch(mr()){case 42:case 47:vl(P$(k$(Pt(),_l()),t,r),c);break;default:A+="/"}break;case 123*v:s[l++]=fr(A)*y;case 125*v:case 59:case 0:switch(_){case 0:case 125:b=0;case 59+d:y==-1&&(A=ne(A,/\f/g,"")),f>0&&fr(A)-u&&vl(f>32?NT(A+";",n,r,u-1):NT(ne(A," ","")+";",n,r,u-2),c);break;case 59:A+=";";default:if(vl(k=RT(A,t,r,l,d,i,s,E,C=[],x=[],u),o),_===123)if(d===0)Sl(A,t,k,k,C,o,u,s,x);else switch(p===99&&Ye(A,3)===110?100:p){case 100:case 108:case 109:case 115:Sl(e,k,k,n&&vl(RT(e,k,k,0,0,i,s,E,i,C=[],u),x),i,x,u,s,n?C:x);break;default:Sl(A,k,k,k,[""],x,0,s,x)}}l=d=f=0,v=y=1,E=A="",u=a;break;case 58:u=1+fr(A),f=m;default:if(v<1){if(_==123)--v;else if(_==125&&v++==0&&E$()==125)continue}switch(A+=ql(_),_*v){case 38:y=d>0?1:(A+="\f",-1);break;case 44:s[l++]=(fr(A)-1)*y,y=1;break;case 64:mr()===45&&(A+=wl(Pt())),p=mr(),d=u=fr(E=A+=x$(_l())),_++;break;case 45:m===45&&fr(A)==2&&(v=0)}}return o}function RT(e,t,r,n,i,o,a,s,c,l,d){for(var u=i-1,p=i===0?o:[""],f=ah(p),m=0,v=0,b=0;m<n;++m)for(var y=0,_=wa(e,u+1,u=y$(v=a[m])),E=e;y<f;++y)(E=uP(v>0?p[y]+" "+_:ne(_,/&\f/g,p[y])))&&(c[b++]=E);return Ml(e,t,r,i===0?ih:s,c,l,d)}function P$(e,t,r){return Ml(e,t,r,cP,ql(I$()),wa(e,2,-2),0)}function NT(e,t,r,n){return Ml(e,t,r,oh,wa(e,0,n),wa(e,n+1,-1),n)}function Bi(e,t){for(var r="",n=ah(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function O$(e,t,r,n){switch(e.type){case v$:if(e.children.length)break;case g$:case oh:return e.return=e.return||e.value;case cP:return"";case lP:return e.return=e.value+"{"+Bi(e.children,n)+"}";case ih:e.value=e.props.join(",")}return fr(r=Bi(e.children,n))?e.return=e.value+"{"+r+"}":""}function R$(e){var t=ah(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 N$(e){return function(t){t.root||(t=t.return)&&e(t)}}function D$(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}function mP(e,t){switch(_$(e,t)){case 5103:return re+"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 re+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return re+e+Tl+e+ot+e+e;case 6828:case 4268:return re+e+ot+e+e;case 6165:return re+e+ot+"flex-"+e+e;case 5187:return re+e+ne(e,/(\w+).+(:[^]+)/,re+"box-$1$2"+ot+"flex-$1$2")+e;case 5443:return re+e+ot+"flex-item-"+ne(e,/flex-|-self/,"")+e;case 4675:return re+e+ot+"flex-line-pack"+ne(e,/align-content|flex-|-self/,"")+e;case 5548:return re+e+ot+ne(e,"shrink","negative")+e;case 5292:return re+e+ot+ne(e,"basis","preferred-size")+e;case 6060:return re+"box-"+ne(e,"-grow","")+re+e+ot+ne(e,"grow","positive")+e;case 4554:return re+ne(e,/([^-])(transform)/g,"$1"+re+"$2")+e;case 6187:return ne(ne(ne(e,/(zoom-|grab)/,re+"$1"),/(image-set)/,re+"$1"),e,"")+e;case 5495:case 3959:return ne(e,/(image-set\([^]*)/,re+"$1$`$1");case 4968:return ne(ne(e,/(.+:)(flex-)?(.*)/,re+"box-pack:$3"+ot+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+re+e+e;case 4095:case 3583:case 4068:case 2532:return ne(e,/(.+)-inline(.+)/,re+"$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(fr(e)-1-t>6)switch(Ye(e,t+1)){case 109:if(Ye(e,t+4)!==45)break;case 102:return ne(e,/(.+:)(.+)-([^]+)/,"$1"+re+"$2-$3$1"+Tl+(Ye(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Dm(e,"stretch")?mP(ne(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Ye(e,t+1)!==115)break;case 6444:switch(Ye(e,fr(e)-3-(~Dm(e,"!important")&&10))){case 107:return ne(e,":",":"+re)+e;case 101:return ne(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+re+(Ye(e,14)===45?"inline-":"")+"box$3$1"+re+"$2$3$1"+ot+"$2box$3")+e}break;case 5936:switch(Ye(e,t+11)){case 114:return re+e+ot+ne(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return re+e+ot+ne(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return re+e+ot+ne(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return re+e+ot+e+e}return e}function J$(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 Pl(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 un={name:i.name,styles:i.styles,next:un},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)un={name:a.name,styles:a.styles,next:un},a=a.next;var s=o.styles+";";return s}return W$(e,t,r)}}var c=r;if(t==null)return c;var l=t[c];return l!==void 0?l:c}function W$(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Pl(e,t,r[i])+";";else for(var o in r){var a=r[o];if(typeof a!="object"){var s=a;t!=null&&t[s]!==void 0?n+=o+"{"+t[s]+"}":LT(s)&&(n+=bm(o)+":"+qT(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++)LT(a[c])&&(n+=bm(o)+":"+qT(o,a[c])+";");else{var l=Pl(e,t,a);switch(o){case"animation":case"animationName":{n+=bm(o)+":"+l+";";break}default:n+=o+"{"+l+"}"}}}return n}function _m(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="";un=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=Pl(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=Pl(r,t,e[s]),n){var c=o;i+=c[s]}UT.lastIndex=0;for(var l="",d;(d=UT.exec(i))!==null;)l+="-"+d[1];var u=J$(i)+l;return{name:u,styles:i,next:un}}function gP(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}function MT(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function FT(e,t,r){var n=[],i=gP(e,n,r);return n.length<2?r:i+t(n)}function Z$(e,t){Be.__h&&Be.__h(Tt,e,BT||t),BT=0;var r=Tt.__H||(Tt.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function yP(e,t){var r=Z$(qm++,7);return r9(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function e9(){for(var e;e=vP.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Il),e.__H.__h.forEach(Um),e.__H.__h=[]}catch(t){e.__H.__h=[],Be.__e(t,e.__v)}}function t9(e){var t,r=function(){clearTimeout(n),zT&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);zT&&(t=requestAnimationFrame(r))}function Il(e){var t=Tt,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),Tt=t}function Um(e){var t=Tt;e.__c=e.__(),Tt=t}function r9(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function Fl(){if(dn>1)dn--;else{for(var e,t=!1;ya!==void 0;){var r=ya;for(ya=void 0,Mm++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&_P(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Mm=0,dn--,t)throw e}}function Ce(e){if(dn>0)return e();dn++;try{return e()}finally{Fl()}}function bP(e){if(le!==void 0){var t=e.n;if(t===void 0||t.t!==le)return t={i:0,S:e,p:le.s,n:void 0,t:le,e:void 0,x:void 0,r:t},le.s!==void 0&&(le.s.n=t),le.s=t,e.n=t,32&le.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=le.s,t.n=void 0,le.s.n=t,le.s=t),t}}function Xe(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}function W(e){return new Xe(e)}function _P(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 wP(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 SP(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 Vi(e){Xe.call(this,void 0),this.x=e,this.s=void 0,this.g=Ol-1,this.f=4}function ba(e){return new Vi(e)}function IP(e){var t=e.u;if(e.u=void 0,typeof t=="function"){dn++;var r=le;le=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,sh(e),n}finally{le=r,Fl()}}}function sh(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,IP(e)}function i9(e){if(le!==this)throw new Error("Out-of-order effect");SP(this),le=e,this.f&=-2,8&this.f&&sh(this),Fl()}function Aa(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}function Ca(e){var t=new Aa(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}function $i(e,t){q[e]=t.bind(null,q[e]||function(){})}function Rl(e){Sm&&Sm(),Sm=e&&e.S()}function CP(e){var t=this,r=e.data,n=kP(r);n.value=r;var i=yP(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var l=ba(function(){var f=n.value.value;return f===0?0:f===!0?"":f||""}),d=ba(function(){return!Array.isArray(l.value)&&!Vu(l.value)}),u=Ca(function(){if(this.N=xP,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 o9(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=W(r);return{o:function(a,s){o.value=a,n=s},d:Ca(function(){this.N=xP;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}function kP(e){return yP(function(){return W(e)},[])}function s9(){Ce(function(){for(var e;e=AP.shift();)EP.call(e)})}function xP(){AP.push(this)===1&&(q.requestAnimationFrame||a9)(s9)}function c9(e,t){let r=pi(e);di(()=>{r.current=e},[e]),Yr(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}function G(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:--l9,__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 q.vnode&&q.vnode(l),l}function Dr(e,t,r){return(t=b9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function b9(e){var t=_9(e,"string");return typeof t=="symbol"?t:t+""}function _9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ut(e,t,r){return(t=R9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R9(e){var t=N9(e,"string");return typeof t=="symbol"?t:t+""}function N9(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 Lr(e,t,r){return(t=L9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function L9(e){var t=q9(e,"string");return typeof t=="symbol"?t:t+""}function q9(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 it(e,t,r){return(t=U9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function U9(e){var t=M9(e,"string");return typeof t=="symbol"?t:t+""}function M9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vt(e,t,r){return(t=F9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F9(e){var t=j9(e,"string");return typeof t=="symbol"?t:t+""}function j9(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 Gn(e,t,r){return(t=B9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B9(e){var t=G9(e,"string");return typeof t=="symbol"?t:t+""}function G9(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 Im(e,t,r){return(t=J9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function J9(e){var t=H9(e,"string");return typeof t=="symbol"?t:t+""}function H9(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 dt(e,t,r){return(t=V9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V9(e){var t=$9(e,"string");return typeof t=="symbol"?t:t+""}function $9(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W9(e,t,r){return(t=z9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function z9(e){var t=K9(e,"string");return typeof t=="symbol"?t:t+""}function K9(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 qr(e,t,r){return(t=X9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function X9(e){var t=Q9(e,"string");return typeof t=="symbol"?t:t+""}function Q9(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 Ur(e,t,r){return(t=Z9(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z9(e){var t=eW(e,"string");return typeof t=="symbol"?t:t+""}function eW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function va(e,t,r){return(t=tW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tW(e){var t=rW(e,"string");return typeof t=="symbol"?t:t+""}function rW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function iW(e,t){return t==="call"&&e.join(".")==="GameSDK.showRewardAd"?0:15e3}function YT(e,t,r,n){return new Promise((i,o)=>{if(!window.parent||window.parent===window){o(new Error("[ParentProxy] No parent window"));return}let a=`${Em}-${++nW}`,s=d=>{let u=d.data;(u==null?void 0:u.type)===`${Em}:response`&&u.id===a&&(window.removeEventListener("message",s),l&&clearTimeout(l),u.error?o(new Error(u.error)):i(u.result))},c=iW(e,t),l=c>0?window.setTimeout(()=>{window.removeEventListener("message",s),o(new Error(`[ParentProxy] Timeout after ${c}ms: ${e.join(".")}.${t}`))},c):null;window.addEventListener("message",s),window.parent.postMessage({type:`${Em}:request`,id:a,path:e,action:t,args:r,value:n},"*")})}function LP(e){return console.log("[JoliboxSDK] NewsBreak createProxyForPath basePath:",e),new Proxy(()=>{},{get(t,r){if(console.log("[JoliboxSDK] NewsBreak createProxyForPath get:",r),!(r==="then"||r==="toJSON"||typeof r=="symbol"))return LP([...e,r])},set(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath set:",r),YT([...e,r],"set",void 0,n).catch(i=>{console.warn(`[ParentProxy] set ${[...e,r].join(".")} failed:`,i)}),!0},apply(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath apply:",n),YT(e,"call",n)}})}function oW(e){return LP([e])}function Mi(e,t,r){return(t=aW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function aW(e){var t=sW(e,"string");return typeof t=="symbol"?t:t+""}function sW(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 XT(e,t,r){return(t=cW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cW(e){var t=lW(e,"string");return typeof t=="symbol"?t:t+""}function lW(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 $t(e,t,r){return(t=uW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function uW(e){var t=dW(e,"string");return typeof t=="symbol"?t:t+""}function dW(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 yl(e,t,r){return(t=pW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pW(e){var t=fW(e,"string");return typeof t=="symbol"?t:t+""}function fW(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 Am(e,t,r){return(t=mW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mW(e){var t=hW(e,"string");return typeof t=="symbol"?t:t+""}function hW(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 me(e,t,r){return(t=gW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function gW(e){var t=vW(e,"string");return typeof t=="symbol"?t:t+""}function vW(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 Mr(e,t,r){return(t=wW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function wW(e){var t=SW(e,"string");return typeof t=="symbol"?t:t+""}function SW(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 dr(e,t,r){return(t=IW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function IW(e){var t=EW(e,"string");return typeof t=="symbol"?t:t+""}function EW(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wt(e,t,r){return(t=AW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AW(e){var t=CW(e,"string");return typeof t=="symbol"?t:t+""}function CW(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 ln(e,t,r){return(t=kW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function kW(e){var t=xW(e,"string");return typeof t=="symbol"?t:t+""}function xW(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 pr(e,t,r){return(t=TW(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function TW(e){var t=PW(e,"string");return typeof t=="symbol"?t:t+""}function PW(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 IV,EV,AV,kl,QT,ZT,AT,eP,CV,kV,tP,xV,TV,CT,PV,OV,kT,RV,NV,DV,rP,LV,BV,GV,xT,JV,TT,HV,iP,oP,aP,PT,VV,$V,Fi,xl,Cm,_e,YV,XV,ha,_a,QV,xm,ZV,ym,r$,Tm,OT,qi,Pm,Om,Rm,Nm,h$,ot,Tl,re,cP,ih,oh,g$,lP,v$,y$,ql,b$,Ul,Gi,dP,yt,qe,Hi,L$,q$,U$,DT,M$,F$,j$,B$,G$,H$,V$,$$,hP,LT,bm,qT,UT,un,z$,K$,Y$,X$,Q$,st,qm,Tt,wm,jT,BT,vP,Be,GT,JT,HT,VT,$T,WT,zT,n9,le,ya,dn,Mm,Ol,EP,Sm,AP,a9,Ge,l9,u9,Fr,Fm,jm,El,d9,p9,f9,m9,h9,g9,v9,TP,y9,PP,Bm,w9,S9,I9,E9,A9,C9,k9,KT,x9,T9,P9,O9,Gm,ji,Ui,OP,D9,RP,Jm,NP,DP,Hm,Vm,$m,Ia,Nl,Y9,Dl,Wm,zm,Km,Em,nW,Al,Ym,Xm,Ji,Qm,at,Zm,Cl,yW,bW,_W,eh,th,rh,nh,Ll,ch=T(()=>{"use strict";ti();Ns();ce();IV=Object.defineProperty,EV=Object.defineProperties,AV=Object.getOwnPropertyDescriptors,kl=Object.getOwnPropertySymbols,QT=Object.prototype.hasOwnProperty,ZT=Object.prototype.propertyIsEnumerable,AT=(e,t,r)=>t in e?IV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eP=(e,t)=>{for(var r in t||(t={}))QT.call(t,r)&&AT(e,r,t[r]);if(kl)for(var r of kl(t))ZT.call(t,r)&&AT(e,r,t[r]);return e},CV=(e,t)=>EV(e,AV(t)),kV=(e,t)=>{var r={};for(var n in e)QT.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&kl)for(var n of kl(e))t.indexOf(n)<0&&ZT.call(e,n)&&(r[n]=e[n]);return r},tP=Object.defineProperty,xV=Object.defineProperties,TV=Object.getOwnPropertyDescriptors,CT=Object.getOwnPropertySymbols,PV=Object.prototype.hasOwnProperty,OV=Object.prototype.propertyIsEnumerable,kT=(e,t,r)=>t in e?tP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,RV=(e,t)=>{for(var r in t||(t={}))PV.call(t,r)&&kT(e,r,t[r]);if(CT)for(var r of CT(t))OV.call(t,r)&&kT(e,r,t[r]);return e},NV=(e,t)=>xV(e,TV(t)),DV=(e,t)=>{for(var r in t)tP(e,r,{get:t[r],enumerable:!0})},rP=(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},LV=(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}BV=(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))(BV||{});GV={log:ma("log"),warn:ma("warn"),info:ma("info"),error:ma("error"),debug:ma("debug")};Object.assign(globalThis,{logger:GV});xT=Symbol.for("Jolibox.canIUseMap"),JV={};globalThis[xT]||(globalThis[xT]=JV);TT=Symbol.for("Jolibox.canIUseMap.native"),HV={};globalThis[TT]||(globalThis[TT]=HV);iP=(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))(iP||{}),oP=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(oP||{}),aP=(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))(aP||{}),PT=["name","params"],VV=["name","type","location","target","extra","timestamp","userId"],$V=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];KV();Fi=typeof window=="undefined",xl=()=>!Fi&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!Fi&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!Fi&&navigator.userAgent.includes("Android"),!Fi&&navigator.userAgent.includes("Mac"),!Fi&&navigator.userAgent.includes("FB_IAB"),!Fi&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");Cm=class km{constructor(t){this.element=t,this.next=km.Undefined,this.prev=km.Undefined}};Cm.Undefined=new Cm(void 0);_e=Cm,YV=class{constructor(){this._first=_e.Undefined,this._last=_e.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===_e.Undefined}clear(){let e=this._first;for(;e!==_e.Undefined;){let t=e.next;e.prev=_e.Undefined,e.next=_e.Undefined,e=t}this._first=_e.Undefined,this._last=_e.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new _e(e);if(this._first===_e.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!==_e.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==_e.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==_e.Undefined&&e.next!==_e.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===_e.Undefined&&e.next===_e.Undefined?(this._first=_e.Undefined,this._last=_e.Undefined):e.next===_e.Undefined?(this._last=this._last.prev,this._last.next=_e.Undefined):e.prev===_e.Undefined&&(this._first=this._first.next,this._first.prev=_e.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==_e.Undefined;)yield e.element,e=e.next}},XV=0,ha=class{constructor(e){this.value=e,this.id=XV++}},_a=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 ha&&(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 ha(e);return this._listeners?this._listeners instanceof ha?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 ha)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 ha?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},QV=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 _a,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 YV,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)}},xm={};DV(xm,{None:()=>ZV,filter:()=>t$,once:()=>sP,toPromise:()=>e$});ZV=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});ym=Symbol.for("Jolibox.hostEmitter"),r$=()=>{let e=new QV;return globalThis[ym]||(globalThis[ym]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[ym]};r$();Tm=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new _a,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 n$(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}};Tm=rP([nP],Tm);OT=class{constructor(){this._onWillExecuteCommand=new _a,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new _a,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Tm,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=qV(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 LV(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),xm.toPromise(xm.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{}}};OT=rP([nP],OT);qi=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")},Pm=class{constructor(t){gt(this,"context",void 0),gt(this,"continueCallback",void 0),gt(this,"adIsShowingCallback",void 0),gt(this,"isBeforeAdCalled",!1),gt(this,"isBeforeRewardCalled",!1),gt(this,"isAdDismissedCalled",!1),gt(this,"isAdViewedCalled",!1),gt(this,"isAfterAdCalled",!1),gt(this,"currentProvider",void 0),gt(this,"currentClientParams",void 0),gt(this,"adsHasResponse",!1),gt(this,"videoChecker",window.document.createElement("video")),gt(this,"contextInfo",void 0),gt(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",eP({userEvent:a},this.paramsToTrack)),xl()&&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=qi(r);s==null||s()}),this.context=t,this.contextInfo=t.getContextInfo()}notifyIframeAdsEvent(t,r){let n=window.parent;n&&n!==window&&typeof n.postMessage=="function"&&n.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=qi(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),xl()&&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=qi(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=qi(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=qi(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=qi(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 g(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")})})}};Om=class{constructor(t){hl(this,"context",void 0),hl(this,"adBreakIsShowing",!1),hl(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),hl(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()})}};Rm=class{constructor(t){gl(this,"configs",null),gl(this,"firstRun",!0),gl(this,"context",void 0),gl(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return g(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}};Nm=class{constructor(t,r){Nr(this,"name","ADSENSE"),Nr(this,"context",void 0),Nr(this,"contextInfo",void 0),Nr(this,"configured",!1),Nr(this,"initParams",void 0),Nr(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),Nr(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=kV(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),Nr(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),Nr(this,"adUnit",n=>g(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 v=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),v&&b.setAttribute("data-ad-format",v),u&&b.setAttribute("data-full-width-responsive",u),p&&b.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let y=document.createElement("div");y.style.position="absolute",y.style.top="0",y.style.left="0",y.style.width="100%",y.style.height="100%",y.style.display="flex",y.style.justifyContent="center",y.style.alignItems="center",y.style.backgroundColor="rgba(0, 0, 0, 0.5)",y.style.color="white",y.innerHTML="Test Ad",b.style.position="relative",f.appendChild(b),b.appendChild(y)}else f.appendChild(b),new MutationObserver(y=>{y.forEach(_=>{if(_.type==="attributes"&&_.attributeName==="data-ad-status"){let 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 g(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)}})}};h$=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(m$(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=f$(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}(),ot="-ms-",Tl="-moz-",re="-webkit-",cP="comm",ih="rule",oh="decl",g$="@import",lP="@keyframes",v$="@layer",y$=Math.abs,ql=String.fromCharCode,b$=Object.assign;Ul=1,Gi=1,dP=0,yt=0,qe=0,Hi="";L$=function(e,t,r){for(var n=0,i=0;n=i,i=mr(),n===38&&i===12&&(t[r]=1),!Sa(i);)Pt();return Ea(e,yt)},q$=function(e,t){var r=-1,n=44;do switch(Sa(n)){case 0:n===38&&mr()===12&&(t[r]=1),e[r]+=L$(yt-1,t,r);break;case 2:e[r]+=wl(n);break;case 4:if(n===44){e[++r]=mr()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=ql(n)}while(n=Pt());return e},U$=function(e,t){return fP(q$(pP(e),t))},DT=new WeakMap,M$=function(e){if(!(e.type!=="rule"||!e.parent||e.length<1)){for(var t=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;r.type!=="rule";)if(r=r.parent,!r)return;if(!(e.props.length===1&&t.charCodeAt(0)!==58&&!DT.get(r))&&!n){DT.set(e,!0);for(var i=[],o=U$(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]}}},F$=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};j$=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case oh:e.return=mP(e.value,e.length);break;case lP:return Bi([ga(e,{value:ne(e.value,"@","@"+re)})],n);case ih:if(e.length)return S$(e.props,function(i){switch(w$(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Bi([ga(e,{props:[ne(i,/:(read-\w+)/,":"+Tl+"$1")]})],n);case"::placeholder":return Bi([ga(e,{props:[ne(i,/:(plac\w+)/,":"+re+"input-$1")]}),ga(e,{props:[ne(i,/:(plac\w+)/,":"+Tl+"$1")]}),ga(e,{props:[ne(i,/:(plac\w+)/,ot+"input-$1")]})],n)}return""})}},B$=[j$],G$=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 v=m.getAttribute("data-emotion");v.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var n=e.stylisPlugins||B$,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(m){for(var v=m.getAttribute("data-emotion").split(" "),b=1;b<v.length;b++)i[v[b]]=!0;a.push(m)});var s,c=[M$,F$];{var l,d=[O$,N$(function(m){l.insert(m)})],u=R$(c.concat(n,d)),p=function(m){return Bi(T$(m),u)};s=function(m,v,b,y){l=b,p(m?m+"{"+v.styles+"}":v.styles),y&&(f.inserted[v.name]=!0)}}var f={key:t,sheet:new h$({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};H$={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},V$=/[A-Z]|^ms/g,$$=/_EMO_([^_]+?)_([^]*?)_EMO_/g,hP=function(e){return e.charCodeAt(1)===45},LT=function(e){return e!=null&&typeof e!="boolean"},bm=D$(function(e){return hP(e)?e:e.replace(V$,"-$&").toLowerCase()}),qT=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace($$,function(r,n,i){return un={name:n,styles:i,next:un},n})}return H$[e]!==1&&!hP(e)&&typeof t=="number"&&t!==0?t+"px":t};UT=/label:\s*([^\s;{]+)\s*(;|$)/g;z$=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},K$=function(e,t,r){z$(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)}};Y$=function(e){var t=G$(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=_m(s,t.registered,void 0);return K$(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=_m(s,t.registered),d="animation-"+l.name;return MT(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=_m(s,t.registered);MT(t,l)},o=function(){for(var a=arguments.length,s=new Array(a),c=0;c<a;c++)s[c]=arguments[c];return FT(t.registered,r,X$(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:gP.bind(null,t.registered),merge:FT.bind(null,t.registered,r)}},X$=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},Q$=Y$({key:"css"}),st=Q$.css,BT=0,vP=[],Be=q,GT=Be.__b,JT=Be.__r,HT=Be.diffed,VT=Be.__c,$T=Be.unmount,WT=Be.__;Be.__b=function(e){Tt=null,GT&&GT(e)},Be.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),WT&&WT(e,t)},Be.__r=function(e){JT&&JT(e),qm=0;var t=(Tt=e.__c).__H;t&&(wm===Tt?(t.__h=[],Tt.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Il),t.__h.forEach(Um),t.__h=[],qm=0)),wm=Tt},Be.diffed=function(e){HT&&HT(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(vP.push(t)!==1&&jT===Be.requestAnimationFrame||((jT=Be.requestAnimationFrame)||t9)(e9)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),wm=Tt=null},Be.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Il),r.__h=r.__h.filter(function(n){return!n.__||Um(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],Be.__e(n,r.__v)}}),VT&&VT(e,t)},Be.unmount=function(e){$T&&$T(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Il(n)}catch(i){t=i}}),r.__H=void 0,t&&Be.__e(t,r.__v))};zT=typeof requestAnimationFrame=="function";n9=Symbol.for("preact-signals");le=void 0,ya=void 0,dn=0,Mm=0,Ol=0;Xe.prototype.brand=n9;Xe.prototype.h=function(){return!0};Xe.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)};Xe.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)}};Xe.prototype.subscribe=function(e){var t=this;return Ca(function(){var r=t.value,n=le;le=void 0;try{e(r)}finally{le=n}})};Xe.prototype.valueOf=function(){return this.value};Xe.prototype.toString=function(){return this.value+""};Xe.prototype.toJSON=function(){return this.value};Xe.prototype.peek=function(){var e=le;le=void 0;try{return this.value}finally{le=e}};Object.defineProperty(Xe.prototype,"value",{get:function(){var e=bP(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Mm>100)throw new Error("Cycle detected");this.v=e,this.i++,Ol++,dn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{Fl()}}}});(Vi.prototype=new Xe).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ol))return!0;if(this.g=Ol,this.f|=1,this.i>0&&!_P(this))return this.f&=-2,!0;var e=le;try{wP(this),le=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(r){this.v=r,this.f|=16,this.i++}return le=e,SP(this),this.f&=-2,!0};Vi.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)}Xe.prototype.S.call(this,e)};Vi.prototype.U=function(e){if(this.t!==void 0&&(Xe.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)}};Vi.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(Vi.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=bP(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});Aa.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()}};Aa.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,IP(this),wP(this),dn++;var e=le;return le=this,i9.bind(this,e)};Aa.prototype.N=function(){2&this.f||(this.f|=2,this.o=ya,ya=this)};Aa.prototype.d=function(){this.f|=8,1&this.f||sh(this)};AP=[];Ca(function(){EP=this.N})();CP.displayName="_st";Object.defineProperties(Xe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:CP},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});$i("__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 Xe&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});$i("__r",function(e,t){Rl();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return Ca(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Rl(r),e(t)});$i("__e",function(e,t,r,n){Rl(),e(t,r,n)});$i("diffed",function(e,t){Rl();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=o9(r,c,d,i),o[c]=l):l.o(d,i)}}}e(t)});$i("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)});$i("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Et.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};a9=function(e){queueMicrotask(function(){queueMicrotask(e)})};Ge=st`
623
623
  inset: 0;
624
624
  clear: none;
625
625
  float: none;