@jolibox/implement 1.4.18 → 1.4.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.rush/temp/package-deps_build.json +2 -2
- package/dist/common/ads/index.d.ts +2 -0
- package/dist/index.js +16 -16
- package/dist/index.native.js +29 -29
- package/implement.build.log +2 -2
- package/package.json +6 -6
- package/src/common/ads/index.ts +5 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Sh=Object.create;var go=Object.defineProperty,Ch=Object.defineProperties,Rh=Object.getOwnPropertyDescriptor,Oh=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertyNames,An=Object.getOwnPropertySymbols,bl=Object.getPrototypeOf,_o=Object.prototype.hasOwnProperty,wl=Object.prototype.propertyIsEnumerable,xh=Reflect.get;var yl=(e,t,r)=>t in e?go(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Y=(e,t)=>{for(var r in t||(t={}))_o.call(t,r)&&yl(e,r,t[r]);if(An)for(var r of An(t))wl.call(t,r)&&yl(e,r,t[r]);return e},Ue=(e,t)=>Ch(e,Oh(t));var Tr=(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 Al=(e,t)=>{var r={};for(var n in e)_o.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&An)for(var n of An(e))t.indexOf(n)<0&&wl.call(e,n)&&(r[n]=e[n]);return r};var ie=(e,t)=>()=>(e&&(t=e(e=0)),t);var yo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var kh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Th(t))!_o.call(e,i)&&i!==r&&go(e,i,{get:()=>t[i],enumerable:!(n=Rh(t,i))||n.enumerable});return e};var bo=(e,t,r)=>(r=e!=null?Sh(bl(e)):{},kh(t||!e||!e.__esModule?go(r,"default",{value:e,enumerable:!0}):r,e));var El=(e,t,r)=>xh(bl(e),r,t);var A=(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 Gh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function To(e){return typeof e=="string"}function xl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function kl(e){return typeof e=="object"&&Array.isArray(e)}function Jh(e){return typeof e=="undefined"}function Fh(e){return Jh(e)||e===null}function jh(e){return typeof e=="function"}function Dl(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Nl(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:Cl(l)&&Cl(s)?i[a]=n(Oo({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function Cl(e){return e&&typeof e=="object"&&e.constructor===Object}function Pl(e,t){if(Array.isArray(e))return e.concat(t)}function Nr(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 h=s&&!n;if(n&&clearTimeout(n),n=setTimeout(()=>{n=null,l&&!h&&c()},t),h)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 Vh(e,t){return(...r)=>t(e,...r)}function Ml(e){return t=>Vh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Hh(`${i}`))}})}function xr(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function En(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 Xh(e){let t=e.location?En(e.location,Ol):null,r=e.target?En(e.target,Ol):null;return En(Bh(Oo({},e),{location:t,target:r}),zh)}function Po(e){let t=e.events.map(n=>Xh(n)),r=En(e.device,Yh);return[e.protocolVersion,t,r,e.project]}function Qh(){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 Bo(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 Fl(e){return Bo("app","stg-app",e)}function rr(e){return`https://${Bo("api","stg-api",e)}`}function op(e){return Bo("collect","stg-collect",e)}function jl(e){return`https://${op(e)}`}function cp(e){return new Promise(t=>ql(e)(t))}function ql(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function dp(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Dr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function fp(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)hp(e[n],t[n])}function hp(e,t){if(To(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(jh(t)){try{if(e instanceof t)return}catch(r){}if(!Fh(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 pp(){return typeof globalThis!="undefined"?globalThis[Hl]:void 0}function mp(e){typeof globalThis!="undefined"&&(globalThis[Hl]=e)}function Re(e=!1){let t=pp();if(!e&&t)return t;let r=new In,n=new Co,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 mp(i),i}var Ro,Dh,Nh,Ph,Il,Lh,Uh,Sl,Oo,Bh,Mh,Tl,Jt,qh,xo,ko,Ll,Ul,Hh,Bl,Sn,Cn,Do,Me,Ao,Kh,No,Rl,$h,Ft,tr,Wh,Ol,zh,Yh,Xe,er,Zh,Be,ep,tp,rp,Gl,Lo,Uo,np,ip,Jl,jt,Eo,le,ap,sp,kr,Dr,nt,So,lp,wo,up,Dt,In,Co,Hl,$=ie(()=>{"use strict";Ro=Object.defineProperty,Dh=Object.defineProperties,Nh=Object.getOwnPropertyDescriptor,Ph=Object.getOwnPropertyDescriptors,Il=Object.getOwnPropertySymbols,Lh=Object.prototype.hasOwnProperty,Uh=Object.prototype.propertyIsEnumerable,Sl=(e,t,r)=>t in e?Ro(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Oo=(e,t)=>{for(var r in t||(t={}))Lh.call(t,r)&&Sl(e,r,t[r]);if(Il)for(var r of Il(t))Uh.call(t,r)&&Sl(e,r,t[r]);return e},Bh=(e,t)=>Dh(e,Ph(t)),Mh=(e,t)=>{for(var r in t)Ro(e,r,{get:t[r],enumerable:!0})},Tl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Nh(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&&Ro(t,r,i),i},Jt=(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}qh=(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))(qh||{}),xo=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}},ko=class extends xo{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Ll=class extends xo{constructor(){super(...arguments),this.kind="USER_ERROR"}},Ul=class extends Ll{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Hh=class extends Ll{constructor(e,t,r){super(e),this.message=e,this.errNo=t,this.name="USER_CUSTOM_ERROR",this.errMsg=e,r&&(this.extra=Object.assign({},this.extra,r))}},Bl=class extends ko{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Sn=class extends ko{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Cn=class extends xo{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}}},Do=class extends ko{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Me={log:xr("log"),warn:xr("warn"),info:xr("info"),error:xr("error"),debug:xr("debug")};Object.assign(globalThis,{logger:Me});Ao=Symbol.for("Jolibox.canIUseMap"),Kh={};globalThis[Ao]||(globalThis[Ao]=Kh);No={get config(){return globalThis[Ao]}},Rl=Symbol.for("Jolibox.canIUseMap.native"),$h={};globalThis[Rl]||(globalThis[Rl]=$h);Ft=(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))(Ft||{}),tr=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(tr||{}),Wh=(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))(Wh||{}),Ol=["name","params"],zh=["name","type","location","target","extra","timestamp","userId"],Yh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Xe=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});Qh();er=typeof window=="undefined",Zh=()=>!er&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Be={isiOS:!er&&(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:!er&&navigator.userAgent.includes("Android"),isMac:!er&&navigator.userAgent.includes("Mac"),isFacebook:!er&&navigator.userAgent.includes("FB_IAB"),isPC:!er&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},ep=()=>Be.isiOS?"iOS":Be.isAndroid?"Android":Be.isMac?"Mac":Be.isFacebook?"Facebook":"PC",tp="device_id",rp="advertising_id",Gl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Xe()),window.__joliboxLocalStorage__.getItem(e)),Lo=()=>new URLSearchParams(window.location.search).get("deviceId")||Gl(tp),Uo=()=>new URLSearchParams(window.location.search).get("advertisingId")||Gl(rp),np=e=>e.charAt(0).toUpperCase()+e.slice(1),ip=()=>{var e;let t=new URLSearchParams(window.location.search);return np((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Jl=e=>{if(Zh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=ep(),n=navigator.language,i=Lo(),o=Uo();return`${t} (${ip()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${o} version/${e||""}`};jt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=Oo({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Jt(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=>Jt(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 Jt(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),h=this.requestAdapter.extractRealTimeData(d),p=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,d);return p&&!this.config.consistencyChecker(l,p)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,p,s),d):this.requestAdapter.mergeData(l,h)}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 Jt(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Jt(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 Jt(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)}},Eo=class Io{constructor(t){this.element=t,this.next=Io.Undefined,this.prev=Io.Undefined}};Eo.Undefined=new Eo(void 0);le=Eo,ap=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},sp=0,kr=class{constructor(e){this.value=e,this.id=sp++}},Dr=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,h,p;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&&((p=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||p.call(h)))}}}}),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}},nt=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 Dr,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 ap,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)}},So={};Mh(So,{None:()=>lp,filter:()=>dp,once:()=>ql,toPromise:()=>cp});lp=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});wo=Symbol.for("Jolibox.hostEmitter"),up=()=>{let e=new nt;return globalThis[wo]||(globalThis[wo]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[wo]},Dt=up();In=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Dr,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 fp(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}};In=Tl([Dl],In);Co=class{constructor(){this._onWillExecuteCommand=new Dr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Dr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new In,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Gh(3e4)),this._starActivation}executeCommand(e,...t){return Jt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),So.toPromise(So.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}}};Co=Tl([Dl],Co);Hl=Symbol.for("Jolibox.commands")});function Ve(e,t={}){Mo.emit("ERROR_REPORT",{error:e,options:t})}var Mo,qt,pt=ie(()=>{"use strict";$();$();Mo=new nt,qt=new nt;Ve.debounce=Nr(Ve,50,{leading:!0})});var Go,vp,Vl,Kl,$l=ie(()=>{"use strict";$();pt();Go=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{}}},vp=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Vl=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:Go(o),payloadJson:Go(a),signature:Go(s)}}else throw"joli_source is missing"}catch(r){return Ve(new Bl(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},Kl=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=vp(e),o=r[2];return`${n}.${i}.${o}`}return t}});var gp,Rn,Wl,Jo=ie(()=>{"use strict";$();gp="1.4.18",Rn=()=>gp,Wl=()=>{let e=Rn();return`${Jl(e)}`}});function jo(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var _p,zl,Fo,Yl,ce,yp,B,ge=ie(()=>{"use strict";$();$l();Jo();$();_p={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Lo(),adId:Uo(),pixelRatio:window.devicePixelRatio||1,platform:Be.isAndroid?"android":Be.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:Rn()},schema:window.location.href,platform:Be.isAndroid?"android":Be.isiOS?"ios":"h5"},Fo=(zl=globalThis.joliboxJSCore)==null?void 0:zl.env,ce=Object.assign({},(Yl=Fo==null?void 0:Fo())!=null?Yl:_p);yp=()=>{var E,I,w,R,O,P,M,S,D,F,H;let{payloadJson:e,headerJson:t,signature:r}=ce.schema.length?Vl(ce.schema):{},n=`${ce.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ce.schema.length?ce.schema:window.location.href).searchParams,a=(w=(I=(E=o.get("mpId"))!=null?E:o.get("appId"))!=null?I:o.get("gameId"))!=null?w:"",s=(P=(O=(R=ce.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?O:o.get("sessionId"))!=null?P: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=(H=(F=(D=e==null?void 0:e.joliboxEnv)!=null?D:e==null?void 0:e.__joliboxEnv)!=null?F:o.get("joliboxEnv"))!=null?H:"production",m=c==="staging",d=t==null?void 0:t.channel,p=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,J;return(J=(U=p.get("joliSource"))!=null?U:o.get("joliSource"))!=null?J: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:Rn()},get mpType(){var U,J;return(J=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?J:"game"},get platform(){var U;return((U=ce.platform)!=null?U:ce.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ce.deviceInfo},get sdkInfo(){return ce.sdkInfo},get hostInfo(){return ce.hostInfo},get hostUserInfo(){return ce.hostUserInfo},get sessionId(){var U,J;return(J=(U=ce.clientSessionId)!=null?U:s)!=null?J:n},get channel(){return d},get webviewId(){var U;return(U=ce.webviewId)!=null?U:-1},get shouldInterupt(){return b},get from(){return e==null?void 0:e.__from},get baseApiHost(){return Fl(m)},get adId(){var U;return(U=ce.deviceInfo.adId)!=null?U:ce.deviceInfo.did},get language(){return ce.deviceInfo.lang},get sdkEnvironment(){return jo("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":jo("gamedistribution","jolibox")?"gamedistribution":jo("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var X,Q,be;let U=(X=ce.deviceInfo.pixelRatio)!=null?X:1,J=(Q=ce.deviceInfo.statusBarHeight)!=null?Q:e==null?void 0:e.__androidStatusBarHeight,j=(be=ce.deviceInfo.navigationBarHeight)!=null?be:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:J!==void 0?J/U:20,navigationBarHeight:j!==void 0?j/U:10}},get abTests(){var U,J;return(J=(U=ce.abValues)==null?void 0:U.split(","))!=null?J:[]},get mpInfo(){var U;return(U=ce.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{Nl(ce,U,Pl)},encodeJoliSourceQuery:U=>{var J,j;return t&&r?Kl(Y(Y({},e),U),(J=o.get("joliSource"))!=null?J:""):(j=o.get("joliSource"))!=null?j:""},setDoExitDirectly:()=>{b=!1}}},B=yp()});var qo,Ql,bp,wp,Xl,Ap,Zl=ie(()=>{"use strict";$();pt();ge();$();qo=!1,Ql=(e,t)=>e==null?!1:t in e,bp=e=>Ql(e,"kind"),wp=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Xl=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=B.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=B.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:wp(e.name)},i=Ue(Y({},n),{env:t.environment,isFromUser:r});r?qt.emit("GLOBAL_USER_ERROR",e,i):qt.emit("GLOBAL_ERROR",e,i)},Ap=e=>Ql(e,"kind")&&e.kind==="USER_ERROR";Mo.on("ERROR_REPORT",({error:e,options:t})=>{if(qo)return;qo=!0;let r=bp(e)&&e.raw?e.raw:e;try{let n=Ap(e);Xl(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new Do(`${i}, origin error: ${r.message}`);Me.error(o),Xl(new Do(o.message),{environment:t.environment},!1)}finally{qo=!1}})});var Ho,Vo=ie(()=>{"use strict";pt();$();pt();Ho=e=>new Ul(e)});function ec(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=Al(c,["eventType"]),l=Ue(Y({tag:n,eventType:o!=null?o:a!=null?a:Ft.Other},t),{extra:Y({},s)});n=="globalJsError"?Ve(new Sn(JSON.stringify(l))):e("systemLog",l,B.webviewId)};return r.debounce=Nr(r,500,{leading:!0}),r}function tc(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=Nr(t,500,{leading:!0}),t}var rc=ie(()=>{"use strict";$();$();pt();ge()});function nc(e,t){let r=ec(e,t),n=tc(r);return{track:r,trackPerformance:n}}var ic=ie(()=>{"use strict";rc()});var Ko=ie(()=>{"use strict"});var On,oc=ie(()=>{"use strict";ge();$();$();On=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return A(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}=B.sdkInfo;return{platform:1e3,os:B.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(o=(i=B.hostInfo)==null?void 0:i.aid)!=null?o:"1",model:(a=B.deviceInfo.model)!=null?a:"UnknownModel",brand:(s=B.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:B.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 A(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}=B;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,m={protocolVersion:"1.0.0",events:[Ue(Y({},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(Po(m),n):yield this.doReport(Po(m))}catch(h){Me.log("[Jolibox SDK] report API error",h)}})}}});var $o=ie(()=>{"use strict";ic();Ko();oc()});var Wo,ac,mt,Tn,Qe,nr=ie(()=>{"use strict";Jo();ge();$();Wo=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(ac=AbortSignal.timeout)!=null||(AbortSignal.timeout=Wo);mt=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 Tn(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},Tn=class{constructor(t){this.xua=Wl();this.getJoliSource=()=>B.joliSource;var n;let r=rr(B.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return A(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:Wo(i!=null?i:3e4)});return mt.getInstance().recordNetworkRequest(!0),yield d.json()}catch(n){throw mt.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return A(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":Be.isAndroid?"ANDROID":Be.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let h=yield fetch(c,{method:"POST",headers:a,body:JSON.stringify(n),signal:Wo(o!=null?o:3e4),credentials:"include"});mt.getInstance().recordNetworkRequest(!0);let p=h.headers.get("content-type");if(p!=null&&p.includes("application/octet-stream"))try{return h.blob()}catch(b){return yield h.arrayBuffer()}if(p!=null&&p.includes("multipart/form-data")||p!=null&&p.includes("application/x-www-form-urlencoded"))try{return h.formData()}catch(b){return yield h.text()}if(p!=null&&p.includes("application/json"))try{return yield h.json()}catch(b){return yield h.text()}return h}catch(n){throw mt.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return A(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 h=yield fetch(c,{method:"PUT",headers:a,credentials:"include",body:JSON.stringify(n!=null?n:{})});if(!h.ok)throw mt.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${h.status}`);return mt.getInstance().recordNetworkRequest(!0),yield h.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=Tn;Qe=mt.getInstance()});var zo,xn,Yo=ie(()=>{"use strict";ge();$o();nr();$();zo=class extends On{constructor(){super(...arguments);this.httpClient=Qe.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return jl((r=B.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},xn=new zo(rr(B.testMode))});var Ep,sc=ie(()=>{"use strict";Zl();$();Vo();$();Yo();ge();Ep=(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:Ft.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(a=(o=B.hostUserInfo)==null?void 0:o.uid)!=null?a:null};xn.trackEvent(n,tr.WebSDK)};qt.on("GLOBAL_ERROR",(e,t)=>{Ep(t.tag,e)});qt.on("GLOBAL_USER_ERROR",(e,t)=>{Me.log("UserError",e,t)})});var kn,lc=ie(()=>{"use strict";kn=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 p=Date.now(),b=p-r;b>=this.interval&&(this.visible&&(a+=Math.min(b,this.interval+1e3),t(a)),r=p),n=requestAnimationFrame(s)},l=()=>{m(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let p=Date.now();p-r>=this.interval&&(r=p)},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",p=>{o&&(console.log("visible",p),p?c():l())});let h=this.visible;return{start(){o||(o=!0,h?c():l())},stop(){o=!1,m(),d()}}}}});var cc,dc=ie(()=>{"use strict";cc=`-----BEGIN PUBLIC KEY-----
|
|
1
|
+
var Sh=Object.create;var _o=Object.defineProperty,Ch=Object.defineProperties,Rh=Object.getOwnPropertyDescriptor,kh=Object.getOwnPropertyDescriptors,Oh=Object.getOwnPropertyNames,En=Object.getOwnPropertySymbols,wl=Object.getPrototypeOf,yo=Object.prototype.hasOwnProperty,Al=Object.prototype.propertyIsEnumerable,Th=Reflect.get;var bl=(e,t,r)=>t in e?_o(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Y=(e,t)=>{for(var r in t||(t={}))yo.call(t,r)&&bl(e,r,t[r]);if(En)for(var r of En(t))Al.call(t,r)&&bl(e,r,t[r]);return e},Ue=(e,t)=>Ch(e,kh(t));var Tr=(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 El=(e,t)=>{var r={};for(var n in e)yo.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&En)for(var n of En(e))t.indexOf(n)<0&&Al.call(e,n)&&(r[n]=e[n]);return r};var ie=(e,t)=>()=>(e&&(t=e(e=0)),t);var bo=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var xh=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Oh(t))!yo.call(e,i)&&i!==r&&_o(e,i,{get:()=>t[i],enumerable:!(n=Rh(t,i))||n.enumerable});return e};var wo=(e,t,r)=>(r=e!=null?Sh(wl(e)):{},xh(t||!e||!e.__esModule?_o(r,"default",{value:e,enumerable:!0}):r,e));var Il=(e,t,r)=>Th(wl(e),r,t);var A=(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 Gh(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function To(e){return typeof e=="string"}function xl(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Dl(e){return typeof e=="object"&&Array.isArray(e)}function Jh(e){return typeof e=="undefined"}function Fh(e){return Jh(e)||e===null}function qh(e){return typeof e=="function"}function Nl(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}function Pl(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:Rl(l)&&Rl(s)?i[a]=n(Oo({},s),l):Array.isArray(l)&&Array.isArray(s)?i[a]=[...s,...l]:i[a]=l}return i}return n(e,t)}function Rl(e){return e&&typeof e=="object"&&e.constructor===Object}function Ll(e,t){if(Array.isArray(e))return e.concat(t)}function Pr(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),h=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 h.cancel=()=>{n&&clearTimeout(n),n=null,i=o=void 0},h.flush=()=>{if(n)return clearTimeout(n),n=null,c()},h}function Vh(e,t){return(...r)=>t(e,...r)}function Gl(e){return t=>Vh(t,function(r,...n){if(typeof r=="function")try{return r.apply(this,n)}catch(i){e(new Hh(`${i}`))}})}function xr(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}function In(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 Xh(e){let t=e.location?In(e.location,Ol):null,r=e.target?In(e.target,Ol):null;return In(Bh(Oo({},e),{location:t,target:r}),zh)}function Lo(e){let t=e.events.map(n=>Xh(n)),r=In(e.device,Yh);return[e.protocolVersion,t,r,e.project]}function Qh(){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 Mo(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 ql(e){return Mo("app","stg-app",e)}function rr(e){return`https://${Mo("api","stg-api",e)}`}function op(e){return Mo("collect","stg-collect",e)}function jl(e){return`https://${op(e)}`}function cp(e){return new Promise(t=>Hl(e)(t))}function Hl(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function dp(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Nr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}function fp(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)hp(e[n],t[n])}function hp(e,t){if(To(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(qh(t)){try{if(e instanceof t)return}catch(r){}if(!Fh(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 pp(){return typeof globalThis!="undefined"?globalThis[Vl]:void 0}function mp(e){typeof globalThis!="undefined"&&(globalThis[Vl]=e)}function Re(e=!1){let t=pp();if(!e&&t)return t;let r=new Sn,n=new Ro,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 mp(i),i}var ko,Dh,Nh,Ph,Sl,Lh,Uh,Cl,Oo,Bh,Mh,Tl,Jt,jh,xo,Do,Ul,Bl,Hh,Ml,Cn,Rn,No,Me,Eo,Kh,Po,kl,$h,Ft,tr,Wh,Ol,zh,Yh,Xe,er,Zh,Be,ep,tp,rp,Jl,Uo,Bo,np,ip,Fl,qt,Io,le,ap,sp,Dr,Nr,nt,Co,lp,Ao,up,Dt,Sn,Ro,Vl,$=ie(()=>{"use strict";ko=Object.defineProperty,Dh=Object.defineProperties,Nh=Object.getOwnPropertyDescriptor,Ph=Object.getOwnPropertyDescriptors,Sl=Object.getOwnPropertySymbols,Lh=Object.prototype.hasOwnProperty,Uh=Object.prototype.propertyIsEnumerable,Cl=(e,t,r)=>t in e?ko(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Oo=(e,t)=>{for(var r in t||(t={}))Lh.call(t,r)&&Cl(e,r,t[r]);if(Sl)for(var r of Sl(t))Uh.call(t,r)&&Cl(e,r,t[r]);return e},Bh=(e,t)=>Dh(e,Ph(t)),Mh=(e,t)=>{for(var r in t)ko(e,r,{get:t[r],enumerable:!0})},Tl=(e,t,r,n)=>{for(var i=n>1?void 0:n?Nh(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&&ko(t,r,i),i},Jt=(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||{}),xo=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}},Do=class extends xo{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Ul=class extends xo{constructor(){super(...arguments),this.kind="USER_ERROR"}},Bl=class extends Ul{constructor(){super(...arguments),this.name="USER_VALIDATE_ERROR"}},Hh=class extends Ul{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))}},Ml=class extends Do{constructor(){super(...arguments),this.name="INTERNAL_SCHEMA_PARSE_ERROR",this.priority="P0"}},Cn=class extends Do{constructor(){super(...arguments),this.name="INTERNAL_GLOBAL_JS_ERROR",this.priority="P1"}},Rn=class extends xo{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}}},No=class extends Do{constructor(){super(...arguments),this.name="INTERNAL_REPORTER_ERROR"}};Me={log:xr("log"),warn:xr("warn"),info:xr("info"),error:xr("error"),debug:xr("debug")};Object.assign(globalThis,{logger:Me});Eo=Symbol.for("Jolibox.canIUseMap"),Kh={};globalThis[Eo]||(globalThis[Eo]=Kh);Po={get config(){return globalThis[Eo]}},kl=Symbol.for("Jolibox.canIUseMap.native"),$h={};globalThis[kl]||(globalThis[kl]=$h);Ft=(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))(Ft||{}),tr=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(tr||{}),Wh=(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))(Wh||{}),Ol=["name","params"],zh=["name","type","location","target","extra","timestamp","userId"],Yh=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];Xe=()=>"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)});Qh();er=typeof window=="undefined",Zh=()=>!er&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),Be={isiOS:!er&&(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:!er&&navigator.userAgent.includes("Android"),isMac:!er&&navigator.userAgent.includes("Mac"),isFacebook:!er&&navigator.userAgent.includes("FB_IAB"),isPC:!er&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},ep=()=>Be.isiOS?"iOS":Be.isAndroid?"Android":Be.isMac?"Mac":Be.isFacebook?"Facebook":"PC",tp="device_id",rp="advertising_id",Jl=e=>(window.__joliboxLocalStorage__.getItem(e)||window.__joliboxLocalStorage__.setItem(e,Xe()),window.__joliboxLocalStorage__.getItem(e)),Uo=()=>new URLSearchParams(window.location.search).get("deviceId")||Jl(tp),Bo=()=>new URLSearchParams(window.location.search).get("advertisingId")||Jl(rp),np=e=>e.charAt(0).toUpperCase()+e.slice(1),ip=()=>{var e;let t=new URLSearchParams(window.location.search);return np((e=t.get("utm_source"))!=null?e:"")||"JoliboxSDK"},Fl=e=>{if(Zh())return window.navigator.userAgent;let t="JoliboxWebSDK",r=ep(),n=navigator.language,i=Uo(),o=Bo();return`${t} (${ip()}${r}; UnknownModel; UnknownSystemVersion; ${n}) uuid/${i} adid/${o} version/${e||""}`};qt=class{constructor(e,t={}){this.requestAdapter=e,this.cache=new Map,this.pendingRequests=new Map,this.requestSequence=0,this.cacheSequences=new Map,this.config=Oo({duration:10*60*1e3,timeout:3e3,keyGenerator:(r,n)=>r,consistencyChecker:()=>!0},t)}request(e,t){return Jt(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=>Jt(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 Jt(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),m=(n=(r=this.requestAdapter).extractCacheableData)==null?void 0:n.call(r,d);return m&&!this.config.consistencyChecker(l,m)?(console.log(`[RequestCacheService] Cache invalidated due to data change for ${e}`),this.setCachedDataWithSequence(a,m,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),h=(o=(i=this.requestAdapter).extractCacheableData)==null?void 0:o.call(i,c);return h&&this.setCachedDataWithSequence(a,h,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 Jt(this,null,function*(){let r=this.config.keyGenerator(e,t);return this.cache.delete(r),this.request(e,t)})}forceRequest(e,t){return Jt(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 Jt(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)}},Io=class So{constructor(t){this.element=t,this.next=So.Undefined,this.prev=So.Undefined}};Io.Undefined=new Io(void 0);le=Io,ap=class{constructor(){this._first=le.Undefined,this._last=le.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===le.Undefined}clear(){let e=this._first;for(;e!==le.Undefined;){let t=e.next;e.prev=le.Undefined,e.next=le.Undefined,e=t}this._first=le.Undefined,this._last=le.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new le(e);if(this._first===le.Undefined)this._first=r,this._last=r;else if(t){let i=this._last;this._last=r,r.prev=i,i.next=r}else{let i=this._first;this._first=r,r.next=i,i.prev=r}this._size+=1;let n=!1;return()=>{n||(n=!0,this._remove(r))}}shift(){if(this._first!==le.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==le.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==le.Undefined&&e.next!==le.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===le.Undefined&&e.next===le.Undefined?(this._first=le.Undefined,this._last=le.Undefined):e.next===le.Undefined?(this._last=this._last.prev,this._last.next=le.Undefined):e.prev===le.Undefined&&(this._first=this._first.next,this._first.prev=le.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==le.Undefined;)yield e.element,e=e.next}},sp=0,Dr=class{constructor(e){this.value=e,this.id=sp++}},Nr=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 Dr&&(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 Dr(t);return this._listeners?this._listeners instanceof Dr?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 h,d,p,m;if(!this._disposed){if(this._listeners instanceof Dr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((m=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||m.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 Dr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},nt=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 Nr,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 ap,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)}},Co={};Mh(Co,{None:()=>lp,filter:()=>dp,once:()=>Hl,toPromise:()=>cp});lp=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});Ao=Symbol.for("Jolibox.hostEmitter"),up=()=>{let e=new nt;return globalThis[Ao]||(globalThis[Ao]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Ao]},Dt=up();Sn=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Nr,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 fp(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}};Sn=Tl([Nl],Sn);Ro=class{constructor(){this._onWillExecuteCommand=new Nr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Nr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Sn,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Gh(3e4)),this._starActivation}executeCommand(e,...t){return Jt(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Co.toPromise(Co.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}}};Ro=Tl([Nl],Ro);Vl=Symbol.for("Jolibox.commands")});function Ve(e,t={}){Go.emit("ERROR_REPORT",{error:e,options:t})}var Go,jt,pt=ie(()=>{"use strict";$();$();Go=new nt,jt=new nt;Ve.debounce=Pr(Ve,50,{leading:!0})});var Jo,vp,Kl,$l,Wl=ie(()=>{"use strict";$();pt();Jo=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{}}},vp=e=>{let t=JSON.stringify(e);return btoa(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")},Kl=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:Jo(o),payloadJson:Jo(a),signature:Jo(s)}}else throw"joli_source is missing"}catch(r){return Ve(new Ml(`${e} not a valid schema: ${r}`)),{headerJson:{},payloadJson:{},signature:{}}}},$l=(e,t)=>{let r=t.split(".");if(r&&r.length===3){let n=r[0],i=vp(e),o=r[2];return`${n}.${i}.${o}`}return t}});var gp,kn,zl,Fo=ie(()=>{"use strict";$();gp="1.4.19",kn=()=>gp,zl=()=>{let e=kn();return`${Fl(e)}`}});function jo(e,t){return(document==null?void 0:document.head.querySelector(`meta[name="${e}"][content="${t}"]`))!==null}var _p,Yl,qo,Xl,ce,yp,B,ge=ie(()=>{"use strict";$();Wl();Fo();$();_p={deviceInfo:{brand:"UnknownBrand",model:"UnknownModel",did:Uo(),adId:Bo(),pixelRatio:window.devicePixelRatio||1,platform:Be.isAndroid?"android":Be.isiOS?"ios":"h5",system:"UnknownSystemVersion",lang:"zh"},sdkInfo:{nativeSDKVersion:"",jssdkVersion:kn()},schema:window.location.href,platform:Be.isAndroid?"android":Be.isiOS?"ios":"h5"},qo=(Yl=globalThis.joliboxJSCore)==null?void 0:Yl.env,ce=Object.assign({},(Xl=qo==null?void 0:qo())!=null?Xl:_p);yp=()=>{var E,I,w,R,k,P,M,S,D,F,H;let{payloadJson:e,headerJson:t,signature:r}=ce.schema.length?Kl(ce.schema):{},n=`${ce.deviceInfo.did}-${new Date().getTime()}`,o=new URL(ce.schema.length?ce.schema:window.location.href).searchParams,a=(w=(I=(E=o.get("mpId"))!=null?E:o.get("appId"))!=null?I:o.get("gameId"))!=null?w:"",s=(P=(k=(R=ce.clientSessionId)!=null?R:e==null?void 0:e.sessionId)!=null?k:o.get("sessionId"))!=null?P: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=(H=(F=(D=e==null?void 0:e.joliboxEnv)!=null?D:e==null?void 0:e.__joliboxEnv)!=null?F:o.get("joliboxEnv"))!=null?H:"production",h=c==="staging",d=t==null?void 0:t.channel,m=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 h},get testAdsMode(){return l},get joliboxEnv(){return c},get joliSource(){var U,J;return(J=(U=m.get("joliSource"))!=null?U:o.get("joliSource"))!=null?J: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:kn()},get mpType(){var U,J;return(J=(U=t==null?void 0:t.__mpType)!=null?U:e==null?void 0:e.__mpType)!=null?J:"game"},get platform(){var U;return((U=ce.platform)!=null?U:ce.deviceInfo.platform).toLowerCase()},get deviceInfo(){return ce.deviceInfo},get sdkInfo(){return ce.sdkInfo},get hostInfo(){return ce.hostInfo},get hostUserInfo(){return ce.hostUserInfo},get sessionId(){var U,J;return(J=(U=ce.clientSessionId)!=null?U:s)!=null?J:n},get channel(){return d},get webviewId(){var U;return(U=ce.webviewId)!=null?U:-1},get shouldInterupt(){return b},get from(){return e==null?void 0:e.__from},get baseApiHost(){return ql(h)},get adId(){var U;return(U=ce.deviceInfo.adId)!=null?U:ce.deviceInfo.did},get language(){return ce.deviceInfo.lang},get sdkEnvironment(){return jo("dlightek","jolibox")?"dlightek":o.get("huaweiQuick")==="true"?"huaweiQuick":jo("gamedistribution","jolibox")?"gamedistribution":jo("funmax","jolibox")?"funmax":"jolibox"},get viewport(){var X,Q,be;let U=(X=ce.deviceInfo.pixelRatio)!=null?X:1,J=(Q=ce.deviceInfo.statusBarHeight)!=null?Q:e==null?void 0:e.__androidStatusBarHeight,q=(be=ce.deviceInfo.navigationBarHeight)!=null?be:e==null?void 0:e.__androidNavigationBarHeight;return{statusBarHeight:J!==void 0?J/U:20,navigationBarHeight:q!==void 0?q/U:10}},get abTests(){var U,J;return(J=(U=ce.abValues)==null?void 0:U.split(","))!=null?J:[]},get mpInfo(){var U;return(U=ce.mpInfo)!=null?U:{mpName:"unknown"}},onEnvConfigChanged:U=>{Pl(ce,U,Ll)},encodeJoliSourceQuery:U=>{var J,q;return t&&r?$l(Y(Y({},e),U),(J=o.get("joliSource"))!=null?J:""):(q=o.get("joliSource"))!=null?q:""},setDoExitDirectly:()=>{b=!1}}},B=yp()});var Ho,Zl,bp,wp,Ql,Ap,ec=ie(()=>{"use strict";$();pt();ge();$();Ho=!1,Zl=(e,t)=>e==null?!1:t in e,bp=e=>Zl(e,"kind"),wp=e=>{let t=e.toLowerCase().split("_");return t[0]+t.slice(1).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join("")},Ql=(e,t={},r)=>{var o,a,s;let n={user_id:(a=(o=B.hostUserInfo)==null?void 0:o.uid)!=null?a:"",device_id:(s=B.deviceInfo.did)!=null?s:"",timestamp:Date.now(),tag:wp(e.name)},i=Ue(Y({},n),{env:t.environment,isFromUser:r});r?jt.emit("GLOBAL_USER_ERROR",e,i):jt.emit("GLOBAL_ERROR",e,i)},Ap=e=>Zl(e,"kind")&&e.kind==="USER_ERROR";Go.on("ERROR_REPORT",({error:e,options:t})=>{if(Ho)return;Ho=!0;let r=bp(e)&&e.raw?e.raw:e;try{let n=Ap(e);Ql(e,t,n)}catch(n){let i=n instanceof Error?n.message:String(n),o=new No(`${i}, origin error: ${r.message}`);Me.error(o),Ql(new No(o.message),{environment:t.environment},!1)}finally{Ho=!1}})});var Vo,Ko=ie(()=>{"use strict";pt();$();pt();Vo=e=>new Bl(e)});function tc(e,t){let r=(n,i,o)=>{let c=i!=null?i:{},{eventType:a}=c,s=El(c,["eventType"]),l=Ue(Y({tag:n,eventType:o!=null?o:a!=null?a:Ft.Other},t),{extra:Y({},s)});n=="globalJsError"?Ve(new Cn(JSON.stringify(l))):e("systemLog",l,B.webviewId)};return r.debounce=Pr(r,500,{leading:!0}),r}function rc(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=Pr(t,500,{leading:!0}),t}var nc=ie(()=>{"use strict";$();$();pt();ge()});function ic(e,t){let r=tc(e,t),n=rc(r);return{track:r,trackPerformance:n}}var oc=ie(()=>{"use strict";nc()});var $o=ie(()=>{"use strict"});var On,ac=ie(()=>{"use strict";ge();$();$();On=class{constructor(t){this.apiHost=t;this.deviceInfo=null;this.samplesConfig=null;this.fetchSamplesConfig()}fetchSamplesConfig(){return A(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}=B.sdkInfo;return{platform:1e3,os:B.deviceInfo.platform,appVersion:(n=t!=null?t:r)!=null?n:"1.0.0",appId:(o=(i=B.hostInfo)==null?void 0:i.aid)!=null?o:"1",model:(a=B.deviceInfo.model)!=null?a:"UnknownModel",brand:(s=B.deviceInfo.brand)!=null?s:"UnknownBrand",uuid:B.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 A(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}=B;this.deviceInfo||(this.deviceInfo=yield this.getDevice());let l=this.deviceInfo,h={protocolVersion:"1.0.0",events:[Ue(Y({},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(Lo(h),n):yield this.doReport(Lo(h))}catch(p){Me.log("[Jolibox SDK] report API error",p)}})}}});var Wo=ie(()=>{"use strict";oc();$o();ac()});var zo,sc,mt,Tn,Qe,nr=ie(()=>{"use strict";Fo();ge();$();zo=e=>{let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};(sc=AbortSignal.timeout)!=null||(AbortSignal.timeout=zo);mt=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 Tn(t);return e.getInstance().httpClients.add(r),r}recordNetworkRequest(t){this.networkRequests.push(t),this.networkRequests.length>this.maxRequestsToTrack&&this.networkRequests.shift()}},Tn=class{constructor(t){this.xua=zl();this.getJoliSource=()=>B.joliSource;var n;let r=rr(B.testMode);this.baseUrl=(n=t==null?void 0:t.baseUrl)!=null?n:r}get(t,r){return A(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,h=this.getJoliSource();o=Object.assign({},o!=null?o:{},c?{"x-user-agent":c}:{},h?{"x-joli-source":h}:{});let d=yield fetch(l,{method:"GET",headers:o,credentials:"include",signal:zo(i!=null?i:3e4)});return mt.getInstance().recordNetworkRequest(!0),yield d.json()}catch(n){throw mt.getInstance().recordNetworkRequest(!1),n}})}post(t,r){return A(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}`:""}`,h=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},h?{"x-user-agent":h}:{},d?{"x-joli-source":d}:{},{"x-os-type":Be.isAndroid?"ANDROID":Be.isiOS?"IOS":"PC"},{"x-runtime-type":"WEB"});let p=yield fetch(c,{method:"POST",headers:a,body:JSON.stringify(n),signal:zo(o!=null?o:3e4),credentials:"include"});mt.getInstance().recordNetworkRequest(!0);let m=p.headers.get("content-type");if(m!=null&&m.includes("application/octet-stream"))try{return p.blob()}catch(b){return yield p.arrayBuffer()}if(m!=null&&m.includes("multipart/form-data")||m!=null&&m.includes("application/x-www-form-urlencoded"))try{return p.formData()}catch(b){return yield p.text()}if(m!=null&&m.includes("application/json"))try{return yield p.json()}catch(b){return yield p.text()}return p}catch(n){throw mt.getInstance().recordNetworkRequest(!1),n}})}put(t,r){return A(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}`:""}`,h=this.xua,d=this.getJoliSource();a=Object.assign({},a!=null?a:{},{"Content-Type":"application/json"},h?{"x-user-agent":h}:{},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 mt.getInstance().recordNetworkRequest(!1),new Error(`HTTP error! status: ${p.status}`);return mt.getInstance().recordNetworkRequest(!0),yield p.json()}catch(n){throw console.error("Error:",n),n}})}};window.JoliboxHttpClient=Tn;Qe=mt.getInstance()});var Yo,xn,Xo=ie(()=>{"use strict";ge();Wo();nr();$();Yo=class extends On{constructor(){super(...arguments);this.httpClient=Qe.create({baseUrl:this.apiBaseURL})}get apiBaseURL(){var r;return jl((r=B.testMode)!=null?r:!1)}doReport(r){this.httpClient.post("/report",{data:r,timeout:5e3}).catch(n=>{console.info("report error",n)})}},xn=new Yo(rr(B.testMode))});var Ep,lc=ie(()=>{"use strict";ec();$();Ko();$();Xo();ge();Ep=(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:Ft.ErrorTrace,location:null,target:null,extra:r,timestamp:Date.now(),userId:(a=(o=B.hostUserInfo)==null?void 0:o.uid)!=null?a:null};xn.trackEvent(n,tr.WebSDK)};jt.on("GLOBAL_ERROR",(e,t)=>{Ep(t.tag,e)});jt.on("GLOBAL_USER_ERROR",(e,t)=>{Me.log("UserError",e,t)})});var Dn,cc=ie(()=>{"use strict";Dn=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 m=Date.now(),b=m-r;b>=this.interval&&(this.visible&&(a+=Math.min(b,this.interval+1e3),t(a)),r=m),n=requestAnimationFrame(s)},l=()=>{h(),r=Date.now(),i=window.setInterval(()=>{if(!o)return;let m=Date.now();m-r>=this.interval&&(r=m)},this.interval)},c=()=>{d(),r=Date.now(),n=requestAnimationFrame(s)},h=()=>{n&&(cancelAnimationFrame(n),n=0)},d=()=>{i&&(clearInterval(i),i=0)};this.eventEmitter.on("visible",m=>{o&&(console.log("visible",m),m?c():l())});let p=this.visible;return{start(){o||(o=!0,p?c():l())},stop(){o=!1,h(),d()}}}}});var dc,uc=ie(()=>{"use strict";dc=`-----BEGIN PUBLIC KEY-----
|
|
2
2
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs29BUZPZdQwNDEYtXufp
|
|
3
3
|
IGF40RBoddFzoD2ixl6PjyKWFXF8kxGS++HNtLspxhLvWoE12IZvrP7+whSpgHcy
|
|
4
4
|
4ryuW86mOdHnP9iyeK69GosHz3lVhQjF9UdhJDXB7P/zdj3VlVzZIj0yL+YvZjO0
|
|
@@ -6,9 +6,9 @@ F9vHrK8GMr1/gf3HKAroVJUVmJlWjqhBGoQzb58mqbTSWSN0HkDdYwXHNh/Xc1le
|
|
|
6
6
|
DJDbBmfKOQdlBjABR9gb1wGz2LPFA40kzROV9mMiVePXpCOKNMy+b0UOW4RoF7pi
|
|
7
7
|
Rq0jHJ4fRrMWvf/GugT0mv8YyuU9DaXLqTGP+jOEVvzvgtkO84XtLW1vh5ggINPW
|
|
8
8
|
2wIDAQAB
|
|
9
|
-
-----END PUBLIC KEY-----`});function
|
|
10
|
-
or `);this.errors.push(o)}return n}}
|
|
11
|
-
`);throw e.errors.length=0,Qo(!1),new TypeError(n)}}var q,na=ie(()=>{"use strict";ta();ta();q={object(e){return new Hn(e)},array(e){return new jn(e)},tuple(...e){return new $n(...e)},literal(e){return new Vn(e)},or(...e){return new Kn(...e)},symbol(){return new Bn},record(e){return new qn(e)},function(){return new Jn},boolean(){return new Ln},string(){return new Un},number(){return new Pn},undefined(){return new Mn},null(){return new Gn},unknown(){return new ir},any(){return new ir},as(){return new ir},arraybuffer(){return new Wn},enum(...e){return new Fn(...e)},typedarray(e){return new zn(e)}}});var Yn,yc,bc=ie(()=>{"use strict";$();pt();na();Vo();Yn=1,yc=e=>{function t(n,i){return(...o)=>{var d,h,p,b;let a=Date.now(),s={method:n,trace_id:Yn};Yn+=1;let l="SUCCESS",c=`${n}:ok`,m=0;try{if(i.paramsSchema)try{ra(i.paramsSchema,o,"params")}catch(R){throw Ho(`${n}:fail ${R.message}`)}let E=i.implement(...o),I=E,w=`${n}:ok`;if(E&&"code"in E){let{code:R,data:O,message:P}=E;l=R,I=O,w=P}return{code:l,message:w,data:I}}catch(E){let I=E;m=(h=(d=I.code)!=null?d:I.errNo)!=null?h:2e3,l="FAILURE";let w=(b=(p=I.message)!=null?p:I.errMsg)!=null?b:`${E}`;return c=`${n}:${l} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`,Ve(new Cn(c,m)),{code:l,message:c}}finally{let E=Date.now()-a}}}function r(n,i){return(...o)=>A(this,null,function*(){var h,p,b,E;let a=kl(o)?o:[o],s=Date.now(),l={method:n,trace_id:Yn};Yn+=1;let c=`${n}:ok`,m="SUCCESS",d={code:m,message:c};try{if(i.paramsSchema)try{ra(i.paramsSchema,a,"params")}catch(R){throw Ho(R.message)}let w=yield i.implement(...a);if(w&&"code"in w){let{code:R,data:O,message:P}=w;m=R,c=P,w=O}return Object.assign(d,{code:m,message:c,data:w}),d}catch(I){let w=I,R=(p=(h=w.code)!=null?h:w.errNo)!=null?p:2e3;m="FAILURE";let O=(E=(b=w.message)!=null?b:w.errMsg)!=null?E:`${I}`,P=`${n}:${m} ${O.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(d,{code:m,message:P}),Ve(new Cn(P,R)),d}finally{let I=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var et,Ht,Ie,Pr=ie(()=>{"use strict";gc();vt();bc();na();({createAPI:et,createSyncAPI:Ht}=yc(Ee)),Ie=vc("h5")});var Ic=yo((Ec,sa)=>{(function(e){if(typeof Ec=="object"&&typeof sa!="undefined")sa.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(i,o,a){function s(m,d){if(!o[m]){if(!i[m]){var h=typeof Tr=="function"&&Tr;if(!d&&h)return h(m,!0);if(l)return l(m,!0);var p=new Error("Cannot find module '"+m+"'");throw p.code="MODULE_NOT_FOUND",p}var b=o[m]={exports:{}};i[m][0].call(b.exports,function(E){var I=i[m][1][E];return s(I||E)},b,b.exports,n,i,o,a)}return o[m].exports}for(var l=typeof Tr=="function"&&Tr,c=0;c<a.length;c++)s(a[c]);return s}({1:[function(n,i,o){(function(a){"use strict";var s=a.MutationObserver||a.WebKitMutationObserver,l;if(s){var c=0,m=new s(E),d=a.document.createTextNode("");m.observe(d,{characterData:!0}),l=function(){d.data=c=++c%2}}else if(!a.setImmediate&&typeof a.MessageChannel!="undefined"){var h=new a.MessageChannel;h.port1.onmessage=E,l=function(){h.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?l=function(){var w=a.document.createElement("script");w.onreadystatechange=function(){E(),w.onreadystatechange=null,w.parentNode.removeChild(w),w=null},a.document.documentElement.appendChild(w)}:l=function(){setTimeout(E,0)};var p,b=[];function E(){p=!0;for(var w,R,O=b.length;O;){for(R=b,b=[],w=-1;++w<O;)R[w]();O=b.length}p=!1}i.exports=I;function I(w){b.push(w)===1&&!p&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,o){"use strict";var a=n(1);function s(){}var l={},c=["REJECTED"],m=["FULFILLED"],d=["PENDING"];i.exports=h;function h(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,S!==s&&I(this,S)}h.prototype.catch=function(S){return this.then(null,S)},h.prototype.then=function(S,D){if(typeof S!="function"&&this.state===m||typeof D!="function"&&this.state===c)return this;var F=new this.constructor(s);if(this.state!==d){var H=this.state===m?S:D;b(F,H,this.outcome)}else this.queue.push(new p(F,S,D));return F};function p(S,D,F){this.promise=S,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof F=="function"&&(this.onRejected=F,this.callRejected=this.otherCallRejected)}p.prototype.callFulfilled=function(S){l.resolve(this.promise,S)},p.prototype.otherCallFulfilled=function(S){b(this.promise,this.onFulfilled,S)},p.prototype.callRejected=function(S){l.reject(this.promise,S)},p.prototype.otherCallRejected=function(S){b(this.promise,this.onRejected,S)};function b(S,D,F){a(function(){var H;try{H=D(F)}catch(U){return l.reject(S,U)}H===S?l.reject(S,new TypeError("Cannot resolve promise with itself")):l.resolve(S,H)})}l.resolve=function(S,D){var F=w(E,D);if(F.status==="error")return l.reject(S,F.value);var H=F.value;if(H)I(S,H);else{S.state=m,S.outcome=D;for(var U=-1,J=S.queue.length;++U<J;)S.queue[U].callFulfilled(D)}return S},l.reject=function(S,D){S.state=c,S.outcome=D;for(var F=-1,H=S.queue.length;++F<H;)S.queue[F].callRejected(D);return S};function E(S){var D=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof D=="function")return function(){D.apply(S,arguments)}}function I(S,D){var F=!1;function H(X){F||(F=!0,l.reject(S,X))}function U(X){F||(F=!0,l.resolve(S,X))}function J(){D(U,H)}var j=w(J);j.status==="error"&&H(j.value)}function w(S,D){var F={};try{F.value=S(D),F.status="success"}catch(H){F.status="error",F.value=H}return F}h.resolve=R;function R(S){return S instanceof this?S:l.resolve(new this(s),S)}h.reject=O;function O(S){var D=new this(s);return l.reject(D,S)}h.all=P;function P(S){var D=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var F=S.length,H=!1;if(!F)return this.resolve([]);for(var U=new Array(F),J=0,j=-1,X=new this(s);++j<F;)Q(S[j],j);return X;function Q(be,Z){D.resolve(be).then(Le,function(ft){H||(H=!0,l.reject(X,ft))});function Le(ft){U[Z]=ft,++J===F&&!H&&(H=!0,l.resolve(X,U))}}}h.race=M;function M(S){var D=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var F=S.length,H=!1;if(!F)return this.resolve([]);for(var U=-1,J=new this(s);++U<F;)j(S[U]);return J;function j(X){D.resolve(X).then(function(Q){H||(H=!0,l.resolve(J,Q))},function(Q){H||(H=!0,l.reject(J,Q))})}}},{1:1}],3:[function(n,i,o){(function(a){"use strict";typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u};function s(u,v){if(!(u instanceof v))throw new TypeError("Cannot call a class as a function")}function l(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(u){return}}var c=l();function m(){try{if(!c||!c.open)return!1;var u=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),v=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!u||v)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(f){return!1}}function d(u,v){u=u||[],v=v||{};try{return new Blob(u,v)}catch(g){if(g.name!=="TypeError")throw g;for(var f=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,_=new f,y=0;y<u.length;y+=1)_.append(u[y]);return _.getBlob(v.type)}}typeof Promise=="undefined"&&n(3);var h=Promise;function p(u,v){v&&u.then(function(f){v(null,f)},function(f){v(f)})}function b(u,v,f){typeof v=="function"&&u.then(v),typeof f=="function"&&u.catch(f)}function E(u){return typeof u!="string"&&(console.warn(u+" used as a key, but it is not a string."),u=String(u)),u}function I(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var w="local-forage-detect-blob-support",R=void 0,O={},P=Object.prototype.toString,M="readonly",S="readwrite";function D(u){for(var v=u.length,f=new ArrayBuffer(v),_=new Uint8Array(f),y=0;y<v;y++)_[y]=u.charCodeAt(y);return f}function F(u){return new h(function(v){var f=u.transaction(w,S),_=d([""]);f.objectStore(w).put(_,"key"),f.onabort=function(y){y.preventDefault(),y.stopPropagation(),v(!1)},f.oncomplete=function(){var y=navigator.userAgent.match(/Chrome\/(\d+)/),g=navigator.userAgent.match(/Edge\//);v(g||!y||parseInt(y[1],10)>=43)}}).catch(function(){return!1})}function H(u){return typeof R=="boolean"?h.resolve(R):F(u).then(function(v){return R=v,R})}function U(u){var v=O[u.name],f={};f.promise=new h(function(_,y){f.resolve=_,f.reject=y}),v.deferredOperations.push(f),v.dbReady?v.dbReady=v.dbReady.then(function(){return f.promise}):v.dbReady=f.promise}function J(u){var v=O[u.name],f=v.deferredOperations.pop();if(f)return f.resolve(),f.promise}function j(u,v){var f=O[u.name],_=f.deferredOperations.pop();if(_)return _.reject(v),_.promise}function X(u,v){return new h(function(f,_){if(O[u.name]=O[u.name]||Zs(),u.db)if(v)U(u),u.db.close();else return f(u.db);var y=[u.name];v&&y.push(u.version);var g=c.open.apply(c,y);v&&(g.onupgradeneeded=function(C){var T=g.result;try{T.createObjectStore(u.storeName),C.oldVersion<=1&&T.createObjectStore(w)}catch(x){if(x.name==="ConstraintError")console.warn('The database "'+u.name+'" has been upgraded from version '+C.oldVersion+" to version "+C.newVersion+', but the storage "'+u.storeName+'" already exists.');else throw x}}),g.onerror=function(C){C.preventDefault(),_(g.error)},g.onsuccess=function(){var C=g.result;C.onversionchange=function(T){T.target.close()},f(C),J(u)}})}function Q(u){return X(u,!1)}function be(u){return X(u,!0)}function Z(u,v){if(!u.db)return!0;var f=!u.db.objectStoreNames.contains(u.storeName),_=u.version<u.db.version,y=u.version>u.db.version;if(_&&(u.version!==v&&console.warn('The database "'+u.name+`" can't be downgraded from version `+u.db.version+" to version "+u.version+"."),u.version=u.db.version),y||f){if(f){var g=u.db.version+1;g>u.version&&(u.version=g)}return!0}return!1}function Le(u){return new h(function(v,f){var _=new FileReader;_.onerror=f,_.onloadend=function(y){var g=btoa(y.target.result||"");v({__local_forage_encoded_blob:!0,data:g,type:u.type})},_.readAsBinaryString(u)})}function ft(u){var v=D(atob(u.data));return d([v],{type:u.type})}function Cr(u){return u&&u.__local_forage_encoded_blob}function _n(u){var v=this,f=v._initReady().then(function(){var _=O[v._dbInfo.name];if(_&&_.dbReady)return _.dbReady});return b(f,u,u),f}function yn(u){U(u);for(var v=O[u.name],f=v.forages,_=0;_<f.length;_++){var y=f[_];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return u.db=null,Q(u).then(function(g){return u.db=g,Z(u)?be(u):g}).then(function(g){u.db=v.db=g;for(var C=0;C<f.length;C++)f[C]._dbInfo.db=g}).catch(function(g){throw j(u,g),g})}function ht(u,v,f,_){_===void 0&&(_=1);try{var y=u.db.transaction(u.storeName,v);f(null,y)}catch(g){if(_>0&&(!u.db||g.name==="InvalidStateError"||g.name==="NotFoundError"))return h.resolve().then(function(){if(!u.db||g.name==="NotFoundError"&&!u.db.objectStoreNames.contains(u.storeName)&&u.version<=u.db.version)return u.db&&(u.version=u.db.version+1),be(u)}).then(function(){return yn(u).then(function(){ht(u,v,f,_-1)})}).catch(f);f(g)}}function Zs(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function Of(u){var v=this,f={db:null};if(u)for(var _ in u)f[_]=u[_];var y=O[f.name];y||(y=Zs(),O[f.name]=y),y.forages.push(v),v._initReady||(v._initReady=v.ready,v.ready=_n);var g=[];function C(){return h.resolve()}for(var T=0;T<y.forages.length;T++){var x=y.forages[T];x!==v&&g.push(x._initReady().catch(C))}var k=y.forages.slice(0);return h.all(g).then(function(){return f.db=y.db,Q(f)}).then(function(N){return f.db=N,Z(f,v._defaultConfig.version)?be(f):N}).then(function(N){f.db=y.db=N,v._dbInfo=f;for(var G=0;G<k.length;G++){var W=k[G];W!==v&&(W._dbInfo.db=f.db,W._dbInfo.version=f.version)}})}function Tf(u,v){var f=this;u=E(u);var _=new h(function(y,g){f.ready().then(function(){ht(f._dbInfo,M,function(C,T){if(C)return g(C);try{var x=T.objectStore(f._dbInfo.storeName),k=x.get(u);k.onsuccess=function(){var N=k.result;N===void 0&&(N=null),Cr(N)&&(N=ft(N)),y(N)},k.onerror=function(){g(k.error)}}catch(N){g(N)}})}).catch(g)});return p(_,v),_}function xf(u,v){var f=this,_=new h(function(y,g){f.ready().then(function(){ht(f._dbInfo,M,function(C,T){if(C)return g(C);try{var x=T.objectStore(f._dbInfo.storeName),k=x.openCursor(),N=1;k.onsuccess=function(){var G=k.result;if(G){var W=G.value;Cr(W)&&(W=ft(W));var re=u(W,G.key,N++);re!==void 0?y(re):G.continue()}else y()},k.onerror=function(){g(k.error)}}catch(G){g(G)}})}).catch(g)});return p(_,v),_}function kf(u,v,f){var _=this;u=E(u);var y=new h(function(g,C){var T;_.ready().then(function(){return T=_._dbInfo,P.call(v)==="[object Blob]"?H(T.db).then(function(x){return x?v:Le(v)}):v}).then(function(x){ht(_._dbInfo,S,function(k,N){if(k)return C(k);try{var G=N.objectStore(_._dbInfo.storeName);x===null&&(x=void 0);var W=G.put(x,u);N.oncomplete=function(){x===void 0&&(x=null),g(x)},N.onabort=N.onerror=function(){var re=W.error?W.error:W.transaction.error;C(re)}}catch(re){C(re)}})}).catch(C)});return p(y,f),y}function Df(u,v){var f=this;u=E(u);var _=new h(function(y,g){f.ready().then(function(){ht(f._dbInfo,S,function(C,T){if(C)return g(C);try{var x=T.objectStore(f._dbInfo.storeName),k=x.delete(u);T.oncomplete=function(){y()},T.onerror=function(){g(k.error)},T.onabort=function(){var N=k.error?k.error:k.transaction.error;g(N)}}catch(N){g(N)}})}).catch(g)});return p(_,v),_}function Nf(u){var v=this,f=new h(function(_,y){v.ready().then(function(){ht(v._dbInfo,S,function(g,C){if(g)return y(g);try{var T=C.objectStore(v._dbInfo.storeName),x=T.clear();C.oncomplete=function(){_()},C.onabort=C.onerror=function(){var k=x.error?x.error:x.transaction.error;y(k)}}catch(k){y(k)}})}).catch(y)});return p(f,u),f}function Pf(u){var v=this,f=new h(function(_,y){v.ready().then(function(){ht(v._dbInfo,M,function(g,C){if(g)return y(g);try{var T=C.objectStore(v._dbInfo.storeName),x=T.count();x.onsuccess=function(){_(x.result)},x.onerror=function(){y(x.error)}}catch(k){y(k)}})}).catch(y)});return p(f,u),f}function Lf(u,v){var f=this,_=new h(function(y,g){if(u<0){y(null);return}f.ready().then(function(){ht(f._dbInfo,M,function(C,T){if(C)return g(C);try{var x=T.objectStore(f._dbInfo.storeName),k=!1,N=x.openKeyCursor();N.onsuccess=function(){var G=N.result;if(!G){y(null);return}u===0||k?y(G.key):(k=!0,G.advance(u))},N.onerror=function(){g(N.error)}}catch(G){g(G)}})}).catch(g)});return p(_,v),_}function Uf(u){var v=this,f=new h(function(_,y){v.ready().then(function(){ht(v._dbInfo,M,function(g,C){if(g)return y(g);try{var T=C.objectStore(v._dbInfo.storeName),x=T.openKeyCursor(),k=[];x.onsuccess=function(){var N=x.result;if(!N){_(k);return}k.push(N.key),N.continue()},x.onerror=function(){y(x.error)}}catch(N){y(N)}})}).catch(y)});return p(f,u),f}function Bf(u,v){v=I.apply(this,arguments);var f=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||f.name,u.storeName=u.storeName||f.storeName);var _=this,y;if(!u.name)y=h.reject("Invalid arguments");else{var g=u.name===f.name&&_._dbInfo.db,C=g?h.resolve(_._dbInfo.db):Q(u).then(function(T){var x=O[u.name],k=x.forages;x.db=T;for(var N=0;N<k.length;N++)k[N]._dbInfo.db=T;return T});u.storeName?y=C.then(function(T){if(T.objectStoreNames.contains(u.storeName)){var x=T.version+1;U(u);var k=O[u.name],N=k.forages;T.close();for(var G=0;G<N.length;G++){var W=N[G];W._dbInfo.db=null,W._dbInfo.version=x}var re=new h(function(ne,ve){var pe=c.open(u.name,x);pe.onerror=function(ze){var Or=pe.result;Or.close(),ve(ze)},pe.onupgradeneeded=function(){var ze=pe.result;ze.deleteObjectStore(u.storeName)},pe.onsuccess=function(){var ze=pe.result;ze.close(),ne(ze)}});return re.then(function(ne){k.db=ne;for(var ve=0;ve<N.length;ve++){var pe=N[ve];pe._dbInfo.db=ne,J(pe._dbInfo)}}).catch(function(ne){throw(j(u,ne)||h.resolve()).catch(function(){}),ne})}}):y=C.then(function(T){U(u);var x=O[u.name],k=x.forages;T.close();for(var N=0;N<k.length;N++){var G=k[N];G._dbInfo.db=null}var W=new h(function(re,ne){var ve=c.deleteDatabase(u.name);ve.onerror=function(){var pe=ve.result;pe&&pe.close(),ne(ve.error)},ve.onblocked=function(){console.warn('dropInstance blocked for database "'+u.name+'" until all open connections are closed')},ve.onsuccess=function(){var pe=ve.result;pe&&pe.close(),re(pe)}});return W.then(function(re){x.db=re;for(var ne=0;ne<k.length;ne++){var ve=k[ne];J(ve._dbInfo)}}).catch(function(re){throw(j(u,re)||h.resolve()).catch(function(){}),re})})}return p(y,v),y}var Mf={_driver:"asyncStorage",_initStorage:Of,_support:m(),iterate:xf,getItem:Tf,setItem:kf,removeItem:Df,clear:Nf,length:Pf,key:Lf,keys:Uf,dropInstance:Bf};function Gf(){return typeof openDatabase=="function"}var xt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jf="~~local_forage_type~",el=/^~~local_forage_type~([^~]+)~/,bn="__lfsc__:",so=bn.length,lo="arbf",co="blob",tl="si08",rl="ui08",nl="uic8",il="si16",ol="si32",al="ur16",sl="ui32",ll="fl32",cl="fl64",dl=so+lo.length,ul=Object.prototype.toString;function fl(u){var v=u.length*.75,f=u.length,_,y=0,g,C,T,x;u[u.length-1]==="="&&(v--,u[u.length-2]==="="&&v--);var k=new ArrayBuffer(v),N=new Uint8Array(k);for(_=0;_<f;_+=4)g=xt.indexOf(u[_]),C=xt.indexOf(u[_+1]),T=xt.indexOf(u[_+2]),x=xt.indexOf(u[_+3]),N[y++]=g<<2|C>>4,N[y++]=(C&15)<<4|T>>2,N[y++]=(T&3)<<6|x&63;return k}function uo(u){var v=new Uint8Array(u),f="",_;for(_=0;_<v.length;_+=3)f+=xt[v[_]>>2],f+=xt[(v[_]&3)<<4|v[_+1]>>4],f+=xt[(v[_+1]&15)<<2|v[_+2]>>6],f+=xt[v[_+2]&63];return v.length%3===2?f=f.substring(0,f.length-1)+"=":v.length%3===1&&(f=f.substring(0,f.length-2)+"=="),f}function Ff(u,v){var f="";if(u&&(f=ul.call(u)),u&&(f==="[object ArrayBuffer]"||u.buffer&&ul.call(u.buffer)==="[object ArrayBuffer]")){var _,y=bn;u instanceof ArrayBuffer?(_=u,y+=lo):(_=u.buffer,f==="[object Int8Array]"?y+=tl:f==="[object Uint8Array]"?y+=rl:f==="[object Uint8ClampedArray]"?y+=nl:f==="[object Int16Array]"?y+=il:f==="[object Uint16Array]"?y+=al:f==="[object Int32Array]"?y+=ol:f==="[object Uint32Array]"?y+=sl:f==="[object Float32Array]"?y+=ll:f==="[object Float64Array]"?y+=cl:v(new Error("Failed to get type for BinaryArray"))),v(y+uo(_))}else if(f==="[object Blob]"){var g=new FileReader;g.onload=function(){var C=Jf+u.type+"~"+uo(this.result);v(bn+co+C)},g.readAsArrayBuffer(u)}else try{v(JSON.stringify(u))}catch(C){console.error("Couldn't convert value into a JSON string: ",u),v(null,C)}}function jf(u){if(u.substring(0,so)!==bn)return JSON.parse(u);var v=u.substring(dl),f=u.substring(so,dl),_;if(f===co&&el.test(v)){var y=v.match(el);_=y[1],v=v.substring(y[0].length)}var g=fl(v);switch(f){case lo:return g;case co:return d([g],{type:_});case tl:return new Int8Array(g);case rl:return new Uint8Array(g);case nl:return new Uint8ClampedArray(g);case il:return new Int16Array(g);case al:return new Uint16Array(g);case ol:return new Int32Array(g);case sl:return new Uint32Array(g);case ll:return new Float32Array(g);case cl:return new Float64Array(g);default:throw new Error("Unkown type: "+f)}}var fo={serialize:Ff,deserialize:jf,stringToBuffer:fl,bufferToString:uo};function hl(u,v,f,_){u.executeSql("CREATE TABLE IF NOT EXISTS "+v.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,_)}function qf(u){var v=this,f={db:null};if(u)for(var _ in u)f[_]=typeof u[_]!="string"?u[_].toString():u[_];var y=new h(function(g,C){try{f.db=openDatabase(f.name,String(f.version),f.description,f.size)}catch(T){return C(T)}f.db.transaction(function(T){hl(T,f,function(){v._dbInfo=f,g()},function(x,k){C(k)})},C)});return f.serializer=fo,y}function kt(u,v,f,_,y,g){u.executeSql(f,_,y,function(C,T){T.code===T.SYNTAX_ERR?C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[v.storeName],function(x,k){k.rows.length?g(x,T):hl(x,v,function(){x.executeSql(f,_,y,g)},g)},g):g(C,T)},g)}function Hf(u,v){var f=this;u=E(u);var _=new h(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(T){kt(T,C,"SELECT * FROM "+C.storeName+" WHERE key = ? LIMIT 1",[u],function(x,k){var N=k.rows.length?k.rows.item(0).value:null;N&&(N=C.serializer.deserialize(N)),y(N)},function(x,k){g(k)})})}).catch(g)});return p(_,v),_}function Vf(u,v){var f=this,_=new h(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(T){kt(T,C,"SELECT * FROM "+C.storeName,[],function(x,k){for(var N=k.rows,G=N.length,W=0;W<G;W++){var re=N.item(W),ne=re.value;if(ne&&(ne=C.serializer.deserialize(ne)),ne=u(ne,re.key,W+1),ne!==void 0){y(ne);return}}y()},function(x,k){g(k)})})}).catch(g)});return p(_,v),_}function pl(u,v,f,_){var y=this;u=E(u);var g=new h(function(C,T){y.ready().then(function(){v===void 0&&(v=null);var x=v,k=y._dbInfo;k.serializer.serialize(v,function(N,G){G?T(G):k.db.transaction(function(W){kt(W,k,"INSERT OR REPLACE INTO "+k.storeName+" (key, value) VALUES (?, ?)",[u,N],function(){C(x)},function(re,ne){T(ne)})},function(W){if(W.code===W.QUOTA_ERR){if(_>0){C(pl.apply(y,[u,x,f,_-1]));return}T(W)}})})}).catch(T)});return p(g,f),g}function Kf(u,v,f){return pl.apply(this,[u,v,f,1])}function $f(u,v){var f=this;u=E(u);var _=new h(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(T){kt(T,C,"DELETE FROM "+C.storeName+" WHERE key = ?",[u],function(){y()},function(x,k){g(k)})})}).catch(g)});return p(_,v),_}function Wf(u){var v=this,f=new h(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){kt(C,g,"DELETE FROM "+g.storeName,[],function(){_()},function(T,x){y(x)})})}).catch(y)});return p(f,u),f}function zf(u){var v=this,f=new h(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){kt(C,g,"SELECT COUNT(key) as c FROM "+g.storeName,[],function(T,x){var k=x.rows.item(0).c;_(k)},function(T,x){y(x)})})}).catch(y)});return p(f,u),f}function Yf(u,v){var f=this,_=new h(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(T){kt(T,C,"SELECT key FROM "+C.storeName+" WHERE id = ? LIMIT 1",[u+1],function(x,k){var N=k.rows.length?k.rows.item(0).key:null;y(N)},function(x,k){g(k)})})}).catch(g)});return p(_,v),_}function Xf(u){var v=this,f=new h(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){kt(C,g,"SELECT key FROM "+g.storeName,[],function(T,x){for(var k=[],N=0;N<x.rows.length;N++)k.push(x.rows.item(N).key);_(k)},function(T,x){y(x)})})}).catch(y)});return p(f,u),f}function Qf(u){return new h(function(v,f){u.transaction(function(_){_.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,g){for(var C=[],T=0;T<g.rows.length;T++)C.push(g.rows.item(T).name);v({db:u,storeNames:C})},function(y,g){f(g)})},function(_){f(_)})})}function Zf(u,v){v=I.apply(this,arguments);var f=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||f.name,u.storeName=u.storeName||f.storeName);var _=this,y;return u.name?y=new h(function(g){var C;u.name===f.name?C=_._dbInfo.db:C=openDatabase(u.name,"","",0),u.storeName?g({db:C,storeNames:[u.storeName]}):g(Qf(C))}).then(function(g){return new h(function(C,T){g.db.transaction(function(x){function k(re){return new h(function(ne,ve){x.executeSql("DROP TABLE IF EXISTS "+re,[],function(){ne()},function(pe,ze){ve(ze)})})}for(var N=[],G=0,W=g.storeNames.length;G<W;G++)N.push(k(g.storeNames[G]));h.all(N).then(function(){C()}).catch(function(re){T(re)})},function(x){T(x)})})}):y=h.reject("Invalid arguments"),p(y,v),y}var eh={_driver:"webSQLStorage",_initStorage:qf,_support:Gf(),iterate:Vf,getItem:Hf,setItem:Kf,removeItem:$f,clear:Wf,length:zf,key:Yf,keys:Xf,dropInstance:Zf};function th(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(u){return!1}}function ml(u,v){var f=u.name+"/";return u.storeName!==v.storeName&&(f+=u.storeName+"/"),f}function rh(){var u="_localforage_support_test";try{return localStorage.setItem(u,!0),localStorage.removeItem(u),!1}catch(v){return!0}}function nh(){return!rh()||localStorage.length>0}function ih(u){var v=this,f={};if(u)for(var _ in u)f[_]=u[_];return f.keyPrefix=ml(u,v._defaultConfig),nh()?(v._dbInfo=f,f.serializer=fo,h.resolve()):h.reject()}function oh(u){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo.keyPrefix,y=localStorage.length-1;y>=0;y--){var g=localStorage.key(y);g.indexOf(_)===0&&localStorage.removeItem(g)}});return p(f,u),f}function ah(u,v){var f=this;u=E(u);var _=f.ready().then(function(){var y=f._dbInfo,g=localStorage.getItem(y.keyPrefix+u);return g&&(g=y.serializer.deserialize(g)),g});return p(_,v),_}function sh(u,v){var f=this,_=f.ready().then(function(){for(var y=f._dbInfo,g=y.keyPrefix,C=g.length,T=localStorage.length,x=1,k=0;k<T;k++){var N=localStorage.key(k);if(N.indexOf(g)===0){var G=localStorage.getItem(N);if(G&&(G=y.serializer.deserialize(G)),G=u(G,N.substring(C),x++),G!==void 0)return G}}});return p(_,v),_}function lh(u,v){var f=this,_=f.ready().then(function(){var y=f._dbInfo,g;try{g=localStorage.key(u)}catch(C){g=null}return g&&(g=g.substring(y.keyPrefix.length)),g});return p(_,v),_}function ch(u){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo,y=localStorage.length,g=[],C=0;C<y;C++){var T=localStorage.key(C);T.indexOf(_.keyPrefix)===0&&g.push(T.substring(_.keyPrefix.length))}return g});return p(f,u),f}function dh(u){var v=this,f=v.keys().then(function(_){return _.length});return p(f,u),f}function uh(u,v){var f=this;u=E(u);var _=f.ready().then(function(){var y=f._dbInfo;localStorage.removeItem(y.keyPrefix+u)});return p(_,v),_}function fh(u,v,f){var _=this;u=E(u);var y=_.ready().then(function(){v===void 0&&(v=null);var g=v;return new h(function(C,T){var x=_._dbInfo;x.serializer.serialize(v,function(k,N){if(N)T(N);else try{localStorage.setItem(x.keyPrefix+u,k),C(g)}catch(G){(G.name==="QuotaExceededError"||G.name==="NS_ERROR_DOM_QUOTA_REACHED")&&T(G),T(G)}})})});return p(y,f),y}function hh(u,v){if(v=I.apply(this,arguments),u=typeof u!="function"&&u||{},!u.name){var f=this.config();u.name=u.name||f.name,u.storeName=u.storeName||f.storeName}var _=this,y;return u.name?y=new h(function(g){u.storeName?g(ml(u,_._defaultConfig)):g(u.name+"/")}).then(function(g){for(var C=localStorage.length-1;C>=0;C--){var T=localStorage.key(C);T.indexOf(g)===0&&localStorage.removeItem(T)}}):y=h.reject("Invalid arguments"),p(y,v),y}var ph={_driver:"localStorageWrapper",_initStorage:ih,_support:th(),iterate:sh,getItem:ah,setItem:fh,removeItem:uh,clear:oh,length:dh,key:lh,keys:ch,dropInstance:hh},mh=function(v,f){return v===f||typeof v=="number"&&typeof f=="number"&&isNaN(v)&&isNaN(f)},vh=function(v,f){for(var _=v.length,y=0;y<_;){if(mh(v[y],f))return!0;y++}return!1},vl=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"},Rr={},gl={},Zt={INDEXEDDB:Mf,WEBSQL:eh,LOCALSTORAGE:ph},gh=[Zt.INDEXEDDB._driver,Zt.WEBSQL._driver,Zt.LOCALSTORAGE._driver],wn=["dropInstance"],ho=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(wn),_h={description:"",driver:gh.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function yh(u,v){u[v]=function(){var f=arguments;return u.ready().then(function(){return u[v].apply(u,f)})}}function po(){for(var u=1;u<arguments.length;u++){var v=arguments[u];if(v)for(var f in v)v.hasOwnProperty(f)&&(vl(v[f])?arguments[0][f]=v[f].slice():arguments[0][f]=v[f])}return arguments[0]}var bh=function(){function u(v){s(this,u);for(var f in Zt)if(Zt.hasOwnProperty(f)){var _=Zt[f],y=_._driver;this[f]=y,Rr[y]||this.defineDriver(_)}this._defaultConfig=po({},_h),this._config=po({},this._defaultConfig,v),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return u.prototype.config=function(f){if((typeof f=="undefined"?"undefined":a(f))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var _ in f){if(_==="storeName"&&(f[_]=f[_].replace(/\W/g,"_")),_==="version"&&typeof f[_]!="number")return new Error("Database version must be a number.");this._config[_]=f[_]}return"driver"in f&&f.driver?this.setDriver(this._config.driver):!0}else return typeof f=="string"?this._config[f]:this._config},u.prototype.defineDriver=function(f,_,y){var g=new h(function(C,T){try{var x=f._driver,k=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver){T(k);return}for(var N=ho.concat("_initStorage"),G=0,W=N.length;G<W;G++){var re=N[G],ne=!vh(wn,re);if((ne||f[re])&&typeof f[re]!="function"){T(k);return}}var ve=function(){for(var Or=function(Eh){return function(){var Ih=new Error("Method "+Eh+" is not implemented by the current driver"),_l=h.reject(Ih);return p(_l,arguments[arguments.length-1]),_l}},mo=0,Ah=wn.length;mo<Ah;mo++){var vo=wn[mo];f[vo]||(f[vo]=Or(vo))}};ve();var pe=function(Or){Rr[x]&&console.info("Redefining LocalForage driver: "+x),Rr[x]=f,gl[x]=Or,C()};"_support"in f?f._support&&typeof f._support=="function"?f._support().then(pe,T):pe(!!f._support):pe(!0)}catch(ze){T(ze)}});return b(g,_,y),g},u.prototype.driver=function(){return this._driver||null},u.prototype.getDriver=function(f,_,y){var g=Rr[f]?h.resolve(Rr[f]):h.reject(new Error("Driver not found."));return b(g,_,y),g},u.prototype.getSerializer=function(f){var _=h.resolve(fo);return b(_,f),_},u.prototype.ready=function(f){var _=this,y=_._driverSet.then(function(){return _._ready===null&&(_._ready=_._initDriver()),_._ready});return b(y,f,f),y},u.prototype.setDriver=function(f,_,y){var g=this;vl(f)||(f=[f]);var C=this._getSupportedDrivers(f);function T(){g._config.driver=g.driver()}function x(G){return g._extend(G),T(),g._ready=g._initStorage(g._config),g._ready}function k(G){return function(){var W=0;function re(){for(;W<G.length;){var ne=G[W];return W++,g._dbInfo=null,g._ready=null,g.getDriver(ne).then(x).catch(re)}T();var ve=new Error("No available storage method found.");return g._driverSet=h.reject(ve),g._driverSet}return re()}}var N=this._driverSet!==null?this._driverSet.catch(function(){return h.resolve()}):h.resolve();return this._driverSet=N.then(function(){var G=C[0];return g._dbInfo=null,g._ready=null,g.getDriver(G).then(function(W){g._driver=W._driver,T(),g._wrapLibraryMethodsWithReady(),g._initDriver=k(C)})}).catch(function(){T();var G=new Error("No available storage method found.");return g._driverSet=h.reject(G),g._driverSet}),b(this._driverSet,_,y),this._driverSet},u.prototype.supports=function(f){return!!gl[f]},u.prototype._extend=function(f){po(this,f)},u.prototype._getSupportedDrivers=function(f){for(var _=[],y=0,g=f.length;y<g;y++){var C=f[y];this.supports(C)&&_.push(C)}return _},u.prototype._wrapLibraryMethodsWithReady=function(){for(var f=0,_=ho.length;f<_;f++)yh(this,ho[f])},u.prototype.createInstance=function(f){return new u(f)},u}(),wh=new bh;i.exports=wh},{3:3}]},{},[4])(4)})});var Cc=yo(or=>{"use strict";$();Pr();vt();var Ur=(e,t)=>{let r=window.parent;r&&r!==window&&typeof r.postMessage=="function"&&r.postMessage({type:e,data:t},"*")},Br=Re(),Hp=et("levelFinished",{paramsSchema:q.tuple(q.object({levelId:q.or(q.string(),q.number()),duration:q.number().optional(),rating:q.number().optional(),score:q.number().optional(),variation:q.string().optional()})),implement:e=>A(or,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e;Me.info("onLevelFinished",r,n,i,o),Ur("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:t,duration:r,rating:n,score:i,variation:o}),yield Promise.all([Ze.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}}),Ze.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})])})}),Vp=et("gamePlayEnded",{paramsSchema:q.tuple(q.object({duration:q.number().optional(),rating:q.number().optional(),score:q.number(),variation:q.string().optional()})),implement:e=>A(or,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e;Me.info("onGamePlayEnded",t,r,n,i),Ur("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:t,rating:r,score:n,variation:i}),yield Promise.all([Ze.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i}),Ze.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})])})}),Kp=et("levelUpgrade",{paramsSchema:q.tuple(q.object({levelId:q.or(q.string(),q.number()),name:q.string().optional()})),implement:r=>A(or,[r],function*({levelId:e,name:t}){Me.info("onLevelUpgrade",e,t),Ur("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:e,name:t}),yield Promise.all([Ze.tracker("LevelUpgrade",{name:t,levelId:e}),Ze.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})])})}),$p=et("levelStart",{paramsSchema:q.tuple(q.object({levelId:q.or(q.string(),q.number())})),implement:e=>A(or,null,function*(){let{levelId:t}=e;Me.info("onLevelStart",t),Ur("JOLIBOX_GAME_TASK_LEVEL_START",{levelId:t}),yield Ze.tracker("LevelStart",{levelId:t})})}),Wp=et("levelFailed",{paramsSchema:q.tuple(q.object({levelId:q.or(q.string(),q.number()),score:q.number().optional(),rating:q.number().optional(),duration:q.number().optional()})),implement:e=>A(or,null,function*(){let{levelId:t,score:r,rating:n,duration:i}=e;Me.info("onLevelFailed",t,r,n,i),Ur("JOLIBOX_GAME_TASK_LEVEL_FAILED",{levelId:t,score:r,rating:n,duration:i}),yield Ze.tracker("LevelFailed",{levelId:t,score:r,rating:n,duration:i})})});Br.registerCommand("TaskTrackerSDK.levelFinished",Hp);Br.registerCommand("TaskTrackerSDK.gamePlayEnded",Vp);Br.registerCommand("TaskTrackerSDK.levelUpgrade",Kp);Br.registerCommand("TaskTrackerSDK.levelStart",$p);Br.registerCommand("TaskTrackerSDK.levelFailed",Wp);Ie("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"}}});Ie("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});Ie("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});Ie("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});Ie("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 Je,ar,Rc,ca,zp,Vt,Mr=ie(()=>{"use strict";Je=(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}},"*")},ar=new Map,Rc=e=>{if(e.source===window.parent)try{let t=e.data;if(t&&t.type){let r=ar.get(t.type);r&&r.forEach(n=>{try{n(t.data)}catch(i){console.warn("Callback execution failed:",i)}})}}catch(t){console.warn("Failed to parse message:",t)}},ca=!1,zp=()=>{ca||(window.addEventListener("message",Rc),ca=!0)},Vt=(e,t)=>{zp(),ar.has(e)||ar.set(e,new Set);let r=ar.get(e);return r.add(t),()=>{r.delete(t),r.size===0&&ar.delete(e),ar.size===0&&(window.removeEventListener("message",Rc),ca=!1)}}});var ti,ri,ni,ii,oi,da,ai,si,li,ci,sr,Yp,oe,_t,yt,Fe=ie(()=>{"use strict";$();ti="UNLOCK_OPTIONS_CHANGED",ri="INVOKE_PAYMENT",ni="ON_PAYMENT_RESULT",ii="ON_USE_MODAL_EVENT",oi="ON_USE_MODAL_RESULT",da="ON_USE_MODAL_FREQUENCY",ai="ON_USE_UNLOGIN_MODAL_EVENT",si="INVOKE_UNLOGIN_MODAL_EVENT",li="INVOKE_SUBSCRIPTION_EVENT",ci="ON_USE_SUBSCRIPTION_RESULT",sr=new nt,Yp=()=>({on:sr.on.bind(sr),off:sr.off.bind(sr),emit:sr.emit.bind(sr)}),oe=Yp(),_t={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},yt={show:!0,minInterval:8*60*60*1e3}});var lf=yo(to=>{"use strict";ge();Fe();Mr();$();var sf={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};Vt("ON_JOLIBOX_JOLI_COIN_USE_RESULT",e=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",sf[e.result],e.result),oe.emit(oi,{useModalResult:sf[e.result]})});oe.on(ii,(e,t)=>{var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Je("JOLIBOX_JOLI_COIN_USE_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:Xe()})});Vt("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",e=>{oe.emit(ni,{paymentResult:e.result=="ADS"?"FAILED":e.result,userJoliCoin:e.joliCoin,currency:"JOLI_COIN"})});oe.on(ri,(e,t)=>A(to,null,function*(){var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Je("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:Xe()})}));Vt("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",e=>{var t,r,n,i,o;oe.emit(ai,{result:e.result=="ADS"?"FAILED":e.result,rewards:{claimedRewardValue:(i=(n=(r=(t=e.extra)==null?void 0:t.firstLogin)==null?void 0:r.reward)==null?void 0:n.rewardValue)!=null?i:0,isFirstLogin:(o=e.isFirstLogin)!=null?o:!1}}),e.result==="SUCCESS"&&B.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});oe.on(si,e=>A(to,null,function*(){e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Je("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:Xe(),type:e})}));Vt("ON_JOLIBOX_SUB_RESULT_EVENT",e=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",e),oe.emit(ci,{result:e.result})});oe.on(li,e=>A(to,null,function*(){console.log("----notify custom event-----",e),Je("JOLIBOX_SUB_EVENT",{sequenceId:Xe()})}))});vt();ge();Pr();$();var wc=Re(),Op="env",Tp="getSystemInfoSync",xp=()=>{var i,o,a,s;let e={system:B.deviceInfo.system,platform:B.deviceInfo.platform.toLowerCase(),brand:B.deviceInfo.brand,pixelRatio:B.deviceInfo.pixelRatio,language:B.deviceInfo.lang,version:B.sdkInfo.jssdkVersion,appName:(i=B.hostInfo)==null?void 0:i.appName,SDKVersion:B.sdkInfo.nativeSDKVersion},t=(o=B.hostInfo)==null?void 0:o.version;t&&(e=Ue(Y({},e),{version:t}));let r=(a=B.hostInfo)==null?void 0:a.appName;r&&(e=Ue(Y({},e),{appName:r}));let n=(s=B.sdkInfo)==null?void 0:s.jssdkVersion;return n&&(e=Ue(Y({},e),{SDKVersion:n})),e},kp=Ht(Tp,{implement:xp}),Dp=Ht(Op,{implement:()=>Ue(Y({},B.hostInfo),{sdkInfo:B.sdkInfo,platform:B.platform,deviceInfo:B.deviceInfo})});wc.registerCommand("API.env",Dp);wc.registerCommand("API.getSystemInfoSync",kp);Ie("env",{version:"1.0.0"});Ie("getSystemInfoSync",{version:"1.0.0"});$();Pr();pt();vt();var Np="onJoliboxShow",Pp="onJoliboxHide",Lp="onReady",oa=Re(),aa=Ml(Ve),ia=!0,Lr=!0,Xn=0,Qn=Xo;function Up(){let e=Date.now();if(e-Xn<100)return;Xn=e;let t=document.visibilityState==="visible";t!==ia&&(ia=t,Qn.emit("visible",ia))}function Ac(e){let t=Date.now();t-Xn<100||(Xn=t,e==="focus"&&!Lr?Lr=!0:e==="blur"&&Lr&&(Lr=!1),Qn.emit("visible",Lr))}document.addEventListener("visibilitychange",Up);window.addEventListener("focus",()=>Ac("focus"));window.addEventListener("blur",()=>Ac("blur"));var Bp=Ht(Np,{paramsSchema:q.tuple(q.function()),implement(e){let t=aa(e);Qn.on("visible",r=>{r&&t()})}}),Mp=Ht(Pp,{paramsSchema:q.tuple(q.function()),implement(e){let t=aa(e);Qn.on("visible",r=>{!r&&t()})}}),Gp=Ht(Lp,{paramsSchema:q.tuple(q.function()),implement(e){let t=aa(e);Dt.on("LifecycleEvent.onReady",r=>{t(r)})}});oa.registerCommand("LifecycleSDK.onReady",Gp);oa.registerCommand("LifecycleSDK.onJoliboxShow",Bp);oa.registerCommand("LifecycleSDK.onJoliboxHide",Mp);Ie("lifeCycle.onReady",{version:"1.0.0"});Ie("lifeCycle.onJoliboxShow",{version:"1.0.0"});Ie("lifeCycle.onJoliboxHide",{version:"1.0.0"});Pr();$();nr();ge();var Sc=bo(Ic());var Zn=Re(),la=class{constructor(){this.httpClient=Qe.create({baseUrl:rr(B.testMode)});this.getGameId=()=>B.mpId;this.getItem=t=>A(this,null,function*(){let{code:r,data:n,message:i}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),o=n==null?void 0:n.value,a=i;return r!=="SUCCESS"&&(o=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",o),a+="fallback to localstorage"),{code:r,message:a,data:o&&o!=="undefined"?o:null}});this.setItem=(t,r)=>A(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:i,message:o}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:i,message:o}});this.removeItem=t=>A(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>A(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=Sc.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},ei=new la,Jp=et("getLocalStorage",{paramsSchema:q.tuple(q.string()),implement(e){return A(this,null,function*(){return yield ei.getItem(e)})}});Zn.registerCommand("StorageSDK.getItem",Jp);Ie("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Fp=et("setStorage",{paramsSchema:q.tuple(q.string(),q.or(q.string(),q.boolean(),q.number())),implement(e,t){return A(this,null,function*(){return yield ei.setItem(e,t)})}});Zn.registerCommand("StorageSDK.setItem",Fp);Ie("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var jp=et("removeStorage",{paramsSchema:q.tuple(q.string()),implement(e){return A(this,null,function*(){return yield ei.removeItem(e)})}});Zn.registerCommand("StorageSDK.removeItem",jp);Ie("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var qp=et("clearStorage",{implement(){return A(this,null,function*(){return yield ei.clear()})}});Zn.registerCommand("StorageSDK.clear",qp);Ie("storage.clear",{version:"1.0.0"});var MR=bo(Cc());vt();$();nr();Mr();ge();Fe();var Oc=B.testMode;function Tc(){let e=new Map,t,r;return{registerRewardHandler(i,o){e.set(i,o)},handleReward(i,...o){return A(this,null,function*(){return yield i.reduce((s,l)=>A(this,null,function*(){let c=yield s;if(c===!0)return!0;Oc&&console.log(`handleReward ${l}`);let m=e.get(l),d=m?yield m(...o):c;return Oc&&console.log(`handleReward ${l} ${d}`),d}),Promise.resolve(!1))})},registerRewardsFetcher(i){return A(this,null,function*(){t=(...o)=>A(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return A(this,null,function*(){r=(...o)=>A(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),{joliCoinUseAndCharge:_t,loginGuide:yt}}})})},getRewardsTypes(...i){return A(this,null,function*(){return t?yield t(...i):["ADS"]})},getRewardFrequencyConfig(...i){return A(this,null,function*(){return r?yield r(...i):{joliCoinUseAndCharge:_t,loginGuide:yt}})}}}$();var ua=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"POST",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){var r,n,i;return{unlockOptions:((r=t.data)==null?void 0:r.unlockOptions)||[],joliCoin:((n=t.extra)==null?void 0:n.joliCoin)||{balance:0,enableAutoDeduct:!1},joliGem:((i=t.extra)==null?void 0:i.joliGem)||{balance:0,enableAutoDeduct:!1}}}mergeData(t,r){return{code:"SUCCESS",message:"success",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin||{balance:0,enableAutoDeduct:!1},joliGem:t.joliGem||{balance:0,enableAutoDeduct:!1}}}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin,joliGem:t.joliGem}}}},fa=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){let r=t.data;return Y({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},di=class{constructor(t){this.unlockOptionsService=new jt(new ua(t),{duration:30*60*1e3,timeout:1e3,keyGenerator:r=>r,consistencyChecker:(r,n)=>r.unlockOptions.length!==n.unlockOptions.length?!1:r.unlockOptions.every((i,o)=>{var s,l;let a=n.unlockOptions[o];return i.type===a.type&&((s=i.joliGemChoice)==null?void 0:s.joliGemQuantity)===((l=a.joliGemChoice)==null?void 0:l.joliGemQuantity)})}),this.globalConfigService=new jt(new fa(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return A(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return A(this,null,function*(){return yield this.globalConfigService.request("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}refreshUnlockOptions(){return A(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return A(this,null,function*(){return yield this.globalConfigService.forceRequest("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}warmupCache(){return A(this,null,function*(){yield Promise.all([this.unlockOptionsService.warmupCache("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",method:"POST"}),this.globalConfigService.warmupCache("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})])})}clearAllCache(){this.unlockOptionsService.clearCache(),this.globalConfigService.clearCache()}getCacheStats(){return{unlockOptions:this.unlockOptionsService.getCacheStats(),globalConfig:this.globalConfigService.getCacheStats()}}clearExpiredCache(){this.unlockOptionsService.clearExpiredCache(),this.globalConfigService.clearExpiredCache()}};Fe();$();var Xp=()=>(e,t)=>{let r={SUBSCRIPTION:4,JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return r[t]-r[e]},Qp=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],Zp=e=>{if(!e.length)return["ADS"];if(e.includes("JOLI_GEM")){if(e.length===1)return["JOLI_GEM_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_GEM_ONLY"]}if(e.includes("JOLI_COIN")){if(e.length===1)return["JOLI_COIN_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_COIN_ONLY"]}return e.sort(Xp())},ha=null;function pa(e){return ha||(ha=new di(e)),ha}var ma=e=>{e.registerRewardsFetcher(t=>A(void 0,null,function*(){var i,o,a,s,l;let r=["ADS"],n=pa(t);try{let c=yield n.getUnlockOptions({});if(c.code!=="SUCCESS")return r;oe.emit(ti,{options:((i=c.data)==null?void 0:i.unlockOptions)||[],userJoliCoin:((o=c.extra)==null?void 0:o.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((a=c.extra)==null?void 0:a.joliGem)||{balance:0,enableAutoDeduct:!1}});let m=((l=(s=c.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(d=>d.type))||Array.from(r);return Zp(m)}catch(c){return console.error("getRewardOptions error (cached):",c),r}}))},va=e=>{e.registerRewardFrequencyConfigFetcher(t=>A(void 0,null,function*(){var n,i,o,a;let r=pa(t);try{let s=yield r.getGlobalConfig();return oe.emit(da,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||_t,loginGuide:((i=s.data)==null?void 0:i.loginGuide)||yt}),s.data&&Dt.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((o=s.data)==null?void 0:o.joliCoinUseAndCharge)||_t,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||yt}}catch(s){return console.error("getGlobalConfig error (cached):",s),oe.emit(da,{joliCoinUseAndCharge:_t,loginGuide:yt}),Dt.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:_t,loginGuide:yt,supportedHostMethods:Qp}}),{joliCoinUseAndCharge:_t,loginGuide:yt}}}))};var ga=e=>A(void 0,null,function*(){yield pa(e).warmupCache(),console.log("Reward cache warmed up")});var xc=e=>t=>A(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",t),yield e.adBreak(t)}catch(r){console.error("-----createAdsRewardHandler error-----",r)}return!0});Fe();function it(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=Y(Y({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}Fe();var Oe=it(oe,ti),Gr=(e,t)=>{var n;let r=(n=e.options)==null?void 0:n.some(i=>i.type==="SUBSCRIPTION");return console.log("typeof extraCheck",typeof t,t==null?void 0:t()),r&&(!t||(t==null?void 0:t()))};ge();$();var _a={JOLI_COIN:{balanceEndpoint:"/api/joli-coin/balance",balanceDetailEndpoint:"/api/joli-coin/balance-detail",unlockEndpoint:"/api/joli-coin/unlock",unlockType:"JOLI_COIN"},GEM:{balanceEndpoint:"/api/joli-gem/balance",balanceDetailEndpoint:"/api/joli-gem/balance-detail",unlockEndpoint:"/api/joli-gem/unlock",unlockType:"GEM"}};$();var Ye=Re();Fe();Fe();$();var ba=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},wa=class{constructor(t){this.balanceService=new jt(new ba(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getBalance(t="JOLI_COIN"){return A(this,null,function*(){return(yield this.balanceService.request("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}refreshBalance(t="JOLI_COIN"){return A(this,null,function*(){return(yield this.balanceService.forceRequest("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}warmupBalance(t="JOLI_COIN"){return A(this,null,function*(){yield this.balanceService.warmupCache("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})})}clearBalanceCache(){this.balanceService.clearCache()}getBalanceCacheStats(){return this.balanceService.getCacheStats()}clearExpiredCache(){this.balanceService.clearExpiredCache()}},ya=null;function Aa(e){return ya||(ya=new wa(e)),ya}var Ea=(e,t="JOLI_COIN")=>A(void 0,null,function*(){return yield Aa(e).getBalance(t)}),Kt=(e,t="JOLI_COIN")=>A(void 0,null,function*(){let n=yield Aa(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n}),ui=(e,t="JOLI_COIN")=>A(void 0,null,function*(){yield Aa(e).warmupBalance(t),console.log(`Balance cache warmed up for type: ${t}`)});$();var Sa=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Ca=class{constructor(t){this.gemBalanceService=new jt(new Sa(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getGemBalance(t="GEM"){return A(this,null,function*(){return(yield this.gemBalanceService.request("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}refreshGemBalance(t="GEM"){return A(this,null,function*(){return(yield this.gemBalanceService.forceRequest("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}warmupGemBalance(t="GEM"){return A(this,null,function*(){yield this.gemBalanceService.warmupCache("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})})}clearGemBalanceCache(){this.gemBalanceService.clearCache()}getGemBalanceCacheStats(){return this.gemBalanceService.getCacheStats()}clearExpiredCache(){this.gemBalanceService.clearExpiredCache()}},Ia=null;function kc(e){return Ia||(Ia=new Ca(e)),Ia}var Ra=(e,t="GEM")=>A(void 0,null,function*(){return yield kc(e).getGemBalance(t)}),lr=(e,t="GEM")=>A(void 0,null,function*(){let n=yield kc(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n});var ot={JOLI_COIN:{fetchBalance:Ea,getQuantity:e=>{var t,r,n;return(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(i=>i.type==="JOLI_COIN"))==null?void 0:r.joliCoinChoices[0].joliCoinQuantity)!=null?n:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userJoliCoin)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userJoliCoin",isEnough:(e,t)=>{var r,n;return(n=(r=e==null?void 0:e.options)==null?void 0:r.some(i=>i.type==="JOLI_COIN"&&i.joliCoinChoices.some(o=>{var a;return o.joliCoinQuantity<=((a=t==null?void 0:t.balance)!=null?a:0)})))!=null?n:!1}},JOLI_GEM:{fetchBalance:Ra,getQuantity:e=>{var t,r,n,i;return(i=(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(o=>o.type==="JOLI_GEM"))==null?void 0:r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userGem)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userGem",isEnough:(e,t)=>{var n,i,o;let r=e==null?void 0:e.options.find(a=>a.type==="JOLI_GEM");return r?((i=(n=r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0)<=((o=t==null?void 0:t.balance)!=null?o:0):!1}}};var fi=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;Ye.registerCommand(`Rewards.${e}.useJolicoin`,()=>A(void 0,null,function*(){let i=yield Oe.getData(),o=ot[t],a=o.getCurrentUser(i),s=o.getQuantity(i),l=!!(a!=null&&a.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",i,l,s),(yield n({enableAutoDeduct:l,userCurrency:a,quantity:s,currency:t}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},$t=(e,t)=>r=>A(void 0,null,function*(){let n=it(oe,oi);return oe.emit(ii,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult});Fe();Fe();var hi=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;Ye.registerCommand(`Rewards.${e}.usePayment`,()=>A(void 0,null,function*(){var h;let o=yield Oe.getData(),a=ot[t],s=yield a.fetchBalance(n),l=a.getQuantity(o),c=a.getCurrentUser(o),m=a.createUpdatedUser((h=s==null?void 0:s.balance)!=null?h:0,c.enableAutoDeduct),d=a.getUpdateKey();if(Oe.updateData({[d]:m}),console.log("-----unlockOptions payment-----",o,m,l,t),!a.isEnough(o,m)){let p=yield i({userCurrency:m,currencyQuantity:l,currency:t});return t==="JOLI_GEM"?lr(n):Kt(n),{result:p==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},Wt=(e,t)=>r=>A(void 0,null,function*(){let n=it(oe,ni);return oe.emit(ri,e,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).paymentResult});ge();Fe();Fe();$();var zt=(e,t)=>r=>A(void 0,null,function*(){let n=it(oe,ai);return oe.emit(si,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()});var rm=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:o,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:s,showUnloginModal:l,hasSubscription:c}})=>{hi(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:a}),fi(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let m=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return d=>A(void 0,null,function*(){var h,p,b,E;try{let I=yield o.getData();if(Gr(I,c)){let P=ot.JOLI_COIN,M=yield P.fetchBalance(t),S=P.getCurrentUser(I),D=P.createUpdatedUser((h=M==null?void 0:M.balance)!=null?h:0,S.enableAutoDeduct);if(!P.isEnough(I,D))return i==null||i(d),!1}else{let P=!0;for(let M of m){let S=yield Ye.executeCommand(M);if(P=P&&S.result!=="FAILED",S.result!=="CONTINUE")break}if(!P)return i==null||i(d),!1}let R=_a[r],O=yield t.post(R.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${Xe()}-${B.mpType}-${Date.now()}`,gameInfo:{gameId:B.mpId}}});if(console.log("-----unlockWithCurrency request result-----",O),O.code=="SUCCESS"){try{(b=d.adBreakDone)==null||b.call(d,{breakType:d.type,breakName:"name"in d&&(p=d.name)!=null?p:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in d&&((E=d.adViewed)==null||E.call(d)),Kt(t)}catch(P){console.error("-----unlockWithJolicoin adBreakDone error-----",P)}return n==null||n({quantity:O.data.quantity,balance:O.data.balance}),!0}return i==null||i(d),!1}catch(I){if(console.info("JolicoinRewardHandler error:",I),I instanceof Error&&I.message=="CANCEL")throw I;return i==null||i(d),!1}finally{o.clearCache()}})},pi=(e,t,r)=>rm(e,t,"JOLI_COIN",r);var Dc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=$t("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),a=Wt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=zt("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return pi("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Oe,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})};var Nc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=c=>{var m;r==null||r(),(m=c.adBreakDone)==null||m.call(c,{breakType:c.type,breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},o=$t("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),a=Wt("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=zt("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return pi("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:Oe,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})};ge();$();Fe();Fe();var Pc=e=>{let{showSubscriptionModal:t}=e;Ye.registerCommand("Rewards.subscription",()=>A(void 0,null,function*(){var s,l;let r=yield Oe.getData(),n=(l=(s=r==null?void 0:r.options)==null?void 0:s.find(c=>c.type==="JOLI_GEM"))==null?void 0:l.type,i=ot[n?"JOLI_GEM":"JOLI_COIN"],o=i.getCurrentUser(r);return i.isEnough(r,o)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},Lc=e=>()=>A(void 0,null,function*(){let t=it(oe,ci);return oe.emit(li,e),(yield t.getFreshData()).result});ge();var Uc=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:o,hasSubscription:a}})=>{Pc({showSubscriptionModal:o});let s=["Rewards.subscription"];return l=>A(void 0,null,function*(){var c,m,d,h,p,b;try{let E=yield i.getData();if(!Gr(E,a))return!1;let w=!0;for(let R of s){let O=yield Ye.executeCommand(R);if(w=w&&O.result!=="FAILED",O.result!=="CONTINUE")break}if(Kt(t),lr(t),console.log("-----unlockWithSubscription result-----",w),w){try{(m=l.adBreakDone)==null||m.call(l,{breakType:l.type,breakName:"name"in l&&(c=l.name)!=null?c:"",breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in l&&((d=l.adViewed)==null||d.call(l)),(b=(p=B).onEnvConfigChanged)==null||b.call(p,{hostUserInfo:Ue(Y({},(h=B.hostUserInfo)!=null?h:{isLogin:!1}),{isSubUser:!0})})}catch(R){console.error("-----unlockWithSubscription adBreakDone error-----",R)}return r==null||r(),!0}return n==null||n(l),!1}catch(E){if(console.info("SubscriptionRewardHandler error:",E),E instanceof Error&&E.message=="CANCEL")throw E;return n==null||n(l),!1}finally{}})};var Bc=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=Lc("SUBSCRIPTION");return Uc("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:Oe,showSubscriptionModal:o,hasSubscription:n}})};var at=Tc();ma(at);va(at);var _i,V,jc,xa,Yt,Mc,qc,Hc,Vc,ka,Oa,Ta,im,Jr={},Kc=[],om=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Fr=Array.isArray;function bt(e,t){for(var r in t)e[r]=t[r];return e}function Da(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function jr(e,t,r){var n,i,o,a={};for(o in t)o=="key"?n=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?_i.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return vi(e,a,n,i,null)}function vi(e,t,r,n,i){var o={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++jc:i,__i:-1,__u:0};return i==null&&V.vnode!=null&&V.vnode(o),o}function qr(){return{current:null}}function Nt(e){return e.children}function Ke(e,t){this.props=e,this.context=t}function cr(e,t){if(t==null)return e.__?cr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?cr(e):null}function $c(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return $c(e)}}function Gc(e){(!e.__d&&(e.__d=!0)&&Yt.push(e)&&!gi.__r++||Mc!==V.debounceRendering)&&((Mc=V.debounceRendering)||qc)(gi)}function gi(){for(var e,t,r,n,i,o,a,s=1;Yt.length;)Yt.length>s&&Yt.sort(Hc),e=Yt.shift(),s=Yt.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,o=[],a=[],t.__P&&((r=bt({},n)).__v=n.__v+1,V.vnode&&V.vnode(r),Na(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,o,i==null?cr(n):i,!!(32&n.__u),a),r.__v=n.__v,r.__.__k[r.__i]=r,Yc(o,r,a),r.__e!=i&&$c(r)));gi.__r=0}function Wc(e,t,r,n,i,o,a,s,l,c,m){var d,h,p,b,E,I,w=n&&n.__k||Kc,R=t.length;for(l=am(r,t,w,l,R),d=0;d<R;d++)(p=r.__k[d])!=null&&(h=p.__i===-1?Jr:w[p.__i]||Jr,p.__i=d,I=Na(e,p,h,i,o,a,s,l,c,m),b=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&Pa(h.ref,null,p),m.push(p.ref,p.__c||b,p)),E==null&&b!=null&&(E=b),4&p.__u||h.__k===p.__k?l=zc(p,l,e):typeof p.type=="function"&&I!==void 0?l=I:b&&(l=b.nextSibling),p.__u&=-7);return r.__e=E,l}function am(e,t,r,n,i){var o,a,s,l,c,m=r.length,d=m,h=0;for(e.__k=new Array(i),o=0;o<i;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(l=o+h,(a=e.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?vi(null,a,null,null,null):Fr(a)?vi(Nt,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?vi(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,(c=a.__i=sm(a,r,l,d))!==-1&&(d--,(s=r[c])&&(s.__u|=2)),s==null||s.__v===null?(c==-1&&(i>m?h--:i<m&&h++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?h--:c==l+1?h++:(c>l?h--:h++,a.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<m;o++)(s=r[o])!=null&&!(2&s.__u)&&(s.__e==n&&(n=cr(s)),Qc(s,s));return n}function zc(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=zc(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=cr(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Hr(e,t){return t=t||[],e==null||typeof e=="boolean"||(Fr(e)?e.some(function(r){Hr(r,t)}):t.push(e)),t}function sm(e,t,r,n){var i,o,a=e.key,s=e.type,l=t[r];if(l===null&&e.key==null||l&&a==l.key&&s===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(i=r-1,o=r+1;i>=0||o<t.length;){if(i>=0){if((l=t[i])&&!(2&l.__u)&&a==l.key&&s===l.type)return i;i--}if(o<t.length){if((l=t[o])&&!(2&l.__u)&&a==l.key&&s===l.type)return o;o++}}return-1}function Jc(e,t,r){t[0]=="-"?e.setProperty(t,r==null?"":r):e[t]=r==null?"":typeof r!="number"||om.test(t)?r:r+"px"}function mi(e,t,r,n,i){var o;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Jc(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Jc(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Vc,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n?r.t=n.t:(r.t=ka,e.addEventListener(t,o?Ta:Oa,o)):e.removeEventListener(t,o?Ta:Oa,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r==null?"":r;break e}catch(a){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function Fc(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=ka++;else if(t.u<r.t)return;return r(V.event?V.event(t):t)}}}function Na(e,t,r,n,i,o,a,s,l,c){var m,d,h,p,b,E,I,w,R,O,P,M,S,D,F,H,U,J=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[s=t.__e=r.__e]),(m=V.__b)&&m(t);e:if(typeof J=="function")try{if(w=t.props,R="prototype"in J&&J.prototype.render,O=(m=J.contextType)&&n[m.__c],P=m?O?O.props.value:m.__:n,r.__c?I=(d=t.__c=r.__c).__=d.__E:(R?t.__c=d=new J(w,P):(t.__c=d=new Ke(w,P),d.constructor=J,d.render=cm),O&&O.sub(d),d.props=w,d.state||(d.state={}),d.context=P,d.__n=n,h=d.__d=!0,d.__h=[],d._sb=[]),R&&d.__s==null&&(d.__s=d.state),R&&J.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=bt({},d.__s)),bt(d.__s,J.getDerivedStateFromProps(w,d.__s))),p=d.props,b=d.state,d.__v=t,h)R&&J.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),R&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(R&&J.getDerivedStateFromProps==null&&w!==p&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,P),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,P)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(d.props=w,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(j){j&&(j.__=t)}),M=0;M<d._sb.length;M++)d.__h.push(d._sb[M]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(w,d.__s,P),R&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(p,b,E)})}if(d.context=P,d.props=w,d.__P=e,d.__e=!1,S=V.__r,D=0,R){for(d.state=d.__s,d.__d=!1,S&&S(t),m=d.render(d.props,d.state,d.context),F=0;F<d._sb.length;F++)d.__h.push(d._sb[F]);d._sb=[]}else do d.__d=!1,S&&S(t),m=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++D<25);d.state=d.__s,d.getChildContext!=null&&(n=bt(bt({},n),d.getChildContext())),R&&!h&&d.getSnapshotBeforeUpdate!=null&&(E=d.getSnapshotBeforeUpdate(p,b)),H=m,m!=null&&m.type===Nt&&m.key==null&&(H=Xc(m.props.children)),s=Wc(e,Fr(H)?H:[H],t,r,n,i,o,a,s,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),I&&(d.__E=d.__=null)}catch(j){if(t.__v=null,l||o!=null)if(j.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else for(U=o.length;U--;)Da(o[U]);else t.__e=r.__e,t.__k=r.__k;V.__e(j,t,r)}else o==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):s=t.__e=lm(r.__e,t,r,n,i,o,a,l,c);return(m=V.diffed)&&m(t),128&t.__u?void 0:s}function Yc(e,t,r){for(var n=0;n<r.length;n++)Pa(r[n],r[++n],r[++n]);V.__c&&V.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){V.__e(o,i.__v)}})}function Xc(e){return typeof e!="object"||e==null?e:Fr(e)?e.map(Xc):bt({},e)}function lm(e,t,r,n,i,o,a,s,l){var c,m,d,h,p,b,E,I=r.props,w=t.props,R=t.type;if(R=="svg"?i="http://www.w3.org/2000/svg":R=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((p=o[c])&&"setAttribute"in p==!!R&&(R?p.localName==R:p.nodeType==3)){e=p,o[c]=null;break}}if(e==null){if(R==null)return document.createTextNode(w);e=document.createElementNS(i,R,w.is&&w),s&&(V.__m&&V.__m(t,o),s=!1),o=null}if(R===null)I===w||s&&e.data===w||(e.data=w);else{if(o=o&&_i.call(e.childNodes),I=r.props||Jr,!s&&o!=null)for(I={},c=0;c<e.attributes.length;c++)I[(p=e.attributes[c]).name]=p.value;for(c in I)if(p=I[c],c!="children"){if(c=="dangerouslySetInnerHTML")d=p;else if(!(c in w)){if(c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w)continue;mi(e,c,null,p,i)}}for(c in w)p=w[c],c=="children"?h=p:c=="dangerouslySetInnerHTML"?m=p:c=="value"?b=p:c=="checked"?E=p:s&&typeof p!="function"||I[c]===p||mi(e,c,p,I[c],i);if(m)s||d&&(m.__html===d.__html||m.__html===e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(d&&(e.innerHTML=""),Wc(t.type==="template"?e.content:e,Fr(h)?h:[h],t,r,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:r.__k&&cr(r,0),s,l),o!=null)for(c=o.length;c--;)Da(o[c]);s||(c="value",R=="progress"&&b==null?e.removeAttribute("value"):b!==void 0&&(b!==e[c]||R=="progress"&&!b||R=="option"&&b!==I[c])&&mi(e,c,b,I[c],i),c="checked",E!==void 0&&E!==e[c]&&mi(e,c,E,I[c],i))}return e}function Pa(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){V.__e(i,r)}}function Qc(e,t,r){var n,i;if(V.unmount&&V.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||Pa(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){V.__e(o,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Qc(n[i],t,r||typeof e.type!="function");r||Da(e.__e),e.__c=e.__=e.__e=void 0}function cm(e,t,r){return this.constructor(e,r)}function Zc(e,t,r){var n,i,o,a;t==document&&(t=document.documentElement),V.__&&V.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,o=[],a=[],Na(t,e=(!n&&r||t).__k=jr(Nt,null,[e]),i||Jr,Jr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?_i.call(t.childNodes):null,o,!n&&r?r:i?i.__e:t.firstChild,n,a),Yc(o,e,a)}_i=Kc.slice,V={__e:function(e,t,r,n){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},jc=0,xa=function(e){return e!=null&&e.constructor==null},Ke.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=bt({},this.state),typeof e=="function"&&(e=e(bt({},r),this.props)),e&&bt(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Gc(this))},Ke.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Gc(this))},Ke.prototype.render=Nt,Yt=[],qc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Hc=function(e,t){return e.__v.__b-t.__v.__b},gi.__r=0,Vc=/(PointerCapture)$|Capture$/i,ka=0,Oa=Fc(!1),Ta=Fc(!0),im=0;var dr,fe,La,ed,Vr=0,ld=[],me=V,td=me.__b,rd=me.__r,nd=me.diffed,id=me.__c,od=me.unmount,ad=me.__;function bi(e,t){me.__h&&me.__h(fe,e,Vr||t),Vr=0;var r=fe.__H||(fe.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function wt(e){return Vr=1,cd(dd,e)}function cd(e,t,r){var n=bi(dr++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):dd(void 0,t),function(s){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,s);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=fe,!fe.__f)){var i=function(s,l,c){if(!n.__c.__H)return!0;var m=n.__c.__H.__.filter(function(h){return!!h.__c});if(m.every(function(h){return!h.__N}))return!o||o.call(this,s,l,c);var d=n.__c.props!==s;return m.forEach(function(h){if(h.__N){var p=h.__[0];h.__=h.__N,h.__N=void 0,p!==h.__[0]&&(d=!0)}}),o&&o.call(this,s,l,c)||d};fe.__f=!0;var o=fe.shouldComponentUpdate,a=fe.componentWillUpdate;fe.componentWillUpdate=function(s,l,c){if(this.__e){var m=o;o=void 0,i(s,l,c),o=m}a&&a.call(this,s,l,c)},fe.shouldComponentUpdate=i}return n.__N||n.__}function Pt(e,t){var r=bi(dr++,3);!me.__s&&Ma(r.__H,t)&&(r.__=e,r.u=t,fe.__H.__h.push(r))}function Ba(e,t){var r=bi(dr++,4);!me.__s&&Ma(r.__H,t)&&(r.__=e,r.u=t,fe.__h.push(r))}function wi(e){return Vr=5,Kr(function(){return{current:e}},[])}function Kr(e,t){var r=bi(dr++,7);return Ma(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function $r(e,t){return Vr=8,Kr(function(){return e},t)}function dm(){for(var e;e=ld.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(yi),e.__H.__h.forEach(Ua),e.__H.__h=[]}catch(t){e.__H.__h=[],me.__e(t,e.__v)}}me.__b=function(e){fe=null,td&&td(e)},me.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),ad&&ad(e,t)},me.__r=function(e){rd&&rd(e),dr=0;var t=(fe=e.__c).__H;t&&(La===fe?(t.__h=[],fe.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(yi),t.__h.forEach(Ua),t.__h=[],dr=0)),La=fe},me.diffed=function(e){nd&&nd(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(ld.push(t)!==1&&ed===me.requestAnimationFrame||((ed=me.requestAnimationFrame)||um)(dm)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),La=fe=null},me.__c=function(e,t){t.some(function(r){try{r.__h.forEach(yi),r.__h=r.__h.filter(function(n){return!n.__||Ua(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],me.__e(n,r.__v)}}),id&&id(e,t)},me.unmount=function(e){od&&od(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{yi(n)}catch(i){t=i}}),r.__H=void 0,t&&me.__e(t,r.__v))};var sd=typeof requestAnimationFrame=="function";function um(e){var t,r=function(){clearTimeout(n),sd&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);sd&&(t=requestAnimationFrame(r))}function yi(e){var t=fe,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),fe=t}function Ua(e){var t=fe;e.__c=e.__(),fe=t}function Ma(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function dd(e,t){return typeof t=="function"?t(e):t}function hm(e,t){for(var r in t)e[r]=t[r];return e}function ud(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function fd(e,t){this.props=e,this.context=t}(fd.prototype=new Ke).isPureReactComponent=!0,fd.prototype.shouldComponentUpdate=function(e,t){return ud(this.props,e)||ud(this.state,t)};var hd=V.__b;V.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),hd&&hd(e)};var dC=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var pm=V.__e;V.__e=function(e,t,r,n){if(e.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),i.__c(e,t)}pm(e,t,r,n)};var pd=V.unmount;function bd(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=hm({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return bd(n,t,r)})),e}function wd(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return wd(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Ga(){this.__u=0,this.o=null,this.__b=null}function Ad(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ai(){this.i=null,this.l=null}V.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),pd&&pd(e)},(Ga.prototype=new Ke).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var i=Ad(n.__v),o=!1,a=function(){o||(o=!0,r.__R=null,i?i(s):s())};r.__R=a;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=wd(l,l.__c.__P,l.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.o.pop();)c.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(a,a)},Ga.prototype.componentWillUnmount=function(){this.o=[]},Ga.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=bd(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&jr(Nt,null,e.fallback);return i&&(i.__u&=-33),[jr(Nt,null,t.__a?null:e.children),i]};var md=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(Ai.prototype=new Ke).__a=function(e){var t=this,r=Ad(t.__v),n=t.l.get(e);return n[0]++,function(i){var o=function(){t.props.revealOrder?(n.push(i),md(t,e,n)):i()};r?r(o):o()}},Ai.prototype.render=function(e){this.i=null,this.l=new Map;var t=Hr(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},Ai.prototype.componentDidUpdate=Ai.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){md(e,r,t)})};var mm=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,vm=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,gm=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,_m=/[A-Z0-9]/g,ym=typeof document!="undefined",bm=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function st(e,t,r){return t.__k==null&&(t.textContent=""),Zc(e,t),typeof r=="function"&&r(),e?e.__c:null}Ke.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ke.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var vd=V.event;function wm(){}function Am(){return this.cancelBubble}function Em(){return this.defaultPrevented}V.event=function(e){return vd&&(e=vd(e)),e.persist=wm,e.isPropagationStopped=Am,e.isDefaultPrevented=Em,e.nativeEvent=e};var Ed,Im={enumerable:!1,configurable:!0,get:function(){return this.class}},gd=V.vnode;V.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,i={},o=n.indexOf("-")===-1;for(var a in r){var s=r[a];if(!(a==="value"&&"defaultValue"in r&&s==null||ym&&a==="children"&&n==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in r&&r.value==null?a="value":a==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||bm(r.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":gm.test(a)&&(a=l):l=a="oninput":o&&vm.test(a)?a=a.replace(_m,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&i[a=l]&&(a="oninputCapture"),i[a]=s}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=Hr(r.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=Hr(r.children).forEach(function(c){c.props.selected=i.multiple?i.defaultValue.indexOf(c.props.value)!=-1:i.defaultValue==c.props.value})),r.class&&!r.className?(i.class=r.class,Object.defineProperty(i,"className",Im)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=mm,gd&&gd(e)};var _d=V.__r;V.__r=function(e){_d&&_d(e),Ed=e.__c};var yd=V.diffed;V.diffed=function(e){yd&&yd(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),Ed=null};var Sm=Object.defineProperty,Cm=Object.defineProperties,Rm=Object.getOwnPropertyDescriptors,Si=Object.getOwnPropertySymbols,Dd=Object.prototype.hasOwnProperty,Nd=Object.prototype.propertyIsEnumerable,Id=(e,t,r)=>t in e?Sm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,At=(e,t)=>{for(var r in t||(t={}))Dd.call(t,r)&&Id(e,r,t[r]);if(Si)for(var r of Si(t))Nd.call(t,r)&&Id(e,r,t[r]);return e},Om=(e,t)=>Cm(e,Rm(t)),Tm=(e,t)=>{var r={};for(var n in e)Dd.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Si)for(var n of Si(e))t.indexOf(n)<0&&Nd.call(e,n)&&(r[n]=e[n]);return r},Ci=(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 xm(e){return!!(e!=null&&e.__nativeBuffers__)}var km=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};function Ka(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!xm(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=km(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}var Dm=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)};function Nm(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:Dm(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var Pd=Object.defineProperty,Pm=Object.getOwnPropertyDescriptor,Lm=(e,t)=>{for(var r in t)Pd(e,r,{get:t[r],enumerable:!0})},Ld=(e,t,r,n)=>{for(var i=n>1?void 0:n?Pm(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&&Pd(t,r,i),i},Um=(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}function Bm(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var Mm=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))}})}};function Ud(e){return typeof e=="string"}function fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Sd(e){return typeof e=="number"&&!isNaN(e)}function Gm(e){return typeof e=="undefined"}function Jm(e){return Gm(e)||e===null}function Bd(e){return typeof e=="function"}function Fm(e){return fr(e)&&Bd(e.then)}function Md(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}var jm=(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))(jm||{}),qm=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}},Ri=class extends qm{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Hm=class extends Ri{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Vm=class extends Ri{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Km=class extends Ri{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Ja=class extends Ri{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function Wr(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var Oi={log:Wr("log"),warn:Wr("warn"),info:Wr("info"),error:Wr("error"),debug:Wr("debug")};Object.assign(globalThis,{logger:Oi});var Cd=Symbol.for("Jolibox.canIUseMap"),$m={};globalThis[Cd]||(globalThis[Cd]=$m);function Wm(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}var $a=Symbol.for("Jolibox.canIUseMap.native"),zm={};globalThis[$a]||(globalThis[$a]=zm);var Wa={get config(){return globalThis[$a]}},Ym=(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))(Ym||{}),Xm=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Xm||{}),Qm=(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))(Qm||{});function Zm(){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}}Zm();var ur=typeof window=="undefined",ev=()=>!ur&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),pC={isiOS:!ur&&(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:!ur&&navigator.userAgent.includes("Android"),isMac:!ur&&navigator.userAgent.includes("Mac"),isFacebook:!ur&&navigator.userAgent.includes("FB_IAB"),isPC:!ur&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},za=class Ya{constructor(t){this.element=t,this.next=Ya.Undefined,this.prev=Ya.Undefined}};za.Undefined=new za(void 0);var de=za,tv=class{constructor(){this._first=de.Undefined,this._last=de.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===de.Undefined}clear(){let e=this._first;for(;e!==de.Undefined;){let t=e.next;e.prev=de.Undefined,e.next=de.Undefined,e=t}this._first=de.Undefined,this._last=de.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new de(e);if(this._first===de.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!==de.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==de.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==de.Undefined&&e.next!==de.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===de.Undefined&&e.next===de.Undefined?(this._first=de.Undefined,this._last=de.Undefined):e.next===de.Undefined?(this._last=this._last.prev,this._last.next=de.Undefined):e.prev===de.Undefined&&(this._first=this._first.next,this._first.prev=de.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==de.Undefined;)yield e.element,e=e.next}},rv=0,zr=class{constructor(e){this.value=e,this.id=rv++}},Xr=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 zr&&(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 zr(t);return this._listeners?this._listeners instanceof zr?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,h,p;if(!this._disposed){if(this._listeners instanceof zr)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&&((p=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||p.call(h)))}}}}),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 zr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Xa=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 Xr,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 tv,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)}},Qa={};Lm(Qa,{None:()=>nv,filter:()=>ov,once:()=>Gd,toPromise:()=>iv});var nv=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function iv(e){return new Promise(t=>Gd(e)(t))}function Gd(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function ov(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Xr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}var Fa=Symbol.for("Jolibox.hostEmitter"),av=()=>{let e=new Xa;return globalThis[Fa]||(globalThis[Fa]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[Fa]},mC=av();function sv(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)lv(e[n],t[n])}function lv(e,t){if(Ud(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Bd(t)){try{if(e instanceof t)return}catch(r){}if(!Jm(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")}}var Za=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Xr,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 sv(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}};Za=Ld([Md],Za);var Rd=class{constructor(){this._onWillExecuteCommand=new Xr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Xr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new Za,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Bm(3e4)),this._starActivation}executeCommand(e,...t){return Um(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Qa.toPromise(Qa.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}}};Rd=Ld([Md],Rd);var vC=Symbol.for("Jolibox.commands");Te("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Te("requestProductDetailsAsync",{version:102e4});Te("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Te("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Te("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Te("userTrackAsync",{version:1e6});Te("openMiniapp",{version:1050100});Te("requestCoinDetailsSync",{version:1070100});Te("requestCoinDetailsAsync",{version:1070100});Te("sendServerEventAsync",{version:1070100});Te("requestGameLeaderboardSync",{version:108e4});Te("requestGameLeaderboardAsync",{version:108e4});Te("notifyTaskGameInfoAsync",{version:1080100});Te("loadAdsAsync",{version:1070200});Te("showAdAsync",{version:1070200});Te("onJoliboxHideLoading",{version:1070300});function Te(e,t){if(Wa.config[e]){Oi.warn(`[can i use] ${e} already registered`);return}Wa.config[e]=At({},t)}var Jd=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=Wa.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",m=l.version;if(l.platforms&&c in l.platforms){let h=l.platforms[c];if(h===!1)return!1;typeof h=="number"&&(m=h)}if(typeof m!="number")return!1;let d=e();return typeof d!="number"||d<m?!1:s.length===0?!0:n(l,s,d)||n(l.properties,s,d)}function n(i,o,a){if(!i)return!1;let s=Wm(i,o);if(!s)return!1;if(fr(s)){let l=s.version;return Sd(l)?typeof a=="number"&&a>=l:!0}return Sd(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};function Od(e,t){return`[${e}]:${t}`}var cv=()=>ev(),Yr="custom_event_",dv=[],uv=[],fv=["env","createRequestTask","login"],Fd="__batch_event__",hv="__native_batch_event__",pv=e=>e==="pv"?e:"default",Ii=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=pv(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&&fr(a))throw new Ja(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(fr(a))l.push(...Object.keys(a));else if(Ud(a)){if(i.length>0)throw new Ja(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new Ja(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let m=fr(a)?a[c]:a;t(n[c],[...i],o,m)})}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={}}},Td=!1,ja,qa,Ha;function mv(e,t){Td||(ja=new Ii({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),qa=new Ii({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ha=new Ii({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{ja.flush(),qa.flush(),Ha.flush()}),Td=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:m,errMsg:d=`${s}:fail no errMsg`,errNo:h=0,__timing:p={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:b,invokeCallback:E}=p,I=(a=(o=d.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";ja.report({status:I,method:n(s,l),errNo:`${h}`,errMsg:d,isForeground:m,duration:Date.now()-c}),c&&b&&E&&(qa.report({status:I,method:s,isForeground:m,duration:Number((b-c).toFixed(3))}),Ha.report({status:I,method:s,isForeground:m,duration:Number((Date.now()-E).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}var Va=[],vv=!1,es=Symbol.for("Jolibox.invokeResolverInstance"),gv=new Map;globalThis[es]||(globalThis[es]=gv);var _v={get resolveMap(){return globalThis[es]}};function yv(e,t){let r=0,n=!0,i=_v.resolveMap,o=mv(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Va.forEach(l=>Ci(this,[l],function*({method:c,args:m,resolve:d}){let h=yield s(c,m);d(h)})),Va.length=0});let a=(l,c)=>{let m=i.get(Number(l));if(!m)return;let d=Ka(c);m(d),i.delete(Number(l))},s=(l,c)=>{var m,d;let h=Date.now(),p=`${n}`;r+=1;let b=new Mm;if(i.set(r,b.resolve),!n&&uv.includes(l))return new Promise(P=>{Va.push({method:l,args:c,resolve:P})});let E=Om(At({},{method:l,startTime:h,args:c,isForeground:p}),{invokeType:"js-bridge"}),I=!vv&&dv.includes(l),w=Nm(c,I),R=I?w:JSON.stringify(w),O;if(l.endsWith("Sync")||fv.includes(l)?O=(m=e.call)==null?void 0:m.call(e,l,w,r):typeof R=="string"?O=e.invoke(l,R,r):O=(d=e.call)==null?void 0:d.call(e,l,R,r),O){try{typeof O=="string"&&(O=JSON.parse(O)),O=Ka(O)}catch(P){Oi.error(P)}return i.delete(r),O.errorCode&&(O.errorCode=Od(l,O.errorCode)),o(At(At({},E),O)),O}return l.endsWith("Sync")&&i.delete(r),b.promise.then(P=>(P.errorCode&&(P.errorCode=Od(l,P.errorCode)),o(At(At({},E),P)),P))};return{invokeNative:s,applyNative:(l,c)=>{let m=s(l,c);return Fm(m)?m.then(d=>xd(l,d)):xd(l,m)},invokeHandler:a}}function xd(e,t){if(!fr(t)){Oi.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=Tm(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new Vm(n,i,o,a);return s}var Ei=Symbol.for("Jolibox.subscribeInstance");function bv(e){if(globalThis[Ei])return globalThis[Ei];let t=new Xa,r=new Xa,n=new Ii({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[Ei]={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=Ka(o),l;if(s.__extra){l=s.params;let{type:c,startTime:m}=s.__extra;n.report({type:c,event:i,duration:Date.now()-m})}else l=s;if(i===Fd){l.forEach(c=>{let[m,d]=c;try{r.emit(m.slice(Yr.length),d,a)}catch(h){}});return}if(i.startsWith(Yr)){r.emit(i.slice(Yr.length),l,a);return}t.emit(i,l,a)}},globalThis[Ei]}function wv(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let m=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Yr}${o}`,a,m);return}n||(n=Promise.resolve().then(()=>{t.forEach((m,d)=>{try{let h=d!==void 0?d==="*"?"*":[d]:void 0;e.publish(Fd,m,h)}catch(h){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Yr}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let m=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,m),console.log("emitNative",o,a,m);return}i||(i=Promise.resolve().then(()=>{r.forEach((m,d)=>{try{let h=d!==void 0?d==="*"?"*":[d]:void 0;e.publish(hv,m,h)}catch(h){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function Av(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=bv(e),{invokeNative:a,invokeHandler:s,applyNative:l}=yv(e,r),{publish:c,emitNative:m}=wv(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:m,publish:c,subscribe:i,unsubscribe:o}}function jd(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var ts,Lt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Lt.trigger=e},onDoExit(e){Lt.exit=e},onDoBackPress(e){Lt.backPress=e}},qd=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Hm("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="")=>{Lt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ci(void 0,null,function*(){let o=yield Lt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});ts={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=jd(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:qd,doExit:r};globalThis.joliboxJSCore=At({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Lt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ci(void 0,null,function*(){let a=yield Lt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});ts={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=jd(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Ci(this,null,function*(){let a=yield Lt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:qd,doExit:n};globalThis.joliboxJSCore=At({},i)}var Hd=ts;if(!Hd&&cv())throw new Km("No joliboxJScore is found, native bridge not found.");var Ev=At({},Hd),Vd=Av(Ev),{invokeHandler:kd}=Vd,{applyNative:gC,invokeNative:Ti,onNative:Kd,offNative:$d,subscribeHandler:Iv,publish:_C,emitNative:yC,subscribe:bC,unsubscribe:wC}=Vd;globalThis.joliboxJSBridge={callHandler:kd,invokeHandler:kd,subscribeHandler:Iv};var Sv=Object.defineProperty,Cv=Object.defineProperties,Rv=Object.getOwnPropertyDescriptors,ji=Object.getOwnPropertySymbols,Au=Object.prototype.hasOwnProperty,Eu=Object.prototype.propertyIsEnumerable,Wd=(e,t,r)=>t in e?Sv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Iu=(e,t)=>{for(var r in t||(t={}))Au.call(t,r)&&Wd(e,r,t[r]);if(ji)for(var r of ji(t))Eu.call(t,r)&&Wd(e,r,t[r]);return e},Ov=(e,t)=>Cv(e,Rv(t)),Tv=(e,t)=>{var r={};for(var n in e)Au.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ji)for(var n of ji(e))t.indexOf(n)<0&&Eu.call(e,n)&&(r[n]=e[n]);return r},Su=Object.defineProperty,xv=Object.defineProperties,kv=Object.getOwnPropertyDescriptors,zd=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Nv=Object.prototype.propertyIsEnumerable,Yd=(e,t,r)=>t in e?Su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pv=(e,t)=>{for(var r in t||(t={}))Dv.call(t,r)&&Yd(e,r,t[r]);if(zd)for(var r of zd(t))Nv.call(t,r)&&Yd(e,r,t[r]);return e},Lv=(e,t)=>xv(e,kv(t)),Uv=(e,t)=>{for(var r in t)Su(e,r,{get:t[r],enumerable:!0})},Cu=(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},Bv=(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}function Mv(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Gv(e){return typeof e=="string"}function Jv(e){return typeof e=="undefined"}function Fv(e){return Jv(e)||e===null}function jv(e){return typeof e=="function"}function Ru(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}var qv=(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))(qv||{});function Qr(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var Hv={log:Qr("log"),warn:Qr("warn"),info:Qr("info"),error:Qr("error"),debug:Qr("debug")};Object.assign(globalThis,{logger:Hv});var Xd=Symbol.for("Jolibox.canIUseMap"),Vv={};globalThis[Xd]||(globalThis[Xd]=Vv);var Qd=Symbol.for("Jolibox.canIUseMap.native"),Kv={};globalThis[Qd]||(globalThis[Qd]=Kv);var Ou=(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))(Ou||{}),Tu=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Tu||{}),xu=(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))(xu||{}),Zd=["name","params"],$v=["name","type","location","target","extra","timestamp","userId"],Wv=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function Pi(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 zv(e){let t=e.location?Pi(e.location,Zd):null,r=e.target?Pi(e.target,Zd):null;return Pi(Lv(Pv({},e),{location:t,target:r}),$v)}function Yv(e){let t=e.events.map(n=>zv(n)),r=Pi(e.device,Wv);return[e.protocolVersion,t,r,e.project]}function Xv(){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}}Xv();var vr=typeof window=="undefined",qi=()=>!vr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!vr&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!vr&&navigator.userAgent.includes("Android"),!vr&&navigator.userAgent.includes("Mac"),!vr&&navigator.userAgent.includes("FB_IAB"),!vr&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var us=class fs{constructor(t){this.element=t,this.next=fs.Undefined,this.prev=fs.Undefined}};us.Undefined=new us(void 0);var ue=us,Qv=class{constructor(){this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ue.Undefined}clear(){let e=this._first;for(;e!==ue.Undefined;){let t=e.next;e.prev=ue.Undefined,e.next=ue.Undefined,e=t}this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ue(e);if(this._first===ue.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!==ue.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ue.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ue.Undefined&&e.next!==ue.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ue.Undefined&&e.next===ue.Undefined?(this._first=ue.Undefined,this._last=ue.Undefined):e.next===ue.Undefined?(this._last=this._last.prev,this._last.next=ue.Undefined):e.prev===ue.Undefined&&(this._first=this._first.next,this._first.prev=ue.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ue.Undefined;)yield e.element,e=e.next}},Zv=0,Zr=class{constructor(e){this.value=e,this.id=Zv++}},on=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 Zr&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){return this._event!=null||(this._event=(e,t)=>{var r,n,i,o,a,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new Zr(e);return this._listeners?this._listeners instanceof Zr?this._listeners=[this._listeners,l]:this._listeners.push(l):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=l,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(s=(a=this.options)==null?void 0:a.onDidAddListener)==null||s.call(a,this),this._size++,()=>{var c,m,d,h;if(!this._disposed){if(this._listeners instanceof Zr)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(m=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||m.call(c));else if(this._listeners){let p=this._listeners.indexOf(l);p>=0&&(this._listeners.splice(p,1),this._size--,this._size===0&&((h=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||h.call(d)))}}}}),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 Zr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},eg=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 on,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),r=this.cachedEventQueue.get(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r||(r=new Qv,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)}},hs={};Uv(hs,{None:()=>tg,filter:()=>ng,once:()=>ku,toPromise:()=>rg});var tg=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function rg(e){return new Promise(t=>ku(e)(t))}function ku(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 ng(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new on(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)})}var rs=Symbol.for("Jolibox.hostEmitter"),ig=()=>{let e=new eg;return globalThis[rs]||(globalThis[rs]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[rs]};ig();function og(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ag(e[n],t[n])}function ag(e,t){if(Gv(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")}}var ps=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new on,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 og(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}};ps=Cu([Ru],ps);var eu=class{constructor(){this._onWillExecuteCommand=new on,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new on,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new ps,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Mv(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 Bv(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),hs.toPromise(hs.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{}}};eu=Cu([Ru],eu);function je(e,t,r){return(t=sg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sg(e){var t=lg(e,"string");return typeof t=="symbol"?t:t+""}function lg(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 hr=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")},ms=class{constructor(t){je(this,"context",void 0),je(this,"continueCallback",void 0),je(this,"adIsShowingCallback",void 0),je(this,"isBeforeAdCalled",!1),je(this,"isBeforeRewardCalled",!1),je(this,"isAdDismissedCalled",!1),je(this,"isAdViewedCalled",!1),je(this,"isAfterAdCalled",!1),je(this,"currentProvider",void 0),je(this,"currentClientParams",void 0),je(this,"adsHasResponse",!1),je(this,"videoChecker",window.document.createElement("video")),je(this,"contextInfo",void 0),je(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",Iu({userEvent:a},this.paramsToTrack)),qi()&&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=hr(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=hr(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),qi()&&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=hr(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=hr(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=hr(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,l,c,m,d;switch(this.adsHasResponse=!0,this.context.track("CallAdBreakDone",{provider:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:null,breakType:r.breakType,breakName:(o=r.breakName)!=null?o:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(a=this.currentProvider)==null?void 0:a.name)!=null?s:null,breakType:r.breakType,breakName:(l=r.breakName)!=null?l:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let h=hr(t);h==null||h(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(m=this.continueCallback)==null||m.call(this,[!1,r]);break}default:{(d=this.continueCallback)==null||d.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return A(this,null,function*(){return this.currentProvider=t,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(o=>{this.continueCallback=o,this.adIsShowingCallback=i;let a;switch(r.type){case"preroll":{a={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),beforeReward:this.wrapBeforeReward(r.beforeReward),adDismissed:this.wrapAdDismissed(r.adDismissed),adViewed:this.wrapAdViewed(r.adViewed),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}default:{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}}window.setTimeout(()=>{var s,l,c,m,d,h,p;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(m=(c=this.currentProvider)==null?void 0:c.name)!=null?m:null}),(h=this.continueCallback)==null||h.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(d=r.name)!=null?d:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout"}]),(p=this.adIsShowingCallback)==null||p.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")})})}};function xi(e,t,r){return(t=cg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cg(e){var t=dg(e,"string");return typeof t=="symbol"?t:t+""}function dg(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 vs=class{constructor(t){xi(this,"context",void 0),xi(this,"adBreakIsShowing",!1),xi(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),xi(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()})}};function ki(e,t,r){return(t=ug(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ug(e){var t=fg(e,"string");return typeof t=="symbol"?t:t+""}function fg(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 gs=class{constructor(t){ki(this,"configs",null),ki(this,"firstRun",!0),ki(this,"context",void 0),ki(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return A(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}};function Et(e,t,r){return(t=hg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hg(e){var t=pg(e,"string");return typeof t=="symbol"?t:t+""}function pg(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 _s=class{constructor(t,r){Et(this,"name","ADSENSE"),Et(this,"context",void 0),Et(this,"contextInfo",void 0),Et(this,"configured",!1),Et(this,"initParams",void 0),Et(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),Et(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=Tv(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),Et(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),Et(this,"adUnit",n=>A(this,null,function*(){var i,o,a,s;if(this.context.track("CallAdUnit",{adFormat:(o=(i=n.adFormat)==null?void 0:i.toString())!=null?o:null,fullWidthResponsive:(a=n.fullWidthResponsive)!=null?a:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:m,fullWidthResponsive:d,style:h}=n,p;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?p=document.querySelector(l):p=l,!p)throw new Error("targeting element not found");let b=c;if(b||(b=this.initParams.unitId),!b)throw new Error("slot is required");let E=typeof m=="object"&&Array.isArray(m)?m.join(", "):m,I=document.createElement("ins");if(I.className="adsbygoogle",I.id="jolibox-ads",I.style.display="block",I.setAttribute("data-ad-client",this.initParams.clientId),I.setAttribute("data-ad-slot",b),E&&I.setAttribute("data-ad-format",E),d&&I.setAttribute("data-full-width-responsive",d),h&&I.setAttribute("style",h),(s=this.contextInfo.testAdsMode)!=null?s:!1){let w=document.createElement("div");w.style.position="absolute",w.style.top="0",w.style.left="0",w.style.width="100%",w.style.height="100%",w.style.display="flex",w.style.justifyContent="center",w.style.alignItems="center",w.style.backgroundColor="rgba(0, 0, 0, 0.5)",w.style.color="white",w.innerHTML="Test Ad",I.style.position="relative",p.appendChild(I),I.appendChild(w)}else p.appendChild(I),new MutationObserver(w=>{w.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let O=I.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:O!=null?O:"null"})}})}).observe(I,{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 A(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)}})}};function mg(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 vg(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}var gg=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(vg(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=mg(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}(),ke="-ms-",Hi="-moz-",ee="-webkit-",Du="comm",qs="rule",Hs="decl",_g="@import",Nu="@keyframes",yg="@layer",bg=Math.abs,Xi=String.fromCharCode,wg=Object.assign;function Ag(e,t){return Se(e,0)^45?(((t<<2^Se(e,0))<<2^Se(e,1))<<2^Se(e,2))<<2^Se(e,3):0}function Pu(e){return e.trim()}function Eg(e,t){return(e=t.exec(e))?e[0]:e}function te(e,t,r){return e.replace(t,r)}function ys(e,t){return e.indexOf(t)}function Se(e,t){return e.charCodeAt(t)|0}function an(e,t,r){return e.slice(t,r)}function dt(e){return e.length}function Vs(e){return e.length}function Di(e,t){return t.push(e),e}function Ig(e,t){return e.map(t).join("")}var Qi=1,yr=1,Lu=0,He=0,ye=0,br="";function Zi(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:Qi,column:yr,length:a,return:""}}function en(e,t){return wg(Zi("",null,null,"",null,null,0),e,{length:-e.length},t)}function Sg(){return ye}function Cg(){return ye=He>0?Se(br,--He):0,yr--,ye===10&&(yr=1,Qi--),ye}function We(){return ye=He<Lu?Se(br,He++):0,yr++,ye===10&&(yr=1,Qi++),ye}function ut(){return Se(br,He)}function Li(){return He}function dn(e,t){return an(br,e,t)}function sn(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 Uu(e){return Qi=yr=1,Lu=dt(br=e),He=0,[]}function Bu(e){return br="",e}function Ui(e){return Pu(dn(He-1,bs(e===91?e+2:e===40?e+1:e)))}function Rg(e){for(;(ye=ut())&&ye<33;)We();return sn(e)>2||sn(ye)>3?"":" "}function Og(e,t){for(;--t&&We()&&!(ye<48||ye>102||ye>57&&ye<65||ye>70&&ye<97););return dn(e,Li()+(t<6&&ut()==32&&We()==32))}function bs(e){for(;We();)switch(ye){case e:return He;case 34:case 39:e!==34&&e!==39&&bs(ye);break;case 40:e===41&&bs(e);break;case 92:We();break}return He}function Tg(e,t){for(;We()&&e+ye!==57&&!(e+ye===84&&ut()===47););return"/*"+dn(t,He-1)+"*"+Xi(e===47?e:We())}function xg(e){for(;!sn(ut());)We();return dn(e,He)}function kg(e){return Bu(Bi("",null,null,null,[""],e=Uu(e),0,[0],e))}function Bi(e,t,r,n,i,o,a,s,l){for(var c=0,m=0,d=a,h=0,p=0,b=0,E=1,I=1,w=1,R=0,O="",P=i,M=o,S=n,D=O;I;)switch(b=R,R=We()){case 40:if(b!=108&&Se(D,d-1)==58){ys(D+=te(Ui(R),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:D+=Ui(R);break;case 9:case 10:case 13:case 32:D+=Rg(b);break;case 92:D+=Og(Li()-1,7);continue;case 47:switch(ut()){case 42:case 47:Di(Dg(Tg(We(),Li()),t,r),l);break;default:D+="/"}break;case 123*E:s[c++]=dt(D)*w;case 125*E:case 59:case 0:switch(R){case 0:case 125:I=0;case 59+m:w==-1&&(D=te(D,/\f/g,"")),p>0&&dt(D)-d&&Di(p>32?ru(D+";",n,r,d-1):ru(te(D," ","")+";",n,r,d-2),l);break;case 59:D+=";";default:if(Di(S=tu(D,t,r,c,m,i,s,O,P=[],M=[],d),o),R===123)if(m===0)Bi(D,t,S,S,P,o,d,s,M);else switch(h===99&&Se(D,3)===110?100:h){case 100:case 108:case 109:case 115:Bi(e,S,S,n&&Di(tu(e,S,S,0,0,i,s,O,i,P=[],d),M),i,M,d,s,n?P:M);break;default:Bi(D,S,S,S,[""],M,0,s,M)}}c=m=p=0,E=w=1,O=D="",d=a;break;case 58:d=1+dt(D),p=b;default:if(E<1){if(R==123)--E;else if(R==125&&E++==0&&Cg()==125)continue}switch(D+=Xi(R),R*E){case 38:w=m>0?1:(D+="\f",-1);break;case 44:s[c++]=(dt(D)-1)*w,w=1;break;case 64:ut()===45&&(D+=Ui(We())),h=ut(),m=d=dt(O=D+=xg(Li())),R++;break;case 45:b===45&&dt(D)==2&&(E=0)}}return o}function tu(e,t,r,n,i,o,a,s,l,c,m){for(var d=i-1,h=i===0?o:[""],p=Vs(h),b=0,E=0,I=0;b<n;++b)for(var w=0,R=an(e,d+1,d=bg(E=a[b])),O=e;w<p;++w)(O=Pu(E>0?h[w]+" "+R:te(R,/&\f/g,h[w])))&&(l[I++]=O);return Zi(e,t,r,i===0?qs:s,l,c,m)}function Dg(e,t,r){return Zi(e,t,r,Du,Xi(Sg()),an(e,2,-2),0)}function ru(e,t,r,n){return Zi(e,t,r,Hs,an(e,0,n),an(e,n+1,-1),n)}function _r(e,t){for(var r="",n=Vs(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function Ng(e,t,r,n){switch(e.type){case yg:if(e.children.length)break;case _g:case Hs:return e.return=e.return||e.value;case Du:return"";case Nu:return e.return=e.value+"{"+_r(e.children,n)+"}";case qs:e.value=e.props.join(",")}return dt(r=_r(e.children,n))?e.return=e.value+"{"+r+"}":""}function Pg(e){var t=Vs(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 Lg(e){return function(t){t.root||(t=t.return)&&e(t)}}function Ug(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Bg=function(e,t,r){for(var n=0,i=0;n=i,i=ut(),n===38&&i===12&&(t[r]=1),!sn(i);)We();return dn(e,He)},Mg=function(e,t){var r=-1,n=44;do switch(sn(n)){case 0:n===38&&ut()===12&&(t[r]=1),e[r]+=Bg(He-1,t,r);break;case 2:e[r]+=Ui(n);break;case 4:if(n===44){e[++r]=ut()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Xi(n)}while(n=We());return e},Gg=function(e,t){return Bu(Mg(Uu(e),t))},nu=new WeakMap,Jg=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&&!nu.get(r))&&!n){nu.set(e,!0);for(var i=[],o=Gg(t,i),a=r.props,s=0,l=0;s<o.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=i[s]?o[s].replace(/&\f/g,a[c]):a[c]+" "+o[s]}}},Fg=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function Mu(e,t){switch(Ag(e,t)){case 5103:return ee+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return ee+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return ee+e+Hi+e+ke+e+e;case 6828:case 4268:return ee+e+ke+e+e;case 6165:return ee+e+ke+"flex-"+e+e;case 5187:return ee+e+te(e,/(\w+).+(:[^]+)/,ee+"box-$1$2"+ke+"flex-$1$2")+e;case 5443:return ee+e+ke+"flex-item-"+te(e,/flex-|-self/,"")+e;case 4675:return ee+e+ke+"flex-line-pack"+te(e,/align-content|flex-|-self/,"")+e;case 5548:return ee+e+ke+te(e,"shrink","negative")+e;case 5292:return ee+e+ke+te(e,"basis","preferred-size")+e;case 6060:return ee+"box-"+te(e,"-grow","")+ee+e+ke+te(e,"grow","positive")+e;case 4554:return ee+te(e,/([^-])(transform)/g,"$1"+ee+"$2")+e;case 6187:return te(te(te(e,/(zoom-|grab)/,ee+"$1"),/(image-set)/,ee+"$1"),e,"")+e;case 5495:case 3959:return te(e,/(image-set\([^]*)/,ee+"$1$`$1");case 4968:return te(te(e,/(.+:)(flex-)?(.*)/,ee+"box-pack:$3"+ke+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ee+e+e;case 4095:case 3583:case 4068:case 2532:return te(e,/(.+)-inline(.+)/,ee+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(dt(e)-1-t>6)switch(Se(e,t+1)){case 109:if(Se(e,t+4)!==45)break;case 102:return te(e,/(.+:)(.+)-([^]+)/,"$1"+ee+"$2-$3$1"+Hi+(Se(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~ys(e,"stretch")?Mu(te(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Se(e,t+1)!==115)break;case 6444:switch(Se(e,dt(e)-3-(~ys(e,"!important")&&10))){case 107:return te(e,":",":"+ee)+e;case 101:return te(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ee+(Se(e,14)===45?"inline-":"")+"box$3$1"+ee+"$2$3$1"+ke+"$2box$3")+e}break;case 5936:switch(Se(e,t+11)){case 114:return ee+e+ke+te(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ee+e+ke+te(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ee+e+ke+te(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ee+e+ke+e+e}return e}var jg=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Hs:e.return=Mu(e.value,e.length);break;case Nu:return _r([en(e,{value:te(e.value,"@","@"+ee)})],n);case qs:if(e.length)return Ig(e.props,function(i){switch(Eg(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return _r([en(e,{props:[te(i,/:(read-\w+)/,":"+Hi+"$1")]})],n);case"::placeholder":return _r([en(e,{props:[te(i,/:(plac\w+)/,":"+ee+"input-$1")]}),en(e,{props:[te(i,/:(plac\w+)/,":"+Hi+"$1")]}),en(e,{props:[te(i,/:(plac\w+)/,ke+"input-$1")]})],n)}return""})}},qg=[jg],Hg=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(b){var E=b.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var n=e.stylisPlugins||qg,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(b){for(var E=b.getAttribute("data-emotion").split(" "),I=1;I<E.length;I++)i[E[I]]=!0;a.push(b)});var s,l=[Jg,Fg];{var c,m=[Ng,Lg(function(b){c.insert(b)})],d=Pg(l.concat(n,m)),h=function(b){return _r(kg(b),d)};s=function(b,E,I,w){c=I,h(b?b+"{"+E.styles+"}":E.styles),w&&(p.inserted[E.name]=!0)}}var p={key:t,sheet:new gg({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 p.sheet.hydrate(a),p};function Vg(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)}var Kg={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},$g=/[A-Z]|^ms/g,Wg=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Gu=function(e){return e.charCodeAt(1)===45},iu=function(e){return e!=null&&typeof e!="boolean"},ns=Ug(function(e){return Gu(e)?e:e.replace($g,"-$&").toLowerCase()}),ou=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(Wg,function(r,n,i){return Bt={name:n,styles:i,next:Bt},n})}return Kg[e]!==1&&!Gu(e)&&typeof t=="number"&&t!==0?t+"px":t};function Vi(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 Bt={name:i.name,styles:i.styles,next:Bt},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)Bt={name:a.name,styles:a.styles,next:Bt},a=a.next;var s=o.styles+";";return s}return zg(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function zg(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Vi(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]+"}":iu(s)&&(n+=ns(o)+":"+ou(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var l=0;l<a.length;l++)iu(a[l])&&(n+=ns(o)+":"+ou(o,a[l])+";");else{var c=Vi(e,t,a);switch(o){case"animation":case"animationName":{n+=ns(o)+":"+c+";";break}default:n+=o+"{"+c+"}"}}}return n}var au=/label:\s*([^\s;{]+)\s*(;|$)/g,Bt;function is(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="";Bt=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=Vi(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=Vi(r,t,e[s]),n){var l=o;i+=l[s]}au.lastIndex=0;for(var c="",m;(m=au.exec(i))!==null;)c+="-"+m[1];var d=Vg(i)+c;return{name:d,styles:i,next:Bt}}function Ju(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}var Yg=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},Xg=function(e,t,r){Yg(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)}};function su(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function lu(e,t,r){var n=[],i=Ju(e,n,r);return n.length<2?r:i+t(n)}var Qg=function(e){var t=Hg(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=is(s,t.registered,void 0);return Xg(t,c),t.key+"-"+c.name},n=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=is(s,t.registered),m="animation-"+c.name;return su(t,{name:c.name,styles:"@keyframes "+m+"{"+c.styles+"}"}),m},i=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=is(s,t.registered);su(t,c)},o=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];return lu(t.registered,r,Zg(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:Ju.bind(null,t.registered),merge:lu.bind(null,t.registered,r)}},Zg=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},e_=Qg({key:"css"}),Pe=e_.css,ws,$e,os,cu,du=0,Fu=[],we=V,uu=we.__b,fu=we.__r,hu=we.diffed,pu=we.__c,mu=we.unmount,vu=we.__;function t_(e,t){we.__h&&we.__h($e,e,du||t),du=0;var r=$e.__H||($e.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function ju(e,t){var r=t_(ws++,7);return i_(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function r_(){for(var e;e=Fu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Mi),e.__H.__h.forEach(As),e.__H.__h=[]}catch(t){e.__H.__h=[],we.__e(t,e.__v)}}we.__b=function(e){$e=null,uu&&uu(e)},we.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),vu&&vu(e,t)},we.__r=function(e){fu&&fu(e),ws=0;var t=($e=e.__c).__H;t&&(os===$e?(t.__h=[],$e.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Mi),t.__h.forEach(As),t.__h=[],ws=0)),os=$e},we.diffed=function(e){hu&&hu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fu.push(t)!==1&&cu===we.requestAnimationFrame||((cu=we.requestAnimationFrame)||n_)(r_)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),os=$e=null},we.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Mi),r.__h=r.__h.filter(function(n){return!n.__||As(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],we.__e(n,r.__v)}}),pu&&pu(e,t)},we.unmount=function(e){mu&&mu(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Mi(n)}catch(i){t=i}}),r.__H=void 0,t&&we.__e(t,r.__v))};var gu=typeof requestAnimationFrame=="function";function n_(e){var t,r=function(){clearTimeout(n),gu&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);gu&&(t=requestAnimationFrame(r))}function Mi(e){var t=$e,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),$e=t}function As(e){var t=$e;e.__c=e.__(),$e=t}function i_(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var o_=Symbol.for("preact-signals");function eo(){if(Mt>1)Mt--;else{for(var e,t=!1;rn!==void 0;){var r=rn;for(rn=void 0,Es++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Hu(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Es=0,Mt--,t)throw e}}function he(e){if(Mt>0)return e();Mt++;try{return e()}finally{eo()}}var ae=void 0,rn=void 0,Mt=0,Es=0,Ki=0;function qu(e){if(ae!==void 0){var t=e.n;if(t===void 0||t.t!==ae)return t={i:0,S:e,p:ae.s,n:void 0,t:ae,e:void 0,x:void 0,r:t},ae.s!==void 0&&(ae.s.n=t),ae.s=t,e.n=t,32&ae.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=ae.s,t.n=void 0,ae.s.n=t,ae.s=t),t}}function Ce(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Ce.prototype.brand=o_;Ce.prototype.h=function(){return!0};Ce.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)};Ce.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)}};Ce.prototype.subscribe=function(e){var t=this;return fn(function(){var r=t.value,n=ae;ae=void 0;try{e(r)}finally{ae=n}})};Ce.prototype.valueOf=function(){return this.value};Ce.prototype.toString=function(){return this.value+""};Ce.prototype.toJSON=function(){return this.value};Ce.prototype.peek=function(){var e=ae;ae=void 0;try{return this.value}finally{ae=e}};Object.defineProperty(Ce.prototype,"value",{get:function(){var e=qu(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Es>100)throw new Error("Cycle detected");this.v=e,this.i++,Ki++,Mt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{eo()}}}});function z(e){return new Ce(e)}function Hu(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 Vu(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 Ku(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 wr(e){Ce.call(this,void 0),this.x=e,this.s=void 0,this.g=Ki-1,this.f=4}(wr.prototype=new Ce).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===Ki))return!0;if(this.g=Ki,this.f|=1,this.i>0&&!Hu(this))return this.f&=-2,!0;var e=ae;try{Vu(this),ae=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 ae=e,Ku(this),this.f&=-2,!0};wr.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)}Ce.prototype.S.call(this,e)};wr.prototype.U=function(e){if(this.t!==void 0&&(Ce.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)}};wr.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(wr.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=qu(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function nn(e){return new wr(e)}function $u(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Mt++;var r=ae;ae=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,Ks(e),n}finally{ae=r,eo()}}}function Ks(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,$u(e)}function a_(e){if(ae!==this)throw new Error("Out-of-order effect");Ku(this),ae=e,this.f&=-2,8&this.f&&Ks(this),eo()}function un(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}un.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()}};un.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,$u(this),Vu(this),Mt++;var e=ae;return ae=this,a_.bind(this,e)};un.prototype.N=function(){2&this.f||(this.f|=2,this.o=rn,rn=this)};un.prototype.d=function(){this.f|=8,1&this.f||Ks(this)};function fn(e){var t=new un(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Wu,as,zu=[];fn(function(){Wu=this.N})();function Ar(e,t){V[e]=t.bind(null,V[e]||function(){})}function $i(e){as&&as(),as=e&&e.S()}function Yu(e){var t=this,r=e.data,n=Xu(r);n.value=r;var i=ju(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=nn(function(){var p=n.value.value;return p===0?0:p===!0?"":p||""}),m=nn(function(){return!Array.isArray(c.value)&&!xa(c.value)}),d=fn(function(){if(this.N=Qu,m.value){var p=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=p)}}),h=t.__$u.d;return t.__$u.d=function(){d(),h.call(this)},[m,c]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}Yu.displayName="_st";Object.defineProperties(Ce.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Yu},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Ar("__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 Ce&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});Ar("__r",function(e,t){$i();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return fn(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),$i(r),e(t)});Ar("__e",function(e,t,r,n){$i(),e(t,r,n)});Ar("diffed",function(e,t){$i();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in n)&&(s.d(),o[a]=void 0)}else o={},r.U=o;for(var l in n){var c=o[l],m=n[l];c===void 0?(c=s_(r,l,m,i),o[l]=c):c.o(m,i)}}}e(t)});function s_(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=z(r);return{o:function(a,s){o.value=a,n=s},d:fn(function(){this.N=Qu;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}Ar("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)});Ar("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Ke.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};function Xu(e){return ju(function(){return z(e)},[])}var l_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function c_(){he(function(){for(var e;e=zu.shift();)Wu.call(e)})}function Qu(){zu.push(this)===1&&(V.requestAnimationFrame||l_)(c_)}var Ae=Pe`
|
|
9
|
+
-----END PUBLIC KEY-----`});function fc(e){let t="",r=new Uint8Array(e),n=r.byteLength;for(let i=0;i<n;i++)t+=String.fromCharCode(r[i]);return window.btoa(t)}function Ip(e){let t="-----BEGIN PUBLIC KEY-----",n=e.substring(e.indexOf(t)+t.length,e.indexOf("-----END PUBLIC KEY-----")).replace(/\s+/g,""),i=window.atob(n),o=new Uint8Array(i.length);for(let a=0;a<i.length;a++)o[a]=i.charCodeAt(a);return o.buffer}function hc(e){return A(this,null,function*(){let t=window.crypto,r=t.subtle,n=Ip(dc),i=yield r.importKey("spki",n,{name:"RSA-OAEP",hash:"SHA-1"},!1,["encrypt"]),o=t.getRandomValues(new Uint8Array(32)),a=yield r.importKey("raw",o,"AES-GCM",!1,["encrypt"]),s=yield r.encrypt({name:"RSA-OAEP"},i,o),l=fc(s),h={timestamp:Date.now(),data:e},p=new TextEncoder().encode(JSON.stringify(h)),m=t.getRandomValues(new Uint8Array(12)),b=yield r.encrypt({name:"AES-GCM",iv:m,tagLength:128},a,p),E=new Uint8Array(b),I=new Uint8Array(m.length+E.length);I.set(m,0),I.set(E,m.length);let w=fc(I.buffer);return{k:l,v:"1.0",payload:w}})}var pc=ie(()=>{"use strict";uc()});var Nn,mc=ie(()=>{"use strict";ge();cc();nr();pc();Nn=class extends Dn{constructor(r,n,i){super(n,i);this.httpClient=Qe.create();this.gameId=B.mpId,this.sessionId=B.sessionId,this.track=r}reporter(r){return A(this,null,function*(){let{event:n,params:i,extraParams:o}=r,a={eventType:n,gameInfo:Y({gameId:this.gameId,sessionId:this.sessionId},i)};o&&Object.assign(a,o);try{let s=yield hc(a);yield this.httpClient.post("/api/base/app-event/v2",{data:s})}catch(s){yield this.httpClient.post("/api/base/app-event",{data:a})}})}tracker(r,n=null){this.track(r,n)}}});var vc,Sp,Ee,Cp,Qo,Ze,vt=ie(()=>{"use strict";lc();$();$();Wo();Xo();mc();ge();$o();vc=Re(),Sp={type:tr.WebSDK,platform:"h5",jssdk_version:B.sdkInfo.jssdkVersion,mp_id:B.mpId,mp_version:B.mpVersion},{track:Ee,trackPerformance:Cp}=ic((...e)=>{var a,s,l,c;let[,t]=e,r=t,n=xl(r.extra)?r.extra:To(r.extra)?JSON.parse(r.extra):{},i=Ue(Y({},n),{mp_id:(a=r.mp_id)!=null?a:"",mp_version:(s=r.mp_version)!=null?s:""}),o={name:t.tag,type:Ft.System,location:null,target:null,extra:i,timestamp:Date.now(),userId:(c=(l=B.hostUserInfo)==null?void 0:l.uid)!=null?c:null};xn.trackEvent(o,tr.WebSDK)},Sp);vc.registerCommand("ReportSDK.traceSystemTimeline",({event:e,duration:t,extra:r})=>{Cp(e,t,r)});vc.registerCommand("ReportSDK.traceSystem",({event:e,info:t})=>{Ee(e,t)});Qo=new nt,Ze=new Nn(Ee,Qo)});function gc(e){let t=Po.config[e];return t||(t={},Po.config[e]=t),(r,n)=>{if(t[r]){Me.warn(`[can i use] ${r} already registered`);return}t[r]=Y({},n)}}var _c=ie(()=>{"use strict";$()});function Zo(e){yc=e}function Pn(e){return e===null||typeof e!="object"?e:Array.isArray(e)?e.map(t=>Pn(t)):Object.keys(e).reduce((t,r)=>(t[r]=Pn(e[r]),t),{})}function gt(e){return typeof e=="number"}function ea(e){let t=ta(e);switch(t){case"string":return`"${e}"`;case"number":case"boolean":case"null":case"undefined":return String(e);default:return`a(n) ${t}`}}function ta(e){return typeof e=="function"?"function":Object.prototype.toString.call(e).slice(8).slice(0,-1).toLowerCase()}var yc,_e,Ln,Un,Bn,Mn,ir,Gn,Jn,Fn,qn,jn,Hn,Vn,Kn,$n,Wn,zn,Yn,ra=ie(()=>{"use strict";yc=!1;_e=class{constructor(){this.errors=[];this.hasFallback=!1;this.hasDefault=!1;this._optional=!1}fail(t){if(yc)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 ${ea(t.actual)}`,this.errors.push(r)}return!1}fallback(t){return this.hasFallback=!0,this._fallback=t,this}get fallbackValue(){return Pn(this._fallback)}default(t){return this.hasDefault=!0,this._default=t,this}get defaultValue(){return typeof this._default=="function"?this._default:Pn(this._default)}optional(){return this._optional=!0,this}};Ln=class extends _e{validate(t){return this._optional&&t===void 0?!0:gt(t)?gt(this._min)&&t<this._min?this.fail(`the value of ${this.path} should be greater than or equal to ${this._min}`):gt(this._max)&&t>this._max?this.fail(`the value of ${this.path} should be less than or equal to ${this._max}`):gt(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}},Un=class extends _e{validate(t){return this._optional&&t===void 0?!0:typeof t!="boolean"?this.fail({expect:"boolean",actual:t}):!0}},Bn=class extends _e{validate(t){if(this._optional&&t===void 0)return!0;if(typeof t!="string")return this.fail({expect:"string",actual:t});if(gt(this._maxLength)&&t.length>this._maxLength)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxLength}`);if(gt(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}},Mn=class extends _e{validate(t){return this._optional&&t===void 0?!0:typeof t!="symbol"?this.fail({expect:"symbol",actual:t}):!0}},ir=class extends _e{validate(t){return!0}},Gn=class extends _e{validate(t){return t!==void 0?this.fail({expect:"undefined",actual:t}):!0}},Jn=class extends _e{validate(t){return this._optional&&t===void 0?!0:t!==null?this.fail({expect:"null",actual:t}):!0}},Fn=class extends _e{validate(t){return this._optional&&t===void 0?!0:typeof t!="function"?this.fail({expect:"function",actual:t}):!0}},qn=class extends _e{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 ${ea(t)}`)}return!0}},jn=class extends _e{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(gt(this._minItems)&&r.length<this._minItems)return this.fail(`the length of ${this.path} should be greater than or equal to ${this._minItems}`);if(gt(this._maxItems)&&r.length>this._maxItems)return this.fail(`the length of ${this.path} should be less than or equal to ${this._maxItems}`);if(gt(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}},Hn=class extends _e{constructor(r){super();this._value=r}validate(r){if(this._optional&&r===void 0)return!0;if(ta(r)!=="object")return this.fail({expect:"object",actual:r});let i=r,o=this._value;o.errors=this.errors;let a=!0;for(let s in i){let l=i[s];if(/^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/.test(s)?o.path=`${this.path}.${s}`:o.path=`${this.path}["${s}"]`,!(l===void 0&&o._optional)){if(l===void 0&&o.hasDefault){i[s]=o.defaultValue;continue}o.validate(l)||(o.hasFallback?i[s]=o.fallbackValue:a=!1)}}return a}},Vn=class extends _e{constructor(r={}){super();this._object=r}validate(r){if(this._optional&&r===void 0)return!0;if(ta(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}},Kn=class extends _e{constructor(r){super();this.value=r}validate(r){return r===void 0&&this._optional?!0:r!==this.value?this.fail({expect:ea(this.value),actual:r}):!0}},$n=class extends _e{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(`
|
|
10
|
+
or `);this.errors.push(o)}return n}},Wn=class extends _e{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}},zn=class extends _e{validate(t){return t===void 0&&this._optional||t instanceof ArrayBuffer?!0:this.fail({expect:"arraybuffer",actual:t})}},Yn=class extends _e{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 na(e,t,r="param"){if(e.errors=[],e.path=r,Zo(!0),!e.validate(t)){let n=e.errors.join(`
|
|
11
|
+
`);throw e.errors.length=0,Zo(!1),new TypeError(n)}}var j,ia=ie(()=>{"use strict";ra();ra();j={object(e){return new Vn(e)},array(e){return new jn(e)},tuple(...e){return new Wn(...e)},literal(e){return new Kn(e)},or(...e){return new $n(...e)},symbol(){return new Mn},record(e){return new Hn(e)},function(){return new Fn},boolean(){return new Un},string(){return new Bn},number(){return new Ln},undefined(){return new Gn},null(){return new Jn},unknown(){return new ir},any(){return new ir},as(){return new ir},arraybuffer(){return new zn},enum(...e){return new qn(...e)},typedarray(e){return new Yn(e)}}});var Xn,bc,wc=ie(()=>{"use strict";$();pt();ia();Ko();Xn=1,bc=e=>{function t(n,i){return(...o)=>{var d,p,m,b;let a=Date.now(),s={method:n,trace_id:Xn};Xn+=1;let l="SUCCESS",c=`${n}:ok`,h=0;try{if(i.paramsSchema)try{na(i.paramsSchema,o,"params")}catch(R){throw Vo(`${n}:fail ${R.message}`)}let E=i.implement(...o),I=E,w=`${n}:ok`;if(E&&"code"in E){let{code:R,data:k,message:P}=E;l=R,I=k,w=P}return{code:l,message:w,data:I}}catch(E){let I=E;h=(p=(d=I.code)!=null?d:I.errNo)!=null?p:2e3,l="FAILURE";let w=(b=(m=I.message)!=null?m:I.errMsg)!=null?b:`${E}`;return c=`${n}:${l} ${w.replace(/^\S+:(fail|cancel)\s?/,"")}`,Ve(new Rn(c,h)),{code:l,message:c}}finally{let E=Date.now()-a}}}function r(n,i){return(...o)=>A(this,null,function*(){var p,m,b,E;let a=Dl(o)?o:[o],s=Date.now(),l={method:n,trace_id:Xn};Xn+=1;let c=`${n}:ok`,h="SUCCESS",d={code:h,message:c};try{if(i.paramsSchema)try{na(i.paramsSchema,a,"params")}catch(R){throw Vo(R.message)}let w=yield i.implement(...a);if(w&&"code"in w){let{code:R,data:k,message:P}=w;h=R,c=P,w=k}return Object.assign(d,{code:h,message:c,data:w}),d}catch(I){let w=I,R=(m=(p=w.code)!=null?p:w.errNo)!=null?m:2e3;h="FAILURE";let k=(E=(b=w.message)!=null?b:w.errMsg)!=null?E:`${I}`,P=`${n}:${h} ${k.replace(/^\S+:(fail|cancel)\s?/,"")}`;return Object.assign(d,{code:h,message:P}),Ve(new Rn(P,R)),d}finally{let I=Date.now()-s}})}return{createAPI:r,createSyncAPI:t}}});var et,Ht,Ie,Lr=ie(()=>{"use strict";_c();vt();wc();ia();({createAPI:et,createSyncAPI:Ht}=bc(Ee)),Ie=gc("h5")});var Sc=bo((Ic,la)=>{(function(e){if(typeof Ic=="object"&&typeof la!="undefined")la.exports=e();else if(typeof define=="function"&&define.amd)define([],e);else{var t;typeof window!="undefined"?t=window:typeof global!="undefined"?t=global:typeof self!="undefined"?t=self:t=this,t.localforage=e()}})(function(){var e,t,r;return function n(i,o,a){function s(h,d){if(!o[h]){if(!i[h]){var p=typeof Tr=="function"&&Tr;if(!d&&p)return p(h,!0);if(l)return l(h,!0);var m=new Error("Cannot find module '"+h+"'");throw m.code="MODULE_NOT_FOUND",m}var b=o[h]={exports:{}};i[h][0].call(b.exports,function(E){var I=i[h][1][E];return s(I||E)},b,b.exports,n,i,o,a)}return o[h].exports}for(var l=typeof Tr=="function"&&Tr,c=0;c<a.length;c++)s(a[c]);return s}({1:[function(n,i,o){(function(a){"use strict";var s=a.MutationObserver||a.WebKitMutationObserver,l;if(s){var c=0,h=new s(E),d=a.document.createTextNode("");h.observe(d,{characterData:!0}),l=function(){d.data=c=++c%2}}else if(!a.setImmediate&&typeof a.MessageChannel!="undefined"){var p=new a.MessageChannel;p.port1.onmessage=E,l=function(){p.port2.postMessage(0)}}else"document"in a&&"onreadystatechange"in a.document.createElement("script")?l=function(){var w=a.document.createElement("script");w.onreadystatechange=function(){E(),w.onreadystatechange=null,w.parentNode.removeChild(w),w=null},a.document.documentElement.appendChild(w)}:l=function(){setTimeout(E,0)};var m,b=[];function E(){m=!0;for(var w,R,k=b.length;k;){for(R=b,b=[],w=-1;++w<k;)R[w]();k=b.length}m=!1}i.exports=I;function I(w){b.push(w)===1&&!m&&l()}}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{}],2:[function(n,i,o){"use strict";var a=n(1);function s(){}var l={},c=["REJECTED"],h=["FULFILLED"],d=["PENDING"];i.exports=p;function p(S){if(typeof S!="function")throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,S!==s&&I(this,S)}p.prototype.catch=function(S){return this.then(null,S)},p.prototype.then=function(S,D){if(typeof S!="function"&&this.state===h||typeof D!="function"&&this.state===c)return this;var F=new this.constructor(s);if(this.state!==d){var H=this.state===h?S:D;b(F,H,this.outcome)}else this.queue.push(new m(F,S,D));return F};function m(S,D,F){this.promise=S,typeof D=="function"&&(this.onFulfilled=D,this.callFulfilled=this.otherCallFulfilled),typeof F=="function"&&(this.onRejected=F,this.callRejected=this.otherCallRejected)}m.prototype.callFulfilled=function(S){l.resolve(this.promise,S)},m.prototype.otherCallFulfilled=function(S){b(this.promise,this.onFulfilled,S)},m.prototype.callRejected=function(S){l.reject(this.promise,S)},m.prototype.otherCallRejected=function(S){b(this.promise,this.onRejected,S)};function b(S,D,F){a(function(){var H;try{H=D(F)}catch(U){return l.reject(S,U)}H===S?l.reject(S,new TypeError("Cannot resolve promise with itself")):l.resolve(S,H)})}l.resolve=function(S,D){var F=w(E,D);if(F.status==="error")return l.reject(S,F.value);var H=F.value;if(H)I(S,H);else{S.state=h,S.outcome=D;for(var U=-1,J=S.queue.length;++U<J;)S.queue[U].callFulfilled(D)}return S},l.reject=function(S,D){S.state=c,S.outcome=D;for(var F=-1,H=S.queue.length;++F<H;)S.queue[F].callRejected(D);return S};function E(S){var D=S&&S.then;if(S&&(typeof S=="object"||typeof S=="function")&&typeof D=="function")return function(){D.apply(S,arguments)}}function I(S,D){var F=!1;function H(X){F||(F=!0,l.reject(S,X))}function U(X){F||(F=!0,l.resolve(S,X))}function J(){D(U,H)}var q=w(J);q.status==="error"&&H(q.value)}function w(S,D){var F={};try{F.value=S(D),F.status="success"}catch(H){F.status="error",F.value=H}return F}p.resolve=R;function R(S){return S instanceof this?S:l.resolve(new this(s),S)}p.reject=k;function k(S){var D=new this(s);return l.reject(D,S)}p.all=P;function P(S){var D=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var F=S.length,H=!1;if(!F)return this.resolve([]);for(var U=new Array(F),J=0,q=-1,X=new this(s);++q<F;)Q(S[q],q);return X;function Q(be,Z){D.resolve(be).then(Le,function(ft){H||(H=!0,l.reject(X,ft))});function Le(ft){U[Z]=ft,++J===F&&!H&&(H=!0,l.resolve(X,U))}}}p.race=M;function M(S){var D=this;if(Object.prototype.toString.call(S)!=="[object Array]")return this.reject(new TypeError("must be an array"));var F=S.length,H=!1;if(!F)return this.resolve([]);for(var U=-1,J=new this(s);++U<F;)q(S[U]);return J;function q(X){D.resolve(X).then(function(Q){H||(H=!0,l.resolve(J,Q))},function(Q){H||(H=!0,l.reject(J,Q))})}}},{1:1}],3:[function(n,i,o){(function(a){"use strict";typeof a.Promise!="function"&&(a.Promise=n(2))}).call(this,typeof global!="undefined"?global:typeof self!="undefined"?self:typeof window!="undefined"?window:{})},{2:2}],4:[function(n,i,o){"use strict";var a=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(u){return typeof u}:function(u){return u&&typeof Symbol=="function"&&u.constructor===Symbol&&u!==Symbol.prototype?"symbol":typeof u};function s(u,v){if(!(u instanceof v))throw new TypeError("Cannot call a class as a function")}function l(){try{if(typeof indexedDB!="undefined")return indexedDB;if(typeof webkitIndexedDB!="undefined")return webkitIndexedDB;if(typeof mozIndexedDB!="undefined")return mozIndexedDB;if(typeof OIndexedDB!="undefined")return OIndexedDB;if(typeof msIndexedDB!="undefined")return msIndexedDB}catch(u){return}}var c=l();function h(){try{if(!c||!c.open)return!1;var u=typeof openDatabase!="undefined"&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),v=typeof fetch=="function"&&fetch.toString().indexOf("[native code")!==-1;return(!u||v)&&typeof indexedDB!="undefined"&&typeof IDBKeyRange!="undefined"}catch(f){return!1}}function d(u,v){u=u||[],v=v||{};try{return new Blob(u,v)}catch(g){if(g.name!=="TypeError")throw g;for(var f=typeof BlobBuilder!="undefined"?BlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:WebKitBlobBuilder,_=new f,y=0;y<u.length;y+=1)_.append(u[y]);return _.getBlob(v.type)}}typeof Promise=="undefined"&&n(3);var p=Promise;function m(u,v){v&&u.then(function(f){v(null,f)},function(f){v(f)})}function b(u,v,f){typeof v=="function"&&u.then(v),typeof f=="function"&&u.catch(f)}function E(u){return typeof u!="string"&&(console.warn(u+" used as a key, but it is not a string."),u=String(u)),u}function I(){if(arguments.length&&typeof arguments[arguments.length-1]=="function")return arguments[arguments.length-1]}var w="local-forage-detect-blob-support",R=void 0,k={},P=Object.prototype.toString,M="readonly",S="readwrite";function D(u){for(var v=u.length,f=new ArrayBuffer(v),_=new Uint8Array(f),y=0;y<v;y++)_[y]=u.charCodeAt(y);return f}function F(u){return new p(function(v){var f=u.transaction(w,S),_=d([""]);f.objectStore(w).put(_,"key"),f.onabort=function(y){y.preventDefault(),y.stopPropagation(),v(!1)},f.oncomplete=function(){var y=navigator.userAgent.match(/Chrome\/(\d+)/),g=navigator.userAgent.match(/Edge\//);v(g||!y||parseInt(y[1],10)>=43)}}).catch(function(){return!1})}function H(u){return typeof R=="boolean"?p.resolve(R):F(u).then(function(v){return R=v,R})}function U(u){var v=k[u.name],f={};f.promise=new p(function(_,y){f.resolve=_,f.reject=y}),v.deferredOperations.push(f),v.dbReady?v.dbReady=v.dbReady.then(function(){return f.promise}):v.dbReady=f.promise}function J(u){var v=k[u.name],f=v.deferredOperations.pop();if(f)return f.resolve(),f.promise}function q(u,v){var f=k[u.name],_=f.deferredOperations.pop();if(_)return _.reject(v),_.promise}function X(u,v){return new p(function(f,_){if(k[u.name]=k[u.name]||el(),u.db)if(v)U(u),u.db.close();else return f(u.db);var y=[u.name];v&&y.push(u.version);var g=c.open.apply(c,y);v&&(g.onupgradeneeded=function(C){var O=g.result;try{O.createObjectStore(u.storeName),C.oldVersion<=1&&O.createObjectStore(w)}catch(T){if(T.name==="ConstraintError")console.warn('The database "'+u.name+'" has been upgraded from version '+C.oldVersion+" to version "+C.newVersion+', but the storage "'+u.storeName+'" already exists.');else throw T}}),g.onerror=function(C){C.preventDefault(),_(g.error)},g.onsuccess=function(){var C=g.result;C.onversionchange=function(O){O.target.close()},f(C),J(u)}})}function Q(u){return X(u,!1)}function be(u){return X(u,!0)}function Z(u,v){if(!u.db)return!0;var f=!u.db.objectStoreNames.contains(u.storeName),_=u.version<u.db.version,y=u.version>u.db.version;if(_&&(u.version!==v&&console.warn('The database "'+u.name+`" can't be downgraded from version `+u.db.version+" to version "+u.version+"."),u.version=u.db.version),y||f){if(f){var g=u.db.version+1;g>u.version&&(u.version=g)}return!0}return!1}function Le(u){return new p(function(v,f){var _=new FileReader;_.onerror=f,_.onloadend=function(y){var g=btoa(y.target.result||"");v({__local_forage_encoded_blob:!0,data:g,type:u.type})},_.readAsBinaryString(u)})}function ft(u){var v=D(atob(u.data));return d([v],{type:u.type})}function Rr(u){return u&&u.__local_forage_encoded_blob}function yn(u){var v=this,f=v._initReady().then(function(){var _=k[v._dbInfo.name];if(_&&_.dbReady)return _.dbReady});return b(f,u,u),f}function bn(u){U(u);for(var v=k[u.name],f=v.forages,_=0;_<f.length;_++){var y=f[_];y._dbInfo.db&&(y._dbInfo.db.close(),y._dbInfo.db=null)}return u.db=null,Q(u).then(function(g){return u.db=g,Z(u)?be(u):g}).then(function(g){u.db=v.db=g;for(var C=0;C<f.length;C++)f[C]._dbInfo.db=g}).catch(function(g){throw q(u,g),g})}function ht(u,v,f,_){_===void 0&&(_=1);try{var y=u.db.transaction(u.storeName,v);f(null,y)}catch(g){if(_>0&&(!u.db||g.name==="InvalidStateError"||g.name==="NotFoundError"))return p.resolve().then(function(){if(!u.db||g.name==="NotFoundError"&&!u.db.objectStoreNames.contains(u.storeName)&&u.version<=u.db.version)return u.db&&(u.version=u.db.version+1),be(u)}).then(function(){return bn(u).then(function(){ht(u,v,f,_-1)})}).catch(f);f(g)}}function el(){return{forages:[],db:null,dbReady:null,deferredOperations:[]}}function kf(u){var v=this,f={db:null};if(u)for(var _ in u)f[_]=u[_];var y=k[f.name];y||(y=el(),k[f.name]=y),y.forages.push(v),v._initReady||(v._initReady=v.ready,v.ready=yn);var g=[];function C(){return p.resolve()}for(var O=0;O<y.forages.length;O++){var T=y.forages[O];T!==v&&g.push(T._initReady().catch(C))}var x=y.forages.slice(0);return p.all(g).then(function(){return f.db=y.db,Q(f)}).then(function(N){return f.db=N,Z(f,v._defaultConfig.version)?be(f):N}).then(function(N){f.db=y.db=N,v._dbInfo=f;for(var G=0;G<x.length;G++){var W=x[G];W!==v&&(W._dbInfo.db=f.db,W._dbInfo.version=f.version)}})}function Of(u,v){var f=this;u=E(u);var _=new p(function(y,g){f.ready().then(function(){ht(f._dbInfo,M,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=T.get(u);x.onsuccess=function(){var N=x.result;N===void 0&&(N=null),Rr(N)&&(N=ft(N)),y(N)},x.onerror=function(){g(x.error)}}catch(N){g(N)}})}).catch(g)});return m(_,v),_}function Tf(u,v){var f=this,_=new p(function(y,g){f.ready().then(function(){ht(f._dbInfo,M,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=T.openCursor(),N=1;x.onsuccess=function(){var G=x.result;if(G){var W=G.value;Rr(W)&&(W=ft(W));var re=u(W,G.key,N++);re!==void 0?y(re):G.continue()}else y()},x.onerror=function(){g(x.error)}}catch(G){g(G)}})}).catch(g)});return m(_,v),_}function xf(u,v,f){var _=this;u=E(u);var y=new p(function(g,C){var O;_.ready().then(function(){return O=_._dbInfo,P.call(v)==="[object Blob]"?H(O.db).then(function(T){return T?v:Le(v)}):v}).then(function(T){ht(_._dbInfo,S,function(x,N){if(x)return C(x);try{var G=N.objectStore(_._dbInfo.storeName);T===null&&(T=void 0);var W=G.put(T,u);N.oncomplete=function(){T===void 0&&(T=null),g(T)},N.onabort=N.onerror=function(){var re=W.error?W.error:W.transaction.error;C(re)}}catch(re){C(re)}})}).catch(C)});return m(y,f),y}function Df(u,v){var f=this;u=E(u);var _=new p(function(y,g){f.ready().then(function(){ht(f._dbInfo,S,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=T.delete(u);O.oncomplete=function(){y()},O.onerror=function(){g(x.error)},O.onabort=function(){var N=x.error?x.error:x.transaction.error;g(N)}}catch(N){g(N)}})}).catch(g)});return m(_,v),_}function Nf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){ht(v._dbInfo,S,function(g,C){if(g)return y(g);try{var O=C.objectStore(v._dbInfo.storeName),T=O.clear();C.oncomplete=function(){_()},C.onabort=C.onerror=function(){var x=T.error?T.error:T.transaction.error;y(x)}}catch(x){y(x)}})}).catch(y)});return m(f,u),f}function Pf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){ht(v._dbInfo,M,function(g,C){if(g)return y(g);try{var O=C.objectStore(v._dbInfo.storeName),T=O.count();T.onsuccess=function(){_(T.result)},T.onerror=function(){y(T.error)}}catch(x){y(x)}})}).catch(y)});return m(f,u),f}function Lf(u,v){var f=this,_=new p(function(y,g){if(u<0){y(null);return}f.ready().then(function(){ht(f._dbInfo,M,function(C,O){if(C)return g(C);try{var T=O.objectStore(f._dbInfo.storeName),x=!1,N=T.openKeyCursor();N.onsuccess=function(){var G=N.result;if(!G){y(null);return}u===0||x?y(G.key):(x=!0,G.advance(u))},N.onerror=function(){g(N.error)}}catch(G){g(G)}})}).catch(g)});return m(_,v),_}function Uf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){ht(v._dbInfo,M,function(g,C){if(g)return y(g);try{var O=C.objectStore(v._dbInfo.storeName),T=O.openKeyCursor(),x=[];T.onsuccess=function(){var N=T.result;if(!N){_(x);return}x.push(N.key),N.continue()},T.onerror=function(){y(T.error)}}catch(N){y(N)}})}).catch(y)});return m(f,u),f}function Bf(u,v){v=I.apply(this,arguments);var f=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||f.name,u.storeName=u.storeName||f.storeName);var _=this,y;if(!u.name)y=p.reject("Invalid arguments");else{var g=u.name===f.name&&_._dbInfo.db,C=g?p.resolve(_._dbInfo.db):Q(u).then(function(O){var T=k[u.name],x=T.forages;T.db=O;for(var N=0;N<x.length;N++)x[N]._dbInfo.db=O;return O});u.storeName?y=C.then(function(O){if(O.objectStoreNames.contains(u.storeName)){var T=O.version+1;U(u);var x=k[u.name],N=x.forages;O.close();for(var G=0;G<N.length;G++){var W=N[G];W._dbInfo.db=null,W._dbInfo.version=T}var re=new p(function(ne,ve){var pe=c.open(u.name,T);pe.onerror=function(ze){var Or=pe.result;Or.close(),ve(ze)},pe.onupgradeneeded=function(){var ze=pe.result;ze.deleteObjectStore(u.storeName)},pe.onsuccess=function(){var ze=pe.result;ze.close(),ne(ze)}});return re.then(function(ne){x.db=ne;for(var ve=0;ve<N.length;ve++){var pe=N[ve];pe._dbInfo.db=ne,J(pe._dbInfo)}}).catch(function(ne){throw(q(u,ne)||p.resolve()).catch(function(){}),ne})}}):y=C.then(function(O){U(u);var T=k[u.name],x=T.forages;O.close();for(var N=0;N<x.length;N++){var G=x[N];G._dbInfo.db=null}var W=new p(function(re,ne){var ve=c.deleteDatabase(u.name);ve.onerror=function(){var pe=ve.result;pe&&pe.close(),ne(ve.error)},ve.onblocked=function(){console.warn('dropInstance blocked for database "'+u.name+'" until all open connections are closed')},ve.onsuccess=function(){var pe=ve.result;pe&&pe.close(),re(pe)}});return W.then(function(re){T.db=re;for(var ne=0;ne<x.length;ne++){var ve=x[ne];J(ve._dbInfo)}}).catch(function(re){throw(q(u,re)||p.resolve()).catch(function(){}),re})})}return m(y,v),y}var Mf={_driver:"asyncStorage",_initStorage:kf,_support:h(),iterate:Tf,getItem:Of,setItem:xf,removeItem:Df,clear:Nf,length:Pf,key:Lf,keys:Uf,dropInstance:Bf};function Gf(){return typeof openDatabase=="function"}var Tt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Jf="~~local_forage_type~",tl=/^~~local_forage_type~([^~]+)~/,wn="__lfsc__:",lo=wn.length,co="arbf",uo="blob",rl="si08",nl="ui08",il="uic8",ol="si16",al="si32",sl="ur16",ll="ui32",cl="fl32",dl="fl64",ul=lo+co.length,fl=Object.prototype.toString;function hl(u){var v=u.length*.75,f=u.length,_,y=0,g,C,O,T;u[u.length-1]==="="&&(v--,u[u.length-2]==="="&&v--);var x=new ArrayBuffer(v),N=new Uint8Array(x);for(_=0;_<f;_+=4)g=Tt.indexOf(u[_]),C=Tt.indexOf(u[_+1]),O=Tt.indexOf(u[_+2]),T=Tt.indexOf(u[_+3]),N[y++]=g<<2|C>>4,N[y++]=(C&15)<<4|O>>2,N[y++]=(O&3)<<6|T&63;return x}function fo(u){var v=new Uint8Array(u),f="",_;for(_=0;_<v.length;_+=3)f+=Tt[v[_]>>2],f+=Tt[(v[_]&3)<<4|v[_+1]>>4],f+=Tt[(v[_+1]&15)<<2|v[_+2]>>6],f+=Tt[v[_+2]&63];return v.length%3===2?f=f.substring(0,f.length-1)+"=":v.length%3===1&&(f=f.substring(0,f.length-2)+"=="),f}function Ff(u,v){var f="";if(u&&(f=fl.call(u)),u&&(f==="[object ArrayBuffer]"||u.buffer&&fl.call(u.buffer)==="[object ArrayBuffer]")){var _,y=wn;u instanceof ArrayBuffer?(_=u,y+=co):(_=u.buffer,f==="[object Int8Array]"?y+=rl:f==="[object Uint8Array]"?y+=nl:f==="[object Uint8ClampedArray]"?y+=il:f==="[object Int16Array]"?y+=ol:f==="[object Uint16Array]"?y+=sl:f==="[object Int32Array]"?y+=al:f==="[object Uint32Array]"?y+=ll:f==="[object Float32Array]"?y+=cl:f==="[object Float64Array]"?y+=dl:v(new Error("Failed to get type for BinaryArray"))),v(y+fo(_))}else if(f==="[object Blob]"){var g=new FileReader;g.onload=function(){var C=Jf+u.type+"~"+fo(this.result);v(wn+uo+C)},g.readAsArrayBuffer(u)}else try{v(JSON.stringify(u))}catch(C){console.error("Couldn't convert value into a JSON string: ",u),v(null,C)}}function qf(u){if(u.substring(0,lo)!==wn)return JSON.parse(u);var v=u.substring(ul),f=u.substring(lo,ul),_;if(f===uo&&tl.test(v)){var y=v.match(tl);_=y[1],v=v.substring(y[0].length)}var g=hl(v);switch(f){case co:return g;case uo:return d([g],{type:_});case rl:return new Int8Array(g);case nl:return new Uint8Array(g);case il:return new Uint8ClampedArray(g);case ol:return new Int16Array(g);case sl:return new Uint16Array(g);case al:return new Int32Array(g);case ll:return new Uint32Array(g);case cl:return new Float32Array(g);case dl:return new Float64Array(g);default:throw new Error("Unkown type: "+f)}}var ho={serialize:Ff,deserialize:qf,stringToBuffer:hl,bufferToString:fo};function pl(u,v,f,_){u.executeSql("CREATE TABLE IF NOT EXISTS "+v.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],f,_)}function jf(u){var v=this,f={db:null};if(u)for(var _ in u)f[_]=typeof u[_]!="string"?u[_].toString():u[_];var y=new p(function(g,C){try{f.db=openDatabase(f.name,String(f.version),f.description,f.size)}catch(O){return C(O)}f.db.transaction(function(O){pl(O,f,function(){v._dbInfo=f,g()},function(T,x){C(x)})},C)});return f.serializer=ho,y}function xt(u,v,f,_,y,g){u.executeSql(f,_,y,function(C,O){O.code===O.SYNTAX_ERR?C.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[v.storeName],function(T,x){x.rows.length?g(T,O):pl(T,v,function(){T.executeSql(f,_,y,g)},g)},g):g(C,O)},g)}function Hf(u,v){var f=this;u=E(u);var _=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){xt(O,C,"SELECT * FROM "+C.storeName+" WHERE key = ? LIMIT 1",[u],function(T,x){var N=x.rows.length?x.rows.item(0).value:null;N&&(N=C.serializer.deserialize(N)),y(N)},function(T,x){g(x)})})}).catch(g)});return m(_,v),_}function Vf(u,v){var f=this,_=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){xt(O,C,"SELECT * FROM "+C.storeName,[],function(T,x){for(var N=x.rows,G=N.length,W=0;W<G;W++){var re=N.item(W),ne=re.value;if(ne&&(ne=C.serializer.deserialize(ne)),ne=u(ne,re.key,W+1),ne!==void 0){y(ne);return}}y()},function(T,x){g(x)})})}).catch(g)});return m(_,v),_}function ml(u,v,f,_){var y=this;u=E(u);var g=new p(function(C,O){y.ready().then(function(){v===void 0&&(v=null);var T=v,x=y._dbInfo;x.serializer.serialize(v,function(N,G){G?O(G):x.db.transaction(function(W){xt(W,x,"INSERT OR REPLACE INTO "+x.storeName+" (key, value) VALUES (?, ?)",[u,N],function(){C(T)},function(re,ne){O(ne)})},function(W){if(W.code===W.QUOTA_ERR){if(_>0){C(ml.apply(y,[u,T,f,_-1]));return}O(W)}})})}).catch(O)});return m(g,f),g}function Kf(u,v,f){return ml.apply(this,[u,v,f,1])}function $f(u,v){var f=this;u=E(u);var _=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){xt(O,C,"DELETE FROM "+C.storeName+" WHERE key = ?",[u],function(){y()},function(T,x){g(x)})})}).catch(g)});return m(_,v),_}function Wf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){xt(C,g,"DELETE FROM "+g.storeName,[],function(){_()},function(O,T){y(T)})})}).catch(y)});return m(f,u),f}function zf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){xt(C,g,"SELECT COUNT(key) as c FROM "+g.storeName,[],function(O,T){var x=T.rows.item(0).c;_(x)},function(O,T){y(T)})})}).catch(y)});return m(f,u),f}function Yf(u,v){var f=this,_=new p(function(y,g){f.ready().then(function(){var C=f._dbInfo;C.db.transaction(function(O){xt(O,C,"SELECT key FROM "+C.storeName+" WHERE id = ? LIMIT 1",[u+1],function(T,x){var N=x.rows.length?x.rows.item(0).key:null;y(N)},function(T,x){g(x)})})}).catch(g)});return m(_,v),_}function Xf(u){var v=this,f=new p(function(_,y){v.ready().then(function(){var g=v._dbInfo;g.db.transaction(function(C){xt(C,g,"SELECT key FROM "+g.storeName,[],function(O,T){for(var x=[],N=0;N<T.rows.length;N++)x.push(T.rows.item(N).key);_(x)},function(O,T){y(T)})})}).catch(y)});return m(f,u),f}function Qf(u){return new p(function(v,f){u.transaction(function(_){_.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(y,g){for(var C=[],O=0;O<g.rows.length;O++)C.push(g.rows.item(O).name);v({db:u,storeNames:C})},function(y,g){f(g)})},function(_){f(_)})})}function Zf(u,v){v=I.apply(this,arguments);var f=this.config();u=typeof u!="function"&&u||{},u.name||(u.name=u.name||f.name,u.storeName=u.storeName||f.storeName);var _=this,y;return u.name?y=new p(function(g){var C;u.name===f.name?C=_._dbInfo.db:C=openDatabase(u.name,"","",0),u.storeName?g({db:C,storeNames:[u.storeName]}):g(Qf(C))}).then(function(g){return new p(function(C,O){g.db.transaction(function(T){function x(re){return new p(function(ne,ve){T.executeSql("DROP TABLE IF EXISTS "+re,[],function(){ne()},function(pe,ze){ve(ze)})})}for(var N=[],G=0,W=g.storeNames.length;G<W;G++)N.push(x(g.storeNames[G]));p.all(N).then(function(){C()}).catch(function(re){O(re)})},function(T){O(T)})})}):y=p.reject("Invalid arguments"),m(y,v),y}var eh={_driver:"webSQLStorage",_initStorage:jf,_support:Gf(),iterate:Vf,getItem:Hf,setItem:Kf,removeItem:$f,clear:Wf,length:zf,key:Yf,keys:Xf,dropInstance:Zf};function th(){try{return typeof localStorage!="undefined"&&"setItem"in localStorage&&!!localStorage.setItem}catch(u){return!1}}function vl(u,v){var f=u.name+"/";return u.storeName!==v.storeName&&(f+=u.storeName+"/"),f}function rh(){var u="_localforage_support_test";try{return localStorage.setItem(u,!0),localStorage.removeItem(u),!1}catch(v){return!0}}function nh(){return!rh()||localStorage.length>0}function ih(u){var v=this,f={};if(u)for(var _ in u)f[_]=u[_];return f.keyPrefix=vl(u,v._defaultConfig),nh()?(v._dbInfo=f,f.serializer=ho,p.resolve()):p.reject()}function oh(u){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo.keyPrefix,y=localStorage.length-1;y>=0;y--){var g=localStorage.key(y);g.indexOf(_)===0&&localStorage.removeItem(g)}});return m(f,u),f}function ah(u,v){var f=this;u=E(u);var _=f.ready().then(function(){var y=f._dbInfo,g=localStorage.getItem(y.keyPrefix+u);return g&&(g=y.serializer.deserialize(g)),g});return m(_,v),_}function sh(u,v){var f=this,_=f.ready().then(function(){for(var y=f._dbInfo,g=y.keyPrefix,C=g.length,O=localStorage.length,T=1,x=0;x<O;x++){var N=localStorage.key(x);if(N.indexOf(g)===0){var G=localStorage.getItem(N);if(G&&(G=y.serializer.deserialize(G)),G=u(G,N.substring(C),T++),G!==void 0)return G}}});return m(_,v),_}function lh(u,v){var f=this,_=f.ready().then(function(){var y=f._dbInfo,g;try{g=localStorage.key(u)}catch(C){g=null}return g&&(g=g.substring(y.keyPrefix.length)),g});return m(_,v),_}function ch(u){var v=this,f=v.ready().then(function(){for(var _=v._dbInfo,y=localStorage.length,g=[],C=0;C<y;C++){var O=localStorage.key(C);O.indexOf(_.keyPrefix)===0&&g.push(O.substring(_.keyPrefix.length))}return g});return m(f,u),f}function dh(u){var v=this,f=v.keys().then(function(_){return _.length});return m(f,u),f}function uh(u,v){var f=this;u=E(u);var _=f.ready().then(function(){var y=f._dbInfo;localStorage.removeItem(y.keyPrefix+u)});return m(_,v),_}function fh(u,v,f){var _=this;u=E(u);var y=_.ready().then(function(){v===void 0&&(v=null);var g=v;return new p(function(C,O){var T=_._dbInfo;T.serializer.serialize(v,function(x,N){if(N)O(N);else try{localStorage.setItem(T.keyPrefix+u,x),C(g)}catch(G){(G.name==="QuotaExceededError"||G.name==="NS_ERROR_DOM_QUOTA_REACHED")&&O(G),O(G)}})})});return m(y,f),y}function hh(u,v){if(v=I.apply(this,arguments),u=typeof u!="function"&&u||{},!u.name){var f=this.config();u.name=u.name||f.name,u.storeName=u.storeName||f.storeName}var _=this,y;return u.name?y=new p(function(g){u.storeName?g(vl(u,_._defaultConfig)):g(u.name+"/")}).then(function(g){for(var C=localStorage.length-1;C>=0;C--){var O=localStorage.key(C);O.indexOf(g)===0&&localStorage.removeItem(O)}}):y=p.reject("Invalid arguments"),m(y,v),y}var ph={_driver:"localStorageWrapper",_initStorage:ih,_support:th(),iterate:sh,getItem:ah,setItem:fh,removeItem:uh,clear:oh,length:dh,key:lh,keys:ch,dropInstance:hh},mh=function(v,f){return v===f||typeof v=="number"&&typeof f=="number"&&isNaN(v)&&isNaN(f)},vh=function(v,f){for(var _=v.length,y=0;y<_;){if(mh(v[y],f))return!0;y++}return!1},gl=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"},kr={},_l={},Zt={INDEXEDDB:Mf,WEBSQL:eh,LOCALSTORAGE:ph},gh=[Zt.INDEXEDDB._driver,Zt.WEBSQL._driver,Zt.LOCALSTORAGE._driver],An=["dropInstance"],po=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(An),_h={description:"",driver:gh.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function yh(u,v){u[v]=function(){var f=arguments;return u.ready().then(function(){return u[v].apply(u,f)})}}function mo(){for(var u=1;u<arguments.length;u++){var v=arguments[u];if(v)for(var f in v)v.hasOwnProperty(f)&&(gl(v[f])?arguments[0][f]=v[f].slice():arguments[0][f]=v[f])}return arguments[0]}var bh=function(){function u(v){s(this,u);for(var f in Zt)if(Zt.hasOwnProperty(f)){var _=Zt[f],y=_._driver;this[f]=y,kr[y]||this.defineDriver(_)}this._defaultConfig=mo({},_h),this._config=mo({},this._defaultConfig,v),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return u.prototype.config=function(f){if((typeof f=="undefined"?"undefined":a(f))==="object"){if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var _ in f){if(_==="storeName"&&(f[_]=f[_].replace(/\W/g,"_")),_==="version"&&typeof f[_]!="number")return new Error("Database version must be a number.");this._config[_]=f[_]}return"driver"in f&&f.driver?this.setDriver(this._config.driver):!0}else return typeof f=="string"?this._config[f]:this._config},u.prototype.defineDriver=function(f,_,y){var g=new p(function(C,O){try{var T=f._driver,x=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!f._driver){O(x);return}for(var N=po.concat("_initStorage"),G=0,W=N.length;G<W;G++){var re=N[G],ne=!vh(An,re);if((ne||f[re])&&typeof f[re]!="function"){O(x);return}}var ve=function(){for(var Or=function(Eh){return function(){var Ih=new Error("Method "+Eh+" is not implemented by the current driver"),yl=p.reject(Ih);return m(yl,arguments[arguments.length-1]),yl}},vo=0,Ah=An.length;vo<Ah;vo++){var go=An[vo];f[go]||(f[go]=Or(go))}};ve();var pe=function(Or){kr[T]&&console.info("Redefining LocalForage driver: "+T),kr[T]=f,_l[T]=Or,C()};"_support"in f?f._support&&typeof f._support=="function"?f._support().then(pe,O):pe(!!f._support):pe(!0)}catch(ze){O(ze)}});return b(g,_,y),g},u.prototype.driver=function(){return this._driver||null},u.prototype.getDriver=function(f,_,y){var g=kr[f]?p.resolve(kr[f]):p.reject(new Error("Driver not found."));return b(g,_,y),g},u.prototype.getSerializer=function(f){var _=p.resolve(ho);return b(_,f),_},u.prototype.ready=function(f){var _=this,y=_._driverSet.then(function(){return _._ready===null&&(_._ready=_._initDriver()),_._ready});return b(y,f,f),y},u.prototype.setDriver=function(f,_,y){var g=this;gl(f)||(f=[f]);var C=this._getSupportedDrivers(f);function O(){g._config.driver=g.driver()}function T(G){return g._extend(G),O(),g._ready=g._initStorage(g._config),g._ready}function x(G){return function(){var W=0;function re(){for(;W<G.length;){var ne=G[W];return W++,g._dbInfo=null,g._ready=null,g.getDriver(ne).then(T).catch(re)}O();var ve=new Error("No available storage method found.");return g._driverSet=p.reject(ve),g._driverSet}return re()}}var N=this._driverSet!==null?this._driverSet.catch(function(){return p.resolve()}):p.resolve();return this._driverSet=N.then(function(){var G=C[0];return g._dbInfo=null,g._ready=null,g.getDriver(G).then(function(W){g._driver=W._driver,O(),g._wrapLibraryMethodsWithReady(),g._initDriver=x(C)})}).catch(function(){O();var G=new Error("No available storage method found.");return g._driverSet=p.reject(G),g._driverSet}),b(this._driverSet,_,y),this._driverSet},u.prototype.supports=function(f){return!!_l[f]},u.prototype._extend=function(f){mo(this,f)},u.prototype._getSupportedDrivers=function(f){for(var _=[],y=0,g=f.length;y<g;y++){var C=f[y];this.supports(C)&&_.push(C)}return _},u.prototype._wrapLibraryMethodsWithReady=function(){for(var f=0,_=po.length;f<_;f++)yh(this,po[f])},u.prototype.createInstance=function(f){return new u(f)},u}(),wh=new bh;i.exports=wh},{3:3}]},{},[4])(4)})});var Rc=bo(or=>{"use strict";$();Lr();vt();var Br=(e,t)=>{let r=window.parent;r&&r!==window&&typeof r.postMessage=="function"&&r.postMessage({type:e,data:t},"*")},Mr=Re(),Hp=et("levelFinished",{paramsSchema:j.tuple(j.object({levelId:j.or(j.string(),j.number()),duration:j.number().optional(),rating:j.number().optional(),score:j.number().optional(),variation:j.string().optional()})),implement:e=>A(or,null,function*(){let{levelId:t,duration:r,rating:n,score:i,variation:o}=e;Me.info("onLevelFinished",r,n,i,o),Br("JOLIBOX_GAME_TASK_LEVEL_FINISHED",{levelId:t,duration:r,rating:n,score:i,variation:o}),yield Promise.all([Ze.reporter({event:"COMPLETE_GAME_LEVEL",extraParams:{inGameInfo:{levelId:t,duration:r,rating:n,score:i}}}),Ze.tracker("LevelFinished",{levelId:t,duration:r,rating:n,score:i,variation:o})])})}),Vp=et("gamePlayEnded",{paramsSchema:j.tuple(j.object({duration:j.number().optional(),rating:j.number().optional(),score:j.number(),variation:j.string().optional()})),implement:e=>A(or,null,function*(){let{duration:t,rating:r,score:n,variation:i}=e;Me.info("onGamePlayEnded",t,r,n,i),Br("JOLIBOX_GAME_TASK_GAME_PLAY_ENDED",{duration:t,rating:r,score:n,variation:i}),yield Promise.all([Ze.tracker("GamePlayEnded",{duration:t,rating:r,score:n,variation:i}),Ze.reporter({event:"GAME_ENDED",extraParams:{inGameInfo:{duration:t,rating:r,score:n}}})])})}),Kp=et("levelUpgrade",{paramsSchema:j.tuple(j.object({levelId:j.or(j.string(),j.number()),name:j.string().optional()})),implement:r=>A(or,[r],function*({levelId:e,name:t}){Me.info("onLevelUpgrade",e,t),Br("JOLIBOX_GAME_TASK_LEVEL_UPGRADE",{levelId:e,name:t}),yield Promise.all([Ze.tracker("LevelUpgrade",{name:t,levelId:e}),Ze.reporter({event:"GAME_LEVEL_UP",extraParams:{inGameInfo:{levelId:e,levelName:t}}})])})}),$p=et("levelStart",{paramsSchema:j.tuple(j.object({levelId:j.or(j.string(),j.number())})),implement:e=>A(or,null,function*(){let{levelId:t}=e;Me.info("onLevelStart",t),Br("JOLIBOX_GAME_TASK_LEVEL_START",{levelId:t}),yield Ze.tracker("LevelStart",{levelId:t})})}),Wp=et("levelFailed",{paramsSchema:j.tuple(j.object({levelId:j.or(j.string(),j.number()),score:j.number().optional(),rating:j.number().optional(),duration:j.number().optional()})),implement:e=>A(or,null,function*(){let{levelId:t,score:r,rating:n,duration:i}=e;Me.info("onLevelFailed",t,r,n,i),Br("JOLIBOX_GAME_TASK_LEVEL_FAILED",{levelId:t,score:r,rating:n,duration:i}),yield Ze.tracker("LevelFailed",{levelId:t,score:r,rating:n,duration:i})})});Mr.registerCommand("TaskTrackerSDK.levelFinished",Hp);Mr.registerCommand("TaskTrackerSDK.gamePlayEnded",Vp);Mr.registerCommand("TaskTrackerSDK.levelUpgrade",Kp);Mr.registerCommand("TaskTrackerSDK.levelStart",$p);Mr.registerCommand("TaskTrackerSDK.levelFailed",Wp);Ie("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"}}});Ie("TaskTrackerSDK.onGamePlayEnded",{version:"1.1.25",properties:{params:{duration:"1.1.25",rating:"1.1.25",score:"1.1.25",variation:"1.1.50"}}});Ie("TaskTrackerSDK.onLevelUpgrade",{version:"1.1.25",properties:{params:{levelId:"1.1.25",name:"1.1.25"}}});Ie("TaskTrackerSDK.onLevelStart",{version:"1.3.8",properties:{params:{levelId:"1.3.8"}}});Ie("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 Je,ar,kc,da,zp,Vt,Gr=ie(()=>{"use strict";Je=(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}},"*")},ar=new Map,kc=e=>{if(e.source===window.parent)try{let t=e.data;if(t&&t.type){let r=ar.get(t.type);r&&r.forEach(n=>{try{n(t.data)}catch(i){console.warn("Callback execution failed:",i)}})}}catch(t){console.warn("Failed to parse message:",t)}},da=!1,zp=()=>{da||(window.addEventListener("message",kc),da=!0)},Vt=(e,t)=>{zp(),ar.has(e)||ar.set(e,new Set);let r=ar.get(e);return r.add(t),()=>{r.delete(t),r.size===0&&ar.delete(e),ar.size===0&&(window.removeEventListener("message",kc),da=!1)}}});var ri,ni,ii,oi,ai,ua,si,li,ci,di,sr,Yp,oe,_t,yt,Fe=ie(()=>{"use strict";$();ri="UNLOCK_OPTIONS_CHANGED",ni="INVOKE_PAYMENT",ii="ON_PAYMENT_RESULT",oi="ON_USE_MODAL_EVENT",ai="ON_USE_MODAL_RESULT",ua="ON_USE_MODAL_FREQUENCY",si="ON_USE_UNLOGIN_MODAL_EVENT",li="INVOKE_UNLOGIN_MODAL_EVENT",ci="INVOKE_SUBSCRIPTION_EVENT",di="ON_USE_SUBSCRIPTION_RESULT",sr=new nt,Yp=()=>({on:sr.on.bind(sr),off:sr.off.bind(sr),emit:sr.emit.bind(sr)}),oe=Yp(),_t={charge:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},useJolicoin:{dailyMaxPopUps:2,minInterval:8*60*60*1e3},joinMember:{dailyMaxPopUps:2,minInterval:8*60*60*1e3}},yt={show:!0,minInterval:8*60*60*1e3}});var lf=bo(ro=>{"use strict";ge();Fe();Gr();$();var sf={USE_COIN:"CONFIRM",ADS:"FAILED",CANCEL:"CANCEL"};Vt("ON_JOLIBOX_JOLI_COIN_USE_RESULT",e=>{console.log("onCustomEvent ON_JOLIBOX_JOLI_COIN_USE_RESULT",sf[e.result],e.result),oe.emit(ai,{useModalResult:sf[e.result]})});oe.on(oi,(e,t)=>{var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Je("JOLIBOX_JOLI_COIN_USE_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:Xe()})});Vt("ON_JOLIBOX_TOPUP_JOLI_COIN_RESULT",e=>{oe.emit(ii,{paymentResult:e.result=="ADS"?"FAILED":e.result,userJoliCoin:e.joliCoin,currency:"JOLI_COIN"})});oe.on(ni,(e,t)=>A(ro,null,function*(){var r;e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Je("JOLIBOX_TOPUP_EVENT",{JOLI_COIN:{quantity:t.quantity,balance:t.userCurrency.balance,enableAutoDeduct:t.enableAutoDeduct},type:e,sequenceId:(r=t.sequenceId)!=null?r:Xe()})}));Vt("ON_JOLIBOX_JOLI_UNLOGIN_MODAL_RESULT_EVENT",e=>{var t,r,n,i,o;oe.emit(si,{result:e.result=="ADS"?"FAILED":e.result,rewards:{claimedRewardValue:(i=(n=(r=(t=e.extra)==null?void 0:t.firstLogin)==null?void 0:r.reward)==null?void 0:n.rewardValue)!=null?i:0,isFirstLogin:(o=e.isFirstLogin)!=null?o:!1}}),e.result==="SUCCESS"&&B.onEnvConfigChanged({hostUserInfo:{isLogin:!0}})});oe.on(li,e=>A(ro,null,function*(){e=="ADS-JOLI_GEM"||e=="JOLI_GEM"||Je("JOLIBOX_JOLI_UNLOGIN_MODAL_EVENT",{sequenceId:Xe(),type:e})}));Vt("ON_JOLIBOX_SUB_RESULT_EVENT",e=>{console.log("----on custom event ON_JOLIBOX_SUB_RESULT_EVENT-----",e),oe.emit(di,{result:e.result})});oe.on(ci,e=>A(ro,null,function*(){console.log("----notify custom event-----",e),Je("JOLIBOX_SUB_EVENT",{sequenceId:Xe()})}))});vt();ge();Lr();$();var Ac=Re(),kp="env",Op="getSystemInfoSync",Tp=()=>{var i,o,a,s;let e={system:B.deviceInfo.system,platform:B.deviceInfo.platform.toLowerCase(),brand:B.deviceInfo.brand,pixelRatio:B.deviceInfo.pixelRatio,language:B.deviceInfo.lang,version:B.sdkInfo.jssdkVersion,appName:(i=B.hostInfo)==null?void 0:i.appName,SDKVersion:B.sdkInfo.nativeSDKVersion},t=(o=B.hostInfo)==null?void 0:o.version;t&&(e=Ue(Y({},e),{version:t}));let r=(a=B.hostInfo)==null?void 0:a.appName;r&&(e=Ue(Y({},e),{appName:r}));let n=(s=B.sdkInfo)==null?void 0:s.jssdkVersion;return n&&(e=Ue(Y({},e),{SDKVersion:n})),e},xp=Ht(Op,{implement:Tp}),Dp=Ht(kp,{implement:()=>Ue(Y({},B.hostInfo),{sdkInfo:B.sdkInfo,platform:B.platform,deviceInfo:B.deviceInfo})});Ac.registerCommand("API.env",Dp);Ac.registerCommand("API.getSystemInfoSync",xp);Ie("env",{version:"1.0.0"});Ie("getSystemInfoSync",{version:"1.0.0"});$();Lr();pt();vt();var Np="onJoliboxShow",Pp="onJoliboxHide",Lp="onReady",aa=Re(),sa=Gl(Ve),oa=!0,Ur=!0,Qn=0,Zn=Qo;function Up(){let e=Date.now();if(e-Qn<100)return;Qn=e;let t=document.visibilityState==="visible";t!==oa&&(oa=t,Zn.emit("visible",oa))}function Ec(e){let t=Date.now();t-Qn<100||(Qn=t,e==="focus"&&!Ur?Ur=!0:e==="blur"&&Ur&&(Ur=!1),Zn.emit("visible",Ur))}document.addEventListener("visibilitychange",Up);window.addEventListener("focus",()=>Ec("focus"));window.addEventListener("blur",()=>Ec("blur"));var Bp=Ht(Np,{paramsSchema:j.tuple(j.function()),implement(e){let t=sa(e);Zn.on("visible",r=>{r&&t()})}}),Mp=Ht(Pp,{paramsSchema:j.tuple(j.function()),implement(e){let t=sa(e);Zn.on("visible",r=>{!r&&t()})}}),Gp=Ht(Lp,{paramsSchema:j.tuple(j.function()),implement(e){let t=sa(e);Dt.on("LifecycleEvent.onReady",r=>{t(r)})}});aa.registerCommand("LifecycleSDK.onReady",Gp);aa.registerCommand("LifecycleSDK.onJoliboxShow",Bp);aa.registerCommand("LifecycleSDK.onJoliboxHide",Mp);Ie("lifeCycle.onReady",{version:"1.0.0"});Ie("lifeCycle.onJoliboxShow",{version:"1.0.0"});Ie("lifeCycle.onJoliboxHide",{version:"1.0.0"});Lr();$();nr();ge();var Cc=wo(Sc());var ei=Re(),ca=class{constructor(){this.httpClient=Qe.create({baseUrl:rr(B.testMode)});this.getGameId=()=>B.mpId;this.getItem=t=>A(this,null,function*(){let{code:r,data:n,message:i}=yield this.httpClient.get(`/api/games/user-storage/${this.gameId}`,{query:{key:t}}),o=n==null?void 0:n.value,a=i;return r!=="SUCCESS"&&(o=yield this.gameStore.getItem(t),console.info("[SDK] cloud storage getItem failed, read from localstorage",o),a+="fallback to localstorage"),{code:r,message:a,data:o&&o!=="undefined"?o:null}});this.setItem=(t,r)=>A(this,null,function*(){let n=typeof r=="string"?r:String(r),{code:i,message:o}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}`,{data:{key:t,value:n}});return yield this.gameStore.setItem(t,n),{code:i,message:o}});this.removeItem=t=>A(this,null,function*(){yield this.gameStore.removeItem(t);let{code:r,message:n}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/remove`,{data:{key:t}});return{code:r,message:n}});this.clear=()=>A(this,null,function*(){yield this.gameStore.clear();let{code:t,message:r}=yield this.httpClient.post(`/api/games/user-storage/${this.gameId}/clear`,{});return{code:t,message:r}});this.gameId=this.getGameId(),this.gameStore=Cc.default.createInstance({name:this.gameId.length?this.gameId:"default"})}},ti=new ca,Jp=et("getLocalStorage",{paramsSchema:j.tuple(j.string()),implement(e){return A(this,null,function*(){return yield ti.getItem(e)})}});ei.registerCommand("StorageSDK.getItem",Jp);Ie("storage.getItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var Fp=et("setStorage",{paramsSchema:j.tuple(j.string(),j.or(j.string(),j.boolean(),j.number())),implement(e,t){return A(this,null,function*(){return yield ti.setItem(e,t)})}});ei.registerCommand("StorageSDK.setItem",Fp);Ie("storage.setItem",{version:"1.0.0",properties:{key:"1.0.0",value:"1.0.0"}});var qp=et("removeStorage",{paramsSchema:j.tuple(j.string()),implement(e){return A(this,null,function*(){return yield ti.removeItem(e)})}});ei.registerCommand("StorageSDK.removeItem",qp);Ie("storage.removeItem",{version:"1.0.0",properties:{key:"1.0.0"}});var jp=et("clearStorage",{implement(){return A(this,null,function*(){return yield ti.clear()})}});ei.registerCommand("StorageSDK.clear",jp);Ie("storage.clear",{version:"1.0.0"});var MR=wo(Rc());vt();$();nr();Gr();ge();Fe();var Oc=B.testMode;function Tc(){let e=new Map,t,r;return{registerRewardHandler(i,o){e.set(i,o)},handleReward(i,...o){return A(this,null,function*(){return yield i.reduce((s,l)=>A(this,null,function*(){let c=yield s;if(c===!0)return!0;Oc&&console.log(`handleReward ${l}`);let h=e.get(l),d=h?yield h(...o):c;return Oc&&console.log(`handleReward ${l} ${d}`),d}),Promise.resolve(!1))})},registerRewardsFetcher(i){return A(this,null,function*(){t=(...o)=>A(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),["ADS"]}})})},registerRewardFrequencyConfigFetcher(i){return A(this,null,function*(){r=(...o)=>A(this,null,function*(){try{return yield i(...o)}catch(a){return console.error("getRewardOptions error:",a),{joliCoinUseAndCharge:_t,loginGuide:yt}}})})},getRewardsTypes(...i){return A(this,null,function*(){return t?yield t(...i):["ADS"]})},getRewardFrequencyConfig(...i){return A(this,null,function*(){return r?yield r(...i):{joliCoinUseAndCharge:_t,loginGuide:yt}})}}}$();var fa=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"POST",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){var r,n,i;return{unlockOptions:((r=t.data)==null?void 0:r.unlockOptions)||[],joliCoin:((n=t.extra)==null?void 0:n.joliCoin)||{balance:0,enableAutoDeduct:!1},joliGem:((i=t.extra)==null?void 0:i.joliGem)||{balance:0,enableAutoDeduct:!1}}}mergeData(t,r){return{code:"SUCCESS",message:"success",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin||{balance:0,enableAutoDeduct:!1},joliGem:t.joliGem||{balance:0,enableAutoDeduct:!1}}}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{unlockOptions:t.unlockOptions},extra:{joliCoin:t.joliCoin,joliGem:t.joliGem}}}},ha=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.body)||{};return n==="GET"?yield this.httpClient.get(t,i):yield this.httpClient.post(t,i)})}extractCacheableData(t){let r=t.data;return Y({joliCoinUseAndCharge:r==null?void 0:r.joliCoinUseAndCharge,loginGuide:r==null?void 0:r.loginGuide},r)}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:t}}},ui=class{constructor(t){this.unlockOptionsService=new qt(new fa(t),{duration:30*60*1e3,timeout:1e3,keyGenerator:r=>r,consistencyChecker:(r,n)=>r.unlockOptions.length!==n.unlockOptions.length?!1:r.unlockOptions.every((i,o)=>{var s,l;let a=n.unlockOptions[o];return i.type===a.type&&((s=i.joliGemChoice)==null?void 0:s.joliGemQuantity)===((l=a.joliGemChoice)==null?void 0:l.joliGemQuantity)})}),this.globalConfigService=new qt(new ha(t),{duration:60*60*1e3,timeout:1e3,keyGenerator:r=>r})}getUnlockOptions(){return A(this,arguments,function*(t={}){return yield this.unlockOptionsService.request("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}getGlobalConfig(){return A(this,null,function*(){return yield this.globalConfigService.request("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}refreshUnlockOptions(){return A(this,arguments,function*(t={}){return yield this.unlockOptionsService.forceRequest("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",body:t,method:"POST"})})}refreshGlobalConfig(){return A(this,null,function*(){return yield this.globalConfigService.forceRequest("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})})}warmupCache(){return A(this,null,function*(){yield Promise.all([this.unlockOptionsService.warmupCache("/api/games/unlock-options",{endpoint:"/api/games/unlock-options",method:"POST"}),this.globalConfigService.warmupCache("/api/fe-configs/web-common/global-config",{endpoint:"/api/fe-configs/web-common/global-config",method:"GET"})])})}clearAllCache(){this.unlockOptionsService.clearCache(),this.globalConfigService.clearCache()}getCacheStats(){return{unlockOptions:this.unlockOptionsService.getCacheStats(),globalConfig:this.globalConfigService.getCacheStats()}}clearExpiredCache(){this.unlockOptionsService.clearExpiredCache(),this.globalConfigService.clearExpiredCache()}};Fe();$();var Xp=()=>(e,t)=>{let r={SUBSCRIPTION:4,JOLI_GEM:3,JOLI_GEM_ONLY:3,JOLI_COIN:2,JOLI_COIN_ONLY:2,ADS:1};return r[t]-r[e]},Qp=["openJolicoinGuide",{method:"getABTest",platforms:["android"],nativeVersionCode:1050100},"userTrackAsync",{method:"openMiniapp",nativeVersionCode:1050100}],Zp=e=>{if(!e.length)return["ADS"];if(e.includes("JOLI_GEM")){if(e.length===1)return["JOLI_GEM_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_GEM_ONLY"]}if(e.includes("JOLI_COIN")){if(e.length===1)return["JOLI_COIN_ONLY"];if(e.includes("SUBSCRIPTION")&&e.length===2)return["SUBSCRIPTION","JOLI_COIN_ONLY"]}return e.sort(Xp())},pa=null;function ma(e){return pa||(pa=new ui(e)),pa}var va=e=>{e.registerRewardsFetcher(t=>A(void 0,null,function*(){var i,o,a,s,l;let r=["ADS"],n=ma(t);try{let c=yield n.getUnlockOptions({});if(c.code!=="SUCCESS")return r;oe.emit(ri,{options:((i=c.data)==null?void 0:i.unlockOptions)||[],userJoliCoin:((o=c.extra)==null?void 0:o.joliCoin)||{balance:0,enableAutoDeduct:!1},userGem:((a=c.extra)==null?void 0:a.joliGem)||{balance:0,enableAutoDeduct:!1}});let h=((l=(s=c.data)==null?void 0:s.unlockOptions)==null?void 0:l.map(d=>d.type))||Array.from(r);return Zp(h)}catch(c){return console.error("getRewardOptions error (cached):",c),r}}))},ga=e=>{e.registerRewardFrequencyConfigFetcher(t=>A(void 0,null,function*(){var n,i,o,a;let r=ma(t);try{let s=yield r.getGlobalConfig();return oe.emit(ua,{joliCoinUseAndCharge:((n=s.data)==null?void 0:n.joliCoinUseAndCharge)||_t,loginGuide:((i=s.data)==null?void 0:i.loginGuide)||yt}),s.data&&Dt.emit("onGlobalConfigChanged",{globalConfig:s.data}),{joliCoinUseAndCharge:((o=s.data)==null?void 0:o.joliCoinUseAndCharge)||_t,loginGuide:((a=s.data)==null?void 0:a.loginGuide)||yt}}catch(s){return console.error("getGlobalConfig error (cached):",s),oe.emit(ua,{joliCoinUseAndCharge:_t,loginGuide:yt}),Dt.emit("onGlobalConfigChanged",{globalConfig:{joliCoinUseAndCharge:_t,loginGuide:yt,supportedHostMethods:Qp}}),{joliCoinUseAndCharge:_t,loginGuide:yt}}}))};var _a=e=>A(void 0,null,function*(){yield ma(e).warmupCache(),console.log("Reward cache warmed up")});var xc=e=>t=>A(void 0,null,function*(){try{console.log("trigger @jolibox/ads reward",t),yield e.adBreak(t)}catch(r){console.error("-----createAdsRewardHandler error-----",r)}return!0});Fe();function it(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=Y(Y({},i),a),r=Promise.resolve(i),n&&(n(i),n=null),i}}}Fe();var ke=it(oe,ri),Jr=(e,t)=>{var n;let r=(n=e.options)==null?void 0:n.some(i=>i.type==="SUBSCRIPTION");return console.log("typeof extraCheck",typeof t,t==null?void 0:t()),r&&(!t||(t==null?void 0:t()))};ge();$();var ya={JOLI_COIN:{balanceEndpoint:"/api/joli-coin/balance",balanceDetailEndpoint:"/api/joli-coin/balance-detail",unlockEndpoint:"/api/joli-coin/unlock",unlockType:"JOLI_COIN"},GEM:{balanceEndpoint:"/api/joli-gem/balance",balanceDetailEndpoint:"/api/joli-gem/balance-detail",unlockEndpoint:"/api/joli-gem/unlock",unlockType:"GEM"}};$();var Ye=Re();Fe();Fe();$();var wa=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Aa=class{constructor(t){this.balanceService=new qt(new wa(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getBalance(t="JOLI_COIN"){return A(this,null,function*(){return(yield this.balanceService.request("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}refreshBalance(t="JOLI_COIN"){return A(this,null,function*(){return(yield this.balanceService.forceRequest("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})).data})}warmupBalance(t="JOLI_COIN"){return A(this,null,function*(){yield this.balanceService.warmupCache("/api/joli-coin/balance",{endpoint:"/api/joli-coin/balance",query:{type:t},method:"GET"})})}clearBalanceCache(){this.balanceService.clearCache()}getBalanceCacheStats(){return this.balanceService.getCacheStats()}clearExpiredCache(){this.balanceService.clearExpiredCache()}},ba=null;function Ea(e){return ba||(ba=new Aa(e)),ba}var Ia=(e,t="JOLI_COIN")=>A(void 0,null,function*(){return yield Ea(e).getBalance(t)}),Kt=(e,t="JOLI_COIN")=>A(void 0,null,function*(){let n=yield Ea(e).refreshBalance(t);return console.log(`Balance cache refreshed for type: ${t}`),n}),fi=(e,t="JOLI_COIN")=>A(void 0,null,function*(){yield Ea(e).warmupBalance(t),console.log(`Balance cache warmed up for type: ${t}`)});$();var Ca=class{constructor(t){this.httpClient=t}execute(t,r){return A(this,null,function*(){let n=(r==null?void 0:r.method)||"GET",i=(r==null?void 0:r.query)||{};return n==="GET"?yield this.httpClient.get(t,{query:i}):yield this.httpClient.post(t,{query:i})})}extractCacheableData(t){var r;return{balance:((r=t.data)==null?void 0:r.balance)||0,timestamp:Date.now()}}processCachedData(t){return{code:"SUCCESS",message:"success from cache",data:{balance:t.balance}}}},Ra=class{constructor(t){this.gemBalanceService=new qt(new Ca(t),{duration:20*60*1e3,timeout:1e3,keyGenerator:(r,n)=>{let i=n!=null&&n.query?JSON.stringify(n.query):"";return`${r}:${i}`}})}getGemBalance(t="GEM"){return A(this,null,function*(){return(yield this.gemBalanceService.request("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}refreshGemBalance(t="GEM"){return A(this,null,function*(){return(yield this.gemBalanceService.forceRequest("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})).data})}warmupGemBalance(t="GEM"){return A(this,null,function*(){yield this.gemBalanceService.warmupCache("/api/joli-gem/balance",{endpoint:"/api/joli-gem/balance",query:{type:t},method:"GET"})})}clearGemBalanceCache(){this.gemBalanceService.clearCache()}getGemBalanceCacheStats(){return this.gemBalanceService.getCacheStats()}clearExpiredCache(){this.gemBalanceService.clearExpiredCache()}},Sa=null;function Dc(e){return Sa||(Sa=new Ra(e)),Sa}var ka=(e,t="GEM")=>A(void 0,null,function*(){return yield Dc(e).getGemBalance(t)}),lr=(e,t="GEM")=>A(void 0,null,function*(){let n=yield Dc(e).refreshGemBalance(t);return console.log(`Gem balance cache refreshed for type: ${t}`),n});var ot={JOLI_COIN:{fetchBalance:Ia,getQuantity:e=>{var t,r,n;return(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(i=>i.type==="JOLI_COIN"))==null?void 0:r.joliCoinChoices[0].joliCoinQuantity)!=null?n:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userJoliCoin)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userJoliCoin",isEnough:(e,t)=>{var r,n;return(n=(r=e==null?void 0:e.options)==null?void 0:r.some(i=>i.type==="JOLI_COIN"&&i.joliCoinChoices.some(o=>{var a;return o.joliCoinQuantity<=((a=t==null?void 0:t.balance)!=null?a:0)})))!=null?n:!1}},JOLI_GEM:{fetchBalance:ka,getQuantity:e=>{var t,r,n,i;return(i=(n=(r=(t=e==null?void 0:e.options)==null?void 0:t.find(o=>o.type==="JOLI_GEM"))==null?void 0:r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0},getCurrentUser:e=>{var t;return(t=e==null?void 0:e.userGem)!=null?t:{balance:0,enableAutoDeduct:!1}},createUpdatedUser:(e,t)=>({balance:e,enableAutoDeduct:t}),getUpdateKey:()=>"userGem",isEnough:(e,t)=>{var n,i,o;let r=e==null?void 0:e.options.find(a=>a.type==="JOLI_GEM");return r?((i=(n=r.joliGemChoice)==null?void 0:n.joliGemQuantity)!=null?i:0)<=((o=t==null?void 0:t.balance)!=null?o:0):!1}}};var hi=(e,t,r)=>{let{showUnlockWithCurrencyModal:n}=r;Ye.registerCommand(`Rewards.${e}.useJolicoin`,()=>A(void 0,null,function*(){let i=yield ke.getData(),o=ot[t],a=o.getCurrentUser(i),s=o.getQuantity(i),l=!!(a!=null&&a.enableAutoDeduct);return console.log("-----unlockOptions usemodal-----",i,l,s),(yield n({enableAutoDeduct:l,userCurrency:a,quantity:s,currency:t}))!=="CONFIRM"?{result:"FAILED"}:{result:"SUCCESS"}}))},$t=(e,t)=>r=>A(void 0,null,function*(){let n=it(oe,ai);return oe.emit(oi,e,{enableAutoDeduct:r.enableAutoDeduct,userCurrency:r.userCurrency,quantity:r.quantity,currency:r.currency,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).useModalResult});Fe();Fe();var pi=(e,t,r)=>{let{httpClient:n,initiateAndAwaitPayment:i}=r;Ye.registerCommand(`Rewards.${e}.usePayment`,()=>A(void 0,null,function*(){var p;let o=yield ke.getData(),a=ot[t],s=yield a.fetchBalance(n),l=a.getQuantity(o),c=a.getCurrentUser(o),h=a.createUpdatedUser((p=s==null?void 0:s.balance)!=null?p:0,c.enableAutoDeduct),d=a.getUpdateKey();if(ke.updateData({[d]:h}),console.log("-----unlockOptions payment-----",o,h,l,t),!a.isEnough(o,h)){let m=yield i({userCurrency:h,currencyQuantity:l,currency:t});return t==="JOLI_GEM"?lr(n):Kt(n),{result:m==="SUCCESS"?"SUCCESS":"FAILED"}}return{result:"CONTINUE"}}))},Wt=(e,t)=>r=>A(void 0,null,function*(){let n=it(oe,ii);return oe.emit(ni,e,{userCurrency:r.userCurrency,quantity:r.currencyQuantity,currency:r.currency,enableAutoDeduct:r.userCurrency.enableAutoDeduct,confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText}),(yield n.getFreshData()).paymentResult});ge();Fe();Fe();$();var zt=(e,t)=>r=>A(void 0,null,function*(){let n=it(oe,si);return oe.emit(li,e,{confirmButtonText:t.confirmButtonText,cancelButtonText:t.cancelButtonText,currency:r}),yield n.getFreshData()});var rm=(e,t,r,{handlers:{handleUnlockSuccess:n,handleUnlockFailed:i,unlockOptionsHandler:o,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:s,showUnloginModal:l,hasSubscription:c}})=>{pi(e,"JOLI_COIN",{httpClient:t,initiateAndAwaitPayment:a}),hi(e,"JOLI_COIN",{showUnlockWithCurrencyModal:s});let h=[`Rewards.${e}.usePayment`,`Rewards.${e}.useJolicoin`];return d=>A(void 0,null,function*(){var p,m,b,E;try{let I=yield o.getData();if(Jr(I,c)){let P=ot.JOLI_COIN,M=yield P.fetchBalance(t),S=P.getCurrentUser(I),D=P.createUpdatedUser((p=M==null?void 0:M.balance)!=null?p:0,S.enableAutoDeduct);if(!P.isEnough(I,D))return i==null||i(d),!1}else{let P=!0;for(let M of h){let S=yield Ye.executeCommand(M);if(P=P&&S.result!=="FAILED",S.result!=="CONTINUE")break}if(!P)return i==null||i(d),!1}let R=ya[r],k=yield t.post(R.unlockEndpoint,{data:{type:"GAME_REWARD",reqId:`${Xe()}-${B.mpType}-${Date.now()}`,gameInfo:{gameId:B.mpId}}});if(console.log("-----unlockWithCurrency request result-----",k),k.code=="SUCCESS"){try{(b=d.adBreakDone)==null||b.call(d,{breakType:d.type,breakName:"name"in d&&(m=d.name)!=null?m:"",breakFormat:"reward",breakStatus:"viewed"}),"adViewed"in d&&((E=d.adViewed)==null||E.call(d)),Kt(t)}catch(P){console.error("-----unlockWithJolicoin adBreakDone error-----",P)}return n==null||n({quantity:k.data.quantity,balance:k.data.balance}),!0}return i==null||i(d),!1}catch(I){if(console.info("JolicoinRewardHandler error:",I),I instanceof Error&&I.message=="CANCEL")throw I;return i==null||i(d),!1}finally{o.clearCache()}})},mi=(e,t,r)=>rm(e,t,"JOLI_COIN",r);var Nc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=$t("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noWatchAds"}),a=Wt("ADS-JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noWatchAds"}),s=zt("ADS-JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noWatchAds"});return mi("ADS-JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:ke,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})};var Pc=(e,{onUnlockSuccess:t,onUnlockFailed:r,hasSubscription:n})=>{let i=c=>{var h;r==null||r(),(h=c.adBreakDone)==null||h.call(c,{breakType:c.type,breakFormat:c.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})},o=$t("JOLI_COIN",{confirmButtonText:"jolicoin.useJolicoin",cancelButtonText:"jolicoin.noThanks"}),a=Wt("JOLI_COIN",{confirmButtonText:"jolicoin.payAndUnlock",cancelButtonText:"jolicoin.noThanks"}),s=zt("JOLI_COIN",{confirmButtonText:"loginGuide.login",cancelButtonText:"loginGuide.noThanks"});return mi("JOLI_COIN",e,{handlers:{handleUnlockSuccess:t,handleUnlockFailed:i,unlockOptionsHandler:ke,initiateAndAwaitPayment:a,showUnlockWithCurrencyModal:o,showUnloginModal:s,hasSubscription:n}})};ge();$();Fe();Fe();var Lc=e=>{let{showSubscriptionModal:t}=e;Ye.registerCommand("Rewards.subscription",()=>A(void 0,null,function*(){var s,l;let r=yield ke.getData(),n=(l=(s=r==null?void 0:r.options)==null?void 0:s.find(c=>c.type==="JOLI_GEM"))==null?void 0:l.type,i=ot[n?"JOLI_GEM":"JOLI_COIN"],o=i.getCurrentUser(r);return i.isEnough(r,o)?{result:"FAILED"}:{result:(yield t())==="SUCCESS"?"SUCCESS":"FAILED"}}))},Uc=e=>()=>A(void 0,null,function*(){let t=it(oe,di);return oe.emit(ci,e),(yield t.getFreshData()).result});ge();var Bc=(e,t,{handlers:{handleSubSuccess:r,handleSubFailed:n,unlockOptionsHandler:i,showSubscriptionModal:o,hasSubscription:a}})=>{Lc({showSubscriptionModal:o});let s=["Rewards.subscription"];return l=>A(void 0,null,function*(){var c,h,d,p,m,b;try{let E=yield i.getData();if(!Jr(E,a))return!1;let w=!0;for(let R of s){let k=yield Ye.executeCommand(R);if(w=w&&k.result!=="FAILED",k.result!=="CONTINUE")break}if(Kt(t),lr(t),console.log("-----unlockWithSubscription result-----",w),w){try{(h=l.adBreakDone)==null||h.call(l,{breakType:l.type,breakName:"name"in l&&(c=l.name)!=null?c:"",breakFormat:l.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in l&&((d=l.adViewed)==null||d.call(l)),(b=(m=B).onEnvConfigChanged)==null||b.call(m,{hostUserInfo:Ue(Y({},(p=B.hostUserInfo)!=null?p:{isLogin:!1}),{isSubUser:!0})})}catch(R){console.error("-----unlockWithSubscription adBreakDone error-----",R)}return r==null||r(),!0}return n==null||n(l),!1}catch(E){if(console.info("SubscriptionRewardHandler error:",E),E instanceof Error&&E.message=="CANCEL")throw E;return n==null||n(l),!1}finally{}})};var Mc=(e,{onSubSuccess:t,onSubFailed:r,hasSubscription:n})=>{let i=()=>{r==null||r()},o=Uc("SUBSCRIPTION");return Bc("SUBSCRIPTION",e,{handlers:{handleSubSuccess:t,handleSubFailed:i,unlockOptionsHandler:ke,showSubscriptionModal:o,hasSubscription:n}})};var at=Tc();va(at);ga(at);var yi,V,jc,xa,Yt,Gc,Hc,Vc,Kc,Da,Oa,Ta,im,Fr={},$c=[],om=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,qr=Array.isArray;function bt(e,t){for(var r in t)e[r]=t[r];return e}function Na(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function jr(e,t,r){var n,i,o,a={};for(o in t)o=="key"?n=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?yi.call(arguments,2):r),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return gi(e,a,n,i,null)}function gi(e,t,r,n,i){var o={type:e,props:t,key:r,ref:n,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i==null?++jc:i,__i:-1,__u:0};return i==null&&V.vnode!=null&&V.vnode(o),o}function Hr(){return{current:null}}function Nt(e){return e.children}function Ke(e,t){this.props=e,this.context=t}function cr(e,t){if(t==null)return e.__?cr(e.__,e.__i+1):null;for(var r;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null)return r.__e;return typeof e.type=="function"?cr(e):null}function Wc(e){var t,r;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((r=e.__k[t])!=null&&r.__e!=null){e.__e=e.__c.base=r.__e;break}return Wc(e)}}function Jc(e){(!e.__d&&(e.__d=!0)&&Yt.push(e)&&!_i.__r++||Gc!==V.debounceRendering)&&((Gc=V.debounceRendering)||Hc)(_i)}function _i(){for(var e,t,r,n,i,o,a,s=1;Yt.length;)Yt.length>s&&Yt.sort(Vc),e=Yt.shift(),s=Yt.length,e.__d&&(r=void 0,i=(n=(t=e).__v).__e,o=[],a=[],t.__P&&((r=bt({},n)).__v=n.__v+1,V.vnode&&V.vnode(r),Pa(t.__P,r,n,t.__n,t.__P.namespaceURI,32&n.__u?[i]:null,o,i==null?cr(n):i,!!(32&n.__u),a),r.__v=n.__v,r.__.__k[r.__i]=r,Xc(o,r,a),r.__e!=i&&Wc(r)));_i.__r=0}function zc(e,t,r,n,i,o,a,s,l,c,h){var d,p,m,b,E,I,w=n&&n.__k||$c,R=t.length;for(l=am(r,t,w,l,R),d=0;d<R;d++)(m=r.__k[d])!=null&&(p=m.__i===-1?Fr:w[m.__i]||Fr,m.__i=d,I=Pa(e,m,p,i,o,a,s,l,c,h),b=m.__e,m.ref&&p.ref!=m.ref&&(p.ref&&La(p.ref,null,m),h.push(m.ref,m.__c||b,m)),E==null&&b!=null&&(E=b),4&m.__u||p.__k===m.__k?l=Yc(m,l,e):typeof m.type=="function"&&I!==void 0?l=I:b&&(l=b.nextSibling),m.__u&=-7);return r.__e=E,l}function am(e,t,r,n,i){var o,a,s,l,c,h=r.length,d=h,p=0;for(e.__k=new Array(i),o=0;o<i;o++)(a=t[o])!=null&&typeof a!="boolean"&&typeof a!="function"?(l=o+p,(a=e.__k[o]=typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?gi(null,a,null,null,null):qr(a)?gi(Nt,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?gi(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):a).__=e,a.__b=e.__b+1,s=null,(c=a.__i=sm(a,r,l,d))!==-1&&(d--,(s=r[c])&&(s.__u|=2)),s==null||s.__v===null?(c==-1&&(i>h?p--:i<h&&p++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?p--:c==l+1?p++:(c>l?p--:p++,a.__u|=4))):e.__k[o]=null;if(d)for(o=0;o<h;o++)(s=r[o])!=null&&!(2&s.__u)&&(s.__e==n&&(n=cr(s)),Zc(s,s));return n}function Yc(e,t,r){var n,i;if(typeof e.type=="function"){for(n=e.__k,i=0;n&&i<n.length;i++)n[i]&&(n[i].__=e,t=Yc(n[i],t,r));return t}e.__e!=t&&(t&&e.type&&!r.contains(t)&&(t=cr(e)),r.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Vr(e,t){return t=t||[],e==null||typeof e=="boolean"||(qr(e)?e.some(function(r){Vr(r,t)}):t.push(e)),t}function sm(e,t,r,n){var i,o,a=e.key,s=e.type,l=t[r];if(l===null&&e.key==null||l&&a==l.key&&s===l.type&&!(2&l.__u))return r;if(n>(l!=null&&!(2&l.__u)?1:0))for(i=r-1,o=r+1;i>=0||o<t.length;){if(i>=0){if((l=t[i])&&!(2&l.__u)&&a==l.key&&s===l.type)return i;i--}if(o<t.length){if((l=t[o])&&!(2&l.__u)&&a==l.key&&s===l.type)return o;o++}}return-1}function Fc(e,t,r){t[0]=="-"?e.setProperty(t,r==null?"":r):e[t]=r==null?"":typeof r!="number"||om.test(t)?r:r+"px"}function vi(e,t,r,n,i){var o;e:if(t=="style")if(typeof r=="string")e.style.cssText=r;else{if(typeof n=="string"&&(e.style.cssText=n=""),n)for(t in n)r&&t in r||Fc(e.style,t,"");if(r)for(t in r)n&&r[t]===n[t]||Fc(e.style,t,r[t])}else if(t[0]=="o"&&t[1]=="n")o=t!=(t=t.replace(Kc,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=r,r?n?r.t=n.t:(r.t=Da,e.addEventListener(t,o?Ta:Oa,o)):e.removeEventListener(t,o?Ta:Oa,o);else{if(i=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=r==null?"":r;break e}catch(a){}typeof r=="function"||(r==null||r===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&r==1?"":r))}}function qc(e){return function(t){if(this.l){var r=this.l[t.type+e];if(t.u==null)t.u=Da++;else if(t.u<r.t)return;return r(V.event?V.event(t):t)}}}function Pa(e,t,r,n,i,o,a,s,l,c){var h,d,p,m,b,E,I,w,R,k,P,M,S,D,F,H,U,J=t.type;if(t.constructor!==void 0)return null;128&r.__u&&(l=!!(32&r.__u),o=[s=t.__e=r.__e]),(h=V.__b)&&h(t);e:if(typeof J=="function")try{if(w=t.props,R="prototype"in J&&J.prototype.render,k=(h=J.contextType)&&n[h.__c],P=h?k?k.props.value:h.__:n,r.__c?I=(d=t.__c=r.__c).__=d.__E:(R?t.__c=d=new J(w,P):(t.__c=d=new Ke(w,P),d.constructor=J,d.render=cm),k&&k.sub(d),d.props=w,d.state||(d.state={}),d.context=P,d.__n=n,p=d.__d=!0,d.__h=[],d._sb=[]),R&&d.__s==null&&(d.__s=d.state),R&&J.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=bt({},d.__s)),bt(d.__s,J.getDerivedStateFromProps(w,d.__s))),m=d.props,b=d.state,d.__v=t,p)R&&J.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),R&&d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(R&&J.getDerivedStateFromProps==null&&w!==m&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(w,P),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(w,d.__s,P)===!1||t.__v==r.__v)){for(t.__v!=r.__v&&(d.props=w,d.state=d.__s,d.__d=!1),t.__e=r.__e,t.__k=r.__k,t.__k.some(function(q){q&&(q.__=t)}),M=0;M<d._sb.length;M++)d.__h.push(d._sb[M]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(w,d.__s,P),R&&d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(m,b,E)})}if(d.context=P,d.props=w,d.__P=e,d.__e=!1,S=V.__r,D=0,R){for(d.state=d.__s,d.__d=!1,S&&S(t),h=d.render(d.props,d.state,d.context),F=0;F<d._sb.length;F++)d.__h.push(d._sb[F]);d._sb=[]}else do d.__d=!1,S&&S(t),h=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++D<25);d.state=d.__s,d.getChildContext!=null&&(n=bt(bt({},n),d.getChildContext())),R&&!p&&d.getSnapshotBeforeUpdate!=null&&(E=d.getSnapshotBeforeUpdate(m,b)),H=h,h!=null&&h.type===Nt&&h.key==null&&(H=Qc(h.props.children)),s=zc(e,qr(H)?H:[H],t,r,n,i,o,a,s,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),I&&(d.__E=d.__=null)}catch(q){if(t.__v=null,l||o!=null)if(q.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;o[o.indexOf(s)]=null,t.__e=s}else for(U=o.length;U--;)Na(o[U]);else t.__e=r.__e,t.__k=r.__k;V.__e(q,t,r)}else o==null&&t.__v==r.__v?(t.__k=r.__k,t.__e=r.__e):s=t.__e=lm(r.__e,t,r,n,i,o,a,l,c);return(h=V.diffed)&&h(t),128&t.__u?void 0:s}function Xc(e,t,r){for(var n=0;n<r.length;n++)La(r[n],r[++n],r[++n]);V.__c&&V.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){V.__e(o,i.__v)}})}function Qc(e){return typeof e!="object"||e==null?e:qr(e)?e.map(Qc):bt({},e)}function lm(e,t,r,n,i,o,a,s,l){var c,h,d,p,m,b,E,I=r.props,w=t.props,R=t.type;if(R=="svg"?i="http://www.w3.org/2000/svg":R=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),o!=null){for(c=0;c<o.length;c++)if((m=o[c])&&"setAttribute"in m==!!R&&(R?m.localName==R:m.nodeType==3)){e=m,o[c]=null;break}}if(e==null){if(R==null)return document.createTextNode(w);e=document.createElementNS(i,R,w.is&&w),s&&(V.__m&&V.__m(t,o),s=!1),o=null}if(R===null)I===w||s&&e.data===w||(e.data=w);else{if(o=o&&yi.call(e.childNodes),I=r.props||Fr,!s&&o!=null)for(I={},c=0;c<e.attributes.length;c++)I[(m=e.attributes[c]).name]=m.value;for(c in I)if(m=I[c],c!="children"){if(c=="dangerouslySetInnerHTML")d=m;else if(!(c in w)){if(c=="value"&&"defaultValue"in w||c=="checked"&&"defaultChecked"in w)continue;vi(e,c,null,m,i)}}for(c in w)m=w[c],c=="children"?p=m:c=="dangerouslySetInnerHTML"?h=m:c=="value"?b=m:c=="checked"?E=m:s&&typeof m!="function"||I[c]===m||vi(e,c,m,I[c],i);if(h)s||d&&(h.__html===d.__html||h.__html===e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(d&&(e.innerHTML=""),zc(t.type==="template"?e.content:e,qr(p)?p:[p],t,r,n,R=="foreignObject"?"http://www.w3.org/1999/xhtml":i,o,a,o?o[0]:r.__k&&cr(r,0),s,l),o!=null)for(c=o.length;c--;)Na(o[c]);s||(c="value",R=="progress"&&b==null?e.removeAttribute("value"):b!==void 0&&(b!==e[c]||R=="progress"&&!b||R=="option"&&b!==I[c])&&vi(e,c,b,I[c],i),c="checked",E!==void 0&&E!==e[c]&&vi(e,c,E,I[c],i))}return e}function La(e,t,r){try{if(typeof e=="function"){var n=typeof e.__u=="function";n&&e.__u(),n&&t==null||(e.__u=e(t))}else e.current=t}catch(i){V.__e(i,r)}}function Zc(e,t,r){var n,i;if(V.unmount&&V.unmount(e),(n=e.ref)&&(n.current&&n.current!==e.__e||La(n,null,t)),(n=e.__c)!=null){if(n.componentWillUnmount)try{n.componentWillUnmount()}catch(o){V.__e(o,t)}n.base=n.__P=null}if(n=e.__k)for(i=0;i<n.length;i++)n[i]&&Zc(n[i],t,r||typeof e.type!="function");r||Na(e.__e),e.__c=e.__=e.__e=void 0}function cm(e,t,r){return this.constructor(e,r)}function ed(e,t,r){var n,i,o,a;t==document&&(t=document.documentElement),V.__&&V.__(e,t),i=(n=typeof r=="function")?null:r&&r.__k||t.__k,o=[],a=[],Pa(t,e=(!n&&r||t).__k=jr(Nt,null,[e]),i||Fr,Fr,t.namespaceURI,!n&&r?[r]:i?null:t.firstChild?yi.call(t.childNodes):null,o,!n&&r?r:i?i.__e:t.firstChild,n,a),Xc(o,e,a)}yi=$c.slice,V={__e:function(e,t,r,n){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,n||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},jc=0,xa=function(e){return e!=null&&e.constructor==null},Ke.prototype.setState=function(e,t){var r;r=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=bt({},this.state),typeof e=="function"&&(e=e(bt({},r),this.props)),e&&bt(r,e),e!=null&&this.__v&&(t&&this._sb.push(t),Jc(this))},Ke.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Jc(this))},Ke.prototype.render=Nt,Yt=[],Hc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Vc=function(e,t){return e.__v.__b-t.__v.__b},_i.__r=0,Kc=/(PointerCapture)$|Capture$/i,Da=0,Oa=qc(!1),Ta=qc(!0),im=0;var dr,fe,Ua,td,Kr=0,cd=[],me=V,rd=me.__b,nd=me.__r,id=me.diffed,od=me.__c,ad=me.unmount,sd=me.__;function wi(e,t){me.__h&&me.__h(fe,e,Kr||t),Kr=0;var r=fe.__H||(fe.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function wt(e){return Kr=1,dd(ud,e)}function dd(e,t,r){var n=wi(dr++,2);if(n.t=e,!n.__c&&(n.__=[r?r(t):ud(void 0,t),function(s){var l=n.__N?n.__N[0]:n.__[0],c=n.t(l,s);l!==c&&(n.__N=[c,n.__[1]],n.__c.setState({}))}],n.__c=fe,!fe.__f)){var i=function(s,l,c){if(!n.__c.__H)return!0;var h=n.__c.__H.__.filter(function(p){return!!p.__c});if(h.every(function(p){return!p.__N}))return!o||o.call(this,s,l,c);var d=n.__c.props!==s;return h.forEach(function(p){if(p.__N){var m=p.__[0];p.__=p.__N,p.__N=void 0,m!==p.__[0]&&(d=!0)}}),o&&o.call(this,s,l,c)||d};fe.__f=!0;var o=fe.shouldComponentUpdate,a=fe.componentWillUpdate;fe.componentWillUpdate=function(s,l,c){if(this.__e){var h=o;o=void 0,i(s,l,c),o=h}a&&a.call(this,s,l,c)},fe.shouldComponentUpdate=i}return n.__N||n.__}function Pt(e,t){var r=wi(dr++,3);!me.__s&&Ga(r.__H,t)&&(r.__=e,r.u=t,fe.__H.__h.push(r))}function Ma(e,t){var r=wi(dr++,4);!me.__s&&Ga(r.__H,t)&&(r.__=e,r.u=t,fe.__h.push(r))}function Ai(e){return Kr=5,$r(function(){return{current:e}},[])}function $r(e,t){var r=wi(dr++,7);return Ga(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function Wr(e,t){return Kr=8,$r(function(){return e},t)}function dm(){for(var e;e=cd.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(bi),e.__H.__h.forEach(Ba),e.__H.__h=[]}catch(t){e.__H.__h=[],me.__e(t,e.__v)}}me.__b=function(e){fe=null,rd&&rd(e)},me.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),sd&&sd(e,t)},me.__r=function(e){nd&&nd(e),dr=0;var t=(fe=e.__c).__H;t&&(Ua===fe?(t.__h=[],fe.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(bi),t.__h.forEach(Ba),t.__h=[],dr=0)),Ua=fe},me.diffed=function(e){id&&id(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(cd.push(t)!==1&&td===me.requestAnimationFrame||((td=me.requestAnimationFrame)||um)(dm)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),Ua=fe=null},me.__c=function(e,t){t.some(function(r){try{r.__h.forEach(bi),r.__h=r.__h.filter(function(n){return!n.__||Ba(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],me.__e(n,r.__v)}}),od&&od(e,t)},me.unmount=function(e){ad&&ad(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{bi(n)}catch(i){t=i}}),r.__H=void 0,t&&me.__e(t,r.__v))};var ld=typeof requestAnimationFrame=="function";function um(e){var t,r=function(){clearTimeout(n),ld&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);ld&&(t=requestAnimationFrame(r))}function bi(e){var t=fe,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),fe=t}function Ba(e){var t=fe;e.__c=e.__(),fe=t}function Ga(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}function ud(e,t){return typeof t=="function"?t(e):t}function hm(e,t){for(var r in t)e[r]=t[r];return e}function fd(e,t){for(var r in e)if(r!=="__source"&&!(r in t))return!0;for(var n in t)if(n!=="__source"&&e[n]!==t[n])return!0;return!1}function hd(e,t){this.props=e,this.context=t}(hd.prototype=new Ke).isPureReactComponent=!0,hd.prototype.shouldComponentUpdate=function(e,t){return fd(this.props,e)||fd(this.state,t)};var pd=V.__b;V.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),pd&&pd(e)};var dC=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var pm=V.__e;V.__e=function(e,t,r,n){if(e.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=r.__e,t.__k=r.__k),i.__c(e,t)}pm(e,t,r,n)};var md=V.unmount;function wd(e,t,r){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(n){typeof n.__c=="function"&&n.__c()}),e.__c.__H=null),(e=hm({},e)).__c!=null&&(e.__c.__P===r&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(n){return wd(n,t,r)})),e}function Ad(e,t,r){return e&&r&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(n){return Ad(n,t,r)}),e.__c&&e.__c.__P===t&&(e.__e&&r.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=r)),e}function Ja(){this.__u=0,this.o=null,this.__b=null}function Ed(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ei(){this.i=null,this.l=null}V.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),md&&md(e)},(Ja.prototype=new Ke).__c=function(e,t){var r=t.__c,n=this;n.o==null&&(n.o=[]),n.o.push(r);var i=Ed(n.__v),o=!1,a=function(){o||(o=!0,r.__R=null,i?i(s):s())};r.__R=a;var s=function(){if(!--n.__u){if(n.state.__a){var l=n.state.__a;n.__v.__k[0]=Ad(l,l.__c.__P,l.__c.__O)}var c;for(n.setState({__a:n.__b=null});c=n.o.pop();)c.forceUpdate()}};n.__u++||32&t.__u||n.setState({__a:n.__b=n.__v.__k[0]}),e.then(a,a)},Ja.prototype.componentWillUnmount=function(){this.o=[]},Ja.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var r=document.createElement("div"),n=this.__v.__k[0].__c;this.__v.__k[0]=wd(this.__b,r,n.__O=n.__P)}this.__b=null}var i=t.__a&&jr(Nt,null,e.fallback);return i&&(i.__u&=-33),[jr(Nt,null,t.__a?null:e.children),i]};var vd=function(e,t,r){if(++r[1]===r[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(r=e.i;r;){for(;r.length>3;)r.pop()();if(r[1]<r[0])break;e.i=r=r[2]}};(Ei.prototype=new Ke).__a=function(e){var t=this,r=Ed(t.__v),n=t.l.get(e);return n[0]++,function(i){var o=function(){t.props.revealOrder?(n.push(i),vd(t,e,n)):i()};r?r(o):o()}},Ei.prototype.render=function(e){this.i=null,this.l=new Map;var t=Vr(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var r=t.length;r--;)this.l.set(t[r],this.i=[1,0,this.i]);return e.children},Ei.prototype.componentDidUpdate=Ei.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,r){vd(e,r,t)})};var mm=typeof Symbol!="undefined"&&Symbol.for&&Symbol.for("react.element")||60103,vm=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,gm=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,_m=/[A-Z0-9]/g,ym=typeof document!="undefined",bm=function(e){return(typeof Symbol!="undefined"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function st(e,t,r){return t.__k==null&&(t.textContent=""),ed(e,t),typeof r=="function"&&r(),e?e.__c:null}Ke.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ke.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var gd=V.event;function wm(){}function Am(){return this.cancelBubble}function Em(){return this.defaultPrevented}V.event=function(e){return gd&&(e=gd(e)),e.persist=wm,e.isPropagationStopped=Am,e.isDefaultPrevented=Em,e.nativeEvent=e};var Id,Im={enumerable:!1,configurable:!0,get:function(){return this.class}},_d=V.vnode;V.vnode=function(e){typeof e.type=="string"&&function(t){var r=t.props,n=t.type,i={},o=n.indexOf("-")===-1;for(var a in r){var s=r[a];if(!(a==="value"&&"defaultValue"in r&&s==null||ym&&a==="children"&&n==="noscript"||a==="class"||a==="className")){var l=a.toLowerCase();a==="defaultValue"&&"value"in r&&r.value==null?a="value":a==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?a="ondblclick":l!=="onchange"||n!=="input"&&n!=="textarea"||bm(r.type)?l==="onfocus"?a="onfocusin":l==="onblur"?a="onfocusout":gm.test(a)&&(a=l):l=a="oninput":o&&vm.test(a)?a=a.replace(_m,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&i[a=l]&&(a="oninputCapture"),i[a]=s}}n=="select"&&i.multiple&&Array.isArray(i.value)&&(i.value=Vr(r.children).forEach(function(c){c.props.selected=i.value.indexOf(c.props.value)!=-1})),n=="select"&&i.defaultValue!=null&&(i.value=Vr(r.children).forEach(function(c){c.props.selected=i.multiple?i.defaultValue.indexOf(c.props.value)!=-1:i.defaultValue==c.props.value})),r.class&&!r.className?(i.class=r.class,Object.defineProperty(i,"className",Im)):(r.className&&!r.class||r.class&&r.className)&&(i.class=i.className=r.className),t.props=i}(e),e.$$typeof=mm,_d&&_d(e)};var yd=V.__r;V.__r=function(e){yd&&yd(e),Id=e.__c};var bd=V.diffed;V.diffed=function(e){bd&&bd(e);var t=e.props,r=e.__e;r!=null&&e.type==="textarea"&&"value"in t&&t.value!==r.value&&(r.value=t.value==null?"":t.value),Id=null};var Sm=Object.defineProperty,Cm=Object.defineProperties,Rm=Object.getOwnPropertyDescriptors,Ci=Object.getOwnPropertySymbols,Nd=Object.prototype.hasOwnProperty,Pd=Object.prototype.propertyIsEnumerable,Sd=(e,t,r)=>t in e?Sm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,At=(e,t)=>{for(var r in t||(t={}))Nd.call(t,r)&&Sd(e,r,t[r]);if(Ci)for(var r of Ci(t))Pd.call(t,r)&&Sd(e,r,t[r]);return e},km=(e,t)=>Cm(e,Rm(t)),Om=(e,t)=>{var r={};for(var n in e)Nd.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ci)for(var n of Ci(e))t.indexOf(n)<0&&Pd.call(e,n)&&(r[n]=e[n]);return r},Ri=(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 Tm(e){return!!(e!=null&&e.__nativeBuffers__)}var xm=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};function $a(e){if(typeof e=="string")try{e=JSON.parse(e)}catch(r){return{}}if(typeof e!="object"||e===null)return{};if(!Tm(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=xm(n.base64)),typeof i!="undefined"&&i instanceof ArrayBuffer&&(e[n.key]=i)}}return e}var Dm=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)};function Nm(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:Dm(o),key:i};n.push(a),delete r[i]}return n.length>0&&(r.__nativeBuffers__=n),r}var Ld=Object.defineProperty,Pm=Object.getOwnPropertyDescriptor,Lm=(e,t)=>{for(var r in t)Ld(e,r,{get:t[r],enumerable:!0})},Ud=(e,t,r,n)=>{for(var i=n>1?void 0:n?Pm(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&&Ld(t,r,i),i},Um=(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}function Bm(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}var Mm=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))}})}};function Bd(e){return typeof e=="string"}function fr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&!(e instanceof RegExp)&&!(e instanceof Date)}function Cd(e){return typeof e=="number"&&!isNaN(e)}function Gm(e){return typeof e=="undefined"}function Jm(e){return Gm(e)||e===null}function Md(e){return typeof e=="function"}function Fm(e){return fr(e)&&Md(e.then)}function Gd(e){let t=e,r=null,n=function(...i){return r||(r=new t(...i)),r};return n.prototype=t.prototype,n}var qm=(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))(qm||{}),jm=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}},ki=class extends jm{constructor(){super(...arguments),this.kind="INTERNAL_ERROR"}},Hm=class extends ki{constructor(){super(...arguments),this.name="INTERNAL_INVOKE_NATIVE_ERROR"}},Vm=class extends ki{constructor(e,t,r,n){super(e),this.errNo=t,this.name="INTERNAL_APPLY_NATIVE_ERROR",this.errorType=r,this.errorCode=n}},Km=class extends ki{constructor(){super(...arguments),this.name="INTERNAL_JSCORE_ERROR",this.priority="P0"}},Fa=class extends ki{constructor(){super(...arguments),this.name="INTERNAL_METRIC_REPORT_ERROR"}};function zr(e){return(...t)=>{var r,n;((n=(r=globalThis.VConsole)==null?void 0:r[e])!=null?n:globalThis.console[e])(...t)}}var Oi={log:zr("log"),warn:zr("warn"),info:zr("info"),error:zr("error"),debug:zr("debug")};Object.assign(globalThis,{logger:Oi});var Rd=Symbol.for("Jolibox.canIUseMap"),$m={};globalThis[Rd]||(globalThis[Rd]=$m);function Wm(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}var Wa=Symbol.for("Jolibox.canIUseMap.native"),zm={};globalThis[Wa]||(globalThis[Wa]=zm);var za={get config(){return globalThis[Wa]}},Ym=(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))(Ym||{}),Xm=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Xm||{}),Qm=(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))(Qm||{});function Zm(){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}}Zm();var ur=typeof window=="undefined",ev=()=>!ur&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK"),pC={isiOS:!ur&&(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:!ur&&navigator.userAgent.includes("Android"),isMac:!ur&&navigator.userAgent.includes("Mac"),isFacebook:!ur&&navigator.userAgent.includes("FB_IAB"),isPC:!ur&&!navigator.userAgent.includes("iPhone")&&!navigator.userAgent.includes("Android")},Ya=class Xa{constructor(t){this.element=t,this.next=Xa.Undefined,this.prev=Xa.Undefined}};Ya.Undefined=new Ya(void 0);var de=Ya,tv=class{constructor(){this._first=de.Undefined,this._last=de.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===de.Undefined}clear(){let e=this._first;for(;e!==de.Undefined;){let t=e.next;e.prev=de.Undefined,e.next=de.Undefined,e=t}this._first=de.Undefined,this._last=de.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new de(e);if(this._first===de.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!==de.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==de.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==de.Undefined&&e.next!==de.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===de.Undefined&&e.next===de.Undefined?(this._first=de.Undefined,this._last=de.Undefined):e.next===de.Undefined?(this._last=this._last.prev,this._last.next=de.Undefined):e.prev===de.Undefined&&(this._first=this._first.next,this._first.prev=de.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==de.Undefined;)yield e.element,e=e.next}},rv=0,Yr=class{constructor(e){this.value=e,this.id=rv++}},Qr=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 Yr&&(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 Yr(t);return this._listeners?this._listeners instanceof Yr?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 h,d,p,m;if(!this._disposed){if(this._listeners instanceof Yr)this._listeners.id===c.id&&(this._listeners=void 0,this._size=0,(d=(h=this.options)==null?void 0:h.onDidRemoveLastListener)==null||d.call(h));else if(this._listeners){let b=this._listeners.indexOf(c);b>=0&&(this._listeners.splice(b,1),this._size--,this._size===0&&((m=(p=this.options)==null?void 0:p.onDidRemoveLastListener)==null||m.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 Yr?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},Qa=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 Qr,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 tv,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)}},Za={};Lm(Za,{None:()=>nv,filter:()=>ov,once:()=>Jd,toPromise:()=>iv});var nv=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function iv(e){return new Promise(t=>Jd(e)(t))}function Jd(e){return(t,r=null)=>{let n=!1;return e(i=>{if(!n)return n=!0,t.call(r,i)},null)}}function ov(e,t){return(r=>{let n,i={onWillAddFirstListener(){n=r(o.fire,o)}},o=new Qr(i);return o.event})((r,n=null)=>e(i=>t(i)&&r.call(n,i),null))}var qa=Symbol.for("Jolibox.hostEmitter"),av=()=>{let e=new Qa;return globalThis[qa]||(globalThis[qa]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[qa]},mC=av();function sv(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)lv(e[n],t[n])}function lv(e,t){if(Bd(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(Md(t)){try{if(e instanceof t)return}catch(r){}if(!Jm(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")}}var es=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new Qr,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 sv(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}};es=Ud([Gd],es);var kd=class{constructor(){this._onWillExecuteCommand=new Qr,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new Qr,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new es,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Bm(3e4)),this._starActivation}executeCommand(e,...t){return Um(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,t):(yield Promise.all([Promise.race([this._activateStar(),Za.toPromise(Za.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}}};kd=Ud([Gd],kd);var vC=Symbol.for("Jolibox.commands");Oe("requestPaymentSync",{version:1e6,properties:{paymentBody:{appStoreProductId:102e4}}});Oe("requestProductDetailsAsync",{version:102e4});Oe("invokeSubscriptionPanelSync",{version:107e4,properties:{type:{game:107e4,drama:107e4}}});Oe("loginSync",{version:1e6,properties:{skipLogin:102e4,triggerFrom:102e4}});Oe("getABTest",{version:1050100,platforms:{android:1050100,ios:!1}});Oe("userTrackAsync",{version:1e6});Oe("openMiniapp",{version:1050100});Oe("requestCoinDetailsSync",{version:1070100});Oe("requestCoinDetailsAsync",{version:1070100});Oe("sendServerEventAsync",{version:1070100});Oe("requestGameLeaderboardSync",{version:108e4});Oe("requestGameLeaderboardAsync",{version:108e4});Oe("notifyTaskGameInfoAsync",{version:1080100});Oe("loadAdsAsync",{version:1070200});Oe("showAdAsync",{version:1070200});Oe("onJoliboxHideLoading",{version:1070300});function Oe(e,t){if(za.config[e]){Oi.warn(`[can i use] ${e} already registered`);return}za.config[e]=At({},t)}var Fd=(e,t)=>{function r(i){var o;let[a,...s]=i.split(":");if(!a)return!1;let l=za.config[a];if(!l)return!1;let c=(o=t==null?void 0:t())!=null?o:"",h=l.version;if(l.platforms&&c in l.platforms){let p=l.platforms[c];if(p===!1)return!1;typeof p=="number"&&(h=p)}if(typeof h!="number")return!1;let d=e();return typeof d!="number"||d<h?!1:s.length===0?!0:n(l,s,d)||n(l.properties,s,d)}function n(i,o,a){if(!i)return!1;let s=Wm(i,o);if(!s)return!1;if(fr(s)){let l=s.version;return Cd(l)?typeof a=="number"&&a>=l:!0}return Cd(s)?typeof a=="number"&&a>=s:s===!0}return{canIUseNative:r}};function Od(e,t){return`[${e}]:${t}`}var cv=()=>ev(),Xr="custom_event_",dv=[],uv=[],fv=["env","createRequestTask","login"],qd="__batch_event__",hv="__native_batch_event__",pv=e=>e==="pv"?e:"default",Si=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=pv(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&&fr(a))throw new Fa(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);if(s){let l=[];if(fr(a))l.push(...Object.keys(a));else if(Bd(a)){if(i.length>0)throw new Fa(`report value failed to match tagNameOrder, ${JSON.stringify(r)}`);l.push(a)}else throw new Fa(`expected metric value to be a string, but got a(n) ${typeof a}, ${JSON.stringify(r)}`);l.forEach(c=>{n[c]||(n[c]={});let h=fr(a)?a[c]:a;t(n[c],[...i],o,h)})}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={}}},Td=!1,ja,Ha,Va;function mv(e,t){Td||(ja=new Si({eventName:"jolibox_invoke",tagNameOrder:["status","method","errNo","errMsg","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Ha=new Si({eventName:"jolibox_invoke_js2native",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),Va=new Si({eventName:"jolibox_invoke_native2js",tagNameOrder:["status","method","isForeground"],metricName:"duration",reporter(i){e.invoke("trackAsync",JSON.stringify({event:"reportMetrics",data:i}),-1)}}),t("onJoliboxEnterBackground",()=>{ja.flush(),Ha.flush(),Va.flush()}),Td=!0);function r(i){var o,a;let{method:s,args:l,startTime:c,isForeground:h,errMsg:d=`${s}:fail no errMsg`,errNo:p=0,__timing:m={receiveJSInvoke:0,invokeCallback:0}}=i,{receiveJSInvoke:b,invokeCallback:E}=m,I=(a=(o=d.match(/\S:(\S+)\s?/))==null?void 0:o[1])!=null?a:"fail";ja.report({status:I,method:n(s,l),errNo:`${p}`,errMsg:d,isForeground:h,duration:Date.now()-c}),c&&b&&E&&(Ha.report({status:I,method:s,isForeground:h,duration:Number((b-c).toFixed(3))}),Va.report({status:I,method:s,isForeground:h,duration:Number((Date.now()-E).toFixed(3))}))}function n(i,o){return(i==="callHostMethod"||i==="callHostMethodSync")&&o!=null&&o.method?`${i}-${o.method}`:i}return r}var Ka=[],vv=!1,ts=Symbol.for("Jolibox.invokeResolverInstance"),gv=new Map;globalThis[ts]||(globalThis[ts]=gv);var _v={get resolveMap(){return globalThis[ts]}};function yv(e,t){let r=0,n=!0,i=_v.resolveMap,o=mv(e,t);t("onJoliboxEnterBackground",()=>{n=!1}),t("onJoliboxEnterForeground",()=>{n=!0,Ka.forEach(l=>Ri(this,[l],function*({method:c,args:h,resolve:d}){let p=yield s(c,h);d(p)})),Ka.length=0});let a=(l,c)=>{let h=i.get(Number(l));if(!h)return;let d=$a(c);h(d),i.delete(Number(l))},s=(l,c)=>{var h,d;let p=Date.now(),m=`${n}`;r+=1;let b=new Mm;if(i.set(r,b.resolve),!n&&uv.includes(l))return new Promise(P=>{Ka.push({method:l,args:c,resolve:P})});let E=km(At({},{method:l,startTime:p,args:c,isForeground:m}),{invokeType:"js-bridge"}),I=!vv&&dv.includes(l),w=Nm(c,I),R=I?w:JSON.stringify(w),k;if(l.endsWith("Sync")||fv.includes(l)?k=(h=e.call)==null?void 0:h.call(e,l,w,r):typeof R=="string"?k=e.invoke(l,R,r):k=(d=e.call)==null?void 0:d.call(e,l,R,r),k){try{typeof k=="string"&&(k=JSON.parse(k)),k=$a(k)}catch(P){Oi.error(P)}return i.delete(r),k.errorCode&&(k.errorCode=Od(l,k.errorCode)),o(At(At({},E),k)),k}return l.endsWith("Sync")&&i.delete(r),b.promise.then(P=>(P.errorCode&&(P.errorCode=Od(l,P.errorCode)),o(At(At({},E),P)),P))};return{invokeNative:s,applyNative:(l,c)=>{let h=s(l,c);return Fm(h)?h.then(d=>xd(l,d)):xd(l,h)},invokeHandler:a}}function xd(e,t){if(!fr(t)){Oi.warn(`[Jolibox SDK]${e} no response value`);return}let r=t,{errMsg:n,errNo:i,errorType:o,errorCode:a}=r,s=Om(r,["errMsg","errNo","errorType","errorCode"]);if(n&&n!==`${e}:ok`)throw new Vm(n,i,o,a);return s}var Ii=Symbol.for("Jolibox.subscribeInstance");function bv(e){if(globalThis[Ii])return globalThis[Ii];let t=new Qa,r=new Qa,n=new Si({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[Ii]={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=$a(o),l;if(s.__extra){l=s.params;let{type:c,startTime:h}=s.__extra;n.report({type:c,event:i,duration:Date.now()-h})}else l=s;if(i===qd){l.forEach(c=>{let[h,d]=c;try{r.emit(h.slice(Xr.length),d,a)}catch(p){}});return}if(i.startsWith(Xr)){r.emit(i.slice(Xr.length),l,a);return}t.emit(i,l,a)}},globalThis[Ii]}function wv(e){let t=new Map,r=new Map,n,i;return{publish:(o,a,s,l)=>{if(l){let h=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(`${Xr}${o}`,a,h);return}n||(n=Promise.resolve().then(()=>{t.forEach((h,d)=>{try{let p=d!==void 0?d==="*"?"*":[d]:void 0;e.publish(qd,h,p)}catch(p){}}),n=void 0,t.clear()}));let c=t.get(s);c||(c=[],t.set(s,c)),c.push([`${Xr}${o}`,a])},emitNative:(o,a,s,l)=>{if(l){let h=s!==void 0?s==="*"?"*":[s]:void 0;e.publish(o,a,h),console.log("emitNative",o,a,h);return}i||(i=Promise.resolve().then(()=>{r.forEach((h,d)=>{try{let p=d!==void 0?d==="*"?"*":[d]:void 0;e.publish(hv,h,p)}catch(p){}}),i=void 0,r.clear()}));let c=r.get(s);c||(c=[],r.set(s,c)),c.push([o,a])}}}function Av(e){let{subscribeHandler:t,onNative:r,offNative:n,subscribe:i,unsubscribe:o}=bv(e),{invokeNative:a,invokeHandler:s,applyNative:l}=yv(e,r),{publish:c,emitNative:h}=wv(e);return{invokeHandler:s,subscribeHandler:t,applyNative:l,invokeNative:a,onNative:r,offNative:n,emitNative:h,publish:c,subscribe:i,unsubscribe:o}}function jd(e,t){return{params:e,__extra:{startTime:Date.now(),type:t}}}var rs,Lt={trigger(){},exit(){return Promise.resolve(!1)},backPress(){return Promise.resolve(!1)},onReady(e){Lt.trigger=e},onDoExit(e){Lt.exit=e},onDoBackPress(e){Lt.backPress=e}},Hd=e=>{let t=window.prompt("invoke",JSON.stringify({event:"envSync",paramsString:JSON.stringify({})}));if(!t)e.onError(new Hm("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="")=>{Lt.trigger(),e.onDocumentReady.postMessage({path:i})},r=i=>Ri(void 0,null,function*(){let o=yield Lt.exit();e.doExit.postMessage({uuid:i,shouldInterrupt:o})});rs={onDocumentReady:t,doExit:r,invoke(i,o,a){e.invoke.postMessage({event:i,paramsString:o,callbackId:a})},publish(i,o,a){let s=jd(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:Hd,doExit:r};globalThis.joliboxJSCore=At({},n)}if(typeof window!="undefined"&&window.JoliAndroidSDKBridge){let e,t=window.JoliAndroidSDKBridge,r=(o="")=>{Lt.trigger(),t.onDocumentReady(JSON.stringify({path:o}))},n=o=>Ri(void 0,null,function*(){let a=yield Lt.exit();t.doExit(JSON.stringify({uuid:o,shouldInterrupt:a}))});rs={onDocumentReady:r,invoke(o,a,s){t.invoke(JSON.stringify({event:o,paramsString:a,callbackId:s}))},doExit:n,publish(o,a,s){let l=jd(a,"joliboxJSCore");t.publish(JSON.stringify({event:o,paramsString:JSON.stringify(l),webviewIds:s}))},call(o,a,s){let l=window.prompt("invoke",JSON.stringify({event:o,paramsString:JSON.stringify(a),callbackId:s}));if(l)return JSON.parse(l)},doBackPress(o){return Ri(this,null,function*(){let a=yield Lt.backPress();t.doBackPress(JSON.stringify({uuid:o,shouldInterrupt:a}))})}};let i={onDocumentReady:r,env:Hd,doExit:n};globalThis.joliboxJSCore=At({},i)}var Vd=rs;if(!Vd&&cv())throw new Km("No joliboxJScore is found, native bridge not found.");var Ev=At({},Vd),Kd=Av(Ev),{invokeHandler:Dd}=Kd,{applyNative:gC,invokeNative:Ti,onNative:$d,offNative:Wd,subscribeHandler:Iv,publish:_C,emitNative:yC,subscribe:bC,unsubscribe:wC}=Kd;globalThis.joliboxJSBridge={callHandler:Dd,invokeHandler:Dd,subscribeHandler:Iv};var Sv=Object.defineProperty,Cv=Object.defineProperties,Rv=Object.getOwnPropertyDescriptors,ji=Object.getOwnPropertySymbols,Eu=Object.prototype.hasOwnProperty,Iu=Object.prototype.propertyIsEnumerable,zd=(e,t,r)=>t in e?Sv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,yr=(e,t)=>{for(var r in t||(t={}))Eu.call(t,r)&&zd(e,r,t[r]);if(ji)for(var r of ji(t))Iu.call(t,r)&&zd(e,r,t[r]);return e},kv=(e,t)=>Cv(e,Rv(t)),Ov=(e,t)=>{var r={};for(var n in e)Eu.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&ji)for(var n of ji(e))t.indexOf(n)<0&&Iu.call(e,n)&&(r[n]=e[n]);return r},Su=Object.defineProperty,Tv=Object.defineProperties,xv=Object.getOwnPropertyDescriptors,Yd=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Nv=Object.prototype.propertyIsEnumerable,Xd=(e,t,r)=>t in e?Su(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Pv=(e,t)=>{for(var r in t||(t={}))Dv.call(t,r)&&Xd(e,r,t[r]);if(Yd)for(var r of Yd(t))Nv.call(t,r)&&Xd(e,r,t[r]);return e},Lv=(e,t)=>Tv(e,xv(t)),Uv=(e,t)=>{for(var r in t)Su(e,r,{get:t[r],enumerable:!0})},Cu=(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},Bv=(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}function Mv(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function Gv(e){return typeof e=="string"}function Jv(e){return typeof e=="undefined"}function Fv(e){return Jv(e)||e===null}function qv(e){return typeof e=="function"}function Ru(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}var jv=(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))(jv||{});function Zr(e){return function(){var t,r;((r=(t=globalThis.VConsole)==null?void 0:t[e])!=null?r:globalThis.console[e])(...arguments)}}var Hv={log:Zr("log"),warn:Zr("warn"),info:Zr("info"),error:Zr("error"),debug:Zr("debug")};Object.assign(globalThis,{logger:Hv});var Qd=Symbol.for("Jolibox.canIUseMap"),Vv={};globalThis[Qd]||(globalThis[Qd]=Vv);var Zd=Symbol.for("Jolibox.canIUseMap.native"),Kv={};globalThis[Zd]||(globalThis[Zd]=Kv);var ku=(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))(ku||{}),Ou=(e=>(e.MiniGame="mini-game",e.MiniDrama="mini-drama",e.App="app",e.WebSDK="web-sdk",e.AppSDK="app-sdk",e))(Ou||{}),Tu=(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))(Tu||{}),eu=["name","params"],$v=["name","type","location","target","extra","timestamp","userId"],Wv=["platform","os","appVersion","appId","model","brand","uuid","jsSdkVersion","extra"];function Li(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 zv(e){let t=e.location?Li(e.location,eu):null,r=e.target?Li(e.target,eu):null;return Li(Lv(Pv({},e),{location:t,target:r}),$v)}function Yv(e){let t=e.events.map(n=>zv(n)),r=Li(e.device,Wv);return[e.protocolVersion,t,r,e.project]}function Xv(){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}}Xv();var vr=typeof window=="undefined",Hi=()=>!vr&&!!(navigator.userAgent||"").includes("JoliboxPlatformSDK");!vr&&(navigator.userAgent.includes("iPhone")||navigator.userAgent.includes("iPod")||navigator.userAgent.includes("iPad")||navigator.userAgent.includes("iPhone OS")),!vr&&navigator.userAgent.includes("Android"),!vr&&navigator.userAgent.includes("Mac"),!vr&&navigator.userAgent.includes("FB_IAB"),!vr&&!navigator.userAgent.includes("iPhone")&&navigator.userAgent.includes("Android");var fs=class hs{constructor(t){this.element=t,this.next=hs.Undefined,this.prev=hs.Undefined}};fs.Undefined=new fs(void 0);var ue=fs,Qv=class{constructor(){this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===ue.Undefined}clear(){let e=this._first;for(;e!==ue.Undefined;){let t=e.next;e.prev=ue.Undefined,e.next=ue.Undefined,e=t}this._first=ue.Undefined,this._last=ue.Undefined,this._size=0}unshift(e){return this._insert(e,!1)}push(e){return this._insert(e,!0)}_insert(e,t){let r=new ue(e);if(this._first===ue.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!==ue.Undefined){let e=this._first.element;return this._remove(this._first),e}}pop(){if(this._last!==ue.Undefined){let e=this._last.element;return this._remove(this._last),e}}_remove(e){if(e.prev!==ue.Undefined&&e.next!==ue.Undefined){let t=e.prev;t.next=e.next,e.next.prev=t}else e.prev===ue.Undefined&&e.next===ue.Undefined?(this._first=ue.Undefined,this._last=ue.Undefined):e.next===ue.Undefined?(this._last=this._last.prev,this._last.next=ue.Undefined):e.prev===ue.Undefined&&(this._first=this._first.next,this._first.prev=ue.Undefined);this._size-=1}*[Symbol.iterator](){let e=this._first;for(;e!==ue.Undefined;)yield e.element,e=e.next}},Zv=0,en=class{constructor(e){this.value=e,this.id=Zv++}},an=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 en&&(this._listeners=[this._listeners]),this._listeners=this._listeners.filter(n=>(n==null?void 0:n.value)===e)):(this._listeners=void 0,this._size=0)),(r=(t=this.options)==null?void 0:t.onDidRemoveLastListener)==null||r.call(t))}get event(){return this._event!=null||(this._event=(e,t)=>{var r,n,i,o,a,s;if(this._disposed)return()=>{console.info("[Jolibox SDK] Emitter is _disposed")};t&&(e=e.bind(t));let l=new en(e);return this._listeners?this._listeners instanceof en?this._listeners=[this._listeners,l]:this._listeners.push(l):((n=(r=this.options)==null?void 0:r.onWillAddFirstListener)==null||n.call(r,this),this._listeners=l,(o=(i=this.options)==null?void 0:i.onDidFirstListener)==null||o.call(i,this)),(s=(a=this.options)==null?void 0:a.onDidAddListener)==null||s.call(a,this),this._size++,()=>{var c,h,d,p;if(!this._disposed){if(this._listeners instanceof en)this._listeners.id===l.id&&(this._listeners=void 0,this._size=0,(h=(c=this.options)==null?void 0:c.onDidRemoveLastListener)==null||h.call(c));else if(this._listeners){let m=this._listeners.indexOf(l);m>=0&&(this._listeners.splice(m,1),this._size--,this._size===0&&((p=(d=this.options)==null?void 0:d.onDidRemoveLastListener)==null||p.call(d)))}}}}),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 en?this._deliver(this._listeners,e):this._listeners.forEach(t=>this._deliver(t,e)))}hasListeners(){return this._size>0}},eg=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 an,o=l=>t(...l.args),a=i.event(o);this.listerHandlerMap.set(t,{handler:o,dispose:a}),this.listeners.set(e,i);let s=this.cachedEventQueue.get(e);if(s&&r)for(let l of s)t(...l.args)}flushCachedEvent(e){e?this.cachedEventQueue.delete(e):this.cachedEventQueue.clear()}off(e,t){let r=this.listerHandlerMap.get(t);r&&(r.dispose(),this.listerHandlerMap.delete(t))}emit(e){let t=this.listeners.get(e),r=this.cachedEventQueue.get(e);for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];r||(r=new Qv,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)}},ps={};Uv(ps,{None:()=>tg,filter:()=>ng,once:()=>xu,toPromise:()=>rg});var tg=()=>(console.log("[Jolibox SDK] None Event"),()=>{console.log("[Jolibox SDK] None Event dispose")});function rg(e){return new Promise(t=>xu(e)(t))}function xu(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 ng(e,t){return(r=>{let n={onWillAddFirstListener(){r(i.fire,i)}},i=new an(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)})}var ns=Symbol.for("Jolibox.hostEmitter"),ig=()=>{let e=new eg;return globalThis[ns]||(globalThis[ns]={on:e.on.bind(e),off:e.off.bind(e),emit:e.emit.bind(e),once:e.once.bind(e)}),globalThis[ns]};ig();function og(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++)ag(e[n],t[n])}function ag(e,t){if(Gv(t)){if(typeof e!==t)throw new Error(`argument does not match constraint: typeof ${t}`)}else if(qv(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")}}var ms=class{constructor(){this._commands=new Map,this._onDidRegisterCommand=new an,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 og(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}};ms=Cu([Ru],ms);var tu=class{constructor(){this._onWillExecuteCommand=new an,this.onWillExecuteCommand=this._onWillExecuteCommand.event,this._onDidExecuteCommand=new an,this.onDidExecuteCommand=this._onDidExecuteCommand.event,this.registry=new ms,this._starActivation=null}_activateStar(){return this._starActivation||(this._starActivation=Mv(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 Bv(this,null,function*(){return this.registry.getCommand(e)?this._tryExecuteCommand(e,r):(yield Promise.all([Promise.race([this._activateStar(),ps.toPromise(ps.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{}}};tu=Cu([Ru],tu);function qe(e,t,r){return(t=sg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function sg(e){var t=lg(e,"string");return typeof t=="symbol"?t:t+""}function lg(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 hr=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")},vs=class{constructor(t){qe(this,"context",void 0),qe(this,"continueCallback",void 0),qe(this,"adIsShowingCallback",void 0),qe(this,"isBeforeAdCalled",!1),qe(this,"isBeforeRewardCalled",!1),qe(this,"isAdDismissedCalled",!1),qe(this,"isAdViewedCalled",!1),qe(this,"isAfterAdCalled",!1),qe(this,"currentProvider",void 0),qe(this,"currentClientParams",void 0),qe(this,"adsHasResponse",!1),qe(this,"videoChecker",window.document.createElement("video")),qe(this,"contextInfo",void 0),qe(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",yr({userEvent:a},this.paramsToTrack)),Hi()&&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=hr(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=hr(t);a==null||a(),((r=this.currentClientParams)==null?void 0:r.type)!=="reward"&&((n=this.adIsShowingCallback)==null||n.call(this,!0),Hi()&&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=hr(t);r==null||r()}}}wrapAdViewed(t){return()=>{if(this.adsHasResponse=!0,!this.isAdViewedCalled){this.isAdViewedCalled=!0;let r=hr(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=hr(t);r==null||r()}}}wrapAdBreakDone(t){return r=>{var n,i,o,a,s,l,c,h,d;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,breakReason:r.breakReason,breakStage:r.breakStage}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_DONE",{provider:(s=(a=this.currentProvider)==null?void 0:a.name)!=null?s:null,breakType:r.breakType,breakName:(l=r.breakName)!=null?l:"",breakFormat:r.breakFormat,breakStatus:r.breakStatus,breakReason:r.breakReason,breakStage:r.breakStage}),r.breakStatus){case"viewed":case"ignored":case"dismissed":case"error":{let p=hr(t);p==null||p(r),(c=this.adIsShowingCallback)==null||c.call(this,!1),(h=this.continueCallback)==null||h.call(this,[!1,r]);break}default:{(d=this.continueCallback)==null||d.call(this,[!0,r]);break}}}}callAdBreakAndContinue(t,r,n,i){return A(this,null,function*(){return this.currentProvider=t,this.currentClientParams=r,this.adsHasResponse=!1,new Promise(o=>{this.continueCallback=o,this.adIsShowingCallback=i;let a;switch(r.type){case"preroll":{a={type:r.type,adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}case"reward":{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),beforeReward:this.wrapBeforeReward(r.beforeReward),adDismissed:this.wrapAdDismissed(r.adDismissed),adViewed:this.wrapAdViewed(r.adViewed),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}default:{a={name:r.name,type:r.type,beforeAd:this.wrapBeforeAd(r.beforeAd),afterAd:this.wrapAfterAd(r.afterAd),adBreakDone:this.wrapAdBreakDone(r.adBreakDone)};break}}window.setTimeout(()=>{var s,l,c,h,d,p,m;this.adsHasResponse||(this.context.track("CallAdBreakTimeout",{type:r.type,provider:(l=(s=this.currentProvider)==null?void 0:s.name)!=null?l:null}),this.notifyIframeAdsEvent("JOLIBOX_AD_CALL_AD_BREAK_TIMEOUT",{type:r.type,provider:(h=(c=this.currentProvider)==null?void 0:c.name)!=null?h:null}),(p=this.continueCallback)==null||p.call(this,[!0,{breakType:r.type,breakName:r.type==="preroll"?"":(d=r.name)!=null?d:"",breakFormat:r.type==="reward"?"reward":"interstitial",breakStatus:"timeout",breakStage:"provider_request"}]),(m=this.adIsShowingCallback)==null||m.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")})})}};function xi(e,t,r){return(t=cg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cg(e){var t=dg(e,"string");return typeof t=="symbol"?t:t+""}function dg(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 gs=class{constructor(t){xi(this,"context",void 0),xi(this,"adBreakIsShowing",!1),xi(this,"reportPageJumpOut",()=>{this.context.track("AdBreakJumpOut",{context:"AdsActionDetection"})}),xi(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()})}};function Di(e,t,r){return(t=ug(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ug(e){var t=fg(e,"string");return typeof t=="symbol"?t:t+""}function fg(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 _s=class{constructor(t){Di(this,"configs",null),Di(this,"firstRun",!0),Di(this,"context",void 0),Di(this,"contextInfo",void 0),this.context=t,this.contextInfo=this.context.getContextInfo(),this.init()}init(){return A(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}};function Et(e,t,r){return(t=hg(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hg(e){var t=pg(e,"string");return typeof t=="symbol"?t:t+""}function pg(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 ys=class{constructor(t,r){Et(this,"name","ADSENSE"),Et(this,"context",void 0),Et(this,"contextInfo",void 0),Et(this,"configured",!1),Et(this,"initParams",void 0),Et(this,"push",function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};window.adsbygoogle.push(n)}),Et(this,"adConfig",n=>{let i=n,{onReady:o}=i,a=Ov(i,["onReady"]);this.context.track("CallAdConfig",a),this.configured?console.warn("Ad config already set, skipping"):(this.configured=!0,this.push(n))}),Et(this,"adBreak",n=>{if(!this.contextInfo.objectId){console.warn("Game ID is not set, skip calling adBreak");return}this.push(n)}),Et(this,"adUnit",n=>A(this,null,function*(){var i,o,a,s;if(this.context.track("CallAdUnit",{adFormat:(o=(i=n.adFormat)==null?void 0:i.toString())!=null?o:null,fullWidthResponsive:(a=n.fullWidthResponsive)!=null?a:null}),document.querySelector("#jolibox-ads")){console.warn("Ad unit already set, skipping");return}let{el:l,slot:c,adFormat:h,fullWidthResponsive:d,style:p}=n,m;if(!l)throw new Error("targeting element is required");if(typeof l=="string"?m=document.querySelector(l):m=l,!m)throw new Error("targeting element not found");let b=c;if(b||(b=this.initParams.unitId),!b)throw new Error("slot is required");let E=typeof h=="object"&&Array.isArray(h)?h.join(", "):h,I=document.createElement("ins");if(I.className="adsbygoogle",I.id="jolibox-ads",I.style.display="block",I.setAttribute("data-ad-client",this.initParams.clientId),I.setAttribute("data-ad-slot",b),E&&I.setAttribute("data-ad-format",E),d&&I.setAttribute("data-full-width-responsive",d),p&&I.setAttribute("style",p),(s=this.contextInfo.testAdsMode)!=null?s:!1){let w=document.createElement("div");w.style.position="absolute",w.style.top="0",w.style.left="0",w.style.width="100%",w.style.height="100%",w.style.display="flex",w.style.justifyContent="center",w.style.alignItems="center",w.style.backgroundColor="rgba(0, 0, 0, 0.5)",w.style.color="white",w.innerHTML="Test Ad",I.style.position="relative",m.appendChild(I),I.appendChild(w)}else m.appendChild(I),new MutationObserver(w=>{w.forEach(R=>{if(R.type==="attributes"&&R.attributeName==="data-ad-status"){let k=I.getAttribute("data-ad-status");this.context.track("AdSenseUnitStatusChanged",{status:k!=null?k:"null"})}})}).observe(I,{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 A(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)}})}};function mg(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 vg(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}var gg=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(vg(this));var n=this.tags[this.tags.length-1];if(this.isSpeedy){var i=mg(n);try{i.insertRule(r,i.cssRules.length)}catch(o){}}else n.appendChild(document.createTextNode(r));this.ctr++},t.flush=function(){this.tags.forEach(function(r){var n;return(n=r.parentNode)==null?void 0:n.removeChild(r)}),this.tags=[],this.ctr=0},e}(),xe="-ms-",Vi="-moz-",ee="-webkit-",Du="comm",Hs="rule",Vs="decl",_g="@import",Nu="@keyframes",yg="@layer",bg=Math.abs,Qi=String.fromCharCode,wg=Object.assign;function Ag(e,t){return Se(e,0)^45?(((t<<2^Se(e,0))<<2^Se(e,1))<<2^Se(e,2))<<2^Se(e,3):0}function Pu(e){return e.trim()}function Eg(e,t){return(e=t.exec(e))?e[0]:e}function te(e,t,r){return e.replace(t,r)}function bs(e,t){return e.indexOf(t)}function Se(e,t){return e.charCodeAt(t)|0}function sn(e,t,r){return e.slice(t,r)}function dt(e){return e.length}function Ks(e){return e.length}function Ni(e,t){return t.push(e),e}function Ig(e,t){return e.map(t).join("")}var Zi=1,br=1,Lu=0,He=0,ye=0,wr="";function eo(e,t,r,n,i,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:o,line:Zi,column:br,length:a,return:""}}function tn(e,t){return wg(eo("",null,null,"",null,null,0),e,{length:-e.length},t)}function Sg(){return ye}function Cg(){return ye=He>0?Se(wr,--He):0,br--,ye===10&&(br=1,Zi--),ye}function We(){return ye=He<Lu?Se(wr,He++):0,br++,ye===10&&(br=1,Zi++),ye}function ut(){return Se(wr,He)}function Ui(){return He}function un(e,t){return sn(wr,e,t)}function ln(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 Uu(e){return Zi=br=1,Lu=dt(wr=e),He=0,[]}function Bu(e){return wr="",e}function Bi(e){return Pu(un(He-1,ws(e===91?e+2:e===40?e+1:e)))}function Rg(e){for(;(ye=ut())&&ye<33;)We();return ln(e)>2||ln(ye)>3?"":" "}function kg(e,t){for(;--t&&We()&&!(ye<48||ye>102||ye>57&&ye<65||ye>70&&ye<97););return un(e,Ui()+(t<6&&ut()==32&&We()==32))}function ws(e){for(;We();)switch(ye){case e:return He;case 34:case 39:e!==34&&e!==39&&ws(ye);break;case 40:e===41&&ws(e);break;case 92:We();break}return He}function Og(e,t){for(;We()&&e+ye!==57&&!(e+ye===84&&ut()===47););return"/*"+un(t,He-1)+"*"+Qi(e===47?e:We())}function Tg(e){for(;!ln(ut());)We();return un(e,He)}function xg(e){return Bu(Mi("",null,null,null,[""],e=Uu(e),0,[0],e))}function Mi(e,t,r,n,i,o,a,s,l){for(var c=0,h=0,d=a,p=0,m=0,b=0,E=1,I=1,w=1,R=0,k="",P=i,M=o,S=n,D=k;I;)switch(b=R,R=We()){case 40:if(b!=108&&Se(D,d-1)==58){bs(D+=te(Bi(R),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:D+=Bi(R);break;case 9:case 10:case 13:case 32:D+=Rg(b);break;case 92:D+=kg(Ui()-1,7);continue;case 47:switch(ut()){case 42:case 47:Ni(Dg(Og(We(),Ui()),t,r),l);break;default:D+="/"}break;case 123*E:s[c++]=dt(D)*w;case 125*E:case 59:case 0:switch(R){case 0:case 125:I=0;case 59+h:w==-1&&(D=te(D,/\f/g,"")),m>0&&dt(D)-d&&Ni(m>32?nu(D+";",n,r,d-1):nu(te(D," ","")+";",n,r,d-2),l);break;case 59:D+=";";default:if(Ni(S=ru(D,t,r,c,h,i,s,k,P=[],M=[],d),o),R===123)if(h===0)Mi(D,t,S,S,P,o,d,s,M);else switch(p===99&&Se(D,3)===110?100:p){case 100:case 108:case 109:case 115:Mi(e,S,S,n&&Ni(ru(e,S,S,0,0,i,s,k,i,P=[],d),M),i,M,d,s,n?P:M);break;default:Mi(D,S,S,S,[""],M,0,s,M)}}c=h=m=0,E=w=1,k=D="",d=a;break;case 58:d=1+dt(D),m=b;default:if(E<1){if(R==123)--E;else if(R==125&&E++==0&&Cg()==125)continue}switch(D+=Qi(R),R*E){case 38:w=h>0?1:(D+="\f",-1);break;case 44:s[c++]=(dt(D)-1)*w,w=1;break;case 64:ut()===45&&(D+=Bi(We())),p=ut(),h=d=dt(k=D+=Tg(Ui())),R++;break;case 45:b===45&&dt(D)==2&&(E=0)}}return o}function ru(e,t,r,n,i,o,a,s,l,c,h){for(var d=i-1,p=i===0?o:[""],m=Ks(p),b=0,E=0,I=0;b<n;++b)for(var w=0,R=sn(e,d+1,d=bg(E=a[b])),k=e;w<m;++w)(k=Pu(E>0?p[w]+" "+R:te(R,/&\f/g,p[w])))&&(l[I++]=k);return eo(e,t,r,i===0?Hs:s,l,c,h)}function Dg(e,t,r){return eo(e,t,r,Du,Qi(Sg()),sn(e,2,-2),0)}function nu(e,t,r,n){return eo(e,t,r,Vs,sn(e,0,n),sn(e,n+1,-1),n)}function _r(e,t){for(var r="",n=Ks(e),i=0;i<n;i++)r+=t(e[i],i,e,t)||"";return r}function Ng(e,t,r,n){switch(e.type){case yg:if(e.children.length)break;case _g:case Vs:return e.return=e.return||e.value;case Du:return"";case Nu:return e.return=e.value+"{"+_r(e.children,n)+"}";case Hs:e.value=e.props.join(",")}return dt(r=_r(e.children,n))?e.return=e.value+"{"+r+"}":""}function Pg(e){var t=Ks(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 Lg(e){return function(t){t.root||(t=t.return)&&e(t)}}function Ug(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var Bg=function(e,t,r){for(var n=0,i=0;n=i,i=ut(),n===38&&i===12&&(t[r]=1),!ln(i);)We();return un(e,He)},Mg=function(e,t){var r=-1,n=44;do switch(ln(n)){case 0:n===38&&ut()===12&&(t[r]=1),e[r]+=Bg(He-1,t,r);break;case 2:e[r]+=Bi(n);break;case 4:if(n===44){e[++r]=ut()===58?"&\f":"",t[r]=e[r].length;break}default:e[r]+=Qi(n)}while(n=We());return e},Gg=function(e,t){return Bu(Mg(Uu(e),t))},iu=new WeakMap,Jg=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&&!iu.get(r))&&!n){iu.set(e,!0);for(var i=[],o=Gg(t,i),a=r.props,s=0,l=0;s<o.length;s++)for(var c=0;c<a.length;c++,l++)e.props[l]=i[s]?o[s].replace(/&\f/g,a[c]):a[c]+" "+o[s]}}},Fg=function(e){if(e.type==="decl"){var t=e.value;t.charCodeAt(0)===108&&t.charCodeAt(2)===98&&(e.return="",e.value="")}};function Mu(e,t){switch(Ag(e,t)){case 5103:return ee+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return ee+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return ee+e+Vi+e+xe+e+e;case 6828:case 4268:return ee+e+xe+e+e;case 6165:return ee+e+xe+"flex-"+e+e;case 5187:return ee+e+te(e,/(\w+).+(:[^]+)/,ee+"box-$1$2"+xe+"flex-$1$2")+e;case 5443:return ee+e+xe+"flex-item-"+te(e,/flex-|-self/,"")+e;case 4675:return ee+e+xe+"flex-line-pack"+te(e,/align-content|flex-|-self/,"")+e;case 5548:return ee+e+xe+te(e,"shrink","negative")+e;case 5292:return ee+e+xe+te(e,"basis","preferred-size")+e;case 6060:return ee+"box-"+te(e,"-grow","")+ee+e+xe+te(e,"grow","positive")+e;case 4554:return ee+te(e,/([^-])(transform)/g,"$1"+ee+"$2")+e;case 6187:return te(te(te(e,/(zoom-|grab)/,ee+"$1"),/(image-set)/,ee+"$1"),e,"")+e;case 5495:case 3959:return te(e,/(image-set\([^]*)/,ee+"$1$`$1");case 4968:return te(te(e,/(.+:)(flex-)?(.*)/,ee+"box-pack:$3"+xe+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+ee+e+e;case 4095:case 3583:case 4068:case 2532:return te(e,/(.+)-inline(.+)/,ee+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(dt(e)-1-t>6)switch(Se(e,t+1)){case 109:if(Se(e,t+4)!==45)break;case 102:return te(e,/(.+:)(.+)-([^]+)/,"$1"+ee+"$2-$3$1"+Vi+(Se(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~bs(e,"stretch")?Mu(te(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Se(e,t+1)!==115)break;case 6444:switch(Se(e,dt(e)-3-(~bs(e,"!important")&&10))){case 107:return te(e,":",":"+ee)+e;case 101:return te(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ee+(Se(e,14)===45?"inline-":"")+"box$3$1"+ee+"$2$3$1"+xe+"$2box$3")+e}break;case 5936:switch(Se(e,t+11)){case 114:return ee+e+xe+te(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ee+e+xe+te(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ee+e+xe+te(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ee+e+xe+e+e}return e}var qg=function(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case Vs:e.return=Mu(e.value,e.length);break;case Nu:return _r([tn(e,{value:te(e.value,"@","@"+ee)})],n);case Hs:if(e.length)return Ig(e.props,function(i){switch(Eg(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return _r([tn(e,{props:[te(i,/:(read-\w+)/,":"+Vi+"$1")]})],n);case"::placeholder":return _r([tn(e,{props:[te(i,/:(plac\w+)/,":"+ee+"input-$1")]}),tn(e,{props:[te(i,/:(plac\w+)/,":"+Vi+"$1")]}),tn(e,{props:[te(i,/:(plac\w+)/,xe+"input-$1")]})],n)}return""})}},jg=[qg],Hg=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(b){var E=b.getAttribute("data-emotion");E.indexOf(" ")!==-1&&(document.head.appendChild(b),b.setAttribute("data-s",""))})}var n=e.stylisPlugins||jg,i={},o,a=[];o=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+t+' "]'),function(b){for(var E=b.getAttribute("data-emotion").split(" "),I=1;I<E.length;I++)i[E[I]]=!0;a.push(b)});var s,l=[Jg,Fg];{var c,h=[Ng,Lg(function(b){c.insert(b)})],d=Pg(l.concat(n,h)),p=function(b){return _r(xg(b),d)};s=function(b,E,I,w){c=I,p(b?b+"{"+E.styles+"}":E.styles),w&&(m.inserted[E.name]=!0)}}var m={key:t,sheet:new gg({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 m.sheet.hydrate(a),m};function Vg(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)}var Kg={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},$g=/[A-Z]|^ms/g,Wg=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Gu=function(e){return e.charCodeAt(1)===45},ou=function(e){return e!=null&&typeof e!="boolean"},is=Ug(function(e){return Gu(e)?e:e.replace($g,"-$&").toLowerCase()}),au=function(e,t){switch(e){case"animation":case"animationName":if(typeof t=="string")return t.replace(Wg,function(r,n,i){return Bt={name:n,styles:i,next:Bt},n})}return Kg[e]!==1&&!Gu(e)&&typeof t=="number"&&t!==0?t+"px":t};function Ki(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 Bt={name:i.name,styles:i.styles,next:Bt},i.name;var o=r;if(o.styles!==void 0){var a=o.next;if(a!==void 0)for(;a!==void 0;)Bt={name:a.name,styles:a.styles,next:Bt},a=a.next;var s=o.styles+";";return s}return zg(e,t,r)}}var l=r;if(t==null)return l;var c=t[l];return c!==void 0?c:l}function zg(e,t,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=Ki(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]+"}":ou(s)&&(n+=is(o)+":"+au(o,s)+";")}else if(Array.isArray(a)&&typeof a[0]=="string"&&(t==null||t[a[0]]===void 0))for(var l=0;l<a.length;l++)ou(a[l])&&(n+=is(o)+":"+au(o,a[l])+";");else{var c=Ki(e,t,a);switch(o){case"animation":case"animationName":{n+=is(o)+":"+c+";";break}default:n+=o+"{"+c+"}"}}}return n}var su=/label:\s*([^\s;{]+)\s*(;|$)/g,Bt;function os(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="";Bt=void 0;var o=e[0];if(o==null||o.raw===void 0)n=!1,i+=Ki(r,t,o);else{var a=o;i+=a[0]}for(var s=1;s<e.length;s++)if(i+=Ki(r,t,e[s]),n){var l=o;i+=l[s]}su.lastIndex=0;for(var c="",h;(h=su.exec(i))!==null;)c+="-"+h[1];var d=Vg(i)+c;return{name:d,styles:i,next:Bt}}function Ju(e,t,r){var n="";return r.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):i&&(n+=i+" ")}),n}var Yg=function(e,t,r){var n=e.key+"-"+t.name;e.registered[n]===void 0&&(e.registered[n]=t.styles)},Xg=function(e,t,r){Yg(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)}};function lu(e,t){if(e.inserted[t.name]===void 0)return e.insert("",t,e.sheet,!0)}function cu(e,t,r){var n=[],i=Ju(e,n,r);return n.length<2?r:i+t(n)}var Qg=function(e){var t=Hg(e);t.sheet.speedy=function(a){this.isSpeedy=a},t.compat=!0;var r=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=os(s,t.registered,void 0);return Xg(t,c),t.key+"-"+c.name},n=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=os(s,t.registered),h="animation-"+c.name;return lu(t,{name:c.name,styles:"@keyframes "+h+"{"+c.styles+"}"}),h},i=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];var c=os(s,t.registered);lu(t,c)},o=function(){for(var a=arguments.length,s=new Array(a),l=0;l<a;l++)s[l]=arguments[l];return cu(t.registered,r,Zg(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:Ju.bind(null,t.registered),merge:cu.bind(null,t.registered,r)}},Zg=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},e_=Qg({key:"css"}),Pe=e_.css,As,$e,as,du,uu=0,Fu=[],we=V,fu=we.__b,hu=we.__r,pu=we.diffed,mu=we.__c,vu=we.unmount,gu=we.__;function t_(e,t){we.__h&&we.__h($e,e,uu||t),uu=0;var r=$e.__H||($e.__H={__:[],__h:[]});return e>=r.__.length&&r.__.push({}),r.__[e]}function qu(e,t){var r=t_(As++,7);return i_(r.__H,t)&&(r.__=e(),r.__H=t,r.__h=e),r.__}function r_(){for(var e;e=Fu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Gi),e.__H.__h.forEach(Es),e.__H.__h=[]}catch(t){e.__H.__h=[],we.__e(t,e.__v)}}we.__b=function(e){$e=null,fu&&fu(e)},we.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),gu&&gu(e,t)},we.__r=function(e){hu&&hu(e),As=0;var t=($e=e.__c).__H;t&&(as===$e?(t.__h=[],$e.__h=[],t.__.forEach(function(r){r.__N&&(r.__=r.__N),r.u=r.__N=void 0})):(t.__h.forEach(Gi),t.__h.forEach(Es),t.__h=[],As=0)),as=$e},we.diffed=function(e){pu&&pu(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Fu.push(t)!==1&&du===we.requestAnimationFrame||((du=we.requestAnimationFrame)||n_)(r_)),t.__H.__.forEach(function(r){r.u&&(r.__H=r.u),r.u=void 0})),as=$e=null},we.__c=function(e,t){t.some(function(r){try{r.__h.forEach(Gi),r.__h=r.__h.filter(function(n){return!n.__||Es(n)})}catch(n){t.some(function(i){i.__h&&(i.__h=[])}),t=[],we.__e(n,r.__v)}}),mu&&mu(e,t)},we.unmount=function(e){vu&&vu(e);var t,r=e.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{Gi(n)}catch(i){t=i}}),r.__H=void 0,t&&we.__e(t,r.__v))};var _u=typeof requestAnimationFrame=="function";function n_(e){var t,r=function(){clearTimeout(n),_u&&cancelAnimationFrame(t),setTimeout(e)},n=setTimeout(r,100);_u&&(t=requestAnimationFrame(r))}function Gi(e){var t=$e,r=e.__c;typeof r=="function"&&(e.__c=void 0,r()),$e=t}function Es(e){var t=$e;e.__c=e.__(),$e=t}function i_(e,t){return!e||e.length!==t.length||t.some(function(r,n){return r!==e[n]})}var o_=Symbol.for("preact-signals");function to(){if(Mt>1)Mt--;else{for(var e,t=!1;nn!==void 0;){var r=nn;for(nn=void 0,Is++;r!==void 0;){var n=r.o;if(r.o=void 0,r.f&=-3,!(8&r.f)&&Hu(r))try{r.c()}catch(i){t||(e=i,t=!0)}r=n}}if(Is=0,Mt--,t)throw e}}function he(e){if(Mt>0)return e();Mt++;try{return e()}finally{to()}}var ae=void 0,nn=void 0,Mt=0,Is=0,$i=0;function ju(e){if(ae!==void 0){var t=e.n;if(t===void 0||t.t!==ae)return t={i:0,S:e,p:ae.s,n:void 0,t:ae,e:void 0,x:void 0,r:t},ae.s!==void 0&&(ae.s.n=t),ae.s=t,e.n=t,32&ae.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=ae.s,t.n=void 0,ae.s.n=t,ae.s=t),t}}function Ce(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}Ce.prototype.brand=o_;Ce.prototype.h=function(){return!0};Ce.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)};Ce.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)}};Ce.prototype.subscribe=function(e){var t=this;return hn(function(){var r=t.value,n=ae;ae=void 0;try{e(r)}finally{ae=n}})};Ce.prototype.valueOf=function(){return this.value};Ce.prototype.toString=function(){return this.value+""};Ce.prototype.toJSON=function(){return this.value};Ce.prototype.peek=function(){var e=ae;ae=void 0;try{return this.value}finally{ae=e}};Object.defineProperty(Ce.prototype,"value",{get:function(){var e=ju(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Is>100)throw new Error("Cycle detected");this.v=e,this.i++,$i++,Mt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{to()}}}});function z(e){return new Ce(e)}function Hu(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 Vu(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 Ku(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 Ar(e){Ce.call(this,void 0),this.x=e,this.s=void 0,this.g=$i-1,this.f=4}(Ar.prototype=new Ce).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===$i))return!0;if(this.g=$i,this.f|=1,this.i>0&&!Hu(this))return this.f&=-2,!0;var e=ae;try{Vu(this),ae=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 ae=e,Ku(this),this.f&=-2,!0};Ar.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)}Ce.prototype.S.call(this,e)};Ar.prototype.U=function(e){if(this.t!==void 0&&(Ce.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)}};Ar.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(Ar.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=ju(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function on(e){return new Ar(e)}function $u(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Mt++;var r=ae;ae=void 0;try{t()}catch(n){throw e.f&=-2,e.f|=8,$s(e),n}finally{ae=r,to()}}}function $s(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,$u(e)}function a_(e){if(ae!==this)throw new Error("Out-of-order effect");Ku(this),ae=e,this.f&=-2,8&this.f&&$s(this),to()}function fn(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}fn.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()}};fn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,$u(this),Vu(this),Mt++;var e=ae;return ae=this,a_.bind(this,e)};fn.prototype.N=function(){2&this.f||(this.f|=2,this.o=nn,nn=this)};fn.prototype.d=function(){this.f|=8,1&this.f||$s(this)};function hn(e){var t=new fn(e);try{t.c()}catch(r){throw t.d(),r}return t.d.bind(t)}var Wu,ss,zu=[];hn(function(){Wu=this.N})();function Er(e,t){V[e]=t.bind(null,V[e]||function(){})}function Wi(e){ss&&ss(),ss=e&&e.S()}function Yu(e){var t=this,r=e.data,n=Xu(r);n.value=r;var i=qu(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=on(function(){var m=n.value.value;return m===0?0:m===!0?"":m||""}),h=on(function(){return!Array.isArray(c.value)&&!xa(c.value)}),d=hn(function(){if(this.N=Qu,h.value){var m=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=m)}}),p=t.__$u.d;return t.__$u.d=function(){d(),p.call(this)},[h,c]},[]),o=i[0],a=i[1];return o.value?a.peek():a.value}Yu.displayName="_st";Object.defineProperties(Ce.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Yu},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}});Er("__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 Ce&&(r||(t.__np=r={}),r[i]=o,n[i]=o.peek())}}e(t)});Er("__r",function(e,t){Wi();var r,n=t.__c;n&&(n.__$f&=-2,(r=n.__$u)===void 0&&(n.__$u=r=function(i){var o;return hn(function(){o=this}),o.c=function(){n.__$f|=1,n.setState({})},o}())),Wi(r),e(t)});Er("__e",function(e,t,r,n){Wi(),e(t,r,n)});Er("diffed",function(e,t){Wi();var r;if(typeof t.type=="string"&&(r=t.__e)){var n=t.__np,i=t.props;if(n){var o=r.U;if(o)for(var a in o){var s=o[a];s!==void 0&&!(a in n)&&(s.d(),o[a]=void 0)}else o={},r.U=o;for(var l in n){var c=o[l],h=n[l];c===void 0?(c=s_(r,l,h,i),o[l]=c):c.o(h,i)}}}e(t)});function s_(e,t,r,n){var i=t in e&&e.ownerSVGElement===void 0,o=z(r);return{o:function(a,s){o.value=a,n=s},d:hn(function(){this.N=Qu;var a=o.value.value;n[t]!==a&&(n[t]=a,i?e[t]=a:a?e.setAttribute(t,a):e.removeAttribute(t))})}}Er("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)});Er("__h",function(e,t,r,n){(n<3||n===9)&&(t.__$f|=2),e(t,r,n)});Ke.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};function Xu(e){return qu(function(){return z(e)},[])}var l_=function(e){queueMicrotask(function(){queueMicrotask(e)})};function c_(){he(function(){for(var e;e=zu.shift();)Wu.call(e)})}function Qu(){zu.push(this)===1&&(V.requestAnimationFrame||l_)(c_)}var Ae=Pe`
|
|
12
12
|
inset: 0;
|
|
13
13
|
clear: none;
|
|
14
14
|
float: none;
|
|
@@ -26,7 +26,7 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
26
26
|
text-decoration: none;
|
|
27
27
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
28
28
|
'Helvetica Neue', sans-serif;
|
|
29
|
-
`;function d_(e,t){let r=
|
|
29
|
+
`;function d_(e,t){let r=Ai(e);Ma(()=>{r.current=e},[e]),Pt(()=>{if(t===null)return;let n=setInterval(()=>{r.current()},t);return()=>{clearInterval(n)}},[t])}var u_=0;function K(e,t,r,n,i,o){t||(t={});var a,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?a=t[s]:l[s]=t[s];var c={type:e,props:l,key:r,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--u_,__i:-1,__u:0,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return V.vnode&&V.vnode(c),c}var f_=Pe`
|
|
30
30
|
${Ae}
|
|
31
31
|
position: fixed;
|
|
32
32
|
top: 0;
|
|
@@ -101,7 +101,7 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
|
-
`,
|
|
104
|
+
`,Ot=z(null),Ss=z(""),Cs=z(""),Ji=z(!1),h_=()=>{var e;(e=Ot.value)==null||e.call(Ot,!1)},p_=()=>{var e;(e=Ot.value)==null||e.call(Ot,!0)},m_=e=>A(void 0,null,function*(){let{title:t,content:r}=e;return Ot.value&&(Ot.value(!1),he(()=>{Ot.value=null,Ji.value=!1})),he(()=>{Ss.value=t||"",Cs.value=r||"",Ji.value=!0}),new Promise(n=>{Ot.value=i=>{he(()=>{Ot.value=null,Ji.value=!1,Ss.value="",Cs.value=""}),n(i)}})}),v_=()=>Ji.value?K("div",{className:f_,children:K("div",{className:"card-wrapper",children:[K("div",{className:"body",children:[K("div",{className:"title",children:Ss.value}),K("div",{className:"content",children:Cs.value})]}),K("div",{className:"footer",children:[K("button",{onClick:h_,className:"cancel-btn",children:"Cancel"}),K("button",{onClick:p_,className:"confirm-btm",children:"Confirm"})]})]})}):null,g_=Pe`
|
|
105
105
|
${Ae}
|
|
106
106
|
position: relative;
|
|
107
107
|
display: flex;
|
|
@@ -134,7 +134,7 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
134
134
|
cursor: not-allowed;
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
|
-
`,__=()=>{let e=z(!1),t=z(null);return{timerPaused:e,startTimestamp:t,startTimer:()=>{he(()=>{t.value=Date.now(),e.value=!1})}}},y_=e=>{let{countdown:t=0,mode:r,onClose:n,state:i}=e,{startTimestamp:o,timerPaused:a}=i,s=Xu(t);d_(()=>{s.value>0?s.value-=1:he(()=>{a.value=!0,s.value=0})},a.value?null:1e3);let l=
|
|
137
|
+
`,__=()=>{let e=z(!1),t=z(null);return{timerPaused:e,startTimestamp:t,startTimer:()=>{he(()=>{t.value=Date.now(),e.value=!1})}}},y_=e=>{let{countdown:t=0,mode:r,onClose:n,state:i}=e,{startTimestamp:o,timerPaused:a}=i,s=Xu(t);d_(()=>{s.value>0?s.value-=1:he(()=>{a.value=!0,s.value=0})},a.value?null:1e3);let l=on(()=>{if(r==="interstitial"||r==="rewarded_insterstitial"||!o.value)return!1;let m=Date.now()-o.value;return s.value>0&&t-s.value>=5&&m>=5e3}),c=on(()=>{if(r==="interstitial")return!0;if(!o.value)return!1;let m=Date.now()-o.value;return s.value<=0&&m>=(t-1)*1e3&&t>5}),h=on(()=>r==="interstitial"?!1:!l.value&&!c.value),d=()=>A(void 0,null,function*(){if(a.value=!0,!(yield m_({title:"Are you sure?",content:"You will lose your reward if you dismiss this Ad."}))){a.value=!1;return}n("dismiss"),he(()=>{a.value=!0,s.value=0,o.value=null})}),p=()=>{n("viewed"),he(()=>{a.value=!0,s.value=0,o.value=null})};return K("div",{className:g_,children:[s.value>0&&r!=="interstitial"&&K("div",{className:"timer",children:[s.value,"s"]}),K("button",{onClick:l.value?d:c.value?p:void 0,disabled:h.value,children:K("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:K("path",{d:"M13.3 0.710215C12.91 0.320215 12.28 0.320215 11.89 0.710215L6.99997 5.59022L2.10997 0.700215C1.71997 0.310215 1.08997 0.310215 0.699971 0.700215C0.309971 1.09021 0.309971 1.72022 0.699971 2.11022L5.58997 7.00022L0.699971 11.8902C0.309971 12.2802 0.309971 12.9102 0.699971 13.3002C1.08997 13.6902 1.71997 13.6902 2.10997 13.3002L6.99997 8.41021L11.89 13.3002C12.28 13.6902 12.91 13.6902 13.3 13.3002C13.69 12.9102 13.69 12.2802 13.3 11.8902L8.40997 7.00022L13.3 2.11022C13.68 1.73022 13.68 1.09022 13.3 0.710215Z",fill:"white"})})})]})},Zu=()=>{let e=z(),t=z(),r=z(),n=z(),i=z(),o=z(!1),a=z(15),s=z(""),l=z("reward");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,visible:o,countdown:a,src:s,mode:l}},b_=Pe`
|
|
138
138
|
${Ae}
|
|
139
139
|
position: fixed;
|
|
140
140
|
z-index: 2147483647;
|
|
@@ -153,7 +153,7 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
153
153
|
width: 100%;
|
|
154
154
|
height: 100%;
|
|
155
155
|
}
|
|
156
|
-
`,ef=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,visible:s,countdown:l,src:c,mode:
|
|
156
|
+
`,ef=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,visible:s,countdown:l,src:c,mode:h}=t,d=$r(()=>__(),[]),[p,m]=wt(!1),b=I=>{var w,R,k,P;s.value=!1,I==="dismiss"?(w=n.value)==null||w.call(n):I==="viewed"&&((R=i.value)==null||R.call(i)),(k=r.value)==null||k.call(r),(P=o.value)==null||P.call(o),m(!1)},E=Wr(()=>{var I;p||(m(!0),(I=a.value)==null||I.call(a))},[p]);return Pt(()=>{p&&(h.value==="reward"||h.value==="rewarded_insterstitial")&&setTimeout(()=>{d.startTimer()},100)},[p,h.value]),s.value?K("div",{className:b_,children:[K(y_,{mode:h.value,onClose:b,countdown:l.value,state:d}),s.value&&K("iframe",{src:c.value,onLoad:E,sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"}),K(v_,{})]}):null};function It(e,t,r){return(t=w_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function w_(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)}var Rs=class{constructor(t,r){It(this,"name","OKSPIN"),It(this,"initialized",!1),It(this,"initCompleter",null),It(this,"context",void 0),It(this,"initParams",void 0),It(this,"adsOverlay",null),It(this,"adsIsShowing",!1),It(this,"lastUnDisplayedAdBreak",null),It(this,"state",Zu()),this.context=t,this.initParams=r}init(){return A(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg"),st(K(ef,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){return A(this,null,function*(){var n,i,o,a,s,l,c,h;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}switch(t.type){case"preroll":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let d=()=>{var m;this.adsIsShowing=!1,(m=t.afterAd)==null||m.call(t)},p=()=>{var m;this.adsIsShowing=!1,(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})};he(()=>{this.adsIsShowing=!0,this.state.afterAd.value=d,this.state.adBreakDone.value=p,this.state.src.value=r.params.url,this.state.mode.value="interstitial",this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(c=t.beforeAd)==null||c.call(t);let d=()=>{var w;this.adsIsShowing=!1,(w=t.afterAd)==null||w.call(t)},p={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},m=()=>{var w;this.adsIsShowing=!1,p.breakStatus="dismissed",(w=t.adDismissed)==null||w.call(t)},b=()=>{var w;this.adsIsShowing=!1,p.breakStatus="viewed",(w=t.adViewed)==null||w.call(t)},E=()=>{var w;this.adsIsShowing=!1,(w=t.adBreakDone)==null||w.call(t,p)};he(()=>{this.state.afterAd.value=d,this.state.adDismissed.value=m,this.state.adViewed.value=b,this.state.adBreakDone.value=E});let I=()=>{var w;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(w=t.adBreakDone)==null||w.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,he(()=>{var R;this.state.countdown.value=(R=r.params.countdown)!=null?R:15,this.state.src.value=r.params.url,this.state.mode.value="reward",this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(h=t.beforeReward)==null||h.call(t,I);break}}})}},E_=()=>{let e=z(null),t=z(null),r=z(null),n=z(null),i=z(null),o=z(null),a=z(!1),s=z(null);return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adError:o,visible:a,payload:s}},I_=Pe`
|
|
157
157
|
${Ae}
|
|
158
158
|
position: fixed;
|
|
159
159
|
inset: 0;
|
|
@@ -184,10 +184,10 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
184
184
|
letter-spacing: 0.08em;
|
|
185
185
|
text-transform: uppercase;
|
|
186
186
|
color: #c7d4ef;
|
|
187
|
-
`,
|
|
187
|
+
`,k_=Pe`
|
|
188
188
|
font-size: 14px;
|
|
189
189
|
font-weight: 500;
|
|
190
|
-
`,
|
|
190
|
+
`,O_=Pe`
|
|
191
191
|
${Ae}
|
|
192
192
|
flex: 1;
|
|
193
193
|
background: #050505;
|
|
@@ -195,7 +195,7 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
195
195
|
align-items: center;
|
|
196
196
|
justify-content: center;
|
|
197
197
|
padding: 0;
|
|
198
|
-
`,
|
|
198
|
+
`,yu=Pe`
|
|
199
199
|
width: 100%;
|
|
200
200
|
height: 100%;
|
|
201
201
|
border: 2px dashed rgba(255, 255, 255, 0.08);
|
|
@@ -204,13 +204,13 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
204
204
|
justify-content: center;
|
|
205
205
|
color: #6e7da1;
|
|
206
206
|
font-size: 14px;
|
|
207
|
-
`,
|
|
207
|
+
`,T_=Pe`
|
|
208
208
|
position: absolute;
|
|
209
209
|
bottom: 32px;
|
|
210
210
|
right: 32px;
|
|
211
211
|
display: flex;
|
|
212
212
|
gap: 12px;
|
|
213
|
-
`,
|
|
213
|
+
`,x_=Pe`
|
|
214
214
|
min-width: 160px;
|
|
215
215
|
min-height: 48px;
|
|
216
216
|
border-radius: 999px;
|
|
@@ -236,7 +236,7 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
236
236
|
font-size: 14px;
|
|
237
237
|
font-weight: 500;
|
|
238
238
|
cursor: pointer;
|
|
239
|
-
`,N_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adError:s,visible:l,payload:c}=t,[
|
|
239
|
+
`,N_=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adError:s,visible:l,payload:c}=t,[h,d]=wt(!1),[p,m]=wt(0),[b,E]=wt(!1),[I,w]=wt(!1),[R,k]=wt("Loading next content..."),P=Ai(null),M=c.value,S=Wr(U=>{var J,q,X,Q;d(!1),l.value=!1,U==="dismiss"?(J=n.value)==null||J.call(n):(q=i.value)==null||q.call(i),(X=r.value)==null||X.call(r),(Q=o.value)==null||Q.call(o)},[l,n,i,r,o]),D=Wr(()=>{var U;d(!1),l.value=!1,(U=s.value)==null||U.call(s)},[l,s]);if(Pt(()=>{var U;if(!l.value||!M){m(0),E(!1),w(!1),k("Loading next content...");return}let J=M.mode==="reward"?15:0,q=Math.max(Math.floor((U=M.countdown)!=null?U:J),0);if(m(q),w(M.mode==="reward"?q===0:!0),E(M.mode==="interstitial"?q===0:!1),q===0)return;let X=q,Q=window.setInterval(()=>{X-=1,m(Math.max(X,0)),X<=0&&(window.clearInterval(Q),M.mode==="reward"?w(!0):E(!0))},1e3);return()=>{window.clearInterval(Q)}},[l.value,M,S]),Pt(()=>{var U;if(!l.value||!M)return;let J=P.current;if(!J)return;if(J.innerHTML="",k("Loading next content..."),d(!1),M.testMode){let Q=document.createElement("div");Q.className=yu,Q.innerText="Preview slot placeholder",J.appendChild(Q),d(!0),(U=a.value)==null||U.call(a);return}if(typeof window=="undefined"){D();return}let q=document.createElement("ins");q.className="adsbygoogle",q.style.display="block",q.style.width="100%",q.style.height="100%",q.setAttribute("data-ad-client",M.clientId),q.setAttribute("data-ad-slot",M.unitId),q.setAttribute("data-ad-format","auto"),q.setAttribute("data-full-width-responsive","true"),M.channelId&&q.setAttribute("data-ad-channel",M.channelId),J.appendChild(q);let X=new MutationObserver(()=>{var Q;let be=q.getAttribute("data-ad-status");be==="filled"?(d(!0),k(""),(Q=a.value)==null||Q.call(a),X.disconnect()):be==="unfilled"&&(k("Slot currently unavailable."),d(!1),X.disconnect())});X.observe(q,{attributes:!0,attributeFilter:["data-ad-status"]});try{let Q=window;Q.adsbygoogle=Q.adsbygoogle||[],Q.adsbygoogle.push({})}catch(Q){X.disconnect(),D()}return()=>{X.disconnect(),J.innerHTML=""}},[l.value,M,a,D]),!l.value||!M)return null;let F=M.mode==="reward"?"Next content unlocking":"Content paused",H=p>0?`Content resumes in ${p}s`:"Content ready";return K("div",{className:I_,children:K("div",{className:S_,children:[K("div",{className:C_,children:[K("div",{className:R_,children:F}),K("div",{className:k_,children:H})]}),K("div",{className:O_,ref:P,children:!h&&K("div",{className:yu,children:R})}),K("div",{className:T_,children:M.mode==="reward"?K("button",{className:x_,type:"button",onClick:()=>S("viewed"),disabled:!I,children:I?"Continue":`Continue in ${p}s`}):b&&K("button",{className:D_,type:"button",onClick:()=>S("viewed"),children:"Continue"})})]})})};function Ge(e,t,r){return(t=P_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P_(e){var t=L_(e,"string");return typeof t=="symbol"?t:t+""}function L_(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 ks=class{constructor(t,r){if(Ge(this,"name","ADSENSE_BANNER_AS_AFG"),Ge(this,"initialized",!1),Ge(this,"initCompleter",null),Ge(this,"context",void 0),Ge(this,"contextInfo",void 0),Ge(this,"initParams",void 0),Ge(this,"defaultCountdown",5),Ge(this,"adsOverlay",null),Ge(this,"adsIsShowing",!1),Ge(this,"lastUnDisplayedAdBreak",null),Ge(this,"requestCounter",0),Ge(this,"scriptPromise",null),Ge(this,"scriptReady",!1),Ge(this,"scriptFailed",!1),Ge(this,"state",E_()),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,typeof window!="undefined"){let n=window;n.adsbygoogle=n.adsbygoogle||[]}}init(){return A(this,null,function*(){var t;if(typeof document!="undefined"){this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-banner-as-afg"),st(K(N_,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay);try{yield this.ensureAdSenseScript()}catch(r){this.scriptFailed=!0,console.warn("[BannerAsAFG] Failed to load Google AdSense script",r)}this.initialized=!0,(t=this.initCompleter)==null||t.call(this)}})}ensureAdSenseScript(){var t;if(typeof document=="undefined")return Promise.resolve();if(this.scriptPromise)return this.scriptPromise;if(document.getElementById("google-adsense"))return this.scriptReady=!0,Promise.resolve();if(!this.initParams.clientId)return this.scriptFailed=!0,Promise.reject(new Error("BannerAsAFG requires a Google AdSense clientId."));let r=(t=this.contextInfo.testAdsMode)!=null?t:!1;return this.scriptPromise=new Promise((n,i)=>{let o=document.createElement("script");o.id="google-adsense",o.async=!0,o.crossOrigin="anonymous",o.src=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=${this.initParams.clientId}`,r&&o.setAttribute("data-adbreak-test","on"),this.initParams.channelId&&o.setAttribute("data-ad-channel",this.initParams.channelId),o.onload=()=>{this.scriptReady=!0,n()},o.onerror=()=>{this.scriptFailed=!0,i(new Error("Failed to fetch Google AdSense script."))},document.head.appendChild(o)}),this.scriptPromise}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}resolveOverlayConfig(t){var r,n;let i=(n=(r=t==null?void 0:t.params)==null?void 0:r.countdown)!=null?n:this.defaultCountdown;return{rewardUnitId:this.initParams.rewardUnitId,interstitialUnitId:this.initParams.interstitialUnitId,channelId:this.initParams.channelId,countdown:Math.max(Math.floor(i),0)}}canDisplay(t){return!!t&&!!this.initParams.clientId&&!!this.adsOverlay&&this.initialized&&!this.scriptFailed&&this.scriptReady}showBannerOverlay(t,r){var n,i;let o=Math.max(Math.floor((n=r.countdown)!=null?n:t==="reward"?15:0),0),a={requestId:++this.requestCounter,clientId:this.initParams.clientId,unitId:t==="reward"?this.initParams.rewardUnitId:this.initParams.interstitialUnitId,channelId:r.channelId,countdown:o,mode:t,testMode:(i=this.contextInfo.testAdsMode)!=null?i:!1};this.state.payload.value=a,this.state.visible.value=!0}adBreak(t,r){var n,i,o,a,s,l,c,h,d;let p=t.type==="preroll"?"":t.name,m=t.type==="reward"?"reward":"interstitial";if(!this.initialized||!this.adsOverlay){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:p,breakFormat:m,breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:p,breakFormat:m,breakStatus:"frequencyCapped"});return}let b=this.resolveOverlayConfig(r);if(!this.canDisplay(b.rewardUnitId)){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:p,breakFormat:m,breakStatus:"notReady"});return}switch(t.type){case"preroll":{(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(s=t.beforeAd)==null||s.call(t);let E={breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"},I=()=>{var k;this.adsIsShowing=!1,(k=t.afterAd)==null||k.call(t)},w=()=>{var k;this.adsIsShowing=!1,(k=t.adBreakDone)==null||k.call(t,E)},R=()=>{var k,P;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(k=t.afterAd)==null||k.call(t),(P=t.adBreakDone)==null||P.call(t,E)};he(()=>{this.adsIsShowing=!0,this.state.afterAd.value=I,this.state.adBreakDone.value=w,this.state.adDismissed.value=null,this.state.adViewed.value=null,this.state.adError.value=R,this.showBannerOverlay("interstitial",b)});break}case"reward":{this.lastUnDisplayedAdBreak&&((c=(l=this.lastUnDisplayedAdBreak).adBreakDone)==null||c.call(l,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(h=t.beforeAd)==null||h.call(t);let E={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},I=()=>{var S;this.adsIsShowing=!1,(S=t.afterAd)==null||S.call(t)},w=()=>{var S;this.adsIsShowing=!1,E.breakStatus="dismissed",(S=t.adDismissed)==null||S.call(t)},R=()=>{var S;this.adsIsShowing=!1,E.breakStatus="viewed",(S=t.adViewed)==null||S.call(t)},k=()=>{var S;this.adsIsShowing=!1,(S=t.adBreakDone)==null||S.call(t,E)},P=()=>{var S,D;this.adsIsShowing=!1,E.breakStatus="noAdPreloaded",(S=t.afterAd)==null||S.call(t),(D=t.adBreakDone)==null||D.call(t,E)};he(()=>{this.state.afterAd.value=I,this.state.adDismissed.value=w,this.state.adViewed.value=R,this.state.adBreakDone.value=k,this.state.adError.value=P});let M=()=>{var S,D;if(!this.canDisplay(b.rewardUnitId)){this.lastUnDisplayedAdBreak=null,(S=t.afterAd)==null||S.call(t),(D=t.adBreakDone)==null||D.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.lastUnDisplayedAdBreak=null,this.adsIsShowing=!0,he(()=>{this.showBannerOverlay("reward",b)})};this.lastUnDisplayedAdBreak=t,(d=t.beforeReward)==null||d.call(t,M);break}}}},gr={};window.addEventListener("message",e=>{e.origin!=="https://ads.appsrockets.com"&&e.origin!=="https://stg-ads.appsrockets.com"||gr[e.data.type]&&gr[e.data.type].forEach(t=>{t(e.data.data)})});var pr=(e,t)=>{Pt(()=>(gr[e]||(gr[e]=new Set),gr[e].add(t),()=>{gr[e].delete(t)}),[e,t])},tf=()=>{let e=z(),t=z(),r=z(),n=z(),i=z(),o=z(),a=z(),s=z(!1),l=z("");return{afterAd:e,adDismissed:t,adViewed:r,adBreakDone:n,adLoaded:i,adLinkClicked:o,adError:a,visible:s,src:l}},U_=Pe`
|
|
240
240
|
${Ae}
|
|
241
241
|
position: fixed;
|
|
242
242
|
z-index: 2147483647;
|
|
@@ -255,7 +255,7 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
255
255
|
width: 100%;
|
|
256
256
|
height: 100%;
|
|
257
257
|
}
|
|
258
|
-
`,rf=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adLinkClicked:s,visible:l,src:c}=t,[m,d]=wt(!1),h=b=>{var E,I,w,R;d(!1),l.value=!1,b==="dismiss"?(E=n.value)==null||E.call(n):b==="viewed"&&((I=i.value)==null||I.call(i)),(w=r.value)==null||w.call(r),(R=o.value)==null||R.call(o)},p=()=>{var b;(b=a.value)==null||b.call(a)};return pr("appsrockets_ad_dismissed",()=>h("dismiss")),pr("appsrockets_ad_rewarded",()=>h("viewed")),pr("appsrockets_ad_completed",()=>h("viewed")),pr("appsrockets_ad_skipped",()=>h("viewed")),pr("appsrockets_ad_clicked",b=>{var E;return(E=s.value)==null?void 0:E.call(s,b)}),pr("appsrockets_ad_loaded",()=>d(!0)),l.value?K("div",{className:U_,style:{display:m?"flex":"none"},children:l.value&&K("iframe",{src:c.value,onLoad:p,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};function St(e,t,r){return(t=B_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B_(e){var t=M_(e,"string");return typeof t=="symbol"?t:t+""}function M_(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 Os=class{constructor(t,r){St(this,"name","APPSROCKETS"),St(this,"initialized",!1),St(this,"initCompleter",null),St(this,"context",void 0),St(this,"adsOverlay",null),St(this,"adsIsShowing",!1),St(this,"lastUnDisplayedAdBreak",null),St(this,"state",tf()),St(this,"processUrl",(n,i)=>{var o;let a=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",a.joliSource),l.get("osType")||l.set("osType",a.osType),l.get("runtimeType")||l.set("runtimeType",a.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",a.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((o=this.context.getWindowInfo().statusBarHeight)!=null?o:0).toString()),l.get("adsType")||l.set("adsType",i),s.search=l.toString(),s.toString()}),this.context=t}init(){return A(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),st(K(rf,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){var n,i,o,a,s,l,c,m;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let d=p=>{var b,E;(E=(b=this.context).handleLinkClicked)==null||E.call(b,p)},h=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let p=()=>{var I;this.adsIsShowing=!1,(I=t.afterAd)==null||I.call(t)},b=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},E=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};he(()=>{this.adsIsShowing=!0,this.state.afterAd.value=p,this.state.adBreakDone.value=b,this.state.src.value=this.processUrl(r.params.url,h),this.state.adLinkClicked.value=d,this.state.adError.value=E,this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(c=t.beforeAd)==null||c.call(t);let p=()=>{var P;this.adsIsShowing=!1,(P=t.afterAd)==null||P.call(t)},b={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},E=()=>{var P;this.adsIsShowing=!1,b.breakStatus="dismissed",(P=t.adDismissed)==null||P.call(t)},I=()=>{var P;this.adsIsShowing=!1,b.breakStatus="viewed",(P=t.adViewed)==null||P.call(t)},w=()=>{var P;this.adsIsShowing=!1,(P=t.adBreakDone)==null||P.call(t,b)},R=()=>{this.adsIsShowing=!1,b.breakStatus="noAdPreloaded"};he(()=>{this.state.afterAd.value=p,this.state.adDismissed.value=E,this.state.adViewed.value=I,this.state.adBreakDone.value=w,this.state.adLinkClicked.value=d,this.state.adError.value=R});let O=()=>{var P;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(P=t.adBreakDone)==null||P.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,he(()=>{this.state.src.value=this.processUrl(r.params.url,h),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(m=t.beforeReward)==null||m.call(t,O);break}}}},nf=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function xe(e,t,r){return(t=G_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function G_(e){var t=J_(e,"string");return typeof t=="symbol"?t:t+""}function J_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var of=class{constructor(e,t,r){xe(this,"adUnit",void 0),xe(this,"project",void 0),xe(this,"keyValue",void 0),xe(this,"adsContext",null),xe(this,"rewardedSlot",null),xe(this,"rewardedPayload",null),xe(this,"readyEvent",null),xe(this,"withCommand",function(){googletag.cmd.push(...arguments)}),xe(this,"init",()=>{var n;this.rewardedSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot&&(this.rewardedSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().addEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().addEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.keyValue&&(Object.keys(this.keyValue).forEach(i=>{var o;(o=this.rewardedSlot)==null||o.setTargeting(i,this.keyValue[i])}),Object.keys(this.keyValue).includes("project")||(n=this.rewardedSlot)==null||n.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),xe(this,"destroy",n=>{var i,o;this.rewardedPayload=null,this.readyEvent=null,googletag.pubads().removeEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().removeEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().removeEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().removeEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.rewardedSlot&&(googletag.destroySlots([this.rewardedSlot]),this.rewardedSlot=null),(o=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||o.call(i,n),n!=="ignored"&&(this.adsContext=null)}),xe(this,"reinit",n=>{this.destroy(n),this.init()}),xe(this,"handleSlotReady",n=>{n.slot===this.rewardedSlot&&(this.readyEvent=n)}),xe(this,"handleSlotClosed",n=>{var i,o;if(this.adsContext&&n.slot===this.rewardedSlot){let a=this.rewardedPayload?"viewed":"dismissed";a==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(i=this.adsContext).afterAd)==null||o.call(i),this.withCommand(()=>{this.reinit(a)})}}),xe(this,"handleSlotGranted",n=>{this.adsContext&&n.slot===this.rewardedSlot&&(this.rewardedPayload=n.payload)}),xe(this,"handleSlotRenderEnded",n=>{n.slot===this.rewardedSlot&&n.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped")})}),xe(this,"requestAds",n=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=n,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,o,a;(o=(i=this.adsContext)==null?void 0:i.beforeAd)==null||o.call(i),(a=this.readyEvent)==null||a.makeRewardedVisible()});else{let i=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=o,this.adsContext.beforeReward(()=>{var a,s,l;(s=(a=this.adsContext)==null?void 0:a.beforeAd)==null||s.call(a),(l=this.readyEvent)==null||l.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=e,this.project=t,this.keyValue=r,nf(),this.withCommand(()=>{this.init()})}};function qe(e,t,r){return(t=F_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F_(e){var t=j_(e,"string");return typeof t=="symbol"?t:t+""}function j_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ts=class{constructor(t,r,n){var i=this;qe(this,"adUnit",void 0),qe(this,"project",void 0),qe(this,"keyValue",void 0),qe(this,"adsContext",null),qe(this,"gamingInterstitialSlot",null),qe(this,"readyEvent",null),qe(this,"isRetrying",!1),qe(this,"withCommand",function(){googletag.cmd.push(...arguments)}),qe(this,"init",()=>{var o;this.gamingInterstitialSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL),this.gamingInterstitialSlot&&(this.gamingInterstitialSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("gameManualInterstitialSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("gameManualInterstitialSlotClosed",this.handleSlotClosed),this.keyValue&&(Object.keys(this.keyValue).forEach(a=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(o=this.gamingInterstitialSlot)==null||o.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),qe(this,"destroy",function(o){var a,s;(!(arguments.length>1&&arguments[1]!==void 0)||arguments[1])&&((s=(a=i.adsContext)==null?void 0:a.onEnd)==null||s.call(a,o),o!=="ignored"&&(i.adsContext=null)),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",i.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",i.handleSlotClosed),i.gamingInterstitialSlot&&(googletag.destroySlots([i.gamingInterstitialSlot]),i.gamingInterstitialSlot=null,i.readyEvent=null)}),qe(this,"reinit",function(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;i.destroy(o,a),i.init()}),qe(this,"handleSlotReady",o=>{this.gamingInterstitialSlot===o.slot&&(this.readyEvent=o)}),qe(this,"handleSlotClosed",o=>{var a,s;this.adsContext&&this.gamingInterstitialSlot===o.slot&&((s=(a=this.adsContext).afterAd)==null||s.call(a),this.withCommand(()=>{this.reinit("viewed")}))}),qe(this,"requestAds",o=>{this.withCommand(()=>{var a,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=o,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((a=o.beforeAd)==null||a.call(o),this.readyEvent.makeGameManualInterstitialVisible()):((l=(s=this.adsContext).onEnd)==null||l.call(s,"frequencyCapped"),this.adsContext=null,this.isRetrying||(this.isRetrying=!0,window.setTimeout(()=>{this.readyEvent||this.withCommand(()=>{this.reinit("frequencyCapped",!1)}),this.isRetrying=!1},31e3)))})}),nf(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Xt(e,t,r){return(t=q_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function q_(e){var t=H_(e,"string");return typeof t=="symbol"?t:t+""}function H_(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 xs=class{constructor(t,r){Xt(this,"name","GOOGLE_GPT"),Xt(this,"context",void 0),Xt(this,"contextInfo",void 0),Xt(this,"initParams",void 0),Xt(this,"rewardAdManager",void 0),Xt(this,"interstitialManager",void 0),Xt(this,"insertScript",()=>{let n="jolibox-google-gpt",i=document.getElementById(n);i||(i=window.document.createElement("script"),i.id=n,i.async=!0,i.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",i.crossOrigin="anonymous",document.head.appendChild(i))}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,this.insertScript()}init(){return A(this,null,function*(){let t=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":this.initParams.rewardedSlot,r=this.contextInfo.testAdsMode?"/6355419/Travel/Europe/France/Paris":this.initParams.interstitialSlot,n=`minigame-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;t&&(this.rewardAdManager=new of(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Ts(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,o;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:a})}});break}default:{if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:a=>{var s;(s=t.adBreakDone)==null||s.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:a})}});break}}}};function ss(e,t,r){return(t=V_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V_(e){var t=K_(e,"string");return typeof t=="symbol"?t:t+""}function K_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ks=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";ss(this,"context",void 0),ss(this,"placement","GAME"),ss(this,"contextInfo",void 0),this.context=t,this.placement=r,this.contextInfo=this.context.getContextInfo()}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:r}}getDevice(){var t,r,n,i;return{platform:(t=this.contextInfo.platform)!=null?t:xu.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(r=this.contextInfo.hostAppId)!=null?r:"1",model:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",brand:(i=this.contextInfo.deviceBrand)!=null?i:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(t,r){var n;let i={protocolVersion:"1.0.0",events:[{name:t,type:Ou.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:Tu.WebSDK};return Yv(i)}},yu="__jolibox_ads_trace__key__",ls=()=>{var e;try{return window.__jolibox_ads_trace__key__===!0||((e=window.localStorage)==null?void 0:e.getItem(yu))==="1"||new URLSearchParams(window.location.search).get(yu)==="1"}catch(t){return!1}},L={log:function(){ls()&&console.log(...arguments)},warn:function(){ls()&&console.warn(...arguments)},error:function(){ls()&&console.error(...arguments)}};function De(e,t,r){return(t=$_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $_(e){var t=W_(e,"string");return typeof t=="symbol"?t:t+""}function W_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var ln=class{constructor(t){De(this,"context",void 0),De(this,"adsTrackSerializer",void 0),De(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new ks(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:o}=this.context.getWindowInfo();return{report:JSON.stringify(this.adsTrackSerializer.serialize(t,{sessionId:this.contextInfo.sessionId,objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId,testAdsMode:this.contextInfo.testAdsMode})),osType:this.contextInfo.osType,runtimeType:this.contextInfo.runtimeType,sessionId:this.contextInfo.sessionId,deviceId:this.contextInfo.deviceId,adId:this.contextInfo.adId,deviceModel:(r=this.contextInfo.deviceModel)!=null?r:"UnknownModel",deviceBrand:(n=this.contextInfo.deviceBrand)!=null?n:"UnknownBrand",dimension:{width:i,height:o}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},Wi=class{constructor(t,r){var n=this;De(this,"context",void 0),De(this,"contextInfo",void 0),De(this,"requestContext",void 0),De(this,"adsInfoRequestSeq",0),De(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),De(this,"pendingAFVAdsInfo",Promise.resolve(null)),De(this,"doFetchAdsInfo",i=>A(this,null,function*(){var o;let a=++this.adsInfoRequestSeq,s=Date.now(),l=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",c=[];switch(i){case"afv":{c=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{c=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{c=["INTERSTITIAL"];break}}let m=i==="afv"?void 0:"cached";L.log("[Jolibox SDK Ads][Trace][AdsRequest] doFetchAdsInfo start",{requestId:a,type:i,eventName:l,adsTypes:c,name:m,contextData:this.requestContext.getRequestContextData(l),bizParams:this.requestContext.getRequestBizParams()});try{let{data:d,code:h}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(l),bizParams:this.requestContext.getRequestBizParams(),adsTypes:c,testAdsMode:this.contextInfo.testAdsMode,name:m}});return L.log("[Jolibox SDK Ads][Trace][AdsRequest] doFetchAdsInfo response",{requestId:a,type:i,code:h,duration:Date.now()-s,length:(o=d==null?void 0:d.length)!=null?o:null,data:d}),h==="SUCCESS"||h==="BYPASS_ADS"?{code:h,data:d}:null}catch(d){throw L.warn("[Jolibox SDK Ads][Trace][AdsRequest] doFetchAdsInfo error",{requestId:a,type:i,duration:Date.now()-s,error:d}),d}})),De(this,"cacheRewardInfo",()=>{L.log("[Jolibox SDK Ads][Trace][AdsRequest] cacheRewardInfo scheduled"),this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),De(this,"cacheInterstitialInfo",i=>{L.log("[Jolibox SDK Ads][Trace][AdsRequest] cacheInterstitialInfo scheduled",{type:i}),this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),De(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),De(this,"cacheNextAFGAdsInfo",i=>A(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),De(this,"getAFGAdsInfo",i=>A(this,null,function*(){var o,a;L.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo await cache",{type:i,cacheKey:i==="reward"?"REWARD":"INTERSTITIAL"});let s=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return L.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo resolved",{type:i,code:s==null?void 0:s.code,length:(a=(o=s==null?void 0:s.data)==null?void 0:o.length)!=null?a:null}),i==="reward"&&(this.cacheNextAFGAdsInfo(i),L.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo cacheNext scheduled",{type:i})),s})),De(this,"getAFVAdsInfo",function(){return A(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let i=yield n.pendingAFVAdsInfo;return n.cacheAFVInfo(),i}else return n.cacheAFVInfo(),yield n.pendingAFVAdsInfo})}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.requestContext=new ln(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};function z_(e,t,r){return(t=Y_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y_(e){var t=X_(e,"string");return typeof t=="symbol"?t:t+""}function X_(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 Q_=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(e)try{e(...r)}catch(i){console.error("[JoliboxSDK] Callback error:",i)}},zi=class{constructor(t){this.context=t,z_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=Jd(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}getTraceContext(){let t=this.context.getContextInfo();return{platform:t.deviceInfo.platform,nativeSDKVersionCode:t.deviceInfo.nativeSDKVersionCode,objectId:t.objectId}}loadAdsAsync(t){return A(this,null,function*(){try{L.log("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync invoke",{context:this.getTraceContext(),providers:t.providers});let{errNo:r,errMsg:n}=yield Ti("loadAdsAsync",{params:{providers:t.providers}});return L.log("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync response",{context:this.getTraceContext(),providers:t.providers,errNo:r,errMsg:n}),r!==0||n.length>0?{code:"FAILURE",message:n||"Failed to load ads"}:{code:"SUCCESS",message:"Ads loaded successfully"}}catch(r){return L.error("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync error",{context:this.getTraceContext(),providers:t.providers,error:r}),{code:"FAILURE",message:`Failed to load ads: ${r instanceof Error?r.message:String(r)}`}}})}canIUse(){let t=this.getTraceContext(),r=qi(),n=this.canIUseHelper("loadAdsAsync"),i=this.canIUseHelper("showAdAsync"),o=r&&n&&i;return L.log("[Jolibox SDK Ads][Trace][NativeHelper] canIUse",{context:t,nativeFlag:r,canLoad:n,canShow:i,result:o}),o}showAdAsync(t){return A(this,null,function*(){try{L.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync invoke",{context:this.getTraceContext(),providers:t.providers});let r=yield Ti("showAdAsync",{params:{providers:t.providers}});if(L.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync response",{context:this.getTraceContext(),providers:t.providers,result:r}),r.errNo!==0)return{code:"FAILURE",message:r.errMsg||"Failed to show ad"};let n=r.data.UUID;if(L.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync success",{context:this.getTraceContext(),providers:t.providers,uuid:n}),t.callbacks){let i=t.timeout!==void 0?t.timeout:-1,o=null,a=()=>{L.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange cleanup",{context:this.getTraceContext(),uuid:n}),$d("onAdsStateChange",s),o&&(clearTimeout(o),o=null)},s=l=>{var c;if(L.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange received",{context:this.getTraceContext(),uuid:n,event:l}),l.UUID!==n)return;let m=(c=t.callbacks)==null?void 0:c[l.event];m&&Q_(m,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&a()};Kd("onAdsStateChange",s),L.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange registered",{context:this.getTraceContext(),uuid:n,timeoutMs:i}),i>0&&(o=setTimeout(()=>{a(),console.warn(`[JoliboxSDK] Event listener for ad ${n} auto-cleaned after ${i}ms timeout`)},i))}return{code:"SUCCESS",message:"Ad shown successfully"}}catch(r){return L.error("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync error",{context:this.getTraceContext(),providers:t.providers,error:r}),{code:"FAILURE",message:`Failed to show ad: ${r instanceof Error?r.message:String(r)}`}}})}isAdsReadySync(t){try{let{errNo:r,data:n}=Ti("isAdsReadySync",{params:{providers:t.providers}});return r!==0||!n?(console.warn("[Jolibox SDK]isAdsReadySync returned an error or no data"),!1):!0}catch(r){return console.warn("[Jolibox SDK]isAdsReadySync invocation failed:",r),!1}}};function Ct(e,t,r){return(t=Z_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z_(e){var t=ey(e,"string");return typeof t=="symbol"?t:t+""}function ey(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 Ds=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){Ct(this,"providers",void 0),Ct(this,"helper",void 0),Ct(this,"adsContext",null),Ct(this,"_isAdsReady",!1),Ct(this,"init",()=>A(this,null,function*(){let n=this.helper.canIUse();if(L.log("[Jolibox SDK Ads][Trace][Reward] init start",{canIUse:n,providers:this.providers}),n){let i=yield this.helper.loadAdsAsync({providers:this.providers});L.log("[Jolibox SDK Ads][Trace][Reward] init loadAdsAsync result",{providers:this.providers,result:i}),i.code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1}else this._isAdsReady=!1;L.log("[Jolibox SDK Ads][Trace][Reward] init end",{isAdsReady:this._isAdsReady,providers:this.providers})})),Ct(this,"destroy",n=>{var i,o;L.log("[Jolibox SDK Ads][Trace][Reward] destroy",{breakStatus:n,hasAdsContext:!!this.adsContext,isAdsReady:this._isAdsReady}),this._isAdsReady=!1,(o=(i=this.adsContext)==null?void 0:i.adBreakDone)==null||o.call(i,n),n!=="ignored"&&(this.adsContext=null)}),Ct(this,"reinit",n=>A(this,null,function*(){L.log("[Jolibox SDK Ads][Trace][Reward] reinit start",{breakStatus:n,providers:this.providers}),this.destroy(n),yield this.init(),L.log("[Jolibox SDK Ads][Trace][Reward] reinit end",{breakStatus:n,isAdsReady:this._isAdsReady,providers:this.providers})})),Ct(this,"requestAds",(n,i)=>A(this,null,function*(){if(L.log("[Jolibox SDK Ads][Trace][Reward] requestAds start",{incomingProviders:i,currentProviders:this.providers,isAdsReady:this.isAdsReady,hasAdsContext:!!this.adsContext}),this.adsContext){L.log("[Jolibox SDK Ads][Trace][Reward] requestAds ignored because adsContext exists"),this.destroy("ignored");return}this.adsContext=n,i&&i.length>0&&(this.providers=i,L.log("[Jolibox SDK Ads][Trace][Reward] requestAds replace providers",{providers:this.providers}));try{this.isAdsReady?(L.log("[Jolibox SDK Ads][Trace][Reward] requestAds showAd directly",{providers:this.providers}),this.showAd()):(L.log("[Jolibox SDK Ads][Trace][Reward] requestAds not ready -> reinit only",{providers:this.providers}),yield this.reinit("frequencyCapped"))}catch(o){L.error("[Jolibox SDK Ads][Trace][Reward] requestAds error",{error:o,providers:this.providers}),this.destroy("notReady")}})),Ct(this,"showAd",()=>{if(L.log("[Jolibox SDK Ads][Trace][Reward] showAd start",{hasAdsContext:!!this.adsContext,providers:this.providers}),!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>A(this,null,function*(){var o,a;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o);let s=m=>{var d,h,p;i||(i=!0,L.log("[Jolibox SDK Ads][Trace][Reward] showAd terminal",{status:m,rewarded:n,providers:this.providers}),m==="dismissed"&&((d=this.adsContext)==null||d.adDismissed()),(p=(h=this.adsContext)==null?void 0:h.afterAd)==null||p.call(h),this.reinit(m))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var m;n=!0,(m=this.adsContext)==null||m.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}},c=yield this.helper.showAdAsync({providers:this.providers,callbacks:l});L.log("[Jolibox SDK Ads][Trace][Reward] showAd showAdAsync result",{providers:this.providers,result:c}),c.code!=="SUCCESS"&&this.reinit("noAdPreloaded")}))}),this.providers=r,this.helper=new zi(t),this.init()}};function Rt(e,t,r){return(t=ty(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ty(e){var t=ry(e,"string");return typeof t=="symbol"?t:t+""}function ry(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 Ns=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;Rt(this,"providers",void 0),Rt(this,"helper",void 0),Rt(this,"adsContext",null),Rt(this,"_isAdsReady",!1),Rt(this,"init",()=>A(this,null,function*(){let i=this.helper.canIUse();if(L.log("[Jolibox SDK Ads][Trace][Interstitial] init start",{canIUse:i,providers:this.providers}),i){let o=yield this.helper.loadAdsAsync({providers:this.providers});L.log("[Jolibox SDK Ads][Trace][Interstitial] init loadAdsAsync result",{providers:this.providers,result:o}),o.code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1}else this._isAdsReady=!1;L.log("[Jolibox SDK Ads][Trace][Interstitial] init end",{isAdsReady:this._isAdsReady,providers:this.providers})})),Rt(this,"destroy",function(i){var o,a;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;L.log("[Jolibox SDK Ads][Trace][Interstitial] destroy",{endReason:i,clearContext:s,hasAdsContext:!!n.adsContext,isAdsReady:n._isAdsReady}),n._isAdsReady=!1,s&&((a=(o=n.adsContext)==null?void 0:o.onEnd)==null||a.call(o,i),i!=="ignored"&&(n.adsContext=null))}),Rt(this,"reinit",function(o){return A(this,arguments,function*(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;L.log("[Jolibox SDK Ads][Trace][Interstitial] reinit start",{endReason:i,clearContext:a,providers:n.providers}),n.destroy(i,a),yield n.init(),L.log("[Jolibox SDK Ads][Trace][Interstitial] reinit end",{endReason:i,clearContext:a,isAdsReady:n._isAdsReady,providers:n.providers})})}),Rt(this,"requestAds",(i,o)=>A(this,null,function*(){if(L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds start",{incomingProviders:o,currentProviders:this.providers,isAdsReady:this.isAdsReady,hasAdsContext:!!this.adsContext}),this.adsContext){L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds ignored because adsContext exists"),this.destroy("ignored");return}this.adsContext=i,o&&o.length>0&&(this.providers=o,L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds replace providers",{providers:this.providers}));try{this.isAdsReady?(L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds showAd directly",{providers:this.providers}),yield this.showAd()):(L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds not ready -> reinit only",{providers:this.providers}),yield this.reinit("frequencyCapped"))}catch(a){L.error("[Jolibox SDK Ads][Trace][Interstitial] requestAds error",{error:a,providers:this.providers}),this.destroy("notReady")}})),Rt(this,"showAd",()=>A(this,null,function*(){var i,o;if(L.log("[Jolibox SDK Ads][Trace][Interstitial] showAd start",{hasAdsContext:!!this.adsContext,providers:this.providers}),!this.adsContext){this.destroy("error");return}let a=!1;(o=(i=this.adsContext).beforeAd)==null||o.call(i);let s=m=>{var d,h;a||(a=!0,L.log("[Jolibox SDK Ads][Trace][Interstitial] showAd terminal",{status:m,providers:this.providers}),(h=(d=this.adsContext)==null?void 0:d.afterAd)==null||h.call(d),this.reinit(m))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}},c=yield this.helper.showAdAsync({providers:this.providers,callbacks:l});L.log("[Jolibox SDK Ads][Trace][Interstitial] showAd showAdAsync result",{providers:this.providers,result:c}),c.code!=="SUCCESS"&&this.reinit("noAdPreloaded")})),this.providers=r,this.helper=new zi(t),this.init()}};function tn(e,t,r){return(t=ny(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ny(e){var t=iy(e,"string");return typeof t=="symbol"?t:t+""}function iy(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 Ps=class{constructor(t,r){tn(this,"name","INTERNAL_NATIVE"),tn(this,"context",void 0),tn(this,"rewardAdManager",void 0),tn(this,"interstitialManager",void 0),tn(this,"initProviders",void 0),this.context=t,this.initProviders=r.providers;let n=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],r.providers),i=this.getConfigsByTypes(["INTERSTITIAL"],r.providers);L.log("[Jolibox SDK Ads][Trace][NativeProvider] constructor",{initProviders:r.providers.map(o=>({provider:o.provider,adUnitId:o.params.adUnitId,extra:o.params.extra})),rewardProviders:n,interstitialProviders:i}),n.length>0&&(this.rewardAdManager=new Ds(this.context,n)),i.length>0&&(this.interstitialManager=new Ns(this.context,i))}getConfigsByTypes(t,r,n){var i;let o=[],a=n?n.map(s=>r.find(l=>l.provider===s.provider)).filter(s=>!!s):r;return L.log("[Jolibox SDK Ads][Trace][NativeProvider] getConfigsByTypes",{adsTypes:t,adBreakServerProviders:(i=n==null?void 0:n.map(s=>s.provider))!=null?i:null,baseProviders:a.map(s=>({provider:s.provider,adUnitId:s.params.adUnitId}))}),a.forEach(s=>{t.forEach(l=>{let c="";l==="REWARD"&&(c=s.params.adUnitId.reward),l==="REWARD_INTERSTITIAL"&&(c=s.params.adUnitId.rewardInterstitial),l==="INTERSTITIAL"&&(c=s.params.adUnitId.interstitial),l==="NATIVE"&&(c=s.params.adUnitId.nativeAds),c&&o.push({provider:s.provider,params:{placementId:c,adsType:l,extra:s.params.extra}})})}),L.log("[Jolibox SDK Ads][Trace][NativeProvider] getConfigsByTypes result",{adsTypes:t,configs:o}),o}init(){return A(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,o;switch(L.log("[Jolibox SDK Ads][Trace][NativeProvider] adBreak start",{type:t.type,name:"name"in t?t.name:void 0,serverProviders:r.params.map(a=>a.provider),hasRewardManager:!!this.rewardAdManager,hasInterstitialManager:!!this.interstitialManager}),t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}let a=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],this.initProviders,r.params);L.log("[Jolibox SDK Ads][Trace][NativeProvider] reward orderedConfigs",{type:t.type,orderedConfigs:a}),this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:s=>{var l;(l=t.adBreakDone)==null||l.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:s})}},a);break}default:{let a=t;if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);L.log("[Jolibox SDK Ads][Trace][NativeProvider] interstitial orderedConfigs",{type:t.type,orderedConfigs:s}),this.interstitialManager.requestAds({beforeAd:a.beforeAd,afterAd:a.afterAd,onEnd:l=>{var c;(c=t.adBreakDone)==null||c.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l})}},s);break}}}},cs="jolibox-nb-proxy",oy=0;function ay(e,t){return t==="call"&&e.join(".")==="GameSDK.showRewardAd"?0:15e3}function bu(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=`${cs}-${++oy}`,s=m=>{let d=m.data;(d==null?void 0:d.type)===`${cs}:response`&&d.id===a&&(window.removeEventListener("message",s),c&&clearTimeout(c),d.error?o(new Error(d.error)):i(d.result))},l=ay(e,t),c=l>0?window.setTimeout(()=>{window.removeEventListener("message",s),o(new Error(`[ParentProxy] Timeout after ${l}ms: ${e.join(".")}.${t}`))},l):null;window.addEventListener("message",s),window.parent.postMessage({type:`${cs}:request`,id:a,path:e,action:t,args:r,value:n},"*")})}function af(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 af([...e,r])},set(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath set:",r),bu([...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),bu(e,"call",n)}})}function sy(e){return af([e])}var Ji=()=>{try{if(window.parent&&window.parent!==window)return sy("GameSDK")}catch(e){}};function mr(e,t,r){return(t=ly(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ly(e){var t=cy(e,"string");return typeof t=="symbol"?t:t+""}function cy(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 Ls=class{constructor(){mr(this,"adsContext",null),mr(this,"init",()=>A(this,null,function*(){console.log("[JoliboxSDK] NewsBreak init");let t=Ji();if(t)try{let r=yield t.createRewardAd({platform:"jolibox"});console.log("[JoliboxSDK] NewsBreak init createRewardAd result:",r)}catch(r){console.log("[JoliboxSDK] NewsBreak init createRewardAd error:",r)}})),mr(this,"destroy",t=>{var r,n;(n=(r=this.adsContext)==null?void 0:r.adBreakDone)==null||n.call(r,t),t!=="ignored"&&(this.adsContext=null)}),mr(this,"reinit",t=>A(this,null,function*(){console.log("[JoliboxSDK] NewsBreak reinit breakStatus:",t),this.destroy(t),yield this.init()})),mr(this,"requestAds",t=>A(this,null,function*(){if(console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext",this.adsContext),this.adsContext){this.destroy("ignored");return}this.adsContext=t;let r=Ji();if(console.log("[JoliboxSDK] NewsBreak newsbreak sdk",r),!r){this.destroy("notReady");return}this.showAd()})),mr(this,"showAd",()=>{if(console.log("[JoliboxSDK] NewsBreak showAd"),!this.adsContext){this.destroy("error");return}this.adsContext.beforeReward(()=>A(this,null,function*(){var t,r,n,i,o,a,s,l,c,m,d,h,p,b;(r=(t=this.adsContext)==null?void 0:t.beforeAd)==null||r.call(t);let E=Ji();if(!E){(i=(n=this.adsContext)==null?void 0:n.afterAd)==null||i.call(n),this.reinit("error");return}try{let I=yield E.showRewardAd();if(console.log("[JoliboxSDK] NewsBreak showRewardAd result:",I),!I.success){(a=(o=this.adsContext)==null?void 0:o.afterAd)==null||a.call(o),this.reinit("error");return}I.rewardGranted?((s=this.adsContext)==null||s.adViewed(),(c=(l=this.adsContext)==null?void 0:l.afterAd)==null||c.call(l),this.reinit("viewed")):((m=this.adsContext)==null||m.adDismissed(),(h=(d=this.adsContext)==null?void 0:d.afterAd)==null||h.call(d),this.reinit("dismissed"))}catch(I){console.error("[JoliboxSDK] NewsBreak showRewardAd failed:",I),(b=(p=this.adsContext)==null?void 0:p.afterAd)==null||b.call(p),this.reinit("error")}}))}),this.init()}};function wu(e,t,r){return(t=dy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dy(e){var t=uy(e,"string");return typeof t=="symbol"?t:t+""}function uy(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 Us=class{constructor(){wu(this,"name","NEWSBREAK"),wu(this,"rewardAdManager",void 0)}init(){return A(this,null,function*(){let t=Ji();if(!t){console.warn("[JoliboxSDK] NewsBreak GameSDK is not available on window");return}t.onEnter(),this.rewardAdManager=new Ls})}adConfig(t,r){}adBreak(t,r){var n,i;if(t.type!=="reward"){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:o=>{var a;(a=t.adBreakDone)==null||a.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:o})}})}};function tt(e,t,r){return(t=fy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fy(e){var t=hy(e,"string");return typeof t=="symbol"?t:t+""}function hy(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 cn=class{constructor(t){if(tt(this,"context",void 0),tt(this,"contextInfo",void 0),tt(this,"providers",{}),tt(this,"channelPolicy",void 0),tt(this,"adsActionDetection",void 0),tt(this,"requestContext",void 0),tt(this,"adsRequest",void 0),tt(this,"initialized",!1),tt(this,"adsIsShowing",!1),tt(this,"lastAdBreak",void 0),tt(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new gs(this.context),this.adsActionDetection=new vs(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new Wi(t),this.requestContext=new ln(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return A(this,null,function*(){var r;window.adsbygoogle=window.adsbygoogle||[],L.log("[Jolibox SDK Ads][Trace][AFG] init /api/ads/init request",{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode});let{data:n}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if(L.log("[Jolibox SDK Ads][Trace][AFG] init /api/ads/init response",{length:(r=n==null?void 0:n.length)!=null?r:null,data:n}),(n==null?void 0:n.length)>0){let i=n.filter(l=>l.isNative),o=n.filter(l=>!l.isNative),a={provider:"INTERNAL_NATIVE",params:{providers:i}},s=o.concat([a]);for(let l of s)switch(l.provider){case"GOOGLE_GPT":{let c=new xs(this.context,l.params);yield c.init(),this.providers[l.provider]=c;break}case"ADSENSE":case"ADSENSE_ADMOB":{let c=new _s(this.context,l.params);yield c.init(),this.providers[l.provider]=c;break}case"OKSPIN":{let c=new Cs(this.context,l.params);yield c.init(),this.providers.OKSPIN=c;break}case"APPSROCKETS":{let c=new Os(this.context,l.params);yield c.init(),this.providers.APPSROCKETS=c;break}case"ADSENSE_BANNER_AS_AFG":{let c=new Rs(this.context,l.params);yield c.init(),this.providers.ADSENSE_BANNER_AS_AFG=c;break}case"INTERNAL_NATIVE":{let c=new Ps(this.context,l.params);yield c.init(),this.providers.INTERNAL_NATIVE=c;break}case"NEWSBREAK":{console.log("[JoliboxSDK] NewsBreak Provider",l);let c=new Us;yield c.init(),this.providers.NEWSBREAK=c;break}}}this.adsRequest.cacheInterstitialInfo("start"),this.adsRequest.cacheRewardInfo(),this.initialized=!0})}adConfig(t){this.providers.ADSENSE?this.providers.ADSENSE.adConfig(t):window.adsbygoogle.push(t)}adBreak(t){return A(this,null,function*(){var r,n,i,o,a,s,l,c,m,d,h,p,b,E,I,w,R,O;let P=Date.now(),M=P-this.initializedTimeStamp;if(L.log("[Jolibox SDK Ads][Trace] adBreak:start",{type:t.type,name:t.type==="preroll"?void 0:t.name,initialized:this.initialized,adsIsShowing:this.adsIsShowing,diffToInitialized:M,lastAdBreakDiff:this.lastAdBreak?P-this.lastAdBreak:null}),M<3e3){L.log("[Jolibox SDK Ads][Trace] adBreak:blocked too soon",{type:t.type,diffToInitialized:M}),(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}if(this.lastAdBreak&&P-this.lastAdBreak<500){L.warn("[Jolibox SDK Ads][Trace] adBreak:blocked too frequently",{type:t.type,interval:P-this.lastAdBreak}),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.lastAdBreak=P,this.adsIsShowing){L.warn("[Jolibox SDK Ads][Trace] adBreak:blocked ad is showing",{type:t.type}),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}if(this.initialized||(L.log("[Jolibox SDK Ads][Trace] adBreak:init begin",{type:t.type}),yield this.init(),L.log("[Jolibox SDK Ads][Trace] adBreak:init end",{type:t.type,providerKeys:Object.keys(this.providers)})),t.type!=="reward"){let S=this.channelPolicy.shouldBypassCallingInterstitial();if(L.log("[Jolibox SDK Ads][Trace] adBreak:channelPolicy",{type:t.type,shouldBypassCallingInterstitial:S}),!S){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}}if(!this.context.checkNetwork()&&!this.providers.NEWSBREAK){L.log("[Jolibox SDK Ads][Trace] adBreak:blocked network not ready",{type:t.type,hasNewsBreak:!!this.providers.NEWSBREAK}),(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}try{L.log("[Jolibox SDK Ads][Trace] adBreak:getAFGAdsInfo begin",{type:t.type});let S=yield this.adsRequest.getAFGAdsInfo(t.type),D=S==null?void 0:S.data,F=S==null?void 0:S.code;if(L.log("[Jolibox SDK Ads][Trace] adBreak:getAFGAdsInfo end",{type:t.type,code:F,length:(s=D==null?void 0:D.length)!=null?s:null,nativeCount:(l=D==null?void 0:D.filter(H=>H.isNative).length)!=null?l:null,data:D}),F==="BYPASS_ADS"){switch(L.log("[Jolibox SDK Ads][Trace] adBreak:bypass",{type:t.type}),t.type){case"preroll":{(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{t.beforeReward(()=>{var H,U,J,j;(H=t.beforeAd)==null||H.call(t),(U=t.adViewed)==null||U.call(t),(J=t.afterAd)==null||J.call(t),(j=t.adBreakDone)==null||j.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(m=t.beforeAd)==null||m.call(t),(d=t.afterAd)==null||d.call(t),(h=t.adBreakDone)==null||h.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!D||F!=="SUCCESS"){L.log("[Jolibox SDK Ads][Trace] adBreak:ads info invalid",{type:t.type,code:F,hasData:!!D}),(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}else{if(D.length===0){L.log("[Jolibox SDK Ads][Trace] adBreak:ads info empty",{type:t.type}),(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"});return}let H=!0,U=null,J=new ms(this.context);this.adsActionDetection.adBreakIsShowing=!0;let j=D.filter(Z=>Z.isNative).sort((Z,Le)=>Z.seq-Le.seq),X=D.filter(Z=>!Z.isNative).sort((Z,Le)=>Z.seq-Le.seq);L.log("[Jolibox SDK Ads][Trace] adBreak:provider options",{type:t.type,nativeOptions:j.map(Z=>({provider:Z.provider,seq:Z.seq})),webOptions:X.map(Z=>({provider:Z.provider,seq:Z.seq}))});let Q={seq:(I=(E=j[0])==null?void 0:E.seq)!=null?I:0,provider:"INTERNAL_NATIVE",params:j},be;for(j.length>0?be=[Q].concat(X):be=X,be=be.sort((Z,Le)=>Z.seq-Le.seq).map((Z,Le)=>Ov(Iu({},Z),{seq:Le})),L.log("[Jolibox SDK Ads][Trace] adBreak:final options",{type:t.type,finalOptions:be.map(Z=>({provider:Z.provider,seq:Z.seq}))});be.length>0;){let Z=be.shift(),Le=this.providers[Z.provider];if(L.log("[Jolibox SDK Ads][Trace] adBreak:provider loop",{type:t.type,optionProvider:Z.provider,optionSeq:Z.seq,providerFound:!!Le}),Le){let[ft,Cr]=yield J.callAdBreakAndContinue(Le,t,Z,_n=>{var yn;this.adsIsShowing=_n,(yn=this.context.eventEmitter)==null||yn.emit("isAdShowing",_n)});H=ft,U=Cr,L.log("[Jolibox SDK Ads][Trace] adBreak:provider result",{type:t.type,provider:Z.provider,shouldContinue:ft,placementInfo:Cr})}else H=!0,U={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"};if(!H)break}H&&U&&(L.log("[Jolibox SDK Ads][Trace] adBreak:trailing adBreakDone",{type:t.type,placementInfo:U}),(w=t.adBreakDone)==null||w.call(t,U))}}catch(S){L.log("[Jolibox SDK Ads][Trace] adBreak:error",{type:t.type,error:S}),(R=t.adBreakDone)==null||R.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}finally{L.log("[Jolibox SDK Ads][Trace] adBreak:finally",{type:t.type,adsIsShowingBeforeReset:this.adsIsShowing}),t.type!=="reward"&&(this.adsRequest.cacheNextAFGAdsInfo(t.type),L.log("[Jolibox SDK Ads][Trace] adBreak:cacheNext scheduled",{type:t.type})),this.adsIsShowing=!1,(O=this.context.eventEmitter)==null||O.emit("isAdShowing",!1),this.adsActionDetection.adBreakIsShowing=!1}})}adUnit(t){console.warn("This method has been deprecated. We will not support AdSense AdUnit in the future.")}};function Ni(e,t,r){return(t=py(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function py(e){var t=my(e,"string");return typeof t=="symbol"?t:t+""}function my(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 Bs=class{constructor(t){Ni(this,"context",void 0),Ni(this,"currentProvider",void 0),Ni(this,"continueCallback",void 0),Ni(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo()}get paramsToTrack(){var t,r;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null}}wrapAdRequested(t){return()=>{this.context.track("CallAFVRequest",this.paramsToTrack),t==null||t()}}wrapAdLoaded(t){return r=>{this.context.track("CallAFVLoad",this.paramsToTrack),t==null||t(r)}}wrapAdPlaying(t){return r=>{var n,i;this.context.track("CallAFVPlaying",this.paramsToTrack),qi()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"AFV",module:"drama",game_id:this.contextInfo.objectId}),t==null||t(r)}}wrapAdCompleted(t){return r=>{var n;this.context.track("CallAFVCompleted",this.paramsToTrack),t==null||t(r),(n=this.continueCallback)==null||n.call(this,[!1,null])}}wrapAdError(t){return r=>{var n;this.context.track("CallAFVError",this.paramsToTrack),(n=this.continueCallback)==null||n.call(this,[!0,r])}}callAdRequestAndContinue(t,r,n){return A(this,null,function*(){return this.currentProvider=t,new Promise(i=>{this.continueCallback=i;let o=Object.assign({},r);o.onAdRequested=this.wrapAdRequested(r.onAdRequested),o.onAdLoaded=this.wrapAdLoaded(r.onAdLoaded),o.onAdPlaying=this.wrapAdPlaying(r.onAdPlaying),o.onAdCompleted=this.wrapAdCompleted(r.onAdCompleted),o.onAdError=this.wrapAdError(r.onAdError),t.requestAd(o,n)})})}};function ds(e,t,r){return(t=vy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vy(e){var t=gy(e,"string");return typeof t=="symbol"?t:t+""}function gy(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 Ne=class e extends Error{constructor(t,r){super(t.message),ds(this,"name",void 0),ds(this,"type",void 0),ds(this,"raw",void 0),this.name="AFVRequestError",this.type=r,this.raw=t,this.stack=t.stack,this.message=t.message}static from(t,r){switch(r){case"GOOGLE_IMA_ERROR":return new e(t,r);case"JOLIBOX_IMA_ERROR":return new e(t,r)}}};function se(e,t,r){return(t=_y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _y(e){var t=yy(e,"string");return typeof t=="symbol"?t:t+""}function yy(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 Ms=class{constructor(t,r,n){se(this,"adsLoader",void 0),se(this,"adDisplayContainer",void 0),se(this,"isAdPlaying",!1),se(this,"isContentFinished",!1),se(this,"videoContent",void 0),se(this,"adContainer",void 0),se(this,"adsManager",void 0),se(this,"intervalTimer",void 0),se(this,"completed",!1),se(this,"adTagUrl",void 0),se(this,"notifyRequestAd",void 0),se(this,"notifyLoaded",void 0),se(this,"notifyPlayingAd",void 0),se(this,"notifyCompleted",void 0),se(this,"notifyError",void 0),se(this,"destroy",()=>{var i,o,a,s,l,c,m,d,h,p,b;this.intervalTimer&&clearInterval(this.intervalTimer),(i=this.adsManager)==null||i.stop(),(o=this.adDisplayContainer)==null||o.destroy(),(a=this.adsLoader)==null||a.removeEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded),(s=this.adsLoader)==null||s.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(l=this.adsManager)==null||l.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(c=this.adsManager)==null||c.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),(m=this.adsManager)==null||m.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),(d=this.adsManager)==null||d.removeEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),(h=this.adsManager)==null||h.removeEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),(p=this.adsManager)==null||p.removeEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),(b=this.adsManager)==null||b.removeEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent)}),se(this,"requestAds",(i,o)=>A(this,null,function*(){var a;this.createAdDisplayContainer(),this.notifyRequestAd=i.onAdRequested,this.notifyLoaded=i.onAdLoaded,this.notifyPlayingAd=i.onAdPlaying,this.notifyCompleted=i.onAdCompleted,this.notifyError=d=>{var h;return(h=i.onAdError)==null?void 0:h.call(i,Ne.from(d,"GOOGLE_IMA_ERROR"))},this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded,!1),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError,!1);let s=()=>{var d;this.isAdPlaying||(this.isContentFinished=!0,(d=this.adsLoader)==null||d.contentComplete())};this.videoContent.onended=s;let l=new window.google.ima.AdsRequest;l.vastLoadTimeout=1e4;let c="";Object.keys(o.params).forEach(d=>{let h=window.encodeURIComponent(o.params[d]);c+=`&${d}=${h}`});let m=`${this.adTagUrl}${c}`;l.adTagUrl=m,l.linearAdSlotWidth=640,l.linearAdSlotHeight=400,l.nonLinearAdSlotWidth=640,l.nonLinearAdSlotHeight=150,this.adsLoader.requestAds(l),(a=this.notifyRequestAd)==null||a.call(this)})),se(this,"createAdDisplayContainer",()=>{this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoContent)}),se(this,"playAds",()=>{var i,o;this.videoContent.load(),this.adDisplayContainer.initialize(),this.completed=!1;try{(i=this.adsManager)==null||i.init(window.document.body.clientWidth,window.document.body.clientHeight,window.google.ima.ViewMode.NORMAL),(o=this.adsManager)==null||o.start()}catch(a){console.error("[JoliboxAFV] Google IMA Error: ",a),this.videoContent.play()}}),se(this,"onAdsManagerLoaded",i=>{let o=new window.google.ima.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.loadVideoTimeout=1e4,this.adsManager=i.getAdsManager(this.videoContent,o),this.adsManager.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent),i.type==="adsManagerLoaded"&&this.playAds()}),se(this,"onAdEvent",i=>{var o,a,s,l;let c=i.getAd();switch(i.type){case window.google.ima.AdEvent.Type.LOADED:c!=null&&c.isLinear()||this.videoContent.play(),(o=this.notifyLoaded)==null||o.call(this,i);break;case window.google.ima.AdEvent.Type.STARTED:c!=null&&c.isLinear()&&(this.intervalTimer=window.setInterval(function(){},300)),(a=this.notifyPlayingAd)==null||a.call(this,i);break;case window.google.ima.AdEvent.Type.COMPLETE:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(s=this.notifyCompleted)==null||s.call(this,i));break;case window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(l=this.notifyCompleted)==null||l.call(this,i));break}}),se(this,"onAdError",i=>{var o,a;(o=this.notifyError)==null||o.call(this,i.getError()),(a=this.adsManager)==null||a.destroy()}),se(this,"onContentPauseRequested",()=>{this.isAdPlaying=!0,this.videoContent.pause()}),se(this,"onContentResumeRequested",()=>{this.isAdPlaying=!1}),this.adTagUrl=t,this.videoContent=r,this.adContainer=n}},Fi=(e=>(e[e.ADS_REQUEST_NETWORK_ERROR=1012]="ADS_REQUEST_NETWORK_ERROR",e[e.ASSET_FALLBACK_FAILED=1021]="ASSET_FALLBACK_FAILED",e[e.AUTOPLAY_DISALLOWED=1205]="AUTOPLAY_DISALLOWED",e[e.COMPANION_AD_LOADING_FAILED=603]="COMPANION_AD_LOADING_FAILED",e[e.COMPANION_REQUIRED_ERROR=602]="COMPANION_REQUIRED_ERROR",e[e.FAILED_TO_REQUEST_ADS=1005]="FAILED_TO_REQUEST_ADS",e[e.INVALID_AD_TAG=1013]="INVALID_AD_TAG",e[e.INVALID_ADX_EXTENSION=1105]="INVALID_ADX_EXTENSION",e[e.INVALID_ARGUMENTS=1101]="INVALID_ARGUMENTS",e[e.NONLINEAR_DIMENSIONS_ERROR=501]="NONLINEAR_DIMENSIONS_ERROR",e[e.OVERLAY_AD_LOADING_FAILED=502]="OVERLAY_AD_LOADING_FAILED",e[e.OVERLAY_AD_PLAYING_FAILED=500]="OVERLAY_AD_PLAYING_FAILED",e[e.STREAM_INITIALIZATION_FAILED=1020]="STREAM_INITIALIZATION_FAILED",e[e.UNKNOWN_AD_RESPONSE=1010]="UNKNOWN_AD_RESPONSE",e[e.UNKNOWN_ERROR=900]="UNKNOWN_ERROR",e[e.UNSUPPORTED_LOCALE=1011]="UNSUPPORTED_LOCALE",e[e.VAST_ASSET_NOT_FOUND=1007]="VAST_ASSET_NOT_FOUND",e[e.VAST_EMPTY_RESPONSE=1009]="VAST_EMPTY_RESPONSE",e[e.VAST_LINEAR_ASSET_MISMATCH=403]="VAST_LINEAR_ASSET_MISMATCH",e[e.VAST_LOAD_TIMEOUT=301]="VAST_LOAD_TIMEOUT",e[e.VAST_MALFORMED_RESPONSE=100]="VAST_MALFORMED_RESPONSE",e[e.VAST_MEDIA_LOAD_TIMEOUT=402]="VAST_MEDIA_LOAD_TIMEOUT",e[e.VAST_NO_ADS_AFTER_WRAPPER=303]="VAST_NO_ADS_AFTER_WRAPPER",e[e.VAST_NONLINEAR_ASSET_MISMATCH=503]="VAST_NONLINEAR_ASSET_MISMATCH",e[e.VAST_PROBLEM_DISPLAYING_MEDIA_FILE=405]="VAST_PROBLEM_DISPLAYING_MEDIA_FILE",e[e.VAST_SCHEMA_VALIDATION_ERROR=101]="VAST_SCHEMA_VALIDATION_ERROR",e[e.VAST_TOO_MANY_REDIRECTS=302]="VAST_TOO_MANY_REDIRECTS",e[e.VAST_TRAFFICKING_ERROR=200]="VAST_TRAFFICKING_ERROR",e[e.VAST_UNEXPECTED_DURATION_ERROR=202]="VAST_UNEXPECTED_DURATION_ERROR",e[e.VAST_UNEXPECTED_LINEARITY=201]="VAST_UNEXPECTED_LINEARITY",e[e.VAST_UNSUPPORTED_VERSION=102]="VAST_UNSUPPORTED_VERSION",e[e.VAST_WRAPPER_ERROR=300]="VAST_WRAPPER_ERROR",e[e.VIDEO_PLAY_ERROR=400]="VIDEO_PLAY_ERROR",e[e.VPAID_ERROR=901]="VPAID_ERROR",e))(Fi||{}),by=()=>{let e=z(!1),t=z(!1),r=z(null),n=qr(),i=qr();return{visible:e,canRetry:t,retry:r,videoRef:n,adContainerRef:i}},wy=Pe`
|
|
258
|
+
`,rf=e=>{let{state:t}=e,{afterAd:r,adDismissed:n,adViewed:i,adBreakDone:o,adLoaded:a,adLinkClicked:s,visible:l,src:c}=t,[h,d]=wt(!1),p=b=>{var E,I,w,R;d(!1),l.value=!1,b==="dismiss"?(E=n.value)==null||E.call(n):b==="viewed"&&((I=i.value)==null||I.call(i)),(w=r.value)==null||w.call(r),(R=o.value)==null||R.call(o)},m=()=>{var b;(b=a.value)==null||b.call(a)};return pr("appsrockets_ad_dismissed",()=>p("dismiss")),pr("appsrockets_ad_rewarded",()=>p("viewed")),pr("appsrockets_ad_completed",()=>p("viewed")),pr("appsrockets_ad_skipped",()=>p("viewed")),pr("appsrockets_ad_clicked",b=>{var E;return(E=s.value)==null?void 0:E.call(s,b)}),pr("appsrockets_ad_loaded",()=>d(!0)),l.value?K("div",{className:U_,style:{display:h?"flex":"none"},children:l.value&&K("iframe",{src:c.value,onLoad:m,allowFullScreen:!0,allow:"autoplay",sandbox:"allow-scripts allow-same-origin allow-forms allow-modals allow-downloads allow-popups allow-popups-to-escape-sandbox allow-top-navigation-by-user-activation allow-top-navigation allow-top-navigation-by-user-activation allow-top-navigation-to-custom-protocols"})}):null};function St(e,t,r){return(t=B_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function B_(e){var t=M_(e,"string");return typeof t=="symbol"?t:t+""}function M_(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 Os=class{constructor(t,r){St(this,"name","APPSROCKETS"),St(this,"initialized",!1),St(this,"initCompleter",null),St(this,"context",void 0),St(this,"adsOverlay",null),St(this,"adsIsShowing",!1),St(this,"lastUnDisplayedAdBreak",null),St(this,"state",tf()),St(this,"processUrl",(n,i)=>{var o;let a=this.context.getContextInfo(),s=new URL(n),l=new URLSearchParams(s.search);return l.has("joliSource")||l.set("joliSource",a.joliSource),l.get("osType")||l.set("osType",a.osType),l.get("runtimeType")||l.set("runtimeType",a.runtimeType),l.get("mode")||l.set("mode","AFG"),l.get("deviceId")||l.set("deviceId",a.deviceId),l.get("statusBarHeight")||l.set("statusBarHeight",((o=this.context.getWindowInfo().statusBarHeight)!=null?o:0).toString()),l.get("adsType")||l.set("adsType",i),s.search=l.toString(),s.toString()}),this.context=t}init(){return A(this,null,function*(){var t;this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afg-appsrockets"),st(K(rf,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(t=this.initCompleter)==null||t.call(this)})}adConfig(t){var r;if(this.initialized){(r=t.onReady)==null||r.call(t);return}this.initCompleter=()=>{var n;(n=t.onReady)==null||n.call(t)}}adBreak(t,r){var n,i,o,a,s,l,c,h;if(!this.initialized||!this.adsOverlay||!r.params.url){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady"});return}if(this.adsIsShowing){(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?"":t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped"});return}let d=m=>{var b,E;(E=(b=this.context).handleLinkClicked)==null||E.call(b,m)},p=t.type==="reward"?"REWARD":"INTERSTITIAL";switch(t.type){case"preroll":{(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"",breakFormat:"interstitial",breakStatus:"noAdPreloaded"});break}case"start":case"browse":case"next":case"pause":{(a=t.beforeAd)==null||a.call(t);let m=()=>{var I;this.adsIsShowing=!1,(I=t.afterAd)==null||I.call(t)},b=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"})},E=()=>{var I;this.adsIsShowing=!1,(I=t.adBreakDone)==null||I.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"noAdPreloaded"})};he(()=>{this.adsIsShowing=!0,this.state.afterAd.value=m,this.state.adBreakDone.value=b,this.state.src.value=this.processUrl(r.params.url,p),this.state.adLinkClicked.value=d,this.state.adError.value=E,this.state.visible.value=!0});break}case"reward":{this.lastUnDisplayedAdBreak&&((l=(s=this.lastUnDisplayedAdBreak).adBreakDone)==null||l.call(s,{breakType:this.lastUnDisplayedAdBreak.type,breakName:this.lastUnDisplayedAdBreak.type==="preroll"?"":this.lastUnDisplayedAdBreak.name,breakFormat:this.lastUnDisplayedAdBreak.type==="reward"?"reward":"interstitial",breakStatus:"ignored"}),this.lastUnDisplayedAdBreak=null),(c=t.beforeAd)==null||c.call(t);let m=()=>{var P;this.adsIsShowing=!1,(P=t.afterAd)==null||P.call(t)},b={breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"ignored"},E=()=>{var P;this.adsIsShowing=!1,b.breakStatus="dismissed",(P=t.adDismissed)==null||P.call(t)},I=()=>{var P;this.adsIsShowing=!1,b.breakStatus="viewed",(P=t.adViewed)==null||P.call(t)},w=()=>{var P;this.adsIsShowing=!1,(P=t.adBreakDone)==null||P.call(t,b)},R=()=>{this.adsIsShowing=!1,b.breakStatus="noAdPreloaded"};he(()=>{this.state.afterAd.value=m,this.state.adDismissed.value=E,this.state.adViewed.value=I,this.state.adBreakDone.value=w,this.state.adLinkClicked.value=d,this.state.adError.value=R});let k=()=>{var P;if(this.lastUnDisplayedAdBreak=null,!this.adsOverlay){(P=t.adBreakDone)==null||P.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"notReady"});return}this.adsIsShowing=!0,he(()=>{this.state.src.value=this.processUrl(r.params.url,p),this.state.visible.value=!0})};this.lastUnDisplayedAdBreak=t,(h=t.beforeReward)==null||h.call(t,k);break}}}},nf=()=>{window.googletag=window.googletag||{cmd:[]},window.googletag.pubadsReady||window.googletag.cmd.push(()=>{window.googletag.enableServices()})};function Te(e,t,r){return(t=G_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function G_(e){var t=J_(e,"string");return typeof t=="symbol"?t:t+""}function J_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var of=class{constructor(e,t,r){Te(this,"adUnit",void 0),Te(this,"project",void 0),Te(this,"keyValue",void 0),Te(this,"adsContext",null),Te(this,"rewardedSlot",null),Te(this,"rewardedPayload",null),Te(this,"readyEvent",null),Te(this,"withCommand",function(){googletag.cmd.push(...arguments)}),Te(this,"init",()=>{var n;this.rewardedSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.REWARDED),this.rewardedSlot&&(this.rewardedSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().addEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().addEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.keyValue&&(Object.keys(this.keyValue).forEach(i=>{var o;(o=this.rewardedSlot)==null||o.setTargeting(i,this.keyValue[i])}),Object.keys(this.keyValue).includes("project")||(n=this.rewardedSlot)==null||n.setTargeting("project",this.project)),googletag.display(this.rewardedSlot))}),Te(this,"destroy",(n,i)=>{var o,a;this.rewardedPayload=null,this.readyEvent=null,googletag.pubads().removeEventListener("rewardedSlotReady",this.handleSlotReady),googletag.pubads().removeEventListener("rewardedSlotClosed",this.handleSlotClosed),googletag.pubads().removeEventListener("rewardedSlotGranted",this.handleSlotGranted),googletag.pubads().removeEventListener("slotRenderEnded",this.handleSlotRenderEnded),this.rewardedSlot&&(googletag.destroySlots([this.rewardedSlot]),this.rewardedSlot=null),(a=(o=this.adsContext)==null?void 0:o.adBreakDone)==null||a.call(o,n,i),n!=="ignored"&&(this.adsContext=null)}),Te(this,"reinit",(n,i)=>{this.destroy(n,i),this.init()}),Te(this,"handleSlotReady",n=>{n.slot===this.rewardedSlot&&(this.readyEvent=n)}),Te(this,"handleSlotClosed",n=>{var i,o;if(this.adsContext&&n.slot===this.rewardedSlot){let a=this.rewardedPayload?"viewed":"dismissed";a==="viewed"?this.adsContext.adViewed():this.adsContext.adDismissed(),(o=(i=this.adsContext).afterAd)==null||o.call(i),this.withCommand(()=>{this.reinit(a,a==="dismissed"?{breakReason:"reward_not_completed",breakStage:"ad_terminal"}:{breakStage:"ad_terminal"})})}}),Te(this,"handleSlotGranted",n=>{this.adsContext&&n.slot===this.rewardedSlot&&(this.rewardedPayload=n.payload)}),Te(this,"handleSlotRenderEnded",n=>{n.slot===this.rewardedSlot&&n.isEmpty&&this.adsContext&&this.withCommand(()=>{this.reinit("frequencyCapped",{breakReason:"gpt_reward_empty_render",breakStage:"provider_request"})})}),Te(this,"requestAds",n=>{this.withCommand(()=>{if(this.adsContext){this.destroy("ignored");return}if(this.rewardedSlot||this.init(),this.adsContext=n,!this.rewardedSlot){this.reinit("notReady");return}if(this.readyEvent)this.adsContext.beforeReward(()=>{var i,o,a;(o=(i=this.adsContext)==null?void 0:i.beforeAd)==null||o.call(i),(a=this.readyEvent)==null||a.makeRewardedVisible()});else{let i=o=>{o.slot===this.rewardedSlot&&this.adsContext&&(googletag.pubads().removeEventListener("rewardedSlotReady",i),this.readyEvent=o,this.adsContext.beforeReward(()=>{var a,s,l;(s=(a=this.adsContext)==null?void 0:a.beforeAd)==null||s.call(a),(l=this.readyEvent)==null||l.makeRewardedVisible()}))};googletag.pubads().addEventListener("rewardedSlotReady",i),window.setTimeout(()=>{this.readyEvent||(this.reinit("timeout"),googletag.pubads().removeEventListener("rewardedSlotReady",i))},500)}})}),this.adUnit=e,this.project=t,this.keyValue=r,nf(),this.withCommand(()=>{this.init()})}};function je(e,t,r){return(t=F_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F_(e){var t=q_(e,"string");return typeof t=="symbol"?t:t+""}function q_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ts=class{constructor(t,r,n){var i=this;je(this,"adUnit",void 0),je(this,"project",void 0),je(this,"keyValue",void 0),je(this,"adsContext",null),je(this,"gamingInterstitialSlot",null),je(this,"readyEvent",null),je(this,"isRetrying",!1),je(this,"withCommand",function(){googletag.cmd.push(...arguments)}),je(this,"init",()=>{var o;this.gamingInterstitialSlot=googletag.defineOutOfPageSlot(this.adUnit,googletag.enums.OutOfPageFormat.GAME_MANUAL_INTERSTITIAL),this.gamingInterstitialSlot&&(this.gamingInterstitialSlot.addService(googletag.pubads()),googletag.pubads().addEventListener("gameManualInterstitialSlotReady",this.handleSlotReady),googletag.pubads().addEventListener("gameManualInterstitialSlotClosed",this.handleSlotClosed),this.keyValue&&(Object.keys(this.keyValue).forEach(a=>{var s;(s=this.gamingInterstitialSlot)==null||s.setTargeting(a,this.keyValue[a])}),Object.keys(this.keyValue).includes("project")||(o=this.gamingInterstitialSlot)==null||o.setTargeting("project",this.project)),googletag.display(this.gamingInterstitialSlot))}),je(this,"destroy",function(o){var a,s;let l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,c=arguments.length>2?arguments[2]:void 0;l&&((s=(a=i.adsContext)==null?void 0:a.onEnd)==null||s.call(a,o,c),o!=="ignored"&&(i.adsContext=null)),googletag.pubads().removeEventListener("gameManualInterstitialSlotReady",i.handleSlotReady),googletag.pubads().removeEventListener("gameManualInterstitialSlotClosed",i.handleSlotClosed),i.gamingInterstitialSlot&&(googletag.destroySlots([i.gamingInterstitialSlot]),i.gamingInterstitialSlot=null,i.readyEvent=null)}),je(this,"reinit",function(o){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s=arguments.length>2?arguments[2]:void 0;i.destroy(o,a,s),i.init()}),je(this,"handleSlotReady",o=>{this.gamingInterstitialSlot===o.slot&&(this.readyEvent=o)}),je(this,"handleSlotClosed",o=>{var a,s;this.adsContext&&this.gamingInterstitialSlot===o.slot&&((s=(a=this.adsContext).afterAd)==null||s.call(a),this.withCommand(()=>{this.reinit("viewed")}))}),je(this,"requestAds",o=>{this.withCommand(()=>{var a,s,l;if(this.adsContext){this.destroy("ignored");return}if(this.gamingInterstitialSlot||this.init(),this.adsContext=o,!this.gamingInterstitialSlot){this.reinit("notReady");return}this.readyEvent?((a=o.beforeAd)==null||a.call(o),this.readyEvent.makeGameManualInterstitialVisible()):((l=(s=this.adsContext).onEnd)==null||l.call(s,"frequencyCapped",{breakReason:"gpt_interstitial_not_ready",breakStage:"provider_request"}),this.adsContext=null,this.isRetrying||(this.isRetrying=!0,window.setTimeout(()=>{this.readyEvent||this.withCommand(()=>{this.reinit("frequencyCapped",!1,{breakReason:"gpt_interstitial_not_ready",breakStage:"provider_request"})}),this.isRetrying=!1},31e3)))})}),nf(),this.adUnit=t,this.project=r,this.keyValue=n,this.withCommand(()=>{this.init()})}};function Xt(e,t,r){return(t=j_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function j_(e){var t=H_(e,"string");return typeof t=="symbol"?t:t+""}function H_(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 xs=class{constructor(t,r){Xt(this,"name","GOOGLE_GPT"),Xt(this,"context",void 0),Xt(this,"contextInfo",void 0),Xt(this,"initParams",void 0),Xt(this,"rewardAdManager",void 0),Xt(this,"interstitialManager",void 0),Xt(this,"insertScript",()=>{let n="jolibox-google-gpt",i=document.getElementById(n);i||(i=window.document.createElement("script"),i.id=n,i.async=!0,i.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",i.crossOrigin="anonymous",document.head.appendChild(i))}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.initParams=r,this.insertScript()}init(){return A(this,null,function*(){let t=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":this.initParams.rewardedSlot,r=this.contextInfo.testAdsMode?"/6355419/Travel/Europe/France/Paris":this.initParams.interstitialSlot,n=`minigame-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;t&&(this.rewardAdManager=new of(t,n,this.initParams.keyValue)),r&&(this.interstitialManager=new Ts(r,n,this.initParams.keyValue))})}adConfig(t,r){}adBreak(t,r){var n,i,o;switch(t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded",breakReason:"unknown_no_ad_preloaded",breakStage:"provider_request"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded",breakReason:"provider_missing",breakStage:"provider_request"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:(a,s)=>{var l;(l=t.adBreakDone)==null||l.call(t,yr({breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:a},s))}});break}default:{if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded",breakReason:"provider_missing",breakStage:"provider_request"});return}this.interstitialManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,onEnd:(a,s)=>{var l;(l=t.adBreakDone)==null||l.call(t,yr({breakName:t.name,breakType:t.type,breakFormat:"interstitial",breakStatus:a},s))}});break}}}};function ls(e,t,r){return(t=V_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function V_(e){var t=K_(e,"string");return typeof t=="symbol"?t:t+""}function K_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Ds=class{constructor(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GAME";ls(this,"context",void 0),ls(this,"placement","GAME"),ls(this,"contextInfo",void 0),this.context=t,this.placement=r,this.contextInfo=this.context.getContextInfo()}getLocation(){let t=new URLSearchParams(window.location.search),r={};return t.forEach((n,i)=>{r[i]=n}),{name:this.placement==="GAME"?"GamePage":"DramaPage",params:r}}getDevice(){var t,r,n,i;return{platform:(t=this.contextInfo.platform)!=null?t:Tu.WebSDK,os:this.contextInfo.osType+"_"+this.contextInfo.runtimeType,appVersion:"1.0.0",appId:(r=this.contextInfo.hostAppId)!=null?r:"1",model:(n=this.contextInfo.deviceModel)!=null?n:"UnknownModel",brand:(i=this.contextInfo.deviceBrand)!=null?i:"UnknownBrand",uuid:this.contextInfo.deviceId,jsSdkVersion:"1.0.0",extra:{}}}serialize(t,r){var n;let i={protocolVersion:"1.0.0",events:[{name:t,type:ku.System,location:this.getLocation(),target:null,extra:r,timestamp:Date.now(),userId:(n=this.contextInfo.userId)!=null?n:null}],device:this.getDevice(),project:Ou.WebSDK};return Yv(i)}},bu="__jolibox_ads_trace__key__",cs=()=>{var e;try{return window.__jolibox_ads_trace__key__===!0||((e=window.localStorage)==null?void 0:e.getItem(bu))==="1"||new URLSearchParams(window.location.search).get(bu)==="1"}catch(t){return!1}},L={log:function(){cs()&&console.log(...arguments)},warn:function(){cs()&&console.warn(...arguments)},error:function(){cs()&&console.error(...arguments)}};function De(e,t,r){return(t=$_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function $_(e){var t=W_(e,"string");return typeof t=="symbol"?t:t+""}function W_(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var cn=class{constructor(t){De(this,"context",void 0),De(this,"adsTrackSerializer",void 0),De(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo(),this.adsTrackSerializer=new Ds(this.context)}getRequestContextData(t){var r,n;this.contextInfo=this.context.getContextInfo();let{width:i,height:o}=this.context.getWindowInfo();return{report:JSON.stringify(this.adsTrackSerializer.serialize(t,{sessionId:this.contextInfo.sessionId,objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId,testAdsMode:this.contextInfo.testAdsMode})),osType:this.contextInfo.osType,runtimeType:this.contextInfo.runtimeType,sessionId:this.contextInfo.sessionId,deviceId:this.contextInfo.deviceId,adId:this.contextInfo.adId,deviceModel:(r=this.contextInfo.deviceModel)!=null?r:"UnknownModel",deviceBrand:(n=this.contextInfo.deviceBrand)!=null?n:"UnknownBrand",dimension:{width:i,height:o}}}getRequestBizParams(){return{objectType:this.contextInfo.objectType,objectId:this.contextInfo.objectId}}},zi=class{constructor(t,r){var n=this;De(this,"context",void 0),De(this,"contextInfo",void 0),De(this,"requestContext",void 0),De(this,"adsInfoRequestSeq",0),De(this,"pendingAFGAdsInfo",{REWARD:Promise.resolve(null),INTERSTITIAL:Promise.resolve(null)}),De(this,"pendingAFVAdsInfo",Promise.resolve(null)),De(this,"doFetchAdsInfo",i=>A(this,null,function*(){var o;let a=++this.adsInfoRequestSeq,s=Date.now(),l=i==="afv"?"AdsAFVSDKRequest":"AdsAFGSDKAdBreak",c=[];switch(i){case"afv":{c=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}case"reward":{c=["REWARD_INTERSTITIAL","REWARD","NATIVE"];break}default:{c=["INTERSTITIAL"];break}}let h=i==="afv"?void 0:"cached";L.log("[Jolibox SDK Ads][Trace][AdsRequest] doFetchAdsInfo start",{requestId:a,type:i,eventName:l,adsTypes:c,name:h,contextData:this.requestContext.getRequestContextData(l),bizParams:this.requestContext.getRequestBizParams()});try{let{data:d,code:p}=yield this.context.httpClient.post("/api/ads/info",{data:{contextData:this.requestContext.getRequestContextData(l),bizParams:this.requestContext.getRequestBizParams(),adsTypes:c,testAdsMode:this.contextInfo.testAdsMode,name:h}});return L.log("[Jolibox SDK Ads][Trace][AdsRequest] doFetchAdsInfo response",{requestId:a,type:i,code:p,duration:Date.now()-s,length:(o=d==null?void 0:d.length)!=null?o:null,data:d}),p==="SUCCESS"||p==="BYPASS_ADS"?{code:p,data:d}:null}catch(d){throw L.warn("[Jolibox SDK Ads][Trace][AdsRequest] doFetchAdsInfo error",{requestId:a,type:i,duration:Date.now()-s,error:d}),d}})),De(this,"cacheRewardInfo",()=>{L.log("[Jolibox SDK Ads][Trace][AdsRequest] cacheRewardInfo scheduled"),this.pendingAFGAdsInfo.REWARD=this.doFetchAdsInfo("reward").catch(()=>null)}),De(this,"cacheInterstitialInfo",i=>{L.log("[Jolibox SDK Ads][Trace][AdsRequest] cacheInterstitialInfo scheduled",{type:i}),this.pendingAFGAdsInfo.INTERSTITIAL=this.doFetchAdsInfo(i).catch(()=>null)}),De(this,"cacheAFVInfo",()=>{this.pendingAFVAdsInfo=this.doFetchAdsInfo("afv").catch(()=>null)}),De(this,"cacheNextAFGAdsInfo",i=>A(this,null,function*(){i==="reward"?this.cacheRewardInfo():this.cacheInterstitialInfo(i)})),De(this,"getAFGAdsInfo",i=>A(this,null,function*(){var o,a;L.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo await cache",{type:i,cacheKey:i==="reward"?"REWARD":"INTERSTITIAL"});let s=yield i==="reward"?this.pendingAFGAdsInfo.REWARD:this.pendingAFGAdsInfo.INTERSTITIAL;return L.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo resolved",{type:i,code:s==null?void 0:s.code,length:(a=(o=s==null?void 0:s.data)==null?void 0:o.length)!=null?a:null}),i==="reward"&&(this.cacheNextAFGAdsInfo(i),L.log("[Jolibox SDK Ads][Trace][AdsRequest] getAFGAdsInfo cacheNext scheduled",{type:i})),s})),De(this,"getAFVAdsInfo",function(){return A(this,arguments,function*(){if(!(arguments.length>0&&arguments[0]!==void 0)||arguments[0]){let i=yield n.pendingAFVAdsInfo;return n.cacheAFVInfo(),i}else return n.cacheAFVInfo(),yield n.pendingAFVAdsInfo})}),this.context=t,this.contextInfo=this.context.getContextInfo(),this.requestContext=new cn(t),r!=null&&r.reward&&this.cacheRewardInfo(),r!=null&&r.interstitial&&this.cacheInterstitialInfo("start"),r!=null&&r.afv&&this.cacheAFVInfo()}};function z_(e,t,r){return(t=Y_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y_(e){var t=X_(e,"string");return typeof t=="symbol"?t:t+""}function X_(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 Q_=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];if(e)try{e(...r)}catch(i){console.error("[JoliboxSDK] Callback error:",i)}},Yi=class{constructor(t){this.context=t,z_(this,"canIUseHelper",void 0),this.context=t;let{canIUseNative:r}=Fd(()=>this.context.getContextInfo().deviceInfo.nativeSDKVersionCode||1e6,()=>this.context.getContextInfo().deviceInfo.platform||"h5");this.canIUseHelper=r}getTraceContext(){let t=this.context.getContextInfo();return{platform:t.deviceInfo.platform,nativeSDKVersionCode:t.deviceInfo.nativeSDKVersionCode,objectId:t.objectId}}loadAdsAsync(t){return A(this,null,function*(){try{L.log("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync invoke",{context:this.getTraceContext(),providers:t.providers});let{errNo:r,errMsg:n}=yield Ti("loadAdsAsync",{params:{providers:t.providers}});return L.log("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync response",{context:this.getTraceContext(),providers:t.providers,errNo:r,errMsg:n}),r!==0||n.length>0?{code:"FAILURE",message:n||"Failed to load ads"}:{code:"SUCCESS",message:"Ads loaded successfully"}}catch(r){return L.error("[Jolibox SDK Ads][Trace][NativeHelper] loadAdsAsync error",{context:this.getTraceContext(),providers:t.providers,error:r}),{code:"FAILURE",message:`Failed to load ads: ${r instanceof Error?r.message:String(r)}`}}})}canIUse(){let t=this.getTraceContext(),r=Hi(),n=this.canIUseHelper("loadAdsAsync"),i=this.canIUseHelper("showAdAsync"),o=r&&n&&i;return L.log("[Jolibox SDK Ads][Trace][NativeHelper] canIUse",{context:t,nativeFlag:r,canLoad:n,canShow:i,result:o}),o}showAdAsync(t){return A(this,null,function*(){try{L.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync invoke",{context:this.getTraceContext(),providers:t.providers});let r=yield Ti("showAdAsync",{params:{providers:t.providers}});if(L.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync response",{context:this.getTraceContext(),providers:t.providers,result:r}),r.errNo!==0)return{code:"FAILURE",message:r.errMsg||"Failed to show ad"};let n=r.data.UUID;if(L.log("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync success",{context:this.getTraceContext(),providers:t.providers,uuid:n}),t.callbacks){let i=t.timeout!==void 0?t.timeout:-1,o=null,a=()=>{L.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange cleanup",{context:this.getTraceContext(),uuid:n}),Wd("onAdsStateChange",s),o&&(clearTimeout(o),o=null)},s=l=>{var c;if(L.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange received",{context:this.getTraceContext(),uuid:n,event:l}),l.UUID!==n)return;let h=(c=t.callbacks)==null?void 0:c[l.event];h&&Q_(h,l.data),["onAdClosed","onAdError","onAdDismissed"].includes(l.event)&&a()};$d("onAdsStateChange",s),L.log("[Jolibox SDK Ads][Trace][NativeHelper] onAdsStateChange registered",{context:this.getTraceContext(),uuid:n,timeoutMs:i}),i>0&&(o=setTimeout(()=>{a(),console.warn(`[JoliboxSDK] Event listener for ad ${n} auto-cleaned after ${i}ms timeout`)},i))}return{code:"SUCCESS",message:"Ad shown successfully"}}catch(r){return L.error("[Jolibox SDK Ads][Trace][NativeHelper] showAdAsync error",{context:this.getTraceContext(),providers:t.providers,error:r}),{code:"FAILURE",message:`Failed to show ad: ${r instanceof Error?r.message:String(r)}`}}})}isAdsReadySync(t){try{let{errNo:r,data:n}=Ti("isAdsReadySync",{params:{providers:t.providers}});return r!==0||!n?(console.warn("[Jolibox SDK]isAdsReadySync returned an error or no data"),!1):!0}catch(r){return console.warn("[Jolibox SDK]isAdsReadySync invocation failed:",r),!1}}};function Ct(e,t,r){return(t=Z_(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Z_(e){var t=ey(e,"string");return typeof t=="symbol"?t:t+""}function ey(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 Ns=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){Ct(this,"providers",void 0),Ct(this,"helper",void 0),Ct(this,"adsContext",null),Ct(this,"_isAdsReady",!1),Ct(this,"init",()=>A(this,null,function*(){let n=this.helper.canIUse();if(L.log("[Jolibox SDK Ads][Trace][Reward] init start",{canIUse:n,providers:this.providers}),n){let i=yield this.helper.loadAdsAsync({providers:this.providers});L.log("[Jolibox SDK Ads][Trace][Reward] init loadAdsAsync result",{providers:this.providers,result:i}),i.code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1}else this._isAdsReady=!1;L.log("[Jolibox SDK Ads][Trace][Reward] init end",{isAdsReady:this._isAdsReady,providers:this.providers})})),Ct(this,"destroy",(n,i)=>{var o,a;L.log("[Jolibox SDK Ads][Trace][Reward] destroy",{breakStatus:n,hasAdsContext:!!this.adsContext,isAdsReady:this._isAdsReady}),this._isAdsReady=!1,(a=(o=this.adsContext)==null?void 0:o.adBreakDone)==null||a.call(o,n,i),n!=="ignored"&&(this.adsContext=null)}),Ct(this,"reinit",(n,i)=>A(this,null,function*(){L.log("[Jolibox SDK Ads][Trace][Reward] reinit start",{breakStatus:n,providers:this.providers}),this.destroy(n,i),yield this.init(),L.log("[Jolibox SDK Ads][Trace][Reward] reinit end",{breakStatus:n,isAdsReady:this._isAdsReady,providers:this.providers})})),Ct(this,"requestAds",(n,i)=>A(this,null,function*(){if(L.log("[Jolibox SDK Ads][Trace][Reward] requestAds start",{incomingProviders:i,currentProviders:this.providers,isAdsReady:this.isAdsReady,hasAdsContext:!!this.adsContext}),this.adsContext){L.log("[Jolibox SDK Ads][Trace][Reward] requestAds ignored because adsContext exists"),this.destroy("ignored");return}this.adsContext=n,i&&i.length>0&&(this.providers=i,L.log("[Jolibox SDK Ads][Trace][Reward] requestAds replace providers",{providers:this.providers}));try{this.isAdsReady?(L.log("[Jolibox SDK Ads][Trace][Reward] requestAds showAd directly",{providers:this.providers}),this.showAd()):(L.log("[Jolibox SDK Ads][Trace][Reward] requestAds not ready -> reinit only",{providers:this.providers}),yield this.reinit("frequencyCapped",{breakReason:"native_reward_not_ready",breakStage:"provider_request"}))}catch(o){L.error("[Jolibox SDK Ads][Trace][Reward] requestAds error",{error:o,providers:this.providers}),this.destroy("notReady")}})),Ct(this,"showAd",()=>{if(L.log("[Jolibox SDK Ads][Trace][Reward] showAd start",{hasAdsContext:!!this.adsContext,providers:this.providers}),!this.adsContext){this.destroy("error");return}let n=!1,i=!1;this.adsContext.beforeReward(()=>A(this,null,function*(){var o,a;(a=(o=this.adsContext)==null?void 0:o.beforeAd)==null||a.call(o);let s=h=>{var d,p,m;i||(i=!0,L.log("[Jolibox SDK Ads][Trace][Reward] showAd terminal",{status:h,rewarded:n,providers:this.providers}),h==="dismissed"&&((d=this.adsContext)==null||d.adDismissed()),(m=(p=this.adsContext)==null?void 0:p.afterAd)==null||m.call(p),this.reinit(h,h==="dismissed"?{breakReason:"reward_not_completed",breakStage:"ad_terminal"}:{breakStage:"ad_terminal"}))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdRewarded:()=>{var h;n=!0,(h=this.adsContext)==null||h.adViewed()},onAdDismissed:()=>{s(n?"viewed":"dismissed")},onAdClosed:()=>{s(n?"viewed":"dismissed")}},c=yield this.helper.showAdAsync({providers:this.providers,callbacks:l});L.log("[Jolibox SDK Ads][Trace][Reward] showAd showAdAsync result",{providers:this.providers,result:c}),c.code!=="SUCCESS"&&this.reinit("noAdPreloaded",{breakReason:"native_show_failed",breakStage:"native_show"})}))}),this.providers=r,this.helper=new Yi(t),this.init()}};function Rt(e,t,r){return(t=ty(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ty(e){var t=ry(e,"string");return typeof t=="symbol"?t:t+""}function ry(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 Ps=class{get isAdsReady(){return this._isAdsReady}constructor(t,r){var n=this;Rt(this,"providers",void 0),Rt(this,"helper",void 0),Rt(this,"adsContext",null),Rt(this,"_isAdsReady",!1),Rt(this,"init",()=>A(this,null,function*(){let i=this.helper.canIUse();if(L.log("[Jolibox SDK Ads][Trace][Interstitial] init start",{canIUse:i,providers:this.providers}),i){let o=yield this.helper.loadAdsAsync({providers:this.providers});L.log("[Jolibox SDK Ads][Trace][Interstitial] init loadAdsAsync result",{providers:this.providers,result:o}),o.code==="SUCCESS"?this._isAdsReady=!0:this._isAdsReady=!1}else this._isAdsReady=!1;L.log("[Jolibox SDK Ads][Trace][Interstitial] init end",{isAdsReady:this._isAdsReady,providers:this.providers})})),Rt(this,"destroy",function(i){var o,a;let s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,l=arguments.length>2?arguments[2]:void 0;L.log("[Jolibox SDK Ads][Trace][Interstitial] destroy",{endReason:i,clearContext:s,hasAdsContext:!!n.adsContext,isAdsReady:n._isAdsReady}),n._isAdsReady=!1,s&&((a=(o=n.adsContext)==null?void 0:o.onEnd)==null||a.call(o,i,l),i!=="ignored"&&(n.adsContext=null))}),Rt(this,"reinit",function(o){return A(this,arguments,function*(i){let a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,s=arguments.length>2?arguments[2]:void 0;L.log("[Jolibox SDK Ads][Trace][Interstitial] reinit start",{endReason:i,clearContext:a,providers:n.providers}),n.destroy(i,a,s),yield n.init(),L.log("[Jolibox SDK Ads][Trace][Interstitial] reinit end",{endReason:i,clearContext:a,isAdsReady:n._isAdsReady,providers:n.providers})})}),Rt(this,"requestAds",(i,o)=>A(this,null,function*(){if(L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds start",{incomingProviders:o,currentProviders:this.providers,isAdsReady:this.isAdsReady,hasAdsContext:!!this.adsContext}),this.adsContext){L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds ignored because adsContext exists"),this.destroy("ignored");return}this.adsContext=i,o&&o.length>0&&(this.providers=o,L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds replace providers",{providers:this.providers}));try{this.isAdsReady?(L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds showAd directly",{providers:this.providers}),yield this.showAd()):(L.log("[Jolibox SDK Ads][Trace][Interstitial] requestAds not ready -> reinit only",{providers:this.providers}),yield this.reinit("frequencyCapped",!0,{breakReason:"native_interstitial_not_ready",breakStage:"provider_request"}))}catch(a){L.error("[Jolibox SDK Ads][Trace][Interstitial] requestAds error",{error:a,providers:this.providers}),this.destroy("notReady")}})),Rt(this,"showAd",()=>A(this,null,function*(){var i,o;if(L.log("[Jolibox SDK Ads][Trace][Interstitial] showAd start",{hasAdsContext:!!this.adsContext,providers:this.providers}),!this.adsContext){this.destroy("error");return}let a=!1;(o=(i=this.adsContext).beforeAd)==null||o.call(i);let s=h=>{var d,p;a||(a=!0,L.log("[Jolibox SDK Ads][Trace][Interstitial] showAd terminal",{status:h,providers:this.providers}),(p=(d=this.adsContext)==null?void 0:d.afterAd)==null||p.call(d),this.reinit(h,!0,h==="dismissed"?{breakReason:"interstitial_dismissed",breakStage:"ad_terminal"}:{breakStage:"ad_terminal"}))},l={onAdShow:()=>{},onAdError:()=>{s("error")},onAdDismissed:()=>{s("dismissed")},onAdClosed:()=>{s("viewed")}},c=yield this.helper.showAdAsync({providers:this.providers,callbacks:l});L.log("[Jolibox SDK Ads][Trace][Interstitial] showAd showAdAsync result",{providers:this.providers,result:c}),c.code!=="SUCCESS"&&this.reinit("noAdPreloaded",!0,{breakReason:"native_show_failed",breakStage:"native_show"})})),this.providers=r,this.helper=new Yi(t),this.init()}};function rn(e,t,r){return(t=ny(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ny(e){var t=iy(e,"string");return typeof t=="symbol"?t:t+""}function iy(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 Ls=class{constructor(t,r){rn(this,"name","INTERNAL_NATIVE"),rn(this,"context",void 0),rn(this,"rewardAdManager",void 0),rn(this,"interstitialManager",void 0),rn(this,"initProviders",void 0),this.context=t,this.initProviders=r.providers;let n=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],r.providers),i=this.getConfigsByTypes(["INTERSTITIAL"],r.providers);L.log("[Jolibox SDK Ads][Trace][NativeProvider] constructor",{initProviders:r.providers.map(o=>({provider:o.provider,adUnitId:o.params.adUnitId,extra:o.params.extra})),rewardProviders:n,interstitialProviders:i}),n.length>0&&(this.rewardAdManager=new Ns(this.context,n)),i.length>0&&(this.interstitialManager=new Ps(this.context,i))}getConfigsByTypes(t,r,n){var i;let o=[],a=n?n.map(s=>r.find(l=>l.provider===s.provider)).filter(s=>!!s):r;return L.log("[Jolibox SDK Ads][Trace][NativeProvider] getConfigsByTypes",{adsTypes:t,adBreakServerProviders:(i=n==null?void 0:n.map(s=>s.provider))!=null?i:null,baseProviders:a.map(s=>({provider:s.provider,adUnitId:s.params.adUnitId}))}),a.forEach(s=>{t.forEach(l=>{let c="";l==="REWARD"&&(c=s.params.adUnitId.reward),l==="REWARD_INTERSTITIAL"&&(c=s.params.adUnitId.rewardInterstitial),l==="INTERSTITIAL"&&(c=s.params.adUnitId.interstitial),l==="NATIVE"&&(c=s.params.adUnitId.nativeAds),c&&o.push({provider:s.provider,params:{placementId:c,adsType:l,extra:s.params.extra}})})}),L.log("[Jolibox SDK Ads][Trace][NativeProvider] getConfigsByTypes result",{adsTypes:t,configs:o}),o}init(){return A(this,null,function*(){})}adConfig(t,r){}adBreak(t,r){var n,i,o;switch(L.log("[Jolibox SDK Ads][Trace][NativeProvider] adBreak start",{type:t.type,name:"name"in t?t.name:void 0,serverProviders:r.params.map(a=>a.provider),hasRewardManager:!!this.rewardAdManager,hasInterstitialManager:!!this.interstitialManager}),t.type){case"preroll":{(n=t.adBreakDone)==null||n.call(t,{breakType:"preroll",breakFormat:"interstitial",breakStatus:"noAdPreloaded",breakReason:"native_preroll_not_supported",breakStage:"provider_request"});break}case"reward":{if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded",breakReason:"native_manager_missing",breakStage:"provider_request"});return}let a=this.getConfigsByTypes(["REWARD","REWARD_INTERSTITIAL","NATIVE"],this.initProviders,r.params);L.log("[Jolibox SDK Ads][Trace][NativeProvider] reward orderedConfigs",{type:t.type,orderedConfigs:a}),this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:(s,l)=>{var c;(c=t.adBreakDone)==null||c.call(t,yr({breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:s},l))}},a);break}default:{let a=t;if(!this.interstitialManager){(o=t.adBreakDone)==null||o.call(t,{breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded",breakReason:"native_manager_missing",breakStage:"provider_request"});return}let s=this.getConfigsByTypes(["INTERSTITIAL"],this.initProviders,r.params);L.log("[Jolibox SDK Ads][Trace][NativeProvider] interstitial orderedConfigs",{type:t.type,orderedConfigs:s}),this.interstitialManager.requestAds({beforeAd:a.beforeAd,afterAd:a.afterAd,onEnd:(l,c)=>{var h;(h=t.adBreakDone)==null||h.call(t,yr({breakName:a.name,breakType:t.type,breakFormat:"interstitial",breakStatus:l},c))}},s);break}}}},ds="jolibox-nb-proxy",oy=0;function ay(e,t){return t==="call"&&e.join(".")==="GameSDK.showRewardAd"?0:15e3}function wu(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=`${ds}-${++oy}`,s=h=>{let d=h.data;(d==null?void 0:d.type)===`${ds}:response`&&d.id===a&&(window.removeEventListener("message",s),c&&clearTimeout(c),d.error?o(new Error(d.error)):i(d.result))},l=ay(e,t),c=l>0?window.setTimeout(()=>{window.removeEventListener("message",s),o(new Error(`[ParentProxy] Timeout after ${l}ms: ${e.join(".")}.${t}`))},l):null;window.addEventListener("message",s),window.parent.postMessage({type:`${ds}:request`,id:a,path:e,action:t,args:r,value:n},"*")})}function af(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 af([...e,r])},set(t,r,n){return console.log("[JoliboxSDK] NewsBreak createProxyForPath set:",r),wu([...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),wu(e,"call",n)}})}function sy(e){return af([e])}var Fi=()=>{try{if(window.parent&&window.parent!==window)return sy("GameSDK")}catch(e){}};function mr(e,t,r){return(t=ly(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ly(e){var t=cy(e,"string");return typeof t=="symbol"?t:t+""}function cy(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 Us=class{constructor(){mr(this,"adsContext",null),mr(this,"init",()=>A(this,null,function*(){console.log("[JoliboxSDK] NewsBreak init");let t=Fi();if(t)try{let r=yield t.createRewardAd({platform:"jolibox"});console.log("[JoliboxSDK] NewsBreak init createRewardAd result:",r)}catch(r){console.log("[JoliboxSDK] NewsBreak init createRewardAd error:",r)}})),mr(this,"destroy",t=>{var r,n;(n=(r=this.adsContext)==null?void 0:r.adBreakDone)==null||n.call(r,t),t!=="ignored"&&(this.adsContext=null)}),mr(this,"reinit",t=>A(this,null,function*(){console.log("[JoliboxSDK] NewsBreak reinit breakStatus:",t),this.destroy(t),yield this.init()})),mr(this,"requestAds",t=>A(this,null,function*(){if(console.log("[JoliboxSDK] NewsBreak newsbreak this.adsContext",this.adsContext),this.adsContext){this.destroy("ignored");return}this.adsContext=t;let r=Fi();if(console.log("[JoliboxSDK] NewsBreak newsbreak sdk",r),!r){this.destroy("notReady");return}this.showAd()})),mr(this,"showAd",()=>{if(console.log("[JoliboxSDK] NewsBreak showAd"),!this.adsContext){this.destroy("error");return}this.adsContext.beforeReward(()=>A(this,null,function*(){var t,r,n,i,o,a,s,l,c,h,d,p,m,b;(r=(t=this.adsContext)==null?void 0:t.beforeAd)==null||r.call(t);let E=Fi();if(!E){(i=(n=this.adsContext)==null?void 0:n.afterAd)==null||i.call(n),this.reinit("error");return}try{let I=yield E.showRewardAd();if(console.log("[JoliboxSDK] NewsBreak showRewardAd result:",I),!I.success){(a=(o=this.adsContext)==null?void 0:o.afterAd)==null||a.call(o),this.reinit("error");return}I.rewardGranted?((s=this.adsContext)==null||s.adViewed(),(c=(l=this.adsContext)==null?void 0:l.afterAd)==null||c.call(l),this.reinit("viewed")):((h=this.adsContext)==null||h.adDismissed(),(p=(d=this.adsContext)==null?void 0:d.afterAd)==null||p.call(d),this.reinit("dismissed"))}catch(I){console.error("[JoliboxSDK] NewsBreak showRewardAd failed:",I),(b=(m=this.adsContext)==null?void 0:m.afterAd)==null||b.call(m),this.reinit("error")}}))}),this.init()}};function Au(e,t,r){return(t=dy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function dy(e){var t=uy(e,"string");return typeof t=="symbol"?t:t+""}function uy(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 Bs=class{constructor(){Au(this,"name","NEWSBREAK"),Au(this,"rewardAdManager",void 0)}init(){return A(this,null,function*(){let t=Fi();if(!t){console.warn("[JoliboxSDK] NewsBreak GameSDK is not available on window");return}t.onEnter(),this.rewardAdManager=new Us})}adConfig(t,r){}adBreak(t,r){var n,i;if(t.type!=="reward"){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded",breakReason:"provider_missing",breakStage:"provider_request"});return}if(!this.rewardAdManager){(i=t.adBreakDone)==null||i.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:"noAdPreloaded",breakReason:"provider_missing",breakStage:"provider_request"});return}this.rewardAdManager.requestAds({beforeAd:t.beforeAd,afterAd:t.afterAd,adDismissed:t.adDismissed,adViewed:t.adViewed,beforeReward:t.beforeReward,adBreakDone:o=>{var a;(a=t.adBreakDone)==null||a.call(t,{breakName:t.name,breakType:t.type,breakFormat:"reward",breakStatus:o,breakReason:o==="dismissed"?"reward_not_completed":void 0,breakStage:o==="dismissed"?"ad_terminal":void 0})}})}};function tt(e,t,r){return(t=fy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fy(e){var t=hy(e,"string");return typeof t=="symbol"?t:t+""}function hy(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 dn=class{constructor(t){if(tt(this,"context",void 0),tt(this,"contextInfo",void 0),tt(this,"providers",{}),tt(this,"channelPolicy",void 0),tt(this,"adsActionDetection",void 0),tt(this,"requestContext",void 0),tt(this,"adsRequest",void 0),tt(this,"initialized",!1),tt(this,"adsIsShowing",!1),tt(this,"lastAdBreak",void 0),tt(this,"initializedTimeStamp",Date.now()),t)this.context=t,this.channelPolicy=new _s(this.context),this.adsActionDetection=new gs(this.context),this.contextInfo=this.context.getContextInfo(),this.adsRequest=new zi(t),this.requestContext=new cn(t);else throw new Error("JoliboxAdsForGame requires a configuration object")}init(t){return A(this,null,function*(){var r;window.adsbygoogle=window.adsbygoogle||[],L.log("[Jolibox SDK Ads][Trace][AFG] init /api/ads/init request",{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode});let{data:n}=yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFGSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}});if(L.log("[Jolibox SDK Ads][Trace][AFG] init /api/ads/init response",{length:(r=n==null?void 0:n.length)!=null?r:null,data:n}),(n==null?void 0:n.length)>0){let i=n.filter(l=>l.isNative),o=n.filter(l=>!l.isNative),a={provider:"INTERNAL_NATIVE",params:{providers:i}},s=o.concat([a]);for(let l of s)switch(l.provider){case"GOOGLE_GPT":{let c=new xs(this.context,l.params);yield c.init(),this.providers[l.provider]=c;break}case"ADSENSE":case"ADSENSE_ADMOB":{let c=new ys(this.context,l.params);yield c.init(),this.providers[l.provider]=c;break}case"OKSPIN":{let c=new Rs(this.context,l.params);yield c.init(),this.providers.OKSPIN=c;break}case"APPSROCKETS":{let c=new Os(this.context,l.params);yield c.init(),this.providers.APPSROCKETS=c;break}case"ADSENSE_BANNER_AS_AFG":{let c=new ks(this.context,l.params);yield c.init(),this.providers.ADSENSE_BANNER_AS_AFG=c;break}case"INTERNAL_NATIVE":{let c=new Ls(this.context,l.params);yield c.init(),this.providers.INTERNAL_NATIVE=c;break}case"NEWSBREAK":{console.log("[JoliboxSDK] NewsBreak Provider",l);let c=new Bs;yield c.init(),this.providers.NEWSBREAK=c;break}}}this.adsRequest.cacheInterstitialInfo("start"),this.adsRequest.cacheRewardInfo(),this.initialized=!0})}adConfig(t){this.providers.ADSENSE?this.providers.ADSENSE.adConfig(t):window.adsbygoogle.push(t)}adBreak(t){return A(this,null,function*(){var r,n,i,o,a,s,l,c,h,d,p,m,b,E,I,w,R,k;let P=Date.now(),M=P-this.initializedTimeStamp;if(L.log("[Jolibox SDK Ads][Trace] adBreak:start",{type:t.type,name:t.type==="preroll"?void 0:t.name,initialized:this.initialized,adsIsShowing:this.adsIsShowing,diffToInitialized:M,lastAdBreakDiff:this.lastAdBreak?P-this.lastAdBreak:null}),M<3e3){L.log("[Jolibox SDK Ads][Trace] adBreak:blocked too soon",{type:t.type,diffToInitialized:M}),(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded",breakReason:"called_too_soon_after_init",breakStage:"before_ads_info"});return}if(this.lastAdBreak&&P-this.lastAdBreak<500){L.warn("[Jolibox SDK Ads][Trace] adBreak:blocked too frequently",{type:t.type,interval:P-this.lastAdBreak}),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped",breakReason:"too_frequently_500ms",breakStage:"before_provider"});return}if(this.lastAdBreak=P,this.adsIsShowing){L.warn("[Jolibox SDK Ads][Trace] adBreak:blocked ad is showing",{type:t.type}),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"frequencyCapped",breakReason:"ad_already_showing",breakStage:"before_provider"});return}if(this.initialized||(L.log("[Jolibox SDK Ads][Trace] adBreak:init begin",{type:t.type}),yield this.init(),L.log("[Jolibox SDK Ads][Trace] adBreak:init end",{type:t.type,providerKeys:Object.keys(this.providers)})),t.type!=="reward"){let S=this.channelPolicy.shouldBypassCallingInterstitial();if(L.log("[Jolibox SDK Ads][Trace] adBreak:channelPolicy",{type:t.type,shouldBypassCallingInterstitial:S}),!S){(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:"skipInterstitials",breakFormat:"interstitial",breakStatus:"viewed"});return}}if(!this.context.checkNetwork()&&!this.providers.NEWSBREAK){L.log("[Jolibox SDK Ads][Trace] adBreak:blocked network not ready",{type:t.type,hasNewsBreak:!!this.providers.NEWSBREAK}),(a=t.adBreakDone)==null||a.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded",breakReason:"network_not_ready",breakStage:"before_ads_info"});return}try{L.log("[Jolibox SDK Ads][Trace] adBreak:getAFGAdsInfo begin",{type:t.type});let S=yield this.adsRequest.getAFGAdsInfo(t.type),D=S==null?void 0:S.data,F=S==null?void 0:S.code;if(L.log("[Jolibox SDK Ads][Trace] adBreak:getAFGAdsInfo end",{type:t.type,code:F,length:(s=D==null?void 0:D.length)!=null?s:null,nativeCount:(l=D==null?void 0:D.filter(H=>H.isNative).length)!=null?l:null,data:D}),F==="BYPASS_ADS"){switch(L.log("[Jolibox SDK Ads][Trace] adBreak:bypass",{type:t.type}),t.type){case"preroll":{(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"viewed"});break}case"reward":{t.beforeReward(()=>{var H,U,J,q;(H=t.beforeAd)==null||H.call(t),(U=t.adViewed)==null||U.call(t),(J=t.afterAd)==null||J.call(t),(q=t.adBreakDone)==null||q.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"viewed"})});break}default:{(h=t.beforeAd)==null||h.call(t),(d=t.afterAd)==null||d.call(t),(p=t.adBreakDone)==null||p.call(t,{breakType:t.type,breakName:t.name,breakFormat:"interstitial",breakStatus:"viewed"});break}}return}if(!D||F!=="SUCCESS"){L.log("[Jolibox SDK Ads][Trace] adBreak:ads info invalid",{type:t.type,code:F,hasData:!!D}),(m=t.adBreakDone)==null||m.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded",breakReason:"ads_info_invalid_code",breakStage:"ads_info"});return}else{if(D.length===0){L.log("[Jolibox SDK Ads][Trace] adBreak:ads info empty",{type:t.type}),(b=t.adBreakDone)==null||b.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded",breakReason:"ads_info_empty",breakStage:"ads_info"});return}let H=!0,U=null,J=new vs(this.context);this.adsActionDetection.adBreakIsShowing=!0;let q=D.filter(Z=>Z.isNative).sort((Z,Le)=>Z.seq-Le.seq),X=D.filter(Z=>!Z.isNative).sort((Z,Le)=>Z.seq-Le.seq);L.log("[Jolibox SDK Ads][Trace] adBreak:provider options",{type:t.type,nativeOptions:q.map(Z=>({provider:Z.provider,seq:Z.seq})),webOptions:X.map(Z=>({provider:Z.provider,seq:Z.seq}))});let Q={seq:(I=(E=q[0])==null?void 0:E.seq)!=null?I:0,provider:"INTERNAL_NATIVE",params:q},be;for(q.length>0?be=[Q].concat(X):be=X,be=be.sort((Z,Le)=>Z.seq-Le.seq).map((Z,Le)=>kv(yr({},Z),{seq:Le})),L.log("[Jolibox SDK Ads][Trace] adBreak:final options",{type:t.type,finalOptions:be.map(Z=>({provider:Z.provider,seq:Z.seq}))});be.length>0;){let Z=be.shift(),Le=this.providers[Z.provider];if(L.log("[Jolibox SDK Ads][Trace] adBreak:provider loop",{type:t.type,optionProvider:Z.provider,optionSeq:Z.seq,providerFound:!!Le}),Le){let[ft,Rr]=yield J.callAdBreakAndContinue(Le,t,Z,yn=>{var bn;this.adsIsShowing=yn,(bn=this.context.eventEmitter)==null||bn.emit("isAdShowing",yn)});H=ft,U=Rr,L.log("[Jolibox SDK Ads][Trace] adBreak:provider result",{type:t.type,provider:Z.provider,shouldContinue:ft,placementInfo:Rr})}else H=!0,U={breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"notReady",breakReason:"provider_missing",breakStage:"before_provider"};if(!H)break}H&&U&&(L.log("[Jolibox SDK Ads][Trace] adBreak:trailing adBreakDone",{type:t.type,placementInfo:U}),(w=t.adBreakDone)==null||w.call(t,U))}}catch(S){L.log("[Jolibox SDK Ads][Trace] adBreak:error",{type:t.type,error:S}),(R=t.adBreakDone)==null||R.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded",breakReason:"ads_info_request_failed",breakStage:"ads_info"})}finally{L.log("[Jolibox SDK Ads][Trace] adBreak:finally",{type:t.type,adsIsShowingBeforeReset:this.adsIsShowing}),t.type!=="reward"&&(this.adsRequest.cacheNextAFGAdsInfo(t.type),L.log("[Jolibox SDK Ads][Trace] adBreak:cacheNext scheduled",{type:t.type})),this.adsIsShowing=!1,(k=this.context.eventEmitter)==null||k.emit("isAdShowing",!1),this.adsActionDetection.adBreakIsShowing=!1}})}adUnit(t){console.warn("This method has been deprecated. We will not support AdSense AdUnit in the future.")}};function Pi(e,t,r){return(t=py(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function py(e){var t=my(e,"string");return typeof t=="symbol"?t:t+""}function my(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 Ms=class{constructor(t){Pi(this,"context",void 0),Pi(this,"currentProvider",void 0),Pi(this,"continueCallback",void 0),Pi(this,"contextInfo",void 0),this.context=t,this.contextInfo=t.getContextInfo()}get paramsToTrack(){var t,r;return{provider:(r=(t=this.currentProvider)==null?void 0:t.name)!=null?r:null}}wrapAdRequested(t){return()=>{this.context.track("CallAFVRequest",this.paramsToTrack),t==null||t()}}wrapAdLoaded(t){return r=>{this.context.track("CallAFVLoad",this.paramsToTrack),t==null||t(r)}}wrapAdPlaying(t){return r=>{var n,i;this.context.track("CallAFVPlaying",this.paramsToTrack),Hi()&&this.context.track("mmp_ad_impression",{ad_network:(i=(n=this.currentProvider)==null?void 0:n.name)!=null?i:"",ad_format:"AFV",module:"drama",game_id:this.contextInfo.objectId}),t==null||t(r)}}wrapAdCompleted(t){return r=>{var n;this.context.track("CallAFVCompleted",this.paramsToTrack),t==null||t(r),(n=this.continueCallback)==null||n.call(this,[!1,null])}}wrapAdError(t){return r=>{var n;this.context.track("CallAFVError",this.paramsToTrack),(n=this.continueCallback)==null||n.call(this,[!0,r])}}callAdRequestAndContinue(t,r,n){return A(this,null,function*(){return this.currentProvider=t,new Promise(i=>{this.continueCallback=i;let o=Object.assign({},r);o.onAdRequested=this.wrapAdRequested(r.onAdRequested),o.onAdLoaded=this.wrapAdLoaded(r.onAdLoaded),o.onAdPlaying=this.wrapAdPlaying(r.onAdPlaying),o.onAdCompleted=this.wrapAdCompleted(r.onAdCompleted),o.onAdError=this.wrapAdError(r.onAdError),t.requestAd(o,n)})})}};function us(e,t,r){return(t=vy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function vy(e){var t=gy(e,"string");return typeof t=="symbol"?t:t+""}function gy(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 Ne=class e extends Error{constructor(t,r){super(t.message),us(this,"name",void 0),us(this,"type",void 0),us(this,"raw",void 0),this.name="AFVRequestError",this.type=r,this.raw=t,this.stack=t.stack,this.message=t.message}static from(t,r){switch(r){case"GOOGLE_IMA_ERROR":return new e(t,r);case"JOLIBOX_IMA_ERROR":return new e(t,r)}}};function se(e,t,r){return(t=_y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _y(e){var t=yy(e,"string");return typeof t=="symbol"?t:t+""}function yy(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 Gs=class{constructor(t,r,n){se(this,"adsLoader",void 0),se(this,"adDisplayContainer",void 0),se(this,"isAdPlaying",!1),se(this,"isContentFinished",!1),se(this,"videoContent",void 0),se(this,"adContainer",void 0),se(this,"adsManager",void 0),se(this,"intervalTimer",void 0),se(this,"completed",!1),se(this,"adTagUrl",void 0),se(this,"notifyRequestAd",void 0),se(this,"notifyLoaded",void 0),se(this,"notifyPlayingAd",void 0),se(this,"notifyCompleted",void 0),se(this,"notifyError",void 0),se(this,"destroy",()=>{var i,o,a,s,l,c,h,d,p,m,b;this.intervalTimer&&clearInterval(this.intervalTimer),(i=this.adsManager)==null||i.stop(),(o=this.adDisplayContainer)==null||o.destroy(),(a=this.adsLoader)==null||a.removeEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded),(s=this.adsLoader)==null||s.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(l=this.adsManager)==null||l.removeEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),(c=this.adsManager)==null||c.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),(h=this.adsManager)==null||h.removeEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),(d=this.adsManager)==null||d.removeEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),(p=this.adsManager)==null||p.removeEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),(m=this.adsManager)==null||m.removeEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),(b=this.adsManager)==null||b.removeEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent)}),se(this,"requestAds",(i,o)=>A(this,null,function*(){var a;this.createAdDisplayContainer(),this.notifyRequestAd=i.onAdRequested,this.notifyLoaded=i.onAdLoaded,this.notifyPlayingAd=i.onAdPlaying,this.notifyCompleted=i.onAdCompleted,this.notifyError=d=>{var p;return(p=i.onAdError)==null?void 0:p.call(i,Ne.from(d,"GOOGLE_IMA_ERROR"))},this.adsLoader=new window.google.ima.AdsLoader(this.adDisplayContainer),this.adsLoader.addEventListener(window.google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED,this.onAdsManagerLoaded,!1),this.adsLoader.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError,!1);let s=()=>{var d;this.isAdPlaying||(this.isContentFinished=!0,(d=this.adsLoader)==null||d.contentComplete())};this.videoContent.onended=s;let l=new window.google.ima.AdsRequest;l.vastLoadTimeout=1e4;let c="";Object.keys(o.params).forEach(d=>{let p=window.encodeURIComponent(o.params[d]);c+=`&${d}=${p}`});let h=`${this.adTagUrl}${c}`;l.adTagUrl=h,l.linearAdSlotWidth=640,l.linearAdSlotHeight=400,l.nonLinearAdSlotWidth=640,l.nonLinearAdSlotHeight=150,this.adsLoader.requestAds(l),(a=this.notifyRequestAd)==null||a.call(this)})),se(this,"createAdDisplayContainer",()=>{this.adDisplayContainer=new window.google.ima.AdDisplayContainer(this.adContainer,this.videoContent)}),se(this,"playAds",()=>{var i,o;this.videoContent.load(),this.adDisplayContainer.initialize(),this.completed=!1;try{(i=this.adsManager)==null||i.init(window.document.body.clientWidth,window.document.body.clientHeight,window.google.ima.ViewMode.NORMAL),(o=this.adsManager)==null||o.start()}catch(a){console.error("[JoliboxAFV] Google IMA Error: ",a),this.videoContent.play()}}),se(this,"onAdsManagerLoaded",i=>{let o=new window.google.ima.AdsRenderingSettings;o.restoreCustomPlaybackStateOnAdBreakComplete=!0,o.loadVideoTimeout=1e4,this.adsManager=i.getAdsManager(this.videoContent,o),this.adsManager.addEventListener(window.google.ima.AdErrorEvent.Type.AD_ERROR,this.onAdError),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,this.onContentPauseRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED,this.onContentResumeRequested),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.LOADED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.STARTED,this.onAdEvent),this.adsManager.addEventListener(window.google.ima.AdEvent.Type.COMPLETE,this.onAdEvent),i.type==="adsManagerLoaded"&&this.playAds()}),se(this,"onAdEvent",i=>{var o,a,s,l;let c=i.getAd();switch(i.type){case window.google.ima.AdEvent.Type.LOADED:c!=null&&c.isLinear()||this.videoContent.play(),(o=this.notifyLoaded)==null||o.call(this,i);break;case window.google.ima.AdEvent.Type.STARTED:c!=null&&c.isLinear()&&(this.intervalTimer=window.setInterval(function(){},300)),(a=this.notifyPlayingAd)==null||a.call(this,i);break;case window.google.ima.AdEvent.Type.COMPLETE:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(s=this.notifyCompleted)==null||s.call(this,i));break;case window.google.ima.AdEvent.Type.ALL_ADS_COMPLETED:c!=null&&c.isLinear()&&clearInterval(this.intervalTimer),this.completed||(this.completed=!0,(l=this.notifyCompleted)==null||l.call(this,i));break}}),se(this,"onAdError",i=>{var o,a;(o=this.notifyError)==null||o.call(this,i.getError()),(a=this.adsManager)==null||a.destroy()}),se(this,"onContentPauseRequested",()=>{this.isAdPlaying=!0,this.videoContent.pause()}),se(this,"onContentResumeRequested",()=>{this.isAdPlaying=!1}),this.adTagUrl=t,this.videoContent=r,this.adContainer=n}},qi=(e=>(e[e.ADS_REQUEST_NETWORK_ERROR=1012]="ADS_REQUEST_NETWORK_ERROR",e[e.ASSET_FALLBACK_FAILED=1021]="ASSET_FALLBACK_FAILED",e[e.AUTOPLAY_DISALLOWED=1205]="AUTOPLAY_DISALLOWED",e[e.COMPANION_AD_LOADING_FAILED=603]="COMPANION_AD_LOADING_FAILED",e[e.COMPANION_REQUIRED_ERROR=602]="COMPANION_REQUIRED_ERROR",e[e.FAILED_TO_REQUEST_ADS=1005]="FAILED_TO_REQUEST_ADS",e[e.INVALID_AD_TAG=1013]="INVALID_AD_TAG",e[e.INVALID_ADX_EXTENSION=1105]="INVALID_ADX_EXTENSION",e[e.INVALID_ARGUMENTS=1101]="INVALID_ARGUMENTS",e[e.NONLINEAR_DIMENSIONS_ERROR=501]="NONLINEAR_DIMENSIONS_ERROR",e[e.OVERLAY_AD_LOADING_FAILED=502]="OVERLAY_AD_LOADING_FAILED",e[e.OVERLAY_AD_PLAYING_FAILED=500]="OVERLAY_AD_PLAYING_FAILED",e[e.STREAM_INITIALIZATION_FAILED=1020]="STREAM_INITIALIZATION_FAILED",e[e.UNKNOWN_AD_RESPONSE=1010]="UNKNOWN_AD_RESPONSE",e[e.UNKNOWN_ERROR=900]="UNKNOWN_ERROR",e[e.UNSUPPORTED_LOCALE=1011]="UNSUPPORTED_LOCALE",e[e.VAST_ASSET_NOT_FOUND=1007]="VAST_ASSET_NOT_FOUND",e[e.VAST_EMPTY_RESPONSE=1009]="VAST_EMPTY_RESPONSE",e[e.VAST_LINEAR_ASSET_MISMATCH=403]="VAST_LINEAR_ASSET_MISMATCH",e[e.VAST_LOAD_TIMEOUT=301]="VAST_LOAD_TIMEOUT",e[e.VAST_MALFORMED_RESPONSE=100]="VAST_MALFORMED_RESPONSE",e[e.VAST_MEDIA_LOAD_TIMEOUT=402]="VAST_MEDIA_LOAD_TIMEOUT",e[e.VAST_NO_ADS_AFTER_WRAPPER=303]="VAST_NO_ADS_AFTER_WRAPPER",e[e.VAST_NONLINEAR_ASSET_MISMATCH=503]="VAST_NONLINEAR_ASSET_MISMATCH",e[e.VAST_PROBLEM_DISPLAYING_MEDIA_FILE=405]="VAST_PROBLEM_DISPLAYING_MEDIA_FILE",e[e.VAST_SCHEMA_VALIDATION_ERROR=101]="VAST_SCHEMA_VALIDATION_ERROR",e[e.VAST_TOO_MANY_REDIRECTS=302]="VAST_TOO_MANY_REDIRECTS",e[e.VAST_TRAFFICKING_ERROR=200]="VAST_TRAFFICKING_ERROR",e[e.VAST_UNEXPECTED_DURATION_ERROR=202]="VAST_UNEXPECTED_DURATION_ERROR",e[e.VAST_UNEXPECTED_LINEARITY=201]="VAST_UNEXPECTED_LINEARITY",e[e.VAST_UNSUPPORTED_VERSION=102]="VAST_UNSUPPORTED_VERSION",e[e.VAST_WRAPPER_ERROR=300]="VAST_WRAPPER_ERROR",e[e.VIDEO_PLAY_ERROR=400]="VIDEO_PLAY_ERROR",e[e.VPAID_ERROR=901]="VPAID_ERROR",e))(qi||{}),by=()=>{let e=z(!1),t=z(!1),r=z(null),n=Hr(),i=Hr();return{visible:e,canRetry:t,retry:r,videoRef:n,adContainerRef:i}},wy=Pe`
|
|
259
259
|
${Ae}
|
|
260
260
|
position: fixed;
|
|
261
261
|
left: 0;
|
|
@@ -300,7 +300,7 @@ or `);this.errors.push(o)}return n}},$n=class extends _e{constructor(...t){super
|
|
|
300
300
|
cursor: pointer;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
`,Ay=e=>{let{onReady:t,state:r}=e,{visible:n,retry:i,canRetry:o,videoRef:a,adContainerRef:s}=r,l=()=>{i.value&&(i.value(),he(()=>{i.value=null,o.value=!1}))};return Pt(()=>{t()},[t]),K("div",{className:wy,style:{display:n.value?"block":"none"},children:K("div",{className:"ads-wrapper",children:[K("video",{ref:a,width:"100%",height:"100%",playsInline:!0,"webkit-playsinline":"true",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAD0lEQVR4AQEEAPv/AAAAAAAEAAFlScNgAAAAAElFTkSuQmCC",style:{transition:"none !important",transform:"none !important",animation:"none !important",objectFit:"contain"}}),K("div",{id:"ad-container",ref:s}),o.value?K("div",{className:"retry-button",onClick:l,children:K("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[K("circle",{cx:"32",cy:"32",r:"32",fill:"#141416",fillOpacity:"0.3"}),K("path",{d:"M25.3334 23.3668V40.6334C25.3334 41.9501 26.7834 42.7501 27.9 42.0334L41.4667 33.4001C42.5 32.7501 42.5 31.2501 41.4667 30.5834L27.9 21.9668C26.7834 21.2501 25.3334 22.0501 25.3334 23.3668Z",fill:"white"})]})}):null]})})};function Ot(e,t,r){return(t=Ey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ey(e){var t=Iy(e,"string");return typeof t=="symbol"?t:t+""}function Iy(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 Gs=class{constructor(t){Ot(this,"name","GOOGLE_IMA"),Ot(this,"context",void 0),Ot(this,"adsOverlay",null),Ot(this,"initialized",!1),Ot(this,"ima",null),Ot(this,"state",by()),Ot(this,"init",r=>A(this,null,function*(){if(this.initialized)return;let n="//imasdk.googleapis.com/js/sdkloader/ima3.js";yield new Promise((i,o)=>{if(document.querySelector("#google-ima-sdk")){i();return}else{let a=document.createElement("script");a.id="google-ima-sdk",a.src=n,a.onload=()=>{var s;(s=window.google)!=null&&s.ima?i():setTimeout(i,100)},a.onerror=o,document.head.appendChild(a)}}),this.adsOverlay=document.createElement("div"),this.adsOverlay.id="jolibox-ima-overlay",document.documentElement.appendChild(this.adsOverlay),yield new Promise((i,o)=>{st(K(Ay,{state:this.state,onReady:()=>{this.ima=new Ms(r.params.url,this.state.videoRef.current,this.state.adContainerRef.current),i()}}),this.adsOverlay)}),this.initialized=!0})),Ot(this,"destroy",()=>{this.adsOverlay&&(st(null,this.adsOverlay),this.adsOverlay.remove()),this.ima&&this.ima.destroy(),this.initialized=!1}),Ot(this,"requestAd",(r,n)=>{var i;if(!this.adsOverlay||!this.ima||!this.initialized){let m=Ne.from(new Error("IMA not initialized"),"JOLIBOX_IMA_ERROR");(i=r.onAdError)==null||i.call(r,m);return}let o=m=>{var d;this.ima.destroy(),this.state.visible.value=!1,(d=r.onAdCompleted)==null||d.call(r,m)},a=m=>{var d;let h=!1;switch(m.raw.getErrorCode()){case Fi.AUTOPLAY_DISALLOWED:case Fi.VIDEO_PLAY_ERROR:case Fi.ADS_REQUEST_NETWORK_ERROR:{h=!0;break}default:{h=!1;break}}if(!h)this.ima.destroy(),he(()=>{this.state.canRetry.value=!1,this.state.retry.value=null,this.state.visible.value=!1}),(d=r.onAdError)==null||d.call(r,m);else{let p=()=>{this.ima.destroy(),this.requestAd(r,n)};he(()=>{this.state.canRetry.value=!0,this.state.retry.value=p})}},s=m=>{var d;this.state.visible.value=!0,(d=r.onAdLoaded)==null||d.call(r,m)},l=m=>{var d;(d=r.onAdPlaying)==null||d.call(r,m)},c=Object.assign({},r);c.onAdCompleted=o,c.onAdError=a,c.onAdLoaded=s,c.onAdPlaying=l,this.ima.requestAds(c,n)}),this.context=t}};function lt(e,t,r){return(t=Sy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sy(e){var t=Cy(e,"string");return typeof t=="symbol"?t:t+""}function Cy(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 Js=class{constructor(t){lt(this,"name","OKSPIN"),lt(this,"initialized",!1),lt(this,"initCompleter",null),lt(this,"context",void 0),lt(this,"adsOverlay",null),lt(this,"adsIsShowing",!1),lt(this,"state",Zu()),lt(this,"init",r=>A(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv"),st(K(ef,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),lt(this,"destroy",()=>{var r;this.adsOverlay&&(st(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),lt(this,"requestAd",(r,n)=>{var i,o,a,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,Ne.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(o=r.onAdError)==null||o.call(r,Ne.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(a=r.onAdRequested)==null||a.call(r);let l=()=>{var m;this.adsIsShowing=!1,(m=r.onAdCompleted)==null||m.call(r,void 0)},c=()=>{var m;(m=r.onAdLoaded)==null||m.call(r,void 0)};this.adsIsShowing=!0,he(()=>{var m;this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.countdown.value=(m=n.params.countdown)!=null?m:15,this.state.src.value=n.params.url,this.state.mode.value="rewarded_insterstitial",this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function rt(e,t,r){return(t=Ry(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ry(e){var t=Oy(e,"string");return typeof t=="symbol"?t:t+""}function Oy(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 Fs=class{constructor(t){rt(this,"name","APPSROCKETS"),rt(this,"initialized",!1),rt(this,"initCompleter",null),rt(this,"context",void 0),rt(this,"adsOverlay",null),rt(this,"adsIsShowing",!1),rt(this,"state",tf()),rt(this,"processUrl",r=>{var n;let i=this.context.getContextInfo(),o=new URL(r),a=new URLSearchParams(o.search);return a.has("joliSource")||a.set("joliSource",i.joliSource),a.get("osType")||a.set("osType",i.osType),a.get("runtimeType")||a.set("runtimeType",i.runtimeType),a.get("mode")||a.set("mode","AFV"),a.get("deviceId")||a.set("deviceId",i.deviceId),a.get("statusBarHeight")||a.set("statusBarHeight",((n=this.context.getWindowInfo().statusBarHeight)!=null?n:0).toString()),a.get("adsType")||a.set("adsType","REWARD_INTERSTITIAL"),o.search=a.toString(),o.toString()}),rt(this,"init",r=>A(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv-appsrockets"),st(K(rf,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),rt(this,"destroy",()=>{var r;this.adsOverlay&&(st(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),rt(this,"requestAd",(r,n)=>{var i,o,a,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,Ne.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(o=r.onAdError)==null||o.call(r,Ne.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(a=r.onAdRequested)==null||a.call(r);let l=()=>{var h;this.adsIsShowing=!1,(h=r.onAdCompleted)==null||h.call(r,void 0)},c=()=>{var h;(h=r.onAdLoaded)==null||h.call(r,void 0)},m=h=>{var p,b;(b=(p=this.context).handleLinkClicked)==null||b.call(p,h)},d=()=>{var h;(h=r.onAdError)==null||h.call(r,Ne.from(new Error("Ads load error"),"JOLIBOX_IMA_ERROR"))};this.adsIsShowing=!0,he(()=>{this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.adLinkClicked.value=m,this.state.adError.value=d,this.state.src.value=this.processUrl(n.params.url),this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function Ut(e,t,r){return(t=Ty(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ty(e){var t=xy(e,"string");return typeof t=="symbol"?t:t+""}function xy(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 js=class{constructor(t){Ut(this,"name","GOOGLE_GPT"),Ut(this,"context",void 0),Ut(this,"contextInfo",void 0),Ut(this,"rewardAdManager",void 0),Ut(this,"init",r=>A(this,null,function*(){if(!this.rewardAdManager){let n=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":r.params.rewardedSlot,i=`minidrama-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;this.rewardAdManager=new of(n,i,r.params.keyValue)}})),Ut(this,"insertScript",()=>{let r="jolibox-google-gpt",n=document.getElementById(r);n||(n=window.document.createElement("script"),n.id=r,n.async=!0,n.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",n.crossOrigin="anonymous",document.head.appendChild(n))}),Ut(this,"destroy",()=>{var r;(r=this.rewardAdManager)==null||r.withCommand(()=>{var n;(n=this.rewardAdManager)==null||n.destroy("ignored")})}),Ut(this,"requestAd",(r,n)=>{var i;if(!this.rewardAdManager){(i=r.onAdError)==null||i.call(r,Ne.from(new Error("rewardAdManager not initialized"),"JOLIBOX_IMA_ERROR"));return}this.rewardAdManager.requestAds({beforeAd:r.onAdRequested,beforeReward:o=>{var a,s;(a=r.onAdLoaded)==null||a.call(r,void 0),o(),(s=r.onAdPlaying)==null||s.call(r,void 0)},adDismissed:()=>{},adViewed:()=>{},adBreakDone:o=>{var a,s;switch(o){case"viewed":{(a=r.onAdCompleted)==null||a.call(r,void 0);break}case"ignored":break;default:{(s=r.onAdError)==null||s.call(r,Ne.from(new Error(o),"JOLIBOX_IMA_ERROR"));break}}}})}),this.context=t,this.contextInfo=t.getContextInfo(),this.insertScript()}};function ct(e,t,r){return(t=ky(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ky(e){var t=Dy(e,"string");return typeof t=="symbol"?t:t+""}function Dy(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 Yi=class e{constructor(t){if(ct(this,"context",void 0),ct(this,"contextInfo",void 0),ct(this,"providers",{}),ct(this,"requestContext",void 0),ct(this,"adsRequest",void 0),ct(this,"initialized",!1),ct(this,"preloadedAd",null),ct(this,"shouldCache",!1),t)this.context=t,this.requestContext=new ln(t),this.adsRequest=new Wi(t,{reward:!1,interstitial:!1,afv:!1}),this.contextInfo=this.context.getContextInfo();else throw new Error("JoliboxAdsForVideo requires a configuration object")}init(){return A(this,arguments,function*(){var t;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n,i=sessionStorage.getItem(e.STORAGE_KEY_INIT);if(i){sessionStorage.removeItem(e.STORAGE_KEY_INIT);try{n=JSON.parse(i)}catch(o){}}if(n!=null&&n.length||(L.log("[Jolibox SDK Ads][Trace][AFV] init /api/ads/init request",{contextData:this.requestContext.getRequestContextData("AdsAFVSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}),n=(yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFVSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}})).data,L.log("[Jolibox SDK Ads][Trace][AFV] init /api/ads/init response",{length:(t=n==null?void 0:n.length)!=null?t:null,data:n})),r&&n!=null&&n.length)try{sessionStorage.setItem(e.STORAGE_KEY_INIT,JSON.stringify(n))}catch(o){}if((n==null?void 0:n.length)>0)for(let o of n)switch(o.provider){case"GOOGLE_GPT":{let a=new js(this.context);yield a.init(o),this.providers.GOOGLE_GPT=a;break}case"GOOGLE_IMA":{let a=new Gs(this.context);yield a.init(o),this.providers.GOOGLE_IMA=a;break}case"OKSPIN":{let a=new Js(this.context);yield a.init(o),this.providers.OKSPIN=a;break}case"APPSROCKETS":{let a=new Fs(this.context);yield a.init(o),this.providers.APPSROCKETS=a;break}}this.adsRequest.cacheAFVInfo(),this.initialized=!0,this.shouldCache=r,this.preload()})}preload(){let t=sessionStorage.getItem(e.STORAGE_KEY_INFO);if(t){sessionStorage.removeItem(e.STORAGE_KEY_INFO);try{this.preloadedAd=JSON.parse(t);return}catch(r){}}this.adsRequest.getAFVAdsInfo(!0).then(r=>{if(L.log("[Jolibox SDK Ads][Trace][AFV] preload adsInfo",r),this.preloadedAd=r,this.shouldCache&&r)try{sessionStorage.setItem(e.STORAGE_KEY_INFO,JSON.stringify(r))}catch(n){}}).catch(()=>{this.preloadedAd=null})}destroy(){let t=Object.values(this.providers);for(let r of t)r.destroy();this.initialized=!1,this.preloadedAd=null}requestAd(t){return A(this,null,function*(){var r,n,i,o,a,s,l,c,m,d,h,p;if((r=this.context.eventEmitter)==null||r.emit("isAdShowing",!0),this.initialized||(yield this.init()),!this.context.checkNetwork()){let b=Ne.from(new Error("No network connection"),"JOLIBOX_IMA_ERROR");(n=t.onAdError)==null||n.call(t,b);return}try{L.log("[Jolibox SDK Ads][Trace][AFV] requestAd preloadedAd",this.preloadedAd);let b=(i=this.preloadedAd)!=null?i:yield this.adsRequest.getAFVAdsInfo(!0);this.preloadedAd=null;let E=b==null?void 0:b.code,I=b==null?void 0:b.data;if(E==="BYPASS_ADS"){(o=t.onAdRequested)==null||o.call(t),(a=t.onAdLoaded)==null||a.call(t,void 0),(s=t.onAdPlaying)==null||s.call(t,void 0),(l=t.onAdCompleted)==null||l.call(t,void 0);return}if(I){let w=I.sort((M,S)=>M.seq-S.seq);if(w.length===0){let M=Ne.from(new Error("No ads available"),"JOLIBOX_IMA_ERROR");(m=t.onAdError)==null||m.call(t,M);return}let R=!0,O=null,P=new Bs(this.context);for(;w.length>0;){let M=w.shift(),S=this.providers[M.provider];if(S){let[D,F]=yield P.callAdRequestAndContinue(S,t,M);R=D,O=F}else R=!0,O=Ne.from(new Error("No provider available"),"JOLIBOX_IMA_ERROR");if(!R)break}R&&O&&((d=t.onAdError)==null||d.call(t,O))}else{let w=Ne.from(new Error("Unknown error"),"JOLIBOX_IMA_ERROR");(c=t.onAdError)==null||c.call(t,w);return}}catch(b){let E=Ne.from(new Error("Failed to request ad"),"JOLIBOX_IMA_ERROR");(h=t.onAdError)==null||h.call(t,E)}finally{(p=this.context.eventEmitter)==null||p.emit("isAdShowing",!1),this.preload()}})}};ct(Yi,"STORAGE_KEY_INIT","jolibox_afv_init_data");ct(Yi,"STORAGE_KEY_INFO","jolibox_afv_info_data");ge();var IR=bo(lf());var hn=class{constructor(t){this.ads=t}getAdsInstance(){return this.ads}init(){}adConfig(t){var r,n;(n=(r=this.ads)==null?void 0:r.adConfig)==null||n.call(r,t)}adBreak(t){this.ads.adBreak(t)}adUnit(){}};vt();var pn=class e{constructor(){this.callbacksId=0,this.callbackMap=new Map,this.initOnMessage()}static getInstance(){return e.instance||(e.instance=new e),e.instance}initOnMessage(){window.addEventListener("message",t=>{var r,n,i,o,a,s,l,c,m;if(console.log(`HuaweiQuickAdsHandler,event => ${t}`),t.origin==window.location.origin&&t.data&&t.data.type==null){let d=JSON.parse(t.data);switch(console.log(`HuaweiQuickAdsHandler type => ${d.type}`),d.type){case"huawei_quick_ads_on_message_init":console.log("HuaweiQuickAdsHandler window.addEventListener init",d);break;case"huawei_quick_ads_on_message_ad_config":{let h=d.callbackId;if(h){let p=this.callbackMap.get(h);(r=p==null?void 0:p.onReady)==null||r.call(p)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",d)}break;case"huawei_quick_ads_on_message_ad_break":{let h=d.callbackId;if(h){let p=this.callbackMap.get(h),b="noAdPreloaded",E=!1;switch(d.adsRes){case"viewed":b="viewed",(n=p==null?void 0:p.adViewed)==null||n.call(p),E=!1;break;case"dismissed":b="dismissed",(i=p==null?void 0:p.adDismissed)==null||i.call(p),E=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":b=d.adsRes,E=!0;break;case"breakDone":b=d.params,E=!0;break;case"beforeReward":(o=p==null?void 0:p.beforeReward)==null||o.call(p,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),E=!1;break;case"beforeAd":Ee("HuaweiQuickAdsAdBreakBeforeAd",{type:"beforeAd",format:(p==null?void 0:p.breakType)==="reward"?"reward":"interstitial"}),(a=p==null?void 0:p.beforeAd)==null||a.call(p),E=!1;break;case"afterAd":(s=p==null?void 0:p.afterAd)==null||s.call(p),E=!1;break}E&&((m=p==null?void 0:p.adBreakDone)==null||m.call(p,{breakType:(l=p.breakType)!=null?l:"",breakName:p.breakName,breakFormat:(c=p.breakFormat)!=null?c:"interstitial",breakStatus:b}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",d)}break;case"huawei_quick_ads_on_message_ad_unit":console.log("HuaweiQuickAdsHandler window.addEventListener adUnit",d);break;default:break}}})}getAdsInstance(){return e.getInstance()}init(t){try{this.sendPostMessage("huawei_quick_ads_init",void 0,t)}catch(r){console.error("init failed",r)}}adConfig(t){try{let r;t.onReady&&(r=++this.callbacksId,this.callbackMap.set(r,{onReady:t.onReady})),this.sendPostMessage("huawei_quick_ads_ad_config",r,t)}catch(r){console.error("adConfig failed",r)}}adBreak(t){var r;try{let n=++this.callbacksId,i={};i.breakType=t.type,t.type!=="preroll"&&t.name&&(i.breakName=t.name),i.breakFormat=t.type==="reward"?"reward":"interstitial",t.adBreakDone&&(i.adBreakDone=t.adBreakDone),t.type!=="preroll"&&t.beforeAd&&(i.beforeAd=t.beforeAd),t.type!=="preroll"&&t.afterAd&&(i.afterAd=t.afterAd),t.type==="reward"&&t.beforeReward&&(i.beforeReward=t.beforeReward),t.type==="reward"&&t.adDismissed&&(i.adDismissed=t.adDismissed),t.type==="reward"&&t.adViewed&&(i.adViewed=t.adViewed),this.callbackMap.set(n,i),Ee("HuaweiQuickAdsAdBreak",{type:t.type,format:t.type==="reward"?"reward":"interstitial"}),this.sendPostMessage("huawei_quick_ads_ad_break",n,t)}catch(n){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}}adUnit(t){try{this.sendPostMessage("huawei_quick_ads_ad_unit",void 0,t)}catch(r){console.error("adUnit failed",r)}}sendPostMessage(t,r,n){var i;try{if(!((i=window.system)!=null&&i.postMessage))throw new Error("window.system.postMessage is not available");let o=Y(Y({type:t},r!==void 0&&{callbackId:r}),n!==void 0&&{data:n});window.system.postMessage(JSON.stringify(o))}catch(o){throw console.error("sendPostMessage failed",o),o}}};var mn=class e{constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}getAdsInstance(){return e.getInstance()}init(){}adConfig(t){t.onReady&&t.onReady()}adBreak(t){var r;try{t.type==="reward"?window.gdsdk.preloadAd("rewarded").then(()=>{var n;(n=t.beforeReward)==null||n.call(t,()=>{t.beforeAd&&t.beforeAd(),window.gdsdk.showAd("rewarded").then(i=>{var o,a,s,l,c;(o=i==null?void 0:i.args)!=null&&o.success?(a=t.adViewed)==null||a.call(t):(s=t.adDismissed)==null||s.call(t),t.afterAd&&t.afterAd(),(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:(l=i==null?void 0:i.args)!=null&&l.success?"viewed":"dismissed"})}).catch(i=>{var o;console.log("showReward error => ",i),(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})})})}).catch(n=>{var i;console.log("preloadAd error => ",n),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})}):(t.type!=="preroll"&&t.beforeAd&&t.beforeAd(),window.gdsdk.showAd("interstitial").then(()=>{var n;t.type!=="preroll"&&t.afterAd&&t.afterAd(),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:"interstitial",breakStatus:"viewed"})}))}catch(n){console.log("adBreak error => ",n),(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"error"})}}adUnit(){}};ge();var Qt=class{constructor(t,r){this.ads=t;this.httpClient=r}getAdsInstance(){return this.ads}init(t){this.ads.init(t)}adConfig(t){this.ads.adConfig(t)}adBreak(t){return A(this,null,function*(){var n,i;if((n=B.hostUserInfo)==null?void 0:n.isSubUser){this.wrapAdBreadDoneViewed(t);return}if(t.type==="reward")try{let o=yield at.getRewardsTypes(this.httpClient);if(!(yield at.handleReward(o,t)))throw new Error("handleReward failed: fallback to unlock failed")}catch(o){console.info("handleReward failed",o),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}else this.ads.adBreak(t)})}adUnit(t){this.ads.adUnit(t)}wrapAdBreadDoneViewed(t){var r,n,i;(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:"name"in t&&(r=t.name)!=null?r:"",breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in t&&((i=t.adViewed)==null||i.call(t))}};var vn=class e extends Qt{constructor(t,r){super(t,r),this.startTimes=Date.now()}adBreak(t){return A(this,null,function*(){var r,n;if(t.type!=="reward"){if(t.type==="preroll"){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let i=Date.now();if(console.log("FunmaxAdsHandler time => ",i-this.startTimes),i-this.startTimes<4e4){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}}El(e.prototype,this,"adBreak").call(this,t)})}};var $s=class{constructor(t){this.cacheHandler=null;this.context=t}createAdsHandler(t){if(this.cacheHandler)return this.cacheHandler;switch(t){case"dlightek":{this.cacheHandler=new hn(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=pn.getInstance();break}case"gamedistribution":{this.cacheHandler=mn.getInstance();break}case"funmax":{let r=new cn(this.context);this.cacheHandler=new vn(r,Gt);break}default:{let r=new cn(this.context);this.cacheHandler=new Qt(r,Gt);break}}return this.cacheHandler}getAdsHandler(t){return this.createAdsHandler(t)}},ro=Re(),cf=new nt,Gt=Qe.create(),Ny={httpClient:Gt,checkNetwork:()=>Qe.getNetworkStatus(),track:Ee,eventEmitter:cf,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:0}),handleLinkClicked:e=>{window.open(e,"_blank")},getContextInfo:()=>{var e,t,r,n,i,o,a,s,l;return{hostAppId:(t=(e=B.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(r=B.deviceInfo.did)!=null?r:"",adId:(n=B.deviceInfo.adId)!=null?n:"",sessionId:(i=B.sessionId)!=null?i:"",userId:(a=(o=B.hostUserInfo)==null?void 0:o.uid)!=null?a:"",objectType:"GAME",objectId:B.mpId,testAdsMode:B.testAdsMode,channel:(s=B.joliSource)!=null?s:"",deviceBrand:B.deviceInfo.brand,deviceModel:B.deviceInfo.model,osType:Be.isAndroid?"ANDROID":Be.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=B.joliSource)!=null?l:"",deviceInfo:{platform:"h5",nativeSDKVersionCode:0}}}},df=e=>{Je("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e}),Ee("jolicoin_unlock_success",{quantity:e.quantity})},Py=()=>{Ee("subscription_unlock_success",{})},Ly=new $s(Ny),gn=Ly.getAdsHandler(B.sdkEnvironment);at.registerRewardHandler("ADS",xc(gn.getAdsInstance()));at.registerRewardHandler("JOLI_COIN",Dc(Gt,{onUnlockSuccess:df.bind(void 0),hasSubscription:()=>!0}));at.registerRewardHandler("JOLI_COIN_ONLY",Nc(Gt,{onUnlockSuccess:df.bind(void 0),hasSubscription:()=>!0}));at.registerRewardHandler("SUBSCRIPTION",Bc(Gt,{onSubSuccess:Py.bind(void 0),hasSubscription:()=>!0}));ga(Gt);ui(Gt);cf.on("isAdShowing",e=>{Je("JOLIBOX_ADS_EVENT",{isAdShowing:e})});ro.registerCommand("AdsSDK.init",e=>{gn.init(e)});ro.registerCommand("AdsSDK.adConfig",e=>{gn.adConfig(e)});ro.registerCommand("AdsSDK.adBreak",e=>{gn.adBreak(e)});ro.registerCommand("AdsSDK.adUnit",e=>{gn.adUnit(e)});$();vt();Mr();var Ws=Re();Ws.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let e=performance.now();Je("CP_LOAD_FINISH",{duration:e}),Ee("loadFinished",{duration:e})});Ws.registerCommand("RuntimeSDK.loadProgressEvent",e=>{Je("CP_LOAD_PROGRESS",{progress:e}),console.log("RuntimeSDK.loadProgressEvent",e)});Ws.registerCommand("RuntimeSDK.gameTTIEvent",()=>{Je("CP_GAME_TTI",{duration:performance.now()}),Ee("gameTTI",{duration:performance.now()})});$();vt();var vf=-1,io=function(e){addEventListener("pageshow",function(t){t.persisted&&(vf=t.timeStamp,e(t))},!0)},Ys=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},oo=function(){var e=Ys();return e&&e.activationStart||0},Ir=function(e,t){var r=Ys(),n="navigate";return vf>=0?n="back-forward-cache":r&&(document.prerendering||oo()>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}},gf=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){}},Sr=function(e,t,r,n){var i,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=o,t.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(t.value,r),e(t))}},_f=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},yf=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},bf=function(e){var t=!1;return function(){t||(e(),t=!0)}},Er=-1,uf=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},no=function(e){document.visibilityState==="hidden"&&Er>-1&&(Er=e.type==="visibilitychange"?e.timeStamp:0,Uy())},ff=function(){addEventListener("visibilitychange",no,!0),addEventListener("prerenderingchange",no,!0)},Uy=function(){removeEventListener("visibilitychange",no,!0),removeEventListener("prerenderingchange",no,!0)},wf=function(){return Er<0&&(Er=uf(),ff(),io(function(){setTimeout(function(){Er=uf(),ff()},0)})),{get firstHiddenTime(){return Er}}},Xs=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},hf=[1800,3e3],Af=function(e,t){t=t||{},Xs(function(){var r,n=wf(),i=Ir("FCP"),o=gf("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-oo(),0),i.entries.push(s),r(!0)))})});o&&(r=Sr(e,i,hf,t.reportAllChanges),io(function(a){i=Ir("FCP"),r=Sr(e,i,hf,t.reportAllChanges),_f(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})};var By=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=bf(e),document.visibilityState==="hidden"?e():(r=t(e),yf(e)),r};var pf=[2500,4e3],zs={},Ef=function(e,t){t=t||{},Xs(function(){var r,n=wf(),i=Ir("LCP"),o=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-oo(),0),i.entries=[c],r())})},a=gf("largest-contentful-paint",o);if(a){r=Sr(e,i,pf,t.reportAllChanges);var s=bf(function(){zs[i.id]||(o(a.takeRecords()),a.disconnect(),zs[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return By(s)},{once:!0,capture:!0})}),yf(s),io(function(l){i=Ir("LCP"),r=Sr(e,i,pf,t.reportAllChanges),_f(function(){i.value=performance.now()-l.timeStamp,zs[i.id]=!0,r(!0)})})}})},mf=[800,1800],My=function e(t){document.prerendering?Xs(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},If=function(e,t){t=t||{};var r=Ir("TTFB"),n=Sr(e,r,mf,t.reportAllChanges);My(function(){var i=Ys();i&&(r.value=Math.max(i.responseStart-oo(),0),r.entries=[i],n(!0),io(function(){r=Ir("TTFB",0),(n=Sr(e,r,mf,t.reportAllChanges))(!0)}))})};ge();nr();pt();$();Mr();$();var ao=new Map,Sf=!1,Gy=()=>{Sf||(Vt("ON_JOLIBOX_GET_USER_SUB_STATUS",e=>{let t=ao.get(e.sequenceId);if(t){clearTimeout(t.timeoutId);let{isSubUser:r,userId:n}=e;t.resolve({isSubUser:r,userId:n}),ao.delete(e.sequenceId)}}),Sf=!0)};function Qs(){return A(this,null,function*(){return Gy(),new Promise((e,t)=>{let r=Xe(),n=setTimeout(()=>{ao.delete(r),t(new Error("Timeout waiting for user sub status response"))},3e3);ao.set(r,{resolve:e,reject:t,timeoutId:n}),Je("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:r})})})}function Cf(){return A(this,null,function*(){let e=Qe.create();try{let t=yield e.get("/api/users/info");return!(t.code!=="SUCCESS"||!t.data)}catch(t){return Ve(new Sn(t)),!1}})}function Jy(){Af(e=>{Ee("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Ef(e=>{Ee("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),If(e=>{Ee("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function Fy(){Dt.on("onDocumentReady",e=>A(this,null,function*(){let t=yield Cf(),{isSubUser:r,userId:n}=yield Qs().catch(()=>({isSubUser:!1,userId:void 0}));B.onEnvConfigChanged({hostUserInfo:{isLogin:t,isSubUser:r,uid:n}}),Dt.emit("LifecycleEvent.onReady",Y({},B.hostUserInfo?B.hostUserInfo:{isLogin:!1})),B.mpType==="game"&&Ze.start(Date.now()-e)}))}function Rf(){Fy(),Jy()}Rf();
|
|
303
|
+
`,Ay=e=>{let{onReady:t,state:r}=e,{visible:n,retry:i,canRetry:o,videoRef:a,adContainerRef:s}=r,l=()=>{i.value&&(i.value(),he(()=>{i.value=null,o.value=!1}))};return Pt(()=>{t()},[t]),K("div",{className:wy,style:{display:n.value?"block":"none"},children:K("div",{className:"ads-wrapper",children:[K("video",{ref:a,width:"100%",height:"100%",playsInline:!0,"webkit-playsinline":"true",poster:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAAD0lEQVR4AQEEAPv/AAAAAAAEAAFlScNgAAAAAElFTkSuQmCC",style:{transition:"none !important",transform:"none !important",animation:"none !important",objectFit:"contain"}}),K("div",{id:"ad-container",ref:s}),o.value?K("div",{className:"retry-button",onClick:l,children:K("svg",{width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[K("circle",{cx:"32",cy:"32",r:"32",fill:"#141416",fillOpacity:"0.3"}),K("path",{d:"M25.3334 23.3668V40.6334C25.3334 41.9501 26.7834 42.7501 27.9 42.0334L41.4667 33.4001C42.5 32.7501 42.5 31.2501 41.4667 30.5834L27.9 21.9668C26.7834 21.2501 25.3334 22.0501 25.3334 23.3668Z",fill:"white"})]})}):null]})})};function kt(e,t,r){return(t=Ey(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ey(e){var t=Iy(e,"string");return typeof t=="symbol"?t:t+""}function Iy(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 Js=class{constructor(t){kt(this,"name","GOOGLE_IMA"),kt(this,"context",void 0),kt(this,"adsOverlay",null),kt(this,"initialized",!1),kt(this,"ima",null),kt(this,"state",by()),kt(this,"init",r=>A(this,null,function*(){if(this.initialized)return;let n="//imasdk.googleapis.com/js/sdkloader/ima3.js";yield new Promise((i,o)=>{if(document.querySelector("#google-ima-sdk")){i();return}else{let a=document.createElement("script");a.id="google-ima-sdk",a.src=n,a.onload=()=>{var s;(s=window.google)!=null&&s.ima?i():setTimeout(i,100)},a.onerror=o,document.head.appendChild(a)}}),this.adsOverlay=document.createElement("div"),this.adsOverlay.id="jolibox-ima-overlay",document.documentElement.appendChild(this.adsOverlay),yield new Promise((i,o)=>{st(K(Ay,{state:this.state,onReady:()=>{this.ima=new Gs(r.params.url,this.state.videoRef.current,this.state.adContainerRef.current),i()}}),this.adsOverlay)}),this.initialized=!0})),kt(this,"destroy",()=>{this.adsOverlay&&(st(null,this.adsOverlay),this.adsOverlay.remove()),this.ima&&this.ima.destroy(),this.initialized=!1}),kt(this,"requestAd",(r,n)=>{var i;if(!this.adsOverlay||!this.ima||!this.initialized){let h=Ne.from(new Error("IMA not initialized"),"JOLIBOX_IMA_ERROR");(i=r.onAdError)==null||i.call(r,h);return}let o=h=>{var d;this.ima.destroy(),this.state.visible.value=!1,(d=r.onAdCompleted)==null||d.call(r,h)},a=h=>{var d;let p=!1;switch(h.raw.getErrorCode()){case qi.AUTOPLAY_DISALLOWED:case qi.VIDEO_PLAY_ERROR:case qi.ADS_REQUEST_NETWORK_ERROR:{p=!0;break}default:{p=!1;break}}if(!p)this.ima.destroy(),he(()=>{this.state.canRetry.value=!1,this.state.retry.value=null,this.state.visible.value=!1}),(d=r.onAdError)==null||d.call(r,h);else{let m=()=>{this.ima.destroy(),this.requestAd(r,n)};he(()=>{this.state.canRetry.value=!0,this.state.retry.value=m})}},s=h=>{var d;this.state.visible.value=!0,(d=r.onAdLoaded)==null||d.call(r,h)},l=h=>{var d;(d=r.onAdPlaying)==null||d.call(r,h)},c=Object.assign({},r);c.onAdCompleted=o,c.onAdError=a,c.onAdLoaded=s,c.onAdPlaying=l,this.ima.requestAds(c,n)}),this.context=t}};function lt(e,t,r){return(t=Sy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Sy(e){var t=Cy(e,"string");return typeof t=="symbol"?t:t+""}function Cy(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 Fs=class{constructor(t){lt(this,"name","OKSPIN"),lt(this,"initialized",!1),lt(this,"initCompleter",null),lt(this,"context",void 0),lt(this,"adsOverlay",null),lt(this,"adsIsShowing",!1),lt(this,"state",Zu()),lt(this,"init",r=>A(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv"),st(K(ef,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),lt(this,"destroy",()=>{var r;this.adsOverlay&&(st(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),lt(this,"requestAd",(r,n)=>{var i,o,a,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,Ne.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(o=r.onAdError)==null||o.call(r,Ne.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(a=r.onAdRequested)==null||a.call(r);let l=()=>{var h;this.adsIsShowing=!1,(h=r.onAdCompleted)==null||h.call(r,void 0)},c=()=>{var h;(h=r.onAdLoaded)==null||h.call(r,void 0)};this.adsIsShowing=!0,he(()=>{var h;this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.countdown.value=(h=n.params.countdown)!=null?h:15,this.state.src.value=n.params.url,this.state.mode.value="rewarded_insterstitial",this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function rt(e,t,r){return(t=Ry(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ry(e){var t=ky(e,"string");return typeof t=="symbol"?t:t+""}function ky(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 qs=class{constructor(t){rt(this,"name","APPSROCKETS"),rt(this,"initialized",!1),rt(this,"initCompleter",null),rt(this,"context",void 0),rt(this,"adsOverlay",null),rt(this,"adsIsShowing",!1),rt(this,"state",tf()),rt(this,"processUrl",r=>{var n;let i=this.context.getContextInfo(),o=new URL(r),a=new URLSearchParams(o.search);return a.has("joliSource")||a.set("joliSource",i.joliSource),a.get("osType")||a.set("osType",i.osType),a.get("runtimeType")||a.set("runtimeType",i.runtimeType),a.get("mode")||a.set("mode","AFV"),a.get("deviceId")||a.set("deviceId",i.deviceId),a.get("statusBarHeight")||a.set("statusBarHeight",((n=this.context.getWindowInfo().statusBarHeight)!=null?n:0).toString()),a.get("adsType")||a.set("adsType","REWARD_INTERSTITIAL"),o.search=a.toString(),o.toString()}),rt(this,"init",r=>A(this,null,function*(){var n;this.initialized||(this.adsOverlay=document.createElement("div"),this.adsOverlay.setAttribute("data-placement-info","afv-appsrockets"),st(K(rf,{state:this.state}),this.adsOverlay),document.documentElement.appendChild(this.adsOverlay),this.initialized=!0,(n=this.initCompleter)==null||n.call(this))})),rt(this,"destroy",()=>{var r;this.adsOverlay&&(st(null,this.adsOverlay),(r=this.adsOverlay)==null||r.remove()),this.initialized=!1}),rt(this,"requestAd",(r,n)=>{var i,o,a,s;if(!this.adsOverlay||!this.initialized){(i=r.onAdError)==null||i.call(r,Ne.from(new Error("Ads not initialized"),"JOLIBOX_IMA_ERROR"));return}if(this.adsIsShowing){(o=r.onAdError)==null||o.call(r,Ne.from(new Error("Ads already showing"),"JOLIBOX_IMA_ERROR"));return}(a=r.onAdRequested)==null||a.call(r);let l=()=>{var p;this.adsIsShowing=!1,(p=r.onAdCompleted)==null||p.call(r,void 0)},c=()=>{var p;(p=r.onAdLoaded)==null||p.call(r,void 0)},h=p=>{var m,b;(b=(m=this.context).handleLinkClicked)==null||b.call(m,p)},d=()=>{var p;(p=r.onAdError)==null||p.call(r,Ne.from(new Error("Ads load error"),"JOLIBOX_IMA_ERROR"))};this.adsIsShowing=!0,he(()=>{this.state.adLoaded.value=c,this.state.adBreakDone.value=l,this.state.adLinkClicked.value=h,this.state.adError.value=d,this.state.src.value=this.processUrl(n.params.url),this.state.visible.value=!0}),(s=r.onAdPlaying)==null||s.call(r,void 0)}),this.context=t}};function Ut(e,t,r){return(t=Oy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Oy(e){var t=Ty(e,"string");return typeof t=="symbol"?t:t+""}function Ty(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 js=class{constructor(t){Ut(this,"name","GOOGLE_GPT"),Ut(this,"context",void 0),Ut(this,"contextInfo",void 0),Ut(this,"rewardAdManager",void 0),Ut(this,"init",r=>A(this,null,function*(){if(!this.rewardAdManager){let n=this.contextInfo.testAdsMode?"/22639388115/rewarded_web_example":r.params.rewardedSlot,i=`minidrama-${this.contextInfo.runtimeType==="APP"?"app":"h5"}`;this.rewardAdManager=new of(n,i,r.params.keyValue)}})),Ut(this,"insertScript",()=>{let r="jolibox-google-gpt",n=document.getElementById(r);n||(n=window.document.createElement("script"),n.id=r,n.async=!0,n.src="https://securepubads.g.doubleclick.net/tag/js/gpt.js",n.crossOrigin="anonymous",document.head.appendChild(n))}),Ut(this,"destroy",()=>{var r;(r=this.rewardAdManager)==null||r.withCommand(()=>{var n;(n=this.rewardAdManager)==null||n.destroy("ignored")})}),Ut(this,"requestAd",(r,n)=>{var i;if(!this.rewardAdManager){(i=r.onAdError)==null||i.call(r,Ne.from(new Error("rewardAdManager not initialized"),"JOLIBOX_IMA_ERROR"));return}this.rewardAdManager.requestAds({beforeAd:r.onAdRequested,beforeReward:o=>{var a,s;(a=r.onAdLoaded)==null||a.call(r,void 0),o(),(s=r.onAdPlaying)==null||s.call(r,void 0)},adDismissed:()=>{},adViewed:()=>{},adBreakDone:o=>{var a,s;switch(o){case"viewed":{(a=r.onAdCompleted)==null||a.call(r,void 0);break}case"ignored":break;default:{(s=r.onAdError)==null||s.call(r,Ne.from(new Error(o),"JOLIBOX_IMA_ERROR"));break}}}})}),this.context=t,this.contextInfo=t.getContextInfo(),this.insertScript()}};function ct(e,t,r){return(t=xy(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function xy(e){var t=Dy(e,"string");return typeof t=="symbol"?t:t+""}function Dy(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 Xi=class e{constructor(t){if(ct(this,"context",void 0),ct(this,"contextInfo",void 0),ct(this,"providers",{}),ct(this,"requestContext",void 0),ct(this,"adsRequest",void 0),ct(this,"initialized",!1),ct(this,"preloadedAd",null),ct(this,"shouldCache",!1),t)this.context=t,this.requestContext=new cn(t),this.adsRequest=new zi(t,{reward:!1,interstitial:!1,afv:!1}),this.contextInfo=this.context.getContextInfo();else throw new Error("JoliboxAdsForVideo requires a configuration object")}init(){return A(this,arguments,function*(){var t;let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,n,i=sessionStorage.getItem(e.STORAGE_KEY_INIT);if(i){sessionStorage.removeItem(e.STORAGE_KEY_INIT);try{n=JSON.parse(i)}catch(o){}}if(n!=null&&n.length||(L.log("[Jolibox SDK Ads][Trace][AFV] init /api/ads/init request",{contextData:this.requestContext.getRequestContextData("AdsAFVSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}),n=(yield this.context.httpClient.post("/api/ads/init",{data:{contextData:this.requestContext.getRequestContextData("AdsAFVSDKInit"),bizParams:this.requestContext.getRequestBizParams(),testAdsMode:this.contextInfo.testAdsMode}})).data,L.log("[Jolibox SDK Ads][Trace][AFV] init /api/ads/init response",{length:(t=n==null?void 0:n.length)!=null?t:null,data:n})),r&&n!=null&&n.length)try{sessionStorage.setItem(e.STORAGE_KEY_INIT,JSON.stringify(n))}catch(o){}if((n==null?void 0:n.length)>0)for(let o of n)switch(o.provider){case"GOOGLE_GPT":{let a=new js(this.context);yield a.init(o),this.providers.GOOGLE_GPT=a;break}case"GOOGLE_IMA":{let a=new Js(this.context);yield a.init(o),this.providers.GOOGLE_IMA=a;break}case"OKSPIN":{let a=new Fs(this.context);yield a.init(o),this.providers.OKSPIN=a;break}case"APPSROCKETS":{let a=new qs(this.context);yield a.init(o),this.providers.APPSROCKETS=a;break}}this.adsRequest.cacheAFVInfo(),this.initialized=!0,this.shouldCache=r,this.preload()})}preload(){let t=sessionStorage.getItem(e.STORAGE_KEY_INFO);if(t){sessionStorage.removeItem(e.STORAGE_KEY_INFO);try{this.preloadedAd=JSON.parse(t);return}catch(r){}}this.adsRequest.getAFVAdsInfo(!0).then(r=>{if(L.log("[Jolibox SDK Ads][Trace][AFV] preload adsInfo",r),this.preloadedAd=r,this.shouldCache&&r)try{sessionStorage.setItem(e.STORAGE_KEY_INFO,JSON.stringify(r))}catch(n){}}).catch(()=>{this.preloadedAd=null})}destroy(){let t=Object.values(this.providers);for(let r of t)r.destroy();this.initialized=!1,this.preloadedAd=null}requestAd(t){return A(this,null,function*(){var r,n,i,o,a,s,l,c,h,d,p,m;if((r=this.context.eventEmitter)==null||r.emit("isAdShowing",!0),this.initialized||(yield this.init()),!this.context.checkNetwork()){let b=Ne.from(new Error("No network connection"),"JOLIBOX_IMA_ERROR");(n=t.onAdError)==null||n.call(t,b);return}try{L.log("[Jolibox SDK Ads][Trace][AFV] requestAd preloadedAd",this.preloadedAd);let b=(i=this.preloadedAd)!=null?i:yield this.adsRequest.getAFVAdsInfo(!0);this.preloadedAd=null;let E=b==null?void 0:b.code,I=b==null?void 0:b.data;if(E==="BYPASS_ADS"){(o=t.onAdRequested)==null||o.call(t),(a=t.onAdLoaded)==null||a.call(t,void 0),(s=t.onAdPlaying)==null||s.call(t,void 0),(l=t.onAdCompleted)==null||l.call(t,void 0);return}if(I){let w=I.sort((M,S)=>M.seq-S.seq);if(w.length===0){let M=Ne.from(new Error("No ads available"),"JOLIBOX_IMA_ERROR");(h=t.onAdError)==null||h.call(t,M);return}let R=!0,k=null,P=new Ms(this.context);for(;w.length>0;){let M=w.shift(),S=this.providers[M.provider];if(S){let[D,F]=yield P.callAdRequestAndContinue(S,t,M);R=D,k=F}else R=!0,k=Ne.from(new Error("No provider available"),"JOLIBOX_IMA_ERROR");if(!R)break}R&&k&&((d=t.onAdError)==null||d.call(t,k))}else{let w=Ne.from(new Error("Unknown error"),"JOLIBOX_IMA_ERROR");(c=t.onAdError)==null||c.call(t,w);return}}catch(b){let E=Ne.from(new Error("Failed to request ad"),"JOLIBOX_IMA_ERROR");(p=t.onAdError)==null||p.call(t,E)}finally{(m=this.context.eventEmitter)==null||m.emit("isAdShowing",!1),this.preload()}})}};ct(Xi,"STORAGE_KEY_INIT","jolibox_afv_init_data");ct(Xi,"STORAGE_KEY_INFO","jolibox_afv_info_data");ge();var IR=wo(lf());var pn=class{constructor(t){this.ads=t}getAdsInstance(){return this.ads}init(){}adConfig(t){var r,n;(n=(r=this.ads)==null?void 0:r.adConfig)==null||n.call(r,t)}adBreak(t){this.ads.adBreak(t)}adUnit(){}};vt();var mn=class e{constructor(){this.callbacksId=0,this.callbackMap=new Map,this.initOnMessage()}static getInstance(){return e.instance||(e.instance=new e),e.instance}initOnMessage(){window.addEventListener("message",t=>{var r,n,i,o,a,s,l,c,h;if(console.log(`HuaweiQuickAdsHandler,event => ${t}`),t.origin==window.location.origin&&t.data&&t.data.type==null){let d=JSON.parse(t.data);switch(console.log(`HuaweiQuickAdsHandler type => ${d.type}`),d.type){case"huawei_quick_ads_on_message_init":console.log("HuaweiQuickAdsHandler window.addEventListener init",d);break;case"huawei_quick_ads_on_message_ad_config":{let p=d.callbackId;if(p){let m=this.callbackMap.get(p);(r=m==null?void 0:m.onReady)==null||r.call(m)}console.log("HuaweiQuickAdsHandler window.addEventListener adConfig",d)}break;case"huawei_quick_ads_on_message_ad_break":{let p=d.callbackId;if(p){let m=this.callbackMap.get(p),b="noAdPreloaded",E=!1;switch(d.adsRes){case"viewed":b="viewed",(n=m==null?void 0:m.adViewed)==null||n.call(m),E=!1;break;case"dismissed":b="dismissed",(i=m==null?void 0:m.adDismissed)==null||i.call(m),E=!1;break;case"notReady":case"timeout":case"error":case"noAdPreloaded":case"frequencyCapped":case"ignored":case"other":b=d.adsRes,E=!0;break;case"breakDone":b=d.params,E=!0;break;case"beforeReward":(o=m==null?void 0:m.beforeReward)==null||o.call(m,()=>{window.system.postMessage(JSON.stringify({type:"huawei_quick_ads_ad_operation"})),console.log("HuaweiQuickAdsHandler beforeReward postMessage AD_OPERATION")}),E=!1;break;case"beforeAd":Ee("HuaweiQuickAdsAdBreakBeforeAd",{type:"beforeAd",format:(m==null?void 0:m.breakType)==="reward"?"reward":"interstitial"}),(a=m==null?void 0:m.beforeAd)==null||a.call(m),E=!1;break;case"afterAd":(s=m==null?void 0:m.afterAd)==null||s.call(m),E=!1;break}E&&((h=m==null?void 0:m.adBreakDone)==null||h.call(m,{breakType:(l=m.breakType)!=null?l:"",breakName:m.breakName,breakFormat:(c=m.breakFormat)!=null?c:"interstitial",breakStatus:b}))}console.log("HuaweiQuickAdsHandler window.addEventListener adBreak",d)}break;case"huawei_quick_ads_on_message_ad_unit":console.log("HuaweiQuickAdsHandler window.addEventListener adUnit",d);break;default:break}}})}getAdsInstance(){return e.getInstance()}init(t){try{this.sendPostMessage("huawei_quick_ads_init",void 0,t)}catch(r){console.error("init failed",r)}}adConfig(t){try{let r;t.onReady&&(r=++this.callbacksId,this.callbackMap.set(r,{onReady:t.onReady})),this.sendPostMessage("huawei_quick_ads_ad_config",r,t)}catch(r){console.error("adConfig failed",r)}}adBreak(t){var r;try{let n=++this.callbacksId,i={};i.breakType=t.type,t.type!=="preroll"&&t.name&&(i.breakName=t.name),i.breakFormat=t.type==="reward"?"reward":"interstitial",t.adBreakDone&&(i.adBreakDone=t.adBreakDone),t.type!=="preroll"&&t.beforeAd&&(i.beforeAd=t.beforeAd),t.type!=="preroll"&&t.afterAd&&(i.afterAd=t.afterAd),t.type==="reward"&&t.beforeReward&&(i.beforeReward=t.beforeReward),t.type==="reward"&&t.adDismissed&&(i.adDismissed=t.adDismissed),t.type==="reward"&&t.adViewed&&(i.adViewed=t.adViewed),this.callbackMap.set(n,i),Ee("HuaweiQuickAdsAdBreak",{type:t.type,format:t.type==="reward"?"reward":"interstitial"}),this.sendPostMessage("huawei_quick_ads_ad_break",n,t)}catch(n){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}}adUnit(t){try{this.sendPostMessage("huawei_quick_ads_ad_unit",void 0,t)}catch(r){console.error("adUnit failed",r)}}sendPostMessage(t,r,n){var i;try{if(!((i=window.system)!=null&&i.postMessage))throw new Error("window.system.postMessage is not available");let o=Y(Y({type:t},r!==void 0&&{callbackId:r}),n!==void 0&&{data:n});window.system.postMessage(JSON.stringify(o))}catch(o){throw console.error("sendPostMessage failed",o),o}}};var vn=class e{constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}getAdsInstance(){return e.getInstance()}init(){}adConfig(t){t.onReady&&t.onReady()}adBreak(t){var r;try{t.type==="reward"?window.gdsdk.preloadAd("rewarded").then(()=>{var n;(n=t.beforeReward)==null||n.call(t,()=>{t.beforeAd&&t.beforeAd(),window.gdsdk.showAd("rewarded").then(i=>{var o,a,s,l,c;(o=i==null?void 0:i.args)!=null&&o.success?(a=t.adViewed)==null||a.call(t):(s=t.adDismissed)==null||s.call(t),t.afterAd&&t.afterAd(),(c=t.adBreakDone)==null||c.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:(l=i==null?void 0:i.args)!=null&&l.success?"viewed":"dismissed"})}).catch(i=>{var o;console.log("showReward error => ",i),(o=t.adBreakDone)==null||o.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})})})}).catch(n=>{var i;console.log("preloadAd error => ",n),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakName:t.name,breakFormat:"reward",breakStatus:"noAdPreloaded"})}):(t.type!=="preroll"&&t.beforeAd&&t.beforeAd(),window.gdsdk.showAd("interstitial").then(()=>{var n;t.type!=="preroll"&&t.afterAd&&t.afterAd(),(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:"interstitial",breakStatus:"viewed"})}))}catch(n){console.log("adBreak error => ",n),(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakName:t.type==="preroll"?void 0:t.name,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"error"})}}adUnit(){}};ge();var Qt=class{constructor(t,r){this.ads=t;this.httpClient=r}getAdsInstance(){return this.ads}init(t){this.ads.init(t)}adConfig(t){this.ads.adConfig(t)}adBreak(t){return A(this,null,function*(){var n,i;if((n=B.hostUserInfo)==null?void 0:n.isSubUser){this.wrapAdBreadDoneViewed(t);return}if(t.type==="reward")try{let o=yield at.getRewardsTypes(this.httpClient);if(!(yield at.handleReward(o,t)))throw new Error("handleReward failed: fallback to unlock failed")}catch(o){console.info("handleReward failed",o),(i=t.adBreakDone)==null||i.call(t,{breakType:t.type,breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"noAdPreloaded"})}else this.ads.adBreak(t)})}adUnit(t){this.ads.adUnit(t)}wrapAdBreadDoneViewed(t){var r,n,i;(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakName:"name"in t&&(r=t.name)!=null?r:"",breakFormat:t.type==="reward"?"reward":"interstitial",breakStatus:"viewed"}),"adViewed"in t&&((i=t.adViewed)==null||i.call(t))}};var gn=class e extends Qt{constructor(t,r){super(t,r),this.startTimes=Date.now()}adBreak(t){return A(this,null,function*(){var r,n;if(t.type!=="reward"){if(t.type==="preroll"){(r=t.adBreakDone)==null||r.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}let i=Date.now();if(console.log("FunmaxAdsHandler time => ",i-this.startTimes),i-this.startTimes<4e4){(n=t.adBreakDone)==null||n.call(t,{breakType:t.type,breakFormat:"interstitial",breakStatus:"noAdPreloaded"});return}}Il(e.prototype,this,"adBreak").call(this,t)})}};var Ws=class{constructor(t){this.cacheHandler=null;this.context=t}createAdsHandler(t){if(this.cacheHandler)return this.cacheHandler;switch(t){case"dlightek":{this.cacheHandler=new pn(window.h5sdk);break}case"huaweiQuick":{this.cacheHandler=mn.getInstance();break}case"gamedistribution":{this.cacheHandler=vn.getInstance();break}case"funmax":{let r=new dn(this.context);this.cacheHandler=new gn(r,Gt);break}default:{let r=new dn(this.context);this.cacheHandler=new Qt(r,Gt);break}}return this.cacheHandler}getAdsHandler(t){return this.createAdsHandler(t)}},no=Re(),cf=new nt,Gt=Qe.create(),Ny={httpClient:Gt,checkNetwork:()=>Qe.getNetworkStatus(),track:Ee,eventEmitter:cf,getWindowInfo:()=>({width:window.innerWidth*window.devicePixelRatio,height:window.innerHeight*window.devicePixelRatio,statusBarHeight:0}),handleLinkClicked:e=>{window.open(e,"_blank")},getContextInfo:()=>{var e,t,r,n,i,o,a,s,l;return{hostAppId:(t=(e=B.hostInfo)==null?void 0:e.aid)!=null?t:"1",deviceId:(r=B.deviceInfo.did)!=null?r:"",adId:(n=B.deviceInfo.adId)!=null?n:"",sessionId:(i=B.sessionId)!=null?i:"",userId:(a=(o=B.hostUserInfo)==null?void 0:o.uid)!=null?a:"",objectType:"GAME",objectId:B.mpId,testAdsMode:B.testAdsMode,channel:(s=B.joliSource)!=null?s:"",deviceBrand:B.deviceInfo.brand,deviceModel:B.deviceInfo.model,osType:Be.isAndroid?"ANDROID":Be.isiOS?"IOS":"PC",runtimeType:"WEB",platform:1e3,joliSource:(l=B.joliSource)!=null?l:"",deviceInfo:{platform:"h5",nativeSDKVersionCode:0}}}},df=e=>{Je("JOLIBOX_CUSTOM_REWARDS_EVENT",{JOLI_COIN:e}),Ee("jolicoin_unlock_success",{quantity:e.quantity})},Py=()=>{Ee("subscription_unlock_success",{})},Ly=new Ws(Ny),_n=Ly.getAdsHandler(B.sdkEnvironment);at.registerRewardHandler("ADS",xc(_n.getAdsInstance()));at.registerRewardHandler("JOLI_COIN",Nc(Gt,{onUnlockSuccess:df.bind(void 0),hasSubscription:()=>!0}));at.registerRewardHandler("JOLI_COIN_ONLY",Pc(Gt,{onUnlockSuccess:df.bind(void 0),hasSubscription:()=>!0}));at.registerRewardHandler("SUBSCRIPTION",Mc(Gt,{onSubSuccess:Py.bind(void 0),hasSubscription:()=>!0}));_a(Gt);fi(Gt);cf.on("isAdShowing",e=>{Je("JOLIBOX_ADS_EVENT",{isAdShowing:e})});no.registerCommand("AdsSDK.init",e=>{_n.init(e)});no.registerCommand("AdsSDK.adConfig",e=>{_n.adConfig(e)});no.registerCommand("AdsSDK.adBreak",e=>{_n.adBreak(e)});no.registerCommand("AdsSDK.adUnit",e=>{_n.adUnit(e)});$();vt();Gr();var zs=Re();zs.registerCommand("RuntimeSDK.loadFinishedEvent",()=>{let e=performance.now();Je("CP_LOAD_FINISH",{duration:e}),Ee("loadFinished",{duration:e})});zs.registerCommand("RuntimeSDK.loadProgressEvent",e=>{Je("CP_LOAD_PROGRESS",{progress:e}),console.log("RuntimeSDK.loadProgressEvent",e)});zs.registerCommand("RuntimeSDK.gameTTIEvent",()=>{Je("CP_GAME_TTI",{duration:performance.now()}),Ee("gameTTI",{duration:performance.now()})});$();vt();var vf=-1,oo=function(e){addEventListener("pageshow",function(t){t.persisted&&(vf=t.timeStamp,e(t))},!0)},Xs=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ao=function(){var e=Xs();return e&&e.activationStart||0},Sr=function(e,t){var r=Xs(),n="navigate";return vf>=0?n="back-forward-cache":r&&(document.prerendering||ao()>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}},gf=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){}},Cr=function(e,t,r,n){var i,o;return function(a){t.value>=0&&(a||n)&&((o=t.value-(i||0))||i===void 0)&&(i=t.value,t.delta=o,t.rating=function(s,l){return s>l[1]?"poor":s>l[0]?"needs-improvement":"good"}(t.value,r),e(t))}},_f=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},yf=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},bf=function(e){var t=!1;return function(){t||(e(),t=!0)}},Ir=-1,uf=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},io=function(e){document.visibilityState==="hidden"&&Ir>-1&&(Ir=e.type==="visibilitychange"?e.timeStamp:0,Uy())},ff=function(){addEventListener("visibilitychange",io,!0),addEventListener("prerenderingchange",io,!0)},Uy=function(){removeEventListener("visibilitychange",io,!0),removeEventListener("prerenderingchange",io,!0)},wf=function(){return Ir<0&&(Ir=uf(),ff(),oo(function(){setTimeout(function(){Ir=uf(),ff()},0)})),{get firstHiddenTime(){return Ir}}},Qs=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},hf=[1800,3e3],Af=function(e,t){t=t||{},Qs(function(){var r,n=wf(),i=Sr("FCP"),o=gf("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-ao(),0),i.entries.push(s),r(!0)))})});o&&(r=Cr(e,i,hf,t.reportAllChanges),oo(function(a){i=Sr("FCP"),r=Cr(e,i,hf,t.reportAllChanges),_f(function(){i.value=performance.now()-a.timeStamp,r(!0)})}))})};var By=function(e){var t=self.requestIdleCallback||self.setTimeout,r=-1;return e=bf(e),document.visibilityState==="hidden"?e():(r=t(e),yf(e)),r};var pf=[2500,4e3],Ys={},Ef=function(e,t){t=t||{},Qs(function(){var r,n=wf(),i=Sr("LCP"),o=function(l){t.reportAllChanges||(l=l.slice(-1)),l.forEach(function(c){c.startTime<n.firstHiddenTime&&(i.value=Math.max(c.startTime-ao(),0),i.entries=[c],r())})},a=gf("largest-contentful-paint",o);if(a){r=Cr(e,i,pf,t.reportAllChanges);var s=bf(function(){Ys[i.id]||(o(a.takeRecords()),a.disconnect(),Ys[i.id]=!0,r(!0))});["keydown","click"].forEach(function(l){addEventListener(l,function(){return By(s)},{once:!0,capture:!0})}),yf(s),oo(function(l){i=Sr("LCP"),r=Cr(e,i,pf,t.reportAllChanges),_f(function(){i.value=performance.now()-l.timeStamp,Ys[i.id]=!0,r(!0)})})}})},mf=[800,1800],My=function e(t){document.prerendering?Qs(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},If=function(e,t){t=t||{};var r=Sr("TTFB"),n=Cr(e,r,mf,t.reportAllChanges);My(function(){var i=Xs();i&&(r.value=Math.max(i.responseStart-ao(),0),r.entries=[i],n(!0),oo(function(){r=Sr("TTFB",0),(n=Cr(e,r,mf,t.reportAllChanges))(!0)}))})};ge();nr();pt();$();Gr();$();var so=new Map,Sf=!1,Gy=()=>{Sf||(Vt("ON_JOLIBOX_GET_USER_SUB_STATUS",e=>{let t=so.get(e.sequenceId);if(t){clearTimeout(t.timeoutId);let{isSubUser:r,userId:n}=e;t.resolve({isSubUser:r,userId:n}),so.delete(e.sequenceId)}}),Sf=!0)};function Zs(){return A(this,null,function*(){return Gy(),new Promise((e,t)=>{let r=Xe(),n=setTimeout(()=>{so.delete(r),t(new Error("Timeout waiting for user sub status response"))},3e3);so.set(r,{resolve:e,reject:t,timeoutId:n}),Je("JOLIBOX_GET_USER_SUB_STATUS",{sequenceId:r})})})}function Cf(){return A(this,null,function*(){let e=Qe.create();try{let t=yield e.get("/api/users/info");return!(t.code!=="SUCCESS"||!t.data)}catch(t){return Ve(new Cn(t)),!1}})}function Jy(){Af(e=>{Ee("GameFCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),Ef(e=>{Ee("GameLCP",{value:e.value,rating:e.rating,navigationType:e.navigationType})}),If(e=>{Ee("GameTTFB",{value:e.value,rating:e.rating,navigationType:e.navigationType})})}function Fy(){Dt.on("onDocumentReady",e=>A(this,null,function*(){let t=yield Cf(),{isSubUser:r,userId:n}=yield Zs().catch(()=>({isSubUser:!1,userId:void 0}));B.onEnvConfigChanged({hostUserInfo:{isLogin:t,isSubUser:r,uid:n}}),Dt.emit("LifecycleEvent.onReady",Y({},B.hostUserInfo?B.hostUserInfo:{isLogin:!1})),B.mpType==="game"&&Ze.start(Date.now()-e)}))}function Rf(){Fy(),Jy()}Rf();
|
|
304
304
|
/*! Bundled license information:
|
|
305
305
|
|
|
306
306
|
localforage/dist/localforage.js:
|