@jolibox/implement 1.4.14 → 1.4.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@
4
4
  "packages/implement/.eslintrc.js": "7a3d2747dc887655ca9e2d3ff621f7dfd98500b9",
5
5
  "packages/implement/README.md": "5660cd88848b7a5428394cc34d881a35dd402188",
6
6
  "packages/implement/esbuild.config.js": "0a49e35996f74ca72898dec126c76086d7a39ffc",
7
- "packages/implement/package.json": "ee2695d9f89a7b073bd7f98820ef3eceb226017a",
7
+ "packages/implement/package.json": "910338ee806a2160bfb326c132e877c21cf90f55",
8
8
  "packages/implement/src/common/ads/ads-action-detection.ts": "5a7b9f85d7eab9e744f8a9fc7638063f43baa214",
9
9
  "packages/implement/src/common/ads/anti-cheating.test.ts": "e2ff3dc6760cfd28d0f8c15703d7fb20d43df583",
10
10
  "packages/implement/src/common/ads/anti-cheating.ts": "a3ffb6a78e289e1c0ce45c7f7c0cee000e75e541",
@@ -130,7 +130,7 @@
130
130
  "packages/implement/src/native/api/storage.ts": "d395e86a04060a1e734f12c1b9c2e7b56eba392b",
131
131
  "packages/implement/src/native/api/task.ts": "2d9bd991e5b7408fb9a57229dd05e34e390b012f",
132
132
  "packages/implement/src/native/api/utils.ts": "a589552be6ef411ea7bffa5061da9825ae68a73f",
133
- "packages/implement/src/native/bootstrap/index.ts": "4575c963b89b4bcac25beee8ce1a33c53fd1fdb1",
133
+ "packages/implement/src/native/bootstrap/index.ts": "349f3d484d6c762f670cf417530a451da53499c6",
134
134
  "packages/implement/src/native/bootstrap/init-env.ts": "d7c3d9bfcf496d6478836f9c6d6e61a712f7b612",
135
135
  "packages/implement/src/native/network/create-fetch.ts": "6d9dacabf473f2e965227c09c5293aa5d9789309",
136
136
  "packages/implement/src/native/network/index.ts": "27b619a9a1127c3713eade7731cb26a3d84be6d5",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var Eh=Object.create;var ho=Object.defineProperty,Ih=Object.defineProperties,Ah=Object.getOwnPropertyDescriptor,Sh=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertyNames,_n=Object.getOwnPropertySymbols,vl=Object.getPrototypeOf,mo=Object.prototype.hasOwnProperty,gl=Object.prototype.propertyIsEnumerable,Rh=Reflect.get;var pl=(e,t,r)=>t in e?ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t)=>{for(var r in t||(t={}))mo.call(t,r)&&pl(e,r,t[r]);if(_n)for(var r of _n(t))gl.call(t,r)&&pl(e,r,t[r]);return e},xe=(e,t)=>Ih(e,Sh(t));var Rr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _l=(e,t)=>{var r={};for(var n in e)mo.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&_n)for(var n of _n(e))t.indexOf(n)<0&&gl.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var po=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ch(t))!mo.call(e,i)&&i!==r&&ho(e,i,{get:()=>t[i],enumerable:!(n=Ah(t,i))||n.enumerable});return e};var vo=(e,t,r)=>(r=e!=null?Eh(vl(e)):{},Oh(t||!e||!e.__esModule?ho(r,"default",{value:e,enumerable:!0}):r,e));var yl=(e,t,r)=>Rh(vl(e),r,t);var E=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function Uh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function So(e){return typeof e=="string"}function Cl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Rl(e){return typeof e=="object"&&Array.isArray(e)}function Bh(e){return typeof e=="undefined"}function Mh(e){return Bh(e)||e===null}function Gh(e){return typeof e=="function"}function Ol(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function kl(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,o){for(let a in o)if(Object.prototype.hasOwnProperty.call(o,a)){let s=i[a],l=o[a],c=r(s,l,a,i,o);c!==void 0?i[a]=c:El(l)&&El(s)?i[a]=n(Ao({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function El(e){return e&&typeof e=="object"&&e.constructor===Object}function Tl(e,t){if(Array.isArray(e))return e.concat(t)}function xr(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:l=!0}=r,c=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),m=function(...d){i=d,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return m.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},m.flush=()=>{if(n)return clearTimeout(n),n=null,c()},m}function jh(e,t){return(...r)=>t(e,...r)}function Dl(e){return t=>jh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Fh(`${i}`))}})}function Or(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function yn(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 Wh(e){let t=e.location?yn(e.location,Al):null,r=e.target?yn(e.target,Al):null;return yn(Dh(Ao({},e),{location:t,target:r}),$h)}function To(e){let t=e.events.map(n=>Wh(n)),r=yn(e.device,Kh);return[e.protocolVersion,t,r,e.project]}function zh(){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 Po(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 Bl(e){return Po("app","stg-app",e)}function tr(e){return`https://${Po("api","stg-api",e)}`}function rm(e){return Po("collect","stg-collect",e)}function Ml(e){return`https://${rm(e)}`}function am(e){return new Promise(t=>Gl(e)(t))}function Gl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function sm(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Tr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function cm(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)dm(e[n],t[n])}function dm(e,t){if(So(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gh(t)){try{if(e instanceof t)return}catch(r){}if(!Mh(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 um(){return typeof globalThis!="undefined"?globalThis[Jl]:void 0}function fm(e){typeof globalThis!="undefined"&&(globalThis[Jl]=e)}function Ae(e=!1){let t=um();if(!e&&t)return t;let r=new bn,n=new Eo,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 fm(i),i}var Io,kh,Th,xh,bl,Nh,Ph,wl,Ao,Dh,Lh,Sl,Bt,Jh,Co,Ro,xl,Nl,Fh,Pl,wn,En,Oo,Pe,_o,Hh,ko,Il,qh,Mt,er,Vh,Al,$h,Kh,We,Zt,Yh,Ne,Xh,Qh,Zh,Ll,xo,No,em,tm,Ul,Gt,yo,ae,nm,im,kr,Tr,et,wo,om,go,lm,kt,bn,Eo,Jl,W=re(()=>{"use strict";Io=Object.defineProperty,kh=Object.defineProperties,Th=Object.getOwnPropertyDescriptor,xh=Object.getOwnPropertyDescriptors,bl=Object.getOwnPropertySymbols,Nh=Object.prototype.hasOwnProperty,Ph=Object.prototype.propertyIsEnumerable,wl=(e,t,r)=>t in e?Io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ao=(e,t)=>{for(var r in t||(t={}))Nh.call(t,r)&&wl(e,r,t[r]);if(bl)for(var r of bl(t))Ph.call(t,r)&&wl(e,r,t[r]);return e},Dh=(e,t)=>kh(e,xh(t)),Lh=(e,t)=>{for(var r in t)Io(e,r,{get:t[r],enumerable:!0})},Sl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Th(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&&Io(t,r,i),i},Bt=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Jh=(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))(Jh||{}),Co=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},Ro=class extends Co{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},xl=class extends Co{constructor(){super(...arguments),this.kind="USER_ERROR"}},Nl=class extends xl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Fh=class extends xl{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))}},Pl=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},wn=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},En=class extends Co{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}}},Oo=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Pe={log:Or("log"),warn:Or("warn"),info:Or("info"),error:Or("error"),debug:Or("debug")};Object.assign(globalThis,{logger:Pe});_o=Symbol.for("Jolibox.canIUseMap"),Hh={};globalThis[_o]||(globalThis[_o]=Hh);ko={get config(){return globalThis[_o]}},Il=Symbol.for("Jolibox.canIUseMap.native"),qh={};globalThis[Il]||(globalThis[Il]=qh);Mt=(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))(Mt||{}),er=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(er||{}),Vh=(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))(Vh||{}),Al=["name","params"],$h=["name","type","location","target","extra","timestamp","userId"],Kh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];We=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});zh();Zt=typeof window=="undefined",Yh=()=>!Zt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Ne={isiOS:!Zt&&(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:!Zt&&navigator.userAgent.includes("Android"),isMac:!Zt&&navigator.userAgent.includes("Mac"),isFacebook:!Zt&&navigator.userAgent.includes("FB_IAB"),isPC:!Zt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Xh=()=>Ne.isiOS?"iOS":Ne.isAndroid?"Android":Ne.isMac?"Mac":Ne.isFacebook?"Facebook":"PC",Qh="device_id",Zh="advertising_id",Ll=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,We()),window.__joliboxLocalStorage__.getItem(e)),xo=()=>new URLSearchParams(window.location.search).get("deviceId")||Ll(Qh),No=()=>new URLSearchParams(window.location.search).get("advertisingId")||Ll(Zh),em=e=>e.charAt(0).toUpperCase()+e.slice(1),tm=()=>{var e;let t=new URLSearchParams(window.location.search);return em((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Ul=e=>{if(Yh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=Xh(),n=navigator.language,i=xo(),o=No();return`${t} (${tm()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${o} version/${e||""}`};Gt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=Ao({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Bt(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=>Bt(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,a),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield a}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Bt(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let d=yield this.requestAdapter.execute(e,t),p=this.requestAdapter.extractRealTimeData(d),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,d);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,h,s),d):this.requestAdapter.mergeData(l,p)}catch(d){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,d),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),m=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return m&&this.setCachedDataWithSequence(a,m,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:o,expiresAt:o+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return Bt(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Bt(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 Bt(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)}},yo=class bo{constructor(t){this.element=t,this.next=bo.Undefined,this.prev=bo.Undefined}};yo.Undefined=new yo(void 0);ae=yo,nm=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let t=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=t}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ae(e);if(this._first===ae.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!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},im=0,kr=class{constructor(e){this.value=e,this.id=im++}},Tr=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 kr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new kr(t);return this._listeners?this._listeners instanceof kr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var m,d,p,h;if(!this._disposed){if(this._listeners instanceof kr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||d.call(m));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((h=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||h.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 kr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},et=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 Tr,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new nm,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)}},wo={};Lh(wo,{None:()=>om,filter:()=>sm,once:()=>Gl,toPromise:()=>am});om=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});go=Symbol.for("Jolibox.hostEmitter"),lm=()=>{let e=new et;return globalThis[go]||(globalThis[go]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[go]},kt=lm();bn=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Tr,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 cm(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}};bn=Sl([Ol],bn);Eo=class{constructor(){this._onWillExecuteCommand=new Tr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Tr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new bn,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Uh(3e4)),this._starActivation}executeCommand(e,...t){return Bt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),wo.toPromise(wo.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}}};Eo=Sl([Ol],Eo);Jl=Symbol.for("Jolibox.commands")});function je(e,t={}){Do.emit("ERROR_REPORT",{error:e,options:t})}var Do,Jt,ut=re(()=>{"use strict";W();W();Do=new et,Jt=new et;je.debounce=xr(je,50,{leading:!0})});var Lo,hm,Fl,jl,Hl=re(()=>{"use strict";W();ut();Lo=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{}}},hm=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Fl=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:Lo(o),payloadJson:Lo(a),signature:Lo(s)}}else throw"joli_source is missing"}catch(r){return je(new Pl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},jl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=hm(e),o=r[2];return`${n}.${i}.${o}`}return t}});var mm,In,ql,Uo=re(()=>{"use strict";W();mm="1.4.14",In=()=>mm,ql=()=>{let e=In();return`${Ul(e)}`}});function Mo(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var pm,Vl,Bo,$l,se,vm,L,pe=re(()=>{"use strict";W();Hl();Uo();W();pm={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:xo(),adId:No(),pixelRatio:window.devicePixelRatio||1,platform:Ne.isAndroid?"android":Ne.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:In()},schema:window.location.href,platform:Ne.isAndroid?"android":Ne.isiOS?"ios":"h5"},Bo=(Vl=globalThis.joliboxJSCore)==null?void 0:Vl.env,se=Object.assign({},($l=Bo==null?void 0:Bo())!=null?$l:pm);vm=()=>{var I,A,w,R,O,D,M,S,N,J,q;let{payloadJson:e,headerJson:t,signature:r}=se.schema.length?Fl(se.schema):{},n=`${se.deviceInfo.did}-${new Date().getTime()}`,o=new URL(se.schema.length?se.schema:window.location.href).searchParams,a=(w=(A=(I=o.get("mpId"))!=null?I:o.get("appId"))!=null?A:o.get("gameId"))!=null?w:"",s=(D=(O=(R=se.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?O:o.get("sessionId"))!=null?D:n,l=!!((S=(M=e==null?void 0:e.testAdsMode)!=null?M:e==null?void 0:e.__testAdsMode)!=null?S:o.get("testAdsMode")==="true"),c=(q=(J=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?J:o.get("joliboxEnv"))!=null?q:"production",m=c==="staging",d=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,b=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return m},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,G;return(G=(U=h.get("joliSource"))!=null?U:o.get("joliSource"))!=null?G:null},get mpId(){var U;return(U=a!=null?a:e==null?void 0:e.id)!=null?U:""},get mpVersion(){var U;return(U=t==null?void 0:t.ver)!=null?U:In()},get mpType(){var U,G;return(G=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var U;return((U=se.platform)!=null?U:se.deviceInfo.platform).toLowerCase()},get deviceInfo(){return se.deviceInfo},get sdkInfo(){return se.sdkInfo},get hostInfo(){return se.hostInfo},get hostUserInfo(){return se.hostUserInfo},get sessionId(){var U,G;return(G=(U=se.clientSessionId)!=null?U:s)!=null?G:n},get channel(){return d},get webviewId(){var U;return(U=se.webviewId)!=null?U:-1},get shouldInterupt(){return b},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Bl(m)},get adId(){var U;return(U=se.deviceInfo.adId)!=null?U:se.deviceInfo.did},get language(){return se.deviceInfo.lang},get sdkEnvironment(){return Mo("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Mo("gamedistribution","jolibox")?"gamedistribution":Mo("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var V,K,Fe;let U=(V=se.deviceInfo.pixelRatio)!=null?V:1,G=(K=se.deviceInfo.statusBarHeight)!=null?K:e==null?void 0:e.__androidStatusBarHeight,j=(Fe=se.deviceInfo.navigationBarHeight)!=null?Fe:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/U:20,navigationBarHeight:j!==void 0?j/U:10}},get abTests(){var U,G;return(G=(U=se.abValues)==null?void 0:U.split(","))!=null?G:[]},get mpInfo(){var U;return(U=se.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{kl(se,U,Tl)},encodeJoliSourceQuery:U=>{var G,j;return t&&r?jl(X(X({},e),U),(G=o.get("joliSource"))!=null?G:""):(j=o.get("joliSource"))!=null?j:""},setDoExitDirectly:()=>{b=!1}}},L=vm()});var Go,Wl,gm,_m,Kl,ym,zl=re(()=>{"use strict";W();ut();pe();W();Go=!1,Wl=(e,t)=>e==null?!1:t in e,gm=e=>Wl(e,"kind"),_m=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Kl=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=L.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=L.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_m(e.name)},i=xe(X({},n),{env:t.environment,isFromUser:r});r?Jt.emit("GLOBAL_USER_ERROR",e,i):Jt.emit("GLOBAL_ERROR",e,i)},ym=e=>Wl(e,"kind")&&e.kind==="USER_ERROR";Do.on("ERROR_REPORT",({error:e,options:t})=>{if(Go)return;Go=!0;let r=gm(e)&&e.raw?e.raw:e;try{let n=ym(e);Kl(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new Oo(`${i}, origin error: ${r.message}`);Pe.error(o),Kl(new Oo(o.message),{environment:t.environment},!1)}finally{Go=!1}})});var Jo,Fo=re(()=>{"use strict";ut();W();ut();Jo=e=>new Nl(e)});function Yl(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=_l(c,["eventType"]),l=xe(X({tag:n,eventType:o!=null?o:a!=null?a:Mt.Other},t),{extra:X({},s)});n=="globalJsError"?je(new wn(JSON.stringify(l))):e("systemLog",l,L.webviewId)};return r.debounce=xr(r,500,{leading:!0}),r}function Xl(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=xr(t,500,{leading:!0}),t}var Ql=re(()=>{"use strict";W();W();ut();pe()});function Zl(e,t){let r=Yl(e,t),n=Xl(r);return{track:r,trackPerformance:n}}var ec=re(()=>{"use strict";Ql()});var jo=re(()=>{"use strict"});var An,tc=re(()=>{"use strict";pe();W();W();An=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return E(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,o,a,s;let{nativeSDKVersion:t,jssdkVersion:r}=L.sdkInfo;return{platform:1e3,os:L.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(o=(i=L.hostInfo)==null?void 0:i.aid)!=null?o:"1",model:(a=L.deviceInfo.model)!=null?a:"UnknownModel",brand:(s=L.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:L.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return E(this,null,function*(){var d;if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),o=t.target||null,a=t.extra||null,{hostUserInfo:s}=L;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,m={protocolVersion:"1.0.0",events:[xe(X({},t),{location:i,target:o,extra:a,timestamp:Date.now(),userId:(d=s==null?void 0:s.uid)!=null?d:null})],device:l,project:r};try{n?yield this.doReport(To(m),n):yield this.doReport(To(m))}catch(p){Pe.log("[Jolibox SDK] report API error",p)}})}}});var Ho=re(()=>{"use strict";ec();jo();tc()});var qo,rc,ft,Sn,ze,rr=re(()=>{"use strict";Uo();pe();W();qo=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(rc=AbortSignal.timeout)!=null||(AbortSignal.timeout=qo);ft=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new Sn(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},Sn=class{constructor(t){this.xua=ql();this.getJoliSource=()=>L.joliSource;var n;let r=tr(L.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return E(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:o}=r!=null?r:{},a=n?new URLSearchParams(n):null,s=a==null?void 0:a.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,m=this.getJoliSource();o=Object.assign({},o!=null?o:{},c?{"x-user-agent":c}:{},m?{"x-joli-source":m}:{});let d=yield fetch(l,{method:"GET",headers:o,credentials:"include",signal:qo(i!=null?i:3e4)});return ft.getInstance().recordNetworkRequest(!0),yield d.json()}catch(n){throw ft.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return E(this,null,function*(){try{let{data:n,query:i,timeout:o}=r!=null?r:{},{headers:a}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,m=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},m?{"x-user-agent":m}:{},d?{"x-joli-source":d}:{},{"x-os-type":Ne.isAndroid?"ANDROID":Ne.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(c,{method:"POST",headers:a,body:JSON.stringify(n),signal:qo(o!=null?o:3e4),credentials:"include"});ft.getInstance().recordNetworkRequest(!0);let h=p.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return p.blob()}catch(b){return yield p.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return p.formData()}catch(b){return yield p.text()}if(h!=null&&h.includes("application/json"))try{return yield p.json()}catch(b){return yield p.text()}return p}catch(n){throw ft.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return E(this,null,function*(){try{let{data:n,query:i,timeout:o}=r!=null?r:{},{headers:a}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,m=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},m?{"x-user-agent":m}:{},d?{"x-joli-source":d}:{});let p=yield fetch(c,{method:"PUT",headers:a,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!p.ok)throw ft.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return ft.getInstance().recordNetworkRequest(!0),yield p.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=Sn;ze=ft.getInstance()});var Vo,Cn,$o=re(()=>{"use strict";pe();Ho();rr();W();Vo=class extends An{constructor(){super(...arguments);this.httpClient=ze.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return Ml((r=L.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},Cn=new Vo(tr(L.testMode))});var bm,nc=re(()=>{"use strict";zl();W();Fo();W();$o();pe();bm=(e,t)=>{var i,o,a;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:Mt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(a=(o=L.hostUserInfo)==null?void 0:o.uid)!=null?a:null};Cn.trackEvent(n,er.WebSDK)};Jt.on("GLOBAL_ERROR",(e,t)=>{bm(t.tag,e)});Jt.on("GLOBAL_USER_ERROR",(e,t)=>{Pe.log("UserError",e,t)})});var Rn,ic=re(()=>{"use strict";Rn=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 h=Date.now(),b=h-r;b>=this.interval&&(this.visible&&(a+=Math.min(b,this.interval+1e3),t(a)),r=h),n=requestAnimationFrame(s)},l=()=>{m(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},c=()=>{d(),r=Date.now(),n=requestAnimationFrame(s)},m=()=>{n&&(cancelAnimationFrame(n),n=0)},d=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",h=>{o&&(console.log("visible",h),h?c():l())});let p=this.visible;return{start(){o||(o=!0,p?c():l())},stop(){o=!1,m(),d()}}}}});var oc,ac=re(()=>{"use strict";oc=`-----BEGIN PUBLIC KEY-----
1
+ var Eh=Object.create;var ho=Object.defineProperty,Ih=Object.defineProperties,Ah=Object.getOwnPropertyDescriptor,Sh=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertyNames,_n=Object.getOwnPropertySymbols,vl=Object.getPrototypeOf,mo=Object.prototype.hasOwnProperty,gl=Object.prototype.propertyIsEnumerable,Rh=Reflect.get;var pl=(e,t,r)=>t in e?ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t)=>{for(var r in t||(t={}))mo.call(t,r)&&pl(e,r,t[r]);if(_n)for(var r of _n(t))gl.call(t,r)&&pl(e,r,t[r]);return e},xe=(e,t)=>Ih(e,Sh(t));var Rr=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var _l=(e,t)=>{var r={};for(var n in e)mo.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&_n)for(var n of _n(e))t.indexOf(n)<0&&gl.call(e,n)&&(r[n]=e[n]);return r};var re=(e,t)=>()=>(e&&(t=e(e=0)),t);var po=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Oh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ch(t))!mo.call(e,i)&&i!==r&&ho(e,i,{get:()=>t[i],enumerable:!(n=Ah(t,i))||n.enumerable});return e};var vo=(e,t,r)=>(r=e!=null?Eh(vl(e)):{},Oh(t||!e||!e.__esModule?ho(r,"default",{value:e,enumerable:!0}):r,e));var yl=(e,t,r)=>Rh(vl(e),r,t);var E=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});function Uh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function So(e){return typeof e=="string"}function Cl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Rl(e){return typeof e=="object"&&Array.isArray(e)}function Bh(e){return typeof e=="undefined"}function Mh(e){return Bh(e)||e===null}function Gh(e){return typeof e=="function"}function Ol(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function kl(e,t,r){if(typeof r!="function")throw new Error("[Jolibox SDK]Customizer must be a function");function n(i,o){for(let a in o)if(Object.prototype.hasOwnProperty.call(o,a)){let s=i[a],l=o[a],c=r(s,l,a,i,o);c!==void 0?i[a]=c:El(l)&&El(s)?i[a]=n(Ao({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function El(e){return e&&typeof e=="object"&&e.constructor===Object}function Tl(e,t){if(Array.isArray(e))return e.concat(t)}function xr(e,t,r={}){let n=null,i,o,a,{leading:s=!1,trailing:l=!0}=r,c=()=>(a=e.apply(o,i),i=void 0,o=void 0,a),m=function(...d){i=d,o=this;let p=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!p&&c()},t),p)return c()};return m.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},m.flush=()=>{if(n)return clearTimeout(n),n=null,c()},m}function jh(e,t){return(...r)=>t(e,...r)}function Dl(e){return t=>jh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Fh(`${i}`))}})}function Or(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function yn(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 Wh(e){let t=e.location?yn(e.location,Al):null,r=e.target?yn(e.target,Al):null;return yn(Dh(Ao({},e),{location:t,target:r}),$h)}function To(e){let t=e.events.map(n=>Wh(n)),r=yn(e.device,Kh);return[e.protocolVersion,t,r,e.project]}function zh(){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 Po(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 Bl(e){return Po("app","stg-app",e)}function tr(e){return`https://${Po("api","stg-api",e)}`}function rm(e){return Po("collect","stg-collect",e)}function Ml(e){return`https://${rm(e)}`}function am(e){return new Promise(t=>Gl(e)(t))}function Gl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function sm(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Tr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function cm(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)dm(e[n],t[n])}function dm(e,t){if(So(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Gh(t)){try{if(e instanceof t)return}catch(r){}if(!Mh(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 um(){return typeof globalThis!="undefined"?globalThis[Jl]:void 0}function fm(e){typeof globalThis!="undefined"&&(globalThis[Jl]=e)}function Ae(e=!1){let t=um();if(!e&&t)return t;let r=new bn,n=new Eo,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 fm(i),i}var Io,kh,Th,xh,bl,Nh,Ph,wl,Ao,Dh,Lh,Sl,Bt,Jh,Co,Ro,xl,Nl,Fh,Pl,wn,En,Oo,Pe,_o,Hh,ko,Il,qh,Mt,er,Vh,Al,$h,Kh,We,Zt,Yh,Ne,Xh,Qh,Zh,Ll,xo,No,em,tm,Ul,Gt,yo,ae,nm,im,kr,Tr,et,wo,om,go,lm,kt,bn,Eo,Jl,W=re(()=>{"use strict";Io=Object.defineProperty,kh=Object.defineProperties,Th=Object.getOwnPropertyDescriptor,xh=Object.getOwnPropertyDescriptors,bl=Object.getOwnPropertySymbols,Nh=Object.prototype.hasOwnProperty,Ph=Object.prototype.propertyIsEnumerable,wl=(e,t,r)=>t in e?Io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Ao=(e,t)=>{for(var r in t||(t={}))Nh.call(t,r)&&wl(e,r,t[r]);if(bl)for(var r of bl(t))Ph.call(t,r)&&wl(e,r,t[r]);return e},Dh=(e,t)=>kh(e,xh(t)),Lh=(e,t)=>{for(var r in t)Io(e,r,{get:t[r],enumerable:!0})},Sl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Th(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&&Io(t,r,i),i},Bt=(e,t,r)=>new Promise((n,i)=>{var o=l=>{try{s(r.next(l))}catch(c){i(c)}},a=l=>{try{s(r.throw(l))}catch(c){i(c)}},s=l=>l.done?n(l.value):Promise.resolve(l.value).then(o,a);s((r=r.apply(e,t)).next())});if(typeof window!="undefined"&&!window.AbortController){let e=function(){this.signal=new t};e.prototype.abort=function(){this.signal._aborted=!0,typeof this.signal.onabort=="function"&&this.signal.onabort(new Event("abort"));let r=new Event("abort");this.signal.dispatchEvent(r)};let t=function(){this._aborted=!1,this.aborted=!1,this.onabort=null,this._eventListeners={}};Object.defineProperty(t.prototype,"aborted",{get:function(){return this._aborted}}),t.prototype.addEventListener=function(r,n){this._eventListeners[r]||(this._eventListeners[r]=[]),this._eventListeners[r].push(n)},t.prototype.removeEventListener=function(r,n){if(!this._eventListeners[r])return;let i=this._eventListeners[r].indexOf(n);i!==-1&&this._eventListeners[r].splice(i,1)},t.prototype.dispatchEvent=function(r){if(this._eventListeners[r.type])for(let n of this._eventListeners[r.type])n.call(this,r)},window.AbortController=e,window.AbortSignal=t}Jh=(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))(Jh||{}),Co=class extends Error{constructor(e){if(typeof e=="string"){super(e),this.priority="P1";return}super(e.message),this.priority="P1",this.stack=e.stack,this.raw=e}},Ro=class extends Co{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},xl=class extends Co{constructor(){super(...arguments),this.kind="USER_ERROR"}},Nl=class extends xl{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Fh=class extends xl{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))}},Pl=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},wn=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},En=class extends Co{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}}},Oo=class extends Ro{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Pe={log:Or("log"),warn:Or("warn"),info:Or("info"),error:Or("error"),debug:Or("debug")};Object.assign(globalThis,{logger:Pe});_o=Symbol.for("Jolibox.canIUseMap"),Hh={};globalThis[_o]||(globalThis[_o]=Hh);ko={get config(){return globalThis[_o]}},Il=Symbol.for("Jolibox.canIUseMap.native"),qh={};globalThis[Il]||(globalThis[Il]=qh);Mt=(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))(Mt||{}),er=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(er||{}),Vh=(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))(Vh||{}),Al=["name","params"],$h=["name","type","location","target","extra","timestamp","userId"],Kh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];We=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});zh();Zt=typeof window=="undefined",Yh=()=>!Zt&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Ne={isiOS:!Zt&&(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:!Zt&&navigator.userAgent.includes("Android"),isMac:!Zt&&navigator.userAgent.includes("Mac"),isFacebook:!Zt&&navigator.userAgent.includes("FB_IAB"),isPC:!Zt&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Xh=()=>Ne.isiOS?"iOS":Ne.isAndroid?"Android":Ne.isMac?"Mac":Ne.isFacebook?"Facebook":"PC",Qh="device_id",Zh="advertising_id",Ll=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,We()),window.__joliboxLocalStorage__.getItem(e)),xo=()=>new URLSearchParams(window.location.search).get("deviceId")||Ll(Qh),No=()=>new URLSearchParams(window.location.search).get("advertisingId")||Ll(Zh),em=e=>e.charAt(0).toUpperCase()+e.slice(1),tm=()=>{var e;let t=new URLSearchParams(window.location.search);return em((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Ul=e=>{if(Yh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=Xh(),n=navigator.language,i=xo(),o=No();return`${t} (${tm()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${o} version/${e||""}`};Gt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=Ao({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Bt(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=>Bt(this,null,function*(){if(s.message.includes("timeout")){let l=this.getValidCachedData(r);if(l)return console.warn(`[RequestCacheService] Request timeout, falling back to cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}throw s}));this.pendingRequests.set(r,a),i.then(s=>{console.log(`[RequestCacheService] Background request completed successfully for ${e}`)}).catch(s=>{console.warn(`[RequestCacheService] Background request failed for ${e}:`,s)});try{return yield a}finally{this.pendingRequests.delete(r)}})}requestInternal(e,t){return Bt(this,null,function*(){var r,n,i,o;let a=this.config.keyGenerator(e,t),s=++this.requestSequence,l=this.getValidCachedData(a);if(console.log("[RequestCacheService] requestInternal start",e,"cached:",l),l){if(this.requestAdapter.extractRealTimeData&&this.requestAdapter.mergeData)try{let d=yield this.requestAdapter.execute(e,t),p=this.requestAdapter.extractRealTimeData(d),h=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,d);return h&&!this.config.consistencyChecker(l,h)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,h,s),d):this.requestAdapter.mergeData(l,p)}catch(d){return console.warn(`[RequestCacheService] Failed to fetch real-time data, using cache only for ${e}:`,d),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}return console.log(`[RequestCacheService] use cache for ${e}`),this.requestAdapter.processCachedData?this.requestAdapter.processCachedData(l):l}console.log(`[RequestCacheService] Cache miss, fetching fresh data for ${e} (sequence: ${s})`);let c=yield this.requestAdapter.execute(e,t),m=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return m&&this.setCachedDataWithSequence(a,m,s),c})}createTimeoutPromise(){return new Promise((e,t)=>{setTimeout(()=>{t(new Error(`[RequestCacheService] Request timeout after ${this.config.timeout/1e3} seconds`))},this.config.timeout)})}getValidCachedData(e){let t=this.cache.get(e);return t?Date.now()>t.expiresAt?(this.cache.delete(e),null):t.data:null}setCachedDataWithSequence(e,t,r,n){let i=this.cache.get(e);if(i&&i.sequence>r){console.log(`[RequestCacheService] Ignoring stale cache update for ${e} (current: ${i.sequence}, incoming: ${r})`);return}let o=Date.now();this.cache.set(e,{data:JSON.parse(JSON.stringify(t)),timestamp:o,expiresAt:o+this.config.duration,key:e,sequence:r,metadata:n}),this.cacheSequences.set(e,r),console.log(`[RequestCacheService] Updated cache for ${e} with sequence ${r}`)}refreshCache(e,t){return Bt(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Bt(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 Bt(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)}},yo=class bo{constructor(t){this.element=t,this.next=bo.Undefined,this.prev=bo.Undefined}};yo.Undefined=new yo(void 0);ae=yo,nm=class{constructor(){this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ae.Undefined}clear(){let e=this._first;for(;e!==ae.Undefined;){let t=e.next;e.prev=ae.Undefined,e.next=ae.Undefined,e=t}this._first=ae.Undefined,this._last=ae.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ae(e);if(this._first===ae.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!==ae.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ae.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ae.Undefined&&e.next!==ae.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ae.Undefined&&e.next===ae.Undefined?(this._first=ae.Undefined,this._last=ae.Undefined):e.next===ae.Undefined?(this._last=this._last.prev,this._last.next=ae.Undefined):e.prev===ae.Undefined&&(this._first=this._first.next,this._first.prev=ae.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ae.Undefined;)yield e.element,e=e.next}},im=0,kr=class{constructor(e){this.value=e,this.id=im++}},Tr=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 kr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){var e;return(e=this._event)!=null||(this._event=(t,r)=>{var n,i,o,a,s,l;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};r&&(t=t.bind(r));let c=new kr(t);return this._listeners?this._listeners instanceof kr?this._listeners=[this._listeners,c]:this._listeners.push(c):((i=(n=this.options)==null?void 0:n.onWillAddFirstListener)==null||i.call(n,this),this._listeners=c,(a=(o=this.options)==null?void 0:o.onDidFirstListener)==null||a.call(o,this)),(l=(s=this.options)==null?void 0:s.onDidAddListener)==null||l.call(s,this),this._size++,()=>{var m,d,p,h;if(!this._disposed){if(this._listeners instanceof kr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(m=this.options)==null?void 0:m.onDidRemoveLastListener)==null||d.call(m));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((h=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||h.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 kr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},et=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 Tr,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e,...t){let r=this.listeners.get(e),n=this.cachedEventQueue.get(e);n||(n=new nm,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)}},wo={};Lh(wo,{None:()=>om,filter:()=>sm,once:()=>Gl,toPromise:()=>am});om=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});go=Symbol.for("Jolibox.hostEmitter"),lm=()=>{let e=new et;return globalThis[go]||(globalThis[go]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[go]},kt=lm();bn=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Tr,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 cm(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}};bn=Sl([Ol],bn);Eo=class{constructor(){this._onWillExecuteCommand=new Tr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Tr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new bn,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Uh(3e4)),this._starActivation}executeCommand(e,...t){return Bt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),wo.toPromise(wo.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}}};Eo=Sl([Ol],Eo);Jl=Symbol.for("Jolibox.commands")});function je(e,t={}){Do.emit("ERROR_REPORT",{error:e,options:t})}var Do,Jt,ut=re(()=>{"use strict";W();W();Do=new et,Jt=new et;je.debounce=xr(je,50,{leading:!0})});var Lo,hm,Fl,jl,Hl=re(()=>{"use strict";W();ut();Lo=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{}}},hm=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Fl=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:Lo(o),payloadJson:Lo(a),signature:Lo(s)}}else throw"joli_source is missing"}catch(r){return je(new Pl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},jl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=hm(e),o=r[2];return`${n}.${i}.${o}`}return t}});var mm,In,ql,Uo=re(()=>{"use strict";W();mm="1.4.15",In=()=>mm,ql=()=>{let e=In();return`${Ul(e)}`}});function Mo(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var pm,Vl,Bo,$l,se,vm,L,pe=re(()=>{"use strict";W();Hl();Uo();W();pm={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:xo(),adId:No(),pixelRatio:window.devicePixelRatio||1,platform:Ne.isAndroid?"android":Ne.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:In()},schema:window.location.href,platform:Ne.isAndroid?"android":Ne.isiOS?"ios":"h5"},Bo=(Vl=globalThis.joliboxJSCore)==null?void 0:Vl.env,se=Object.assign({},($l=Bo==null?void 0:Bo())!=null?$l:pm);vm=()=>{var I,A,w,R,O,D,M,S,N,J,q;let{payloadJson:e,headerJson:t,signature:r}=se.schema.length?Fl(se.schema):{},n=`${se.deviceInfo.did}-${new Date().getTime()}`,o=new URL(se.schema.length?se.schema:window.location.href).searchParams,a=(w=(A=(I=o.get("mpId"))!=null?I:o.get("appId"))!=null?A:o.get("gameId"))!=null?w:"",s=(D=(O=(R=se.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?O:o.get("sessionId"))!=null?D:n,l=!!((S=(M=e==null?void 0:e.testAdsMode)!=null?M:e==null?void 0:e.__testAdsMode)!=null?S:o.get("testAdsMode")==="true"),c=(q=(J=(N=e==null?void 0:e.joliboxEnv)!=null?N:e==null?void 0:e.__joliboxEnv)!=null?J:o.get("joliboxEnv"))!=null?q:"production",m=c==="staging",d=t==null?void 0:t.channel,h=new URL(window.location.href).searchParams,b=e==null?void 0:e.__shouldInterupt;return{get startTime(){var U;return(U=performance.timeOrigin)!=null?U:performance.timing.navigationStart},get testMode(){return m},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,G;return(G=(U=h.get("joliSource"))!=null?U:o.get("joliSource"))!=null?G:null},get mpId(){var U;return(U=a!=null?a:e==null?void 0:e.id)!=null?U:""},get mpVersion(){var U;return(U=t==null?void 0:t.ver)!=null?U:In()},get mpType(){var U,G;return(G=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?G:"game"},get platform(){var U;return((U=se.platform)!=null?U:se.deviceInfo.platform).toLowerCase()},get deviceInfo(){return se.deviceInfo},get sdkInfo(){return se.sdkInfo},get hostInfo(){return se.hostInfo},get hostUserInfo(){return se.hostUserInfo},get sessionId(){var U,G;return(G=(U=se.clientSessionId)!=null?U:s)!=null?G:n},get channel(){return d},get webviewId(){var U;return(U=se.webviewId)!=null?U:-1},get shouldInterupt(){return b},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Bl(m)},get adId(){var U;return(U=se.deviceInfo.adId)!=null?U:se.deviceInfo.did},get language(){return se.deviceInfo.lang},get sdkEnvironment(){return Mo("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":Mo("gamedistribution","jolibox")?"gamedistribution":Mo("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var V,K,Fe;let U=(V=se.deviceInfo.pixelRatio)!=null?V:1,G=(K=se.deviceInfo.statusBarHeight)!=null?K:e==null?void 0:e.__androidStatusBarHeight,j=(Fe=se.deviceInfo.navigationBarHeight)!=null?Fe:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:G!==void 0?G/U:20,navigationBarHeight:j!==void 0?j/U:10}},get abTests(){var U,G;return(G=(U=se.abValues)==null?void 0:U.split(","))!=null?G:[]},get mpInfo(){var U;return(U=se.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{kl(se,U,Tl)},encodeJoliSourceQuery:U=>{var G,j;return t&&r?jl(X(X({},e),U),(G=o.get("joliSource"))!=null?G:""):(j=o.get("joliSource"))!=null?j:""},setDoExitDirectly:()=>{b=!1}}},L=vm()});var Go,Wl,gm,_m,Kl,ym,zl=re(()=>{"use strict";W();ut();pe();W();Go=!1,Wl=(e,t)=>e==null?!1:t in e,gm=e=>Wl(e,"kind"),_m=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Kl=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=L.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=L.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:_m(e.name)},i=xe(X({},n),{env:t.environment,isFromUser:r});r?Jt.emit("GLOBAL_USER_ERROR",e,i):Jt.emit("GLOBAL_ERROR",e,i)},ym=e=>Wl(e,"kind")&&e.kind==="USER_ERROR";Do.on("ERROR_REPORT",({error:e,options:t})=>{if(Go)return;Go=!0;let r=gm(e)&&e.raw?e.raw:e;try{let n=ym(e);Kl(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new Oo(`${i}, origin error: ${r.message}`);Pe.error(o),Kl(new Oo(o.message),{environment:t.environment},!1)}finally{Go=!1}})});var Jo,Fo=re(()=>{"use strict";ut();W();ut();Jo=e=>new Nl(e)});function Yl(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=_l(c,["eventType"]),l=xe(X({tag:n,eventType:o!=null?o:a!=null?a:Mt.Other},t),{extra:X({},s)});n=="globalJsError"?je(new wn(JSON.stringify(l))):e("systemLog",l,L.webviewId)};return r.debounce=xr(r,500,{leading:!0}),r}function Xl(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=xr(t,500,{leading:!0}),t}var Ql=re(()=>{"use strict";W();W();ut();pe()});function Zl(e,t){let r=Yl(e,t),n=Xl(r);return{track:r,trackPerformance:n}}var ec=re(()=>{"use strict";Ql()});var jo=re(()=>{"use strict"});var An,tc=re(()=>{"use strict";pe();W();W();An=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return E(this,null,function*(){let r=`${this.apiHost}/api/fe-configs/js-sdk/samples-config`,n=yield(yield fetch(r)).json();this.samplesConfig=n})}checkIsSampled(t){if(!this.samplesConfig)return!1;let{samples:r}=this.samplesConfig;for(let[n,i]of Object.entries(r))if(i.includes(t.name))return Math.floor(Math.random()*101)<parseFloat(n);return!1}getDevice(){var n,i,o,a,s;let{nativeSDKVersion:t,jssdkVersion:r}=L.sdkInfo;return{platform:1e3,os:L.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(o=(i=L.hostInfo)==null?void 0:i.aid)!=null?o:"1",model:(a=L.deviceInfo.model)!=null?a:"UnknownModel",brand:(s=L.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:L.deviceInfo.did,jsSdkVersion:r,extra:{}}}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:"GamePage",params:r}}trackEvent(t,r,n){return E(this,null,function*(){var d;if(this.checkIsSampled(t))return;let i=t.location?t.location:yield this.getLocation(),o=t.target||null,a=t.extra||null,{hostUserInfo:s}=L;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,m={protocolVersion:"1.0.0",events:[xe(X({},t),{location:i,target:o,extra:a,timestamp:Date.now(),userId:(d=s==null?void 0:s.uid)!=null?d:null})],device:l,project:r};try{n?yield this.doReport(To(m),n):yield this.doReport(To(m))}catch(p){Pe.log("[Jolibox SDK] report API error",p)}})}}});var Ho=re(()=>{"use strict";ec();jo();tc()});var qo,rc,ft,Sn,ze,rr=re(()=>{"use strict";Uo();pe();W();qo=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(rc=AbortSignal.timeout)!=null||(AbortSignal.timeout=qo);ft=class e{constructor(){this.httpClients=new WeakSet;this.networkRequests=[];this.maxRequestsToTrack=20;this.getNetworkStatus=()=>this.networkRequests.length===0?!0:this.networkRequests.filter(n=>n).length/this.networkRequests.length>=.6}static getInstance(){return e._instance||(e._instance=new e),e._instance}create(t){let r=new Sn(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},Sn=class{constructor(t){this.xua=ql();this.getJoliSource=()=>L.joliSource;var n;let r=tr(L.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return E(this,null,function*(){try{let{query:n,timeout:i}=r!=null?r:{},{headers:o}=r!=null?r:{},a=n?new URLSearchParams(n):null,s=a==null?void 0:a.toString(),l=`${this.baseUrl}${t}${s?`?${s}`:""}`,c=this.xua,m=this.getJoliSource();o=Object.assign({},o!=null?o:{},c?{"x-user-agent":c}:{},m?{"x-joli-source":m}:{});let d=yield fetch(l,{method:"GET",headers:o,credentials:"include",signal:qo(i!=null?i:3e4)});return ft.getInstance().recordNetworkRequest(!0),yield d.json()}catch(n){throw ft.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return E(this,null,function*(){try{let{data:n,query:i,timeout:o}=r!=null?r:{},{headers:a}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,m=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},m?{"x-user-agent":m}:{},d?{"x-joli-source":d}:{},{"x-os-type":Ne.isAndroid?"ANDROID":Ne.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(c,{method:"POST",headers:a,body:JSON.stringify(n),signal:qo(o!=null?o:3e4),credentials:"include"});ft.getInstance().recordNetworkRequest(!0);let h=p.headers.get("content-type");if(h!=null&&h.includes("application/octet-stream"))try{return p.blob()}catch(b){return yield p.arrayBuffer()}if(h!=null&&h.includes("multipart/form-data")||h!=null&&h.includes("application/x-www-form-urlencoded"))try{return p.formData()}catch(b){return yield p.text()}if(h!=null&&h.includes("application/json"))try{return yield p.json()}catch(b){return yield p.text()}return p}catch(n){throw ft.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return E(this,null,function*(){try{let{data:n,query:i,timeout:o}=r!=null?r:{},{headers:a}=r!=null?r:{},s=i?new URLSearchParams(i):null,l=s==null?void 0:s.toString(),c=`${this.baseUrl}${t}${l?`?${l}`:""}`,m=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},m?{"x-user-agent":m}:{},d?{"x-joli-source":d}:{});let p=yield fetch(c,{method:"PUT",headers:a,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!p.ok)throw ft.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return ft.getInstance().recordNetworkRequest(!0),yield p.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=Sn;ze=ft.getInstance()});var Vo,Cn,$o=re(()=>{"use strict";pe();Ho();rr();W();Vo=class extends An{constructor(){super(...arguments);this.httpClient=ze.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return Ml((r=L.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},Cn=new Vo(tr(L.testMode))});var bm,nc=re(()=>{"use strict";zl();W();Fo();W();$o();pe();bm=(e,t)=>{var i,o,a;let r={message:t.message,stack:(i=t.stack)!=null?i:"",errorType:t.name,source:0},n={name:e,type:Mt.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(a=(o=L.hostUserInfo)==null?void 0:o.uid)!=null?a:null};Cn.trackEvent(n,er.WebSDK)};Jt.on("GLOBAL_ERROR",(e,t)=>{bm(t.tag,e)});Jt.on("GLOBAL_USER_ERROR",(e,t)=>{Pe.log("UserError",e,t)})});var Rn,ic=re(()=>{"use strict";Rn=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 h=Date.now(),b=h-r;b>=this.interval&&(this.visible&&(a+=Math.min(b,this.interval+1e3),t(a)),r=h),n=requestAnimationFrame(s)},l=()=>{m(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let h=Date.now();h-r>=this.interval&&(r=h)},this.interval)},c=()=>{d(),r=Date.now(),n=requestAnimationFrame(s)},m=()=>{n&&(cancelAnimationFrame(n),n=0)},d=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",h=>{o&&(console.log("visible",h),h?c():l())});let p=this.visible;return{start(){o||(o=!0,p?c():l())},stop(){o=!1,m(),d()}}}}});var oc,ac=re(()=>{"use strict";oc=`-----BEGIN PUBLIC KEY-----
2
2
  MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs29BUZPZdQwNDEYtXufp
3
3
  IGF40RBoddFzoD2ixl6PjyKWFXF8kxGS++HNtLspxhLvWoE12IZvrP7+whSpgHcy
4
4
  4ryuW86mOdHnP9iyeK69GosHz3lVhQjF9UdhJDXB7P/zdj3VlVzZIj0yL+YvZjO0